Browse Source

* fixed bug, where left and right shift were swapped in the i8086-msdos
keyboard unit.

Nikolay Nikolov 3 years ago
parent
commit
55b8fd6e94
1 changed files with 10 additions and 8 deletions
  1. 10 8
      packages/rtl-console/src/msdos/keyboard.pp

+ 10 - 8
packages/rtl-console/src/msdos/keyboard.pp

@@ -44,6 +44,14 @@ begin
 end;
 end;
 
 
 
 
+function SysGetShiftState: Byte;
+begin
+  SysGetShiftState:=(mem[$40:$17] and %1100) or
+                   ((mem[$40:$17] and %0010) shr 1) or
+                   ((mem[$40:$17] and %0001) shl 1);
+end;
+
+
 function SysGetKeyEvent: TKeyEvent;
 function SysGetKeyEvent: TKeyEvent;
 
 
 var
 var
@@ -53,7 +61,7 @@ begin
   intr($16,regs);
   intr($16,regs);
   if (regs.al=$e0) and (regs.ah<>0) then
   if (regs.al=$e0) and (regs.ah<>0) then
    regs.al:=0;
    regs.al:=0;
-  SysGetKeyEvent:=(kbPhys shl 24) or regs.ax or (longint(mem[$40:$17] and $f) shl 16);
+  SysGetKeyEvent:=(kbPhys shl 24) or regs.ax or (longint(SysGetShiftState) shl 16);
 end;
 end;
 
 
 
 
@@ -67,13 +75,7 @@ begin
    exit(0);
    exit(0);
   if (regs.al=$e0) and (regs.ah<>0) then
   if (regs.al=$e0) and (regs.ah<>0) then
    regs.al:=0;
    regs.al:=0;
-  SysPollKeyEvent:=(kbPhys shl 24) or regs.ax or (longint(mem[$40:$17] and $f) shl 16);
-end;
-
-
-function SysGetShiftState: Byte;
-begin
-  SysGetShiftState:=(mem[$40:$17] and $f);
+  SysPollKeyEvent:=(kbPhys shl 24) or regs.ax or (longint(SysGetShiftState) shl 16);
 end;
 end;