Source code of Windows XP (NT5)
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.

257 lines
4.8 KiB

  1. .xlist
  2. include cmacros.inc
  3. ;
  4. ;~~vvr 091989
  5. ;
  6. SYS=1
  7. include equate.inc
  8. ;~~
  9. include vecsys.inc
  10. include int31.inc
  11. .list
  12. page
  13. ;======= EnableVectra ========================================================
  14. ;
  15. ; If we have a Vectra A, A+, or A++ with EX-BIOS, save the current HPEntry
  16. ; vector, HPHIL state and set HPentry=6Fh, Turn ON HPHIL.
  17. ;
  18. ; Entry:
  19. ; DS: Code segment
  20. ;
  21. ;
  22. ; Exit:
  23. ; CurHPentry, CurHILState
  24. ;
  25. ; Regs:
  26. ; AX,
  27. ;
  28. ;=============================================================================
  29. assumes cs, code
  30. sBegin DATA
  31. fFirst dw 0 ; =0: First time in
  32. ;
  33. ;~~vvr 091989
  34. ;
  35. fVectra db 0 ; bit0 =1: We have a Vectra with EX-BIOS
  36. CurHPEntry db 0 ; Current HPEntry vector (usually 6Fh)
  37. CurHILState db 0 ; bit6 =1: HIL is OFF
  38. db ? ; Word aligned
  39. RealMode_Word_Struc Real_Mode_Call_Struc <>
  40. externA WinFlags
  41. externA __ROMBIOS
  42. WF_PMODE equ 01h
  43. sEnd
  44. sBegin CODE
  45. assumes cs, CODE
  46. externW MyCSDS
  47. cProc EnableVectra, <PUBLIC,NEAR>
  48. cBegin
  49. push CX
  50. push BX
  51. push BP
  52. push DS
  53. mov ds, MyCSDS
  54. assumes ds,DATA
  55. test [fVectra], 10000000B ; Any previous Vectra check?
  56. jne EnVNext ; Yes, proceed
  57. ;
  58. ; Check if the PC is a Vectra. If Yes, then call HPSystem to get the
  59. ; current size of the HP state
  60. or [fVectra], 80H ; Mark as gone through the identification
  61. ; ..process
  62. push ES ; Save it
  63. mov AX, __ROMBIOS
  64. mov ES, AX ; ES: Segment of ID code
  65. cmp Word Ptr ES:[ID_OFFSET], 'PH'
  66. pop ES ; Restore entry ES
  67. jz EnVCont1
  68. jmp EnVRet ; Not a Vectra, so no extra HP processing
  69. EnVCont1:
  70. ;
  71. ; Check if EX-BIOS is present
  72. ;
  73. mov AX, F16_INQUIRE
  74. mov BX, AX
  75. int INT_KBD
  76. cmp BX, 'HP' ; EX-BIOS present?
  77. je EnVCont
  78. jmp EnVRet ; No, finish
  79. EnVCont:
  80. or [fVectra], 1 ; Yes, flag we have a Vectra
  81. EnvNext:
  82. test [fVectra], 1
  83. jnz EnVContinue
  84. jmp EnVRet ; No special processing if not a vectra
  85. EnVContinue:
  86. ;
  87. ; We need to save the EX-BIOS vector and the HIL state only once since it is
  88. ; assumed that these parameters will not be changed while running under
  89. ; Windows, especially by an old app.
  90. ;
  91. xor BH, BH
  92. cmp [CurHPEntry], BH ; first time?
  93. jnz EnVSet ; no, don't have to save it again
  94. ;
  95. ; Save current HP entry and set it to be 6Fh
  96. ;
  97. mov AX, F16_GET_INT_NUMBER
  98. int INT_KBD
  99. inc BH ; Flag as the first time
  100. mov [CurHPEntry], HPENTRY ; Assume we have HPentry= 6Fh
  101. cmp AH, RS_UNSUPPORTED
  102. je EnVSet ; We have a Vectra A, A+ if unsupported
  103. mov [CurHPEntry], AH ; Save it if valid
  104. ;
  105. EnVSet:
  106. mov BL, HPENTRY
  107. mov AX, F16_SET_INT_NUMBER
  108. int INT_KBD ; BH preserved
  109. ;
  110. ; Save current HPHIL state and set it ON
  111. ;
  112. mov cx, WinFlags
  113. and cx, WF_PMODE
  114. cmp cx, WF_PMODE ; prot-mode only
  115. jne sys_real_mode
  116. sys_prot_mode:
  117. or BH, BH ; BH= 0: Not the first time
  118. jz EnVSetHIL_PM ; so don't save state
  119. HPSysCall V_HPHIL, F_SYSTEM, SF_REPORT_STATE
  120. mov [CurHILState], BH
  121. ;
  122. ; Bit 14 of BX (Status Word) = 1: HPHIL OFF
  123. ; 0: ON
  124. ;
  125. EnVSetHIL_PM:
  126. HPSysCall V_HPHIL, F_IO_CONTROL, SF_HIL_ON
  127. jmp EnVret
  128. sys_real_mode:
  129. or BH, BH ; BH= 0: Not the first time
  130. jz EnVSetHIL ; so don't save state
  131. mov AH, F_SYSTEM
  132. mov AL, SF_REPORT_STATE
  133. mov BP, V_HPHIL
  134. int HPENTRY ; int 6f to get the state
  135. ;
  136. ; Bit 14 of BX (Status Word) = 1: HPHIL OFF
  137. ; 0: ON
  138. ;
  139. mov [CurHILState], BH
  140. ;
  141. ; Turn HIL ON
  142. ;
  143. EnVSetHIL:
  144. mov AH, F_IO_CONTROL
  145. mov AL, SF_HIL_ON
  146. mov BP, V_HPHIL
  147. int HPENTRY
  148. ;
  149. EnVret:
  150. pop DS
  151. pop BP
  152. pop BX
  153. pop CX
  154. ;
  155. cEnd EnableVectra
  156. page
  157. ;======= DisableVectra =======================================================
  158. ;
  159. ; Restore the Vectra environment according to CurHPEntry and CurHILState
  160. ; Assume that HPENTRY is always 6Fh
  161. ;
  162. ; Entry:
  163. ; DS: Code Segment
  164. ;
  165. ; Exit:
  166. ;
  167. ;
  168. ; Regs:
  169. ; AX,
  170. ;
  171. ;=============================================================================
  172. cProc DisableVectra, <PUBLIC,NEAR>
  173. cBegin
  174. push BX
  175. push BP
  176. push DS
  177. ; make it run in both
  178. mov ds,MyCSDS ; real and prot modes
  179. assumes ds,DATA
  180. test [fVectra], 1 ; are we on a Vectra ?
  181. jnz DisVCont
  182. jmp DisVRet ; no
  183. DisVCont:
  184. ; check if we are prot or real mode
  185. mov bx, WinFlags ; get mode flag
  186. and bx, WF_PMODE
  187. cmp bx, WF_PMODE ; is it prot_mode ?
  188. jne sys_dis_real_mode ; we are in real mode
  189. sys_dis_prot_mode:
  190. test [CurHILState], B_HIL_STATE
  191. je DisVHIL_PM
  192. HPSysCall V_HPHIL, F_IO_CONTROL, SF_HIL_OFF
  193. jmp DisRestHIL
  194. DisVHIL_PM:
  195. HPSysCall V_HPHIL, F_IO_CONTROL, SF_HIL_ON
  196. jmp DisRestHIL
  197. sys_dis_real_mode:
  198. ;
  199. ;
  200. ; Restore the HIL state according to CurHILState
  201. ;
  202. mov AH, F_IO_CONTROL
  203. mov BP, V_HPHIL
  204. mov AL, SF_HIL_ON ; Assume HIL is ON
  205. test [CurHILState], B_HIL_STATE
  206. je DisVHIL ; 0= correct assumption
  207. mov AL, SF_HIL_OFF
  208. DisVHIL:
  209. push ds
  210. int HPENTRY
  211. pop ds
  212. ;
  213. ; Restore the Saved HPEntry
  214. ;
  215. DisRestHIL:
  216. mov AX, F16_SET_INT_NUMBER
  217. mov BL, [CurHPEntry]
  218. int INT_KBD
  219. ;
  220. DisVRet:
  221. pop DS
  222. pop BP
  223. pop BX
  224. ;
  225. cEnd DisableVectra
  226. Send code
  227. end