; This is called automatically (by BYERSX) when a loss of ; carrier is detected, or when forced by the "twit" key ; for a manual disconnect, or by the user executing BYE. ; This outputs a message, and then ensures that the line ; is disconnected, after which it sets write protection on ; all drives and executes a program to answer a new call. ; cr equ 0dh lf equ 0ah tstr equ 9 ; ; bdos calls setdma equ 26 ; ; byersx calls chain equ 47 minsta equ 61; (* 3d 0 for no input ready *) moutsta equ 62; (* 3e 0 for output not ready *) mout equ 63; (* 3f output, no ready waiting *) min equ 64; (* 40 input, no ready waiting *) carrier equ 65; (* 41 detected *) sgstate equ 84; (* 54 Priv., terminal mode, checks *) dodelay equ 85; (* 55 in millisecs *) rsxmast equ 87; (* 57 master presence call *) swrtprt equ 91; (* 5b set drive write-protect vector *) ; ; rsxmast subcalls rstsec equ 4; (* 4 set security off *) stopmdm equ 66; (* 42 disconnect communications *) ; bdos equ 5 boot equ 0 ; aseg org 0100h lxi sp,stack lxi d,msg1 mvi a,tstr call dos mvi a,rsxmast lxi d,0 call dos ora a; only BYERSX sets flags jz exitx; BYERSX not running, dont hang lxi d,0ffffh mvi a,swrtprt call dos; write protect everything mvi a,sgstate mvi e,0; remove all privilege, disable remote call dos mvi a,rsxmast mvi e,stopmdm call dos; kill the line, if capable mvi e,rstsec mvi a,rsxmast; remove security trap call dos call killchk; check disconnected lxi d,byeln mvi a,setdma call dos mvi a,chain call dos; should never return exitx: lxi d,norsx mvi a,tstr call dos jmp boot ; ; Check that carrier is gone. If not, try to interrupt the ; modem with an escape sequence and repeat. killchk: mvi c,carrier call bdos rz; carrier gone, all well call flush; any input lxi d,1500; pause 1.5 secs, quiet mvi a,dodelay call dos call esc; try to interrupt modem call esc call esc mvi d,200; pause to let it come down mvi a,dodelay call dos jmp killchk; and retest ; ; output escape char to modem esc: mvi e,01h; ; " " ; output char. (e) to modem, wait for ready moutch: mvi a,moutsta call dos jz moutch mvi a,mout ; " " ; DOS call (a), preserving registers ; a,f,h,l dos: push b push d mov c,a call bdos pop d pop b ret ; ; flush any input from modem port flush: mvi a,minsta call dos rz; quiet flush1: mvi a,min call dos; discard mvi a,minsta call dos jnz flush1; clean out for now lxi d,100 mvi a,dodelay; pause 1500 millisec. call dos jmp flush ; msg1: db cr,lf,'Call terminated$' norsx: db cr,lf,'BYERSX not running, can''t chain$' ; ; Ensure the .PCD file is accessed byeln: db 'RUNPCD ANSWER',0; put at end for easy patching ds 64 stack: end