.title KRTERM Packet I/O via TT .ident "V03.62" ; /62/ 27-Jul-93 Billy Youdelman ; ; add support for RT-11 V4 ; /BBS/ 1-Dec-91 Billy Youdelman V03.61 ; ; this module has been extensively modified, please refer to it ; added SET TT XON (TSX) emt to t.ttxon, uses tsxsav for lnum ; add dummy routines for inqdtr, inqcd ; ttyini - suspend TSX window processing, as in connect, packets ; added support for vlflag under TSX+ to ttyini ; ; drop TSX hi eff term mode and declare a list of activation chars ; instead, allowing single char input (so packets can be longer ; than TSX's internal I/O buffers) whilst offing ^B, ^T, ^W, etc ; so line noise doesn't trigger various annoying things as when ; using the server via TT, also allows passing to remote when in ; the connect mode ; Copyright 1984 Change Software, Inc. .include "IN:KRTMAC.MAC" .iif ndf KRTINC .error <; .include for IN:KRTMAC.MAC failed> ; /62/ .PEEK,.POKE bypassed for V4, also expanded to allow assy under same .mcall .GVAL ,.RCTRLO,.TTINR ,.TTYOUT,.TWAIT $TCFIG = 424 ; terminal configuration word CRLF$ = 2 ; ignore width bit PAGE$ = 200 ; /BBS/ SET TT [NO]PAGE bit .psect $pdata ttime: .word 0 ,1 ; a tick sleep for .twait w$suspen:.byte 3 ,161 ; /BBS/ suspend TSX window processing .psect tsxdat ,rw,d,lcl,rel,con xonemt: .byte 1 ,154 ; /BBS/ TSX SET TT XON emt xonlin: .byte 0 ,0 ; /BBS/ line_to_XON ,0 .word 0 ; /BBS/ speed (unused here) .even .psect $code .sbttl Initialize the terminal ; /BBS/ heavily hacked ; T T Y I N I ; ; input: (r5) = if <> don't force ^W/^B off, as for CONNECT mode ; output: r0 = cleared, no error possible t.ttyini::save tst tsxsave ; running under TSX? bne 3$ ; ya, skip to TSX term init .gval #rtwork,#$tcfig ; no, get term config word addr cmp rt11ver ,#5 ; /62/ is this RT-11 V5 or above? bge 71$ ; /62/ ya, .peek will work tst montyp ; /62/ if XM and V4.. bgt 77$ ; /62/ ..tough luck bic #crlf$ ,(r0) ; /62/ no CR/LF, ignore width that is br 77$ 71$: mov r0 ,r1 ; copy for peek, which uses r0 ; /62/ .peek #rtwork ,r1 ; must do it this way for XM MOV #rtwork ,R0 ; /62/ expanded to assemble under V4 MOV #28.*^o400+1.,@R0 ; /62/ even though V4 can't run it MOV r1 ,2.(R0) ; /62/ EMT ^o375 ; /62/ mov r0 ,r2 ; copy for poke, which also uses r0 bic #crlf$ ,r2 ; no CR/LF, ignore width that is.. ; /62/ .poke #rtwork ,r1,r2 ; stuff in new term config word MOV #rtwork ,R0 ; /62/ expanded to assemble under V4 MOV #28.*^o400+3,@R0 ; /62/ even though V4 can't run it MOV r1 ,2.(R0) ; /62/ MOV r2 ,4.(R0) ; /62/ EMT ^o375 ; /62/ 77$: .rctrlo ; force update of it in the os br 7$ ; skip past TSX init code 3$: mov #1 ,r1 ; offset to second byte mov #11. ,r2 ; 11 of 'em to do 4$: movb #'D ,limits(r1) ; load activation char prefix add #3 ,r1 ; bump to next one sob r2 ,4$ ; next one tst (r5) ; come here via CONNECT? bne 55$ ; ya movb limits ,vl$chr ; no, ensure ^W gets off'd br 57$ ; and continue 55$: movb vlflag ,vl$chr ; set/clear ^B/^W lead-in char beq 59$ ; ^W stays on, keep windowing on 57$: mov #w$suspen,r0 ; suspend TSX window processing emt 375 ; for packets and connect mode 59$: wrtall #limits ; set some terminal parameters 7$: mov #1000 ,r2 ; eat anything that's pending please 10$: calls t.binrea,<#-1> ; force call to t.binread dec r2 ; don't loop forever please beq 20$ ; exit the loop tst r0 ; did we get anything at all? beq 10$ ; yes, eat some more input 20$: clr r0 ; indicate success unsave return .sbttl Binary read ; B I N R E A ; ; input: (r5) = time_out ; output: r1 = character just read ; r0 = if <>, error code t.xbinre:: ; same here, different in KRTXL t.binrea::cmp (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$ ; done 20$: mov (r5) ,r1 ; get the time_out in seconds mul clkflg ,r1 ; /BBS/ into ticks now 30$: .ttinr ; try and read console bcs 40$ ; nothing there mov r0 ,r1 ; save character clr r0 ; success br 100$ ; done 40$: dec r1 ; been here too long? beq 80$ ; yes, exit with error .twait #rtwork ,#ttime ; no, sleep one tick br 30$ ; and try again please 80$: mov #er$nin ,r0 ; no data today clr r1 ; /BBS/ ensure nothing output 100$: return .sbttl Binary write ; B I N W R I ; ; output: r0 = if <>, error code t.binwri::save mov @r5 ,r1 ; get the string address mov 2(r5) ,r2 ; get the string length beq 100$ ; nothing to do 10$: .ttyou (r1)+ ; dump one char sob r2 ,10$ ; next please 100$: clr r0 ; no error possible unsave return .sbttl Reset an XOFF ; /BBS/ all new t.ttxon::movb tsxsave ,xonlin ; TSX line number beq 5$ ; not TSX cmp tsxver ,#620. ; TSX, but which version? blo 5$ ; if less than 6.2 use RT-11 code mov #xonemt ,r0 ; load args for XON emt emt 375 ; SET TT XON br 7$ 5$: save .gval #rtwork,#$tcfig ; get term config word addr cmp rt11ver ,#5 ; /62/ is this RT-11 V5 or above? bge 71$ ; /62/ ya, .peek will work tst montyp ; /62/ if XM and V4.. bgt 77$ ; /62/ ..tough luck mov r0 ,r2 ; /62/ copy term config word address bic #page$ ,(r2) ; /62/ clear page bit .rctrlo ; /62/ force update bis #page$ ,(r2) ; /62/ restore page bit br 77$ 71$: mov r0 ,r1 ; save copy as peek eats r0 ; /62/ .peek #rtwork ,r1 ; must do it this way for XM MOV #rtwork ,R0 ; /62/ expanded to assemble under V4 MOV #28.*^o400+1.,@R0 ; /62/ even though V4 can't run it MOV r1 ,2.(R0) ; /62/ EMT ^o375 ; /62/ mov r0 ,r2 ; save copy as poke also eats r0 bic #page$ ,r2 ; clear page bit ; /62/ .poke #rtwork ,r1,r2 ; set tt nopage MOV #rtwork ,R0 ; /62/ expanded to assemble under V4 MOV #28.*^o400+3,@R0 ; /62/ even though V4 can't run it MOV r1 ,2.(R0) ; /62/ MOV r2 ,4.(R0) ; /62/ EMT ^o375 ; /62/ .rctrlo ; force update bis #page$ ,r2 ; restore page bit ; /62/ .poke #rtwork ,r1,r2 ; set tt page MOV #rtwork ,R0 ; /62/ expanded to assemble under V4 MOV #28.*^o400+3,@R0 ; /62/ even though V4 can't run it MOV r1 ,2.(R0) ; /62/ MOV r2 ,4.(R0) ; /62/ EMT ^o375 ; /62/ 77$: unsave 7$: .rctrlo ; force update again .ttyout #xon ; send an XON clr r0 ; success return .sbttl Hose the terminal port, cancel type_ahead t.hose:: ; same here, different in KRTXL t.cantyp::call t.ttxon ; /BBS/ dump a possible XOFF then jmp clrcns ; /62/ eat any pending terminal input .sbttl Handler functions not needed for TT t.dcdtst:: ; /62/ t.ttspee::clr r0 ; /62/ not available return t.inqcd:: t.inqdtr:: t.ttyfin:: mov #-1 ,r0 ; /BBS/ not available return t.setspd::mov #er$spx ,r0 ; /BBS/ speed not settable return t.ttyhan::mov #er$pls ,r0 ; /BBS/ please SET LINE first.. return .end