diff --git a/subsystems/ntvdm/bios.c b/subsystems/ntvdm/bios.c index d21bd1e2009..efb37182d91 100644 --- a/subsystems/ntvdm/bios.c +++ b/subsystems/ntvdm/bios.c @@ -596,13 +596,9 @@ WORD BiosPeekCharacter(VOID) { WORD CharacterData; - /* Check if there is a key available */ - if (Bda->KeybdBufferHead == Bda->KeybdBufferTail) return 0xFFFF; - /* Get the key from the queue, but don't remove it */ - BiosKbdBufferTop(&CharacterData); - - return CharacterData; + if (BiosKbdBufferTop(&CharacterData)) return CharacterData; + else return 0xFFFF; } WORD BiosGetCharacter(VOID) @@ -1169,8 +1165,7 @@ VOID BiosHandleIrq(BYTE IrqNumber, LPWORD Stack) } /* Push it onto the BIOS keyboard queue */ - BiosKbdBufferPush((ScanCode << 8) | (Character & 0xFF)); - + BiosKbdBufferPush(MAKEWORD(Character, ScanCode)); } else { diff --git a/subsystems/ntvdm/dos.c b/subsystems/ntvdm/dos.c index 9528a67fbde..f52f94ac80f 100644 --- a/subsystems/ntvdm/dos.c +++ b/subsystems/ntvdm/dos.c @@ -1411,6 +1411,36 @@ VOID DosInt21h(LPWORD Stack) break; } + /* Direct Console I/O */ + case 0x06: + { + BYTE Character = LOBYTE(Edx); + + if (Character != 0xFF) + { + /* Output */ + DosPrintCharacter(Character); + } + else + { + /* Input */ + Eax &= 0xFFFFFF00; + + if (DosCheckInput()) + { + Eax |= DosReadCharacter(); + Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_ZF; + } + else + { + /* No character available */ + Stack[STACK_FLAGS] |= EMULATOR_FLAG_ZF; + } + } + + break; + } + /* Read Character Without Echo */ case 0x07: case 0x08: