Google
 

Trailing-Edge - PDP-10 Archives - cuspmar86binsrc_2of2_bb-fp63a-sb - 10,7/fefile/fefile.mac
There are 6 other files named fefile.mac in the archive. Click here to see a list.
TITLE FEFILE - ALLOCATE CONTIGUOUS SPACE ON A DISK FOR RSX20
SUBTTL E. SOCCI 9 AUG 76




;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1976,1984,1986. ALL RIGHTS RESERVED.
;
;
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
;ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH LICENSE AND WITH THE
;INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY  OTHER
;COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
;OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE  SOFTWARE  IS  HEREBY
;TRANSFERRED.
;
;THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT  NOTICE
;AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
;CORPORATION.
;
;DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY  OF  ITS
;SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.


	SEARCH UUOSYM
	SALL

	VMAJOR==1
	VMINOR==0
	VCUST==0
	VEDIT==27

	LOC	137
	BYTE (3)VCUST(9)VMAJOR(6)VMINOR(18)VEDIT
	RELOC

COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1976,1986. ALL RIGHTS RESERVED.
\;END COPYRIGHT MACRO

;AC ASSIGNMENTS

	S=0
	T1=1
	T2=2
	T3=3
	T4=4
	P=17

;I/O CHANNELS

	DSK==0

;SWITCHES

	FTDEBUG==0
;PARAMETERS

	PDSIZ==^D20
	HOMBK1==^D1		;FIRST HOM BLOCK LOCATION
	HOMBK2==^D10		;SECOND HOM BLOCK LOCATION
	HOMNAM==0		;PLACE TO CHECK FOR SIXBIT/HOM/
	.RBSLF==177		;PLACE IN RIB THAT HAS BLOCK NUMBER
	HOMFEA==61		;PLACE IN HOM BLOCK FOR LOGICAL BLOCK NUMBER OF FE AREA
	  HM$VAL==1B2		;VALID BIT, MUST BE ON FOR HOMFEA TO BE CONSIDERED VALID
	HOMFES==62		;SIZE OF FE AREA IN BLOCKS

;FLAGS - LH

	FL.DEL==1B0		;DELETE FE.SYS ON AN ERROR IN PROGRAM
	FL.NDL==1B1		;FE.SYS EXISTS WITH NO DELETE BIT ON IN RIB

;FLAGS - RH

;MACRO DEFINITIONS

DEFINE FERROR(ARG)<JRST	[OUTSTR [ASCIZ/? 'ARG
/]
			JRST ERRXIT]>;END FERROR MACRO DEFINITION

DEFINE TELL(MSG)<OUTSTR	[ASCIZ/MSG/]>
DEFINE TELLCR(MSG)<OUTSTR [ASCIZ/MSG
/]>

DEFINE GTAB(AC,ARG)<MOVE	AC,[ARG]
	GETTAB	AC,
	 FERROR <CANNOT GETTAB 'ARG>
>;END GTAB MACRO DEFINITION
SUBTTL INITIALIZATION


FEFILE:	JFCL			;IN CASE CCL START
	RESET
	SETZ	S,		;CLEAR FLAGS
	MOVE	P,[IOWD PDSIZ,PDL] ;SETUP PDL POINTER
IFE FTDEBUG,<
	GTAB	T1,%LDSYS	;GET PPN FOR SYS
>;END IFE FTDEBUG
IFN FTDEBUG,<
	SETZ	T1,
>;END IFN FTDEBUG

	DEFINE	X(A)<MOVEM	T1,A+.RBPPN>
	X(DELBLK)
	X(LUKBLK)
	X(ENTBLK)		;SET SYS PPN FOR ALL FILE BLOCKS

	GTAB	T1,%CNVER	;GET MONITOR VERSION
	ANDI	T1,77700	;JUST VERSION
	CAIGE	T1,60200	;DON'T SCREW UP HOM BLOCKS IN OLD MONITORS
	FERROR	MONITOR VERSION MUST BE 602 OR GREATER TO WRITE IN HOM BLOCKS
