10 'RING.BAS   2/20/84  (See also info at LINE 300)
20 'This program (along with a BATCH file) to look for an incoming
30 'call on a HAYES and then switch system control to the COM1:
40 'port. By calling the batch file "OUTSIDER" the system
50 'can return to looking for another outside call. Control can
60 'be returned to the keyboard by BREAKing this program, returning to
70 'the SYSTEM and pressing CTRL-BREAK (real quick)!
80 '
90 'This program is freely given to the public domain.
100 'Developed by Dan Derrick under a grant from Direct Access
110 '
120 ON ERROR GOTO 800
130 CLS
140   PRINT"Your computer will be ready to receive external control in"
141 FOR X=9 TO 1 STEP -1
143   LOCATE 2,1
150   PRINT X;"seconds."
152   FOR Y=1 TO 1000:NEXT Y
155 NEXT X
170 CLS
180 OPEN "COM1:300,E,7,1" AS #1
190     PRINT#1,"AT S0=1"            'sets up for auto answer mode
200       INPUT#1,A$                 'looks for local "RING" response
210       IF A$<>"RING" THEN 200
220   FOR P=1 TO 3000:NEXT P         'pause to wait for carrier tone
230       PRINT#1,"You have the system"
240       PRINT#1,"All commands are now at the DOS level."
250       PRINT#1,"Type OUTSIDER to return the SYSTEM"
260       PRINT#1,"to waiting for an incoming RING."
270   CLS:SYSTEM
280 CLOSE:GOTO 180
290 '
300 'This program is part of a BATCH file.
310 'It must be called from the BATCH file to work:
320 'Type  RUN 500  to create this BATCH file
330 '
500 ON ERROR GOTO 800
505 OPEN "I",#2,"outsider.bat":CLOSE:PRINT "File exists":GOTO 570
506 OPEN "o",#2,"outsider.bat"
510 PRINT#2,"REM PRESS KEY, THEN HANG UP"
520 PRINT#2,"PAUSE"
530 PRINT#2,"CTTY CON"
540 PRINT#2,"BASICA RING"
550 PRINT#2,"CTTY COM1"
560 CLOSE#2
570 PRINT"Now go back to the SYSTEM level and type OUTSIDER"
580 PRINT "Press any key to do this or CTRL-BREAK to stop"
590 A$=INKEY$:IF A$="" THEN 590
600 SYSTEM
800 IF ERR=57 THEN 280
810 IF ERR=53 THEN 506
820 PRINT "FATAL ERROR....SORRY"
999 END
1000 '********* PHYSICAL END EOF *********
