[comp.lang.pascal] Interupt 9 processing

DAVID1%UCONNVM.bitnet@vm.its.rpi.edu ( Carl David) (06/28/91)

I have a problem in understanding Interupt 9 handling, which I am doing
in Turbo Pascal, and I wonder if someone with real knowledge about how
it works can help me.
I would like to understand, with emphasis on understanding, what is
happening when a multiple key stroke is being read, for instance,
Ctrl-RightShift-J.
What ends up in the keyboard buffer?
For single keys, I understand what is going on, but for multiple ones I
don't.
Thus, is the address (which I forgot) which holds the status bits for
NumLock, etc., being set when one depresses and releases the Ctrl,
Alt, Shift, etc. keys?
Can I write to those locations so that when a character comes along I
can trick the computer into thinking that the Ctrl (or something else)
key was depressed?
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.
Carl David
DAVID1 at UCONNVM.bitnet

bobb@vice.ICO.TEK.COM (Bob Beauchaine) (06/28/91)

In article <27307@adm.brl.mil> DAVID1%UCONNVM.bitnet@vm.its.rpi.edu ( Carl David) writes:
>
>I have a problem in understanding Interupt 9 handling, which I am doing
>in Turbo Pascal, and I wonder if someone with real knowledge about how
>it works can help me.
>I would like to understand, with emphasis on understanding, what is
>happening when a multiple key stroke is being read, for instance,
>Ctrl-RightShift-J.
>What ends up in the keyboard buffer?
>For single keys, I understand what is going on, but for multiple ones I
>don't.
>Thus, is the address (which I forgot) which holds the status bits for
>NumLock, etc., being set when one depresses and releases the Ctrl,
>Alt, Shift, etc. keys?
>Can I write to those locations so that when a character comes along I
>can trick the computer into thinking that the Ctrl (or something else)
>key was depressed?
  
  First, I agree that you probably don't need to intercept vector 9
  to access the keyboard the way you want.  However, if you insist, 
  this may be of some use.

  Using interrupt 9, the keyboard scan code is available at port $60
  (at least on nearly all IBM compatibles) when interrupt 9 fires off.  
  Note, this is the scan code, not the ascii value of the key.  The 
  scan code is unique for every key on your keyboard.  Also, *any* 
  key press will generate an interrupt 9, including the shift,control,
  function keys, etc...

  This scan code is "mixed" with the byte at location $0000:$0417, 
  which indicates which (if any) of the shift,ctrl,alt,caps,numlock,
  or insert keys are active.  This information is placed at the head
  of the keyboard buffer, provided there is room.

  That's really all there is to it.  Of course, there are other issues 
  too detailed to go into here if you plan on actully intercepting or
  chaining interrupt 9, which I don't suggest unless you are writing
  TSR's.

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ 

Bob Beauchaine bobb@vice.ICO.TEK.COM 

C: The language that combines the power of assembly language with the 
   flexibility of assembly language.

   "It seems that the less a statesman amounts to, the more he appears
   to love the flag".