GETUNI:	TELL	<DISK UNIT NAME:>
	PUSHJ	P,GETDEV	;GET THE NAME
	  JRST	[TELLCR <% BAD DEVICE NAME SPECIFICATION>
		 JRST	GETUNI]	;GET IT AGAIN
	JUMPE	T1,GETUNI	;IN CASE HE GAVE <CRLF>
	PUSH	P,T1		;SAVE THE NAME
	SYSPHY	T1,		;MAKE SURE IT'S A PHYSICAL DISK
	  JRST	[TELLCR <% NOT A PHYSICAL DISK UNIT>
		 POP	P,(P)	;DISCARD SAVED NAME
		 JRST	GETUNI]
	POP	P,T2		;RESTORE DEVICE NAME TO T2
	MOVE	T1,[UU.DER+.IODMP] ;NO RETRIES, DUMP MODE
	SETZ	T3,		;NO BUFFER HEADERS
	OPEN	DSK,T1		;TRY TO OPEN DEVICE
	  JRST	[TELLCR <% CANNOT OPEN DESIGNATED DISK UNIT>
		 JRST	GETUNI]

;MAKE SURE FE.SYS DOESN'T EXIST ALREADY. IF IT DOES, DELETING IT
; IS NOT A GOOD IDEA, SINCE THE 11 WILL BE WRITING IN SOMEONE'S -10
; FILE.

	LOOKUP	DSK,LUKBLK	;LOOK FOR FE.SYS
	  CAIA			;PROBABLY OK, BUT CHECK FOR FUNNY CODES
	FERROR <FILE FE.SYS ALREADY EXISTS ON THAT DISK UNIT>
	HRRZ	T1,LUKBLK+.RBEXT ;GET ERROR CODE
	JUMPE	T1,ASKSOF	;JUMP IF FILE DID NOT EXIST
	TELL <? LOOKUP ERROR >
	PUSHJ	P,OCTOUT	;GIVE ERROR CODE
	TELLCR < FOR FE.SYS IN SYSTEM AREA>
	JRST	ERRXIT
;NOW ASK HOW BIG FE.SYS SHOULD BE

ASKSOF:	TELL	<SIZE OF FILE IN BLOCKS (<CRLF> GIVES DEFAULT OF 2000):>
	PUSHJ	P,GETDEC	;GET SIZE OF FILE
	  JRST	[TELLCR <% BAD DECIMAL NUMBER SPECIFICATION>
		 JRST	ASKSOF]
	SKIPN	T1		;IF NO ANSWER GIVEN,
	MOVEI	T1,^D2000	;MAKE IT 2000 BLOCKS LONG
	ADDI	T1,2		;ALLOW FOR THE RIBS
	MOVEM	T1,FEFSIZ	;PUT IT INTO THE ENTER BLOCK IN .RBALC

SUBTTL MAKE FE.SYS, FILL IT WITH ZEROES AND LOOK FOR ERRORS

NFESYS:	CLOSE	DSK,		;CLOSE OFF CHANNEL
MAKFEF:	ENTER	DSK,ENTBLK	;MAKE FE.SYS
	  JRST	ENTERR		;SOMETHING WENT WRONG, CHECK FOR PARTIAL ALLOCATION ERROR
	TELL	<[>
	MOVE	T1,FEFSIZ	;TELL USER HOW MUCH HE GETS FOR FREE
	SUBI	T1,2		;ACCOUNT FOR RIBS
	PUSHJ	P,DECOUT
	TELLCR	< DATA BLOCKS ALLOCATED TO FE.SYS]>

	MOVE	T3,FEFSIZ	;SIZE OF FILE
	SUBI	T3,2		;ACCOUNT FOR RIBS, SET TO LAST BLOCK NUMBER

