diff options
| author | 2024-04-25 21:24:10 +0100 | |
|---|---|---|
| committer | 2024-04-25 22:32:27 +0000 | |
| commit | 2d04cacc5322951f187bb17e017c12920ac8ebe2 (patch) | |
| tree | 80ee017efa878dfd5344b44249e6a241f2a7f6e2 /v4.0/src/CMD/KEYB/KEYBSHAR.INC | |
| parent | Merge pull request #430 from jpbaltazar/typoptbr (diff) | |
| download | ms-dos-main.tar.gz ms-dos-main.tar.xz ms-dos-main.zip | |
Diffstat (limited to 'v4.0/src/CMD/KEYB/KEYBSHAR.INC')
| -rw-r--r-- | v4.0/src/CMD/KEYB/KEYBSHAR.INC | 307 |
1 files changed, 307 insertions, 0 deletions
diff --git a/v4.0/src/CMD/KEYB/KEYBSHAR.INC b/v4.0/src/CMD/KEYB/KEYBSHAR.INC new file mode 100644 index 0000000..75bbc13 --- /dev/null +++ b/v4.0/src/CMD/KEYB/KEYBSHAR.INC | |||
| @@ -0,0 +1,307 @@ | |||
| 1 | .XLIST | ||
| 2 | |||
| 3 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 4 | ;; DOS - NLS Support - KEYB Command | ||
| 5 | ;; (C) Copyright 1988 Microsoft | ||
| 6 | ;; | ||
| 7 | ;; File Name: KEYBSHAR.INC | ||
| 8 | ;; ---------- | ||
| 9 | ;; | ||
| 10 | ;; Description: | ||
| 11 | ;; ------------ | ||
| 12 | ;; Include file containing structure definitions Shared Data Area | ||
| 13 | ;; for the Shared Data Area. | ||
| 14 | ;; The Shared Data Area contains data which is required by | ||
| 15 | ;; both the resident and transient KEYB code. The Shared | ||
| 16 | ;; Data Area is allocated in the KEYBI2F file and will be | ||
| 17 | ;; resident following initial installation. | ||
| 18 | ;; | ||
| 19 | ;; Change History: | ||
| 20 | ;; --------------- | ||
| 21 | ;; | ||
| 22 | ;; | ||
| 23 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 24 | ;; | ||
| 25 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 26 | ;; SHARED_DATA_STR defines the initial fixed length portion of the | ||
| 27 | ;; Shared Data Area. | ||
| 28 | ;; Tables are loaded beginning at TABLE_AREA in the following order: | ||
| 29 | ;; State Logic | ||
| 30 | ;; Common Translate Section | ||
| 31 | ;; Specific Translate Sections for | ||
| 32 | ;; each code page | ||
| 33 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 34 | ;; SPECIAL_FEATURES equates: | ||
| 35 | TYPEWRITER_CAPS_LK EQU 8000H ;; typewriter style caps lock | ||
| 36 | JR_HOT_KEY_1_2 EQU 4000H ;; on PCjr use 1/2 as the hot keys | ||
| 37 | ;; instead of F1/F2 | ||
| 38 | ;; | ||
| 39 | ;; Some useful scan codes: | ||
| 40 | F1_SCAN EQU 59 ;; F1 | ||
| 41 | F2_SCAN EQU 60 ;; F2 | ||
| 42 | ONE_SCAN EQU 2 ;; "1" | ||
| 43 | TWO_SCAN EQU 3 ;; "2" | ||
| 44 | ;; | ||
| 45 | ;; SYSTEM_FLAG equates: | ||
| 46 | EXT_16 EQU 8000H ;; extended int16 support is there | ||
| 47 | PC_AT EQU 4000H ;; code for pcat | ||
| 48 | PC_LAP EQU 2000H ;; code for pc lap computer (p-12) | ||
| 49 | PC_XT EQU 1000H ;; code for PC, PC/XT, PORTABLE | ||
| 50 | PC_JR EQU 0800H ;; code for PCjr | ||
| 51 | PC_PAL EQU 0400H ;; code for PALACE | ||
| 52 | PC_386 EQU 0200H ;; code for WRANGLER | ||
| 53 | PC_NET EQU 0100H ;; PC Net is installed | ||
| 54 | ;; | ||
| 55 | ;; HOT_KEY_FLAG EQUATES: | ||
| 56 | US_MODE EQU 0 ;; hot key is active => US | ||
| 57 | LANG_MODE EQU 0FFH ;; hot key is inactive | ||
| 58 | ;; | ||
| 59 | ;; ----------------------------------- | ||
| 60 | SHARED_DATA_STR STRUC ;; SHARED DATA AREA | ||
| 61 | ;; | ||
| 62 | OLD_INT_9 DD 0 ;; saved int 9 vector | ||
| 63 | OLD_INT_2F DD 0 ;; saved int 2F vector | ||
| 64 | OLD_INT_48 DD 0 ;; saved int 48 vector (if PCjr) | ||
| 65 | KEYB_TYPE DW 0 ;; type of keyboard | ||
| 66 | SYSTEM_FLAG DW 0 ;; system configuration flags | ||
| 67 | TABLE_OK DB 0 ;; flag to INT 9 that table is built | ||
| 68 | JR_KB_FLAG DB 0 ;; flag for special PCjr processing | ||
| 69 | TIMING_FACTOR DW 1 ;; Scale factor for INT 9 timing loops | ||
| 70 | ;; PC_AT = 1 | ||
| 71 | DB 2 DUP(0) ;; reserved | ||
| 72 | ;; | ||
| 73 | ;; Table copy begins here: | ||
| 74 | ACTIVE_LANGUAGE DB 'US' ;; language code | ||
| 75 | INVOKED_CP_TABLE DW 437 ;; ptr to table for invoked code page | ||
| 76 | INVOKED_KBD_ID DW 0 ;; WGR invoked keyboard id. ;AN000 | ||
| 77 | ACTIVE_XLAT_PTR DW -1 ;; ptr to active Specific Translate Sect | ||
| 78 | FIRST_XLAT_PTR DW -1 ;; ptr to first Specific Translate Sect | ||
| 79 | RESIDENT_END DW 0ffffh ;; offset of last byte in resident mem | ||
| 80 | LOGIC_PTR DW -1 ;; ptr to State Logic | ||
| 81 | COMMON_XLAT_PTR DW -1 ;; ptr to Common Translate Section | ||
| 82 | SPECIAL_FEATURES DW ? ;; special Features | ||
| 83 | TABLE_OVERFLOW DB 0 ;; overflow flag for table rebuild | ||
| 84 | HOT_KEY_ON_SCAN DB ? ;; scan codes to use with ALT+CTRL | ||
| 85 | HOT_KEY_OFF_SCAN DB ? ;; to turn hot key on and off | ||
| 86 | DB 4 DUP(0) ;; reserved | ||
| 87 | TABLE_AREA DB ? ;; tables loaded here: | ||
| 88 | ;; State Logic | ||
| 89 | ;; Common Translate Section | ||
| 90 | ;; Specific Translate Sections for | ||
| 91 | ;; each code page | ||
| 92 | SHARED_DATA_STR ENDS ;; | ||
| 93 | ;; | ||
| 94 | ;; | ||
| 95 | ;; | ||
| 96 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 97 | ;; State Logic equates. | ||
| 98 | ;; Contains equates for our NLS Flags and for the State Logic | ||
| 99 | ;; commands. | ||
| 100 | ;; State Logic command macros are defined in KEYBMAC.INC | ||
| 101 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 102 | ;; | ||
| 103 | STATE_LOGIC_STR STRUC ;; | ||
| 104 | ;; | ||
| 105 | SL_LOGIC_LEN DW ? ;; length of state logic | ||
| 106 | SL_SPECIAL_FEATURES DW ? ;; | ||
| 107 | SL_LOGIC_CMDS DB 0 ;; state logic commands begin here | ||
| 108 | ;; | ||
| 109 | STATE_LOGIC_STR ENDS ;; | ||
| 110 | ;; | ||
| 111 | ;; | ||
| 112 | NUM_BIOS_FLAGS EQU 4 ;; | ||
| 113 | NUM_NLS_FLAGS EQU 2 ;; '+1' below is the EXT_KB_FLAG | ||
| 114 | NUM_FLAGS EQU NUM_BIOS_FLAGS+NUM_NLS_FLAGS+1 | ||
| 115 | ;; | ||
| 116 | ;; | ||
| 117 | EITHER_SHIFT EQU 80H ;; EXT_KB_FLAG : our own shift state | ||
| 118 | EITHER_CTL EQU 40H ;; flags | ||
| 119 | EITHER_ALT EQU 20H ;; | ||
| 120 | SCAN_MATCH EQU 08H ;; set if scan code found in XLATT | ||
| 121 | ;; or SET_FLAG searches | ||
| 122 | ;; | ||
| 123 | ;; | ||
| 124 | KB_FLAG_ID EQU 0 ;; Flag ID's as coded in IFF and ANDF | ||
| 125 | KB_FLAG_1_ID EQU 1 ;; commands | ||
| 126 | KB_FLAG_2_ID EQU 2 ;; | ||
| 127 | KB_FLAG_3_ID EQU 3 ;; | ||
| 128 | EXT_KB_FLAG_ID EQU 4 ;; | ||
| 129 | NLS_FLAG_1_ID EQU 5 ;; | ||
| 130 | NLS_FLAG_2_ID EQU 6 ;; | ||
| 131 | ;; | ||
| 132 | COMMAND_BITS EQU 0F0H ;; Mask to isolate command code | ||
| 133 | SUB_CMD_BITS EQU 0FH ;; mask to isolate sub command code | ||
| 134 | NOT_TEST EQU 08H ;; NOT bit in IFF, ANDF | ||
| 135 | COMMAND_SHIFT EQU 4 ;; shift amount for command code | ||
| 136 | FLAG_ID_BITS EQU 07H ;; mask to isolate flag id in IFF, ANDF | ||
| 137 | NUM_COMMANDS EQU 0CH ;; number of commands | ||
| 138 | ;; | ||
| 139 | IFF_COMMAND EQU 00H ;; | ||
| 140 | ANDF_COMMAND EQU 10H ;; | ||
| 141 | ELSEF_COMMAND EQU 20H ;; | ||
| 142 | ENDIFF_COMMAND EQU 30H ;; | ||
| 143 | XLATT_COMMAND EQU 40H ;; | ||
| 144 | OPTION_COMMAND EQU 50H ;; | ||
| 145 | SET_FLAG_COMMAND EQU 60H ;; | ||
| 146 | PUT_ERROR_COMMAND EQU 70H ;; | ||
| 147 | IFKBD_COMMAND EQU 80H ;; | ||
| 148 | GOTO_COMMAND EQU 90H ;; | ||
| 149 | BEEP_COMMAND EQU 0A0H ;; | ||
| 150 | RESET_NLS_COMMAND EQU 0B0H ;; | ||
| 151 | CHECK_CORE_COMMAND EQU 0C0H ;; | ||
| 152 | ;; | ||
| 153 | ;; | ||
| 154 | EXIT_INT_9_FLAG EQU 01H ;; Special forms of GOTO. These | ||
| 155 | EXIT_STATE_LOGIC_FLAG EQU 02H ;; values are in the right nibble | ||
| 156 | ;; of the GOTO command. | ||
| 157 | ;; | ||
| 158 | ;; PROCESSING OPTIONS: | ||
| 159 | EXIT_IF_FOUND EQU 80H ;; exit INT 9 if a translation | ||
| 160 | ;; match is found | ||
| 161 | ;; | ||
| 162 | ANY_KB EQU 0FFFFH ;; | ||
| 163 | JR_KB EQU 8000H ;; Keyboard types | ||
| 164 | XT_KB EQU 4000H ;; | ||
| 165 | AT_KB EQU 2000H ;; | ||
| 166 | G_KB EQU 1000H ;; | ||
| 167 | P_KB EQU 0800H ;; | ||
| 168 | P12_KB EQU 0400H ;; | ||
| 169 | ;; | ||
| 170 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 171 | ;; Translate Table Sections. Both the Specific and Common | ||
| 172 | ;; Translate Sections are formatted as follows. | ||
| 173 | ;; | ||
| 174 | ;; The Specific Translate Sections are chained together using the | ||
| 175 | ;; XS_NEXT_SECT_PTR field (-1 if last section). | ||
| 176 | ;; Translate Sections contains multiple States. | ||
| 177 | ;; A State contains the translate tables for a single | ||
| 178 | ;; shift state (IE lower case, upper case ....) | ||
| 179 | ;; Each State may contain multiple translate tables. | ||
| 180 | ;; | ||
| 181 | ;; The Translate Section layout is defined using several STRUCs. | ||
| 182 | ;; These STRUCs are allocated in the Shared Data Area as follows: | ||
| 183 | ;; | ||
| 184 | ;; XLAT_SECT_STR ; header info for the section | ||
| 185 | ;; STATE_STR ; header for state #1 | ||
| 186 | ;; XLAT_STR ; first translate tab for state #1 | ||
| 187 | ;; XLAT_TYPE_1_STR or XLAT_TYPE_2_STR | ||
| 188 | ;; XLAT_STR ; second translate tab | ||
| 189 | ;; XLAT_TYPE_1_STR or XLAT_TYPE_2_STR | ||
| 190 | ;; ... | ||
| 191 | ;; STATE_STR ; header for state #2 | ||
| 192 | ;; XLAT_STR | ||
| 193 | ;; XLAT_TYPE_1_STR or XLAT_TYPE_2_STR | ||
| 194 | ;; ... | ||
| 195 | ;; ... | ||
| 196 | ;; | ||
| 197 | ;; A State may contain a "Set_Flag" table instead of translate tables. | ||
| 198 | ;; These tables are used to set the NLS flags instead of generating | ||
| 199 | ;; ASCII codes (for example: to remember dead key states). | ||
| 200 | ;; There can be only on Set_Flag table per state. | ||
| 201 | ;; The Set_Flag table layout is defined in the SET_FLAG_STR STRUC. | ||
| 202 | ;; | ||
| 203 | ;; So some states will contain translate tables (to generate ASCII codes) | ||
| 204 | ;; and some states will contain a Set_Flag table (to record dead key | ||
| 205 | ;; status). | ||
| 206 | ;; | ||
| 207 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 208 | ;; | ||
| 209 | XLAT_SECT_STR STRUC ;; | ||
| 210 | ;; | ||
| 211 | XS_NEXT_SECT_PTR DW ? ;; Pointer to next Specific Translate | ||
| 212 | ;; Section | ||
| 213 | XS_CP_ID DW ? ;; code page id | ||
| 214 | XS_FIRST_STATE DB ? ;; | ||
| 215 | ;; | ||
| 216 | XLAT_SECT_STR ENDS ;; | ||
| 217 | ;; | ||
| 218 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 219 | ;; State structure. | ||
| 220 | ;; The last State is a null State containing only the | ||
| 221 | ;; XS_STATE_LEN field with a value of 0. | ||
| 222 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 223 | ;; | ||
| 224 | STATE_STR STRUC ;; | ||
| 225 | ;; | ||
| 226 | XS_STATE_LEN DW ? ;; length of state section | ||
| 227 | XS_STATE_ID DB ? ;; State ID | ||
| 228 | XS_KBD_TYPE DW ? ;; Keyboard Type | ||
| 229 | XS_ERROR_CHAR DW ? ;; Buffer entry for error character | ||
| 230 | XS_FIRST_TAB DB ? ;; | ||
| 231 | ;; | ||
| 232 | STATE_STR ENDS ;; | ||
| 233 | ;; | ||
| 234 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 235 | ;; Translate Table structures. | ||
| 236 | ;; There may be many translate tables in a State. The last | ||
| 237 | ;; table is a null table containing only the XLAT_TAB_SIZE field with | ||
| 238 | ;; a value of 0. | ||
| 239 | ;; The xlate table can be in one of two forms: | ||
| 240 | ;; Type 1 = Table contains buffer entries only. | ||
| 241 | ;; Scan code is used as an index into xlat table | ||
| 242 | ;; Type 2 = Table contains pairs of SCAN/BUFFER_ENTRY. | ||
| 243 | ;; Table must be searched for matching scan. | ||
| 244 | ;; Type 1 is the default. Type 2 tables should be identified by setting | ||
| 245 | ;; the TYPE_2_TAB bit in XLAT_OPTIONS. | ||
| 246 | ;; Buffer entries default to 2-bytes per entry. | ||
| 247 | ;; Optionally the table may contain ASCII codes only | ||
| 248 | ;; (1-byte entries). This is specified by setting the ASCII_ONLY bit | ||
| 249 | ;; in XLAT_OPTIONS. 2-byte buffer entries are coded ASCII,SCAN. | ||
| 250 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 251 | ;; | ||
| 252 | ;; Translate options: | ||
| 253 | ASCII_ONLY EQU 80H ;; Only ASCII codes listed - use | ||
| 254 | ;; incoming scan for buffer entry | ||
| 255 | TYPE_2_TAB EQU 40H ;; search xlat table for matching scan | ||
| 256 | ZERO_SCAN EQU 20H ;; set the scan half of the buffer | ||
| 257 | ;; entry to 0 | ||
| 258 | ;; | ||
| 259 | NULL_ASCII_CODE EQU -1 ;; | ||
| 260 | ;; | ||
| 261 | DEFAULT_TAB_2_ENT_SZ EQU 3 ;; | ||
| 262 | ASC_ONLY_TAB_2_ENT_SZ EQU 2 ;; | ||
| 263 | ;; | ||
| 264 | ;; | ||
| 265 | XLAT_STR STRUC ;; | ||
| 266 | ;; | ||
| 267 | XLAT_TAB_SIZE DW ? ;; Size in bytes of this table - | ||
| 268 | ;; includes this field, options etc. | ||
| 269 | XLAT_OPTIONS DB ? ;; xlat options | ||
| 270 | ;; XLAT TABLE IS HERE | ||
| 271 | XLAT_STR ENDS ;; | ||
| 272 | ;; | ||
| 273 | XLAT_TYPE_1_STR STRUC ;; use scan code as index into table | ||
| 274 | DB TYPE XLAT_STR DUP(?) ;; filler | ||
| 275 | XLAT_SCAN_LO DB ? ;; Scan code | ||
| 276 | XLAT_SCAN_HI DB ? ;; range | ||
| 277 | XLAT_1_BUF_ENTRY DB ? ;; The table itself | ||
| 278 | XLAT_TYPE_1_STR ENDS ;; | ||
| 279 | ;; | ||
| 280 | XLAT_TYPE_2_STR STRUC ;; search table for scan | ||
| 281 | DB TYPE XLAT_STR DUP(?) ;; filler | ||
| 282 | XLAT_NUM DB ? ;; number of scans | ||
| 283 | XLAT_SCAN DB ? ;; Scan code | ||
| 284 | XLAT_2_BUF_ENTRY DB ? ;; The table itself | ||
| 285 | XLAT_TYPE_2_STR ENDS ;; | ||
| 286 | ;; | ||
| 287 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 288 | ;; Set_Flag Tables. | ||
| 289 | ;; State Sections immediately following the LAST_ENTRYs. | ||
| 290 | ;; Dead key definitions. If the scan matches then | ||
| 291 | ;; set the bit in NLS_FLAGs indicated in DK_MASK | ||
| 292 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 293 | ;; | ||
| 294 | SF_ENT_SZ EQU 3 ;; size of entry | ||
| 295 | ;; | ||
| 296 | SET_FLAG_STR STRUC ;; | ||
| 297 | ;; | ||
| 298 | SF_NUM DB 0 ;; Number of entries | ||
| 299 | SF_SCAN_CODE DB 0 ;; scan code | ||
| 300 | SF_FLAG_ID DB 0 ;; flag id | ||
| 301 | SF_FLAG_MASK DB 0 ;; flag mask | ||
| 302 | ;; | ||
| 303 | SET_FLAG_STR ENDS ;; | ||
| 304 | ;; | ||
| 305 | ;; | ||
| 306 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 307 | .LIST | ||