	.TITLE *** AN OCTAL DEBUGGER FOR RSX ***
/
/ COPYRIGHT (C) 1976
/ DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
/
/ THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY
/ ON A SINGLE COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH
/ THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS
/ SOFTWARE, OR ANY OTHER COPIES THEREOF, MAY NOT BE PRO-
/ VIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON
/ EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO
/ THESE LICENSE TERMS.  TITLE TO AND OWNERSHIP OF THE
/ SOFTWARE SHALL AT ALL TIMES REMAIN IN DEC.
/
/ THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE
/ WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COM-
/ MITMENT BY DIGITAL EQUIPMENT CORPORATION.
/
/ DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY
/ OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY
/ DEC.
/
	.EJECT
/
/
/ EDIT #13      DEC. 31, 1975      M. HEBENSTREIT
/ EDIT #14	APR. 28, 1976	   M .HEBENSTREIT (MA CHANGES)
/ EDIT #15	MAY  6,1976	   M. HEBENSTREIT (MISC BUGS)
/ EDIT #16	MAY  7,1976	   M. HEBENSTREIT
/ 017	13-JUL-76 (RCHM)	BUG IN PICKING UP THE CURRENT USER NUMBER.
/
/ THIS PROGRAM IS AN ODT FOR RSX 
/
/ THE NAME OF THIS TASK IS ARBITRARY.  THERE CAN BE MULTIPLE
/ COPIES OF IT IN CORE SIMULTANEOUSLY, PROVIDED THAT EACH
/ COPY HAS A UNIQUE NAME AND PARTITION, AND EACH ACCESSES
/ DIFFERENT LUNS.  THROUGHOUT THE DESCRIPTION OF THIS TASK
/ IT WILL BE REFERRED TO AS RSXODT.
/
/	THE COMMANDS HONORED BY THIS PROGRAM ARE:
/
/			OPEN A MEMORY LOCATION OR REGISTER
/			START THE PROGRAM TO BE DEBUGGED
/			EXIT AND ABORT THE TASK
/			DEFINE A SYMBOL
/			SET A BREAKPOINT AT SOME LOCATION
/			REMOVE A BREAKPOINT
/			CONTINUE AFTER A BREAKPOINT HAS BEEN REACHED
/			RESTART THE TASK AT SOME LOCATION
/			RELOAD THE TASK KEEPING SYMBOL DEFS AND BRKPTS
/
/			IF THE ASSEMBLY PARAMETER ONEPLS IS DEFINED THE
/			FOLLOWING COMMANDS ARE ALSO HONORED:
/
/			DUMP THE TASK'S PARTITION INTO A CREATED FILE
/			DECODE THE LOCATIONS PRINTED BY OPEN
/			REGISTERS PRINTS THE AC,MQ,LR,XR, AND LINK
/
/	THE SYNTAX OF THESE COMMANDS AND THEIR RESTRICTIONS CAN BE FOUND
/	AT THE BEGINNING OF THE APPROPRIATE SECTION OF CODE.
/
/	TO USE RSXODT, INSTALL IT UNDER A NAME CONSISTANT WITH
/	TDV FUCNTION NAMING CONVENTIONS (E.G. ODT... OR XXX...),
/	THEN CONSTRUCT THE TASK TO BE DEBUGGED. TO BEGIN A DEBUGGING
/	SESSION TYPE:  TDV>ODT TSKNAM (LUN)  WHERE TSKNAM IS THE
/	TASK NAME CORRESPONDING TO THE NAME OF THE CONSTRUCTED FILE
/	IN WHICH THE TASK IMAGE RESIDES. LUN IS AN OPTIONAL, DECIMAL
/	LUN ON WHICH THE CONSTRUCTED FILE CAN BE FOUND.
/
/	RSXODT WILL ALWAYS RUN AS AN EXEC MODE TASK IN A PARTITION
/	DISTINCT FROM THAT OF THE TASK TO BE DEBUGGED.
/
/
	.TITLE *** EXPLANATION OF BREAKPOINT HANDLING ***
/
/		WHEN THE 1ST BREAK POINT IS SET, ODT SETS UP A BREAK POINT
/		TRAP TABLE AS FOLLOWS:
/
/			WORD0	XX
/			WORD1	JMS	.+1
/			WORD2	0
/			WORD3	JMP	.
/
/		THIS TABLE IS POSITIONED IN WORDS 0-3 OF THE TASK'S PAR-
/		TITION. ONCE THIS TABLE IS SET UP FOR THE 1ST BREAK POINT
/		THE PROCESS OF SETTING BREAK POINTS PROCEEDS AS FOLLOWS.
/		THE ADDRESS OF THE BREAKPOINT IS SAVED IN THE BREAKPOINT
/		ADDRESS TABLE. (THE ADDRESSES ARE RELATIVE TO THE PARTITIONS BASE.)
/		THE CONTENTS OF THE BREAK POINT LOCATION IS SAVED IN THE 
/		BREAK POINT INSTRUCTION TABLE. THEN THE CONTENTS OF THE
/		BREAK POINT IS CHANGED TO AN XCT* X17 INSTRUCTION.
/		FINALLY X17 IS SET TO POINT TO WORD0 OF THE BREAK POINT
/		TRAP TABLE. WHEN THE TASK REACHES THE BREAK POINT IT EXECUTES
/		THE JMS .+1 INSTRUCTION IN THE BREAK POINT TRAP TABLE.
/		SINCE THE XCT* X17 INSTRUCTION DOES NOT CHANGE THE PC,
/		THE ADDRESS OF THE BREAK POINT CAN BE DETERMINED FROM THE
/		SUBROUTINE HEADER WORD IN THE BREAK POINT TRAP TABLE.
/		THE TASK THEN HANGS IN AN INFINITE LOOP AT THE JMP .
/		INSTRUCTION IN THE BREAK POINT TRAP TABLE. THE MONITOR
/		ROUTINE IN ODT CHECKS PERIODICALLY TO SEE IF THE TASK HAS
/		GOTTEN A CHANCE TO RUN AND IF IT IS HUNG UP AT THE JMP .
/		INSTRUCTION. IF BOTH THESE CONDITIONS ARE MET THEN THE
/		MONITOR ROUTINE SETS THE TASK'S STATUS TO 10 SO LOW
/		PRIORITY TASKS WILL GET A CHANCE TO RUN. THEN ODT
/		INFORMS THE USER THAT THE TASK IS AT SOME SPECIFIED BREAK
/		POINT. IF BOTH CONDITIONS ARE NOT MET, ODT ASSUMES THE TASK
/		IS STILL RUNNING AND CONTINUES TO PERIODICALLY CHECK ON
/		THE STATUS OF THE TASK.IF, AFTER A BREAK POINT IS REACHED,
/		THE USER INDICATES THAT THE TASK SHOULD CONTINUE, ODT PROCEEDS
/		AS FOLLOWS. THE FORMER CONTENTS OF THE LOCATION OF THE
/		BREAK POINT IS ENTERED INTO WORD0 OF THE BREAK POINT TRAP
/		TABLE. THEN WORD 17 (X17) OF THE PARTITION IS SET TO POINT
/		TO LOCATION WORD0-1. THE RESTART ADDRESS IN THE TASK'S PBDL
/		NODE  IS SET SO THE NEXT INSTRUCTION THE TASK WILL EXECUTE
/		IS THE XCT* X17 INSTRUCTION AT THE BREAK POINT LOCATION.
/		FINALLY ODT CHANGES THE TASK'S STATUS FROM 10 TO 5. AT THIS
/		TIME THE TASK CAN CONTINUE AS FOLLOWS. WHEN ITS REGISTERS
/		ARE RESTORED, THE TASK EXECUTES THE XCT* X17 INSTRUCTION
/		CAUSING THE INITIAL CONTENTS OF THE BREAK POINT LOCATION
/		TO BE EXECUTED. AFTERWARDS THE TASK CAN PROCEED NORMAL-
/		LY UNTIL ANOTHER BREAK POINT IS REACHED OR THE TASK EXITS.
/		
/		THE FOLLOWING RESTRICITONS APPLY TO TASKS TO BE DEBUGGED
/		WITH THIS ODT:
/
/		1.) NO TASK CAN MODIFY THE CONTENTS OF VIRTUAL LOC. 17
/		2.) NO TASK CAN MODIFY THE CODE AT A BREAK POINT
/		3.) NO TASK CAN MODIFY VIRTUAL LOCS. 0-3
/		4.) NO TASK SHOULD HAVE OVERLAYS
/		5.) A BREAK POINT CANNOT BE SET ON AN XCT INSTRUCTION
/		6.) ONLY NORMAL MODE TASKS CAN BE DEBUGGED WITH THIS PROGRAM
/
/		NOTE: BECAUSE THE AUTOINCREMENT REGISTERS FOR NORMAL MODE
/		TASKS ARE LOCATED IN WORDS 10-17 OF THE TASK'S PARTITION,
/		THESE REGISTERS ARE NEVER DESTROYED WHEN THE TASK ISSUES
/		A CAL. HENCE, RSXODT CAN USE X17 FOR BREAKPOINT HANDLING.
/		THIS IS NOT TRUE FOR EXEC MODE TASKS!
/
/		NOTE: A TASK WITH OVERLAYS CAN BE DEBUGGED WITH RSXODT
/		PROVIDED THAT NO BREAKPOINTS ARE SET WITHIN AN OVERLAY.
/		BREAKPOINTS SHOULD ONLY BE SET WITHIN RESIDENT CODE.
/
	.TITLE *** ODT CONSTANTS AND IOT'S ***
/
/ *** ODT CONSTANTS AND IOTS
/
	.IFUND ONEPLS
NO.CMD=11		/NUMBER OF COMMANDS HONORED
	.ENDC
	.IFDEF ONEPLS
NO.CMD=14
	.ENDC
	.IFUND SYMSIZ
SYMSIZ=20		/SYMBOL TABLE SIZE
	.ENDC
	.IFUND BRKSIZ
BRKSIZ=10		/BREAK POINT TABLE SIZE
	.ENDC
REGSIZ=14
	.IFUND LUN
	.DEC
LUN=12			/ODT I/0 LUN
	.OCT
	.ENDC
	.IFUND FILLUN
	.DEC
FILLUN=15		/ODT CREATED FILE LUN (MUST BE A DISK)
	.OCT
	.ENDC
	.IFUND	DEFLUN
	.DEC
DEFLUN=14		/DEFAULT LUN FOR ACCESSING CONSTRUCTED FILE
	.OCT
	.ENDC
	.IFUND	TIME
TIME=10			/NUMBER OF TIMES MONITOR ROUTINE SHOULD MARK TIME
			/BEFORE ASKING IF THE TASK SHOULD BE ABORTED.
			/EACH MARK TIME REQUEST SUSPENDS RSXODT FOR 1 SEC.
	.ENDC
	.IFUND	DFPRIO
	.DEC
DFPRIO=280		/USER TASKS RUN PRIORITY
	.OCT
	.ENDC
	.EJECT
ATL=244			/LISTHEAD FOR THE ATL
STL=242			/LISTHEAD FOR THE STL
P.PBDL=250		/LISTHEAD FOR THE PBDL
SNAM=123		/ADDRESS OF FIND A NAME REENTRANT SUBROUTINE
R1=101			/REENTRANT REGISTER 1
R2=102			/REENTRANT REGISTER 2
CURTSK=135		/POINTER TO ATL NODE OF CURRENT TASK
X10=10			/AUTOINCREMENT REGISTER 10
X11=11			/AUTOINCREMENT REGISTER 11
X12=12			/AUTOINCREMENT REGISTER 12
X13=13			/AUTOINCREMENT REGISTER 13
X14=14			/AUTOINCREMENT REGISTER 14
X15=15			/AUTOINCREMENT REGISTER 15
X16=16			/AUTOINCREMENT REGISTER 16
X17=17			/AUTOINCREMENT REGISTER 17
P.TDV=240426		/'TDV' IN SIXBIT
P.NAME=2
P.MINS=1
P.LVL5=400004		/AC CONTENTS TO RAISE TO API LEVEL 5
NEG=400000
ADRMSK=077777
CMANEG=377777
REMADR=700000
SHAL=660000		/MOVE AC0 TO LINK WITH EAE
MA.UCA=221		/BASE OF 1ST UCA
MA.UN=223		/ ADDRESS OF THE CURRENT USER NUMBER.	/(017)
P.N1=2			/OFFSET TO PART NAME (1ST HALF)
P.N2=3			/OFFSET TO PART NAME (2ND HALF)
P.BA=4			/OFFSET TO PART BASE
P.SZ=5			/OFFSET TO PART SIZE
P.TS=6			/OFFSET TO TASK SIZE IN PART BLOCK
P.IC=14			/OFFSET TO INTERRUPT CONNECT LOC
P.AC=17			/OFFSET TO AC BUFFER
P.XR=20			/OFFSET TO XR BUFFER
P.LR=21			/OFFSET TO LR BUFFER
P.MQ=22			/OFFSET TO MQ BUFFER
P.TC=47			/OFFSET TO TASK USE COUNT
.INH=705522		/INHIBIT INTERRUPTS IOT
.ENB=705521		/ENABLE INTERRUPTS IOT
IDX=ISZ			/USED IF INTENT IS TO INCREMENT BUT NOT TO SKP
	.EJECT
/
/ MACRO WHICH DEFINES SYSTEM TASK LIST ENTRIES
/ THIS ALSO DEFINES ALL BITS FOR EACH FLAG WORD.
/
	.DEFIN STLOFF
S.FP=0			/FORWARD LINKAGE.
S.BP=1				/BACKWARD LINKAGE.
S.N1=2				/TASK NAME
S.N2=3				/TASK NAME
S.DP=4				/FLAGS AND DEFAULT PRIORITY.
S.PB=5				/PARTITION BLOCK ADDRESS
S.DA=6				/DISK ADDRESS AND UNIT.
S.DB=7				/RESIDENT CODE LENGTH (DISK TRANSFER)
S.TS=10				/TASK SIZE.
S.EP=11				/TASK ENTRY POINT.
/
/ DEFINE S.DP BIT EXTRACTION MASKS.
/
S.ETA=400000			/EXTRACT TASK ACTIVE
S.EROX=200000			/EXTRACT REMOVE ON EXIT.
S.ETDI=100000			/EXTRACT TASK DISABLED.
S.EFIX=40000			/EXTRACT TASK FIXED IN CORE.
S.EPLC=20000			/EXTRACT PARTITION LOST IN RECONFIG.
S.ERCP=10000			/EXTRACT RECONFIGURATION IN PROGRESS.
S.ETEX=4000			/EXTRACT TASK HAS EXITTED.
S.EDP=1777			/EXTRACT DEFAULT PRIORITY.
/
/ DEFINE S.TS BIT EXTRACTION MASKS.
/
S.ETS=777400			/EXTRACT TASK SIZE.
S.ERD=200			/EXTRACT RELOCATE DISABLE.
S.EXM=140			/EXTRACT XVM MODE.
S.EIOT=20			/EXTRACT IOT PERMISSION.
/
/ DEFINE S.EP BIT EXTRACTION MASKS.
/
S.ELC=400000			/EXTRACT LINK CONTENTS.
S.EPB=200000			/EXTRACT PAGE/BANK INDICATOR.
S.EEN=100000			/EXTRACT EXEC/NORMAL MODE.
S.EEP=77777			/EXTRACT ENTRY POINT ADDRESS.
	.DEFIN STLOFF
	.ENDM
	.ENDM
	.EJECT
	STLOFF
	.EJECT
/
/ MACRO WHICH DEFINES ACTIVE TASK LIST ENTRIES
/ THIS ALSO DEFINES ALL BITS FOR EACH FLAG WORD.
/
	.DEFIN ATLOFF
A.FP=0				/FORWARD LINKAGE
A.BP=1				/BACKWARD LINKAGE
A.N1=2				/TASK NAME
A.N2=3				/TASK NAME
A.TP=4				/TASK PRIORITY
A.PB=5				/PARTITION BLOCK ADDRESS
A.SN=6				/STL NODE ADDRESS
A.TS=7				/FLAGS AND TASK STATUS.
A.RA=10				/START OR RESUMPTION ADDRESS.
A.EV=11				/EVENT VARIABLE ADDRESS
				/TASK IS LOADING OR IN 'WAITFOR'
/
/ DEFINE A.TS BIT EXTRACTION MASKS.
/
A.ETLF=400000			/EXTRACT TASK LOADING FLAG.
A.ETNR=400			/EXTRACT TASK NOT TO BE RESCHEDULED.
A.EDRP=200			/EXTRACT TASK IS DISK RESIDENT AND
				/NEEDS PARTITION.
A.EPSD=100			/EXTRACT PARTITION IS AVAILABLE, SETUP
				/DISK READ REQUEST.
A.EWEV=40			/EXTRACT WAITING FOR EVENT VARIABLE.
A.ERSR=20			/EXTRACT TASK READY FOR STARTING OR
				/RESUMPTION.
A.ERXR=10			/TASK ACTIVE, IF INTERRUPTED RESTORE
				/REGISTERS.
A.ESS=4				/EXTRACT TASK HAS SELF SUSPENDED.
A.ETSS=2			/TASK STOPPED FOR TIME SLICING.
/
/ DEFINE A.RA BIT EXTRACTION MASKS.
/
A.ELC=400000			/EXTRACT LINK CONTENTS.
A.EPB=200000			/EXTRACT PAGE/BANK INDICATOR.
A.EEN=100000			/EXTRACT EXEC/NORMAL MODE.
A.ERA=77777			/EXTRACT RESUMPTION ADDRESS.
	.DEFIN ALTOFF
	.ENDM
	.ENDM
	.EJECT
	ATLOFF
	.EJECT
/
/ MACRO TO DEFINE OFFSETS INTO THE USER CONTEXT AREA.
/
	.DEFIN UCAOFF
U.JSW=0				/OFFSET TO JOB STATUS WORD.
U.MAEV=1			/OFFSET TO EVENT VARIABLE
U.MAMTE=2			/OFFSET TO MARK TIME EVENT VARIABLE.
U.OEV=3				/OFFSET TO OVERLAY EVENT VARIABLE.
U.DSK=4				/OFFSET TO DISK NAME
U.DUN=5				/OFFSET TO DISK UNIT NUMBER
U.UFD=6				/OFFSET TO UFD NAME.
U.CTSK=7			/OFFSET TO CURRENT TASK NAME
U.PSC=11			/OFFSET TO PARTITION SELECTION CRITERIA.
U.ULOF=14			/OFFSET TO USER NUMBER AND LUN OFFSET.
U.TTYN=15			/OFFSET TO USER TERMINAL NUMBER.
U.TB=16				/OFFSET TO USER TERMINAL BUFFER.
U.CPB=62			/OFFSET TO MULTI-ACCESS CPB.
U.SSM=74			/SECONDS SINCE MIDNIGHT INTO STATE 11
				/ OR 12 (HUNG ON PARTITION)
U.TW=75				/TOTAL TIME IN SECONDS SPENT IN STATE 11
				/ OR 12.
U.OVID=76			/OVERLAY IDENTIFIER (LAST OVERLAY CALLED)
U.CKS=77			/CHECKSUM OF INPUT BUFFER FOR TIMED READ.
U.LEN=100			/LENGTH OF UCA.
	.DEFIN UCAOFF
	.ENDM
	.ENDM
	.EJECT
	UCAOFF
	.TITLE *** ODT INITIALIZATION ***