FEFOUT:	USETO	DSK,(T3)	;WRITE LAST BLOCK NUMBER
	OUT	DSK,OIOWD	;OUTPUT A BLOCK AT A TIME
	JRST	FEODON		;OK
	GETSTS	DSK,T1		;ERROR, GET FILE STATUS
	TRNE	T1,IO.DER+IO.DTE ;NORMAL ERRORS?
	JRST	FEFDEL		;YES, JUST TRY AGAIN
	TELL <? UNRECOVERABLE OUTPUT ERROR, STATUS >
	PUSHJ	P,OCTOUT	;PRINT STATUS
	TELLCR	<>		;CRLF
	JRST	ERRXIT		;GO DELETE FE.SYS


;HERE ON ENTER ERROR CREATING FE.SYS, MAKE SURE ITS NOT PARTIAL ALLOCATION

ENTERR:	HRRZ	T1,ENTBLK+.RBEXT ;GET ERROR CODE
	CAIN	T1,ERPOA%	;PARITAL ALLOCATION?
	FERROR <NOT ENOUGH CONTIGOUS SPACE ON UNIT FOR FE.SYS>
	TELL <? ENTER ERROR >
	PUSHJ	P,OCTOUT	;NOT PARTIAL ALLOCATION, SAY WHAT IT IS
	TELLCR < FOR FE.SYS ON SYSTEM AREA>
	JRST	ERRXIT
;HERE WHEN FE.SYS IS ALL WRITTEN OUT, CHECK FOR ERRORS

FEODON:	CLOSE	DSK,		;OK, CLOSE AND MAKE FE.SYS EXIST
	TLO	S,(FL.DEL)	;IF ERROR HAPPENS NOW, DELETE FE.SYS
	LOOKUP	DSK,LUKBLK	;LOOK IT UP AGAIN
	  JRST	[TELL <? LOOKUP ERROR >
		 HRRZ	T1,LUKBLK+.RBEXT ;GET CODE
		 PUSHJ	P,OCTOUT
		 TELLCR < FOR NEWLY CREATED FE.SYS>
		 TLZ	S,(FL.DEL) ;CAN'T LOOK IT UP TO DELETE IT
		 JRST	ERRXIT]

;NOW INPUT ALL BLOCKS ONE AT A TIME AND LOOK FOR DATA ERRORS

FEFIN:	SETZ	T2,		;T2 HAS COUNT OF ERRORS
FEFIN1:	IN	DSK,IIOWD	;INPUT A BLOCK
	  JRST	.-1		;WAIT FOR EOF
	GETSTS	DSK,T1		;GET STATUS
	TRNE	T1,IO.DER+IO.DTE ;DEVICE OR DATA ERROR?
	AOS	T2		;YES, COUNT IT
	TRNE	T1,IO.ERR-IO.DER-IO.DTE ;OTHER ERRORS?
	JRST	[TELL <? UNUSUAL INPUT ERROR, STATUS >
		 PUSHJ	P,OCTOUT
		 TELLCR <>
		 JRST	ERRXIT]
	TRNN	T1,IO.EOF	;END OF FILE NOW?
	JRST	FEFIN2		;NO, KEEP GOING
	JUMPN	T2,FEFDEL	;DONE NOW. IF ANY ERRORS, TRY A NEW FE.SYS
	JRST	FEPERM		;GO MAKE FE.SYS INVULNERABLE

FEFIN2:	TRNE	T1,IO.DER+IO.DTE ;ANY ERRORS COUNTED BEFORE?
	SETSTS	DSK,.IODMP	;YES, CLEAR THEM
	JRST	FEFIN1		;AND CONTINUE TO READ

;NOW AN ERROR FREE FE.SYS EXISTS. CAST IN CONCRETE BY LIGHTING NO DELETE
; BIT.  ALSO, LIGHT NO BACKUP BIT AND ALWAYS BAD CHECKSUM (SINCE IT WILL
; HAVE)

