From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: keyboard problem! Date: Sat, 06 Dec 1997 08:10:08 +0000 Organization: Two pounds of chaos and a pinch of salt Lines: 53 Message-ID: <34890860.5561@cs.com> References: <65iu4r$ca1$1 AT yeppa DOT connect DOT com DOT au> <6608mn$g5u AT mtinsc05 DOT worldnet DOT att DOT net> <3485301B DOT 3A13 AT trash DOT lip6 DOT fr> <34878CD0 DOT 3AB5 AT mailexcite DOT com> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp218.cs.com 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 Doug Gale wrote: > > There is a big difference! > > The BIOS call always reads the keyboard. > > getch() reads from standard input, which may have been redirected at the > command-line to read from a device or a file. You might be right, if you were talking about getchar(). But getch() is a conio function that reads a single keystroke from the BIOS keyboard interrupt. The relevant code is in src/libc/pc_hw/co80/conio.c: int getch(void) { __dpmi_regs regs; int c; if (char_avail) { c = ungot_char; char_avail = 0; } else { regs.x.ax = 0x0700; __dpmi_int(0x21, ®s); c = regs.h.al; } return(c); } I don't know if this is functionally equivalent to reading from 0x16. To the original poster: I suggest you look in the DJGPP sources to see exactly how the conio functions handle all the various keyboard-related issues. Also, a big tip: use __dpmi_int instead of int86 for most interrupt-related functions. Not only does it support more functions, but it also handles things like zeroing the stack pointer and other overhead work. hth -- John M. Aldrich, aka Fighteer I -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS d- s+:- a-->? C++>$ U@>++$ p>+ L>++ E>++ W++ N++ o+>++ K? w(---) O- M-- V? PS+ PE Y+ PGP- t+(-) 5- X- R+(++) tv+() b+++ DI++ D++ G>++ e(*)>++++ h!() !r !y+() ------END GEEK CODE BLOCK------