Author: aandrejevic Date: Sat Sep 13 21:50:23 2014 New Revision: 64136
URL: http://svn.reactos.org/svn/reactos?rev=64136&view=rev Log: [NTVDM] Implement motion counters in the mouse BIOS.
Modified: trunk/reactos/subsystems/ntvdm/bios/bios32/moubios32.c trunk/reactos/subsystems/ntvdm/bios/bios32/moubios32.h
Modified: trunk/reactos/subsystems/ntvdm/bios/bios32/moubios32.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/bios/bios3... ============================================================================== --- trunk/reactos/subsystems/ntvdm/bios/bios32/moubios32.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/ntvdm/bios/bios32/moubios32.c [iso-8859-1] Sat Sep 13 21:50:23 2014 @@ -85,8 +85,11 @@ /* Reset Driver */ case 0x00: { + SHORT i; + DriverEnabled = TRUE; DriverState.ShowCount = 0; + DriverState.ButtonState = 0;
/* Set the default text cursor */ DriverState.TextCursor.ScreenMask = 0xFFFF; /* Display everything */ @@ -130,6 +133,18 @@ DriverState.GraphicsCursor.CursorMask[14] = 0x0030; // 0000000000110000 DriverState.GraphicsCursor.CursorMask[15] = 0x0000; // 0000000000000000
+ /* Initialize the counters */ + DriverState.HorizCount = DriverState.VertCount = 0; + + for (i = 0; i < NUM_MOUSE_BUTTONS; i++) + { + DriverState.PressCount[i] = DriverState.ReleaseCount[i] = 0; + } + + /* Initialize the resolution */ + DriverState.MickeysPerCellHoriz = 8; + DriverState.MickeysPerCellVert = 16; + /* Return mouse information */ setAX(0xFFFF); // Hardware & driver installed setBX(NUM_MOUSE_BUTTONS); @@ -240,6 +255,27 @@ break; }
+ /* Read Motion Counters */ + case 0x0B: + { + setCX(DriverState.HorizCount); + setDX(DriverState.VertCount); + + /* Reset the counters */ + DriverState.HorizCount = DriverState.VertCount = 0; + + break; + } + + /* Define Mickey/Pixel Ratio */ + case 0x0F: + { + DriverState.MickeysPerCellHoriz = getCX(); + DriverState.MickeysPerCellVert = getDX(); + + break; + } + /* Return Driver Storage Requirements */ case 0x15: { @@ -289,7 +325,15 @@
VOID MouseBiosUpdatePosition(PCOORD NewPosition) { - if (DriverEnabled && (DriverState.ShowCount > 0)) + SHORT DeltaX = NewPosition->X - DriverState.Position.X; + SHORT DeltaY = NewPosition->Y - DriverState.Position.Y; + + if (!DriverEnabled) return; + + DriverState.HorizCount += (DeltaX * (SHORT)DriverState.MickeysPerCellHoriz) / 8; + DriverState.VertCount += (DeltaY * (SHORT)DriverState.MickeysPerCellVert) / 8; + + if (DriverState.ShowCount > 0) { EraseMouseCursor(); DriverState.Position = *NewPosition;
Modified: trunk/reactos/subsystems/ntvdm/bios/bios32/moubios32.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/bios/bios3... ============================================================================== --- trunk/reactos/subsystems/ntvdm/bios/bios32/moubios32.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/ntvdm/bios/bios32/moubios32.h [iso-8859-1] Sat Sep 13 21:50:23 2014 @@ -35,6 +35,10 @@ COORD LastPress[NUM_MOUSE_BUTTONS]; WORD ReleaseCount[NUM_MOUSE_BUTTONS]; COORD LastRelease[NUM_MOUSE_BUTTONS]; + SHORT HorizCount; + SHORT VertCount; + WORD MickeysPerCellHoriz; + WORD MickeysPerCellVert;
struct {