FEPERM:	USETI	DSK,0		;GET SET TO READ PRIME RIB
	IN	DSK,IIOWD	;GET IT INTO IBUF
	  JRST	.+2		;OK
	JRST	[TELL <? ERROR READING FE.SYS RIB, STATUS >
		 GETSTS	DSK,T1
		 PUSHJ	P,OCTOUT
		 TELLCR <>
		 JRST	ERRXIT]
	CLOSE	DSK,		;NOW PREPARE TO DO SUSET. FOR AN OUTPUT
	MOVE	T1,IBUF+.RBSLF	;GET BLOCK NUMBER TO UPDATE HOM BLOCKS
	MOVEM	T1,FEFPOS	;SAVE
	TELL	<[FE.SYS AREA STARTS AT LOGICAL BLOCK >
	AOS	T1		;GET PAST RIB
	PUSHJ	P,DECOUT	;PRINT IN DECIMAL
	TELLCR	<.]>
	MOVEI	T1,RP.NDL+RP.NFS+RP.ABC ;NOW SET NO DELETE, NO BACKUP, AND ALWAYS BAD CHECKSUM
	IORM	T1,IBUF+.RBSTS	;SET IN THE RIB
	MOVE	T1,FEFPOS	;GET RIB BLOCK NUMBER
	IOR	T1,[SU.SOT+<DSK>B12] ;SETUP TO OUTPUT THE RIB
	SUSET.	T1,		;SET THE BLOCK, PUT CHANNEL IN SUPER I/O MODE
	  FERROR <SUSET. FAILURE TRYING TO WRITE FE.SYS RIB>
	OUT	DSK,IIOWD	;WRITE THE RIB
	  JRST	.+2		;OK
	JRST	[TELL <? OUTPUT ERROR WRITING FE.SYS RIB, STATUS >
		 GETSTS	DSK,T1
		 PUSHJ	P,OCTOUT
		 TELLCR <>
		 JRST	ERRXIT]
	TLO	S,(FL.NDL)	;IN CASE WE GET TO ERRXIT, TELL IT TO CLEAR
				; NO DELETE BIT BEFORE ATTEMPTING TO DELETE FE.SYS

;NOW UPDATE PROPER SLOTS IN HOM BLOCK SO -11 CAN FIND ITS AREA ON THE UNIT

	SETZM	HOMERR		;# OF ERRORS
	MOVEI	T1,HOMBK1	;GET BLOCK # OF FIRST HOM BLOCK
	PUSHJ	P,UPDHOM
	  AOS	HOMERR		;AN ERROR
	MOVEI	T1,HOMBK2	;SECOND ALSO
	PUSHJ	P,UPDHOM
	  AOS	HOMERR		;AN ERROR
	MOVE	T1,HOMERR	;GET NUMBER OF ERRORS
	CAIL	T1,2		;IF 2 OR MORE ERRORS,
	FERROR	<CANNOT UPDATE EITHER HOM BLOCK SUCCESSFULLY, ABORTING>
	TELLCR <[FRONT END FILE CREATED, HOM BLOCKS WRITTEN]>
	RELEAS	DSK,		;ALL DONE, RELEAS CHANNEL
	EXIT	1,
	JRST	.-1
;HERE IF ERRORS ARE ENCOUNTERED EITHER WHILE WRITING FE.SYS OUT
; OR WHEN READING IT BACK IN.  REPORT NUMBER OF BAD BLOCKS, CLOSE
; CHANNEL SO BAT BLOCKS WILL BE UPDATED AND GO BACK TO MAKFEF
; TO SUPERCEDE THE BAD FE.SYS.

FEFDEL:	TELL <% >
	MOVE	T1,T2		;GET NUMBER OF ERRORS IN T1
	PUSHJ	P,DECOUT	;PRINT IN DECIMAL
	TELLCR < BAD BLOCK(S) ENCOUNTERED IN FRONT END FILE>
	TELLCR <% RETRYING FRONT END FILE CREATION>
	CLOSE	DSK,
	JRST	MAKFEF		;GO TRY AGAIN


