From a41935301b66908e458835c663b732a861fe1ea9 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 2 Apr 2023 23:21:20 +0200 Subject: [PATCH] Process command D1 (write output port) instantly, required for Windows 95 to work correctly on some chipsets such as SiS 50x. --- src/device/keyboard_at.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/device/keyboard_at.c b/src/device/keyboard_at.c index eac705a90..638b4433a 100644 --- a/src/device/keyboard_at.c +++ b/src/device/keyboard_at.c @@ -2338,10 +2338,30 @@ kbd_write(uint16_t port, uint8_t val, void *priv) switch (port) { case 0x60: dev->status &= ~STAT_CD; + if (dev->want60 && (dev->command == 0xd1)) { + kbd_log("ATkbc: write output port\n"); + /* Bit 2 of AMI flags is P22-P23 blocked (1 = yes, 0 = no), + discovered by reverse-engineering the AOpeN Vi15G BIOS. */ + if (dev->ami_flags & 0x04) { + /* If keyboard controller lines P22-P23 are blocked, + we force them to remain unchanged. */ + val &= ~0x0c; + val |= (dev->output_port & 0x0c); + } + write_output(dev, val | 0x01); + dev->want60 = 0; + return; + } break; case 0x64: dev->status |= STAT_CD; + if (val == 0xd1) { + kbd_log("ATkbc: write output port\n"); + dev->want60 = 1; + dev->command = 0xd1; + return; + } break; }