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.

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