;ROUTINE TO PROCESS ERROR IN PROGRAM
; DELETE FE.SYS IF IT WAS CREATED

ERRXIT:	TLNN	S,(FL.DEL)	;WAS FE.SYS CREATED YET?
	JRST	ERRXI1		;NO, SKIP FILE STUFF
	SETSTS	DSK,.IODMP	;MAKE SURE NO ERROR BITS ARE ON
	TLNN	S,(FL.NDL)	;FE.SYS EXIST WITH NO DELETE BIT ON?
	JRST	ERRXI0		;EXISTS, BUT ITS VULNERABLE
	CLOSE	DSK,		;GET READY FOR SUPER I/O
	MOVE	T1,FEFPOS	;GET RIB BLOCK NUMBER
	TLO	T1,(<DSK>B12)	;PUT CHANNEL NUMBER IN
	SUSET.	T1,		;SET INPUT BLOCK
	  JRST	[TELLCR <? SUSET. FAILURE WHILE TRYING TO CLEAR NO DELETE BIT IN FE.SYS RIB>
		 JRST	ERRXI1]	;GIVE UP, CAN'T DO MUCH
	IN	DSK,IIOWD	;GET RIB
	  JRST	.+2		;OK
	JRST	[TELL <? INPUT ERROR FOR FE.SYS RIB, STATUS >
		 GETSTS	DSK,T1
		 PUSHJ	P,OCTOUT
		 TELLCR <>
		 JRST	ERRXI1]
	MOVEI	T1,RP.NDL	;GET BIT TO CLEAR
	ANDCAM	T1,IBUF+.RBSTS	;CLEAR IT
	MOVE	T1,FEFPOS	;GET BLOCK NUMBER OF RIB AGAIN
	TLO	T1,(SU.SOT+<DSK>B12) ;SET UP FOR OUTPUT
	SUSET.	T1,
	  JRST	[TELLCR <? SUSET. FAILURE WHILE TRYING TO CLEAR NO DELETE BIT IN FE.SYS>
		 JRST	ERRXI1]
	OUT	DSK,IIOWD	;WRITE RIB BACK OUT
	  JRST	.+2		;OK
	JRST	[TELL <? OUTPUT FAILURE WHILE TRYING TO CLEAR NO DELETE BIT FOR FE.SYS, STATUS >
		 GETSTS	DSK,T1
		 PUSHJ	P,OCTOUT
		 TELLCR <>
		 JRST	ERRXI1]

ERRXI0:	LOOKUP	DSK,LUKBLK	;GET FE.SYS ON THE CHANNEL
	  JRST	[TELLCR <% CAN'T DELETE FE.SYS>
		 JRST	ERRXI1]
	RENAME	DSK,DELBLK	;DELETE IT
	  JRST	[TELLCR <% CAN'T DELETE FE.SYS>
		 JRST	ERRXI1]
	RELEAS	DSK,		;MAKE CHANNEL GO AWAY
ERRXI1:	EXIT	1,
	JRST	.-1

SUBTTL SUBROUTINES


;ROUTINE TO UPDATE HOM BLOCKS, CALL WITH BLOCK NUMBER IN T1
; SKIP RETURN IF ALL IS OK, NON-SKIP IF READ OR WRITE ERROR

