Mail Archives: djgpp/1998/04/16/01:08:46
Steven S. Falls <broadview AT earthlink DOT net> a écrit dans l'article
<35297B13 DOT 4E5CD995 AT earthlink DOT net>...
> Does anyone know how to make the keybord read without a wait or an
> error. For example, The commen code to deal with haveing only a keybord
> read would be...
> unsigned userinput;
> if(kbhit()) userinput=getkey() //or getch()
>
> but the problem is that it does not get the first key you press. You
> often get a delay or you have to press the key twice. Does anyone know
> how to deal with this problem?
> Thnaks,
> -Ardy
> http://www.addr.com/~ardy/
>
>
I'm french, sorry for my bad english.
I made this function in ASM for DJGPP.
It seems to work, but it isn't sure.
char scan_kb()
{
char k;
asm ("
movb $1,%%ah
int $0x16
jz pas
movb $0,%%ah
int $0x16
movb %%ah,%0
pas: "
:"=0"(k)
:"a"(k)
);
return k;
}
It works like kbhit() and getch() combined.
If it doesn't work, send me a message.
jacquespierre DOT pique AT hol DOT fr
- Raw text -