| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | #defines |
> In this case i was looking at my getch() function, which uses INT16.
> Unfortunately, there are at least three types of k/boards commonly in
> use, and they're read with different values in AH 0x01,0x11,i forget the
> third .
Should be only two: XT keyboard and extended (101) keyboard.
> So in order to make this function realize, which one to use i have
> to access the CMOS to get the KB IDbyte, and set AH accordingly.
> A #define would've been beutiful, but the way it is, the IDbyte has to be
> fetched on each call or placed in a static char on the
> first call, but that still adds an if statement.
But examining a local variable doesn't involve a lot of overhead compared
with poking around in lower memory.
static char ext_kbd = (char)-1;
static int
getkbdchar(void)
{
if (ext_kbd == (char)-1)
ext_kbd = (char *)MK_FP(x,y) & 0x10;
return int16(ext_kbd | 1);
}
.. or something similar, however it is that you call int 16h and at
whatever address the extended keyboard byte is at (sorry, it's been years
since I last dealt with this so I don't recall the details).
--- MaltEd/2 1.0.b6
* Origin: Unique Computing Pty Limited (3:632/348)SEEN-BY: 633/267 270 @PATH: 632/348 635/503 50/99 635/728 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.