From: ionicis AT geocities DOT com Newsgroups: comp.os.msdos.djgpp Subject: int 16h/func 00h Date: Fri, 07 Nov 1997 20:00:25 -0800 Organization: An Family Lines: 43 Message-ID: <3463E3D8.968C53AE@geocities.com> Reply-To: "DON'T CHANGE" NNTP-Posting-Host: 168.191.200.39 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Ok, what EXACTLY does that interrupt function do? I need to know EXACTLY what it does when called. I'm very new to keyboard interrupts, so below is a little code snippet I wrote as a test program for the keyboard interrupt functions. I want the program to prompt the user via the first printf(), and then call get_key(), and when the user presses a key (because I assume that int6h/00h waits for the user to hit a key, then returns the data), and then it tells the user what key was hit. For some reason, the first printf() dosen't execute until the user hits a key. When a key is hit, both printf()s execute. Why is this? BTW, I'm using DJGPP. Code snippet: #include #include #define KEYBOARD 0x16 char get_key() //the get_key functions, calls int 16h func 00h, and returns the ASCII value { union REGS regs; regs.h.ah = 0x00; int86(KEYBOARD, ®s, ®s); return regs.h.al; } main() { char key; printf("Press a key"); //this should execute first, but it dosen't key = get_key(); printf("\nThe key your pressed was '%c'!", key); return 0; }