Google
 

Trailing-Edge - PDP-10 Archives - BB-L288A-RM - swskit-utilities/read.mac
There are 5 other files named read.mac in the archive. Click here to see a list.
;<V-SOURCES>READ.MAC.11, 18-Nov-77 09:00:21, EDIT BY MILLER
;INHIBIT ERROR LOGGING WHILST INHIBITING ERROR RECOVERY
;<V-SOURCES>READ.MAC.6,  8-Aug-77 08:56:56, EDIT BY MILLER
;<V-SOURCES>READ.MAC.5,  5-Apr-77 16:18:02, EDIT BY MILLER
;<V-SOURCES>READ.MAC.4,  5-Apr-77 15:20:52, EDIT BY MILLER
	SALL
	TITLE READ
	SEARCH MONSYM,MACSYM
	.REQUIRE SYS:MACREL
A==1
B==2
C==3
D==4
W==5
W1==6
W2==7
W3==10
PT==11
JFN==12			;WHERE TO SAVE THE JFN
TRY==13			;RETRY REGISTER
PTT==14
P==17				;PDL

PDL:	BLOCK 10
LSTDSK:	BLOCK 1
ERRTYP:	BLOCK 1
BUFFER:	BLOCK 11
IDXPAG==10000			;WHERE PTT IS
PTPAGE==11000			;CURRENT PT
DATPAG==12000			;WHERE FILE DATA GOES
STGADR==77,,-1

	RELOC 1000-140



FILOUT:	TXNN JFN,GJ%DEV!GJ%DIR!GJ%NAM!GJ%EXT!GJ%VER
	RET			;NO. DON'T DO NAME THEN
	MOVEI A,.PRIOU
	MOVEI B,0(JFN)
	SETZ C,			;OUTPUT THE NAME
	JFNS			;DO IT
	HRROI A,[ASCIZ /
/]
	PSOUT
	RET

SETUP:	MOVEM A,LSTDSK		;SAVE DISK ADDRESS
	MOVEI TRY,10		;MAX RETRIES WITH NO ERROR RECOVERY
SETUP1:	MOVEI B,.DOPSR		;STR RELATIVE ADDRESSING
	STOR B,DOP%AT,1		;STORE IT
	SETONE DOP%SN,1		;SAY DEVICE DESIGNATOR IN D
	MOVEI B,1000
	TXO B,DOP%IR!DOP%IL	;INHIBIT ERROR RECOVERY
	MOVE D,W2		;DEVICE DESIGANTOR
	SETZM ERRTYP		;ASSUME NO ERROR
	DSKOP			;DO IT
	JUMPN A,[ MOVE A,LSTDSK	;GET LAST DISK ADDRESSA AGAIN
		SOJGE TRY,SETUP1 ;DO MAX RETRIES BEFORE GIVING UP
		SETONE DOP%SN,A
		MOVEI W,.DOPSR
		STOR W,DOP%AT,A	;SET UP NEW ARGS
		TXZ B,DOP%IR!DOP%IL ;ALLOW ERROR RECOVERY THIS TIME
		DSKOP		;TRY IT AGAIN
		MOVEM A,ERRTYP	;REMEMBER THE ERROR
		RET]		;RETURN WITH CODE IN A
	CAIE TRY,10		;ANY RETRIES?
	SETOM ERRTYP		;YES. REMEMBER THIS
	RETSKP			;NO

PRTDSC:	HRROI A,[ASCIZ / DISK ADDRESS /]
	PSOUT
	MOVEI A,.PRIOU
	MOVE B,LSTDSK
	MOVEI C,10
	NOUT
	 JFCL
	HRROI A,[ASCIZ /
/]
	PSOUT
	RET

PTOUT:	SKIPA B,PT
PTTOUT:	MOVE B,PTT
	HRRZS B
	MOVEI C,10
	MOVEI A,.PRIOU
	NOUT
	 JFCL
	RET			;DONE



