Mail Archives: djgpp/1997/09/17/22:00:26
Seby Carta <cartas AT sr DOT flashnet DOT it> wrote:
> Hi,
> I wrote a keyboard handler, how can i read and set correctily ctrl, alt
> and shift keys ?
> I know there are memory regions of bios that should be readed and writed
> when change the state of this special keys......How i can access them ?
> Can you help me ??
It depends on how you wrote your handler. The following is snarfed from
a keyboard handler I myself wrote; scancode here is the raw scan code returned
by the keyboard controller. A complete list of scan codes can be found in
Ralf Brown's Interrupt List, probably one of the figures accompanying INT 09.
switch(scancode) /* shiftstates, now. */
{
case 0x2A:
case 0x36:
flags.shiftstate = 1; ascii = 0; break;
case 0x1D: flags.ctrlstate = 1; ascii = 0; break;
case 0x38: flags.altstate = 1; ascii = 0; break;
case (0x2A|0x80):
case (0x36|0x80):
flags.shiftstate = 0; return(1);
case (0x1D|0x80): flags.ctrlstate = 0; return(1);
case (0x38|0x80): flags.altstate = 0; return(1);
}
As you can see, 0x2A and 0x36 are the shifts. (Which is right and which is
left, I can't remember.) 0x1D is control, and 0x38 is alt. If the scancode
has the high bit set (0x80) it indicates that the key has been let go. (The
"break" codes, as opposed to those that -don't- have the high bit set: "make"
codes.)
Reading the BIOS memory will not help you at all, since you have replaced
the keyboard handler and the BIOS is no longer receiving keyboard information.
--
[- firewind -]
[- email: firewind AT metroid DOT dyn DOT ml DOT org (home), firewind AT aurdev DOT com (work) -]
[- "You're just jealous because the voices talk to -me-." -]
- Raw text -