Finish multi-monitor support
This commit is contained in:
@@ -80,14 +80,18 @@ typedef struct {
|
||||
uint16_t ma, maback;
|
||||
int con, coff, cursoron;
|
||||
int dispon, blink;
|
||||
int vsynctime;
|
||||
int vsynctime;
|
||||
int vadj;
|
||||
int monitor_index, prev_monitor_index;
|
||||
|
||||
int cols[256][2][2];
|
||||
|
||||
uint8_t *vram;
|
||||
} herculesplus_t;
|
||||
|
||||
#define VIDEO_MONITOR_PROLOGUE() { dev->prev_monitor_index = monitor_index_global; monitor_index_global = dev->monitor_index; }
|
||||
#define VIDEO_MONITOR_EPILOGUE() { monitor_index_global = dev->prev_monitor_index; }
|
||||
|
||||
static video_timings_t timing_herculesplus = {VIDEO_ISA, 8, 16, 32, 8, 16, 32};
|
||||
|
||||
|
||||
@@ -180,7 +184,7 @@ herculesplus_in(uint16_t port, void *priv)
|
||||
break;
|
||||
|
||||
case 0x3ba:
|
||||
/* 0x50: InColor card identity */
|
||||
/* 0x10: Hercules Plus card identity */
|
||||
ret = (dev->stat & 0xf) | ((dev->stat & 8) << 4) | 0x10;
|
||||
break;
|
||||
}
|
||||
@@ -489,6 +493,7 @@ herculesplus_poll(void *priv)
|
||||
uint16_t ca = (dev->crtc[15] | (dev->crtc[14] << 8)) & 0x3fff;
|
||||
int x, oldvc, oldsc;
|
||||
|
||||
VIDEO_MONITOR_PROLOGUE();
|
||||
if (! dev->linepos) {
|
||||
timer_advance_u64(&dev->timer, dev->dispofftime);
|
||||
dev->stat |= 1;
|
||||
@@ -602,6 +607,8 @@ herculesplus_poll(void *priv)
|
||||
if ((dev->sc == (dev->crtc[10] & 31) || ((dev->crtc[8] & 3) == 3 && dev->sc == ((dev->crtc[10] & 31) >> 1))))
|
||||
dev->con = 1;
|
||||
}
|
||||
|
||||
VIDEO_MONITOR_EPILOGUE();
|
||||
}
|
||||
|
||||
|
||||
@@ -615,10 +622,11 @@ herculesplus_init(const device_t *info)
|
||||
memset(dev, 0, sizeof(herculesplus_t));
|
||||
|
||||
dev->vram = (uint8_t *)malloc(0x10000); /* 64k VRAM */
|
||||
dev->monitor_index = monitor_index_global;
|
||||
|
||||
timer_add(&dev->timer, herculesplus_poll, dev, 1);
|
||||
|
||||
mem_mapping_add(&dev->mapping, 0xb0000, 0x10000,
|
||||
mem_mapping_add(&dev->mapping, 0xb0000, 0x08000,
|
||||
herculesplus_read,NULL,NULL,
|
||||
herculesplus_write,NULL,NULL,
|
||||
dev->vram, MEM_MAPPING_EXTERNAL, dev);
|
||||
|
||||
@@ -110,13 +110,13 @@ video_cards[] = {
|
||||
{ &cpqega_device },
|
||||
{ &ega_device },
|
||||
{ &g2_gc205_device },
|
||||
{ &hercules_device },
|
||||
{ &herculesplus_device },
|
||||
{ &hercules_device, VIDEO_FLAG_TYPE_MDA },
|
||||
{ &herculesplus_device, VIDEO_FLAG_TYPE_MDA },
|
||||
{ &incolor_device },
|
||||
{ &im1024_device },
|
||||
{ &iskra_ega_device },
|
||||
{ &et4000_kasan_isa_device },
|
||||
{ &mda_device },
|
||||
{ &mda_device, VIDEO_FLAG_TYPE_MDA },
|
||||
{ &genius_device },
|
||||
{ &nga_device },
|
||||
{ &ogc_device },
|
||||
@@ -299,7 +299,7 @@ video_prepare(void)
|
||||
|
||||
for (int i = 0; i < MONITORS_NUM; i++) {
|
||||
/* Reset the CGA palette. */
|
||||
monitors[i].mon_cga_palette = 0;
|
||||
if (monitors[i].mon_cga_palette) *monitors[i].mon_cga_palette = 0;
|
||||
cgapal_rebuild_monitor(i);
|
||||
|
||||
/* Do an inform on the default values, so that that there's some sane values initialized
|
||||
@@ -340,14 +340,17 @@ video_reset(int card)
|
||||
|
||||
/* Initialize the video card. */
|
||||
device_add(video_cards[card].device);
|
||||
}
|
||||
|
||||
if (herc_enabled) {
|
||||
if (!(card == VID_NONE)
|
||||
&& !machine_has_flags(machine, MACHINE_VIDEO_ONLY)
|
||||
&& gfxcard_2 != 0
|
||||
&& (video_cards[gfxcard_2].flags != video_cards[gfxcard].flags)) {
|
||||
video_monitor_init(1);
|
||||
monitor_index_global = 1;
|
||||
device_add(&hercules_device);
|
||||
monitor_index_global = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Enable the Voodoo if configured. */
|
||||
if (voodoo_enabled)
|
||||
@@ -366,6 +369,11 @@ video_card_available(int card)
|
||||
return(1);
|
||||
}
|
||||
|
||||
int
|
||||
video_card_get_flags(int card)
|
||||
{
|
||||
return video_cards[card].flags;
|
||||
}
|
||||
|
||||
const device_t *
|
||||
video_card_getdevice(int card)
|
||||
|
||||
@@ -105,7 +105,6 @@ monitor_t monitors[MONITORS_NUM];
|
||||
monitor_settings_t monitor_settings[MONITORS_NUM];
|
||||
atomic_bool doresize_monitors[MONITORS_NUM];
|
||||
int monitor_index_global = 0;
|
||||
int herc_enabled = 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
void * __cdecl (*video_copy)(void *_Dst, const void *_Src, size_t _Size) = memcpy;
|
||||
@@ -621,11 +620,16 @@ cgapal_rebuild_monitor(int monitor_index)
|
||||
{
|
||||
int c;
|
||||
uint32_t* palette_lookup = monitors[monitor_index].mon_pal_lookup;
|
||||
int cga_palette_monitor = *monitors[monitor_index].mon_cga_palette;
|
||||
int cga_palette_monitor = 0;
|
||||
|
||||
/* We cannot do this (yet) if we have not been enabled yet. */
|
||||
if (video_6to8 == NULL) return;
|
||||
|
||||
if (monitors[monitor_index].target_buffer == NULL ||
|
||||
monitors[monitor_index].mon_cga_palette == NULL) return;
|
||||
|
||||
cga_palette_monitor = *monitors[monitor_index].mon_cga_palette;
|
||||
|
||||
for (c=0; c<256; c++) {
|
||||
palette_lookup[c] = makecol(video_6to8[cgapal[c].r],
|
||||
video_6to8[cgapal[c].g],
|
||||
@@ -737,14 +741,14 @@ video_update_timing(void)
|
||||
*vid_timing_write_b = ISA_CYCLES(monitor_vid_timings->write_b);
|
||||
*vid_timing_write_w = ISA_CYCLES(monitor_vid_timings->write_w);
|
||||
*vid_timing_write_l = ISA_CYCLES(monitor_vid_timings->write_l);
|
||||
} else if (vid_timings->type == VIDEO_PCI) {
|
||||
} else if (monitor_vid_timings->type == VIDEO_PCI) {
|
||||
*vid_timing_read_b = (int)(pci_timing * monitor_vid_timings->read_b);
|
||||
*vid_timing_read_w = (int)(pci_timing * monitor_vid_timings->read_w);
|
||||
*vid_timing_read_l = (int)(pci_timing * monitor_vid_timings->read_l);
|
||||
*vid_timing_write_b = (int)(pci_timing * monitor_vid_timings->write_b);
|
||||
*vid_timing_write_w = (int)(pci_timing * monitor_vid_timings->write_w);
|
||||
*vid_timing_write_l = (int)(pci_timing * monitor_vid_timings->write_l);
|
||||
} else if (vid_timings->type == VIDEO_AGP) {
|
||||
} else if (monitor_vid_timings->type == VIDEO_AGP) {
|
||||
*vid_timing_read_b = (int)(agp_timing * monitor_vid_timings->read_b);
|
||||
*vid_timing_read_w = (int)(agp_timing * monitor_vid_timings->read_w);
|
||||
*vid_timing_read_l = (int)(agp_timing * monitor_vid_timings->read_l);
|
||||
|
||||
Reference in New Issue
Block a user