Applied all mainline PCem commits;
Added experimental NVidia Riva TNT2 emulation (patch from MoochMcGee); ASUS P/I-P54TP4XE, ASUS P/I-P55T2P4, and ASUS P/I-P55TVP4 are back; National Semiconductor PC87306 Super I/O chip now correctly reenables devices after a chip power cycle; Several FDC improvements and the behavior is now a bit closer to real hardware (based on actual tests); Added MR Intel Advanced/ATX with Microid Research BIOS with support for 4 floppy drives and up to 4 IDE controllers; Added floppy drives 3 and 4, bringing the maximum to 4; You can now connect hard disks to the tertiary IDE controller; Correct undocumented behavior of the LEA instruction with register is back on 286 and later CPU's; Pentium-rea models with Intel chipsets now have port 92 (with alternate reset and alternate A20 toggle); Overhauled DMA channel read and write routines and fixed cascading; Improved IMG detection of a bad BPB (or complete lack of a BPB); Added preliminary emulation of PS/2 1.44 MB and PC-98 1.25 MB 3-mode drives (both have an inverted DENSEL pin); Removed the incorrect Amstrad mouse patch from TheCollector1995; Fixed ATAPI CD-ROM disk change detection; Windows IOCTL CD-ROM handler now tries to use direct SCSI passthrough for more things, including obtaining CD-ROM capacity; The Diamond Stealth32 (ET4000/W32p) now also works correctly on the two Award SiS 496/497 boxes; The (S)VGA handler now converts 6-bit RAMDAC RGB channels to standard 8-bit RGB using a lookup table generated at emulator start, calculated using the correct intensity conversion method and treating intensity 64 as equivalent to 63; Moved a few options from the Configuration dialog box to the menu; SIO, PIIX, and PIIX3 now have the reset control register on port CF9 as they should; Several bugfixes.
This commit is contained in:
140
src/vid_tandy.c
140
src/vid_tandy.c
@@ -1,6 +1,3 @@
|
||||
/* Copyright holders: Sarah Walker
|
||||
see COPYING for more details
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "ibm.h"
|
||||
@@ -10,8 +7,10 @@
|
||||
#include "timer.h"
|
||||
#include "video.h"
|
||||
#include "vid_tandy.h"
|
||||
#include "dosbox/vid_cga_comp.h"
|
||||
|
||||
static int i_filt[8],q_filt[8];
|
||||
#define TANDY_RGB 0
|
||||
#define TANDY_COMPOSITE 1
|
||||
|
||||
typedef struct tandy_t
|
||||
{
|
||||
@@ -38,9 +37,10 @@ typedef struct tandy_t
|
||||
int vsynctime, vadj;
|
||||
uint16_t ma, maback;
|
||||
|
||||
int dispontime, dispofftime;
|
||||
int vidtime;
|
||||
int dispontime, dispofftime, vidtime;
|
||||
int firstline, lastline;
|
||||
|
||||
int composite;
|
||||
} tandy_t;
|
||||
|
||||
static uint8_t crtcmask[32] =
|
||||
@@ -76,6 +76,7 @@ void tandy_out(uint16_t addr, uint8_t val, void *p)
|
||||
return;
|
||||
case 0x3d8:
|
||||
tandy->mode = val;
|
||||
update_cga16_color(tandy->mode);
|
||||
return;
|
||||
case 0x3d9:
|
||||
tandy->col = val;
|
||||
@@ -471,60 +472,15 @@ void tandy_poll(void *p)
|
||||
}
|
||||
if (tandy->mode & 1) x = (tandy->crtc[1] << 3) + 16;
|
||||
else x = (tandy->crtc[1] << 4) + 16;
|
||||
if (cga_comp)
|
||||
|
||||
if (tandy->composite)
|
||||
{
|
||||
for (c = 0; c < x; c++)
|
||||
{
|
||||
y_buf[(c << 1) & 6] = ntsc_col[buffer->line[tandy->displine][c] & 7][(c << 1) & 6] ? 0x6000 : 0;
|
||||
y_buf[(c << 1) & 6] += (buffer->line[tandy->displine][c] & 8) ? 0x3000 : 0;
|
||||
i_buf[(c << 1) & 6] = y_buf[(c << 1) & 6] * i_filt[(c << 1) & 6];
|
||||
q_buf[(c << 1) & 6] = y_buf[(c << 1) & 6] * q_filt[(c << 1) & 6];
|
||||
y_tot = y_buf[0] + y_buf[1] + y_buf[2] + y_buf[3] + y_buf[4] + y_buf[5] + y_buf[6] + y_buf[7];
|
||||
i_tot = i_buf[0] + i_buf[1] + i_buf[2] + i_buf[3] + i_buf[4] + i_buf[5] + i_buf[6] + i_buf[7];
|
||||
q_tot = q_buf[0] + q_buf[1] + q_buf[2] + q_buf[3] + q_buf[4] + q_buf[5] + q_buf[6] + q_buf[7];
|
||||
for (c = 0; c < x; c++)
|
||||
buffer32->line[tandy->displine][c] = buffer->line[tandy->displine][c] & 0xf;
|
||||
|
||||
y_val = y_tot >> 10;
|
||||
if (y_val > 255) y_val = 255;
|
||||
y_val <<= 16;
|
||||
i_val = i_tot >> 12;
|
||||
if (i_val > 39041) i_val = 39041;
|
||||
if (i_val < -39041) i_val = -39041;
|
||||
q_val = q_tot >> 12;
|
||||
if (q_val > 34249) q_val = 34249;
|
||||
if (q_val < -34249) q_val = -34249;
|
||||
|
||||
r = (y_val + 249*i_val + 159*q_val) >> 16;
|
||||
g = (y_val - 70*i_val - 166*q_val) >> 16;
|
||||
b = (y_val - 283*i_val + 436*q_val) >> 16;
|
||||
|
||||
y_buf[((c << 1) & 6) + 1] = ntsc_col[buffer->line[tandy->displine][c] & 7][((c << 1) & 6) + 1] ? 0x6000 : 0;
|
||||
y_buf[((c << 1) & 6) + 1] += (buffer->line[tandy->displine][c] & 8) ? 0x3000 : 0;
|
||||
i_buf[((c << 1) & 6) + 1] = y_buf[((c << 1) & 6) + 1] * i_filt[((c << 1) & 6) + 1];
|
||||
q_buf[((c << 1) & 6) + 1] = y_buf[((c << 1) & 6) + 1] * q_filt[((c << 1) & 6) + 1];
|
||||
y_tot = y_buf[0] + y_buf[1] + y_buf[2] + y_buf[3] + y_buf[4] + y_buf[5] + y_buf[6] + y_buf[7];
|
||||
i_tot = i_buf[0] + i_buf[1] + i_buf[2] + i_buf[3] + i_buf[4] + i_buf[5] + i_buf[6] + i_buf[7];
|
||||
q_tot = q_buf[0] + q_buf[1] + q_buf[2] + q_buf[3] + q_buf[4] + q_buf[5] + q_buf[6] + q_buf[7];
|
||||
|
||||
y_val = y_tot >> 10;
|
||||
if (y_val > 255) y_val = 255;
|
||||
y_val <<= 16;
|
||||
i_val = i_tot >> 12;
|
||||
if (i_val > 39041) i_val = 39041;
|
||||
if (i_val < -39041) i_val = -39041;
|
||||
q_val = q_tot >> 12;
|
||||
if (q_val > 34249) q_val = 34249;
|
||||
if (q_val < -34249) q_val = -34249;
|
||||
|
||||
r = (y_val + 249*i_val + 159*q_val) >> 16;
|
||||
g = (y_val - 70*i_val - 166*q_val) >> 16;
|
||||
b = (y_val - 283*i_val + 436*q_val) >> 16;
|
||||
if (r > 511) r = 511;
|
||||
if (g > 511) g = 511;
|
||||
if (b > 511) b = 511;
|
||||
|
||||
((uint32_t *)buffer32->line[tandy->displine])[c] = makecol32(r / 2, g / 2, b / 2);
|
||||
}
|
||||
Composite_Process(tandy->mode, 0, x >> 2, buffer32->line[tandy->displine]);
|
||||
}
|
||||
|
||||
tandy->sc = oldsc;
|
||||
if (tandy->vc == tandy->crtc[7] && !tandy->sc)
|
||||
{
|
||||
@@ -619,7 +575,7 @@ void tandy_poll(void *p)
|
||||
// printf("Blit %i %i\n",firstline,lastline);
|
||||
//printf("Xsize is %i\n",xsize);
|
||||
|
||||
if (cga_comp)
|
||||
if (tandy->composite)
|
||||
video_blit_memtoscreen(0, tandy->firstline-4, 0, (tandy->lastline - tandy->firstline) + 8, xsize, (tandy->lastline - tandy->firstline) + 8);
|
||||
else
|
||||
video_blit_memtoscreen_8(0, tandy->firstline-4, xsize, (tandy->lastline - tandy->firstline) + 8);
|
||||
@@ -677,19 +633,17 @@ void tandy_poll(void *p)
|
||||
|
||||
void *tandy_init()
|
||||
{
|
||||
int c;
|
||||
int tandy_tint = -2;
|
||||
int display_type;
|
||||
tandy_t *tandy = malloc(sizeof(tandy_t));
|
||||
memset(tandy, 0, sizeof(tandy_t));
|
||||
|
||||
display_type = model_get_config_int("display_type");
|
||||
tandy->composite = (display_type != TANDY_RGB);
|
||||
|
||||
cga_comp_init(1);
|
||||
tandy->memctrl = -1;
|
||||
tandy->base = (mem_size - 128) * 1024;
|
||||
|
||||
for (c = 0; c < 8; c++)
|
||||
{
|
||||
i_filt[c] = 512.0 * cos((3.14 * (tandy_tint + c * 4) / 16.0) - 33.0 / 180.0);
|
||||
q_filt[c] = 512.0 * sin((3.14 * (tandy_tint + c * 4) / 16.0) - 33.0 / 180.0);
|
||||
}
|
||||
timer_add(tandy_poll, &tandy->vidtime, TIMER_ALWAYS_ENABLED, tandy);
|
||||
mem_mapping_add(&tandy->mapping, 0xb8000, 0x08000, tandy_read, NULL, NULL, tandy_write, NULL, NULL, NULL, 0, tandy);
|
||||
mem_mapping_add(&tandy->ram_mapping, 0x80000, 0x20000, tandy_ram_read, NULL, NULL, tandy_ram_write, NULL, NULL, NULL, 0, tandy);
|
||||
@@ -698,8 +652,6 @@ void *tandy_init()
|
||||
io_sethandler(0x03d0, 0x0010, tandy_in, NULL, NULL, tandy_out, NULL, NULL, tandy);
|
||||
io_sethandler(0x00a0, 0x0001, tandy_in, NULL, NULL, tandy_out, NULL, NULL, tandy);
|
||||
tandy->b8000_mask = 0x3fff;
|
||||
|
||||
overscan_x = overscan_y = 16;
|
||||
|
||||
return tandy;
|
||||
}
|
||||
@@ -729,3 +681,57 @@ device_t tandy_device =
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
static device_config_t tandy_config[] =
|
||||
{
|
||||
{
|
||||
.name = "display_type",
|
||||
.description = "Display type",
|
||||
.type = CONFIG_SELECTION,
|
||||
.selection =
|
||||
{
|
||||
{
|
||||
.description = "RGB",
|
||||
.value = TANDY_RGB
|
||||
},
|
||||
{
|
||||
.description = "Composite",
|
||||
.value = TANDY_COMPOSITE
|
||||
},
|
||||
{
|
||||
.description = ""
|
||||
}
|
||||
},
|
||||
.default_int = TANDY_RGB
|
||||
},
|
||||
{
|
||||
.type = -1
|
||||
}
|
||||
};
|
||||
|
||||
/*These aren't really devices as such - more of a convenient way to hook in the
|
||||
config information*/
|
||||
device_t tandy1000_device =
|
||||
{
|
||||
"Tandy 1000",
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
tandy_config
|
||||
};
|
||||
device_t tandy1000hx_device =
|
||||
{
|
||||
"Tandy 1000HX",
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
tandy_config
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user