Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

339 lines
17 KiB

  1. .XLIST
  2. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3. ;;
  4. ;; (C) Copyright Microsoft Corp. 1987-1991
  5. ;; MS-DOS 5.00 - NLS Support - KEYB Command
  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. ;; ;jwg ; - Feb 1990 For 4.03.
  23. ;; ;AN007; - Add Patriot/Sebring determination code for HOT Replug
  24. ;; so that INT 9 handler can alter keyboard Scan Code set.
  25. ;; ;M030 Merged IBM (Kermit - JP), KEYBOARD.SYS and KEYB.COM
  26. ;; versions of this file into one.
  27. ;;
  28. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  29. ;;
  30. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  31. ;; SHARED_DATA_STR defines the initial fixed length portion of the
  32. ;; Shared Data Area.
  33. ;; Tables are loaded beginning at TABLE_AREA in the following order:
  34. ;; State Logic
  35. ;; Common Translate Section
  36. ;; Specific Translate Sections for
  37. ;; each code page
  38. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  39. ;; SPECIAL_FEATURES equates:
  40. TYPEWRITER_CAPS_LK EQU 8000H ;; typewriter style caps lock
  41. ;;
  42. JR_HOT_KEY_1_2 equ 4000h ;; M030 Merged back for kdfcf.asm
  43. ;;========================================
  44. ;; Added YST for Cyrillic keyboards
  45. ;; 1/21/90
  46. ;;========================================
  47. SHIFTS_TO_LOGIC EQU 2000H ;; - transfer CTRL, SHIFT, ALT keys
  48. ;; to LOGIC section
  49. ;;
  50. SWITCHABLE EQU 1000H ;; - Driver can use NLS/Def mode
  51. ;; switching (like Rus/Lat mode)
  52. ;; Used for Int 2Fh, function 0AD83h answer
  53. ;;========================================
  54. ;; End of YST
  55. ;;========================================
  56. JR_KB equ 8000h ;; M030 Merged back for kdfcf.asm
  57. ;; Some useful scan codes:
  58. F1_SCAN EQU 59 ;; F1
  59. F2_SCAN EQU 60 ;; F2
  60. ;;
  61. ;; SYSTEM_FLAG / Hardware equates:
  62. ;; INT 16h and remote support
  63. EXT_16 EQU 8000H ;; extended INT 16h support is there
  64. EXT_122 EQU 4000H ;; extended INT 16h for 122 is there
  65. ; EQU 2000H ;; unused
  66. PC_NET EQU 1000H ;; flag PC Net is installed
  67. ;; System type/hardware support flags
  68. PC_81 EQU 0800H ;; flag for Original PC
  69. PC_XT EQU 0400H ;; code for PC, PC/XT, PORTABLE
  70. PC_LAP EQU 0200H ;; code for Convertiable (p-12)
  71. PC_PAL EQU 0080H ;; code for Model 30 (PALACE)
  72. PC_AT EQU 0040H ;; code for PC-AT with 8042
  73. PC_386 EQU 0020H ;; code for PS/2's with 8042 (WRANGLER)
  74. PS_8042 EQU 0010H ;; 8042 is a Patriot/Sebring type array;AN007;jwg
  75. ;; or system set translate OFF (SCS=01)
  76. SECURITY_ACTIVE EQU 0008h ; M030 ;; Server password mode is active
  77. ; ; M030 ;; This bit becomes off from on when
  78. ; ; M030 ;; correct password is entered JP9010
  79. ifdef JAPAN
  80. DBCS_OK EQU 0002h ;; DBCS scan codes are OK allowed
  81. endif ; JAPAN
  82. ;;
  83. ;; HOT_KEY_FLAG EQUATES:
  84. US_MODE EQU 0 ;; hot key is active => US
  85. LANG_MODE EQU 0FFH ;; hot key is inactive
  86. ;;
  87. ;; -----------------------------------
  88. SHARED_DATA_STR STRUC ;; SHARED DATA AREA
  89. ;;
  90. OLD_INT_9 DD 0 ;; saved int 9 vector
  91. OLD_INT_2F DD 0 ;; saved int 2F vector
  92. dd 0 ;; reserved
  93. KEYB_TYPE DW 0 ;; type of keyboard
  94. SYSTEM_FLAG DW 0 ;; system configuration flags
  95. TABLE_OK DB 0 ;; flag to INT 9 that table is built
  96. db 5 dup (0) ;; reserved
  97. ;;
  98. ;; Table copy begins here:
  99. ACTIVE_LANGUAGE DB 'US' ;; language code
  100. INVOKED_CP_TABLE DW 437 ;; ptr to table for invoked code page
  101. INVOKED_KBD_ID DW 0 ;; WGR invoked keyboard id. ;AN000
  102. ACTIVE_XLAT_PTR DW -1 ;; ptr to active Specific Translate Sect
  103. FIRST_XLAT_PTR DW -1 ;; ptr to first Specific Translate Sect
  104. RESIDENT_END DW 0ffffh ;; offset of last byte in resident mem
  105. LOGIC_PTR DW -1 ;; ptr to State Logic
  106. COMMON_XLAT_PTR DW -1 ;; ptr to Common Translate Section
  107. SPECIAL_FEATURES DW ? ;; special Features
  108. TABLE_OVERFLOW DB 0 ;; overflow flag for table rebuild
  109. HOT_KEY_ON_SCAN DB ? ;; scan codes to use with ALT+CTRL
  110. HOT_KEY_OFF_SCAN DB ? ;; to turn hot key on and off
  111. DB 4 DUP(0) ;; reserved
  112. TABLE_AREA DB ? ;; tables loaded here:
  113. ;; State Logic
  114. ;; Common Translate Section
  115. ;; Specific Translate Sections for
  116. ;; each code page
  117. SHARED_DATA_STR ENDS ;;
  118. ;;
  119. ;;
  120. ;;
  121. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  122. ;; State Logic equates.
  123. ;; Contains equates for our NLS Flags and for the State Logic
  124. ;; commands.
  125. ;; State Logic command macros are defined in KEYBMAC.INC
  126. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  127. ;;
  128. STATE_LOGIC_STR STRUC ;;
  129. ;;
  130. SL_LOGIC_LEN DW ? ;; length of state logic
  131. SL_SPECIAL_FEATURES DW ? ;;
  132. SL_LOGIC_CMDS DB 0 ;; state logic commands begin here
  133. ;;
  134. STATE_LOGIC_STR ENDS ;;
  135. ;;
  136. ;;
  137. NUM_BIOS_FLAGS EQU 4 ;;
  138. NUM_NLS_FLAGS EQU 2 ;; '+1' below is the EXT_KB_FLAG
  139. NUM_FLAGS EQU NUM_BIOS_FLAGS+NUM_NLS_FLAGS+1
  140. ;;
  141. ;;
  142. EITHER_SHIFT EQU 80H ;; EXT_KB_FLAG : our own shift state
  143. EITHER_CTL EQU 40H ;; flags
  144. EITHER_ALT EQU 20H ;;
  145. SCAN_MATCH EQU 08H ;; set if scan code found in XLATT
  146. ;; or SET_FLAG searches
  147. ;;
  148. SHIFTS_PRESSED EQU 04H ;; set if any SHIFT, ALT, CTRL key
  149. ;; pressed (added YST for Cyrillic keyb.)
  150. ;;
  151. KB_FLAG_ID EQU 0 ;; Flag ID's as coded in IFF and ANDF
  152. KB_FLAG_1_ID EQU 1 ;; commands
  153. KB_FLAG_2_ID EQU 2 ;;
  154. KB_FLAG_3_ID EQU 3 ;;
  155. EXT_KB_FLAG_ID EQU 4 ;;
  156. NLS_FLAG_1_ID EQU 5 ;;
  157. NLS_FLAG_2_ID EQU 6 ;;
  158. ;;
  159. COMMAND_BITS EQU 0F0H ;; Mask to isolate command code
  160. SUB_CMD_BITS EQU 0FH ;; mask to isolate sub command code
  161. NOT_TEST EQU 08H ;; NOT bit in IFF, ANDF
  162. COMMAND_SHIFT EQU 4 ;; shift amount for command code
  163. FLAG_ID_BITS EQU 07H ;; mask to isolate flag id in IFF, ANDF
  164. NUM_COMMANDS EQU 0CH ;; number of commands
  165. ;;
  166. IFF_COMMAND EQU 00H ;;
  167. ANDF_COMMAND EQU 10H ;;
  168. ELSEF_COMMAND EQU 20H ;;
  169. ENDIFF_COMMAND EQU 30H ;;
  170. XLATT_COMMAND EQU 40H ;;
  171. OPTION_COMMAND EQU 50H ;;
  172. SET_FLAG_COMMAND EQU 60H ;;
  173. PUT_ERROR_COMMAND EQU 70H ;;
  174. IFKBD_COMMAND EQU 80H ;;
  175. GOTO_COMMAND EQU 90H ;;
  176. BEEP_COMMAND EQU 0A0H ;;
  177. RESET_NLS_COMMAND EQU 0B0H ;;
  178. CHECK_CORE_COMMAND EQU 0C0H ;;
  179. ;;
  180. ;;
  181. EXIT_INT_9_FLAG EQU 01H ;; Special forms of GOTO. These
  182. EXIT_STATE_LOGIC_FLAG EQU 02H ;; values are in the right nibble
  183. ;; of the GOTO command.
  184. ;;
  185. ;; PROCESSING OPTIONS:
  186. EXIT_IF_FOUND EQU 80H ;; exit INT 9 if a translation
  187. ;; match is found
  188. ;;
  189. ANY_KB EQU 0FFFFH ;;
  190. XT_KB EQU 4000H ;;
  191. AT_KB EQU 2000H ;;
  192. G_KB EQU 1000H ;;
  193. P_KB EQU 0800H ;;
  194. P12_KB EQU 0400H ;;
  195. DBCS_OLD_A_KB EQU 0080H ; M030 ;; JP9009
  196. DBCS_OLD_P_KB EQU 0040H ; M030 ;; JP9009
  197. DBCS_OLD_G_KB EQU 0020H ; M030 ;; JP9009
  198. DBCS_OLD_KB EQU 00C0H ; M030 ;; JP9009
  199. DBCS_KB EQU 0020H ; M030 ;; JP9009
  200. ;;
  201. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  202. ;; Translate Table Sections. Both the Specific and Common
  203. ;; Translate Sections are formatted as follows.
  204. ;;
  205. ;; The Specific Translate Sections are chained together using the
  206. ;; XS_NEXT_SECT_PTR field (-1 if last section).
  207. ;; Translate Sections contains multiple States.
  208. ;; A State contains the translate tables for a single
  209. ;; shift state (IE lower case, upper case ....)
  210. ;; Each State may contain multiple translate tables.
  211. ;;
  212. ;; The Translate Section layout is defined using several STRUCs.
  213. ;; These STRUCs are allocated in the Shared Data Area as follows:
  214. ;;
  215. ;; XLAT_SECT_STR ; header info for the section
  216. ;; STATE_STR ; header for state #1
  217. ;; XLAT_STR ; first translate tab for state #1
  218. ;; XLAT_TYPE_1_STR or XLAT_TYPE_2_STR
  219. ;; XLAT_STR ; second translate tab
  220. ;; XLAT_TYPE_1_STR or XLAT_TYPE_2_STR
  221. ;; ...
  222. ;; STATE_STR ; header for state #2
  223. ;; XLAT_STR
  224. ;; XLAT_TYPE_1_STR or XLAT_TYPE_2_STR
  225. ;; ...
  226. ;; ...
  227. ;;
  228. ;; A State may contain a "Set_Flag" table instead of translate tables.
  229. ;; These tables are used to set the NLS flags instead of generating
  230. ;; ASCII codes (for example: to remember dead key states).
  231. ;; There can be only on Set_Flag table per state.
  232. ;; The Set_Flag table layout is defined in the SET_FLAG_STR STRUC.
  233. ;;
  234. ;; So some states will contain translate tables (to generate ASCII codes)
  235. ;; and some states will contain a Set_Flag table (to record dead key
  236. ;; status).
  237. ;;
  238. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  239. ;;
  240. XLAT_SECT_STR STRUC ;;
  241. ;;
  242. XS_NEXT_SECT_PTR DW ? ;; Pointer to next Specific Translate
  243. ;; Section
  244. XS_CP_ID DW ? ;; code page id
  245. XS_FIRST_STATE DB ? ;;
  246. ;;
  247. XLAT_SECT_STR ENDS ;;
  248. ;;
  249. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  250. ;; State structure.
  251. ;; The last State is a null State containing only the
  252. ;; XS_STATE_LEN field with a value of 0.
  253. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  254. ;;
  255. STATE_STR STRUC ;;
  256. ;;
  257. XS_STATE_LEN DW ? ;; length of state section
  258. XS_STATE_ID DB ? ;; State ID
  259. XS_KBD_TYPE DW ? ;; Keyboard Type
  260. XS_ERROR_CHAR DW ? ;; Buffer entry for error character
  261. XS_FIRST_TAB DB ? ;;
  262. ;;
  263. STATE_STR ENDS ;;
  264. ;;
  265. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  266. ;; Translate Table structures.
  267. ;; There may be many translate tables in a State. The last
  268. ;; table is a null table containing only the XLAT_TAB_SIZE field with
  269. ;; a value of 0.
  270. ;; The xlate table can be in one of two forms:
  271. ;; Type 1 = Table contains buffer entries only.
  272. ;; Scan code is used as an index into xlat table
  273. ;; Type 2 = Table contains pairs of SCAN/BUFFER_ENTRY.
  274. ;; Table must be searched for matching scan.
  275. ;; Type 1 is the default. Type 2 tables should be identified by setting
  276. ;; the TYPE_2_TAB bit in XLAT_OPTIONS.
  277. ;; Buffer entries default to 2-bytes per entry.
  278. ;; Optionally the table may contain ASCII codes only
  279. ;; (1-byte entries). This is specified by setting the ASCII_ONLY bit
  280. ;; in XLAT_OPTIONS. 2-byte buffer entries are coded ASCII,SCAN.
  281. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  282. ;;
  283. ;; Translate options:
  284. ASCII_ONLY EQU 80H ;; Only ASCII codes listed - use
  285. ;; incoming scan for buffer entry
  286. TYPE_2_TAB EQU 40H ;; search xlat table for matching scan
  287. ZERO_SCAN EQU 20H ;; set the scan half of the buffer
  288. ;; entry to 0
  289. ;;
  290. NULL_ASCII_CODE EQU -1 ;;
  291. ;;
  292. DEFAULT_TAB_2_ENT_SZ EQU 3 ;;
  293. ASC_ONLY_TAB_2_ENT_SZ EQU 2 ;;
  294. ;;
  295. ;;
  296. XLAT_STR STRUC ;;
  297. ;;
  298. XLAT_TAB_SIZE DW ? ;; Size in bytes of this table -
  299. ;; includes this field, options etc.
  300. XLAT_OPTIONS DB ? ;; xlat options
  301. ;; XLAT TABLE IS HERE
  302. XLAT_STR ENDS ;;
  303. ;;
  304. XLAT_TYPE_1_STR STRUC ;; use scan code as index into table
  305. DB TYPE XLAT_STR DUP(?) ;; filler
  306. XLAT_SCAN_LO DB ? ;; Scan code
  307. XLAT_SCAN_HI DB ? ;; range
  308. XLAT_1_BUF_ENTRY DB ? ;; The table itself
  309. XLAT_TYPE_1_STR ENDS ;;
  310. ;;
  311. XLAT_TYPE_2_STR STRUC ;; search table for scan
  312. DB TYPE XLAT_STR DUP(?) ;; filler
  313. XLAT_NUM DB ? ;; number of scans
  314. XLAT_SCAN DB ? ;; Scan code
  315. XLAT_2_BUF_ENTRY DB ? ;; The table itself
  316. XLAT_TYPE_2_STR ENDS ;;
  317. ;;
  318. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  319. ;; Set_Flag Tables.
  320. ;; State Sections immediately following the LAST_ENTRYs.
  321. ;; Dead key definitions. If the scan matches then
  322. ;; set the bit in NLS_FLAGs indicated in DK_MASK
  323. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  324. ;;
  325. SF_ENT_SZ EQU 3 ;; size of entry
  326. ;;
  327. SET_FLAG_STR STRUC ;;
  328. ;;
  329. SF_NUM DB 0 ;; Number of entries
  330. SF_SCAN_CODE DB 0 ;; scan code
  331. SF_FLAG_ID DB 0 ;; flag id
  332. SF_FLAG_MASK DB 0 ;; flag mask
  333. ;;
  334. SET_FLAG_STR ENDS ;;
  335. ;;
  336. ;;
  337. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  338. .LIST
  339.