Xref: news2.mv.net comp.os.msdos.djgpp:5527 From: robert DOT fremin AT mailbox DOT swipnet DOT se (Robert Fremin) Newsgroups: comp.os.msdos.djgpp Subject: Why is my program pausing at regular interalls? Date: Sat, 29 Jun 1996 12:26:01 GMT Organization: - Lines: 68 Message-ID: <31d51ccf.1258881@nntpserver.swip.net> NNTP-Posting-Host: dialup101-1-13.swipnet.se NNTP-Posting-User: 41e1c758e329b31c4d905147051ba029 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp I have located the above mystery to my DOS-int call: movb $0x0b, %ah int $0x21 // to get keyboard status I'm using this call as part of a GetKey(char ascii) function. In BC++ realmode, the same code runs without any problems, but in DJGPP it halts for some tenths of seconds every 2048 call, and doesn't break the program at the exact moment you press a key. Hmm, here is the whole test-program so you'll understand what I'm talking about... // kb_test.c unsigned char _ascii; char GetKey(char ascii) // true if key has been pressed { _ascii = ascii; asm volatile (" movb $0x0b, %ah int $0x21 cmpb $0x00, %al je false1 movb $0x08, %ah int $0x21 cmpb __ascii, %al jne false1 movl $0x01, %eax jmp end1 false1: movl $0x00, %eax end1: "); } void main() { unsigned long counter = 0; do { printf("%08d", counter++); // show the running counter } while (!GetKey(' ')); // wait for space to be pressed // the exit should be instant } // end of kb_test.c BTW, is my solution of return-code the best (without using the complex extended inline assembly)? I had to put the labels inside the "" of asm, so I couldn't do like this; jne false1 "); return 1; false1: return 0; --- Robert Fremin ----------------------------------- --- http://bip.concept.se/user/sprite/hemsida.htm --- -----------------------------------------------------