Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!caen!news.cs.indiana.edu!ux1.cso.uiuc.edu!s.psych.uiuc.edu!amead From: amead@s.psych.uiuc.edu (alan mead) Newsgroups: comp.lang.pascal Subject: Re: Interrupt 9 Processing Message-ID: <1991Jun27.234613.6472@ux1.cso.uiuc.edu> Date: 27 Jun 91 23:46:13 GMT References: <27309@adm.brl.mil> Sender: usenet@ux1.cso.uiuc.edu (News) Organization: University of Illinois at Urbana Lines: 72 dm2368@eecs1.eecs.usma.edu (Fichten Mark CPT) writes: >> From: Carl David >[ interrupt 9 discussion deleted] >> I am creating a cryptogram, such that each letter typed by the user >> is substituted from a table in memory, such that to get the computer to >> operate the player would need to solve the cryptogram, how would I handle >> the multiple keys and uppercase lowercase problems? >> Thanks for any help you can give me. >I think that you can avoid the interrupt situation completely and just >write a program using the ReadKey and KeyPressed routines in TP. >[and then what to do] >CPT Mark Fichten | INTERNET: fichten@eecs1.eecs.usma.edu | >Captain U.S. Army | @trotter.edu:dm2368@eecs1.eecs.usma.edu | >Work: (914) 938-5580 | USENET: rutgers.edu!trotter!eecs1!dm2368 | Well. Readkey and KeyPressed won't respond to the "shift" keys. I have a couple excellant articles on INT 09---if you want a citation, please email me. [From memory] When a key is pressed or released, the keyboard controller generates a hardware interrupt. The BIOS routine at INT 09 services the keyboard at that time. Servicing a hardware interrupt is somewhat complex (like you have to send a code to the right port when you're finished). I don't pretend to know those details, but I've seen code that appears to work. The BIOS throws away a lot of useful keystrokes--most notibly the KEY RELEASED signals. It also refuses to differentiate between left and right "shift" keys for the sake of backwards compatibility. So to get on with an answer to the original question: What happens in INT 09 when it services the keyboard? The BIOS scans the shift status byte (I don't know which one, but I'd be suprised if it bothers with the more recent one). It ignores many combinations. For those lucky enough to be reported, the BIOS: 1 checks to see if the circular buffer is full; 2a if not--increments the pointer 2a1 places the SCAN code in the high byte of the current word in the keyboard buffer; 2a2 places the ASCII character (well, the IBM ASCII version) into the lo byte of the current word; 2b if so--beeps at you I don't remember how the shift status of the key is incorporated. I *think* the scan code is shifted. I believe the main use of the scan code is to determine which of two identical keys were pressed (ie, on an extended keyboard, was it the "grey +" or the "white +"), and as such hasn't been that much help to me. Somewhere I have a list (not electronic) of what is where. The TP manual has a brief list as well (appendix C). So, to capture each key and especially to "trick" the computer, you will need to install your own INT 09 handler. But if you don't want to write your own, the code from a Turbo Technix article used to be available by anon FTP. I didn't see any familiar names on GArbo or Wustl, but the package below at wuarchive.wustl.edu might be useful, or I could make the above package available to a FTP site. TPENHKBD.ZIP B 8031 901116 TP unit enabling extended keys for std/enh kbd I hope this helps. -alan mead : amead@s.psych.uiuc.edu