UPDHOM:	MOVE	T2,T1		;GET BLOCK NUMBER
	TLO	T2,(<DSK>B12)	;PUT IN CHANNEL FOR SUSET.
	SUSET.	T2,		;DO IT
	  FERROR <SUSET. ERROR WHILE TRYING TO READ HOM BLOCKS>
	IN	DSK,IIOWD	;GET HOM BLOCK IN CORE
	  CAIA			;OK
	JRST	[TELL <% HOM BLOCK READ ERROR, BLOCK >
		 PUSHJ	P,DECOUT
		 TELL <., STATUS >
		 GETSTS	DSK,T1
		 PUSHJ	P,OCTOUT
		 SETSTS	DSK,.IODMP ;CLEAR ERRORS
		 TELLCR <>
		 POPJ	P,]
	MOVE	T2,[SIXBIT/HOM/];MAKE SURE ITS A REAL HOM BLOCK
	CAME	T2,IBUF+HOMNAM	;IS IT?
	JRST	[TELL <% HOM BLOCK CONSISTENCY ERROR, BLOCK >
		 PUSHJ	P,DECOUT
		 TELLCR <.>
		 POPJ	P,]
	MOVE	T2,FEFPOS	;GET POSITION OF RIB OF FE.SYS
	AOS	T2		;POINT TO FIRST DATA BLOCK
	PUSHJ	P,SPLTWD	;CONVERT TO -11 FORMAT
	TLO	T2,(HM$VAL)	;SAY ITS VALID
	MOVEM	T2,IBUF+HOMFEA	;PUT IN ADDRESS WORD
	MOVE	T2,FEFSIZ	;GET SIZE OF ENTIRE FE.SYS
	SUBI	T2,2		;ACCOUNT FOR PRIME AND SPARE RIBS
	PUSHJ	P,SPLTWD	;SPLIT WORD INTO HALFWORDS FOR -11
	MOVEM	T2,IBUF+HOMFES	;PLACE IN HOM BLOCK
	MOVE	T2,T1		;GET BLOCK NUMBER AGAIN
	TLO	T2,(SU.SOT+<DSK>B12) ;SET FOR OUTPUT SUSET.
	SUSET.	T2,
	  FERROR <SUSET. ERROR WHILE TRYING TO WRITE HOM BLOCKS>
	OUT	DSK,IIOWD	;FROM SAME BUFFER
	  CAIA			;OK
	JRST	[TELL <% HOM BLOCK WRITE ERROR, BLOCK >
		 PUSHJ	P,DECOUT
		 TELL <., STATUS >
		 GETSTS	DSK,T1
		 PUSHJ	P,OCTOUT
		 SETSTS	DSK,.IODMP ;CLEAR ERRORS
		 TELLCR <>
		 POPJ	P,]
	JRST	CPOPJ1		;GIVE SUCCESS RETURN


;ROUTINE TO SPLIT UP 36 BIT -10 WORD INTO TWO 16 BIT QUANTITIES, IN
; HALF WORDS

SPLTWD:	LDB	T3,[POINT 16,T2,35-16] ;GET SECOND 16 BITS
	ANDI	T2,177777	;MASK OFF ALL BUT FIRST 16 BITS
	HRL	T2,T3		;MAKE HALF-WORDS SO -11 CAN SEE ALL
	POPJ	P,		;RETURN
;OUTPUT ROUTINES

DECOUT:	SKIPA	T4,[^D10]
OCTOUT:	MOVEI	T4,^D8
RADOUT:	IDIV	T1,T4
	HRLM	T2,(P)	;SAVE
	SKIPE	T1		;SKIP IF END
	PUSHJ	P,RADOUT	;NOT
	HLRZ	T1,(P)		;GET
	ADDI	T1,"0"		;CONVERT TO ASCII
	OUTCHR	T1		;PRINT
	POPJ	P,


;GET RADIX INPUT

GETDEC:	SKIPA	T4,[^D10]
GETOCT:	MOVEI	T4,^D8
	SETZ	T1,		;T1 WILL HAVE RESULT
GETOC1:	PUSHJ	P,GETCHR	;GET CHAR FROM TTY
	CAIL	T2,"0"		;LEGAL OCTAL NUMBER?
	CAILE	T2,"0"(T4)
	JRST	GETOC2		;NO, SEE IF BREAK CHAR
	IMUL	T1,T4		;TIMES RADIX
	ADDI	T1,-"0"(T2)	;ADD IN
	JRST	GETOC1

