.title remote .ident /v1.0/ .enabl debug ; ;REMOTE - remote port access utility ; designed to operate with a VENTEL 212+ modem ; ;author: Jim Sturtevant ;version: 1.0, December 1981 ; ;Copyright (C) 1981 ;Ross Systems, Inc. ;Palo Alto, California ; ;This software is furnished under a rule provided by DECUS ;and may be copied only with the inclusion of the above ;copyright notice. This software, or any other copies thereof, may not ;be provided or otherwise made available to any other person except ;for use on such system and to one who agrees to these DECUS rules. ;Title to and ownership of the software shall at all times remain in ;Ross Systems. ; ;The information in this document is subject to change without notice ;and should not be construed as a commitment by Ross Systems, Inc. ; ;Ross Systems makes no warranties either express or implied as to the ;use of this system. In no event, shall RSI be liable for any direct, ;indirect, special or consequential damages, of any nature or kind ;whatsoever, including but not limited to personal injury, property ;damage, loss of profits or other economic loss in connection ;with, or arising out of the licensee's use of this product. ; ; macros ; .macro errorck,?l1 blbs r0,l1 pushl r0 calls #1,lib$stop l1: .endm .macro write,arg1,arg2 $qiow_s chan=inpchn,- func=#io$_writevblk,- p1=arg1,- p2=arg2 .endm .macro readln $qiow_s chan=inpchn,- func=#io$_readvblk!io$m_cvtlow,- iosb=i_iosb,- p1=inpbuf,- p2=#80 .endm inpchn: .blkw 0 inpdes: .ascid /SYS$INPUT/ inpdev: .long 63 .address inpnam inpnam: .blkb 63 inpbuf: .blkb 80 inplen = .-inpbuf inpcnt: .long 0 i_iosb: .blkw 4 i_ptr: .address inpbuf i_plen: .long 0 ; ; remote port i/o space ; remchn: .long 0 remdes: .long 7 ;create logical name for .address 10$ ;remote port 10$: .ascii /REMOTE/ remidx: .ascii /0/ remdevl = 63 remdev: .long remdevl .address remnam remnam: .blkb remdevl rembuf: .blkb 80 remlen = .-rembuf remcnt: .long 0 r_iosb: .blkw 4 r_ptr: .address rembuf r_plen: .long 0 esc = ^x1b cr = ^x0d lf = ^x0a bell = 7 zero = ^a/0/ ctl_d = ^x04 ctl_e = ^x05 ctl_f = ^x06 ctl_k = ^x0b trigger:.byte ctl_f ; ; define record types for log file ; c_one: .long 1 ;log message = connect c_two: .long 2 ;log message = all lines busy c_three:.long 3 ;log message = exit requested c_four: .long 4 ;log message = abnormal exit c_five: .long 5 ;log message = timeout startbuf: .byte cr,cr sclock: .ascid /0 00:00:00.4/ swait: .blkq 1 tclock: .ascid /0 00:05:00.0/ ;initial timeout period twait: .blkq 1 dbgf1: .ascid /msg1 word=!UW/ faodesc: .word 80 .word 0 .long faobuf faobuf: .blkb 80 faolen: .word 0 .word 0 ctrlcbuf:.byte 3 ; ; log file record save area ; flag: .long 0 savsiz: .long 0 savbeg: .address savbuf savptr: .long savbuf savdsc: .long 256 .long savbuf savbuf: .blkb 256 ; ; indirect input file dirty area ; indclock:.ascid /0 00:00:01/ indwait: .blkq 1 inderr: .long 0 indlen: .long 0 inddesc: .long 80 .long indbuf indbuf: .blkb 80 ; ; bit flags ; rem_v_log = 0 ;logfile active rem_m_log = 1 rem_v_ind = 1 ;alternate input file rem_m_ind = 2 ;active rem_v_chr = 2 ;charcter delay active rem_m_chr = 4 rem_v_exit = 3 ;exiting normal rem_m_exit = 8 rem_v_time = 4 ;timeout warning given rem_m_time = 16 rem_v_tdbl = 5 ;disable timeout rem_m_tdbl = 32 ; ; static qio packet ; wio: $qio func=io$_writevblk,- efn=1,- p4=32 remwio: $qio func=io$_writevblk,- efn=2 ; ; device assigned messages ; udesc: .long 12 .address unam unam: .blkb 12 ulen: .long 0 upid: .long 0 ustr: .ascid \Modem !AS in use by !AD (!XL) at !%T!/\ ustr1: .ascid \Error, no logical translation for !AS!/\ ustr2: .ascid \Connection established on !AS at !%D!/!/\ ustr3: .ascid \All modems are busy, try again later...!/\ ustr4: .ascii \Remote:timeout.\ ustr4l: .long .-ustr4 ustr5: .ascii \Remote (warning):timeout.\ ustr5l: .long .-ustr5 ; ; statistics ; t_on: .blkq 1 t_off: .blkq 1 t_delta:.blkq 1 ; ; exit handler ; exitblock: .long 0 .address goodbye .long 1 .address byests byests: .blkl 1 ; ; entry point ; .entry remote,^m<> bsbw init ;assign devices, etc.. $fao_s ctrstr=ustr2,- ;display initialization message outlen=faolen,- outbuf=faodesc,- p1=#remdev $qiow_s chan=inpchn,- func=#io$_writevblk,- p1=faobuf,- p2=faolen bsbw rio bsbw remrio bsbw start ; $hiber_s 10$: $waitfr_s efn=#5 ;this should only occur when timer ;expires while processing alternate ;input bsbw indast brb 10$ $exit_s ; ; read i/o to local port or alternate input file ; rio: $qio_s chan=inpchn,- func=#io$_ttyreadall!io$m_noecho!io$m_trmnoecho,- iosb=i_iosb,- astadr=rast,- p1=inpbuf,- p2=#1 errorck rsb ; ; post i/o to remote port ; remrio: $qio_s chan=remchn,- func=#io$_readvblk!io$m_noecho,- iosb=r_iosb,- astadr=remrast,- p1=rembuf,- p2=#1 errorck rsb rast: .word ^m incl inpcnt ;take note of activity cmpb inpbuf,trigger ;check for trigger bneq 10$ calls #0,usrcmd ;prompt for command brw 20$ 10$: $qiow_s chan=remchn,- func=#io$_writevblk,- p1=inpbuf,- p2=#1 errorck 20$: bbc #rem_v_ind,flag,30$ ;processing indirect file? $setimr_s daytim=indwait,- ;then call room service for efn=#5 errorck brw 40$ 30$: bsbw rio ;de jenaro? 40$: ret ; ; subroutine: read a line from secondary input file and write ; out to remote port ; indast: pushal inderr pushal indlen pushal inddesc calls #3,basind tstl inderr ;error reading indirect? beql 5$ ;no error bsbw rio ;reque i/o from terminal bicl2 #rem_m_ind,flag ;clear indirect state calls #0,basclox ;close the indirect file $clref_s efn=#5 ;clear out any garbage brw 20$ 5$: bbs #rem_v_chr,flag,9$ ;we're doing character delay $qiow_s chan=remchn,- ;nope, we're doing line delay func=#io$_writevblk,- p1=indbuf,- p2=indlen brw 15$ ;go wait for line delay 9$: movl indlen,r2 ;character at a time moval indbuf,r3 ;with delay 10$: $qiow_s chan=remchn,- ;write out one byte func=#io$_writevblk,- p1=(r3),- p2=#1 errorck ;ok? incl r3 ;move buffer pointer bsbw wait1 ;do the wait sobgtr r2,10$ ;check character count 15$: $setimr_s daytim=indwait,- ;then call room service for efn=#5 errorck 20$: rsb remrast:.word ^m incl remcnt $qiow_s chan=inpchn,- func=#io$_writevblk,- p1=rembuf,- p2=#1 errorck bbc #rem_v_log,flag,10$ ;log file active? cmpb rembuf,#cr ;end of record? bneq 5$ subl3 savbeg,savptr,savsiz pushal savsiz pushal savdsc calls #2,basrec movl savbeg,savptr brw 10$ 5$: movb rembuf,@savptr incl savptr 10$: bsbw remrio ret ; ; initialization section ; init: $trnlog_s lognam=inpdes,- ;translate for console terminal rsllen=inpdev,- rslbuf=inpdev errorck cmpb inpnam,#esc bneq 10$ subw #4,inpdev ;reduce size addw #4,inpdev+4 ;increment descriptor pointer 10$: $assign_s devnam=inpdev,- chan=inpchn errorck movzwl inpchn,wio+8 $qiow_s chan=inpchn,- ;read current value func=#io$_sensemode,- p1=ttchar errorck bicl2 #tt$m_halfdup,ttchar+4 ;force full duplex $qiow_s chan=inpchn,- ;set current value func=#io$_setmode,- p1=ttchar errorck 15$: movl #remdevl,remdev ;restore descriptor length $trnlog_s lognam=remdes,- ;translate for remote rsllen=remdev,- rslbuf=remdev errorck cmpb remnam,#esc bneq 20$ subw #4,remdev ;reduce size addw #4,remdev+4 ;increment descriptor pointer 20$: $assign_s devnam=remdev,- ;try and pickup the remote port chan=remchn cmpl r0,#ss$_devalloc ;it's busy, tell 'em by who beqlu 25$ brw 30$ ;otherwise continue checking 25$: pushal ulen pushal unam pushal upid pushaq remdev calls #4,getdev $fao_s ctrstr=ustr,- outlen=faolen,- outbuf=faodesc,- p1=#remdev,- p2=ulen,- p3=#unam,- p4=upid,- p5=#0 errorck ;take standard error $qiow_s chan=inpchn,- func=#io$_writevblk,- p1=faobuf,- p2=faolen errorck ;take standard error incb remidx ;change the logical name and brw 15$ ;try again 30$: cmpl r0,#ss$_nosuchdev ;did someone goof and not set beql 31$ ;up logical names?? brw 40$ ;nope, some other error 31$: cmpb #zero,remidx ;is this the first logical? bneq 35$ ;no, then all are busy $fao_s ctrstr=ustr1,- outlen=faolen,- outbuf=faodesc,- p1=#remdev $qiow_s chan=inpchn,- func=#io$_writevblk,- p1=faobuf,- p2=faolen $exit_s 35$: pushal ulen ;all busy pushal unam pushal upid calls #3,getusr pushal ulen pushaq udesc pushal upid pushal remdev pushal c_two calls #5,logrec ;log a record $fao_s ctrstr=ustr3,- outlen=faolen,- outbuf=faodesc $qiow_s chan=inpchn,- func=#io$_writevblk,- p1=faobuf,- p2=faolen $exit_s 40$: errorck pushal ulen pushal unam pushal upid pushaq remdev calls #4,getdev pushal ulen pushaq udesc pushal upid pushal remdev pushal c_one calls #5,logrec movzwl inpchn,remwio+8 $bintim_s timbuf=indclock,- ;save wait time for indirect timadr=indwait ;input file processing errorck $bintim_s timbuf=sclock,- ;save wait time for start up timadr=swait errorck $bintim_s timbuf=tclock,- ;determine timeout period timadr=twait errorck $setimr_s daytim=twait,- ;then call room service for astadr=timeout ;a wake up call $gettim_s timadr=t_on $dclexh_s desblk=exitblock ;if anything fails we should errorck ;know $clref_s efn=#5 ;clear out any garbage rsb start: $qiow_s chan=remchn,- func=#io$_writevblk,- p1=startbuf,- p2=#1 errorck bsbw wait $qiow_s chan=remchn,- func=#io$_writevblk,- p1=startbuf,- p2=#1 errorck rsb wait: $setimr_s efn=#4,daytim=swait errorck $waitfr_s efn=#4 errorck rsb wait1: $setimr_s efn=#4,daytim=indwait errorck $waitfr_s efn=#4 errorck rsb ; ; exit handler routine ; goodbye:.word ^m<> bbs #rem_v_exit,flag,10$ ;if we're exiting via EXIT cmd ;else we had a problem $cancel_s chan=inpchn ;cancel all i/o to device bsbw hangup ;make sure if we go away the ;modem get's disconnected pushal ulen pushal unam pushal upid calls #3,getusr pushal ulen pushaq udesc pushal upid pushal remdev pushal c_four calls #5,logrec ;log a record 10$: ret ; ; timeout - every timer complete we check character count, if ; no i/o then we terminate the user ; timeout:.word ^m bbc #rem_v_tdbl,flag,5$ ;are we checking? brw texit ;nope 5$: tstl inpcnt ;any activity from user? bneq active ;yep tstl remcnt ;any activity from remote? bneq active ;yep bbc #rem_v_time,flag,10$ ;been here before? write ustr4,ustr4l ;yep brw trec 10$: bisl2 #rem_m_time,flag ;nope, then set flag write ustr5,ustr5l ;give warning brw texit ;goback active: clrl inpcnt ;there was activity clrl remcnt ;clear counters bicl2 #rem_m_time,flag ;and warning flag texit: $setimr_s daytim=twait,- ;then call room service for astadr=timeout ;a wake up call ret ;and split.. trec: pushal ulen pushal unam pushal upid calls #3,getusr pushal ulen pushaq udesc pushal upid pushal remdev pushal c_five calls #5,logrec ;log a record $exit_s ; ; REMOTE command parser (here's the smarts) ; first: .long 1 ;descriptor pointing to first .address inpbuf ;character in input buffer valid: .ascid /DEHILSTCR/ ;define valid commands cmddes: .long 0 .address inpbuf cstr1: .ascid \Unknown command "!AS", type H for help !/\ pstr1: .ascii /Enter REMOTE function (H for help or / .ascii / when done): / pstr1l: .long .-pstr1 cstr2: .ascii .ascii /REMOTE V1.0 Utility instructions/ .ascii .ascii /Commands:/ .ascii / Clock - specify delay between each line in INPUT/ .ascii / mode/ .ascii / Disconnect - hangup modem and stay in REMOTE/ .ascii / Exit - hangup modem and end program/ .ascii / Input - read alternate input file/ .ascii / Log - place a copy of output in file/ .ascii / Reset - toggle timeout flag/ .ascii / Speed - change speed of remote line (300 or / .ascii /1200)/ .ascii / Trigger - replace trigger character/ .ascii cstr2l: .long .-cstr2 cstr3: .ascii /Enter new trigger character: / cstr3l: .long .-cstr3 cstr4: .ascii /Error: trigger character must be one byte only./ cstr4l: .long .-cstr4 cstr5: .ascii /Enter remote port speed (300 or 1200): / cstr5l: .long .-cstr5 cstr6: .ascii /Error: speed may only be 300 or 1200 baud./ cstr6l: .long .-cstr6 cstr7: .ascii .ascii /The modem is currently connected to another system, / .ascii /to change the speed it must be hung up./ .ascii /Do you wish to continue (Yes or No): / cstr7l: .long .-cstr7 cstr8: .ascid /Enter delta delay time to remote <0 !%T>: / cstr9: .ascii /Error: Invalid delta time./ cstr9l: .long .-cstr9 cstr10: .ascid \!/!/Remote exiting, connect time !%T.!/\ cstr11: .ascii /Delay between line or character (l or c): / cstr11l:.long .-cstr11 cstr12: .ascid \A per line delay of !%T is set.!/\ cstr13: .ascid \A per character delay of !%T is set.!/\ cstr14: .ascii \Disable or enable timeout check (D or E): \ cstr14l:.long .-cstr14 c_1200: .ascid /1200/ c_300: .ascid /300/ baud: .long 0 ttchar: .blkq 1 ; ; subroutine ; .entry usrcmd,^M usrtry: write pstr1,pstr1l ;write prompt readln ;linput errorck ;error? tstw i_iosb+2 ;null line input? bneq 5$ ;nope, continue checking brw c_exit ;yep, split... 5$: pushaq valid ;check for a valid command pushaq first ;in the first character calls #2,lib$locc tstl r0 ;zero, means unknown command bneq 10$ ;nope, it's valid, go do it $fao_s ctrstr=cstr1,- ;display help message outlen=faolen,- outbuf=faodesc,- p1=#first errorck write faobuf,faolen brw usrtry ;try again 10$: casel r0,#1,valid ;process command 20$: .word c_disc-20$ .word c_end-20$ .word c_help-20$ .word c_input-20$ .word c_log-20$ .word c_speed-20$ .word c_trigger-20$ .word c_clock-20$ .word c_reset-20$ c_disc: bsbw hangup ;hangup line bsbw wait1 ;wait for modem to return bsbw wait1 ;to idle state bsbw start ;then output attention brw c_exit c_end: bsbw hangup pushal ulen ;gether information for stats pushal unam pushal upid pushaq remdev calls #4,getdev pushal ulen ;write stat message out pushaq udesc pushal upid pushal remdev pushal c_three calls #5,logrec $gettim_s timadr=t_off ;find out how long we've been pushal t_delta ;playing this game pushal t_on pushal t_off calls #3,subquad $fao_s ctrstr=cstr10,- ;display exit message outlen=faolen,- outbuf=faodesc,- p1=#t_delta errorck write faobuf,faolen bisl2 #rem_m_exit,flag ;state we're exiting normally ;for handler.... $exit_s ;to-da-loo c_help: write cstr2,cstr2l brw usrtry ;help command c_input:calls #0,basinix ;secondary input file bbs #rem_v_chr,flag,10$ $fao_s ctrstr=cstr12,- ;display switch setting outlen=faolen,- outbuf=faodesc,- p1=#indwait errorck brw 20$ 10$: $fao_s ctrstr=cstr13,- ;display other switch set outlen=faolen,- outbuf=faodesc,- p1=#indwait errorck 20$: write faobuf,faolen ;write it bisl2 #rem_m_ind,flag ;set indirect input flag brw c_exit c_log: bbsc #rem_v_log,flag,10$ ;logfile command calls #0,basini bisl2 #rem_m_log,flag brw c_exit 10$: calls #0,basclo brw c_exit c_speed:write cstr5,cstr5l ;change speed readln ;prompt for new speed movzwl i_iosb+2,cmddes ;set up descriptor of input pushaq cmddes pushaq c_300 calls #2,str$compare ;compare to 300? tstl r0 bneq 10$ ;nope, try next speed movl #tt$c_baud_300,baud ;yep, save that fact brw 30$ ;go change the speed 10$: pushaq cmddes ;compare 1200? pushaq c_1200 calls #2,str$compare tstl r0 bneq 20$ ;nope, report error movl #tt$c_baud_1200,baud ;yep, save the fact brw 30$ 20$: write cstr6,cstr6l ;write error msg brw c_exit 30$: $cancel_s chan=remchn ;change characteristics $qiow_s chan=remchn,- ;read current value func=#io$_sensemode,- p1=ttchar errorck bbs #tt$v_remote,ttchar+4,40$ ;check if we're now connected 33$: bsbw hangup $qiow_s chan=remchn,- ;write new value func=#io$_setmode,- p1=ttchar,- p3=baud errorck bsbw remrio ;requeue i/o bsbw wait1 bsbw wait1 bsbw start 35$: brw c_exit 40$: write cstr7,cstr7l ;handle a change of speed to a readln ;remote line (bad idea anyway) cmpb #^A/Y/,inpbuf bnequ 50$ ;don't continue brw 33$ 50$: cmpb #^A/N/,inpbuf ;no? beqlu 60$ ;no, then just skip it brw 40$ ;not "no" then ask again 60$: brw 35$ c_trigger: write cstr3,cstr3l readln cmpw #1,i_iosb bneq 10$ movb inpbuf,trigger brw c_exit 10$: write cstr4,cstr4l brw c_exit c_clock:$fao_s ctrstr=cstr8,- ;display help message outlen=faolen,- outbuf=faodesc,- p1=#indwait errorck write faobuf,faolen readln tstw i_iosb+2 ;null line input? bneq 5$ ;nope, keep going brw c_exit 5$: movzwl i_iosb+2,cmddes ;set up descriptor of input $bintim_s timbuf=cmddes,- ;save wait time for indirect timadr=indwait ;input file processing blbc r0,10$ ;error with bintim? 7$: write cstr11,cstr11l readln cmpb #^A/L/,inpbuf bnequ 8$ ;check next answer bicl #rem_m_chr,flag ;yep, it's an L brw usrtry 8$: cmpb #^A/C/,inpbuf ;"C"? beqlu 9$ ;yes, then just skip it brw 7$ ;not "C" then ask again 9$: bisl #rem_m_chr,flag ;yep, it's an C brw usrtry 10$: write cstr9,cstr9l $bintim_s timbuf=indclock,- ;save wait time for indirect timadr=indwait ;input file processing brw usrtry c_reset: write cstr14,cstr14l ;ask to readln ;disable timeout? cmpb #^A/D/,inpbuf bnequ 50$ ;don't continue bisl2 #rem_m_tdbl,flag brw c_exit 50$: cmpb #^A/E/,inpbuf ;no? beqlu 60$ ;no, then just skip it brw c_reset ;not "no" then ask again 60$: bicl2 #rem_m_tdbl,flag brw c_exit c_exit: ret hangup: $cancel_s chan=remchn ;cancel all i/o to device errorck ;ok? $qiow_s chan=remchn,- ;drop DTR on remote port func=#io$_setmode!io$m_hangup errorck ;ok? rsb ;go back .end remote