From c93742a8313606b3887e4d194309ef78970f9b0f Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Sun, 28 Aug 2016 02:00:10 +0000 Subject: [PATCH] [NTVDM:BIOS] Properly implement INT 15h, AH = 86h. svn path=/trunk/; revision=72481 --- .../mvdm/ntvdm/bios/bios32/bios32.c | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/reactos/subsystems/mvdm/ntvdm/bios/bios32/bios32.c b/reactos/subsystems/mvdm/ntvdm/bios/bios32/bios32.c index 436ac2122b3..1a65f0e0a33 100644 --- a/reactos/subsystems/mvdm/ntvdm/bios/bios32/bios32.c +++ b/reactos/subsystems/mvdm/ntvdm/bios/bios32/bios32.c @@ -327,14 +327,31 @@ static VOID WINAPI BiosMiscService(LPWORD Stack) * See Ralf Brown: http://www.ctyme.com/intr/rb-1525.htm * for more information. */ - LARGE_INTEGER TimeOut; - TimeOut.QuadPart = MAKELONG(getDX(), getCX()) * -10LL; - // HACK: For now, use the NT API (time in hundreds of nanoseconds). - NtDelayExecution(FALSE, &TimeOut); + static ULONG CompletionTime = 0; + + /* Check if we're already looping */ + if (getCF()) + { + if (GetTickCount() >= CompletionTime) + { + /* Stop looping */ + setCF(0); + + /* Clear the CF on the stack too */ + Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF; + } + } + else + { + /* Set the CF on the stack */ + Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF; + + /* Set the completion time and start looping */ + CompletionTime = GetTickCount() + (MAKELONG(getDX(), getCX()) / 1000); + setCF(1); + } - /* Clear CF */ - Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF; break; }