perm filename TTYINI.MAC[HST,NET] blob
sn#807635 filedate 1985-10-12 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00033 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00003 00002 <FINGER.SOURCES>TTYINI.MAC.83, 24-Jun-85 11:53:04, Edit by FMF
C00014 00003
C00015 00004
C00016 00005 MACROS
C00020 00006 DATA AREA
C00028 00007 SUBTTL Impure data
C00033 00008
C00035 00009 STARTUP
C00041 00010 COMMAND HANDLERS
C00050 00011
C00055 00012
C00056 00013 COMMAND EXECUTION
C00061 00014
C00068 00015
C00071 00016
C00074 00017
C00077 00018
C00098 00019 CHECK HANDLER, TYPE ROUTINES
C00106 00020
C00110 00021 SUBTTL Binary file reading
C00114 00022
C00116 00023
C00119 00024
C00122 00025 SUBTTL Write unix-style ttyini file
C00124 00026 SUBTTL Write binary file from raw data file
C00127 00027
C00128 00028
C00130 00029
C00135 00030
C00137 00031
C00139 00032
C00143 00033
C00144 ENDMK
C⊗;
;<FINGER.SOURCES>TTYINI.MAC.83, 24-Jun-85 11:53:04, Edit by FMF
; Type for CHECK needs to be halfword, since we compare with a CAIN
;<FINGER.SOURCES>TTYINI.MAC.82, 19-May-85 17:53:52, Edit by BILLW
; add SUN48 terminal type
; munge net and host numbers for TCP connections too (Eg SUNs)
; if NETMAP or HSTMAP fails, try it again using local net/host/tty
; bugfix: initialize OURLIN before calling CHKTVT/etc (fixes /xx-DEFAULT:foo)
;<FINGER.SOURCES>TTYINI.MAC.80, 29-Apr-85 10:27:00, Edit by FMF
; Make sure to set the default area to -1s
;<FINGER.SOURCES>TTYINI.MAC.79, 28-Apr-85 18:21:37, Edit by FMF
; Add /NVT, output "dialup" or "network" for unix file
;<FINGER.SOURCES>TTYINI.MAC.78, 26-Apr-85 16:37:34, Edit by FMF
; AVT's termcap is "avt"
;<FINGER.SOURCES>TTYINI.MAC.77, 26-Apr-85 13:16:44, Edit by FMF
; Make use of B%DIAL to tell TTYINI.NET-BIN if it's a dialin
;<FINGER.SOURCES>TTYINI.MAC.76, 24-Apr-85 12:04:28, Edit by FMF
; Select UNIXSW for now, to try it out
; Rename UNIXFILE to UNIX-FILE (consistent with BINARY-FILE)
; If nothing to define for a logical name, clear the logical
; If default terminal, don't output port number to UNIX file
;<FINGER.SOURCES>TTYINI.MAC.75, 24-Apr-85 02:57:52, Edit by FMF
;<FINGER.SOURCES>TTYINI.MAC.74, 24-Apr-85 02:50:00, Edit by FMF
; Don't use host information as part of the terminal number
;<FINGER.SOURCES>TTYINI.MAC.73, 24-Apr-85 02:37:44, Edit by FMF
; If doing default while writing binary file, force BINLOC to return it
;<FINGER.SOURCES>TTYINI.MAC.72, 24-Apr-85 02:06:47, Edit by FMF
;<FINGER.SOURCES>TTYINI.MAC.71, 24-Apr-85 01:58:44, Edit by FMF
; Don't test for maximum tty if creating binary file in BINLOC
;<FINGER.SOURCES>TTYINI.MAC.70, 24-Apr-85 01:42:16, Edit by FMF
; Make sure to point to default entry if tty number too large
;<FINGER.SOURCES>TTYINI.MAC.69, 24-Apr-85 00:45:08, Edit by FMF
;<FINGER.SOURCES>TTYINI.MAC.68, 24-Apr-85 00:41:16, Edit by FMF
; Point to the default ttyini entry if the real one doesn't exist
;<FINGER.SOURCES>TTYINI.MAC.67, 23-Apr-85 17:38:24, Edit by FMF
; More of edit 64
;<FINGER.SOURCES>TTYINI.MAC.66, 18-Apr-85 00:50:50, Edit by FMF
; For now, create UNIXSW, and deselect. Note that this isn't a true
; switch, for it only makes sure that TERM: doesn't get set
;<FINGER.SOURCES>TTYINI.MAC.65, 18-Apr-85 00:45:28, Edit by FMF
; Tip ports mask is 777, not 77
;<FINGER.SOURCES>TTYINI.MAC.64, 10-Apr-85 16:35:04, Edit by FMF
; Make more general for host data page, anticipating adding more
; header words
;<FINGER.SOURCES>TTYINI.MAC.63, 27-Mar-85 16:28:36, Edit by FMF
; Oops, need LOTSW and GSBSW
; Typo in edit 61
;<FINGER.SOURCES>TTYINI.MAC.62, 27-Mar-85 16:17:19, Edit by FMF
; Put $PUPNS in here (at least for now)
; Put LOTSW and GSBSW in IFNDEFs
;<FINGER.SOURCES>TTYINI.MAC.61, 27-Mar-85 16:14:46, Edit by FMF
; /UNIXFILE
;<FINGER.SOURCES>TTYINI.MAC.56, 27-Mar-85 11:29:07, Edit by FMF
; Change to storing termcap string itself in the bin file
;<FINGER.SOURCES>TTYINI.MAC.53, 26-Mar-85 14:22:43, Edit by FMF
; Make sure to test /TERMCAP from .NET-CMD is in TCPTAB for making .NET-BIN
;<FINGER.SOURCES>TTYINI.MAC.52, 25-Mar-85 16:19:11, Edit by FMF
; Finish up /TERMCAP:foo support (hopefully)
;<FINGER.SOURCES>TTYINI.MAC.45, 25-Mar-85 11:39:03, Edit by FMF
; Start /UNIXFILE and /TERMCAP:foo support
; Need to make use of termcap type and write UNIXFILE routine
;<FINGER.SOURCES>TTYINI.MAC.42, 24-Mar-85 18:40:50, Edit by FMF
; If no bits selected in TTYINI.NET-BIN use B%DEFAULTS (in BINRD)
;<FINGER.SOURCES>TTYINI.MAC.41, 24-Mar-85 17:48:48, Edit by FMF
; Left half of PUPPAR is -#PNVs, not +
;<FINGER.SOURCES>TTYINI.MAC.40, 24-Mar-85 06:54:02, Edit by JPBION
; Add the Concept GVT terminal type
;<FINGER.SOURCES>TTYINI.MAC.39, 11-Feb-85 17:26:54, Edit by WHP4
; search FINGER:, not SYSTEM:, for various files
;<FINGER.SOURCES>TTYINI.MAC.38, 4-Dec-84 15:34:09, Edit by SATZ
; Add the Concept AVT terminal type
;<FINGER>TTYINI.MAC.37, 31-May-84 15:47:16, Edit by LOUGHEED
; Add Freedom-200, ANSI, FR100, FR200, SUN terminal types
; Add documentation about the /DEFAULT switches
;<FINGER>TTYINI.MAC.36, 14-Apr-84 17:44:42, Edit by LOUGHEED
; Make sure ADDRESS field in binary file is null terminated
;<LOUGHEED>TTYINI.MAC.35, 21-Jan-84 21:42:00, Edit by LOUGHEED
; Turn on LOTSW and GSBSW so everyone can parse the same command file
;ACCT:<SU-UTILITIES>TTYINI.MAC.34, 7-Jan-84 14:23:36, Edit by R.RMK
; Up MAXLEN and ATMLEN. Tip-TermanA nuked us.
;ACCT:<SU-UTILITIES>TTYINI.MAC.33, 23-Nov-83 15:59:55, Edit by R.RMK
; Lite bits in 9 pages of host data, not just one.
;ACCT:<SU-UTILITIES>TTYINI.MAC.32, 18-Nov-83 16:22:01, Edit by R.RMK
; Had to fix COMTRM, too.
;ACCT:<SU-UTILITIES>TTYINI.MAC.31, 18-Nov-83 13:37:00, Edit by R.RMK
; Fix DIRECT - neighbor parsing had been broken.
;ACCT:<SU-UTILITIES>TTYINI.MAC.30, 18-Nov-83 12:27:41, Edit by R.RMK
; Import from Sierra:
; Add GIGI, LA38, TELEMEDIA, TI and VT125.
; Flush DEC SUDS terminals.
; Update help and remove spurious comments therein.
;<FINGER>TTYINI.MAC.29, 15-Nov-83 23:08:15, Edit by BURGESS
; Don't look in NET-CMD if just reading bin file
;<FINGER>TTYINI.MAC.28, 17-Oct-83 16:18:29, Edit by BURGESS
; Tip port mask is 77, not 7777
;<FINGER>TTYINI.MAC.27, 12-Oct-83 00:02:02, Edit by FMF
; When creating new net page make sure host page unmapped (don't create
; new net page in the middle of host page!)
;<FINGER>TTYINI.MAC.26, 6-Oct-83 16:58:09, Edit by FMF
; Make GSB have same things as LOTS
;<FINGER>TTYINI.MAC.25, 26-Sep-83 21:06:32, Edit by LOUGHEED
; Add Freedom-100, Esprit support
;<FINGER>TTYINI.MAC.24, 24-Sep-83 18:44:57, Edit by FMF
; Use PUPNM% to figure out host names rather than mapping the PUP-Network
; Directory.
; Move file definitions to .UNV file
; Use .TEXT instead of .MIC file to load
; /ETHERNET-DEFAULT, /INTERNET-DEFAULT, /NETWORK-DEFAULT, /DIALIN-DEFAULT,
; /PTY-DEFAULT, and /LOCAL-DEFAULT
; Allow multiple host numbers for each site (such as SUN-Test)
;<R.RMK>TTYINI.MAC.6, 19-Sep-83 12:53:38, Edit by R.RMK
; Simplify SETTTY.
;<R.RMK>TTYINI.MAC.5, 16-Sep-83 15:08:11, Edit by R.RMK
; Change to SYSTEM:TTYINI.NET* now that it's mostly debugged.
;<R.RMK>TTYINI.MAC.4, 16-Sep-83 11:34:04, Edit by R.RMK
; TTYINI.NET-CMD and TTYINI.NET-BIN instead of .CMD and .BIN
;<R.RMK>TTYINI.MAC.3, 15-Sep-83 15:29:06, Edit by R.RMK
; In HSTMAP, map the second host page on, not the first.
;<R.RMK>TTYINI.MAC.2, 15-Sep-83 12:19:30, Edit by R.RMK
; Flush CERAS 105, put office in its place.
;<R.RMK>TTYINI.MAC.1, 14-Sep-83 16:53:05, Edit by R.RMK
; This version is sufficiently new to justify flushing the previous
; edit history.
; Add network terminal support.
TITLE TTYINI - SET TERMINAL CHARACTERISTICS
SEARCH MONSYM,MACSYM,TINIDF,ANAUNV
.REQUIRE SYS:MACREL
.TEXT "/SYMSEG:PSECT:TTCODE"
.TEXT "TTYINI/SAVE"
.TEXT "/HASHSIZE:12007"
SALL
IFN SCORSW,<.TTGVT==0>
.PSECT VARBS,40000
.ENDPS
.PSECT PVARBS,50000
.ENDPS
.PSECT TTCODE,1000
VGROUP==4 ;EDIT BY CUSTOMER
VMAJOR==5
VMINOR==0
VEDIT==100
LOTSW==1
GSBSW==1
DEFINE DATE<ASCIZ \24-March-1985\>
A=1
B=2
C=3
D=4
E=5
;16 IS USED BY MACSYM
P=17
MAXCHR==↑D500
MAXLEN==<MAXCHR+5>/5
ABCHR==↑D100
ABLEN==<ABCHR+5>/5
PDLLEN==500 ; Plenty of stack.
DEFINE JCERR(TEXT)<
ERCAL [JSMSG<TEXT>
RET]>
DEFINE JSMSG(TEXT,CHAR)<
IFB<CHAR><TMSG <
?>>
IFNB<CHAR><TMSG <
CHAR>>
IFNB<TEXT><TMSG <TEXT: >>
CALL JSMSG0
>
DEFINE FMSG(TEXT)<
HRROI B,[ASCIZ \TEXT\]
SETZ C,
SOUT
>
DEFINE FCHR(CHR)<
MOVEI B,CHR
BOUT
>
DEFINE FVER<
FMSG (\VMAJOR)
IFN VMINOR,<
IFG VMINOR-↑D26,<
VMIN1==<VMINOR-1>/↑D26
FCHR <"A"+VMIN1-1>
>
VMIN1==VMINOR-<<VMINOR-1>/↑D26*↑D26>
FCHR <"A"+VMIN1-1>
>
IFN VEDIT,<
FCHR<"(">
FMSG(\VEDIT)
FCHR<")">
>
IFN VGROUP,<
FCHR<"-">
FMSG(\VGROUP)
>
>
SUBTTL MACROS
;LOAD A BLOCK WITH DATA AND ALLOCATE ENOUGH SPACE
;FOR LARGEST WORD
DEFINE LDBLK(LIST)<
..LEN==0
IRP LIST,<.LDWRD(LIST)>
.ORG .+..LEN
>
;USED TO STRIP OFF <>
DEFINE .LDWRD(A)<LDWRD(A)>
;LOAD 1 WORD CHECK MAX LENGTH
DEFINE LDWRD(A,B,C)<
.ORG .+<A>
IFNB<C><C:>
IFB<B>,<0;>B
.ORG .-<A>-1
IFGE <A>-..LEN,<..LEN==<A>+1>
>
;KEYWORD TABLE MACROS
DEFINE TABLE<
...BEG==.
BLOCK 1
>
DEFINE TEND<
...LEN==.-...BEG
.ORG ...BEG
...LEN-1,,...LEN
.ORG .+...LEN
>
DEFINE T(TEXT,VALUE)< [ASCIZ \TEXT\],,VALUE>
DEFINE TT (TEXT,VALUE,TCP) < ;;Used for Terminal types W/Termcaps
IFB <TCP>,<
[ASCIZ \TEXT\],,[VALUE
0]
>;IFB TCP
IFNB <TCP>,<
[ASCIZ \TEXT\],,[VALUE
POINT 7,[ASCIZ \TCP\]]
>;IFNB TCP
>;TT
;LOAD A FUNCTION DESCRIPTOR BLOCK
;USE FLDDB. MACRO FROM MONSYM. ARGS AS FOLLOWS:
;FLDDB.(TYP,FLGS,DATA,HLPM,DEFM,LST)
;TYP COMND FUNCTION CODE (I.E. .CMKEY)
;FLGS FLAGS (I.E. CM%SDH, SUPPRESS DEFAULT HELP)
;DATA ARG TO SPECIFIC FUNCTION (I.E. RADIX FOR .CMNUM)
;HLPM USER SUPPLIED HELP STRING (AUTOMATICALLY SETS CM%HPP)
;DEFM DEFAULT STRING (AUTOMATICALLY SETS CM%DPP)
;LST POINTER TO NEXT FUNCTION DESCRIPTOR BLOCK
;DEFINE SINGLE DATA WORD (OR WORDS)
DEFINE DATA(ADDR,SIZE<1>)<
.PSECT VARBS
ADDR: BLOCK SIZE ;; Storage.
.ENDPS VARBS>
DEFINE PDATA(ADDR,SIZE<1>)<
.PSECT PVARBS
ADDR: BLOCK 1000*SIZE
.ENDPS PVARBS>
DEFINE CONFIRM(ERROR)<
CALL DOCFM
IFB<ERROR>< JRST COMERR>
IFNB<ERROR>< JRST ERROR>
>
DEFINE NIY<
TMSG <
?Not implemented yet.
>
JRST COMLOP
>
DEFINE COMINI(TEXT)<
IFNB<TEXT><HRROI A,[ASCIZ \TEXT\]>
IFB<TEXT><HRROI A,CMBUF>
MOVE B,[.PRIIN,,.PRIOU]
CALL DOINI
>
DEFINE FIELD(FDB,ERROR)<
MOVEI B,FDB
CALL DOCOM
IFB<ERROR>< JRST COMERR>
IFNB<ERROR>< JRST ERROR>
>
DEFINE RFIELD(FDB)<
MOVEI B,FDB
MOVEI A,CMSTAT
COMND
ERJMP ERSCAN
TXNE A,CM%NOP
JRST ERSCAN
>
DEFINE CHECK(ADDR,NAME)<
SKIPL ADDR
JRST [ SKIPE FILEF
RETSKP
TMSG <?Cannot give NAME more than once
>
RET]
>
DEFINE DEFAULT(SWIT,VAL)<
MOVEI A,VAL
SKIPGE SWIT
MOVEM A,SWIT
>
SUBTTL DATA AREA
EV: JRST STRT
JRST STRT
JOBVER: BYTE (3)VGROUP(9)VMAJOR(6)VMINOR(18)VEDIT
EVL==.-EV
CMSTAT: LDBLK(<<.CMFLG,REPARS>,<.CMIOJ,<.PRIIN,,.PRIOU>>,<.CMBFP,<-1,,CMBUF>>,<.CMPTR,<-1,,CMBUF>>,<.CMCNT,MAXCHR>,<.CMINC,0>,<.CMABP,<POINT 7,ABBUF>>,<.CMABC,ABCHR>,<.CMGJB,CMGJFN>>)
INIBLK: FLDDB.(.CMINI)
TTYINI: FLDDB.(.CMKEY,,RESKEY)
RESKEY: TABLE
T TTYINI,0
TEND
COMAND: FLDDB.(.CMCFM,,,,,COMSWT)
COMSWT: FLDDB.(.CMSWI,,TYPSWT,,,COMTYP)
TYPSWT: TABLE
T ADDRESS:,$ADDRE
IFN LOTSW!GSBSW,<
T ASSIGNABLE,$ASSIG
>;IFN LOTSW!GSBSW
T BINARY-FILE,$BINMK
IFN LOTSW!GSBSW,<
T CONSULTINGTERMINAL,$CONSU
>;IFN LOTSW!GSBSW
T DEFAULT-TYPE:,$DTYPE
T DIALIN-DEFAULT:,$DDEF
T DIALUP,$DIAL
T ETHERNET-DEFAULT:,$EDEF
T EXIT,$EXIT
IFN LOTSW!GSBSW,<
T EXPRESSTERMINAL,$EXPRE
>;IFN LOTSW!GSBSW
T FILE:,$FILE
T FLAG,$FLAG
T FORMFEED,$FORM
T FULLDUPLEX,$FULL
T HALFDUPLEX,$HALF
T HELP,$HELP
T INTERNET-DEFAULT:,$IDEF
T LENGTH:,$LENGT
T LINE-HALFDUPLEX,$LHALF
T LOCAL-DEFAULT:,$LDEF
T LOCATION,$LOCAT
T LOWERCASE,$LOWER
T NETWORK-DEFAULT:,$NDEF
T NO-PAGE-SPEED:,%PGSPD
T NO-PAUSE-AT-END-OF-PAGE,%PAUSE
T NO-PAUSE-ON-COMMAND,%CTLS
T NODIALUP,%DIAL
T NOFILE,%FILE
T NOFLAG,%FLAG
T NOFORMFEED,%FORM
T NOLOWERCASE,%LOWER
T NONVT,%NVT
T NORAISE,%RAISE
T NOTAB,%TAB
T NVT,$NVT
IFN LOTSW!GSBSW,<
T OPERATOR,$OPERA
T OVERHEAD,$OVERH
>;IFN LOTSW!GSBSW
T PAUSE-AT-END-OF-PAGE,$PAUSE
T PAUSE-ON-COMMAND,$CTLS
T PRINT-NODE:,$PRINT
T PTY-DEFAULT:,$PDEF
T RAISE,$RAISE
T RECEIVE-MESSAGES,%REFSY
T REFUSE-MESSAGES,$REFSY
T TAB,$TAB
T TERMCAP:,$TRMCP
IFN LOTSW!GSBSW,<
T TOBACK:,$TOBAC
T TODIAGONAL:,$TODIA
T TOFRONT:,$TOFRO
T TOGLASS:,$TOGLA
T TOLEFT:,$TOLEF
T TOPARTITION:,$TOPAR
T TORIGHT:,$TORIG
>;IFN LOTSW!GSBSW
T UNIX-FILE,$UNIXF
T VT100-52,$10052
T VT100-ANSI,$100AN
T WIDTH:,$WIDTH
TEND
COMSPD: FLDDB.(.CMKEY,,SPDKEY,<
Speed at or below which to disable /PAUSE-ON-END-OF-PAGE,
>)
SPDKEY: TABLE
T 110,↑D110
T 1200,↑D1200
T 134,↑D134
T 150,↑D150
T 1800,↑D1800
T 200,↑D200
T 2400,↑D2400
T 300,↑D300
T 4800,↑D4800
T 50,↑D50
T 600,↑D600
T 75,↑D75
T 9600,↑D9600
TEND
COMTYP: FLDDB.(.CMKEY,,COMKEY)
COMDTY: FLDDB.(.CMKEY,,COMKEY)
COMKEY: TABLE
TT 33,$TT33,<tty33>
TT 35,$TT35
TT 37,$TT37,<tty37>
TT 43,$TT43,<tty43>
TT ADM-3,$TTADM,<adm3>
TT ALTO,$TTALT,<alto>
TT AMBASSADOR,$TTAMB,<aaa-30>
TT ANN-ARBOR,$TTANN,<annarbor>
TT ANSI,$TTANS,<ansi>
TT AVT,$TTAVT,<avt>
TT CHECK,777777
TT CONCEPT-100,$TTCPT,<concept>
TT DATAMEDIA-1520,$TTDA2,<dm1520>
TT DATAMEDIA-2500,$TTDAM,<dm2500>
TT DEFAULT,$TTDEF,<dumb>
TT DIABLO,$TTL36,<1620>
TT DM1520,$TTDA2,<dm1520>
TT DM2500,$TTDAM,<dm2500>
TT ESPRIT,$TTESP
TT EXECUPORT,$TTEXE,<ep4080>
TT FR100,$TTFRD
TT FR200,$TTFR2
TT FREEDOM-100,$TTFRD
TT FREEDOM-200,$TTFR2
TT GIGI,$TTGG
TT GILLOTINE,$TTGIL,<gill>
TT GVT,$TTGVT
TT H19,$TTH19,<h19>
TT HAZELTINE-1500,$TTHAZ,<h1500>
TT HEATH-19,$TTH19,<h19>
TT HP2645A,$TTHP,<hp2645>
TT IBM-3101,$TTIBM,<ibm3101>
TT IDEAL,$TTIDL
TT LA120,$TT120
TT LA30,$TTL30
TT LA34,$TTL34
TT LA36,$TTL36
TT LA38,$TTL38
TT NVT,$TTIDL
TT SOROC-IQ120,$TTSRC,<soroc>
TT SUN,$TTSUN,<vsun>
TT SUN48,$TTSUL,<vgts48> ;[wew82]
TT TEK4023,$TTTK3,<tek4023>
TT TEK4025,$TTTEK,<tek4025>
TT TEKTRONIX-4023,$TTTK3,<tek4023>
TT TEKTRONIX-4025,$TTTEK,<tek4025>
TT TELEMEDIA,$TTDAM,<dm2500>
TT TELERAY-1061,$TTTEL,<t1061>
TT TELEVIDEO-912,$TTTVI,<tvi912>
TT TERMINET,$TTTRM,<terminet300>
TT TI,$TTTI,<ti700>
TT VK100,$TTGG
TT VT05,$TTV05
TT VT100,$TT100,<vt100>
TT VT125,$TT125
TT VT50,$TTV50,<vt50>
TT VT52,$TTV52,<vt52>
TT ZENITH-19,$TTH19,<h19>
TEND
COMCFM: FLDDB.(.CMCFM)
COMNUM: FLDDB.(.CMNUM,,↑D10)
COMLIN: FLDDB.(.CMCFM,,,,,COMSTR)
COMPLS: FLDDB.(.CMTOK,,<-1,,[ASCIZ/+/]>,,,COMHSH)
COMHSH: FLDDB.(.CMTOK,,<-1,,[ASCIZ/#/]>)
COMSTR: FLDDB.(.CMTOK,,<-1,,[ASCIZ /*/]>,,,CMDKEY)
CMDKEY: FLDDB. .CMKEY,,CMKEYS,,,COMOCT
CMKEYS: TABLE
T HOST,$HOST
TEND
COMFLD: FLDDB. .CMFLD
COMHST: FLDDB. .CMFLD
COMTRM: FLDDB. .CMNUM,,10,,,COMHST
COMOCT: FLDDB.(.CMNUM,,10)
COMEOL: FLDDB.(.CMTXT)
COMFIL: FLDDB.(.CMFIL)
FILBLK: LDBLK(<<.GJGEN,GJ%OLD>,<.GJEXT,<-1,,[ASCIZ /CMD/]>>,<.GJNAM,[ASCIZ /TTYINI/]>>)
FILLEN==.-FILBLK
;SAMPLES OF OTHER BLOCKS
;NOISE: FLDDB.(.CMNOI,,<-1,,[ASCIZ /NOISE/]>)
;IFILE: FLDDB.(.CMIFI)
;OFILE: FLDDB.(.CMOFI)
;ARBFIL:FLDDB.(.CMFIL)
;FILBLK: LDBLK(<<.GJGEN,GJ%OLD>,<.GJEXT,<-1,,[ASCIZ /EXT/]>>,<.GJNAM,[ASCIZ /NAME/]>>)
;FILLEN==.-FILBLK
SUBTTL Impure data
DATA PDL,PDLLEN ; Stack
DATA CMGJFN,16 ; COMND% GTJFN% block
DATA CMBUF,MAXLEN ; COMND% parse buffer
DATA ABBUF,ABLEN ; COMND% atom buffer
DATA HSTBUF,10 ;Generous buffer for host name
DATA UNXFLG ; If non-zero, we're generating a unix file
DATA BINFLG ; If non-zero, we're generating a binary file
DATA THELIN ; The current TTY line out of the command file
LNMLEN==10 ; 40 chars for logical name
DATA NEWTCP,LNMLEN ; String set in /TERMCAP:foo
DATA REPPDL
DATA REPPC
DATA SYSCOM
;DATA PTY0
DATA OURLIN
DATA EXITS
DATA HELPS
DATA CHANGE
DATA FILEF
DATA IJFN
DATA SAVMOD
DATA PASS
DATA DATBEG,0 ; Start of initialized data area.
DATA TYPE
DATA DTYPE
DATA EXITF
DATA FLAGF
DATA FORMF
DATA DIALF
DATA NVTF
DATA HELPF
DATA LENGTH
DATA LINEF
DATA LOWERF
DATA PAUSEF
DATA CTLSF
DATA SPEED
DATA RAISEF
DATA TABF
DATA WIDTH
DATA VT100F
DATA FJFN
DATA REFSYS
DATA PRINT,2
DATA LOCAT
DATA ADDRE,6
IFN LOTSW!GSBSW,<
DATA ASSIG
DATA CONSU
DATA EXPRE
DATA OVERH
DATA OPERA
>;IFN LOTSW!GSBSW
DATA DIRARR,8
DATA TRMCAP ;Whether we have a TERMCAP entry
DATA DATEND,0 ; End of data to be initialized
DATA NETNUM ; -1, have not seen HOST command line...else
; net number of host working on in binary file.
DATA HSTNUM ; -1, have not seen HOST command line...else
; host number of host working on in binary file
DATA NETJFN ; JFN for TTYINI.NET-BIN when reading/writing.
DATA MAPNET ; Positive, page number mapped in NETPAG
DATA MAPHST ; Positive, page number mapped in HSTPAG
DATA NUMHST ; Positive, number of pages mapped at HSTPAG
DATA FILPAG ; Page number in binary file to be created.
DATA NTDJFN ; JFN for SYSTEM:PUP-NETWORK.DIRECTORY
DATA MULHST ;This is a host with multiple entries
DATA HSTNMS,3 ;Numbers if have multiple hosts|
DATA LCLNET ; Local net number (that this host is on)
DATA LCLHST ; This host
DATA FSTPNV ; Number of first PNV on system
DATA NUMPNV ; Number of PNVs on system
DATA FSTTVT ;Number of first TVT on system
DATA NUMTVT ;Number of TVTs
DATA FSTPTY ;Number of first PTY
DATA NUMPTY ;Number of PTYs on system
DATA PARNUM ; Number of PUPPAR table
.PSECT VARBS
DATALN==:DATEND-DATBEG
.ENDPS VARBS
DATA TMPARG,DATALN
PDATA TXTPGA,↑d50 ;[wew] place to map in the .NET-CMD file
TXTPAG==:TXTPGA/1000 ;[wew]
PDATA TTYPGA ; TTYINI.NET-BIN's first page
TTYPAG==:TTYPGA/1000
PDATA NETPGA ; Where NET page gets mapped
NETPAG==:NETPGA/1000 ; Table of page pointers to host TTYINI data
MAXPAG==:100 ; Allow 64 pages
PDATA HSTPGA,MAXPAG ; Allow MAXPAG pages of host TTYINI data
HSTPAG==:HSTPGA/1000
PDATA TEMP ; One temporary page.
;TERMINAL TYPE TABLE FOR ANSI RESPONSE TO <ESC>Z
ANSITB:
T100AN: ;LABEL USED FOR /VT100-52
$TT100,,[ASCIZ /VT100]/] ; (1) VT100
$TT120,,[ASCIZ /LA120]/] ; (2) LA120
$TTL34,,[ASCIZ /LA34]/] ; (3) LA34
ANSIMX==.-ANSITB
;TERMINAL TYPE TABLE FOR DEC RESPONSE TO <ESC>Z
DEFINE DECENT(LETTER,ROUTINE,TYPE,ADDR)<
LDWRD(<<"LETTER">-<"A">>,<ROUTINE,,[ASCIZ \TYPE]\]>,ADDR)
>
DECTAB:
..LEN==0
DECENT A,$TTV50,VT50
DECENT H,$TTV50,VT50
DECENT C,$TTV52,VT52
DECENT K,$TTV52,VT52
DECENT L,$TTV52,VT52
DECENT (Z,$TTV52,<VT100(VT52)>,T10052) ;T10052 USED BY /VT100-ANSI
DECENT E,$TTV52,<VT55(VT52)>
DECMAX==..LEN
.ORG DECTAB+DECMAX
SUBTTL STARTUP
STRT: RESET%
MOVE P,[IOWD PDLLEN,PDL]
; MOVE A,['PTYPAR']
; SYSGT%
; HRRZM A,PTY0
MOVE A,['PUPPAR'] ; Get information about PNVs.
SYSGT%
HRRZM A,FSTPNV ; Number of first PNV.
HLRES A ; Left half had -# PNVs, make fullword -
MOVNM A,NUMPNV ; And make + # PNVs
; HLRZM A,NUMPNV ; Number of PNVs.
HRRZM B,PARNUM ; Number of PUPPAR table for later use.
MOVE A,['PTYPAR'] ;Want info on PTYs
SYSGT% ;Get it
HRRZM A,FSTPTY ;Number of first PTY
HLRZM A,NUMPTY ;Number of PTYs
MOVX A,TCP%NT ;Want number of TVTs
STAT% ;Try to get it
IFJER.
SETOM FSTTVT ;Set a quite unlikely TVT number
SETOM NUMTVT ;And an even more unlikely number of TVTs
ELSE.
HRRZM B,FSTTVT ;Save first TVT number
HLROM B,NUMTVT ;Get -num of tvts
MOVNS NUMTVT ;Make it positive
ENDIF.
CALL INIHST ; Get local host net/number
MOVNI A,1 ;[wew82] get tty number that we are on
MOVE B,[1,,OURLIN] ; so that chktvt/etc will work
MOVEI C,.JITNO
GETJI%
JSHLT ;[wew82] end of edit
SETOM SYSCOM
GJINF
JUMPE A,NOLOG ;NOT LOGGED IN - MUST USE FILE
SETZ A,
RSCAN
ERJMP ERSCAN
JUMPE A,ERSCAN
COMINI()
RFIELD(TTYINI) ;MUST START WITH PROGRAM NAME, OR NO ERRORS
MOVEI B,COMCFM
MOVEI A,CMSTAT
COMND
ERJMP REPAR1
TXNE A,CM%NOP
JRST REPAR1
NOLOG: SETOM DATBEG
MOVE A,[DATBEG,,DATBEG+1]
BLT A,DATEND-1
SETZM CHANGE
AOS CHANGE
JRST COMDON ;GO DO TYPE FROM FILE
ERSCAN: HRROI A,[0]
RSCAN
ERJMP .+1
SETZM SYSCOM
TMSG <TTYINI VERSION >
MOVEI A,.PRIOU
LDB B,[POINT 9,JOBVER,11] ;MAJOR
MOVEI C,10
NOUT
JCERR
LDB B,[POINT 6,JOBVER,17] ;MINOR
JUMPE B,NOMINR
SUBI B,1
IDIVI B,↑D26
JUMPE B,NOMINF
MOVEI A,"A"-1(B)
PBOUT
NOMINF: MOVEI A,"A"(C)
PBOUT
NOMINR: HRRZ B,JOBVER ;EDIT
JUMPE B,NOEDIT
TMSG <(>
MOVEI A,.PRIOU
MOVEI C,10
NOUT
JCERR
TMSG <)>
NOEDIT: LDB B,[POINT 3,JOBVER,2]
JUMPE B,NOGRP
TMSG <->
MOVEI A,.PRIOU
MOVEI C,10
NOUT
JCERR
NOGRP: TMSG <, >
HRROI A,[DATE]
PSOUT
TMSG <.
>
COMLOP: CALL CLEAN
SKIPE SYSCOM
HALTF
COMLP1: SETZM SYSCOM
HRROI A,[ASCIZ /TTYINI>/]
MOVE B,[.PRIIN,,.PRIOU]
CALL DOINI
CALL CLEAN
REPAR1: SETZM CHANGE
SETZM FILEF
SETZM BINFLG ;NOT CREATING A BINARY FILE
SETZM UNXFLG ;Nor a unix file
SETOM DATBEG
MOVE A,[DATBEG,,DATBEG+1]
BLT A,DATEND-1
COMNXT: FIELD(COMAND)
HRRZ B,(B)
MOVE A,B
HRRZ C,C
CAIN C,COMAND
JRST COMDON ;CONFIRMED
CAIN C,COMTYP
MOVEI A,SETTYP
CALL (A)
JRST COMERR
JRST COMNXT
REPARS: MOVE P,REPPDL
MOVE A,REPPC
MOVEM A,(P)
RET
DOINI: MOVEM A,CMSTAT+.CMRTY
MOVEM B,CMSTAT+.CMIOJ
MOVE A,(P)
MOVEM A,REPPC
MOVEM P,REPPDL
MOVEI A,CMSTAT
SKIPE BINFLG ;[wew] Reading in binary file?
JRST PTRINI ;[wew] Yes,just munge pointers.
MOVEI B,INIBLK
COMND
ERJMP FATAL
TXNN A,CM%NOP
RET
FATAL: JSHLT
PTRINI: LDB B,CMSTAT+.CMPTR ;[wew] get last character to be parsed
CAIN B,12 ; a line feed?
IFSKP.
PTRLP: ILDB B,CMSTAT+.CMPTR ; get next character
SOS CMSTAT+.CMCNT ; one less character in buffer
SOSGE CMSTAT+.CMINC ; one less unparsed character
JRST PTREOF
CAIE B,12 ;reached a Line feed yet?
JRST PTRLP ;no, keep trying
ENDIF.
SKIPLE CMSTAT+.CMINC
RET
PTREOF: POP P,(P) ;back up a level
JRST FILNON ;goto file close routine
DOCFM: MOVEI B,COMCFM
DOCOM: MOVEI A,CMSTAT
COMND
ERJMP R
TXNE A,CM%NOP
RET
RETSKP
COMERR: JSMSG <Command error>
JRST COMLOP
CLEAN: MOVX A,CZ%NCL!FLD(.FHSLF,CZ%PRH)
CLZFF
JCERR <Failed to release unopened JFNs>
RET
COMEND: SKIPL EXITF
HALTF
JRST COMLOP
SUBTTL COMMAND HANDLERS
$DDEF: FIELD(COMDTY,R)
CALL CHKDIA ;Are we a dialin?
RETSKP ;No, go back
JRST %DTYPE ;Go do the processing
$EDEF: FIELD(COMDTY,R)
CALL CHKPNV ;Are we a PNV?
RETSKP ;No, go back now
JRST %DTYPE ;Otherwise do it
$IDEF: FIELD(COMDTY,R)
CALL CHKTVT ;Are we a TVT?
RETSKP ;No, go back now
JRST %DTYPE ;And go do it
$LDEF: FIELD(COMDTY,R)
CALL CHKDIA ;Are we a dialin?
IFNSK. ;No...
CALL CHKPNV ;An ether tty?
ANNSK.
CALL CHKTVT ;An internet tty?
ANNSK.
CALL CHKPTY ;Are we a PTY?
ANNSK.
ELSE.
RETSKP ;If any of these go back now
ENDIF.
JRST %DTYPE ;Otherwise go do the defaulting
$NDEF: FIELD(COMDTY,R)
CALL CHKPNV ;Are we an ether tty?
SKIPA
JRST %DTYPE ;If so
CALL CHKTVT ;Are we an internet TVT?
RETSKP ;No, neither so don't do default
JRST %DTYPE ;Otherwise go ahead and do it
$PDEF: FIELD(COMDTY,R)
CALL CHKPTY ;Are we a PTY?
RETSKP ;No, go back now
JRST %DTYPE ;Else go do it
CHKDIA: SAVEAC <B> ;Check if we're a dialin
MOVEI A,.PRIOU ;For our tty
MOVEI B,.MORSP ;See whether we're a dialin
MTOPR% ;Try to find out
TXNN B,MO%RMT ;Are we a dialin?
RET ;No, go back now +1
RETSKP ;Yes, go back +2
CHKPNV: MOVE A,FSTPNV ;Get first PNV number
CAMLE A,OURLIN ;Is it .GT. our tty?
RET ;Yes, go back +1
ADD A,NUMPNV ;Adjust for max PNV+1
CAMG A,OURLIN ;Is it .LE. our tty?
RET ;Yes, go back +1
RETSKP ;Else go back +2
CHKTVT: MOVE A,FSTTVT ;Get first TVT number
CAMLE A,OURLIN ;Is it .GT. our tty?
RET ;Yes, go back +1
ADD A,NUMTVT ;Adjust for max TVT+1
CAMG A,OURLIN ;Is it .LE. our tty?
RET ;Yes, go back +1
RETSKP ;Go back +2
CHKPTY: MOVE A,FSTPTY ;Get first PTY number
CAMLE A,OURLIN ;Is it .GT. our tty?
RET ;Yes, go back +1
ADD A,NUMPTY ;Adjust for max PTY+1
CAMG A,OURLIN ;Is it .LE. our tty?
RET ;Yes, go back +1
RETSKP ;Yes we are a PTY, go back +2
$DTYPE: FIELD(COMDTY,R)
%DTYPE: HRRZ B,(B) ;Get where the definition lives
MOVE A,(B) ;And get the actual definition
CHECK DTYPE,DEFAULT-TYPE
MOVEM A,DTYPE
JRST SETTY0 ;Go set the ttyloc if we need to
SETTYP: CHECK TYPE,TYPE
MV. <(B)>,TYPE ;Got the address of the type, now save type
SETTY0:
MOVE C,TRMCAP ;Get our current value of TRMCAP
CAME C,[-1] ;Is it pointing to anything?
JRST CRET ;Yes, don't set something on top of it
SKIPN C,1(B) ;Do we have a termcap here?
JRST CRET ;No, go back
MOVEM C,TRMCAP ;Otherwise save this as our termcap
JRST CRET ;And go back
$TRMCP: FIELD(COMFLD,R) ;Parse a field for the termcap
HRROI A,ABBUF ;Pointer to the atom buffer
HRROI B,NEWTCP ;And pointer to the new termcap
MOVEM B,TRMCAP ;Save this as our current termcap
MOVNI C,LNMLEN*5 ;How many chars long this can be
CALL STRCPY ;Copy the string over, including null byte
JUMPN C,CRET ;Go back if we won
SETOM TRMCAP ;Whoops, we don't have a termcap
TMSG <
?Termcap string too long> ;Give an error
JRST COMLOP ;And go get more commands
$EXIT: SKIPE FILEF
JRST [ SETZM EXITS
RETSKP]
CHECK EXITF,EXIT
SETZM EXITF
RETSKP
%FLAG: TDZA A,A
$FLAG: MOVEI A,1
CHECK FLAGF,FLAG
MOVEM A,FLAGF
JRST CRET
%FORM: TDZA A,A
$FORM: MOVEI A,1
CHECK FORMF,FORMFEED
MOVEM A,FORMF
JRST CRET
%DIAL: TDZA A,A
$DIAL: MOVEI A,1
CHECK DIALF,DIALUP
MOVEM A,DIALF ;Save it
JRST CRET
%NVT: TDZA A,A
$NVT: MOVEI A,1
CHECK NVTF,NVT
MOVEM A,NVTF
JRST CRET
$HELP: SKIPE FILEF
JRST [ SETZM HELPS
RETSKP]
CHECK HELPF,HELP
SETZM HELPF
RETSKP
$LENGT: CHECK LENGTH,LENGTH
FIELD(COMNUM,R)
MOVEM B,LENGTH
JRST CRET
%LOWER: TDZA A,A
$LOWER: MOVEI A,1
CHECK LOWERF,LOWERCASE
MOVEM A,LOWERF
JRST CRET
$100AN: TDZA A,A
$10052: MOVEI A,1
SKIPL VT100F
JRST [ SKIPE FILEF
RETSKP
TMSG <?Cannot give VT100->
HRROI A,[ASCIZ /ANSI/]
SKIPE VT100F
HRROI A,[ASCIZ /52/]
PSOUT
TMSG < more than once
>
RET]
MOVEM A,VT100F
JRST CRET
%PGSPD: CHECK SPEED,NO-PAGE-SPEED
FIELD(COMSPD,R) ;GET SPEED
HRRZ B,(B) ;GET VALUE
MOVEM B,SPEED ;AND SAVE HERE
JRST CRET
%PAUSE: TDZA A,A
$PAUSE: MOVEI A,1
CHECK PAUSEF,PAUSE-AT-END-OF-PAGE
MOVEM A,PAUSEF
JRST CRET ;NO, DONE
%CTLS: TDZE A,A
$CTLS: MOVEI A,1
CHECK CTLSF,PAUSE-ON-COMMAND
MOVEM A,CTLSF
JRST CRET
%REFSY: TDZE A,A
$REFSY: MOVEI A,1
CHECK REFSYS,REFUSE-MESSAGES
MOVEM A,REFSYS
JRST CRET
IFN LOTSW!GSBSW,<
$OPERA: MOVEI A,1 ;OPERATOR permitted to login on this tty
CHECK OPERA,OPERATOR
MOVEM A,OPERA
JRST CRET
>;IFN LOTSW!GSBSW
%RAISE: TDZA A,A
$RAISE: MOVEI A,1
CHECK RAISEF,RAISE
MOVEM A,RAISEF
JRST CRET
%TAB: TDZA A,A
$TAB: MOVEI A,1
CHECK TABF,TAB
MOVEM A,TABF
JRST CRET
$WIDTH: CHECK WIDTH,WIDTH
FIELD(COMNUM,R)
MOVEM B,WIDTH
JRST CRET
$FULL: MOVEI A,.TTFDX
JRST DODUM
$HALF: MOVEI A,.TTHDX
JRST DODUM
$LHALF: MOVEI A,.TTLDX
DODUM: CHECK LINEF,DUPLEX
MOVEM A,LINEF
JRST CRET
%FILE: SETZ A,
JRST GFILE
$FILE: MOVE A,[FILBLK,,CMGJFN]
BLT A,CMGJFN+FILLEN-1
FIELD(COMFIL,R)
MOVE A,B
GFILE: CHECK FJFN,FILE
MOVEM A,FJFN
CRET: AOS CHANGE
RETSKP
COMQST: FLDDB. .CMQST
$ADDRE: CHECK ADDRE,ADDRESS
FIELD(COMQST,R)
HRROI A,ADDRE
HRROI B,ABBUF
MOVEI C,5*6-1 ;UP TO 34 CHARACTERS
SETZB D,ADDRE ;CLEAR LOW BIT, SINCE BUGGY MONITOR DOESN'T
SOUT ;COPY THE STRING
IDPB D,A ;ENSURE A NULL TERMINATED STRING
JRST CRET
;HERE ON /PRINT-NODE: TO SET THE USER'S DECNET NODE
$PRINT: CHECK PRINT,PRINT-NODE
FIELD (COMQST,R)
HRROI A,PRINT
HRROI B,ABBUF
MOVEI C,6 ;UP TO 6 CHARACTERS IN A NODE NAME
SETZB D,PRINT ;END ON A NULL, CLEAR DATA AREA
SETZM PRINT+1 ;CLEAR SECOND WORD OF DATA AREA
SOUT ;COPY THE STRING
JRST CRET
IFN LOTSW!GSBSW,<
$ASSIG: MOVEI A,1
CHECK ASSIG,ASSIGNABLE
MOVEM A,ASSIG
JRST CRET
$OVERH: MOVEI A,1
CHECK OVERH,OVERHEAD
MOVEM A,OVERH
JRST CRET
$CONSU: MOVEI A,1
CHECK CONSU,CONSULTANT
MOVEM A,CONSU
JRST CRET
$EXPRE: MOVEI A,1
CHECK EXPRE,EXPRESSTERMINAL
MOVEM A,EXPRE
JRST CRET
>;IFN LOTSW!GSBSW
LOCKEY: FLDDB. (.CMKEY,,LOCTAB,,,COMNUM) ;KEYWORD OR A NUMBER
$LOCAT: CHECK LOCAT,LOCATION
FIELD(LOCKEY)
HRRZ C,C ;GET FIELD ACTUALLY PARSED
CAIN C,LOCKEY ;DID WE PARSE A KEYWORD?
HRRZ B,(B) ;YES. IF NOT, NUMBER IS ALREADY IN B.
MOVEM B,LOCAT
JRST CRET
IFN LOTSW!GSBSW,<
LOCTAB: TABLE ;SUGGESTED NAMES FOR VALUES
T ARPANVT,11 ;LOCARP
T CERASLOBBY,2 ;LOCLOB
T CERASOTHER,3 ;LOCCOT
T DECNVT,12 ;LOCDEC
T DIALIN,6 ;LOCDIA
T ERL206,14 ;LOCERL
T ETHERNVT,10 ;LOCETH
T GANDALF,7 ;LOCGAN
T INTERNETNVT,15 ;LOCINT
T LARKIN,20 ;LOCLAR
T MEYER,16 ;LOCMYR
T OFFICE,1 ;LOCOFF
T PTY,13 ;LOCPTY
T TERMAN104,4 ;LOCTER
T TERMANLOBBY,17 ;LOCTLB
T TERMANOTHER,5 ;LOCTOT
T UNKNOWN,0 ;LOCUNK
TEND
>;IFN LOTSW!GSBSW
IFE LOTSW!GSBSW,<
LOCTAB: TABLE ;SUGGESTED NAMES FOR VALUES
T UNKNOWN,0 ;LOCUNK
TEND
>;IFE LOTSW!GSBSW
IFN LOTSW!GSBSW,<
$TOBAC: MOVEI D,5
JRST DIRECT
$TODIA: SKIPA D,[4]
$TOFRO: MOVEI D,3
JRST DIRECT
$TOGLA: SKIPA D,[2]
$TOLEF: MOVEI D,0
JRST DIRECT
$TOPAR: SKIPA D,[6]
$TORIG: MOVEI D,1
DIRECT: CHECK(DIRARR(D),<neighbor specification>)
FIELD(COMTRM,DIRERR) ; Parse a keyword (host name) or octal terminal
; number.
ACVAR HSTADR
HRRZ C,C ; Get the FDB address
CAIE C,COMHST ; Was it a host name?
IFSKP. ; Yes.
HRROI A,ABBUF ;Pointer to the host name
MOVX B,PN%NAM!PN%FLD!<2,,HSTADR> ;Where to put the data
PUSH P,D ;Save from certain doom...
PUPNM% ;Get the host number
IFJER.
ADJSP P,-1 ;Flush pushed arg
JRST DIRERR ;We had a mistake, oh well
ENDIF.
POP P,D ;Restore this reg
FIELD(COMPLS,DIRERR) ;Get a plus
FIELD(COMOCT,DIRERR) ;Get the octal number following
HLRZ A,HSTADR ;Get the net number
HRRZS HSTADR ;And isolate the host number
ELSE.
MOVE A,NETNUM ; Get net and host.
MOVE HSTADR,HSTNUM
ENDIF.
HRL B,HSTADR ; Get host number and...
LSH A,↑D27 ; ...fold in net number.
IOR B,A
MOVEM B,DIRARR(D)
ENDAV.
JRST CRET
DIRERR: TMSG <?Error in /NEIGHBOR argument: >
HRROI A,CMBUF
PSOUT%
TMSG <
?Parsing terminated for this file>
; JRST CNTCON ; Just stare at the wall.
>;IFN LOTSW!GSBSW
; Routine to halt, then type "?Can't continue" when continued.
CNTCON: DO.
HALTF%
TMSG <?Can't continue>
LOOP.
ENDDO.
SUBTTL COMMAND EXECUTION
COMDON: HRROI A,HLPMES
SKIPL HELPF
PSOUT
SKIPG CHANGE
JRST COMEND
SETOM FILEF ; Now reading file.
CALL SETTTY ; Set the network for this terminal.
FILCHK: MOVE A,TYPE ;SEE IF NEED CHECK NOW
CAIN A,-1
JRST [ CALL DOCHK
SKIPL TYPE ;STILL UNKNOWN?
JRST COMXCT ;NOPE, NO FILE PLEASE
JRST CKFILE]
CKFILE: SKIPLE A,FJFN
JRST FILGOT
JUMPE A,COMXCT ;DONE IF EXPLICIT NOFILE
SKIPGE TYPE ;DEFAULT SEARCH ONLY IF NO TYPE
SKIPL FILEF ;TRIED YET?
JRST COMXCT ;YES, NO MORE
MOVEI A,1
MOVEM A,FILEF ;FLAG TRYING DEFAULT FILE
SKIPN BINFLG ;DON'T IF WRITING A BINARY FILE!
CALL GETBIN ;TRY TO GET THE DATA FROM TTYINI.NET-BIN
SKIPN BINFLG ;FAILED, DON'T WORRY IF NOT CREATING BIN FILE
JRST COMXCT ;SUCCESS. GO DO IT.
MOVX A,GJ%OLD!GJ%SHT
HRROI B,[ASCIZ /FINGER:TTYINI.NET-CMD/]
GTJFN
JRST [ JSMSG(<Can't get FINGER:TTYINI.NET-CMD:>,%)
JRST COMXCT]
FILGOT: HRRZM A,IJFN
MOVX B,FLD(7,OF%BSZ)!OF%RD
OPENF
JRST [ TMSG <
?Can't open >
MOVEI A,.PRIOU
MOVE B,IJFN
SETZ C,
JFNS
ERCAL R
TMSG < because: >
CALL JSMSG0
JRST COMLOP]
SETOM FJFN
MOVE A,[DATBEG,,TMPARG] ;SAVE USER ARGS
BLT A,TMPARG+DATALN-1
MOVE A,IJFN ;[wew] map in the text file
SIZEF ;how big is it
SETZB B,C
PUSH P,B ;save byte count
HRLZ A,IJFN
MOVE B,[.FHSLF,,TXTPAG]
HRLI C,(PM%RD!PM%CNT)
PMAP
MOVE A,[POINT 7,TXTPGA] ;pointer to start of text
MOVEM A,CMSTAT+.CMBFP ;save in various COMND locations
MOVEM A,CMSTAT+.CMPTR
POP P,A ;get back count of bytes in file
MOVEM A,CMSTAT+.CMCNT ; and save it in various places too.
MOVEM A,CMSTAT+.CMINC
;[wew] end of faster table parsing?
FILLOP: HRROI A,CMBUF
MOVEI B,.NULIO
HRL B,IJFN
CALL DOINI
CALL CLEAN ;CLEAN UP LAST SCAN
SETOM EXITS
SETOM HELPS
MOVE A,[TMPARG,,DATBEG]
BLT A,DATEND-1
FIELD(COMLIN,FILERR) ;Else parse them as octal
HRRZ C,C
CAIN C,COMSTR
JRST ISOURS ;* ALWAYS MATCHES
CAIE C,CMDKEY ; Keyword?
IFSKP.
HRRZ B,(B) ; Yes, get the dispatch address.
JRST (B)
ENDIF.
CAIE C,COMOCT
JRST FILLOP ;IGNORE BLANK LINES
SKIPL HSTNUM ; Have we not seen a host yet?
IFSKP. ; Yes, then we can't associate this with a host
TMSG <
?Terminal line encountered without previous HOST line:
>
HRROI A,CMBUF
PSOUT%
TMSG <
?Aborting parse of file>
JRST CNTCON
ENDIF.
MOVE A,NETNUM ; Fold in net, host information for this line.
LSH A,↑D27
IOR B,A
HRL A,HSTNUM
IOR B,A
SKIPE BINFLG ;SKIP IF NOT CREATING A BINARY FILE
JRST BINLIN ;WRITE A LINE IN THE BINARY FILE
CAMN B,OURLIN ;FIND OUR LINE?
JRST ISOURS ;YES
jrst filer1 ;no. Not ours
FILERR: MOVEI A,.FHSLF
GETER
HRRZ B,B
CAIN B,COMNX9 ;EOF?
JRST FILNON ;YES, NONE FOUND
FILER1: FIELD(COMEOL,FILLOP) ;EAT LINE
JRST FILLOP
;SETTTY - set network address for a terminal.
;Call:
;Ret: OURLIN set to net, host and line number.
;Blasts A-D.
SETTTY: ACVAR <TIPADR,TIPLIN> ; If TIPADR is zero, says use local net
; address, else has net address for TIP.
; TIPLIN is the line number on the TIP.
MOVNI A,1 ; Get TTY number we're on.
MOVE B,[1,,C]
MOVEI C,.JITNO
GETJI%
JSHLT
MOVEM C,OURLIN ; Stash this.
MOVE B,FSTPNV ; Check if we're on a PNV.
ADD B,NUMPNV
SETZM TIPADR ; If zero, says set local net/host, else has
; TIP net address.
CAML C,FSTPNV ; In range?
CAML C,B
IFSKP. ; Yes, we are on a PNV. Are we on a TIP?
MOVE A,['NVTPUP'] ; Get table numbers for some tables.
SYSGT%
MOVE A,C ; Get index into NVTPUP table.
SUB A,FSTPNV
HRLS A
HRR A,B
GETAB% ; Get the entry from NVTPUP for this NVT.
JSHLT ; Some random error.
HRLZ C,A ; Save the port number.
MOVE A,['PUPFPT'] ; Get number of foreign port table.
SYSGT%
MOVE A,C ; Get back port number.
HRR A,B ; Get table number for PUPFPT.
GETAB% ; Get the foreign port address information.
JSHLT
HRRZ D,A ; Save the port address, flush the count.
HRR A,PARNUM ; Get the monitor address of PUPBUF.
HRLI A,1 ; (Index 1 in PUPPAR).
GETAB%
JSHLT
SUB D,A ; Get index into PUPBUF
MOVE A,['PUPBUF'] ; Get number of PUPBUF table
SYSGT%
HRLI A,1(D) ; Index to net address for this foreign port
HRLI B,2(D) ; Index to second word of net address.
HRR A,B ; Get PUPBUF table number
GETAB% ; Get first word of net address
JSHLT
MOVEM A,TIPADR ; Save it.
MOVEM A,TEMP ; Set up for PUPNM%.
SETZM TEMP+1 ; Flush socket information.
MOVE A,B ; Get the socket information.
GETAB%
JSHLT
ANDI A,777 ; Flush most of the junk, just want the line.
MOVEM A,TIPLIN ; Save it.
HRROI A,TEMP ; Put ASCIZ address there
MOVX B,PN%FLD!TEMP
PUPNM%
IFNJE. ; Then look if this is a tip...
MOVE B,TEMP
TLZ B,201004 ; Uppercase first three letters
CAML B,[ASCIZ/TIP-/] ; Is it?
CAML B,[ASCIZ/TIP./]
SETZM TIPLIN ; No, indicate to use local net/host.
ELSE.
SETZM TIPLIN
ENDIF.
ELSE. ;(not a PUP NVT)
;[wew82] be smart for Suns and things coming in over internet connections too.
SETZM TIPADR
CALL CHKTVT ;are we on a TVT?
IFSKP. ;is a TVT
MOVX A,TCP%TV ;ARGUMENT IS TVT
HRR A,OURLIN ;OUR TVT NUMBER
HRROI B,7 ;WANT HOST NUMBER
HRROI C,D ;PUT IT IN D
STAT%
SETZ D,
LDB A,[POINT 8,D,11] ;get class A network number
CAIE A,↑d36 ;Stanford network number?
IFSKP. ;SUNet
LDB A,[POINT 8,D,19] ;get subnet (pup network) number
LDB B,[POINT 8,D,35] ;get host number from that net
HRRM B,TIPADR ;save host number in right half
HRLM A,TIPADR ;and network number in left half
ENDIF. ;(Not SUNet)
ENDIF. ;(Line is a TVT)
ENDIF. ;(Not a PUP NVT)
;[wew82] end of edit
IFE. TIPADR ; If 0, then set local net/host information.
MOVE A,LCLNET ; Merge in net and host information for this
LSH A,↑D27 ; line.
IORM A,OURLIN
HRL A,LCLHST
IORM A,OURLIN
ELSE. ; We're on a TIP, set the net and host for it.
HRRM TIPLIN,OURLIN ; Set the line.
HRLM TIPADR,OURLIN ; Drop in the host number.
MOVSS TIPADR ; Get the net number in the right half.
DPB TIPADR,[POINT 9,OURLIN,8] ; Drop in the net number.
ENDIF.
ENDAV.
RET
;[wew82] SETLCL - set OURLIN to local net, host, and tty line number
SETLCL: MOVNI A,1 ;get TTY number
MOVE B,[1,,OURLIN]
MOVEI C,.JITNO
GETJI%
JSHLT
MOVE A,LCLNET ;merge in net and host info for this line
LSH A,↑D27
IORM A,OURLIN
HRLZ A,LCLHST
IORB A,OURLIN ;return number in A too
RET
;$HOST - handle HOST keyword in command file.
$HOST: FIELD(COMHST,HSTERR) ; Get a host name.
HRROI A,ABBUF ;Pointer to the atom buffer
MOVX B,PN%NAM!PN%FLD!<4,,TEMP> ;Allow room enough for multiple hosts
PUPNM% ;Do it
IFJER.
$HOST0: TMSG <
?Couldn't get information on host >
HRROI A,ABBUF ;Find out who smashed us
PSOUT%
TMSG <, aborting>
JRST CNTCON ;Shut down permanently
ENDIF.
SKIPN UNXFLG ;Making a unix file?
IFSKP. ;Yes...
;Here we're going to write out the host name
; again because this will get capitalization
; correct
HRROI A,HSTBUF ;Where to put the host string
MOVE B,TEMP ;Get the host number
CALL $PUPNS ;Make a string
JRST $HOST0 ;Didn't work, bomb
SETZ C, ;Get a null
IDPB C,A ;Drop it in
JRST FILLOP ;Get another line
ENDIF.
HLRZS B ; Get pointer to data for host.
SUBI B,2 ;Find out how many entires we have
IFN. B ;If we have more than one entry...
HLRZ A,TEMP+2 ;Get the net number of the pointer
SKIPN BINFLG ;Making a binary file?
IFSKP. ;Yes...
CALL NETDO ;Do net munging
ELSE.
MOVEM A,NETNUM ;Else just stash it
ENDIF.
HRRZ B,TEMP+2 ;Get the host number to set the pointer into
MOVE A,TEMP ;Get to where we wish to point
MOVEM A,NETPGA(B) ;Stash it
ENDIF.
HLRZ A,TEMP ; Get the net number.
SKIPN BINFLG ; Making a binary file?
IFSKP. ; Yes.
CALL NETDO ; Do net munging.
ELSE.
MOVEM A,NETNUM ; No, just stash net number.
ENDIF.
HRRZ A,TEMP ; Get the host number.
SKIPN BINFLG
IFSKP.
CALL HOSTDO ; Do host munging.
ELSE.
MOVEM A,HSTNUM ; Just stash host number if no binary file.
ENDIF.
JRST FILLOP ; Finished here.
HSTERR: TMSG <?Invalid host name in file: >
HRROI A,CMBUF
PSOUT%
TMSG <?Aborting parse of file.>
JRST CNTCON
;NETDO - Create or map a network's NET page.
;Call: A/ Net number of net to munge.
;Ret: +1 - Network's NET page in NETPAG.
NETDO: SAVEAC B
ACVAR NET
MOVE NET,A
CAMN NET,NETNUM ; Is this the net we have in memory?
IFSKP. ; No. Must set things up.
SKIPG NETNUM ; Do we have a net in memory?
IFSKP. ; Yes, unmap the old page.
SETOM A
MOVE B,[.FHSLF,,NETPAG]
SETZM C
PMAP%
ENDIF.
MOVEM NET,NETNUM ; Set this as the new net in memory.
MOVE B,FILPAG ; Get the page number of the second host page.
AOS B ; ...
MOVE C,NUMTTY+HSTPGA ; Get number of TTYs.
IMUL C,BLKSIZ+TTYPGA ; Get number of words of TTYINI information.
ADDI C,TTYBLK ; Point to the actual entry
LSH C,-↑D9 ; Make pages.
IFN. C ; If there are any map them out.
ADDM C,FILPAG ; Update this information.
MOVE A,[.FHSLF,,HSTPAG+1] ; Create some new pages in the file.
HRL B,NETJFN ; Create argument for PMAP%.
TXO C,PM%RD!PM%WR!PM%CNT
PMAP% ; Create the pages.
ENDIF.
SETOM A ; Unmap the host page, too.
MOVE B,[.FHSLF,,HSTPAG]
SETZM C
PMAP%
SETZM HSTNUM ;Clear current host - don't unmap twice!
SKIPL A,NETADR+TTYPGA(NET) ; Is there a page allocated for this net?
IFSKP. ; No ...
SETOM NETPGA ; Create a page of bits.
MOVE A,[NETPGA,,NETPGA+1]
BLT A,NETPGA+777
MOVE A,[.FHSLF,,NETPAG] ; Make a new page in the file.
AOS B,FILPAG ; Get a new page number.
MOVEM B,NETADR+TTYPGA(NET) ; Set it in the index page.
MOVEM B,MAPNET ; Make it the mapped net.
HRL B,NETJFN
MOVX C,PM%WR!PM%RD
PMAP%
EXCH A,B ; Map it back.
TXO C,PM%PLD
PMAP%
ENDIF.
HRL A,NETJFN ; Move in file's JFN.
MOVE B,[.FHSLF,,NETPAG] ; Map it there.
MOVX C,PM%RD!PM%PLD!PM%WR
PMAP%
ENDIF.
ENDAV.
RET
;HOSTDO - Create a host's data area.
;Call: A/ Host number to munge.
;Ret: +1 - Host's data page initialized in HSTPAG.
HOSTDO: ACVAR HOSTN
MOVE HOSTN,A
SKIPG A,HSTNUM ; Do we have a host right now?
IFSKP. ; Yes...
MOVE B,FILPAG ; Get the page number of the second host page.
AOS B ; ...
MOVE C,NUMTTY+HSTPGA ; Get number of TTYs.
IMUL C,BLKSIZ+TTYPGA ; Get number of words of TTYINI information.
ADDI C,TTYBLK ;Point past the header data
LSH C,-↑D9 ; Make pages.
IFN. C ; If there are any map them out.
ADDM C,FILPAG ; Update this information.
MOVE A,[.FHSLF,,HSTPAG+1] ; Create some new pages in the file.
HRL B,NETJFN ; Create argument for PMAP%.
TXO C,PM%RD!PM%WR!PM%CNT
PMAP% ; Create the pages.
ENDIF.
SETOM A ; Unmap the host page, too.
MOVE B,[.FHSLF,,HSTPAG]
SETZM C
PMAP%
ENDIF.
MOVEM HOSTN,HSTNUM ; Update this.
SKIPG A,NETPGA(HOSTN) ; Is there already an entry for this host?
IFSKP.
TMSG <?Duplicate host encountered in TTYINI.NET-CMD file: >
HRROI A,CMBUF
PSOUT%
TMSG <
?Aborting parse of file>
JRST CNTCON
ELSE. ; Generating file, and page doesn't exist.
SETZM NUMTTY+HSTPGA ; No TTYs seen so far.
SETOM DEFBLK+HSTPGA ; Set the rest of the bits in the page.
MOVE A,[DEFBLK+HSTPGA,,DEFBLK+HSTPGA+1]
BLT A,TTYBLK+HSTPGA+10776
MOVE A,[.FHSLF,,HSTPAG] ; Create the page in the file.
AOS B,FILPAG
MOVEM B,NETPGA(HOSTN) ; Update this pointer.
MOVEM B,MAPHST ; Make this the mapped host.
HRL B,NETJFN
MOVX C,PM%WR!PM%RD
PMAP%
EXCH A,B ; Map it right back in.
TXO C,PM%PLD
PMAP%
ENDIF.
ENDAV.
RET
ISOURS: FIELD(COMAND,TRMERR)
HRRZ B,(B)
MOVE A,B
HRRZ C,C
CAIN C,COMAND
JRST FILDON ;CONFIRMED
CAIN C,COMTYP
MOVEI A,SETTYP
CALL (A)
JRST TRMERR
JRST ISOURS
TRMERR: JSMSG <Command error in file>
TMSG <Line was: >
HRROI A,CMBUF
PSOUT
TMSG <
Will ignore terminal data line and continue scan
>
JRST FILERR
FILNON: MOVE A,[TMPARG,,DATBEG]
BLT A,DATEND-1
JRST FILDN1
FILDON: HRROI A,[ASCIZ \%Ignoring /EXIT from file
\]
SKIPL EXITS
PSOUT
HRROI A,[ASCIZ \%Ignoring /HELP from file
\]
SKIPL HELPS
PSOUT
FILDN1: SKIPE BINFLG ;SKIP IF NOT CREATING A BINARY FILE
CALL MAKBIN ;WRITE OUT THE BINARY FILE
MOVE A,IJFN
CLOSF
JCERR <CLOSF failed>
JRST FILCHK
COMXCT: SKIPL B,TYPE
JRST DOSTYP
SKIPGE B,DTYPE ;DEFAULT?
JRST NOSTYP
MOVEM B,TYPE ;YES, SET AS TYPE
CAIN B,-1
CALL DOCHK
SKIPGE B,TYPE
JRST NOSTYP
DOSTYP: tlc b,377777 ; if type=377777,,typeno then treat
tlze b,377777 ; as type num. instead of routine addr
CALL (B)
CALL SETLNM ;Set the logical name
MOVEI A,.CTTRM
STTYP
JCERR <STTYP failed>
CAIE B,.TTTEL ;TELERAYS RUN THE TELERAY PROGRAM FOR FREE HERE
JRST NOSTYP ; TO SET UP THEIR TABS
MOVX A,CR%CAP
CFORK
JRST NOSTYP
MOVEI D,(A)
MOVX A,GJ%OLD!GJ%SHT
HRROI B,[ASCIZ/SYS:TELERAY.EXE/]
GTJFN
JRST NOSTYP
HRLI A,(D)
GET
MOVEI A,(D)
SETZ B,
SFRKV
WFORK
KFORK
NOSTYP: MOVEI A,.CTTRM
RFMOD
SKIPN LOWERF
TXZ B,TT%LCA
SKIPLE LOWERF
TXO B,TT%LCA
SKIPN FORMF
TXZ B,TT%MFF
SKIPLE FORMF
TXO B,TT%MFF
SKIPN TABF
TXZ B,TT%TAB
SKIPLE TABF
TXO B,TT%TAB
SKIPN FLAGF
TXZ B,TT%UOC
SKIPLE FLAGF
TXO B,TT%UOC
SKIPN RAISEF
TXZ B,TT%LIC
SKIPLE RAISEF
TXO B,TT%LIC
SKIPL C,LINEF
STOR C,TT%DUM,B
SKIPN PAUSEF ;FIRST, USE PAUSE-AT-END-OF-PAGE
TXZ B,TT%PGM
SKIPLE PAUSEF
TXO B,TT%PGM
SKIPN CTLSF ;USE PAUSE-ON-COMMAND IF ANY
TXZ B,TT%PGM
SKIPLE CTLSF
TXO B,TT%PGM
STPAR
JCERR <STPAR failed>
SKIPGE C,LENGTH
JRST NOLEN
MOVEI A,.CTTRM
MOVEI B,.MOSLL
MTOPR
JCERR <Length MTOPR failed>
NOLEN: SKIPGE C,WIDTH
JRST NOWID
MOVEI A,.CTTRM
MOVEI B,.MOSLW
MTOPR
JCERR <Width MTOPR failed>
NOWID: SKIPGE C,REFSYS ;BY DEFAULT, USE SYSTEM DEFAULT
JRST NOREF
MOVEI A,.CTTRM
MOVEI B,.MOSNT ;N.B. THIS CODE DEPENDS ON .MOSMY=0
TRC C,1 ; AND .MOSMN=1
MTOPR
JCERR <Refuse Messages MTOPR failed>
NOREF: MOVE A,PRINT ;FETCH FIRST WORD OF NODE NAME
CAMN A,[-1] ;-1 MEANS NOTHING SET
JRST NOSTJB ;SO SKIP THIS
SETO A, ;-1 FOR THIS JOB
MOVX B,.SJLLO ;FUNCTION IS SET JOB LOCATION
HRROI C,PRINT ;POINTER TO NODE NAME
SETJB% ;SET IT
JCERR <Unable to set job location>
NOSTJB: SKIPGE PAUSEF
JRST NOXOF
MOVEI A,.CTTRM
MOVEI B,.MOXOF
MOVEI C,.MOONX
SKIPN PAUSEF
MOVEI C,.MOOFF
MTOPR
JCERR <Pause MTOPR failed>
NOXOF: SKIPGE SPEED ;SPEED TO CUT-OFF AT SPECIFIED?
JRST COMEND
MOVEI A,.CTTRM
MOVEI B,.MORSP
MTOPR
ERJMP [JSMSG <Failed to read speed for controlling terminal>
JRST COMEND]
CAMN C,[-1]
JRST COMEND
HRRZ C,C ;GET OUTPUT SPEED
CAMLE C,SPEED ;SPECIFIED SPEED LESS THAN ACTUAL?
JRST COMEND ;YES, LEAVE PAGE MODE ON
MOVEI A,.CTTRM
MOVEI B,.MOXOF
MOVEI C,.MOOFF
MTOPR
JCERR <Failed to set /NO-PAUSE-AT-END-OF-PAGE>
JRST COMEND
;SETLNM - Set the logical name to whatever we need. Note that since this is
; for the unix TERM environment variable, case is important. Therefore we
; need to copy the logical name to our local area and quote any lowercase
; character that isn't ['A'..'Z','0'..'9','<','>','-','.','↑@'] with a ↑V.
;Takes TRMCAP/ Pointer to string to create, or -1 if none
SETLNM: SAVEAC <A,B,C,D>
MOVE A,TRMCAP ;Get the source
CAMN A,[-1] ;Anything there?
JRST CLRLNM ;Nope, clear the logical
STKVAR <<LNAM,LNMLEN*2>>
MOVEI D,.CHCNV ;↑V is the quote char
MOVEI B,LNAM ;Pointer to our destination for logical
HRLI B,(<POINT 7,0>) ;Make it a byte pointer (LNAM is STKVAR)
TLC A,-1 ;Is this a string pointer?
TLCN A,-1 ;(Meaning was LH -1?)
HRLI A,(<POINT 7,0>) ;Yes, make a byte pointer
DO.
ILDB C,A ;Get a char
CALL LNMOK. ;Is this char okay by itself?
IDPB D,B ;Nope, drop in the quoter
IDPB C,B ;And the char itself
JUMPN C,TOP. ;Go to the top if it's not a null
ENDDO.
MOVE C,[POINT 7,LNAM] ;Get a pointer to the logical name
ILDB A,C ;Get the first char
JUMPE A,CLRLNM ;If it's nothing, clear the logical
MOVEI A,.CLNJB ;Create job-wide logical name
HRROI C,LNAM ;Pointer to the name itself
SETLN0: HRROI B,[ASCIZ \TERM\] ;What to set it to
CRLNM% ;Try to do it
JFCL ;Oh well
RET
CLRLNM: MOVEI A,.CLNJ1 ;Delete this logical name
JRST SETLN0 ;And go finish up
ENDSV.
;LNMOK - check to see if this char is okay by itelf
;Takes C/ Char to check
;Returns +1 - No, need to quote
; +2 - Okay, don't need quoting
LNMOK.: JUMPE C,RSKP ;If it's null, don't quote
CAIE C,"<" ;Less than?
CAIN C,">" ;Or greater than?
RETSKP ;Yes, okay
CAIE C,"-" ;Dash?
CAIN C,"." ;Or period?
RETSKP ;Yes, those are okay, too
CAIL C,"0" ;In the range of '0'
CAILE C,"9" ; to '9'?
TRNA ;Nope, skip
RETSKP ;Otherwise it is a valid char
CAIL C,"A" ;Same with 'A'
CAILE C,"Z" ; to 'Z'
TRNA
RETSKP
RET ;Otherwise go back needing quote
XLIST
HLPMES: ASCIZ \
TTYINI is a program to set terminal types. Normally it reads the
necessary information from the file FINGER:TTYINI.NET-BIN. You may
selectively override any or all of the values contained in the file.
The command format is an optional terminal type name followed by
optional switches.
Available terminal type names:
33 Model 33 hardcopy terminal.
35 Model 35 hardcopy terminal.
37 Model 37 hardcopy terminal.
43 Model 43 hardcopy terminal.
ADM-3 LSI ADM-3 or other "glass teletype".
ALTO XEROX Alto running Datamedia 2500 emulation with 60 line screen
AMBASSADOR Ann Arbor Ambassador terminal.
ANN-ARBOR Ann Arbor terminal.
ANSI ANSI standard terminal
AVT Concept AVT terminal
CHECK Special type. When given, causes the terminal to be
polled to determine type. Currently works for VT50,
VT52, VK100 (GIGI), VT100, VT125, LA34 and LA120 terminals.
If the type is successfully determined, reading of any
file is suppressed. A VT100 can be in VT52 mode. This
case is indicated during the checking procedure.
DATAMEDIA-1520 Datamedia model 1520
DATAMEDIA-2500 Datamedia model 2500 or modified 3000 terminal.
DEFAULT System default terminal type.
DIABLO Diablo printer (sets to LA36)
DM1520 Same as DATAMEDIA-1520
DM2500 Same as DATAMEDIA-2500
ESPRIT Hazeltine Esprit
EXECUPORT Execuport terminal.
FR100 Same as Freedom-100
FR200 Same as Freedom-200
FREEDOM-100 Liberty Electronics Freedom-100
FREEDOM-200 Liberty Electronics Freedom-200
GIGI DEC VK100 graphics terminal
H19 Same as ZENITH.
HAZELTINE-1500 Hazeltine 1500 terminal.
HEATH-19 Same as ZENITH.
HP2645A HP 2645 or related terminal.
IBM-3101 IBM 3101 ASCII terminal
IDEAL Does no special character processing.
LA120 DEC LA120 terminal.
LA30 DEC LA30 terminal.
LA34 DEC LA34 terminal.
LA36 DEC LA36 terminal.
LA38 DEC LA38 terminal.
NVT "Network Virtual Terminal", equivalent to IDEAL.
SOROC-120 Soroc IQ120 terminal.
SUN SUN work station. A VT100 with a long (28 line) screen.
SUN48 SUN work station with 48 line screen.
TEK4023 Tektronix 4023 terminal.
TEK4025 Tektronix 4025 terminal.
TEKTRONIX-4023 Tektronix 4023 terminal.
TEKTRONIX-4025 Tektronix 4025 terminal.
TELEMEDIA Televideo with Datamedia emulation. Same as Datamedia-2500.
TELERAY-1061 Teleray 1061 terminal with edit key.
TELEVIDEO-912 Televideo 912 terminal.
TERMINET Terminet terminal. (worst possible)
VK100 DEC GIGI.
VT05 DEC VT05 video terminal.
VT100 DEC VT100 video terminal.
VT50 DEC VT50 video terminal.
VT52 DEC VT52 video terminal.
The following switches may be given:
/BINARY-FILE Instead of setting terminal parameters, read the
file FINGER:TTYINI.NET-CMD and write a new copy of
FINGER:TTYINI.NET-BIN. Various special switches may
be included in TTYINI.NET-CMD; see below.
/DEFAULT-TYPE:type-name
If terminal type not specified, use this type.
/DIALIN-DEFAULT:type-name
If terminal is a dialin then do same as /DEFAULT-TYPE.
/ETHERNET-DEFAULT:type-name
If terminal is an Ethernet terminal then do same as
/DEFAULT-TYPE.
/EXIT Exit at end of command.
/FILE:filespec Read "filespec" for terminal data by line number.
/FLAG Flag upper case output (precede by ').
/FORMFEED Send formfeed characters directly to terminal.
/FULLDUPLEX Set terminal to FULL DUPLEX mode.
/HALFDUPLEX Set terminal to CHARACTER HALF DUPLEX mode.
/HELP Print this text.
/INTERNET-DEFAULT:type-name
If terminal is an Internet terminal then do same as
/DEFAULT-TYPE.
/LENGTH:n Set terminal length (lines per page) to "n".
/LINE-HALFDUPLEX
Set terminal to LINE HALF DUPLEX mode.
/LOCAL-DEFAULT:type-name
If temrinal is a hardwired terminal then do same as
/DEFAULT-TYPE
/LOWERCASE Pass lower case characters to terminal.
/NOFILE Never read a file.
/NOFLAG Don't flag upper case output.
/NOFORMFEED Simulate formfeed characters.
/NOLOWERCASE Convert lower case to upper case on output.
/NO-PAGE-SPEED:n
The value "n" is the speed at or below which to
disable /PAUSE-ON-END-OF-PAGE. If the speed
of output from the computer to the terminal is
higher than the specified speed, the /PAUSE-ON-
END-OF-PAGE will be allowed either implicitly or
explicitly.
/NO-PAUSE-AT-END-OF-PAGE
Don't pause when end of page is reached.
/NO-PAUSE-ON-COMMAND
Don't pause when ↑S is typed.
/NORAISE Don't convert lower case to upper case on input.
/NOTAB Simulate tab characters.
/PAUSE-AT-END-OF-PAGE
Stop terminal output at end of page (when lines per
page lines have been output). Type ↑Q to cause output
to continue.
/PAUSE-ON-COMMAND
Stop terminal output when ↑S is typed. Type ↑Q to cause
output to continue.
/PTY-DEFAULT:type-name
If the terminal is a pseudo terminal then do the same
as /DEFAULT-TYPE.
/RAISE Convert lower case to upper case on input.
/REFUSE-MESSAGES Suppress the reception of system messages
/TAB Send tab characters directly to terminal.
/VT100-52 Used in conjuction with CHECK option. If terminal is
successfully identified as a VT100 in ANSI mode, it is
switched to VT100 in VT52 mode and that terminal type
is assumed.
/VT100-ANSI Used in conjuction with CHECK option. If terminal is
successfully identified as a VT100 in VT52 mode, it is
switched to VT100 in ANSI mode and that terminal type
is assumed.
/WIDTH:n Set terminal width to "n" characters.
If terminal type is not given and no /FILE:filespec or /NOFILE switches
are given, the file FINGER:TTYINI.NET-BIN is read.
The file FINGER:TTYINI.NET-CMD (read by the /BINARY-FILE command to build
FINGER:TTYINI.NET-BIN) contains information in text format for each line.
Each line of the file has the following format:
<line #> <same as TTYINI command line>
The <line #> indicates which line the command line applies to. The
file is parsed using the COMND JSYS. Several special switches are
only applicable inside of TTYINI.NET-CMD:
/ADDRESS:"quotedstring"
Use "quotedstring" as the location name known to the
FINGER program.
/ASSIGNABLE Assignable by the queueing system.
/CONSULTINGTERMINAL
Reserved for a LOTS consultant.
/EXPRESSTERMINAL
Reserved for short (5 min. or less) terminal sessions.
/LOCATION:location
Location of the terminal (currently one of ARPANVT,
CERAS105, CERASLOBBY, CERASOTHER, DECNVT, DIALIN,
ERL206, GANDALF, PTY, TERMAN104, TERMANOTHER, UNKNOWN).
/PRINT-NODE:"NODE"
Set the default print node for a job on this terminal
/OPERATOR Terminal can be used by the OPERATOR account.
/OVERHEAD Not subject to the normal 90 minute session time limit.
/TOBACK:n Terminal "n" is located "Behind you".
/TODIAGONAL:n Terminal "n" is located "Diagonally opposite you".
/TOFRONT:n Terminal "n" is located "Facing you".
/TOGLASS:n Terminal "n" is located "Across the glass from you".
/TOLEFT:n Terminal "n" is located "On your left".
/TOPARTITION:n Terminal "n" is located "Across the partition from you".
/TORIGHT:n Terminal "n" is located "On your right".
Examples:
TTYINI<cr>
Determine terminal data from FINGER:TTYINI.NET-BIN by line number.
TTYINI DATAMEDIA/WIDTH:84/LENGTH:38
Set terminal data explicity, this particular command would be
appropriate for a SUAI Datadisk terminal running DTN.
The following type names imply the indicated default switches
unless explicity overridden:
LA120 /NORAISE
LA34 LA120/NORAISE/NOFORMFEED/LOWERCASE
LA36 /NORAISE/LOWERCASE
LA38 /NORAISE/LOWERCASE
VK100 /NORAISE/PAUSE-AT-END-OF-PAGE/LOWERCASE
VT05 /RAISE/PAUSE-AT-END-OF-PAGE
VT50 /NORAISE/PAUSE-AT-END-OF-PAGE
VT52 /NORAISE/PAUSE-AT-END-OF-PAGE/LOWERCASE
VT100 /NORAISE/PAUSE-AT-END-OF-PAGE/LOWERCASE
VT125 /NORAISE/PAUSE-AT-END-OF-PAGE/LOWERCASE
\
LIST
SUBTTL CHECK HANDLER, TYPE ROUTINES
DOCHK: TMSG <[Terminal type is >
MOVEI A,.PRIOU
DOBE ;WAIT TILL OUT
CFIBF
RFMOD
MOVEM B,SAVMOD
TDZ B,[TT%ECO!TT%DAM]
SFMOD
DOBE
SETOM PASS ;FIRST PASS
HRROI A,[BYTE(7)33,132] ;QUERY FOR FIRST PASS
PASS2: PSOUT ;QUERY TERMINAL
MOVEI A,.PRIOU
DOBE
MOVEI C,↑D20 ;20 * 250 MS = 5 SECONDS
CHKLOP: SOJL C,CHKLOS
CALL GETCHR
JRST CHKLOP
CAIE A,33 ;CORRECT RESPONSE?
JRST CHKBAD ;NOT EVEN FIRST CHARACTER CORRECT
CALL GETCHR
JRST CHKLOS
CAIE A,"/" ;DEC terminal response?
JRST CKANSI ;NO, TRY ANSI RESPONSE
CALL GETCHR ;yes, get arg
JRST CHKLOS
CAIL A,"A"
CAILE A,"A"+DECMAX-1
JRST CHKLOS ;NOT IN DESIRED RANGE
SKIPN DECTAB-"A"(A)
JRST CHKLOS ;NO ENTRY FOR THIS ONE
MOVEI E,DECTAB-"A"(A)
CAIN E,T10052 ;IS THIS VT100 IN 52 MODE?
SKIPE VT100F ;YES, REQUESTING SWITCH TO 100 MODE?
CAIA ;NO, OK
JRST S100AN ;YES, SWITCH TO 100 MODE
MOVE D,DECTAB-"A"(A)
CHKOK: MOVEI A,.PRIIN
CFIBF
JRST CHKEND
S100AN: HRROI A,[BYTE(7)33,"<"] ;SET TO VT100-ANSI MODE
PSOUT
MOVE D,T100AN ;ASSUME OK, GET DISPATCH FOR VT100-ANSI
JRST CHKOK
CHKBAD: SETZM PASS ;IF BAD RESPONSE, NO SECOND-PASS
CHKLOS: MOVEI A,.PRIIN
CFIBF
AOSN PASS ;IS THIS FIRST PASS?
JRST [ HRROI A,[BYTE (7)33,133,"C"+40]
JRST PASS2] ;YES, TRY AGAIN WITH ANSI QUERY SEQ
MOVE D,[-1,,[ASCIZ /UNKNOWN]/]]
CHKEND: MOVE B,SAVMOD
SFMOD
HLREM D,TYPE
HRRZ A,D
PSOUT
RET
CKANSI: CAIE A,"["
JRST CHKLOS
MOVEI C,"?"
CALL CHKCHR
JRST CHKLOS
CALL GETCHR ; GET TYPE CODE
JRST CHKLOS
CAIL A,"1"
CAILE A,"0"+ANSIMX
JRST CHKLOS
MOVEI E,ANSITB-"1"(A)
CHKARG: CALL GETCHR
JRST CHKLOS
CAIE A,";"
JRST CHKANE
CALL GETCHR
JRST CHKLOS
CAIL A,"0"
CAILE A,"7"
JRST CHKLOS
JRST CHKARG
CHKANE: CAIE A,"C"+40
JRST CHKLOS
CAIN E,T100AN ;VT100 IN ANSI MODE?
SKIPG VT100F ;YES, REQUESTING SWITCH TO 52 MODE?
CAIA ;NO, GO AHEAD
JRST S10052 ;YES, DO IT
SKIPN D,(E) ;GET DISPATCH AND STRING (IF ANY)
JRST CHKLOS
JRST CHKOK
S10052: HRROI A,[BYTE(7)33,"[","?","2","L"+40] ;SET TO VT100-52 MODE
PSOUT
MOVE D,T10052 ;ASSUME OK, GET DISPATCH FOR VT100-52
JRST CHKOK
CHKCHR: CALL GETCHR
RET
CAMN C,A
RETSKP
RET
GETCHR: MOVEI A,.PRIIN
SIBE
JRST GETCH1
MOVEI A,↑D250
DISMS
MOVEI A,.PRIIN
SIBE
JRST GETCH1
RET
GETCH1: PBIN
ANDI A,177
RETSKP
$TT33: MOVEI B,.TT33
RET
$TT35: MOVEI B,.TT35
RET
$TT37: MOVEI B,.TT37
RET
$TT43: MOVEI B,.TT43
RET
$TTADM: MOVEI B,.TTADM
JRST VIDXIT
$TTALT: MOVEI B,.TTDAM
DEFAULT LENGTH,↑D60 ;DM2500 with big screen
JRST VIDXIT
$TTAMB: MOVEI B,.TTAMB
DEFAULT WIDTH,↑D79
DEFAULT LENGTH,↑D30
JRST VIDXIT
$TTANS: MOVEI B,.TTANS ;ANSI terminal type
JRST VIDXIT
$TTANN: MOVEI B,.TTANN
DEFAULT WIDTH,↑D80
JRST VIDXIT
$TTAVT: MOVEI B,.TTAVT
JRST VIDXIT
$TTCPT: MOVEI B,.TTCPT
JRST VIDXIT
$TTDAM: MOVEI B,.TTDAM
JRST VIDXIT
$TTDA2: MOVEI B,.TTDM2
JRST VIDXIT
$TTDEF: MOVEI B,.TTDEF
RET
$TTESP: MOVEI B,.TTESP
JRST VIDXIT
$TTEXE: MOVEI B,.TTEXE
RET
$TTGG: MOVEI B,.TTK10
JRST VIDXIT
$TTGVT: MOVEI B,.TTGVT
JRST VIDXIT
$TTFR2: SKIPA B,[.TTFR2]
$TTFRD: MOVEI B,.TTFRD
JRST VIDXIT
$TTGIL: MOVEI B,.TTGIL
JRST VIDXIT
$TTHAZ: MOVEI B,.TTHAZ
JRST VIDXIT
$TTH19: MOVEI B,.TTH19
JRST VIDXIT
$TTHP: MOVEI B,.TTHP
JRST VIDXIT
$TTIBM: MOVEI B,.TTIBM
JRST VIDXIT
$TTDIA: MOVEI B,1
MOVEM B,REFSYS ;WANT TO SET REF SYS LATER ON
MOVEI B,.TTL36 ;PRETEND LA36 IS THE TTY TYPE
RET
$TTTI: MOVEI B,3
RET
$TTIDL: MOVEI B,.TTIDL
RET
$TTL30: MOVEI B,.TTL30
RET
$TTL34: MOVEI B,.TT120
DEFAULT FORMF,0
JRST LOWXIT
$TTL36: MOVEI B,.TTL36
JRST LOWXIT
$TTL38: MOVEI B,.TTL38
DEFAULT FORMF,0
JRST LOWXIT
$TTSRC: MOVEI B,.TTSRC
JRST VIDXIT
$TTSUL: MOVEI B,.TT100 ;[wew82]
DEFAULT LENGTH,↑D48 ;VT100 with a very long screen
JRST VIDXIT
$TTSUN: MOVEI B,.TT100
DEFAULT LENGTH,↑D28 ;VT100 with a long screen
JRST VIDXIT
$TTTEK: MOVEI B,.TTTEK
DEFAULT LENGTH,↑D34
DEFAULT WIDTH,↑D78
JRST VIDXIT
$TTTK3: MOVEI B,.TTTK3
JRST VIDXIT
$TTTEL: MOVEI B,.TTTEL
JRST VIDXIT
$TTTVI: MOVEI B,.TTTVI
JRST VIDXIT
$TTTRM: MOVEI B,.TTDEF
RET
$TTV05: MOVEI B,.TTV05
DEFAULT RAISEF,1
RET
$TTV50: MOVEI B,.TTV50
DEFAULT PAUSEF,1
RET
$TT120: MOVEI B,.TT120
DEFAULT RAISEF,0
RET
$TT125: MOVEI B,.TT125
JRST VIDXIT
$TT100:
IFDEF .TT100,<
SKIPA B,[.TT100]
>;IFDEF .TT100
$TTV52: MOVEI B,.TTV52
VIDXIT: DEFAULT PAUSEF,1
LOWXIT: DEFAULT RAISEF,0
DEFAULT LOWERF,1
RET
;BINRD -- process binary data mapped in.
;call: a/ base of data block for our terminal
;ret: +1 always, with various data for TTYINI set
BINRD: SKIPLE B,B%TTYTYPE(A)
JRST [ HRLI B,377777 ;use special flag for LH
SKIPGE TYPE ;DON'T CHANGE IF ALREADY SET
MOVEM B,TYPE ;SET TYPE IF KNOWN
JRST .+1 ]
SKIPLE B,B%DEFTTYTYPE(A)
JRST [ HRLI B,377777 ;indicate actual type # rather than routine
SKIPGE DTYPE ;DON'T CHANGE IF ALREADY SET
MOVEM B,DTYPE ;SET /DEFAULT: IF KNOWN
JRST .+1 ]
SKIPG B,LENGTH ;USE EXISTING VALUE IF ANY
SKIPL B,B%LENGTH(A)
MOVEM B,LENGTH ;SET /WIDTH:
SKIPG B,WIDTH
SKIPL B,B%WIDTH(A)
MOVEM B,WIDTH ;SET /LENGTH:
SKIPG B,LINEF ;USE EXISTING VALUE IF ANY
SKIPL B,B%DPLXMODE(A)
MOVEM B,LINEF ;SET DUPLEX MODE
;SET PRINT NODE
DMOVE B,PRINT ;GET PRINT NODE (TWO WORDS)
CAME B,[-1] ;ANYTHING SET?
JRST BINRD0 ;SOMETHING ALREADY THERE, SKIP TO THE BITS
DMOVE B,B%PRINT(A) ;FETCH DEFAULT
CAMN B,[-1] ;DO WE KNOW ANYTHING?
DMOVE B,[ASCIZ/LOCAL/] ;NO, SO USE LOCAL:: AS OUR NODE NAME
DMOVEM B,PRINT ;SET THE NODE NAME UP
BINRD0: MOVE B,B%BITS(A) ;GET TABLE OF BITS
CAMN B,[-1] ;Did we select no bits at all?
MOVX B,B%DEFAULTS ;None selected, get the defaults
HRLZI C,-BINRLN ;GET NUMBER OF BITS WE'RE CHECKING.
BINRD1: MOVEI D,1 ;GET A "TRUE" VALUE
TDNN B,BINRTB(C) ;IS THIS BIT SET?
MOVEI D,0 ;NO, USE FALSE
SKIPGE @BINRTL(C) ;USE EXISTING VALUE IF ANY
MOVEM D,@BINRTL(C)
AOBJN C,BINRD1
MOVE B,TRMCAP ;Get the current value
CAME B,[-1] ;Do we have anything there now?
RET ;Yes, go back
MOVE B,B%TERMCAP(A) ;Get what we want to set it to
CAMN B,[-1] ;Anything in there?
RET ;No, go back now
MOVEM B,NEWTCP ;Save the first word
DMOVE B,1+B%TERMCAP(A) ;Get the other two words
DMOVEM B,1+NEWTCP ;And save it away
HRROI A,NEWTCP ;Get a pointer to the termcap string
MOVEM A,TRMCAP ;And save it away
RET ;ALL DONE
BINRTB: B%FORMFEED
B%LOWERCASE
B%TABS
B%PAGEPAUSE
B%COMMANDPAUSE
B%RAISE
B%FLAG
B%DIAL
BINRLN==.-BINRTB
BINRTL: IFIW!FORMF
IFIW!LOWERF
IFIW!TABF
IFIW!PAUSEF
IFIW!CTLSF
IFIW!RAISEF
IFIW!FLAGF
IFIW!DIALF
IFN <.-BINRTL>-BINRLN,<PRINTX %WARNING. BINRTB & BINRTL TABLES NOT SAME LENGTH
>
SUBTTL Binary file reading
;BINLOC -- find location of data block for terminal.
;Call: With TTYINI page 0 mapped at TTYPAG and NETJFN open on file.
; MAPNET -1 if no NET page mapped, else NET page index of mapped NET page
; A/ set up with our line number (net, host, line number)
;Ret: +1 - Terminal is not in file
; +2 - Success, with
; A/ Pointer to terminal data block in memory.
BINLOC: ACVAR LINNUM
SKIPE BINFLG ;Doing a binary file?
SKIPL A ;And if we're doing the default
TRNA
JRST BINLO0 ;If binary and doing default, return that
BINLO1: MOVE LINNUM,A
LDB A,[POINT 9,LINNUM,8] ; Get the network number for NETMAP.
CALL NETMAP ; Map the net page for this terminal.
IFNSK. ;[wew82] retry with our own net/host number
LDB A,[POINT 9,LINNUM,8] ; Get the network number
CAMN A,LCLNET ;already our own net?
RET ; Yes, really not in file, return bad.
CALL SETLCL ;set OURLIN to local net/host/tty
JRST BINLO1 ; and try again
ENDIF. ;[wew82] end of edit
LDB A,[POINT 9,LINNUM,17] ; Get the host number for HSTMAP.
CALL HSTMAP ; Map the HOST's TTYINI data, if it exists.
IFNSK. ;[wew82] failed - retry with our net/host
LDB A,[POINT 9,LINNUM,17] ; Get the host number for HSTMAP.
CAMN A,LCLHST ;already our host ?
RET ; yes - really fail.
CALL SETLCL ;get our net/host/tty
JRST BINLO1 ; and retry
ENDIF. ;[wew82] end of edit
HRRZ A,LINNUM ; Make this only a line number.
SKIPN BINFLG ;Creating a binary file?
CAMG A,NUMTTY+HSTPGA ;No, make sure line number's in range.
TRNA ;If creating binary or in range, tty's okay
JRST BINLO0 ; Not in the TTYINI file, use default.
IMUL A,BLKSIZ+TTYPGA ; Convert to an index to the block.
ADDI A,HSTPGA+TTYBLK ;Point to data (past header data)
SKIPE BINFLG ;Doing a binary file?
RETSKP ;Yes, return now with A set
SKIPE B%EXISTS(A) ;Does this entry exist?
BINLO0: MOVEI A,HSTPGA+DEFBLK ;No, point to the default one
ENDAV.
RETSKP ; Return done.
;NETMAP - Map a NET page.
;Call: A/ Network number.
;Ret: +1 - Failure, no TTYINI entries for this network number.
; +2 - Success, NETPAG containing the NET page for this network.
NETMAP: SKIPG A,NETADR+TTYPGA(A) ; If there's not an entry in the NET
RET ; index for this terminal's network, return bad
CAMN A,MAPNET ; Is this the mapped net?
IFSKP. ; No.
SKIPG MAPNET ; Is there a mapped net page?
IFSKP.
PUSH P,A
SETOM A ; Yes, unmap the old net page.
MOVE B,[.FHSLF,,NETPAG]
SETZM C
PMAP%
POP P,A ; Get back the page to map.
ENDIF.
MOVEM A,MAPNET ; Flag which page we've got mapped now.
HRL A,NETJFN ; Map the new net page.
MOVE B,[.FHSLF,,NETPAG]
MOVX C,PM%RD!PM%WR!PM%PLD
PMAP%
ENDIF.
RETSKP
;HSTMAP - Map a host's TTYINI data.
;Call: A/ Host number.
; NETPAG containing host indices for host's net.
; NETJFN open on TTYINI data file.
;Ret: +1 - Failure, no TTYINI entries for this host.
; +2 - Success, HSTPAG and subsequent pages containing host's TTYINI data
HSTMAP: STKVAR <TMPHST>
SKIPG A,NETPGA(A) ; Get page number for this host's TTYINI data.
RET ; No TTYINI data for this host.
TLNN A,-1 ;Is this a pointer to another host?
IFSKP. ;Yes...
HRRZM A,TMPHST ;Save the host number
HLRZS A ;Get net number in A
CALL NETMAP ;Map in that pagey
RET ;It failed, so say we failed
MOVE A,TMPHST ;Get back host number
HRRZS A ;Isolate it
JRST HSTMAP ;Go try this one
ENDIF.
CAMN A,MAPHST ; Is this the mapped host?
IFSKP.
SKIPG MAPHST ; No, is there a mapped host?
IFSKP.
PUSH P,A
SETOM A ; Yes, unmap the mapped host information.
MOVE B,[.FHSLF,,HSTPAG]
SKIPE C,NUMHST
TXO C,PM%CNT
PMAP%
POP P,A
ENDIF.
MOVEM A,MAPHST ; Flag which host we've got mapped.
HRL A,NETJFN ; Map the first page of this host's data.
MOVE B,[.FHSLF,,HSTPAG]
MOVX C,PM%RD!PM%WR!PM%PLD
PMAP%
MOVE C,NUMTTY+HSTPGA ; Get number of TTYINI blocks for this host.
IMUL C,BLKSIZ+TTYPGA ; Get the total words we are going to use.
ADDI C,TTYBLK ;Account for the header data
LSH C,-↑D9 ; Get a page count in C.
AOS C ; Adjust the page count to reflect reality.
MOVEM C,NUMHST ; Save this for unmapping code.
CAIN C,1 ; Is there more than one page of host info?
IFSKP. ; Yes...
AOS A ; Map the subsequent pages of host info.
AOS B
TXO C,PM%CNT!PM%WR!PM%RD
PMAP%
ENDIF.
ENDIF.
RETSKP ; Done here.
;GETBIN -- get default data from binary file TTYINI.NET-BIN
; No parameters on entry.
;Ret: +1 - Error, E.G. file not found, or bad format
; +2 - First page of file mapped at TTYPAG
GETBIN: MOVX A,GJ%OLD!GJ%SHT ; Get JFN for the file.
HRROI B,[ASCIZ/FINGER:TTYINI.NET-BIN/]
GTJFN%
ERJMP R ; No file.
HRRZM A,NETJFN ; Open it.
MOVX B,FLD(↑D36,OF%BSZ)!OF%RD
OPENF%
IFJER. ; Someone must be writing it.
RLJFN%
JFCL ; Loser...
RET
ELSE.
HRLZ A,A ; Now map the first page of the file.
MOVE B,[.FHSLF,,TTYPAG]
MOVX C,PM%RD!PM%PLD
PMAP%
IFNJE.
MOVE A,OURLIN ; Get our line number.
CALL BINLOC ; Figure out where our data is.
IFSKP.
AOS (P) ; Indicate we're winning.
CALL BINRD ; Process binary file now
ENDIF.
ENDIF.
SETOM A ; Now unmap first page.
MOVE B,[.FHSLF,,TTYPAG]
SETZM C
PMAP%
ERJMP .+1
SKIPG MAPNET ; Is there a NET page mapped?
IFSKP.
MOVE B,[.FHSLF,,NETPAG] ; Yes, unmap it.
PMAP%
ERJMP .+1
ENDIF.
SKIPG MAPHST ; Is there host information mapped?
IFSKP.
MOVE B,[.FHSLF,,HSTPAG] ; Yes, unmap it.
SKIPE C,NUMHST
TXO C,PM%CNT
PMAP%
ERJMP .+1
ENDIF.
MOVE A,NETJFN ; Now close the JFN.
CLOSF%
IFJER.
MOVE A,NETJFN ; Release it if we lose.
RLJFN%
JFCL
ENDIF.
ENDIF.
SETOM NETJFN ; Show no more JFN.
RET
SUBTTL Write unix-style ttyini file
$UNIXF: CONFIRM ;Wain for confirm
SETOM UNXFLG ;Say we're creating a unix file
SETOM BINFLG ;And fake making a binary flag
AOS CHANGE ;So we read in the filename
TMSG <Generating Unix TTYINI file...> ;Say what we're doing
MOVX A,GJ%SHT!GJ%NEW!GJ%FOU ;Get JFN for the new TTYINI.UNIX
HRROI B,[ASCIZ \FINGER:TTYINI.UNIX\]
GTJFN%
IFJER. ;If we can't...
TMSG <
?Can't get JFN for FINGER:TTYINI.UNIX>
JRST CNTCON ;Bomb unmercifully
ENDIF.
MOVEM A,NETJFN ;Save JFN for the file
MOVX B,OF%WR!OF%RD!FLD(↑D7,OF%BSZ) ;Open it
OPENF%
IFJER. ;If we can't do that
TMSG <
?Can't open FINGER:TTYINI.UNIX>
JRST CNTCON ;Bomb
ENDIF.
JRST COMDON ;Okay, go ahead
SUBTTL Write binary file from raw data file
$BINMK: CONFIRM ; Wait for confirmation.
SETOM BINFLG ; Flag that we're creating a binary file.
AOS CHANGE ; This needs twiddling for some reason.
TMSG <Generating network TTYINI binary file...> ; Say what we're doing.
MOVX A,GJ%SHT!GJ%NEW!GJ%FOU ; Get a JFN for the new TTYINI.NET-BIN.
HRROI B,[ASCIZ/FINGER:TTYINI.NET-BIN/]
GTJFN%
IFJER.
TMSG <
?Can't get JFN for FINGER:TTYINI.NET-BIN>
JRST CNTCON
ELSE.
MOVEM A,NETJFN ; Save JFN for the file.
MOVX B,OF%WR!OF%RD!FLD(↑D36,OF%BSZ) ; Open it.
OPENF%
IFJER.
TMSG <
?Can't get JFN for FINGER:TTYINI.NET-BIN>
JRST CNTCON
ELSE.
SETOM VERSION+TTYPGA ; Initialize the data structure.
MOVE A,[VERSION+TTYPGA,,VERSION+TTYPGA+1]
BLT A,VERSION+TTYPGA+777
MVI. B%DEFL,BLKSIZ+TTYPGA ; Number of words per TTY block.
MVI. B%VNO,VERSION+TTYPGA ; Version number of TTYINI.NET-BIN.
SETOM MAPNET ; Say no net page mapped.
SETOM MAPHST ; Say no mapped host pages.
SETZM FILPAG ; Zero file page counter.
MOVE A,[.FHSLF,,TTYPAG] ; Make the first page of the file.
HRLZ B,NETJFN
MOVX C,PM%WR!PM%RD
PMAP%
EXCH A,B ; Map it right back in.
MOVX C,PM%WR!PM%RD
PMAP%
ENDIF.
ENDIF.
JRST COMDON ; Join parse loop.
; Here to process a line of the raw data file.
BINLIN: MOVEM B,THELIN ; Save file's TTY number.
DO.
FIELD(COMAND,TRMERR)
HRRZ B,(B)
MOVE A,B
HRRZ C,C
CAIE C,COMAND ; Confirmation?
IFSKP.
SKIPE UNXFLG
JRST UNXWRT ;If doing a Unix file
CALL BINWRT ; Process this line of data if so.
JRST FILLOP
ENDIF.
CAIN C,COMTYP ; Parsed a TTY type?
MOVEI A,SETTYP
CALL (A) ; Call routine to fetch TTY type in B.
JRST COMERR ; Oops.
LOOP.
ENDDO.
;Process a line for a unix-style file
UNXWRT: MOVE A,NETJFN ;Where our data is going
HRROI B,HSTBUF ;Name of our current host
SETZ C, ;All chars we can handle
SOUT% ;Output it
MOVEI B,":" ;Separate with a colon
BOUT%
SKIPGE B,THELIN ;Get the terminal number
IFSKP. ;If it's not the default...
MOVEI C,↑D8 ;Radix octal
NOUT%
JFCL
ENDIF.
MOVEI B,":" ;Another colon
BOUT%
MOVE B,TRMCAP ;Do we have a termcap?
SKIPLE DIALF ;Dialin?
HRROI B,[ASCIZ \dialup\] ;Yes, say so
SKIPLE NVTF ;How about a network tty?
HRROI B,[ASCIZ \network\] ;Yes, advertise that fact
SETZ C, ;Do all chars
CAME B,[-1] ;Do we have something there?
SOUT% ;Yes, do it
MOVEI B,":"
BOUT%
MOVE B,ADDRE ;Get the current address
CAMN B,[-1] ;Anything there?
JRST UNXWR0 ;No, go around
HRROI B,ADDRE ;Otherwise get a pointer to it
SOUT% ;And output it
UNXWR0: MOVEI B,.CHCRT ;A CR
BOUT%
MOVEI B,.CHLFD ;And a line feed
BOUT%
JRST FILLOP ;Go for more
; Process all local versions set for this line.
BINWRT: ACVAR TTYPTR
SKIPGE A,THELIN ;If the tty line is -1
JRST BINWR1 ;If it's the default, go around
HRRZS A ;Clear the host information
CAMLE A,NUMTTY+HSTPGA ; Larger than number of TTYs seen so far?
MOVEM A,NUMTTY+HSTPGA ; Yes.
MOVE A,THELIN ; Get full TTY line descriptor back.
BINWR1: CALL BINLOC ; Find base of data for that line (into A).
IFNSK.
JSMSG <Invalid line number specified>
JRST COMLOP ; Oops. Invalid line number
ENDIF.
MOVE TTYPTR,A ; Get pointer to the data for TTY line.
SETZM B%EXISTS(TTYPTR) ; Make sure we know this entry exists
SKIPLE B,TYPE ; Set type if known.
CALL (B)
MOVEM B,B%TTYTYPE(TTYPTR)
MOVE A,TRMCAP ;Get our termcap pointer
CAMN A,[-1] ;Do we have anything there?
IFSKP. ;Yes...
HRROI B,B%TERMCAP(TTYPTR) ;Destination
MOVNI C,↑D15 ;How many chars we can manage
CALL STRCPY ;Copy them in
IFE. C ;Did we have too many chars?
TMSG <
?Termcap too long - "> ;Yes...
MOVE A,TRMCAP ;Get it
PSOUT% ;And show it
TMSG <", aborting> ;Say we're going to bomb
JRST CNTCON ;And go out
ENDIF.
ENDIF.
SKIPLE B,DTYPE ; Set /DEFAULT: if known.
CALL (B) ; N.B. We set flags based on default type!
MOVEM B,B%DEFTTYTYPE(TTYPTR)
MV. LENGTH,B%LENGTH(TTYPTR) ; Set /LENGTH:
MV. WIDTH,B%WIDTH(TTYPTR) ; Set /WIDTH:
MV. LINEF,B%DPLXMODE(TTYPTR) ; Set duplex mode
SETZ B, ; Start with false in all
TXO B,B%DEFAULTS ; Default those to on that we want
SKIPN LOWERF ; Clear /LOWER?
TXZ B,B%LOWERCASE ; Yes.
SKIPN PAUSEF ; Clear /PAUSE-AT-END-OF-PAGE?
TXZ B,B%PAGEPAUSE ; Default to on.
SKIPN CTLSF ; Clear /PAUSE-ON-COMMAND?
TXZ B,B%COMMANDPAUSE ; Yes.
MOVEI D,1 ; Get a "true" value for comparison.
CAMN D,FORMF ; Set these flags accordingly...
TXO B,B%FORMFEED
CAMN D,TABF
TXO B,B%TABS
CAMN D,RAISEF
TXO B,B%RAISE
CAMN D,FLAGF
TXO B,B%FLAG
IFN LOTSW!GSBSW,<
CAMN D,ASSIG
TXO B,B%ASSIGNABLE
CAMN D,OVERH
TXO B,B%OVERHEAD
CAMN D,CONSU
TXO B,B%CONSULTANT
CAMN D,EXPRE
TXO B,B%EXPRESS
CAMN D,OPERA
TXO B,B%OPERATOR
>;IFN LOTSW!GSBSW
CAMN D,REFSYS
TXO B,B%REFUSE
MOVEM B,B%BITS(TTYPTR) ; Finally, save all the bits.
HRROI A,B%ADDR(TTYPTR) ; Set up address string for FINGER.
HRROI B,ADDRE
MOVEI C,5*6
SETZ D,
SOUT%
DMOVE A,PRINT ; Fetch node (two words).
DMOVEM A,B%PRINT(TTYPTR) ; Set up DECNET node.
MV. LOCAT,B%LOCATION(TTYPTR)
HRLZI A,-8 ; Number of directions.
HRR B,TTYPTR
DO.
MV. DIRARR(A),B%NEIGHBOR(B) ; Set an entry.
AOS B
AOBJN A,TOP.
ENDDO.
ENDAV.
RET
; Here to finish saving data in the binary file.
MAKBIN: SKIPE UNXFLG ;Doing a unix file?
JRST MAKBI0 ;Yes, just close the file
SETOM A ; Unmap all pages we've got in memory.
MOVE B,[.FHSLF,,NETPAG]
SETZM C
PMAP%
MOVE C,NUMTTY+HSTPGA ; Calculate number of pages over HSTPAG to map.
IMUL C,BLKSIZ+TTYPGA
ADDI C,TTYBLK
LSH C,-↑D9
IFN. C ; If there's at least one page...
MOVE A,[.FHSLF,,HSTPAG+1] ; Unmap host's TTYINI data now.
HRL B,NETJFN
HRR B,FILPAG
AOS B
TXO C,PM%CNT!PM%WR
PMAP%
ENDIF.
MOVE B,[.FHSLF,,HSTPAG] ; Now unmap the first page of the TTYINI data.
SETZM C
PMAP%
HRRI B,TTYPAG ; Finally, the first page of the file.
PMAP%
MAKBI0: MOVE A,NETJFN ; Close the file now.
CLOSF%
IFJER.
TMSG <
?Fatal error closing TTYINI.NET-BIN>
JRST CNTCON
ENDIF.
MOVE A,IJFN ;[wew] unmap the text file
SIZEF
SETZB B,C
SETO A,
MOVE B,[.FHSLF,,TXTPAG]
HRLI C,(PM%CNT)
PMAP
HRROI A,CMBUF
MOVEM A,CMSTAT+.CMBFP ;save in various COMND locations
MOVEM A,CMSTAT+.CMPTR
MOVEI A,MAXCHR
MOVEM A,CMSTAT+.CMCNT ; and save it in various places too.
SETZM CMSTAT+.CMINC
SETZM BINFLG ;NOT CREATING A BINARY FILE
TMSG <[OK]> ; Signal that all went okay.
RET ; Return to caller.
; Get local host
INIHST: MOVE A,[SIXBIT \PUPROU\] ;Pup routing table
SYSGT% ;Get table length, first entry in table
JUMPE B,CNTCON ;If zero then no such table
HRRZM B,D ;Save table number
HLLZS B ;Set up AOBJN pointer
JRST ETHNM ;Already have first entry
DO.
HRL A,B ;Left half of A is index
HRR A,D ;Right half is table number
GETAB% ;Get the table entry
ERJMP CNTCON ;Failed, can't find ourselves
ETHNM: HRRZS A ;Clear left to only get host num
JUMPN A,ENDLP. ;Go out if done
AOBJN B,TOP. ;Otherwise try next one
JRST CNTCON ;Shut down, can't find self
ENDDO.
HRRM A,LCLHST ;Copy host number
HRRI A,1(B) ;Get the net number
MOVEM A,LCLNET ;Save it too
RET
;STRCPY - Copy string over, including null byte
;Takes A/ Pointer to source
; B/ Pointer to desination
; C/ -Max chars (including null)
STRCPY: SAVEAC <D>
TLC A,-1 ;Toggle left hand side
TLCN A,-1 ;String pointer?
HRLI A,(<POINT 7,0>) ;Yes, make a byte pointer
TLC B,-1 ;Same with B
TLCN B,-1
HRLI B,(<POINT 7,0>)
STRCP0: ILDB D,A ;Get a char from the source
IDPB D,B ;Drop it in the destination
SKIPE D ;Go around looper if we hit the null
AOJL C,STRCP0 ;Otherwise loop until we've filled it up
SETZ D, ;Guarantee a null
DPB D,B ;And drop it in
RET ;Go back
;$PUPNS - Stolen from HSTNAM so we don't have to do different PSECTS
;The difference is we don't add the domain
IFNDEF PUPNM%,<
OPDEF PUPNM% [JSYS 443]
PN%NAM==:1B0
PN%FLD==:1B1
PN%OCT==:1B2
>;IFNDEF PUPNM%
$PUPNS::SAVEAC <C,D>
STKVAR <HSTPTR,<PUPHSN,2>>
MOVEM A,HSTPTR ; save host pointer
CAME B,[-1] ; want local address?
IFSKP.
MOVX A,SIXBIT/PUPROU/ ; get GETAB% index of PUPROU table
SYSGT% ; B/ -items,,table number
ERJMP R ; shouldn't happen
JUMPE B,R ; fail if no such table
HLLZ C,B ; C/ AOBJN pointer through PUPROU
DO.
HRR A,B ; table number
HRL A,C ; index in table
GETAB% ; get table entry
ERJMP R ; shouldn't happen
IFXE. A,1B0 ; network inaccessible?
JXN A,.RHALF,ENDLP. ; no, done if have local addr on this network
ENDIF.
AOBJN C,TOP. ; try next entry
RET ; unable to find our host address
ENDDO.
HRLI B,1(C) ; network # is 1+<PUPROU index>
HRR B,A ; host # is in RH of PUPROU entry
ENDIF.
MOVEM B,PUPHSN ; save host address argument
SETZM 1+PUPHSN ; don't want port info
MOVE A,HSTPTR ; destination string
MOVX B,PN%FLD!PN%OCT!<FLD 1,.LHALF> ; no defaults, use octal if have to
HRRI B,PUPHSN ; pointer to host address
PUPNM% ; call incredibly hairy Pup JSYS
ERJMP R ; failed
; HRROI B,[ASCIZ/#Pup/] ; add Pup domain
; CALL $ADDOM
MOVE B,PUPHSN ; return host number too in case argument -1
RETSKP
ENDSV.
.ENDPS TTCODE
END XWD EVL,EV