GETOC2:	PUSHJ	P,NOTBRK	;BREAK?
	  JRST	COMFIN		;YES
	JRST	COMERR		;NO, BARF



;ROUTINE TO GET SIXBIT DEVICE NAME

GETDEV:	SETZ	T1,		;CLEAR RESULT
	MOVE	T3,[POINT 6,T1] ;BYTE POINTER
GETDV1:	PUSHJ	P,GETCHR	;GET INPUT CHAR IN T2
	CAIN	T2,":"		;COLON OR
	JRST	GETDV3
	PUSHJ	P,NOTBRK	;BREAK IS DELIMITER
	  JRST	COMFIN		;OK
	SUBI	T2," "-' '	;CONVERT ASCII TO SIXBIT
	CAIL	T2,0		;MAKE SURE ITS LEGAL SIXBIT
	CAILE	T2,77		;IN RANGE?
	JRST	COMERR		;NO
GETDV2:	IDPB	T2,T3		;STORE ANOTHER CHAR IN T1
	TLNN	T3,770000	;OUT OF ROOM?
	SETZ	T3,		;YES, STOP STORING, BUT STILL CHECK
	JRST	GETDV1		;CONTINUE

GETDV3:	PUSHJ	P,GETCHR	;GET NEXT CHAR, BETTER BE BREAK
	PUSHJ	P,NOTBRK	;IS IT BREAK?
	  JRST	COMFIN		;YES, OK
	JRST	COMERR		;NO, ERROR
;ROUTINE TO SKIP IF CHAR IN T2 IS NOT A BREAK CHAR

	DEFINE X(A),<IRP A,<BRKMSK==BRKMSK+1B<^O'A>>>
	BRKMSK==0
	X(<7,12,13,14,32,33>)
NOTBRK:	MOVE	T4,[BRKMSK]
	LSH	T4,(T2)
	SKIPL	T4
CPOPJ1:	AOS	(P)
CPOPJ:	POPJ	P,
;HERE IF INPUT ACCEPTED AND NO ERRORS, TYPE CRLF AND RETURN CPOPJ1

COMFIN:	TELLCR	<>
	JRST	CPOPJ1
;HERE IF ERROR DETECTED, GIVE ERROR RETURN, CLEAR TTY INPUT BUFFER

COMERR:	CLRBFI
	TELLCR	<>
	POPJ	P,

;ROUTINE TO GET ONE CHAR FROM TTY INTO T2

GETCHR:	INCHWL	T2
	CAIN	T2,15
	JRST	GETCHR
	POPJ	P,
SUBTTL LOOKUP/ENTER/RENAME/DELETE BLOCKS

LUKBLK:	.RBSTS
	0		;PPN
	SIXBIT/FE/	;NAME
	SIXBIT/SYS/	;EXTENSION
	0		;PROTECTION
	BLOCK	^D13	;OTHER STUFF


;BLOCK USED TO CREATE FE.SYS

ENTBLK:	.RBSTS
	0		;PPN, FILLED IN AT INITIALIZATION
	SIXBIT/FE/
	SIXBIT/SYS/
	XWD	157000,0	;PROTECTION
	EXP	0,0,0
	0		;.RBEST, SHOULD BE ZERO
FEFSIZ:	0		;.RBALC
	EXP	0,0,0,0,0,0

;BLOCK USED TO DELETE AN FE.SYS WITH BAD BLOCKS IN IT

DELBLK:	.RBPRV
	EXP 0,0,0,0
SUBTTL STORAGE

HOMERR:	BLOCK	1		;NUMBER OF HOM BLOCKS THAT HAD ERRORS
FEFPOS:	BLOCK	1
PDL:	BLOCK	PDSIZ

IIOWD:	IOWD	200,IBUF
	0
IBUF:	BLOCK	200

OIOWD:	IOWD	200,OBUF
	0
OBUF:	BLOCK	200

	END	FEFILE