home *** CD-ROM | disk | FTP | other *** search
-
- Specification of Keyboard Software Interrupt ( INT 16H )
- --------------------------------------------------------
-
- description:
- Both INT 9h and INT 16h are keyboard interrupt.
- INT 9h is keyboard interrupt handler which puts scan code/ASCII
- code in keyboard buffer. Whereas INT 16h provides some function
- to get the scan code/ASCII code from keyboard buffer.
- In conclusion, we can consider INT 9h as hardware interrupt
- service routine which serves as an interface between keyboard
- and system(keyboard buffer), INT 16h is a software interrupt
- service routine which serves as an interface between keyboard
- buffer and users.
-
- function: (keyboard I/O)
-
- (ah) = 0 Read key
- (ah) = 1 Read status
- (ah) = 2 Return current shift status
- (ah) = 3 Set typematic rate
- (ah) = 4 reserved
- (ah) = 5 Write key
- (ah) = 6 - 0fh reserved
- (ah) = 10h Extented read key
- (ah) = 11h Extented read status
- (ah) = 12h Extented return current shift status
- (ah) = 13h - 0efh reserved
- (ah) = 0f0h -- Speed control
- *(ah) = 0f1h -- Read speed status
- (ah) = 0f2h -- Reserved
- *(ah) = 0f4h -- Cache control
- *(ah) = 0f5h -- Write Protect for disk
- (ah) = 0f6h - 0ffh -- Reserved
-
- NOTE:
- 1. * -- is Acer support special function only for i386 or i386SX
- model.
-
- 2. This interrupt must check if the current LED flag is equal to
- the previous flag to insure whether it is changed or not.
- If the LED flag is changed, indicating the user must have pressed
- the key that affects the flag, this routine will send command to
- the keyboard controller to correct the LED.
- It seems redundant to do this action because the keyboard
- hardware interrupt (INT 9) supported by BIOS does this action too.
- By consideration of one case, INT 9 may be intercepted by
- other application program which can ignore the setting of LED;
- this rountine can correct this error now.
-
- reference BIOS data area:
-
- 40:17 keyboard flag 1
- 40:18 keyboard flag 2
- 40:1A keyboard buffer head pointer
- 40:1C keyboard buffer tail pointer
- 40:1E - 3D keyboard buffer
- 40:80 keyboard buffer starting address
- 40:82 keyboard buffer ending address
- 40:96 keyboard flag 3
- 40:97 keyboard LED flag
-
- Note:
- 1. If function number (AH) > 12h, AH = AH - 12h will be returned. This
- is checked by IBM PC 3270 Emulation.
-
- 2. Function 0,1,10h, and 11h must check if the current LED flag
- is equal to the previous flag to insure whether it is changed
- or not. If the LED flag is changed, update the LED.
-
- 3. Check mode_indicator_update flag (bit 6 of 40:97) before update
- the LED.
-
- 4. Remember to disable H/W interrupt when it access the BIOS data,
- for preventing INT 9 access the same BIOS data at the same time.
-
-
- READ KEY
- description:
- This function will read a set of scan code/ASCII code from
- keyboard buffer. It will take the code away from keyboard
- buffer. If the keyboard buffer is empty, it will wait
- until there is at least one pair of data available.
-
- input: (ah) = 0
-
- output: (ah) = scan code
- (al) = ASCII char
-
- Note:
- 1. If the keyboard buffer is empty, call Keyboard Device Busy function
- (INT 15h, AX=9002h)
-
- 2. Throw away the invalid code (scan code <> 0 and ASCII char = 0F0h)
-
- 3. This function support the codes for 84-keys-compatible keyboard, so
- it is necessary to do the following transformations:
-
- (1) Throw away the code for 101-keys keyboard such as F11, F12, ...
- key (scan code > 84h)
-
- (2) If the scan code <> 0 and the ASCII char = 0E0h, transfer the
- ASCII char to 00h
-
- (3) If the scan code = 0E0h, transfer it to the associated scan code
- ('Enter' & '/' keys at the Keypad of 101-key keyboard)
-
-
- READ STATUS
- description:
- This function will return the keyboard buffer status
- to user, that is, it will tell the user whether krystroke
- is available or not.
-
- input: (ah) = 1
-
- output: (zf) = 1 -- no keystroke queued
- (zf) = 0 -- keystroke is available in queue, key in ax
-
- Note:
- 1. If the keystroke is available in queue, fetch the code but don't
- take it away from the queue (that is, don't adjust the head pointer).
- And it is the same as the Function 0 to support the codes for
- 84-keys-compatible keyboard.
-
-
- RETURN CURRENT SHIFT STATUS
- description:
- Whenever a "shift" key is pressed, no scan code/ASCII
- code is put into keyboard buffer. Instead, a shift
- status(one bit) is set. This function will tell you
- which key is depressed or which mode is set.
-
- input: (ah) = 2
-
- output: (al) = shift status
- bit 0 = 1 -- right-shift depressed
- bit 1 = 1 -- left-shift depressed
- bit 2 = 1 -- ctrl-shift depressed
- bit 3 = 1 -- alt-shift depressed
- bit 4 = 1 -- scroll mode set
- bit 5 = 1 -- num lock mode set
- bit 6 = 1 -- caps mode set
- bit 7 = 1 -- insert mode set
- Note : All the other registers is restored.
-
-
- SET TYPEMATIC RATE
- description:
- If a key(except shift status keys) is depressed, the
- keyboard handler will repeat the key until the key
- is released. This function supports the user to set
- typematic rate and delay time. The typematic rate is
- the rate that the handler repeat the key. Delay time
- is the time between the first keystroke (normal) and
- the second keystroke (repeated).
-
- input: (ah) = 03h
- (bl) - typematic rate (bit4-0)
-
- 00h = 30.0 10h = 7.5
- 01h = 26.7 11h = 6.7
- 02h = 24.0 12h = 6.0
- 03h = 21.8 13h = 5.5
- 04h = 20.0 14h = 5.0
- 05h = 18.5 15h = 4.6
- 06h = 17.1 16h = 4.3
- 07h = 16.0 17h = 4.0
- 08h = 15.0 18h = 3.7
- 09h = 13.3 19h = 3.3
- 0ah = 12.0 1ah = 3.0
- 0bh = 10.9 1bh = 2.7
- 0ch = 10.0 1ch = 2.5
- 0dh = 9.2 1dh = 2.3
- 0eh = 8.5 1eh = 2.1
- 0fh = 8.0 1fh = 2.0
-
- (bh) - delay value (bit1-0)
-
- 00h = 250ms
- 01h = 500ms
- 02h = 750ms
- 03h = 1000ms
-
- output:
- none
-
- WRITE KEY
- description:
- This function will put scan code/ASCII code (supported
- by user) into keyboard buffer as if you strike a key.
-
- input: (ah) = 5
- (cl) - ASCII code
- (ch) - scan code
-
- output:
- none
-
- EXTENEDED READ KEY
- description:
- This function is corresponding to ah = 0, but supports
- the 101/102 keyboard.
-
- input: (ah) = 10h
-
- output: (ah) = scan code
- (al) = ASCII code
-
- Note:
- 1. This function is corresponding to ah = 0, but supports the 101/102
- keyboard. So it is not necessary to do the transformations following
- by the Note 3 of the Function 0.
-
-
- EXTENDED READ STATUS
- description:
- This function is corresponding to ah = 1, but supports
- the 101/102 keyboard.
-
- input: (ah) = 11h
-
- output: (zf) = 1 -- no keystroke queued
- (zf) = 0 -- keystroke is available in queue, key in ax
-
- Note:
- 1. This function is corresponding to ah = 1, but supports the 101/102
- keyboard. So it is not necessary to do the transformations following
- by the Note 3 of the Function 0.
-
-
- EXTENDED RETURN CURRENT SHIFT STATUS
- description:
- This function is corresponding to ah = 2, but supports
- the 101/102 keyboard.
-
- input: (ah) = 12h
-
- output:
-
- (al) = bits from (40:17)
-
- bit 7 ins_key_active
- bit 6 caps_key_active
- bit 5 numlock_key_active
- bit 4 scroll_lock_active
- bit 3 alt_key_depress
- bit 2 control_key_depressed
- bit 1 left_shift_key_depressed
- bit 0 right_shift_key_depressed
-
-
- (ah) = bits for left and right ctl
- and alt keys from (40:18) and (40:96)
-
- bit 0 ----- left_ctl_shift
- bit 1 ----- left_alt_shift
- bit 2 ----- right_ctl_shift
- bit 3 ----- right_alt_shift
- bit 4 ----- scroll_shift
- bit 5 ----- num_shift
- bit 6 ----- caps_shift
- bit 7 ----- sys_shift
-
-
- SPEED CONTROL
- input:
- (ah) = 0f0h
- *(al) = 0 ====> Set 6M
- (al) = 1 ====> Set 8M
- (al) = 2 ====> Set top speed
- (al) = 3 ====> Set toggle
- √(al) = 4 ====> Set 10M mode
- √(al) = 5 ====> Set 12M mode
- (al) = 6 ====> Reserved
- √(al) = 7 ====> Set PC mode
- (al) = 8 ====> Set smart mode
- (al) = 9 ====> CX = Scale (0--7)
- Set speed scale
-
- NOTE:
- 1. * -- is reserved on Acer 1100/33c and 1100SX(p9).
- 2. √ -- is supported by Acer 1100/20 and 1100/16 model only, other
- model is reserved.
- 3. When set to top speed on 1100/25/20c and 1100/33c, cache on/off
- depend on status of CMOS.
-
-
-
- READ SPEED MODE OR SPEED SCALE
-
- input:
- (ah) = 0f1h
- output:
-
- (ax) = 0 ====> 6M
- (ax) = 1 ====> 8M
- (ax) = 2 ====> Top speed
- (ax) = 3 ====> Reserved
- (ax) = 4 ====> 10M
- (ax) = 5 ====> 12M
- (ax) = 6 ====> Reserved
- (ax) = 7 ====> PC
- (ax) = 8 ====> Smart mode
- (ax) = 9 ====> CX = SCALE (0--7)
-
-
- CACHE CONTROL
- input:
- (ah) = 0f4h
- (al) = 0 ====> return cache controller status
- (al) = 1 ====> set cache on
- (al) = 2 ====> set cache off
- output:
- (ah) = 0 ====> successful
- (cy) = 0 ====> successful
- (al) = 1 ====> cache on status
- (al) = 2 ====> cache off status
- (ah) = 1 ====> error
- (cy) = 1 ====> error