[comp.lang.pascal] clearing keyboard buffer

MATHRICH@umcvmb.missouri.edu (Rich Winkel UMC Math Department) (10/04/89)

The fastest (and least readable) solution from an assembler hacker
would be:
var kb_head:word absolute $40:$1A;
    bk_tail:word absolute $40:$1C;
 ...
   kb_head:=kb_tail;  { flush keyboard buffer }

Rich

MATHRICH@umcvmb.missouri.edu (Rich Winkel UMC Math Department) (10/05/89)

In my previous posting (using kb_head & kb_tail) I used WORD for the data
type, forgetting that the word type only exists in TP 5.0 & 5.5.  Integer
would work just as well, so the same technique could be used in 4.0 (and 3.0,
if it allows the 'absolute' modifier).

Also, this technique may not work if you're using a TSR to expand your
keyboard buffer.

Rich

erja@epimetheus.dk (Erik Jacobsen) (10/05/89)

In article <21040@adm.BRL.MIL> MATHRICH@umcvmb.missouri.edu (Rich Winkel UMC Math Department) writes:
>The fastest (and least readable) solution from an assembler hacker
>would be:
>var kb_head:word absolute $40:$1A;
>    bk_tail:word absolute $40:$1C;
> ...
>   kb_head:=kb_tail;  { flush keyboard buffer }
>
>Rich

Isn't it necessary to disable interrupts in the assignment:


      var kb_head:word absolute $40:$1A;
          bk_tail:word absolute $40:$1C;
      ...
      inline($fa);       { disable interrupts. }
      kb_head:=kb_tail;  { flush keyboard buffer }
      inline($fb);       { enable interrupts. }

Erik
--------------------------------------------------------------------
Erik Jacobsen,     Computer Science Department,    Aarhus University
Ny Munkegade,    Building 540,       DK-8000 Aarhus C,       Denmark

Phone: +45 86127188, Telefax: +45 86135725, Home phone: +45 86169199
         Internet: erja@daimi.dk,           Ham-radio: OZ6KS