diff --git a/src/Spice86.Core/Emulator/InterruptHandlers/Input/Keyboard/BiosKeyboardInt9Handler.cs b/src/Spice86.Core/Emulator/InterruptHandlers/Input/Keyboard/BiosKeyboardInt9Handler.cs index 9b221fc0ed..bb0dd2d947 100644 --- a/src/Spice86.Core/Emulator/InterruptHandlers/Input/Keyboard/BiosKeyboardInt9Handler.cs +++ b/src/Spice86.Core/Emulator/InterruptHandlers/Input/Keyboard/BiosKeyboardInt9Handler.cs @@ -72,6 +72,15 @@ public BiosKeyboardInt9Handler(IMemory memory, BiosDataArea biosDataArea, /// public override void Run() { + // INT 16h may invoke INT 09h as a polling mechanism. + // Do not reprocess the controller's previous data byte when + // the output buffer contains no new data. + byte status = _ps2Controller.ReadByte(KeyboardPorts.StatusRegister); + if ((status & 0x01) == 0) { + _dualPic.AcknowledgeInterrupt(1); + return; + } + // Disable keyboard first - otherwise Prince of Persia reads it before us! _ps2Controller.WriteByte(KeyboardPorts.Command, (byte)KeyboardCommand.DisablePortKbd);