perm filename HOST.MID[HST,NET] blob
sn#696037 filedate 1983-01-14 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00006 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 TITLE HOST
C00005 00003 HSTSID HSTFN1 HSTVRS HSTWHO HSTDAT HSTTIM NAMPTR NUMPTR NUMNUM NUMSYS NUMNAM NUMBTS NUMSRV NUMMCH NAMNAM
C00007 00004 BEG FLSINP HSTCOM CMDSCN PROMPT DOCMD HSTLUP GOTHST CNTCHR
C00010 00005 SEARCH SRCNXW SRCWIN OFFNAM MCHTYP ENDNIC NXTHST
C00013 00006 MAPHST OCTOUT DECOUT NUMOUT PDL MONCMP HSTADR HSTTOP HSTEXT ...LIT
C00015 ENDMK
C⊗;
TITLE HOST
SUBTTL Host table format
COMMENT ⊗
The format of the host table binary file is:
word 0 SIXBIT /HOSTS1/
word 1 SIXBIT /HOSTS/
word 2 version HOSTS file which this was compiled from.
word 3 user name of person who compiled this generation of the host table
word 4 Date of compilation as sixbit YYMMDD
word 5 Time of compilation as sixbit HHMMSS
word 6 Address in file of NAME table.
word 7 Address in file of NUMBER table.
NUMBERS table:
word 0 Number of entries in this table.
word 1 Number of words per entry (currently 3).
followed by entries, in order by host number.
Each entry looks like this:
word 0 host number
word 1 LH pointer to system name (ITS, TIP, TENEX, etc.)
May be 0 → not known.
word 1 RH pointer to official name of host.
word 2 LH flags:
4.9 1 → server site.
word 2 RH pointer to machine name (PDP10, etc).
May be 0 → not known.
...
NAMES table:
word 0 Number of entries
followed by one word entries, sorted by the host name treated as a vector of
signed integers, looking like:
word 0 LH address in file of NUMBERS table entry for this host.
RH pointer to host name
...
Host, system and machine names are ASCIZ strings, all letters upper case.
The strings are stored before, after and between the NAME and NUMBER tables.
⊗
;HSTSID HSTFN1 HSTVRS HSTWHO HSTDAT HSTTIM NAMPTR NUMPTR NUMNUM NUMSYS NUMNAM NUMBTS NUMSRV NUMMCH NAMNAM
SUBTTL Host table definitions
; Table header
HSTSID==0 ; SIXBIT /HOSTS1/
HSTFN1==1 ; SIXBIT /HOSTS/
HSTVRS==2 ; FN2 of HOSTS file (if compiled at MIT)
HSTWHO==3 ; User name of person who compiled
HSTDAT==4 ; Date of compilation as sixbit YYMMDD
HSTTIM==5 ; Time of compilation as sixbit HHMMSS
NAMPTR==6 ; Address in file of NAMES table.
NUMPTR==7 ; Address in file of NUMBERS table.
; NUMBERS table
NUMNUM==0 ; host number
NUMSYS==1 ; LH pointer to system name
NUMNAM==1 ; RH pointer to official name of host.
NUMBTS==2 ; LH flags:
NUMSRV==400000 ; 4.9 → server site.
NUMMCH==2 ; RH pointer to machine name
; NAMES table
NAMNAM==0 ; <numbers pointer,,host name pointer>
;BEG FLSINP HSTCOM CMDSCN PROMPT DOCMD HSTLUP GOTHST CNTCHR
SUBTTL Start of program
BEG: JFCL
RESET
SETZM MONCMP
MOVE 17,[PDL(-50)]
PUSHJ 17,MAPHST ; map host table in core
RESCAN 1
JUMPE 1,PROMPT
INCHRS
JRST PROMPT
CAIE "H ; check for HOST command
CAIN "h
JRST HSTCOM
FLSINP: INCHRS
JRST PROMPT
CAIE 175
CAIN ↑J
JRST PROMPT
JRST FLSINP
HSTCOM: OUTSTR [ASCIZ/
/]
CMDSCN: INCHRS
JRST GOTHST
CAIE 175
CAIN ↑J
JRST GOTHST ; no command argument
CAIE <" >
JRST CMDSCN
SETOM MONCMP
JRST DOCMD
PROMPT: SKIPE MONCMP
EXIT 1,
OUTCHR ["#]
DOCMD: SETZM HSTEXT
MOVE [440700,,HSTEXT]
HSTLUP: INCHWL 1
ANDI 1,177
CAIN 1,↑M
INCHWL 1
CAIE 1,175
CAIN 1,↑J
JRST GOTHST
IDPB 1,
JRST HSTLUP
GOTHST: SKIPN HSTEXT
JRST [ MOVEI ['SYS,, ? 'HOSTAB ? 0 ? 0 ? 0 ? 0]
RUN]
SETZ 1,
IDPB 1,
MOVEI HSTEXT
; Set up various AC's for hairy search below. 0 has a pointer to the input
; host, 1 has the host table pointer, 2 has the character count.
MOVE 1,HSTADR ; base host address
MOVE 2,NAMPTR(1)
ADD 2,HSTADR ; address of NAMES table
HRLO 1,(2) ; # of entries,,-1
EQVI 1,(2) ; -<1+# of entries>,,table-1
ADJSP 1,1 ; now have AOJBN pointer to table
MOVE 3,
HRLI 3,440700 ; make byte pointer
SETZ 2, ; character count
; Compute character count in AC 2
CNTCHR: ILDB 4,3
JUMPE 4,[ SETZB 3,4 ; init pointers
JRST SEARCH]
CAIL 4,"a ; lowercase?
SUBI 4,"a-"A
DPB 4,3
AOJA 2,CNTCHR
;SEARCH SRCNXW SRCWIN OFFNAM MCHTYP ENDNIC NXTHST
SUBTTL Host name search
SEARCH: JUMPE 2,SRCWIN
MOVEI 5,(2) ; copy of count
MOVE 6, ; copy of source pointer
HRRZ 7,(1)
ADD 7,HSTADR ; pointer for this entry
SRCNXW: MOVE 10,(7)
MOVE 11,(6)
ANDCMI 11,1 ; 1.1 is a loser
CAIL 5,5. ; account for this word
JRST [ CAME 10,11 ; match for this word?
JRST NXTHST
SUBI 5,5. ; match, account for this word
ADDI 7,1
AOJA 6,SRCNXW] ; still more to go
AND 11,[.BYTE 7 ? 177 ? 000 ? 000 ? 000 ? 000
.BYTE 7 ? 177 ? 000 ? 000 ? 000 ? 000
.BYTE 7 ? 177 ? 177 ? 000 ? 000 ? 000
.BYTE 7 ? 177 ? 177 ? 177 ? 000 ? 000
.BYTE 7 ? 177 ? 177 ? 177 ? 177 ? 000](5)
CAMN 10,11 ; exact match?
JRST SRCWIN ; stop the presses!
SOJL 5,SRCWIN ; this string ends on word boundry
AND 10,[.BYTE 7 ? 177 ? 000 ? 000 ? 000 ? 000
.BYTE 7 ? 177 ? 177 ? 000 ? 000 ? 000
.BYTE 7 ? 177 ? 177 ? 177 ? 000 ? 000
.BYTE 7 ? 177 ? 177 ? 177 ? 177 ? 000](5)
CAME 10,11 ; match for partial word?
JRST NXTHST
SRCWIN: HRRZ 5,NAMNAM(1)
ADD 5,HSTADR
OUTSTR (5)
HLRZ 7,(1)
ADD 7,HSTADR
HRRZ 6,NUMNAM(7)
ADD 6,HSTADR
CAIN 5,(6)
JRST OFFNAM ; official name
OUTSTR [ASCIZ/ is a nickname for /]
OUTSTR (6)
OUTSTR [ASCIZ/ which/]
OFFNAM: OUTSTR [ASCIZ/ is number /]
LDB 10,[001100,,NUMNUM(7)]
PUSHJ 17,DECOUT
OUTCHR ["/]
LDB 10,[112200,,NUMNUM(7)]
PUSHJ 17,DECOUT
OUTSTR [ASCIZ/,
a /]
SKIPL NUMBTS(7)
SKIPA 10,[[ASCIZ/user /]]
MOVEI 10,[ASCIZ/server /]
OUTSTR (10)
HRRZ 6,NUMMCH(7)
JUMPE 6,[ OUTSTR [ASCIZ/unknown/]
JRST MCHTYP]
ADD 6,HSTADR
OUTSTR (6)
MCHTYP: OUTSTR [ASCIZ/ machine running /]
HLRZ 6,NUMSYS(7)
JUMPE 6,[ OUTSTR [ASCIZ/an unknown operating system.
/]
JRST NXTHST]
ADD 6,HSTADR
OUTSTR (6)
ENDNIC: OUTSTR [ASCIZ/.
/]
NXTHST: AOBJN 1,SEARCH
JRST PROMPT
;MAPHST OCTOUT DECOUT NUMOUT PDL MONCMP HSTADR HSTTOP HSTEXT ...LIT
SUBTTL Subroutines and stuff
; MAPHST -- Map host table into core if necessary
; Call: PUSHJ 17,MAPHST
; <return>
MAPHST: SKIPE HSTADR
POPJ 17,
OPEN [17 ? 'DSK,, ? 0] ; get a disk channel
JRST 4,.-1
MOVE ['HOSTS1] ? MOVSI 1,'BIN ? SETZ 2, ? MOVE 3,['HSTNET]
LOOKUP ; find file HOSTS1.BIN[HST,NET]
JRST 4,.-1
MOVE 2,JOBFF
MOVS 3 ? MOVN ? ADDB JOBFF ; get address of highest addr we need
MOVEM HSTTOP
CORE ; get more core from system maybe
JRST 4,.-1
MOVE 3 ? HRRI -1(2) ; compute IOWD to read host table in
SETZ 1,
INPUT
MOVE (2) ; get first word of host table
CAME ['HOSTS1]
JRST 4,.-1
MOVEM 2,HSTADR ; remember where host table begins
RELEAS
POPJ 17,
; Numerical output routines
; Call: MOVE 10,<number>
; PUSHJ P,DECOUT or OCTOUT
; <return>
OCTOUT: SKIPA 12,[10]
DECOUT: MOVEI 12,10.
NUMOUT: IDIVI 10,(12)
PUSH 17,11
SKIPE 10
PUSHJ 17,NUMOUT
POP 17,10
ADDI 10,"0
OUTCHR 10
POPJ 17,
PDL: BLOCK 50
MONCMP: BLOCK 1 ; -1 → got a monitor command
HSTADR: BLOCK 1
HSTTOP: BLOCK 1
HSTEXT: BLOCK 25
...LIT: CONSTANTS
END BEG