perm filename SAIBRK.FAI[S,AIL]1 blob sn#102581 filedate 1974-05-22 generic text, type T, neo UTF8
COMPIL(BRK,<BREAKSET,SETBREAK,STDBRK>
	  ,<SAVE,RESTR,BRKMSK,SIMIO,GOGTAB,X22,X33>
	  ,<BREAKSET, SETBREAK, STDBRK ROUTINES>)
HERE (BREAKSET)
	PUSHJ	P,SAVE		;SAVE ACS AND THINGS
	MOVE	LPSA,X33
	SUB	SP,X22
	SKIPLE	A,-2(P)		;TABLE #
	CAILE	A,=18
	ERR	<THERE ARE ONLY 18 BREAK TABLES>
	HLLZ	B,BRKMSK(A)	;BREAK MASK FOR THIS TABLE
	ADD	A,USER
	MOVE	C,[ANDCAM B,(D)]  ;USUAL CLEARING INSTR
	LDB	X,[POINT 4,-1(P),35] ;COMMAND
	TRZN	X,10		  ;LEFT OR RIGHT HALF OF TABLE?
	SKIPA	X,BKCOM(X)	  ;RIGHT HALF
	HLRZ	X,BKCOM(X)	  ;LEFT HALF
	JRST	(X)		  ;DISPATCH
BKCOM:	XWD	XCLUDE,PASLINS	;X,,P
	XWD	INCL,PENDCH	;I,,A
	XWD	ILLSET,RETCH	;-,,R
	XWD	UCASE,SKIPCH	;K,,S
	XWD	BRKLIN,RESTR	;L,,D
	XWD	ILLSET,ERMAN	;-,,E
	XWD	NOLINS,LCASE	;N,,F
	XWD	OMIT,ILLSET	;O,,-
ILLSET:	ERR	<ILLEGAL COMMAND TO BREAKSET>,1
	JRST	RESTR
XCLUDE:	SKIPA	C,[IORM B,(D)]	;YES, SET ALL TO 1 TO INITIALIZE
OMIT:	MOVSS	B		;OMIT, PUT BIT IN RH
INCL:	MOVSI	D,-200
	HRRI	D,BRKTBL(USER)	;RELOCATABLE IOWD
BRKLUP:	XCT	C		;CLEAR (OR SET) PROPER (HALF OF PROPER) TABLE
	AOBJN	D,BRKLUP
	MOVE	C,[IORM B,BRKTBL(D)]	;USUAL SETTING INSTR
	CAIN	X,XCLUDE	;BY EXCEPTION?
	MOVE	C,[ANDCAM B,BRKTBL(D)] ;YES, WANT TO TURN OFF BITS
	ADDI	C,(USER)	;RELOCATE IT
	HRRZ	A,1(SP)		;LENGTH OF STRING
	MOVE	X,2(SP)		;BYTE POINTER
	JRST	BRKL2
BRKL1:	ILDB	D,X		;GET A CHAR
	XCT	C		;DO RIGHT THING TO RIGHT BIT
BRKL2:	SOJGE	A,BRKL1
	JRST	RESTR
PASLINS: TDZA	B,B		;PASS LINE NOS. SINE COMMENT
NOLINS:	MOVEI	B,-1		;INFORM IN THAT IT SHOULD 
	MOVEM	B,LINTBL(A)	;  DELETE LINE NOS.
	JRST	RESTR
BRKLIN:	SKIPA	B,[-1]		;MARK BREAK ON LINE NOS. FOR THIS TBL
ERMAN:	MOVSI	B,-1		;LH NEG SIGNALS ERMAN'S SCHEME
	MOVEM	B,LINTBL(A)
	JRST	RESTR
PENDCH:	SETOM	DSPTBL(A)	;APPEND TO END OF INPUT
	JRST	RESTR
SKIPCH:	TDZA	B,B		;CHAR NEVER APPEARS IN INPUT STRING
RETCH:	MOVEI	B,-1		;RETAIN FOR NEXT TIME
	MOVEM	B,DSPTBL(A)
	JRST	RESTR
UCASE:	MOVSS	B	;INTO RIGHT HLF
	IORM	B,BRKCVT(USER)
	JRST	RESTR
LCASE:	MOVSS	B
	ANDCAM	B,BRKCVT(USER)
	JRST	RESTR
HERE (SETBREAK)
	HRRZ	TEMP,-3(SP)		;DO OMIT STRING, IF PRESENT
	JUMPE	TEMP,NO.O		;NULL STRING DOESN'T COUNT
	PUSH	P,-1(P)			;TABLE #
	PUSH	SP,-3(SP)		;OMIT CHARACTERS
	PUSH	SP,-3(SP)
	PUSH	P,["O"]			;OMIT!
	PUSHJ	P,BREAKSET		;DO THAT
NO.O:	HRRZS	-1(SP)			;COUNT OF # OF COMMANDS
BKSLUP:	SOSGE	-1(SP)		;DONE?
	 JRST	 BKSDUN			; YES
	PUSH	P,-1(P)			;TABLE #
	ILDB	TEMP,(SP)		;COMMAND
	PUSH	P,TEMP
	PUSH	SP,-5(SP)
	PUSH	SP,-5(SP)		;STRING TO USE IF NECESSARY
	PUSHJ	P,BREAKSET
	JRST	BKSLUP			;DO IT -- AGAIN
BKSDUN:	SUB	P,X22
	SUB	SP,[XWD 6,6]
	JRST	@2(P)
HERE (STDBRK)
	PUSHJ	P,SAVE
	MOVE	LPSA,X22
	MOVE	CHNL,-1(P)
	MOVEI	CDB,D-DMODE		;SO WE CAN USE SIMIO'S OPEN
	MOVEI	D,17			;DUMP MODE
	MOVE	D+1,['SYS   ']
	MOVEI	D+2,0			;NO HEADERS
	XCT	IOOPEN,SIMIO		;DO THE OPEN
	 ERR	 <DSK NOT AVAILABLE?>
	MOVEI	USER,D-FNAME		;SO WE CAN USE SIMIO'S LOOKUP
	MOVE	D,['BKTBL ']
	MOVE	D+1,['BKT   ']		;FUNNY NAME AND EXTENSION
	SETZB	D+2,D+3
	XCT	IOLOOKUP,SIMIO		;DO THE LOOKUP
	ERR	<Standard break table not available>
	MOVE	USER,GOGTAB
	MOVEI 	D,DSPTBL-1(USER)
	HRLI	D,-(=19+=19+=128)	;IOWD SIZE,LOC
	MOVEI	D+1,0			;TERMINATE COMMAND LIST
	XCT	IODIN,SIMIO		;DO THE INPUT
	SKIPA				;ALL WENT WELL
	ERR	<Error reading standard break table>
	MOVEI	D,0			;NO INHIBIT BITS TO RELEASE
	XCT	IORELEASE,SIMIO		;RELEASE FILE
	JRST	RESTR
HERE(BRKSP1)				; SPARES *******
HERE(BRKSP2);
	ERR	<DRYROT IN BRK SPARES>
ENDCOM(BRK)