home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Unsorted BBS Collection
/
thegreatunsorted.tar
/
thegreatunsorted
/
programming
/
misc_programming
/
int9.spc
< prev
next >
Wrap
Text File
|
1990-01-05
|
13KB
|
250 lines
Specification of Keyboard Hardware Interrupt ( INT 9H )
-------------------------------------------------------
Description:
This routine supports an interface between system and keyboard.
When you strike a key, an interrupt occurs, which invokes the
routine to put ASCII code and scan code in keyboard buffer or
set keyboard flag ("Shift", "Alt, "Crtl"...).
function: keyboard handler
----------------
input:
none
output:
none
reference BIOS data area:
40:17 keyboard flag 1
40:18 keyboard flag 2
40:19 input number of Alternate key
40:1A keyboard buffer head pointer
40:1C keyboard buffer tail pointer
40:1E - 3D keyboard buffer
40:71 break key state
40:72 warm start flag
40:80 keyboard buffer starting address
40:82 keyboard buffer ending address
40:96 keyboard flag 3
40:97 keyboard LED flag
*40:b6 Keyboard active (bit 7) (For 1100LX only)
40:D2 bios_d
port defined:
60h --- Input/Output Buffer
64h --- 8042 Command Port (WRITE)
8042 Status Port (READ)
Programming:
The main structure of INT 9 is as follows:
- enable H/W interrupt
- save registers
- disable keyboard interface
- read keyboard code
- set carry flag then call Keyboard Intercept function (INT 15h,AH=4Fh)
- IF return carry THEN
analyze the keyboard code and do the relative process
ELSE
nothing to process because Keyboard Intercept function has already
been processed
ENDIF
- disable H/W interrupt
- enable keyboard interface
- call Interrupt Complete function (INT 15h, AX=9102h)
- send EOI
- restore registers
- IRET
Note:
1. Enable H/W interrupt allows the coming of the higher priority H/W
interrupt.
2. Disable keyboard interface before reading keyboard code to avoid the
reentry of keyborad code during analyzing and processing time.
3. Set carry flag before calling the Keyboard Intercept function to solve
IBM 3270 SDLC (no add-on card version) problem.
4. Disable H/W interrupt before enabling keyboard interface to avoid the
reentry of keyborad code too quickly and causing a stack overflow.
5. When a make key is read from I/O port 60h, the ASCII and scan code
are placed in keyboard buffer (40:1e - 3d) at address keyboard_tail
pointer. The keyboard_tail pointer is increased by two unless it wraps
past the end of the buffer.
6. It will issue a short beep when the keyboard buffer is full or when it
received a keyboard overrun code (code 0FFh).
7. For shift state (ctrl, shift and alt), will update the keyboard flag 1
(40:17) keyboard flag 2(40:18), keyboard flag 3(40:96), and keyboard
LED flag(40:97).
8. Check the mode_indicator_update flag (bit 6 of 40:97) before update
the LED.
9. The Ctrl-Alt-Del sequence places 1234h in the warm start flag (40:72),
then jumps to the POST.
It will bypass when in setup (bit 7 of 40:D2 is set), to prevent a
warm start during setup time.
10. The Pause key causes the handler to loop until a valid key is entered.
11. The PrintScreen key will invoke INT 5h.
12. The Ctrl-Break sequence sets bit 7 of break key state (40:71), places
0000h in keyboard buffer, and then invokes INT 1Bh.
13. The SysRq make key invokes INT 15h, AX=8500h.
The SysRq break key invokes INT 15h, AX=8501h.
14. The Ctrl-Alt-Esc sequence jumps to the setup routine.
It will bypass in setup (bit 7 of 40:D2 is set), to prevent the
reentry during Setup time.
15. The Ctrl-Alt-"+" sequence toggles the CPU speed.
16. This routine sets the active flag (40:b6h bit 7) on the Laptop 1100LX
model.
---------------------------------------------------------------------------
:scan :84-Key:101-Key:Base : Upper:Number : Ctrl :Alt : key :
:code : : :case : case :Lock : : : :
---------------------------------------------------------------------------
(00) 00
(01) 01 110 90 011B 011B 011B 01F0 ESC
(02) 02 2 2 0231 0221 -1 7800 1 !
(03) 03 3 3 0332 0340 0300 7900 2 @
(04) 04 4 4 0433 0423 -1 7A00 3 #
(05) 05 5 5 0534 0524 -1 7B00 4 $
(06) 06 6 6 0635 0625 -1 7C00 5 %
(07) 07 7 7 0736 075E 071E 7D00 6 ^
(08) 08 8 8 0837 0826 -1 7E00 7 &
(09) 09 9 9 0938 092A -1 7F00 8 *
(0A) 10 10 10 0A39 0A28 -1 8000 9 (
(0B) 11 11 11 0B30 0B29 -1 8100 0 )
(0C) 12 12 12 0C2D 0C5F 0C1F 8200 - _
(0D) 13 13 13 0D3D 0D2B -1 8300 = +
(0E) 14 15 15 0E08 0E08 0E7F 0EF0 BackSpace
(0F) 15 16 16 0F09 0F00 9400 A500 Tab
(10) 16 17 17 1071 1051 1011 1000 Q
(11) 17 18 18 1177 1157 1117 1100 W
(12) 18 19 19 1265 1245 1205 1200 E
(13) 19 20 20 1372 1352 1312 1300 R
(14) 20 21 21 1474 1454 1414 1400 T
(15) 21 22 22 1579 1559 1519 1500 Y
(16) 22 23 23 1675 1655 1615 1600 U
(17) 23 24 24 1769 1749 1709 1700 I
(18) 24 25 25 186F 184F 180F 1800 O
(19) 25 26 26 1970 1950 1910 1900 P
(1A) 26 27 27 1A5B 1A7B 1A1B 1AF0 [ {
(1B) 27 28 28 1B5D 1B7D 1B1D 1BF0 ] }
(1C) 28 43 43 1C0D 1C0D 1C0A 1CF0 Enter
(1D) 29 30 58 ## ## ## ## L-CTL
(1E) 30 31 31 1E61 1E41 1E01 1E00 A
(1F) 31 32 32 1F73 1F53 1F13 1F00 S
(20) 32 33 33 2064 2044 2004 2000 D
(21) 33 34 34 2166 2146 2106 2100 F
(22) 34 35 35 2267 2247 2207 2200 G
(23) 35 36 36 2368 2348 2308 2300 H
(24) 36 37 37 246A 244A 240A 2400 J
(25) 37 38 38 256B 254B 250B 2500 K
(26) 38 39 39 266C 264C 260C 2600 L
(27) 39 40 40 273B 273A -1 27F0 ; :
(28) 40 41 41 2827 2822 -1 28F0 ' "
(29) 41 1 1 2960 297E -1 29F0 ` ~
(2A) 42 44 44 ## ## ## ## L-SHIFT
(2B) 43 14 2/42 2B5C 2B7C 2B1C 2BF0 \ |
(2C) 44 46 46 2C7A 2C5A 2C1A 2C00 Z
(2D) 45 47 47 2D78 2D58 2D18 2D00 X
(2E) 46 48 48 2E63 2E43 2E03 2E00 C
(2F) 47 49 49 2F76 2F56 2F16 2F00 V
(30) 48 50 50 3062 3042 3002 3000 B
(31) 49 51 51 316E 314E 310E 3100 N
(32) 50 52 52 326D 324D 320D 3200 M
(33) 51 53 53 332C 333C -1 33F0 , <
(34) 52 54 54 342E 343E -1 34F0 . >
(35) 53 55 55 352F 353F -1 35F0 / ?
(36) 54 57 57 ## ## ## ## R-SHIFT
(37) 55 - - 372A ## 7200 37F0 PrtSc (PC)
(38) 56 58 60 ## ## ## ## L-ALT
(39) 57 61 61 3920 3920 3920 3920 Space Bar
(3A) 58 64 30 ## ## ## ## CAP-LOCK
(3B) 59 70 12 3B00 5400 5E00 6800 F1
(3C) 60 65 13 3C00 5500 5F00 6900 F2
(3D) 61 71 14 3D00 5600 6000 6A00 F3
(3E) 62 66 15 3E00 5700 6100 6B00 F4
(3F) 63 72 16 3F00 5800 6200 6C00 F5
(40) 64 67 17 4000 5900 6300 6D00 F6
(41) 65 73 18 4100 5A00 6400 6E00 F7
(42) 66 68 19 4200 5B00 6500 6F00 F8
(43) 67 74 20 4300 5C00 6600 7000 F9
(44) 68 69 21 4400 5D00 6700 7100 F10
(45) 69 95 90 ## ## ## ## NUM-LOCK
(46) 70 100 25 ## ## ## ## SCROLL-LOCK
(47) 71 91 91 4700 4737 4737 7700 Buf- Home (Keypad)
(48) 72 96 96 4800 4838 4838 8D00 Buf- Up (Keypad)
(49) 73 101 01 4900 4939 4939 8400 Buf- PgUp (Keypad)
(4A) 74 107 05 4A2D 4A2D 4A2D 8E00 4AF0 - (Keypad)
(4B) 75 92 92 4B00 4B34 4B34 7300 Buf- <-- (Keypad)
(4C) 76 97 97 4CF0 4C35 4C35 8F00 Buf- enter(Keypad)
(4D) 77 102 02 4D00 4D36 4D36 7400 Buf- --> (Keypad)
(4E) 78 108 06 4E2B 4E2B 4E2B 9000 4EF0 + (Keypad)
(4F) 79 93 93 4F00 4F31 4F31 7500 Buf- End (Keypad)
(50) 80 98 98 5000 5032 5032 9100 Buf- Down (Keypad)
(51) 81 103 103 5100 5133 5133 7600 Buf- PgDn (Keypad)
(52) 82 99 99 5200 5230 5230 9200 Buf- INS (Keypad)
(53) 83 104 104 5300 532E 532E 9300 -1 DEL (Keypad)
(54) 84 105 - ## ## ## ## SYS (PC)
(55) 85 - - 4A00 4B00 4300 -1
(56) 86 - - 565C 567C -1 -1 KEY-102 Only
(57) 87 - 122 8500 8700 8900 8B00 F11
(58) 88 - 123 8600 8800 8A00 8C00 F12
59-FF - -
E0 1C - 108 E00D E00D E00A A600 Enter(Keypad)
E0 1D - 64 ## ## ## ## R-CTL
E0 35 - 95 E02F E02F 9500 A400 / (Keypad)
37 - 100 372A 372A 9600 37F0 * (Keypad)
E0 38 - 62 ## ## ## ## R-ALT
E0 47 - 80 47E0 47E0 47E0 77E0 9700 Home (New)
E0 48 - 83 48E0 48E0 48E0 8DE0 9800 Up (New)
E0 49 - 85 49E0 49E0 49E0 84E0 9900 PageUp (New)
E0 4B - 79 4BE0 4BE0 4BE0 73E0 9B00 <-- (New)
E0 4D - 89 4DE0 4DE0 4DE0 74E0 9D00 --> (New)
E0 4F - 81 4FE0 4FE0 4FE0 75E0 9F00 End (New)
E0 50 - 84 50E0 50E0 50E0 91E0 A000 Down (New)
E0 51 - 86 51E0 51E0 51E0 76E0 A100 PageDown(New)
E0 52 - 75 52E0 52E0 52E0 92E0 A200 Insert (New)
E0 53 - 76 53E0 53E0 53E0 93E0 A300 Delete (New)
Note:
(1) Symbol Definition:
'-' = not defined
'-1' = INT 9 service routine will not do anything
'##' = special actions such as setting keyboard flags, print
screen, system request
'Buf-' = accumulate the input number before releasing the Alt key
(2) Scan codes of special 101/102 keys combination:
Key : PrintScreen
Key No. : 124
Base Case : E0 2A E0 37/E0 B7 E0 AA (PrintScreen)
Shift Case : E0 37/E0 B7 (PrintScreen)
Ctrl Case : E0 37/E0 B7 (7200)
Alt Case : 54/D4 (System Request)
Key : Pause
Key No. : 126
Base Case : E1 1D 45 E1 9D C5 (Pause, Ctrl-NumLock)
Shift Case : E1 1D 45 E1 9D C5 (Pause, Ctrl-NumLock)
Ctrl Case : E0 46 E0 C6 (Break)
Alt Case : E1 1D 45 E1 9D C5 (Pause, Ctrl-NumLock)
--------------------------------------------------------------------------