Mail Archives: djgpp/1997/12/05/13:45:47
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 <fighteer AT cs DOT com>
-----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------
- Raw text -