START:	RESET			;GET A CLEAN SLATE
	MOVE P,[IOWD 10,PDL]
	HRROI A,[ASCIZ /
FILE NAME(S) TO VERIFY: /]
	PSOUT
	MOVX A,GJ%OLD!GJ%FNS!GJ%SHT!GJ%CFM!GJ%IFG
	MOVE B,[.PRIIN,,.PRIOU]
	GTJFN			;GET THE FILE
	 JRST [	JSERR
		JRST START]	
	MOVE JFN,A		;SAVE ORIGINAL JFN
FILLOP:	CALL FILOUT		;PRINT NAME IF APPROPRIATE
	MOVEI A,0(JFN)		;GET THE JFN
	MOVE B,[3,,.FBCTL]	;READ 3 FDB WORDS
	MOVEI C,D		;INTO THE REGS
	GTFDB			;DO IT

;GET STRUCTURE NAME FOR DSKOP

	MOVE B,A		;MOVE THE JFN
	HRROI A,BUFFER		;WHERE TO PUT STRUCTURE NAME
	MOVX C,1B2		;DEVICE NAME ONLY
	JFNS			;DO IT
	HRROI A,BUFFER		;GET STR NAME
	STDEV			;GET DEVICE DISEGNATOR
	 JRST [	JSERR
		JRST INCFIL]	;BAD. GET NEXT FILE
	MOVE W2,B		;SAVE DESIGNATOR
	TXNN D,FB%LNG		;IS THIS A LONG FILE?
	JRST [	MOVEM W1,IDXPAG	;NO. SAVE ONLY XB ADDRESS
		MOVSI PTT,-1	;ONLY LOOK AT ONE ENTRY
		JRST DOPT]	;AND GO PROCESS THE PTT
	MOVE A,W1		;GET DISK ADDRESS
	MOVEI C,IDXPAG		;WHERE ITS GOING
	CALL SETUP		;GO SET UP ARGS AND DO OPERATION
	 JRST [	HRROI A,[ASCIZ /
?HARD ERROR READING PTT/]
		SKIPN ERRTYP	;WAS IT REALLY HARD?
		HRROI A,[ASCIZ /
?RECOVERABLE ERROR READING PTT/]
		PSOUT
		CALL PRTDSC
		SKIPN ERRTYP	;HARD ERROR
		JRST .+1	;NO. GO ON
		JRST INCFIL]
	SKIPE ERRTYP		;CLEAN READ?
	JRST [	HRROI A,[ASCIZ /
%TRANSIENT ERROR READING PTT/]
		PSOUT
		CALL PRTDSC	;PRINT ADDRESS
		JRST .+1]	;DONE

	MOVEI A,IDXPAG		;THE PAGE WHERE XB IS
	CALL CHKSUM		;VERIFY BLOCK
	 JRST [	HRROI A,[ASCIZ/
?CHECK SUM ERROR ON PTT/]
		PSOUT
		CALL PRTDSC	;PRINT DISK ADDRESS
		JRST INCFIL]	;AND SKIP THE FILE
	MOVSI PTT,-1000		;DO ALL PTT'S
