Browse Source

Go32v2 and msdos mouse is zero based. Fixed GetMouseX, GetMouseY and SetMouseXY.

Margers 10 months ago
parent
commit
8b1824ab34
2 changed files with 16 additions and 6 deletions
  1. 6 3
      packages/rtl-console/src/go32v2/mouse.pp
  2. 10 3
      packages/rtl-console/src/msdos/mouse.pp

+ 6 - 3
packages/rtl-console/src/go32v2/mouse.pp

@@ -656,10 +656,11 @@ asm
         movzwl  %cx,%eax
         shrl    $3,%eax
         cmpw    $40,ScreenWidth
-        jne     .Lmorethan40cols
+        {jne     .Lmorethan40cols}
+        jne     .Lexit
         shrl    $1,%eax
 .Lmorethan40cols:
-        incl    %eax
+        {incl    %eax} {need to be zero based - no inc}
         jmp .Lexit
 .LGetMouseXError:
         xorl    %eax,%eax
@@ -679,7 +680,7 @@ asm
         popl    %ebp
         movzwl  %dx,%eax
         shrl    $3,%eax
-        incl    %eax
+        {incl    %eax} {need to be zero based - no inc}
         jmp .Lexit
 .LGetMouseYError:
         xorl    %eax,%eax
@@ -713,6 +714,8 @@ asm
         jne     .LSetMouseXYExit
         movw    x,%cx
         movw    y,%dx
+        shll    $3,%ecx {character based convert to pixels: x * 8}
+        shll    $3,%edx {character based convert to pixels: y * 8}
         movl    $4,%eax
         pushl   %ebp
         int     $0x33

+ 10 - 3
packages/rtl-console/src/msdos/mouse.pp

@@ -407,10 +407,11 @@ asm
 {$else}
         cmp     ScreenWidth, 40
 {$endif}
-        jne     @@morethan40cols
+        {jne     @@morethan40cols}
+        jne     @@exit
         shr     ax, 1
 @@morethan40cols:
-        inc     ax
+        {inc     ax} {need to be zero based - no inc}
         jmp @@exit
 @@GetMouseXError:
         xor     ax, ax
@@ -430,7 +431,7 @@ asm
         shr     ax, 1
         shr     ax, 1
         shr     ax, 1
-        inc     ax
+        {inc     ax} {need to be zero based - no inc}
         jmp @@exit
 @@GetMouseYError:
         xor     ax, ax
@@ -460,6 +461,12 @@ asm
         jne     @@SetMouseXYExit
         mov     cx, x
         mov     dx, y
+        shl     cx, 1 {character based convert to pixels: x * 8}
+        shl     cx, 1
+        shl     cx, 1
+        shl     dx, 1 {character based convert to pixels: y * 8}
+        shl     dx, 1
+        shl     dx, 1
         mov     ax, 4
         push    bp
         int     33h