keyboard buffer
keyboard buffer
Anybody know how to empty the keyboard buffer and where is located? Thanx in advance...
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:keyboard buffer
it's somewhere in the BIOS variables area (some 0x40:????, if i remember well) and has 2 "pointers" to the 'next place to write' and the 'next char to read' (that's what we use to call a circular buffer).
In order to empty it, just move both pointer to the same location
In order to empty it, just move both pointer to the same location
Re:keyboard buffer
Thanx pype, I think it's 0040h:0071h ??? if i'm not wrong, but what I must write here exactly?!
PS
...if there's an interrupt that clear directly the keybord buffer I resolve all my problems...
PS
...if there's an interrupt that clear directly the keybord buffer I resolve all my problems...
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:keyboard buffer
do not know any interrupt to flush the keyboard except
while ({mov ah,1 ; int 16 ; zf==1} ) {
mov ah,0 ; int 16
}
the pointers i was talkin' about were at 040:1a and 040:1c, both are words that holds offset in the buffer (ranging from 0040:001e - 0040:003d ... some spying might be necessary to know if first location is referred as 0 or 1e by the bios)
in order to flush the buffer, just do
mov es, 0040
mov ax,[es:001c] ; read the offset of the last received char
mov [es:001a],ax ; overwrite the offset of the next-char-to-read
; the buffer is now empty
while ({mov ah,1 ; int 16 ; zf==1} ) {
mov ah,0 ; int 16
}
the pointers i was talkin' about were at 040:1a and 040:1c, both are words that holds offset in the buffer (ranging from 0040:001e - 0040:003d ... some spying might be necessary to know if first location is referred as 0 or 1e by the bios)
in order to flush the buffer, just do
mov es, 0040
mov ax,[es:001c] ; read the offset of the last received char
mov [es:001a],ax ; overwrite the offset of the next-char-to-read
; the buffer is now empty