Google
 

Trailing-Edge - PDP-10 Archives - bb-d549g-sb - fitrak.mac
There are 3 other files named fitrak.mac in the archive. Click here to see a list.
TITLE	FITRAK	VERSION 3	
SUBTTL	CAM DISK & DECTAPE DIRECTORY HANDLING ROUTINES		CWRU/CAM

;EDIT==6

;COPYRIGHT 1971, DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
	HISEG

	A1=1
	A2=2
	A3=3
	A4=4
	A5=5
	A7=7
	CHAR=13
	RETURN=14
	DISK=200000
	DTAPE=100
	DCHAN=17
	RC=16
	LF=12
	VT=13
	FF=14

	ENTRY	BASSRC,USESRC,EOFERR,ERRE,DELET,ERRC,ERRD


	EXTERN	DIALOG,CONVRT,FFSAVE,BASDDB,USEDDB,BASIPT,USEIPT,MRGOUT
	EXTERN	LSTOUT,LSTOP,.JBFF,CAMOPT,DSKFLG
	EXTERN	TEMP,USEPTR,BASPTR,HEDOUT,SYSIPT,CMORE
	EXTERN	MESAPS,T2
		EXTERN	DELPT,MESGA,MESGB

MESAPT:	POINT	7,MESGA+2,
DELPTZ:	POINT	7,DELPT,
MESAPU:	POINT	7,MESGA+7,20
DELPTR:	POINT	7,DELPT,20
DELPTS:	POINT	7,DELPT+2,
MESBPT:	POINT	7,MESGB+7,20
DPER:	POINT	7,DELPT+1,34
	
	DEFINE	SAVE <XLIST
	MOVE	.JBFF
	MOVEM	FFSAVE
	LIST>

	DEFINE	RESTOR <XLIST
	MOVE	FFSAVE
	MOVEM	.JBFF
	LIST>

	SYN	RC,USE
	SYN	RC,BAS
	DEFINE CNVT(A,B,C,D) <XLIST
		JSP	RETURN,CONVRT
			XWD A,B
			XWD C,D
				LIST>
	DEFINE	FCAL(A,B,C) <XLIST
	JSP	RETURN,A
		B
		C
		LIST>
	DEFINE	INITER(A) <XLIST
	OUTSTR	[ASCIZ /*** INITIALIZATION ERROR ON DEVICE: /]
	OUTSTR	A
	JRST	EOFERR+1
	LIST>

NOGOOD:	+	7	;NUMBER OF NOGOOD EXTENSIONS-1
	SIXBIT	/REL/
	SIXBIT	/SAV/
	SIXBIT	/RIM/
	SIXBIT	/BIN/
	SIXBIT	/LOW/
	SIXBIT	/SHR/
	SIXBIT	/TMP/
	SIXBIT	/HGH/
	OPDEF	OUTSTR[TTCALL 3,0]
	OPDEF	INCHRW[TTCALL 4,0]
	SYN	INCHRW,INCHWL
	OPDEF	OUTCHR[TTCALL 1,0]
	OPDEF	CLRBFI[TTCALL 11,0]
BASSRC:
	SAVE
BAS.1:	SETZM	TUMP
	EXTERNAL TUMP

	SETZM	BASDDB+6
	RELEAS	6,
	MOVEI	A1,14		;SET BINARY MODE
	MOVE	A2,BASDDB	;GET BASE DEVICE
	MOVE	A3,BASDDB+1	;GET BUFFER POINTER
	OPEN	BAS,A1		;
	JRST	ERRA		;CANT OPEN - GIVE UP

;	IS BASE DEV DECTAPE OR DISK

	MOVE	A1,BASDDB	;
	CALL	A1,[SIXBIT/DEVCHR/]  ;GET DEV CHARACTERISTICS
	TLNE	A1,DISK		;DISK ?
	JRST	BDISKR		;YES - GO TO DISK ROUTINE
	TLNN	A1,DTAPE	;DECTAPE ?
	JRST	ERRA		;NO - GIVE UP

;	BASE DECTAPE DIRECTORY ROUTINE

BDTRUT:
	AOSL	BASPTR		;INCREMENT FILE POINTER
	JRST	BNOINP	;NO MORE FILES
	USETI	BAS,144		;DIRECTORY BLOCK
	INPUT	BAS,0		;INPUT DIRECTORY
	HRRZ	A2,BASIPT+1	;
	ADDI	A2,176	;
	ADD	A2,BASPTR	;GET APPR FILE
BNFILE:	MOVE	A1,NOGOOD	;GET NO OF NOGOOD EXTENSIONS
	HLLZ	A3,0(A2)	;LOAD AN EXTENSION
BNEXT:	CAMN	A3,NOGOOD+1(A1)	;IS IT NOGOOD ?
	JRST	BNFPRE		;YES
	SOJGE	A1,BNEXT	;TRY NEXT NOGOOD EXT
	JRST	BTGOT		;IT IS GOOD
BNFPRE:	AOS	A2		;INCREMENT DIR ADDR
	AOSGE	BASPTR		;INCEREMT FILE NUMBER
	JRST	BNFILE		;TRY ANOTHER FILE
	JRST	BNOINP		;ANY MORE TAPES ?
BTGOT:
	MOVE	A1,-26(A2)	;
	JUMPE	A1,BNFPRE	;NULL FILE NAME
	MOVEM	A1,BASDDB+2	;STORE FILE NAME
	MOVEM	A3,BASDDB+3	;EXT STORED
	RESTOR
	RELEAS	BAS,
	JRST	2(A5)

;	FATAL ERROR ROUTINE

ERRA:	OUTSTR	[ASCIZ /LA BANDA ESTA BORRACHA !@$+*#%! - - FATAL ERROR
/]
	JRST	EOFERR+1	;
ERRC:	OUTSTR	[ASCIZ /*** CAN'T FIND BASE FILE
/]
	JRST	EOFERR+1
ERRD:	OUTSTR	[ASCIZ /*** CAN'T FIND USER FILE
/]
	JRST	EOFERR+1

ERRE:	OUTSTR	[ASCIZ/*** CAN'T FIND MANUFACTURER CORRECTION FILE
/]
	JRST	EOFERR+1




;	NEED NEW INPUT DECTAPE ROUTINE

BNOINP:
	CNVT	BASDDB,MESBPT,MESAPS,6
	OUTSTR	MESGB		;OUTPUT MESSAGE
	RELEAS	BAS,0
	JSP	A1,DIALOG	;
	JRST	BNOI.1		;NO D
	HRREI	A1,-26		;
	MOVEM	A1,BASPTR	;INITIALIZE DECTAPE POINTER
	JRST	BAS.1		;TRY NEXT DECTAPE
BNOI.1:	SKIPE	TUMP
	JRST	USNOIN
	RESTOR
	RELEAS	RC,
	JRST	0(A5)

;	DISK DIRECTORY -- GET FILE.EXT PAIR ROUTINE

DSKDIR:	HRLZI	A2,(SIXBIT /UFD/);LOAD FILE EXT
	SETZ	A3,		;
	MOVE	A4,[XWD 1,1]	;WHERE UFD'S ARE
	LOOKUP	DCHAN,A1
	JRST	ERRB
	IN	DCHAN,		;INPUT A DIRECTORY BUFFER
DFILGT:	SOSG	SYSIPT+2	;
	IN	DCHAN,		;
	SKIPA			;
	JRST	BNOI.1		;EOF OR ERR
	ILDB	A1,SYSIPT+1	;LOAD FILENAME
	JUMPE	A1,DFILGT
DEXTGT:	SOS	SYSIPT+2	;
	ILDB	A2,SYSIPT+1	;LOAD EXTENSION
	HRRI	A2,0		;CLEAR AC RIGHT
	JRST	0(RETURN)	;


;	BASE DISK DIRECTORY ROUTINE

BDISKR:	MOVE	A1,BASDDB+5	;P,P NUMBER
	JUMPN	A1,BPT1		;IS IT ZERO ?
	CALL	A1,[SIXBIT /GETPPN/]	;GET OWN P,P
BPT1:	JSP	RETURN,DSKDIR	;GET DIR ENTRY
	SKIPN	DSKFLG		;DISK CANT BE INIT-ED
	JRST	BDPT0		;OK
	INITER	[ASCIZ /DSK/]	;JUMP TO ERR ROUT
BDPT0:	MOVE	A3,BASDDB+2	;LAST BASE FILE
	JUMPE	A3,BPT2		;FIRST TIME
	MOVE	A4,BASDDB+3	;LAST BASE EXT
BDPT22:	CAME	A1,A3		;FILES SAME ?
	JRST	BDPT3		;NO
		CAMN	A2,A4	;IS IS SAME EXTS ?
	JRST	BDPT44		;SAME FILE AND EXT
BDPT3:	JSP	RETURN,DFILGT	;GET NEXT ENTRY
	JRST	BDPT22		;TRY NEW ENTRY
BDPT44:	JSP	RETURN,DFILGT	;GET ENTRY AFTER =
BPT2:	MOVE	A3,NOGOOD
BDNEXT:	CAME	A2,NOGOOD+1(A3) ;IS EXTENSION NOGOOD ?
	JRST	BDOKSF		;NO
	JSP	RETURN,DFILGT	;YES - GET ANOTHER
	JRST	BPT2		;TRY AGAIN
BDOKSF:	SOJGE	A3,BDNEXT	;TRY NEXT NOGOOD EXT
	MOVEM	A1,BASDDB+2	;GOT OK FILE
	MOVEM 	A2,BASDDB+3	;STORE IN DDB
	RESTOR
	RELEAS	BAS,
	JRST	2(A5)		;NORMAL RETURN

;	WRAPUP ROUTINE

EOFERR:	OUTSTR	[ASCIZ /*** CAM TERMINATED -- INPUT FILES EXHAUSTED
/]
	RELEAS	0,
	RELEAS	1,
	RELEAS	2,
	RELEAS	3,
	RELEAS	4,
	RELEAS	5,
	RELEAS	6,
	JRST	CMORE
ERRB:
	OUTSTR	[ASCIZ /*** DISK DIRECTORY NOT FOUND
/]
	JRST	EOFERR+1
;	USER DIRECTORY ROUTINES
;	INITIALIZATION

USESRC:
	SAVE
USE.1:	SETOM	TUMP

	SETZM	USEDDB+6
	RELEAS	5,
	MOVNI	25
	MOVEM	USEPTR
	MOVEI	A1,14		;SET BINARY MODE
	MOVE	A2,USEDDB	;
	MOVE	A3,USEDDB+1	;INITIALIZE DEV
	OPEN	USE,A1		;
	JRST	ERRA		;CANT -- GIVE UP
	MOVE	0,[XWD BASDDB+2,A1]
	BLT	0,A2		;
	MOVEI	A3,0
	MOVE	A4,USEDDB+5
	LOOKUP	USE,A1
	JRST	USE.11
	MOVE	A3,BASDDB+2
	MOVE	A4,BASDDB+3	;LOAD FILE AND EXT
	JRST	USPT11		;RETURN-WE GOT IDENTICAL FILE.EXT
;	FIND OUT IF USE DEV IS DECTAPE OR DISK
USE.11:
	MOVE	A1,USEDDB	;
	CALL	A1,[SIXBIT/DEVCHR/];GET DEV CHARACTERISTICS
	TLNE	A1,DISK		;DISK ?
	JRST	USEDSR		;YES
	TLNN	A1,DTAPE	;TAPE ?
	JRST	ERRA		;NO -GIVE UP

;	USER DECTAPE ROUTINE

USETR:	USETI	USE,144		;SET DIRECTORY BLOCK
	INPUT	USE,		;INPUT DIR
	HRRZ	A2,USEIPT+1	;
	ADDI	A2,150		;
	ADD	A2,USEPTR	;
USETRY:	MOVE	A3,0(A2)	;GET FILE
	CAMN	A3,BASDDB+2	;IS IT SAME AS BASE ?
	JRST	USFGOT		;YES
USTRMO:	AOS	A2		;INCREMENT FILE POINTER
	AOSGE	USEPTR		;NO-SETUP FOR NEXT
	JRST	USETRY		;TRYMORE
	JRST	USNOIN		;NO MORE_GET NEXT TAPE
;	USER TAPE EXHAUSTED- GET NEXT

USNOIN:
	CNVT	BASDDB+2,MESAPT,MESAPS,6
	CNVT	USEDDB,MESAPU,MESAPS,6
	OUTSTR	MESGA		;OUTPUT MESG
	RELEAS	USE,
	JSP	A1,DIALOG	;
	JRST	DELET		;NO-DELETE BASE FILE
	HRREI	A1,-25		;YES-INITIALIZE DECTAPE PTR
	MOVEM	A1,USEPTR	;
	JRST	USE.1		;TRY THIS DECTAPE


;	DELETE THE CURRENT BASE FILE

DELET:	CNVT	BASDDB+2,DELPTR,MESAPS,6
	CNVT	BASDDB+3,DELPTS,MESAPS,3
	MOVEI	A1,40
	MOVEI	A2,56		;PERIOD
	DPB	A1,DPER		;PUT IN SP WHERE PER SHOULD BE
	SKIPE	BASDDB+3	;IS EXT NULL ?
	DPB	A2,DPER		;NO-PUT IN .
	MOVE	A1,DELPTZ	;BYTE POINTER
	MOVEI	A2,17		;MESG LENGTH
	RELEAS	BAS,
	RESTOR
	JSP	A7,HEDOUT
	JRST	1(A5)
;	USER DECTAPE ROUTINE GOTIT

USFGOT:	MOVE	A1,NOGOOD		;
	HLLZ	A4,26(A2)	;GET EXT
USPT1:	CAMN	A4,NOGOOD+1(A1)	;IS IT NOGOOD ?
	JRST	USTRMO		;YES
	SOJGE	A1,USPT1	;OK SO FAR
USPT11:
	MOVEM	A3,USEDDB+2	;ALLOK-STORE FILE
	MOVEM	A4,USEDDB+3	;STORE EXT
	RESTOR
	RELEAS	BAS,
	JRST	2(A5)		;NORMAL RETURN

;	USER DISK DIRECTORY ROUTINE

USEDSR:	MOVE	A1,USEDDB+5	;GET P,P
	JUMPN	A1,USDPT1	;IS IT ZERO ?
	CALL	A1,[SIXBIT/GETPPN/];YES-GET OWN
USDPT1:	JSP	RETURN,DSKDIR	;GET FILE.EXT
USDTRY:	CAMN	A1,BASDDB+2	;IS FILE SAME AS BASE ?
	JRST	USDGOT		;YES
USDPT2:	JSP	RETURN,DFILGT	;NO-GET ANOTHER FILE
	JRST	USDTRY		;TRY THAT
USDGOT:	MOVE	A3,NOGOOD	;
USDTRE:	CAMN	A2,NOGOOD+1(A3)	;IS EXT GOOD ?
	JRST	USDPT2		;YES-TRY NEXT FILE
	SOJGE	A3,USDTRE	;OKSOFAR -TEST REST
	MOVEM	A1,USEDDB+2	;ALLOK-STORE FILE
	MOVEM	A2,USEDDB+3	;STORE EXT
		RESTOR
	RELEAS	USE,
	JRST	2(A5)		;NORMAL RETURN

	END