Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team
Code: Select all
flush_keyboard:
.read_key: move.w #11,-(sp) ; Cconis()
trap #1
addq.l #2,sp
tst.w d0
beq.b .empty
move.w #8,-(sp) ; Cnecin()
trap #1
addq.l #2,sp
bra.b .read_key
.empty: rts
Code: Select all
move.w #$ff,-(sp)
move.w #$6,-(sp)
trap #1
addq.l #4,sp
tst.w d0
beq.s no_key
rockyone wrote:How to clear the keyboard buffer before using the Gemdos function $b "Cconis"
Code: Select all
loop:
....
move.w #$ff,-(sp)
move.w #$6,-(sp)
trap #1
addq.l #4,sp
tst.w d0
beq.s loop
....
charles wrote:is the keyboard buffer a circular buffer like midi?
just reset the head /tail pointer ?
using the keybdvec pointer
too abstract I know ..
but possible ???
from what I roughily remember if the head tail are different it sends interrupt hence the code command
conis
im always wrong
tell me im wrong please
Code: Select all
void flush_kbd(void)
{
while(Bconstat(2) != 0)
{
(void)Bconin(2);
}
}
Code: Select all
' sof
'
' PRINT XBIOS(34)
ptr%=XBIOS(14,1)
PRINT "keyboard input adrress";ptr%
PRINT "keyboard buf size";DPEEK(ptr%+4) ! size
PRINT "keyboard buf head-pos";DPEEK(ptr%+6) ! buffer-head
PRINT "keyboard buf tail-pos";DPEEK(ptr%+8) ! buffer-tail
PRINT "keyboard buf low mark=1/4size";DPEEK(ptr%+10) ! low mark (not used)1/4
PRINT "keyboard buf hi mark 3/4size";DPEEK(ptr%+12) ! high mark (not used)3/4
PRINT
'
SLPOKE &H4BA,0
PRINT "timer @ 0ms";TIMER
PRINT
PRINT "type some keystokes for the buffer"
PRINT
WHILE TIMER<600
WEND
PRINT "timer @ 600ms";TIMER
PRINT
'
' *************************************************************************
' *************************************************************************
' **** set the keyboard tail ********
' **** (which would be longer cause it indexes keystrokes) ********
' **** to the head-pos ********
' **** !!!! now the operating system cant detect any keystrokes!!! ********
' *************************************************************************
' *************************************************************************
'
' *************************************************************************
' **** try this next line of code active ,and altenatily deactive *********
' *************************************************************************
' DPOKE ptr%+8,DPEEK(ptr%+6) !poke tail-pos the head-pos... see what haps !!
' *************************************************************************
' *************************************************************************
' *************************************************************************
'
WHILE BIOS(1,2)
PRINT "your keystroke is:"+CHR$(BIOS(2,2) AND &X1111111)
WEND
'
PRINT "keyboard buf size";DPEEK(ptr%+4) ! size
PRINT "keyboard buf head-pos";DPEEK(ptr%+6) ! buffer-head
PRINT "keyboard buf tail-pos";DPEEK(ptr%+8) ! buffer-tail
PRINT "keyboard buf low mark=1/4size";DPEEK(ptr%+10) ! low mark (not used)1/4
PRINT "keyboard buf hi mark 3/4size";DPEEK(ptr%+12) ! high mark (not used)3/4
PRINT
'
END
'
eof
Users browsing this forum: No registered users and 2 guests