Информационный сервер для программистов: Исходники со всего света. Паскальные исходники со всего света
  Powered by Поисковый сервер Яndex: Найдется ВСЁ!
На Главную Pascal Форум Информер Страны мира
   Клавиатура    >>    tpbuf11
   
 
 TP-BUFFER v1.1 - Use the Keyboard Buffer   Lavi Tidhar 30.06.1993

TP-BUFFER v1.1. Pascal source to use the keyboard buffer. Read char WITHOUT wait; Read SCAN CODE from buffer; ERASE buffer; Full documentation, Public domain software



2k 
 

(* TP-Buffer unit version 1.1 /Update *) (* Using the keyboard's buffer in Turbo Pascal *) (* This unit is released to the public domain *) (* by Lavi Tidhar on 5-10-1992 *) (* This unit adds three special functions not *) (* incuded in the Turbo Pascal regular package *) (* You may alter this source code, move the *) (* procedures to your own programs. Please do *) (* NOT change these lines of documentation *) (* This source might teach you about how to *) (* use interrupts in pascal, and the keyboard's *) (* buffer. from the other hand, it might not :-) *) (* Used: INT 16, functions 0 and 1 *) (* INT 21, function 0Ch *) (* INT 16 - KEYBOARD - READ CHAR FROM BUFFER, WAIT IF EMPTY AH = 00h Return: AH = scan code AL = character *) (* INT 16 - KEYBOARD - CHECK BUFFER, DO NOT CLEAR AH = 01h Return: ZF = 0 character in buffer AH = scan code AL = character ZF = 1 no character in buffer *) (* INT 21 - DOS - CLEAR KEYBOARD BUFFER AH = 0Ch AL must be 1, 6, 7, 8, or 0Ah. Notes: Flushes all typeahead input, then executes function specified by AL (effectively moving it to AH and repeating the INT 21 call). If AL contains a value not in the list above, the keyboard buffer is flushed and no other action is taken. *) (* For more details/help etc, you can contact me on: *) (* Mail: Lavi Tidhar 46 Bantam Dr. Blairgowrie 2194 South Africa Phone: International: +27-11-787-8093 South Africa: (011)-787-8093 *) (* Netmail: The Catacomb BBS 5:7101/45 (fidonet) The Catacomb BBS 80:80/100 (pipemail) *) Function GetScanCode:Byte; (* Get SCAN CODE from buffer, wait if empty *) Function GetKey:Char; (* Get Char from buffer, do NOT wait *) Procedure FlushKB;