DOPT:	MOVSI PT,-1000		;DO ALL OF THIS PT
	SKIPN A,IDXPAG(PTT)	;GET PAGE TABLE ADDRESS
	JRST DOPT1		;NONE HERE.
	TLZ A,777000		;IGNORE CHECKSUM
	JUMPE A,DOPT1		;SKIP IT IF NOTHING HERE
	MOVEI C,PTPAGE		;WHERE TO PUT IT
	CALL SETUP		;GET IT
	 JRST [	HRROI A,[ASCIZ /
?HARD ERROR READING PT # /]
		SKIPN ERRTYP	;WAS IT REALLY HARD?
		HRROI A,[ASCIZ /
?RECOVERABLE ERROR READING PT # /]
		PSOUT
		CALL PTTOUT
		CALL PRTDSC
		SKIPN ERRTYP	;RECOVERABLE?
		JRST .+1	;YES. PROCEED
		JRST DOPT1]
	SKIPE ERRTYP		;CLEAN READ?
	JRST [	HRROI A,[ASCIZ/
%TRANSIENT ERROR READING PT# /]
		PSOUT
		CALL PTTOUT
		CALL PRTDSC	;DISC ADDRESS
		JRST .+1]	;AND PROCEED
	MOVEI A,PTPAGE		;THE PAGE WHERE THE XB IS
	CALL CHKSUM		;VERIFY IT
	 JRST [	HRROI A,[ASCIZ /
?CHECK SUM ERROR READING PT#/]
		PSOUT
		MOVEI A,.PRIOU
		MOVEI C,10
		MOVEI B,0(PTT)
		NOUT
		 JFCL
		CALL PRTDSC
		JRST DOPT1]	;DO NEXT PT
DOPAG:	SKIPN A,PTPAGE(PT)	;DO NEXT DATA PAGE
	JRST DOP2		;NONE HERE
	TLZ A,777000		;IGNORE CHECKSUM
	JUMPE A,DOP2		;IF NOW ZERO, IGNORE IT
	MOVEI C,DATPAG		;WHERE TO PUT IT
	CALL SETUP		;DO IT
	 JRST [	HRROI A,[ASCIZ /
?HARD ERROR READING PAGE # /]
		SKIPN ERRTYP	;REALLY HARD?
		HRROI A,[ASCIZ /
?RECOVERABLE ERROR READING PAGE # /]
		PSOUT
		CALL PTOUT
		HRROI A,[ASCIZ / OF PT # /]
		PSOUT
		CALL PTTOUT
		CALL PRTDSC
		JRST DOP2]	;DO NEXT
	SKIPE ERRTYP
	JRST [	HRROI A,[ASCIZ /
%TRANSIENT ERROR READING PAGE # /]
		PSOUT
		CALL PTOUT
		HRROI A,[ASCIZ / OF PT# /]
		PSOUT
		CALL PTTOUT
		CALL PRTDSC
		JRST .+1]
DOP2:	AOBJN PT,DOPAG		;DO ALL OF IT
DOPT1:	AOBJN PTT,DOPT		;DO NEXT PT
INCFIL:	MOVE A,JFN		;THE JFN AGAIN
	GNJFN			;TRY TO STEP IT
	 JRST DONE		;NO MORE
	JRST FILLOP		;DONE
DONE:	HRROI A,[ASCIZ /

DONE!
/]
	PSOUT
	HALTF
	JRST START		;START OVER IF CONTINUED

;CHECK SUM SUBROUTINE
;	A/ XB BLOCK ADDRESS

CHKSUM:	MOVSI B,-4		;# OF WORDS TO DO
	HRRI B,0(A)		;GET ADDRESS
	MOVE C,[POINT ^D9,D]
	PUSH P,A
CHKLOP:	LDB A,[POINT ^D9,0(B),8] ;GET NEXT PART
	IDPB A,C		;SAVE IT
	AOBJN B,CHKLOP		;DO ALL 36 BITS
	POP P,A			;GET BACK ADDRESS
	SETCA D,		;GET COMPLEMENT OF CHECK SUM
	JCRY0 .+1
	MOVSI W3,-1000		;THE LOOP COUNTER
	HRLI A,W3
CHKLO1:	MOVE B,@A		;GET NEXT ADDRESS
	LOAD B,STGADR,B		;GET ADDRESS PART ONLY
	SKIPN B			;HAVE AN ADDRESS?
	HRRZ B,W3		;NO. USE OFFSET IN XB THEN
	ADD D,B
	JCRY0 [AOJA D,.+1]
CHKLO2:	AOBJN W3,CHKLO1		;DO THEM ALL
	CAME D,[-1]		;GOOD CHECKSUM?
	RET			;NO
	RETSKP			;YES
	END START