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.

226 lines
8.3 KiB

  1. ;/*
  2. ; * Microsoft Confidential
  3. ; * Copyright (C) Microsoft Corporation 1988 - 1991
  4. ; * All Rights Reserved.
  5. ; */
  6. PAGE ,132 ;AN000;
  7. TITLE DOS - GRAPHICS Command - Interrupt 2FH Driver ;AN000;
  8. ;AN000;
  9. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  10. ;; DOS - GRAPHICS Command
  11. ;;
  12. ;; ;AN000;
  13. ;; File Name: GRINT2FH.ASM ;AN000;
  14. ;; ---------- ;AN000;
  15. ;; ;AN000;
  16. ;; Description: ;AN000;
  17. ;; ------------ ;AN000;
  18. ;; This file contains the Interrupt 2FH driver. ;AN000;
  19. ;; ;AN000;
  20. ;; Documentation Reference: ;AN000;
  21. ;; ------------------------ ;AN000;
  22. ;; OASIS High Level Design ;AN000;
  23. ;; OASIS GRAPHICS I1 Overview ;AN000;
  24. ;; ;AN000;
  25. ;; Procedures Contained in This File: ;AN000;
  26. ;; ---------------------------------- ;AN000;
  27. ;; INT_2FH_DRIVER - Interrupt 2FH driver ;AN000;
  28. ;; ;AN000;
  29. ;; Include Files Required: ;AN000;
  30. ;; ----------------------- ;AN000;
  31. ;; GRLOAD.EXT - Externals for profile load ;AN000;
  32. ;; GRCTRL.EXT - Externals for print screen control ;AN000;
  33. ;; GRPRINT.EXT - Externals for print modules ;AN000;
  34. ;; GRCPSD.EXT - Externals for COPY_SHARED_DATA module ;AN000;
  35. ;; ;AN000;
  36. ;; External Procedure References: ;AN000;
  37. ;; ------------------------------ ;AN000;
  38. ;; Calls next Int 2FH handler in the chain. ;AN000;
  39. ;; ;AN000;
  40. ;; Linkage Instructions: ;AN000;
  41. ;; -------------------- ;AN000;
  42. ;; Refer to GRAPHICS.ASM ;AN000;
  43. ;; ;AN000;
  44. ;; Change History:
  45. ;; ---------------
  46. ;; M001 NSM 1/30/91 New int 10 handler to trap alt-prt-sc select
  47. ;; calls made by ANSI.SYS. For these calls, we
  48. ;; we need to reinstall our int 5 handler again
  49. ;;
  50. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  51. ;; ;AN000;
  52. ;; ;AN000;
  53. CODE SEGMENT PUBLIC 'CODE' ;; ;AN000;
  54. ASSUME CS:CODE,DS:CODE ;; ;AN000;
  55. ;; ;AN000;
  56. PUBLIC OLD_INT_2FH ;; ;AN000;
  57. PUBLIC INT_2FH_DRIVER ;; ;AN000;
  58. PUBLIC INT_10H_DRIVER ;; ;AN000;
  59. PUBLIC PRT_SCR_2FH_NUMBER ;; ;AN000;
  60. PUBLIC RESIDENT_CODE_SEG ;; ;AN000;
  61. PUBLIC SHARED_DATA_AREA_PTR ;; ;AN000;
  62. ;; ;AN000;
  63. ;; ;AN000;
  64. .XLIST ;AN000;
  65. INCLUDE STRUC.INC ;AN000;
  66. INCLUDE GRINST.EXT ;AN000;
  67. INCLUDE GRCTRL.EXT ;AN000;
  68. INCLUDE GRCPSD.EXT ;AN000;
  69. .LIST ;AN000;
  70. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  71. ;; ;AN000;
  72. ;; Module: INT_2FH_DRIVER ;AN000;
  73. ;; ;AN000;
  74. ;; Description: ;AN000;
  75. ;; Respond to GRAPHICS Int 2FH calls. ;AN000;
  76. ;; The following calls are handled: ;AN000;
  77. ;; ;AN000;
  78. ;; AL = 0 � Install Check ;AN000;
  79. ;; ;AN000;
  80. ;; Invoked By: ;AN000;
  81. ;; INT 2FH instruction. ;AN000;
  82. ;; ;AN000;
  83. ;; Modules Called: ;AN000;
  84. ;; Lower level INT 2FH handlers. ;AN000;
  85. ;; ;AN000;
  86. ;; Input Registers: ;AN000;
  87. ;; Install Check - AH=ACH AL=0 ;AN000;
  88. ;; ;AN000;
  89. ;; ;AN000;
  90. ;; Output Registers: ;AN000;
  91. ;; Install Check: IF GRAPHICS installed ;AN000;
  92. ;; AH=FFH AL=FFH ;AN000;
  93. ;; ES : DI points to Shared Data Area ;AN000;
  94. ;; ELSE ;AN000;
  95. ;; AH=ACH AL=0 ;AN000;
  96. ;; ;AN000;
  97. ;; Logic: ;AN000;
  98. ;; IF AH=ACH THEN ;AN000;
  99. ;; IF AL=0 THEN ;AN000;
  100. ;; AH,AL := -1 ;AN000;
  101. ;; ES : DI := SHARED_DATA_AREA_PTR ;AN000;
  102. ;; ENDIF ;AN000;
  103. ;; IRET ;AN000;
  104. ;; ELSE ;AN000;
  105. ;; IF OLD_INT_2FH is a valid pointer THEN ;AN000;
  106. ;; Jump to Old Int 2FH ;AN000;
  107. ;; ELSE ;AN000;
  108. ;; IRET ;AN000;
  109. ;; ENDIF ;AN000;
  110. ;; ENDIF ;AN000;
  111. ;; ;AN000;
  112. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  113. ;AN000;
  114. INT_2FH_DRIVER PROC NEAR ;AN000;
  115. JMP SHORT INT_2FH ;AN000;
  116. PRT_SCR_2FH_NUMBER EQU 0ACH ; 2FH Multiplex interrupt number ;AN000;
  117. ; assigned to Print Screen. ;AN000;
  118. OLD_INT_2FH DD ? ; Pointer to next 2FH interrupt handler ;AN000;
  119. RESIDENT_CODE_SEG DW ? ; Segment for installed stuff ;AN000;
  120. SHARED_DATA_AREA_PTR DW ? ; Offset of the start of the ;AN000;
  121. ; Shared Data Area ;AN000;
  122. ;AN000;
  123. INT_2FH: ;AN000;
  124. ;-------------------------------------------------------------------------------;AN000;
  125. ; Verify if the 2FH Interrupt call is for our interrupt handler: ;AN000;
  126. ;-------------------------------------------------------------------------------;AN000;
  127. .IF <AH EQ PRT_SCR_2FH_NUMBER> AND;If 2FH call is for us ;AN000;
  128. .IF <ZERO AL> ; and request is "Get install state" ;AN000;
  129. .THEN ; then, ;AN000;
  130. ;-------------------------------------------------------------------------------;AN000;
  131. ; Yes: return results ;AN000;
  132. ;-------------------------------------------------------------------------------;AN000;
  133. MOV DI,CS:SHARED_DATA_AREA_PTR ; ES:DI := Pointer to shared ;AN000;
  134. PUSH CS:RESIDENT_CODE_SEG ; data area ;AN000;
  135. POP ES ; ;AN000;
  136. MOV AH,0FFH ; AL and AH := "We are installed" ;AN000;
  137. MOV AL,AH ; ;AN000;
  138. IRET ; Return to interrupted process ;AN000;
  139. ;-------------------------------------------------------------------------------;AN000;
  140. ; No, pass control to next 2FH interrupt handler: ;AN000;
  141. ;-------------------------------------------------------------------------------;AN000;
  142. .ELSE ; else, this call is not for us: ;AN000;
  143. .IF <<WORD PTR CS:OLD_INT_2FH> NE 0> AND ;if there is another ;AN000;
  144. .IF <<WORD PTR CS:OLD_INT_2FH+2> NE 0> ; 2FH driver ;AN000;
  145. .THEN ; below us then, ;AN000;
  146. JMP CS:OLD_INT_2FH ; pass control to it ;AN000;
  147. .ELSE ; else, there is nobody to pass ;AN000;
  148. IRET ; control to, just return. ;AN000;
  149. .ENDIF ; END If there is a driver below us.;AN000;
  150. .ENDIF ; END If this call is for us. ;AN000;
  151. INT_2FH_DRIVER ENDP ;AN000;
  152. ;AN000;
  153. ;/*M001 BEGIN */
  154. ;========================================================================
  155. ; INT_10h_Driver :
  156. ; int 10 handler to check for alt-prt-sc-select calls (ah=12,bl=20h)
  157. ; Other int 10 calls are passed on. For alt-prt-sc-select calls,
  158. ; old int 10 is called and after return, we reinstall our int 5 (prt_sc)
  159. ; vector back again ( if it was changed by ANSI.SYS).
  160. ;=======================================================================
  161. INT_10H_DRIVER PROC NEAR
  162. sti ; restore interrupts
  163. cmp ah,ALTERNATE_SELECT ; see if the call is for
  164. jnz go_old_int10 ; alt_prt_sc; if so
  165. cmp bl,ALT_PRT_SC_SELECT ; call int 10 and then
  166. jz Set_Our_Int5_handler ; restore out PRT_SC vector
  167. go_old_int10: ; other int 10 calls
  168. jmp DWORD PTR cs:OLD_INT_10H ; ...pass it on.
  169. ; the call is for alternate prt Screen int 10
  170. ; call the old int 10 handler and then restore our int 5 vector back again
  171. Set_Our_Int5_handler:
  172. pushf
  173. call DWORD PTR cs:OLD_INT_10H ; call the prev.int 10 handler
  174. push ax
  175. push bx
  176. push cx
  177. push dx
  178. push si
  179. push di
  180. push ds
  181. xor ax,ax
  182. mov ds,ax ; ds-> 0 to get at int.vector table
  183. mov si,5 * 4 ; ds:si -> ptr to int 5 vector
  184. mov cx,cs
  185. mov dx,offset PRT_SCR
  186. cli
  187. mov ax,ds:[si+2] ; segment for current int 5 vector
  188. cmp ax,cx ; is it changed by ROM BIOS
  189. je no_int5_chg
  190. mov bx,ds:[si]
  191. cmp bx, dx ;further sanity check for offset
  192. je no_int5_chg
  193. ; cx:dx = our int 5 handler
  194. ; ax:bx = current int 5 handler
  195. ; store the current int 5 handler as the old handler and install ourselves
  196. ; again
  197. mov ds:[si],dx ; store offset
  198. mov ds:[si+2],cx ; store segment
  199. mov CS:[BIOS_INT_5H],bx ; store old int5 vector
  200. mov CS:[BIOS_INT_5H +2],ax
  201. no_int5_chg:
  202. sti
  203. pop ds
  204. pop di
  205. pop si
  206. pop dx
  207. pop cx
  208. pop bx
  209. pop ax
  210. iret
  211. INT_10H_DRIVER ENDP
  212. ; /* M001 END */
  213. CODE ENDS ;AN000;
  214. END ;AN000;
  215.