[comp.sys.ibm.pc] Keyboard Scan Codes

ALG106@PSUVM.BITNET (04/13/89)

I am writing a program in Turbo Pascal and need to get the scan codes from
when a key is released.

      Actual problem is - I have to be able to tell when a key is pressed
          when I have another key down.  I also have to tell when original
          key is released.
                                Thanks,
                                  Andy

pathak@s.cs.uiuc.edu (04/21/89)

You may not have to write your own int9 routine.  If all you want is the 
status of the shift keys, control keys, alt keys .... then you can use 
a BIOS function to do the same.

int 16h	func 02h
call with:	AH = 02h

Returns in AL:

	Bit		Significance if set
	 7		Insert on
	 6		Caps lock on
	 5		Num lock on
	 4		Scroll Lock on
	 3		Alt key down
	 2		Ctrl key down
	 1		left Shift down
	 0 		right Shift down

The enhanced keyboard that came with the AT and PS/2 can be read
using:

int 16h	func 12h

call with AH = 12h

Returns in AL:

	Bit 		Significiance
	 F		SysReq down
	 E		Caps Lock down
	 D		Num Lock down
	 C		Scroll Lock down
	 B	  	right Alt
	 A		right Ctrl
 	 9		left Alt
	 8 		left Ctrl

and the rest is the same as before


Heeren Pathak
s.cs.uiuc.edu