/44/ NOLFOUT and NOFORM0 xlset3: .word 10 ; /45/ Put LFOUT back in ; The following tables are used for: ; ; (1) On TSX+, map decimal speeds into .SPFUN speeds for setting ; speed on DH/DHV/DHU and DZ/DZV interfaces. ; (2) At some future time when either TSX+ or RT supports it get ; the interface speed from the exec and insert a .TWAIT in ; front of the .SPFUN read call to reduce cpu usage at lower ; line speeds. For now, default to one tick unless a SET SPE ; command was given on TSX+. .word 0 splst: .word 75. ,110. ,134. ,150. ,300. ,600. ; /44/ .word 1200. ,1800. ,2000. ,2400. ,3600. ,4800. ; /44/ .word 7200. ,9600. ,19200. ,0 ; /44/ spmap: .word 1 ,2 ,3 ,4 ,5 ,6 ; /44/ .word 7 ,10 ,11 ,12 ,13 ,14 ; /44/ .word 15 ,16 ,17 ; /44/ ; waitti: .byte 1 ; /52/ .byte 6 ,6 ,6 ,6 ,6 ,4 ; /52/ .byte 3 ,2 ,2 ,2 ,2 ,1 ; /52/ .byte 1 ,1 ,0 ,0 ,0 ,0 ; /52/ .even ; /52/ waitarg:.word 0,0 ; /52/ xkspeed:.word 0 ; /52/ .psect $CODE ERRBYT = 52 JSW = 44 ; .SPFUN codes for the XC/XL driver CLRDRV == 201 ; undo xon, reset the driver BRKDRV == 202 ; wc=0, end break else break SRDDRV == 203 ; special read, wc is max # of bytes ; to read, always returns at least one ; byte, up to max if data is there. STSDRV == 204 ; driver status, high byte is driver ; version, low byte is: ; bit 0 = 1 if sent xoff to host ; bit 1 = 1 if rec xoff from host ; bit 2 = 1 if CTS is ok OFFDRV = 205 ; disable interupts at program exit DTRDRV = 206 ; rt 5.2, set/clear DTR. If WC <> 0 ; then turn it on else turn it off. CLSET = 250 ; Set cl options for TSX-Plus CLRSET = 251 ; Reset cl option for TSX-Plus CLSPEED = 256 ; /44/ Speed control CLCLR = 257 ; /37/ Reset w/o dropping DTR XC.CONTROL == 14 ; channel for controlling the driver XC.AUX = 15 ; /41/ Ditto .iif ndf, XON , XON = 'Q&37 .iif ndf, XOFF , XOFF= 'S&37 .sbttl assign and init the XC/XL port .enabl lsb .mcall .SERR ,.HERR ; /51/ x.ttysav:: x.ttyrst:: x.deadev:: mov r1 ,-(sp) ; /45/ br 10$ ; /45/ x.assdev:: mov r1 ,-(sp) ; /44/ Save a register please mov @r5 ,r1 ; /44/ Address of the devname call mapxl ; /44/ Do we know about this dev? bcs 110$ ; /44/ No, return error in R0 10$: .SERR ; /51/ tst tsxcl ; Under tsx and using cl line? beq 100$ ; Nope mov #hieff,r0 ; Get emt parameter block emt 375 ; Turn off hi efficiency .PRINT #m.tsxr ; Reset some terminal parameters 100$: .HERR ; /51/ clr r0 ; Success 110$: mov (sp)+ ,r1 ; /44/ Restore return ; not needed for PRO/RT .dsabl lsb ; T T Y I N I ; ; input: @r5 device name ; 2(r5) LUN ; 4(r5) modifiers ; ; output: r0 error code x.TTYINi:: save ; /37/ always save temps please mov @r5 ,r1 ; get the device name address mov 2(r5) ,r0 ; copy the device name please asl r0 ; lun times two please movb (r1) ,devnam(r0) ; save it please movb 1(r1) ,devnam+1(r0) ; both ascii characters please clr r0 ; assume success tstb @r1 ; perhaps the console ? beq 100$ ; yes, don't do anything cmpb @r1 ,#'T&137 ; TT: ? beq 100$ ; do nothing then 1$: clr xoffed ; reset 'sent an XOFF' flag mov #xcrdbf ,xcpoint ; a pointer into the XC: buffer mov #xcrdbf ,r2 ; xc device, zero the buffer mov #xcrdsi+2,r0 ; the size of the buffer 5$: clrb (r2)+ ; clear it out sob r0 ,5$ ; next please call mapxl ; /44/ See if XL/XC or CLn passed bcs 95$ ; /44/ No, exit with ER$UKN mov r0 ,r2 ; /44/ Point to RAD50 device name 10$: calls fetch ,<@r2> ; get the device loaded ? tst r0 ; did it work ? bne 95$ ; no 20$: clr xcdone ; nothing pending to read from XC: mov r2 ,r3 ; /37/ get pointer to rad50 of dev mov #r50dev ,r4 ; /37/ where to save r50 of name mov (r3)+ ,(r4)+ ; /37/ copy rad50 of device name mov (r3)+ ,(r4)+ ; /37/ copy rad50 of device name mov (r3)+ ,(r4)+ ; /37/ copy rad50 of devK11PRTMAC[.050032]K11PRT.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|bddf50 / / .sbttl close the line up .enabl lsb x.ttyfin:: save ; /37/ save temps please .TWAIT #rtwork,#third ; /37/ insure ack for B packet done tst tsxcl ; /45/ Tsx+ and CLn? beq 1$ ; /45/ No .SPFUN #rtwork,#xc.control,#clset,#xlset3,#1,#0 ; /45/ Yes, SET LFOUT 1$: clr wasxc ; was not xc/xl and pure RT mov 2(r5) ,r1 ; get the internal lun asl r1 ; map it cmpb devname(r1),#'C&137 ; /44/ CLn: and TSX+ ? beq 2$ ; /44/ Yes, let it through cmpb devname(r1),#'X&137 ; see if the device was X?: bne 10$ ; no, then do nothing 2$: call clrxc ; reset the driver mov #CLCLR ,r2 ; /37/ assume TSX CL function 257 tst tsxcl ; tsx and cl? bne 5$ ; yes mov sp ,wasxc ; flag for .exit that this was XC/XL mov #OFFDRV ,r2 ; /37/ No, was real RT11 today 5$: .SPFUN #rtwork,#XC.CONTROL,r2,#0,#0,#1 ;disable interupts at exit .ABTIO 2(r5) ; try to stop all i/o please .ABTIO #XC.CONTROL ; /51/ .CLOSE 2(r5) ; yes, was XC/XL, thus close it .CLOSE #XC.CONTROL ; and close the controller port clr xcwdone ; nothing as far as writes either clr xcdone ; nothing pending to read from XC: mov #xcrdbf ,xcpoint ; reset the pointer to the buffer clrb @xcpoint ; stuff a null in please 10$: clr devnam(r1) ; no device active now clr r0 ; no error are possible unsave ; /37/ pop temp and exit return ; bye .dsabl lsb x.finrt:: ; /37/ clear the line for good tst r50dev ; /37/ anything ever opened up ? beq 10$ ; /37/ no .LOOKUP #rtwork,#XC.CONTROL,#r50dev ; /37/ yes, open it .SPFUN #rtwork,#XC.CONTROL,#OFFDRV,#0,#0,#1 ; /37/ and kill it 10$: tst wasxc ; /37/ need a .HRESET ? beq 20$ ; /37/ no .ABTIO #XC.CONTROL ; /51/ .CLOSE #XC.CONTROL ; /51/ .HRESET ; /51/ br 100$ ; /51/ And exit ; 20$: .CLOSE #XC.CONTROL ; /37/ 100$: clr r0 ; /37/ bye return .save .psect XCDATA ,rw,d,lcl,rel,con XCNAME: .rad50 /XC / .rad50 / / .rad50 / / .rad50 / / XLNAME: .rad50 /XL / .rad50 / / .rad50 / / .rad50 / / .restore .sbttl binrea read binary ; B I N R E A ; ; input: @r5 LUN ; 2(r5) timeout ; output: r0 error code ; r1 character just read ; ; To avoid rewriting the terminal emulation code, the case ; where we get passed a timeout of -1 is used to do a qio ; to the XC port and then subsequent calls simply check to ; see if it completed. If so, get whats in the buffer. If ; it's not done, exit and check next time. This is only ; done from the connect code, so perhaps later I will get ; around to rewriting it. ; ; For the normal Kermit timed packet read, we post the qio ; and loop waiting for it to complete. If it does not com- ; plete within the specified time, we cancel the i/o and ; reset the driver. ; For proper operation, the XC driver must be modified as ; described at the beginning of the file. rdmode: .word 0 x.xbin::mov sp ,rdmode br rdcom x.binr::clr rdmode rdcom: save ; we may want to use these here mov @r5 ,r2 ; get the lun to use asl r2 ; if TT: then do it different cmpb devnam(r2),#'C&137 ; /44/ CLn: and TSX+ ? beq 10$ ; /44/ Yes, let it through cmpb devnam(r2),#'X&137 ; XC: ? beq 10$ ; yes (or at least assume so) call ttread ; yes, get from the console tt br 100$ ; bye 10$: cmp xcpoint ,#xcrdbf+xcrdsi ; insure no buffer overflows bhis 20$ ; gone too far, XC driver is %$#@! tstb @xcpoint ; anything left in the readbuffer? bne 30$ ; no 20$: mov #xcrdbf ,xcpoint ; reset the pointer to the buffer clrb @xcpoint ; stuff a null in please call xxread ; load the buffer with as much as can tst r0 ; did this read succeed ? bne 100$ ; no 30$: clr r1 ; avoid sxt even if the fubar XC bisb @xcpoint,r1 ; driver always drops bit 7 (future?) inc xcpoint ; point to the next one in the buffer clr r0 ; insure success and exit 100$: unsave return xxread: mov 2(r5) ,r3 ; timeout in seconds here bne 10$ ; iK11PRTMAC[.050032]K11PRT.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|bddfnt/2 .WRITC #xcwork,4(r5),xklgbuf,r1,#200$,#1 mov #10.*60.,r3 ; wait at most 10 seconds (?) 50$: tst xcwdone ; ast completion as of yet ? bne 60$ ; yes tst clkflg ; A clock? bne 55$ ; Yes CPUWAIT #1 ; No, loop and fall thru, twait is NOP 55$: .TWAIT #rtwork,#wait ; still not complete, wait a tick sob r3 ,50$ ; and check again call clrxc ; clear the driver out, send XON clr r0 br 100$ ; exit 60$: tst r4 ; was that a single character i/o? beq 70$ ; yes tst xoffed ; in case a virgin xcdriver, wait. beq 70$ ; no, skip the wait and xon then. .TWAIT #rtwork,#tenth ; no, sleep for a moment please .TWAIT #rtwork,#tenth ; at 9600, we need this one also call 300$ ; xon the other side please 70$: clr r0 ; success clr xcwdone ; reset the i/o in progress flag 100$: unsave ; pop registers and exit return ; bye 200$: mov #1 ,xcwdone ; flag ast level completion return ; and exit 300$: tst xoffed ; did we xoff the other side? beq 310$ ; no .WRITC #xcwork,4(r5),#320$,#1,#0,#1 ; synch i/o this time please 310$: clr xoffed ; say no xoff's anymore please return 320$: .byte XON,0 clrxc: .SPFUN #rtwork,#XC.CONTROL,#CLRDRV,#0,#0,#1 ; clear the driver return .sbttl cantyp try to dump all typeahead x.cantyp:: save ; save temps mov #200 ,r2 ; loop for no more than 128 characters mov #xcrdbf ,xcpoint ; reset the pointer to the buffer clrb @xcpoint ; stuff a null in please 10$: calls binrea ,<2(r5),#-1> ; try to get something tst r0 ; did it work ? bne 20$ ; no, exit sob r2 ,10$ ; yes, eat somemore characters 20$: .ABTIO 2(r5) ; try to reinit the driver and exit call clrxc ; this also please 100$: unsave ; pop temp and exit clr r0 return ; bye x.ttxon:: call clrxc ; get the driver to clear xoff status return x.senbrk:: .SPFUN #rtwork,#XC.CONTROL,#BRKDRV,#0,#1,#1 tst brklen ; /43/ User set a BREAK length? beq 10$ ; /43/ No mov brklen ,break+2 ; /43/ Yes, use it 10$: .TWAIT #rtwork,#break .SPFUN #rtwork,#XC.CONTROL,#BRKDRV,#0,#0,#1 clr r0 return ; Drop dtr for a moment, For RT11 5.2 only ; Added 31-Dec-85 03:46:44 Edit 2.41 .enabl lsb x.ttyhan:: x.ttydtr:: save ; /41/ Save a register mov (r5) ,r1 ; /44/ Get device name address in R1 call mapxl ; /44/ See if device names maps bcs 100$ ; /44/ No, so exit mov r0 ,r1 ; /44/ Point to it 10$: calls fetch ,<@r1> ; /41/ Insure handler is loaded .LOOKUP #rtwork,#XC.AUX,r1 ; /41/ Now open it up bcs 90$ ; /41/ Oops, should not happen .SPFUN #rtwork,#XC.AUX,#DTRDRV,#0,#0,#1 ;/41/ Now DROP DTR .TWAIT #rtwork,#dtrlow ;/41/ And let it stay low for .TWAIT #rtwork,#dtrlow ;/41/ And let it stay low for .TWAIT #rtwork,#dtrlow ;/41/ And let it stay low for .SPFUN #rtwork,#XC.AUX,#DTRDRV,#0,#1,#1 ;/41/ while, then bring it up .CLOSE #XC.AUX ; /41/ Close controlling channel br 100$ 90$: movb @#52 ,r1 message decout r1 message 100$: unsave ; /41/ Pop saved register clr r0 ; /41/ Assume that it worked return ; /41/ And exit .dsabl lsb .sbttl parse terminal unit ; T T P A R S ; ; input: @r5 address of RT11 Multiple terminal service unit string ; output: r0 unit in binary x.ttpars:: clr r0 ; always unit zero for PRO/RT return .sbttl GTTNAM get MT unit of current console (set tt:consol=nn) ; G T T N A M ; ; input: @r5 address of console name to be written ; output: @r5 current console name ; consave same thing x.gttnam:: mov @r5 ,r0 ; for PRO/RT, always return TT: movb #'T&137 ,@r0 movb (r0)+ ,consave movb #'T&137 ,@r0 movb (r0)+ ,consave+1 movb #': ,@r0 movb (r0)+ ,consave+2 clrb @r0 clrb consave+3 clr r0 return global .sbttl terminal i/o things we don't need, can't do or haven't done yet ; Edit: /54/ Remove ASL R3 to get correct speed indexing x.setspd:: clr xkspeed ; /52/ No sK11PRTMAC[.050032]K11PRT.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|bddfaved speed now tst tsxcl ; /44/ TSX+ and CL ? beq 110$ ; /44/ No can do if not save ; /44/ Save a register or three clr r3 ; /44/ Match passed speed in table 10$: tst splst(r3) ; /44/ End of the speed table ? beq 90$ ; /44/ Yes, exit please cmp splst(r3),2(r5) ; /44/ Speeds match up ? beq 20$ ; /44/ Yes, exit loop tst (r3)+ ; /44/ No, try next entry then br 10$ ; /44/ Next please 20$: mov (r5) ,r1 ; /44/ Get device name address in R1 call mapxl ; /44/ See if device names maps bcs 100$ ; /44/ No, so exit mov r0 ,r1 ; /44/ Point to it calls fetch ,<@r1> ; /44/ Insure handler is loaded .LOOKUP #rtwork,#XC.AUX,r1 ; /44/ Now open it up bcs 100$ ; /44/ Oops, should not happen add #spmap ,r3 ; /45/ for the speed .SPFUN #rtwork,#XC.AUX,#CLSPEED,r3,#1,#0 ; /45/ Address NOT value bcs 40$ ; /52/ Oops mov (r3) ,xkspeed ; /52/ Save it please 40$: .CLOSE #XC.AUX ; /44/ Close controlling channel br 100$ ; /44/ Exit 90$: mov #ER$SPE ,r0 ; /44/ Return UNKNOWN speed 100$: unsave ; /44/ Pop saved registers clr r0 ; /44/ Assume that it worked return ; /44/ And exit 110$: mov #377 ,r0 return x.ttsp::clr r0 ; /54/ Presume failure tst tsxcl ; /54/ CL and TSX+ beq 100$ ; /54/ No mov xkspeed ,r0 ; /54/ Get from last SET SPEED asl r0 ; /54/ Word indexing mov splst-2(r0),r0 ; /54/ Copy and exit 100$: return ; /54/ Bye x.ttset:: x.ttrfin:: x.ttrini:: clr r0 return .mcall .TTYIN jsw = 44 x.kbread:: mov r2 ,-(sp) mov r3 ,-(sp) bis #40000 ,@#jsw ; enable lower case tt: input tst tsxcl ; tsx and cl? beq 5$ ; nope bic #10000!100,@#jsw ; ditch single ch input and wait br 7$ ; jump ahead 5$: bic #10000 ,@#jsw ; ditch single ch input please 7$: mov @r5 ,r1 ; a buffer to put the chars mov #80. ,r3 ; size of the buffer here ;10$: .SCCA #area ,#kmonbf ; so we can catch control Z 10$: .TTYIN ; read a character please tstb r0 beq 15$ ; a null cmpb r0 ,#'Z&37 ; control Z ? beq 20$ ; yes cmpb r0 ,#'C&37 ; control C ? beq 20$ ; yep cmpb r0 ,#15 ; carriage return ? beq 30$ ; yep movb r0 ,(r1)+ ; return what we just got cmpb r0 ,#14 ; form feed ? beq 40$ ; yep 15$: sob r3 ,10$ ; next please 20$: mov #ER$EOF ,r0 ; say read error and exit br 100$ ; bye 30$: movb #cr ,(r1)+ ; return all terminators please movb #lf ,(r1)+ ; simple .TTYIN ; eat the line feed now 40$: clrb @r1 sub @r5 ,r1 ; the length clr r0 100$: mov (sp)+ ,r3 mov (sp)+ ,r2 return .end