/
/ *** ODT INITIALIZATION
/
/
/ GET THE XR ADJUSTMENT FACTOR
/
BEGIN	LAC	(BEGIN		/GET THIS ADDRESS
	AND	(70000		/SAVE ONLY THE HIGH BITS
	TCA			/NEGATE
	DAC	XRADJ		/STORE THE XR ADJUSTMENT FACTOR
/
/ GET THE NAME OF THIS TASK
/
	CAL	TSKNAM		/ISSUE THE TASK NAME DIRECTIVE
	LAC	TSKNAM+3	/GET 2ND HALF OF THIS TASK NAME
	AND	(7777		/MAKE USER TASK RUN UNDER THE NAME 'USR NN'
	XOR	(NEG		/SO IT CAN'T BE REMOVED FROM MCR OR TDV
	DAC	FINUT2		/SAVE IN 2ND 1/2 OF USER TASK NAME
	LAC* (MA.UN		/ FETCH THE USER NUMBER OF	/(017)
				/ ODT.				/(017)
	AAC	-1		/ADJUST TO GET UCA NUMBER
	MUL			/CALCULATE BASE ADDRESS OF UCA
	U.LEN			/MULTIPLY BY WORDS PER UCA
	LACQ			/GET RESULT
	TAD*	(MA.UCA		/ADD BASE OF 1ST UCA
	DAC	UCADDR		/SAVE BASE OF UCA
/
/ PRINT THE ODT HEADER
/
LOCB	JMS	ATTACH		/ATTACH THE OUTPUT DEVICE
	LAC	(MSGBL		/PRINT A BLANK LINE
	JMS	PRINT
	LAC	(MSGHDR		/PRINT THE HEADER
	JMS	PRINT
	JMS	DETACH		/DETACH TERMINAL
/
/ GET THE TASK NAME AND LUN IF PRESENT
/
	CAL	XFRCMD		/MOVE TDV COMMAND BUFFER INTO ODT
	LAC	EV		/ANY ERRORS?
	SPA
	JMP	ERRTDV		/YES -- TELL USER
	JMS	IFAC		/NO -- PREPARE TO CHECK SYNTAX
	INBUFF			/INPUT BUFFER ADDR
LOCB1	JMS	FAC57		/READ A CHAR -- LOOK FOR 1ST SPACE
	SAD	(40		/IS CHAR A SPACE?
	JMP	LOCB2		/YES
	JMS	CR		/NO -- IS IT A LINE TERM?
	JMP	LOCB1		/NO -- LOOK AT NEXT CHAR
	JMP	ERRNAM		/YES -- NO NAME GIVEN, ERROR
LOCB2	JMS	FAC57		/NOW LOOK FOR 1ST NON-SPACE
	SAD	(40		/IS CHAR A SPACE?
	JMP	LOCB2		/YES -- READ ANOTHER CHAR
	JMS	CR		/NO -- IS CHAR A LINE TERM?
	SKP
	JMP	ERRNAM		/YES -- ERROR, NO NAME GIVEN
	JMS	GETNAM		/NO -- GET TASK NAME
	FINAM1			/BUFFER FOR TASK/FILE NAME
	JMP	ERRNAM		/RETURN HERE ON NAME ERROR
	JMS	CR		/RETURN HERE IF OK -- WAS BREAK A TERM?
	SKP			/NO -- GO SEE IF A LUN IS GIVEN
	JMP	LOCB3		/YES -- USE DEFAULT LUN
	SAD	(40		/WAS BREAK A SPACE?
	SKP			/YES -- PROCEED
	JMP	ERRNAM		/NO -- ERROR
LOCB4	JMS	FAC57		/GET NEXT CHAR
	JMS	CR		/IS IT A TERM?
	SKP			/NO --
	JMP	LOCB3		/YES -- USE DEFAULT LUN
	SAD	(40		/IS IT ANOTHER SPACE?
	JMP	LOCB4		/YES -- READ NEXT CHAR
	JMS	GDNUM		/NO -- GO GET LUN
	JMP	ERRNAM		/RETURN HERE ON ERRORS
	SKP			/RETURN HERE IF OK WITH NUMBER IN AC
LOCB3	LAC	(DEFLUN		/USE DEFAULT FININS LUN
	XOR	(600000		/SET ALIAS AND MA FININS BITS
	DAC	FINLUN		/SAVE IN FININS (XQT) CPB
/
/ SET UP CPBS WITH THE TASK/FILE NAMES
/
	LAC	FINUT1		/SET UP THE REQUIRED CPB'S - GET TASK NAME
	DAC	UNFIX+2		/SAVE 1ST 1/2 OF TASK NAME IN UNFIX CPB
	DAC	REQTSK+2	/SAVE THIS IN REQUEST CPB
	DAC	NAME1		/SAVE IN FIX CPB
	.IFDEF ONEPLS
	LAC	FINAM1		/ENTER FILE NAME INTO CPBS
	DAC	CRECTA+0	/SAVE 1ST 1/2 OF NAME IN CREATE CONTROL TABLE
	DAC	DELETE+3	/AND IN DELETE CPB
	.ENDC
	LAC	FINUT2		/GET 2ND 1/2 OF TASK NAME
	DAC	UNFIX+3		/SAVE THIS IN UNFIX CPB
	DAC	REQTSK+3	/AND IN REQUEST CPB
	DAC	NAME2		/AND INTO FIX CPB
	.IFDEF ONEPLS
	LAC	FINAM2		/ENTER 2ND 1/2 OF FILE NAME
	DAC	CRECTA+1	/SAVE 2ND 1/2 OF NAME IN CREATE CONTROL TABLE
	DAC	DELETE+4	/AND IN DELETE CPB
	.ENDC
/
/ GET TASK INTO STL IF POSSIBLE VIA FININS
/
	DZM	FINEV		/ZERO ABSOLUTE EV FOR FININS
	CAL	FINS		/ISSUE XQT DIRECTIVE
	LAC	EV		/WAS REQUEST QUEUED TO FININS PROPERLY?
	SPA
	JMP	ERRFIN		/NO -- ERROR
	CAL	WFFIN		/YES -- WAIT FOR FININS TO DO ITS THING
	LAC	FINEV		/GET THE ABSOLUTE EV
	SPA			/DID FININS PERFORM ITS TASK?
	JMP	ERRFIN		/NO -- ERROR
				/YES -- TASK HAS NOW GOT AN STL NODE!
				/STL ADDRESS IS NOW IN AC.
/
/ INITIALIZE VARIOUS DATA ITEMS FOR THIS TASK
/
	DAC	STLADR		/SAVE TASKS STL NODE ADDR
	JMS	P.FIT		/PLACE TASK IN A PARTITION
	SPA			/ANY ERRORS?
	JMP	ERRBSY		/YES -- CAN'T GET A PARTITION
	SZL			/NO -- WAS TASK EXEC MODE?
	JMP	ERREXM		/YES -- ERROR
	LAC	STLADR		/NO -- GET STL ADDR
	JMS	SETXR		/PREPARE TO ACCESS STL NODE
	LAC	S.PB,X		/ GET THE PBDL NODE ADDR.
	DAC	PBADR		/SAVE IT
	JMS	SETXR		/PREPARE TO ACCESS PBDL NODE
	LAC	P.BA,X		/GET BASE OF PARTITION
	DAC	PBASE		/SAVE IT
	DBK			/DROP TO API LEVEL 7 (FROM API 5)
	CAL	FIX		/FIX THE TASK IN CORE
	LAC	EV		/ANY ERROS?
	SPA
	JMP	ERRFIX		/YES -- TELL USER ABOUT ERROR
				/NO --
	.TITLE *** ODT COMMAND DISPATCH ROUTINE ***
/
/ *** GET AND DISPATCH A COMMAND
/
LOC0	JMS	ATTACH		/ATTACH THE I/O DEVICE
	DZM	CMD		/ZERO THE COMMAND WORDS
	DZM	CMD+1
	LAC	(MSGQUE		/PRINT THE COMMAND PROMPTER
	JMS	PRINT
	JMS	READ		/READ A LINE
	JMS	IFAC		/INIT. FAC VARIABLES
	INBUFF			/BUFFER ADDRESS
	CLA			/CLEAR AC TO DENOTE NO CHAR THERE
	JMS	GETNAM		/STORE THE COMMAND
	CMD			/COMMAND BUFFER
	JMP	ERRCMD		/RETURN HERE ON ERROR
LOC5	SAD	(40		/RETURN HERE IF OK -- IS BREAK CHAR A SPACE?
	JMP	LOC4		/YES
	SAD	(15		/NO -- A CR?
	JMP	LOC4		/YES
	SAD	(175		/NO -- ALTMODE?
	JMP	LOC4		/YES
	JMS	FAC57		/NO -- READ ANOTHER CHAR 
	JMP	LOC5		/GO SEE IF IT'S A BREAK CHAR
LOC4	DAC	TERM		/YES -- SAVE THE COMMAND TERMINATOR
	LAC	(CMDTBL-1	/SET UP TO SCAN LEGAL COMMAND TABLE
	DAC*	(X10		/INIT. X10 TO POINT TO COMMAND TABLE
	LAW	-NO.CMD		/SET UP A COMMAND COUNTER (-# CMD'S)
	DAC	TEMP		/SAVE COUNTER IN TEMP
	LAC	CMD		/GET THE SIXBT REP. FOR THIS COMMAND
LOC1	SAD*	X10		/DOES THE COMMAND MATCH TABLE ENTRY?
	JMP	LOC2		/YES -- PREPARE TO DISPATCH
	ISZ	TEMP		/NO -- ARE WE AT THE END OF THE TABLE?
	JMP	LOC1		/NO -- GO CONSIDER NEXT TABLE ENTRY
	JMP	ERRCMD		/YES -- ERROR - ILLEGAL COMMAND
/
/ *** COMMAND TRANSFER ROUTINE
/
LOC2	LAC	TEMP		/GET COMMAND COUNT INTO AC (<0)
	AAC	NO.CMD+1	/ADD DISPATCH TABLE OFFSET (# CMD'S +1)
	TAD	(JMP	LOC3	/ADD "JMP LOC3" INSTRUCTION
	DAC	LOC3		/SAVE RESULT IN NEXT LOCATION
LOC3	XX			/THIS INSTRUCTION IS MODIFIED TO JMP .+N
/
/ COMMAND DISPATCH VECTOR
/
	JMP	START
	JMP	OPEN
	JMP	SET
	JMP	CONTIN
	JMP	REMOVE
	JMP	DEFINE
	JMP	EXIT
	JMP	RESTAR
	JMP	RELOAD
	.IFDEF ONEPLS
	JMP	DUMP
	JMP	DECODE
	JMP	REGIST
	.ENDC
	.TITLE *** ODT START COMMAND ***
/
/ START COMMAND -- FORMAT: >STA(RT)
/
/			THIS COMMAND CAN BE USED ONLY IF THE TASK
/			HAS NOT ALREADY BEEN STARTED.
/
START	LAC	STFLAG		/HAS THE TASK ALREADY BEEN STARTED?
	SZA
	JMP	ERRST		/YES -- ERROR
	CLA!IAC			/NO -- SET THE 'STARTED' FLAG
	DAC	STFLAG
	LAC	UCADDR		/PREPARE TO ACCESS UCA
	JMS	SETXR		/SETUP XR TO DO SO
	LAC	U.ULOF,X	/GET LUN OFFSET AND USER NUMBER
	AND	(777000		/KEEP ONLY LUN OFFSET
	DAC	LUNOFF		/ENTER INTO CPB FOR LUN MAPPING
	CAL	REQTSK		/REQUEST THE TASK
	LAC	EV		/PICK UP EV
	SPA			/WHERE THERE ANY ERRORS?
	JMP	ERRREQ		/YES
	JMS	DETACH		/NO -- DETACH THE DEVICE
	JMP	MONITOR		/GO MONITOR THE TASK'S PROGRESS
	.TITLE *** ODT DEFINE A SYMBOLIC ADDRESS COMMAND ***
/
/ DEFINE COMMAND -- FORMAT: >DEF(INE) XXX=NNNNNN
/
/			WHERE XXX IS A 1-3 CHARACTER SYMBOL AND
/			NNNNNN IS ANY OCTAL NUMBER. AFTER THE
/			FIRST THREE CHARACTERS OF A SYMBOL THE
/			SUBSEQUENT CHARACTERS ARE IGNORED.
/
/			NOTE: UNLIKE OTHER COMMANDS NNNNNN CANNOT BE A SYMBOL
/
/			THIS COMMAND IS LEGAL ANYTIME.
/
DEFINE	CLA			/CLEAR AC TO DENOTE THERE'S NO CHAR THERE
	JMS	GETNAM		/GET THE SYMBOL
	SYMBOL			/SYMBOL BUFFER ADDRESS
	JMP	ERRNUM		/RETURN HERE ON ERROR
DEF2	SAD	(75		/RETURN HERE IF OK -- IS BREAK CHAR AN = ?
	SKP
	JMP	ERRNUM		/NO -- ERROR
	CLA			/YES -- CLEAR AC TO DENOTE NO CHAR THERE
	JMS	GETNUM		/GET THE VALUE
	JMP	ERRNUM		/RETURN HERE ON AN ERROR
	DAC	TEMP		/RETURN HERE IF OK -- SAVE NUMBER
	LACQ			/CHECK THE LINE TERM -- RETRIEVE FROM MQ
	JMS	CR		/GO CHECK IT
	JMP	ERRNUM		/IT'S NOT A CR OR ALT -- ERROR
	LAW	-SYMSIZ		/CHAR IS TERM -- SCAN THE SYMBOL TABLE FOR THIS SYMBOL
	DAC	TEMP1		/SET TEMP1 TO BE COUNTER OF SYMBOL TAB ENTRIES
	LAC	(SYMTAB-1	/SET UP X10 TO POINT TO SYMBOL TAB
	DAC*	(X10
	LAC	SYMBOL		/GET THE SYMBOL NAME INTO AC
DEF3	SAD*	X10		/DOES THIS SYMBOL MATCH THE ONE ALREADY IN TAB.?
	JMP	DEF4		/YES
	ISZ	TEMP1		/NO -- END OF TABLE?
	JMP	DEF3		/NO -- LOOK AT NEXT TABLE ENTRY
	JMP	DEF1		/YES -- PREPARE TO ENTER A NEW SYMBOL
/
/ THE NAME OF THIS SYMBOL IS ALREADY IN THE TABLE. REPLACE IT'S OLD VALUE
/
DEF4	LAC*	(X10		/SET A NEW VALUE IN TABLE FOR SYMBOL
	TAD	(SYMSIZ-1	/MAKE X10 POINT TO VALUE TABLE
	DAC*	(X10
	LAC	TEMP		/GET THE NEW VALUE
	DAC*	X10		/SAVE IT IN THE VALUE TABLE
	JMS	DETACH		/DETACH THE I/O DEVICE
	JMP	LOC0		/GO PROCESS A NEW COMMAND
/
/ ENTER A NEW SYMBOL AND VALUE INTO THE TABLES
/
DEF1	ISZ	SYMCNT		/IS THERE ANY MORE ROOM IN SYMBOL TABLE?
	SKP			/YES
	JMP	ERRTAB		/NO -- ERROR
	LAC	TEMP		/SET VALUE INTO VALUE TABLE
	DAC*	VALPTR		/STORE VALUE IN VALUE TABLE
	IDX	VALPTR		/INCREMENT POINTER TO VALUE TABLE
	LAC	SYMBOL		/GET THE SYMBOL NAME
	DAC*	SYMPTR		/STORE IT IN THE SYMBOL TABLE
	IDX	SYMPTR		/INCREMENT POINTER TO SYMBOL TABLE
	JMS	DETACH		/DETACH THE I/O DEVICE
	JMP	LOC0		/GO PROCESS A NEW COMMAND
	.TITLE *** ODT RESTART COMMAND ***
/
/ RESTART COMMAND -- FORMAT: >RES(TAR) NNNNNN
/
/			WHERE NNNNNN IS AN ADDRESS RELATIVE TO THE
/			BASE OF THE TASK'S PARTITION .
/
/			NOTE: NNNNNN COULD BE A SYMBOL 
/
/			THIS COMMAND IS LEGAL ONLY IF THE TASK IS AT A BRKPT
/
RESTAR	LAC	BRKPT		/IS THE TASK AT A BRKPT?
	SNA
	JMP	ERRCON		/NO -- ERROR
	CLA			/YES -- CLEAR AC TO DENOTE NO CHAR THERE
	JMS	GETNUM		/GO GET THE RESTART ADDR
	JMS	GETSYM		/RETURN HERE ON ERROR -- MAYBE SYMBOL
	DAC	TEMP		/SAVE THE ADDRESS
	LACQ			/GET THE LINE TERM FROM MQ
	JMS	CR		/GO CHECK THAT IT'S A CR OR ALT.
	JMP	ERRNUM		/RETURN HERE ON ERROR
	JMS	ADRCHK		/RETURN HERE IF OK -- CHECK THE ADDRESS
	LAC	PBASE		/RESET X17 SO NEXT BREAKPOINT WILL WORK OK
	JMS	SETXR		/SET UP XR TO ACCESS PART. BASE
	DZM	X17,X		/ZERO X17
	JMP	CONT3		/GO ENTER RESTART ADDRESS INTO PBDL
				/AND SET UP TASK STATUS SO TASK CAN RUN
	.TITLE *** ODT RELOAD COMMAND ***
/
/ RELOAD COMMAND -- FORMAT: >REL(OAD)
/
/			THIS COMMAND WILL CAUSE THE TASK TO BE ABORTED
/			AND SUBSEQUENTLY RELOADED WITH BREAKPOINTS.
/			SYMBOL DEFINITIONS WILL BE RETAINED.
/
/			THIS COMMAND IS LEGAL ANYTIME.
/
RELOAD	DZM	STFLAG		/CLEAR THE START FLAG
	DZM	RBPFLG		/CLEAR THE REMOVED BRKPT FLAG
	DZM	BRKPT		/CLEAR THE BREAKPOINT FLAG
	LAC	PBADR		/PREPARE TO ACCESS PBDL NODE
	JMS	SETXR		/SETUP XR TO DO SO
	IDX	P.TC,X		/INCREMENT PART IN USE SO PART WON'T BE LOST
	CAL	UNFIX		/UNFIX THE TASK
	JMS	ATLSCN		/SCAN ATL FOR THE TASK
	JMP	REL3		/RETURN HERE IF NOT FOUND
	JMS	SETXR		/RETURN HERE IF FOUND -- SET UP XR
	LAC	(4		/SET TASK TO STATUS 4
	DAC	A.TS,X
	LAC	(300		/SET RESTART TO 300
	DAC	A.RA,X
/
/ WAIT FOR THE TASK TO ABORT
/
REL2	.ENB			/ENABLE INTERRUPTS
	CAL	MARK		/MARK TIME TO ALLOW TASK TO ABORT
	CAL	WAIT		/WAIT FOR COMPLETION
	JMS	ATLSCN		/SCAN THE ATL TO BE SURE TASK ABORTED
	SKP			/RETURN HERE IF NOT FOUND -- GOOD
	JMP	REL2		/RETURN HERE IF FOUND -- NOT SO GOOD
/
/ RE-INITIALIZE THE TASK COMPLETE WITH BREAK POINTS
/
REL3	LAC	(P.LVL5		/PREPARE TO ENABLE INTERRUPT AND RAISE TO 5
	.ENB			/ENABLE INTERRUPTS (THANK GOD FOR RE-ENTR ECO)
	ISA			/RAISE TO API LEVEL 5
	LAC	PBADR		/PREPARE TO GET AT PBDL NODE
	JMS	SETXR		/SETUP XR TO DO SO
	DZM	P.TC,X		/FREE UP PARTITION
	DBK			/DROP TO API LEVEL 7 (NOTE ECO)
	CAL	FIX		/FIX THE TASK
	LAC	EV		/WERE THERE ANY ERRORS?
	SPA
	JMP	ERRFIX		/YES
				/THE FIX DIRECTIVE HAS PUT THE TASK INTO
				/STATUS 2 AND SET THE FIX BITS BUT AS YET
				/THE TASK HAS NOT BEEN LOADED INTO ITS PART.
				/THE TASK WILL NOT BE LOADED UNTIL HIGHER
				/PRIORITY TASKS RELINQUISH CONTROL. AS SOON
				/AS PROPER THE TASK WILL LOAD INTO CORE AND
				/THEN IT WILL EXIT VIA AN ABORT SEQUENCE.
				/THIS IS THE STANDARD WAY TASKS GET FIXED.
				/HENCE RSXODT MUST WAIT FOR THE TASK TO EXIT
				/FROM THE FIX-ABORT SEQUENCE, I.E. RSXODT
				/MUST WAIT UNTIL THE ATL NODE FOR THE TASK
				/GETS REMOVED FROM THE ATL.
REL8	JMS	ATLSCN		/SCAN THE ATL FOR THE TASK
	JMP	REL9		/RETURN HERE IF NOT FOUND -- GOOD
	.ENB			/RETURN HERE IF FOUND -- NOT SO GOOD
	CAL	MARK		/MARK TIME TO ALLOW TASK TO ABORT
	CAL	WAIT		/WAIT FOR COMPLETION
	JMP	REL8		/GO SCAN THE ATL -- MAYBE THE TASK HAS ABORTED
REL9	.ENB			/ENABLE INTERRUPTS AND PROCEED
/
/ SET UP THE BREAKPOINT TRAP TABLE
/
	LAC	PBASE		/SET UP BREAKPOINT TRAP TABLE
	AAC	-1
	DAC*	(X10		/USE X10 AS A POINTER TO BASE OF PART
	LAC	(HLT		/0: XX
	DAC*	X10
	LAC	(100002		/1: JMS 2
	DAC*	X10
	DZM*	X10		/2: 0
	LAC	(600003		/3: JMP .
	DAC*	X10
	CLA!IAC			/SET THE BRKPT SET FLAG
	DAC	SETFLG
	LAW	-BRKSIZ		/USE TEMP1 AS A COUNTER FOR BRKPT
	DAC	TEMP1		/TABLE ENTRIES
	LAC	(BRKTAB-1	/USE X10 AS A POINTER TO BRKPT ADDR TAB
	DAC*	(X10
	AAC	BRKSIZ		/USE X11 AS A POINTER TO BRKPT INST TAB
	DAC*	(X11
/
/ TRY TO RESET THE BREAK POINTS, IF A BRKPT IS SET ON AN XQT INST
/ THEN IGNORE THE BRKPT AND ZERO TABLE ENTRIES.
/
REL4	LAC*	X10		/GET A BRKPT ADDR
	SNA			/IS IT ZERO?
	JMP	REL5		/YES -- IGNORE THIS TABLE ENTRY
	TAD	PBASE		/NO -- PREPARE TO CHANGE INSTRUCTIONS
	JMS	SETXR		/SET UP XR TO ACCESS BRKPT LOC.
	LAC	0,X		/GET THE INST AT THE BRKPT
	DAC*	X11		/SAVE IN THE BRKPT INST TABLE
	AND	(NOP		/IS INST AN XQT?
	SAD	(NEG
	JMP	REL6		/YES -- PREPARE TO IGNORE THE POINT
	LAC	(420017		/NO -- REPLACE INST WITH XQT* X17
	DAC	0,X		/REPLACE IT
	JMP	REL7		/GO TEST FOR END OF TABLE
/
/ THE TABLE ENTRY IS ZERO SO INCREMENT X11 AND GO TEST FOR END OF TABLE
/
REL5	IDX*	(X11		/INCR. X11 SO IT CORRESPONDS TO X10
	JMP	REL7		/GO TEST FOR END OF TABLE
/
/ THE INST AT THE BRKPT IS AN XQT SO UNSET THIS BREAKPOINT
/
REL6	LAC*	(X10		/DECREMENT X10 SO ENTRY CAN BE ZEROED
	AAC	-1
	DAC*	(X10
	DZM*	X10		/ZERO THE TABLE ENTRY
/
/ TEST FOR END OF TABLE
/
REL7	ISZ	TEMP1		/DONE WITH TABLE?
	JMP	REL4		/NO -- GO LOOK AT NEXT ENTRY
				/YES -- END OF TABLE
/
/ SET UP X17 TO IT POINTS TO WORD0 OF THE BRKPT TRAP TABLE (X17=0)
/
	LAC	PBASE		/PREPARE TO ACCESS PARTITION'S BASE
	JMS	SETXR		/SET UP THE XR
	DZM	X17,X		/ZERO X17
	JMS	DETACH		/DETACH THE OUTPUT DEVICE
	JMP	LOC0		/GO GET ANOTHER COMMAND
	.TITLE *** ODT EXIT COMMAND ***
/
/ EXIT COMMAND -- FORMAT: >EXI(T)
/
/			THIS COMMAND WILL CAUSE ODT TO EXIT UNCONDITIONALLY.
/
/			NOTE: THE EXIT COMMAND WILL CAUSE THE TASK TO ABORT
/
/			THIS COMMAND IS LEGAL ANYTIME
/
EXIT	JMS	DETACH		/DETACH THE OUTPUT DEVICE
/
/ ABORT THE TASK
/
EXIT3	JMS	ATLSCN		/SCAN THE ATL FOR THE TASK
	JMP	EXIT2		/RETURN HERE IF TASK NOT IN ATL
	JMS	SETXR		/RETURN HERE IF FOUND -- SET UP XR
	LAC	(4		/SET STATUS TO 4 SO TASK CAN BE ABORTED
	DAC	7,X
	LAC	(300		/SET THE RESTART ADDRESS TO 300
	DAC	10,X
/ 
/ UNFIX THE TASK FROM IT'S PARTITION
/
EXIT2	.ENB			/ENABLE INTERRUPTS
	CAL	UNFIX		/UNFIX THE TASK
EXIT1	LAC	(MSGBL		/PRINT A BLANK LINE
	JMS	PRINT
/
/ IF TASK IS STILL IN STL LET AUTORM REMOVE IT
/
	LAC	(STL		/SETUP TO SCAN STL
	DAC*	(R1
	LAC	(FINUT1		/LOOK FOR USR NN
	DAC*	(R2
	JMS*	(SNAM		/SCAN THE STL FOR THIS TASK
	JMP	QUIT		/RETURN HERE IF NOT FOUND
	JMS	SETXR		/RETURN HERE IF FOUND -- SETUP XR
	LAC	S.DP,X		/GET FLAGS WORD
	.INH			/INHIBIT INTERRUPTS
	AND	(573777		/STRIP OFF REM ON EXIT AND DONE BITS
	XOR	(S.EROX!S.ETEX	/SET REMOVE ON EXIT BIT AND DONE BIT
	DAC	S.DP,X		/RESTORE WORD
	DZM	S.N1,X		/ZERO TASK AME IN STL
	.ENB			/ENABLE INTERRUPTS
	DZM	S.N2,X
	CAL	RQARM		/REQUEST AUTORM
QUIT	CAL	(10		/EXIT
	.TITLE *** ODT SET A BREAKPOINT COMMAND ***
/
/ SET COMMAND -- FORMAT: >SET NNNNNN
/
/			WHERE NNNNNN IS AN ADDRESS RELATIVE TO THE
/			BASE OF THE TASK'S PARTITION.
/
/			NOTE: NNNNNN COULD BE A SYMBOL 
/
/			THIS COMMAND IS LEGAL ANYTIME.
/
SET	CLA			/CLEAR AC TO DENOTE NO CHAR. IS THERE
	JMS	GETNUM		/GET THE BREAK POINT LOCATION
	JMS	GETSYM		/RETURN HERE IF ERROR -- MAYBE SYMBOL 
	DAC	TEMP		/OK -- (AC=VALUE) SAVE IT
	LACQ			/CHECK THE LINE TERM - PUT TERM IN AC
	JMS	CR		/GO CHECK IT
	JMP	ERRNUM		/TERM ISN'T CR OR ALT -- ERROR
	JMS	ADRCHK		/TERM IS OK -- GO CHECK THE ADDRESS
	LAC	SETFLG		/RETURN HERE IF OK
	SZA			/HAS A BREAK POINT BEEN SET?
	JMP	SET1		/YES
/
/ CONTRUCT THE BREAK POINT TRAP TABLE
/
	LAC	PBASE		/NO -- SET UP A TRAP TABLE
	AAC	-1
	DAC*	(X10
	LAC	(HLT		/0: XX
	DAC*	X10
	LAC	(100002		/1: JMS 2
	DAC*	X10
	DZM*	X10		/2: 0
	LAC	(600003		/3: JMP 3
	DAC*	X10
/
/ TRY TO ENTER THE BREAKPOINT IN THE TABLE
/
SET1	CLA!IAC			/SET THE SET BREAK POINT FLAG
	DAC	SETFLG
	LAW	-BRKSIZ		/IS THIS BREAK PT IN TABLE ALREADY?
	DAC	TEMP1		/USE TEMP1 AS A COUNTER OF BRKPT TAB ENTRIES
	LAC	(BRKTAB-1	/USE X10 AS A POINTER TO TABLE
	DAC*	(X10
	LAC	TEMP		/GET THE ADDRESS SPECIFIED
SET5	SAD*	X10		/DOES ADDR MATCH ONE IN TABLE?
	JMP	ERRBRK		/YES -- ERROR
	ISZ	TEMP1		/NO -- DONE WITH TABLE?
	JMP	SET5		/NO -- LOOK AT NEXT ENTRY
	LAC	(BRKTAB-1	/YES -- SCAN TABLE FOR FREE ENTRY
	DAC*	(X10		/USE X10 AS POINTER TO TABLE
	LAW	-BRKSIZ		/SET UP TEMP1 AS A COUNTER
	DAC	TEMP1		/OF TABLE ENTRIES
SET6	LAC*	X10		/GET NEXT TABLE ENTRY
	SNA			/IS IT ZERO?
	JMP	SET2		/YES -- A FREE ENTRY HAS BEEN FOUND
	ISZ	TEMP1		/NO -- DONE WITH TABLE?
	JMP	SET6		/NO -- GO LOOK AT NEXT ENTRY
	JMP	ERRTAB		/YES -- CAN'T FIND FREE ENTRY -- ERROR
/
/ ENTER THE BREAKPOINT
/
SET2	LAC*	(X10		/WE'VE FOUND A SPOT IN THE TABLE
	AAC	-1		/SET UP X10 AND X11 TO ACCESS
	DAC*	(X10		/FREE TABLE ENTRIES
	AAC	BRKSIZ
	DAC*	(X11
	LAC	TEMP		/STORE THE ADDR IN BRKTAB
	DAC*	X10
SET7	LAC	PBASE		/STORE THE CONTENTS OF ADDR IN INSTAB
	TAD	TEMP
SET8	JMS	SETXR		/SET UP TO ACCESS INSTRUCTION
	LAC	0,X		/PICK UP THE INST. AT THE BREAK
	DAC*	X11		/SAVE IT IN THE TABLE
	AND	(NOP		/IS INSTRUCTION AN XCT?
	SAD	(NEG
	JMP	SETERR		/YES -- PREPARE TO DECLARE AN ERROR
	LAC	(420017		/NO -- REPLACE THE INST. WITH XCT*  X17
	DAC	0,X
	LAC	PBASE		/PREPARE TO ACCESS PARTITION BASE ADDR
	JMS	SETXR
	DZM	X17,X		/MAKE X17 POINT TO 0
	JMS	DETACH		/DETACH THE I/O DEVICE
	JMP	LOC0		/GO GET NEXT COMMAND
/
/ THE BREAK POINT HAS BEEN SET ON AN XQT INSTRUCTION. THIS IS ILLEGAL SO
/ UNSET THE BREAK POINT AND DECLARE AN ERROR
/
SETERR	LAC*	(X10		/PREPARE TO ZERO THE TABLE ENTRY JUST MADE
	AAC	-1
	DAC*	(X10		/X10 IS NOW RESET SO THE ENTRY CAN BE ZEROED
	DZM*	X10		/ZERO THE ENTRY
	JMP	ERRXQT		/DECLARE ERROR -- BRKPT CAN'T BE SET ON XQT
	.TITLE *** ODT CONTINUE AFTER A BREAKPOINT COMMAND ***
/
/ CONTINUE COMMAND -- FORMAT: >CON(T)
/
/			THIS COMMAND IS LEGAL ONLY IF THE TASK IS AT A BREAK PT.
/
CONTIN	LAC	BRKPT		/ARE WE AT A BREAK?
	SNA
	JMP	ERRCON		/NO -- ERROR
	DAC	TEMP		/YES -- SAVE THE BRK PT ADDRESS
	LAC	RBPFLG		/HAVE WE REMOVED THE BREAK ?
	SZA
	JMP	CONT4		/YES -- THEN JUST SET TASK STATUS TO 5
	LAC	PBASE		/NO -- PREPARE TO ACCESS TRAP TABLE
	JMS	SETXR		/SET UP THE XR
CONT2	JMS	SEARCH		/SEARCH BRK PT TABLE FOR BRK LOCATION
	JMP	ERRSEA		/RETURN HERE IF NOT FOUND
	LAC*	X11		/GET THE INST. FROM THE INST. TABLE
	DAC	0,X		/PUT IT INTO TRAP TABLE
	LAW	-1		/SET UP X17 TO POINT TO WORD0-1
	DAC	X17,X
/
/ SET UP TASKS RESTART ADDRESS AND PREPARE TO RESUME TASK
/ (RESTART ROUTINE ENTERS HERE ALSO)
/
CONT3	LAC	PBADR		/SET XR UP TO ACCESS PBDL NODE
	JMS	SETXR		/SET UP THE XR
	LAC	14,X		/GET THE MODE BITS INTO MQ
	AND	(REMADR		/AND OFF THE START ADDR
	LMQ			/SAVE RESULT IN MQ (FLAG BITS)
	LAC	TEMP		/GET. THE RESTART ADDR (ADDR OF XCT* X17)
	OMQ			/OR THE MODE BITS AND RESTART ADDR
	DAC	P.IC,X		/SET UP THE RESTART ADDR
/
/ CHANGE THE TASK'S STATUS FROM 6 TO 5
/
CONT4	JMS	ATLSCN		/SCAN THE ATL FOR THE TASK
	JMP	CONERR		/RETURN HERE IF NOT FOUND
	JMS	SETXR		/RETURN HERE IF FOUND -- SET UP XR
	LAC	(5		/SET THE TASK'S STATUS BACK TO 5
	DAC	A.TS,X
	.ENB			/ENABLE INTERRUPTS
	JMS	DETACH		/DETACH THE I/O DEVICE
	JMS	MONITOR		/GO MONITOR THE TASK'S PROGRESS
/
/ TASK IS NOT IN ATL, DECLARE AN ERROR
/
CONERR	.ENB			/ENABLE INTERRUPTS
	JMP	ERREX		/DECLARE THE ERROR
	.TITLE *** ODT REMOVE A BREAKPOINT COMMAND ***
/
/ REMOVE COMMAND -- FORMAT: >REM(OVE) NNNNNN
/
/			WHERE NNNNNN IS AN ADDRESS RELATIVE TO THE
/			BASE OF THE TASK'S PARTITION.
/
/			NOTE: NNNNNN COULD BE A SYMBOL 
/
/			THIS COMMAND IS LEGAL ANYTIME.
/
REMOVE	CLA			/CLEAR AC TO DENOTE NO CHAR. THERE
	JMS	GETNUM		/GET THE ADDR. OF THE BREAKPOINT
	JMS	GETSYM		/RETURN HERE IF ERROR -- MAYBE SYMBOL
	DAC	TEMP		/SAVE THE ADDRESS
	LACQ			/CHECK THE LINE TERM - GET IT FROM MQ
	JMS	CR		/GO CHECK IT
	JMP	ERRNUM		/RETURN HERE IF IT'S NOT A CR OR ALT -- ERROR
REM2	LAC	BRKPT		/RETURN HERE IF TERM OK -- ARE WE AT A BREAK POINT?
	SNA
	JMP	REM3		/NO
	SAD	TEMP		/YES -- IS THIS THE BRK PT WE'RE AT?
	SKP
	JMP	REM3		/NO
/
/ REMOVE THE BREAKPOINT TASK IS AT RIGHT NOW
/
	JMS	SEARCH		/YES -- SCAN THE TABLE
	JMP	ERRSEA		/RETURN HERE IF POINT NOT FOUND
	IDX	RBPFLG		/SET REMOVED BRK PT FLAG
	LAC	PBASE		/PREPARE TO RESET X17
	JMS	SETXR		/SET UP THE XR
	DZM	X17,X		/SET X17 TO 0
	LAC	PBADR		/PREPARE TO ACCESS PARTITION BLOCK
	JMS	SETXR		/SET UP THE XR
	LAC	P.IC,X		/GET THE MODE BITS
	AND	(REMADR		/AND OFF THE ADDRESS
	LMQ			/SAVE RESULT IN MQ
	LAC	TEMP		/GET THE BRK PT ADDR
	OMQ			/CONSTRUCT THE RESTART ADDRESS
	DAC	P.IC,X		/SET UP THE RESTART ADDR
	JMP	REM4		/GO CLEAR OUT TABLE ENTRIES
/
/ REMOVE BREAKPOINT WITHOUT COMPLICATIONS
/
REM3	JMS	SEARCH		/SEARCH THE BRKPT TABLE
	JMP	ERRSEA		/RETURN HERE IF NOT FOUND -- ERROR
/
/ CLEAR OUT THE ENTRY IN THE BREAKPOINT TABLE
/
REM4	LAC*	(X11		/USE X11 POINT TO BREAKPOINT INST TABLE
	TAD	(-BRKSIZ	/AND USE X10 TO POINT TO BREAKPOINT
	DAC*	(X10		/ADDRESS TABLE
	DZM*	X10		/ZERO BRK PT. ADDR. TABLE ENTRY
	LAC	PBASE		/PREPARE TO ACCESS PARTITION BASE
	TAD	TEMP		/PLUS BRKPT LOCATION
	JMS	SETXR		/SET UP THE XR
	LAC*	X11		/RESTORE THE CONTENTS OF BRK PT LOC.
	DAC	0,X		/DEPOSIT FORMER CONTENTS OF INST
	JMS	DETACH		/DETACH THE I/O DEVICE
	JMP	LOC0		/GO GET NEXT COMMAND
	.TITLE *** ODT OPEN A REGISTER OR LOCATION COMMAND ***
/
/ OPEN COMMAND -- FORMAT: >OPE(N) NNNNNN
/
/			WHERE NNNNNN IS AN ADDRESS RELATIVE TO THE BASE
/			OF THE TASK'S PARTITION.
/
/			NOTE: NNNNNN COULD BE A SYMBOL OR ONE OF THE FOLLOWING
/			REGISTERS - $AC,$MQ,$XR,$LR,$LINK,$X10,...,$X16 .
/
/			ODT WILL PRINT THE CONTENTS OF THE LOCATION OR REGISTER
/			AND WAIT FOR A RESPONSE. IF A VALUE(OCTAL ONLY) IS
/			GIVEN THAT VALUE WILL REPLACE THE FORMER CONTENTS
/			IF ONLY A TERMINATOR IS TYPED, ODT WILL PROCESS
/			IT. IN EITHER CASE IF THE RESPONSE IS ENDED WITH ALTM.
/			A BRAND NEW COMMAND WILL BE REQUESTED. IF, HOWEVER, THE
/			LINE IS TERMINATED BY A CR, THE NEXT LOCATION
/			WILL BE OPENED (UNLESS A REGISTER WAS SPECIFIED)
/			IF A NEW VALUE IS ENTERED FOR THE LINK, ONLY BIT 0
/			IS RELAVANT.
/
/			THIS COMMAND IS LEGAL ANYTIME, BUT REGISTERS CAN
/			BE OPENED ONLY IF THE TASK IS AT A BREAKPOINT.
/
OPEN	CLA			/CLEAR AC TO DENOTE NO CHAR THERE
	DZM	OPEBPT		/CLEAR THE 'THIS IS A BRK PT' FLAG
	DZM	OPEREG		/CLEAR THE 'THIS IS A REGISTER' FLAG
	DZM	OPELNK		/CLEAR THE 'THIS IS THE LINK' FLAG
	JMS	GETNUM		/GET A NUMBER (LOCATION)
	JMP	OPEN1		/RETURN HERE IF POSSIBLE ERROR
				/RETURN HERE IF OK WITH AC=ADDR
/
/ OPEN A MEMORY LOCATION
/
OPEN3	DAC	TEMP		/SAVE THE LOCATION
	LACQ			/CHECK THE LINE TERM - GET CHAR FROM MQ
	JMS	CR		/GO CHECK IT
	JMP	ERRNUM		/ERROR -- NOT A TERM
	JMS	ADRCHK		/GO CHECK THE ADDRESS
	LAC	TEMP		/GET ACTUAL ADDR
	TAD	PBASE		/ADD BASE OF PARTITION
	JMS	SETXR		/SET UP XR TO ACCESS THAT LOCATION
	PXA			/SAVE THE XR
	DAC	TEMP1		/IN TEMP1
	JMS	SEARCH		/SCAN BRK PT TABLE TO SEE IF ADDR IS IN IT
	JMP	OPEN5		/ADDRESS IS NOT A BREAK
/
/ OPEN MEMORY LOC. AT A BREAKPOINT
/
	LAC*	(X11		/SAVE X11 AS POINTER IN CASE OF
	DAC	OPEX11		/BRKPT MODIFICATION.
	LAC*	X11		/ADDRESS IS A BREAK -- GET CONTENTS
	IDX	OPEBPT		/SET THE 'THIS IS A BRK PT' FLAG
	JMP	OPEN6		/GO PRINT THE CONTENTS
/
/ OPEN A MEMORY LOC NOT AT A BREAKPOINT
/
OPEN5	LAC	TEMP1		/SET UP TO GET THE CONTENTS
	PAX			/RESTORE XR
	LAC	0,X		/GET THE CONTENTS OF THE ADDR
/
/ PRINT THE CONTENTS OF THE MEMORY LOC OR REGISTER AND GET THE
/ NEW VALUE IF ONE WAS SPECIFIED.
/
	.IFUND ONEPLS
OPEN6	DAC	TEMP2		/SAVE THE VALUE
	LAC	TEMP		/GET THE ADDR
	JMS	NUMOUT		/PRINT IT
	LAC	(MSGCOL		/PRINT A COLON
	JMS	PRINT
	LAC	TEMP2		/RETRIEVE THE VALUE
	JMS	NUMOUT		/PRINT THE VALUE
	LAC	(MSGCOL		/PRINT A COLON
	.ENDC
	.IFDEF ONEPLS
/
/ IF THE FLAG SYMFLG IS SET, AND A LOCATION HAS BEEN OPENED, DECODE
/ THE OP. CODE OF THIS INSTRUCTION FOR THE USER.
/
OPEN6	DAC	OPEWRD		/SAVE CONTENTS OF THE LOCATION
	LAC	TEMP		/GET THE ADDR
	JMS	NUMOUT		/PRINT IT
	LAC	(MSGCOL		/PRINT A COLON
	JMS	PRINT
	LAC	OPEWRD		/RETRIEVE VALUE
	JMS	NUMOUT		/PRINT THE CONTENTS
	LAC	SYMFLG		/SHOULD THE CONTENTS BE DECODED?
	SNA
	JMP	OPECOL		/NO -- PREPARE TO GET NEW CONTENTS
	LAC	OPEREG		/MAYBE -- IS THIS A REGISTER?
	SZA
	JMP	OPECOL		/YES -- DON'T DECODE REGISTERS
OPESYM	LAC	OPEWRD		/NO -- DECODE THE WORD
	AND	(770000		/GET THE OP. CODE (6 BITS FOR SPECIAL CASES)
	SAD	(710000		/IS IT FPP?
	JMP	OPEFPP		/YES
	SAD	(720000		/NO -- IND?
	JMP	OPEIND		/YES
	AND	(740000		/NO -- MASK TO 4 BITS FOR NORMAL CASES
	SNA			/IS IT A CAL?
	JMP	OPECAL		/YES
	LMQ			/NO -- SAVE OP CODE IN MQ
	LAC	(DECTAB-1	/PREPARE TO SCAN PDP-15 INST TABLE
	DAC*	(X13		/USE X13 AS INDEXER
	LAW	-16		/SETUP OPETMP AS AN ISZ COUNTER FOR
	DAC	OPETMP		/TABLE ENTRIES
	LACQ			/RETRIEVE OP CODE
OPESY1	SAD*	X13		/DOES IT MATCH TABLE ENTRY?
	JMP	OPESY2		/YES -- GET MSG TABLE ENTRY
	ISZ	OPETMP		/NO -- DONE WITH TABLE?
	JMP	OPESY1		/NO -- CHECK NEXT ENTRY
OPEOPR	LAC	(MSGOPR		/YES -- MUST BE AND OPR
	JMP	OPEPS		/GO PRINT THE SYMBOLIC REPRESENTATION
OPESY2	LAC*	(X13		/TABLE ENTRY FOUND 
	AAC	15		/PREPARE TO GET MSG ADDR FROM
	DAC*	(X13		/MESSAGE TABLE
	LAC*	X13		/PICK UP MESSAGE ADDRESS
	JMP	OPEPS		/GO PRINT IT
OPECAL	LAC	(MSGCAL		/GET CAL MESSAGE
	JMP	OPEPS		/GO PRINT IT
OPEFPP	LAC	(MSGFPP		/GET FPP MESSAGE
	JMP	OPEPS		/GO PRINT IT
OPEIND	LAC	(MSGIND		/GET IND MESSAGE
OPEPS	JMS	PRINT		/PRINT THE MESSAGE
OPECOL	LAC	(MSGCOL		/GET THE COLON MESSAGE
	.ENDC
	JMS	PRINT		/GO PRINT THE COLON
	JMS	READ		/READ A LINE
	JMS	IFAC		/INIT. FAC VARIABLES
	INBUFF			/INPUT BUFFER
	CLA			/CLEAR AC TO DENOTE NO CHAR THERE
	JMS	GETNUM		/TRY TO GET A NUMBER
	JMP	OPEN9		/RET. HERE ON POSSIBLE ERROR -- COULD BE TERM.
	PAL			/SAVE THE NUMBER IN LR
	LACQ			/GET THE BREAK CHAR
	JMS	CR		/IS IT A TERM?
	JMP	ERRNUM		/NO -- ERROR
	LAC	OPEBPT		/YES -- IS THIS ADDRESS A BREAK POINT?
	SNA
	JMP	OPEN8		/NO
/
/ CHANGE THE MEMORY LOCATION (AT A BREAKPOINT)
/
	LAC	OPEX11		/RESET X11 TO ACCESS TABLE
	DAC*	(X11		/IN BRKPT INST TABLE
	PLA			/GET NEW CONTENTS
	AND	(NOP
	SAD	(NEG		/IS IT AN XQT INST?
	JMP	ERRXQT		/YES -- ERROR
	PLA			/NO -- RESTORE NEW CONTENTS TO AC
	DAC*	X11		/PUT IT IN BREAK PT. TABLE
	JMP	OPEN9		/GO CHECK LINE TERM
/
/ CHANGE REGISTER OR MEMROY LOC (NOT AT A BREAKPOINT)
/
OPEN8	LAC	TEMP1		/NOT A BREAK PT. RESET XR
	PAX			/RESTORE XR
	LAC	OPELNK		/HAS THE LINK BEEN OPENED?
	SZA
	JMP	OPEN17		/YES
/
/ CHANGE REGISTER (EXECPT LINK) OR MEMROY LOC. (NOT AT A BREAKPOINT)
/
	PLA			/NO -- GET NEW CONTENTS
	DAC	0,X		/PUT NEW CONTENTS IN ADDR.
	JMP	OPEN9		/GO CHECK LINE TERM
/
/ CHANGE THE LINK (ONLY BIT 0 IS RELEVANT)
/
OPEN17	LAC	0,X		/PICK UP THE WORD WITH THE LINK
	AND	(CMANEG		/KEEP EVERYTHING BUT THE LINK
	DAC	TEMP1		/SAVE THIS TEMPORARILY
	PLA			/GET NEW LINK CONTENTS
	AND	(NEG		/KEEP ONLY THE SIGNIFICANT BIT
	XOR	TEMP1		/ENTER THE REST OF THE WORD
	DAC	0,X		/STORE THE RESULT
/
/ CHECK THE LINE TERM FOR A POSSIBLE ERROR
/
OPEN9	LACQ			/WHAT KIND OF TERM WAS IT?
	JMS	CR		/GO CHECK IT
	JMP	ERRNUM		/NOT A CR OR ALT -- ERROR
/
/ CHECK TO SEE IF THE NEXT MEMORY LOC SHOULD BE OPENED
/
OPEN13	SAD	(175		/ALTMODE?
	JMP	OPEN10		/YES -- GO GET NEXT COMMAND
	LAC	OPEREG		/NO -- WAS THIS A REG?
	SZA
	JMP	OPEN10		/YES -- GO GET NEXT COMMAND
	LAC	(15		/SET TERM = CR
	LMQ			/SAVE IN MQ
	LAC	TEMP		/BUMP THE ADDRESS
	IAC
	JMP	OPEN3		/OPEN THE NEXT ADDRESS
/
/ GO GET NEXT COMMAND
/
OPEN10	JMS	DETACH		/DETACH THE I/O DEVICE
	JMP	LOC0		/GO GET NEXT COMMAND
/
/ OPEN A REGISTER OR MEMORY LOC DEFINED BY A SYMBOL
/
OPEN1	LACQ			/GET THE BREAK CHAR
	SAD	(44		/"$"?
	JMP	OPEN2		/YES -- OPEN A REGISTER MAYBE
	JMS	GETSYM		/NO -- GET A SYMBOL
	AAC	20		/ADD 20 TO THE ADDRESS
	JMP	OPEN3		/OPEN THE LOCATION AS USUAL
/
/ OPEN A REGISTER
/
OPEN2	PAL			/SAVE THE CHAR
	LAC	BRKPT		/ARE WE AT A BREAK POINT?
	SNA
	JMP	ERROPR		/NO -- ERROR (ILLEGAL TO OPEN REGISTERS)
	PLA			/YES -- RESTORE THE CHAR
	JMS	GETNAM		/GET A 'NAME' (IT'S REALLY A REGISTER)
	CMD			/REGISTER NAME BUFFER
	JMP	ERRNUM		/RETURN HERE ON AN ERROR
	LAC	(REGTB1-1	/PREPARE TO SCAN REGISTER TABLES
	DAC*	(X10		/USE X10 AS A POINTER TO TABLE
	LAW	-REGSIZ		/SET UP REG TABLE COUNTER
	DAC	TEMP2		/IN TEMP2
OPEN11	LAC	CMD		/SCAN THE 1ST TABLE
/
/ SCAN THE 1ST REGISTER NAME TABLE
/
	SAD*	X10		/MATCH?
	JMP	OPEN12		/YES -- CHECK 2ND HALF OF REGISTER NAME
	ISZ	TEMP2		/NO -- END OF 1ST TABLE?
	JMP	OPEN11		/NO -- CHECK NEXT TABLE ENTRY
	JMP	ERRNUM		/YES -- ERROR
/
/ CHECK THE 2ND HALF OF THE REGISTER'S NAME
/
OPEN12	LAC*	(X10		/CHECK TABLE 2
	AAC	REGSIZ		/USE TEMP1 AS A POINTER
	DAC	TEMP1		/TO 2ND REG TABLE
	LAC*	TEMP1		/GET 2ND HALF OF REG NAME
	SAD	CMD+1		/MATCH ON SECOND HALF OF REG. NAME?
	SKP			/YES
	JMP	OPEN11		/NO -- CONTINUE SCANNING TABLE 1
	LAC	TEMP1		/PREPARE TO GET REG. VALUE FROM PBDL
	AAC	REGSIZ		/USE TEMP1 AS POINTER 
	DAC	TEMP1		/TO BIAS TABLE ENTRY
	LAC*	TEMP1		/WE'VE GO THE BIAS --DOES BIAS REFER TO PBDL?
	SPA
	JMP	OPEN14		/NO -- BIAS REFERS TO PARTITION (X10-X16)
/
/ GET REGISTER CONTENTS FROM PBDL
/
	TAD	PBADR		/YES -- PREPARE TO ACCESS PBDL
/
/ PREPARE TO PRINT REGISTER CONTENTS
/
OPEN15	JMS	SETXR		/SET UP TO ACCESS PBDL
	PXA			/SAVE THE XR
	DAC	TEMP1		/IN TEMP1
	LAC	0,X		/GET THE VALUE OF THE REG
	IDX	OPEREG		/SET THE OPEN REGISTER FLAG
	PAL			/SAVE THE VALUE TEMPORIRIALY
	LAC	CMD		/GET THE 1ST HALF OF REGISTER NAME
	SAD	(441411		/DOES IT SHOW "$LI" FOR $LINK?
	JMP	OPEN16		/YES
	PLA			/NO -- RESTORE THE VALUE
	JMP	OPEN6		/GO PRINT CONTENTS OF THE REGISTER
/
/ GET REGISTER CONTENTS FORM VIRTUAL ADDRESSES 10-16 (X10-X16)
/
OPEN14	AND	(ADRMSK		/AND OFF BIT 0 THE FLAG BIT
	TAD	PBASE		/ADD BASE OF PARTITION
	JMP	OPEN15		/GO GET THE VALUE
/
/ GET THE CONTENTS OF THE LINK
/
OPEN16	PLA			/RESTORE THE VALUE
	AND	(NEG		/SAVE ONLY THE SIGNIFICANT PART
	IDX	OPELNK		/SET THE 'OPEN LINK' FLAG
	JMP	OPEN6		/GO PRINT THE CONTENTS
/
/ LOCAL VARIABLES FOR OPEN
/
OPEREG	0			/SET 1 IF OPENING A REG, 0 IF NOT
OPEBPT	0			/SET 1 IF OPENING A BRKPT, 0 IF NOT
OPELNK	0			/SET 1 IF OPENING LINK, 0 IF NOT
OPEX11	0			/USED TO SAVE X11 WHEN OPEN BRKPT
	.IFDEF ONEPLS
OPEWRD	0			/USED TO SAVE A LOCATION'S CONTENTS
OPETMP	0			/USED AN AN ISZ COUNTER FOR PDP-15 INST TABS
	.ENDC
	.TITLE *** ODT DUMP THE TASK COMMAND ***
/
/ DUMP COMMAND -- FORMAT: >DUM(P)
/
/			THE TASK IMAGE NOW IN CORE WILL BE DUMPED INTO
/			AN RSX CREATED FILE NAMED: 'TSKNAM DMP'.
/			BEFORE DUMPING THE FILE, RSXODT WILL REPLACE
/			THE CONTENTS OF BREAKPOINT LOCATIONS WITH
/			THEIR FORMER CONTENTS.  THESE LOCATIONS WILL
/			LATER BE RESTORED WHEN THIS FUNCTION IS DONE.
/
/			THIS COMMAND IS LEGAL ANYTIME.
/
	.IFDEF ONEPLS
DUMP	CAL	HINF		/GET HANDLER INFO ON 'FILLUN' LUN
	CAL	WAIT		/WAIT FOR COMPLETION
	LAC	EV		/WERE THERE ERRORS?
	SPA
	JMP	ERRHIN		/YES
	AND	(77		/NO -- AND OFF EVERYTHING BUT DEVICE CODE
	SAD	(2		/IS DEVICE RF DISK?
	SKP			/YES -- OK
	SAD	(3		/NO -- RP DISK?
	SKP			/YES -- OK
	SAD	(24		/NO -- RK DISK?
	SKP			/YES -- OK
	JMP	ERRHIN		/NO -- ERROR (NOT A DISK)
/
/ SET UP THE CREATE AND PUT CPB'S AND CONTROL TABLES
/
	DAC	PUT+4		/SAVE DEVICE CODE IN PUT CPB
	LAC	PBADR		/PREPARE TO ACCESS PBDL NODE
	JMS	SETXR		/SET UP THE XR
	LAC	PBASE		/GET THE BASE ADDRESS
	DAC	PUTCTA+2	/SAVE IT IN THE PUT CONTROL TABLE
	LAC	P.SZ,X		/GET THE SIZE
	DAC	PUTCTA+3	/SAVE IT IN THE CONTROL TABLE
	CLL			/SET UP LINK FOR A SHIFT
	LRS	10		/CONVERT WORDS TO BLOCKS
	DAC	CRECTA+3	/SAVE NO. OF BLOCKS IN CREATE C.T.
/
/ CREATE THE FILE AND WRITE THE TASK IMAGE INTO IT
/
	CAL	CREATE		/CREATE THE FILE
	CAL	WAIT		/WAIT FOR COMPLETION
	LAC	EV		/ANY ERRORS?
	SPA
	JMP	ERRCRE		/YES
	LAC	CRECTA+7	/NO -- GET THE UNIT AND PLATTER
	DAC	PUTCTA+0	/STORE IN PUT CONTROL TABLE
	LAC	CRECTA+10	/GET THE DISK ADDRESS
	DAC	PUTCTA+1	/STORE IN PUT CONTROL TABLE
	JMS	REMRES		/RESTORE CONTENTS OF BRKPTS
	LAC*	X11		/WORD XCT'D BY SUBROUTINE REMRES
	CAL	PUT		/RETURN HERE -- PUT THE TASK TO DISK
	CAL	WAIT		/WAIT FOR COMPLETION
	LAC	EV		/ANY ERRORS?
	SPA
	JMP	DUMERR		/YES -- GO RESTORE BRKPTS AND TELL USER
	JMS	REMRES		/NO -- GO RESTORE BRKPTS
	LAC	(420017		/WORD XCT'D BY SUBROUTINE REMRES
	JMS	DETACH		/RETURN HERE -- DETACH I/O DEVICE
	JMP	LOC0		/GO GET NEXT COMMAND
/
/ A PUT ERROR OCCURRED SO RESTORE THE BREAKPOINTS, DELETE THE FILE
/ AND DECLARE THE ERROR
/
DUMERR	CAL	DELETE		/DELETE THE CREATED FILE
	CAL	WAIT		/WAIT FOR COMPLETION
	JMS	REMRES		/RESTORE BRKPTS
	LAC	(420017		/WORD XCT'D BY SUBROUTINE REMRES
	JMP	ERRPUT		/RETURN HERE -- GO DECLARE ERROR
	.ENDC
	.TITLE *** ODT DECODE COMMAND ***
/
/ DECODE COMMAND -- FORMAT: >DEC(ODE) STRING
/
/			WHERE STRING IS EITHER 'ON' OR 'OFF'.
/
/			THIS COMMAND SETS (ON) OR CLEARS (OFF) A FLAG
/			WHICH TELLS OPEN WHETHER OR NOT TO DECODE
/			THE OP. CODE OF THE INSTRUCTIONS IN A TASK'S
/			PARTITION.
/
/			THIS COMMAND IS LEGAL ANYTIME.
/
	.IFDEF ONEPLS
DECODE	CLA			/CLEAR AC TO DENOTE NO CHAR THERE
	JMS	GETNAM		/GET THE STRING
	SYMBOL			/PLACE TO STORE THE STRING
	JMP	ERRNUM		/RETURN HERE ON ERROR
	LAC	SYMBOL		/RETURN HERE IF OK -- GET STRING
	SAD	(170606		/IS IT OFF?
	JMP	DECOFF		/YES
	SAD	(171600		/NO -- IS IT ON?
	JMP	DECON		/YES
	JMP	ERRNUM		/NO -- ERROR
/
/ THE STRING IS OFF SO CLEAR THE FLAG
/
DECOFF	DZM	SYMFLG		/ZERO THE FLAG
	JMP	DECEX		/PREPARE TO EXIT
/
/ THE STRING IS ON SO SET THE FLAG
/
DECON	CLA!IAC			/SET THE FLAG
	DAC	SYMFLG
DECEX	JMS	DETACH		/DETACH I/O DEVICE
	JMP	LOC0		/GO GET NEXT COMMAND
	.ENDC
	.TITLE *** ODT REGISTERS COMMAND ***
/
/ REGISTERS COMMAND -- FORMAT: >REG(IST)
/
/			THIS COMMAND PRINTS THE CONTENTS OF THE AC,
/			MQ,XR,LR, AND LINK.
/
/			THIS COMMAND IS LEGAL ONLY IF TASK AT A BRKPT.
/
	.IFDEF ONEPLS
REGIST	LAC	BRKPT		/IS TASK AT A BRKPT?
	SNA
	JMP	ERRCON		/NO -- ERROR
/
/ PRINT CONTENTS OF AC
/
	LAC	(MSGAC		/YES -- GET MESSAGE FOR AC
	JMS	PRINT		/PRINT IT
	LAC	PBADR		/PREPARE TO ACCESS PBDL
	JMS	SETXR		/SET UP XR
	LAC	P.AC,X		/GET AC'S VALUE
	JMS	NUMOUT		/PRINT IT
	LAC	(MSGBL		/PRINT BLANK LINE
	JMS	PRINT
/
/ PRINT CONTENTS OF XR
/
	LAC	(MSGXR		/GET MESSAGE FOR XR
	JMS	PRINT		/PRINT IT
	LAC	PBADR		/PREPARE TO ACCESS PBDL
	JMS	SETXR		/SET UP XR
	LAC	P.XR,X		/GET XR'S VALUE
	JMS	NUMOUT		/PRINT IT
	LAC	(MSGBL		/PRINT BLANK LINE
	JMS	PRINT
/
/ PRINT CONTENTS OF MQ
/
	LAC	(MSGMQ		/GET MESSAGE FOR MQ
	JMS	PRINT		/PRINT IT
	LAC	PBADR		/PREPARE TO ACCESS PBDL
	JMS	SETXR		/SET UP XR
	LAC	P.MQ,X		/GET MQ'S VALUE
	JMS	NUMOUT		/PRINT IT
	LAC	(MSGBL		/PRINT BLANK LINE
	JMS	PRINT
/
/ PRINT CONTENTS OF LR
/
	LAC	(MSGLR		/GET MESSAGE FOR LR
	JMS	PRINT		/PRINT IT
	LAC	PBADR		/PREPARE TO ACCESS PBDL
	JMS	SETXR		/SET UP XR
	LAC	P.LR,X		/GET LR'S VALUE
	JMS	NUMOUT		/PRINT IT
	LAC	(MSGBL		/PRINT BLANK LINE
	JMS	PRINT
/
/ PRINT CONTENTS OF LINK
/
	LAC	(MSGLNK		/GET MESSAGE FOR LINK
	JMS	PRINT		/PRINT IT
	LAC	PBADR		/PREPARE TO ACCESS PBDL
	JMS	SETXR		/SET UP XR
	LAC	P.IC,X		/GET LINK AND RESTART ADDR.
	AND	(NEG		/KEEP ONLY LINK
	JMS	NUMOUT		/PRINT IT
	LAC	(MSGBL		/PRINT BLANK LINE
	JMS	PRINT
	JMS	DETACH		/DETACH I/O DEVICE
	JMP	LOC0		/GO GET NEXT COMMAND
	.ENDC
	.TITLE *** ODT MONITOR ROUTINE ***
/
/ *** MONITOR ROUTINE -- WAIT FOR THE TASK TO HANG UP AT A BREAK OR EXIT
/
MONITOR	LAW	-TIME		/SET UP THE TIME COUNTER
	DAC	TIMER		/SAVE IT IN TIMER
MON2	CAL	MARK		/MARK SOME TIME
	DZM	RBPFLG		/ZERO REMOVED BRK PT FLAG
	DZM	BRKPT		/ZERO FLAG SO IT SHOWS WE'RE NOT AT A BRK YET
	CAL	WAIT		/WAIT FOR MARK TIME REQUEST
	JMS	ATLSCN		/SCAN THE ATL FOR THE TASK
	JMP	MONDON		/RETURN HERE IF NOT FOUND -- TASK NOT IN ATL
	.ENB			/RETURN HERE IF FOUND -- ENABLE INTERRUPTS
	JMS	SETXR		/SET UP THE XR TO ACCESS ATL
	LAC	A.TS,X		/GET THE TASK STATUS
	DAC	MONTMP		/SAVE IT FOR POSSIBLE PRINTING
	SAD	(7		/IS TASK BEING SLICED?
	SKP			/YES
	SAD	(5		/NO -- INTERRUPTED BY EXEC?
	SKP
	JMP	MON100		/NO
	PXA			/YES -- SAVE THE XR IN MQ
	LMQ
	LAC	PBADR		/SET UP TO ACCESS PBDL
	JMS	SETXR		/SET UP XR
	LAC	P.IC,X		/GET RESTART ADDRESS
	AND	(ADRMSK		/KEEP ONLY THE ADDRESS
	DAC	TEMP		/SAVE THIS
	SAD	(3		/IS THE TASK HUNG UP AT THE JMP .?
	SKP
	JMP	MON100		/NO -- GO MARK SOME TIME
	LAC	PBASE		/YES -- SET UP TO GET ADDR OF BRK PT +1
	JMS	SETXR		/SET UP XR TO ACCESS TRAP TABLE
	LAC	2,X		/GET ADDR OF BRK PT +1
	AND	(ADRMSK		/AND OFF EVERYTHING BUT THE ADDRESS
	AAC	-1		/GET ADDR OF BRK PT
	DAC	TEMP		/SAVE THE ADDR OF ALLEGED BRK PT
MON1	JMS	SEARCH		/SEARCH THE TABLE FOR THIS ADDR
	JMP	MON100		/NOT FOUND
	LACQ			/RESTORE THE XR TO POINT TO THE ATL NODE
	PAX
	.INH			/INHIBIT INTERRUPTS
	LAC	(10		/TASK AT BRK - SET THE TASK'S STATUS TO 10
	.ENB			/ENABLE INTERRUPTS
	DAC	A.TS,X
	LAC	(MSGBRK		/PRINT THE MESSAGE
	JMS	PRINT
	LAC	TEMP		/GET THE BRK PT ADDR
	DAC	BRKPT		/SAVE ADDR OF BREAK POINT
	JMS	NUMOUT		/PRINT THE ADDR
	LAC	(MSGBL		/PRINT A BLANK LINE TO RETURN CARRIAGE
	JMS	PRINT
	JMP	LOC0		/GO GET A COMMAND
/
/ ENABLE INTERRUPTS AND GO MONITOR TASK'S PROGRESS
/ UNLESS ITS TIME TO SEE IF THE TASK SHOULD BE ABORTED
/
MON100	ISZ	TIMER		/TIME TO SEE IF TASK SHOULD BE ABORTED?
	JMP	MON2		/NO -- GO MONITOR THE TASK'S PROGRESS
/
/ DETERMINE IF THE TASK HAS RUN LONG ENOUGH AND SHOULD BE ABORTED
/
MON3	JMS	ATTACH		/YES -- ATTACH THE DEVICE
	LAC	(MSGSTA		/GET TASK STATUS MESSAGE
	JMS	PRINT		/PRINT IT
	LAC	MONTMP		/GET TASK STATUS
	JMS	NUMOUT		/PRINT IT
	LAC	(MSGABO		/PRINT THE ABORT QUESTION
	JMS	PRINT
	JMS	READ		/READ THE RESPONSE
	JMS	DETACH		/DETACH THE I/O DEVICE
	JMS	IFAC		/INIT. FAC VARIABLE
	INBUFF			/BUFFER ADDRESS
	JMS	FAC57		/GET A CHAR
	SAD	(116		/IS IT A "N"?
	JMP	MONITOR		/YES -- GO MONITOR
	JMP	RELOAD		/NO -- ABORT AND RELOAD THE TASK
/
/ TASK HAS EXITTED -- GO TELL THE USER
/
MONDON	.ENB			/ENABLE INTERRUPTS
	LAC	(MEDON		/GET THE MESSAGE ADDR
	JMS	PRINT		/PRINT THE MESSAGE
	JMP	RELOAD		/GO RELOAD THE TASK
/
/ MONITOR ROUTINE'S LOCAL VARIABLE
/
MONTMP	0			/SET TO TASK'S STATUS
	.TITLE *** ODT SUBROUTINES ***
/
/
/ *** SUBROUTINES
/
/ SUBROUTINE PRINT -- PRINT LINE WHOSE ADDR IS IN AC
/
/		RETURN AT JMS+1 UNCONDITIONALLY
/
/		ALL REGISTERS ARE MODIFIED
/
PRINT	0
	DAC	WRITE+4		/SAVE THE MESSAGE ADDR IN CPB
	CAL	WRITE		/PRINT THE MESSAGE
	CAL	WAIT		/WAIT FOR COMPLETION
	JMP*	PRINT		/RETURN
/
/ SUBROUTINE ATLSCN -- SCAN ATL FOR TASK NAMED BY NAME1 AND NAME2
/
/		RETURN AT JMS+1 IF NOT FOUND
/		RETURN AT JMS+2 IF FOUND WITH ATL NODE ADDR IN AC
/		ON RETURN INTERRUPTS WILL BE INHIBITTED IN EITHER CASE
/
/		AC,XR, AND X12 ARE MODIFIED
/
ATLSCN	0
	LAC	(NAME1		/SET UP TO ACCESS THE TASK NAME
	JMS	SETXR		/USE XR AS A POINTER TO THE NAME
	LAC*	(CURTSK		/SET UP TO SCAN ATL STARTING WITH RSXODT
	DAC	ATLTMP		/SAVE ADDR. OF RSXODT'S ATL NODE
	LAC*	ATLTMP		/GET POINTER TO NEXT NODE IN ATL
ATL1	.INH			/INHIBIT INTERRUPTS
	SAD	(ATL		/IS THIS THE END OF THE ATL?
	JMP*	ATLSCN		/YES -- TASK NOT FOUND RET. AT JMS+1
	DAC	ATLTMP		/NO -- SAVE THE ADDR OF THIS NODE
	IAC			/SET UP X12 TO POINT TO TASK NAME
	DAC*	(X12
	LAC*	X12		/GET 1ST 1/2 OF TASK NAME FROM ATL NODE
	SAD	0,X		/DOES IT MATCH THE NAME WE SEEK?
	SKP			/YES -- GO EXAMINE 2ND 1/2 OF NAME
	JMP	ATL2		/NO -- PREPARE TO LOOK AT NEXT NODE
	LAC*	X12		/GET THE 2ND HALF OF THE NAME IN ATL NODE
	SAD	1,X		/DOES 2ND 1/2 OF NAME MATCH?
	JMP	ATL3		/YES -- ATL NODE HAS BEEN FOUND
ATL2	.ENB			/NO -- ENABLE INTERRUPTS
	LAC*	ATLTMP		/PREPARE TO ACCESS NEXT NODE -- GET THE
	JMP	ATL1		/POINTER TO NEXT NODE AND GO CHECK IT
ATL3	LAC	ATLTMP		/GET THE ADDR. OF THIS NODE
	IDX	ATLSCN		/PREPARE TO RETURN AT JMS+2
	JMP*	ATLSCN		/RETURN
/
/ LOCAL VARIABLE FOR ATLSCN
/
ATLTMP	0			/ADDRESS OF ATL NODE
/
/ SUBROUTINE ATTACH -- ATTACH THE I/O DEVICE
/
/		RETURN AT JMS+1 IF ATTACH IS OK
/
/		ALL REGISTERS ARE MODIFIED
/ 
ATTACH	0
	CAL	ATT		/ISSUE ATTACH DIRECTIVE
	CAL	WAIT		/WAIT FOR COMPLETION
	LAC	EV		/CHECK EV -- OK?
	SMA
	JMP*	ATTACH		/YES -- RETURN
	JMP	ERRATT		/NO -- DECLARE ERROR
/
/ SUBROUTINE REMRES -- RESTORE LOCATION CONTENTS OR BRKPT
/
/		JMS+1 CONTAINS EITHER LAC* X11 OR LAC (420017
/		TO EITHER RESTORE CONTENTS OR BRKPT 
/
/		RETURN AT JMS+2 UNCONDITIONALLY
/
/		AC, XR, X10, X11, AND TEMP1 ARE ALTERED
/
	.IFDEF ONEPLS
REMRES	0
	LAW	-BRKSIZ		/USE TEMP1 AS A COUNTER OF TABLE ENTRIES
	DAC	TEMP1
	LAC	(BRKTAB-1	/USE X10 AS POINTER TO BRKPT ADDR TABLE
	DAC*	(X10
	AAC	BRKSIZ		/USE X11 AS POINTER TO BRKPT INST TABLE
	DAC*	(X11
REMRE1	LAC*	X10		/GET 1ST ADDR
	SNA			/IS IT ZERO?
	JMP	REMRE2		/YES -- IGNORE ENTRY
	TAD	PBASE		/NO -- PREPARE TO ACCESS LOCATION
	JMS	SETXR		/SET UP XR
	XCT*	REMRES		/XCT WORD AT JMS+1
	DAC	0,X		/STORE IT IN TASK
	SKP			/PREPARE TO TEST FOR END OF TABLE
REMRE2	LAC*	X11		/INCREMENT X11 (VALUE IS MEANINGLESS)
	ISZ	TEMP1		/END OF TABLE?
	JMP	REMRE1		/NO -- GO CHECK NEXT ENTRY
	IDX	REMRES		/YES -- PREPARE TO RETURN AT JMS+2
	JMP*	REMRES		/RETURN
	.ENDC
/
/ SUBROUTINE SETXR -- ADJUST THE XR
/
/ 		RETURN AT JMS+1 UNCONDITIONALLY
/
/		AC AND XR ARE MODIFIED
/
SETXR	0
	TAD	XRADJ		/ADD XR ADJUST. TO AC
	PAX			/STICK RESULT IN XR
	JMP*	SETXR		/RETURN
/
/ SUBROUTINE DETACH -- DETACH THE I/O DEVICE
/
/		RETURN AT JMS+1 UNCONDITIONALLY
/
/		ALL REGISTERS ARE MODIFIED
/
DETACH	0
	CAL	DET		/ISSUE DETACH DIRECTIVE
	CAL	WAIT		/WAIT FOR COMPLETION
	JMP*	DETACH		/RETURN
/
/ SUBROUTINE READ -- READ A COMMAND OR NAME LINE
/
/ 		RETURN AT JMS+1 IF NO ERRORS ARE FOUND
/
/		ALL REGISTERS ARE MODIFIED
/
READ	0
	CAL	READIT		/READ A LINE
	CAL	WAIT		/WAIT FOR COMPLETION
	LAC	EV		/CHECK EV -- OK?
	SPA			/
	JMP	ERRREA		/NO -- ERROR
	SAD	(2		/WAS TERM A CR?
	JMP*	READ		/YES -- RETURN
	LAC	(MSGBL		/NO -- END THE LINE
	JMS	PRINT
	JMP*	READ
/
/ SUBROUTINE ADRCHK -- CHECK ADDR. LEGALITY FOR NRM MODE TASKS
/
/		RETURN AT JMS+1 IF ADDR. IS OK
/		JUMP TO ERRADR IF ADDRESS IS ILLEGAL FOR THIS TASK
/
/		AC AND XR ARE ALTERED
/
ADRCHK	0
	LAC	PBADR		/PREPARE TO ACCESS PBDL NODE
	JMS	SETXR
	LAC	TEMP		/IS ADDR TOO LOW?
	AAC	-20
	SPA			/DON'T ALLOW ACCESS TO AUTOINCR REG ETC.
	JMP	ERRADR		/ERROR -- ADDR IS TOO LOW
	LAC	TEMP		/GET THE ADDRESS
	TCA			/NEGATE
	TAD	P.TS,X		/ADD SIZE OF TASK
	SPA			/ADDR<=SIZE OF PART?
	JMP	ERRADR		/NO -- ERROR
	JMP*	ADRCHK		/YES -- RETURN
	.EJECT
/
/ SUBROUTINE GETNUM -- GET AN OCTAL NUMBER
/
/		RETURN AT JMS+2 IF OK WITH TERM IN MQ AND NUMBER IN AC
/		RETURN AT JMS+1 IF ERROR WITH THE CHAR IN MQ
/
/		AC AND MQ ARE MODIFIED
/
GETNUM	0
	DAC	NTEMP		/SAVE THE CHAR
	LAW	-6		/SET DIGIT COUNTER
	DAC	NCOUNT		/IN NCOUNT
	DZM	NUM		/ZERO PREVIOUS RESULTS
	DZM	NUMFLG		/CLEAR FLAG TO SHOW NOW DIGIT YET
	LAC	NTEMP		/PICK UP THE CHAR AGAIN
	SNA			/USE THIS IF NON-ZERO
NUM1	JMS	FAC57		/GET A CHARACTER
	SAD	(40		/SPACE?
	JMP	NUMSPC		/YES
	IDX	NUMFLG		/NO -- SET FLAG TO SHOW A DIGIT WAS READ
	DAC	NUMT		/SAVE IT TEMPORARILY
	AAC	-60		/IS IT A DIGIT?
	SPA
	JMP	NUM2		/NO -- EITHER A BREAK OR AN ERROR
	DAC	NCHAR		/MAYBE -- SAVE THE POTENTIAL DIGIT
	AAC	-10
	SMA
	JMP	NUM2		/NO -- EITHER A BREAK OR AN ERROR
	LAC	NUM		/YES -- PICK UP THE REAL NUMBER
				/THAT HAS ALREADY BEEN CONSTRUCTED
	CLL
	ALS	3		/SHIFT THE CONTENTS
	TAD	NCHAR		/ADD THE DIGIT JUST READ
	DAC	NUM		/SAVE THE RESULTING DECIMAL NUMBER
	ISZ	NCOUNT		/HAVE 6 DIGITS BEEN READ?
	JMP	NUM1		/NO -- READ SOME MORE
	JMS	FAC57		/YES -- READ A BREAK CHARACTER
NUM3	LMQ			/SAVE THE TERMINATOR
NUM5	LAC	NUM		/GET THE NUMBER
	IDX	GETNUM		/PREPARE TO RETURN AT JMS+2
	JMP*	GETNUM		/RETURN
/
/ CHAR IS EITHER A BREAK OR ERROR
/
NUM2	LAC	NUMT		/PUT OFFENDING CHAR IN MQ
NUM6	LMQ
	LAW	-6		/CHARACTER IS EITHER A BREAK OR ERROR
	SAD	NCOUNT		/IF THIS WAS THE 1ST CHARACTER READ
				/ITS AN ERROR. OTHERWIZE ITS A BREAK.
	JMP*	GETNUM		/ERROR -- RETURN AT JMS+1
	JMP	NUM5		/BREAK CHAR -- PREPARE TO RETURN
/
/ CHAR IS A SPACE -- IS THIS A BREAK OR SHOULD IT BE IGNORED?
/
NUMSPC	LAC	NUMFLG		/HAS A DIGIT BEEN READ?
	SNA
	JMP	NUM1		/NO -- IGNORE THE CHAR
	LAC	(40		/YES -- RETRIEV THE BREAK CHAR (A SPACE)
	JMP	NUM6		/GO SEE IF THIS IS A REAL BREAK OR AN ERROR
/
/ LOCAL VARIABLES FOR GETNUM
/
NTEMP	0			/BUFFER FOR AC ON ENTRY
NCHAR	0			/POTENTIAL DIGIT BUFFER
NUM	0			/NUMBER BUFFER
NUMT	0			/CHARACTER SAVE BUFFER
NCOUNT	0			/DIGIT COUNTER
NUMFLG	0			/FLAG: 0 IF NOT DIGIT READ, 1 OR MORE OTHERWISE
	.EJECT
/
/
/ SUBROUTINE GETNAM -- GET AN ASCII NAME FROM TTY LINE AND ENTER
/                      THE SIXBT VERSION OF THE NAME INTO THE  
/                      LOCATIONS SPECIFIED AT JMS+1
/			RETURN AT JMS+2 ON ERRORS
/			RETURN AT JMS+3 ON OK
/
/			AC ON ENTRY HAS 1 CHAR OR 0
/			AC ON RETURN HAS BREAK CHAR
/
/			AC AND MQ ARE MODIFIED
/
GETNAM	0
	DAC	GNTEMP		/SAVE THE CHAR
	LAC*	GETNAM		/GET A POINTER TO THE NAME BUFFER
	DAC	GNCNT		/SAVE THE POINTER TEMPOR ARILY
	DZM*	GNCNT		/ZERO 1ST HALF OF NAME
	IDX	GNCNT		/INCREMENT THE POINTER
	DZM*	GNCNT		/ZERO 2ND HALF OF NAME
	LAW	-6		/SET THE CHAR. COUNT TO 6 CHARS.
	DAC	GNCNT		/SAVE IN GNCNT
	LAC	GNTEMP		/PICK UP FORMER CONTENTS OF AC
	SNA			/SKIP IF AC IS A CHAR.
GNLOC2	JMS	FAC57		/GET NEXT CHAR
	SAD	(40		/IS IT A SPACE?
	JMP	GNLOC3		/YES
	SAD	(15		/NO -- CARRIAGE RETURN?
	JMP	GNLOC3		/YES
	SAD	(175		/NO -- ALTMODE?
	JMP	GNLOC3		/YES
	SAD	(75		/NO -- EQUAL SIGN?
	JMP	GNLOC3		/YES
	AND	(77		/NO -- MASK TO 6 BITS
	DAC	GNTEMP		/SAVE THE SIXBT CHAR
	LAC	GNCNT		/DETERMINE IF THIS IS 1ST OR 2ND WORD STORE
	AAC	3
	SPA
	JMP	GNLOC5		/1ST WORD STORE
	LAC*	GETNAM		/2ND WORD STORE -- GET POINTER
	IAC			/(INCREMENT IT)
GNLOC6	DAC	GNPTR		/PTR NOW HAS ADDR OF 2ND WORD OF NAME
	LAC*	GNPTR		/PICK UP THE NAME
	CLL			/SET UP LINK FOR SHIFT
	ALS	6		/MAKE ROOM FOR NEXT CHAR
	TAD	GNTEMP		/INSERT NEXT CHAR
	DAC*	GNPTR		/STORE NAME
	ISZ	GNCNT		/HAVE SIX CHARS BEEN PROCESSED?
	JMP	GNLOC2		/NO -- GO GET THE NEXT CHAR
	JMS	FAC57		/YES -- GET THE BREAK CHAR
/
/ PREPARE TO RETURN
/
GNLOC4	IDX	GETNAM		/PREPARE TO RETURN AT JMS+2
	IDX	GETNAM
	JMP*	GETNAM		/RETURN
/
/ PREPARE TO CONSTRUCT 1ST 1/2 OF NAME
/
GNLOC5	LAC*	GETNAM		/1ST WORD STORE
	JMP	GNLOC6
/
/ A BREAK CHAR HAS BEEN READ, SO SHIFT NAME BUFFER WORDS TO SHOW
/ THAT THERE ARE NULLS ON THE END OF THE WORD
/
GNLOC3	DAC	GNTEMP		/SAVE THE BREAK
	LAW	-6		/IS THERE A CHAR IN THE NAME?
	SAD	GNCNT
	JMP	GNERR		/NO -- ERROR
	LAC	GNCNT		/YES -- SHIFT THE WORDS
	AAC	3		/CHECK IF THE 1ST OR 2ND WORD WAS PROCESSED
	SMA!CLA
	IAC			/2ND WORD SO ADD 1 TO POINTER
	TAD*	GETNAM		/SET UP A POINTER TO NAME WORD
	DAC	GNPTR		/SAVE THE POINTER
/
/ FIND OUT WHERE LAST CHAR WAS PUT AND SHIFT AS APPROPRIATE
/
	LAC	GNCNT		/GET THE CHAR COUNT
	SAD	(-5		/WAS 1 CHAR READ?
	JMP	GNLOC9		/YES -- GO SHIFT
	SAD	(-2		/NO -- WERE 4 CHARS READ?
	JMP	GNLOC9		/YES -- GO SHIFT
	SAD	(-4		/NO -- WERE 2 CHARS READ?
	JMP	GNLOC8		/YES -- GO SHIFT
	SAD	(-1		/NO -- WERE 5 CHARS READ?
	JMP	GNLOC8		/YES -- GO SHIFT
	JMP	GNLOC7		/NO -- NO SHIFT REQUIRED
/
/ SHIFT TO SHOW 2 NULLS IN NAME
/
GNLOC9	LAC*	GNPTR		/GET THE NAME WORD
	CLL			/SET UP FOR SHIFT
	ALS	14		/SHIFT IN 2 NULLS
	JMP	GNLOC0		/GO STORE RESULT
/
/ SHIFT TO SHOW 1 NULL IN NAME
/
GNLOC8	LAC*	GNPTR		/GET THE NAME WORD
	CLL			/SET UP FOR SHIFT
	ALS	6		/SHIFT IN 1 NULL
GNLOC0	DAC*	GNPTR		/STORE THE RESULT
GNLOC7	LAC	GNTEMP		/GET THE BREAK CHAR
	JMP	GNLOC4		/PREPARE TO RETURN
/
/ AN ERROR WAS FOUND -- RETURN AT JMS+1
/
GNERR	IDX	GETNAM		/PREPARE TO RETURN AT JMS+1
	JMP*	GETNAM		/RETURN
/
/ LOCAL VARIABLES FOR GETNAM
/
GNCNT	0			/CHAR COUNTER
GNTEMP	0			/TEMP STORE FOR CHAR
GNPTR	0			/POINTER TO NAME BUFFER
	.EJECT
/
/ SUBROUTINE NUMOUT -- PRINT THE CONTENTS OF AC AS AN OCTAL NUMBER
/
/			RETURN AT JMS+1 UNCONDITIONALLY
/
/			ALL REGISTERS ARE MODIFIED 
/
NUMOUT	0
	LMQ			/SAVE THE NUMBER TO BE PRINTED IN MQ
	LAW	-6		/SET UP DIGIT COUNTER
	DAC	NUMTMP		/IN NUMTMP
	DZM	OUTBUF+1	/ZERO CHECKSUM WORD IN BUFFER
	CLL			/PREPARE TO SHIFT
	LAC	(OUTBUF+1	/INIT. X10 TO OUTPUT BUFFER
	DAC*	(X10
NUMO1	CLA			/CLEAR OUT OLD RESULTS
	LLS	3		/SHIFT IN A DIGIT
	TAD	(60		/MAKE IT INTO ASCII
	DAC*	X10		/STORE IT IN BUFFER
	ISZ	NUMTMP		/HAVE WE DONE 6 DIGITS?
	JMP	NUMO1		/NO
	CAL	WRT		/YES -- WRITE OUT THE BUFFER
	CAL	WAIT		/WAIT FOR COMPLETION
	JMP*	NUMOUT		/RETURN
/
/ LOCAL VARIABLE FOR NUMOUT
/
NUMTMP	0			/DIGIT COUNTER
/
/
/ SUBROUTINE SEARCH -- SEARCH BREAK POINT TABLE FOR ADDRESS IN TEMP
/
/			RETURN AT JMS+1 IF ADDRESS NOT IN TABLE
/			RETURN AT JMS+2 IF ADDRESS FOUND WITH X11
/			SET UP TO FETCH INSTRUCTION.
/			ON ENTRY TO THIS SUBROUTINE TEMP HAS THE ADDRESS
/
/			AC AND X11 ARE MODIFIED
/
SEARCH	0
	LAC	(BRKTAB-1	/INIT X11 TO POINT TO TABLE
	DAC*	(X11
	LAW	-BRKSIZ		/SET UP THE TABLE LENGTH COUNTER
	DAC	SEAR3		/IN SEAR3
	LAC	TEMP		/SCAN DOWN THE TABLE
SEAR2	SAD*	X11		/DOES THE ADDRESS MATCH?
	JMP	SEAR1		/YES
	ISZ	SEAR3		/NO -- ARE WE AT THE END OF THE TABLE?
	JMP	SEAR2		/NO
	JMP*	SEARCH		/YES -- RETURN AT JMS+1
SEAR1	IDX	SEARCH		/PREPARE TO RETURN AT JMS+2
	LAC*	(X11		/SET UP X11 SO THE INST. CAN BE FETCHED
	TAD	(BRKSIZ-1
	DAC*	(X11
	JMP*	SEARCH		/RETURN AT JMS+2
/
/ LOCAL VARIABLE FOR SEARCH
/
SEAR3	0			/USED AS A TABLE ENTRY COUNTER
	.EJECT
/
/ SUBROUTINE GETSYM -- SEARCH SYMBOL TABLE FOR A SYMBOL AND RETURN WITH VALUE
/
/			RETURN AT JMS+1 WITH VALUE IN AC IF OK
/			AND MQ CONTAINING BREAK CHAR.
/			ON ENTRY MQ HAS 1ST CHAR OF SYMBOL
/
/			X10,MQ AND AC ARE MODIFIED
/
GETSYM	0
	DZM	GETSY1		/ZERO OLD SYMBOL NAME
	LACQ			/GET THE 1ST CHAR
	SAD	(44		/IS IT A "$"?
	JMP	ERRNUM		/YES -- THAT'S A RESERVED CHARACTER
	JMS	CR		/IS IT A TERM?
	SKP
	JMP	ERRNUM		/YES -- ERROR
	AND	(77		/NO -- MASK TO 6 BITS
	CLL			/STORE 1ST CHAR
	ALS	14		/IN BITS 0-5
	DAC	GETSY1		/OF GETSY1
	JMS	FAC57		/GET NEXT CHAR
	JMS	CR		/IS IT A TERM?
	SKP
	JMP	GETSY5		/YES -- END OF SYMBOL
	AND	(77		/NO -- MASK TO 6 BITS
	CLL
	ALS	6		/STORE 2ND CHAR.
	TAD	GETSY1		/IN BITS 6-11
	DAC	GETSY1		/OF GETSY1
	JMS	FAC57		/GET THE NEXT CHAR
	JMS	CR		/IS IT A TERM?
	SKP
	JMP	GETSY5		/YES -- END OF SYMBOL
	AND	(77		/NO -- MASK TO 6 BITS
	TAD	GETSY1		/STORE 3RD AND FINAL CHAR
	DAC	GETSY1		/IN BITS 12-17 OF GETSY1
	JMS	FAC57		/GET THE BREAK CHAR
GETSY5	LMQ			/SAVE IT IN THE MQ FOR THE RETURN
	LAC	(SYMTAB-1	/INIT X10 TO ACCESS TABLE
	DAC*	(X10
	LAW	-SYMSIZ		/SET UP THE TABLE SIZE COUNTER
	DAC	GETSY4
	LAC	GETSY1		/SEARCH THE TABLE
GETSY2	SAD*	X10		/IS IT A MATCH?
	JMP	GETSY3		/YES
	ISZ	GETSY4		/NO -- END OF TABLE?
	JMP	GETSY2		/NO
	JMP	ERRNUM		/YES -- SYMBOL NOT FOUND -- ERROR
GETSY3	LAC*	(X10		/PREPARE TO GET THE VALUE
	TAD	(SYMSIZ-1	/USE X10 AS A POINTER
	DAC*	(X10		/TO VALUE TABLE
	LAC*	X10		/PICK UP THE VALUE
	JMP*	GETSYM		/RETURN
/
/ LOCAL VARIABLES FOR GETSYM
/
GETSY1	0			/SYMBOL NAME BUFFER
GETSY4	0			/TABLE ENTRY COUNTER
/
/ SUBROUTINE CR -- TEST CHAR FOR A TERMINATOR
/
/			RETURN AT JMS+2 IF TERM
/			RETURN AT JMS+1 IF CHAR IS NOT A TERM
/
/			NO REGISTERS ARE MODIFIED
/
CR	0
	SAD	(15		/IS CHAR IN AC A CR?
	JMP	CR1		/YES -- PREPARE TO RETURN AT JMS+2
	SAD	(175		/NO -- ALTMODE?
	JMP	CR1		/YES -- PREPARE TO RETURN AT JMS+2
	SKP			/NO -- PREPARE TO RETURN AT JMS+1
CR1	IDX	CR		/INCREMENT RETURN ADDRESS
	JMP*	CR		/RETURN
	.EJECT
/
/	FAC57 IS A SET OF TWO SUBROUTINES TO GET CHARACTERS
/		FROM A LINE BUFFER IN 5/7 FORMAT AND RETURN
/		THEM TO THE CALLER.
/
/	SUBROUTINE IFAC
/
/		JMS	IFAC
/		+	LINE BUFFER ADDRESS
/
/	THIS ROUTINE MUST BE CALLED FIRST TO DEFINE THE
/	LINE BUFFER TO BE PROCESSED
/
/
/	SUBROUTINE FAC57
/
/		JMS	FAC57
/
/
/
/	THIS ROUTINE IS CALLED TO GET ONE CHARACTER
/	IT RETURNS WITH THE CHARACTER IN 7 BIT FORMAT
/	RIGHT JUSTIFIED IN THE AC.
/
/	IF A TERMINATOR IS SENSED ( 015,175) IT
/	WILL BE RETURNED ON EVERY SUBSEQUENT CALL TO FAC57
/
//////////////////////////////////////////////////////////////////////
/
/		THE AC IS MODIFIED
/
IFAC	0
	LAC*	IFAC		/GET LINE BUFFER ADDRESS(HEADER)
	AAC	2		/BUMP POINTER PAST BUFFER HEADER
	DAC	FACLBX		/SAVE RESULT 
	LAC	(FACCB+5)	/STARTS WITH END OF BUFFER
	DAC	FACCBX		/SETUP POINTERS
	ISZ	IFAC		/PREPARE TO RETURN AT JMS+2
	JMP*	IFAC		/RETURN
	.EJECT
/		
/	SUBROUTINE FAC57-- FETCH A CHARACTER FROM THE 5/7 ASCII 
/	LINE BUFFER 'FACLB' DESCRIBED BY THE POINTERS FACLBX
/	AND FACCBX.
/	CHARACTERS ARE NOT FETCHED BEYOND THE TERMINAL CHARACTER.
/
/	AC AND MQ ARE MODIFIED
/
/
FAC57	0
	LAC*	FACCBX		/FETCH THE NEXT UNPACKED CHAR
	SMA			/WAS THE CHARBUFFER EMPTY
	JMP	FAC2		/NO-- TEST FOR A TERMINAL CHARACTER
	LAC	(FACCB-1)	/YES -- REFILL FACLB FROM THE INPUT LINE
	DAC	FACCBX
	LAC*	FACLBX		/FIRST HALF OF A WORD PAIR
	ISZ	FACLBX
	LMQ
	CLA!CLL
	JMS	FACUPS		/FIRST CHAR
	JMS	FACUPS		/SECOND CHAR
	JMS	FACUPS		/FIRST 4 BITS OF THIRD CHAR
	LAC*	FACLBX		/SECOND HALF OF WORD PAIR
	ISZ	FACLBX
	LRS	17		/LAST 3 BITS OF THIRD CHAR
	XOR*	FACCBX
	DAC*	FACCBX
	CLA
	JMS	FACUPS		/FORTH CHAR
	JMS	FACUPS		/FIFTH CHAR
	LAC	(FACCB)		/RESET THE CHARACTER BUFFER INDEX
	DAC	FACCBX
	LAC*	FACCBX		/FETCH THE FIRST CHAR FROM TH BUFFER
				/OF CHARACTERS JUST FILLED
FAC2	SAD	(015)		/IF IT IS A TERMINAL CHARACTER, CARRIAGE
	JMP*	FAC57		/RETURN OR ALTMODE, RETURN WITH THE  CHAR
	SAD	(175)		/IN THE AC, BUT DO NO ALTER THE CHAR BUF INDEX
	JMP*	FAC57		/THUS REPEATED CALLS WILL GET THE SAME CHAR
	ISZ	FACCBX		/ELSE INCREMENT SAID INDEX
	JMP*	FAC57		/RETURN TO CALLER WITH CHAR IN AC
	.EJECT
/
/	SUBROUTINE FACUPS -- UNPACKING SUBROUTINE USED BY FAC57
/
/	CALLING SEQUENCE
/
/	AC AN LINK CLEAR
/	NEXT CHAR MUST BE IN
/	THE HIGH ORDER END OF THE MQ
/	FACCBX MUST POINT TO THE WORD PRECEDING
/	THE  ONE IN WHICH THE CHAR IS
/	TO BE STORED
/
/	JMS	FACUPS
/	(UNCONDITIONAL RETURN WITH FACCBX POINTING TO THE STORED
/	CHARACTER AND WITH THE AC AND LINK CLEARED)
/
/	MQ AND AC ARE MODIFIED
/
/
FACUPS	0
	LLS	7		/SHIFT THE CHAR INTO THE AC
	ISZ	FACCBX		/LOW BITS OF THIRD CHAR ARE ZERO
	DAC*	FACCBX		/BECAUSE THE LINK IS ZERO
	CLA
	JMP*	FACUPS		/RETURN TO CALLER
FACLBX	740040			/INITIALIZED TO HALT
FACCBX	740040	
FACCB	.BLOCK 5
	-1			/MARKS END OF BUFFER
	.EJECT
/
/ SUBROUTINE GDNUM -- GET AN DECIMAL NUMBER
/
/		AC HAS 1ST CHAR. ON ENTRY OR 0
/
/		RETURN AT JMS+2 IF OK WITH TERM IN MQ AND NUMBER IN AC
/		RETURN AT JMS+1 IF ERROR WITH THE CHAR IN MQ
/
/		AC AND MQ ARE MODIFIED
/
GDNUM	0
	DAC	GDNV.1		/SAVE THE CHAR
	LAW	-5		/SET DIGIT COUNTER
	DAC	GDNV.5
	DZM	GDNV.3		/ZERO PREVIOUS RESULTS
	DZM	GDNV.6		/CLEAR THE "SPACES ARE NOT BREAKS" FLAG
	LAC	GDNV.1		/PICK UP THE CHAR AGAIN
	SNA
GDN1	JMS	FAC57		/GET A CHARACTER
	SAD	(40
	JMP	GDN2
	IDX	GDNV.6		/SET THE "SPACES ARE NOT BREAKS" FLAG
	DAC	GDNV.4		/SAVE IT TEMPORARILY
	AAC	-60		/IS IT A DIGIT?
	SPA
	JMP	GDN6		/NO -- EITHER A BREAK OR AN ERROR
	DAC	GDNV.2		/MAYBE -- SAVE THE POTENTIAL DIGIT
	AAC	-12		/CHECK THE UPPER BOUND -- IS IT A DIGIT?
	SMA
	JMP	GDN6		/NO -- EITHER A BREAK OR AN ERROR
	LAC	GDNV.3		/YES -- PICK UP THE REAL NUMBER
				/THAT HAS ALREADY BEEN CONSTRUCTED
	CLL
	MUL			/MULTIPLY BY 10 DECIMAL
	12
	LACQ			/GET RESULT
	TAD	GDNV.2		/ADD THE DIGIT JUST READ
	DAC	GDNV.3		/SAVE THE RESULTING DECIMAL NUMBER
	ISZ	GDNV.5		/HAVE 5 DIGITS BEEN READ?
	JMP	GDN1		/NO -- READ SOME MORE
	JMS	FAC57		/YES -- READ A BREAK CHARACTER
GDN3	LMQ			/SAVE THE TERMINATOR
GDN4	LAC	GDNV.3
	IDX	GDNUM		/PREPARE TO RETURN AT JMS+2
	JMP*	GDNUM
GDN6	LAC	GDNV.4		/PUT OFFENDING CHAR IN MQ
GDN5	LMQ
	LAW	-5		/CHARACTER IS EITHER A BREAK OR ERROR
	SAD	GDNV.5		/IF THIS WAS THE 1ST CHARACTER READ
				/ITS AN ERROR. OTHERWIZE ITS A BREAK.
	JMP*	GDNUM		/ERROR -- RETURN AT JMS+1
	JMP	GDN4
GDN2	LAC	GDNV.6		/ARE SPACES BREAKS?
	SNA
	JMP	GDN1		/NO -- IGNORE THE SPACE
	LAC	(40		/YES -- PREPARE TO EXIT
	JMP	GDN5
GDNV.1	0			/TEMP. STORAGE FOR AC
GDNV.2	0			/STORAGE FOR THIS DIGIT
GDNV.3	0			/STORAGE FOR THE NUMBER
GDNV.4	0			/STORAGE FOR THE ASCII CHAR.
GDNV.5	0			/DIGIT COUNTER
GDNV.6	0			/"SPACES ARE NOT BREAKS" FLAG
	.TITLE *** PARTITION FITTING ROUTINE ***
 
/ THIS ROUTINE IS CALLED IN ORDER TO FIND A PARTITION FOR A MULTIACCESS
/ JOB TO RUN IN. THE PARTITION FIT ROUTINE HAS TWO INPUT ARGUMENTS:
/
/ 1. THE ADDRESS OF THE UCA.
/ 2. THE ADDRESS OF THE STL NODE
/
/ THE CALLING FORMAT IS AS FOLLOWS:
/
/ ENTER UCA ADDR INTO UCADDR
/
/
/	LAC	STLADR
/	JMS P.FIT
/	...			/ ERROR FREE RETURN.
/				/ THE ERROR FREE RETURN WILL ALWAYS BE
/				/ TAKE AT API LEVEL 5. THE CALLER MUST
/				/ PERFORM A DEBREAK PRIOR TO CALLING
/				/ THE EXECUTIVE.
/	...			/ ERROR RETURN, AC=RETURN CODE.
/
/ THE RETURN VALUES ARE:
/
/ LINK = 0 IF THE TASK IS NORMAL MODE, 1 IF EXEC MODE.
/ STL NODE CONTAINS PBDL ADDRESS.
/ AC = 0
/ API LEVEL = 5.
/ IF EXEC MODE (TO BE AN ERROR) RETURN AT API 7 WITH AC=0 AND L=1
/
/ OTHER ERROR RETURN:
/
/ AC<0 IF ERROR AND API LEVEL =7
/
/
/
/
/ THERE WILL BE A LIMITATION ON THE MAXIMUM NUMBER OF PARTITIONS WHICH
/ CAN BELONG TO THE "TDV PARTITION POOL" OF 18. THIS NUMBER MAY BE
/ CHANGED BY ALTERING THE NUMBER OF ENTRIES IN THE TABLE "P.POOL"
 
P.FIT	XX		/ ROUTINE ENTRY POINT.
 
/ COPY THE INPUT PARAMETERS FROM THE CALLER.
 
	TAD XRADJ	/ FUDGE THE STL NODE ADDRESS FOR INDEXING.
	DAC P.STL
	PAX
	LAC	UCADDR	/GET UCADDR SETUP
	TAD	XRADJ	/ADJUST FOR INDEXING
	DAC	P.XUCA	/SAVE
 
/ FIRST CHECK TO SEE IF THE TASK TO BE EXECUTED IS AN EXEC MODE
/ TASK.
 
	LAC S.EP,X	/ FETCH NORMAL/EXEC MODE INDICATOR.
	RTL		/ MOVE INDICATOR INTO SIGN BIT OF AC.
	SPA		/ EXEC MODE?
	JMP P.NORM	/ NO, NORMAL MODE.
	STL!CLA		/EXEC MODE RETURN
	JMP*	P.FIT
 
/ A NORMAL MODE TASK IS TO BE EXECUTED. THIS SECTION OF THE CODE WILL
/ BE RUN MOSTLY AT LEVEL 5 IN ORDER TO LOCK OUT SIGNIFICANT EVENT
/ RECOGNITION AND SWAPPING DURING THE FIT ALGORITHM.
 
P.NORM	LAC S.TS,X	/ FETCH TASK SIZE.
	AND (S.ETS)	/ EXTRACT TASK SIZE.
	DAC P.TSKS	/ SAVE TASK SIZE FOR LATER.
	LAC P.XUCA	/ FETCH UCA POINTER.
	PAX		/ SET UP INDEXING.
	LAC U.PSC,X	/ FETCH PARTITION SELECTION CRITERIA.
	AND (377777)	/ REMOVE GLOBAL BIT.
	SAD (P.NAME)	/ THE PARTITION IS NAMED.
	SKP		/ YES.
	JMP P.0050	/ NO
	LAC (P.PBDL)	/ FETCH DEQ HEAD.
	DAC* (R1)	/ SET UP FOR SNAM.
	LAC UCADDR	/ FETCH ABSOLUTE ADDRESS OF UCA.
	AAC U.PSC+1	/ POINT TO ADDRESS OF NAME.
	DAC* (R2)	/ SNAM NOW COMPLETELY SET UP.
	JMS* (SNAM)	/ PARTITION HAD BETTER BE FOUND.
	JMP P.ERR	/ ERROR, PARTITION HAS GONE AWAY.
	DAC P.TMP1	/ SAVE PBDL NODE ADDRESS.
	JMS	SETXR	/SETUP FOR INDEXING
	LAC P.SZ,X	/ FETCH PARTITION SIZE.
	CMA!IAC		/ MAKE NEGATIVE.
	TAD P.TSKS	/ ADD IN TASK TO BE RUN SIZE.
	SMA!SZA		/ CHECK TASK SIZE. IS PARTITION BIG ENOUGH.
	JMP P.ERR	/ PARTITION TOO SMALL.
	LAC (P.LVL5)	/ RAISE TO LEVEL 5.
	ISA
	LAC P.TC,X	//FETCH TASK CCOUNT FROM PBDL.		
	SZA		//IST THE PARTITION BUSY?>		
	JMP P.BUSY	//YES, RETURN.				
P.0047	LAC P.STL	//FETCH STL NODE ADDRESS.
	PAX		//SET UP FOR INDEXING.
	LAC P.TMP1	//FETCH PBDL NODE ADDRESS.
	.INH
	DAC S.PB,X	///ALL DONE, NODE SET UP.
	LAC S.DP,X	///FETCH FLAGS WORD.
	AND (S.EDP)	///CLEAR ALL FLAGS.
	.ENB		///ENABLE
	DAC S.DP,X	///RESTORE FLAG WORDS.
	CLL!CLA		/ CLEAR THE LINK AND THE AC.
	JMP* P.FIT	/ RETURN TO THE CALLER, EVERYTHING IS OK.
P.BUSY	DBK		/DROP TO API LEVEL 7
P.ERR	LAW	-1	/SETUP ERROR RETUNR
	CLL
	JMP*	P.FIT	/RETURN
 
/ THE PARTITION SELECTION CRITERIA WAS NOT A SPECIFIC PARTITION NAME.
/ FIGURE OUT WHETHER OR NOT IT IS A "MINIMUM SIZE" SELECTION.
 
P.0050	SAD (P.MINS)	/ IS THE SELECTION BASED ON A MINIMUM SIZE?
	SKP		/ YES.
	JMP P.0060	/ NO, MUST BE INCREMENT.
 
/ FIGURE OUT WHICH IS LARGER, TASK SIZE OR MINIMUM PARTITION SIZE.
 
	LAC U.PSC+1,X	/ FETCH PARTITION MINIMUM SIZE.
	CMA!IAC!CLL	/ MAKE IT NEGATIVE AND CLEAR THE LINK FOR LATER.
	TAD P.TSKS	/ ADD IN THE CURRENT SIZE.
	LAC P.TSKS	/ WHICH ONE SHOULD I USE?
	SNL		/ LINK = 1 => OVERFLOW TASK SIZE IS LARGER.
	LAC U.PSC+1,X	/ FETCH CURRENT SIZE.
	JMP P.0070	/ GO JOIN COMMON CODE.
 
/ LAST OPTION IS TASK SIZE PLUS DELTA.
 
P.0060	LAC P.TSKS	/ FETCH TASK SIZE.
	TAD U.PSC+1,X	/ ADD IN DELTA.
P.0070	CMA!IAC		/ MAKE TASK SIZE NEGATIVE.
	DAC P.TSKS	/ STORE NEW TASK SIZE FOR FIT ALGORITHM.
 
/ PERFORM SET UP FOR PARTITION FITTING ALGORITHM.
 
	LAC (P.POOL-1)	/ SET UP X10 FOR FILLING POOL TABLE.
	DAC* (X10)
	LAC (P.PBDL)	/ FETCH LIST HEAD POINTER.
	DAC P.TMP1	/ START COUNTER.
	LAC (377777)	/ FETCH BEST DELTA PARTITION SIZE.
	DAC P.TMP3	/ INITIAL DELTA WILL ALWAYS KICK OUT.
	DAC P.TMP4	/ INITIAL TASK USE COUNT WILL ALSO KICK OUT.
	CLLR		/ CLEAR THE LIMIT REGISTER.
	LAC (P.LVL5)
	ISA		/ RAIS TO LEVEL 5 FOR SCAN.
 
/ PERFORM PARTITION FIT. UPON EXIT THE LR WILL CONTAIN 0 IF THERE
/ WAS NO PARTITION LARGE ENOUGH TO RUN THE TASK. OTHERWISE THE LR WILL
/ CONTAIN THE BEST FITTING PARTITION BLOCK ADDRESS. IN THE CASE OF
/ MORE THAN ONE PARTITION OF THE SAME SIZE THE LR WILL CONTAIN THE
/ PARTITION BLOCK WITH THE LOWEST USE COUNT. THIS IMPLIES THAT THE
/ LOAD WILL BE LEVELED ACROSS PARTITIONS IF THEY ARE ALL BUSY.
/
/ P.TMP4 WILL CONTAIN THE USE COUNT FOR THE BEST FITTING PARTITION.
/ X10 WILL POINT TO THE LAST USED WORD IN THE POOL TABLE.
 
P.0080	LAC* P.TMP1	//GET NEXT PDBL NODE TO PROCESS.
	SAD (P.PBDL)	//DONE WITH THE LIST?
	JMP P.0100	//YES, GO SET UP PARTITION.
	DAC P.TMP1	//SAVE FOR NEXT ITERATION OF LOOP.
	JMS	SETXR	//SET UP XR FOR INDEXING
	LAC P.N1,X	//FETCH PARTITION NAME (3CHAR)
	SAD (P.TDV)	//FIRST THREE CHARACTERS TDV?
	SKP		//YES.					/(001)
	JMP P.0080	//NO, DON'T LOOK AT THIS PARTITION.
 
/ A PARTITION OF THE FORM TDV??? HAS BEEN FOUND SINCE ALL PARTITIONS
/ OF THIS FORM ARE PART OF THE POOL CHECK FOR SIZE CONSTRAINTS.
 
	LAC P.SZ,X	//FETCH PARTITION SIZE.
	TAD P.TSKS	//CALCULATE PARTITION DELTA.
	SPA		//AC >= 0 IF TASK WILL FIT.
	JMP P.0080	//TASK WON'T FIT, RUN SOMEWHERE ELSE.
	DAC P.TMP2	//SAVE DELTA FOR DELTA COMPARISON LATER.
	LAC P.TC,X	//FETCH PARTITION USE COUNT.
	SZA		//IS IT IDLE?
	JMP P.0090	//NO, GO DO BEST FIT CHECK.
 
/ AN IDLE PARTITION WHICH WILL RUN THE TASK HAS BEEN LOCATED, MAKE
/ AND ENTRY IN THE POOL TABLE FOR THIS PARTITION.
 
	LAC P.TMP2	//FETCH DELTA.
	DAC* X10	//DELTA INTO POOL TABLE.
	LAC P.TMP1	//FETCH PBDL NODE ADDRESS.
	DAC* X10	//PBDL NODE ADDRESS INTO POOL TABLE.
 
/ CHECK THE PARTITION TO SEE IF IT FITS ANY BETTER THAN THE LAST
/ FITTING PARTITION.
 
P.0090	LAC P.TMP2	//FETCH CURRENT DELTA.
	CMA!IAC		//MAKE IT NEGATIVE.
	TAD P.TMP3	//ADD IN LAST BEST DELTA.
	SPA		//IS IT AT LEAST AS GOOD?
	JMP P.0080	//NO, GO TRY NEXT PARTITION.
 
/ THE CURRENT PARTITION IS AT LEAST THE SAME SIZE AS THE PREVIOUS
/ BEST FITTING PARTITION. CHECK TO SEE IF IT IS ANY BETTER.
 
	SZA		//IS IT ANY BETTER?
	JMP P.0095	//YES, GO UPDATE BEST FITTING CELLS.
 
/ THE PARTITION LOCATED IS THE SAME SIZE AS THE PREVIOUS PARTITION.
/ SELECT THE ONE WITH THE LOWEST USE COUNT. IF THEY HAVE THE SAME
/ USE COUNT, USE THE CURRENT PARTITION.
 
	LAC P.TC,X	//FETCH USE COUNT FOR THE PARTITION.
	CMA!IAC		//MAKE IT NEGATIVE.
	TAD P.TMP4	//ADD IN THE PREVIOUS PARTITIONS USE COUNT.
	SPA		//IS IT AT LEAST AS GOOD?
	JMP P.0080	//NO, KEEP THE CURRENT BEST FITTING PARTITION.
 
/ UPDATE ALL THE BEST FITTING CELLS TO INDICATE A NEW BEST FITTING
/ PARTITION.
 
P.0095	LAC P.TC,X	//FETCH TASK USE COUNT FROM PBDL.
	DAC P.TMP4	//UPDATE TASK COUNT.
	LAC P.TMP1	//FETCH PBDL NODE ADDRESS.
	PAL		//LR HAS NEW BEST FITTING NODE ADDRESS.
	LAC P.TMP2	//FETCH NEW PARTITIONS DELTA SIZE.
	DAC P.TMP3	//UPDATE OLD PARTITIONS DELTA SIZE.
	JMP P.0080	//GO CHECK THE NEXT PARTITIONS.
 
/ PARTITION FITTING IS OVER, SELECT A PARTITION TO USE.
 
P.0100	PLA		//FETCH PBDL NODE.
	SZA		//ANY PARTITIONS LARGE ENOUGH?
	JMP P.0110	//YES.
	JMP	P.BUSY	//NO ERROR RETURN
 
/ AT LEAST ONE PARTITION WILL RUN THE JOB. CHECK TO SEE IF THE BEST
/ FITTING ONE IS IDLE.
 
P.0110	DAC P.TMP1	//SAVE PBDL NODE ADDRESS FOR COMMON CODE.
	LAC P.TMP4	//FETCH USE COUNT FOR BEST FITTING PARTITION.
	SNA		//IS IT IDLE?
	JMP P.0047	//YES, GO SET UP STL.
 
/ THE BEST PARTITION IS BUSY. SEE IF ANY PARTITION IS FREE.
 
	LAC* (X10)	//FETCH UPDATED POOL TABLE POINTER.
	SAD (P.POOL-1)	//ARE THERE ENTRIES IN THE TABLE?
	JMP	P.BUSY	//NO -- ERROR RETURN
 
/ AT LEAST ONE OTHER PARTITION IS IDLE. SCAN THE IDLE LIST FOR THE
/ BEST AVAILABLE PARTITION AND SET UP A REQUEST FOR THAT ONE.
 
P.0115	LAC (P.POOL)	//FETCH POOL BEGINNING.
	JMS	SETXR	//SET UP FOR INDEXING
	LAC* (X10)	//FETCH POINTER TO LAST USED WORD IN TABLE.
	TAD XRADJ	//SET UP LIMIT.
	PAL
	LAC (377777)	//FETCH INITIAL DELTA.
	DAC P.TMP1
P.0120	LAC 0,X		//FETCH DELTA FROM POOL TABLE.
	CMA!IAC		//MAKE IT NEGATIVE.
	TAD P.TMP1	//ADD IN CURRENT DELTA.
	SPA		//IS THE NEW DELTA SMALLER?
	JMP P.0130	//NO, ADVANCE TO NEXT TABLE ENTRY.
	LAC 0,X		//FETCH NEW DELTA.
	DAC P.TMP1	//UPDATE OLD DELTA.
	PXA		//FETCH INDEXING CONSTANT.
	DAC P.TMP2	//SAVE IT.
P.0130	AXS 2		//GO TO NEXT POOL TABLE ENTRY.
	JMP P.0120	//LOOP NOT OVER YET.
 
/ A NEW BEST FITTING ALTERNATIVE HAS NOW BEEN CHOSEN. FETCH THE
/ NODE ADDRESS FROM THE POOL TABLE AND GO JOIN COMMON CODE.
 
	LAC P.TMP2	//FETCH POINTER TO POOL TABLE ENTRY.
	PAX		//SET UP INDEXING FOR IT.
	LAC 1,X		//FETCH PBDL NODE ADDRESS.
	DAC P.TMP1	//SET UP COMMON CODE.
	JMP P.0047	//GO JOIN COMMON CODE.
	.TITLE *** ODT GLOBLE PROGRAM VARIABLES ***
/
/ *** GLOBLE PROGRAM VARIABLES
/
XRADJ	0		/XR ADJUSTMENT FACTOR
UCADDR	0		/ADDRESS OF USERS UCA
UCANUM	0		/UCA NUMBER (0,1,2,...)
STLADR	0		/USER TASKS STL NODE ADDRESS
P.TMP1	0		/PAR FIT TEMP LOC
P.TMP2	0		/PAR FIT TEMP LOC
P.TMP3	0		/PAR FIT TEMP LOC
P.TMP4	0		/PAR FIT TEMP LOC
P.TSKS	0		/PAR FIT TASK SIZE
P.XUCA	0		/XR ADJUSTED UCA ADDR
P.STL	0		/PAR FIT XR ADJUSTED STL NODE ADDR
EV	0		/EVENT VARIABLE
FINEV	0		/EVENT VARIABLE USED FOR FININS
PBADR	0		/TASK'S PBDL NODE ADDR.
PBASE	0		/TASK'S PART. BASE ADDR.
STFLAG	0		/1 IF TASK HAS BEEN STARTED, 0 IF NOT
SYMPTR	SYMTAB		/POINTER TO NEXT FREE ENTRY IN SYMBOL TABLE
VALPTR	VALTAB		/POINTER TO NEXT FREE ENTRY IN VALUE TABLE
SYMCNT	-SYMSIZ		/RUNNING COUNT OF SYMBOL TABLE ENTRIES LEFT
CMD	0		/1ST HALF OF COMMAND
	0		/2ND HALF OF COMMAND (USUALLY UNUSED)
TEMP	0		/TEMP. STORAGE
TEMP1	0
TEMP2	0
SYMBOL	0		/SYMBOL NAME (1ST HALF)
	0		/SYMBOL NAME (2ND HALF)
TIMER	0		/TIME COUNTER FOR MONITOR
SETFLG	0		/1 IF A BREAK POINT HAS BEEN SET, 0 IF NOT
TERM	0		/LINE TERMINATOR
RBPFLG	0		/1 ONLY IF THE NEWLY REMOVED BREAK POINT WAS THE
			/RESTART ADDRESS FOR CONTINUE COMMAND, 0 IF NOT.
BRKPT	0		/SET TO BREAK POINT ADDRESS ON BREAK POINTS
			/SET TO ZERO IF TASK NOT AT A BREAK POINT
	.IFDEF ONEPLS
SYMFLG	0		/SET ZERO IF OP. CODES NEED NOT BE DECODED
			/SET TO 1 IF OPEN SHOULD DECODE THEM
	.ENDC
	.TITLE *** ODT BUFFERS AND TABLES ***
/
/ *** BUFFERS AND TABLES
/
INBUFF	.BLOCK	20	/INPUT BUFFER
P.POOL	.BLOCK	2*22	/PARTITION FIT PAR LIST (18 MAX)
OUTBUF	5000		/OUTPUT BUFFER
	0
	.BLOCK	6
	40		/SPACE
	175		/ALTMODE
BRKTAB	.BLOCK BRKSIZ	/BREAK POINT LOCATION TABLE
INSTAB	.BLOCK BRKSIZ	/CONTENTS OF BREAK POINT LOCATION TABLE
SYMTAB	.BLOCK SYMSIZ	/SYMBOL NAME TABLE
VALTAB	.BLOCK SYMSIZ	/SYMBOL VALUE TABLE
CMDTBL	.SIXBT "STA"	/COMMAND DISPATCH TABLE
	.SIXBT "OPE"
	.SIXBT "SET"
	.SIXBT "CON"
	.SIXBT "REM"
	.SIXBT "DEF"
	.SIXBT "EXI"
	.SIXBT "RES"
	.SIXBT "REL"
	.IFDEF ONEPLS
	.SIXBT "DUM"
	.SIXBT "DEC"
	.SIXBT "REG"
	.ENDC
REGTB1	.SIXBT "$AC"	/REGISTER NAME TABLE (FOR 1ST HALF OF NAME)
	.SIXBT "$XR"
	.SIXBT "$MQ"
	.SIXBT "$LR"
	.SIXBT "$LI"
	.SIXBT "$X1"
	.SIXBT "$X1"
	.SIXBT "$X1"
	.SIXBT "$X1"
	.SIXBT "$X1"
	.SIXBT "$X1"
	.SIXBT "$X1"
REGTB2	0		/REGISTER NAME TABLE (FOR 2ND HALF OF NAME)
	0
	0
	0
	.SIXBT "NK@"
	.SIXBT "0@@"
	.SIXBT "1@@"
	.SIXBT "2@@"
	.SIXBT "3@@"
	.SIXBT "4@@"
	.SIXBT "5@@"
	.SIXBT "6@@"
REGTB3	P.AC		/AC -- LOCATION OF REG WITHIN PBDL NODE
	P.XR		/XR
	P.MQ		/MQ
	P.LR		/LR
	P.IC		/LINK
	X10!NEG		/X10 -- LOCATIONS NOT IN PBDL
	X11!NEG		/X11
	X12!NEG		/X12
	X13!NEG		/X13
	X14!NEG		/X14
	X15!NEG		/X15
	X16!NEG		/X16
	.IFDEF	ONEPLS
DECTAB	040000		/PDP-15 OP-CODE INSTRUCTION TABLE
	100000
	140000
	200000
	240000
	300000
	340000
	400000
	440000
	500000
	540000
	600000
	640000
	700000
MSGTAB	MSGDAC		/PDP-15 OP-CODE INSTRUCTION MESSAGE ADDRESSES
	MSGJMS
	MSGDZM
	MSGLAC
	MSGXOR
	MSGADD
	MSGTAD
	MSGXCT
	MSGISZ
	MSGAND
	MSGSAD
	MSGJMP
	MSGEAE
	MSGIOT
	.ENDC
	.TITLE *** ODT CPB'S ***
/
/ *** CPB'S
/
WAIT	20		/WAITFOR CPB
	EV		/EVENT VARIABLE ADDRESS
/
READIT	2600		/READ CPB
	EV		/EVENT VARIABLE ADDRESS
	LUN		/LOGICAL UNIT NUMBER
	2		/MODE (IOPS ASCII)
	INBUFF		/BUFFER ADDRESS
	20		/BUFFER SIZE
/
WRITE	2700		/WRITE CPB
	EV		/EVENT VARIABLE ADDRESS
	LUN		/LOGICAL UNIT NUMBER
	2		/MODE (IOPS ASCII)
	XX		/MESSAGE ADDRESS (UNDEFINED INITIALLY)
/
DET	2500		/DETACH CPB
	EV		/EVENT VARIABLE ADDRESS
	LUN		/LOGICAL UNIT NUMBER
/
ATT	2400		/ATTACH CPB
	EV		/EVENT VARIABLE
	LUN		/LOGICAL UNIT NUMBER
/
FIX	15		/FIX CPB
	EV		/EVENT VARIABLE ADDRESS
NAME1	XX		/TASK NAME (FIRST HALF, INITIALLY UNDEFINED)
NAME2	XX		/TASK NAME (SECOND HALF, INITIALLY UNDEFINED)
/
UNFIX	16		/UNFIX CPB
	EV		/EVENT VARIABLE ADDRESS
	XX		/TASK NAME (FIRST HALF, INITIALLY UNDEFINED)
	XX		/TASK NAME (SECOND HALF, INITIALLY UNDEFINED)
/
TSKNAM	25		/TASK NAME CPB
	0		/EVENT VARIABLE (NONE SPECIFIED)
	XX		/NAME BUFFER (1ST 1/2)
	XX		/NAME BUFFER (2ND 1/2)
/
MARK	13		/MARK TIME CPB
	EV		/EVENT VARIABLE ADDRESS
	1		/MARK TIME FOR 1 UNIT
	2		/THE UNIT IS A SECOND
/
WRT	2700		/WRITE CPB
	EV		/EVENT VARIABLE ADDRESS
	LUN		/LOGICAL UNIT NUMBER
	3		/MODE (IMAGE ASCII)
	OUTBUF		/OUTPUT BUFFER ADDRESS
/
REQTSK	36		/REQUEST CPB (MAPPED)
	EV		/EVENT VARIABLE ADDRESS
	XX		/TASK NAME (FIRST HALF, INITIALLY UNDEFINED)
	XX		/TASK NAME (SECOND HALF, INITIALLY UNDEFINED)
PRIOR	DFPRIO		/TASK'S RUN PRIORITY 
LUNOFF	XX		/LUN MAPPING OFFSET
/
WFFIN	20		/WAIT FOR FININS
	FINEV		/ABSOLUTE EVENT VARIABLE ADDR
/
XFRCMD	37		/TRANSFER TDV LINE BUFFER
	EV		/EVENT VARIABLE ADDRESS
	INBUFF		/INPUT BUFFER
/
FINS	34		/XQT CPB
	EV
FINAM1	XX		/FILE NAME
FINAM2	XX		/FILE NAME
	DFPRIO		/DEFAULT PRIORITY
FINLUN	XX		/LUN AND ALIAS AND MA BITS
	FINEV		/ABSOLUTE FININS EV
	XX		/UNUSED
FINUT1	.SIXBT	"USR"	/USER TASK NAME
FINUT2	XX		/USER TASK NAME
/
RQARM	1		/REQUEST AUTORM
	0
	.SIXBT	"AUT"
	.SIXBT	"ORM"
	0
/
	.IFDEF ONEPLS
CREATE	1600		/CREATE CPB
	EV		/EVENT VARIABLE ADDRESS
	FILLUN		/LOGICAL UNIT NUMBER
	CRECTA		/ADDRESS OF CREATE CONTROL TABLE
CRECTA	XX		/FILE NAME(FIRST HALF, INITIALLY UNDEFINED)
	XX		/FILE NAME(SECOND HALF, INITIALLY UNDEFINED)
	.SIXBT "DMP"	/FILE NAME EXTENSION
	XX		/FILE SIZE IN DISK BLOCKS
	0		/ACCOUNTING INFO
	0		/ACCOUNTING INFO
	1		/UPDATE INDICATOR (UPDATES ALLOWED)
	XX		/DISK UNIT AND PLATTER (INITIALLY UNDEFINED)
	XX		/DISK ADDRESS *INITIALLY UNDEFINED)
/
PUT	13100		/PUT CPB
	EV		/EVENT VARIABLE ADDRESS
	1		/LOGICAL UNIT NUMBER
	PUTCTA		/ADDRESS OF PUT CONTROL TABLE
	XX		/DEVICE CODE (INITIALLY UNDEFINED)
PUTCTA	XX		/DISK UNIT AND PLATTER (INITIALLY UNDEFINED)
	XX		/DISK ADDRESS (INITIALLY UNDEFINED)
	XX		/CORE ADDRESS (INITIALLY UNDEFINED)
	XX		/TRANSFER LENGTH (INITIALLY UNDEFINED)
/
HINF	3600		/HINF CPB
	EV		/EVENT VARIABLE ADDRESS
	FILLUN		/LOGICAL UNIT NUMBER
/
DELETE	3500		/DELETE CPB
	EV		/EVENT VARIABLE ADDRESS
	FILLUN		/LOGICAL UNIT NUMBER
	XX		/FILE NAME (FIRST HALF, INITIALLY UNDEFINED)
	XX		/FILE NAME (SECOND HALF, INITIALLY UNDEFINED)
	.SIXBT "DMP"	/FILE NAME EXTENSION
/
	.ENDC
	.TITLE *** ODT MESSAGES ***
/
/ *** MESSAGES
/
	.IFDEF ONEPLS
MEHIN	MEPUT-MEHIN/2*1000
	0
	.ASCII "HINF ERR"<15>
MEPUT	MECRE-MEPUT/2*1000
	0
	.ASCII "PUT ERR"<15>
MECRE	MSGAC-MECRE/2*1000
	0
	.ASCII "CREATE ERR"<15>
MSGAC	MSGXR-MSGAC/2*1000
	0
	.ASCII "AC:   "<175>
MSGXR	MSGMQ-MSGXR/2*1000
	0
	.ASCII "XR:   "<175>
MSGMQ	MSGLR-MSGMQ/2*1000
	0
	.ASCII "MQ:   "<175>
MSGLR	MSGLNK-MSGLR/2*1000
	0
	.ASCII "LR:   "<175>
MSGLNK	MSGCAL-MSGLNK/2*1000
	0
	.ASCII "LINK: "<175>
MSGCAL	MSGDAC-MSGCAL/2*1000
	0
	.ASCII " CAL "<175>
MSGDAC	MSGJMS-MSGDAC/2*1000
	0
	.ASCII " DAC "<175>
MSGJMS	MSGDZM-MSGJMS/2*1000
	0
	.ASCII " JMS "<175>
MSGDZM	MSGLAC-MSGDZM/2*1000
	0
	.ASCII " DZM "<175>
MSGLAC	MSGXOR-MSGLAC/2*1000
	0
	.ASCII " LAC "<175>
MSGXOR	MSGADD-MSGXOR/2*1000
	0
	.ASCII " XOR "<175>
MSGADD	MSGTAD-MSGADD/2*1000
	0
	.ASCII " ADD "<175>
MSGTAD	MSGXCT-MSGTAD/2*1000
	0
	.ASCII " TAD "<175>
MSGXCT	MSGISZ-MSGXCT/2*1000
	0
	.ASCII " XCT "<175>
MSGISZ	MSGAND-MSGISZ/2*1000
	0
	.ASCII " ISZ "<175>
MSGAND	MSGSAD-MSGAND/2*1000
	0
	.ASCII " AND "<175>
MSGSAD	MSGJMP-MSGSAD/2*1000
	0
	.ASCII " SAD "<175>
MSGJMP	MSGEAE-MSGJMP/2*1000
	0
	.ASCII " JMP "<175>
MSGEAE	MSGIOT-MSGEAE/2*1000
	0
	.ASCII " EAE "<175>
MSGIOT	MSGFPP-MSGIOT/2*1000
	0
	.ASCII " IOT "<175>
MSGFPP	MSGIND-MSGFPP/2*1000
	0
	.ASCII " FPP "<175>
MSGIND	MSGOPR-MSGIND/2*1000
	0
	.ASCII " IND "<175>
MSGOPR	MSGSTA-MSGOPR/2*1000
	0
	.ASCII " OPR "<175>
	.ENDC
MSGSTA	MSGBL-MSGSTA/2*1000
	0
	.ASCII "STATUS: "<175>
MSGBL	MSGCOL-MSGBL/2*1000
	0
	.ASCII "  "<15>
MSGCOL	MSGHDR-MSGCOL/2*1000
	0
	.ASCII ":"<175>
MSGHDR	MSGNAM-MSGHDR/2*1000
	0
	.ASCII "ODT V1B000"<15>
MSGNAM	MSGQUE-MSGNAM/2*1000
	0
	.ASCII "TASK NAME?"<175>
MSGQUE	MSGBRK-MSGQUE/2*1000
	0
	.ASCII "ODT>"<175>
MSGBRK	MEOPR-MSGBRK/2*1000
	0
	.ASCII "BRKPT AT "<175>
MEOPR	MEXQT-MEOPR/2*1000
	0
	.ASCII "ILLEGAL"<15>
MEXQT	MEEXM-MEXQT/2*1000
	0
	.ASCII "BRKPT AT XCT"<15>
MEEXM	MERER-MEEXM/2*1000
	0
	.ASCII "EXEC MODE"<15>
MERER	MEFORM-MERER/2*1000
	0
	.ASCII "READ ERR"<15>
MEFORM	MEFIX-MEFORM/2*1000
	0
	.ASCII "FORMAT ERR"<15>
MEFIX	MESYS-MEFIX/2*1000
	0
	.ASCII "FIX ERR"<15>
MESYS	MECMD-MESYS/2*1000
	0
	.ASCII "TASK NOT IN STL"<15>
MECMD	MEST-MECMD/2*1000
	0
	.ASCII "WHAT?"<15>
MEST	MEREQ-MEST/2*1000
	0
	.ASCII "ALREADY STARTED"<15>
MEREQ	MESYM-MEREQ/2*1000
	0
	.ASCII "REQ ERR"<15>
MESYM	MEBRK-MESYM/2*1000
	0
	.ASCII "TABLE FULL"<15>
MEBRK	MECON-MEBRK/2*1000
	0
	.ASCII "ALREADY DEFINED"<15>
MECON	MESEA-MECON/2*1000
	0
	.ASCII "NOT AT A BRKPT"<15>
MESEA	MEATT-MESEA/2*1000
	0
	.ASCII "NOT IN TABLE"<15>
MEATT	MEEX-MEATT/2*1000
	0
	.ASCII "ATTACH ERR"<15>
MEEX	MEADR-MEEX/2*1000
	0
	.ASCII "TASK NOT IN ATL"<15>
MEADR	MEDON-MEADR/2*1000
	0
	.ASCII "OUT OF BOUNDS"<15>
MEDON	MSGABO-MEDON/2*1000
	0
	.ASCII "TASK EXITTED"<15>
MSGABO	METDV-MSGABO/2*1000
	0
	.ASCII "ABORT TASK?"<15>
METDV	MEFIN-METDV/2*1000
	0
	.ASCII "TDV READ ERR"<15>
MEFIN	MEBSY-MEFIN/2*1000
	0
	.ASCII "FININS ERR"<15>
MEBSY	ENDMSG-MEBSY/2*1000
	0
	.ASCII "NO PARTITION AVAIL"<15>
ENDMSG=.
	.TITLE *** ODT ERROR ROUTINES ***
/
/ *** ERROR ROUTINES
/
/ INITIAL NAME ERROR
/
ERRNAM	LAC	(MEFORM
	SKP
ERRTDV	LAC	(METDV
	JMS	PRINT
	JMP	EXIT1
/
/ FATAL ERRORS
/
/	PARTITION BUSY OR UNAVAILABLE
ERRBSY	LAC	(MEBSY
	SKP
/	FININS-XQT ERROR
ERRFIN	LAC	(MEFIN
	SKP
/	TASK IS EXEC MODE
ERREXM	LAC	(MEEXM
	SKP
/	REQUEST ERROR
ERRREQ	LAC	(MEREQ
	SKP
/	FIX ERROR
ERRFIX	LAC	(MEFIX
	SKP
/	READ ERROR
ERRREA	LAC	(MERER
	SKP
/	TASK NOT IN ATL -- SYSTEM ERROR
ERREX	LAC	(MEEX
	SKP
/	TASK NOT IN STL
ERRSYS	LAC	(MESYS
	SKP
/	ATTACH ERROR
ERRATT	LAC	(MEATT
	JMS	PRINT		/PRINT ERROR MESSAGE
	JMP	EXIT
/
/ NON-FATAL ERRORS
/
	.IFDEF ONEPLS
/	HINF ERROR
ERRHIN	LAC	(MEHIN
	SKP
/	PUT ERROR
ERRPUT	LAC	(MEPUT
	SKP
/	CREATE ERROR
ERRCRE	LAC	(MECRE
	SKP
	.ENDC
/	BREAKPOINT NOT IN TABLE
ERRSEA	LAC	(MESEA
	SKP
/	REGISTERS CAN BE ONLY OPENED AT BREAK POINTS
ERROPR	LAC	(MEOPR
	SKP
/	BREAKPOINT AT XQT IS ILLEGAL
ERRXQT	LAC	(MEXQT
	SKP
/	UNRECOGNIZED COMMAND
ERRCMD	LAC	(MECMD
	SKP
/	TASK ALREADY STARTED
ERRST	LAC	(MEST
	SKP
/	ADDRESS OUT OF BOUNDS
ERRADR	LAC	(MEADR
	SKP
/	SYMBOL/BREAKPOINT TABLE FULL
ERRTAB	LAC	(MESYM
	SKP
/	BREAKPOINT ALREADY DEFINED
ERRBRK	LAC	(MEBRK
	SKP
/	TASK IS NOT AT A BREAKPOINT
ERRCON	LAC	(MECON
	SKP
/	FORMAT ERROR
ERRNUM	LAC	(MEFORM
	JMS	PRINT		/PRINT ERROR MESSAGE
	JMP	LOC0		/GO GET NEXT COMMAND
/
	.END
