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.

265 lines
8.6 KiB

  1. PAGE ,132
  2. ;
  3. ; (C) Copyright Microsoft Corp. 1987-1990
  4. ; MS-DOS 5.00 - NLS Support - KEYB Command
  5. ;
  6. ; File Name: KEYBI2F.ASM
  7. ; ----------
  8. ;
  9. ; Description:
  10. ; ------------
  11. ; Contains Interrupt 2F handler.
  12. ;
  13. ; Procedures Contained in This File:
  14. ; ----------------------------------
  15. ; KEYB_INT_2F - Interupt 2F handler
  16. ;
  17. ; Include Files Required:
  18. ; -----------------------
  19. ; INCLUDE KEYBEQU.INC
  20. ; INCLUDE KEYBSHAR.INC
  21. ; INCLUDE KEYBMAC.INC
  22. ; INCLUDE KEYBCMD.INC
  23. ; INCLUDE KEYBCPSD.INC
  24. ; INCLUDE KEYBI9C.INC
  25. ;
  26. ; External Procedure References:
  27. ; ------------------------------
  28. ; FROM FILE ????????.ASM:
  29. ; procedure - description????????????????????????????????
  30. ;
  31. ; Linkage Information: Refer to file KEYB.ASM
  32. ; --------------------
  33. ;
  34. ; Change History:
  35. ; ---------------
  36. INCLUDE KEYBEQU.INC
  37. INCLUDE KEYBSHAR.INC
  38. ifndef JAPAN
  39. INCLUDE KEYBMAC.INC
  40. endif ; !JAPAN
  41. INCLUDE KEYBCMD.INC
  42. INCLUDE KEYBCPSD.INC
  43. INCLUDE KEYBI9C.INC
  44. PUBLIC KEYB_INT_2F
  45. EXTRN ERROR_BEEP:NEAR
  46. EXTRN NLS_FLAG_1:BYTE ;; (YST)
  47. CODE SEGMENT PUBLIC 'CODE'
  48. ASSUME CS:CODE,DS:nothing
  49. ; Module: KEYB_INT_2F
  50. ;
  51. ; Description:
  52. ;
  53. ; Input Registers:
  54. ; AH = 0ADH
  55. ; ifdef JAPAN
  56. ; AL = 80,81,82,83
  57. ; else
  58. ; AL = 80,81,82
  59. ; endif
  60. ;
  61. ; Output Registers:
  62. ; N/A
  63. ;
  64. ; Logic:
  65. ; IF AH = 0ADh THEN (this call is for us)
  66. ; Set carry flag to 0
  67. ; IF AL = 80 THEN
  68. ; Get major and minor
  69. ; Get SEG:OFFSET of SHARED_DATA_AREA
  70. ;
  71. ; IF AL = 81 THEN
  72. ; Get FIRST_XLAT_PTR
  73. ; FOR each table
  74. ; IF code page requested = code page value at pointer THEN
  75. ; Set INVOKED_CODE_PAGE
  76. ; Set ACTIVE_XLAT_PTR
  77. ; EXIT
  78. ; ELSE
  79. ; Get NEXT_SECT_PTR
  80. ; NEXT table
  81. ; IF no corresponding code page found THEN
  82. ; Set carry flag
  83. ;
  84. ; IF AL = 82 THEN
  85. ; IF BL = 00 THEN
  86. ; Set COUNTRY_FLAG = 00
  87. ; ELSE IF BL = 0FFH THEN
  88. ; Set COUNTRY_FLAG = 0FFH
  89. ; ELSE
  90. ; Set carry flag
  91. ; ifdef JAPAN
  92. ; IF AL = 83 THEN
  93. ; Return BL=COUNTRY_FLAG
  94. ; endif
  95. ; JMP to previous INT 2FH handler
  96. CP_QUERY EQU 80H
  97. CP_INVOKE EQU 81H
  98. CP_LANGUAGE EQU 82H
  99. ifdef JAPAN
  100. CP_QLANGUAGE EQU 83H
  101. endif ; JAPAN
  102. GET_KB_MODE EQU 83H ;; ONLY FOR RUSSIAN (YST)
  103. SET_KB_MODE EQU 84H ;; ONLY FOR RUSSIAN
  104. VERSION_MAJOR EQU 01H
  105. VERSION_MINOR EQU 00H
  106. CARRY_FLAG EQU 01H
  107. KEYB_INT_2F PROC
  108. cmp ah,INT_2F_SUB_FUNC ; is it for us?
  109. jz our_i2f_interrupt
  110. i2f_chain:
  111. ; Under DOS 5, it is always safe for us to assume that there was
  112. ; an existing Int2f vector for us to continue to.
  113. jmp cs:sd.old_int_2f
  114. our_i2f_interrupt:
  115. push bp
  116. mov bp,sp
  117. and word ptr [bp]+6,not carry_flag ; pre-clear carry
  118. call do_our_i2f ; pass bp.6 -> flags to functions
  119. pop bp
  120. jmp i2f_chain
  121. do_our_i2f:
  122. CMP AL,CP_QUERY ; Q..query CP?
  123. JNE INT_2F_CP_INVOKE ; N..next
  124. MOV AX,-1 ; Y..process query
  125. mov bx,(version_major shl 8) + version_minor
  126. MOV DI,OFFSET SD
  127. PUSH CS
  128. POP ES
  129. ret
  130. INT_2F_CP_INVOKE:
  131. CMP AL,CP_INVOKE ; Q..invoke CP?
  132. JNE INT_2F_CP_LANGUAGE ; N..next
  133. MOV SI,cs:SD.FIRST_XLAT_PTR ; Get FIRST_XLAT_PTR
  134. INT_2F_NEXT_SECTION:
  135. CMP SI,-1
  136. JE INT_2F_ERROR_FLAG
  137. cmp bx,cs:[SI].XS_CP_ID ; is this the code page we want?
  138. JNE INT_2F_CP_INVOKE_CONT1
  139. MOV cs:SD.ACTIVE_XLAT_PTR,SI ; IF Yes, Set the ACTIVE_XLAT_PTR
  140. MOV cs:SD.INVOKED_CP_TABLE,BX ; record new code page
  141. ret
  142. INT_2F_CP_INVOKE_CONT1:
  143. MOV SI,cs:[SI].XS_NEXT_SECT_PTR ; Chain to NEXT_SECT_PTR
  144. JMP INT_2F_NEXT_SECTION ; NEXT_SECTION
  145. INT_2F_ERROR_FLAG:
  146. mov ax,1 ; ***??? why do we return error code
  147. ; ; only in this case?????
  148. i2f_reterror:
  149. or word ptr [bp]+6,carry_flag ; set carry to int2f caller
  150. ret
  151. INT_2F_CP_LANGUAGE:
  152. CMP AL,CP_LANGUAGE ; Q..Set default language??
  153. ifdef JAPAN
  154. jnz INT_2F_CP_QLANG ; go check for query language
  155. else ; !JAPAN
  156. jnz int2f_ret ; don't handle undefined functions
  157. endif ; !JAPAN
  158. ; Now, if BL=0 or 0ffh, we'll set COUNTRY_FLAG to that value.
  159. inc bl
  160. cmp bl,2 ; set carry if bl is legal
  161. dec bl ; restore old value, preserve carry
  162. jnc i2f_reterror ; done if error
  163. MOV cs:COUNTRY_FLAG,BL ; Set COUNTRY_FLAG to 0 or 0ffh
  164. ;; ============================================================
  165. ;; ONLY FOR RUSSIAN KEYBOARD !!!!!
  166. ;; ============================================================
  167. jmp short int2f_ret
  168. INT_2F_KB_MODE_ERROR_FLAG: ;; ==== (YST) === ;;
  169. INT_2F_GET_KB_MODE: ;; (YST)-----------------------------
  170. CMP AL,GET_KB_MODE ;; Q..Get keyboard mode? |
  171. JNE INT_2F_SET_KB_MODE ;; N..next |
  172. ; PUSH DS ;;
  173. ; PUSH BX ;;
  174. ; PUSH CX ;;
  175. ; PUSH SI ;;
  176. ; push cs
  177. ; pop ds
  178. XOR AX,AX ;; |
  179. OR AL,cs:COUNTRY_FLAG ;; Q..CTRL+ALT+F1 was pressed? |
  180. JZ INT_2F_GET_KB_MODE_DONE ;; Y..return AX = 0 |
  181. ;; Q..is current driver switchable? |
  182. TEST WORD PTR CS:SD.SPECIAL_FEATURES,SWITCHABLE ;; |
  183. JZ INT_2F_GET_KB_MODE_DONE ;; N..return AX = 0FFH |
  184. MOV AL,cs:NLS_FLAG_1 ;; Y..return <keyb NL mode+1> |------------------\
  185. AND AL,1 ;; | if RUS_MODE = 1 | > S
  186. INC AX ;; |------------------/ A
  187. ;; |
  188. INT_2F_GET_KB_MODE_DONE: ;; For DOS 5 normal exit |
  189. RET ;; |
  190. ;; |
  191. INT_2F_SET_KB_MODE: ;; |
  192. CMP AL,SET_KB_MODE ;; Q..Set keyboard mode? |
  193. JNE int2f_ret ;; N..next |
  194. ;; |
  195. MOV BH,cs:NLS_FLAG_1 ;; |
  196. ;; |
  197. TEST BL,0FEH ;; Q..BL equ 0 or 1? |---------------------
  198. JNZ INT_2F_KB_MODE_ERROR_FLAG;; N..Set CARRY flag | |
  199. AND BH,0FEH ;; Y..Set NL mode | if RUS_MODE = 1 |
  200. OR BH,BL ;; | |
  201. ;; |---------------------
  202. ;; |
  203. MOV cs:NLS_FLAG_1,BH ;; Store this value |
  204. ;; |
  205. ;; |
  206. ;; |
  207. ;; (YST)-----------------------------
  208. int2f_ret:
  209. ret
  210. ifdef JAPAN
  211. INT_2F_CP_QLANG:
  212. CMP AL,CP_QLANGUAGE
  213. jnz int2f_ret
  214. mov bl,cs:COUNTRY_FLAG
  215. ret
  216. endif ; JAPAN
  217. KEYB_INT_2F ENDP
  218. CODE ENDS
  219. END
  220. ;; ========================================