$: mov #er$dev ,r0 ; device name parse failed br 100$ ; bye 100$: unsave ; pop and exit return .sbttl save/restore terminal settings t.ttysav:: save ; we will use this one ; ; No multi-terminal support in TSX-plus ; mov @#jsw,ttparm ; save jsw ; .gval #rtwork,#$tcfig ; get terminal configuration ; mov r0,ttparm+2 ; and save it clr r0 ; success 100$: unsave ; pop this and exit return t.ttyrst:: save ; we will use this one ; ; No multi-terminal support ; mov ttparm,@#jsw ; restore jsw ; .pval #rtwork,#$tcfig,ttparm+2; restore terminal configuration ; tstb tsx ; are we under tsx?? ; beq 70$ ; nope mov #hieff,r0 ; point to block tst tsxflg ; /38/ really TSX+ bmi 70$ ; /38/ no emt 375 ; and turn off high efficiency .print #m.tsxr,#6 ; reset stuff 70$: clr r0 ; success br 100$ ; bye 100$: unsave ; pop this and exit return .sbttl binrea read binary ; B I N R E A ; ; input: @r5 LUN ; 2(r5) timeout ; output: r0 error code ; r1 character just read t.xbinre:: t.binrea:: save ; we may want to use these here bis #10000 ,@#JSW ; /39/ insure no echoing please clr -(sp) ; allocate a mark time tim buffer clr -(sp) ; simple mov sp ,r2 ; and point to it mov @r5 ,r3 ; get the LUN cmp 2(r5) ,#-1 ; read without any wait ? bne 20$ ; no .ttinr ; try to read a single character bcs 80$ ; nothing was there, so exit mov r0 ,r1 ; return character in r1 clr r0 ; no errors br 100$ ; exit 20$: mov 2(r5) ,r1 ; get the timeout in seconds mul #60. ,r1 ; into ticks now 30$: .ttinr ; try and read console bcs 40$ ; none mov r0,r1 ; save character clr r0 ; success br 100$ ; exit 40$: dec r1 ; been here too long ? beq 80$ ; yes, exit with error .twait #rtwork,#ttime ; sleep a moment please br 30$ ; and try again please 80$: mov #er$nin ,r0 ; no data today br 100$ ; bye 100$: add #4 ,sp ; pop local buffers unsave ; pop registers and exit return .sbttl binary write ; B I N W R I ; ; binwri( %loc buffer, %val buffer_size, %val lun ) ; ; output: r0 error code ; t.binwri:: save ; save registers we may need clr r0 ; preset no errors as of yet mov @r5 ,r1 ; get the string address mov 2(r5) ,r2 ; get the string length beq 100$ ; nothing to do 10$: .ttyou (r1)+ ; dump and exit sob r2 ,10$ ; next please clr r0 ; success today 100$: unsave ; pop the saved registers return ; and exit .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 t.ttpars:: clr r0 ; /39/ does not make sense in return ; /39/ this context. mov r1 ,-(sp) ; save scratch register please mov @r5 ,r0 ; get the address of the string call 200$ ; check for legit character bcs 110$ ; oops movb (r0)+ ,r1 ; get the first byte please sub #'0 ,r1 ; convert to binary call 200$ ; check for legit character bcs 110$ ; oops movb @r0 ,r0 ; get the next digit beq 100$ ; nothing there then we are done mul #12 ,r1 ; something there, shift over by 10 sub #'0 ,r0 ; and convert low digit to binary add r0 ,r1 ; add into the accumulator 100$: mov r1 ,r0 ; and return the result clc ; return success 110$: mov (sp)+ ,r1 return 200$: tstb @r0 ; null ? beq 210$ ; yes, it's ok cmpb @r0 ,#'0 ; must only be digits today blo 220$ ; oops cmpb @r0 ,#'9 ; 0..9 bhi 220$ ; bad device name 210$: clc ; device name ok so far return ; bye 220$: sec ; bad, set and exit return ; G T T N A M ; ; input: @r5 address of console name to be written ; output: @r5 console name, always .asciz /0/ t.gttnam:: mov @r5 ,r0 ; get the address of where to put it movb #'0 ,(r0)+ ; tt0: is always mt unit 0 clrb @r0 ; insure .asciz and exit clr r0 ; return success returK11TSXMAC[.050032]K11TSX.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|bddfn ; bye t.ttyfin:: 100$: clr r0 ; return 'success' return ; and exit .sbttl speed read and change t.ttspee:: t.setspd:: clr r0 ; find the speed map now return .sbttl terminal i/o things we don't need, can't do or haven't done yet t.ttxon:: t.cantyp:: t.ttset:: t.ttydtr:: t.ttrfin:: t.ttrini::clr r0 return t.ttyhan::mov #er$iop ,r0 return .mcall .ttyin jsw = 44 t.kbread::mov r2 ,-(sp) mov r3 ,-(sp) bis #40000 ,@#jsw ; enable lower case tt: input bic #10000!100,@#jsw ; ditch single ch input and nowait 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 t.senbrk:: t.finrt:: clr r0 return .end