c60c-3ds@web-1b.berkeley.edu (03/08/89)
Do the Bconin and Bconstat functions lie?
while (c!='q') {
if (x=Bconstat(2)) c=Bconin(2);
printf("%d %c\n",x,c);
}
When I hold down a key, it starts with Bconstat=-1, which means a
character is waiting, and then Bconin gets that character. After the key
starts auto repeating, Bconstat starts to flip back to 0 sporadically (no
character waiting). I let go of the key, and Bconstat goes to 0 (no key
waiting), which is fine.
Then when I press 'q' to quit, and I see the keyboard buffer dumped
out (into the Gulam shell). If I had put a getchar() after the loop,
the keyboard buffer would be barfed out there. In any case, some keys
were missed and just sat in the buffer.
Shouldn't Bconstat return -1 until they keyboard buffer is empty?
I'm asking this because I wrote a small game that used the keyboard.
After a while of playing, the buffer would fill up, overwrite ram, and crash
the machine (this is a known bug in the keyboard handler).
P.S. Are there better ways to get keys from the keyboard? i've tried
evnt_multi(), and it does the same thing, no matter how long a delay
I tell evnt_multi() to generate.
John Kawakami c60c-3ds@web.berkeley.edu
cs163afu@sdcc10.ucsd.EDU (Some call me...Tim) (03/09/89)
In article <21306@agate.BERKELEY.EDU> c60c-3ds@web-1b.berkeley.edu () writes: > >Do the Bconin and Bconstat functions lie? > I've encountered this before, and I forget how I resolved it, but I think my theory was that GEMDOS was eating the characters--i.e. you can probably find them in CONIN and CONSTAT, GEMDOS $01 and $0b. ------------- Tim Mensch Internet: tmensch@ucsd.edu