Click to See Complete Forum and Search --> : Clear Keyboard buffer?


Kindred
November 7th, 2006, 09:00 PM
Hi, I'm new and im hoping someone can help me.
I am currently working a project in which the user will press X and the program terminates. I am using INT 16H Function 01H and it reads and retrieves data that the user enters from the keyboard buffer.
Problem is that after the user presses X the first time, the second time he runs it and presses X, nothing happens.
Im hoping clearing the Keyboard buffer before calling that function will help thats why i want to know if anyone knows how to clear the Keyboard buffer

Krishnaa
November 8th, 2006, 04:34 AM
I think you should use AH = 00h to read the key.


00h Get a key from the keyboard, return code in AX.
01h Test for available key, ZF=1 if none, ZF=0 and
AX contains next key code if key available.
02h Get shift status. Returns shift key status in AL.
03h Set Autorepeat rate. BH=0,1,2,3 (delay time in
quarter seconds), BL=0..1Fh for 30 char/sec to
2 char/sec repeat rate.
05h Store scan code (in CX) in the type ahead buffer.
10h Get a key (same as 00h in this implementation).
11h Test for key (same as 01h).
12h Get extended key status. Returns status in AX.

Kindred
November 8th, 2006, 11:53 AM
The thing is that 00H will stop everything until a key is hit. I have an animation running and it can't stop. It has to keep running until the user presses 'x'. The main problem i want help with is how can i implement the ability to exit the program when X is hit.