home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Beijing Paradise BBS Backup
/
PARADISE.ISO
/
software
/
BBSDOORW
/
WATCHKAT.ZIP
/
WATCHCAT.LST
< prev
next >
Wrap
File List
|
1989-08-23
|
26KB
|
495 lines
Turbo Assembler Version 1.0 11-21-89 20:57:32 Page 1
WATCHCAT.ASM
1 0000 .model tiny
2 0000 .code
3 0000 first:
4 ;
5 ; WATCHCAT copyright 1989, Joseph R. Ahlgren
6 ; see WATCHCAT.DOC
7 ;
8 ; WATCHCAT performs 5 critical functions for any RBBS system:
9 ; 1. Reboots system if no carrier in specified period of time
10 ; This catches RBBS or system failures
11 ; 2. Reboots system if carrier lost during critical period
12 ; This allows Doors to be used safely
13 ; 3. Reboots system if 20 rings without answering phone
14 ; This allows system to be restarted by phone
15 ; 4. Reboots system if "Hit any key to return to system" message appears
16 ; This restarts system on a common RBBS failure
17 ; 5. Drops carrier if L&R shift keys pressed simultaneously
18 ; This allows users to be logged off without a nasty message.
19 ;WATCHCAT loads the TSR and disables all functions
20 ; WATCHCAT OFF disables all functions
21 ; WATCHCAT ON enables 1,3,4,and 5
22 ; WATCHCAT TIMER enables 2,4,and 5
23 ;ComPort = 03f8h ;{COM1}
24 ;ComPort = 02f8h ;{COM2}
25 ;ComPort = 03e8h ;{COM3}
26 ;ComPort = 02e8h ;{COM4}
27 ;ScreenSegment = 0b800h ;{Color}
28 ;ScreenSegment = 0b000h ;{Mono}
29 = 0006 ModemStatus = 0006h
30 = 0004 ModemControl = 0004h
31 = 0080 CarrierDetect = 0080h
32 = 0040 RingIndicator = 0040h
33 = 0444 tpm = 1092 ; {ticks per minute}
34 = 006E RingTicks = 110; {6 seconds}
35 org 100h
36 0100 start:
37 0100 E9 010F jmp init
38 0103 0000 RingTrigger dw 0
39 0105 00 RingTimer db 0
40 0106 06 Flag db 'F' and 0fh ; OFF ON TIME = F O I
41 0107 ???????? TimerInt dd ?
42 010B 01E0 Minutes dw 8*60 ;{minutes of no carrier to trigger reset}
43 010D 0444 Seconds dw tpm
44 010F 01E0 MinReset dw 8*60
45 0111 FFFF0000 ColdBoot dd 0ffff0000h
46 0115 00 ExitTimer db 0
47 0116 03 DropTrigger db 3 ;Drop DTR on L&R shift
48 0117 48 69 74 20 61 6E 79 + ExitMessage db 'Hit any key to return to system'
49 20 6B 65 79 20 74 6F +
50 20 72 65 74 75 72 6E +
51 20 74 6F 20 73 79 73 +
52 74 65 6D
53 0136 00 ExitMessageEnd db 0
54 0137 02F8 ComPort dw 02f8h ;{COM2}
55 0139 B000 ScreenSegment dw 0b000h ;{Mono}
56 013B 6A 4F 65 59 Ident db "jOeY"
57 013F 35 30 63 34 Ident2 db "50c4"
58 0143 timer:
59 assume ds:nothing,es:nothing,ss:nothing
Turbo Assembler Version 1.0 11-21-89 20:57:32 Page 2
WATCHCAT.ASM
60 0143 2E: 80 3E 0106r 06 cmp cs:[Flag],'F' and 0fh
61 0149 75 05 jne SystemOn
62 014B 2E: FF 2E 0107r jmp cs:[TimerInt]
63 0150 SystemOn:
64 0150 50 push ax
65 0151 52 push dx
66 0152 1E push ds
67 ; 4. Reboots system if "Hit any key to return to system" message appears
68 ; This restarts system on a common RBBS failure
69 0153 2E: FE 0E 0115r dec cs:[ExitTimer]
70 0158 75 2C jnz NoExitLoop
71 015A 51 push cx
72 015B 56 push si
73 015C 57 push di
74 015D 2E: A1 0139r mov ax,cs:[ScreenSegment]
75 0161 8E D8 mov ds,ax
76 0163 B9 0019 mov cx,25
77 0166 33 F6 xor si,si
78 0168 SSLoop1:
79 0168 51 push cx
80 0169 56 push si
81 016A B9 001F mov cx,ExitMessageEnd-ExitMessage
82 016D BF 0117r mov di,offset ExitMessage
83 0170 SSLoop2:
84 0170 AD lodsw
85 0171 2E: 3A 05 cmp al,cs:[di]
86 0174 75 05 jne SSLoop2x
87 0176 47 inc di
88 0177 E2 F7 loop SSLoop2
89 0179 EB 6D jmp short NoCarrier
90 017B SSLoop2x:
91 017B 5E pop si
92 017C 59 pop cx
93 017D 81 C6 00A0 add si,160
94 0181 E2 E5 loop SSLoop1
95 0183 5F pop di
96 0184 5E pop si
97 0185 59 pop cx
98 0186 NoExitLoop:
99 ; 5. Drops carrier if L&R shift keys pressed simultaneously
100 ; This allows users to be logged off without a nasty message.
101 0186 33 C0 xor ax,ax
102 0188 8E D8 mov ds,ax
103 assume ds:Lowmem
104 018A A0 0417r mov al,[ShiftStatus]
105 018D 24 0F and al,0fh
106 018F 2E: 3A 06 0116r cmp al,cs:[DropTrigger]
107 0194 75 0C jne NoShift
108 0196 2E: 8B 16 0137r mov dx,cs:[ComPort]
109 019B 83 C2 04 add dx,ModemControl
110 019E EC in al,dx
111 ; or al,1
112 019F 24 FE and al,0feh
113 01A1 EE out dx,al ;drop DTR
114 01A2 NoShift:
115 ; 3. Reboots system if 20 rings without answering phone
116 ; This allows system to be restarted by phone
117 01A2 2E: 8B 16 0137r mov dx,[ComPort]
118 01A7 83 C2 06 add dx,ModemStatus
Turbo Assembler Version 1.0 11-21-89 20:57:32 Page 3
WATCHCAT.ASM
119 01AA EC in al,dx
120 01AB A8 40 test al,RingIndicator
121 01AD 74 06 jz NotRinging
122 01AF 2E: 83 0E 0103r 01 or cs:[RingTrigger],1
123 01B5 NotRinging:
124 01B5 2E: FE 0E 0105r dec cs:[RingTimer]
125 01BA 75 15 jnz NoRingTime
126 01BC 2E: C6 06 0105r 6E mov cs:[RingTimer],RingTicks
127 01C2 2E: A1 0103r mov ax,cs:[RingTrigger]
128 01C6 3D FFFF cmp ax,0ffffh
129 01C9 74 1D je NoCarrier
130 01CB D1 E0 shl ax,1
131 01CD 2E: A3 0103r mov cs:[RingTrigger],ax
132 ; 2. Reboots system if carrier lost during critical period
133 ; This allows Doors to be used safely
134 01D1 NoRingTime:
135 01D1 2E: 80 3E 0106r 09 cmp cs:[Flag],'I' and 0fh
136 01D7 72 07 jb NoMonitor
137 01D9 74 12 je TimeCheck
138 01DB EC in al,dx
139 01DC 24 80 and al,CarrierDetect
140 01DE 74 08 jz NoCarrier
141 01E0 NoMonitor:
142 01E0 1F pop ds
143 01E1 5A pop dx
144 01E2 58 pop ax
145 01E3 2E: FF 2E 0107r jmp cs:[TimerInt]
146 01E8 NoCarrier:
147 01E8 2E: FF 2E 0111r jmp cs:[ColdBoot]
148 ; 1. Reboots system if no carrier in specified period of time
149 ; This catches RBBS or system failures
150 01ED TimeCheck:
151 01ED A8 80 test al,CarrierDetect
152 01EF 75 17 jnz ResetTime
153 01F1 2E: FF 0E 010Dr dec cs:[Seconds]
154 01F6 75 E8 jnz NoMonitor
155 01F8 2E: C7 06 010Dr 0444 mov cs:[Seconds],tpm
156 01FF 2E: FF 0E 010Br dec cs:[Minutes]
157 0204 74 E2 jz NoCarrier
158 0206 EB D8 jmp short NoMonitor
159 0208 ResetTime:
160 0208 2E: A1 010Fr mov ax,cs:[MinReset]
161 020C 2E: A3 010Br mov cs:[Minutes],ax
162 0210 EB CE jmp short NoMonitor
163 ;
164 ;
165 ;
166 ;
167 assume ds:@code,es:@code,ss:@code
168 0212 init:
169 0212 BA 035Ar mov dx,offset SignOnMessage
170 0215 B8 0900 mov ax,0900h
171 0218 CD 21 int 21h ;print load message
172 021A A1 013Fr mov ax,[word ptr Ident2]
173 021D 31 06 013Br xor [word ptr Ident],ax
174 0221 A1 0141r mov ax,[word ptr Ident2+2]
175 0224 31 06 013Dr xor [word ptr Ident+2],ax
176 0228 33 D2 xor dx,dx
177 022A 8E C2 mov es,dx
Turbo Assembler Version 1.0 11-21-89 20:57:32 Page 4
WATCHCAT.ASM
178 022C BE 013Br mov si,offset Ident
179 022F 8C C9 mov cx,cs
180 0231 8B 04 mov ax,[si]
181 0233 findloop:
182 0233 26: 3B 04 cmp ax,es:[si]
183 0236 74 5F jz found
184 0238 NotQuite:
185 0238 42 inc dx
186 0239 8E C2 mov es,dx
187 023B E2 F6 loop findloop
188 023D LoadWatchCat:
189 023D 33 DB xor bx,bx
190 023F 8E C3 mov es,bx
191 0241 8A 1E 0082 mov bl,ds:[82h]
192 0245 80 FB 30 cmp bl,'0'
193 0248 7E 05 jle NoCom
194 024A 80 FB 34 cmp bl,'4'
195 024D 7E 02 jle ComSpec
196 024F NoCom:
197 024F B3 31 mov bl,'1'
198 0251 ComSpec:
199 0251 88 1E 030Er mov [ComPortNumber],bl
200 0255 03 DB add bx,bx
201 0257 26: 8B 87 039E mov ax,es:[bx+400h-31h-31h]
202 025C A3 0137r mov [ComPort],ax
203 025F 80 3E 0083 43 cmp byte ptr ds:[83h],'C'
204 0264 75 0C jnz NotColor
205 0266 C7 06 0139r B800 mov [ScreenSegment],0b800h
206 026C C6 06 031Cr 38 90 mov [ScreenSegNum],'8'
207 0272 NotColor:
208 0272 B8 3508 mov ax,3508h
209 0275 CD 21 int 21h ;get timer interrupt
210 0277 89 1E 0107r mov [word ptr TimerInt],bx
211 027B 8C 06 0109r mov [word ptr TimerInt+2],es
212 027F BA 0143r mov dx,offset Timer
213 0282 B8 2508 mov ax,2508h
214 0285 CD 21 int 21h ;set timer interrupt
215 0287 BA 02F1r mov dx,offset message1
216 028A B8 0900 mov ax,0900h
217 028D CD 21 int 21h ;print load message
218 028F BA 0022 mov dx,(init-first+15)/16
219 0292 B8 3101 mov ax,3101h
220 0295 CD 21 int 21h ;TSR
221 0297 Found:
222 0297 8B 5C 02 mov bx,[si+2]
223 029A 26: 3B 5C 02 cmp bx,es:[si+2]
224 029E 75 98 jnz NotQuite
225 02A0 8C C0 mov ax,es
226 02A2 BB 0010 mov bx,10h
227 02A5 BF 0336r mov di,offset message2x
228 02A8 B9 0004 mov cx,4
229 02AB loc:
230 02AB F7 E3 mul bx
231 02AD 80 FA 09 cmp dl,9
232 02B0 76 03 jbe locx
233 02B2 80 C2 07 add dl,7
234 02B5 locx:
235 02B5 80 C2 30 add dl,'0'
236 02B8 88 15 mov [di],dl
Turbo Assembler Version 1.0 11-21-89 20:57:32 Page 5
WATCHCAT.ASM
237 02BA 47 inc di
238 02BB E2 EE loop loc
239 02BD 26: A1 010Fr mov ax,es:[MinReset]
240 02C1 26: A3 010Br mov es:[Minutes],ax
241 02C5 A0 0083 mov al,ds:[83h]
242 02C8 24 0F and al,0fh
243 02CA 26: A2 0106r mov es:[Flag],al
244 02CE BA 0352r mov dx,offset message2tim
245 02D1 3C 09 cmp al,'I' and 0fh
246 02D3 74 08 jz done
247 02D5 BA 034Cr mov dx,offset message2off
248 02D8 72 03 jb done
249 02DA BA 0347r mov dx,offset message2on
250 02DD done:
251 02DD 52 push dx
252 02DE BA 0322r mov dx,offset message2
253 02E1 B8 0900 mov ax,0900h
254 02E4 CD 21 int 21h
255 02E6 5A pop dx
256 02E7 B8 0900 mov ax,0900h
257 02EA CD 21 int 21h
258 02EC B8 4C00 mov ax,4c00h
259 02EF CD 21 int 21h
260 02F1 0A 0D 57 61 74 63 68 + message1 db 0ah,0dh,'Watchcat Loaded, set to COM'
261 63 61 74 20 4C 6F 61 +
262 64 65 64 2C 20 73 65 +
263 74 20 74 6F 20 43 4F +
264 4D
265 030E 31 20 61 6E 64 20 53 + ComPortNumber db '1 and Screen B'
266 63 72 65 65 6E 20 42
267 031C 30 30 30 0A 0D 24 ScreenSegNum db '000',0ah,0dh,'$'
268 0322 0A 0D 57 61 74 63 68 + message2 db 0ah,0dh,'Watchcat found at '
269 63 61 74 20 66 6F 75 +
270 6E 64 20 61 74 20
271 0336 30 30 30 30 20 61 6E + message2x db '0000 and set to $'
272 64 20 73 65 74 20 74 +
273 6F 20 24
274 0347 4F 4E 0A 0D 24 message2on db 'ON',0ah,0dh,'$'
275 034C 4F 46 46 0A 0D 24 message2off db 'OFF',0ah,0dh,'$'
276 0352 54 49 4D 45 52 0A 0D + message2tim db 'TIMER',0ah,0dh,'$'
277 24
278 035A 0D 0A 57 41 54 43 48 + SignOnMessage db 0dh,0ah,'WATCHCAT, copyright 1989 Joseph R. Ahlgren'
279 43 41 54 2C 20 63 6F +
280 70 79 72 69 67 68 74 +
281 20 31 39 38 39 20 4A +
282 6F 73 65 70 68 20 52 +
283 2E 20 41 68 6C 67 72 +
284 65 6E
285 0386 20 20 20 52 42 42 53 + db ' RBBS 703-241-7980',0dh,0ah
286 20 37 30 33 2D 32 34 +
287 31 2D 37 39 38 30 0D +
288 0A
289 039C 20 57 41 54 43 48 43 + db ' WATCHCAT may be freely distributed provided this message is not modified',0dh,0ah
290 41 54 20 6D 61 79 20 +
291 62 65 20 66 72 65 65 +
292 6C 79 20 64 69 73 74 +
293 72 69 62 75 74 65 64 +
294 20 70 72 6F 76 69 64 +
295 65 64 20 74 68 69 73 +
Turbo Assembler Version 1.0 11-21-89 20:57:32 Page 6
WATCHCAT.ASM
296 20 6D 65 73 73 61 67 +
297 65 20 69 73 20 6E 6F +
298 74 20 6D 6F 64 69 66 +
299 69 65 64 0D 0A
300 03E7 20 4C 6F 61 64 20 77 + db ' Load with WATCHCAT ps, where p is the port number (1,2,3,4)',0dh,0ah
301 69 74 68 20 57 41 54 +
302 43 48 43 41 54 20 70 +
303 73 2C 20 77 68 65 72 +
304 65 20 70 20 69 73 20 +
305 74 68 65 20 70 6F 72 +
306 74 20 6E 75 6D 62 65 +
307 72 20 28 31 2C 32 2C +
308 33 2C 34 29 0D 0A
309 0425 20 20 61 6E 64 20 73 + db ' and s is the screen type (Color or Mono), e.g., WATCHCAT 2C',0dh,0ah
310 20 69 73 20 74 68 65 +
311 20 73 63 72 65 65 6E +
312 20 74 79 70 65 20 28 +
313 43 6F 6C 6F 72 20 6F +
314 72 20 4D 6F 6E 6F 29 +
315 2C 20 65 2E 67 2E 2C +
316 20 57 41 54 43 48 43 +
317 41 54 20 32 43 0D 0A
318 0464 20 20 73 70 65 63 69 + db ' specifies COM2 and Color Screen',0ah,0dh
319 66 69 65 73 20 43 4F +
320 4D 32 20 61 6E 64 20 +
321 43 6F 6C 6F 72 20 53 +
322 63 72 65 65 6E 0A 0D
323 0487 20 53 75 62 73 65 71 + db ' Subsequent calls are WATCHCAT ON, WATCHCAT OFF, and WATCHCAT TIMER',0dh,0ah
324 75 65 6E 74 20 63 61 +
325 6C 6C 73 20 61 72 65 +
326 20 57 41 54 43 48 43 +
327 41 54 20 4F 4E 2C 20 +
328 57 41 54 43 48 43 41 +
329 54 20 4F 46 46 2C 20 +
330 61 6E 64 20 57 41 54 +
331 43 48 43 41 54 20 54 +
332 49 4D 45 52 0D 0A
333 04CC 20 20 4F 46 46 20 64 + db ' OFF disables all functions',0dh,0ah
334 69 73 61 62 6C 65 73 +
335 20 61 6C 6C 20 66 75 +
336 6E 63 74 69 6F 6E 73 +
337 0D 0A
338 04EA 20 20 4F 4E 20 72 65 + db ' ON reboots if carrier lost',0dh,0ah
339 62 6F 6F 74 73 20 69 +
340 66 20 63 61 72 72 69 +
341 65 72 20 6C 6F 73 74 +
342 0D 0A
343 0508 20 20 54 49 4D 45 52 + db ' TIMER reboots if 20 rings without answering phone, if no carrier',0dh,0ah
344 20 72 65 62 6F 6F 74 +
345 73 20 69 66 20 32 30 +
346 20 72 69 6E 67 73 20 +
347 77 69 74 68 6F 75 74 +
348 20 61 6E 73 77 65 72 +
349 69 6E 67 20 70 68 6F +
350 6E 65 2C 20 69 66 20 +
351 6E 6F 20 63 61 72 72 +
352 69 65 72 0D 0A
353 054C 20 20 20 69 6E 20 38 + db ' in 8 hours, or if "Hit any key to return to system" appears on screen',0dh,0ah
354 20 68 6F 75 72 73 2C +
Turbo Assembler Version 1.0 11-21-89 20:57:32 Page 7
WATCHCAT.ASM
355 20 6F 72 20 69 66 20 +
356 22 48 69 74 20 61 6E +
357 79 20 6B 65 79 20 74 +
358 6F 20 72 65 74 75 72 +
359 6E 20 74 6F 20 73 79 +
360 73 74 65 6D 22 20 61 +
361 70 70 65 61 72 73 20 +
362 6F 6E 20 73 63 72 65 +
363 65 6E 0D 0A
364 0596 20 20 20 41 6C 73 6F + db ' Also, pressing both Left and Right Shift keys simultaneously will',0dh,0ah
365 2C 20 70 72 65 73 73 +
366 69 6E 67 20 62 6F 74 +
367 68 20 4C 65 66 74 20 +
368 61 6E 64 20 52 69 67 +
369 68 74 20 53 68 69 66 +
370 74 20 6B 65 79 73 20 +
371 73 69 6D 75 6C 74 61 +
372 6E 65 6F 75 73 6C 79 +
373 20 77 69 6C 6C 0D 0A
374 05DC 20 20 20 64 72 6F 70 + db ' drop the line, logging off the current user.',0dh,0ah
375 20 74 68 65 20 6C 69 +
376 6E 65 2C 20 6C 6F 67 +
377 67 69 6E 67 20 6F 66 +
378 66 20 74 68 65 20 63 +
379 75 72 72 65 6E 74 20 +
380 75 73 65 72 2E 0D 0A
381 060D 24 db '$'
382 060E ends
383 0000 Lowmem segment at 0000h
384 org 417h
385 0417 ?? ShiftStatus db ?
386 0418 Lowmem ends
387 end start
Turbo Assembler Version 1.0 11-21-89 20:57:32 Page 8
Symbol Table
Symbol Name Type Value
??DATE Text "11-21-89"
??FILENAME Text "WATCHCAT"
??TIME Text "20:57:29"
??VERSION Number 0100
@CODE Text DGROUP
@CODESIZE Text 0
@CPU Text 0101H
@CURSEG Text LOWMEM
@DATA Text DGROUP
@DATASIZE Text 0
@FILENAME Text WATCHCAT
@WORDSIZE Text 2
CARRIERDETECT Number 0080
COLDBOOT Dword DGROUP:0111
COMPORT Word DGROUP:0137
COMPORTNUMBER Byte DGROUP:030E
COMSPEC Near DGROUP:0251
DONE Near DGROUP:02DD
DROPTRIGGER Byte DGROUP:0116
EXITMESSAGE Byte DGROUP:0117
EXITMESSAGEEND Byte DGROUP:0136
EXITTIMER Byte DGROUP:0115
FINDLOOP Near DGROUP:0233
FIRST Near DGROUP:0000
FLAG Byte DGROUP:0106
FOUND Near DGROUP:0297
IDENT Byte DGROUP:013B
IDENT2 Byte DGROUP:013F
INIT Near DGROUP:0212
LOADWATCHCAT Near DGROUP:023D
LOC Near DGROUP:02AB
LOCX Near DGROUP:02B5
MESSAGE1 Byte DGROUP:02F1
MESSAGE2 Byte DGROUP:0322
MESSAGE2OFF Byte DGROUP:034C
MESSAGE2ON Byte DGROUP:0347
MESSAGE2TIM Byte DGROUP:0352
MESSAGE2X Byte DGROUP:0336
MINRESET Word DGROUP:010F
MINUTES Word DGROUP:010B
MODEMCONTROL Number 0004
MODEMSTATUS Number 0006
NOCARRIER Near DGROUP:01E8
NOCOM Near DGROUP:024F
NOEXITLOOP Near DGROUP:0186
NOMONITOR Near DGROUP:01E0
NORINGTIME Near DGROUP:01D1
NOSHIFT Near DGROUP:01A2
NOTCOLOR Near DGROUP:0272
NOTQUITE Near DGROUP:0238
NOTRINGING Near DGROUP:01B5
RESETTIME Near DGROUP:0208
RINGINDICATOR Number 0040
RINGTICKS Number 006E
RINGTIMER Byte DGROUP:0105
RINGTRIGGER Word DGROUP:0103
Turbo Assembler Version 1.0 11-21-89 20:57:32 Page 9
Symbol Table
SCREENSEGMENT Word DGROUP:0139
SCREENSEGNUM Byte DGROUP:031C
SECONDS Word DGROUP:010D
SHIFTSTATUS Byte LOWMEM:0417
SIGNONMESSAGE Byte DGROUP:035A
SSLOOP1 Near DGROUP:0168
SSLOOP2 Near DGROUP:0170
SSLOOP2X Near DGROUP:017B
START Near DGROUP:0100
SYSTEMON Near DGROUP:0150
TIMECHECK Near DGROUP:01ED
TIMER Near DGROUP:0143
TIMERINT Dword DGROUP:0107
TPM Number 0444
Groups & Segments Bit Size Align Combine Class
DGROUP Group
_DATA 16 0000 Word Public DATA
_TEXT 16 060E Word Public CODE
LOWMEM 16 0418 AT 0000