Compaq EGA: Put the dot poll timer into the correct time after a timings recalculation, fixes POST errors on non-Compaq machines.

This commit is contained in:
OBattler
2024-08-07 17:34:09 +02:00
parent e929b39620
commit 6118f7080d

View File

@@ -62,6 +62,7 @@ enum {
static video_timings_t timing_ega = { .type = VIDEO_ISA, .write_b = 8, .write_w = 16, .write_l = 32, .read_b = 8, .read_w = 16, .read_l = 32 };
static uint8_t ega_rotate[8][256];
static int active = 0;
static uint32_t pallook16[256];
static uint32_t pallook64[256];
static int ega_type = EGA_TYPE_IBM;
@@ -155,6 +156,25 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
if (!(val & 1))
io_sethandler(0x03a0, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
ega_recalctimings(ega);
if ((ega_type == 2) && !(val & 0x02))
mem_mapping_disable(&ega->mapping);
else switch (ega->gdcreg[6] & 0xc) {
case 0x0: /*128k at A0000*/
mem_mapping_set_addr(&ega->mapping, 0xa0000, 0x20000);
break;
case 0x4: /*64k at A0000*/
mem_mapping_set_addr(&ega->mapping, 0xa0000, 0x10000);
break;
case 0x8: /*32k at B0000*/
mem_mapping_set_addr(&ega->mapping, 0xb0000, 0x08000);
break;
case 0xC: /*32k at B8000*/
mem_mapping_set_addr(&ega->mapping, 0xb8000, 0x08000);
break;
default:
break;
}
break;
case 0x3c4:
ega->seqaddr = val;
@@ -207,7 +227,9 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
ega->chain2_read = val & 0x10;
break;
case 6:
switch (val & 0xc) {
if ((ega_type == 2) && !(ega->miscout & 0x02))
mem_mapping_disable(&ega->mapping);
else switch (val & 0xc) {
case 0x0: /*128k at A0000*/
mem_mapping_set_addr(&ega->mapping, 0xa0000, 0x20000);
break;
@@ -593,9 +615,16 @@ ega_recalctimings(ega_t *ega)
if (ega->dispofftime < TIMER_USEC)
ega->dispofftime = TIMER_USEC;
ega->dot_time = (uint64_t) (ega->dot_clock);
if (ega->dot_time < TIMER_USEC)
ega->dot_time = TIMER_USEC;
if (ega_type == 2) {
ega->dot_time = (uint64_t) (ega->dot_clock);
if (ega->dot_time < TIMER_USEC)
ega->dot_time = TIMER_USEC;
timer_disable(&ega->dot_timer);
timer_set_delay_u64(&ega->dot_timer, ega->dot_time);
ega->cca = 0;
active = 1;
ega->dot = 0;
}
ega_recalc_remap_func(ega);
}
@@ -622,14 +651,13 @@ ega_dot_poll(void *priv)
uint32_t addr;
int drawcursor;
uint32_t charaddr;
static int fg;
static int bg;
static uint32_t dat;
static int fg = 0;
static int bg = 0;
static uint32_t dat = 0x00000000;
static int cclock = 0;
static int disptime;
static int _dispontime;
static int _dispofftime;
static int cclock = 0;
static int active = 0;
if (ega->seqregs[1] & 8) {
disptime = ((ega->crtc[0] + 2) << 1);
@@ -1476,6 +1504,8 @@ ega_standalone_init(const device_t *info)
ega->vrammask = ega->vram_limit - 1;
mem_mapping_add(&ega->mapping, 0xa0000, 0x20000, ega_read, NULL, NULL, ega_write, NULL, NULL, NULL, MEM_MAPPING_EXTERNAL, ega);
if (ega_type == 2)
mem_mapping_disable(&ega->mapping);
io_sethandler(0x03c0, 0x0020, ega_in, NULL, NULL, ega_out, NULL, NULL, ega);
if (ega->chipset) {