keyboard.pp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by Florian Klaempfl
  5. member of the Free Pascal development team
  6. Keyboard unit for go32v2
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. unit Keyboard;
  14. interface
  15. {$i keybrdh.inc}
  16. implementation
  17. uses
  18. go32;
  19. {$i keyboard.inc}
  20. function SysGetKeyEvent: TKeyEvent;
  21. var
  22. regs : trealregs;
  23. begin
  24. regs.ah:=$10;
  25. realintr($16,regs);
  26. if (regs.al=$e0) and (regs.ah<>0) then
  27. regs.al:=0;
  28. SysGetKeyEvent:=regs.ax or ((mem[$40:$17] and $f) shl 16);
  29. end;
  30. function SysPollKeyEvent: TKeyEvent;
  31. var
  32. regs : trealregs;
  33. begin
  34. regs.ah:=$11;
  35. realintr($16,regs);
  36. if (regs.realflags and zeroflag<>0) then
  37. exit(0);
  38. if (regs.al=$e0) and (regs.ah<>0) then
  39. regs.al:=0;
  40. SysPollKeyEvent:=regs.ax or ((mem[$40:$17] and $f) shl 16);
  41. end;
  42. function SysGetShiftState: Byte;
  43. begin
  44. SysGetShiftState:=(mem[$40:$17] and $f);
  45. end;
  46. Const
  47. SysKeyboardDriver : TKeyboardDriver = (
  48. InitDriver : Nil;
  49. DoneDriver : Nil;
  50. GetKeyevent : @SysGetKeyEvent;
  51. PollKeyEvent : @SysPollKeyEvent;
  52. GetShiftState : @SysGetShiftState;
  53. TranslateKeyEvent : Nil;
  54. TranslateKeyEventUnicode : Nil;
  55. );
  56. begin
  57. SetKeyBoardDriver(SysKeyBoardDriver);
  58. end.
  59. {
  60. $Log$
  61. Revision 1.2 2001-09-21 21:33:35 michael
  62. + Merged driver support from fixbranch
  63. Revision 1.1.2.2 2001/09/21 21:20:43 michael
  64. + Added support for keyboard driver.
  65. + Added DefaultTranslateKeyEvent,DefaultTranslateKeyEventUnicode
  66. + PendingKeyEvent variable no longer public. Handling of this variable is
  67. now done entirely by global functions. System dependent code should not
  68. need it, it is set automatically.
  69. + InitVideo DoneVideo will check whether the keyboard is initialized or not.
  70. Revision 1.1.2.1 2001/01/30 21:52:01 peter
  71. * moved api utils to rtl
  72. Revision 1.1 2001/01/13 11:03:57 peter
  73. * API 2 RTL commit
  74. }