;-- DK:DIALUP.MAC DATE: 3-MAY-86 TIME: 13:10 .REPT 0 Maarten van Swaay maarten@ksuvax1.BITNET Dept. of Computer Science Nichols Hall Kansas State University Manhattan, Kansas 66506 DIALUP is a front end for terminal emulators that handle communication with a remote host over dialup lines. It runs under RT11V4. For design details see DIALUP.TXT. DIALUP should not require modification of existing emulators: it is designed to be invoked from a command file that will subsequently start the appropriate emulator. DIALUP returns exception reports to monitor level by discarding or replacing the command file that called DIALUP. Therefore DIALUP need not be aware of the emulator for which it is establishing a connection. Furthermore it allows the user to control the consequences of DIALUP exceptions by means of command files, without any need to modify either DIALUP or emulators. This version (1.5) takes one of three exit paths: Failure to acquire or control specified LUN: discard command file Failure to establish link to remote host: replace command file with SY:DIALUP.ABT Successful connection to remote host: continue command file .ENDR ; MULTITERMINAL SUPPORT IS REQUIRED ; TIME-OUT SUPPORT IS REQUIRED VERS = '1 REV = '5 .GLOBL KMNCMD ; to patch abort filename .ENABL LC .IIF NDF LUNREM LUNREM = 2 ; remote (modem) LUN .IIF NDF TIMOUT TIMOUT = 30 ; default wait time for response .IIF NDF CSEP CSEP = '^ ; command/response separator CHAIN = 004000 ; chain bit in JSW CHBIT = 010000 ; char. mode AST.IN = 040000 ; set if input available KMNBUF = 510 ; chain command area starts at 510 octal ERRBYT = 52 JSW = 44 CBEL = 7 CCR = 15 CLF = 12 .MCALL .MTATCH,.MTGET,.MTSET,.MTIN,.MTOUT,.MTPRNT .MCALL .TTYIN,.TTINR,.TTYOUT,.PRINT .MCALL .GTLIN,.MRKT,.CMKT,.TWAIT,.EXIT ;****************************** ; START OF CODE, ENTRY POINT ;****************************** ;****************************** ; claim a terminal port, quit on failure ;****************************** DIALUP: .PRINT #WELCOM .MTATCH #ATTEMT ; grab modem port BCC 1$ MOV #101$,R0 JMP QUIT 1$: .MTGET #SETEMT BCC 2$ MOV #102$,R0 JMP QUIT 2$: BIS #CHBIT,MTSTS ; char mode .MTSET #SETEMT BCC DOIT MOV #103$,R0 JMP QUIT 101$: .ASCIZ /?DIALUP-F-cannot attach modem port/ 102$: .ASCIZ /?DIALUP-F-cannot get modem port configuration/ 103$: .ASCIZ /?DIALUP-F-cannot set up modem port/ .EVEN ;****************************** ; read and process command lines ;****************************** DOIT: CLRB CMDBUF .GTLIN #CMDBUF TSTB CMDBUF BEQ DOIT ; ignore null lines CMPB CMDBUF,#CSEP ; separator on left margin means reset modem BNE NONULL ; not a null line CALL BREAK ; separator on left: reset modem to cmd mode BR DOIT NONULL: CALL CUT ; break line into cmd + response BCC CMDOK ; command looks OK .PRINT #NOSEP ; ignore lines without a separator BR DOIT CMDOK: BIT #AST.IN,REMAST BEQ 1$ .MTIN #INEMT ; drain old modem chars BR CMDOK 1$: .MTPRNT #OUTEMT CLRB EXPIRE .MRKT #MRKEMT ; limited patience for response 2$: BIT #AST.IN,REMAST BNE REPLY ; response arrived TSTB EXPIRE BEQ 2$ ; wait some more MOV #NOCHAR,R0 JMP ABORT REPLY: .CMKT #CMKT ; cancel outstanding mark-time request .MTIN #INEMT MOVB REMCH,R0 MOVB R0,RSPONS .TTYOUT ECHO: BIT #AST.IN,REMAST ; this yields a

. Why?? BEQ 1$ .MTIN #INEMT MOVB REMCH,R0 .TTYOUT BR ECHO 1$: .PRINT #CRLF CMPB RSPONS,EXPECT BEQ DOIT ; next line of input MOV #UNEXP,R0 ABORT: CALL BREAK ; reset modem on any hard error MOV #DERAIL,R1 MOV #KMNBUF,R0 MOV #DIALUP,SP 1$: MOVB (R1)+,(R0)+ CMP R1,#KMNEND BLO 1$ JMP EXIT QUIT: .PRINT ; local problems .PRINT #QUITMS MOV #1,@#KMNBUF CLRB @#KMNBUF+2 EXIT: CLR R0 BIS #CHAIN,@#JSW .EXIT DERAIL: .WORD KMNEND-KMNCMD KMNCMD: .ASCIZ /@SY:DIALUP.ABT/ ; catch abort in a command file KMNEND: QUITMS: .ASCIZ / Command file, if any, aborted/ .EVEN ;****************************** ; BREAK: modem reset sequence: wait, then +++, wait some more ;****************************** BREAK: .TWAIT #WTEMT MOV #PLUS,OUTSTR .MTPRNT #OUTEMT MOV #CMDBUF,OUTSTR .TWAIT #WTEMT .PRINT #RESET RETURN WTEMT: .WORD 24*400,TWOSEC TWOSEC: .WORD 0,2*60. ; 2 seconds RESET: .ASCIZ /?DIALUP-I-modem reset to command mode/ PLUS: .ASCII /+++/<200> .EVEN ;****************************** ; CUT: replaces separator by null, copies next char to EXPECT ; if no separator found, C=1 on exit ;****************************** CUT: MOV #CMDBUF,R0 1$: TSTB @R0 BEQ 98$ ; error exit, no ^ found CMPB (R0)+,#CSEP BNE 1$ MOVB @R0,EXPECT CLRB -(R0) ; also clears C BR CUTX 98$: SEC CUTX: RETURN ;****************************** ; TIMUP: mark-time completion routine sets EXPIRE ;****************************** TIMUP: BISB #1,EXPIRE RETURN ATTEMT: .WORD 37*400+5,REMAST,LUNREM ; for .MTATCH SETEMT: .WORD 37*400+1,MTSTS,LUNREM ; for .MTGET, .MTSET INEMT: .WORD 37*400+2,REMCH,1*400+LUNREM OUTEMT: .WORD 37*400+7,CMDBUF,LUNREM ; word 2 changed at runtime OUTSTR = OUTEMT+2 MRKEMT: .WORD 22*400,TIME,TIMUP,1 TIME: .WORD 0,60*TIMOUT ; limit of dial-up patience CMKT: .WORD 23*400,0,0 ; cancel mark-time requests MTSTS: .BLKW 2 ; port status block REMAST: .BLKW 1 ; AST word CRLF: .BYTE 0 ; newline via .PRINT WELCOM: .ASCIZ /DIALUP VERSION //./ NOCHAR: .ASCIZ /?DIALUP-F-no response from modem/ UNEXP: .ASCIZ /?DIALUP-F-unexpected response from modem/ NOSEP: .ASCIZ /?DIALUP-W-no // in line, input ignored/ CMDBUF: .BLKB 81. ; command text buffer EXPECT: .BLKB 1 ; expected response char (from input line) EXPIRE: .BLKB 1 ; expired patience flag REMCH: .BLKB 1 ; modem response char RSPONS: .BLKB 1 ; expected response char .END DIALUP