T1000KBD by Andrew Rossmann 4/1/88 requirements: Tandy 1000/A/SX/EX/TX/HX 432 bytes of available memory This program will let your Tandy 1000's keyboard emulate (fairly well) the AT extended keyboard (the one with 12 function keys.) It also increases the compatibility of your keyboard with many programs. A little before IBM introduced the PS/2 computers, it started shipping its AT's with a new keyboard that had 12 function keys. It had the arrow keys and the word processing keys (PGUP etc..) in separate clusters. It also has a / key next to the keypad. Luckily, the Tandy 1000 has 12 function keys, and a separate arrow keys cluster. Unfortunately, only the HOME key is separated. Despite this, I was able to get emulation with only a few kludges. The first benefit of this program will be some programs that read keys as a combination of character and scan code. This primarily affects keys such as: \, |, ~, and ` that Tandy put on the keypad. It also affects the - and + keys on the keypad, since Tandy mixed them with the Insert and Delete keys. These changes are the same as in the KEYCNVRT.SYS device driver that came with your computer. All keyboard requests normally come from using INT 16h, with the function numbers of 0, 1 or 2 in AH. Function 0 will wait for a key, then return its code. For normal keys, AL=character code and AH=scan code. For special keys, AL=0 and AH=special code. Function 1 checks if a key is ready, and sets the Z flag if a key is NOT ready. If one IS ready, AX will act as in function 0, but the key is not actually taken from the buffer. You must still issue a function 0 to actually 'grab' the key. Function 3 returns with AL set to the state of the shift keys in the form: Bit 7 6 5 4 3 2 1 0 Meaning 1 . . . . . . . Insert state (1 = yes) . 1 . . . . . . Caps Lock (1 = ON) . . 1 . . . . . Num Lock (1 = ON) . . . 1 . . . . Scroll Lock (1 = ON) (Use Shift-BREAK on the 1000) . . . . 1 . . . ALT shift (1 = depressed) . . . . . 1 . . CTRL shift (1 = depressed) . . . . . . 1 . Left SHIFT (1 = depressed) . . . . . . . 1 Right SHIFT (1 = depressed) NOTE: In all discussions, I have shortened Shift, Ctrl and ALT to s, c and a, respectively. ex: sF11 means SHIFT-F11. On the extended keyboard, using these function codes will only return 'standard' PC codes. F11, F12 and combinations such as aArrow will not do anything. In order to get these keys, you must use functions 10h, 11h and 12h. They function the same as 0, 1 and 2, but return the new codes. When you run T1000KBD, those 'high' INT 16h function codes will be converted down to normal function codes. All combinations involving F11, F12, TAB, INSERT, DELETE, c, HOME, ENTER and the arrow keys work as you would expect. The following combinations are the 'kludges': c, use c (think of the ~ above the 8) c, use c= (think of the + above the =) c, use c (think of the \ above the 7) c, use c8 (keyboard, not keypad. Think of the * above the 8) aPGUP, use a[ (think of these as the 'top' and ) aPGDN, use a] ( 'bottom' of a page turned sideways) aEND, use a. (the normal period) (think of it as the 'end' of a page) Also, sArrow and sHOME are converted into the numeric keypad number equivalents. i.e. Since the up-arrow key would normally be on the key, pressing sUpArw would give you an '8'. HOME is normally on the key, so sHOME returns a '7'. I should note that with this program in memory, you will not be able to run DESKMATE properly since sArrow, F11, F12, sF12, cUpArw, and cDnArw have been re-mapped. Because there are so many versions of Deskmate now, I cannot give patches for it. You can sort of use aUpArw for F11, a[ for F12, aDELETE for sF12, F11 for sUpArw, F12 for sDnArw, sF11 for sLfArw, sF12 for sRtArw, c= for cUpArw, and c8 for cDnArw. The same holds true for BASIC's KEY 11 and KEY 12. NOTE!!: Programs that directly read scan codes, such as Flight Simulator, will NOT be helped by this program. You can usually tell those programs by the way the arrow keys work as if they were still part of the keypad. I haven't done much extensive testing with this program. Turbo Pascal 4 does properly recognize the keys when customizing its editor using the TINST program. I'm not sure how programs will figure out what type of keyboard a person has. The only way I can think of is to check some special identity bytes in the ROMS. As it is, it seems most programs don't really care. They'll recognize the special keys either way. This program converts functions 10h, 11h, and 12h into 0, 1 and 2, respectively, so programs that try to use it will think this is an extended keyboard. I hope. Also, some programs (such as PC-Write) may have to be re-configured to work properly under the 'new' codes, especially if you took advantage of special Tandy 1000 keys. The following is a list of every single special key combination on my Tandy 1000SX. All of these codes are special in that they have AL=0. All numbers assume NUM-LOCK is OFF. Code Key Comment 0 BREAK also sBREAK 1-2 3 c2 Normal keyboard 2 4-14 15 sTAB 16 aQ Alt'd top row 17 aW 18 aE 19 aR 20 aT 21 aY 22 aU 23 aI 24 aO 25 aP 26-29 30 aA Alt'd middle row 31 aS 32 aD 33 aF 34 aG 35 aH 36 aJ 37 aK 38 aL 39-43 44 aZ Alt'd bottom row 45 aX 46 aC 47 aV 48 aB 49 aN 50 aN 51-58 59 F1 60 F2 61 F3 62 F4 63 F5 64 F6 65 F7 66 F8 67 F9 68 F10 69 70 aPRINT PC: aPrtSc 71 HOME 72 UpArw 73 PGUP 74 sHOME PC and AT: 75 LfArw 76 77 RtArw Also c/ on my SX 78 Code Key Comment 79 END 80 81 PGDN 82 INSERT PC: Ins 83 DELETE PC: Del 84 sF1 85 sF2 86 sF3 87 sF4 88 sF5 89 sF6 90 sF7 91 sF8 92 sF9 93 sF10 94 cF1 95 cF2 96 cF3 97 cF4 98 cF5 99 cF6 100 cF7 101 cF8 102 cF9 103 cF10 104 aF1 105 aF2 106 aF3 107 aF4 108 aF5 109 aF6 110 aF7 111 aF8 112 aF9 113 aF10 114 cPRINT PC: cPrtScr (this normally causes simultaneous printing) 115 cLfArw 116 cRtArw 117 cEND 118 cPGDN 119 cHOME 120 a1 normal numbers, not keypad 121 a2 122 a3 123 a4 124 a5 125 a6 126 a7 127 a8 128 a9 129 a0 130 a- 131 a= 132 aPGUP PC: This is the end of the 'normal' codes Code Key Comment 133 sUpArw AT: F11 134 sDnArw AT: F12 135 sLfArw AT: sF11 136 sRtArw AT: sF12 137 a, AT: cF11 138 a. AT: cF12 139 aESC AT: aF11 140 aBACKSPACE AT: aF12 141 cTAB AT: cUpArw 142 aTAB AT: c, T1000KBD: c 143 aENTER AT: c 144 cUpArw AT: c, T1000KBD: c= 145 aUpArw AT: cDnArw 146 aLfArw AT: cIns, T1000KBD: cINSERT 147 c AT: cDel, T1000KBD: cDELETE 148 c AT: cTAB 149 c AT: c, T1000KBD: c 150 cDnArw AT: c, T1000KBD: c8 151 aDnArw AT: aHOME 152 F11 AT: aUpArw 153 F12 AT: aPgUp, T1000KBD: a[ 154 c 155 AT: aLfArw 156 c 157 cDELETE AT: aRtArw 158 aDELETE 159 cINSERT AT: aEND, T1000KBD: a. 160 aINSERT AT: aDnArw 161 AT: aPgDn 162 sF11 AT: aIns, T1000KBD: aINSERT 163 sF12 AT: aDel, T1000KBD: aDELETE 164 c AT: a, T1000KBD, a/ 165 a AT: aTAB 166 aHOME AT: aENTER, also end of AT extended codes 167-171 172 cF11 173 cF12 174-181 182 aF11 183 aF12 184-223 224 c0 normal numbers, not keypad 225 c1 226 227 c3 228 c4 229 c5 230 231 c7 232 c8 233 c9 234 aRtArw 235 a[ 236-239 Code Key Comment 240 a] 241 a' 242 a/ 243 244 245 c= 246 c; 247 c' 248 a; 249 c, 250 c. 251 252 c 253 c 254-256