Merge pull request #4751 from 86Box/tc1995

Honor the composite mode of the PCjr and Tandy 1000
This commit is contained in:
Miran Grča
2024-08-26 00:52:04 +02:00
committed by GitHub
2 changed files with 42 additions and 21 deletions

View File

@@ -1438,6 +1438,34 @@ speed_changed(void *priv)
recalc_timings(pcjr);
}
static void
pcjr_vid_init(pcjr_t *pcjr)
{
int display_type;
video_inform(VIDEO_FLAG_TYPE_CGA, &timing_dram);
pcjr->memctrl = -1;
if (mem_size < 128)
pcjr->memctrl &= ~0x24;
display_type = device_get_config_int("display_type");
pcjr->composite = (display_type != PCJR_RGB);
pcjr->apply_hd = device_get_config_int("apply_hd");
overscan_x = 256;
overscan_y = 32;
mem_mapping_add(&pcjr->mapping, 0xb8000, 0x08000,
vid_read, NULL, NULL,
vid_write, NULL, NULL, NULL, 0, pcjr);
io_sethandler(0x03d0, 16,
vid_in, NULL, NULL, vid_out, NULL, NULL, pcjr);
timer_add(&pcjr->timer, vid_poll, pcjr, 1);
cga_palette = 0;
cgapal_rebuild();
}
void
pit_irq0_timer_pcjr(int new_out, int old_out, UNUSED(void *priv))
{
@@ -1494,7 +1522,6 @@ const device_t pcjr_device = {
int
machine_pcjr_init(UNUSED(const machine_t *model))
{
int display_type;
pcjr_t *pcjr;
int ret;
@@ -1507,14 +1534,6 @@ machine_pcjr_init(UNUSED(const machine_t *model))
pcjr = malloc(sizeof(pcjr_t));
memset(pcjr, 0x00, sizeof(pcjr_t));
pcjr->memctrl = -1;
if (mem_size < 128)
pcjr->memctrl &= ~0x24;
display_type = machine_get_config_int("display_type");
pcjr->composite = (display_type != PCJR_RGB);
pcjr->apply_hd = machine_get_config_int("apply_hd");
overscan_x = 256;
overscan_y = 32;
pic_init_pcjr();
pit_common_init(0, pit_irq0_timer_pcjr, NULL);
@@ -1524,16 +1543,10 @@ machine_pcjr_init(UNUSED(const machine_t *model))
/* Initialize the video controller. */
video_reset(gfxcard[0]);
loadfont("roms/video/mda/mda.rom", 0);
mem_mapping_add(&pcjr->mapping, 0xb8000, 0x08000,
vid_read, NULL, NULL,
vid_write, NULL, NULL, NULL, 0, pcjr);
io_sethandler(0x03d0, 16,
vid_in, NULL, NULL, vid_out, NULL, NULL, pcjr);
timer_add(&pcjr->timer, vid_poll, pcjr, 1);
video_inform(VIDEO_FLAG_TYPE_CGA, &timing_dram);
device_context(&pcjr_device);
pcjr_vid_init(pcjr);
device_context_restore();
device_add_ex(&pcjr_device, pcjr);
cga_palette = 0;
cgapal_rebuild();
/* Initialize the keyboard. */
keyboard_scan = 1;

View File

@@ -1328,11 +1328,10 @@ vid_init(tandy_t *dev)
vid = malloc(sizeof(t1kvid_t));
memset(vid, 0x00, sizeof(t1kvid_t));
vid->memctrl = -1;
dev->vid = vid;
video_inform(VIDEO_FLAG_TYPE_CGA, &timing_dram);
display_type = machine_get_config_int("display_type");
display_type = device_get_config_int("display_type");
vid->composite = (display_type != TANDY_RGB);
cga_comp_init(1);
@@ -1345,11 +1344,14 @@ vid_init(tandy_t *dev)
io_sethandler(0x0065, 1, vid_in, NULL, NULL, vid_out, NULL, NULL, dev);
} else
vid->b8000_mask = 0x3fff;
timer_add(&vid->timer, vid_poll, dev, 1);
mem_mapping_add(&vid->mapping, 0xb8000, 0x08000,
vid_read, NULL, NULL, vid_write, NULL, NULL, NULL, 0, dev);
io_sethandler(0x03d0, 16,
vid_in, NULL, NULL, vid_out, NULL, NULL, dev);
dev->vid = vid;
}
const device_config_t vid_config[] = {
@@ -1771,7 +1773,9 @@ machine_tandy1k_init(const machine_t *model, int type)
keyboard_set_table(scancode_tandy);
io_sethandler(0x00a0, 1,
tandy_read, NULL, NULL, tandy_write, NULL, NULL, dev);
device_context(&vid_device);
vid_init(dev);
device_context_restore();
device_add_ex(&vid_device, dev);
device_add((type == TYPE_TANDY1000SX) ? &ncr8496_device : &sn76489_device);
break;
@@ -1781,8 +1785,10 @@ machine_tandy1k_init(const machine_t *model, int type)
keyboard_set_table(scancode_tandy);
io_sethandler(0x00a0, 1,
tandy_read, NULL, NULL, tandy_write, NULL, NULL, dev);
device_context(&vid_device_hx);
vid_init(dev);
device_add_ex(&vid_device, dev);
device_context_restore();
device_add_ex(&vid_device_hx, dev);
device_add(&ncr8496_device);
device_add(&eep_1000hx_device);
break;
@@ -1792,7 +1798,9 @@ machine_tandy1k_init(const machine_t *model, int type)
init_rom(dev);
io_sethandler(0xffe8, 8,
tandy_read, NULL, NULL, tandy_write, NULL, NULL, dev);
device_context(&vid_device_sl);
vid_init(dev);
device_context_restore();
device_add_ex(&vid_device_sl, dev);
device_add(&pssj_device);
device_add(&eep_1000sl2_device);