From: "Jésus" Newsgroups: comp.os.msdos.djgpp Subject: Re: Keybord Read Problem Date: 15 Apr 1998 20:15:36 GMT Lines: 45 Message-ID: <01bd6878$1823b740$LocalHost@topper> References: <35297B13 DOT 4E5CD995 AT earthlink DOT net> NNTP-Posting-Host: rouen2-36.hol.fr To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Steven S. Falls 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