Google
 

Trailing-Edge - PDP-10 Archives - k20v7d - utilities/readfe.mac
There is 1 other file named readfe.mac in the archive. Click here to see a list.
	SALL
	TITLE READFE
	SEARCH MONSYM,MACSYM
	.REQUIRE SYS:MACREL
A==1
B==2
C==3
D==4
W==5
W1==6
W2==7
PTT==10
PT==11
JFN==12			;WHERE TO SAVE THE JFN
P==17				;PDL

PDL:	BLOCK 10
LSTDSK:	BLOCK 1
ERRTYP:	BLOCK 1
BUFFER:	BLOCK 11
IDXPAG==10000			;WHERE PTT IS
PTPAGE==11000			;CURRENT PT
MAPPTR==PTPAGE/1000
DATPAG==12000			;WHERE FILE DATA GOES

	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 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		;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
		SETONE DOP%SN,A
		MOVEI W,.DOPSR
		STOR W,DOP%AT,A	;SET UP NEW ARGS
		TXZ B,DOP%IR	;ALLOW ERROR RECOVERY THIS TIME
		DSKOP		;TRY IT AGAIN
		MOVEM A,ERRTYP	;REMEMBER THE ERROR
		RET]		;RETURN WITH CODE IN A
	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



START:	RESET			;GET A CLEAN SLATE
	SETZM HRDERR#		;CLEAR HARD ERROR INDICATOR
	MOVE P,[IOWD 10,PDL]
	HRROI A,[ASCIZ /
FILE NAME 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
	MOVEM D,FDBWRD#
	TXNN D,FB%NOD	;SECOND TIME THRU ?
	  JRST DONE1	;GO STRAIGHT BACK

;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
	MOVX A,GJ%FOU!GJ%SHT
	HRROI B,[ASCIZ/DSK:FRONT-END-BOOT.BIN
/]
	GTJFN
	 JRST [JSERR
		JRST START]
	MOVEM A,OUTJFN#		;SAVE JFN FOR LATER
	MOVX B,^D36B5!OF%WR	;OPEN FOR WRITE
	OPENF
	 JRST [JSERR
		JRST START]
	MOVEI A,0(JFN)
	MOVE B,[1,,.FBBYV]	;ONE WORD--LENGTH RH
	MOVE C,[500000,,PTPAGE];INTO INDEX-PAGE
	GTFDB
	HRLZ B,OUTJFN		;PMAP NEEDS JFN LEFT!
	ADDI B,1		;INTO FILE-PAGE 1
	MOVE A,[.FHSLF,,MAPPTR]
	MOVX C,PM%WR		;WANT TO WRITE
	PMAP
	SETO A,
	MOVE B,[.FHSLF,,MAPPTR]
	MOVX C,PM%CNT!1B35
	PMAP			;UNMAP THIS PAGE
	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
		SKIPE ERRTYP
		SETOM HRDERR	;WE HAD HARD ERROR
		CALL PRTDSC
		SKIPN ERRTYP	;HARD ERROR
		JRST .+1	;NO. GO ON
		JRST INCFIL]

	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
	SKIPE HRDERR
	JRST [HRROI A,[ASCIZ/
?FILE HAS HARD ERROR(S) , NOT OPENED FOR DUMPER , CORRECT
HARD ERRORS FIRST !
/]
		PSOUT]
	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
		SKIPE ERRTYP
		SETOM HRDERR	;WE HAD HARD ERROR
		MOVEI B,0(PTT)
		MOVEI A,.PRIOU
		MOVEI C,10
		NOUT
		 JFCL
		CALL PRTDSC
		SKIPN ERRTYP	;RECOVERABLE?
		JRST .+1	;YES. PROCEED
		JRST DOPT1]
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
		SKIPE ERRTYP
		SETOM HRDERR	;WE HAD HARD ERROR
		MOVEI A,.PRIOU
		MOVEI B,0(PT)
		MOVEI C,10
		NOUT
		 JFCL
		HRROI A,[ASCIZ / OF PT # /]
		PSOUT
		MOVEI A,.PRIOU
		MOVEI B,0(PTT)
		NOUT
		 JFCL
		CALL PRTDSC
		PSOUT
		JRST DOP2]	;DO NEXT
DOP2:	AOBJN PT,DOPAG		;DO ALL OF IT
	TRNE PTT,-1		;FIRST INDEX-BLOCK DONE ??
	JRST DOPT1		;YES
	HRLZ B,OUTJFN		;JFN FOR PMAP
	ADDI B,2		;INTO FILE-PAGE 2
	MOVE A,[.FHSLF,,MAPPTR]	;OUT OF INDEX-PAGE
	MOVX C,PM%WR		;WE WANT WRITE
	PMAP
	SETO A,
	MOVE B,[.FHSLF,,MAPPTR]
	MOVX C,PM%CNT!1B35
	PMAP			;UNMAP THIS PAGE
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:	SKIPE HRDERR
	JRST DONE1		;HARD-ERROR--NO BOOT
	HRLZI  A,10		; BOOTS-PAGE
	MOVEI C,PTPAGE		; INTO INDEX-AREA
	CALL SETUP
	 JRST [	HRROI A,[ ASCIZ /
?HARD ERROR READING BOOTS-PAGES
/]
	SKIPN ERRTYP
	HRROI A,[ ASCIZ /
%RECOVERABLE ERROR READING BOOTS-PAGES
/]
	PSOUT
	SKIPE ERRTYP
	SETOM HRDERR
	JRST DONE1]
	HRLZ B,OUTJFN		;FOR PMAP
	MOVE A,[.FHSLF,,MAPPTR]
	MOVX C,PM%WR
	PMAP
	SETO A,
	MOVE B,[.FHSLF,,MAPPTR]
	MOVX C,PM%CNT!1B35
	PMAP			;UNMAP THIS PAGE
DONE1:	SKIPE HRDERR
	JRST [HRROI A,[ASCIZ/
?FILE HAS HARD ERROR(S) , NOT OPENED FOR DUMPER , CORRECT
HARD ERRORS FIRST !
/]
		PSOUT
		JRST DONE2]
	MOVX B,^D36B5!OF%RD!OF%WR
	MOVEI A,0(JFN)	;JFN
	OPENF
	   JRST	[JSERR
		 JRST START]
	MOVEI A,0(JFN)	;LOAD JFN
	TXO A,1B17	; FIRST WORD
	MOVX B,FB%NOD	;CHANGE BACK-UP BIT
	SETZ C,
	MOVE D,FDBWRD
	TXNN D,FB%NOD	;NO BACKUP BIT SET?
	HRROI C,-1	;NO,LIGHT IT
	CHFDB
	HRROI A,[ ASCIZ /
ALLOWING DUMP OF FE-SYSTEM WITH DUMPER
/]
	TXNN D,FB%NOD	;NO BACK-UP BIT SET ?
	HRROI A,[ ASCIZ /
EXCLUDING DUMP OF FE-SYSTEM WITH DUMPER
/]
	PSOUT
	HRROI A,[ASCIZ /

DONE!
/]
	PSOUT
	SETO A,
	CLOSF
	 JRST [JSERR
		JRST START]
DONE2:	HALTF
	JRST START		;START OVER IF CONTINUED
	END START