Initialise A20 gate correctly at startup.

Keyboard controller self-test command enables A20.
HIMEM.SYS included with Windows/286 now works.
This commit is contained in:
TomW 2015-10-12 13:42:09 +01:00
commit 9d2dd22d6d
2 changed files with 15 additions and 4 deletions

View file

@ -340,6 +340,15 @@ void keyboard_at_write(uint16_t port, uint8_t val, void *priv)
keyboard_at.status |= STAT_SYSFLAG;
keyboard_at.mem[0] |= 0x04;
keyboard_at_adddata(0x55);
/*Self-test also resets the output port, enabling A20*/
if (!(keyboard_at.output_port & 0x02))
{
mem_a20_key = 2;
mem_a20_recalc();
// pclog("Rammask change to %08X %02X\n", rammask, val & 0x02);
flushmmucache();
}
keyboard_at.output_port = 0xcf;
break;
case 0xab: /*Interface test*/
@ -445,7 +454,7 @@ void keyboard_at_reset()
keyboard_at.status = STAT_LOCK | STAT_CD;
keyboard_at.mem[0] = 0x11;
keyboard_at.wantirq = 0;
keyboard_at.output_port = 0;
keyboard_at.output_port = 0xcf;
keyboard_at.input_port = 0xb0;
keyboard_at.out_new = -1;
keyboard_at.last_irq = 0;

View file

@ -1736,6 +1736,9 @@ void mem_add_bios()
mem_mapping_add(&bios_high_mapping[7], 0xffffc000, 0x04000, mem_read_bios, mem_read_biosw, mem_read_biosl, mem_write_null, mem_write_nullw, mem_write_nulll, rom + (0x1c000 & biosmask), 0, 0);
}
int mem_a20_key = 0, mem_a20_alt = 0;
static int mem_a20_state = 1;
void mem_init()
{
int c;
@ -1847,6 +1850,8 @@ void mem_resize()
mem_mapping_add(&romext_mapping, 0xc8000, 0x08000, mem_read_romext, mem_read_romextw, mem_read_romextl, NULL, NULL, NULL, romext, 0, NULL);
// pclog("Mem resize %i %i\n",mem_size,c);
mem_a20_key = 2;
mem_a20_recalc();
}
void mem_reset_page_blocks()
@ -1863,9 +1868,6 @@ void mem_reset_page_blocks()
}
}
int mem_a20_key = 0, mem_a20_alt = 0;
static int mem_a20_state = 0;
void mem_a20_recalc()
{
int state = mem_a20_key | mem_a20_alt;