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-08-14,Westcott), approve(87-07-13,MCR7580),
 11 ;     audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072):
 12 ;     Created.
 13 ;  2) change(86-09-11,Flegel), approve(87-07-13,MCR7580),
 14 ;     audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072):
 15 ;     Resetting the MCR to not drop DTR.
 16 ;  3) change(86-09-11,Flegel), approve(87-07-13,MCR7580),
 17 ;     audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072):
 18 ;     Resetting the MCR to not drop RTS as well.
 19 ;  4) change(87-04-08,Flegel), approve(87-07-13,MCR7580),
 20 ;     audit(87-07-13,Leskiw), install(87-08-07,MR12.1-1072):
 21 ;     Erase the entire data area (security measures).
 22 ;                                                      END HISTORY COMMENTS
 23 
 24 page 55,132
 25 ;/* : PROCEDURE FUNCTION (terminate_mowse):
 26 ;
 27 ;Remove MOWSE from the PC. This involves:
 28 ;     - disabling interrupts from rs232 hardware
 29 ;     - restoring interrupt vectors to pre-mowse values
 30 ;     - releasing memory used by mowse
 31 ;*/
 32 
 33 include dos.mac          ;Lattice include file
 34 include xoscall.mac      ;Bios and Dos Call macros
 35 include mowsdefs.mac
 36 include ws.mac
 37 include ws_buf.mac
 38 
 39 env_addr equ 2Ch         ; location of address of environment string on PSP
 40 
 41 page
 42 ;*****************************************************************************
 43 ;                                       DATA
 44 ;*****************************************************************************
 45 dseg
 46 
 47 ;------- External Declarations -----------------------------------------------
 48 
 49 extrn   _PSP:word
 50 extrn   MASK8259:byte
 51 extrn   SOFTNO:word
 52 extrn   COM_PORT:word
 53 extrn   HARDINTRPT:word
 54 extrn    _TOP:word
 55 extrn    _STACK:word
 56 
 57 ;------- Public Declarations -------------------------------------------------
 58 
 59 public  terminate_mowse
 60 
 61 endds
 62 
 63 page
 64 ;*****************************************************************************
 65 ;                               Program mainline
 66 ;*****************************************************************************
 67 pseg
 68 
 69 extrn INTHARD:near
 70 extrn INTSOFT:near
 71 extrn INT13:near
 72 extrn INT1C:near
 73 extrn INT28:near
 74 extrn free_program:near
 75 
 76 terminate_mowse proc near
 77 
 78         push    bp
 79 
 80 ;/* : disable hardware interrupt on 8259 interrupt controller */
 81 
 82         cli
 83         in      AL,IMR8259             ;Get current masks
 84         mov     cl,MASK8259
 85         not     cl
 86         or      al,cl                  ;Reset interrupt mask
 87         out     IMR8259,AL             ;And restore to Interrupt Mask
 88                                        ;Register
 89 
 90 ;/* : disable 8250 interrupts */
 91 
 92         mov     DX,LCR                  ;DX ==> LCR
 93         add     DX,COM_PORT
 94         in      AL,DX                   ;Reset DLAB for IER access
 95         and     AL,MASKLCR
 96         out     DX,AL
 97         mov     DX,IER                  ;Address IER
 98         add     DX,COM_PORT
 99         xor     ax,ax
100         out     DX,AL                   ; disable all rs232 interrupts
101 
102 ;/* : disable DTR,RTS,OUT1,OUT2 on 8250 */
103 
104         mov     DX,MCR                  ;Address MCR
105         add     DX,COM_PORT
106         mov     al,MASKMCR              ;Disable OUT2, Leave DTR, RTS active low
107         out     DX,AL
108         sti
109 
110 ;/* : Restore interrupt vectors to pre-mowse values */
111 
112         push    ds
113         mov     ax,HARDINTRPT
114         push    cs                          ; Set up addressability into CS
115         pop     ds
116         mov     dx,word ptr INTHARD
117         mov     ds,word ptr INTHARD+2
118         mov     ah,25h
119         int     21h
120         pop     ds
121 
122         mov     ax,SOFTNO
123         push    ds
124         push    cs                          ; Set up addressability into CS
125         pop     ds
126 
127 ;/* : restore sofware interrupt vector */
128 
129         mov     dx,word ptr INTSOFT
130         mov     ds,word ptr INTSOFT+2
131         mov     ah,25h
132         int     21h
133 
134 ;/* : restore int 13 vector */
135 
136         mov     dx,word ptr INT13
137         mov     ds,word ptr INT13+2
138         mov     al,13h
139         mov     ah,25h
140         int     21h
141 
142 ;/* : restore int 1C vector */
143 
144         mov     dx,word ptr INT1C
145         mov     ds,word ptr INT1C+2
146         mov     al,1Ch
147         mov     ah,25h
148         int     21h
149 
150 ;/* : restore int 28 vector */
151 
152         mov     dx,word ptr INT28
153         mov     ds,word ptr INT28+2
154         mov     al,28h
155         mov     ah,25h
156         int     21h
157         pop     ds
158 
159 ;/* : Erase all static data area */
160 
161         xor     al,al
162         mov     cx,_TOP
163         sub     cx,_STACK
164         xor     si,si
165         push    DS
166         pop     ES
167 
168 erase_data:
169         mov     ES:[si],al
170         inc     si
171         loopne  erase_data
172 
173 ;/* : Free memory occupied by environment block */
174 
175         push    ES
176         push    CS
177         pop     ES                       ; ES = CS of program to free
178         call    free_program             ; free program
179         pop     ES
180 
181         pop     bp
182         ret
183 
184 terminate_mowse endp
185 
186 endps
187       end