From 14c2ff83ac82e4555f29680cb397e6d103541306 Mon Sep 17 00:00:00 2001 From: Lars Brinkhoff Date: Mon, 7 Nov 2016 13:55:41 +0100 Subject: [PATCH] TCTYP and CRTSTY source code. --- src/klh/macros.84 | 578 ++ src/rms/macros.18 | 298 + src/syseng/$call.macro | 58 + src/syseng/crtsty.1377 | 18212 +++++++++++++++++++++++++++++++++++++++ src/syseng/system.14 | 151 + src/syseng/tctyp.153 | Bin 0 -> 39022 bytes 6 files changed, 19297 insertions(+) create mode 100755 src/klh/macros.84 create mode 100755 src/rms/macros.18 create mode 100755 src/syseng/$call.macro create mode 100755 src/syseng/crtsty.1377 create mode 100755 src/syseng/system.14 create mode 100755 src/syseng/tctyp.153 diff --git a/src/klh/macros.84 b/src/klh/macros.84 new file mode 100755 index 00000000..9172f717 --- /dev/null +++ b/src/klh/macros.84 @@ -0,0 +1,578 @@ +IF2 .INEOF ; Never read on 2nd pass, nothing to re-define. +IF1 IFDEF %%%MAC .INEOF ; This checks for file already .INSRT'd. +%%%MAC==1 ; Aha, first! Prevent other .INSRT's from winning. +;---------------------------------------------------------------------------- + +; Determine what OS to assemble for. To force a particular OS, +; simply set OS%==SIXBIT/foo/ where foo is one of +; ITS,CMU,SAIL,DEC,TENEX,TWENEX mutually exclusive. +; T10 equivalent to DEC +; T20,20X equivalent to TWENEX +; 10X equivalent to TENEX +; TNX indicates either 10X or 20X, macro determines which. +; The following symbols are defined by this section: +; Flag Set if assembling for: +; OS%ITS ITS system (AI,ML,MC,DM) +; OS%CMU CMU system +; OS%SAI SAIL system +; OS%T10 a vanilla Tops-10 system (neither SAIL nor CMU) +; OS%DEC set for all of the above 3 Tops-10 based systems. +; OS%10X BBN TENEX +; OS%20X DEC Tops-20 (TWENEX) +; OS%TNX set for both of the above 2 (10X or 20X). + +ifndef os%,os%==.osmidas +%%t==0 +irp pair,,[[ITS,its],[DEC,t10],[CMU,cmu],[SAIL,sail],[TENEX,10X],[TNX,tnx],[10X,10x],[20X,20x],[TWENEX,20x]] + irp sys,flg,[pair] + ife os%-sixbit/sys/, os%!flg==1 + .else ifndef os%!flg, os%!flg==0 + %%t==%%t+os%!flg + .istop + termin +termin +ife %%t,.err Can't determine OS to assemble for! +expunge %%t + + ; Fixups... +ifn os%tnx,[ ; If TNX of some kind, find exact variety. +ife .osmidas-sixbit/tenex/, os%10x==1 +.else os%20x==1 +] +os%tnx==os%10x+os%20x ; TNX on if either 10X or 20X. +os%t20==os%20x ; T20 synonym for 20X. +os%dec==os%t10\os%cmu\os%sai ; DEC means a T10-like sys. + +;------------------------------------------------------------------ +; Note: the following stuff is not completely thought out. Mainly it +; tries to ensure that a standard exists for specifying CPU type +; and that all CPU-dependent symbols are properly defined. +; This benefits various .insrt-able packages like NUUOS. + +; Find what CPU to assemble for. To force a particular CPU, +; set CPU%==SIXBIT/foo/ where foo is one of: +; KA defaults to this. Standard vanilla PDP-10 +; KI very slightly hairier. +; KL current zenith, standard for 20X. +; K* means set flags to "good guess". +; RUNTIM means use run-time determination. +; The following symbols are defined by this section: +; CPU%KA set if should assemble specifically for KA +; CPU%KI " " " " " " KI +; CPU%KL " " " " " " KL +; CPU%X set if should use run-time determination. +; +; In general, code should be written to run on any processor. These +; flags are intended to be used only for special circumstances where +; the differences can be significant and binary portability is not +; as important. (For runtime determination of OS and CPU, see +; forthcoming .insrt-able routines, which should set variable flags +; of the form OS.TNX, CPU.KA, etc. ) + +ifndef cpu%, cpu%==sixbit/KA/ ; Always force to KA unless overridden +irp pair,,[[KA,ka],[KI,ki],[KL,kl],[RUNTIM,x]] +irp m,s,[pair] + ife cpu%-sixbit/m/, cpu%!m==1 + .else cpu%!m==0 +termin +termin +ife cpu%-sixbit/K*/,{ ; Make good guess + ifn os%20x, cpu%kl==1 + .else cpu%ka==1 +} +ife cpu%ka\cpu%ki\cpu%kl\cpu%x, .err Can't determine CPU to assemble for! + +;------------------------------------------------------------------ + +DEFINE INFORM A,B,C,D,E,F,G +PRINTX \A!B!C!D!E!F!G +\ +TERMIN + + ; DEFAULT no-op'ing of purification macros if they're + ; not already defined to do something. +IFNDEF BVAR,[ +DEFINE BVAR ; Make BVAR, EVAR, and LVAR all do nothing. +TERMIN +EQUALS EVAR,BVAR +EQUALS LVAR,BVAR +DEFINE VARCHK ; VARCHK always has this side effect. +VARIABLES +TERMIN ] + + ; Defs for ITS .CALL system call. +IFN OS%ITS,[ +CIMM==1000,,0 ; Immediate arg (also seen as MOVEI) +CRET==2000,,0 ; Value returned (also seen as MOVEM) +CERR==3000,,0 ; Error code returned +CTL== 4000,,0 ; Control bits at loc +CTLI==5000,,0 ; Control bits, immediate + +DEFINE SYSCAL A,B + .CALL [SETZ ? SIXBIT/A/ ? B ((SETZ))] +TERMIN +] + +%SIGN==SETZ ; Define full-word Sign bit. +%HSIGN==400000 ; and Halfword sign bit. + + ; Common byte-pointer LH's +IFNDEF $OPCOD,$OPCOD==331100 ; Instruction op-code +IFNDEF $ACFLD,$ACFLD==270400 ; Instruction AC field +IFNDEF $IFLD,$IFLD==220400 ; Instruction (I) field (maybe shd be $XFLD) +IFNDEF $ATFLD,$ATFLD==260100 ; Instruction @ field (maybe shd be $IFLD) +IFNDEF $ERRCD,$ERRCD==220600 ; Error code from .STATUS wd (ITS only) +IFNDEF $PFLD,$PFLD==360600 ; P field of byte pointer +IFNDEF $SFLD,$SFLD==300600 ; S field of byte pointer + + ; Macro to decrement 7-bit byte ptr in ac (no checking) +DEFINE MDBP7 AC,FOO +ADD AC,[70000,,0] ; Increase P +CAIG AC,0 ; Skip, + SUB AC,[430000,,1] ; unless went off edge, in which case reset. +TERMIN +EQUALS MD7BPT,MDBP7 ; Remain compatible with old names +EQUALS MDBPT, MDBP7 + + ; Page-size parameters, OS dependent +IFNDEF PG$BTS,{ IFN OS%TNX, PG$BTS==9. ; # bits of address in a page. + IFN OS%ITS, PG$BTS==10. +} +PG$SIZ==1_PG$BTS ; Page size in # words. +PG$MSK==PG$SIZ-1 ; Mask for page address bits. + + + ; Define some "instructions". +IFNDEF P,P=:17 ? .ERR P undefined, using P=17. +IFNDEF CALL,CALL==: ; More efficient than macro. +IFNDEF RETURN,RETURN==: +IFNDEF RET,RET==: +IFNDEF CALRET,CALRET==:JRST ; Better name for PJRST. +IFNDEF PJRST,PJRST==:JRST ; JRST to a popj'ing routine +IFNDEF NOP,NOP=: ; What the hell. + +DEFINE PUSHAE AC,LIST +IRP LOC,,[LIST] +PUSH AC,LOC +TERMIN +TERMIN + +DEFINE POPAE AC,LIST +IRP LOC,,[LIST] +POP AC,LOC +TERMIN +TERMIN + + ; TMPLOC , - puts argument at given LOC + ; without changing location counter outside macro call. +DEFINE TMPLOC VAL,?ARG +%%%TLC==. +LOC VAL +ARG +LOC %%%TLC +TERMIN + +IFNDEF %%%ASC,%%%ASC==0 ; Default is old mode, i.e. ASCNT [str] +IFE %%%ASC,[ + ; ASCNT [string] - produces word of ,, +DEFINE ASCNT STR +.LENGTH STR,,[ASCIZ STR]!TERMIN + +DEFINE LITSTR STRING +[ASCNT [STRING]]TERMIN + + ; ASCSTR [string] - produces 2 words of constant string descriptor, + ; ? +DEFINE ASCSTR STR +.LENGTH STR +440700,,[ASCIZ STR]!TERMIN + +] ; end IFE %%%ASC + +IFE %%%ASC-1,[ ; New style, i.e. ASCNT /str/ + +DEFINE ASCNT &STR& +.LENGTH STR,,[ASCIZ STR]!TERMIN + +DEFINE LITSTR &STR& +[ASCNT STR]!TERMIN + +DEFINE ASCSTR &STR& +.LENGTH STR +440700,,[ASCIZ STR]!TERMIN + +] ; IFE %%%ASC-1 + +; NETHANG - macro interface to use NETBLK call. Hangs until specified +; net channel changes state, or call times out. +; MOVEI AC, +; NETHANG ,AC,,[] +; failure return (timed out or non-winning new state) +; win return (changed to winning state) +; Always returns new state in AC. + +IFN OS%ITS,[ ; Only for ITS (in theory could hack for TNX) +DEFINE NETHANG TIMOUT,AC,HANGST,NEWSTL +JRST [ MOVEM AC,TMSTOR' + MOVE AC,[TIMOUT] + EXCH AC,TMSTOR + SYSCAL NETBLK,[AC ? [HANGST] ? TMSTOR ? CRET AC] + JRST .+1 +IRP CODE,,[NEWSTL] + CAIN AC,CODE + JRST .+2 +TERMIN + JRST .+1] +TERMIN +] ; IFN OS%ITS + +; BLKINI, BLKADD - couple of hairy macros that take a given +; and turn it into repository of text, initialized by BLKINI +; added to by BLKADD ,[]. +; To dump text, simply stick someplace after all has been added. + +DEFINE BLKINI BLKNAM ; Initialize specified blockname. +DEFINE BLKNAM ARG +ARG +TERMIN +TERMIN + +DEFINE BLKADD BLKNAM,NEW ; Add stuff to specified blockname. +BLKNAM [DEFINE BLKNAM ARG +ARG]NEW +TERMIN +TERMIN + + +IFN OS%ITS,[ ; Clock stuff really not used by anything much. + + ; Macro to clear clock and set frame time for interrupts +DEFINE CLKSET (TMOLOC) + PUSH P,A + MOVE A,[600000,,TMOLOC] + .REALT A, + JFCL + POP P,A +TERMIN + + ;to enable clock interrupts +DEFINE CLKON + .SUSET [.SAPIRQC,,[%PIRLT]] ;turn off any pending realt + .SUSET [.SIMASK,,[%PIRLT]] ;enable it +TERMIN + + ;to disable +DEFINE CLKOFF + .SUSET [.SAMASK,,[%PIRLT]] +TERMIN + +] ; IFN OS%ITS + +;------------------------------------------------------------- +; Old Super duper macro to make output a breeze. Requires UUOS. +; This stuff is obsoleted by an even more super-duper macro +; contained in the OUT output package, but can still be used for +; the sake of compatibility. +IFNDEF $$OUUO,$$OUUO==0 ; Default is not to use old output UUOs. + +DEFINE FWRITE CH,LIST +IFE $$OUUO, MOVEI OC,CH +%F==0 +IRP ITM,REM,[LIST] +IFN %F,[%F==0 ? .STOP] +IFNSQ [ITM] .GO O +IFNDEF %%.!ITM, .GO O +IRP ARG,,[REM] ? %%.!ITM CH,[ARG] ? .ISTOP ? TERMIN +%F==1 ? .STOP +.TAG O +%%.TC CH,[[.LENGTH ITM,,[ASCII ITM]]] +TERMIN +TERMIN + +DEFINE MAKSTR LOC,LIST ; For making string in one fell swoop. +BCONC +FWRITE STRC,[LIST] +ECONC LOC +TERMIN + +DEFINE CONC LOC,LIST ; For concatenating stuff to existing string. +BCONC LOC +FWRITE STRC,[LIST] +ECONC LOC +TERMIN + +DEFINE DEFWR ITM,INSTR,INTNAM ; Make easy to define simple items. +IFN $$OUUO,{ ; Use old output UUOs +DEFINE %%.!ITM C,ARG +OU!ITM C,ARG +TERMIN .STOP } + +IFB [INSTR]{IFB [INTNAM] DEFX2 %%.!ITM,MOVE U3,OX!ITM + .ELSE DEFX2 %%.!ITM,MOVE U3,INTNAM + .STOP } +IFB [INTNAM] DEFX2 %%.!ITM,INSTR,OX!ITM +.ELSE DEFX2 %%.!ITM,INSTR,INTNAM +TERMIN + +DEFINE DEFX2 WITM,INSTR,RTN +DEFINE WITM C,ARG +INSTR,ARG +CALL OUT"RTN +TERMIN +TERMIN + +;------------------- FWRITE item routines ------------------ +; item is in form "%%. ," +; Note that if item takes no argument and it is the last thing in FWRITE, +; a space should follow the comma, as in FWRITE CH,[[foo],WAI, ] +; Otherwise MIDAS botches it with no err message. + +DEFWR TLS,,OXLS ; "TLS" - Text, List String. +DEFWR TA,MOVEI U1,OXAR ; "TA" - Text, Area. outputs whole area. +DEFWR TS,MOVEI U3,OXS ; "TS" - Text, String. outputs string var. +DEFWR N10,,OXN10. ; "N10" - Number, base 10 ; signed decimal value, +DEFWR N9,,OXN10 ; "N9" - N10 without decimal point. Kludge. +DEFWR N8,,OXN8 ; "N8" - Number, base 8. Signed octal value. +EQUALS %%.OCT,%%.N8 ; "OCT" - N8 +EQUALS %%.DEC,%%.N10 ; "DEC" - N9 +DEFWR NFL,,OXNFL ; "NFL" - Number, FLoating. From MACLISP. +DEFWR TI,MOVEI U1,OXC ; "TI" - Text Immediate. Outputs arg as char +DEFWR TZ,MOVEI U3,OXZA ; "TZ" - Text ASCIZ. Outputs asciz string +DEFWR TC,,OXTC ; "TC" - Text, Count. Outputs ASCNT string at arg +DEFWR TPZ,,OXZ ; "TPZ" - Text, BP ASCIZ. c(ARG) is BP to asciz string +DEFWR TPC,,OXPC ; "TPC" - Text, BP Count. c(ARG) is #,,[bp] +DEFWR 6F ; "6F" - outputs c(arg) as sixbit without trailing bls +DEFWR 6W ; "6W" - outputs all of c(arg) as sixbit +DEFWR 6Q ; "6Q" - like 6F but puts ^Q in front of punct. chars + +; Weird cookies + +IFN $$OUUO,[ +DEFINE DEFWRN ITM,INSTR,UUO +DEFINE %%.!ITM C,ARG +INSTR U4,ARG +UUO C,U4 +TERMIN +TERMIN + +DEFWRN RH,MOVE,OUNRH ; "RH" - outputs RH of c(ARG) in octal (6 chars) +DEFWRN LH,HLRZ,OUNRH ; "LH" - outputs LH of c(ARG) in octal (6 chars) +DEFWRN RHV,HRRZ,OUN8 ; "RHV" - rh(arg) as octal number, not bit pattern +DEFWRN LHV,HLRZ,OUN8 ; "LHV" - lh(arg) as octal number +DEFWRN RHS,HRRE,OUN8 ; "RHS" - rh(arg) as signed octal number +DEFWRN LHS,HLRE,OUN8 ; "LHS" - lh(arg) as signed octal number + +DEFINE DEFWH ITM +DEFINE %%.!ITM C,ARG +%%.L!ITM C,ARG +%%.TZ C,[[ASCIZ /,,/]] +%%.R!ITM C,ARG +TERMIN +TERMIN + +DEFWH H ; "H" - outputs c(ARG) in halfwd format (LH,,RH) +DEFWH HV ; "HV" - lhv,,rhv +DEFWH HS ; "HS" - lhs,,rhs + +DEFINE %%.TZ$ C,ARG ; "TZ$" - Text ASCIZ crock. RH(c(arg)) is addr of asciz +MOVE U4,ARG ; (like OUTZ C,@ARG but avoids more indirection) +OUTZ C,(U4) +TERMIN +] ; IFN $$OUUO + +IFE $$OUUO,[ +DEFWR RH,HRRZ U3 ; RH(aval) - Right halfword, full. +DEFWR LH,HLRZ U3,OXRH ; LH(aval) - Left halfword, full. +DEFWR RHV,HRRZ U3,OXN8 ; RHV(aval) - RH as octal num, not bit pattern. +DEFWR LHV,HLRZ U3,OXN8 ; LHV(aval) - LH as octal num, not bit pattern. +DEFWR RHS,HRRE U3,OXN8 ; RHS(aval) - RH as signed octal num +DEFWR LHS,HLRE U3,OXN8 ; LHS(aval) - LH as signed octal num +DEFWR H,,OXHWD ; H(aval) - Halfword (123,,456) +DEFWR HV ; HV(aval) - LHV,,RHV +DEFWR HS ; HS(aval) - LHS,,RHS +DEFWR TZ$,HRRZ U3,OXZA ; TZ$(a-[a-asciz]) like TZ(@A) but avoids +] ;IFE $$OUUO + +DEFINE %%.ERR C,ARG ; "ERR" - System error message. If arg is blank, +IFN $$OUUO,MOVEI OC,C +IFB [ARG] CALL OUT"OXERRL ; use last err, otherwise arg is error code +.ELSE MOVE U3,ARG ? CALL OUT"OXERR +TERMIN + +DEFINE DEFWRT ITM,RTN,OUTRTN +DEFINE %%.!ITM!I C,ARG ; Def the "immediate" version. +%%.!ITM C +TERMIN +IFN $$OUUO,{ +DEFINE %%.!ITM C,ARG +PUSH P,A +IFNB [ARG] MOVE A,ARG +.ELSE CALL TIMGET +CALL RTN +%%.TC C,A +POP P,A +TERMIN +.STOP } ; IFN $$OUUO + +DEFINE %%.!ITM C,ARG +IFB [ARG]{ ; If no arg, use current time. + IFN OS%ITS, CALL OUT"UTMGTS + IFN OS%TNX, SETO U3, +} .ELSE MOVE U3,ARG + MOVEI U1,OUT"OUTRTN + CALL OUT"OXTXS +TERMIN +TERMIN + +DEFWRT WA,TIMDTM,OXTMDT ; "WA" - When, type A. "mm/dd/yy hh:mm:ss" +DEFWRT WB,TIMEXP,OXTME ; "WB" - When, type B. "dd mmm yy hhmm zon" +DEFWRT WC,TIMTIM,OXTMTS ; "WC" - When, type C. "hh:mm:ss" +DEFWRT WD,LTMEXP,OXTMX ; "WD" - When, type D. "dd month yyyy hh:mm zon" + +; "HN" - takes host # from arg and outputs number, performing +; simplifications where appropriate. Intended for use with new (HOSTS3) +; host table. +; Note that the $$OUUO==1 version is obsolete, and should be flushed asap. + +IFN $$OUUO,[ + +DEFINE DEFWRH ITM,RTN +DEFINE %%.!ITM C,ARG +MOVE U4,ARG +LDB U3,[NETWRK"NW$BYT,,U4] ; If no string exists, check number. +CAIN U3,12 ; Arpanet? + PUSHJ P,[ +IFDEF $$HST3,IFN $$HST3,.ERR You are going to lose. Flush the $$OUUO==1 !! + TDNE U4,[777,,77700774] ; Are any extended bits set? + POPJ P, ; If so, just print number (hack "/" fmt later) + DPB U4,[170200,,U4] ; Move host # ahead of imp # + LSH U4,-9. + ANDI U4,377 + POPJ P,] ; finally output old-form number +RTN C,U4 ; not arpanet?? just print. +TERMIN +TERMIN + +DEFWRH HN,OUN8 ; Output host number in octal +DEFWRH HND,OUN9 ; Ditto in decimal + +; "HST" - takes host # from arg and outputs name or # +; This version works with new host table file +DEFINE %%.HST C,ARG ; "HST" - takes host # from arg and outputs name or # + PUSHAE P,[A,B,D] ;clobbered by HSTSRC routine + SKIPN B,ARG + MOVE B,OWNHST + PUSHJ P,NETWRK"HSTSRC ;make A point to asciz name + PUSHJ P,[ + %%.HN C,B ; Output number. + JRST POPJ1] + OUTZ C,(A) + POPAE P,[D,B,A] +TERMIN +] ;IFN $$OUUO + +IFE $$OUUO,[ +IRP ITM,,[HN,HND,HST] +DEFINE %%.!ITM C,ARG +MOVE U3,ARG +CALL OUT"OX!ITM +TERMIN +TERMIN +] ;IFE $$OUUO + +; Character Table Macros + +; These macros facilitate use of 200-word arrays indexed by +; an ASCII character. A standard table definition is furnished which +; can be inserted where desired, and each insertion may be altered +; as necessary. + + + ; Character class flag definitions - all in LH + +ch%msk==377000 ; Note sign bit not included; user can set. + +ch%ul== 200000 ; Uppercase Letter (A-Z) +ch%ll== 100000 ; Lowercase Letter (a-z) +ch%d== 40000 ; Digit (0-9) +ch%pt== 20000 ; Printing (41-176; all but CTLs, SP, DEL) +ch%wsp== 10000 ; Whitespace (SP, TAB) +ch%fmt== 4000 ; ForMaT effector (^H, ^I, ^J, ^K, ^L, ^M) +ch%lbr== 2000 ; Left BRacket (<[{ +ch%rbr== 1000 ; Right BRacket }]>) + + ; Some useful combinations +ch%l==ch%ul+ch%ll ; Letter (upper or lower case) +ch%ld==ch%l+ch%d ; Letter or Digit +ch%uld==ch%ul+ch%d ; Uppercase Letter or Digit +ch%lld==ch%ll+ch%d ; Lowercase Letter or Digit +ch%br==ch%lbr+ch%rbr ; Brackets + +; CHTMAC - macro defining a character table with standard flags. +; Can be used as-is just by putting "chtmac" someplace, but +; also serves as a model for defining non-standard tables. + +define CHTMAC +chrtab==. ; Addr of latest table. +repeat 200,c.set \.rpcnt,0 ; Reserve 200 locs and set values to char only. +chrgrp addl,.ascvl/A,.ascvl/Z,,ch%ul ; Add flag ch%ul to chars "A-"Z incl +chrgrp addl,.ascvl/a,.ascvl/z,,ch%ll ; Add flag ch%ll to chars "a-"z +chrgrp addl,.ascvl/0,.ascvl/9,,ch%d ; Add flag ch%d to chars "0-"9 +chrgrp addl,41,176,,ch%pt ; Add flag ch%pt to chars 041-176 inclusive +chrgrp addl,^I,," ",ch%wsp ; Add flag ch%wsp to chars ^I and 40 +chrgrp addl,^H,^M,,ch%fmt ; Add flag ch%fmt to chars ^H-^M inclusive +chrgrp addl,133,,"(<{",ch%lbr ; Add flag ch%lbr to 133 = [ and (,<,{. +chrgrp addl,135,,"}>)",ch%rbr ; Add flag ch%rbr to 133 = ] and },>,). +termin + +; CHRGRP - Macro for easily setting ranges of chars in a table. +; Syntax is: +; chrgrp ,,,, +; Applies to specified chars according to . +; The range of chars to set can be specified in two ways; either +; or both can be used. +; * All chars from to INCLUSIVE. +; If is null, use only . +; If is null, use nothing. +; and must be expressions, not chars. +; * All chars in , which has "strung" syntax. +; If is null, use nothing. +; Applicable modes are: +; SET - like MOVE +; SETR - like HRR +; ADD - like TDO +; ADDL - like TLO + +define chrgrp mode,ch1,ch2,*str*,?val +if1 .stop +ifsn [ch1][]{ + ifsn [ch2][] %%%nc==1+- + .else %%%nc==1 + %%%tlc==. + loc chrtab+ + repeat %%%nc,c.!mode \<+.rpcnt>,val + loc %%%tlc +} +ifse [str][] .stop +%%%tlc==. +irpc c,,[str] + loc chrtab+<.ascvl /c> + c.!mode \<.ascvl /c>,val + termin +loc %%%tlc +termin + +; Define the s for CHRGRP. +define c.set #chr#,?val + +termin +define c.add #chr#,?val + +termin +define c.addl #chr#,?val +> +termin +define c.setr #chr#,?val +&ch%!chr\val> +termin + diff --git a/src/rms/macros.18 b/src/rms/macros.18 new file mode 100755 index 00000000..b91440c6 --- /dev/null +++ b/src/rms/macros.18 @@ -0,0 +1,298 @@ + +IF2 [ .MLLIT=1 + $PURE==0 +IFN PURESW,[ + $PURLC==$PURBG ;RESET BOTH LOCATION COUNTERS. + $VARLC==$VARBG +]] +IF2 .INEOF + +.MLLIT=1 ;MULTI-LINE MODE. +IFN 0,[ +.AUXIL ;DON'T CREF THIS FILE'S SYMBOLS UNLESS THEY'RE ACTUALLY USED ELSEWHERE. +] +IFNDEF %TOOVR,.INSRT SYSTEM;TTYDEF > +IFNDEF %PIMPV,.INSRT SYSTEM;BITS > + +;AC DEFS. +F==0 ;FLAGS. +A=1 ;THESE USED FOR ARGS. +B=2 +C=3 +D=4 +E=5 +G=6 ;RARELY SAVED IF USED. +H=7 +I=10 ;CHARACTER IO THRU HERE. +J=11 ;-> FILE BLOCK. +K=12 +M=13 ;OUTPUT PATH. +N=14 ;INPUT PATH. +R=15 +S=16 +P=17 ;PDL POINTER. + +SAVE=PUSH P, +REST=POP P, +CALL=PUSHJ P, +RET=POPJ P, + +SIGN=400000 ;IT SAVES A LITTLE TYPING +JRSTF=JRST 2, +JOV=JFCL 10, +JCRY0=JFCL 4, +JCRY1=JFCL 2, +JFOV=JFCL 1, +.FORMAT 30,2704_24. ;MAKE A, FORMAT TREAT A LIKE AC +.FORMAT 34,00222704_12. ;CHANGE A,B FORMAT TO TREAT A LIKE AC +.AOP .OPER@ 0,.RDATIM ;GET DATE AND TIME OF ASSEMBLY +ASTIME=.AVAL1 ;TIME (SIXBIT /HHMMSS/) OF ASSEMBLY +ASDATE=.AVAL2 ;DATE (SIXBIT /YYMMDD/) OF ASSEMBLY + + +;SWDEF NAME=EXPR ;SET "NAME" TO "EXPR" IFF "NAME" NOT DEFINED + +DEFINE SWDEF ASSGT/ +IRPS DUMMY,,[ASSGT] +IFNDEF DUMMY,ASSGT +.ISTOP +TERMIN +TERMIN + + ;FOLLOWING MACROS TAKE ADVANTAGE + ;OF ARGUMENT EVALUATION AT EXPANSION TIME + +DEFINE CONCAT A,B +A!B!TERMIN + +DEFINE DEF A,B,C,D,E,F,G,H,I,J,K +DEFINE A!B!C!D!E!F!G!H!I!J!K!TERMIN +TERMIN + +DEFINE PRINTA A,B,C,D,E,F +IF1,[PRINTC Á!B!C!D!E!F +Ý +TERMIN + + +DEFINE PRINTB A,B,C,D,E,F +PRINTC Á!B!C!D!E!F +Š TERMIN + + ;(RIGHT) BYTE POINTER, POS ARG IS # BITS TO RIGHT OF BYTE + +DEFINE POINTR POS,SIZ +_12.+_6,,TERMIN + + ;(LEFT) BYTE POINTER, 1STBIT ARG IS # BITS TO LEFT OF BYTE + +DEFINE POINTL 1STBIT,SIZ +<36.--<1STBIT>>_12.+_6,,TERMIN + + ;BYTE POINTER TO BYTE BEFORE FIRST IN WORD + +DEFINE POINTZ SIZ +36.-<36./*>_12.+_6,,-1 TERMIN + +;BYTE POINTER TO THE WORD BUT OFF THE LEFT END (EG 440700,,) +DEFINE POINTW SIZ +36._12.+_6,,TERMIN + + ;(PLURAL) BYTE POINTER ARRAY TO LDB FROM INDEXED + +DEFINE POINTS SIZ +REPEAT 36./,<36.-*<.RPCNT+1>>_12.+_6,,TERMIN + + ;(ILDB) BYTE POINTER ARRAY TO ILDB FROM + +DEFINE POINTI SIZ +REPEAT 36./,<36.-*.RPCNT>_12.+_6,,TERMIN + + ;ASSEMBLE INTO A CERTAIN LOCATION + +DEFINE TMPLOC LCTN,CRUFT/ +.ZZ==. +LOC LCTN +CRUFT +.=.ZZ +TERMIN + + ;DECREMENT A 7 BIT BYTE POINTER + +DEFINE DBP7 AC +ADD AC,[070000,,0] +TLNE AC,400000 +SUB AC,[430000,,1] +TERMIN + + ;DECREMENT 7 BIT BYTE POINTER AND JUMP + +DEFINE DBP7J AC,ADR +ADD AC,[70000,,0] +JUMPGE AC,ADR +SUB AC,[430000,,1] +JRST ADR +TERMIN + + ;IFNEED FOOSW,FOO,[FOO:BAR] + ;ASSEMBLES IF FOO NEEDED OR FOOSW NONZERO. + +DEFINE IFNEED A,B +SWDEF A==0 +IF1 [IRPS X,,[B] +IFE 3-.TYPE X ,A==1 +TERMIN ] +IFN A,TERMIN + + + ;REPEAT AN INSTRUCTION WITH VARIOUS ADDRESSES + +DEFINE INSIRP A,B +IRPS %%ADR,,[B] +A,%%ADR +TERMIN +TERMIN + + ;TAKE ACTION WHEN A BUG IS DETECTED. + ;(MIGHT BE REDEFINED AFTER THIS FILE) +DEFINE BUG A/ +.VALUE +TERMIN + + ;PAUSE IF IN DEBUG MODE. SHOULD HAPPEN BEFORE THE PROGRAM + ;FINALIZES ITS MAIN ACTION OR KILLS ITSELF. +DEFINE DPAUSE + SKIPE DEBUG + .VALUE +TERMIN + + ;1ST ARG NAME OF SYSTEM CALL, + ;2ND LIKE A LITERAL HAS ARGS TO CALL. +DEFINE SYSCAL A,B + .CALL [SETZ ? SIXBIT/A/ ? B ((SETZ))] +TERMIN + +DEFINE INSERT LINE/ + IRPS %NAME,,[LINE] + DEFINE %NAME DEFALT/ + .INSRT DSK:DEFALT  LINE + TERMIN + .ISTOP + TERMIN +TERMIN + +DEFINE INSERT DEFALT/GENSYM + IRPS %NAME,,[DEFALT] + IFNDEF %NAME,[ + DEFINE %NAME + .INSRT DSK:!TERMIN + ] + DEFINE GENSYM + EXPUNG GENSYM + %NAME!!TERMIN + .ISTOP + TERMIN + GENSYM DEFALTîTERMIN + SWDEF PURESW==0 +IFE PURESW,[ +DEFINE VBLK +IFE $PURE, .ERR CONSEC. VBLK'S +$PURE==0 +TERMIN + +DEFINE PBLK +IFN $PURE, .ERR CONSEC. PBLK'S +$PURE==1 +TERMIN + +DEFINE $PUREND ;SETS $PURMX, $VARMX IF PURESW. +TERMIN +] + +IFN PURESW,[ +DEFINE VBLK ;START IMPURE CODING. +IFE $PURE, .ERR CONSEC. VBLK'S +IFN $PURE, $PURLC==. ? .=$VARLC +$PURE==0 +TERMIN + +DEFINE PBLK ;START PURE CODING. +IFN $PURE, .ERR CONSEC. PBLK'S. +IFE $PURE, $VARLC==. ? .=$PURLC +$PURE==1 +TERMIN + +SWDEF $VARBG==. ;DEFINE STARTS OF SEGMENTS. +SWDEF $PURBG==20*2000 +$PURLC==$PURBG ;INITIALIZE LOC. CNTRS. +$VARLC==$VARBG + +DEFINE $PUREND ;PUT THIS AFTER END OF BOTH SEGS. +IFN $PURE, VBLK ;FORCE BOTH $PURLC AND $VARLC TO BE RIGHT. +PBLK +$PURMX==$PURLC +$VARMX==$VARLC +TERMIN +] ;END IFN PURESW, + +$PURE==0 + +DEFINE VARS X +VBLK +X +PBLK +TERMIN + +;UUO DEFINITION MACROS: + +F"UUONUM==0 ;USED TO ASSIGN VALUES TO UUOS. + +;DEFINE UUO NAMED A, DISPATCH ENTRY B. +DEFINE UUODEF A,B + F"UUONUM==F"UUONUM+1 + A=F"UUONUM_33 + TMPLOC UUOTAB+A_-33, B +TERMIN + +;DEFINE AN OUTPUT UUO, TO CALL AT CURRENT LOCATION. +DEFINE OUTUUO A +UUODEF .M"A,\.,,F"OUTUOH +TERMIN + +;ARRANGE FOR SOME THINGS TO BE DONE AT END OF ASSAMBLY. +EQUALS $END,END + +DEFINE END ADDR +F"UUOMAX==F"UUONUM ;LARGEST UUO NUM. USED. +F"CHNMAX==F"CHNNUM ;LARGEST ASSIGNED CHANNEL NUM. +IFN F"UUOMAX,[IFNDEF UUOTAB,[ VBLK +UUOTAB: BLOCK F"UUOMAX ]] +IFN PURESW, IFNDEF $PURMX, $PUREND ;(UNLESS ALREADY DONE) +$END ADDR +TERMIN + ;ASSEMBLE A FILE BLOCK AND NAME THE WORDS IN IT. + +DEFINE FILDEF NAM,CHNL,SIZ +NAM!CHN: CHNL +NAM!DEV: 0 +NAM!FN1: 0 +NAM!FN2: 0 +NAM!SNM: 0 +NAM!BPT: 0+IFN NAM!BSZ,POINTZ SIZ,NAM!BUF +NAM!PNT: 0 +NAM!CNT: -1 ;BUFFER NOT INITTED. +NAM!EPT: 0 +NAM!BSB: 36./SIZ +NAM!LEN: NAM!BSZ +NAM!MOD: 0 +IFN NAM!BSZ,NAM!BUF: BLOCK NAM!BSZ+1 +TERMIN + +;NUMBER OF NEXT UNASSIGNED IO CHANNEL. +DEFINE FRECHN +F"CHNNUM+1 +F"CHNNUM==F"CHNNUM+1 +TERMIN + +F"CHNNUM==0 + \ No newline at end of file diff --git a/src/syseng/$call.macro b/src/syseng/$call.macro new file mode 100755 index 00000000..3aaf529b --- /dev/null +++ b/src/syseng/$call.macro @@ -0,0 +1,58 @@ +;;; System-Call Macro. + +DEFINE $CALL PROC,IN,OUT,CTLB + ;COUNT ARGUMENTS + .CLST.==0 + .CLCT. IN + .CLCT. OUT + .CLCT. CTLB + +043000,,[SETZ + .1STWD SIXBIT/PROC/ + .CLAG. 4000,CTLB + .CLAG. 0,IN + .CLAG. 2000,OUT + IFN .CLST.,INFORM BAD FORMAT SYSTEM CALL - PROC +] +TERMIN + +DEFINE .CLCT. ?A,B,C,D,E,F,G,H ;CROCK DUE TO IRP LOSS +IFNB [A] .CLST.==.CLST.+1 +IFNB [B] .CLST.==.CLST.+1 +IFNB [C] .CLST.==.CLST.+1 +IFNB [D] .CLST.==.CLST.+1 +IFNB [E] .CLST.==.CLST.+1 +IFNB [F] .CLST.==.CLST.+1 +IFNB [G] .CLST.==.CLST.+1 +IFNB [H] .CLST.==.CLST.+1 +TERMIN + +;;; ARGUMENT POINTER GENERATOR FOR ABOVE +;;; A # INDICATES AN IMMEDIATE ARGUMENT + +DEFINE .CLAG. BITS?A,B,C,D,E,F,G,H +IFNB [A] .CLG1. BITS,A +IFNB [B] .CLG1. BITS,B +IFNB [C] .CLG1. BITS,C +IFNB [D] .CLG1. BITS,D +IFNB [E] .CLG1. BITS,E +IFNB [F] .CLG1. BITS,F +IFNB [G] .CLG1. BITS,G +IFNB [H] .CLG1. BITS,H +TERMIN + +DEFINE .CLG1. BITS?ARG + .CLST.==.CLST.-1 ;COUNT ARGS + .CLG2.==0 + IRPNC 0,1,-1,CH,REST,[ARG] + IFE "CH-"#,[ ,,0*"CH+REST + .CLG2.==1 ;the 0 times is per order rms + ] ;Immediate + IFE "CH-"?,[ ,,0*"CH+REST + .CLG2.==1 + ] ;Error-code argument + IFN "CH-40, .ISTOP ;STOP ON FIRST NON BLANK + TERMIN + IFE .CLG2., ,,ARG +TERMIN + \ No newline at end of file diff --git a/src/syseng/crtsty.1377 b/src/syseng/crtsty.1377 new file mode 100755 index 00000000..75a29f0a --- /dev/null +++ b/src/syseng/crtsty.1377 @@ -0,0 +1,18212 @@ +.SYMTAB 8009. ; -*-MIDAS-*- + +TITLE CRTSTY - STY program for unsupported CRTs +; (c) Copyright 1979,1983 by Ken Harrenstien and Earl Killian. + +comment ~ + Building a CRTSTY + +To create a new CRTSTY for ITS, do: + :MIDAS SYSENG;_CRTSTY ; Assemble CRTSTY + :JOB CRTSTY + :LOAD CRTSTY ; Load CRTSTY BIN into a job + PURIFY$G ; This will dump to SYSBIN;CRTSTY BIN + ; if you confirm with CR. Another filename + ; can be specified. + +To create a new CRTSTY for TENEX or TOPS-20 (known collectively as TNX), +first obtain the following files from their canonical location on MIT-MC: + TNX filename MIT-MC location + CRTSTY.MID SYSENG;CRTSTY > + SYSTEM.MID SYSENG;SYSTEM > + MACROS.MID KSC;MACROS > + +Be sure to preserve the ITS version numbers; e.g. if the MIT-MC file is +CRTSTY 1300, then the TNX filename should be CRTSTY.MID.1300. +Then do: (this example is for TOPS-20) + [@]MIDAS CRTSTY ; Assemble CRTSTY + [@]GET CRTSTY ; Load it up + [@]START PURIFY ; [Optional - start at "purify"] + [@]SAVE CTN ; Then save as sharable program. + +NOTE that the default assembly on ITS produces a "local" CRTSTY which +deals with STYs (pseudo-TTYs). It is necessary to specify NET==1 to +produce a "Supdup" CRTSTY (which acts like TELNET). On TNX this is +reversed, i.e. the default produces a Supdup CRTSTY (also called CTN) +since the assumption is that one will use it to access an ITS host over +the network. By setting STY==1 a local CRTSTY can be built instead, +which is also called a PTY CRTSTY or PCRTSTY. For example: + [@]MIDAS CRTSTY/T + [TTY: .INSRTed, end input with ^Z:] + STY==1 + ^Z + ; This results in a PCRTSTY. +~ + +comment ~ + +Operation: + + CRTSTY is a program which was originally meant to provide ITS +display support for terminals which ITS does not support itself. It is +now also capable of acting as a SUPDUP (TELNET-like) user program, as +well as a general-purpose terminal translator which can emulate or +support many different types of terminals. + +Because the design of ITS display support is interwoven closely with +CRTSTY, a brief overview of how ITS supports "virtual terminals" is +necessary to understand CRTSTY. When an ITS program sends output to a +terminal it is interpreted by the ITS Main Program (MP) Level TTY +routines. In addition to straight text to be displayed a program may +output special character sequences to perform useful operations on the +displayed output. These character sequences are called "^P codes". +The ITS MP Level interprets ^P codes (and certain ASCII format +effectors such as CR, LF, etc.) and deposits in the terminal's output +buffer "%TD codes" - an internal representation of the operations to +be performed on the display. Finally at output interrupt level the +ITS interrupt routines read %TD codes from the output buffer and send +the terminal specific codes necessary to operate on the display. + + Normal ITS terminal output: + +----------- ------------- ---------- ------------- ------------ +| | | ITS | | ITS | | ITS | | | +| Program |--->| Main Prog |--->| Output |--->| Interrupt |--->| Terminal | +| | | | Level | | | Buffer | | | Level | | | | +----------- | ------------- | ---------- | ------------- | ------------ + | | | | + ^P codes %TD codes %TD codes Terminal codes + + Thus the only terminals directly supported by ITS are the few +which the ITS Interrupt Level knows about. However it is possible to +indirectly support other terminals by means of a program like CRTSTY, +which runs in a separate process and basically replaces the +ITS Interrupt Level in the above diagram. It does this via the STY +device which allows it to read from the output buffer of the TTY +associated with the STY. Thus CRTSTY is able to read ITS %TD codes +and translate them into terminal codes for the supported terminal. +Finally CRTSTY outputs the terminal codes to the terminal, again going +through the ITS MP Level, ITS output buffer, and ITS Interrupt Level. +However it outputs in a special mode called "super image ouput mode" +which prevents MP Level and Interrupt Level from doing anything but +passing what CRTSTY sends verbatim. + + CRTSTY operation: + +----------- ------------- ---------- ---------- ---------- +| | | ITS | | ITS | | Pseudo | | | +| Program |--->| Main Prog |--->| Output |--->| TTY |--->| CRTSTY |---> +| | | | Level | | | Buffer | | | Device | | | | | +----------- | ------------- | ---------- | ---------- | ---------- | + | | | | | + ^P codes %TD codes %TD codes %TD codes Terminal codes + + ------------- ---------- ------------- ------------ + | ITS | | ITS | | ITS | | | + --->| Main Prog |--->| Output |--->| Interrupt |--->| Terminal | + | Level | | | Buffer | | | Level | | | | + ------------- | ---------- | ------------- | ------------ + | | | + Terminal codes Terminal codes Terminal codes + + Add some stuff about what CRTSTY does when it gets the %TD codes. +Explain its "never do today what you can put off until tomorrow" attitude. +~ + +comment ~ + CRTSTY Internal Structure + + CRTSTY operates as two separate processes, one for the "Input Stream" +and one for the "Output Stream". Each stream contains one module for +the SUPPORT of a particular terminal, and another for the SIMULATION of +a different terminal. + + %TOFCI bits - Ideal input stream + | + SIMULATION | SUPPORT + |----------------| | |----------------| + PYO channel | "SMI" | | | "TYI" | TYIC channel +input <<======|smibout< >======|smobin> >=======|=======|td.xxx> >tyobout|===========>> display + PYI channel | | | | | TYOC channel + |----------------| | |----------------| + | + %TD codes - Ideal output stream + + Input Stream: SMI+TYI Support Pair: TYI+TYO + Output Stream: SMO+TYO Simulate Pair: SMI+SMO + +Remember that each data stream is implemented as a complete + process, with its own ACs and stack. In some TNX configurations + the output stream is actually an inferior fork! +Also note a common source of confusion: each stream has both input and output + aspects at various stages, depending on the point of view; + e.g. note that output to a STY is actually input from the TTY, + and vice versa. + +In the very center one sees the "IDEAL" virtual terminal, using %TOFCI +bits on input and %TD codes on output. By using this virtual terminal +concept it is possible to simulate and support any pair of real terminals +freely, since each module will be "plug compatible" with every other. + +In general, only the output stream is of interest, since keyboard +input is usually passed along to the program with no modification or +special action. Note that the SMI and TYI modules as implemented are +actually co-routines within the input-stream process; each believes it +is driving the other. SMO on the other hand does drive TYO directly; +in fact the channel between them is one of execution paths rather than +actual data, wherein SMO decides what TD.XXX routines to invoke. + +The SIMULATE (SMx) component's task is to fake the program into believing +that its controlling TTY is some particular terminal, primarily by scanning the +output stream for display commands and translating them into %TD codes. +This is useful when dealing with programs which were written with one +particular terminal in mind, as is often the case on non-ITS systems. +By default this component simulates an ITS "Soft" TTY. Since a Soft +TTY is merely the ITS virtual terminal specification, identical or +almost so to CRTSTY's virtual terminal, this default involves essentially +no overhead. + +The SUPPORT (TYx) component's task is to translate the virtual-terminal +%TD-code display commands into specific output sequences for the +particular terminal type actually being used. It is also sometimes +responsible, in the TYI module, for implementing various keyboard input +features that try to compensate for whatever mis-features the terminal +has. A prime example of this is the underscore/DEL exchange for +keyboards which have these chars on the same key, wrong side up (i.e. +they expect you to hold down SHIFT every time you rubout something). + +CRTSTY normally configures the SMI/SMO simulation to accurately reflect +the capabilities of the terminal being supported (by TYI/TYO). This is +particularly easy when the simulated terminal is the ITS virtual terminal +since many parameters are easily varied. It is more difficult when the +user has requested simulation of some other, specific terminal, because +an adequate simulation may REQUIRE capabilities which the supported +terminal does not have. An obvious example is an attempt to simulate +a VT52 on a printing terminal. + +~ + +subttl History + +comment ~ + +Historical: + + Historically derived from TEKSTY, munged by DPR, RZ, MOON, +CBF, EAK, and KLH. Current version nearly a complete KLH rewrite +(with exception of command parsing). TEKSTY was a version of STY +(written by PJ?) hacked up by JLK and RLB. + +Date Version Who What +(Note KLH doesn't pay much attention to this nonsense) + 3/20/78 394 EAK fix auto-nl bug again + 3/28/78 400 EAK add TM.AX and TM.AY entries to HP's + 3/31/78 402 EAK put check in MOVCUR for fast return if no movement + 3/31/78 403 CBF remove my version of the NIH5200 + 4/05/78 407 EAK fix Concept 100 initialization to set tabs correctly + 4/07/78 416 EAK Purified CRTSTY + 4/08/78 417 EAK Fixed bug in SCRDCP + 4/12/78 421 CBF Added DTI terminal + 4/16/78 422 EAK Fixed bug in TEK4025 + 4/26/78 423 EAK Added home entry to TEK4025 + 4/28/78 435 EAK Fixed some OMRON bugs + 5/06/78 436 EAK Increased OMRON InsLine and DelLine padding + 5/11/78 437 EAK Switched to winning version of ASCNT macro + 5/16/78 439 KLH Added DM3025 as per FURST's specifications + 5/16/78 440 CBF Changed some timings and 1 bug in DM3025 definition + 5/16/78 443 EAK Fixed some paddings in DM3025 + 5/22/78 448 EAK Restored C100 editing functions + 5/22/78 449 EAK Fixed FOX absolute move bug and NOABS flag + 5/22/78 450 CBF Made TR.AMC definitions for FOX, OWL, HP2645 and HP2640 + 5/22/78 452 EAK Changed C100 padding on basis of experimentation + 5/28/78 454 RJL Added control _ and control ^ to c100 on function keys + 5/31/78 459 RJL Added esc n function keys, padding on formfeed and + fixed init bug in C100 + 6/02/78 480 EAK Changed insert/delete line/character entries to take + argument instead of assuming 1 + 7/03/78 507 EAK Finally debugged the TEK4025 code. The terminal is + a real crock, and the manual is impossible. + 7/19/78 520 KLH Hacked TRMBEG macro and CORFLS routine so that + several terminal definitions can share same page. + 7/24/78 521 EAK Added some stuff to TEK4025 code. + 8/01/78 527 EAK Fixed a bug in TEK4025 code. Also made definition + macros barf if arguments are blank. + 8/02/78 530 EAK Created two new zone tables and modified some terminal + definitions to use them. + 8/06/78 564 EAK Put in redundent movement optimizer. + 8/11/78 572 KLH Finished EAK's mods and added smart CLEOL hackery! + 8/12/78 RWK Made VT52 alternate keypad work right, made it %TOFCI + and put in timeout for ESC (SEL). Fixed FEEP code. + 8/14/78 608 EAK Changed the world to use arguments for relative + movement functions. + 8/17/78 615 EAK Redid ORDNRY to fix bugs, provide better control + character output. + 8/20/78 633 EAK Fixed some bugs in movement optimizer and ORDNRY. + 8/20/78 634 EAK Added a TR.WRP entry for the HP terminals. + 8/20/78 635 EAK Hacked the HP terminal definitions somewhat. + 8/20/78 638 EAK Added the Tektronix 4027. It is almost identical + to the 4025, but lacks  for move up. + 8/20/78 639 EAK Fixed a bug in CLEOL-less terminal bug in ORDNRY. + 8/20/78 641 EAK Hacked 4027 CLEOL to used DCH at 60cps or slower. + 8/21/78 644 EAK Fixed bug in SIMEOL so that it will clear the last + character position on a line. + 8/21/78 646 EAK Moved screen image updating from ORDNRY to SCHO. + 8/21/78 647 EAK Removed  hackery from 4025 since not all of them + have it. + 8/21/78 656 EAK Added TRMTOO and associated hackery. + 8/22/78 657 EAK Fixed bug in FTLINT. + 8/23/78 660 CBF Added H1500A cause Hazeltine changed RP's CR to an NL + 8/23/78 661 CBF Added T1061 + 8/23/78 662 CBF Changed TK4027 to always use DWN instead of LF + This may also have to be done to the 4025 + 8/23/78 663 RWK Fixed a %CLPND bug in ORDNRY. + 8/23/78 664 EAK Added DBUFC for debugging. + 8/27/78 667 EAK Changed FRCEOL to not output CLEOL unless its + really needed. + 9/01/78 668 EAK Fixed a bug I introduced into FRCEOL. + 9/01/78 669 EAK Added more smarts to SMEOL on terminal with CLEOL. + 9/03/78 670 EAK Added a CHO routine for the Concept 100. Also, + turned off character insert/delete. + 9/05/78 671 CBF Add the BEE3 for CMR + 9/07/78 679 EAK Fixed some VT100 stuff after playing with one. + 9/08/78 680 EAK Added some scroll region optimizations for the VT100. + 9/08/78 681 EAK Added Infoton 4380 support. Also added sample + terminal definition. + 9/09/78 683 RWK Made -> key on VT52 into [BREAK] instead of [FORM] + 9/09/78 684 RWK Added [ENTER] key hackery to VT52 stuff + 9/09/78 686 RWK Made code for [ENTER] stuff available to any terminal + and added code to flush it from core for those that + don't use it. + 9/09/78 691 RWK Added terminal-specific interactive ([ENTER]) + capability. Intended for re-initing terminal + parameters, etc. + 9/09/78 691 RWK Added Alarm mode toggle as an [ENTER] command + 9/09/78 692 RWK Started adding the DELPHI terminal type. (An + intelligent protocol between DELPHI UNIX and ITS + including a mini-FTP for people here TA'ing 6.031) + 9/09/78 694 RWK Spec'd out the FTP portion of DELPHI type. + 9/09/78 699 RWK Added log file hackery + 9/09/78 703 RWK Fixed a bug in VT52 sail graphics. + 9/09/78 705 RWK More DELPHI hacking. + 9/12/78 706 EAK Added a VT100 absolute movement cost calculator. + 9/12/78 708 EAK Fixed two bugs in log file stuff. + 9/13/78 709 EAK Fixed two bugs in Teleray 1061 code before demo today. + 9/13/78 717 EAK Debugged Teleray 1061 support. + 9/13/78 718 EAK Fixed bug in VTCHO. + 9/15/78 719 CBF Hacked Adds 980 a bit. + 9/17/78 724 EAK Hacked log file stuff a little more. + 9/20/78 727 CBF Fixed BADSPC up a little. + 9/20/78 729 EAK Tidied up OMRON code. + 9/20/78 731 EAK Removed GRAFIX hack per request. + 9/20/78 736 EAK Changed around a lot of the command line parsing. + Still needs an awful lot of work. + 9/24/78 738 RWK Fixed a bug in the CRTSTY-escape code. + 9/27/78 739 CBF Made TK4027 use the obscure hardware CLEOL. +10/12/78 751 EAK Added stuff to flush initialization code after + startup. +10/20/78 766 EAK Created terminal type SOFT and reorganized lots + of the TD routines. In the process HOMCLR went + away; TDCLR and TDEOF now conspire to do it's job. +10/20/78 767 EAK Fixed up TK40XX insert line at top code a little. +10/20/78 770 EAK Added basic windowing stuff. +10/21/78 777 EAK Added insert/delete line/character simulation. +10/23/78 780 KLH Changed the terminal definition table to be BLT'd + into the TB array at initialization. Redid STY + input. +10/24/78 790 KLH Added NLS LP simulation. +10/24/78 792 EAK Redid screen dumping stuff a little. +10/24/78 793 EAK Added some TNX conditionals. +10/25/78 794 MMCM Added Soroc IQ 120. +10/25/78 797 EAK Added some more TNX stuff. Changed WARN to use ORDNRY. +10/27/78 804 CBF Added RPVT52, it's sick. +10/27/78 807 KLH Added H1510. +10/28/78 808 EAK Added %TDWIN stuff. Created TE.WIN entries for the + VT100 and Concept 100. +10/30/78 809 EAK Hacked insert/delete line/character to work better + in windows. Also added .TRFIN to be called before + CRTSTY quits. +10/30/78 810 EAK Added ACT-IV. Changed log file's home to be CRASH. +11/01/78 811 EAK More fixes for insert/delete line/char in windows. + Added .TPSCR, the scroll count for the terminal + (corresponds to TTYROL in ITS). Also, changed screen + image to live right after variables to save a page + on occaisions. +11/01/78 812 EAK Reorganized TD subroutines. Added some more TNX + conditionals. +11/03/78 814 EAK Redid TD.(DLF ILP DLP ICP DCP) yet again. %FNxxx + no longer need to be specified in terminal definitions. + SIMEOL now calls TD.DLF instead of ORDNRY. +11/06/78 819 EAK Replaced PAD subroutine with PAD UUO. Changed all + the TR.TYI handlers to conform to KLH's new scheme. +11/07/78 821 EAK Added @ITS command line option. +11/08/78 822 EAK Changed NOWARN to NO WARN, NOLOGIN to NO LOGIN, and + NOBELL to NO BELL. Also changed SCREOL, SCREOS, + and SCRILP to work with windowing. +11/09/78 824 RWK Fixed bugs in ENTER code. +11/09/78 827 EAK Reorganized more of the initialization code to make + it more modular and make it easier to conditionalize + it for TNX. Also changed C100 padding to be closer + to reality, making it pretty hairy. +11/10/78 828 EAK Changed NOABS to NO ABS, and NOTABS to NO TABS. + Hacked TPCBS stuff. Moved lots of code around + to make groupings more logical. PAD UUO now rounds up. +11/10/78 830 EAK Changed SCRICP to work with windowing. Commented + out DBUFC (not worth the buffer space it takes). +11/14/78 834 EAK Added a wrap optimizer to the I4380. +11/16/78 837 EAK Removed %FLCNL and added CCHO in its place. CCHO + hacks scrolling when typing in the last column of the + last line. Added redisplay command to ACT stuff. +11/16/78 838 EAK Changed SCRDLP to work with windowing. +11/21/78 852 KLH Re-did some LP support/simulation stuff. +11/21/78 853 GSB Added TX.VBL entry for Concept 100 and also changed + its TR.CHO to hack underscores to avoid lossage. +11/21/78 854 EAK Fixed a bug in C1CHO and hacked it a bit. +11/24/78 8?? KLH decides to give up and start writing garbage in here. +11/24/78 880 KLH Made TYI and SMO modules into co-routines, re-did + most TR.TYI entries to take advantage of new + capabilities. Added more doc, clarified structure. + Fixed several bugs in term defs (ACs not saved). +11/26/78 883 EAK Changed TD.SCR to TD.SU. Added SCROLL command line + option. +11/27/78 888 KLH Fixed bug in TD.ILP/DLP/ICP/DCP routines, added + TD.SD (scroll down), redid terminal subttl's. +11/27/78 892 EAK Undid KLH's undo of my undo to KLH's undo of my .TPSCR + stuff. Also fixed a bug in .TPSCR where cursor isn't + updated updated correctly when .TPSCR<>1. +11/27/78 897 EAK Changed SCRDCP to hack windowing. + Began TR.TYI changes to improve co-routine setup. +11/29/78 899 KLH Completed most TR.TYI changes, also changed STY + interrupt vectoring similarly. Fixed SCREOL bug. + Added ACT-V. +11/30/78 900 EAK Removed HP2640 definition, moved much of its stuff + into the HP2645. Eventually I'd like to make HPINIT + see what name was used to invoke the HP code and do + some stuff conditional on that name being HP2640. +11/30/78 901 EAK Redid VT52 input co-routine and timeout stuff. + Timeout stuff is now available to all terminals. +11/30/78 902 EAK Hacked REDISP stuff a little. +12/01/78 903 RWK Put [HELP] back in the ASKQUE routine. This is easier + to type on a VT52 (and I expect other TTY's too) than + [BACK-NEXT]H or [TOP]H +12/01/78 906 RWK Put in table of TOP characters. What existed was + useless. +12/01/78 909 EAK HP2645 bug fix. +12/02/78 912 EAK Fixed up simulator output co-routine initialization. +12/03/78 914 EAK Added some 20X PTY code. +12/04/78 915 KLH Added  for LP mouse simulation. +12/05/78 917 EAK Random changes all over. +12/06/78 918 EAK CT64 bug fix. +12/06/78 919 EAK ADM2 bug fix. +12/06/78 920 EAK Fixed initialization bug introduced in 917. +12/06/78 921 EAK Changes to %PITTY interrupts. +12/07/78 922 CBF Minor fix to RPVT52, fixed JTRMSLS to list several + terminals per line again, and put in VT100 padding. +12/07/78 926 KLH Added DATAPOINT, tried to document some hair. +12/08/78 928 KLH Added XLOG, improved CCHO, removed SCRLCOUNT=0 + check. Scroll stuff really needs to be fixed. +12/08/78 929 EAK Put back detached check in RLTINT; it is needed + because %PITTY doesn't go off reliably. +12/08/78 930 EAK Added SLEEP macro. Reversed PG$MSK convention. +12/08/78 931 EAK More TNX modifications. +12/14/78 943 KLH Added DATALOSER (still needs work), condensed + TMCDEF etc macros, TB entries now have labels for DDT. + Changed TR.INI default, dbgsw setting. +12/14/78 944 KLH Fixed a CLEOL bug. +12/14/78 947 KLH Changed Dm2500 i/c and i/l code to use cleverness. +12/17/78 950 RWK Put the ASKHLP routine (from ASKQUE) inside the IFN ITS +12/22/78 953 KLH Fixed DEFINI bug, changed LP's .TRINI back owing to + problems with hacking TYIGET before interrupts enabled. + 1/03/79 954 BYRON Minor adjustment to C100 padding. + 1/29/79 960 CBF Changed OMRON to -%TOLID if > 300 baud. + 2/25/79 962 CBF Added MIME52 for Emery. Essentially VT52 with line i/d + 2/28/79 964 EAK Changed C1CHO3 to use repeat character horizontal. + Also changed OSMAP a little. + 3/01/79 966 GSB&EAK Hacked C1CHO some more. + 3/02/79 967 EAK Added STYIP for hacky optimizations. + 3/03/79 968 EAK Added TRANSLUCENT option for C100. Completely redid + C1CHO. Also started WHOLINE option. + 3/05/79 970 EAK Moved OSMAP code into OSINIT, TTYINI, STYINI. + Changed HPINIT to use BUFC while sending terminal + reset. + 3/11/79 971 EAK Fixed up TKILP. + 3/11/79 972 EAK Added WHO1/WHO2/WHO3 hacking to WHOLINE stuff. + 3/11/79 973 EAK Added JTMU, NMPGS, and NSWPGS hackery to WHOLINE. + 3/11/79 974 EAK Fixed screwed up %F flag definitions. + 3/12/79 976 EAK Added I400. + 3/13/79 977 CBF Added I100. (This is support your local Infoton week) + 3/13/79 978 CBF Added ADS100 for Macrak and hacked MIME52 for Emery + 3/14/79 979 EAK Fixed I400 bugs, changed C1CHO to hack last column + better. + 3/15/79 980 EAK More I400 work. + 3/16/79 981 EAK Changed XITEX to use NUL for padding. + 3/17/79 982 EAK Fixed formatting bug in WRTLOG. + 3/18/79 983 EAK Fixed TDORS problem with WHOLINE. + 3/24/79 984 EAK C100 window hacking. + 3/25/79 985 EAK Added optimization to TDDLP. + 3/26/79 986 EAK Hacked C100 insert/delete character subroutines. + 3/26/79 989 EAK Random hacking. + 3/30/79 990 EAK Added TR.NRM to make wrapping work. Also changed + %FNxxx computation in SETUP3 and TD.WIN. It is now + possible to have, for example, a TE.ICP entry which + isn't used because of a %FNICP in TP.FLG (but that + can be overriden by a CID in the command line). + Also added %PIATY interrupt handler and DMOVE/DMOVEM + macros. + 3/31/79 991 CBF VT100 hacking. + 3/31/79 992 EAK Rewrote ORDNRY, SCHO, CCHO to be faster. + 3/31/79 993 EAK Added TE.EIM and TE.LIM. + 4/01/79 994 EAK Fixed bug in %PIATY interrupt handler. + 4/03/79 999 EAK Numerous changes to everything. Mostly completing the + TNX SUPDUP code. + 4/09/79 1000 EAK More changes for TNX SUPDUP code. Sort of hacky + at the moment. + 4/09/79 1001 EAK Wrote FINI, QUIT, and PROCED. Flushed C1FINI. + 4/10/79 1002 EAK Fixed bug %TOLID/%TOCID bug in SETUP4. + 4/12/79 1003 EAK Added more command character hackery. Hacked CC.FWD. + 4/20/79 1004 CBF Added VDM1 for Jerry Pournelle + 4/22/79 1005 CBF Added H19 + 4/22/79 1007 RWK Added TH6416 for NEAL (he wrote it, this is a merge) + 4/24/79 1008 EAK Fixed H2000 bug. + 4/24/79 1009 EAK Added some %TX code to SWSMI. Hacked ENTER/CMDCHR. + 4/25/79 1010 EAK Fixed bug in H19DEC. + 4/27/79 1011 EAK Added %FNEOL+%FNEOS to Xitex's TP.FLG. + 4/28/79 1013 EAK Reduced padding for Teleray 1061. TNX hackery. + 5/10/79 1015 EAK Changed VT100 definition a fair amount. + 5/17/79 1017 EAK Added CLEOL padding to T1061. + 5/18/79 1018 EAK Fixed NO BELL, added VT100 visbel. + 5/28/79 1019 EAK Added ANNARB and ADI60. + 5/29/79 1020 EAK Added tabs to ANNARB support. + 5/30/79 1021 EAK Added TEL3 for ELL. + 6/10/79 1022 EAK Added TLC for AUTHOR. + 6/12/79 1023 EAK Added PGA,GYRO's DD5200 code. + 6/18/79 1024 EAK Added SOL20 for LEWIS! and DEVON. + 6/18/78 1025 EAK Changed C1EOL and C1EOS to use Clear All. + 6/18/78 1026 EAK Added I200 for MACRAK. + 6/19/79 1027 EAK Changed SOL20 for DEVON. + 6/20/79 1028 EAK Added VT52 simulation. + 6/21/79 1029 EAK Added TNX JERR1 uuo for reporting JSYS failure returns. + 6/22/79 1030 EAK Added real TYITOG for TNX, added SIBEBUG stuff. + 6/22/79 1032 EAK Added more TNX error handling code. + 6/25/79 1034 EAK Debugged TNX PTY and INT code. TNX&STY&INT doesn't + work because SIBE doesn't appear to work on PTY + channels! TNX&INT doesn't work because .TICTI + doesn't leave interrupt character in input buffer! + 6/26/79 1036 EAK Stopped using IVORY in favor of SECTIONs. + 7/05/79 1037 EAK Fixed bug in TNX NET STYINI, CHNTAB definition, + changed IQ120 to use CCHO, and fixed missing + TE.EOL in SOL20 definition. + 7/09/79 1038 EAK Added C1TYI. + 7/10/79 1039 EAK CID option tells C100 support to use fixes for + insert/delete character. + 7/11/79 1040 EAK Changed SIMULATE default for TNX&STY to VT52. + 7/20/79 1043 EAK Merged in HARV's TUBE1.5. + 7/21/79 1044 EAK Added automatic login on TNX PTYs and open TTY: + instead of TTYnnn. + 7/21/79 1045 EAK Added ICMASK so DM2500 and T1061 input handlers can + hack meta bits. + 7/22/79 1046 DCH Added MIME. + 7/23/79 1047 EAK Added NO LOGIN option for TNX&STY. + 7/27/79 1048 EAK Fixed H19 per MT's request. + 7/28/79 1049 EAK Fixed SOL20 and TUBE1.5 per requests. + 7/28/79 1050 EAK Moved VTABS to utility section, added TYODEC utility. + 7/31/79 1052 EAK Merge several insert/delete lines in VT52 simulation. + 8/01/79 1053 EAK Added PURIFY routine for TNX. + 8/12/79 1055 EAK Added code to handle too many insert/delete + lines/characters. + 8/14/79 1056 EAK Added fair share to wholine, updated option listing, + change ICP to be to SUPDUP socket, made TNX TYIPUF and + SMIPUF better, and added %FSPD to H19 flags. + 8/16/79 1057 CBF Added HP2621 from HP2645 definition + 8/16/79 1058 EAK Added more comments, fixed %PIATY bug, hacked FRCV + to handle non-existant receive fork. Added REINIT + and NO FLUSH. + 8/16/79 1059 EAK Divided INT conditional into TINT and SINT for + TTY and STY. Got TTY input interrupts to work. + 8/21/79 1065 EAK Add ITS network code. Still needs work. + 8/22/79 1066 EAK Added TNX WHOLINE code. Fixed up VT52 simulator. + 8/23/79 1067 EAK Added a few .XCREFs. + 8/31/79 1069 EAK Added load average to TNX WHOLINE. + 9/04/79 1075 KLH Fixed bug in LP, TDDLP. Cvtted LP to TNX. + Added TYIPUC routine to centralize cmd-char check. + 9/05/79 1081 KLH Put in kludge code to make SIBE work with TINT. + Added IBUFIP. + 9/09/79 1084 EAK Added IQ140 for JAC. + 9/11/79 1085 EAK Fixed IBUFIP. + 9/12/79 1086 EAK Lots of little changes all over. Fixed TM.NLs + that used TYN instead of TYO. Re-ordered JCOPTs + and :CRTSTY ? listing. Renamed CLEOS to + STEOS and added NO CLEOL and NO CLEOS. Moved MOVC20 + label to right place. Bummed an instruction from + CC.TAB. Deleted H200 and H2LOSE CLEOL routines. + 9/13/79 1087 CBF Added Perkin-Elmer Bantam + 9/27/79 1088 EAK Added chaosnet code. +10/01/79 1089 CBF Made DM2500 cancel modes at initialization time +10/13/79 1090 CBF Added IBM 3101. +10/23/79 1091 EAK Fixed bugs in IBM 3101. +11/02/79 1092 EAK Conditionalized stuff in VTTYI on ITS\NET. +11/12/79 1093 EAK Added VT52 absolute positioning hack to VT52 simulation +12/03/79 1094 HIC Fixed some bugs in BANTAM support. Still needs work. +12/11/79 1095 EAK Added AAB for AQE (another Ann Arbor!). Also + changed TR.NRM to be just for horizontal wrapping. +12/13/79 1096 EAK Added %TDRSU/%TDRSD code. Not tested yet. +12/20/79 1100 RWK Added TE.SU entry for H19, made TE.INI reset auto-CR + and turn on the cursor! Flushed losing DELPHI spec + which was never finished and useless now anyway. + Added TX.WE, TX.WB, TX.WI, and TR.WHO, and gave H19 a + TR.WHO to use the 25'the line. +12/21/79 1101 EAK Changed around new wholine stuff. Fixed several bugs + in it (probably introduced a few). TP.WHO kludge + eliminated in favor of TR.WI. + 1/13/80 1109 EAK Added %TDRSU/%TDRSD code. + 1/24/80 1110 EAK Fixed a 20X TT%PGM bug. + 1/29/80 1111 EAK Turn on %TPRSC when %TOLID turned on. Fixed bug + at XDLP4 that caused random lossage sometimes. + 1/30/80 1112 EAK Added TR.FIN for H19 to prevent cursor from + being left on status line. + 1/30/80 1113 EAK Fixed bug in STYIP that prevented one character of + the input stream from being read! + 2/07/80 1114 EAK H19 wholine bug fix. + 3/30/80 1122 CBF Installed RLL's first cut at VT132. + 4/18/80 1125 EAK Added gross padding to VT132. + 5/07/80 1127 EAK Increased C100 insert/delete line padding a bit. + 5/23/80 1129 EAK Changed IQ140 insert/delete codes for JAC. + 5/25/80 1130 EAK Fixed H19 25th line problems with 20X SUPDUP version. + 6/08/80 1133 CBF Added TVI912 for DBK, put IQ120,140 in alpha order. + 6/21/80 1138 CBF Added AJ510 for GNU, installed BKD's Cromem 3101 + Had to up MAXTRMs from 80.! Set it to 120. + 6/27/80 1142 EAK Added CSK's VT05 code and removed RLJFN from PURIFY. + 7/12/80 1144 CBF Couldn't resist the amusement of adding DWARME's ACT-II + commented out due to CRTSTY lossage + 7/30/80 1150 CBF Added VIP7800 for MAXB + 8/5/80 1152 CBF The problem with the ACT-II and the VIP7800 was due + to Midas limits on constants. EAK made a new version + on MC which fixes it. In celebration I added, KTM2 + for MAXB, DG200 for JJK and INtertec-S for JWP. + ACT-II & VIP7800 should work now also. + 9/8/80 1162 RLL Added support for the AAA (Ann Arbor Ambassador) + terminal. There is no padding, but that might + change when it's tried out on the terminal. + 9/9/80 1167 EAK Fixed up AAA support a bit. Added TYOANS & TYNANS + UUOs. +11/1/80 1176 CBF Added ADM-31 for Stever +12/30/80 1187 EAK Fixed bug in TDICP. + 1/4/81 1188 EAK Added AUTONL option. + 1/6/81 1189 EAK Fixed bug in TD.IC. + 1/7/81 1192 RWK Fixed up AAA, added padding to CLEOS, and made it + always use absolute positioning, since as near as I can + tell the move forward and backwards commands don't work + in random cases. Sounds unbelievable, and I'll try + hacking it some other time. + 1/9/81 1193 EAK Fixed but in WHOOUT that caused H19 wholines and + SMEOL to lose together. +1/14/81 1197 RWK Hacked up on AAA. Will try the Move Horizontal Relative + command instead of the Forward Cursor, and see if that + works. Made it set mode to ensure clear screen actually + clears, even if there are protected fields. Determined + that the clear-screen command cannot work at 9600 baud + since it does not home up until after the padding is + done and it puts characters at the cursor as it moves + the cursor (or some such lossage). I.e. if you make it + pad for 2 seconds, the screen clears, the cursor frobs + away at the bottom of the screen while padding happens, + a few characters are placed partway up the screen, and + then finally the rest make it to the top. Probably a + bug in the ucode, not an inherent flaw.... + Probably the padding needs to be adjusted according to + the screen size. +2/4/81 1198 BEE Fixed AAA to set the screen size correctly. Also why is + the tab setting commented out? +3/6/81 1208 EAK Fixed H19 problem with CRTSTY --> prompt and + redisplay. +3/7/81 1209 EAK Wasn't good enough; another try. +3/15/81 1210 EAK Fixed up ITS network code to install a SCRTSTY. +5/5/81 1219 EAK Added KTM3 for ELF. +8/21/81 1236 LRH Added VISBEL to KTM3 and comments for ADM2 +8/21/81 1237 LRH Fixed bug caused by code added in 1236 +9/9/81 1238 CBF Added ADDS viewpoint, changed ADS100 to make it work? +11/8/81 1242 GNU Fixed VT132 enter/exit insert (reversed), standout. +11/8/81 1243 EAK Added ADDS25 for RMS (EMACS user request). +11/9/81 1244 GNU Added ENTER C to send control chars user can't make. + Also fixed VT100 VISBEL. +11/19/81 1246 CBF,EAK Added ISC800 for FJW. +11/21/81 1248 EAK Worked on Ambassador code a little. +12/25/81 1250 CHIRON Cleaned up some Chaos code. Can now use TINT&CHAOS + without spurious error messages. When Chaos + host breaks connection, CRTSTY handles it + properly. Added ADM5 terminal (per best + documents available). Attempted to make Chaos + code interupt driven (CHAOS&SINT&TINT), but + Twenex seems wedged. + 1/6/82 1254 CHIRON Fixed ADM5 Definition. + 3/27/82 1257 RWK Visibel for AAA + 3/27/82 1259 RWK JRTR6F was making caller skip instead of self, so + :AAA ... would kill itself rather than assume AAA. + 3/27/82 1260 RWK AAA -- Fixed standout mode to work with inverse video, + made wholine use it. + 4/4/82 1264 RWK AAA: Fixed wholine to use standout mode on all of the + wholine, including the part initially drawn. Make + VISBEL not un-invert it. + 4/21/82 1270 CHIRON Fixed ADM5 definition to be 80x24. Users are + should run with auto-NL off, and perhaps tell CRTSTY + to only use 79 columns. + 4/27/82 1271 LRH Changed KTM-3 bell code to use new bell character. + 8/16/82 1272 CBF Added Lunar for Moon's terminal. + 9/20/82 1273 CAH Fixed VIP7800 tab setting. + 1/03/83 0930 CAH Fixed VIP7800 at end of line. + 2/22/83 1277 EBM Added Kimtron ABM-85 terminal, a slightly hacked TVI920 +11/22/83 1281 KLH Merged in TCP/IP for 20X. +12/03/83 1294 KLH Added META, speed options; partial-match JCL; + fixed LP simulate, cleaned up variousness. +12/08/83 1309 KLH Added many comments & did some cleanup. Renamed some + stuff. New runtime command stuff. +03/15/84 1347 GRUPP Fixed ADDS25 to work in either page or scroll mode. + Added VIS50, a Visual 50. +07/02/84 1348 CBF Put obnoxious warning message in for AAA -- + telling user he'd rather use TCTYP +08/02/85 1374 GUMBY Fix AJ5 to use decimal cursorpos for TYSON +05/31/86 1376 GUMBY Add obnoxious warning like above for h19 losers + +History: ; This is here for the TAGS package to find where to + ; add new history entries +~ + +subttl Things-to-do + +comment ~ To Be Done (someday)?: + Not all of these things are, of course, realistic. + +Fix metizer and controlizer runtime commands so that unusual chars +are properly echoed. Current code just sends back to terminal, which +can really screw it up for control chars etc! + +Extend NVT and TELNET operation to permit transparent/binary connections. + Probably want the following modes: + INPUT (User to remote host) + A. Fully transparent (binary mode) 8-bit bytes from terminal + B. Semi-transparent - binary mode, 7-bit bytes from terminal + C. Normal (not binary mode), 7-bit bytes from terminal. + CRs should be followed by NULs. + + OUTPUT (Remote host to user) + A. Fully transparent (binary mode) - 8-bit bytes from net, sent to term + B. Semi-transparent (binary mode) - 8-bit bytes from net, 7 bits to TTY + C. Normal direct (not binary mode) - 7 from net, 7 to TTY, no interp. + D. Opaque - 7 from net, let OS handle output controls. + E. CRTSTY - 8/7 from net, CRTSTY manipulates TTY. + F. NVT - ignore anything not part of NVT output set. + +Provide equivalent IPSCAL capability for other direction, i.e. TYI/SMI asks +SMO/TYO to do something (not just freeze). This would solve LP's +problem of finalizing mouse cursor position. +May want to have interrupt insert a JRST or CALL into an impure +location that inferior loop always goes through. + +Maybe redo naming conventions for modules, to make more consistent +and easier to remember: + Simulation/Emulation Support + Input stream ISM,ISE,IEM,IPY ISP,ISS,ITY + PYO,SYO,SMI,SIS TYI,,,TIS + ISS,ISP,PIS IST,,TIS + ISO ISI + + Output stream OSM,OSE,OEM,OPY OSP,OSS,OTY + PYI,SYI,SMI,SOS TYO,,,TOS + OSS,OSP,POS OST,,TOS + OSI OSO + + sbout< >call td.xx> >tbout + + smoput< >call td.xx> >tyoput + + sbout< >call td.xx >tbout + + smiput< >call td.xx> >tyoput + + smibout< >call td.xx> >tyobout + + +New JCL option: META. + Fix META-bit processing. Escape becomes meta-^@. + Allow site-dependent frobs, eg at SRI, most Dm2500's have + an EDIT key. + For ITS, check %TPMTA of controlling TTY so can automatically + enable it? Does super-image input mung the 8th + bit if %TPMTA is set? + +Add support for %TOOVR terminals. + +Make tabstop setter more general, have "set-tab" terminal-table entry +as well as "clear-tab" (or "clear-all-tabs") or something. + +MOVCUR Optimizer - variable-size tab calculations? + +Figure how to have efficient distinction between +a) neither atomic nor simulate exist. +b) atomic commands, no simulate +c) no atomic, uses simulate. +d) atomic cmds exist, but shorter simulate also exists. +(assmption is that a longer-than-atomic simulate will never want +to exist!) + +Separate universal term flags into LH of F, dependent flags into RH +(or define mask range for them) + +Store line sum counts in front of SCREEN? For easier check-EOL-ing; +not hard to do, but saving may be trivial. + +Must remember MODE that terminal is in; some terms have many different +modes with different ways of exiting each. (upon entry to mode, store +vector to getting out of mode?) + +CRTSTY test program? either routine in CRTSTY, or program using ^P +codes? (or program feeding it software codes directly? 2 sty's in a row...) +see KLH;CRTEST > + +Detach sty when tty disappears. May need more ITS support. + +Check %TANJS bit of STYGET call? Or somehow detect when the ^Z sent to +STY isn't getting a hactrn; this could be a big loss if it +hangs up crtsty forever. + +Debug script file. normal feedthru chars all on one line, all 2xx +chars given as: + | .. move h,v -> nh,nv + (chars sent) (description) +~ + +subttl Definitions + +IF1 { +$$ask==0 ; Normally don't ask questions, use current system. +its==1 ; Allow these two systems +tnx==1 +.insrt system +} ; IF1 + +ifndef sty, sty==0 ; STY device output +ifndef net, net==0 ; NET device output (i.e. a TELNET or SUPDUP) +ife sty\net, sty==its ? net==1-sty ; If neither specified, + ; Default to STY on ITS, NET otherwise. + +ifndef tint,tint==its\20x ; 1= Input stream driven by TTY input interrupt + ; (TENEX loses here) +ifndef sint,sint==its\<20x&sty> ; 1= Output stream driven by STY/NET input + ; interrupt +ifn net,{ + ifndef tcp, tcp==1 ; Use TCP, not NCP, if NET. + ifndef ncp, ncp==<1-tcp> + ifndef chaos, chaos==1 +} +ife net, ncp==0 ? chaos==0 ? tcp==0 + +; The SIBEBUG hack is necessary because SIBE returns the wrong # of bytes for +; some kinds of input. Specifically it loses for TENEX PTY/NET input and for +; TOPS-20 NET input. Evidently it does work for TOPS-20 PTYs now. +; Basically if SIBEBUG is set, input from the PTY/NET must be read in a +; byte at a time, and only if SIBE doesn't skip. This of course makes +; for pretty gross inefficiency. +ifndef sibebug, sibebug==10x\<20x&net> + +ifndef histohack, histohack==0 ; 1 to enable histogram cnt of chars by value + +F=:0 ; AC of flags +A=:1 ; A-E are used for arguments and return values. +B=:2 ; In general these ACs are preserved across subroutine calls. +C=:3 +D=:4 +E=:5 +Z=:6 ; Random MOVCUR AC +CP=:7 ; Cursor motion hack stack +V=:10 ; "Actual" current vertical position +H=:11 ; "Actual" current horizontal position +VH==:V ; VH refers to the pair V,H +NV=:12 ; "New" virtual positions +NH=:13 ; "New" virtual positions +NVH==:NV ; NVH refers to the pair NV,NH +T1=:14 ; temporaries, not saved by UUOs, subroutines, or macros +T2=:15 ; ... + ; 16 unused! +P=:17 ; PDL pointer + +.XCREF F,A,B,C,D,E,V,H,NV,NH,T1,T2,P + + +; ACs for .I/.F +A0==:T1 +A1==:T2 + + +IFN ITS,{ +; I/O channel assignments. +tyon==:2 ; Console terminal output during startup +pbout==:<.iot tyon,a> ; Hack for reducing conditionals! + +tyic==:3 ; Input from supported terminal (Superimage) +tyoc==:4 ; Output to supported terminal (Superimage) + +ifn net&ncp, icpch==:5 ; ICP channel, PYI/PYO must be ICPCH+2/ICPCH+3 + +pyi==:7 ; Input from sty/net (some program outputting to TTY) +pyo==:pyi+1 ; Output to sty/net (some program reading typein from TTY) + +dsko==:12 ; channel for various disk outputs. +} ; IFN ITS + + +; F flag values, LH (see TRMFLG for RH values) + +; These flags used for setting bucky-bit input. +%imeta==400000 ; For input, metize next char +%itop== 200000 ; topify next char +%ictrl==100000 ; controlify +%imtc==%imeta+%itop+%ictrl +%ipesc== 40000 ; Indicate ESC key seen (preceding current) +%ipesq== 20000 ; Indicates ESC-? (for VT terms) + +%ipcts== 10000 ; for ^S/^Q hacking by RPVT52 +%clpnd== 4000 ; 1 => CLEOL pending +%icm==: 2000 ; insert character mode + +IFN TNX, IF1 EXPUNGE DTI + +ifndef maxver,maxver==70. ; max value for vertical screen size (SHEIGHT) +ifndef maxhor,maxhor==140. ; max value for horizontal screen size (SWIDTH) + +IFE ITS\.ITS,{ +;NOW COME THE BITS OF THE CHARACTER ITSELF: +%TXTOP==:4000 ;"TOP" KEY. +%TXSFL==:2000 ;"SHIFT-LOCK" KEY. +%TXSFT==:1000 ;"SHIFT" KEY. +%TXMTA==:400 ;"META" KEY. +%TXCTL==:200 ;"CONTROL" KEY. +%TXASC==:177 ;THE ASCII PART OF THE CHARACTER. + +%TNPRT==:0 ;PRINTING TTY. +%TNDP==:1 ;TTY USES DATAPOINT CURSOR CTL CODES. +%TNODP==:2 ;TTY IS A LOSING DATAPOINT. +%TNIML==:3 ;TTY USES IMLAC CURSOR CODES. +%TNTEK==:4 ;TEKTRONIX 4000 SERIES +%TNTV==:5 ;TTY IS A KNIGHT TV DISPLAY. +%TNMEM==:6 ;TTY IS A MEMOWRECK. +%TNSFW==:7 ;"SOFTWARE" TTY THAT WANTS I.T.S. CURSOR-MOTION CODES. +%TNTRM==:10 ;TTY IS A TERMINET. +%TNESC==:11 ;TTY WANTS ASCII STANDARD ESCAPE SEQUENCES. (E.G. VT52) +%TNDTM==:12 ;DATAMEDIA +%TNMAX==:13 + + +;TTYOPT WORD DESCRIBES CHARACTERISTICS OF THE PARTICULAR +;TERMINAL ATTACHED TO EACH LINE. + +;LEFT HALF BITS ARE: +%TO==:1,,525252 ;BIT TYPEOUT MASK +%TOALT==:200000 ;4.8 => STANDARDIZE ALTMODES. +%TOCLC==:100000 ;4.7 => CONVERT LOWER CASE TO UPPER. +%TOERS==:40000 ;4.6 => THIS TTY CAN SELECTIVELY ERASE. +%TOHDX==:20000 ;4.5 => THIS TTY IS HALF-DUPLEX. +$TOHDX==:370100 +%TOMVB==:10000 ;4.4 => THIS TTY CAN BACKSPACE. +%TOSAI==:4000 ;4.3 => THIS TTY HAS SAIL CHAR SET ON OUTPUT. +%TOSA1==:2000 ;4.2 INIT %TSSAI OF NEW JOBS. +%TOOVR==:1000 ;4.1 => THIS TTY CAN OVERPRINT SUCCESSFULLY. +%TOMVU==:400 ;3.9 => THIS TTY CAN MOVE CURSOR UP (I.E. IT'S A DISPLAY). +%TOMOR==:200 ;3.8 => DO **MORE** PROCESSING ON THIS TTY + ;(ACTUALLY JUST USED TO INIT %TSMOR FOR NEW JOBS). +%TOROL==:100 ;3.7 SIMILARLY, INIT %TSROL FOR NEW JOBS. +%TORAW==:40 ;3.6 => SUPPRESS CURSOR MOTION OPTIMIZATION. +%TOLWR==:20 ;3.5 => THIS TTY HAS LOWER CASE KEYBOARD. +%TOFCI==:10 ;3.4 => KEYBOARD CAN GENERATE FULL 12-BIT CHARACTER SET +%TOIML==:4 ;3.3 => SPACE, BS DON'T EQUAL ^PF, ^PB; ALSO ^PC SENDS ^L. +%TOLID==:2 ;3.2 => %TDILP, %TDDLP WORK (INSERT AND DELETE LINES) +%TOCID==:1 ;3.1 => %TDICP, %TDDCP WORK (INSERT AND DELETE CHARACTERS) + +;RIGHT HALF: +%TP==:707252 ;BIT TYPEOUT MASK +%TPPLF==:100000 +$TPPLF==:170300 ;3-BIT FIELD SAYING HOW TO PAD LF. + ;0 - DON'T. 1 - MEMOWRECK, 2741. 2 - TERMINET. +%TPPCR==:10000 +$TPPCR==:140300 ;3-BIT FIELD SAYING HOW TO PAD CR. + ;7 - UNUSED. 6 - MEMOWRECK. 5 - 2741. 4 - EXECUPORT. + ;0 - DON'T. 1 - NORMAL. 2 - DOUBLE. + ;ON DATAPOINTS, = # CHARS PADDING NEEDED FOR ALL CURSOR MOTION. + ;4 IS RIGHT FOR 2400 BAUD; 3, FOR 1200. + ;ON TERMINETS, 0 => NO PADDING, ELSE a,2,3,4,5 + ;ARE PADDING FOR SPEEDS 10,15,30,60,120 CPS. +%TPPCW==:6 ;FOR MEMO WRECK. +%TPPTB==:1000 +$TPPTB==:110300 ;3 BIT FIELD SAYING HOW MUCH PADDING NEEDED AFTER TAB. + ;0 => TABS NOT ALLOWED; ELSE 1 +<# PADDING CHARS NEEDED> + ;BUT ON A DISPLAY, TABS ARE NEVER PADDED AND THIS FIELD IS + ;1 TO USE TABS, 2 TO USE ABSOLUTE CURSOR POSITIONING, + ;3 TO USE BOTH, 0 TO USE NEITHER. +%TPMTA==:400 ;1.9 => treat bit 1.8 of input characters as the meta bit. +%TPPRN==:200 ;1.8 => INTERCHANGE () WITH [] ON INPUT +%TPTEL==:100 ;1.7 => HANDLE CR-LF ON INPUT AS CR, FOR TELNET PROTOCOL +%TPCBS==:40 ;1.6 => ENABLE SPECIAL HANDLING OF CONTROL BACK SLASH ON INPUT + ;(THE "INTELLIGENT TERMINAL PROTOCOL"). +%TP11T==:20 ;1.5 => PDP-11 TV TTY. REFLECTS %TY11T. + ;NOT SETTABLE BY USER. +%TPORS==:10 ;1.4 => OUTPUT RESET ON THIS TTY SHOULD REALLY DO SOMETHING. +%TPRSC==:4 ;1.3 => THIS TTY SUPPORTS %TDRSU, %TDRSD +} ; IFE ITS\.ITS + +subttl Macros + +; Make use of some winning macros. + +ifn its, .insrt syseng;$call macro + +%%%asc==:1 ; use winning ASCNT +ifn .its, .insrt ksc;macros > +ife .its, .insrt macros + +call=: ; saves typing +return=: +;pjrst==:jrst ; CALL FOO ? RETURN +paoja==:aoja ; ADDI AC,1 ? CALL FOO ? RETURN +.xcref call,return,pjrst + + +define movx #ac,con +ife con򽸱, movei ac,con ? .stop +ife con&777777, movsi ac,(con) ? .stop + move ac,[con] +termin + +IFNDEF KA,KA==1-20X + +IFN KA,{ +IF1 { +define dmove ac,m + ac ? m +termin +equals dmovem,dmove +equals fltr,dmove +} ; IF1 +IF2 { +define dmove #ac,m +ifn m&20000000, .err DMOVE macro can't hack indirection + move ac,m + move ac+1,m+1 +termin + +define dmovem #ac,m +ifn m&20000000, .err DMOVEM macro can't hack indirection + movem ac,m + movem ac+1,m+1 +termin + +define fltr #ac,m + move ac,m + fsc ac,233 +termin +} ; IF2 +} ; IFN KA + + +define say &string& + move t1,[ascnt string] + call typasc +termin + +define saycr &string& + move t1,[ascnt string] + call typasc + call typcr +termin + +; SLEEP - Macro to sleep tenths of a second. Clobbers A. +IFN ITS,{ +define sleep t + movx a,t*3. + .sleep a, +termin +} ; IFN ITS +IFN TNX,{ +define sleep t + movx a,t*100. + disms +termin +} ; IFN TNX + +IFN 0,{ +.defmac ivar ; tell @ that IVAR defines its argument +.defmac mvar ; tell @ that MVAR defines its argument +.defmac tvar ; tell @ that TVAR defines its argument +.defmac svar ; tell @ that SVAR defines its argument +} + +define inform a,b,c,d,e,f,g + printx á!b!c!d!e!f!g +Š termin + +define section name +$sect +loc name +define $sect +name==. +termin +termin + +; Start off with SECTION MAINVAR. +define $sect +mainvar==. +termin + + +init== 0+<22.*2000> ; leave 22K for variables and screen images +initvar==init+<5*2000> ; leave 5K for initialization section +main== initvar+<1*2000> ; leave 1K for initialization variable section + +;fmvpg==:0 ; First MAINVAR page +fipg==:init/pg$siz ; First INIT page +fivpg==:initvar/pg$siz ; First INITVAR page +fmpg==:main/pg$siz ; First MAIN page + + +IFN 0,{ +define mvar v1,v2,v3,v4 + irp v,,[v1,v2,v3,v4] + irps s,c,[v] + s=:mainvar + ifse [c][] mainvar==mainvar+1 ? .istop + irpnc <.length "s">+1,<.length "v">-<.length "s">-2,1,l,,[v] + mainvar==mainvar+ + termin + .istop + termin + termin +termin +} +.ELSE { +equals mvar,.scalar ; .SCALAR is presumably faster, so use it in + ; place of MVAR since it occurs most often +} + +define ivar v1,v2,v3,v4 + irp v,,[v1,v2,v3,v4] + irps s,c,[v] + s=:initvar + ifse [c][] initvar==initvar+1 ? .istop + irpnc <.length "s">+1,<.length "v">-<.length "s">-2,1,l,,[v] + initvar==initvar+ + termin + .istop + termin + termin +termin + +equals tvar,mvar +equals svar,mvar + +subttl Part I - Initialization +subttl Purification + + +patch: pat: block 40 ; patch area +debug: 0 ; set positive for any runtime debug switching + +prgnam: IFN NET,ascnt "CTN" + .else ascnt "CRTSTY" +constants +SECTION INIT + +IFN ITS,{ +; Use PURIFYG to purify CRTSTY before dumping. +purify: move a,[,,sipg] ; flush screen image pages + $call corblk,[#0,#%jself,a] ; ... + .lose %lssys + move a,[-,,fipg] ; purify INIT pages + $call corblk,[#%cbndr,#%jself,a] + .lose %lssys + move a,[-,,fmpg] ; purify MAIN pages + $call corblk,[#%cbndr,#%jself,a] + .lose %lssys +IFN STY,{ + .value [asciz ": Purified, now dump... +:PDUMP DSK:SYSBIN;CRTSTY BIN"] +} +IFN NET,{ + .value [asciz ": Purified, now dump... +:PDUMP DSK:SYSBIN;CTN BIN"] +} +} ; IFN ITS +IFN TNX,{ +IFN 20X,{ ; T20 EXEC does SAVE properly, retains page access bits. +purify: move p,[-lpdl,,pdl-1] ; set PDL pointer + move a,[-,,fipg] ; INIT pages + call purifp + move a,[-,,fmpg] ; MAIN pages + call purifp + haltf ; Purified, done. + jrst crtsty + + ; Purify pages, given AOBJN ptr to same. +purifp: pushae p,[b,c] + skipl c,a + jrst purif9 + hrli a,.fhslf + movsi b,(pa%rd+pa%ex) ; Permit read/execute only. +purif2: hrri a,(c) + spacs ; Do it! + aobjn c,purif2 +purif9: popae p,[c,b] + return + +} ;IFN 20X + +IFN 10X,{ ; TENEX EXEC is stupid about SSAVEing with same access, + ; so must do the save ourselves. +purtab: -sipg,,ss%cpy\ss%rd\ss%exe\0 ; MAINVAR pages + -,,ss%rd\ss%exe\fipg ; INIT pages + -,,ss%cpy\ss%rd\ss%exe\fivpg ; INITVAR pages + -,,ss%rd\ss%exe\fmpg ; MAIN pages + -<512.->,,ss%rd\ ; symbol table pages + 0 + +purify: move p,[-lpdl,,pdl-1] ; set PDL pointer so can use error UUO + movei a,.fhslf ; SEVEC arg: A = process handle + move b,[1,,crtsty] ; SEVEC arg: B = length,,address + sevec ; set entry vector + move a,[gj%sht+.fvers] ; GTJFN arg: A = bits,,default version +IFE STY,{ +ifn 20x, hrroi b,[asciz "CRTSTY.EXE"] +ifn 10x, hrroi b,[asciz "CRTSTY.SAV"] +} +IFN STY,{ +ifn 20x, hrroi b,[asciz "PCRTSTY.EXE"] +ifn 10x, hrroi b,[asciz "PCRTSTY.SAV"] +} + ; GTJFN arg: B = filename + gtjfn ; get JFN to CRTSTY save file + jerr1 [asciz "Unable to assign JFN - "] + hrli a,.fhslf ; SSAVE arg: A = fork handle,,JFN + movei b,purtab ; SSAVE arg: B = table address + movei c,0 ; SSAVE arg: C = flag bits + ssave ; dump ourself + haltf +} ; IFN 10X +} ; IFN TNX + +subttl Startup - Main init routine + +crtini: movei f,0 ; initialize flags + call osinit ; operating system dependent initialization + call jclpar ; parse command line to get terminal type, + ; TTY no., etc. + jrst logout ; error in command line + call ttyini ; Open TTY, initialize some options + call jclpar ; Parse command line again, this time + ; for rest of options + jrst logout ; error in command line + call ttyoin ; TTY output initialization + call trmchk ; Check out the "support" terminal spec + call trmini ; Set up parameters for supported terminal! + call scrini ; Initialize screen image + call simchk ; Check out "simulate" terminal spec + call simini ; Set up initial params for simulated terminal (styini + ; or netini may re-do this) + +IFN STY,call styopn ; Open STY and get info about it. +IFN NET,{ + call netcnf ; Set up net protocol configuration stuff + say "Trying..." + call netopn ; Open net connection, set up info. + saycr "Open" + call netini ; Initialize (including negotiations) +} ;IFN NET + call smiini ; Initialize SMI co-routine + +IFN ITS&STY,setom cmdchr ; ITS CRTSTY has no command char. +.ELSE movei t1,^^ ? movem t1,cmdchr ; All other cases + + setzb h,v ; Initialize both sets of cursor coords + dmove nvh,wmin + xct .trini+tb ; Initialize terminal (must clear screen, + ; reset window, leave insert mode) + ; See "Notes about Terminal-table entries"!! +ifn sty,call whoini + call tyofrc ; Ensure all TTY output forced out + + skipl jsii ; NO SII specified? Skip if so. + jrst [ skipg jsii ; SII specified? + skipg debug ; and DEBUG not specified? + call sii ; then use Super-Image Input. + jrst .+1] +IFN ITS,.close tyon, ; don't need this any more +IFN NET,{ + skiple jattach ; ATTACH specified? + call attach ; Do it only if explicitly requested. +} ; IFN NET +IFN STY,{ + skipl jattach ; NO ATTACH specified? Skip if so. + jrst [ skipg jattach ; ATTACH specified? Do it by default. + skipg debug ; No. Last check, don't attach if debugging + call attach ; Make ourselves top-level + jrst .+1] + skipg jslave ; SLAVE specified? Don't even ^Z (or ^C) if so. + jrst slogin ; Nope, so log in the STY. + ; See comments at SLOGIN which explain why this + ; has to be a JRST... stack becomes useless. +} ;IFN STY + ret ; Return to non-INIT section to + ; perform final CRTSTY initialization + +; Startup of initialization. +constants +SECTION MAIN + +lpdl==100 ; Length of PDL +mvar pdl(lpdl) ; PDL +mvar oncefl ; Once-only flag + +; CRTSTY starts here! + +crtsty: skipe oncefl + jrst [ saycr "Restarting is not possible." + jrst logout] + setom oncefl + move p,[-lpdl,,pdl-1] ; initialize PDL pointer + call crtini ; Perform lots of once-only init. + + ; All set up, now operate at interrupt level. + call trmfls ; OK, now flush core pages of unused terms + move a,[,,fipg] +IFN ITS&NET, skiple jflush ; For an ITS SUPDUP, keep ANALYZE around +IFE ITS&NET, skipl jflush ; NO FLUSH specified? + call corfls ; no, so flush unneeded pages. + + ; Enable remaining interrupts: realtime and input. +IFN ITS,{ +IFE TINT&SINT, .err No interrupts? + move a,[600000,,[clkfrm]] + .realt a, ; Set clock frame + jfcl + move a,[-2,,[ + .simask,,[%pirlt] ; enable .realt interrupt + .sadf2,,[1_pyi+1_tyic] ; undefer tyi, pyi ints + ]] + .suset a + + ; Now do all the work at interrupt level. +IFE STY,{ + jfcl ; hang around forever + .hang ; ... +} ; IFE STY +IFN STY,{ + skipg jslave ; supposed to be slave? + jrst noslav + jfcl ; slave, so hang forever + .hang +noslav: skipl @ttysts ; Wait until TTY becomes free + .hang + .suset [.sidf2,,[<1_tyic>\<1_pyi>]] ; disable interrupts + jrst quitng +} ; IFN STY +} ; IFN ITS + +IFN TNX,{ +IFE TINT\SINT,{ + ; No interrupts to be used at all, so must start up inferior + ; fork to handle the Output Stream process (SMO+TYO). + move t1,[iftlev,,iftint] ; create inferior fork termination + movem t1,chntab+.icift ; handler + move t1,[ipslev,,ipsint] ; Ditto to process "do" requests + movem t1,chntab+ipschn ; from inferior fork. + movei a,.fhslf ; AIC arg: A = fork handle + move b,[<1_<35.-.icift>>\<1_<35.-ipschn>>] ; B = channel mask + aic ; activate inferior fork termination + ; interrupt +irp x,,[f,nv,nh,v,h,p] + movem x,acblk+x ; pass ACs to simulation input process +termin + movsi a,(cr%map\cr%st\cr%acs) ; CFORK arg: LH A = control bits + hrr a,.trsmo+tb ; RH A = start address (SMO module) + movei b,acblk ; CFORK arg: B = AC block address + cfork ; create simulation input fork sharing our + ; address space, start up output process. + jerr1 [asciz "Error creating inferior fork - "] + ; don't use stack until TYIINI! + movem a,rcvfrk ; CFORK result: A = fork handle + ; RPCAP arg: A = fork handle + rpcap ; read process capabilities + ; result: B = possible capabilities, + ; C = enabled capabilities + tlo b,(sc%sup) ; allow simulation input fork to interrupt + tlo c,(sc%sup) ; us + epcap ; set process capabilities + jrst tyiini ; Now go start the Input Stream process, + ; by initializing TYI module! +} ; IFE TINT\SINT + +IFN TINT\SINT,{ + ; Use interrupts for Input (and maybe Output) streams! + ; This means interrupting on TTY input and PTY (or NET) input. + ; TENEX cannot do this because it has no such thing as .TICTI + ; (interrupt on any typein), but TOPS-20 can. + + ; If it is desired to have only one stream using interrupts, this + ; is only really do-able if the Input stream (TTY input) interrupts + ; and STY/NET input doesn't, because TTY input must always have + ; higher priority. +IFE TINT, .err TINT=0 and SINT=1 cannot work! + + move a,[ipslev,,ipsint] ; Set up handler for Input-Process level + movem a,chntab+ipschn ; reqs from Output Process. + movei a,.fhslf ; AIC arg: A = fork handle +IFE SINT,move b,[<1_<35.-ttychn>>\<1_<35.-timchn>>\<1_<35.-ipschn>>] +IFN SINT,move b,[<1_<35.-ttychn>>\<1_<35.-timchn>>\<1_<35.-ipschn>>\<1_<35.-smochn>>] + ; AIC arg: B = channel mask + aic ; enable TTY, timer, IPS, and maybe PTY interrupts + movei a,.fhslf ; STIW arg: A = fork handle + movx b,1_<35.-.ticti> ; STIW arg: B = terminal interrupt word + movei c,0 ; STIW arg: C = deferred interrupt word + stiw ; interrupt on all characters + movei a,.fhslf ; IIC arg: A = fork handle +IFE SINT,move b,[<1_<35.-ttychn>>] +IFN SINT,move b,[<1_<35.-ttychn>>\<1_<35.-smochn>>] + ; IIC arg: B = channels to interrupt on + iic ; Fire initial interrupts to catch anything + ; that might have happened prior to AIC/STIW. +IFN SINT, wait ; Now do everything at interrupt level! +IFE SINT, jrst @.trsmo+tb ; Go to SMO module as main loop + ; for Output Stream process. +} ; IFN TINT\SINT +} ; IFN TNX + +constants +SECTION MAINVAR + +bughlt: 0 ; Called by JSR BUGHLT for fatal errors +IFN ITS, .lose +IFN TNX,{ + hrroi 1,[asciz "Fatal CRTSTY error! Check location BUGHLT/ +"] + psout + haltf + jrst .-1 +} +SECTION INIT ; Revert to initialization code section + +subttl Operating system initialization + +IFN ITS,{ +osinit: move a,[-lintpdl,,intpdl-1] ; initialize interrupt PDL + movem a,intpdp ; ... + setzm iocvec ; no IOC error handler yet + move a,[-24.,,[ + .roption ? tlo %opint+%opopc ; turn on new style ints + .roption ? movem option + .rmask ? movei %piioc ; enable interrupts + .rmsk2 ? movei 0 ; ... + .rdf1 ? movei 0 ; and set defer words + .rdf2 ? movei 0 ; ... + .rcnsl ? movem cnsl ; get console TTY no. + .runame ? movem uname + .rjname ? movem jname + .ruind ? movem uind + .rxuname ? movem xuname + .rxjname ? movem xjname + ]] + $call usrvar,[#%jself,a] + .lose %lssys + .i ttynum=cnsl ; default TTY supported to our console + $call open,[#tyon,[sixbit/tty/]][][#.uao] + .lose %lsfil ; Normal unit output to TTY + hlrz a,uname ; get LH of uname + cain a,-1 ; not logged in? + jrst [ saycr "You must log in to use CRTSTY" + jrst logout] + + move e,xjname ; JRTR6F arg: sixbit name + call jrtr6f ; is XJNAME some terminal name? + setz a, ; No, so zap... + hrrzm a,trmadr ; yes, set terminal to use. + + move a,option ; get OPTION variable + tlnn a,%opcmd ; command for us? + jrst [ skipe trmadr ; No, barf unless terminal selected by xjname. + jrst .+1 + call cusage ; Barf politely. + call dohelp + jrst logout] + move a,[jclbuf,,jclbuf+1] ; clear command line buffer + setzm jclbuf ; ... + blt a,jclbuf+/5-2 ; ... + movsi a,(ascii " +") ; put CR at end of command line buffer + movem a,jclbuf+/5-1 ; ... + .break 12,[5,,jclbuf] ; get command line from superior + call wrtlog ; Write log file entry with cmd line. +ifn histohack, call histo + + move b,[squoze 0,%TDMAX] ; Find highest software code + .eval b, + .lose %lssys + caile b,%tdmax ; see if system has same ideas we do. + jrst [ saycr "Warning: Some display codes may not work. +Send mail to BUG-CRTSTY@MC about this!" + jrst .+1] + + move a,[squoze 0,LUBLK] ; find length of a user-var block + .eval a, + .lose %lssys + movem a,lublk + imul a,uind ; find position from start of user-var storage + movem a,myuind ; save in case later need + + movei a,syspg + movem a,syspno + + move a,[squoze 0,TIME] + movei b,0 + call itsmap + movem a,time + + move a,[squoze 0,APRC] + move b,myuind + call itsmap + movem a,aprc + + move a,[squoze 0,SUPPRO] + move b,myuind + call itsmap + movem a,suppro + + return +} ; IFN ITS + +IFN TNX,{ + +osinit: reset ; initialize system's data for this fork + ; (this does an automatic CIS so that's not + ; needed below) + movei a,.fhslf ; RPCAP arg: fork handle + rpcap ; read our capabilities + ; results: B = possible capabilities, + ; C = enabled capabilities + tlo c,(sc%ctc\sc%gtb) ; turn on control-C intercept and + epcap ; GETAB capabilities + gjinf ; get job specific information + movem a,ldir ; directory no. logged in under + movem d,cnsl ; GJINF val: terminal no. associated with + ; this job (or -1 if detached) + setom ttynum ; default to using TTY: instead of TTYnnn: + move t1,[chntab,,chntab+1] ; zero channel table + setzm chntab ; ... + blt t1,chntab+35. ; ... + movei a,.fhslf ; SIR arg: process handle + move b,[levtab,,chntab] ; SIR arg: level table,,channel table + sir ; set channel and level table addresses + eir ; enable interrupt system + setzm siiset ; no superimage input yet +; Get command line. +IFN 20X,{ + movei a,0 ; RSCAN arg: 0 to read last string + rscan ; put command line in input buffer + jerr1 [asciz "Error reading command line - "] + movn c,a + ; skip over 1st word of command line +os1: aojge c,os9 ; nothing more to read? + pbin ; get next character + cain a,^J ; LF? + jrst os9 ; yes, no real command line + caie a,40 ; space? + jrst os1 ; no, keep going + movei a,.priin ; SIN arg: A = source designator + move b,[440700,,jclbuf] ; SIN arg: B = B.P. + ; SIN arg: C = -count + sin ; read command line into command buffer + movei a,^M ; replace LF at end of string with CR + dpb a,b ; ... +} ; IFN 20X +IFN 10X,{ + movei a,.priin ; BKJFN arg: A = JFN + bkjfn ; backup one character in input stream + jrst os0 ; can't, oh well + pbin ; get last character typed + cain a,37 ; CR? + jrst os9 ; yes, no command line +os0: move b,[10700,,jclbuf-1] ; byte pointer to command line buffer +os1: pbin ; get next character + cain a,37 ; CR? + jrst os2 ; yes, we're done + cain a,177 ; RUBOUT? + jrst [ camn b,[10700,,jclbuf-1] ; yes, nothing to rubout? + jrst [ movei a,^G ; nothing, PBOUT arg: character + pbout ; feep at user + jrst os1 ] ; keep reading + ldb a,b ; get character rubbed out + pbout ; echo it back + add b,[70000,,0] ; decrement byte pointer + jumpge b,os1 ; ... + sub b,[430000,,1] ; ... + jrst os1 ] ; keep reading + idpb a,b ; put character into command line buffer + jrst os1 ; keep reading +os2: movei a,^M ; deposit an actual CR, instead of 37 + idpb a,b ; ... +} ; IFN 10X +IFN STY,{ + move a,[sixbit/ptypar/] ; SYSGT arg: SIXBIT table name + sysgt ; get PTY information + ; results: A = first word of table, + ; B = table no. + jumpe b,[ ; no PTYPAR table? + saycr "System lacks PTYs" + jrst logout + ] + hlrzm a,syspty ; no. of PTYs in system + hrrzm a,firpty ; TTY no. of first PTY +} ; IFN STY +IFN NCP,{ + setzm lskt ; local relative socket no. +} + return + +os9: call cusage ; Barf politely. + call dohelp + jrst logout + +} ; IFN TNX + +subttl Output entry to CRTSTY log file + +IFN ITS,{ +wrtlog: movei a,logint ; where to go if we get an IOC error + movem a,iocvec +sretry: syscal open,[ %clbit,,100000\.uao ? %climm,,dsko + [sixbit /DSK/] + [sixbit /CRTSTY/] ? [sixbit /LOG/] ? [sixbit /CRASH/] + %clerr,,a] ; get the error code + jrst [ cain a,%enafl ; file locked? + jrst [ movei a,5 ; sleep a bit + .sleep a, + jrst sretry ] ; and try again + caie a,%ensfl ; file not found? + $call lose,[#%lsfil,#sretry] ; unknown error, hassle + syscal open,[ %clbit,,.uao ? %climm,,dsko ? [sixbit /DSK/] + [sixbit /CRTSTY/] ? [sixbit /LOG/] + [sixbit /CRASH/]] + .lose %lsfil + jrst .+1] + $call fillen,[#dsko][a] ; find end of file + .lose %lsfil + $call access,[#dsko,a] ; and start there + .lose %lsfil + .rdatim a, ; get date and time + move e,b ; hack the date first + rot e,12. ; make MMDDYY + movei b,"/ ; separate by /'s + call timprt ; print the time + .iot dsko,[40] ; separate by a space + move e,a ; hack the time now + movei b,": ; separate by :'s + call timprt ; print it + .iot dsko,[40] ; space again + move a,uind ; get job no. + caige a,100 + .iot dsko,[40] + caige a,10 + .iot dsko,[40] + call numout + .iot dsko,[40] + move e,[.fnam1] + call sixout ; output FN1 if strange. + .iot dsko,[40] + move e,[.fnam2] + call sixout + .iot dsko,[40] + move e,xuname + call sixout ; print it + .iot dsko,[40] + $call stlget,[#tyon][a,e] ; get the host + caia + jumpn e,log1 + move a,cnsl ; get terminal no. + lshc a,-3 ; convert to sixbit + lsh a,3 ; ... + lshc a,3 ; ... + movsi e,'T00(a) ; convert to device name +log1: call sixout ; print it + .iot dsko,[40] + .iot dsko,[40] + move a,[440700,,jclbuf] ; BP to the command buffer +logcmd: ildb b,a ; get a char + caie b,^M ; end of line? + cain b,^C ; Another form of end of line + jrst logcls ; yes, close up the line + caie b,^_ ; still another form of end of the line + cain b,0 ; yet another + jrst logcls ; so close up the line + .iot dsko,b ; no, output it + jrst logcmd ; and do another + +logcls: .iot dsko,[^M] ; new line + .iot dsko,[^J] +logint: .close dsko, + setzm iocvec ; remove IOC error handler + return + + +numout: push p,b + idivi a,10 + caile a,0 + call numout + addi b,"0 + .iot dsko,b + pop p,b + return + +sixout: movei b,6 + call prtdig ; print a character + sojg b,.-1 + return + +; SIXDO - output sixbit in E cleverly to disk; always outputs +; at least one char (a blank if word 0). +sixdo: movei d,0 + lshc d,6 + addi d,40 + .iot dsko,d + jumpn e,sixdo + return + +timprt: call prt2dg ; print two digits + .iot dsko,b ; and the delimiter + call prt2dg ; print two more digits + .iot dsko,b ; and the delimiter + pjrst prt2dg ; and the final portion + +prt2dg: call prtdig +prtdig: movei d,0 + lshc d,6 + addi d,40 + .iot dsko,d + return +} ; IFN ITS + +IFN ITS&HISTOHACK,{ + +histch==17 + +histo: $call open,[#histch,[sixbit/DSK/],[sixbit/.CHAR/],[sixbit/.COUNT/]][][#.bio] + .lose %lsfil + movsi t1,-256. + .iot histch,t1 + .close histch, + $call open,[#histch,[sixbit/DSK/],[sixbit/.CHAR/],[sixbit/.COUNT/]][][#.uio+100000] + .lose %lsfil + $call corblk,[#%cbndw+%cbndr,#%jself,#histpg,#histch,#0] + .lose %lssys + move t1,[counts+0,,counts+1] + setzm counts+0 + blt t1,counts+256.-1 + return +} + +subttl Command line processing + +ljcl==:120. ; length of command line buffer +ivar jclbuf(/5) ; command line buffer +ltoken==:20. ; option buffer length +ivar token(/5) ; option buffer +ivar cmdysw ; Holds +1 for YES, -1 for NO. + + +jclpar: move a,[440700,,jclbuf] ; initialize pointer to the command buffer + movem a,jclp + hllz f,f ; Clear terminal flags. +jclp01: setom cmdysw ; Set state to YES by setting -1 then negating +jclp02: movns cmdysw ; Come here to reverse state. + call jclf ; pick up next token + jrst popj1 ; EOF, return2 from JCLPAR for winnage + move d,token ; get 1st word of token + camn d,[asciz /NO/] ; requesting opposite state? + jrst jclp02 ; Yes, negate state & get next field. + move a,[440700,,token] ; Set up BP to token + movsi d,-njopts ; Loop through JCL option table. + setz e, ; Say no duplicates yet +jclp10: move b,jcoptb(d) ; Get addr of ASCIZ option string + hrli b,440700 ; Set up BP + call strcmp ; Compare them + jrst jclp19 ; Failed, try another. + jrst [ jumpl e,jclp19 ; Partial match, jump if ignoring. + jumpg e,[seto e, ; If already a partial match, ignore + jrst jclp19] ; all further partial matches. + movei e,(d) ; No other partial matches, save index! + jrst jclp19] + jrst jclp20 ; Won! Go execute this routine. +jclp19: aobjn d,jclp10 ; Drop thru if fail to match... + jumple e,jclp50 ; If no partial matches, go try term names. + movei d,(e) ; Got exactly one partial match, use it! + + ; JCL Option match found. +jclp20: hlrz c,jcoptb(d) ; Get routine address from LH of entry + move a,cmdysw ; Set up yes/no argument in A + call (c) ; Execute matching rtn. + return ; return1 from JCLPAR to indicate error + jrst jclp01 ; Continue loop + + ; No options matched token, try it as a terminal name. +jclp50: move e,[440700,,token] ; didn't match a JCL opt, try as terminal. + call jrtrmf ; Check out. + jrst jclp60 ; No match, try other stuff. + skipe b,trmadr ; won, but was something already spec'd? + cain b,(c) + caia ; No, or specifying same thing, OK. + jrst [saycr "Terminal already specified!" + return] + hrrzm c,trmadr ; first spec of terminal. + jrst jclp01 ; Continue if won... + + ; Not an option or terminal name. See if it's a host name, + ; in case we're hacking network. +jclp60: +IFN NET,{ + skipe hstsen ; If HOST option already given, + jrst jclp70 ; Don't bother trying to parse as hostname. + move a,[440700,,token] ; Set up pointer to token + call hstpar ; Get number for host + jrst jclp70 ; Failed, give up. + movem a,frnhst ; Won! Set host address + move a,[440700,,hstnam] + call tokcpy ; and copy token into hostname buffer! + jrst jclp01 ; Done, back for another token. +} +jclp70: ; Fall through to complain about bad JCL spec. + +bad: say |"| + move t1,tokp + move t2,tokl + call typstr + saycr |" is not a valid terminal name or option. +| + call cusage ; Barf politely. + call dohelp + return ; don't fall thru to help anymore + +cusage: say "Usage is " +IFN ITS,say |:| +IFN TNX,say |@| + move t1,prgnam + call typasc + saycr " " + ret +dohelp: say "Do " +IFN ITS,say |:| +IFN TNX,say |@| + move t1,prgnam + call typasc + saycr " HELP for help." + ret + +help: skiple trmadr ; if he specified a good terminal, + jrst lstopt ; don't list them + call cusage + say " +Terminals are:" + call jtrmls + say " +" +lstopt: say "Options are: +; Terminal description: +HEIGHT , +WIDTH , +, SPEED , ISPEED , OSPEED , +NO ABS, NO TABS, NO BELL, NO CLEOL, NO CLEOS, NO LID, NO CID, +[NO] META, [NO] EDIT, +SCRLCOUNT + +; ITS options (same meaning as with TCTYP): +GLASS, SAIL, SCROLL + +; CRTSTY options: +[NO] INVERSE, VISBEL, WHOLINE, ALARM , +[NO] SMEOL, STEOS, +NO LOGIN, LOGIN , +NO WARN, SOFTOK, SLAVE, NO SII, NO ATTACH, DEBUG, +BUFFER , +TTY , +SIMULATE " +IFN NET,{ + say ", +, HOST " +} + say " +" + return + +badtrm: say "Terminal id may be one of:" + pjrst jtrmls + +subttl JCL option routines & dispatch table + +comment | + JCL options are defined very easily; for example, +to define an option FOO, we just put in + + jcopt /FOO/,