.blkb 110 co: .asciz /Connecting to / spd: .asciz / Speed: /<200> .even .psect concod .enabl lsb doconn::call check ; SJ checks .iif NE, SJ$TEST, clr clkflg ; For testing clr xk ; Clear device type tstb ttname ; Anything there ? bne 1$ ; Yes message ,cr return ; Exit 1$: strcpy #msg ,#co ; Build a header up. strcat #msg ,#ttname ; ... strcat #msg ,#spd ; ...... cmpb ttname ,#'0 ; Is this using XC/XL/CLn? blo 5$ ; No cmpb ttname ,#'9 ; Well? bhi 5$ ; No call domt ; Switch modes then. return ; Exit 5$: inc xk ; Flag device class call init ; Startup bcs 100$ ; Oops call ttinit ; Save terminal characteristics bcs 90$ ; Die ; 10$: tst done ; Time to go now ? bne 90$ ; Yes, exit mov #ttbuff ,r4 ; Pointer to local term buffer inc suspend ; Count the number of suspends .SPND ; Suspend ourself clr idle ; No longer idle tst sj.dec ; Minimal SJ system? beq 25$ ; No mov #sjlist ,r5 ; Yes, No mark time so we will 20$: tst @r5 ; have to call all of the watchers beq 25$ ; If zero, all done jsr pc ,@(r5)+ ; Do it for Sj krud br 20$ ; Check for more calls needed for SJ 25$: mov #tlist ,r5 ; Find out who woke up 30$: cmp taskaddr(r5),#-1 ; End of the table now? beq 50$ ; Yes, suspend again tst state(r5) ; Runnable task ? beq 40$ ; No jsr pc ,@taskaddr(r5) ; Yes, run the sucker. 40$: add #HDSIZE ,r5 ; Next task control block please br 30$ ; ... 50$: br 10$ ; Go away until something happens 90$: .CMKT #cancel,#0 ; Kill all marktime requests call ttrst ; Restore terminal chars 100$: bic #40000+10000+100,@#JSW ; Clear special modes .SCCA #scca,#0 ; Enable control C stuff again .CMKT #cancel,#0 ; Kill all marktime requests return .dsabl lsb .sbttl misc support routines .enabl lsb .mcall .scca $TCFIG = 424 ttinit: clc ; Basically a NO-OP return ; Exit init: tst tsxsave ; True TSX+ today? beq 5$ ; No .SERR ; To be safe mov #tsxbrk ,r0 ; Set break AST EMT 375 ; Do it. .HERR ; Normal now 5$: mov #tlist ,r0 ; Clear out task list 10$: cmp TASKAD(r0),#-1 ; All done with list beq 20$ ; Yes clr STATE(r0) ; No clr IODONE(r0) ; ... clr IOPEND(r0) ; ... clr IOSTALL(r0) ; Stalled flag. add #HDSIZE ,r0 ; Next please br 10$ ; ... 20$: clr eseen ; No escape seen clr idle ; clr done ; ... clr xkr1done ; Clear out clr xkr2done ; Ditto clr xkio ; No remote I/O seen clr ttio ; No local I/O seen clr ioseen ; No I/O at all happened clr ttsdon ; No terminal settings done yet clr xksdon ; No terminal settings done yet clr charcount ; Clear out data count clr charcount+2 ; All 32 bits of it please. mov #1 ,suspend ; Suspension count mov #xkbuff ,xkpoint ; Current pointer into buffer. .SCCA #scca ,#scca+4 ; Trap all control c's calls ttyset ,<#ttname,#LUN.XK> calls ttyini ,<#ttname,#LUN.XK,#0> tst r0 ; Successfull setup of port? beq 25$ ; Yes, continue jmp 90$ ; No, exit ; 25$: .print #msg ; A header message ,cr ; ... message ,cr ; ; All done, prime the system. .MRKT #idmark,#idtime,#iddone,#11 .MRKT #stsmark,#ststime,#stsdone,#7 .MRKT #wtmark,#wttime,#wtdone,#10 .SPFUN #stswork,#XC.CONTROL,#STSDRV,#xksts,#0,#1 clr rt.v51 ; Flag if 5.1 or 5.2 please cmpb xksts+1 ,#$XLV51 ; Is this a 5.1 system? bne 30$ ; No, must be 5.2 or later. inc rt.v51 ; Yes, a serious bug in XL/XC 30$: ; .SPFUN #xkrd1,#LUN.XK,#203,#xkbuff,#xksize,#1,#xkdone .MRKT #ttmark,#ttwait,#ttdone,#3 clc ; Successfull exit br 100$ ; Exit ; 90$: mov r0 ,r1 ; Save error code message direrr r1 sec ; Failure to initialize things 100$: return ; Exit INIT code .dsabl lsb .sbttl Restore line settings, check options for SJ exec ttrst: .TWAIT #twait,#short ; Eat K11RCOMAC[.050032]K11RCO.MAC[.050032]    X14|H [4;Ik(&'( k ߫H&P` \RrPP2PPzPP{PPPPP2P~\$\\TD 0D \~ hi) +\ ^( n ^( np\^txY\^ˀ\!kVk<\F˰<˴ˬ\VVkˤ1`@lP ABCDEFGHIJKLMNOPQRSTUVWXYZ$.?0123456789<@<SЬTЬ UQS>?\\\\\\\\\`:#@'="\abcdefghi\\\\\\\jklmnopqr\\\\\\\~stuvwxyz\\\\\\\\\\\\\\\\\\\\\\{ABCDEFGHI\\\\\\}JKLMNOPQR\\\\\\\\STUVWXYZ\\\\\\0123456789\\\\\  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~@ggh<i|o<m<4p<p<k|Zn<l fr rwx<x<x<x޺<w@]@@fjnr]Ze@@|> | |v<H|  |  |xz|  |zt f r   < &^ @&@'*/V,"?Lh:hmBmz|z{x`y~|fN|@@|@͂|@ ݃ƃ<ns<|Ŏ |️|ep|u|-@率|<ᄇ2ֻr||ZRM | ntB|xyvZw|J=|R>|J? nnaa|bddf ,ioseen ; Say we got some data 210$: tstb (r1) ; All done yet? beq 240$ ; Yes movb (r1)+ ,r0 ; .TTOUTR ; No, dump the data bcs 220$ ; If we fail, come back later add #1 ,charcount ; Bump up the character count adc charcount+2 ; The high part also. inc xkpoint ; Remember where we were at now. br 210$ ; Next please ; 220$: .MRKT #xkmark,#xktime,#xkredo,#13 ; Output ring buffer is FULL. inc IOSTALL(r5) ; Flag we are stalled. clr STATE(r5) ; No longer runable please br 250$ ; Exit ; 240$: mov #xkbuff ,xkpoint ; Reset the pointer now. mov #xkbuff ,r3 ; Disk logging next call dumplog ; clr STATE(r5) ; clr IODONE(r5) ; clr IOSTALL(r5) ; mov sp ,IOPEND(r5) ; ... .SPFUN #xkrd1,#LUN.XK,#203,#xkbuff,#xksize,#1,#xkdone 250$: mov (sp)+ ,r3 ; Pop r3 mov (sp)+ ,r1 ; Pop r1 mov (sp)+ ,r0 ; And R0 please return ; Exit rmproc: mov r0 ,-(sp) ; Save mov r1 ,-(sp) ; ... tst IOPENDING(r5) ; Are we still waiting for XC/XL? bne 100$ ; Yes, ignore this request then. mov IOBUFF(r5),r1 ; Pointer to I/O buffer movb @r1 ,rmbuff ; Copy the data clrb rmbuff+1 ; Tack a NULL on the end. mov sp ,IOPENDING(r5) ; Flag that we are waiting here. .MRKT #rmwork,#rmtime,#300$,#5; Start timer to clear driver. .WRITC #xkwork,#LUN.XK,#rmbuff,#1,#200$,#1 100$: mov (sp)+ ,r1 ; Pop mov (sp)+ ,r0 ; ... clr STATE(r5) ; Don't reschedule please. return ; Simple ; ; XC/XL WRITE completion. 200$: clr RMHEAD+IOPENDING ; I/O no longer pending .CMKT #rmwork,#5 ; Stop the marktime for XOFFED return ; Ast completion is a NO-OP ; ; MARKTIME completion. 300$: call x.ttxon ; Force a driver reset. clr RMHEAD+IOPENDING ; Say we are ready for MORE data return ; Done. .sbttl Status watchers stsdone:mov r0 ,-(sp) ; Save this (?) SCHEDULE #STHEAD ; Schedule the status checker br wtexit ; Exit now wtdone: mov r0 ,-(sp) ; Save this (?) SCHEDULE #WTHEAD ; Schedule the xon/xoff checker wtexit: tst suspend ; Fix the suspended count beq 100$ ; No dec suspend ; Yes, suspend-- .RSUM ; Start scheduler now 100$: mov (sp)+ ,r0 ; Pop R0 and exit return ; Exit the ast now .enabl lsb stproc: save ; Save registers we may need clr STATE(r5) ; No longer runnable mov xksts ,r2 ; Save old status word .SPFUN #stswork,#XC.CONTROL,#STSDRV,#xksts,#0,#1 bcs 100$ ; Failed?? mov xksts ,r1 ; Get the current status bic #^C4 ,r2 ; Leave only the carrier detect bic #^C4 ,r1 ; bits on for the status cmp r1 ,r2 ; Are they the same? beq 100$ ; Yes, then ignore BEEP ; Make a small noise tst r1 ; Not the same, did we loose it? bne 10$ ; No, we must have just gotten it message <%Kermit-11 Carrier lost>,cr br 100$ ; Exit 10$: message <%Kermit-11 Carrier detected>,cr 100$: .MRKT #stsmark,#ststime,#stsdone,#7 ; Reschedule us unsave ; Pop registers and exit return ; Exit .dsabl lsb .sbttl Check for hung driver .enabl lsb wtproc: save ; Save registers please clr STATE(r5) ; No longer runnable mov wtsts ,r2 ; Save old Status flags .SPFUN #stswork,#XC.CONTROL,#STSDRV,#wtsts,#0,#1 bcs 100$ ; It should ALWAYS work. mov wtsts ,r1 ; Get new status bic #^C3 ,r2 ; Leave only XOFF'ed status bic #^C3 ,r1 ; Same for the current status word tst r1 ; See if XOFF'ed at either end beq 100$ ; No, so just reschedule ourself cmp r2 ,r1 ; Same status as last time here? bne 100$ ; No, just exit normally then. mov #tlist ,r0 ; Ok, check for any i/o stalled. 10$: cmp TASKAD(r0),#-1 ; End of list so far ? beq 20$ ; Yes, fix the line up tst IOSTALL(r0) ; No, anybody stalled intentionally? bne 100$ ; Yes, just reschedule ourself add #HDSIZE ,r0 ; No, check next task out br 10$ ; Next please 20$: ; .SPFUN #stswork,#XC.CONTROL,#CLRDRV,#0,#0,#1 100$: .MRKT #wtmark,#wttime,#wtdone,#10 mov charcount,wtcount ; Copy low 16 bits of char count. unsave ?\\\\\\\\\`:#@'="\abcdefghi\\\\\\\jklmnopqr\\\\\\\~stuvwxyz\\\\\\\\\\\\\\\\\\\\\\{ABCDEFGHI\\\\\\}JKLMNOPQR\\\\\\\\STUVWXYZ\\\\\\0123456789\\\\\  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~@ggh<i|o<m<4p<p<k|Zn<l fr rwx<x<x<x޺<w@]@@fjnr]Ze@@|> | |v<H|  |  |xz|  |zt f r   < &^ @&@'*/V,"?Lh:hmBmz|z{x`y~|fN|@@|@͂|@ ݃ƃ<ns<|Ŏ |️|ep|u|-@率|<ᄇ2ֻr||ZRM | ntB|xyvZw|J=|R>|J? nnaa|bddfxit now. .dsabl lsb sxon: tst conflow beq 100$ calls binwri ,<#$xon,#1,#LUN.XK> 100$: return sxoff: tst conflow beq 100$ calls binwri ,<#$xoff,#1,#LUN.XK> 100$: return .sbttl concmd terminal emulation escape commands .enabl lsb concmd::mov r1 ,-(sp) ; Save it movb @r4 ,r1 ; Get the character to check bicb #^C177 ,r1 ; Must drop parity scan r1 ,#200$ ; look for a match here asl r0 ; word offsets jsr pc ,@210$(r0) ; dispatch to the correct routine 100$: mov (sp)+ ,r1 ; Pop R1 and exit return .save .psect rwdata ,rw,d,lcl,rel,con 200$: .byte 'C&137 ,'c!40 ; drop connection ctrl \ C .byte 'I&137 ,'i!40 ; init the line .byte 'Q&137 ,'q!40 ; quit logging but leave file open .byte 'R&137 ,'r!40 ; resume logging if file is open .byte 'X&137 ,'X!40 ; control Q and then thats all .byte 'B&137 ,'b!40 .byte '? ,177 ; help, rub for send break .byte 'H&137 ,'h!40 .byte 0 .even 210$: .word con.$ ; unknown escape command .word con.c ,con.c ; drop connection .word con.i ,con.i ; get modems attention .word con.q ,con.q ; turn console logging off .word con.r ,con.r ; turn it back on please .word con.x ,con.x ; send XON .word con.br ,con.br ; break .word con.hl ,con.br ; print out commands .word con.hl ,con.hl ; help .restore ; Pop code psect context .dsabl lsb ; Turn off current symbol block con.$: movb $bel ,r0 .TTOUTR ; Beep a little clc ; commands. Say it is not fatal. return ; Bye con.c: mov sp ,done ; Exit connection return ; And return con.i: calls ttydtr ,<#ttname> ; try to force DTR up on the line clc ; And say it's NOT fatal return ; Exit con.q: bic #log$co ,trace ; turn off console logging clc ; Successfull return ; Exit con.r: bit #log$op ,trace ; if the file is open do it beq 100$ ; no bis #log$co ,trace ; yes, enable this 100$: clc ; Success return ; Exit .enabl lsb con.x: tst xk ; MT or XC/XL/CL today? beq 30$ ; MT service .SPFUN #200$,#XC.CONTROL,#CLRDRV,#0,#0,#1 mov #tlist ,r0 ; Ok, check for any i/o stalled. 10$: cmp TASKAD(r0),#-1 ; End of list so far ? beq 20$ ; Yes, fix the line up clr IOSTALL(r0) ; Clear task stalled flags add #HDSIZE ,r0 ; No, check next task out br 10$ ; Next please 20$: .WRITC #200$,#LUN.XK,#$xon,#1,#190$,#1 br 100$ ; Exit 30$: calls ttxon ,<#ttname> ; and try to clear our xoffed state 100$: clc ; Success return ; Exit 190$: return ; AST write completion .save .psect rwdata ,d,lcl 200$: .word 0,0,0,0,0,0,0 .restore .dsabl lsb brkast: call con.br mov #tsxbrk ,r0 EMT 375 return con.br: calls senbrk ,<#ttname,#lun.ti> clc return con.hl::.print #hlptxt clc return .save .psect rwdata ,rw,d,lcl,rel,con hlptxt: .ascii /B Try to send a break to the remote/ .ascii /C Connect back to the local Kermit-11/ .ascii /I Drop and raise DTR (for RSTS only)/ .ascii /Q Quit console logging. See SET LOG/ .ascii /R Resume console logging. See SET LOG/ .ascii /X Send XON and cancel any active XONs/ .asciz /RUBOUT Try to fake a break to the remote/ .ascii /? Print this message/ .byte 0 .even .restore .sbttl dump i/o to a log file ? ; Passed: r3 buffer address dumplo: bit #LOG$CO ,trace ; Is this enabled ? beq 100$ ; No bit #LOG$OP ,trace ; Is it open beq 100$ ; No save ; Save work registers strlen r3 ; Get size mov r0 ,r2 ; Copy size beq 90$ ; Nothing to do ? 10$: clrb r0 ; Avoid sign extension bisb (r3)+ ,r0 ; Get the next character mov #LUN.LO ,r1 ; Unit number call putcr0 ; Thats it folks sob r2 ,10$ ; Next please 90$: unsave ; Pop registers and exit 100$: clc ; May as well say it worked return ; Bye .save .psect rwdata $xon: .byte 'Q&37,0 $xoff: .byte 'S&37,0 $bel: .byte 'G&37,0 .even .restore .end K11RCOMAC[.050032]K11RCO.MAC[.050032]d   X14|H [4;Ik(&'( k ߫H&P` \RrPP2PPzPP{PPPPP2P~\$\\TD 0D \~ hi) +\ ^( n ^( np\^txY\^ˀ\!kVk<\F˰<˴ˬ\VVkˤ1`@lP ABCDEFGHIJKLMNOPQRSTUVWXYZ$.?0123456789<@<SЬTЬ UQS>?\\\\\\\\\`:#@'="\abcdefghi\\\\\\\jklmnopqr\\\\\\\~stuvwxyz\\\\\\\\\\\\\\\\\\\\\\{ABCDEFGHI\\\\\\}JKLMNOPQR\\\\\\\\STUVWXYZ\\\\\\0123456789\\\\\  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~@ggh<i|o<m<4p<p<k|Zn<l fr rwx<x<x<x޺<w@]@@fjnr]Ze@@|> | |v<H|  |  |xz|  |zt f r   < &^ @&@'*/V,"?Lh:hmBmz|z{x`y~|fN|@@|@͂|@ ݃ƃ<ns<|Ŏ |️|ep|u|-@率|<ᄇ2ֻr||ZRM | ntB|xyvZw|J=|R>|J? nnaa|bddf