	.TITLE	PATCH XVM V1A000
/ 
/ 
/                   FIRST PRINTING, FEBRUARY 1974
/ 
/ THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO 
/ CHANGE WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED
/ AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
/ DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPON-
/ SIBILITY FOR ANY ERRORS THAT MAY APPEAR IN THIS
/ DOCUMENT.
/ 
/ THE SOFTWARE DESCRIBED IN THIS DOCUMENT IS FUR-
/ NISHED TO THE PURCHASER UNDER A LICENSE FOR USE ON
/ A SINGLE COMPUTER SYSTEM AND CAN BE COPIED (WITH
/ INCLUSION OF DIGITAL'S COPYRIGHT NOTICE) ONLY FOR 
/ USE IN SUCH SYSTEM, EXCEPT AS MAY OTHERWISE BE PRO-
/ VIDED IN WRITING BY DIGITAL.
/ 
/ DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY
/ FOR THE USE OR RELIABILITY OF ITS SOFTWARE ON EQUIP-
/ MENT THAT IS NOT SUPPLIED BY DIGITAL.
/ 
/ COPYRIGHT (C) 1974,75 BY DIGITAL EQUIPMENT CORPORATION
/ 
/ 
        .EJECT
/ 
/EDIT #017 	DEC. 12, 72
/EDIT #018	JULY 14, 74	EK	CHANGE SIGNON NUMBER
/EDIT #019	JULY 20, 75	BLR	XVM UPGRADE AND REMOVE ADSS/BF STARTUP
/EDIT #020	SEPT 11, 75	GAR	FIX SO 'ILLEGAL COMMAND' TYPEOUT OCCURS ...
/					AND ADD 'IAC' AND 'TCA' TO SYMBOL TABLE.
/COPYRIGHT 69,71,72 DIGITAL EQUIPMENT CORPORATION ,MAYNARD,MASSACHUSETTS
/SYSTEM PROGRAM TO PATCH SYSTEM PROGRAMS.
/ 
/SEQUENTIAL ORGANIZATION: COMMAND DECODER; COMMAND PROCESSORS;
/SUBROUTINES; ERROR HANDLER; TELETYPE MESSAGES; SYMBOL TABLE; COMMAND TABLE;
/DATA REGISTERS; BUFFERS & BANK BIT INITIALIZATION ROUTINE.
/ 
	.ABS
	.LOC	12700
 
IDX=ISZ			/USED WHEN SKIP NOT INTENDED.
SET=ISZ			/USED TO SET A FLAG NON-0.
.SCOM=100
	.EJECT
/PROGRAM STARTS HERE.
 
BEGIN	JMP INBANK	/ONE-TIME-ONLY INITIALIZATION OF
BEGIN1	JMS	NUBLOK		/READ IN SYSBLK
	LAC	COMTB1		/COMPUTE THE END OF THE PATCH COMMAND
	TAD	ADR100		/TABLE
	TAD	(6
	DAC	ADR100
			/BANK BITS IN 15-BIT ADDRESSES.
 
/PROGRAM RESTARTED HERE.
 
BEGRET	CAL 764		/.INIT -14, SYSTEM DEVICE HANDLER,
	1		/FOR INPUT AND OUTPUT.
ADR1	BEGRET		/^P ADDRESS (JUST IN CASE).
	0
 
	CAL 1775		/.INIT -3, TO PRINT CAR. RET. LINE FD.
	1		/ON THE TELETYPE.
ADR2	BEGRET		/^P RESTART ADDRESS.
	0
 
	CAL 2775		/.WRITE IOPS ASCII ON TELETYPE.
	11
ADR3	MSG1		/ADDRESS OF 'PATCH VNN'.
SYSNAM	0		/SYSTEM-PROGRAM-SELECTED FLAG.
 
	DZM SYSNAM	/SYSTEM PROGRAM NOT YET SELECTED.
 
/RETURN HERE WHEN READY TO READ IN AND DECODE A NEW COMMAND.
 
NUCMND	DZM BLKOUT	/SET FLAG ZERO INDICATING THAT
			/THE BLOCK IN CORE (IF ANY) HAS
			/NOT YET BEEN MODIFIED.
	JMS TTYIN		/PRINT'>'; READ IN USER'S LINE; SET
			/PICKUP COUNT AND POINTER.
	.EJECT

/NOW CONVERT THE COMMAND FROM.ASCII TO .SIXBT AND STORE
/FOR SUBSEQUENT COMPARISION WITH LEGAL ENTRIES IN THE
/COMMAND TABLE. COMMAND IS EITHER A SYSTEM PROGRAM
/NAME OR AN ACTION (L, READ, OR EXIT). L IS FOLLOWED
/BY A SPACE AND THEN AN OCTAL ADDRESS. B, B+, AND B-
/ARE TREATED LIKE PROGRAM NAMES.
 
TRYAGN	LAC (40
	DAC LASTCH
	JMS STRING	/CONVERT COMMAND TO .SIXBT .
	JMP NUCMND	/NULL LINE.
 
/NOW, SEARCH COMTAB FOR A MATCHING COMMAND.
 
MATCH	LAC ADR5		/(COMTAB
NXCMD	DAC PUTP		/INITIAL ADDRESS OF TABLE.
	LAC* PUTP		/TRY TO MATCH 2 WORDS.
	IDX PUTP
	SAD COMAND
	SKP		/1ST WORDS MATCH.
	JMP NXCMD1
	LAC* PUTP
	SAD COMAND+1
	JMP	FOUND	/2ND WORDS MATCH.
NXCMD1	LAC	PUTP		/SKIP OVER REMAINDER OF THIS ENTRY.
	TAD	(6
	SAD	ADR100
	JMP ILLCMD	/NO. ILLEGAL COMMAND.
	JMP	NXCMD	/SEARCH FARTHER
FOUND	IDX	PUTP	/FOUND MATCH
	LAC*	PUTP
	SPA
	JMP*	PUTP		/IT'S AN ACTION
	RTL
	LAC	PUTP		/IT'S A PROGRAM
	DAC	SYSNAM
	CLC
	DAC	CURBLK
	SZL
	JMP	BLOCK		/BLOCK MODE COMMAND
	LAC	TFOR
	DAC	TRANIN
	TAD	(1000
	DAC	TRANOUT
	JMS	ENDLIN
	JMP	NUCMND
 
 
	.EJECT

/SYSTEM-PROGRAM-NAME COMMAND. USER ASKS TO SETUP FOR
/PATCHING A NEW SYSTEM PROGRAM OR A SINGLE BLOCK.
 
SETUP	0
	DAC	PUTP
	LAC*	PUTP
	DAC	STBLOK
	IDX	PUTP
	DAC	STBL1		/FIRST BLOCK FOR COPY ROUTINE
	LAC*	PUTP
	DAC	NOBLK1		/# OF BLOCKS FOR SIZE TEST
	TAD	STBLOK		/COMPUTE LAST BLOCK
	DAC	MBLOK		/PLUS 1 OR FIRST BLOCK OF NEXT PROGRAM
	IDX	PUTP
	LAC*	PUTP
	TAD	(-1
	DAC	LOCAT
	IDX	PUTP
	LAC*	PUTP
	TAD	(-1
	CMA
	DAC	SIZE
	IDX	PUTP		/FETCH STARTING ADDRESS FOR
	LAC*	PUTP		/RELOCATEABLE LISTING
	TAD	(32		/SKIP OVER BANK BIT INIT. ROUTINE
	DAC	RLOCAT
	CMA
	TAD	(1		/COMPUTE THE NEGATIVE RELOCATION
	DAC	MRLOC		/FACTOR FOR CODE SAVING
	JMP*	SETUP
 
/SINGLE BLOCK SELECT COMMAND. B OR B+ INDICATE THAT THE BLOCK IS WRITTEN
/FORWARD; B- INDICATES THAT THE BLOCK IS WRITTEN IN REVERSE.
 
BLOCK	JMS OCTAL.	/RETURN NUMBER IN OCTNUM.
	JMP ILLCMD	/RETURN HERE IF VALUE IS NULL.
	LAC OCTNUM
	SPA
	JMP BADBLK	/BLKNUM<0 IS ILLEGAL.
	LAC*	SYSNAM
	AND (2000		/SAVE DIRECTION BIT.
	TAD (764
	DAC TRANIN	/.TRAN IN (FWD OR REV).
	TAD (1000
	DAC TRANOUT	/.TRAN OUT (FWD OR REV).
	LAC OCTNUM
	DAC FAKBOK	/BLOCK #.
	LAC	ADR33
	DAC	SYSNAM
	JMP NUCMND	/GET NEXT COMMAND.
 
	.EJECT
/EXIT ACTION: PRINT CARRIAGE RETURN LINE FEED AND THEN EXIT
/TO THE MONITOR.
 
EX.IT	CAL 775		/.CLOSE -3 TO PRINT CAR. RET.
	6		/LINE FEED ON THE TTY.
 
	CAL		/.EXIT TO THE MONITOR.
	15
/CHANGE SYSTEM PROGRAM PARAMETERS
FIRB.	LAW	1		/STARTING BLOCK
	SKP
NUMB.	LAW	2		/# OF BLOCKS
	SKP
FIRA.	LAW	3		/FIRST ADDRESS
	SKP
PROGS.	LAW	4		/SIZE OF PROGRAM
	SKP
STRTA.	LAW	5		/STARTING ADDRESS
	AND	(7
	DAC	TEMP
	LAC	ADR30
	CMA
	TAD	SYSNAM
	SPA
	JMP	ILLCMD
	TAD	TEMP
	DAC	ADRESS
	LAC	SYBLOK
	DAC	SYBLO1
	LAC	ADR34
	JMS	SETUP
	LAC	LSKP		/SET LISTING SWITCH TO ABS
	DAC	RELOCF
	JMP	TSTADR
	.EJECT
 
/L ACTION: LIST LOCATION AND CONTENTS AND OPEN THE REGISTER
/FOR MODIFICATION.
 
LIST.	LAC	LSKP		/ABS LISTING (L)
LSKP	SKP
RLIST.	LAC	(NOP		/BIN LISTING (LR)
	DAC	RELOCF		/SET FLAG
	LAC SYSNAM	/CHECK THAT A SYSTEM PROGRAM HAS
	SNA		/BEEN SELECTED.
	JMP ILLCMD	/NO. ILLEGAL COMMAND.
	JMS	SETUP
	LAW	-2
	DAC	SYBLO1
	JMS OCTAL.	/RETURNS ADDRESS IN OCTNUM.
	JMP ILLCMD	/RETURNS HERE IF NO NUMBER FOUND
			/BEFORE THE LINE TERMINATOR. ILLEGAL.
	LAC OCTNUM
RELOCF	XX		/RELOCATION FLAG
	TAD	RLOCAT		/ADD RELOCATION TO NUMBER (LR)
DACADR	DAC ADRESS	/ADDRESS TO BE LISTED.
 

/INSURE THAT THE ADDRESS IS WITHIN THE RANGE OF THE PROGRAM.
/THEN DO WHAT IS NECESSARY TO GET THAT LOCATION INTO CORE.
 
TSTADR	JMS TEST		/CHECK IF ADDRESS IS VALID; COMPUTE
			/BLOCK# AND RELATIVE ADDRESS WITHIN
			/THE BLOCK. RETURN BLOCK # IN THE AC.
	SAD CURBLK	/IS THIS BLOCK ALREADY IN CORE?
	JMP LISTIT	/YES.
	JMS OUTPUT	/NO. OUTPUT OLD BLOCK, IF NECESSARY.
	JMS NUBLOK	/SET AND TRAN IN NEW BLOCK.
	JMS PRTGTH	/PRINT '>'.
	JMP PRTADR
	.EJECT
/ 
/LIST ADDRESS AND CONTENTS. WAIT FOR REPLY.
 
LISTIT	CAL 2775		/.WRITE IOPS ASCII ON TTY.
	11
ADR6	MSG7		/A SPACE.
ADRESS	0		/CORE ADDRESS TO BE LISTED.
 
PRTADR	LAC	(DAC DIGIT	/SET UP TO PRINT ADDRESS
	DAC	DACDIG
	LAC	(57		/SLASH
	DAC	DIG6		/6TH CHARACTER TO BE PRINTED
	LAC ADRESS	/PRINT THE ADDRESS AS
	STL		/A 5-DIGIT OCTAL # FOLLOWED
	JMS PRTOCT	/BY A SLASH.
	LAC	BUFP
	TAD BLKADR	/COMPUTE ADDRESS RELATIVE TO THE 1ST
	DAC PICKUP	/LOCATION OF THE BLOCK IN CORE.
	LAC	(DAC DIGIT	/SET UP TO PRINT CONTENTS
	DAC	DACDIG
	LAC* PICKUP	/GET ITS CONTENTS.
	CLL		/PRINT CONTENTS AS
	JMS PRTOCT	/A 6-DIGIT OCTAL #.
	XCT	RELOCF		/LR?
	SKP			/YES
	JMP	PRTAD1		/NO
	LAC	(740000	/IS CONTENTS ADDRESS INSTRUCTION
	AND*	PICKUP
	SZA
	SAD	(640000
	JMP	PRTAD1		/NO
	AND	(700000
	SAD	(700000
	JMP	PRTAD1		/NO
	LAC	(74		/<
	DAC	DIGIT
	LAC	(DAC DIGIT
	DAC	DACDIG
	ISZ	DACDIG
	LAC*	PICKUP		/ARE CONTENTS POSITIVE WHEN UNRELOCATED
	AND	(17777
	TAD	MRLOC
	SPA
	JMP	PRTAD1		/NO
	STL			/YES
	JMS	PRTOCT		/PRINT <5 DIGITS
PRTAD1	JMS TTYIN		/PRINT '>'; THEN READ IN USER'S REPLY
			/AND SETUP GET POINTER AND COUNTER.
 
	.EJECT
/PROCESS COMMAND STRING TO DETERMINE WHETHER OR NOT TO MODIFY THE CONTENTS
/OF THE OPEN REGISTER AND WHAT REGISTER TO LIST NEXT: (1) OPTIONAL EXPRESSION
/FOLLOWED BY (2) OPTIONAL _ OR / FOLLOWED BY (3) OPTIONAL COMMENT AND
/TERMINATED BY (4) CAR. RET. OR ALT MODE. THE EXPRESSION IS PROCESSED LEFT
/TO RIGHT. THE INITIAL VALUE IS ZERO AND THE INITIAL OPERATOR IS +. WHENEVER
/A STRING OF OPERATORS IS SEEN, ONLY THE LAST IS USED. INITIAL OPERATORS
/ARE LEGAL. TRAILING OPERATORS ARE LEGAL BUT ARE IGNORED. (!) IS INCLUSIVE
/OR. (-) IS 2'S COMP. SUBTRACTION. (SPACE)(+)(HORIZ. TAB)(*) ARE ALL
/2'S COMP. ADD. (*) IS SPECIAL: WHEN IT IS ENCOUNTERED, 20000 IS XORED
/INTO THE ACCUMULATED VALUE OF THE EXPRESSION AND A FLAG IS SET INDICATING
/THAT THE OPEN REGISTER IS TO BE MODIFIED (ALSO SET BY NUMBERS AND
/SYMBOLS). NUMBERS ARE OCTAL WITH FROM 1 TO 6 DIGITS. SYMBOLS ARE ALPHA-
/NUMERIC WITH FROM 1 TO 3 CHARACTERS, THE 1ST NOT BEING AN OCTAL DIGIT.
/SYMBOL VALUES ARE LOOKED UP IN THE SYMBOL TABLE OF INSTRUCTION MNEMONICS.
/"LAW" IS A SPECIAL SYMBOL. IT IS ASSUMED THAT IT WILL BE USED ONLY IN
/EXPRESSIONS OF THE FORM: "LAW N" OR "LAW -N". IF THE EXPRESSION
/(OPTIONAL) IS TERMINATED BY / OR _ , THE REMAINDER OF THE LINE IS IGNORED.
/AFTER THE REGISTER HAS BEEN (OPTIONALLY) MODIFIED, _ OPENS THE REGISTER
/ADDRESSED BY THE CONTENTS OF THE CURRENT REGISTER. IF _ NOT THERE,
/CAR. RET. OPENS THE NEXT SEQUENTIAL REGISTER AND ALT MODE TERMINATES THE
/LISTING SEQUENCE.
 
	DZM VALFLG	/NO VALUE EXPR. YET SEEN.
	DZM LAWFLG	/SET NON-0 WHEN LAW ENCOUNTERED.
	DZM VALUE		/SET INITIAL VALUE OF 0.
SAVSPC	LAC (40		/SPACE (+) IS INITIAL OPERATOR.
SAVEOP	DAC OPER		/STORE OPERATOR.
	JMS ENDCH		/GET NEXT CHAR.; TEST FOR TERMINATOR.
	JMP SAVEOP	/SPACE.
	JMP LINEND	/CAR. RET. OR ALT MODE.
SKPCHN	SAD (55		/ -
	JMP SAVEOP
	SAD (41		/ !
	JMP SAVEOP
	SAD (52		/ *
	JMP STAR
	SAD (53		/ +
	JMP SAVEOP
	SAD (11		/HORIZ. TAB.
	JMP SAVEOP
	SAD (137		/ _
	JMP INDREC
	SAD	(136		/^
	JMP	PT.MN1
	SAD (57		/ /
	JMP COMENT
	JMS OCTDIG	/SKIP IF NOT 0-7.
	JMP NUMBER
	JMS ALFNUM	/SKIP IF NOT A-Z 0-9.
	SKP
	JMP ILLCMD	/ILLEGAL COMMAND STRING.
 
	.EJECT
/CONVERT ALPHANUMERIC SYMBOL, UP TO 3 CHARS., TO .SIXBT .
 
	LAW -4		/SETUP >3 CHAR ERROR DETECTION COUNT.
	DAC TEMP
	LAW -3		/INIT 3-CHAR-PER-WORD COUNT.
	DAC PUTC
	LAC ADR20		/(FNAME1
	DAC PUTP		/STORAGE WORD POINTER.
	DZM FNAME1
 
LOOP3	ISZ TEMP		/IS SYMBOL > 3 CHARS.?
	SKP
	JMP ILLCMD	/YES. ILLEGAL COMMAND STRING.
	LAC LASTCH
	JMS PUT		/PUT CHAR. IN SYMBOL.
	JMS ENDCH		/GET NEXT CHAR.; TEST FOR TERMINATOR.
	JMP SEARCH	/SPACE ENDS SYMBOL.
	JMP SEARCH	/SAME FOR CAR. RET. OR ALT MODE.
	JMS ALFNUM	/SKIP IF NON-ALFAMERIC.
	JMP LOOP3
 
/THE .SIXBT SYMBOL IS IN FNAME1. LOOK UP VALUE IN SYMBOL TABLE.
 
SEARCH	LAC ADR18		/(SYMTAB
	DAC PUTP
	LAC* PUTP		/GET 1ST WORD IN SYMTAB:
	DAC PUTC		/2'S COMP. ENTRY COUNT.
 
NEXSYM	IDX PUTP		/POINT AT NEXT SYMBOL NAME.
	LAC* PUTP		/GET NAME.
	IDX PUTP		/POINT AT SYMBOL VALUE.
	SAD FNAME1	/MATCH?
	JMP FNDSYM
	ISZ PUTC		/END OF TABLE?
	JMP NEXSYM
	JMP ILLCMD	/YES. ILLEGAL COMMAND SYMBOL.
 
/FOUND SYMBOL.
 
FNDSYM	LAC* PUTP		/SAVE SYMBOL VALUE IN OCTNUM.
	DAC OCTNUM
	LAC FNAME1	/IS THIS SYMBOL "LAW"?
	SAD LAWSYM
	SET LAWFLG	/YES.
	JMP COMBIN	/COMBINE SYMBOL VALUE INTO EXPRESSION.
 
	.EJECT
/CONVERT OCTAL NUMBER, UP TO 6 DIGITS.
 
NUMBER	DZM OCTNUM	/INIT STORAGE WORD.
	LAW -7		/SETUP >6 DIGIT ERROR DETECTION COUNT.
	DAC PUTC
 
PUTDIG	JMS PUTOCT	/PUT DIGIT IN NUMBER.
	JMS ENDCH		/GET NEXT CHAR.; TEST FOR TERMINATOR.
	JMP COMBIN	/SPACE TERMINATES NUMBER.
	JMP COMBIN	/SO DOES CAR. RET. OR ALT MODE.
	JMS OCTDIG	/SKIP IF NOT AN OCTAL DIGIT.
	JMP PUTDIG
 
/COMBINE NEW VALUE INTO ACCUMULATED VALUE.
 
COMBIN	LAC OPER		/DISPATCH ON OPERATOR.
	SAD (55		/- (2'S COMP).
	JMP MINUS
	SAD (41		/! (INCLUSIVE OR).
	JMP INCLOR
	JMP GETNUM	/ALL OTHERS EQUIV TO TAD.
 
INCLOR	LAC VALUE
	XOR OCTNUM
	DAC TEMP
	LAC VALUE
	AND OCTNUM
	XOR TEMP
	JMP DACVAL
 
MINUS	LAC OCTNUM
	CMA
	TAD (1
	DAC OCTNUM
	LAC LAWFLG
	SNA
	JMP GETNUM	/"LAW" WAS NOT JUST SEEN.
	DZM LAWFLG
	LAC OCTNUM	/ASSUME EXPRESSION "LAW N" OR "LAW -N".
	JMP DACVAL
GETNUM	LAC OCTNUM
TADVAL	TAD VALUE
DACVAL	DAC VALUE
	SET VALFLG	/INDICATE VALUE EXPRESSION WAS SEEN.
 
	.EJECT
	JMS ALFNUM	/SKIP IF CHAR. FOLLOWING # NON-ALFAMERIC.
	JMP ILLCMD	/ILLEGAL COMMAND STRING.
	LAC LASTCH
	SAD (40		/SPACE?
	JMP SAVEOP
	SAD (15		/CAR. RET.?
	JMP LINEND
	SAD (175		/ALT MODE?
	JMP LINEND
	JMP SKPCHN
 
STAR	LAC BSPACE	/(20000) THE INDIRECT BIT.
	XOR VALUE
	DAC VALUE
	SET VALFLG	/INDICATE VALUE EXPRESSION SEEN.
	JMP SAVSPC	/* EQUIV TO SPACE AND +.
 
INDREC	JMS ENDLIN	/TERMINATE INPUT LINE.
	JMS CHANGE	/MODIFY OPEN REGISTER IF EXPR SEEN.
	LAC* PICKUP	/OPEN REGISTER'S CONTENTS.
	AND (17777	/MASK TO 13-BIT ADDRESS.
	JMP DACADR	/OPEN THAT REGISTER.
PT.MN1	JMS	ENDLIN
	JMS	CHANGE
	LAW	-1
	TAD	ADRESS
	JMP	DACADR
 
COMENT	JMS ENDLIN	/TERMINATE INPUT LINE.
LINEND	JMS CHANGE	/MODIFY OPEN REGISTER IF EXPR SEEN.
 
/CHECK LINE TERMINATOR: ALT MODE ENDS AND CARRIAGE RETURN
/CONTINUES THE SEQUENCE.
 
	LAC (15		/IS THE LINE TERMINATOR A CARRIAGE
	SAD LASTCH	/RETURN ?
	JMP NEXLOC	/YES.
OUTNUC	JMS OUTPUT	/NO, ALT MODE. WRITE OUT THE BLOCK IN
			/CORE ONTO THE SYSTEM DEVICE IF
			/THE BLOCK HAS BEEN MODIFIED.
	JMP NUCMND	/GET A NEW COMMAND.
 
NEXLOC	IDX ADRESS	/POINT TO NEXT SEQUENTIAL LOCATION.
	JMP TSTADR	/LIST AND OPEN FOR MODIFICATION.
	.EJECT
 
/READ ACTION: READ FROM AUXILIARY DEVICE AND PATCH. IF ABS BIN
/LOADER IS ON THE TAPE, SKIP OVER IT. ERRORS TERMINATE READ.
 
READ	LAC	LSKP		/ABS READ
	SKP
READR	LAC	(NOP		/READR (RELOCATABLE READ)
	DAC	RELOCF		/SET RELOCATION FLAG
	LAC SYSNAM	/CHECK THAT A SYSTEM PROGRAM HAS
	SNA		/BEEN SELECTED.
	JMP ILLCMD	/NO. ILLEGAL COMMAND.
	JMS	SETUP
	LAW	-2
	DAC	SYBLO1
	XCT	RELOCF		/READR?
	SKP			/YES
	JMP	READ2		/NO
	LAC	LSKP		/READ SYSBLK AGAIN
	DAC	SYSRF
	LAC	GETP		/SAVE UNPACKING ROUTINE POINTERS
	DAC	GETP1
	LAC	GETC
	DAC	GETC1
	LAC	LASTCH
	DAC	LASCH1
	LAC	GET1
	DAC	GET11
	LAC	GET2
	DAC	GET21
	LAC	(JMP READ3	/DO NOT CAUSE ERROR IF NOT NUMBER
	DAC	OSWCH
	LAC	(NOP		/SUPRESS READING TO END OF LINE
	DAC	OSWCH1
	JMS	OCTAL.
READ3	SKP			/RETURN IF NO NUMBER
	JMP	READ1		/NUMBER PRESENT
	LAC	GETP1		/RESTORE UNPACKING ROUTINE TO REPROCESS
	DAC	GETP
	LAC	MAXSZ		/DEFAULT VALUE IS CONTENTS OF .SCOM
	DAC	OCTNUM
	LAC	GETC1
	DAC	GETC
	LAC	GET11
	DAC	GET1
	LAC	GET21
	DAC	GET2
	LAC	LASCH1
	DAC	LASTCH
READ1	LAC	(JMP NOTOCT	/RESTORE ERROR ON NOT OCTAL
	DAC	OSWCH
	LAC	ERROR1		/RESTORE READING TO END OF LINE IN OCTAL
	DAC	OSWCH1
	LAC	OCTNUM		/FETCH OCTAL NUMBER
	DAC	LMAXPC		/STORE 
	CMA			/TEST IF LESS THAN 17637
	TAD	(1
	TAD	MAXSZ
	SPA
	JMP	RELERR		/NO; GREATER THAN 17636
	LAC	ADR30		/COMPUTE ADDRESS OF NB FOR PROGRAM
	CMA
	TAD	SYSNAM
	SPA			/IS PROGRAM IN SYSBLK
	JMP	ILLCMD		/NO ERROR
	TAD	(2		/INCREMENT FOR NB
	DAC	PDNB		/STORE
 
READ2	CAL 770		/.INIT -10, THE AUX. DEVICE, FOR
	1		/INPUT.
ADR8	BEGRET		/^P RESTART ADDRESS (JUST IN CASE).
TEMP	0
/ CONVERT REMAINDER OF LINE TO FILENAME.
 
	JMS STRING	/CONVERT FILENAME, IF ANY, TO .SIXBT .
	DAC	COMAND		/NULL FILE NAME
	LAC COMAND	/SAVE FIRST 6 CHARS. AS FILE NAME.
	DAC FNAME1
	LAC COMAND+1
	DAC FNAME2
	LAC LASTCH
	SAD (40
	JMP EXTEN		/SPACE MEANS THERE MIGHT BE AN EXTENSION.
NULEXT	XCT	RELOCF		/READR?
	JMP	.+3		/YES
	LAC	(10223		/NO; ABS EXTENSION
	SKP
	LAC	(21116		/BIN EXTENSION
	JMP .+4		/ASSUME AN EXTENSION OF 'ABS'.
EXTEN	JMS STRING	/CONVERT EXTENSION TO .SIXBT .
	JMP NULEXT	/NULL EXTENSION.
	LAC COMAND
	DAC EXT		/SAVE FIRST 3 CHARS. AS THE EXTENSION.
	JMS ENDLIN	/TERMINATE THE INPUT LINE.
 
/ IS THE DEVICE FILE ORIENTED? IF SO, THE FILENAME HAD BETTER BE THERE.
 
FSTAT	LAC ADR20		/(FNAME1 ; DIRECTORY POINTER.
	DAC DVCTYP
 
	CAL 3770		/.FSTAT -10 ON FNAME1.
	2
DVCTYP	XX		/DEVICE TYPE BITS RETURNED IN 0-2.
 
VALFLG=.-1		/USED IN LIST COMMAND.
	.EJECT
 
	SZA!CLL		/AC=0 IF FILE NOT FOUND.
	STL
	LAC DVCTYP	/GET CODE BITS FOR DEVICE TYPE.
	AND IOTSYM	/(700000
	SNA
	JMP NONFOD	/NON-FILE-ORIENTED DEVICE.
	LAC	FNAME1
	SZL
	SAD	(40
	JMP FNF		/ERROR. FILE NOT FOUND.
 
	CAL 770		/.SEEK THE FILE ON -10.
	3
ADR20	FNAME1		/POINTER TO FILE DIRECTORY ENTRY BLOCK.
 
	DZM CMDBUF
	DZM CMDBUF+1	/PROTECT AGAINST EOM ON PTR.
NONFOD	XCT	RELOCF		/READR?
	JMP	SREADR		/YES
 
	CAL 4770		/.READ -10 IN DUMP MODE.
	10
ADR9	CMDBUF
	-2		/2 WORDS; NO HEADER.

	CAL 770		/.WAIT ON -10 FOR READIN.
	12
 
	LAC CMDBUF	/1ST WORD READ IN.
	SMA
	JMP NOLOAD	/NOT THE ABS BIN LOADER.
 
/SINCE THE 1ST WORD ON THE TAPE IS NEGATIVE, ASSUME IT'S
/THE BEGINNING OF THE ABS BIN LOADER. WILL BE ON PAPER TAPE, ONLY.
 
LDLOOP	CAL 3770		/.READ IMAGE ALPHA FROM -10.
	10
ADR10	CMDBUF
	-3		/1 LINE + 2 WORD HEADER.
 
	CAL 770		/.WAIT ON -10 FOR READIN.
	12
 
	LAC CMDBUF+2	/IF 7-HOLE PUNCH IS ON THIS
	AND (100		/PAPER TAPE LINE, IT'S THE END OF
	SNA		/THE ABS BIN LOADER.
	JMP LDLOOP
	.EJECT
 
/THIS IS THE RESTART LOCATION OF THE READ LOOP. READ IN
/FIRST 2 WORDS OF ABS BLOCK HEADER.
 
READLP	DZM CMDBUF+1	/PROTECT AGAINST EOM ON PTR.
 
	CAL 4770		/.READ DUMP MODE FROM -10.
	10
ADR11	CMDBUF
	-2		/2 WORDS; NO HEADER.
 
	CAL 770		/.WAIT ON -10 FOR READIN.
	12
 
	LAC CMDBUF	/1ST WORD READ IN.
	SMA
	JMP NOLOAD	/NOT A START BLOCK.
 
/START BLOCK HAS BEEN DETECTED. TERMINATE READ COMMAND.
 
OUTNU1	CAL 770		/.CLOSE -10.
	6
 
	JMP OUTNUC
 

/ABS BLOCK HEADER WORDS 1 AND 2 HAVE BEEN READ IN.
 
NOLOAD	DAC ADRESS	/SAVE 1ST LOCATION TO MODIFY.
	LAC CMDBUF+1	/WORD 2 IS BLOCK BODY COUNT (-).
	SMA
	JMP SUMERR	/TREAT WORD COUNT ERROR AS CHECKSUM ERROR.
	TAD (31		/MAX. # OF WORDS IN BLOCK BODY.
	SPA
	JMP SUMERR	/WORD COUNT TOO LARGE. GIVE CHECKSUM ERROR.
	TAD (-32
	DAC BODYCT	/SAVE WORD COUNT +1 (INCLUDES CHECKSUM WORD).
	DAC GETC
	LAC ADR13		/(CMDBUF
	DAC TEMP		/SETUP POINTERS TO FIRST DATA WORD.
	DAC GETP
	IDX GETP
	LAC CMDBUF	/START PARTIAL CHECKSUM.
	TAD CMDBUF+1
	DAC CHKSUM
 
	DZM CMDBUF+1	/PROTECT AGAINST EOM ON PTR.
	.EJECT
 
	CAL 4770		/.READ DUMP MODE FROM -10.
	10
ADR13	CMDBUF
BODYCT	XX		/2'S COMPL. OF # OF WORDS TO READ.
 
VALUE=.-1			/USED IN LIST COMMAND.
 
	CAL 770		/.WAIT ON -10 FOR READIN.
	12
 
/FINISH COMPUTING CHECKSUM ON ABS BIN BLOCK.
 
CKSMLP	LAC* TEMP		/PICKUP NEXT BLOCK WORD.
	TAD CHKSUM
	DAC CHKSUM	/ADD INTO CHECKSUM.
	IDX TEMP
	ISZ BODYCT	/SKIP WHEN DONE.
	JMP CKSMLP
	SZA		/CHECKSUM MUST BE ZERO.
	JMP SUMERR	/CHECKSUM ERROR.
 

/CHECK IF ANY WORDS REMAIN IN READER BUFFER. IF SO,
/TEST VALIDITY OF PRESENT ADDRESS. THEN BRING IN THE 
/APPROPRIATE BLOCK INTO CORE AND TRANSFER THE NEXT
/BUFFER WORD TO IT.
 
ANYMOR	ISZ GETC		/READER BUFFER EMPTY?
	SKP
	JMP READLP	/YES, GO FILL IT UP.
	LAC* GETP		/GET NEXT BUFFER WORD, THE NEW
	IDX GETP
	JMS	DACPRG		/DEPOSIT IN PROGRAM
	JMP ANYMOR	/GET NEXT WORD.
 
	.EJECT
/
/READ IN BINARY PROGRAM
/
SREADR	DZM	RECDIN		/READ NOT IN PROGRESS
LL002	LAC	RECDIN		/IS READ IN PROGRESS
	SZA
	JMP	LL019		/YES
LL018	LAC	ADR11		/NO; SET UP BUFFERS
	DAC	LNBUFP
	DAC	VEC4		/READ CAL
	TAD	(62		/BUFFERS SIZE 62
	DAC	LL016
LL010	CAL	770		/READ -10
	10
VEC4	XX			/SUPPLIED
	-62
LL014	.WAIT	-10
	LAC*	LNBUFP
	AND	(60		/READ ERROR
	SZA
	JMP	SUMERR		/YES
	LAC*	LNBUFP		/IOPS BINARY FILE?
	AND	(17
	SZA
	JMP	ABSERR		/NO; ANNOUNCE ERROR
	LAC*	LNBUFP		/FETCH WORD PAIR COUNT
	AND	(377000		/MAKE POSITIVE
	CLL!RAL		/MULTIPLY BY TWO
	TAD	(776000		/SUBTRACT 2
	DAC	WDCNT
	SNA!CLL			/IS IT EMPTY
	JMP	LL002		/YES
LL015	CAL	770		/READ -10
	10
LL016	XX			/SUPPLIED
	-62
	CLC			/INDICATE READ IN PROGRESS
	DAC	RECDIN
	.EJECT
/
/DATA CODE WORD FETCH ROUTINE
/
LL041	ISZ	LNBUFP		/GO PAST HEADER
	ISZ	LNBUFP
LL005	LAW	-4		/CODES IN GROUPS OF 4
	DAC	CWDTAL
	JMS	WRDCHK		/PICK UP CODE WORD
	DAC	CODEWD
CODE1	ISZ	CWDTAL		/IS THIS END OF GROUP
	SKP
	JMP	LL005		/YES
	LAC	CODEWD		/SAVED CODE WORD
	RTL			/GET NEW CODE WORD INTO AC RIGHT
	RTL
	RTL
	DAC	CODEWD
	RAL			/GET LAST BIT FROM LINK
	AND	(77
	DAC	LTEMP1
	SAD	(27		/END CODE?
	JMP	LCD23		/YES
	LAW	-34
	TAD	LTEMP1
	SMA
	JMP	SUMERR		/THESE LOADER CODES ARE ILLEGAL
	TAD	(22
	SMA
	LAW	-2		/IGNORE THESE LOADER CODES
	TAD	LL007
	DAC	.+2
	JMS	WRDCHK
	XX			/SUPPLIED
/DISPATCH TABLE
LL007	JMP	ENTRY		/MODIFIED CONSTANT
	JMP	SUMERR		/0 ILLEGAL
	JMP	LCD01		/1
	JMP	LCD02		/2
	JMP	LCD03		/3
	JMP	LCD04		/4
	JMP	LCD05		/5
	JMP	LCD06		/6
	JMP	CODE1		/7	IGNORE
	JMP	CODE1		/8	IGNORE
	JMP	EXTERR		/9 EXTERNAL .GLOBL (ERROR)
ENTRY=.
	.EJECT
/FETCH NEXT WORD FROM BUFFER
/
WRDCHK	0
	LAC	WDCNT
	SNA
	JMP	LL002		/GO READ NEXT BUFFER
	TAD	(777000		/DECREMENT WORD COUNT
	DAC	WDCNT
	LAC*	LNBUFP		/PICK UP WORD
	ISZ	LNBUFP		/BUMP WORD POINTER
	JMP*	WRDCHK
/SET UP TO PROCESS BUFFER JUST FILLED AND SET UP
/TO READ NEXT BUFFER
LL019	LAC	LL016
	DAC	LNBUFP		/POINTER TO NEWLY READ BUFFER
	SAD	ADR11		/DECIDE WHICH BUFFER WE ARE DEALING WITH
	JMP	LL020
	LAC	ADR11
LL021	DAC	LL016		/SWAP BUFFERS
	JMP	LL014
LL020	TAD	(62
	JMP	LL021
/
/ADD WORD TO PROGRAM
/
DACPRG	0
	DAC	LTEMP1		/STORE NEW CONTENTS FOR LATER
	JMS	TEST		/COMPUTE THE NEW ADDRESS
	SAD	CURBLK		/IN THIS BLOCK
	JMP	.+3		/YES
	JMS	OUTPUT		/NO OUTPUT OLD BLOCK IF NECESSARY
	JMS	NUBLOK		/READ IN THE NEW BLOCK
	LAC	BUFP		/CALCULATE THE WORD IN THE BUFFER
	TAD	BLKADR
	DAC	PICKUP		/STORE FOR DEPOSIT
	LAC	LTEMP1
	DAC*	PICKUP
	LAW	-1		/SET FLAG TO INDICATE BLOCK ALTERED
	DAC	BLKOUT
	ISZ	ADRESS
	JMP*	DACPRG
	.EJECT
/
/BANK BIT INITIALIZATION PROGRAM
/
BBSTR	JMS	0		/GET BANK BITS AND LOCATION FOR FIRST VECTOR
	LAC	0		/PICK UP TRANSFER VECTOR
	AND	27		/(77777
	TAD	31		/(31 ADD TO GET FIRST FREE LOCATION
BFSWCH	DAC*	30		/UPDATE .SCOM+3(BACKGROUND FOREGROUND CHANGES THIS TO DAC 30)
	JMP	16		/GO TO NEXT LOWER ADDRESS
	XOR*	0		/BANK BIT INIT. TRANSFER VECTOR VECTOR
	AND	25		/(60000
	XOR*	0		/KEEP ALL BUT BANK BITS
	DAC	1		/TWO LEVELS OF INDIRECTION
	XOR*	1		/BANK BITS ARE STILL IN AC
	AND	25		/(60000
	XOR*	1
	DAC*	1		/BANK BITS INTO TRANSFER VECTOR
	LAC	0		/DECREMENT POINTER
	TAD	26		/SUBTRACT 1
	DAC	0		/UPDATE POINTER
	ISZ	24		/IS THIS THE LAST TRANSFER VECTOR?
	JMP	6		/PROCESS NEXT TRANSFER VECTOR
	JMP	32		/GO TO BEGINNING OF PROGRAM
	-2			/CONSTANT-(NUMBER OF TRANSFER VECTORS PLUS 2)
	60000			/CONSTANT
	-1			/CONSTANT
	77777			/CONSTANT
	.SCOM+3		/FIRST FREE ADDRESS UPDATE
	30			/TO SKIP OVER OR OVERLAY THIS ROUTINE
/32				/USER PROGRAM STARTS HERE
	.EJECT
/
/CODE1 - PROGRAM SIZE
/
LCD01	SPA!SNA
	JMP	ABSERR		/PROGRAM IS NOT RELOCATABLE
	TAD	(32		/ADD SIZE OF BANK BIT INITIALIZATION ROUTINE
	DAC	DPS		/STORE FOR LATER
	CMA			/COMPUTE THE NEGATIVE SIZE
	TAD	(1
	DAC	SIZE
	DAC	UCOU		/COUNTER FOR ZEROING CORE IMAGE
	TAD	LMAXPC		/IS PROGRAM TOO BIG
	SPA
	JMP	SIZERR		/YES
	DAC	LOCAT		/.LOC-1
	TAD	(1
	DAC	RLOCAT		/ SA
	DAC	ADRESS
	TAD	(32
	DAC	RLOC2		/RELOCATION FACTOR OF BINARY
	LAC	DPS
	TAD	(377
	AND	(777400		/COMPUTE NUMBER OF BLOCKS REQUIRED
	CLL
	RTR
	RTR
	RTR
	RTR
	DAC	LTEMP1		/STORE TEMPORARILY
	CMA
	TAD	(1
	TAD	NOBLK1		/DO WE HAVE ROOM?
	SPA
	JMP	SIZERR		/NO
	LAC	ADR30		/TV TABLE
	DAC	TVEC
ULOOP	CLA
	JMS	DACPRG		/CLEAR OUT CORE IMAGE
	ISZ	UCOU		/IS THIS THE LAST WORD
	JMP	ULOOP		/NO; CONTINUE
	LAC	RLOC2
	DAC	ADRESS		/GO BACK TO THE BEGINNING
	JMP	CODE1		/PROCESS NEXT WORD
	.EJECT
/
/CODE02 - PROGRAM LOAD ADDRESS
/
LCD02	TAD	RLOC2		/ADD RELOCATION FACTOR
	DAC	ADRESS		/PUT IN LOAD ADDRESS
	JMP	CODE1		/PROCESS NEXT CODE
/
/CODE03 - RELOCATABLE INSTRUCTION
/
LCD03	DAC	LTEMP1		/STORE TEMPORARILY
	TAD	RLOC2		/ADD RELOCATION
	XOR	LTEMP1		/MAKE SURE INSTRUCTION DOESN'T
	AND	(17777		/CHANGE
	XOR	LTEMP1
/
/CODE04 - CONSTANT
/
LCD04	JMS	DACPRG		/DEPOSIT IN LOAD ADDRESS
	JMP	CODE1		/PROCESS NEXT CODE WORD
/
/CODE05 - TRANSFER VECTOR
/
LCD05	TAD	RLOC2		/RELOCATE
	DAC	LTEMP1		/SAVE
	LAC	TVEC		/HAVE WE ROOM FOR ONE MORE TRANSFER VECTOR
	TAD	(400
	SAD	ADR19		/YES
	JMP	TMVEC		/NO ERROR
	LAC	ADRESS
	DAC*	TVEC		/STORE IN TABLE
	ISZ	TVEC		/BUMP POINTER
	LAC	LTEMP1
	JMP	LCD04		/PROCESS LIKE CONSTANT AFTER RELOCATION
/
/CODE06 - NON COMMON STORAGE ALLOCATION
/
LCD06	TAD	ADRESS		/INCREMENT ADDRESS OF LOADING BY VARIABLE
	DAC	ADRESS
	JMP	CODE1		/PROCESS NEXT CODE
	.EJECT
/
/CODE23 - END OF PROGRAM
/
LCD23	JMS	WRDCHK		/SA READ FROM BUFFER
	DAC	LTEM2		/SAVE FOR BANK BIT INITIALIZATION ROUTINE
	LAC	ADR101		/SET UP TO LOAD BANK BIT INIT. PROGRAM
	DAC*	(10
	LAC	RLOCAT
	DAC	ADRESS
	LAC	ADR30
	CMA
	TAD	(1
	TAD	TVEC		/COMPUTE NUMBER OF TRANSFER VECTORS
	DAC	INCR		/STORE TEMPORARILY
	TAD	DPS		/ADD TO PROGRAM SIZE
	DAC	DPS
	LAC	INCR		/COMPUTE - # OF T.V.
	CMA
	TAD	(1
	DAC	INCR		/STORE TEMPORARILY
	TAD	RLOCAT		/SUBTRACT FROM FIRST ADDRESS
	DAC	DFA		/NEW FIRST ADDRESS OF PROGRAM
	TAD	(-20		/SUBTRACT THE FIRST 20 LOCATIONS OF BANK
	SPA			/CAN PROGRAM FIT IN ONE BANK
	JMP	SIZERR		/NO
	LAW	-23		/SIZE OF RELOCATABLE PART OF PROGRAM-1
	DAC	LCOUN		/STORE IN COUNTER
LCD23A	LAC*	10		/FETCH NEXT WORD
	TAD	RLOCAT		/ADD RELOCATION FACTOR
LCD23B	JMS	DACPRG		/ADD TO PROGRAM
	ISZ	LCOUN
	JMP	LCD23A		/GO GET NEXT WORD
	LAC*	10		/FETCH LAST RELOCATABLE WORD
	TAD	RLOCAT		/RELOCATE IT
	TAD	LTEM2		/ADD RELATIVE ADDRESS OF BEGINNING OF PROG.
	JMS	DACPRG		/STORE AWAY (THIS IS INSTRUCTION TO 
				/TRANSFER CONTROL AFTER BANK BIT INIT.
	LAC*	10		/FETCH CONSTANT -2
	TAD	INCR		/ADD MINUS # OF TRANSFER VECTORS
	JMS	DACPRG		/STORE AWAY IN PROGRAM AS COUNTER
	LAW	-5		/PUT IN REST OF CONSTANTS
	DAC	LCOUN
	LAC*	10
	JMS	DACPRG
	ISZ	LCOUN	/ARE WE THROUGH
	JMP	.-3		/NO
	.EJECT
/
/SQUEEZE IN TRANSFER VECTORS
/
SQTRAN	LAC	RLOCAT		/START FROM BEGINNING OF BANK BIT INIT.
	DAC	DSA		/STORE FOR SA OF PROG.
	DAC	ADRESS
	JMP	SQ2		/YES
SQ1	1764			/.TRAN OUT -14
	13
STBL1	XX			/SUPPLIED
ADR30	COMTB1			/START OF SYSBLK AND TRANSFER VECTOR TABLE
	-400
	.WAIT	-14
	LAC	ADRESS			/IS THIS THE END
	SAD	LMAXPC		/THE LAST ADDRESS USED
	JMP	SQ3		/YES
	ISZ	STBL1		/NO GO TO NEXT BLOCK
	LAC	STBL1		/IS THIS ONE TOO MANY
	SAD	MBLOK
	JMP	SIZERR		/YES
	LAC	ADR30		/START ON NEW BLOCK
	DAC	TVEC
SQ2	DZM	BLKOUT		/DO NOT WRITE OUT CHANGED CONTENTS
	JMS	TEST
	SAD	CURBLK		/HAS BLOCK CHANGED
	SKP
	JMS	NUBLOK		/READ IN NEW BLOCK IF NECESSARY
	LAC	TVEC		/CHECK IF BLOCK IS FULL
	TAD	(400
	SAD	BUFP
	JMP	SQ1		/WRITE FULL BLOCK OUT
	LAC	BUFP		/COMPUTE LOAD ADDRESS
	TAD	BLKADR
	DAC	PICKUP		/STORE TRANSFER VECTOR
	LAC*	PICKUP	/PICK UP WORD
	DAC*	TVEC		/MOVE IT
	LAC	ADRESS		/CHECK IF END OF PROGRAM REACHED
	SAD	LMAXPC
	JMP	SQ1		/END OF PROGRAM REACHED.
	ISZ	ADRESS
	ISZ	TVEC
	JMP	SQ2		/ITERATE
	.EJECT
/
/PUT NEW PARAMETER IN SYSBLK
/
SQ3	LAC	SYBLOK
	DAC	SYBLO1
	LAC	ADR34		/GET INTO RIGHT TYPE OF OPERATION 
	JMS	SETUP		/TO MODIFY SYSBLK
	LAC	PDNB		/FETCH ADDRESS IN SYSBLK FOR MODIFYING
	DAC	ADRESS
	JMS	TEST		/IS THIS BLOCK IN CORE
	JMS	NUBLOK		/NEVER
	LAC	BUFP
	TAD	BLKADR		/COMPUTE THE TRANSFER VECTOR
	DAC*	(10		/ACTUALLY THIS IS ADDRESS - 1
	LAC	DFA		/STORE FA
	DAC*	10
	LAC	DPS
	DAC*	10	/STORE PS
	LAC	DSA		/STORE SA
	DAC*	10
	LAC	(NOP		/DO NOT READ IN SYSBLK
	DAC	SYSRF
	CLC
	DAC	BLKOUT
	JMP	OUTNU1
	.EJECT
/
/NEW ERROR MESSAGES
/
TMVEC	JMS	ERRPG
	.ASCII	'MORE THAN 256 TRANSFER VECTORS'<15>
	.LOC	.-1
ABSERR	JMS	ERRPG
	.ASCII	'NOT RELOCATABLE BINARY'<15>
EXTERR	JMS	ERRPG
	.ASCII	'EXTERNAL .GLOBL NOT ALLOWED'<15>
	.EJECT
RELERR	JMS	ERRPG
	.ASCII	'LAST ADDRESS GREATER THAN .SCOM CONTENTS'<15>
	.LOC	.-1
/VARIABLES ETC
LTEMP1	0
PSIZE	0
LTEM2	0
LCOUN	0
LMAXPC	0
MBLOK	0
INCR	0
DFA	0
DPS	0
DSA	0
PDNB	0
GETP1	0
GETC1	0
GET11	0
GET21	0
UCOU	0
LASCH1	0
	.EJECT
/SUBROUTINE OCTDIG: SKIP ON RETURN IF LASTCH IS NOT AN OCTAL DIGIT.
 
OCTDIG	0
 
	LAW -60
	TAD LASTCH
	SPA
	JMP .+3
	TAD GETS		/(-10
	SMA
	IDX OCTDIG	/NOT OCTAL.
	JMP* OCTDIG
 
/SUBROUTINE ALFNUM: SKIP ON RETURN IF LASTCH IS NOT ALPHANUMERIC.
 
ALFNUM	0
	LAC	LASTCH		/TEST FOR #
	SAD	(43
	JMP*	ALFNUM		/INCLUDE # AS ALFANUMERIC
 
	JMS OCTDIG	/SKIP IF NOT AN OCTAL DIGIT.
	JMP* ALFNUM
	SZA		/SKIP IF 8.
	SAD (1		/SKIP IF NOT 9.
	JMP* ALFNUM
	TAD (-11		/-101 SO FAR.
	SPA
	JMP .+3
	TAD (-32
	SMA
	IDX ALFNUM	/NOT ALPHANUMERIC.
	JMP* ALFNUM
 
/SUBROUTINE CHANGE: IF VALFLG NON-0, CHANGE CONTENTS OF OPEN REGISTER.
 
CHANGE	0
 
	LAC VALFLG
	SNA
	JMP* CHANGE
	LAC	CURBLK
	SAD	SYBLO1
	JMS	TESPAR
	LAC VALUE		/VALUE OF USER-TYPED EXPRESSION.
	DAC* PICKUP	/STORE IN CURRENT REGISTER.
	LAW -1		/SET FLAG TO INDICATE THAT THE BLOCK
	DAC BLKOUT	/IN CORE HAS BEEN MODIFIED.
	JMP* CHANGE
	.EJECT
/SUBROUTINE TO TEST PARAMETERS FOR APPROPRIATENESS
TESPAR	0
	LAC	PICKUP
	CMA
	TAD	ADR19
	SPA
	JMP*	TESPAR		/NOT SYSTEM PROGRAM PARAMETER
	LAC	BLKADR
	TAD	(-1
	SPA
	JMP*	TESPAR		/NOT SYSTEM PROGRAM PARAMETER
	TAD	(-7
	SMA			/CALCULATE TYPE OF PARAMETER
	JMP	.-2
	TAD	(5
	SPA
	JMP*	TESPAR		/PROGRAM NAMES ARE IGNORED
	SAD	(3
	JMP	TESP1
	SZA
	SAD	(1
	JMP*	TESPAR		/STARTING BLOCK AND NUMBER OF BLOCKS
				/ARE NOT TESTED
TESP3	LAC	VALUE		/ALL ADDRESSES ARE TESTED TO SEE
				/IF THEY CAN FIT UNDER BOOTSTRAP
	JMS	TESTP
	TAD	MAXSZ
	JMP	RANGER
	JMP*	TESPAR
TESP1	LAW	-2		/PROGRAM SIZE IS TESTED TO SEE IF IT
				/WILL FIT ON ALLOTTED BLOCKS
	TAD	PICKUP
	DAC	PUTP
	LAC	VALUE
	TAD	(-1
	JMS	CBKADR
	LAC	TEMP1
	TAD	(1
	JMS	TESTP
	TAD*	PUTP
	JMP	SIZERR
	JMP	TESP3
	.EJECT
TESTP	0
	SPA
	JMP	ER1
	CMA
	TAD	(1
	XCT*	TESTP
	SMA
	ISZ	TESTP
ER1	ISZ	TESTP
	JMP*	TESTP
CBKADR	0			/POSITIVE RELATIVE ADDRESS IN AC
	AND	(377777
	DZM	TEMP1
	TAD	BUFSZB
	SPA
	JMP*	CBKADR		/RETURN WITH RELATIVE BLOCK NUMBER IN
	ISZ	TEMP1		/TEMP1 AND BLOCK ADDRESS IN AC
	JMP	.-4
 
	.EJECT
/ SUBROUTINE STRING: UNPACK CHARACTERS FROM THE COMMAND INPUT BUFFER
/ AND CONVERT THEM TO .SIXBT STORED IN REGISTERS COMAND TO COMAND+2.
/ STRING TERMINATORS ARE SPACE, CAR. RET. AND ALT MODE.
 
STRING	0
 
	LAC ADR4		/(COMAND
	DAC PUTP		/1ST LOC. TO STORE IN.
	LAW -3
	DAC PUTC		/INITIAL BYTE COUNT.
	DZM COMAND	/0 REGISTERS WHERE STRING WILL BE STORED
	DZM COMAND+1	/IN .SIXBT .
	DZM COMAND+2
	LAW -12		/SET COUNT USED TO CHECK IF
	DAC MAXCNT	/STRING IS > 9 CHARS.
	LAC LASTCH
	SAD (40
 
GETNXT	JMS ENDCH		/GET NEXT CHAR.; TEST FOR TERMINATOR.
	JMP ENDSTR	/SPACE.
	JMP ENDSTR	/CAR. RET. OR ALT MODE.
			/OTHER.
	ISZ MAXCNT	/SKIP IF > 9 CHARS.
	SKP
	JMP ILLCMD	/ILLEGAL COMMAND.
 
	JMS PUT		/PACK CHAR. IN .SIXBT .
	JMP GETNXT
 
ENDSTR	LAW -3		/FILL IN THE LAST WORD WITH 0'S IF
	SAD PUTC		/WORD IS PARTIALLY FULL, I.E.,
	JMP .+4		/LEFT JUSTIFY.
	CLA
	JMS PUT
	JMP ENDSTR
 
	LAW -12		/IS THE STRING EMPTY?
	SAD MAXCNT
	JMP .+3		/YES.
	IDX STRING
	JMP* STRING
	LAC (40		/IS LAST CHAR. A SPACE?
	SAD LASTCH
	JMP STRING+1	/YES. TRY AGAIN.
	JMP* STRING
 
	.EJECT

/SUBROUTINE OCTAL.: CONVERT NUMBER FROM 5/7 ASCII, IN COMMAND
/INPUT BUFFER, INTO AN OCTAL NUMBER AND STORE IT IN OCTNUM. IGNORE
/LEADING AND TRAILING SPACES.  PRINT CARRIAGE RETURN LINE FEED IF
/LINE IS TERMINATED BY ALT MODE. SKIP ON RETURN IF NUMBER IS 
/NON-EMPTY.
 
OCTAL.	0
	DZM OCTNUM
	LAW -7
	DAC PUTC		/COUNT SET FOR 6 DIGITS MAXIMUM.
	LAC LASTCH	/IF LASTCH IS NOT SPACE, THERE'S NO
	SAD (40		/NUMBER AT ALL.
	SKP
	JMP* OCTAL.
	JMS ENDCH		/GET NEXT CHAR.; TEST FOR TERMINATOR.
	JMP .-1		/IGNORE LEADING SPACES.
	JMP* OCTAL.	/CAR. RET. OR ALTMODE - NO NUMBER.
	IDX OCTAL.
NEXDIG	JMS PUTOCT
	JMS ENDCH		/GET NEXT CHAR.; TEST FOR TERMINATOR.
OSWCH1	JMS ENDLIN	/SPACE. IGNORE REMAINDER OF LINE.
	JMP* OCTAL.	/CAR. RET. OR ALTMODE.
	JMP NEXDIG
 
/SUBROUTINE PUTOCT: TEST THAT THE CHAR. IS AN OCTAL DIGIT AND THAT THE
/NUMBER IS <7 DIGITS LONG. PUT DIGIT IN NUMBER.
 
PUTOCT	0
 
	JMS OCTDIG	/SKIP IF NOT OCTAL.
	SKP
OSWCH	JMP NOTOCT	/ERROR.
	ISZ PUTC		/SKIP IF TOO MANY DIGITS.
	SKP
	JMP TOOBIG	/ERROR.
	LAW -60
	TAD LASTCH	/GET DIGIT.
	DAC DIGIT
	LAC OCTNUM
	RCL		/MAKE ROOM FOR NEW DIGIT.
	RTL
	XOR DIGIT
	DAC OCTNUM
	JMP* PUTOCT
 
	.EJECT
/SUBROUTINE PRTOCT: CONVERT THE OCTAL NUMBER IN THE AC TO
/ASCII. IF LINK IS SET, PRINT 5-DIGIT ADDRESS.
 
PRTOCT	0
	DAC OCTNUM	/SAVE NUMBER.
	LAW -1
	DAC PUTC		/LOOP COUNT FOR 6 DIGITS.
 
PRTLP	LAC OCTNUM	/PRINT LOOP.
	RCL
	RTL
	DAC OCTNUM	/SAVE REMAINING DIGITS.
	RAL		/NEXT DIGIT IN POSITION.
	AND (7		/MASK IT.
	TAD (60		/CONVERT TO ASCII.
DACDIG	XX		/STORE DIGIT IN PRINT BUFFER.
	ISZ PUTC		/SKIP IF ON 1ST DIGIT.
	JMP .+4
	LAC PRTOCT	/IF LINK WAS SET ON ENTRY,
	SPA		/MEANING PRINT 5-DIGIT ADDRESS,
	JMP PRTLP		/IGNORE 1ST DIGIT.
	IDX DACDIG
	LAC PUTC
	SAD (5
	SKP		/DONE.
	JMP PRTLP
 
	CAL 3775		/.WRITE IMAGE ALPHA ON TELETYPE.
	11
ADR15	IMAGE		/ADDRESS OF BUFFER.
	-7
 
	CAL 775		/.WAIT ON -3 FOR OUTPUT COMPLETION.
	12
 
	JMP* PRTOCT
 
IMAGE	4000		/WORD PAIR COUNT.
	0
DIGIT	0
	0
	0
	0
	0
DIG6	0
 
	.EJECT

/SUBROUTINE GET: INITIALIZE BY SETTING GETC TO -1 AND GETP
/TO ADDRESS OF FIRST BUFFER WORD. GET PICKS UP A 5/7 ASCII WORD
/PAIR AND, EACH TIME CALLED, RETURNS NEXT CHAR. IN THE AC.
 
GET	0
	ISZ GETC		/SKIP IF WORD PAIR EXHAUSTED.
	JMP GETS		/NO, GET NEXT CHAR.
	LAC* GETP		/PICKUP NEXT WORD PAIR.
	IDX GETP
	DAC GET1		/WORD 1.
	LAC* GETP
	IDX GETP
	DAC GET2		/WORD 2.
	LAW -5
	DAC GETC		/RESET BYTE COUNT TO 5.
 
GETS	LAW -10		/SETUP SHIFT COUNT TO ROTATE WORDS 1
	DAC GETR		/AND 2 COMBINED 7+1/2 TIMES.
 
GETL	LAC GET2		/SHIFT LOOP.
	RAL
	ISZ GETR		/SKIP IF CHAR. IN POSITION.
	JMP .+3
	AND (177
	JMP* GET		/RETURN CHAR. IN THE AC.
 
	DAC GET2
	LAC GET1
	RAL
	DAC GET1
	JMP GETL		/CONTINUE SHIFT LOOP.
 
	.EJECT
/SUBROUTINE PUT: THE ASCII CHAR. IN THE AC IS TRIMMED TO
/.SIXBT AND PACKED IN WORDS OF 3 CHARS. EACH. INITIALIZE
/BY SETTING PUTC TO -3, PUTP TO THE ADDRESS OF THE FIRST
/STORAGE WORD, AND ALL STORAGE WORDS TO ZERO.
 
PUT	0
	AND (77		/CHANGE TO .SIXBT.
	XOR* PUTP		/ADD IN OTHER CHARS.
	ISZ PUTC		/SKIP IF WORD NOW FULL.
	JMP SHIFT
	DAC* PUTP		/STORE WORD WITHOUT SHIFTING.
	IDX PUTP		/POINT TO NEXT WORD.
	LAW -3		/RESET BYTE COUNT TO 3.
	DAC PUTC
	JMP* PUT
 
SHIFT	RCL		/SHIFT LEFT 6 TO MAKE ROOM FOR
	RTL		/NEXT CHAR.
	RTL
	RAL
	DAC* PUTP		/SAVE IT.
	JMP* PUT
 
/SUBROUTINE ENDCH: GET AND DISPATCH ON END
/OF LINE CHARACTER.
 
ENDCH	0
	JMS GET		/GET NEXT CHAR. FROM CMDBUF.
	DAC LASTCH	/SAVE LAST CHARACTER.
	SAD (40		/SPACE?
	JMP* ENDCH
	IDX ENDCH
	SAD (15		/CAR. RET.?
	JMP* ENDCH
	SAD (175		/ALT MODE?
	JMP ALT.
	IDX ENDCH		/OTHER.
	JMP* ENDCH
 
ALT.	CAL 775		/.CLOSE -3 TO PRINT CAR. RET.
	6		/LINE FEED ON THE TTY.
 
	LAC LASTCH
	JMP* ENDCH
 
	.EJECT

/SUBROUTINE TEST:  CHECK VALIDITY OF THE ADDRESS.  THEN CALCULATE
/THE BLOCK# (RETURNED IN THE AC) AND THE ADDRESS RELATIVE TO THE
/BEGINNING OF THE BLOCK.
 
TEST	0
	LAC ADRESS
	CMA
	TAD (1
	TAD LOCAT		/PROGRAM'S LOAD ADDRESS -1.
	SMA!CMA
	JMP RANGER	/INVALID ADDRESS.
	TAD SIZE		/2'S COMPLEMENT OF PROGRAM'S SIZE.
	SMA
	JMP RANGER
	LAC LOCAT		/CALCULATE ADDRESS RELATIVE TO
	CMA		/LOAD ADDRESS.
	TAD ADRESS
	DAC	BLKNUM
	JMS	CBKADR
	TAD	BUFSIZ
	DAC	BLKADR
	LAC	STBLOK
	SAD	SYBLO1
	JMP	TEST1
	TAD	TEMP1
	JMP	TEST2
TEST1	LAC	BLKNUM
	DAC	BLKADR
	LAC	STBLOK
TEST2	DAC	BLKNUM
	JMP*	TEST
/SUBROUTINE PRTGTH: PRINT '>' ON THE TELETYPE.
 
PRTGTH	0
	CAL 2775		/.WRITE IOPS ASCII ON TTY.
	11
ADR14	MSG2		/ADDRESS OF '>'.
BLKADR	0		/ADDRESS RELATIVE TO THE BEGINNING
			/OF THE CURRENT BLOCK.
	JMP* PRTGTH	/RETURN WITHOUT WAITING.
 
 
	.EJECT

/SUBROUTINE ENDLIN:  READ INPUT LINE UP TO THE CAR.RET. OR
/ALTMODE.  IF ALTMODE, PRINT CAR.RET. LINE FEED.
 
ENDLIN	0
	LAC LASTCH	/LAST CHARACTER.
	SAD (15		/CAR. RET.?
	JMP* ENDLIN
	SAD (175		/ALT MODE?
	JMP* ENDLIN	/LINE ALREADY TERMINATED.
	JMS ENDCH		/GET NEXT CHAR.; TEST FOR TERMINATOR.
	JMP .-1		/IGNORE SPACES.
	JMP* ENDLIN	/CAR. RET.OR ALT MODE.
	JMP .-3		/IGNORE ALL OTHER CHARACTERS.
 
/SUBROUTINE NUBLOK:  SET CURRENT BLOCK FROM NEW BLOCK #
/AND .TRAN IN THE NEW BLOCK.
 
NUBLOK	0
	LAC BLKNUM
	DAC CURBLK
	DAC	TRANOUT+2
	SAD	SYBLO1
	JMP	NUBLO1
	LAC	BUFSZB
	DAC	BUFP+1
	DAC	TRANOUT+4
	LAC	ADR19
	JMP	TRANIN-2
NUBLO1	LAC	SYSIZE
	CMA
	TAD	(1
	DAC	BUFP+1
	DAC	TRANOUT+4
	LAC	ADR30
	DAC	BUFP
	DAC	TRANOUT+3
TRANIN	CAL	764		/.TRAN IN FROM -14 (FWD OR REV), THE
	13		/SYSTEM DEVICE HANDLER.
CURBLK	-1		/# OF THE CURRENT BLOCK.
BUFP	XX
	-400
 
	CAL 764		/.WAIT ON -14 TO COMPLETE INPUT.
	12
 
	JMP* NUBLOK
 
	.EJECT

/SUBROUTINE  OUTPUT:  .TRAN OUT THE CURRENT BLOCK IN CORE
/IF THE FLAG INDICATES IT IS NECESSARY. THEN TURN OFF THE FLAG.
 
OUTPUT	0
	LAC BLKOUT
	SNA		/SKIP IF CURRENT BLOCK WAS MODIFIED.
	JMP* OUTPUT
TRANOUT	CAL 1764		/.TRAN OUT TO -14 (FWD OR REV).
	13
	XX		/BLOCK #.
	XX
	-400
 
	CAL 764		/.WAIT ON -14 TO COMPLETE OUTPUT.
	12
 
	DZM BLKOUT	/CLEAR OUTPUT-NECESSARY FLAG.
	JMP* OUTPUT
 
/SUBROUTINE TTYIN:  PRINT '>', READ IN USER-TYPED LINE INTO THE
/COMMAND BUFFER, AND SETUP POINTER AND COUNTER.
 
TTYIN	0
	JMS PRTGTH	/PRINT '>'.
 
	CAL 2776		/.READ IOPS ASCII FROM -2, THE TTY
	10		/OR BATCH DEVICE, INTO COMMAND BUFFER.
ADR17	CMDBUF
	-44
 
	CAL 776		/.WAIT ON -2 TO COMPLETE READIN.
	12
 
	LAW -1		/SETUP BYTE COUNT FOR GET SUBROUTINE.
	DAC GETC
	LAC ADR17		/(CMDBUF
	TAD (2
	DAC GETP		/SETUP POINTER TO COMMAND BUFFER.
	JMP* TTYIN
 
	.EJECT
/ERROR PRINT ROUTINE: SEARCH FOR LINE
/TERMINATOR IN ORDER TO PRINT CAR. RET. LINE FEED IF ALT MODE
/ENCOUNTERED. THEN, IF THE CURRENT BLOCK IN CORE HAS BEEN
/MODIFIED, WRITE IT OUT. THEN PRINT THE ERROR MESSAGE.
 
ERRPG	0			/ENTRY FOR NEW ERROR MESSAGES
	LAW	-2
	TAD	ERRPG		/MOVE BACK 2 FOR HEADER
ERROR	DAC ERRMSG	/POINTER TO ERROR MESSAGE.
ERROR1	JMS ENDLIN	/TERMINATE THE INPUT LINE.
	JMS OUTPUT	/WRITE OUT BLOCK IN CORE, IF NECESSARY.
 
	CAL 2775		/.WRITE IOPS ASCII ON TTY.
	11
ERRMSG	XX		/ADDRESS OF ERROR MESSAGE.
MAXCNT	0		/TEMP. COUNT REGISTER.
 
OPER=.-2			/USED IN LIST COMMAND.
SYSRF	NOP			/SYSBLK FLAG
	JMP NUCMND	/GET A NEW COMMAND.
	LAC	(NOP
	DAC	SYSRF		/CLEAR SYSBLK FLAG
	LAC	SYBLOK		/ALLOW COMMAND TABLE TO BE REFRESHED
	DAC	SYBLO1
	LAC	ADR34		/SYSBLK PARAMETERS
	JMS	SETUP
	DZM	ADRESS		/FIRST ADDRESS GOOD ENOUGH
	JMS	TEST
	JMS	NUBLOK		/READ IN SYSBLK
	JMP	NUCMND		/GET NEXT COMMAND
	.EJECT
 
/ERROR: ILLEGAL COMMAND.
 
ILLCMD	LAC ADR21		/POINTER TO 'ILLEGAL COMMAND'.
	JMP ERROR
 
/ERROR: RANGE ERROR.
 
RANGER	LAC ADR22		/POINTER TO 'ADDRESS OUT OF RANGE'.
	JMP ERROR
 
/ERROR: NOT AN OCTAL DIGIT.
 
NOTOCT	LAC ADR23		/POINTER TO 'NOT OCTAL DIGIT'.
	JMP ERROR
 
/ERROR: TOO MANY DIGITS.
 
TOOBIG	LAC ADR24		/POINTER TO  'TOO MANY DIGITS'.
	JMP ERROR
 
/ERROR: CHECKSUM ERROR OR BAD WORD COUNT IN ABS BLOCK HEADER OR EOF REACHED.
 
SUMERR	LAC ADR26		/POINTER TO 'CHECKSUM ERROR'.
	JMP ERROR
 
/ERROR: ILLEGAL BLOCK NUMBER.
 
BADBLK	LAC ADR12		/POINTER TO 'ILLEGAL BLOCK #'.
	JMP ERROR
 
/ERROR: FILE NOT FOUND.
 
FNF	LAC ADR27		/POINTER TO 'FILE NOT FOUND'.
	JMP ERROR
/ERROR: SIZE TOO LARGE FOR ALLOTTED BLOCKS
SIZERR	LAC	ADR32
	JMP	ERROR
	.EJECT

/IOPS ASCII MESSAGES FOR OUTPUT TO THE TELETYPE.
 
MSG1	2000
CHKSUM	0		/TEMP. CHECKSUM REGISTER.
	.ASCII /PATCH XVM V1A000/<15>	/(BR-019)
MSG2=.-2		/(WAS MSG2=.-2   EK 018)
/   (DELETED    .LOC .-1    EK-018)
	.ASCII />/<175>
MSG3=.-2			/(GAR:020) NOW 'ILLEGAL COMMAND' WILL TYPE.
/(GAR:020) DELETED .LOC .-1
	.ASCII /ILLEGAL COMMAND/<15>
MSG4=.-3
	.LOC .-1
	.ASCII /NOT OCTAL DIGIT/<15>
MSG5=.-3
	.LOC .-1
	.ASCII /ADDRESS OUT OF RANGE/<15>
MSG7=.-3
	.LOC .-1
	.ASCII / /<175>
 
	.EJECT
MSG9=.-3
	.LOC .-1
	.ASCII /TOO MANY DIGITS/<15>
MSG11=.-3
	.LOC .-1
	.ASCII /CHECKSUM ERROR/<15>
MSG12=.-2
	.ASCII /ILLEGAL BLOCK #/<15>
MSG13=.-3
	.LOC .-1
	.ASCII /FILE NOT FOUND/<15>
MSG14=.-2
	.ASCII /ILLEGAL SIZE/<15>
 
	.EJECT
/SYMBOL TABLE USED IN LIST COMMAND. THE 1ST WORD CONTAINS THE TWOS
/COMPLEMENT COUNT OF THE # OF TABLE ENTRIES. EACH ENTRY IS 2 WORDS:
/(1) .SIXBT SYMBOL MNEMONIC; (2) SYMBOL VALUE.
 
SYMTAB	SYMSIZ/2\777777+1	/2'S COMP. ENTRY COUNT.
	.SIXBT /ADD/
	300000
	.SIXBT /AND/
	500000
	.SIXBT /CAL/
	0
	.SIXBT /CCL/
	744002
	.SIXBT /CLA/
	750000
	.SIXBT /CLC/
	750001
	.SIXBT /CLL/
	744000
	.SIXBT /CMA/
	740001
	.SIXBT /CML/
	740002
	.SIXBT /DAC/
	40000
	.SIXBT /DZM/
	140000
	.SIXBT /EAE/
	640000
	.SIXBT /GLK/
	750010
	.SIXBT /HLT/
	740040
	.SIXBT	/IAC/		/(GAR:020)
	740030			/(GAR:020)
	.SIXBT /IOT/
IOTSYM	700000
	.SIXBT /ISZ/
	440000
	.SIXBT /JMP/
	600000
	.SIXBT /JMS/
	100000
	.SIXBT /LAC/
	200000
	.SIXBT /LAS/
	750004
	.SIXBT /LAT/
	750004
LAWSYM	.SIXBT /LAW/
	760000
	.SIXBT /NOP/
	740000
	.SIXBT /OAS/
	740004
	.SIXBT /OPR/
	740000
	.SIXBT /RAL/
	740010
	.SIXBT /RAR/
	740020
	.SIXBT /RCL/
	744010
	.SIXBT /RCR/
	744020
	.SIXBT /RTL/
	742010
	.SIXBT /RTR/
	742020
	.SIXBT /SAD/
	540000
	.SIXBT /SKP/
	741000
	.SIXBT /SMA/
	740100
	.SIXBT /SML/
	740400
	.SIXBT /SNA/
	741200
	.SIXBT /SNL/
	740400
	.SIXBT /SPA/
	741100
	.SIXBT /SPL/
	741400
	.SIXBT /STL/
	744002
	.SIXBT /SZA/
	740200
	.SIXBT /SZL/
	741400
	.SIXBT /TAD/
	340000
	.SIXBT	/TCA/		/(GAR:020)
	740031			/(GAR:020)
	.SIXBT /XCT/
	400000
	.SIXBT /XOR/
	240000
	.SIXBT /XX@/
	740040
	.SIXBT	/@#@/
RLOCAT	0
 
SYMSIZ=.-SYMTAB-1
 
	.EJECT
/TRANSFER VECTORS
ADR34	SYBLOK
ADR100	COMTB1-6
ADR101	BBSTR-1
/CONSTANTS
CONTB2	.BLOCK	100		/SET ASIDE ROOM FOR CONSTANTS
/PATCH AREA
PCH	.BLOCK	40
MAXSZ	17636			/MAXIMUM SIZE OF SYSBLK PARAMETERS
	.EJECT
/COMMAND TABLE;7 WORDS PER ENTRY
/SEE SYSBLK LISTING FOR FORMAT OF SYSTEM PROGRAMS.  IF COMMAND
/IS AN ACTION, WORD 3 IS A JMP TO THE APPROPRIATE ROUTINE
/WORDS 4,5,6,AND 7 ARE USED AS VARIABLES
/FOR B,B+, AND B-, THE 3RD WORD IS THE .TRAN FORWARD OR BACKWORD 
/BIT. ALSO, BIT 1 IS SET TO DISTINGUISH SINGLE BLOCK MODE
/FROM SYSTEM PROGRAM NAMES
COMTAB=.
BSPACE	.SIXBT	/B/
	0
	200000
ADR33	FAKBOK		/POINTS TO FAKE PARAMETERS
SIZE	0		/SYSTEM PROG. 2'S COMP. SIZE
ADR5	COMTAB
LOCAT	0		/SYSTEM PROGRAM LOAD ADDRESS -1
BPLUS	.SIXBT	/B+/
	0
	200000
FAKBOK	0		/FAKE PARAMETERS FOR BLOCK EXAMINATION
	1
	0
BUFSIZ	XX		/SIZE OF DEVICE BLOCK
BMINUS	.SIXBT	/B-/
	0
	202000
LAWFLG	0
ADR32	MSG14
SYBLO1	0
STBLOK	0		/SYSTEM PROGRAM FIRST BLOCK #
L.	.SIXBT	/L/
	0
	JMP	LIST.
GETC	0		/COUNTER FOR GETTING INPUT CHARS.
LASTCH	0		/LAST CHAR. EXAMINED FROM COMMAND INPUT BUF.
GETP	0		/POINTER INTO COMMAND INPUT BUFFER
BLKNUM	0		/BLOCK # ON PATCH DEVICE IN WHICH THE
			/SELECTED ADDRESS IS LOCATED
RL	.SIXBT	/LR/
	0
	JMP	RLIST.
MRLOC	0			/MINUS RELOCATION OF PROGRAM
TVEC	0			/NEXT TRANSFER VECTOR TO BE STORED
NOBLK1	0			/NUMBER OF BLOCKS OF CURRENT PROGRAM
RECDIN	0			/READ IN PROGRESS IF NONZERO
RR.	.SIXBT	/READR/
	JMP	READR
LNBUFP	0			/POINTER TO CURRENT BUFFER
WDCNT	0		/WORD COUNT
CWDTAL	0			/GROUP COUNT
CODEWD	0			/HOLDS CODE WORD
R.	.SIXBT	/READ/
	JMP	READ
GET1	0		/WORD 1 OF WORD PAIR FROM INPUT BUFFER
GET2	0			/WORD 2 OF WORD PAIR FROM INPUT BUFFER
BLKOUT	0			/IF NON-ZERO INDICATES THAT
ADR4	COMAND
				/THE CURRENT BLOCK IN CORE HAS BEEN MODIFIED
X.	.SIXBT	/EXIT/
	JMP	EX.IT
GETR	0			/TEMP. SHIFT COUNTER
OCTNUM	0			/TEMP. NUMBER ACCUMULATOR
PUTC	0			/BYTE COUNTER
ADR12	MSG12
FB.	.SIXBT	/FB/
	0
	JMP	FIRB.
PUTP	0			/WORD POINTER
PICKUP	0			/POINTER TO LOCATION IN BLOCK IN CORE
ADR18	SYMTAB
ADR21	MSG3
NB.	.SIXBT	/NB/
	0
	JMP	NUMB.
COMAND	0			/3 REGISTERS;COMMAND
	0
	0			/CONVERTED TO .SIXBT AND STORED HERE
RLOC2	0
FA.	.SIXBT	/FA/
	0
	JMP	FIRA.
FNAME1	0			/FILE DIRECTORY
FNAME2	0			/ENTRY BLOCK FOR READ COMMAND
EXT	0
ADR27	MSG13
PS.	.SIXBT	/PS/
	0
	JMP	PROGS.
ADR22	MSG5
ADR23	MSG4
ADR24	MSG9
ADR26	MSG11
SA.	.SIXBT	/SA/
	0
	JMP	STRTA.
ADR19	BUFFER
BUFSZB	-400			/2'S COMPLEMENT OF BUFFER SIZE
TFOR	764			/TRAN FORWARD .DAT -14
TEMP1	0
SYSBK.	.SIXBT	/SYSBLK/
SYBLOK	0			/SYSTEM BLOCK
	1
	0
SYSIZE	XX			/SIZE OF SYSTEM BLOCK
COMTB1=.
	.EJECT

/BUFFERS: THIS AREA CONTAINS THE SYSTEM DEVICE BLOCK BUFFER
/AND THE COMMAND INPUT BUFFER (ALSO USED AS A PAPER TAPE
/READER BUFFER). THE ONE-TIME-ONLY BANK BIT INITIALIZATION
/ROUTINE IS IN FIRST BUFFER.
 
BUFFER=.+1000			/SYSTEM DEVICE BLOCK BUFFER
CMDBUF=BUFFER+400		/COMMAND BUFFER,PAPER TAPE BUFFER
LIT60K	60000
INBANK	LAC* (.SCOM	/BANK BIT INIT. ROUTINE.
	AND LIT60K	/(60000
	DAC TEMP		/BANK BITS.
	LAC ADR1
	XOR TEMP
	DAC ADR1
	DAC	ADR35
	DAC ADR2
	DAC ADR8
	LAC ADR3
	XOR TEMP
	DAC ADR3
	LAC ADR4
	XOR TEMP
	DAC ADR4
	LAC ADR5
	XOR TEMP
	DAC ADR5
	LAC ADR6
	XOR TEMP
	DAC ADR6
	LAC ADR9
	XOR TEMP
	DAC ADR9
	DAC ADR10
	DAC ADR11
	DAC ADR13
	DAC ADR17
	LAC ADR12
	XOR TEMP
	DAC ADR12
	LAC ADR14
	XOR TEMP
	DAC ADR14
 

	LAC ADR15
	XOR TEMP
	DAC ADR15
	.EJECT
	LAC ADR19
	XOR TEMP
	DAC ADR19
	DAC	TCAL		/STORE IN .TRAN OF DIRECTORY BLOCK CORE ADDRESSS
	DAC	CAD1
	TAD	(237		/PUT POSITION-1 OF SYS FILE ENTRYS IN 
	DAC*	(10		/10
	LAC ADR18
	XOR TEMP
	DAC ADR18
	LAC ADR20
	XOR TEMP
	DAC ADR20
	LAC ADR21
	XOR TEMP
	DAC ADR21
	DAC	FSAD
	LAC ADR22
	XOR TEMP
	DAC ADR22
	LAC ADR23
	XOR TEMP
	DAC ADR23
	LAC ADR24
	XOR TEMP
	DAC ADR24
	LAC ADR26
	XOR TEMP
	DAC ADR26
	LAC ADR27
	XOR TEMP
	DAC ADR27
	LAC	ADR30
	XOR	TEMP
	DAC	ADR30
	LAC	ADR32
	XOR	TEMP
	DAC	ADR32
	LAC	ADR33
	XOR	TEMP
	DAC	ADR33
	LAC	ADR34
	XOR	TEMP
	DAC	ADR34
	LAC	ADR101
	XOR	TEMP
	DAC	ADR101
	LAC	ADR100
	XOR	TEMP
	DAC	ADR100
	.EJECT
	CAL	764		/INIT. -14 FOR BUFFER SIZE
	1
ADR35	XX
	0
	LAC	.-1
	SAD	(376
	LAC	(377
	CMA
	DAC	BUFSZB		/2'S COMP. OF BUFFER SIZE
	CMA
	TAD	(1
	DAC	BUFSIZ		/BUFFER SIZE
	-14&777+3000		/.FSTAT -14
	2
FSAD	XX
	LAC	.-1
	AND	(700000	/STRIP OFF FILE STRUCTURE BITS
	SAD	(100000		/DT
	JMP	DTAPE
	SAD	(200000		/DK
	JMP	DECDSK		/DECKDISK
	SAD	(300000		/DP
	JMP	DSKPAK			/DISKPACK
	SAD (500000	/DC
	JMP DECDSK	/DISK CARTRIDGE. SAME AS DECDSK
NFOR	LAC	(NFOR1
	XOR	TEMP
	DAC	NFOR2
	CAL	2775		/.WRITE -3
	11
NFOR2	XX
	0
	.WAIT	-3
	.EXIT
NFOR1	32000
	0
	.ASCII	'.DAT-14 NOT PATCHABLE'<15>
	.EJECT
DSKPAK	LAC	(47040		/MFD FIRST BLOCK
	SKP
DECDSK	LAC	(1777		/MFD FIRST BLOCK
	DAC	BNO1
/					REMOVE ADSS STARTUP FOR DECTAPE (BR-019)
	764			/.TRAN IN MFD
	13
BNO1	XX			/BLOCK #
CAD1	XX			/CORE ADDRESS
	-400
	LAC*	(.SCOM+42		/LOGGED IN MIC?
	SMA
	JMP	NFOR		/NO MAY NOT PATCH
	LAC	(1000
	DAC	SYSIZE		/SYSBLK 2 BLOCKS
	LAC	(2
	DAC	SYBLOK+1
	.WAIT	-14
	LAC	BUFFER+2
	SAD	(-1
	JMP	BEGRET		/NO SYSBLK
	JMP	IN2A
DTAPE	764		/TRAN IN -14 DIRECTORY BLOCK
	13
	100		/BLOCK 100
TCAL	0		/CORE ADDRESS
	-400		/400 WORDS
	LAC	(400		/SYSBLK 1 BLOCK FOR DECTAPE
	DAC	SYSIZE
	LAC	(1
	DAC	SYBLOK+1
	.WAIT	-14		/WAIT FOR COMPLETION
	.EJECT
LOP1	CLL
	LAC*	10		/FETCH FIRST WORD OF SYS FILE ENTRY
	SAD	SYSASI		/IS IT SYS
	SKP			/YES
	STL			/NO SET LINK
	LAC*	10		/FETCH SECOND WORD OF SYS FILE ENTRY
	SAD	SYSASI+1		/IS IT BLK?
	SKP			/YES
	STL			/NO SET LINK
	LAC*	10		/FETCH THIRD WORD OF SYS FILE ENTRY
	SAD	SYSASI		/IS IT SYS?
	SKP			/YES
	STL			/NO SET LINK
	LAC*	10		/FETCH BLOCK #
	SNL			/IS THIS SYSBLK?
	JMP	IN2A		/YES
	ISZ	CON		/NO TRY AGAIN?
	JMP	LOP1	/YES
	JMP	BEGRET		/NO START UP WITHOUT SYSBLK(REGULAR DATA TAPE)
IN2A	AND	(377777	/AND OFF SIGN BIT
	DAC	SYBLO1		/STORE IT APPROPRIATELY
	DAC	BLKNUM
	DAC	SYBLOK
	LAC*	(.SCOM		/IS THIS BACKGROUND FOREGROUND?
	AND	(17777
	DAC	MAXSZ
/					REMOVE B/F CHECK (BR-019)
	JMP	BEGIN1
SYSASI	.SIXBT	'SYSBLK'
CON2	61			/ADVANCED MONITOR SYSBLK BLOCK #
CON	-30			/# OF SYS FILES IN TAPE
CON1	20000			/TO MAKE DAC* DAC
	.EJECT
	.LOC	CONTB2
	.LTORG
LASTAD=CMDBUF+144	/THIS ADDRESS SHOULD BE 17637
 
	.END
