1 ; ***********************************************************
  2 ; *                                                         *
  3 ; * Copyright, (C) Honeywell Bull Inc., 1987                *
  4 ; *                                                         *
  5 ; * Copyright, (C) Honeywell Information Systems Inc., 1986 *
  6 ; *                                                         *
  7 ; ***********************************************************
  8 
  9 ; HISTORY COMMENTS:
 10 ;  1) change(86-06-16,Westcott), approve(87-07-13,MCR7580),
 11 ;     audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072):
 12 ;     Created.
 13 ;                                                      END HISTORY COMMENTS
 14 
 15 ;/* : PROCEDURE FUNCTION (set_dta)
 16 ;
 17 ;This routine is used to provide a DTA address so that the called MOWSE
 18 ;application does not use the foreground applications's DTA. It does this
 19 ;by saving the old DTA address and then providing a new DTA address
 20 ;*/
 21 
 22 ;/* : NOTES
 23 ;
 24 ;Syntax:
 25 ;      call set_dta()
 26 ;*/
 27 
 28 include dos.mac
 29 dseg
 30 
 31 ;-------------- DATA
 32 
 33 svdtaoff        dd      0       ; save address for old DTA offset address
 34 trap22          dd      0       ; old int22 vector address
 35 trap23          dd      0       ; old int23 vector address
 36 trap24          dd      0       ; old int24 vector address
 37 newdta          db      128 dup (0);  new dta
 38 endds
 39 
 40 ;*******************************************************************
 41 ;                          MAIN
 42 ;*******************************************************************
 43 pseg
 44 
 45 ;-------------- PUBLICS
 46 
 47 public  set_dta
 48 public  rst_dta
 49 public  set_trap
 50 public  rst_trap
 51 public  wstrap23
 52 public  wstrap24
 53 
 54 set_dta proc    near
 55         push    bp
 56         push    es
 57         mov     ah,2Fh
 58         int     21h                    ; get old dta address into es:bx
 59         mov     word ptr svdtaoff+2,es ; save addresses
 60         mov     word ptr svdtaoff,bx
 61         mov     dx,offset newdta
 62         mov     ah,1Ah
 63         int     21h                    ; set new dta address
 64         pop     es
 65         pop     bp
 66         ret
 67 set_dta endp
 68 
 69 ;/* : PROCEDURE FUNCTION (rst_dta)
 70 ;
 71 ;This routine is used to restore the DTA address previously saved by set_dta.
 72 ;*/
 73 
 74 ;/* : NOTES
 75 ;
 76 ;Syntax:
 77 ;     call rst_dta()
 78 ;*/
 79 
 80 rst_dta proc    near
 81         push    bp
 82         push    ds
 83         lds     dx,svdtaoff            ; set ds:dx old dta address
 84         mov     ah,1aH
 85         int     21h
 86         pop     ds
 87         pop     bp
 88         ret
 89 rst_dta endp
 90 
 91 ;/* : PROCEDURE FUNCTION (set_trap)
 92 ;
 93 ;This routine is used to set the trap vectors for DOS Interrupts 23,24,25 to
 94 ;a MOWSE controlled routine.
 95 ;*/
 96 
 97 ;/* : NOTES
 98 ;
 99 ;Syntax:
100 ;     call set_trap()
101 ;*/
102 
103 set_trap proc near
104         push    bp
105         push    es
106         mov     al,23h
107         mov     ah,35h
108         int     21h                    ; get old trap vector
109         mov     word ptr trap23+2,es
110         mov     word ptr trap23,bx
111         mov     dx, offset wstrap23
112         mov     al,23h
113         mov     ah,25h
114         int     21h                    ; set new vector
115         mov     al,24h
116         mov     ah,35h
117         int     21h                    ; get old trap vector
118         mov     word ptr trap24+2,es
119         mov     word ptr trap24,bx
120         mov     dx, offset wstrap24
121         mov     al,24h
122         mov     ah,25h
123         int     21h                    ; set new vector
124         pop     es
125         pop     bp
126         ret
127 set_trap endp
128 
129 ;/* : PROCEDURE FUNCTION (rst_trap)
130 ;
131 ;This routine is used to restore the trap vectors for DOS Interrupts 23,24,25
132 ;to the previous values so that MOWSE knows when these interrupts occur.
133 ;*/
134 
135 ;/* : NOTES
136 ;
137 ;Syntax:
138 ;     call rst_trap()
139 ;*/
140 
141 rst_trap proc near
142         push    bp
143         push    ds
144         lds     dx,trap23
145         mov     al,23h
146         mov     ah,25h
147         int     21h                    ; restore interrupt 23 vector
148         pop     ds
149         push    ds
150         lds     dx,trap24
151         mov     al,24h
152         mov     ah,25h
153         int     21h                    ; restore interrupt 24 vector
154         pop     ds
155         pop     bp
156         ret
157 rst_trap endp
158 
159 ;/* : PROCEDURE FUNCTION (wstrap23)
160 ;
161 ;This routine will get control whenever an Interrupt 23 occurs while MOWSE
162 ;is active.
163 ;*/
164 
165 ;/* : NOTES
166 ;Syntax:
167 ;     wstrap23()
168 ;*/
169 
170 INTRAP23 dw 0
171 
172 wstrap23  proc near
173         sti
174         cmp     cs:INTRAP23,0
175         jne     notrap23
176         inc     cs:INTRAP23
177         or      al,al
178         dec     cs:INTRAP23
179 
180 notrap23:
181         iret
182 
183 wstrap23  endp
184 
185 ;/* : PROCEDURE FUNCTION (wstrap24)
186 ;
187 ;This routine will get control whenever an Interrupt 24 occurs while MOWSE
188 ;is active.
189 ;*/
190 
191 ;/* : NOTES
192 ;
193 ;Syntax:
194 ;     wstrap24()
195 ;*/
196 
197 INTRAP24 dw 0
198 
199 wstrap24  proc near
200         sti
201         cmp     cs:INTRAP24,0
202         jne     notrap24
203         inc     cs:INTRAP24
204         or      al,al
205         dec     cs:INTRAP24
206 
207 notrap24:
208         xor     al,al                  ;tell DOS to ignore the trap
209         iret
210 
211 wstrap24  endp
212 endps
213         end
214 ^Z