perm filename IMPRST.MID[S,NET]1 blob sn#424826 filedate 1979-03-10 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	TITLE IMPRST
C00005 ENDMK
C⊗;
TITLE IMPRST
SUBTTL MRC, 3/79

;  Send RSTs to every host on the Arpanet.  We don't want to waste time RSTing
; non-existant hosts.

A=1 ? B=2 ? C=3 ? D=4 ? E=5 ? RC=6 ? RH=7

UPGPRV==004000,,

IMPRST:	CAI
	RESET
	MOVSI (UPGPRV)
	SETPRV			; Need UPG priv to do RST
	INIT 17
	 'DSK,,
	 0
	 JRST 4,.
	DMOVE A,[SIXBIT/HOSTS2BIN/]
	MOVE D,['NETMRC]
	LOOKUP A		; Open channel to host table
	 JRST 4,.
	MOVS A,D		; D has negative swapped word count
	MOVNS A
	ADDI A,HSTTAB
	CORE A,			; Make sure enough core
	 JRST 4,.
	HRRI D,HSTTAB-1		; Form IOWD ptr to where we put host table
	SETZ E,
	IN D			; Read in host table
	 CAIA
	  JRST 4,.
	MOVE HSTTAB
	CAME ['HOSTS2]		; Make sure it looks reasonable
	 JRST 4,.
	INIT
	 'IMP,,
	 0
	 JRST 4,.
	MOVEI RC,22		; RST MTAPE function code
	MOVE E,HSTTAB+12	; E←address of NETWORK table (NETPTR)
	DMOVE A,HSTTAB(E)	; A←# of entries, B←# of words/entry
FNDARP:	DMOVE C,HSTTAB+2(E)	; C←net #, D←ptr to name,,addr of address table
	CAIE C,10.		; ARPA net?
	 JRST [	ADDI E,(B)
		SOJG A,FNDARP
		JRST 4,.]	; ARPA net not found in host table!
	DMOVE A,HSTTAB(D)	; A←# of entries, B←# of words/entry
RSTHST:	MOVE RH,HSTTAB+2(D)
	MTAPE RC
	ADDI D,(B)
	SOJG A,RSTHST
	EXIT

	CONSTANTS
HSTTAB:

END IMPRST