From: firewind Newsgroups: comp.os.msdos.djgpp Subject: Re: Special keys problem. Date: 18 Sep 1997 00:20:22 GMT Organization: Netcom Lines: 41 Message-ID: <5vps46$bj7@dfw-ixnews8.ix.netcom.com> References: <34202216 DOT DA007B5E AT sr DOT flashnet DOT it> NNTP-Posting-Host: elp-tx2-02.ix.netcom.com Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Seby Carta 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-." -]