Author: hbelusca Date: Mon Nov 3 21:27:20 2014 New Revision: 65237
URL: http://svn.reactos.org/svn/reactos?rev=65237&view=rev Log: [NTVDM] - Fix the BIOS32 Wait hack (Sleep takes a duration in milliseconds, whereas the BIOS function takes the duration in microseconds). - Initialize the PIT channels with realistic values (realistic == found on real BIOSes). - Remove unneeded commented code.
Modified: trunk/reactos/subsystems/ntvdm/bios/bios32/bios32.c trunk/reactos/subsystems/ntvdm/dos/mouse32.c trunk/reactos/subsystems/ntvdm/hardware/keyboard.c trunk/reactos/subsystems/ntvdm/hardware/mouse.c
Modified: trunk/reactos/subsystems/ntvdm/bios/bios32/bios32.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/bios/bios3... ============================================================================== --- trunk/reactos/subsystems/ntvdm/bios/bios32/bios32.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/ntvdm/bios/bios32/bios32.c [iso-8859-1] Mon Nov 3 21:27:20 2014 @@ -166,7 +166,9 @@ * See Ralf Brown: http://www.ctyme.com/intr/rb-1525.htm * for more information. */ - Sleep(MAKELONG(getDX(), getCX())); + + // HACK: For now, use the Win32 API (that takes time in milliseconds). + Sleep(MAKELONG(getDX(), getCX()) / 1000);
/* Clear CF */ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF; @@ -471,20 +473,23 @@ IOWriteB(PIC_SLAVE_DATA , 0xFF);
- /* Initialize PIT Counter 0 */ + /* Initialize PIT Counter 0 - Mode 2, 16bit binary count */ + // NOTE: Some BIOSes set it to Mode 3 instead. IOWriteB(PIT_COMMAND_PORT, 0x34); + // 18.2Hz refresh rate IOWriteB(PIT_DATA_PORT(0), 0x00); IOWriteB(PIT_DATA_PORT(0), 0x00);
- /* Initialize PIT Counter 1 */ - IOWriteB(PIT_COMMAND_PORT, 0x74); - IOWriteB(PIT_DATA_PORT(1), 0x00); - IOWriteB(PIT_DATA_PORT(1), 0x00); - - /* Initialize PIT Counter 2 */ - IOWriteB(PIT_COMMAND_PORT, 0xB4); - IOWriteB(PIT_DATA_PORT(2), 0x00); - IOWriteB(PIT_DATA_PORT(2), 0x00); + /* Initialize PIT Counter 1 - Mode 2, 8bit binary count */ + IOWriteB(PIT_COMMAND_PORT, 0x54); + // DRAM refresh every 15ms: http://www.cs.dartmouth.edu/~spl/Academic/Organization/docs/PC%20Timer%20825... + IOWriteB(PIT_DATA_PORT(1), 18); + + /* Initialize PIT Counter 2 - Mode 3, 16bit binary count */ + IOWriteB(PIT_COMMAND_PORT, 0xB6); + // Count for 440Hz + IOWriteB(PIT_DATA_PORT(2), 0x97); + IOWriteB(PIT_DATA_PORT(2), 0x0A);
EnableHwIRQ(0, BiosTimerIrq); }
Modified: trunk/reactos/subsystems/ntvdm/dos/mouse32.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/dos/mouse3... ============================================================================== --- trunk/reactos/subsystems/ntvdm/dos/mouse32.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/ntvdm/dos/mouse32.c [iso-8859-1] Mon Nov 3 21:27:20 2014 @@ -327,11 +327,11 @@ DriverState.GraphicsCursor.HotSpot.X = getBX(); DriverState.GraphicsCursor.HotSpot.Y = getCX();
- RtlMoveMemory(DriverState.GraphicsCursor.ScreenMask, + RtlCopyMemory(DriverState.GraphicsCursor.ScreenMask, MaskBitmap, sizeof(DriverState.GraphicsCursor.ScreenMask));
- RtlMoveMemory(DriverState.GraphicsCursor.CursorMask, + RtlCopyMemory(DriverState.GraphicsCursor.CursorMask, &MaskBitmap[16], sizeof(DriverState.GraphicsCursor.CursorMask));
Modified: trunk/reactos/subsystems/ntvdm/hardware/keyboard.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/hardware/k... ============================================================================== --- trunk/reactos/subsystems/ntvdm/hardware/keyboard.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/ntvdm/hardware/keyboard.c [iso-8859-1] Mon Nov 3 21:27:20 2014 @@ -41,8 +41,6 @@ }
DPRINT("Press 0x%X\n", ScanCode); - - // PicInterruptRequest(1); }
BOOLEAN KeyboardInit(BYTE PS2Connector)
Modified: trunk/reactos/subsystems/ntvdm/hardware/mouse.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/hardware/m... ============================================================================== --- trunk/reactos/subsystems/ntvdm/hardware/mouse.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/ntvdm/hardware/mouse.c [iso-8859-1] Mon Nov 3 21:27:20 2014 @@ -317,7 +317,6 @@ MouseBiosUpdateButtons(LOWORD(MouseEvent->dwButtonState));
// PS2QueuePush(PS2Port, Data); - // PicInterruptRequest(12); }
BOOLEAN MouseInit(BYTE PS2Connector)