home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / os / msdos / programm / 10530 < prev    next >
Encoding:
Text File  |  1992-11-11  |  2.6 KB  |  73 lines

  1. Newsgroups: comp.os.msdos.programmer
  2. Path: sparky!uunet!think.com!ames!kronos.arc.nasa.gov!iscnvx!enterprise!news
  3. From: lb00197@Corlac (David Porco)
  4. Subject: Re: putting chars back to keyboard buffer...
  5. Message-ID: <lb00197.11@Corlac>
  6. Sender: news@enterprise.rdd.lmsc.lockheed.com
  7. Nntp-Posting-Host: 129.197.235.11
  8. Organization: Lockheed
  9. References: <1992Nov10.204616.25750@slate.mines.colorado.edu>
  10. Date: Wed, 11 Nov 92 22:56:47 GMT
  11. Lines: 60
  12.  
  13. In article <1992Nov10.204616.25750@slate.mines.colorado.edu> iarit@slate.mines.colorado.edu (ARIT ISMAIL) writes:
  14.  
  15.  
  16. >Hi,
  17.  
  18. >I am writing  a small TSR that will put a string back
  19. >to the keyboard buffer. I got some ideas how to use keyboard 'head'
  20. >and 'tail' pointers, but still confused a bit. I understand what the
  21. >'tail' is and how to use it, but 'head' is confusing..
  22. >Does anybody have any 'C' function/idea how to put chars back to
  23. >keyboard buffer without crashing/rebooting the system?
  24. >Any idea/help is appreciated..
  25. >Thanks.
  26. >iarit@slate.mines.colorado.edu
  27.  
  28. This is kind-of a wierd thing (But aren't all computer concepts).  There 
  29. are basically 4 pointers: Buffer_Start, Buffer_End, Buffer_Head & 
  30. Buffer_Tail.
  31.  
  32. Buffer_Start is the start of the Keyboard buffer in memory, and Buffer_End
  33. is the end of this buffer.  These are Far pointers at address 0x00400080
  34. and 0x00400082 respectively.  
  35.  
  36. The Buffer_Head and Buffer_Tail form a sliding/wraparound window within 
  37. this buffer. 
  38.  
  39. To make a simple illustration... Say an imaginary keyboard buffer started
  40. at address 1 and ended at address 32 (16 ASCII bytes & 16 ScanCode bytes)
  41. Our first window containing the string "HELLO" might look like this:
  42.  
  43.          00000000011111111112222222222333
  44. Buffer : 12345678901234567890123456789012
  45.          --------------------------------
  46. Data   : H.E.L.L.O.                     (The dots represent the scan codes)
  47.  
  48. In this example Buffer_Head Address=1 and Buffer_Tail Address=11 (Buffer
  49. Tail points to the next available address).
  50.  
  51. Now for the wierd part:  Lets say our Buffer_Head Address=29 and our
  52. string was "HELLO".  The keyboard buffer would look like this:
  53.  
  54.          00000000011111111112222222222333
  55. Buffer : 12345678901234567890123456789012
  56.          --------------------------------
  57. Data   : L.L.O.                      H.E.  
  58.  
  59. The Buffer_Head Address=29 and the Buffer_Tail Address=7.  When the 
  60. keyboard buffer is parsed, the string will be "HELLO" because it is a 
  61. sliding window/wraparound ring.
  62.  
  63. Whew...
  64.  
  65. Some info you ought to know:
  66. You can only fit 16 chars in this buffer (16 ASCII codes + 16 Scan Codes),
  67. unless you are up to relocating and expanding the keboard buffer in your
  68. program (not recommended for the weak of heart).
  69. .
  70.  
  71. Good luck.
  72. .
  73.