home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / pascal / 7522 < prev    next >
Encoding:
Internet Message Format  |  1992-12-16  |  1.9 KB

  1. Path: sparky!uunet!mcsun!uknet!axion!gssec.bt.co.uk!agauld
  2. From: agauld@gssec.bt.co.uk (Alan Gauld)
  3. Newsgroups: comp.lang.pascal
  4. Subject: Fix to editors bug in TP6 TurboVision
  5. Message-ID: <1992Dec16.125905.18501@gssec.bt.co.uk>
  6. Date: 16 Dec 92 12:59:05 GMT
  7. Sender: usenet@gssec.bt.co.uk
  8. Organization: BT Glasgow Engineering Centre, Scotland.
  9. Lines: 36
  10.  
  11. There have been several posts recently about the bug with 3-6 in the
  12. Teditor object in TVDEMOS. I beluieve Borland have a patch for this but I
  13. will post my personal fix for anyone who wants it. There are no warranties
  14. given or implied other than that it worked for me :-)
  15.  
  16. function ScanKeyMap(KeyMap: Pointer; KeyCode: Word): Word; assembler;
  17. asm
  18.         PUSH    DS
  19.         LDS     SI,KeyMap
  20.         MOV     DX,KeyCode
  21.         CLD
  22.         LODSW
  23.         MOV     CX,AX  {Load the size of the map}
  24. @@1:    LODSW
  25.         MOV     BX,AX  {BX = Key}
  26.         LODSW          {AX = Corresponding command}
  27.         CMP     BL,DL  {Compare the ASCII Codes}
  28.         JNE     @@2    {   If NOT equal go round again}
  29.         OR      BH,BH  {If (BH=0) AND (ASCII Codes are equal)}
  30.         JE      @@3    {   Return CommandCode}
  31.         CMP     BH,DH  {If (Scan Codes are equal)AND(ASCII Codes are equal)}
  32.         JE      @@3    {   Return CommandCode}
  33. @@2:    LOOP    @@1    {If more in map goto @@1:}
  34.         XOR     AX,AX  {Set AX = 0}
  35. @@3:    POP     DS     {Return AX}
  36. end;
  37.  
  38. Simply place instead of the listed function in editors.pas.
  39. The comments are simply my attempt to understand what was going on. If they
  40. are wrong, no flames please!
  41. -- 
  42. -----------------------------------------------------------------------
  43. A.J. Gauld                EMail:       agauld@gssec.bt.co.uk
  44. BT, Glasgow Engineering Centre,         Phone:    +44 41 553 2140
  45. 229 George Street, Glasgow, UK          PostCode: G1 1BZ
  46. -----------------------------------------------------------------------
  47.