Google
 

Trailing-Edge - PDP-10 Archives - bb-k345a-sb - ddb4.mac
There is 1 other file named ddb4.mac in the archive. Click here to see a list.
SUBTTL	INITILIZATION  REX SHADRICK/DVB/DRB/RWS  3-JUL-77


; THIS ROUTINE IS SET UP TO SCAN 507/601, 602 OR 603 DISK DDB
; CHAINS AND OUTPUT SOME USEFUL INFORMATION.  THIS ROUTINE IS
; SET UP TO DRIVE AN ASR33, MINIBEE, HAZELTINE 2000, HAZELTINE
; MODULAR-ONE, LSI ADM-1, LSI ADM-3, DEC VT05B, DEC VT50, DEC
; VT52 OR DEC VT61 TERMINAL.
;
; IF YOU HAVE ANY QUESTIONS, SUGGESTIONS OR COMMENTS CONTACT:
;
;		REX SHADRICK			(303)666-6581
;		INFORMATION SERVICES DIVISION
;		STORAGE TECHNOLOGY CORPORATION
;		2270 SOUTH 88TH STREET
;		LOUISVILLE  CO  80027


;SEARCH SOME UNIVERSAL FILES

	SEARCH	MACTEN	;DEC'S UNIVERSAL MACRO FILE
	SEARCH	UUOSYM	;DEC'S UNIVERSAL UUO SYMBOL FILE

	SALL		;TURN OFF THE MACRO EXPANSION


DDB.VN==600,,230

	LOC	137

.JBVER:	DDB.VN		;STORE THE VERSION NUMBER

	RELOC
SUBTTL	THE TABLE OF CONTENTS


;				SECTION				    PAGE
;
;   1.   THE REVISION HISTORY ......................................   5
;
;   2.   SUGGESTIONS FOR FUTURE IMPLEMENTATION .....................   8
;
;   3.   CONDITIONAL DEFINITIONS ...................................  10
;   3.1    CONDITIONAL ASSEMBLY DEFINITIONS ........................  10
;   3.2    CONDITIONAL VALUE DEFINITIONS ...........................  10
;
;   4.   CONSTANT DEFINITIONS ......................................  11
;   4.1    DEFINE THE AC'S USED AND THERE USAGE ....................  11
;   4.2    DEFINE THE I/O CHANNELS .................................  11
;   4.3    DEFINE THE FLAGS AND THERE USAGE ........................  12
;   4.4    DEFINE SOME MONITOR STATUS BITS .........................  13
;   4.5    DEFINE THE TYPES OF DISPLAYS SUPPORTED ..................  14
;
;   5.   MACRO DEFINITIONS .........................................  16
;   5.1    DEFINE THE .MNVAL MACRO - MONITOR TABLE VALUES ..........  16
;   5.2    DEFINE THE .TITLE MACRO - PROGRAM TITLE .................  19
;   5.3    DEFINE THE .SBTTX MACRO - THE SUBTITLE TEXT .............  19
;   5.4    DEFINE THE .PTHTX MACRO - THE PATH SUBTITLE TEXT ........  19
;   5.5    DEFINE THE .DSPTB MACRO - THE DISPLAY TABLE .............  19
;   5.6    DEFINE THE .HLPTX MACRO - THE HELP TEXT .................  20
;
;   6.   PROGRAM INITALIZATION .....................................  21
;
;   7.   THE DDB SCANNING LOOP .....................................  26
;
;   8.   MAKE THE HEADER LINE AND OUTPUT THE BUFFER ................  31
;
;   9.   THE COMMAND SCANNER .......................................  34
;   9.1    CMDWAT - GET A COMMAND FROM THE TERMINAL ................  34
;   9.2    CMDTST - GET AND TEST A COMMAND .........................  34
;   9.3    CMDERR - COMMAND ERROR ..................................  34
;   9.4    THE COMMAND DISPATCH TABLE ..............................  35
;   9.5    "-" COMMAND - DECREMENT THE DISPLAY BY ONE PAGE .........  36
;   9.6    "+" COMMAND - ADVANCE THE DISPLAY BY ONE PAGE ...........  36
;   9.7    "G" COMMAND - COMPLEMENT THE 'GOD' BIT ..................  36
;   9.8    "^C" OR "^Z" COMMAND - ABORT THE PROGRAM ................  36
;   9.9    "W" COMMAND - COMPLEMENT THE 'WHAT' BIT .................  36
;
;	** THE TABLE OF CONTENTS IS CONTINUED ON THE NEXT PAGE **
;				SECTION				    PAGE
;
;   9.10   "N" COMMAND - CHANGE THE LOGGED IN PPN TO NOT DISPLAY ...  37
;   9.11   "L" COMMAND - CHANGE THE LOGGED IN PPN TO DISPLAY .......  37
;   9.12   "F" COMMAND - CHANGE THE FILE SPEC. TO DISPLAY ..........  37
;   9.13   "J" COMMAND - CHANGE THE JOB TO DISPLAY .................  38
;   9.14   "A" COMMAND - CHANGE THE DISPLAY TO ALL DDBS ............  38
;   9.15   "H" COMMAND - THE HELP TEXT DISPLAY .....................  38
;   9.16   "K" COMMAND - KILL THE DISPLAY AND KJOB THE JOB .........  38
;   9.17   "S" COMMAND - CHANGE THE SLEEP TIME BETWEEN UPDATES .....  39
;   9.18   "$" COMMAND - UPDATE THE SCREEN THEN WAIT ...............  39
;   9.19   "D" COMMAND - CHANGE THE TYPE OF DISPLAY TO BE USED .....  39
;   9.20   "P" COMMAND - COMPLEMENT THE OUTPUT OF THE PATH BIT .....  40
;   9.21   "T" COMMAND - COMPLEMENT THE OUTPUT OF THE TITLE BIT ....  40
;   9.22   CMDFIN - SLEEP BETWEEN DDB SCANS ........................  40
;   9.23   COMNOW - DO A DDB RESCAN NOW ............................  40
;
;  10.   SUBROUTINE TO INPUT A FILE SPECIFICATION ..................  41
;
;  11.   THE INPUT SUBROUTINES .....................................  44
;  11.1    OCTIN, DECIN AND RDXIN - INPUT A NUMBER .................  44
;  11.2    WLDOCT - INPUT A WILD OCTAL NUMBER ......................  44
;  11.3    WLDSIX - INPUT A WILD SIXBIT WORD .......................  45
;
;  12.   THE OUTPUT SUBROUTINES ....................................  46
;  12.1    PPNOUT AND PPNJST - OUTPUT A PPN ........................  46
;  12.2    OCTOUT AND DECOUT - OUTPUT A NUMBER .....................  46
;  12.3    OCTJST, DECJST AND RDXJST - OUTPUT A NUMBER .............  46
;  12.4    CHROUT - OUTPUT A CHARACTER .............................  46
;  12.5    JUST - JUSTIFY TO A COLUMN ..............................  47
;  12.6    ASCOUT - OUTPUT AN ASCIZ STRING .........................  47
;  12.7    SIXOUT - OUTPUT A SIXBIT WORD ...........................  47
;  12.8    BEGLIN - SET UP A LINE TO CONTAIN DDB INFO ..............  47
;  12.9    ENDLIN - FINISH OFF AN OUTPUT LINE RIGHT ................  47
;  12.10   COMOUT - OUTPUT A COMMA .................................  48
;  12.11   CLNOUT - OUTPUT A COLON .................................  48
;  12.12   SLHOUT - OUTPUT A SLASH .................................  48
;  12.13   SPAOUT - OUTPUT A SPACE .................................  48
;  12.14   HGHOUT AND LOWOUT - OUTPUT THE SEGMENT SIZE .............  48
;  12.15   TIMOUT - OUTPUT A TIME VALUE ............................  49
;  12.16   TWOOUT - OUTPUT A TWO DIGIT NUMBER ......................  49
;  12.17   SIXJST - JUSTIFY TO COLUMN AND OUTPUT A SIXBIT WORD .....  49
;  12.18   JOBOUT - OUTPUT A JOBS STATUS ...........................  50
;  12.19   CMDOUT - BUILD THE COMMAND STRING BUFFER ................  58
;  12.20   SPCOUT - OUTPUT A FILE SPECIFICATION ....................  60
;  12.21   WPPOUT - OUTPUT A WILD PPN ..............................  60
;  12.22   WOCOUT - OUTPUT A WILD OCTAL NUMBER .....................  60
;
;	** THE TABLE OF CONTENTS IS CONTINUED ON THE NEXT PAGE **
;				SECTION				    PAGE
;
;  13.   VARIOUS USEFUL SUBROUTINES ................................  61
;  13.1    TSTABR - TEST A SIXBIT WORD FOR AN ABBBREVIATED NAME ....  61
;  13.2    TRMDSP - GET THE DEFAULT DISPLAY TYPE ...................  62
;  13.3    SETDSP - SET UP THE DISPLAY (SIZE AND TYPE) .............  64
;  13.4    SYSIN - GET A CHARACTER FOR 'SYS:DISPLA.INI' ............  64
;  13.5    ADJTIM - CONTVERT FROM NEW DATE/TIME FORMAT TO JIFFIES ..  64
;  13.6    PAGADJ - SET UP THE PAGE BOUNDARIES FOR OUTPUT ..........  65
;  13.7    SIXOCT - CONVERT SIXBIT TO OCTAL ........................  65
;  13.8    RSTTRM - RESTORE THE TERMINAL CHARACTERISTICS ...........  65
;  13.9    CLRLIN - CLEAR THE INPUT COMMAND LINE ...................  66
;  13.10   TSTEOL - TEST A CHARACTER FOR AN E-O-L CHARACTER ........  66
;
;  14.   THE DDB SCANNING SUBROUTINES ..............................  67
;  14.1    NXTDDB - GET THE NEXT DDB IN THE CHAIN ..................  67
;  14.2    FNDSTR - FIND A STRUCTURE ...............................  67
;  14.3    TSTNOT - SEE IF THIS DDB FITS THE "N" COMMAND ...........  68
;  14.4    TSTLOG - SEE IF THIS DDB FITS THE "L" COMMAND ...........  68
;  14.5    TSTFIL - SEE IF THIS DDB FITS THE "F" COMMAND ...........  68
;  14.6    TSTJOB - SEE IF THIS DDB FITS THE "J" COMMAND ...........  68
;
;  15.   THE DISPLAY ROUTINES ......................................  69
;  15.1    TRMCLR - CLEAR THE DISPLAY SCREEN .......................  69
;  15.2    TRMEOS - CLEAR TO THE END OF THE SCREEN .................  70
;  15.3    TRMEOL - CLEAR TO THE END OF THE LINE ...................  71
;  15.4    TRMHOM - HOME THE TERMINAL ..............................  72
;
;  16.   THE ERROR ROUTINES ........................................  73
;
;  17.   THE DATA AND STORAGE AREA .................................  74
SUBTTL	THE REVISION HISTORY


; EDIT	  DATE			COMMENT
;
;  ***	27-MAY-75  CHANGE THE MAJOR VERSION NUMBER FROM 4 TO 5
;
;  134	27-MAY-75  ADD SUPPORT FOR THE HAZELTINE-2000, DEC VT05B, LSI
;		   ADM-1 AND DEC VT50 TERMINALS
;
;  135	28-MAY-75  REPLACE THE MACRO '.TTYDP' WITH THE FILE
;		   'SYS:DDBDPY.INI'
;
;  136  29-MAY-75  ADD THE OPTION TO CHANGE THE DISPLAY BACK TO THE
;		   DEFAULT DISPLAY FOR THIS TERMINAL
;
;  137  29-MAY-75  LIST SPOOLED DEVICE DDBS
;
;  140   4-JUN-75  CHANGE THE TITLE LINE AND REMOVE THE "I" COMMAND
;
;  141   4-JUN-75  ADD SUPPORT FOR THE 602 MONITOR
;
;  142	 4-JUN-75  CHANGE THE OUTPUT UNDER THE 'OTH' COLUMN
;
;  143   4-JUN-75  MORE OF EDIT 141
;
;  144	 6-JUN-75  IMPROVE THE CONTROL-C (^C) INTERCEPT ROUTINE AND
;		   REMOVE THE "L" AND "T" COMMANDS
;
;  145	 6-JUN-75  MORE OF EDIT 135
;
;  146	19-SEP-75  DISPLAY THE ENTERED SPOOLED NAME (602), ALLOW "J"
;		   COMMAND IF NOT [1,2] (BUT ONLY LOOK AT THE JOB IF
;		   LOGGED IN UNDER THE SAME PROGRAMMER NUMBER) AND
;		   CHANGE THE "P" COMMAND TO THE "L" COMMAND
;
;  147	20-OCT-75  ADD THE "K" COMMAND WHICH KILL'S THE DISPLAY AND
;		   LOGOUT'S THE JOB
;
;  150  23-OCT-75  ADD A DEBUGGING AID
;
;  151   4-NOV-75  ADD SUPPORT TO DISPLAY THE ENTIRE PATH OF THE FILE
;		   BEING DISPLAYED AND ADD "P" COMMAND TO DISPLAY THIS
;		   INFORMATION
;
;  152   5-NOV-75  REWRITE SUBROUTINES 'SCAN' AND 'TSTFIL'
;
;  153   7-NOV-75  ADD SOME SMALL GOODIES AND FIX SOME MINOR BUGS
;
;  154   7-NOV-75  REWRITE SUBROUTINE 'FNDSTR' AND DISPLAY THE MOUNT
;		   COUNT
;
;	** THE REVISION HISTORY IS CONTINUED ON THE NEXT PAGE **
; EDIT	  DATE			COMMENT
;
;  155  10-NOV-75  DISPLAY THE CURRENT COMMAND STRING BEING PROCESSED
;
;  156  10-NOV-75  ALLOW A SPACE BETWEEN COMMANDS
;
;  157  18-NOV-75  MAKE THE "K" COMMAND RESTORE THE LINE CHARACTERISTICS
;		   BEFORE THE RUN UUO IS EXECUTED
;
;  160   5-DEC-75  CHANGE THE "J" COMMAND TO DISPLAY MORE INFORMATION
;		   ABOUT THE JOB
;
;  161  10-DEC-75  MORE OF EDIT 160
;
;  162  10-DEC-75  REMOVE 506 SUPPORT (TOO MANY QUESTIONABLE SYMBOLS)
;		   AND DON'T ALLOW SUBJOBS TO RUN DDBDPY
;
;  163  12-DEC-75  ADD DEC VT52 SUPPORT AND DON'T ALLOW THE TITLE
;		   BUFFER TO OVERFLOW
;
;  164  18-DEC-75  REPLACE THE ALLOCATED LENGTH BY THE UNIT STATUS
;		   (I.E. IDLE, SEEK, SEEK WAIT, POSITION, ...) AND
;		   THE LOOKUP COUNT
;
;  165  23-DEC-75  REENABLE THE OLD "T" COMMAND  (COMPLEMENT THE OUTPUT
;		   OF THE TITLE LINE), GET THE JIFFIES PER SECOND FROM
;		   THE MONITOR AND DO ONE UPDATE AND PAUSE ON AN ESCAPE
;
;  166  21-JAN-76  MORE OF EDIT 165 - TIMOUT WAS OUTPUTTING THE PARTS
;		   OF A SECOND INCORRECTLY
;
;  167  25-JAN-76  CORRECT THE CORE SIZE OF A JOB ON A VM MONITOR
;
;  170  19-MAR-76  PUT THE ALLOCATED LENGTH BACK AND FIX THE SIX
;		   DIGIT PPN PROBLEM
;
;  171  24-MAR-76  UNDER THE 'OTH' COLUMN OUTPUT AN 'I' FOR INPUT WAIT
;		   OR AN 'O' FOR OUTPUT WAIT AND CLEAR THE TERMINAL
;		   INPUT BUFFER ON A 'K' COMMAND
;
;  172  26-MAR-76  FIX THE HAZELTINE CLEAR TO THE END-OF-SCREEN ROUTINE
;
;  173   5-APR-76  CHANGE THE SLEEP TIME AFTER 10 SCANS
;
;  174  21-APR-76  MOVE OF EDIT 173
;
;  175  28-APR-76  ALLOW LOWER CASE COMMANDS
;
;  176   4-MAY-76  ADD SUPPORT FOR THE HAZELTINE "MODULAR ONE"
;
;  177  17-MAY-76  SEARCH MACTEN AND UUOSYM INSTEAD OF C
;
;  200  28-JUN-76  ALLOW A TAB AS A BREAK CHARACTER BETWEEN COMMANDS
;
;	** THE REVISION HISTORY IS CONTINUED ON THE NEXT PAGE **
; EDIT	  DATE			COMMENT
;
;  201  28-JUN-76  ADD THE RESCAN CODE
;
;  202  11-AUG-76  DO A LITTLE MORE CODE CLEAN UP
;
;  203   1-SEP-76  ALLOW ONLY PRIVILEGED USERS TO RUN DDBDPY AND MORE
;		   OF EDIT 201
;
;  204  15-OCT-76  ADD SUPPORT FOR THE 603 MONITOR, ADD SUPPORT FOR
;		   THE LSI ADM-3 AND DEC VT61 TERMINALS, AND IMPROVE
;		   EDIT 173
;
;  205  26-OCT-76  IMPROVE THE DDB TO OUTPUT CODE
;
;  206  30-NOV-76  CHANGE THE DEFAULT PPN SPECIFICATION FOR THE
;		   F, J AND L COMMANDS:
;			[OPR]	->  [*,*]
;		      [NON-OPR] -> [*,PRG]
;
;  207  22-FEB-77  DON'T CLEAR THE TERMINAL INPUT BUFFER ON A "^Z"
;		   OR "^C" AND CLEAR TO THE END OF THE COMMAND LINE
;		   ON "K" COMMAND
;
;  210  22-FEB-77  MORE OF EDIT 204 (603 MONITOR SUPPORT)
;
;  211  23-FEB-77  CHANGE THE FILE SPECIFICATION FOR THE 'INI' FILE,
;		   'SYS:DDBDPY.INI' -> 'SYS:DISPLA.INI'
;
;  212  10-MAR-77  ALLOW DDBDPY TO RUN AS A SUBJOB, BUT NOT A BATCH
;		   OR MIC SUBJOB.
;
;  213  14-MAR-77  ADD A LITTLE 2741 SUPPORT, ALLOW "<" AND ">" AROUND
;		   THE PPN SPECIFICATION
;
;  214   6-MAY-77  OUTPUT AN 'S' IF THE STRUCTURE IS MOUNTED SINGLE
;		   ACCESS, IN THE HEADER, AND CHANGE 'RD' TO 'RED' AND
;		   'WT' TO 'WRT', IN THE JOB DISPLAY
;
;  215   6-MAY-77  PUT IN A CHECK FOR A NULL STRUCTURE NAME
;
;  216  13-MAY-77  ADD A THIRD LINE TO THE JOB DISPLAY
;
;  217  18-MAY-77  CHANGE LSI AND LSI3 TO ADM1 AND ADM3 RESPECTIVELY,
;		   TO BE CONSISTENT WITH TECO %124
;
;  220  19-MAY-77  FIX A BUG IN THE PATH MODE OUTPUT
;
;  221  20-MAY-77  OUTPUT THE USER'S ACTIVE SEARCH LIST ON A 'J' COMMAND
;
;  222  20-MAY-77  ADD SUPPORT FOR THE NODE/LINE CONVENSION IN
;		   'DISPLA.INI'
;
;	** THE REVISION HISTORY IS CONTINUED ON THE NEXT PAGE **
; EDIT	  DATE			COMMENT
;
;  223  24-MAY-77  ON THE JOB DISPLAY OUTPUT EVENT WAIT CODES:
;			TK - (1) TAPE KONTROLLER WAIT
;			TR - (2) TAPE REWIND WAIT
;			LP - (3) LABEL PROCESSING WAIT
;			NW - (4) NETWORK WAIT
;			IP - (5) IPCF SYSTEM PROCESS RECEIVE WAIT
;			FI - (6) FRONT END DEVICE INPUT WAIT
;			FO - (7) FRONT END DEVICE OUTPUT WAIT
;			D6 - (10) DAS60 DEVICE WAIT
;
;  224  26-MAY-77  ON THE JOB DISPLAY OUTPUT THE SMALLER OF THE TWO,
;		   FREE ON THE STRUCTURE OR LOGIN QUOTA
;
;  225   2-JUN-77  ON START-UP ALWAYS RESET THE SLEEP TIME AFTER 10
;		   SCANS
;
;  226   2-JUL-77  SEARCH STCMAC TO GET THE $VRSN AND $TITLE MACROS
;
;  227   3-JUL-77  ADD THE "N" COMMAND, DISPLAY JOBS NOT LOGGED-IN
;		   UNDER THIS PPN, THE DEFAULT PPN IS THE USER'S
;
;  ***   3-JUL-77  CHANGE THE MAJOR VERSION NUMBER FROM 5 TO 6
SUBTTL	SUGGESTIONS FOR FUTURE IMPLEMENTATION


;    DATE			SUGGESTION
;
;  27-MAY-75  OUTPUT THE DDBS IN ORDER OF OLDEST TO NEWEST
;
;  10-DEC-75  ADD SPLIT SCREEN SUPPORT (THE UPPER HALF IS FOR DDBDPY
;	      AND THE LOWER HALF IS FOR AN INTERACTIVE SUBJOB)
;
;  24-MAR-76  OUTPUT DDBS THAT ARE DOING SUPER-MODE I/O
;
;  28-APR-76  ON VT50, VT52 AND VT61 TERMINALS CLEAR TO THE E-O-L
;	      INSTEAD OF CLEARING THE LINE THEN TYPING THE DATA
;
;  22-FEB-77  ADD SUPPORT TO SCAN 'SWITCH.INI'
;
;  22-FEB-77  ADD SUPPORT FOR ERSATZ DEVICES
SUBTTL	CONDITIONAL DEFINITIONS


;DEFINE SOME CONDITIONAL ASSEMBLY VALUES

	ND	FTESCAPE,-1	;NON-ZERO TO UPDATE THE SCREEN THEN PAUSE
	ND	FTRESCAN,-1	;NON-ZERO TO SUPPORT RESCAN FEATURE
	ND	FTMOUNT,-1	;NON-ZERO TO DISPLAY THE MOUNT COUNT
	ND	FTTITLE,-1	;NON-ZERO TO ALLOW COMPLEMENT OF THE TITLE
	ND	FTSLEEP,-1	;NON-ZERO TO ADJUST THE SLEEP TIME
	ND	FTSPACE,-1	;NON-ZERO TO ALLOW A SPACE BETWEEN COMMANDS
	ND	FTSPOOL,-1	;NON-ZERO TO DISPLAY THE ENTERED SPOOLLED NAME
	ND	FTDEBUG,0	;NON-ZERO TO ALLOW A DEBUGGING AID
	ND	FTPATH,-1	;NON-ZERO TO DISPLAY THE ENTIRE PATH OF A FILE
	ND	FTWHAT,-1	;NON-ZERO TO DISPLAY THE CURRENT COMMAND STRING
	ND	FTPRIV,0	;NON-ZERO TO CHECK PRIVILEGES TO RUN DDBDPY
	ND	FTPROG,-1	;NON-ZERO TO MAKE PROGRAMMER NUMBER MATCH
	ND	FTPROJ,0	;NON-ZERO TO MAKE PROJECT NUMBER MATCH
	ND	FTJOB,-1	;NON-ZERO TO SUPPORT THE FANCY JOB DISPLAY
	ND	FTVM,-1		;NON-ZERO TO SUPPORT VIRTUAL MEMORY MONITORS


;DEFINE SOME CONDITIONAL VALUES

	ND	MONVER,700	;THE VERSION OF THE MONITOR DDBDPY WILL
				; RUN UNDER
	ND	PDLSIZ,^D20	;THE DEFAULT SIZE OF THE PUSH DOWN LIST
	ND	PATSIZ,^D50	;THE DEFAULT PATCH SIZE WHEN DEBUGGING
	ND	DEFHIB,^D20000	;THE DEFAULT HIBERNATE TIME BETWEEN SCANS
	ND	PASWRD,'RIPE  '	;THE PASSWORD FOR THE 'G' COMMAND
	ND	MAXSTR,^D4	;THE DEFAULT NUMBER OF STRUCTURES TO BE
				; TYPED ON THE TITLE LINE
	ND	SLPSCN,^D10	;THE SLEEP TIME COUNTER
	ND	SLPMIN,^D30000	;THE MINIMUM SLEEP TIME WITHOUT ADJUSTMENT
	ND	SLPADJ,^D30000	;THE NEW SLEEP TIME AFTER ADJUSTMENT
	ND	SLPPTY,^D60000	;THE SLEEP TIME ON A PTY
	ND	DEFTRM,%V52TP	;THE DEFAULT TERMINAL DISPLAY
	ND	MAXLIN,^D26	;THE DEFAULT MAXIMUM NUMBER OF LINES
	ND	WHTSIZ,^D11	;THE DEFAULT COMMAND STRING BUFFER
	ND	LINSIZ,^D15	;THE DEFAULT LINE SIZE (5 CHAR PER WORD)
	ND	BUFSIZ,<LINSIZ*<MAXLIN-1>>  ;THE SIZE THE LINE BUFFER
SUBTTL	CONSTANT DEFINITIONS


;DEFINE THE ACCUMULATORS

	F=0	;FLAGS
	T1=1	;TEMPORARY AC
	T2=2	;TEMPORARY AC
	T3=3	;TEMPORARY AC
	T4=4	;TEMPORARY AC
	T5=5	;TEMPORARY AC
	P1=6	;HOLDS THE CURRENT DISPLAY TYPE		(PERMANENT AC)
	P2=7	;HOLDS THE LINK TO THE CURRENT DDB	(PERMANENT AC)
	P3=10	;HOLDS THE LINK TO THE CURRENT ACC	(PERMANENT AC)
		; OR THE LINK TO THE CURRENT PDB  (JOB DISPLAY)
	P4=11	;HOLDS THE LINK TO THE CURRENT AKB	(PERMANENT AC)
		; OR THE LINK TO THE CURRENT NMB
		; OR THE LINK TO THE CURRENT STR
		; OR THE JOB STATUS		  (JOB DISPLAY)
	P5=12	;HOLDS THE LINK TO THE CURRENT PPB	(PERMANENT AC)
		; OR THE JOB OR SEGMENT NUMBER	  (JOB DISPLAY)
	C=13	;HOLDS A CHARACTER
	CC=14	;HOLDS THE COLUMN COUNT
	LC=15	;HOLDS THE LINE COUNT
	BP=16	;HOLDS A BYTE POINTER
	P=17	;HOLDS THE PUSH DOWN POINTER


;DEFINE AN I/O CHANNEL TO THE TTY AND TO THE DISK

	SYS==16		;I/O CHANNEL TO SYS
	TTY==17		;I/O CHANNEL TO THE TTY
;DEFINE SOME PERMANENT FLAGS FOR 'F' (LEFT HALF)

	F.PTH==1B0	;IF ON, DISPLAY THE ENTIRE PATH (SIGN BIT)
	F.HLP==1B1	;IF ON, GIVE A HELP TEXT
	F.INI==1B2	;IF ON, THE PROGRAM HAS BE INITALIZED
	F.WLD==1B3	;IF ON, CHECK FOR A EVENT TO OCCUR
	F.GOD==1B4	;IF ON, THE JOB IS PRIVILEGED
	F.CLR==1B5	;IF ON, CLEAR THE SCREEN BEFORE THIS SCAN
	F.DDT==1B6	;IF ON, DDT IS LOADED AND DON'T DO SOME GOODIES
	F.WHT==1B7	;IF ON, DISPLAY THE CURRENT COMMAND BEING PROCESSED
	F.PAG==1B8	;IF ON, THIS CPU USES PAGES
	F.VMS==1B9	;IF ON, THIS IS A VIRTUAL MEMORY SYSTEM
	F.JOB==1B10	;IF ON, USING JOB DISPLAY MODE
	F.PAS==1B11	;IF ON, IN PASS ONE OF THE JOB DISPLAY
	F.SRH==1B12	;IF ON, IT IS TIME TO OUTPUT THE SEARCH LIST
	F.TTL==1B13	;IF ON, DON'T OUTPUT THE TITLE LINE
	F.ESC==1B14	;IF ON, DO AN UPDATE AND THEN PAUSE
	F.RES==1B15	;IF ON, WE ARE IN RESCAN MODE


;DEFINE SOME TEMPORARY FLAGS FOR 'F' (RIGHT HALF)

	F.NOD==1B18	;IF ON, NODE NAME SEEN
	F.DEV==1B19	;IF ON, DEVICE NAME SEEN
	F.FIL==1B20	;IF ON, FILE NAME SEEN
	F.EXT==1B21	;IF ON, EXTENSION WAS SEEN
	F.PPN==1B22	;IF ON, PPN WAS SEEN
	F.AST==1B23	;IF ON, ASTRISK WAS SEEN
	F.DIG==1B24	;IF ON, A DIGIT HAS BEEN OUTPUT
	F.NEG==1B25	;IF ON, A NEGATIVE SIGN MUST BE OUTPUT
	F.LOW==1B26	;IF ON, GET GET THE LOW SEGMENT SIZE
	F.DCT==1B27	;IF ON, DON'T CLEAR THE TERMINAL INPUT BUFFER
	F.STR==1B28	;IF ON, OUTPUT A SPACE BEFOR THE STRUCTURE NAME
;DEFINE SOME STATUS BITS ABOUT THE JOB OR SEGMENT

	JS.RUN==1B0	;THE JOB IS RUNNABLE
	JS.CMW==1B1	;THE JOB IS IN A COMMAND WAIT
	JS.JNA==1B3	;THE JOB NUMBER IS ASSIGNED
	JS.LOK==1B5	;THE JOB IS LOCKED IN CORE
	JS.SWP==1B7	;THE JOB IS SWAPPED
	JS.NSH==1B8	;THE JOB CAN'T BE SHUFFLED
	JS.CLK==1B18	;THE JOB HAS A CLOCK REQUEST
	JS.JDC==1B20	;THE JOB IS IN A DAEMON WAIT
	JS.DCE==1B22	;THE JOB IS WAITING FOR A DEVICE TO CONTINUE
	JS.SFL==1B33	;THE JOB WILL PAUSE ON A DISK FULL CONDITION

	SS.SNA==1B0	;THE SEGMENT NUMBER IS ASSIGNED
	SS.SHR==1B1	;THE HIGH SEGMENT IS SHARABLE


;DEFINE SOME CUSTOMER PRIVILEGE BITS

	JP.DPY==1B34	;THE USER HAS PRIVILEGES TO RUN DDBDPY
	JP.PAS==1B35	;THE USER CAN'T CHANGE HER PASSWORD
;DEFINE THE TYPE OF TERMINALS DDBDPY KNOWS ABOUT

	%AD1TP==0			;LSI ADM-1 TERMINAL
		%AD1SZ==^D24		;NUMBER OF LINES PER SCREEN
		%AD1LD==33		;THE LEAD IN CHARACTER
		%AD1HM==36		;HOME THE CURSER
		%AD1ES==131		;CLEAR TO END OF THE SCREEN
		%AD1EL==124		;CLEAR TO END OF THE LINE

	%AD3TP==1			;LSI ADM-3 TERMINAL
		%AD3SZ==^D24		;NUMBER OF LINES PER SCREEN
		%AD3CL==32		;CLEAR THE SCREEN

	%ASRTP==2			;ASR-33 TERMINAL
		%ASRSZ==^D19		;NUMBER OF LINES PER PAGE

	%HZLTP==3			;HAZELTINE-2000 TERMINAL
		%HZLSZ==^D26		;NUMBER OF LINES PER SCREEN
		%HZLHP==^D68		;CLEAR THRU COLUMN 68
		%HZLLD==176		;THE LEAD IN CHARACTER
		%HZLCL==34		;CLEAR THE SCREEN
		%HZLHM==22		;HOME THE CURSER
		%HZLDL==23		;DELETE A LINE

	%MBETP==4			;MINI-BEE TERMINAL
		%MBESZ==^D25		;NUMBER OF LINES PER SCREEN
		%MBELD==33		;THE LEAD IN CHARACTER
		%MBECL==105		;CLEAR THE SCREEN
		%MBEHM==110		;HOME THE CURSER
		%MBEES==112		;CLEAR TO END OF THE SCREEN
		%MBEEL==113		;CLEAR TO END OF THE LINE

	%MDLTP==5			;MODULAR ONE TERMINAL
		%MDLSZ==^D24		;NUMBER OF LINES PER SCREEN
		%MDLHP==^D68		;CLEAR THRU COLUMN 68
		%MDLLD==176		;THE LEAD IN CHARACTER
		%MDLCL==34		;CLEAR THE SCREEN
		%MDLHM==22		;HOME THE CURSER
		%MDLDL==23		;DELETE A LINE


;	** THE TYPE OF TERMINALS IS CONTINUED ON THE NEXT PAGE **
	%V5BTP==6			;DEC VT05B TERMINAL
		%V5BSZ==^D20		;NUMBER OF LINES PER SCREEN
		%V5BHM==35		;HOME THE CURSER
		%V5BES==37		;CLEAR TO END OF THE SCREEN
		%V5BEL==36		;CLEAR TO END OF THE LINE

	%V50TP==7			;DEC VT50 TERMINAL
		%V50SZ==^D12		;NUMBER OF LINES PER SCREEN
		%V50LD==33		;THE LEAD IN CHARACTER
		%V50HM==110		;HOME THE CURSER
		%V50ES==112		;CLEAR TO END OF THE SCREEN
		%V50EL==113		;CLEAR TO END OF THE LINE

	%V52TP==10			;DEC VT52 TERMINAL
		%V52SZ==^D24		;NUMBER OF LINES PER SCREEN
		%V52LD==33		;THE LEAD IN CHARACTER
		%V52HM==110		;HOME THE CURSER
		%V52ES==112		;CLEAR TO END OF THE SCREEN
		%V52EL==113		;CLEAR TO END OF THE LINE

	%V61TP==11			;DEC VT61 TERMINAL
		%V61SZ==^D24		;NUMBER OF LINES PER SCREEN
		%V61LD==33		;THE LEAD IN CHARACTER
		%V61HM==110		;HOME THE CURSER
		%V61ES==112		;CLEAR TO END OF THE SCREEN
		%V61EL==113		;CLEAR TO END OF THE LINE
SUBTTL	MACRO DEFINITIONS -- .MNVAL


IFN <<MONVER-507>*<MONVER-601>*<MONVER-602>*<MONVER-603>*<MONVER-700>>,<
	$ERROR	?,NSM,NOT A SUPPORTED MONITOR BY DDBDPY >

DEFINE	.MNVAL($SYM,$601,$602,$603,$700)<

	IFE <<MONVER-507>*<MONVER-601>>,<
		$SYM==$601 >

	IFE <MONVER-602>,<
		$SYM==$602 >

	IFE <MONVER-603>*<MONVER-700>,<
		$SYM==$603 >
	IFE <MONVER-700>,<
		$SYM==$700 >>

NS==-1		;** NO SUCH SYMBOL IN THIS MONITOR **


; DEFINE SOME VALUES USED BY DDBDPY IN THE DDB (DEVICE DATA BLOCK)

	.MNVAL	DEVNAM,0,0,0,0 	;THE DEVICE NAME IN SIXBIT
	.MNVAL	DEVCHR,1,1,1,1 	;THE DEVICE CHARACTERISTICS (JOB NUMBER BITS 0-6)
	.MNVAL	DEVIOS,2,2,2,2 	;THE INPUT/OUTPUT STATUS
		.MNVAL	IOSIO,20,20,20,20	;OUTPUT WAIT
		.MNVAL	IOSIOW,1,1,1,1 	;INPUT/OUTPUT WAIT
	.MNVAL	DEVSER,3,3,3,3 	;THE LINK TO THE NEXT DDB (LH)
	.MNVAL	DEVMOD,4,4,4,4 	;THE DEVICE CHARACTERISTICS (CHAR.,,MODES)
	.MNVAL	DEVSPL,12,12,12,12	;THE SPOOL BIT FOR THIS DDB
	.MNVAL	DEVPAL,NS,NS,13,13	;THE PRE-ALLOCATION WORD
		.MNVAL	DEPPAL,NS,NS,20,20	;PRE-ALLOCATED (BIT 31 603)
	.MNVAL	DEVJOB,NS,16,20,21	;THE JOB NUMBER (BITS 27-35 602)
	.MNVAL	DEVFIL,16,17,21,22	;THE FILE NAME IN SIXBIT
	.MNVAL	DEVEXT,17,20,22,23	;THE FILE EXTENSION IN SIXBIT (LH)
	.MNVAL	DEVREL,23,24,26,32	;THE RELATIVE BLOCK IN THE FILE TO READ OR WRITE
	.MNVAL	DEVUNI,24,25,27,33	;THE LINK TO THE UNIT DATA BLOCK (RH)
	.MNVAL	DEVSFD,26,27,31,35	;THE LINK TO THE FATHER SFD (RH)
	.MNVAL	DEVBLK,27,30,32,36	;THE LOGICAL BLOCK IN THE UNIT TO READ OR WRITE
	.MNVAL	DEVACC,30,31,33,37	;THE LINK TO THE ACCESS BLOCK (RH)
	.MNVAL	DEVPRI,35,36,40,45	;THE DISK PRIORITY (BITS 27-29)
	.MNVAL	DEVSPN,NS,37,41,46	;THE ENTERED SPOOLED NAME (602)


;	** THE MONITOR TABLE DEFINITIONS ARE CONTINUED ON THE NEXT PAGE **
; DEFINE SOME VALUES USED BY DDBDPY IN THE TTY DDB

	.MNVAL	DDBLDB,16,17,21,22	;THE LINK TO THE LINE DATA BLOCK (RH)
	.MNVAL	DDBICC,NS,NS,22,NS	;THE INPUT CHARACTER COUNT
	.MNVAL	DDBOCC,NS,NS,23,NS	;THE OUTPUT CHARACTER COUNT
	.MNVAL	DDBBCC,NS,NS,24,25	;THE COMMANDS TYPE (LH) AND
				; THE INPUT WAKEUP'S (RH)


; DEFINE SOME VALUES USED BY DDBDPY IN THE NMB (FILE NAME DATA BLOCK)

	.MNVAL	NMBNAM,0,0,0,0 	;THE NAME OF SFD IN SIXBIT
	.MNVAL	NMBPPB,1,1,1,1 	;THE LINK TO THE FATHER SFD (LH)
		.MNVAL	NMPUPT,2,2,2,2 	;THE SFD NAME IS IN NMBNAM (BIT)


; DEFINE SOME VALUES USED BY DDBDPY IN THE ACC (ACCESS DATA BLOCK)

	.MNVAL	ACCAKB,0,NS,NS,NS	;THE LINK TO THE SECOND ACCESS BLOCK (LH)
				; THE LINK TO THE PROJ-PROG BLOCK (RH)
	.MNVAL	ACCALC,NS,0,0,0 	;THE BLOCKS ALLOCATED TO THIS FILE (602)
	.MNVAL	ACCPPB,NS,4,4,4 	;THE LINK TO THE PROJ-PROG BLOCK (RH 602)
	.MNVAL	ACCSTS,1,5,5,5 	;THE FILE STATUS (RH)
		.MNVAL	ACPREN,40,200,200,200  ;A RENAME UUO IN PROGRESS (BIT)
		.MNVAL	ACPDEL,20,100,100,100  ;THE FILE MARKED FOR DELETION (BIT)
		.MNVAL	ACPSMU,NS,4,4,4      ;SIMULTANEOUS UPDATE (BIT 602)
	.MNVAL	ACCWRT,2,6,6,6 	;THE BLOCKS WRITTEN IN THE FILE
	.MNVAL	ACCDOR,3,3,3,3 	;THE LIST LINK WORD (IF ZERO, ACCESS IS NOT
				; DORMANT)


; DEFINE SOME VALUES USED BY DDBDPY IN THE AKB (SECOND ACCESS BLOCK)

	.MNVAL	AKBALC,0,NS,NS,NS	;THE BLOCKS ALLOCATED TO THIS FILE


; DEFINE SOME VALUES USED BY DDBDPY IN THE PPB (PROJ-PROG BLOCK)

	.MNVAL	PPBNAM,0,0,0,0 	;PROJECT NUMBER,,PROGRAMMER NUMBER
	.MNVAL	PPBSYS,NS,NS,1,1	;LINK TO THE NEXT PPB (LH)
	.MNVAL	PPBUFB,NS,NS,2,2	;LINK TO THE UFB'S FOR THIS PPN (LH)


; DEFINE SOME VALUES USED BY DDBDPY IN THE UFB (USER FILE DIRECTORY BLOCK)

	.MNVAL	UFBTAL,NS,NS,0,0 	;PROJECT NUMBER,,PROGRAMMER NUMBER
	.MNVAL	UFBPPB,NS,NS,1,1	;LINK TO THE NEXT UFB (LH)
	.MNVAL	UFBFSN,NS,NS,4,4	;THE FILE STRUCTURE NUMBER (BITS 0-5)


;	** THE MONITOR TABLE DEFINITIONS ARE CONTINUED ON THE NEXT PAGE **
; DEFINE SOME VALUES USED BY DDBDPY IN THE UNI (UNIT DATA BLOCK)

	.MNVAL	UNINAM,0,0,0,0 	;THE UNIT NAME (I.E. RPA0)
	.MNVAL	UNISTR,4,4,4,4 	;THE LINK TO THE FILE STRUCTURE DATA BLOCK (RH)


; DEFINE SOME VALUES USED BY DDBDPY IN THE STR (FILE STRUCTURE DATA BLOCK)

	.MNVAL	STRNAM,0,0,0,0 	;THE FILE STRUCTURE NAME IN SIXBIT
	.MNVAL	STRFSN,1,1,1,1	;THE FILE STRUCTURE NUMBER (RH)
	.MNVAL	STRSYS,1,1,1,1 	;THE LINK TO THE NEXT FILE STRUCTURE (LH)
	.MNVAL	STRTAL,11,11,11,11	;THE NUMBER OF FREE BLOCKS
	.MNVAL	STRMNT,13,13,13,13	;THE MOUNT COUNT FOR THIS STRUCTURE
	.MNVAL	STRJOB,20,20,20,20	;THE SINGLE ACCESS JOB


;DEFINE SOME VALUES USED BY DDBDPY IN THE NDB (NETWORK DATA BLOCK)

	.MNVAL	NDBNNM,NS,NS,0,0	;THE NODE NUMBER (LH)
				;THE LINK TO THE NEXT NDB (RH)
	.MNVAL	NDBSNM,NS,NS,2,2	;THE POINTER TO THE NODE NAME (LH)
	.MNVAL	SCBOPR,NS,NS,17,17	;THE POINTER TO THE OPR'S LDB (RH)


;DEFINE SOME VALUES USED BY DDBDPY IN THE LDB (LINE DATA BLOCK)

	.MNVAL	LDBDCH,15,16,16,23	;THE TERMINAL CHARACTERISTIC BITS
		.MNVAL	LDRPTY,1B18,1B18,1,1B18  ;THE TERMINAL IS A PTY
		.MNVAL	LDRREM,NS,NS,1,1B31      ;THE TERMINAL IS REMOTE
	.MNVAL	LDBREM,NS,NS,23,32	;THE REMOTE LINE NUMBER (BITS 0-7)
	.MNVAL	LDBMIC,NS,NS,30,43	;THE TERMINAL IS UNDER MIC CONTROL


;DEFINE SOME VALUES USED BY DDBDPY IN THE PDB (PROCESS DATA BLOCK)

	.MNVAL	.PDJSL,NS,NS,27,27	;THE JOB'S SEARCH LIST
		.MNVAL	.FSFNC,NS,NS,45,45	;THE FENCE ACTIVE/PASSIVE
		.MNVAL	.FSEND,NS,NS,46,46	;THE LOGICAL END
		.MNVAL	.FSTMP,NS,NS,47,47	;THE TEMPORARY
		.MNVAL	.FSSTP,NS,NS,77,77	;THE PHYSICAL END
		.MNVAL	FS.WLK,NS,NS,100,100;THE STRUCTURE IS WRITE-LOCKED
		.MNVAL	FS.NCR,NS,NS,200,200;THE STRUCTURE IS NO-CREATE


; DEFINE SOME LOCATIONS IN THE MONITOR

	.MNVAL	LIMLVL,5,5,5,5		;THE MAXIMUM SFD NESTING LEVEL
	.MNVAL	GTBSLF,410,410,410,410	;THE ABSOLUTE ADDRESS THAT CONTAINS THE
					; ADDRESS OF THE 'GETTAB' POINTERS
	.MNVAL	HI,400000,400000,400000,400000	;THE OFFSET TO THE SPY SEGMENT
SUBTTL	MACRO DEFINITIONS -- .TITLE, .SBTTX, .PTHTX AND .DSPTB
TITLE	DDB4 - DISK DDB DISPLAY FOR A 700 MONITOR
DEFINE	.SBTTX<

XLIST	;;TURN THE LISTING OFF

ASCIZ	/JB M     PPN                FILE              NXT   WRT   ALC   OTH/

LIST	;;TURN THE LISTING ON

>


DEFINE	.PTHTX<

XLIST	;;TURN THE LISTING OFF

ASCIZ	/JB M     PPN          FILE       UNIT   BLK   NXT   WRT   ALC   OTH/

LIST	;;TURN THE LISTING ON

>


DEFINE	.DSPTB<

XLIST	;;TURN THE LISTING OFF

	.DSP	ADM1,%AD1TP,%AD1SZ
	.DSP	ADM3,%AD3TP,%AD3SZ
	.DSP	ASR33,%ASRTP,%ASRSZ
	.DSP	HAZELTINE,%HZLTP,%HZLSZ
	.DSP	MINIBEE,%MBETP,%MBESZ
	.DSP	MODULAR,%MDLTP,%MDLSZ
	.DSP	VT05B,%V5BTP,%V5BSZ
	.DSP	VT50,%V50TP,%V50SZ
	.DSP	VT52,%V52TP,%V52SZ
	.DSP	VT61,%V61TP,%V61SZ
	.DSP	VT100,%V52TP,%V52SZ

LIST	;;TURN THE LISTING ON

>
SUBTTL	MACRO DEFINITIONS -- .HLPTX


DEFINE	.HLPTX($MON,$VER,$EDT)<

XLIST	;;TURN THE LISTING OFF

ASCIZ	\DDBDPY %'$VER($EDT) Help Text - Set up for a $MON Monitor

Each command must be terminated by a break character
^C (Control-C) OR ^Z (Control-Z) will exit the job

<CR>  Update the listing
<ALT> Update the listing and wait for a new command
  +   Advance the listing by one page
  -   Decrement the listing by one page
  A   List all the disk DDBs (privileged command)
  D   Change the type of display
  F   List only the DDBs that reference a file specification
  H   This help text
  J   List only the DDBs from a job
  K   Kill the execution and this job
  L   List only the DDBs that are from jobs logged-in under a PPN
  N   List only the DDBs that are from jobs not logged-in under a PPN
  P   Complement the listing of the entire path
  S   Change the sleep time between updates
  T   Complement the listing of the title line
  W   Complement the listing of the command buffer\

LIST	;;TURN THE LISTING ON

>
SUBTTL	PROGRAM INITALIZATION


DDBDPY:	JFCL
IFE <MONVER-700>,<
	MOVE	[25,,113]
	GETTAB			;GET OFFSET FOR .UPLST
	  MOVEI	771		;PRE R?330 LOAD
	ADDI	UPT		;RELOCATE IT
	MOVEM	LSTLOC
>
	MOVX	T1,%CNVER	;GET THE MONITOR
	GETTAB	T1,		; VERSION NUMBER
	 JRST	E$$DRM		;NO - BEFORE 503
	ANDX	T1,777_^D6	;REMOVE THE COSTUMER VERSION NUMBER AND
				; WHO LAST EDITED THE MONITOR
;	CAXE	T1,MONVER_^D6	;SKIP IF THE RIGHT MONITOR
;	JRST	E$$DRM		;JUMP AN ILLEGAL MONITOR VERSION NUMBER
	SETZB	F,PAGNUM	;RESET ALL THE FLAGS AND CURRENT PAGE NUMBER
IFN FTDEBUG,<
	SKIPE	.JBDDT##	;SKIP IF DDT ISN'T LOADED
	TXO	F,F.DDT		;SET THE DDT IS LOADED FLAG >
	MOVX	T1,DEFHIB	;GET THE DEFAULT SLEEP TIME BETWEEN SCANS
	HRRM	T1,HIBTIM	;SAVE FOR LATER
IFN FTRESCAN,<
	RESCAN	1		;SKIP IF THERE ISN'T A RESCAN'ABLE COMMAND
	TXO	F,F.RES		;SET THE RESCAN FLAG >

DDBDP0:	RESET			;RESET THE WORLD
	MOVX	T1,%CNSIZ	;GET THE SIZE OF
	GETTAB	T1,		; THE MONITOR
	 JRST	E$$NPS		;NO - GO INFORM THE USER
	SOJ	T1,		;GETTAB RETURNS MONITOR SIZE + 1
	SPY	T1,		;SET UP TO SPY ON THE MONITOR
	 JRST	E$$NPS		;NO - GO INFORM THE USER

	HRRZ	P5,HI+GTBSLF	;GET THE ADDRESS OF THE START OF THE
				; GETTAB TABLES
	MOVEI	T2,HI(P5)	;SAVE THE ADDRESS OF
	HRRM	T2,GETSLF	; THE GETTAB TABLES

	HRRZ	T2,HI+.GTLVD(P5);GET THE ADDRESS OF LEVEL-D TABLE

IFE <MONVER-603>*<MONVER-700>,<
	MOVEI	T1,HI+%LDSPB_-^D18(T2)	;GET THE ADDRESS OF THE 
	MOVEM	T1,GETSPB		; POINTER TO THE PPB'S >

	MOVEI	T1,HI+%LDSTR_-^D18(T2)	;GET THE ADDRESS OF THE 
	MOVEM	T1,GETSTR		; POINTER TO THE STR'S

	HRRZ	P2,HI+.GTCNF(P5)	;GET THE MAX
	MOVE	T1,HI+%CNSJN_-^D18(P2)	; NUMBER OF
	HRRI	T1,-1(T1)		; JOBS ON THE
	HRRZM	T1,JOBMAX		; SYSTEM
	MOVE	T1,HI+56(P5)
	MOVEI	T1,HI+10(T1)		;POINT AT HIGHJB
	MOVEM	T1,HIJOB		;SAVE THE ADDRESS
IFN FTJOB,<
	MOVEI	T1,HI+%CNDTM_-^D18(P2)	;GET THE ADDRESS
	HRRZM	T1,GETDAT		; OF THE DATE

	MOVE	T1,HI+%CNPTY_-^D18(P2)	;GET THE PTY'S ON THE SYSTEM
	HLRZM	T1,PTYMIN		;SAVE THE MINIMUM PTY NUMBER

	SETO	T1,		;TEST A KA VS
	AOBJN	T1,.		; KI OR KL
	CAIN	T1,0		;SKIP IF A KA
	TXO	F,F.PAG		;SET THE PAGE FLAG

IFN FTVM,<
	MOVE	T1,HI+%CNST2_-^D18(P2)	;GET THE SECOND STATES WORD
	TXNE	T1,ST%VMS		;SKIP IF NOT A VM SYSTEM
	TXO	F,F.VMS			;SET THE VIRTUAL MEMORY FLAG >

	MOVEI	T1,^D60		;GET DEFAULT TIME FOR A JIFFY
	MOVE	T2,HI+%CNSTS_-^D18(P2)  ;GET THE STATES WORD
	TXNE	T2,ST%CYC	;SKIP IF A 60 CYCLE CLOCK
	MOVEI	T1,^D50		;SET UP FOR A 50 CYCLE CLOCK
	MOVEM	T1,JIFFIE	;SAVE THE TIME OF A JIFFY FOR LATER
	IMULI	T1,^D60		;GET JIFFIES PER MINUTES
	MOVEM	T1,JIFMIN	;SAVE FOR LATER
	IMULI	T1,^D60		;GET JIFFIES PER HOUR
	MOVEM	T1,JIFHOR	;SAVE FOR LATER >

IFN FTJOB,<
	HRRZ	T1,HI+%CNPDB_-^D18(P2)	;GET THE ADDRESS
	MOVEI	T1,HI(T1)		; OF THE PDB
	HRRM	T1,GETPDB		; TABLE >

IFE <MONVER-603>*<MONVER-700>,<
	HRRZ	T1,HI+%CNNDB_-^D18(P2)  ;GET THE POINTER TO
	MOVEM	T1,GETNDB		; NETWORK DATA BLOCK >

	HLRZ	P2,HI+%CNDEV_-^D18(P2)  ;FIND THE ADDRESS OF THE FIRST DDB

	MOVE	T2,[-GETSIZ,,GETTBL]  ;SET THE GETTAB POINTERS
DDBDP1:	LDB	T1,[POINT 9,(T2),8]  ;GET THE TABLE TO LOOK AT
	HRRZ	T1,@GETSLF	;GET THE ADDRESS OF THE TABLE
	MOVEI	T1,HI(T1)	;SET UP FOR SPYING
	HRRM	T1,(T2)		;SAVE FOR LATER USE
	AOBJN	T2,DDBDP1	;LOOP BACK BACK IF NOT FINISHED
	MOVEI	T1,DDBDP0	;SET UP TO HAVE IMR'S
	MOVEM	T1,.JBAPR##	; RESTART THE PROGRAM
	MOVX	T1,AP.ILM	;SET UP TO TRAP
	APRENB	T1,		; ILL MEM REF'S

IFN FTDEBUG,<
	TXNE	F,F.DDT		;SKIP IF DDT ISN'T LOADED
	JRST	DDBDP2		;SKIP SETTING UP THE CONTROL-C INTERCEPT >
	MOVEI	T1,INTBLK	;SET UP TO INTERCEPT 
	MOVEM	T1,.JBINT##	; CONTROL-C'S (^C)
	SETZM	INTBLK+2	;RESET THE INTERCEPT BLOCK

DDBDP2:	MOVE	T1,CMDWAT	;SET UP THE DEFAULT INPUT
	MOVEM	T1,INCHR	; ROUTINE (INCHWL C)
	MOVE	P,[-PDLSIZ,,PDL];SET UP THE PUSH DOWN LIST

	TXOE	F,F.INI		;SKIP IF THE PROGRAM WAS JUST STARTED
	JRST	DDBDP7

	PJOB	P5,		;GET MY JOB NUMBER
	MOVEM	P5,CURJOB	;SAVE MY JOB NUMBER FOR LATER
IFN FTPRIV,<
	MOVX	T1,JP.DPY	;GET THE PRIVILEGE BIT
	TDNN	T1,@GETPRV	;SKIP IF THE USER IS PRIVILEGED
	JRST	E$$NPR		;NOT ENOUGH PRIVILEGES >
	MOVE	T1,@GETPPN	;GET MY PPN
	MOVEM	T1,MYPPN	;SAVE FOR LATER
	HLRZ	T4,T1
	CAIE	T4,10
	CAMN	T1,[1,,2]	;SKIP IF NOT 1,2
	JRST	DDBDP3		;GO SET THE GOD BIT
	HRRZ	T4,T1
	CAIN	T4,10
	JRST	DDBDP3
IFE FTPROJ,<
	IFN FTPROG,<
		HRRZM	T1,IDIR		;ASSUME [*,PRG]
		HLLOS	IDIRMSK >>
IFN FTPROJ,<
	IFE FTPROG,<
		HLLZM	T1,IDIR		;ASSUME [PRJ,*]
		HRROS	IDIRMSK >
	IFN FTPROG,<
		MOVEM	T1,IDIR		;ASSUME [PRJ,PRG]
		SETOM	T1,IDIRMSK >>
	MOVE	T1,[IROUTI,,ROUTIN]  ;SET UP THE INITIAL
	BLT	T1,BLTEND	     ; SCAN CONDITIONS
	TXOA	F,F.WLD		;SET THE WILD FLAG
DDBDP3:	TXO	F,F.GOD		;SET THE GOD BIT

IFN FTSLEEP,<
	MOVX	T1,SLPSCN	;SET THE DEFAULT
	MOVEM	T1,SLPCNT	; SLEEP COUNTER >
	SKIPN	T4,@GETTTY	;GET THE ADDRESS OF MY TERMINALS DDB
	 JRST	E$$TTF		;ERROR - NO DDB
	HRRZ	T4,HI+DDBLDB(T4);GET THE ADDRESS OF THE TERMINALS LDB
	JUMPE	T4,E$$TTF	;JUMP IF THE ADDRESS IS ZERO
IFE <MONVER-700>,<
	PUSHJ	P,GETLDB	;SET SPY-PAGE FOR LDB
>
	MOVE	T3,HI+LDBDCH(T4);GET THE DEVICE CHARACTERISTIC BITS
	TXNN	T3,LDRPTY	;SKIP IF A PTY
	JRST	DDBDP4		;SKIP SOME PTY CODE
	MOVX	T1,JB.LBT	;GET THE BATCH BIT
IFE <MONVER-603>*<MONVER-700>,<
	SKIPN	HI+LDBMIC(T2)	;SKIP IF A MIC COJOB >
	TDNE	T1,@GETLIM	;SKIP IF NOT A BATCH JOB
	JRST	E$$CRS		;CAN'T RUN DDBDPY
	MOVX	T1,SLPPTY	;SLEEP TIME
	HRRM	T1,HIBTIM	; ON A PTY
IFN FTSLEEP,<
	SETZM	SLPCNT		;DON'T RESET THE SLEEP COUNTER >
DDBDP4:	DPB	T3,[POINT 9,TRM+1,35]  ;STORE THE TEN TERMINAL NUMBER
IFN <MONVER-603>,<
	ANDX	T3,777		;CLEAR SOME JUNK >
IFE <MONVER-603>*<MONVER-700>,<
	TXNN	T3,LDRREM	;SKIP IF A REMOTE TERMINAL
	JRST	[ANDX	T3,777		;REMOVE UNNEEDED BITS
		 HRRZ	T1,@GETLOC	;THE NUMBER OF THE CENTRAL NODE
		 JRST	DDBDP5]		;GO STORE THIS HOT INFO
	HLRZ	T1,HI+LDBREM(T4);GET THE POINTER NETWORK INFO
	JUMPE	T1,E$$TTF	;JUMP IF AN INVALID POINTER
	LDB	T3,[POINT 8,HI+LDBREM+4(T4),7]  ;GET RELATIVE LINE NUMBER
	HLRZ	T1,HI+NDBNNM(T1);GET THE NODE NUMBER
DDBDP5:	MOVEM	T1,NODIDX	;SAVE THE NODE NUMBER >
	MOVEM	T3,LINIDX	;SAVE THE LINE NUMBER

	MOVSI	T3,-TRMSIZ	;SET A AOBJN COUNTER
DDBDP6:	MOVE	T2,TRMTAB(T3)	;GET THE TRMOP. TO PREFORM
	HLRZM	T2,TRM+2	;SAVE THE NEW STATUS
	HRRZM	T2,TRM		;SAVE THE READ FUNCTION
	MOVE	T1,[2,,TRM]	;READ THE BIT IN
	TRMOP.	T1,		; QUESTION
	 JRST	E$$TTF		;NO - GO INFORM THE USER
	MOVEM	T1,TRMSAV(T3)	;SAVE FOR LATER
	MOVEI	T2,.TOSET(T2)	;CHANGE THE FUNCTION INTO A SET
	MOVEM	T2,TRM		;SAVE FOR LATER
	MOVE	T1,[3,,TRM]	;SET THE FUNCTION
	TRMOP.	T1,		; IN QUESTION
	 JRST	E$$TTF		;NO - GO INFORM THE USER
	AOBJN	T3,DDBDP6	;JUMP IF NOT FINISHED

	PUSHJ	P,TRMDSP	;SET UP THE DEFAULT DISPLAY TYPE
	PUSHJ	P,PAGADJ	;SET UP THE SCREEN SIZE INFO
IFN FTWHAT,<
	PUSHJ	P,CMDOUT	;GO SETUP THE COMMAND STRING BUFFER >
DDBDP7:
IFN FTDEBUG,<
	TXNE	F,F.DDT		;SKIP IF DDT WASN'T LOADED
	JRST	DDBMAN		;SKIP THE INIT CODE >
	INIT	TTY,IO.SUP!.IOASC  ;INIT THE TTY WITH ECHO OFF
	SIXBIT	/TTY/
	OCT	0
	 JRST	E$$CIT		;NO - INFORM THE USER!!
	PUSHJ	P,CLRLIN

SUBTTL	THE DDB SCANNING LOOP


DDBMAN:	TXZE	F,F.CLR		;SKIP IF THE SCREEN SHOULDN'T BE CLEARED
	PUSHJ	P,@TRMCLR(P1)	;GO CLEAR THE SCREEN
	SETZB	LC,DDBCNT	;ZERO SOME COUNTERS
IFL <MONVER-700>,<
	MOVE	P2,ADRDSK	;GET THE POINTER TO THE FIRST DISK DDB
>
IFGE <MONVER-700>,<
	SETZB	P2,JOB
>
DDBLOP:	PUSHJ	P,NXTDDB	;GET THE NEXT DDB IN THE CHAIN
	 JRST	DDBEND		;FINISHED WITH THE CHAIN
	MOVX	T1,DV.DSK	;GET THE DEVICE IS A DISK BIT
	TDNN	T1,HI+DEVMOD(P2);SKIP IF THE DDB IS FOR A DISK
	JRST	[SKIPGE	HI+DEVSPL(P2)	;SKIP IF THE DEVICE ISN'T SPOOLED
		 JRST	DDBLO0		;GO LIST THE DDB
		 JRST	DDBLOP]		;GO TRY THE NEXT DDB
DDBLO0:	HRRZ	P3,HI+DEVACC(P2);GET THE POINTER TO ACC-TAB
	JUMPE	P3,DDBLOP	;JUMP IF ZERO
IFL <MONVER-602>,<
	SKIPN	HI+ACCDOR(P3)	;SKIP IF THE FILE IS DORMANT
	SKIPN	P5,HI+ACCAKB(P3);SKIP IF THE POINTERS TO THE PPB
				; AND AKB ARE NON-ZERO
	JRST	DDBLOP
	HLRZ	P4,P5		;GET THE POINTER TO PPB >
IFGE <MONVER-602>,<
	SKIPE	HI+ACCDOR(P3)	;SKIP IF THE FILE ISN'T DORMANT
	JRST	DDBLOP		;GO TRY THE NEXT DDB
	HRRZ	P5,HI+ACCPPB(P3);GET THE PPB POINTER
	JUMPE	P5,DDBLOP	;NO PPB - TRY NEXT DDB THEN >

	TXNE	F,F.WLD		;SKIP IF WILD PROCESSOR ISN'T WANTED
	JRST	@ROUTIN		;GO EXCUTE THE WILD PROCESSOR
DDBLO1:	MOVE	T1,DDBCNT	;GET THE DDB COUNTER
	CAML	T1,PAGFST	;SKIP IF THE DDB IS TO SOON
	CAML	T1,PAGLST	;SKIP IF THE DDB IS IN TIME
	JRST	DDBL13		;GO COUNT THE DDB
	PUSHJ	P,BEGLIN	;SET UP THE LINE
	MOVEI	T4,^D2		;SET UP OUTPUT THE JOB NUMBER
	LDB	T1,JOBPTR	;GET THE JOB NUMBER OF THIS DDB
	PUSHJ	P,DECJST	;OUTPUT THE JOB NUMBER
	LDB	T1,STSPTR	;GET THE FILE STATUS
	MOVE	T1,MODE(T1)	;GET THE MODE AND
	PUSHJ	P,SIXOUT	; OUTPUT IT
	LDB	T5,JOBPTR	;GET THE JOB NUMBER AGAIN
	SKIPN	T5,@GETPP	;SKIP IF THE PPN FOR THIS
				; JOB IS NON-ZERO
	JRST	DDBLOP
	MOVEI	T4,^D6		;SET UP TO OUTPUT THE PPN
	PUSHJ	P,PPNJST	;GO OUTPUT THE PPN
	MOVEI	T1,^D17		;JUSTIFY TO
	PUSHJ	P,JUST		; COLUMN 17
	PUSHJ	P,FNDSTR	;GO FIND THE STRUCTURE NAME
	 JRST	DDBLOP		;GO ABORT THE OUTPUT
	PUSHJ	P,SIXOUT	;GO OUTPUT THE STRUCTURE NAME
	MOVEI	T1,^D22		;JUSTIFY TO
	PUSHJ	P,JUST		; COLUMN 22
	SKIPN	T1,HI+DEVFIL(P2);SKIP IF THE FILE NAME IS NON-ZERO
	JRST	DDBLOP
	HLRZ	T5,HI+DEVEXT(P2);GET THE EXTENSION
	CAIN	T5,'UFD'	;SKIP IF IT ISN'T A UFD
	JRST	[MOVEI	C,"["
		 PUSHJ	P,CHROUT	;GO OUTPUT OPEN BRACKET
		 MOVE	T5,T1		;GET THE PPN IN THE RIGHT PLACE
		 PUSHJ	P,PPNOUT	;GO OUTPUT THE PPN
		 MOVE	T1,['].UFD ']
		 PUSHJ	P,SIXOUT	;GO OUTPUT '].UFD'
		 JRST	DDBLO5]		;SKIP OUTPUTTING THE UFD
IFGE <MONVER-602>,<IFN FTSPOOL,<
	SKIPGE	HI+DEVSPL(P2)	;SKIP IF NOT A SPOOLED FILE
	SKIPN	T2,HI+DEVSPN(P2);SKIP IF A NON-ZERO ENTERED SPOOLED NAME
	JRST	DDBLO2		;GO OUTPUT THE FILE NAME
	MOVE	T1,T2		;OUTPUT THE ENTERED
	PUSHJ	P,SIXOUT	; SPOOLED NAME
	MOVEI	T1,^D28		;JUSTIFY TO
	PUSHJ	P,JUST		; COLUMN 28
	MOVEI	C,"*"		;OUTPUT A
	PUSHJ	P,CHROUT	; ASTERISK
	JRST	DDBLO3		;GO OUTPUT THE SPOOLED DEVICE >>
DDBLO2:	PUSHJ	P,SIXOUT	;OUTPUT THE FILE NAME
	JUMPE	T5,DDBLO4	;JUMP IF THE EXTENSION IS ZERO
	MOVEI	T1,^D29		;JUSTIFY TO
	PUSHJ	P,JUST		; COLUMN 29
DDBLO3:	MOVSI	T1,(T5)		;GET THE EXTENSION AGAIN
	PUSHJ	P,SIXOUT	;OUTPUT THE EXTENSION
DDBLO4:	MOVEI	T1,^D32		;JUSTIFY TO
	PUSHJ	P,JUST		; COLUMN 32
IFN FTPATH,<
	JUMPL	F,[HRRZ  T1,HI+DEVUNI(P2)  ;GET THE LINK THE UNIT DATA BLOCK
		   JUMPE T1,DDBLOP	;JUMP IF NO UNIT DATA BLOCK
		   MOVE  T1,HI+UNINAM(T1)  ;GET THE UNIT NAME
		   LSH   T1,-^D6	;SHIFT IN A SPACE
		   PUSHJ P,SIXOUT	;OUTPUT THE UNIT NAME
		   MOVEI T4,^D7
		   MOVE	 T1,HI+DEVBLK(P2)  ;OUTPUT THE LOGICAL BLOCK
		   PUSHJ P,DECJST	   ; TO BE READ OR WRITTEN
		   MOVEI T4,^D6		;SET UP OUTPUT THE
		   JRST  DDBLO6]	; RELATIVE BLOCK >
	MOVEI	T4,^D6
	MOVE	T5,HI+PPBNAM(P5);THE PPN OF THE FILE
	PUSHJ	P,PPNJST	;GO OUTPUT THE PPN
DDBLO5:	MOVEI	T1,^D45		;JUSTIFY TO
	PUSHJ	P,JUST		; COLUMN 45
	MOVEI	T4,^D5
DDBLO6:	MOVE	T1,HI+DEVREL(P2);GET THE NEXT (RELATIVE) BLOCK
	PUSHJ	P,DECJST	; TO BE READ OR WRITTEN
	MOVEI	T4,^D6
	MOVE	T1,HI+ACCWRT(P3);GET THE NUMBER OF BLOCKS WRITTEN
	PUSHJ	P,DECJST	;OUTPUT IT
	MOVEI	T4,^D6
IFL <MONVER-602>,<
	MOVE	T1,HI+AKBALC(P4);GET THE NUMBER OF BLOCKS ALLOCATED >
IFGE <MONVER-602>,<
	MOVE	T1,HI+ACCALC(P3);GET THE NUMBER OF BLOCKS ALLOCATED >
	PUSHJ	P,DECJST	;OUTPUT IT
	PUSHJ	P,SPAOUT	;OUTPUT A SPACE
	LDB	T1,[POINT 3,HI+DEVPRI(P2),29]  ;THE DISK PRIORITY
	JUMPE	T1,DDBLO7	;JUMP IF ZERO
	TRZE	T1,4		;SKIP IF NEGATIVE
	MOVEI	C,"-"
	PUSHJ	P,CHROUT	;OUTPUT A MINUS SIGN OR A SPACE
	PUSHJ	P,DECOUT	;OUTPUT THE DISK PRIORITY
	PUSHJ	P,SPAOUT	;OUTPUT A SPACE
DDBLO7:	MOVEI	C,"S"
	SKIPGE	HI+DEVSPL(P2)	;SKIP IF THE FILE ISN'T A SPOOLLED FILE
	PUSHJ	P,CHROUT	;OUTPUT A "S"
	HRRZ	T1,HI+ACCSTS(P3);GET THE FILE STATUS
	MOVEI	C,"D"
	TRNE	T1,ACPDEL	;SKIP IF THE FILE ISN'T MARKED FOR DELETION
	PUSHJ	P,CHROUT	;OUTPUT A 'D'
	MOVEI	C,"R"
	TRNE	T1,ACPREN	;SKIP IF THE FILE ISN'T BEING RENAMED
	PUSHJ	P,CHROUT	;OUTPUT A 'R'
IFGE <MONVER-602>,<
	MOVEI	C,"M"
	TRNE	T1,ACPSMU	;SKIP IF NOT SIMULTANEOUS UPDATE, MULTI-USER
	PUSHJ	P,CHROUT	;OUTPUT A 'M' >
IFE <MONVER-603>*<MONVER-700>,<
	MOVEI	C,"P"
	MOVX	T1,DEPPAL	;GET THE PRE-ALLOCATION BIT
	TDNE	T1,HI+DEVPAL(P2);SKIP IF NOT PRE-ALLOCATED
	PUSHJ	P,CHROUT	;OUTPUT A 'P' >
	HLRZ	T1,HI+DEVIOS(P2);GET THE I/O STATUS
	TRNN	T1,IOSIOW	;SKIP IF IN I/O WAIT
	JRST	DDBLO8		;JUMP NOT IN AN I/O WAIT
	MOVEI	C,"I"		;ASSUME INPUT WAIT
	TRNE	T1,IOSIO	;SKIP IF INPUT WAIT
	MOVEI	C,"O"		;OUTPUT WAIT
	PUSHJ	P,CHROUT	;OUTPUT THE WAIT STATE
DDBLO8:	PUSHJ	P,ENDLIN	;GO FINISH OFF THE LINE
	AOJ	LC,		;INCREMENT THE LINE COUNT
IFN FTPATH,<
	JUMPGE	F,DDBL13	;JUMP IF THE ENTIRE PATH ISN'T WANTED
	PUSHJ	P,BEGLIN	;SET UP THE LINE
	MOVEI	T4,^D10
	MOVE	T5,HI+PPBNAM(P5);GET THE PPN TO BE OUTPUT
	PUSHJ	P,PPNJST	;OUTPUT THE PPN
	HRRZ	P4,HI+DEVSFD(P2);SEE IF THE FILE IS IN AS SFD
	JUMPE	P4,DDBL12	;SKIP IF THE FILE IS IN AN SFD
	PUSH	P,[0]		;SET A FLAG
DDBLO9:	PUSH	P,HI+NMBNAM(P4)	;SAVE THE SFD NAME
DDBL10:	HLRZ	P4,HI+NMBPPB(P4);GET THE POINTER TO THE NEXT NMB
	TRZN	P4,NMPUPT	;SKIP IF THE CONTAINS THE SFD NAME
	JUMPN	P4,DDBL10	;GO SAVE THE SFD NAME
	JUMPN	P4,DDBLO9	;GO GET THE NEXT NMB POINTER
DDBL11:	POP	P,T1		;GET THE SFD NAME BACK
	JUMPE	T1,DDBL12	;JUMP IF THE FLAG WAS FOUND
	PUSHJ	P,COMOUT	;OUTPUT A COMMA
	PUSHJ	P,SIXOUT	;OUTPUT THE SFD NAME
	JRST	DDBL11		;GO GET THE NEXT SFD LEVEL
DDBL12:	PUSHJ	P,ENDLIN	;GO FINISH OFF THE LINE
	AOJ	LC,		;INCREMENT THE LINE COUNT >
DDBL13:	AOS	DDBCNT		;INCREMENT DDB COUNT
	JRST	DDBLOP		;GO TRY THE NEXT DDB
SUBTTL	MAKE THE HEADER LINE AND OUTPUT THE BUFFER


DDBEND:	CAXN	P1,%AD3TP	;SKIP IF NOT A LSI ADM-3
	OUTSTR	[BYTE (7).CHCRT,.CHLFD,0]
	MOVEM	LC,CURCNT	;SAVE THE LINE COUNT
IFN FTTITLE,<
	TXNE	F,F.TTL		;SKIP IF THE TITLE FLAG IS SET
	JRST	DDBEN7		;GO OUTPUT THE DDB BUFFER >
	SETZ	LC,		;SET UP THE FOR
	PUSHJ	P,TTLLIN	; THE TITLE LINE
IFN FTJOB,<
	TXNN	F,F.JOB		;SKIP IF THE JOB DISPLAY IS WANTED
	JRST	DDBEN0		;SKIP THE JOB DISPLAY STUFF
	PUSHJ	P,JOBOUT	;GET SET UP THE JOB BUFFER
 	 JRST	DDBEN4		;GO TERMINATE THE LINE OFF RIGHT >

DDBEN0:	MOVE	T1,DDBCNT	;OUTPUT THE NUMBER
	PUSHJ	P,DECOUT	; OF DDB'S
	PUSHJ	P,SPAOUT	;OUTPUT A SPACE
	MOVE	T1,PAGNUM	;GET THE CURRENT PAGE NUMBER
	AOJ	T1,
	PUSHJ	P,DECOUT	;OUTPUT THE CURRENT PAGE NUMBER
	PUSHJ	P,SLHOUT	;OUTPUT A SLASH
	SKIPE	T1,DDBCNT	;SKIP IF THE DDB COUNT IS ZERO
	SOJ	T1,		;MAKE IT ONE LESS
	ADD	T1,PAGSIZ
	IDIV	T1,PAGSIZ	;GET THE NUMBER OF PAGES OF DDB'S
	PUSHJ	P,DECOUT	;OUTPUT THE NUMBER OF PAGES
	HLRZ	P4,@GETSTR	;GET THE POINTER TO THE STRUCTURE CHAIN
	JUMPE	P4,DDBEN4	;JUMP IF THE END OF THE CHAIN WAS REACHED
	MOVEM	CC,TEMP		;SAVE THE CURRENT COLUMN COUNT FOR LATER
	MOVX	T5,MAXSTR	;SET UP A STRUCTURE COUNTER

DDBEN1:	SKIPN	HI+STRNAM(P4)	;SKIP IF A NON-NULL STRUCTURE NAME
	JRST	DDBEN3		;GO TRY THE NEXT STRUCTURE
	SOJGE	T5,DDBEN2	;JUMP IF NOT TIME FOR A NEW LINE
	PUSHJ	P,ENDLIN	;TERMINATE THE CURRENT LINE
	AOJ	LC,		;INCREMENT THE LINE COUNT
	PUSHJ	P,TTLLIN	;SET UP A TITLE LINE
	MOVE	T1,TEMP		;GET THE COLUMN COUNT
	PUSHJ	P,JUST		; AND JUSTIFY TO IT
	MOVX	T5,MAXSTR-1	;SET UP A STRUCTURE COUNTER
DDBEN2:	MOVE	T1,HI+STRNAM(P4);GET THE STRUCTURE NAME
	LSH	T1,-^D6		;SHIFT A SPACE INTO THE FIRST CHAR
	PUSHJ	P,SIXOUT	;OUTPUT THE STRUCTURE NAME
	PUSHJ	P,CLNOUT	;OUTPUT A COLON
	MOVE	T1,HI+STRTAL(P4);GET THE NUMBER OF FREE BLOCKS ON THE STRUCTURE
	PUSHJ	P,DECOUT	;OUTPUT THE NUMBER OF FREE BLOCKS
IFN FTMOUNT,<
	PUSHJ	P,CLNOUT	;OUTPUT A COLON
	SKIPLE	HI+STRJOB(P4)	;SKIP IF THE STRUCTURE IS MOUNTED SINGLE
	JRST	[MOVEI	C,"S"		;OUTPUT AN 'S' FOR
		 PUSHJ	P,CHROUT	; SINGLE ACCESS
		 JRST	DDBEN3]		;KEEP ON TRUCK'N
	MOVE	T1,HI+STRMNT(P4);GET THE MOUNT COUNT FOR THIS STRUCTURE
	PUSHJ	P,DECOUT	;OUTPUT THE MOUNT COUNT >
DDBEN3:	HLRZ	P4,HI+STRSYS(P4);GET POINTER TO THE NEXT STRUCTURE
	JUMPN	P4,DDBEN1	;GO DISPLAY THIS STRUCTURE
DDBEN4:	PUSHJ	P,ENDLIN	;FINISH OFF THE LINE
	AOJ	LC,		;INCREMENT THE LINE COUNT

	CAILE	LC,^D2		;SKIP IF TWO OR LESS TITLE LINES
	JRST	DDBEN5		;SKIP SOME CRUDE CODE
	PUSHJ	P,TTLLIN	;SET UP ANOTHER TITLE LINE
	MOVEI	T1,STLBUF	;ASSUME NOT OUTPUTTING THE PATH
IFN FTPATH,<
	TXNE	F,F.PTH		;SKIP PATH NO WANTED
	MOVEI	T1,PTHBUF	;GET THE PATH BUFFER >
	PUSHJ	P,ASCOUT	;OUTPUT TEXT TO THE BUFFER
	PUSHJ	P,ENDLIN	;FINISH OFF THE LINERRIGHT
	AOJ	LC,		;INCREMENT THE LINE COUNT

DDBEN5:	MOVEI	T5,TTLBUF	;THE POINTER TO THE TITLE LINE
DDBEN6:	PUSHJ	P,@TRMEOL(P1)	;CLEAR TO THE END OF THE LINE
	OUTSTR	(T5)		;OUTPUT A TITLE LINE
	MOVEI	T5,LINSIZ(T5)	;GET THE POINTER TO THE NEXT LINE
	SOJG	LC,DDBEN6	;LOOP UNTIL FINISHED

DDBEN7:	MOVEI	T5,LINBUF	;SET UP THE LINE BUFFER
	SKIPG	LC,CURCNT	;SKIP IF NO LINES TO OUTPUT
	JRST	DDBEN9		;SKIP SOME CODE
DDBEN8:	PUSHJ	P,@TRMEOL(P1)	;GO CLEAR TO THE END OF THE LINE
	OUTSTR	(T5)		;GO OUTPUT A LINE
	MOVEI	T5,LINSIZ(T5)	;POINT TO THE NEXT LINE
	SOJG	LC,DDBEN8	;JUMP IF MORE LINES TO OUTPUT

DDBEN9:	PUSHJ	P,@TRMEOS(P1)	;GO CLEAR TO THE END OF THE SCREEN
IFN FTSLEEP,<
	SOSE	SLPCNT		;SKIP IF TIME TO ADJUST THE SLEEP TIME
	JRST	DDBE10		;SKIP SOME CODE
	MOVX	T1,SLPADJ	;ADJUST THE SLEEP
	HRRM	T1,HIBTIM	; TIME INTERVAL
IFN FTWHAT,<
	PUSHJ	P,CMDOUT	;SET UP COMMAND STRING BUFFER >
DDBE10: >
IFE FTWHAT,<
	TXNN	F,F.HLP		;SKIP IF HELP IS NEEDED
	JRST	DDBE11		;GO HOME THE SCREEN THEN
	OUTSTR	[ASCIZ /  ** Type "H<CR>" for help **/] >
IFN FTWHAT,<
	TXNN	F,F.HLP!F.WHT	;SKIP IF THE HELP OR COMMAND BUFFER IS NEEDED
	JRST	DDBE11		;GO HOME THE TERMINAL
	MOVEI	T1,WHTBUF	;GET THE ADDRESS OF THE COMMAND LINE
	TXNE	F,F.HLP		;SKIP IF HELP ISN'T NEEDED
	MOVEI	T1,[ASCIZ /  ** Type "H<CR>" for help **/]
	OUTSTR	(T1)		;OUTPUT THE LINE >
	CAXN	P1,%ASRTP	;SKIP IF NOT AN ASR33 DISPLAY
	OUTSTR	[BYTE (7).CHCRT,.CHLFD,0]
DDBE11:	PUSHJ	P,@TRMHOM(P1)	;GO HOME THE TERMINAL
SUBTTL	THE COMMAND SCANNER


IFN FTESCAPE,<
	TXZE	F,F.ESC		;SKIP IF THE SCREEN SHOULD NOT BE FROZEN
	JRST	CMDWAT		;GO WAIT FOR A NEW COMMAND >

	SKPINL			;SKIP IF A COMMAND WAS TYPED
	 JRST	CMDFIN		;NO - GO HIBERNATE

CMDWAT:	INCHWL	C		;GET A CHAR FROM THE TTY

CMDTST:	CAIL	C,"a"		;SKIP IF LESS THAN A LOWER CASE A
	CAILE	C,"z"		;SKIP IF LESS THAN A LOWER CASE Z
	JRST	CMDTS0		;JUMP IF NOT LOWER CASE CHARACTER
	MOVEI	C,"A"-"a"(C)	;CONVERT TO UPPER CASE
CMDTS0:	TXZ	F,F.HLP		;CLEAR THE COMMAND ERROR FLAG
	MOVSI	T2,-CMDSIZ	;SET UP A AOBJN COUNTER
CMDTS1:	MOVS	T1,CMD(T2)	;GET A CHAR TO TEST
	CAIE	C,(T1)		;SKIP IF THE CHAR MATCH
	AOBJN	T2,CMDTS1	;JUMP IF NOT FINISHED
	JUMPGE	T2,CMDERR	;JUMP IF A MATCH WASN'T FOUND
	HLRZS	T1		;GET THE FLAGS AND WHERE TO GO TOO
	TRZN	T1,EC		;SKIP IF EOL SHOULD FOLLOW THE COMMAND
	JRST	(T1)		;NO - GO TO THE RIGHT ROUTINE
	PUSHJ	P,TSTEOL	;GO TEST FOR AN EOL
	 JRST	CMDERR		;NOT EOL - GO GIVE AN ERROR MESSAGE
	JRST	(T1)		;FOUND AN EOL GO TO THE ROUTINE


;HERE IF A COMMAND ERROR WAS DETECTED

CMDERR:	CAIE	C,.CHCNC	;SKIP IF A CONTROL-C WAS INPUT
	CAIN	C,.CHCNZ	;SKIP IF A CONTROL-Z WASN'T INPUT
	JRST	CMDABT		;GO ABORT THE JOB
	CLRBFI			;CLEAR THE INPUT BUFFER
	TXO	F,F.HLP		;SET THE HELP FLAG
	JRST	DDBMAN		;GO DO A RESCAN
	EC==400000	;COMMAND SHOULD BE FOLLOWED BY AN EOL CHAR


CMD:	.CHCRT,,DDBMAN+EC	;DO A RESCAN NOW (CARRIAGE-RETURN)
	.CHESC,,CMDESC		;FREEZE THE SCREEN (ALTMODE)
IFN FTSPACE,<
	.CHTAB,,CMDWAT		;GO GET THE NEXT COMMAND
	   " ",,CMDWAT		;GO GET THE NEXT COMMAND >
	   "+",,CMDNXT+EC	;OUTPUT NEXT PAGE
	   "-",,CMDLST+EC	;OUTPUT PREVIOUS PAGE
	   "A",,CMDALL+EC	;GO DO THE NORMAL JOB SEQUENCE
	   "D",,CMDDSP		;SET UP A NEW OUTPUT DISPLAY
	   "F",,CMDFIL		;SET UP TO TEST FOR A FILE SPECIFICATION
	   "G",,CMDGOD		;COMPLEMENT THE GOD BIT
	   "H",,CMDHLP+EC	;SET TO PRINT A HELP MESSAGE
	   "J",,CMDJOB		;SET UP TO TEST FOR A JOB
	   "K",,CMDKIL+EC	;KILL THE DISPLAY AND THE JOB
	   "L",,CMDLOG		;SET UP TO TEST FOR A LOGGED IN JOB
	   "N",,CMDNOT		;SET UP TO TEST FOR A NOT LOGGED IN JOB
IFN FTPATH,<
	   "P",,CMDPTH+EC	;COMPLEMENT THE PATH BIT >
	   "S",,CMDSLP		;GO GET THE SLEEP TIME
IFN FTTITLE,<
	   "T",,CMDTTL+EC	;COMPLEMENT THE OUTPUT OF THE TITLE >
IFN FTWHAT,<
	   "W",,CMDWHT+EC	;COMPLEMENT THE COMMAND BUFFER BIT >
CMDSIZ==.-CMD
;HERE ON A "-" COMMAND - DECREMENT THE DISPLAY BY ONE PAGE

CMDLST:	SOSGE	PAGNUM		;DECREMENT THE PAGE POINTER


;HERE ON A "+" COMMAND - ADVANCE THE DISPLAY BY ONE PAGE

CMDNXT:	AOS	PAGNUM		;INCREMENT THE PAGE POINTER
	PUSHJ	P,PAGADJ	;SET UP THE PAGE BOUNDARY
	JRST	CMDNOW		;DO A RESCAN NOW


;HERE ON A "G" COMMAND - COMPLEMENT THE 'GOD' BIT

CMDGOD:	PUSHJ	P,WLDSIX	;GO GET THE PASSWORD
	 JRST	CMDERR		;ERROR WHILE GETTING THE PASSWORD
	PUSHJ	P,TSTEO0	;GO TEST FOR AN E-O-L CHARACTER
	 JRST	CMDERR		;ERROR, NOT AN E-O-L CHARACTER
	CAXE	T1,PASWRD	;SKIP IF THE RIGHT PASSWORD WAS INPUT
	JRST	CMDERR		;GO GIVE A COMMAND ERROR
	TXC	F,F.GOD		;COMPLEMENT THE GOD BIT
	JRST	CMDNOW		;GO DO A RESCAN


;HERE ON A CONTROL-C OR CONTROL-Z COMMAND - ABORT THE PROGRAM

CMDABT:	TXO	F,F.DCT		;DON'T CLEAR THE TERMINAL INPUT BUFFER
	CLRBFO			;CLEAR THE OUTPUT BUFFER
	PUSHJ	P,@TRMCLR(P1)	;GO CLEAR THE SCREEN
CMDAB0:	SETZM	INTBLK+.EROPC	;ALLOW MORE CONTROL-C'S
	PUSHJ	P,RSTTRM	;GO RESTORE THE TRMINAL CHARACTERISTICS
CMDAB1:	TXZN	F,F.DCT		;SKIP IF BUFFER ISN'T TO BE CLEARED
	CLRBFI			;CLEAR THE INPUT BUFFER
IFN FTDEBUG,<
	TXNN	F,F.DDT		;SKIP IF DDT IS LOADED >
	RELEASE	TTY,		;RELEASE THE TTY
	SETZM	.JBINT##	;DISABLE CONTROL-C INTERCEPT
	MONRT.			;RETURN TO MONITOR MODE
	JRST	DDBDPY		;RESTART THE PROGRAM ON A CONTINUE


;HERE ON A "W" COMMAND - COMPLMENT THE 'WHAT' BIT

IFN FTWHAT,<
CMDWHT:	TXC	F,F.WHT		;COMPLEMENT THE COMMAND BUFFER BIT
	JRST	CMDNOW		;DO A RESCAN NOW >
;HERE ON A "N" COMMAND - CHANGE THE LOGGED IN PPN NOT TO DISPLAY

CMDNOT:	TXNE	F,F.GOD		;SKIP IF NOT GOD
	PUSHJ	P,SCAN		;GO GET THE PPN
	 JRST	CMDERR		;AN ERROR INFORM THE USER
	TXNE	F,F.PPN		;SKIP IF A PPN WASN'T INPUT
	JRST	CMDNO0		;SKIP SOME CODE
	MOVE	T1,MYPPN	;GET MY PPN
	MOVEM	T1,XDIR		;SAVE FOR
	SETOM	XDIRMSK		; 'TSTNOT'
CMDNO0:	MOVEI	T1,TSTNOT	;SET UP TO GET THE NOT LOGGED IN PPN
	MOVEM	T1,XROUTIN	;SAVE FOR LATER
	JRST	CMDFI0		;GO SET EVERYTHING RIGHT


;HERE ON A "L" COMMAND - CHANGE THE LOGGED IN PPN TO DISPLAY

CMDLOG:	SKIPA	T1,[TSTLOG]	;SET UP TO GET THE LOGGED IN PPN


;HERE ON A "F" COMMAND - CHANGE THE FILE SPECIFICATION TO DISPLAY

CMDFIL:	MOVEI	T1,TSTFIL	;SET UP TO TEST A FILE SPECIFICATION
	MOVEM	T1,XROUTIN	;SAVE FOR LATER
	PUSHJ	P,SCAN		;TO SCAN THE FILE SPECIFICATION
	 JRST	CMDERR		;ERROR IN SPECIFICATION
CMDFI0:	MOVE	T1,[XROUTI,,ROUTIN]  ;SET TO STORE THE SPECIFICATION
	BLT	T1,BLTEND	     ; IN THE RIGHT PLACE
IFN FTJOB,<
	TXZ	F,F.JOB		;ZERO THE JOB DISPLAY FLAG >
CMDFI1:	TXO	F,F.WLD		;SET THE WILD FLAG
CMDFI2:	SETZM	PAGNUM		;START ON PAGE ONE
	PUSHJ	P,PAGADJ	;SET UP THE PAGE BOUNDARY
CMDFI3:
IFN FTWHAT,<
	PUSHJ	P,CMDOUT	;GO BUILD THE COMMAND STRING BUFFER >
	JRST	CMDNOW		;GO DO A RESCAN
;HERE ON A "J" COMMAND - CHANGE THE JOB NUMBER TO DISPLAY

CMDJOB:	PUSHJ	P,DECIN		;GO GET A DECIMAL NUMBER
	 JRST	CMDERR		;JUMP IF NO EOL SEEN
	CAIG	T1,^D0		;SKIP IF NOT JOB ZERO
	MOVE	T1,CURJOB	;CONVERT JOB ZERO INTO MY JOB NUMBER
	CAMLE	T1,JOBMAX	;SKIP IF THE JOB NUMBER IS .LT. JOBMAX
	JRST	CMDERR		;JUMP IF JOB NUMBER IS OUT OF RANGE
	MOVEM	T1,JOBNUM	;SAVE THE JOB NUMBER FOR LATER
	MOVE	T1,IDIR		;GET THE DEFAULT
	MOVEM	T1,DIR		; DIRECTORY
	MOVE	T1,IDIRMSK	;GET THE DEFAULT
	MOVEM	T1,DIRMSK	; DIRECTORY MASK
	MOVEI	T1,TSTJOB	;SET UP TO TEST FOR A JOB
	MOVEM	T1,ROUTIN	;SAVE FOR LAVER
IFN FTJOB,<
	TXO	F,F.JOB!F.PAS!F.SRH  ;SET SOME JOB DISPLAY FLAGS >
	JRST	CMDFI1		;CLEAR THE PAGE COUNTER AND DO A RESCAN


;HERE ON AN "A" COMMAND - DISPLAY ALL DDB'S

CMDALL:	TXNN	F,F.GOD		;SKIP IF GOD
	JRST	CMDERR		;GO INFORM USER NOT A VALID COMMAND
	TXZ	F,F.WLD!F.JOB	;CLEAR THE WILD AND JOB DISPLAY FLAGS
	JRST	CMDFI2		;CLEAR THE PAGE COUNTER AND DO A RESCAN


;HERE ON A "H" COMMAND - DISPLAY A HELP TEXT

CMDHLP:	PUSHJ	P,@TRMCLR(P1)	;GO CLEAR THE SCREEN
	OUTSTR	HLPBUF		;OUTPUT THE HELP MESSAGE
	PUSHJ	P,@TRMHOM(P1)	;GO HOME THE TERMINAL
	TXO	F,F.CLR		;CLEAR THE SCREEN BEFORE NEXT SCAN
	JRST	CMDWAT		;GO WAIT FOR A COMMAND


;HERE ON A "K" COMMAND - KILL THE DISPLAY AND THE JOB

CMDKIL:	PUSHJ	P,CLRLIN	;CLEAR TO THE END OF THE COMMAND LINE
	PUSHJ	P,@TRMCLR(P1)	;CLEAR THE TERMINAL
	PUSHJ	P,RSTTRM	;GO RESTORE THE TERMINAL CHARACTERISTICS
	MOVEI	T1,LGOBLK	;SET UP THE RUN
	RUN	T1,UU.PHY	; THE LOGOUT CUSP
	 HALT	.		;NO 'SYS:LOGOUT'
;HERE ON A "S" COMMAND - CHANGE THE SLEEP TIME BETWEEN DISPLAYS

CMDSLP:	PUSHJ	P,DECIN		;GO GET A DECIMAL NUMBER
	 JRST	CMDERR		;NO END-OF-LINE, GO INFORM USER
	CAILE	T1,^D60		;SKIP IF LESS THAN 61 SECONDS
	JRST	CMDERR		;ERROR IF THE TIME IS GREATER THAN 60
	IMULI	T1,^D1000	;CONVERT TO MILLISECONDS
	CAIN	T1,^D0		;SKIP IF THE SLEEP TIME ISN'T ZERO
	MOVEI	T1,^D250	;SET THE SLEEP TIME TO 250 MILLISECONDS
	HRRM	T1,HIBTIM	;SAVE FOR LATER
IFN FTSLEEP,<
	TXNN	F,F.GOD		;SKIP IF GOD
	CAXL	T1,SLPMIN	;SKIP IF LESS THE MINIMUM SLEEP TIME
	TDZA	T1,T1		;DON'T ADJUST THE SLEEP TIME
	MOVX	T1,SLPSCN	;SET THE SLEEP
	MOVEM	T1,SLPCNT	; TIME COUNTER >
	JRST	CMDFI3		;GO UPDATE THE SCREEN NOW


;HERE ON A "ESCAPE" COMMAND - FREEZE THE SCREEN

IFN FTESCAPE,<
CMDESC:	TXO	F,F.ESC		;PAUSE AFTER UPDATING THE SCREEN
	JRST	DDBMAN		;GO UPDATE THE SCREEN NOW >
IFE FTESCAPE,<
CMDESC==CMDWAT	;FREEZE THE SCREEN AND WAIT FOR A NEW COMMAND >


;HERE ON A "D" COMMAND - CHANGE THE TYPE OF DISPLAY

CMDDSP:	PUSHJ	P,WLDSIX	;GO GET THE NEW DISPLAY TYPE
	 JRST	CMDERR		;ERROR WHILE SEACHING FOR A DISPLAY TYPE
	PUSHJ	P,TSTEO0	;TEST FOR AN E-O-L CHARACTER
	 JRST	CMDERR		;ERROR, NOT AN E-O-L CHARACTER
	JUMPE	T1,CMDDS1	;JUMP IF THE DEFAULT DISPLAY IS TO BE USED
	MOVE	T2,[-DSPSIZ,,DSPNAM]  ;INFORM TSTABR WHAT TO MATCH
	PUSHJ	P,TSTABR	;GO FIND OUT WHICH ONE MATCHES
	 JRST	CMDERR		;NO MATCH OR NOT UNIQUE
	HLRZ	P1,DSPNUM(T2)	;SET UP THE DISPLAY OFFSET
CMDDS0:	PUSHJ	P,SETDSP	;GO SET UP THE SCREEN SIZE
	JRST	CMDFI2		;GO CLEAR THE PAGE NUMBER AND DO A RESCAN
CMDDS1:	PUSHJ	P,TRMDSP	;GO READ THE DEFAULT DISPLAY TYPE
	JRST	CMDFI2		;GO CLEAR THE PAGE NUMBER AND DO A RESCAN
;HERE ON A "P" COMMAND - CHANGE THE DISPLAY OF THE ENTIRE PATH

IFN FTPATH,<
CMDPTH:	TXC	F,F.PTH		;COMPLEMENT THE ENTIRE PATH BIT
	JRST	CMDDS0		;GO SET UP THE SCREEN SIZE >


;HERE ON A "T" COMMAND - CHANGE THE DISPLAY OF THE TITLE LINE

IFN FTTITLE,<
CMDTTL:	TXC	F,F.TTL		;COMPLEMENT THE TITLE BIT
	JRST	CMDDS0		;GO SET UP THE SCREEN SIZE >


;HERE TO SLEEP FOR AWHILE

CMDFIN:	MOVE	T1,HIBTIM
	HIBER	T1,		;HIBERNATE AWHILE
	 JFCL			;NO - PUNT IT
	INCHSL	C		;SKIP IF INPUT MADE ME WAKE UP
	 JRST	DDBMAN		;NO - GO DO A RESCAN
	JRST	CMDTST		;GO TEST THIS NEW COMMAND


;HERE TO SEE IF THE SCREEN SHOULD BE UPDATED NOW

CMDNOW:
IFN FTSPACE,<
	CAIE	C," "		;SKIP IF THE CHARACTER IS AN SPACE
	CAIN	C,.CHTAB	;SKIP IF THE CHARACTER IS A TAB
	JRST	CMDWAT		;GO WAIT FOR A NEW COMMAND >
	CAIN	C,.CHESC	;SKIP IF THE CHARACTER ISN'T AN ESCAPE
	JRST	CMDWAT		;GO WAIT FOR A NEW COMMAND
	JRST	DDBMAN		;GO UPDATE THE SCREEN NOW!!!
SUBTTL	SUBROUTINE TO INPUT A FILE SPECIFICATION


SCAN:	MOVE	T1,[INOD,,XNOD]	;SET UP THE INITIAL CONDITIONS
	BLT	T1,XBLTEND	; FOR SCAN - ALL:*.*[MYPPN]
	TXZ	F,F.NOD!F.DEV!F.FIL!F.EXT!F.PPN  ;CLEAR SOME FLAGS

SCAN0:	PUSHJ	P,WLDSIX	;GO READ A SIXBIT WORD
	 POPJ	P,		;ERROR IN THE SIXBIT ROUTINE
	CAIE	C,"["		;SKIP IF AN OPEN BRACKET
	CAIN	C,"<"		;SKIP IF NOT AN OPEN CARROT
	JRST	SCNDIR		;GO PROCESS IT
IFE <MONVER-603>*<MONVER-700>,<
	CAIN	C,"_"		;SKIP IF NOT A BACKARROW (UNDERSCORE)
	JRST	SCNNOD		;GO PROCESS IT >
	CAIN	C,":"		;SKIP IF NOT A COLON
	JRST	SCNDEV		;GO PROCESS IT
SCAN1:	CAIN	C,"."		;SKIP IF NOT AN PERIOD
	JRST	SCNFIL		;GO PROCESS IT
SCAN2:	PUSHJ	P,TSTEO0	;GO SEE IF AN EOL WAS FOUND
	 POPJ	P,		;NO E-O-L - ERROR RETURN

SCNEXT:	TXNE	F,F.FIL		;SKIP IF NO FILE-NAME SEEN
	JRST	SCNEX0
	JUMPE	T1,.POPJ1	;JUMP IF DEFAULT NAME IS WANTED
	TXO	F,F.FIL		;SET THE FILE SEEN FLAG
	MOVEM	T1,XFIL		;SAVE FOR LATER
	MOVEM	T2,XFILMSK	;SAVE FOR LATER
	PJRST	.POPJ1		;GIVE A GOOD RETURN
SCNEX0:	TXO	F,F.EXT		;SET THE EXTENSION SEEN FLAG
	HLR	T1,T2		;GET THE EXTENSION MASK
	MOVEM	T1,XEXT		;SAVE FOR LATER
	CAME	T1,['UFD',,-1]	;SKIP IF THE EXTENSION IS 'UFD'
	PJRST	.POPJ1		;GIVE A GOOD RETURN
	MOVE	T1,[1,,1]	;MOVE THE
	EXCH	T1,XDIR		; DIRECTORY
	MOVEM	T1,XFIL		; TO THE FILE
	SETO	T1,		; NAME AND [1,1]
	EXCH	T1,XDIRMSK	; TO THE
	MOVEM	T1,XFILMSK	; DIRECTORY
	PJRST	.POPJ1		;GIVE A GOOD RETURN
IFE <MONVER-603>*<MONVER-700>,<
SCNNOD:	TXON	F,F.NOD		;SKIP IF THE NODE FLAG IS SET
	TXNE	F,F.DEV!F.FIL!F.PPN  ;SKIP IF NON ARE SET
	POPJ	P,		;ERROR RETURN
	JUMPE	T1,.POPJ	;NULL NODE IS ILLEGAL - ERROR RETURN
	MOVEM	T1,XNOD		;SAVE FOR LATER
	MOVEM	T2,XNODMSK	; ..
	JRST	SCAN0		;GO LOOK FOR MORE >

SCNDEV:	TXON	F,F.DEV		;SKIP IF THE DEVICE FLAG IS SET
	TXNE	F,F.FIL!F.PPN	;SKIP IF NON ARE SET
	POPJ	P,		;ERROR RETURN
	JUMPE	T1,.POPJ	;NULL DEVICE IS ILLEGAL - ERROR RETURN
	CAMN	T1,IDEV		;SKIP IF THE DEVICE ISN'T 'ALL'
	JRST	SCAN0		;GO LOOK FOR MORE
	MOVEM	T1,XDEV		;SAVE FOR LATER
	MOVEM	T2,XDEVMSK	; ..
	JRST	SCAN0		;GO LOOK FOR MORE

SCNFIL:	TXOE	F,F.FIL		;SKIP IF I HAVEN'T BEEN HERE BEFORE
	POPJ	P,		;ERROR RETURN
	JUMPE	T1,SCAN0	;JUMP IF THE DEFAULT NAME IS WANTED
	MOVEM	T1,XFIL		;SAVE FOR LATER
	MOVEM	T2,XFILMSK	; ..
	JRST	SCAN0		;GO LOOK FOR MORE
SCNDIR:	TXOE	F,F.PPN		;SKIP IF I HAVEN'T BEEN HERE BEFORE
	POPJ	P,		;ERROR RETURN
	PUSHJ	P,WLDOCT	;GO GET THE PROJECT NUMBER THEN
	CAIE	C,","		;SKIP IF A COMMA
	POPJ	P,		;ERROR RETURN
	CAMN	T3,[-1,,0]	;SKIP IF THE PROJECT NUMBER ISN'T ZERO
	HLRO	T3,MYPPN	;USE MY PROJECT NUMBER THEN
IFN FTPROJ,<
	TXNE	F,F.GOD		;SKIP IF NOT A PRIVILEGED USER
	JRST	SCNDI0
	HLRO	T4,MYPPN	;GET THE UESR'S PROJECT NUMBER
	CAME	T3,T4		;SKIP IF THE INPUT PROJECT AND THE
				; USER'S PROJECT NUMBER DON'T MATCH
	POPJ	P,		;ERROR RETURN >
SCNDI0:	HRLZM	T3,XDIR		;SAVE FOR LATER
	HLLZM	T3,XDIRMSK	; ..
	PUSHJ	P,WLDOCT	;GO GET THE PROGRAMMER NUMBER THEN
	CAMN	T3,[-1,,0]	;SKIP IF THE PROGRAMMER NUMBER ISN'T ZERO
	HRRO	T3,MYPPN	;USE MY PROGRAMMER NUMBER THEN
IFN FTPROG,<
	TXNE	F,F.GOD		;SKIP IF NOT A PRIVILEGED USER
	JRST	SCNDI1
	HRRO	T4,MYPPN	;GET THE UESR'S PROGRAMMER NUMBER
	CAME	T3,T4		;SKIP IF THE INPUT PROGRAMMER AND THE
				; USER'S PROGRAMMER NUMBER DON'T MATCH
	POPJ	P,		;ERROR RETURN >
SCNDI1:	HRRM	T3,XDIR		;SAVE FOR LATER
	HLRM	T3,XDIRMSK	; ..
REPEAT 0,<			;		**** SAVE T1-T2 ****
	PUSH	P,P1		;SAVE P1
	MOVSI	P1,-<LIMLVL+1>	;SET UP A COUNTER
SCNDI2:	CAIE	C,","		;SKIP IF THE CHARACTER IS A COMMA
	JRST	SCNDI4		;GO TEST FOR EOL
	AOBJP	P1,SCNDI3	;JUMP IF TOO MANY SFD
	PUSHJ	P,WLDSIX	;GO READ THE SFD NAME
	 JRST	SCNDI3		;ERROR IN SFD NAME
	JUMPE	T1,SCNDI3	;NULL SFD IS AN ILLEGAL
	MOVEM	T1,XDIR+1(P1)	;SAVE THE SFD NAME
	MOVEM	T2,XDIRMSK+1(P1);SAVE THE SFD MASK
	JRST	SCNDI2		;LOOP BACK FOR MORE
SCNDI3:	POP	P,P1		;RESTORE P1
	POPJ	P,		;ERROR RETURN
SCNDI4:	POP	P,P1		;RESTORE P1 >
	CAIE	C,"]"		;SKIP IF THE BREAK CHARACTER WAS A "]"
	CAIN	C,">"		;SKIP IF THE BREAK CHARACTER WASN'T A ">"
	JRST	[XCT	INCHR		;GET THE NEXT CHARACTER THEN
		 JRST	SCAN1]		;GO TEST FOR A "."
	JRST	SCAN2		;GO TEST FOR AN E-O-L
SUBTTL	THE INPUT SUBROUTINES


;HERE TO INPUT A NUMBER

OCTIN:	SKIPA	T3,EIGHT	;SET UP OF OCTAL INPUT
DECIN:	MOVEI	T3,^D10		;SET UP OF DECIMAL INPUT
RDXIN:	SETZ	T1,		;CLEAR THE INPUT BUFFER
RDXIN0:	XCT	INCHR		;GET A CHARACTER
	CAIL	C,"0"		;SKIP IF LESS THAN AN ASCII ZERO
	CAIL	C,"0"(T3)	;SKIP IF LESS THAN THE RADIX OF INPUT
	PJRST	TSTEO0		;GO TEST FOR EOL
	IMULI	T1,(T3)		;MULIPLY BY THE RADIX
	ADDI	T1,-"0"(C)	;ADD IN THE NEW DIGIT
	JRST	RDXIN0		;GO GET ANOTHER CHAR


;HERE TO INPUT A WILD OCTAL NUMBER

WLDOCT:	MOVSI	T3,-1		;SET UP THE DEFAULT NUMBER
	MOVEI	T4,^D7		;SET UP A CHARACTER COUNTER
WLDOC0:	SOJL	T4,.POPJ	;RETURN IF MORE THAN SIX DIGITS INPUT
	XCT	INCHR		;GET A CHARACTER
	CAIL	C,"0"		;SKIP IF LESS THAN A "0"
	CAILE	C,"7"		;SKIP IF LESS THAN AN "8"
	JRST	WLDOC1
	LSH	T3,3		;MULTIPLY BY 8
	TLO	T3,7		;PUT A 7 IN THE MASK
	ORI	T3,-"0"(C)	;ADD IN THE LAST NUMBER
	JRST	WLDOC0		;GO GET ANOTHER NUMBER
WLDOC1:	CAIN	C,"*"		;SKIP IF NOT AN ASTRISK
	JRST	WLDOC2
	CAIE	C,"?"		;SKIP IF A QUESTION MARK
	POPJ	P,		;RETURN
	LSH	T3,3		;MULTIPLY BY 8
	JRST	WLDOC0		;LOOP FOR MORE DIGITS
WLDOC2:	CAME	T3,[-1,,0]	;SKIP IF THE DEFAULT NUMBER
	POPJ	P,		;ERROR RETURN
	SETZ	T3,		;SET THE '*' FLAG
	XCT	INCHR		;GET THE NEXT CHARACTER
	POPJ	P,		;RETURN
;HERE TO INPUT A WILD SIXBIT WORD

WLDSIX:	TXZ	F,F.AST		;RESET THE ASTRISK FLAG
	SETZ	T1,		;RESET THE SIXBIT WORD
	SETO	T2,		;RESET THE MASK WORD
	MOVE	T3,[POINT 6,T1]	;SET UP A BYTE POINTER

WLDSI0:	XCT	INCHR		;GET A CHARACTER FROM THE USER
	CAIL	C,"a"		;SKIP IF LESS THAN A LOWER CASE A
	CAILE	C,"z"		;SKIP IF LESS THAN A LOWER CASE Z
	JRST	WLDSI3		;GO STORE THE CHARACTER
	MOVEI	C,"A"-"a"(C)	;CONVERT LOWER CASE TO UPPER CASE

WLDSI1:	TXNE	F,F.AST		;SKIP IF AN ASTRISK HAS BEEN INPUT
	POPJ	P,		;ERROR
WLDSI2:	MOVEI	C,' '-" "(C)	;CONVERT ASCII TO SIXBIT
	TXNE	T3,77B5		;SKIP IF THE SIXBIT WORD IS FULL
	IDPB	C,T3		;STORE THE CHARACTER
	JRST	WLDSI0		;GO GET THE NEXT CHARACTER

WLDSI3:	CAIG	C,"Z"		;SKIP IF GREATER THAN A "Z"
	CAIGE	C,"0"		;SKIP IF GREATER THAN A "0"
	JRST	WLDSI4		;GO TEST FOR AN "*" OR "?"
	CAIGE	C,"A"		;SKIP IF GREATER THAN A "A"
	CAIG	C,"9"		;SKIP IF GREATER THAN A "9"
	JRST	WLDSI1		;GO STORE THE CHARACTER

WLDSI4:	CAIN	C,"*"		;SKIP IF NOT AN ASTRISK
	JRST	WLDAST		;GO PROCESS THE ASTRISK
	CAIE	C,"?"		;SKIP IF A QUESTION MARK
	PJRST	.POPJ1		;GIVE A GOOD RETURN

WLDQST:	TXNE	F,F.AST		;SKIP IF THE ASTRISK FLAG ISN'T SET
	POPJ	P,		;ERROR RETURN
	MOVX	T4,77B5		;SET UP THE QUESTION MARK MASK
	JRST	WLDAS0		;TO STORE THE CHARACTER AND MASK

WLDAST:	TXOE	F,F.AST		;SKIP IT ASTRISK FLAG ISN'T SET AND SET IT
	POPJ	P,		;ERROR RETURN
	SETO	T4,		;SET THE MASK FLAG
WLDAS0:	LDB	T5,[POINT 6,T3,5]  ;GET THE LOCATION OF THE BYTE
	LSH	T4,-^D36(T5)	;POSITION THE MASK
	XOR	T2,T4		;STORE THE MASK
	JRST	WLDSI2		;TO STORE THE CHARACTER
SUBTTL	THE OUTPUT SUBROUTINES


;HERE TO OUTPUT A PPN

PPNOUT:	SETZ	T4,		;CLEAR THE JUSTIFY COUNTER
PPNJST:	HLRZ	T1,T5		;SET TO OUTPUT THE PROJ NUMBER
	PUSHJ	P,OCTJST	;OUTPUT THE PROJ NUMBER
	PUSHJ	P,COMOUT	;OUTPUT A COMMA
	MOVEI	T1,(T5)		;SET UP TO OUTPUT THE PROG NUMBER


;HERE TO OUTPUT A NUMBER

OCTOUT:	TDZA	T4,T4
DECOUT:	TDZA	T4,T4

OCTJST:	SKIPA	T3,EIGHT	;SET UP FOR OCTAL OUTPUT
DECJST:	MOVEI	T3,^D10		;SET UP FOR DECIMAL OUTPUT
RDXJST:	JUMPGE	T1,RDXJS0	;JUMP IF THE NUMBER OF POSITIVE
	MOVNS	T1		;MAKE THE NUMBER POSITIVE
	SOJ	T4,		;DECREMENT COLUMN COUNTER
	TXOA	F,F.NEG		;SET THE NEGATIVE FLAG AND SKIP
RDXJS0:	TXZ	F,F.NEG		;CLEAR THE NEGATIVE FLAG
RDXJS1:	SOJ	T4,		;DECREMENT COLUMN COUNTER
	IDIVI	T1,(T3)		;GET A DIGIT
	MOVEI	C,"0"(T2)	;CONVERT BINARY TO ASCII
	HRLM	C,(P)		;SAVE FOR LATER
	JUMPE	T1,RDXJS3	;JUMP IF NO MORE DIGITS TO OUTPUT
	PUSHJ	P,RDXJS1	;GO GET ANOTHER DIGIT
RDXJS2:	HLRZ	C,(P)		;GET A DIGIT AND FALL INTO CHROUT


;HERE TO OUTPUT A CHAR

CHROUT:	AOJ	CC,		;INCREMENT THE COLUMN COUNTER
	IDPB	C,BP		;SAVE THE CHAR
EIGHT:	POPJ	P,8		;A CONSTANT FOR OCTOUT AND OCTJST


RDXJS3:	JUMPLE	T4,RDXJS5	;JUMP IF NO SPACES TO OUTPUT
	MOVEI	C," "
RDXJS4:	PUSHJ	P,CHROUT	;OUTPUT A SPACE
	SOJG	T4,RDXJS4	;JUMP IF MORE SPACES TO OUTPUT
RDXJS5:	TXNN	F,F.NEG		;SKIP IF THE NEGATIVE FLAG IS SET
	JRST	RDXJS2		;GO OUTPUT SOME DIGITS
	MOVEI	C,"-"		;OUTPUT A
	PUSHJ	P,CHROUT	; NEGATIVE SIGN
	JRST	RDXJS2		;GO OUTPUT SOME DIGITS
;HERE TO JUSTIFY THE OUTPUT

JUST:	SUBI	T1,(CC)		;GET THE NUMBER OF SPACES NEEDED
	JUMPLE	T1,.POPJ	;JUMP IF NONE TO OUTPUT
	MOVEI	C," "
JUST0:	PUSHJ	P,CHROUT	;OUTPUT A SPACE
	SOJG	T1,JUST0	;LOOP IF MORE SPACES TO OUTPUT
	POPJ	P,		;RETURN


;HERE TO OUTPUT AN ASCIZ STRING

ASCOUT:	TLOA	T1,(POINT 7)	;SET UP THE BYTE POINTER
ASCOU0:	PUSHJ	P,CHROUT	;OUTPUT THE CHAR
	ILDB	C,T1		;GET THE NEXT CHAR
	JUMPN	C,ASCOU0	;GO OUTPUT THE CHAR IF NON-NULL
	POPJ	P,		;RETURN


;HERE TO OUTPUT A SIXBIT WORD

SIXOU0:	SETZ	T2,		;CLEAR A SHIFT REGISTER
	ROTC	T1,6		;GET THE CHAR INTO T2
	MOVEI	C," "-' '(T2)	;CONVERT FROM SIXBIT TO ASCII
	PUSHJ	P,CHROUT	;OUTPUT THE CHAR
SIXOUT:	JUMPN	T1,SIXOU0	;LOOP FOR MORE CHARACTERS
	POPJ	P,		;RETURN


;HERE TO START OFF A TITLE LINE RIGHT

TTLLIN:	MOVEI	BP,(LC)		     ;MAKE A BYTE
	IMULI	BP,LINSIZ	     ; POINTER TO THE
	ADD	BP,[POINT 7,TTLBUF]  ; CURRENT LINE
	SETZ	CC,		;RESET THE COLUMN COUNT
	POPJ	P,		;RETURN

;HERE TO START OFF A LINE RIGHT

BEGLIN:	MOVEI	BP,(LC)		     ;MAKE A BYTE
	IMULI	BP,LINSIZ	     ; POINTER TO THE
	ADD	BP,[POINT 7,LINBUF]  ; CURRENT LINE
	SETZ	CC,		;RESET THE COLUMN COUNT
	POPJ	P,		;RETURN

;HERE TO FINISH OFF THE LINE RIGHT

ENDLIN:	MOVX	T1,%HZLHP	;ASSUME A HAZELTINE TERMINAL
	CAXE	P1,%HZLTP	;SKIP IF THE DISPLAY IS FOR A HAZELTINE-2000
	CAXN	P1,%MDLTP	;SKIP IF NOT THE DISPLAY IS FOR A MODULAR ONE
	PUSHJ	P,JUST		;CLEAR THRU COLUMN 68
	MOVEI	T1,[BYTE (7).CHCRT,.CHLFD,0]
	PUSHJ	P,ASCOUT	;OUTPUT A CR-LF
	PJRST	CHROUT		;GO PUT A NULL CHAR IN THE LINE BUFFER
;HERE TO OUTPUT A COMMA

COMOUT:	MOVEI	C,","		;GET A COMMA TO OUTPUT
	PJRST	CHROUT		;OUTPUT IT AND RETURN


;HERE TO OUTPUT A COLON

CLNOUT:	MOVEI	C,":"		;GET A COLON TO OUTPUT
	PJRST	CHROUT		;OUTPUT IT AND RETURN


;HERE TO OUTPUT A SLASH

SLHOUT:	MOVEI	C,"/"		;GET A SLASH TO OUTPUT
	PJRST	CHROUT		;OUTPUT IT AND RETURN


;HERE TO OUTPUT A SPACE

SPAOUT:	MOVEI	C," "		;GET A SPACE TO OUTPUT
	PJRST	CHROUT		;OUTPUT IT AND RETURN


;HERE TO OUTPUT THE LOW OR HIGH SEGMENT SIZE

IFN FTJOB,<
HGHOUT:	TXZA	F,F.LOW		;CLEAR THE LOW SEGMENT FLAG
LOWOUT:	TXO	F,F.LOW		;SET THE LOW SEGMENT FLAG
IFN FTVM,<
	TXNN	F,F.VMS		;SKIP IF A VIRTUAL MEMORY SYSTEM
	JRST	LOWOU0		;USE THE OLD WAY
	MOVE	T1,@GETSWP	;GET THE SWAPPED SIZE
	TXNE	F,F.LOW		;SKIP IF THE HIGH SEGMENT
	JRST	LOWOU3		;RETURN ONLY THE LAST 9 BITS
	MOVX	T1,SS.SHR	;GET THE SHARABLE BIT
	TDNE	T1,@GETSTS	;SKIP IF THE SEGMENT ISN'T SHARABLE
	JRST	LOWOU0		;GO USE THE OLD WAY
	MOVS	T1,@GETSWP	;GET THE SWAPPED SIZE
	JRST	LOWOU3		;RETURN ONLY THE LAST 9 BITS >
LOWOU0:	MOVS	T1,@GETADR	;GET THE PROTECTION REGISTER INFO
	JUMPE	T1,LOWOU1	;JUMP IF ZERO
	TXNE	F,F.LOW		;SKIP IF THE HIGH SEGMENT
	TXNN	P4,JS.SWP	;SKIP IF SWAPPED
	JRST	LOWOU2		;GO CONVERT WORDS TO PAGES OR K
LOWOU1:	MOVE	T1,@GETSWP	;GET THE SWAPPED SIZE
	ANDI	T1,777		;GET ONLY 9 BITS
	JUMPN	T1,DECOUT	;OUTPUT IT IF NON-ZERO
	MOVS	T1,@GETADR	;GET THE PROTECTION REGISTER
LOWOU2:	AOJ	T1,		;ROUND UP THE NEARIST UNIT
	LSH	T1,-^D9		;CONVERT WORDS TO PAGES
	TXNN	F,F.PAG		;SKIP IF KI OR KL
	LSH	T1,-^D1		;CONVERT PAGES TO K
LOWOU3:	ANDI	T1,777		;CLEAR OUT SOME TRASH
	PJRST	DECOUT		; AND OUTPUT THE SIZE >
;HERE TO OUTPUT A TIME VALUE

IFN FTJOB,<
TIMOUT:	TXZ	F,F.DIG		;CLEAR THE DIGIT OUTPUT FLAG
	IDIV	T1,JIFHOR	;GET THE NUMBER OF HOURS
	PUSH	P,T2		;SAVE THE MINUTES AND SECONDS FOR LATER
	JUMPE	T1,TIMOU0	;JUMP IF THE HOURS FIELD IS ZERO
	PUSHJ	P,TWOOUT	;OUTPUT THE HOURS
	PUSHJ	P,CLNOUT	;OUTPUT A COLON
TIMOU0:	POP	P,T1		;RESTORE THE MINUTES AND SECONDS
	IDIV	T1,JIFMIN	;GET THE MINUTES
	PUSH	P,T2		;SAVE THE SECONDS FOR LATER
	TXNN	F,F.DIG		;SKIP IS A DIGIT HAS BEEN OUTPUT
	JUMPE	T1,TIMOU1	;JUMP IF THE MINUTES FIELD IS ZERO
	PUSHJ	P,TWOOUT	;OUTPUT THE MINUTES
	PUSHJ	P,CLNOUT	;OUTPUT A COLON
TIMOU1:	POP	P,T1		;RESTORE THE SECONDS
	IDIV	T1,JIFFIE	;GET THE WHOLE SECONDS
	PUSH	P,T2		;SAVE THE PART OF A SECOND FOR LATER
	PUSHJ	P,TWOOUT	;OUTPUT THE WHOLE SECONDS
	MOVEI	C,"."		;OUTPUT
	PUSHJ	P,CHROUT	; A "."
	POP	P,T1		;RESTORE THE PART OF A SECOND
	IMULI	T1,^D100	;CONVERT TO CENTI-SECONDS
	IDIV	T1,JIFFIE	; AND FALL INTO 'TWOOUT' >


;HERE TO OUTPUT A TWO DIGIT NUMBER IF NEEDED

IFN FTJOB,<
TWOOUT:	TXON	F,F.DIG		;SKIP IF A DIGIT HAS BEEN OUTPUT
	PJRST	DECOUT		;OUTPUT THE NUMBER AND RETURN
	MOVEI	C,"0"		;SET UP TO OUTPUT A ZERO
	CAIGE	T1,^D10		;SKIP IF THE NUMBER IS GREATER THAN 9
	PUSHJ	P,CHROUT	;OUTPUT A ZERO
	PJRST	DECOUT		;OUTPUT THE NUMBER AND RETURN >


;HERE TO JUSTIFY AND OUTPUT A SIXBIT WORD

SIXJST:	PUSHJ	P,JUST		;JUSTIFY TO THE RIGHT COLUMN
	MOVE	T1,T2		;GET THE SIXBIT WORD TO BE OUTPUT
	PJRST	SIXOUT		;NOW OUTPUT IT AND RETURN
;HERE TO OUTPUT THE JOB STATUS

IFN FTJOB,<
JOBOUT:	MOVE	P5,JOBNUM	;GET THE JOB NUMBER
	MOVE	P4,@GETSTS	;GET THE JOB'S STATUS
	TXNN	P4,JS.JNA	;SKIP IF THE JOB NUMBER HAS BE ASSIGNED
	PJRST	.POPJ1		;THE JOB ISN'T IN USE
	SKIPE	P2,@GETTTY	;SKIP IF ON TTY ASSOCIATED WITH THE JOB
	SKIPN	P3,@GETPDB	;SKIP IF THE JOB HAS A PDB
	PJRST	.POPJ1		;THE JOB ISN'T IN USE

	MOVE	T1,['PRG:  ']	;OUTPUT
	PUSHJ	P,SIXOUT	; 'PRG:'
	MOVE	T1,@GETPRG	;GET THE PROGRAM NAME
	PUSHJ	P,SIXOUT	; AND OUTPUT IT

	PUSH	P,P5		;THE SAVE JOB NUMBER FOR LATER
	MOVEI	T1,^D12		;JUSTIFY TO COLUMN
	MOVE	T2,['COR:  ']	; 12 AND OUTPUT
	PUSHJ	P,SIXJST	; 'COR:'
	PUSHJ	P,LOWOUT	;OUTPUT THE LOW SEGMENT SIZE
	SKIPG	P5,@GETSGN	;SKIP IF THERE IS A HIGH SEGMENT
	JRST	JOBOU0		;GO SEE IF SPYING
	MOVEI	C,"+"		;OUTPUT
	PUSHJ	P,CHROUT	; A "+"
	PUSHJ	P,HGHOUT	;OUTPUT THE HIGH SEGMENT SIZE
JOBOU0:	MOVEI	C,"P"		;ASSUME THE CORE IS IN PAGES
	TXNN	F,F.PAG		;SKIP IF A KI OR KL CPU
	MOVEI	C,"K"		;CORE IS IN K'S
	PUSHJ	P,CHROUT	;OUTPUT THE CORE SIZE
	JUMPGE	P5,JOBOU1	;JUMP IF NOT SPYING
	MOVSI	T1,'+S '	;OUTPUT '+S' TO SHOW
	PUSHJ	P,SIXOUT	; JOB IS SPYING
JOBOU1:	POP	P,P5		;RESTORE THE JOB NUMBER
	MOVEI	T1,^D24		;JUSTIFY TO COLUMN
	MOVE	T2,['STS:  ']	; 24 AND OUTPUT
	PUSHJ	P,SIXJST	; 'STS:'
	MOVSI	T1,'^W '	;ASSUME COMMAND WAIT STATE
	TXNE	P4,JS.RUN	;SKIP IF NOT IN A RUN STATE
	MOVSI	T1,'CW '	;ASSUME CORE WAIT STATE
	TXNE	P4,JS.CMW	;SKIP IF NOT IN COMMAND WAIT
	JRST	JOBOU4		;GO OUTPUT THE STATE
	MOVSI	T1,'OW '	;ASSUME OPERATOR WAIT
	TXNE	P4,JS.DCE	;SKIP IF NOT IN OPERATOR WAIT
	JRST	JOBOU4		;GO OUTPUT THE STATE
	MOVSI	T1,'^D '	;ASSUME DAEMON WAIT STATE
	TXNE	P4,JS.JDC	;SKIP IF NOT IN DAEMON WAIT
	JRST	JOBOU4		;GO OUTPUT THE STATE
	MOVSI	T1,'^C '	;ASSUME THE JOB IS STOPPED
	JUMPGE	P4,JOBOU4	;GO OUTPUT THE STATE
	LDB	T1,[POINT 5,P4,14]  ;GET THE STATE OF THE JOB
	IDIVI	T1,^D3		;GET THE WORD THE STATE IS IN
	IMULI	T2,^D12		;GET THE SHIFT VALUE TO GET THE STATE
	MOVE	T1,@GETWSN	;GET THE RIGHT STATE FOR THE JOB
	LSH	T1,(T2)		;GET THE STATE IF THE RIGHT PLACE
	ANDX	T1,7777B11	;CLEAR ANY UNNEEDED BITS
IFE <MONVER-603>*<MONVER-700>,<
	CAME	T1,['EW    ']	;SKIP IF IN A EVENT WAIT STATE
	JRST	JOBOU2		;SKIP THE EW STATE
	LDB	T2,[POINT 5,@GETST2,24]  ;GET THE EVENT WAIT CODE
	JUMPE	T2,JOBOU4	;0 IS UNKNOWN
	CAIG	T2,10		;SKIP IF GREATER THAN THE KNOWN ONE'S
	MOVE	T1,EVWTAB-1(T2)	;GET THE EVENT WAIT STATE
	JRST	JOBOU4		;GO OUTPUT THE STATE >
JOBOU2:	CAME	T1,['SL    ']	;SKIP IF IN A SLEEP STATE
	JRST	JOBOU3		;GO TEST THE 'TI' STATE
	TXNE	P4,JS.CLK	;SKIP IF NOT IS A CLOCK REQUEST QUEUE
	MOVSI	T1,'HB '	;CHANGE THE STATE TO HIBERNATE
	JRST	JOBOU4		;GO OUTPUT THE STATE
JOBOU3:	CAMN	T1,['TI    ']	;SKIP IF NOT TERMINAL I/O WAIT
	SKIPL	HI+DEVIOS(P2)	;SKIP IF OUTPUT WAIT
	JRST	JOBOU4		;GO OUTPUT THE STATE
	MOVSI	T1,'TO '	;CHANGE THE STATE TO TERMINAL OUTPUT
JOBOU4:	PUSHJ	P,SIXOUT	;OUTPUT THE STATE OF THE JOB
				; NOTE - T1 IS ZERO ON RETURN
	TXNE	P4,JS.LOK	;SKIP IF THE JOB ISN'T LOCKED IN CORE
	MOVSI	T1,' LS'	;JOB IS LOCKED IN CORE SHUFFLING ALLOWED
	TXNE	P4,JS.NSH	;SKIP IF THE JOB CAN BE SHUFFLED
	MOVSI	T1,' LK'	;JOB IS LOCKED IN CORE IN PLACE
	JUMPN	T1,JOBOU7	;GO OUTPUT THE STATE OF THE JOB
	TXNN	P4,JS.SWP	;SKIP IF THE JOB IS SWAPPED
	JRST	JOBOU5		;GO SEE IF VIRTUAL
	MOVSI	T1,' SW'	;ASSUME SWAPPED
	SKIPGE	@GETSWP		;SKIP IF NOT FRAGMENTED
	MOVSI	T1,' SF'	;SET THE JOB TO SWAPPED AND FRAGMENTED
JOBOU5:
IFN FTVM,<
	TXNN	F,F.VMS		;SKIP IF A VIRTUAL MEMORY SYSTEM
	JRST	JOBOU7		;GO SEE IF THE STATE SHOULD BE OUTPUT
	HLRZ	T2,@GETVRT	;GET THE VIRTUAL FLAGS FOR THE JOB
	JUMPE	T2,JOBOU7	;JUMP IF NOT VIRTUAL
	JUMPE	T1,JOBOU6	;JUMP IF NOT SWAPPED
	TLNN	T1,'SW'^!'SF'	;SKIP IF NOT FRAGMENTED
	TLCA	T1,'SF'^!'F'^!'M'  ;SET THE STATE TO 'VF'
	TLC	T1,'SW'^!'S'^!'M'  ;SET THE STATE TO 'VS'
JOBOU6:	TLC	T1,'VM'		   ;SET THE STATE TO 'VM' >
JOBOU7:	PUSHJ	P,SIXOUT	;OUTPUT THE STATE OF THE JOB
	MOVEI	T1,^D34		;JUSTIFY TO COLUMN
	MOVE	T2,['RUN:  ']	; 34 AND GET 'RUN:'
	TXNE	F,F.PAS		;SKIP IF NOT PASS ONE
	TRO	T2,' ? '	;CHANGE TO 'RUN:?'
	PUSHJ	P,SIXJST	;OUTPUT THE SIXBIT MESSAGE
	MOVN	T1,@GETTIM	;GET THE RUN TIME OF THE JOB
	EXCH	T1,TOTTIM	;SAVE FOR THE NEXT SCAN
	SUB	T1,TOTTIM	;GET THE INCREMENTAL RUN TIME
	CAIGE	T1,0		;SKIP IF NON-NEGATIVE
	MOVN	T1,TOTTIM	;USE THE TOTAL RUNTIME (ASSUME NEW JOB)
	MOVEM	T1,DELTIM	;SAVE FOR LATER
	TXNN	F,F.PAS		;SKIP IF PASS ONE
	PUSHJ	P,TIMOUT	;OUTPUT THE INCREMENTAL RUN TIME
	PUSHJ	P,SLHOUT	;OUTPUT A SLASH
	MOVN	T1,TOTTIM	;GET THE TOTAL RUN TIME
	PUSHJ	P,TIMOUT	;OUTPUT TOTAL RUN TIME

	MOVEI	T1,^D55		;JUSTIFY TO COLUMN
	MOVE	T2,['CPU:  ']	; 55 AND GET 'CPU:'
	TXNE	F,F.PAS		;SKIP IF NOT PASS ONE
	TRO	T2,' ? '	;CHANGE TO 'CPU:?'
	PUSHJ	P,SIXJST	;OUTPUT THE SIXBIT MESSAGE
	MOVE	T1,DELTIM	;GET THE DELTA RUNTIME
	IMULI	T1,^D100	;SET UP TO GET A PERCENTAGE
	MOVN	T2,@GETDAT	;GET THE DATE
	EXCH	T2,CURDAT	;SAVE FOR THE NEXT SCAN
	SUB	T2,CURDAT	;GET THE DELTA DATE
	PUSHJ	P,ADJTIM	;CONVERT TO THE RIGHT FORMAT
	MOVE	T3,T2		;ROUND THE
	ASH	T3,-^D1		; PERCENTAGE
	ADD	T1,T3		; OF RUNTIME
	IDIV	T1,T2		;GET THE PERCENTAGE OF RUNTIME
	TXNN	F,F.PAS		;SKIP IF PASS ONE
	PUSHJ	P,DECOUT	;OUTPUT THE PERCENTAGE OF RUNTIME
IFGE <MONVER-602>,<
	PUSHJ	P,SLHOUT	;OUTPUT A SLASH
	MOVN	T1,TOTTIM	;GET THE RUNTIME
	IMULI	T1,^D100	;SET UP TO GET A PERCENTAGE
	MOVN	T2,CURDAT	;GET THE LENGTH OF TIME THE
	SUB	T2,@GETJLT	; JOB HAS BEEN LOGGED IN
	PUSHJ	P,ADJTIM	;CONVERT TO THE RIGHT FORMAT
	MOVE	T3,T2		;ROUND THE
	ASH	T3,-^D1		; PERCENTAGE
	ADD	T1,T3		; OF RUNTIME
	IDIV	T1,T2		;GET THE PERCENTAGE
	PUSHJ	P,DECOUT	; OF RUNTIME >
	PUSHJ	P,ENDLIN	;FINISH OFF THE LINE RIGHT
	AOJ	LC,		;INCREMENT THE LINE COUNT
	PUSHJ	P,TTLLIN	;SET UP FOR THE NEW LINE
	MOVE	T1,HI+DEVNAM(P2);GET THE TERMINAL NAME
	HRRZ	T4,HI+DDBLDB(P2);GET THE LINK TO THE TERMINALS LDB
	JUMPE	T4,[HRLI  T1,'DET'	;SAY THE JOB IS DETACHED
		    TXNN  F,F.GOD	;SKIP IF GOD
		    TRZ   T1,-1		;CLEAR THE TERMINAL NUMBER
		    JRST  JOBO10]	;GO OUTPUT THE TERMINAL NAME
IFE <MONVER-700>,<
	PUSHJ	P,GETLDB	;SET SPY-PAGE FOR LDB
>
	MOVE	T2,HI+LDBDCH(T4);GET THE TERMINAL CHARACTERISTIC BITS
	HRL	P2,T2		;SAVE LINE NUMBER
	TLZ	P2,777000	;ISOLATE LINE NUMBER
	TXNN	T2,LDRPTY	;SKIP IF A PTY
	JRST	JOBO10		;NO NEED TO CHANGE ANY THING
	ANDX	T2,777		;REMOVE SOME UNNEEDED BITS
	SUB	T2,PTYMIN	;CONVERT FROM TTY RANGE TO PTY RANGE
	MOVSI	T1,'PTY'	;SET THE TERMINAL TO BE A PTY
	PUSH	P,JOBOU9	;SET UP TO MAKE THE PTY NAME
JOBOU8:	IDIVI	T2,^D8		;GET A DIGIT
	HRLM	T3,(P)		;SAVE IT FOR LATER
	CAIN	T2,0		;SKIP IF NOT FINISHED
	SKIPA	T3,[POINT 6,T1,17]  ;SET UP A TYPE POINTER
	PUSHJ	P,JOBOU8	;LOOP BACK
	HLRZ	T2,(P)		;RESTORE A DIGIT
	MOVEI	T2,'0'(T2)	;CONVERT FROM BINARY TO SIXBIT
	IDPB	T2,T3		;STORE THE DIGIT IN THE NAME
JOBOU9:	POPJ	P,JOBO10	;MAGIC
JOBO10:	PUSHJ	P,SIXOUT	;OUTPUT THE TERINAL NAME

	MOVEI	T1,^D7		;JUSTIFY TO COLUMN
	MOVE	T2,['HPQ:  ']	; 7 AND OUTPUT
	PUSHJ	P,SIXJST	; 'HPQ:'
	LDB	T1,[POINT 4,@GETRTD,9]  ;GET THE HPQ LEVEL
	PUSHJ	P,DECOUT	;OUTPUT THE LEVEL NUMBER

	MOVEI	T1,^D13		;JUSTIFY TO COLUMN
	MOVE	T2,['PRI:  ']	; 13 AND OUTPUT
	PUSHJ	P,SIXJST	; 'PRI:'
	LDB	T1,[POINT 3,@GETSPL,26]  ;GET THE DISK PRIORITY
	TRZE	T1,4		;SKIP IF A POSITIVE PRIORITY
	MOVNS	T1		;NEGATE THE ABSOLUTE VALUE OF THE PRIORITY
	PUSHJ	P,DECOUT	;OUTPUT THE PRIORITY

	MOVEI	T1,^D20		;JUSTIFY TO COLUMN 20
	MOVE	T2,['DSK:E ']	;ASSUME ERROR ON QUOTA EXAUSTED
	TXNE	P4,JS.SFL	;SKIP IF ERROR ON DISK FULL CONDITION
	TRC	T2,'E '^!'P '	;CHANGE ERROR TO PAUSE
	PUSHJ	P,SIXJST	;OUTPUT THE MESSAGE

	MOVEI	T1,^D26		;JUSTIFY TO COLUMN
	MOVE	T2,['DDB:  ']	; 26 AND OUTPUT
	PUSHJ	P,SIXJST	; 'DDB:'
	MOVE	T1,DDBCNT	;OUTPUT THE
	PUSHJ	P,DECOUT	; DDB COUNT
	MOVEI	T1,^D33		;JUSTIFY TO COLUMN 33
	MOVE	T2,['RED:  ']	; AND OUTPUT 'RED:'
	TXNE	F,F.PAS		;SKIP IF NOT PASS ONE
	TRO	T2,' ? '	;CHANGE TO 'RED:?'
	PUSHJ	P,SIXJST	;OUTPUT THE SIXBIT MESSAGE
	LDB	T1,[POINT 24,@GETRCT,35]  ;GET THE NUMBER OF DISK READS
	MOVNS	T1		;NEGATE THE NUMBER THE DISK READS
	EXCH	T1,DSKRED	;SAVE FOR THE NEXT SCAN
	SUB	T1,DSKRED	;GET THE INCREMENTAL DISK READS
	TXNN	F,F.PAS		;SKIP IF PASS ONE
	PUSHJ	P,DECOUT	;OUTPUT THE INCREMENTAL DISK READS
	PUSHJ	P,SLHOUT	;OUTPUT A SLASH
	MOVN	T1,DSKRED	;OUTPUT THE TOTAL
	PUSHJ	P,DECOUT	; DISK READS

	MOVEI	T1,^D49		;JUSTIFY TO COLUMN 49
	MOVE	T2,['WRT:  ']	; AND GET 'WRT:'
	TXNE	F,F.PAS		;SKIP IF NOT PASS ONE
	TRO	T2,' ? '	;CHANGE TO 'WRT:?'
	PUSHJ	P,SIXJST	;OUTPUT THE SIXBIT MESSAGE
	LDB	T1,[POINT 24,@GETWCT,35]  ;GET THE NUMBER OF DISK WRITES
	MOVNS	T1		;NEGATE THE NUMBER THE DISK WRITES
	EXCH	T1,DSKWRT	;SAVE FOR THE NEXT SCAN
	SUB	T1,DSKWRT	;GET THE INCREMENTAL DISK WRITES
	TXNN	F,F.PAS		;SKIP IF PASS ONE
	PUSHJ	P,DECOUT	;OUTPUT THE INCREMENTAL DISK WRITES
	PUSHJ	P,SLHOUT	;OUTPUT A SLASH
	MOVN	T1,DSKWRT	;OUTPUT THE TOTAL
	PUSHJ	P,DECOUT	; DISK WRITES
	PUSHJ	P,ENDLIN	;FINISH THE LINE OFF
	AOJ	LC,		;INCREMENT THE LINE COUNT
IFE <MONVER-603>*<MONVER-700>,<
	PUSHJ	P,TTLLIN	;SET UP FOR THE NEXT LINE

	TXCN	F,F.SRH		;SKIP IF TIME TO OUTPUT THE SEARCH LIST
	JRST	JOBO11		;GO OUTPUT THE CHARACTER COUNTS
	TXNE	F,F.GOD		;SKIP IF NOT GOD
	JRST	JOBO13		;GO OUTPUT THE JOB'S SEARCH LIST
	MOVE	T1,@GETPPN	;GET THE JOB'S PPN
	XOR	T1,DIR		;COMPARE THE PPN
	TDNN	T1,DIRMSK	;SKIP IF NOT A MATCH
	JRST	JOBO13		;GO OUTPUT THE JOBS SEARCH LIST

JOBO11:	MOVE	T1,['ICC:  ']	;OUTPUT
	PUSHJ	P,SIXOUT	; 'ICC:'
IFL <MONVER-700>,<
	MOVE	T1,HI+DDBICC(P2);OUTPUT THE INPUT
>
IFGE <MONVER-700>,<
	HLRZ	T2,P2		;LINE NUMBER
	TRO	T2,.UXTRM	;TURN IT INTO A UDX
	MOVEI	T1,.TOOCT
	MOVE	T5,[3,,T1]	;READ OUTPUT CHARACTER COUNT
	TRMOP.	T5,
	  SETZ	T5,
	PUSH	P,T5		;SAVE OCC
	MOVEI	T1,.TOICT
	MOVE	T5,[3,,T1]
	TRMOP.	T5,		;READ INPUT CHARACTER COUNT
	  SETZ	T5,
	MOVE	T1,T5
>
	PUSHJ	P,DECOUT	; CHARACTER COUNT

	MOVEI	T1,^D12		;JUSTIFY TO COLUMN
	MOVE	T2,['OCC:  ']	; 12 AND OUTPUT
	PUSHJ	P,SIXJST	; 'OCC:'
IFL <MONVER-700>,<
	MOVE	T1,HI+DDBOCC(P2);OUTPUT THE OUTPUT
>
IFGE <MONVER-700>,<
	POP	P,T1		;GET OCC
>
	PUSHJ	P,DECOUT	; CHARACTER COUNT

	MOVEI	T1,^D24		;JUSTIFY TO COLUMN
	MOVE	T2,['CMD:  ']	; 24 AND OUTPUT
	PUSHJ	P,SIXJST	; 'CMD:'
	HLRZ	T1,HI+DDBBCC(P2);OUTPUT THE COMMAND
	PUSHJ	P,DECOUT	; COUNT

	MOVEI	T1,^D33		;JUSTIFY TO COLUMN
	MOVE	T2,['UUO:  ']	; 33 AND OUTPUT
	PUSHJ	P,SIXJST	; 'UUO:'
	MOVE	T1,@GETUUC	;OUTPUT THE UUO
	PUSHJ	P,DECOUT	; COUNT

	MOVEI	T1,^D45		;JUSTIFY TO COLUMN
	MOVE	T2,['KCS:  ']	; 45 AND OUTPUT
	PUSHJ	P,SIXJST	; 'KCS:'
	MOVE	T1,@GETKCT	;OUTPUT THE NON-VM KILO-CORE-SECONDS
	IDIV	T1,JIFFIE	; ..
	PUSHJ	P,DECOUT	; ..
IFN FTVM,<
	TXNN	F,F.VMS		;SKIP IF VM SYSTEM
	JRST	JOBO12		;SKIP SOME VM CODE
	PUSHJ	P,CLNOUT	;OUTPUT A COLON
	MOVE	T1,@GETVKS	;OUTPUT THE VM KILO-CORE-SECONDS
	IDIV	T1,JIFFIE	; ..
	PUSHJ	P,DECOUT	; .. >>

JOBO12:	TXZ	F,F.PAS		;CLEAR THE PASS ONE FLAG
	POPJ	P,		;RETURN 
IFE <MONVER-603>*<MONVER-700>,<
JOBO13:	TXZ	F,F.STR		;RESET THE STRUCTURE OUTPUT FLAG
	MOVE	T5,[POINT 9,HI+.PDJSL(P3)]  ;GET THE POINTER TO THE SEARCH LIST
JOBO14:	ILDB	T3,T5		;GET A FILE STRUCTURE NUMBER
	ANDX	T3,77		;CLEAR SOME FLAGS
	CAIN	T3,.FSTMP	;SKIP IF NOT A TEMPORARY STRUCTURE
	JRST	JOBO14		;GO TRY THE NEXT STRUCTURE
	CAIE	T3,.FSEND	;SKIP IF THE END OF THE SEARCH LIST
	CAIN	T3,.FSFNC	;SKIP IF THE END OF THE ACTIVE SEARCH LIST
	JRST	JOBO12		;FINISHED
	CAIN	T3,.FSSTP	;SKIP IF THE END OF EVERY THING
	JRST	JOBO12		;FINISHED
	HLRZ	T4,@GETSTR
JOBO15:	HRRZ	T2,HI+STRFSN(T4);GET THIS FILE STRUCTURE NUMBER
	CAMN	T2,T3		;SKIP IF NOT A MATCH
	JRST	JOBO16		;YEA! WE FOUND IT
	HLRZ	T4,HI+STRSYS(T4);GET THE POINTER TO THE NEXT STRUCTURE
	JUMPN	T4,JOBO15	;SKIP IF NOT THE END OF THE LINE
	JRST	JOBO14		;WELL I TRIED
JOBO16:	MOVE	T1,HI+STRNAM(T4);GET THE NAME OF THE STRUCTURE
	TXOE	F,F.STR		;SKIP IF THE FIRST STRUCTURE OUTPUT
	LSH	T1,-^D6		;INSERT A SPACE
	PUSHJ	P,SIXOUT	;OUTPUT THE STRUCTURE NAME
	PUSHJ	P,CLNOUT	;OUTPUT A COLON
	MOVE	T1,@GETPPN	;GET THE USER'S PPN
	HLRZ	T2,@GETSPB	;GET THE POINTER TO THE PPB CHAIN
	TRNA			;FAST SKIP
JOBO17:	HLRZ	T2,HI+PPBSYS(T2);GET THE POINTER TO THE NEXT PPB
	JUMPE	T2,JOBO19	;JUMP IF END OF THE CHAIN
	CAME	T1,HI+PPBNAM(T2);SKIP IF THE USER'S PPB
	JRST	JOBO17		;KEEP ON TRUCK'N
	HLRZ	T2,HI+PPBUFB(T2);GET THE POINTER TO THE PPB CHAIN
	TRNA			;FAST SKIP
JOBO18:	HLRZ	T2,HI+UFBPPB(T2);GET THE POINTER TO THE NEXT PPB
	JUMPE	T2,JOBO19	;JUMP IF THE END OF THE CHAIN
	LDB	T1,[POINT 6,HI+UFBFSN(T2),5]  ;GET THE FILE STRUCTURE NUMBER
	CAME	T1,T3		;SKIP IF THE RIGHT STRUCTURE
	JRST	JOBO18		;KEEP ON TRUCK'N
	MOVE	T1,HI+UFBTAL(T2);GET THE LOGIN QUOTA
	CAMLE	T1,HI+STRTAL(T4);SKIP IF SMALLER THAN STRUCTURE FREE
JOBO19:	MOVE	T1,HI+STRTAL(T4);GET THE FREE
	PUSHJ	P,DECOUT	; SPACE LEFT
	JRST	JOBO14		;GO FIND THE NEXT STRUCTURE >>
;HERE TO BUILD THE COMMAND STRING BUFFER

IFN FTWHAT,<
CMDOUT:	PUSH	P,C		;SAVE C FOR LATER
	MOVE	BP,[POINT 7,WHTBUF]  ;SET UP THE POINTER TO THE BUFFER
	SETZ	CC,		;RESET THE BUFFER COUNTER
	TXNN	F,F.WLD		;SKIP IF THE WILD PROCESSOR IS IN USE
	JRST	CMDOU3		;GO INFORM USER
	MOVE	T1,ROUTINE	;GET THE ADDRESS OF THE WILD PROCESSOR
	CAIN	T1,TSTFIL	;SKIP IF NOT THE "F" COMMAND
	JRST	CMDOU1		;GO OUTPUT THE "F" COMMAND STRING
	CAIN	T1,TSTJOB	;SKIP IF NOT THE "J" COMMAND
	JRST	CMDOU2		;GO OUTPUT THE "J" COMMAND STRING
	CAIN	T1,TSTLOG	;SKIP IF NOT THE "L" COMMAND
	JRST	CMDOU0		;GO OUTPUT THE "L" COMMAND STRING

	SKIPA	C,["N"]		;OUTPUT AN "N"

CMDOU0:	MOVEI	C,"L"		;OUTPUT AN "L"
	PUSHJ	P,CHROUT	;THE CHARACTER
	PUSHJ	P,WPPOUT	;GO OUTPUT THE PPN FOR THE "L" COMMAND
	JRST	CMDOU4

CMDOU1:	MOVEI	C,"F"		;OUTPUT
	PUSHJ	P,CHROUT	; THE "F"
	PUSHJ	P,SPCOUT	;GO OUTPUT THE FILE SPEC
	JRST	CMDOU4

CMDOU2:	MOVEI	C,"J"		;OUTPUT
	PUSHJ	P,CHROUT	; THE "J"
	MOVE	T1,JOBNUM	;GO OUTPUT THE JOB NUMBER
	PUSHJ	P,DECOUT	; FOR THE "J" COMMAND
	JRST	CMDOU4

CMDOU3:	MOVEI	C,"A"		;OUTPUT
	PUSHJ	P,CHROUT	; THE "A"
CMDOU4:	MOVSI	T1,' D '	;OUTPUT
	PUSHJ	P,SIXOUT	; THE " D"
	MOVE	T1,DSPNAM(P1)	;OUTPUT THE
	PUSHJ	P,SIXOUT	; DISPLAY NAME

IFN FTPATH,<
	MOVSI	T1,' P '	;SET UP TO OUTPUT A "P" IF IN PATH MODE
	TXNE	F,F.PTH		;SKIP IF NOT IN PATH MODE
	PUSHJ	P,SIXOUT	;OUTPUT A " P" IF A PATH MODE >

	MOVSI	T1,' S '	;OUTPUT
	PUSHJ	P,SIXOUT	; THE " S"
	HRRZ	T1,HIBTIM	;GET THE HIBERNATE TIME
	IDIVI	T1,^D1000	;CONVERT FROM MILLISECONDS TO SECONDS
	PUSHJ	P,DECOUT	;OUTPUT THE TIME

IFN FTTITLE,<
	MOVSI	T1,' T '	;SET UP TO OUTPUT A "T" IF IN TITLE SUPPRESSION
	TXNE	F,F.TTL		;SKIP IF THE TITLE IS WANTED
	PUSHJ	P,SIXOUT	;OUTPUT A " T" IF IN TITLE SUPPRESSION MODE >

	MOVSI	T1,' W '	;OUTPUT
	PUSHJ	P,SIXOUT	; THE " W"

	IDPB	T1,BP		;STORE A NULL CHARACTER IN THE BUFFER
	POP	P,C		;RESTORE C
	POPJ	P,		;RETURN >
;HERE TO OUTPUT A FILE SPECIFICATION

IFN FTWHAT,<
SPCOUT:	MOVE	T1,DEV		;OUTPUT THE
	PUSHJ	P,SIXOUT	; DEVICE NAME
	PUSHJ	P,CLNOUT	;OUTPUT A COLON
	HLRZ	T5,EXT		;GET THE EXTENSION
	CAIN	T5,'UFD'	;SKIP IF NOT 'UFD'
	JRST	[MOVE	T3,FIL		;GET THE FILE NAME
		 MOVE	T4,FILMSK	; AND FILE NAME MASK
		 PUSHJ	P,WPPOU0	;OUTPUT THE NAME AS A UFD
		 JRST	SPCOU0]		;CONTINUE
	MOVE	T1,FIL		;OUTPUT THE
	PUSHJ	P,SIXOUT	; FILE NAME
SPCOU0:	JUMPE	T5,WPPOUT	;JUMP IF THE EXTENSION IS ZERO
	MOVEI	C,"."		;OUTPUT
	PUSHJ	P,CHROUT	; A PERIOD
	MOVSI	T1,(T5)		;OUTPUT THE EXTENSION
	PUSHJ	P,SIXOUT	; AND FALL INTO WPPOUT

WPPOUT:	MOVE	T3,DIR		;GET THE DIRECTORY AND
	MOVE	T4,DIRMSK	; DIRECTORY MASK
WPPOU0:	MOVEI	C,"["		;OUTPUT
	PUSHJ	P,CHROUT	; A "["
	HLLZ	T1,T4		;GET THE PROJECT MASK
	HLR	T1,T3		;GET THE PROJECT NUMBER
	PUSHJ	P,WOCOUT	;OUTPUT THE WILD PROJECT NUMBER
	PUSHJ	P,COMOUT	;OUTPUT A COMMA
	HRLZI	T1,(T4)		;GET THE PROGRAMMER MASK
	HRRI	T1,(T3)		;GET THE PROGRAMMER NUMBER
	PUSHJ	P,WOCOUT	;OUTPUT THE WILD PROGRAMMER NUMBER
	MOVEI	C,"]"		;OUTPUT A "]"
	PJRST	CHROUT		; AND RETURN

WOCOUT:	JUMPE	T1,WOCOU3	;JUMP IF THE NUMBER IS COMPLETELY WILD
	TXZ	F,F.DIG		;CLEAR THE DIGIT SEEN FLAG
	MOVEI	T2,^D6		;SET UP A COUNTER
WOCOU0:	JUMPGE	T1,WOCOU1	;JUMP IF THIS DIGIT IS WILD
	LDB	C,[POINT 3,T1,20]  ;GET A DIGIT
	TXNN	F,F.DIG		;SKIP IF A DIGIT HAS BEEN SEEN
	JUMPE	C,WOCOU2	;JUMP IF THE DIGIT IS A ZERO
	TROA	C,"0"		;CONVERT BINARY TO ASCII AND SKIP
WOCOU1:	MOVEI	C,"?"		;SET UP TO OUTPUT A QUESTION MARK
	TXO	F,F.DIG		;SET THE DIGIT SEEN FLAG
	PUSHJ	P,CHROUT	;OUTPUT THE DIGIT OR QUESTION MARK
WOCOU2:	LSH	T1,^D3		;ADJUST THE MASK
	SOJG	T2,WOCOU0	;LOOP BACK IF NOT FINISHED
	POPJ	P,		;RETURN
WOCOU3:	MOVEI	C,"*"		;SET UP TO OUTPUT AN
	PJRST	CHROUT		; ASTRISK AND RETURN >
SUBTTL	VARIOUS USEFUL SUBROUTINES


;HERE TO TEST FOR AN ABBREVIATED NAME

TSTABR:	SETO	T4,		;RESET A COUNTER

TSTAB0:	LSH	T4,-6		;SHIFT THE MASK ONE CHARACTER TO THE RIGHT
	TDNE	T1,T4		;SKIP IF OUT OF CHARACTERS
	JRST	TSTAB0		;LOOP BACK UNTIL FINISHED

	SETZ	T3,		;CLEAR THE FLAG FOR LATER
	HRRZM	T2,TEMP		;SET THE BASE ADDRESS FOR LATER

TSTAB1:	MOVE	T5,(T2)		;GET A WORD TO TEST
	XOR	T5,T1		;TRY TO CLEAR SOME CHARACTERS
	JUMPE	T5,TSTAB3	;JUMP IF A MATCH WAS FOUND
	ANDCM	T5,T4		;CLEAR ANY CHARACTERS AT THE END OF THE WORD
	JUMPN	T5,TSTAB2	;JUMP IF NOT A VALID ABBREVIATION
	TRON	T3,1		;SKIP A IF NOT THE FIRST MATCH
	TLOA	T3,(T2)		;SET THE FLAG FOR AN ABREVIATION FOUND
	TLZ	T3,-1		;MORE THAN ONE ABBREVIATION FOUND
TSTAB2:	AOBJN	T2,TSTAB1	;LOOP BACK IF NOT FINISHED

	TLNN	T3,-1		;SKIP IF AN ABBREVIATION WAS FOUND
	POPJ	P,		;ERROR - T3 CONTAINS A:
				;	0 - NO ABBREVIATION FOUND
				;	1 - NO UNIQUE ABBREVIATION FOUND

	HLRZ	T2,T3		;SET UP T2 TO POINT TO THE ABBREVIATION
TSTAB3:	SUB	T2,TEMP		;SET UP T2 TO BE 0, 1, 2, ...
	JRST	.POPJ1		;GIVE A GOOD RETURN
;HERE TO GET THE DEFAULT TERMINAL TYPE OF DISPLAY

TRMDSP:	PUSH	P,C		;SAVE C FOR LATER
	MOVEI	P1,DEFTRM	;GET THE DEFAULT TERMINAL TYPE
IFE <MONVER-700>,<
	MOVE	T1,[2,,TRM]
	MOVEI	T2,1041		;ASK THE MONITOR WHAT TYPE TERMINAL WE HAVE
	HRRZM	T2,TRM
	TRMOP.	T1,
	 JRST	E$$TTF		;CAN'T TELL
>
IFN <MONVER-700>,<
	MOVE	P3,[PUSHJ P,SYSIN]  ;SET UP SCAN TO USE 'SYS' INSTEAD
	EXCH	P3,INCHR	    ; OF THE TERMINAL FOR INPUT
	OPEN	SYS,OPNBLK	;GET AN I/O CHANNEL TO 'SYS'
	 JRST	TRMD13		;NO 'SYS'
	SETZM	LOKBLK+.RBPPN	;ZERO THE PPN
	HLLZS	LOKBLK+.RBEXT	;ZERO THE ACCESS AND HI CREATION DATE
	LOOKUP	SYS,LOKBLK	;SEE IF 'DISPLA.INI' IS ON SYS
	 JRST	TRMD12		;NO FILE 'DISPLA.INI'
	MOVEI	T1,SYSBUF	;SET UP TO GET A TWO BUFFER RING
	EXCH	T1,.JBFF##	;FAKE THE MONITOR OUT
	INBUF	SYS,2		;GET TWO BUFFERS
	MOVEM	T1,.JBFF##	;RESTORE THE OLD VALUE

TRMDS0:	PUSHJ	P,SCAN		;GO GET THE TERMINAL NAME AND DISPLAY TYPE
	 JRST	TRMD12		;ASSUME E-O-F

IFE <MONVER-603>,<
	SKIPGE	T4,XNOD		;GET THE NODE NAME/NUMBER
	JRST	TRMDS2		;JUMP IF A NODE NAME
	JUMPE	T4,TRMDS1	;IF THE NUMBER IS ZERO USE THE CENTRAL NODE
	PUSHJ	P,SIXOCT	;CONVERT SIXBIT TO OCTAL
	 JRST	TRMDS2		;NOT OCTAL GO TRY THE NEXT ENTRY
	SKIPN	T4,T1		;SKIP IF NOT ZERO
TRMDS1:	HRRZ	T4,@GETLOC	;GET THE CENTRAL NODE NUMBER
	JRST	TRMDS5		;GO SEE IF THE ONE WE WANT
TRMDS2:	SKIPN	T3,GETNDB	;GET THE POINTER TO THE FIRST NODE
	JRST	TRMDS0		;NO NETWORK CODE
TRMDS3:	HLRZ	T2,HI+NDBSNM(T3);GET THE POINTER TO THE NODE NAME
	CAMN	T4,HI(T2)	;SKIP IF THEY MATCH
	JRST	TRMDS4		;SKIP IF A MATCH
	HRRZ	T3,HI+NDBNNM(T3);GET THE POINTER TO THE NEXT NODE
	JUMPN	T3,TRMDS3	;WELL KEEP ON TRUCK'N
	JRST	TRMDS0		;TRY THE NEXT ENTRY
TRMDS4:	HLRZ	T4,HI+NDBNNM(T3);GET THE NODE NUMBER FOR THE NODE
TRMDS5:	CAME	T4,NODIDX	;SKIP IF THEY MATCH
	JRST	TRMDS0		;TRY THE NEXT ENTRY >
	HLRZ	T4,XDEV		;GET THE TYPE OF TERMINAL
	CAIN	T4,'TTY'	;SKIP IF NOT 'TTY'
	JRST	TRMD10		;GET THE RELATIVE LINE NUMBER
IFE <MONVER-603>*<MONVER-700>,<
	CAIN	T4,'OPR'	;SKIP IF NOT 'OPR'
	JRST	TRMDS6		;GET THE OPERATORE LINE NUMBER >
	CAIE	T4,'CTY'	;SKIP IF 'CTY'
	JRST	TRMDS9		;ASSUME AN OCTAL NUMBER

	MOVE	T1,PTYMIN	;GET THE NUMBER OF THE FIRST PTY
	SOJA	T1,TRMD11	;ADJUST IT TO THE CTY

IFE <MONVER-603>*<MONVER-700>,<
TRMDS6:	SKIPN	T2,GETNDB	;GET THE POINTER TO THE FIRST NODE DATA BLOCK
	JRST	TRMDS0		;SKIP IF NOT A NETWORK SYSTEM
TRMDS7:	HLRZ	T1,HI+NDBNNM(T2);GET THE NODE NUMBER
	CAMN	T1,NODIDX	;SKIP IF NOT A MATCH
	JRST	TRMDS8		;GO GET THE OPR LDB
	HRRZ	T2,HI+NDBNNM(T2);GET THE POINTER TO THE NEXT NDB
	JUMPN	T2,TRMDS7	;JUMP IF NOT THE END OF THE LINE
	JRST	TRMDS0		;NO SUCH NODE
TRMDS8:	HRRZ	T4,HI+SCBOPR(T2);GET THE POINTER TO THE OPR LDB
	JUMPE	T4,TRMDS0	;JUMP IF NO OPR LINE
	LDB	T1,[POINT 8,HI+LDBREM+4(T4),7]  ;GET THE RELATIVE LINE NUMBER
	JRST	TRMD11		;GO SEE IF THE RIGHT LINE >

TRMDS9:	SKIPA	T4,XDEV		;ASSUME AN OCTAL NUMBER INPUT
TRMD10:	HRLZ	T4,XDEV		;GET THE TERMINAL NUMBER
	PUSHJ	P,SIXOCT	;CONVERT SIXBIT TO OCTAL
	 JRST	TRMDS0		;TRY THE NEXT ENTRY

TRMD11:	CAME	T1,LINIDX	;SKIP IF WE FOUND THE RIGHT ENTRY
	JRST	TRMDS0		;NO - TRY THE NEXT ENTRY

	MOVE	T1,XFIL		;GET THE DISPLAY TYPE
	MOVEM	P3,INCHR	;RESTORE FOR TERMINAL INPUT
>
	MOVE	T2,[-DSPSIZ,,DSPNAM]  ;GET INFORM TSTABR WHAT TO MATCH
	PUSHJ	P,TSTABR	;GO SEE IF ONE MATCHED
	 JRST	TRMD12		;NO GIVE UP
	HLRZ	P1,DSPNUM(T2)	;SET UP THE DISPLAY OFFSET
TRMD12:	RELEAS	SYS,		;RELEASE THE DISK FILE
TRMD13:	POP	P,C		;RESTORE C
				; FALL INTO SETDSP
;HERE TO SET UP THE DISPLAY SIZE

SETDSP:	HRRZ	T1,DSPNUM(P1)	;GET THE SIZE OF THE DISPLAY
IFN FTTITLE,<
	TXNE	F,F.TTL		;SKIP IF THE TITLE FLAG ISN'T SET
	MOVEI	T1,^D2(T1)	;THE SCREEN IS LARGER IN NO TITLE MODE >
IFN FTPATH,<
	TXNE	F,F.PTH		;SKIP IT THE PATH OPTION ISN'T WANTED
	LSH	T1,-^D1		;DIVIDE BY TWO >
	MOVEM	T1,PAGSIZ	;SAVE FOR LATER
	TXO	F,F.CLR		;SET UP CLEAR THE SCREEN ON THE NEXT SCAN
	POPJ	P,		;RETURN


;HERE FOR A CHARACTER FROM 'SYS:DISPLA.INI'

SYSIN:	SOSG	SYSCNT		;SKIP IF THE BUFFER ISN'T EMPTY
	JRST	SYSIN1		;GO FILL THE BUFFER
SYSIN0:	ILDB	C,SYSPNT	;GET A CHARACTER
	JUMPE	C,SYSIN		;GET ANOTHER CHARACTER IF A NULL CHARACTER
	POPJ	P,
SYSIN1:	IN	SYS,		;FILL THE INPUT BUFFER
	JRST	SYSIN0		;FULL TO EMPTY IT
	MOVEI	C,-1		;ASSUME E-O-F, INFORM THE CALLER
	POPJ	P,		;RETURN


;HERE TO CONVERT FROM THE NEW DATE/TIME FORMAT TO JIFFIES

IFN FTJOB,<
ADJTIM:	MUL	T2,[^D<24*60*60*1000>]  ;ADJUST THE FACTION OF A DAY
	ASHC	T2,^D17		;ADJUST THIS RESULT
	MUL	T2,JIFFIE	;CONVERT FROM MILLI-SECONDS
	DIVI	T2,^D1000	; TO JIFFIES
	POPJ	P,		;RETURN >
;HERE TO SET UP THE PAGE BOUNDARIES

PAGADJ:	MOVE	T1,PAGNUM	;GET THE PAGE TO OUTPUT
	IMUL	T1,PAGSIZ	;GET THE FIRST
	MOVEM	T1,PAGFST	; DDB TO OUTPUT
	ADD	T1,PAGSIZ	;GET THE LAST
	MOVEM	T1,PAGLST	; DDB TO OUTPUT
	POPJ	P,		;RETURN


;CONVERT SIXBIT TO OCTAL

SIXOCT:	JUMPE	T4,.POPJ	;JUMP IF NOTHING TO CONVERT
	SETZ	T1,		;RESET THE NUMBER
	MOVE	T3,[POINT 6,T4]	;SET UP THE BYTE POINTER
SIXOC0:	ILDB	T2,T3		;GET A CHARACTER
	JUMPE	T2,.POPJ1	;RETURN IF NULL
	CAIL	T2,'0'		;SKIP IF LESS THAN A '0'
	CAILE	T2,'7'		;SKIP IF LESS THAN A '7'
	POPJ	P,		;GIVE AN ERROR RETURN
	LSH	T1,3		;MUTIPLY BY EIGHT
	ORI	T1,-'0'(T2)	;ADD IN THE NEW DIGIT
	TXNE	T3,77B5		;SKIP IF THE END OF THE WORD IS REACHED
	JRST	SIXOC0		;GO TRY THE NEXT BYTE
	JRST	.POPJ1		;GIVE A GOOD RETURN


;HERE TO RESTORE THE TERMINAL CHARACTERISTICS

RSTTRM:	MOVSI	T1,-TRMSIZ	;SET UP A AOBJN COUNTER
RSTTR0:	MOVE	T2,TRMSAV(T1)	;GET THE BIT TO SET
	MOVEM	T2,TRM+2	;SAVE FOR THE TRMOP. UUO
	HRRZ	T2,TRMTAB(T1)	;GET THE FIRST FUNCTION
	MOVEI	T2,.TOSET(T2)	;SET UP AS A SET FUNCTION
	MOVEM	T2,TRM		;SAVE FOR THE TRMOP. UUO
	MOVE	T3,[3,,TRM]
	TRMOP.	T3,		;SET THE BIT
	 JRST	E$$TTF		;NO - GO INFORM THE USER
	AOBJN	T1,RSTTR0	;JUMP IF MORE TO DO
	POPJ	P,		;RETURN
;HERE TO CLEAR TO THE END OF THE COMMAND LINE

CLRLIN:	MOVSI	T5,-<EOLSIZ-2>	;GET THE NUMBER OF END OF LINE CHARACTERS
CLRLI0:	CAMN	C,EOL(T5)	;SKIP IF NOT THIS CHARACTER
	POPJ	P,		;RETURN
	AOBJN	T5,CLRLI0	;LOOP UNTIL ALL HAVE BEEN TRIED
	XCT	INCHR		;GET THE NEXT CHARACTER
	JRST	CLRLIN		;GO TRY THIS CHARACTER


;HERE TO TEST FOR AN EOL CHARACTER

TSTEOL:	XCT	INCHR		;GET A CHARACTER
TSTEO0:	CAIN	C,.CHCRT	;SKIP IF THE CHAR ISN'T A CARRIAGE RETURN
	XCT	INCHR		;GET ANOTHER CHARACTER THEN
	MOVSI	T5,-EOLSIZ	;SET UP AN AOBJN COUNTER
TSTEO1:	CAMN	C,EOL(T5)	;SKIP IF IT EQUALS THIS CHAR
	JRST	.POPJ1
	AOBJN	T5,TSTEO1	;JUMP IF MORE CHAR TO TEST
	POPJ	P,		;RETURN


EOL:	.CHBEL	;A BELL
	.CHLFD	;A LINE-FEED
	.CHVTB	;A VERTICAL-TAB
	.CHFFD	;A FORM-FEED
	.CHCNZ	;A CONTROL-Z
	.CHESC	;AN ESCAPE
IFN FTSPACE,<
	.CHTAB	;A TAB
	" "	;A SPACE >
EOLSIZ==.-EOL

IFE <MONVER-700>,<
;HERE TO SET UP A SPY-PAGE FOR AN LDB
GETLDB:	HRRZ	T3,T4
	LSH	T3,-11
	HRLM	T3,LDBBLK+1
	ADDI	T3,1
	HRLM	T3,LDBBLK+2
	MOVE	T3,[11,,DELLDB]
	PAGE.	T3,
	  JFCL
	MOVE	T3,[11,,LDBBLK]
	PAGE.	T3,
	  HALT
	TRZ	T4,777000
	TRO	T4,LDB-400000
	POPJ	P,
>
SUBTTL	THE DDB SCANNING SUBROUTINES

;HERE TO FIND THE NEXT DDB
SPY==377000
UPT==376000
LDB==374000
SPYPAG==377
UPTPAG==376
LDBPAG==374
NXTDDB:
IFL <MONVER-700>,<
	HLRZ	P2,HI+DEVSER(P2);GET THE LINK TO THE NEXT DDB
	CAIE	P2,0		;SKIP IF OUT OF DDB'S
>
IFGE <MONVER-700>,<
	JUMPN	P2,NXTDD5
NXTDD1:	AOS	T1,JOB
	CAMLE	T1,@HIJOB
	POPJ	P,
	SETZ	P2,
	HRRZ	T2,@GETUPM
NXTDD2:	JUMPE	T2,NXTDD1
	MOVEM	T2,CURUPM
	HRLM	T2,UPTBLK+1
	MOVE	T2,[11,,DELUPT]
	PAGE.	T2,
	  JFCL
	MOVE	T2,[11,,UPTBLK]
	PAGE.	T2,200000
	  HALT
NXTDD3:	SKIPE	P2
	SKIPA	T2,DEVSER(P2)
	MOVE	T2,@LSTLOC
	HLRZS	T2
	MOVEM	T2,CURVRT
	JUMPE	T2,NXTDD1
	MOVE	T3,T2
	LSH	T2,-11
	ADDI	T2,440
	ROT	T2,-1
	TLZE	T2,400000
	TLOA	T2,001500
	TLO	T2,221500
	ADDI	T2,UPT
	MOVEM	T2,CURPTR
	LDB	T2,T2
	MOVEM	T2,CURPAG
	HRLM	T2,FUNBLK+1
	MOVE	T2,[11,,DELSPY]
	PAGE.	T2,
	  JFCL
	MOVE	T2,[11,,FUNBLK]
	PAGE.	T2,200000
	  HALT
	MOVE	P2,T3
NXTDD4:	JUMPE	P2,.POPJ
	ANDI	P2,777
	ADDI	P2,SPY-HI
.POPJ1:	AOS	(P)		;SET UP FOR A SKIP RETURN
.POPJ:	POPJ	P,		;RETURN
NXTDD5:	SUBI	P2,HI
	MOVE	T1,JOB
	HRRZ	T2,@GETUPM
	CAME	T2,CURUPM
	JRST	NXTDD2
	HLRZ	T2,DEVSER(P2)
	JUMPE	T2,NXTDD1
	XOR	T2,CURVRT
	TRNE	T2,777000
	JRST	NXTDD3
	LDB	T2,CURPTR
	CAME	T2,CURPAG
	JRST	NXTDD3
	HLRZ	P2,DEVSER(P2)
	JRST	NXTDD4

>


;HERE TO FIND A STRUCTURE

FNDSTR:	HRRZ	T1,HI+DEVUNI(P2);GET THE POINTER TO THE UNIT
	JUMPE	T1,.POPJ	;ERROR RETURN
	HRRZ	T1,HI+UNISTR(T1);GET THE POINTER TO THE STRUCTURE
	JUMPE	T1,.POPJ	;ERROR RETURN
	MOVE	T1,HI+STRNAM(T1);GET THE STRUCTURE NAME
	JRST	.POPJ1		;GO DO A SKIP RETURN
;HERE TO TEST IF A DDB FIXS A NOT LOGGED IN SPECIFICATION

TSTNOT:	LDB	T5,JOBPTR	;GET THE JOB NUMBER
	MOVE	T1,@GETPP	;GET THE PPN IN USE
	XOR	T1,DIR		;COMPARE THIS PPN
	TDNN	T1,DIRMSK	;SKIP IF NOT A MATCH
	JRST	DDBLOP		;NO - GO TRY NEXT DDB
	JRST	DDBLO1		;YEA - GO OUTPUT THIS DDB


;HERE TO TEST IF A DDB FIXS A LOGGED IN SPECIFICATION

TSTLOG:	LDB	T5,JOBPTR	;GET THE JOB NUMBER
TSTLO0:	MOVE	T1,@GETPP	;GET THE PPN IN USE
	XOR	T1,DIR		;COMPARE THIS PPN
	TDNE	T1,DIRMSK	;SKIP IF A MATCH
	JRST	DDBLOP		;NO - GO TRY NEXT DDB
	JRST	DDBLO1		;YEA - GO OUTPUT THIS DDB


;HERE TO TEST IF A DDB FIXS A FILE SPECIFICATION

TSTFIL:	MOVE	T1,HI+PPBNAM(P5);GET THE PPN OF THE FILE
	XOR	T1,DIR		;COMPARE THIS PPN
	TDNE	T1,DIRMSK	;SKIP IF A MATCH
	JRST	DDBLOP		;NO - GO TRY NEXT DDB THEN
	PUSHJ	P,FNDSTR	;GO FIND THE STRUCTURE NAME
	 JRST	DDBLOP		;NO - GO TRY NEXT DDB THEN
	XOR	T1,DEV		;COMPARE THIS DEVICE
	TDNE	T1,DEVMSK	;SKIP IF A MATCH
	JRST	DDBLOP		;NO - GO TRY NEXT DDB THEN
	MOVE	T1,HI+DEVFIL(P2);GET THE FILE NAME
	XOR	T1,FIL		;COMPARE THIS FILE NAME
	TDNE	T1,FILMSK	;SKIP IF A MATCH
	JRST	DDBLOP		;NO - GO TRY NEXT DDB THEN
	HLLZ	T1,HI+DEVEXT(P2);GET THE EXTENSION
	XOR	T1,EXT		;COMPARE THIS EXTENSION
	TLNE	T1,(T1)		;SKIP IF A MATCH
	JRST	DDBLOP		;NO - GO TRY NEXT DDB
	JRST	DDBLO1		;YEA - GO OUTPUT THIS DDB


;HERE TO TEST IF A DDB IS FROM A GIVE JOB

TSTJOB:	LDB	T5,JOBPTR	;GET THE JOB NUMBER
	CAME	T5,JOBNUM	;SKIP IF A RIGHT JOB NUMBER
	JRST	DDBLOP		;GO TRY THE NEXT JOB NUMBER
	TXNE	F,F.GOD		;SKIP IF NOT GOD
	JRST	DDBLO1		;GO OUTPUT THE DDB
	JRST	TSTLO0		;GO TEST THE PPN OF THIS USER
SUBTTL	THE DISPLAY ROUTINES


;HERE TO CLEAR THE SCREEN

TRMCLR:	AD1CLR		;LSI ADM-1 CLEAR THE SCREEN ROUTINE
	AD3CLR		;LSI ADM-3 CLEAR THE SCREEN ROUTINE
	ASRCLR		;ASR-33 CLEAR THE SCREEN ROUTINE
	HZLCLR		;HAZELTINE-2000 CLEAR THE SCREEN ROUTINE
	MBECLR		;MINI-BEE CLEAR THE SCREEN ROUTINE
	MDLCLR		;MODULAR ONE CLEAR THE SCREEN ROUTINE
	V5BCLR		;DEC VT05B CLEAR THE SCREEN ROUTINE
	V50CLR		;DEC VT50 CLEAR THE SCREEN ROUTINE
	V52CLR		;DEC VT52 CLEAR THE SCREEN ROUTINE
	V61CLR		;DEC VT61 CLEAR THE SCREEN ROUTINE

AD1CLR:	PUSHJ	P,AD1HOM	;GO USE THE LSI HOME ROUTINE
	PJRST	AD1EOS		;GO CLEAR TO THE END OF THE SCREEN

AD3CLR:	OUTCHR	[%AD3CL]	;CLEAR THE SCREEN FOR THE LSI ADM-3
	POPJ	P,		;RETURN

ASRCLR:	OUTSTR	[BYTE (7).CHCRT,.CHLFD,0]
	POPJ	P,		;RETURN

HZLCLR:	OUTSTR	[BYTE (7)%HZLLD,%HZLCL,.CHDEL,.CHDEL,0]
	MOVEI	T1,^D150	;HIBERNATE FOR AWHILE
	HIBER	T1,		; ..
	 OUTSTR	[BYTE (7).CHDEL,.CHDEL,.CHDEL,.CHDEL,0]
	SETOM	LSTCNT		;RESET THE COUNT FOR THE NUMBER
				; OF LINES ON THE LAST DISPLAY
	POPJ	P,		;RETURN

MBECLR:	OUTSTR	[BYTE (7)%MBELD,%MBECL,0]
	POPJ	P,		;RETURN

MDLCLR==HZLCLR		;SAME AS THE HAZELTINE-2000

V5BCLR:	OUTSTR	[BYTE (7)%V5BHM,%V5BES,0]
	POPJ	P,		;RETURN

V50CLR:	OUTSTR	[BYTE (7)%V50LD,%V50HM,%V50LD,%V50ES,0]
	POPJ	P,		;RETURN

V52CLR==V50CLR		;SAME AS DEC VT50

V61CLR==V50CLR		;SAME AS DEC VT50
;HERE TO CLEAR TO END OF THE SCREEN

TRMEOS:	AD1EOS		;LSI ADM-1 CLEAR TO END OF THE SCREEN ROUTINE
	AD3EOS		;LSI ADM-3 CLEAR TO END OF THE SCREEN ROUTINE
	ASREOS		;ASR-33 OR ASR-35 CLEAR TO END OF THE SCREEN ROUTINE
	HZLEOS		;HAZELTINE-2000 CLEAR TO END OF THE SCREEN ROUTINE
	MBEEOS		;MINI-BEE CLEAR TO END OF THE SCREEN ROUTINE
	MDLEOS		;MODULAR ONE CLEAR TO END OF THE SCREEN ROUTINE
	V5BEOS		;DEC VT05B CLEAR TO END OF THE SCREEN ROUTINE
	V50EOS		;DEC VT50 CLEAR TO END OF THE SCREEN ROUTINE
	V52EOS		;DEC VT52 CLEAR TO END OF THE SCREEN ROUTINE
	V61EOS		;DEC VT61 CLEAR TO END OF THE SCREEN ROUTINE

AD1EOS:	OUTSTR	[BYTE (7)%AD1LD,%AD1ES,0]
	MOVEI	T1,^D100	;HIBERNATE FOR AWHILE
	HIBER	T1,		; ..
	 JFCL			;NO HIBER - PUNT
	POPJ	P,		;RETURN

AD3EOS:	HRRZ	T1,DSPNUM(P1)	;GET THE SCREEN SIZE
	TXNE	F,F.TTL		;SKIP THE TITLE IS BEING OUTPUT
	MOVEI	T1,^D3(T1)	;GET THE SIZE OF THE TITLE
	SUB	T1,CURCNT	;GET THE NUMBER OF BLANK LINES
	JUMPLE	T1,.POPJ	;RETURN IF NO BLANKS LINES NEEDED
AD3EO1:	OUTCHR	[.CHLFD]	;OUTPUT A LINE-FEED
	SOJG	T1,AD3EO1	;LOOP BACK IF MORE LINES TO OUTPUT
	POPJ	P,		;RETURN

ASREOS==.POPJ		;NOOP FOR ASR TERMINALS

HZLEOS:	MOVE	T1,CURCNT	;GET THE NUMBER OF LINES DISPLAYED
	EXCH	T1,LSTCNT	;SAVE FOR THE NEXT SCAN
	SUB	T1,LSTCNT	;GET THE NUMBER LINES TO DELETE
	AOJLE	T1,.POPJ	;RETURN IF NO LINES TO CLEAR
HZLES0:	OUTSTR	[BYTE (7)%HZLLD,%HZLDL,.CHDEL,.CHDEL,0]
	SOJE	T1,.POPJ	;JUMP IF NO MORE LINES TO DELETE
	MOVEI	T2,^D10		;HIBERNATE FOR AWHILE
	HIBER	T2,		; ..
	 OUTSTR	[BYTE (7).CHDEL,.CHDEL,.CHDEL,.CHDEL,0]
	JRST	HZLES0		;LOOP BACK UNTIL FINISHED

MBEEOS:	OUTSTR	[BYTE (7)%MBELD,%MBEES,0]
	POPJ	P,		;RETURN

MDLEOS==HZLEOS		;SAME AS HAZELTINE-2000

V5BEOS:	OUTCHR	[%V5BES]
	POPJ	P,		;RETURN

V50EOS==MBEEOS		;SAME AS MINE-BEE

V52EOS==MBEEOS		;SAME AS MINI-BEE

V61EOS==MBEEOS		;SAME AS MINI-BEE
;HERE TO CLEAR TO END OF THE LINE

TRMEOL:	AD1EOL		;LSI ADM-1 CLEAR LINE ROUTINE
	AD3EOL		;LSI ADM-3 CLEAR LINE ROUTINE
	ASREOL		;ASR-33 OR ASR-35 CLEAR LINE ROUTINE
	HZLEOL		;HAZELTINE-2000 CLEAR LINE ROUTINE
	MBEEOL		;MINI-BEE CLEAR LINE ROUTINE
	MDLEOL		;MODULAR ONE CLEAR LINE ROUTINE
	V5BEOL		;DEC VT05B CLEAR LINE ROUTINE
	V50EOL		;DEC VT50 CLEAR LINE ROUTINE
	V52EOL		;DEC VT52 CLEAR LINE ROUTINE
	V61EOL		;DEC VT61 CLEAR LINE ROUTINE

AD1EOL:	OUTSTR	[BYTE (7)%AD1LD,%AD1EL,0]
	POPJ	P,		;RETURN

AD3EOL==.POPJ		;NOOP FOR LSI ADM-3 TERMINALS

ASREOL==.POPJ		;NOOP FOR ASR TERMINALS

HZLEOL==.POPJ		;NOOP FOR HAZELTINE-2000 TERMINALS

MBEEOL:	OUTSTR	[BYTE (7)%MBELD,%MBEEL,0]
	POPJ	P,

MDLEOL==HZLEOL		;SAME AS HAZELTINE-2000

V5BEOL:	OUTCHR	[%V5BEL]
	POPJ	P,		;RETURN

V50EOL==MBEEOL		;SAME AS MINI-BEE

V52EOL==MBEEOL		;SAME AS MINI-BEE

V61EOL==MBEEOL		;SAME AS MINI-BEE
;HERE TO HOME THE TERMINAL

TRMHOM:	AD1HOM		;LSI ADM-1 HOME THE SCREEN ROUTINE
	AD3HOM		;LSI ADM-3 HOME THE SCREEN ROUTINE
	ASRHOM		;ASR-33 OR ASR-35 HOME THE SCREEN ROUTINE
	HZLHOM		;HAZELTINE-2000 HOME THE SCREEN ROUTINE
	MBEHOM		;MINI-BEE HOME THE SCREEN ROUTINE
	MDLHOM		;MODULAR ONE HOME THE SCREEN ROUTINE
	V5BHOM		;DEC VT05B HOME THE SCREEN ROUTINE
	V50HOM		;DEC VT50 HOME THE SCREEN ROUTINE
	V52HOM		;DEC VT52 HOME THE SCREEN ROUTINE
	V61HOM		;DEC VT61 HOME THE SCREEN ROUTINE

AD1HOM:	OUTCHR	[%AD1HM]
	MOVEI	T1,^D100	;HIBERNATE FOR AWHILE
	HIBER	T1,		; ..
	 JFCL			;NO HIBERNATE - PUNT
	POPJ	P,		;RETURN

AD3HOM==.POPJ		;NOOP FOR LSI ADM-3 TERMINALS

ASRHOM==ASRCLR		;ASR TERMINALS PRINT OUTPUT '<CR><LF>'

HZLHOM:	OUTSTR	[BYTE (7)%HZLLD,%HZLHM,0]
	POPJ	P,		;RETURN

MBEHOM:	OUTSTR	[BYTE (7)%MBELD,%MBEHM,0]
	POPJ	P,		;RETURN

MDLHOM==HZLHOM		;SAME AS HAZELTINE-2000

V5BHOM:	OUTCHR	[%V5BHM]
	POPJ	P,		;RETURN

V50HOM==MBEHOM		;SAME AS MINI-BEE

V52HOM==MBEHOM		;SAME AS MINI-BEE

V61HOM==MBEHOM		;SAME AS MINI-BEE
SUBTTL	THE ERROR ROUTINES


E$$DRM:	OUTSTR	[ASCIZ /
?DDBDRM DDBDPY isn't set up to run on this monitor
/]
	JRST	CMDAB1		;GO DO A MONITOR RETURN

E$$NPS:	OUTSTR	[ASCIZ /
?DDBNPS No privileges to SPY on the monitor
/]
	JRST	CMDAB1		;GO DO A MONITOR RETURN

E$$DCB:	PUSHJ	P,@TRMCLR(P1)	;GO CLEAR THE SCREEN
	OUTSTR	[ASCIZ /
?DDBDCB DDB chain was broken
/]
	JRST	CMDAB0

E$$TTF:	OUTSTR	[ASCIZ /
?DDBTTF A TRMNO. or TRMOP. UUO failed
/]
	JRST	CMDAB1		;GO DO A MONITOR RETURN

E$$CIT:	OUTSTR	[ASCIZ /
?DDBCIT Can't INIT the terminal
/]
	JRST	CMDAB1		;GO DO A MONITOR RETURN

E$$CRS:	OUTSTR	[ASCIZ /
?DDBCRS DDBDPY can't be ran as a subjob
/]
	JRST	CMDAB1		;GO DO A MONITOR RETURN

IFN FTPRIV,<
E$$NPR:	OUTSTR	[ASCIZ /
?DDBNPR No privileges to run DDBDPY
/]
	JRST	CMDAB1		;GO DO A MONITOR RETURN >
SUBTTL	THE DATA AND STORAGE AREA


PDL:	BLOCK	PDLSIZ	;THE PUSH DOWN LIST
IFN FTDEBUG,<
PATCH:	BLOCK	PATSIZ	;A PATCH AREA IF DEBUGGING >
TEMP:	BLOCK	1	;A TEMPORARY STORAGE LOCATION
IFE <MONVER-700>,<
LSTLOC:	BLOCK	1
>
IFE <MONVER-603>*<MONVER-700>,<
NODIDX:	BLOCK	1	;THE NODE NUMBER OF THE TERMINAL >
LINIDX:	BLOCK	1	;THE RELATIVE LINE ON THE NODE
INCHR:	BLOCK	1	;CONTAINS AN INSTRUCTION TO BE EXECUTED WHEN
			; ANOTHER CHARACTER IS WANTED ON INPUT
ADRDSK:	BLOCK	1	;ADDRESS OF THE FIRST DISK DDB
MYPPN:	BLOCK	1	;MY PROJECT PROGRAMMER NUMBER
JOBMAX:	BLOCK	1	;THE MAXIMUM NUMBER OF JOBS
CURJOB:	BLOCK	1	;MY JOB NUMBER
IFN FTJOB,<
JIFFIE:	BLOCK	1	;THE NUMBER OF JIFFIES IN ONE SECOND
JIFMIN:	BLOCK	1	;THE NUMBER OF JIFFIES IN ONE MINUTE
JIFHOR:	BLOCK	1	;THE NUMBER OF JIFFIES IN ONE HOUR
PTYMIN:	BLOCK	1	;THE NUMBER OF THE FIRST PTY
CURDAT:	BLOCK	1	;THE CURRENT DATE
TOTTIM:	BLOCK	1	;THE TOTAL RUNTIME
DELTIM:	BLOCK	1	;THE DELTA RUNTIME
DSKRED:	BLOCK	1	;THE NUMBER OF DISK READS
DSKWRT:	BLOCK	1	;THE NUMBER OF DISK WRITES >
PAGNUM:	BLOCK	1	;CURRENT PAGE TO OUTPUT
PAGSIZ:	BLOCK	1	;THE NUMBER OF DDB'S ON ONE SCREEN
PAGFST:	BLOCK	1	;THE FIRST DDB TO OUTPUT ON THE PAGE
PAGLST:	BLOCK	1	;THE LAST DDB TO OUTPUT ON THE PAGE
CURCNT:	BLOCK	1	;THE NUMBER OF LINES OUTPUT THIS SCAN
LSTCNT:	BLOCK	1	;THE NUMBER OF LINES OUTPUT ON THE LAST SCAN
DDBCNT:	BLOCK	1	;THE NUMBER OF DDB'S FOUND ON THIS SCAN
JOB:	BLOCK	1	;THE CURRENT JOB WE'RE LOOKING AT FOR DDBS
HIJOB:	BLOCK	1	;HIGHEST JOB IN SYSTEM
CURUPM:	BLOCK	1	;CURRENT UPMP FOR JOB (PHYSICAL ADDRESS)
CURPTR:	BLOCK	1	;PNTR TO CURRENT FUNNY PAGE
CURPAG:	BLOCK	1	;CURRENT PHYSICAL PAGE OF FUNNY PAGE
CURVRT:	BLOCK	1	;CURRENT VIRTUAL PAGE OF SPIED DDB
TTLBUF:	BLOCK	LINSIZ*^D3  ;THE TITLE BUFFER
STLBUF:	.SBTTX		;THE SUBTITLE TEXT
IFN FTPATH,<
PTHBUF:	.PTHTX		;THE PATH SUBTITLE TEXT >
IFN FTWHAT,<
WHTBUF:	BLOCK	WHTSIZ	;THE COMMAND STRING BUFFER >
XLIST	;;TURN THE LISTING OFF
HLPBUF:
ASCIZ	\DDB Set up for a 701 Monitor

Each command must be terminated by a break character
^C (Control-C) OR ^Z (Control-Z) will exit the job

<CR>  Update the listing
<ALT> Update the listing and wait for a new command
  +   Advance the listing by one page
  -   Decrement the listing by one page
  A   List all the disk DDBs (privileged command)
  D   Change the type of display
  F   List only the DDBs that reference a file specification
  H   This help text
  J   List only the DDBs from a job
  K   Kill the execution and this job
  L   List only the DDBs that are from jobs logged-in under a PPN
  P   Complement the listing of the entire path
  S   Change the sleep time between updates
  T   Complement the listing of the title line
  W   Complement the listing of the command buffer\

LIST	;;TURN THE LISTING ON

IFN FTSLEEP,<
SLPCNT:	BLOCK	1	;SLEEP TIME ADJUSTMENT COUNTER >
HIBTIM:	HB.RTL!HB.RWJ	;HIBER TIME AND WAKE BITS
ROUTIN:	BLOCK	1	;THE ROUTINE TO BE USED IS STORED HERE
JOBNUM:
NOD:	BLOCK	1	;THE FILE SPECIFICATION GO HERE
NODMSK:	BLOCK	1
DEV:	BLOCK	1
DEVMSK:	BLOCK	1
FIL:	BLOCK	1
FILMSK:	BLOCK	1
EXT:	BLOCK	1
DIR:	BLOCK	1
DIRMSK:	BLOCK	1
BLTEND==.-1

XROUTI:	BLOCK	1	;THE ROUTINE TO BE USED IS STORED HERE
XNOD:	BLOCK	1	;THE TEMPORARY FILE SPECIFICATION GO HERE
XNODMS:	BLOCK	1
XDEV:	BLOCK	1
XDEVMS:	BLOCK	1
XFIL:	BLOCK	1
XFILMS:	BLOCK	1
XEXT:	BLOCK	1
XDIR:	BLOCK	1
XDIRMS:	BLOCK	1
XBLTEND==.-1

IROUTI:	TSTFIL		;THE ROUTINE TO BE USED IS STORED HERE
INOD:	'      '	;THE INITIAL FILE SPECIFICATION GO HERE
INODMS:	-1		; 'ALL:*.*[PRJ,*]
IDEV:	'ALL   '
IDEVMS:	0
IFIL:	'*     '
IFILMS:	0
IEXT:	'*  ',,0
IDIR:	0
IDIRMS:	0
JOBPTR:					;POINTER TO THE JOB NUMBER
IFL <MONVER-602>,<
	POINT	7,HI+DEVCHR(P2),6	;507/601 >
IFGE <MONVER-602>,<
	POINT	9,HI+DEVJOB(P2),35	;602 OR 603 >

STSPTR:					;POINTER TO THE FILE STATUS
IFL <MONVER-602>,<
	POINT	3,HI+ACCSTS(P3),29	;507/601 >
IFGE <MONVER-602>,<
	POINT	3,HI+ACCSTS(P3),32	;602 OR 603 >


TRMTAB:	1,,.TONFC	;SET THE NO FREE CARRIAGE RETURNS
	0,,.TOALT	;CLEAR THE ALTMODE SETTING
TRMSIZ==.-TRMTAB
TRMSAV:	BLOCK	TRMSIZ	;SAVE THE TTY STATUS HERE
TRM:	BLOCK	1	;THE TRMOP. DATA AREA
	.UXTRM
	BLOCK	1


INTBLK:	4,,CMDABT	;GO ABORT THE JOB ON A CONTROL-C
	ER.ICC
	BLOCK	2


MODE:	SIXBIT	/ R/	;READ		** THE FILE STATUS MODES **
	SIXBIT	/ U/	;UPDATE
	SIXBIT	/ S/	;SUPERSEDE
	SIXBIT	/ ?/	;NO SUCH MODE
	SIXBIT	/ C/	;CREATE


IFE <MONVER-603>*<MONVER-700>,<
EVWTAB:	SIXBIT	/TK/	;TAPE KONTROLLER WAIT
	SIXBIT	/TR/	;TAPE REWIND WAIT
	SIXBIT	/LB/	;LABEL PROCESSING WAIT
	SIXBIT	/NW/	;NETWORK WAIT
	SIXBIT	/IP/	;IPCF SYSTEM PROCESS RECEIVE WAIT
	SIXBIT	/FI/	;FRONT END DEVICE INPUT WAIT
	SIXBIT	/FO/	;FRONT END DEVICE OUTPUT WAIT
	SIXBIT	/D6/	;DAS60 DEVICE WAIT >

UPTBLK:	1
	UPTPAG
FUNBLK:	1
	SPYPAG
LDBBLK:	2
	LDBPAG
	LDBPAG+1
DELUPT:	1
	SETZ	UPTPAG
DELSPY:	1
	SETZ	SPYPAG
DELLDB:	2
	SETZ	LDBPAG
	SETZ	LDBPAG+1
	XALL		;EXPAND THE MACROS

DEFINE	.DSP	($NAM,$TYP,$SIZ),<
	LIST
	<SIXBIT	/$NAM/>
	XLIST
>

DSPNAM:	.DSPTB			;** GENERATE THE DISPLAY NAME TABLE **
DSPSIZ==.-DSPNAM


DEFINE	.DSP	($NAM,$TYP,$SIZ),<
	LIST
	$TYP,,$SIZ-4	;$NAM DISPLAY
	XLIST
>

DSPNUM:	.DSPTB			;** GENERATE THE DISPLAY SIZE TABLE **

	SALL		;SUPPRESS THE MACRO EXPANSION
DEFINE	GT($GET,$IDX,$FTX)<
	IFN $FTX,<
		BYTE	(9)$GET (5)0 (4)$IDX (18)0 >
>

GETSLF:	GT ,T1,1		;THE GETTAB TABLE POINTER
GETPDB:	GT ,P5,FTJOB		;THE PDB POINTER
GETDAT:	GT ,,FTJOB		;GET ADDRESS OF THE DATE
GETSPB:	GT ,,FTJOB&^-<MONVER-603>  ;THE ADDRESS OF THE WHERE TO FIND THE FIRST PPB
GETSTR:	GT ,,1			;THE ADDRESS OF THE WHERE TO FIND THE FIRST STR
GETNDB:	GT ,,^-<MONVER-603>	;THE ADDRESS OF THE FIRST NETWORK DATA BLOCK

GETTBL:			;THE GETTAB TABLES TO BE SET UP

GETSTS:	GT .GTSTS,P5,FTJOB	;THE STATUS OF A JOB
GETADR:	GT .GTADR,P5,FTJOB	;THE RELOCATION AND PROTECTION
GETPP:	GT .GTPPN,T5,1		;THE PROJECT PROGRAMMER NUMBER
GETPPN:	GT .GTPPN,P5,1		;THE PROJECT PROGRAMMER NUMBER
GETPRG:	GT .GTPRG,P5,FTJOB	;THE PROGRAM NAME
GETTIM:	GT .GTTIM,P3,FTJOB	;THE CURRENT RUNTIME
GETKCT:	GT .GTKCT,P3,FTJOB&^-<MONVER-603>  ;THE KILO-CORE-TICKS
GETPRV:	GT .GTPRV,T5,FTPRIV	;THE JOB PRIVILEGES
GETSWP:	GT .GTSWP,P5,FTJOB	;THE SWAPPING DATA
GETTTY:	GT .GTTTY,P5,1		;THE TTY POINTER
GETSGN:	GT .GTSGN,P5,FTJOB	;THE SEGMENT NUMBER
GETRCT:	GT .GTRCT,P5,FTJOB	;THE DISK READ COUNT
GETWCT:	GT .GTWCT,P5,FTJOB	;THE DISK WRITE COUNT
GETWSN:	GT .GTWSN,T1,FTJOB	;THE RUN STATES
GETLOC:	GT .GTLOC,,^-<MONVER-603>  ;THE LOCATION NUMBER
GETSPL:	GT .GTSPL,P5,FTJOB	;THE SPOOL BITS
GETRTD:	GT .GTRTD,P5,FTJOB	;THE REAL TIME STATUS WORD
GETLIM:	GT .GTLIM,P5,1		;THE LIMITS WORD
GETUPM:	GT	.GTUPM,T1,1	;JBTUPM
GETVRT:	GT .GTVRT,P5,FTJOB&FTVM	;THE VIRTUAL FLAGS
GETST2:	GT .GTST2,P5,FTJOB&^-<MONVER-603>  ;THE SECOND STATUS WORD
GETJLT:	GT .GTJLT,P5,FTJOB&^-<<MONVER-602>*<MONVER-603>>  ;THE LOGGED-IN TIME
GETVKS:	GT .GTVKS,P3,FTJOB&FTVM&^-<MONVER-603>  ;THE VM KILO-CORE-TICKS
GETUUC:	GT .GTUUC,P3,FTJOB&^-<MONVER-603>  ;THE UUO COUNT

GETSIZ==.-GETTBL	;DEFINE THE SIZE OF THE GETTAB TABLE
	XLIST	;DON'T LIST THE LITERALS
	LIT	;FORCE THE LITERALS TO BE PUT HERE
	LIST	;TURN THE LISTING BACK ON

LGOBLK:	SIXBIT	/SYS/	;DEVICE - FOR THE "K" COMMAND
	SIXBIT	/LOGOUT/;FILENAME
	EXP	0	;EXTENTION
	EXP	0	;PRIVILEGES
	EXP	0	;PPN
	EXP	0	;CORE

OPNBLK:	EXP	.IOASC	;GET AN INPUT CHANNEL TO 'SYS'
	SIXBIT	/SYS/
	EXP	SYSHED

LOKBLK:	EXP	.RBEXT	;.RBCNT - LOOKUP THE FILE 'DISPLA.INI' ON SYS
	XWD	0,0	;.RBPPN - NO PPN
	SIXBIT	/DISPLA/;.RBFIL - FILE NAME
	SIXBIT	/INI/	;.RBEXT - EXTENSION NAME

LINBUF:	BLOCK	BUFSIZ	;THE LINE BUFFER

SYSHED==LINBUF		;THE BUFFER HEADER FOR 'SYS'
SYSPNT==LINBUF+1	;THE BYTE POINTER
SYSCNT==LINBUF+2	;THE BYTE COUNTER
SYSBUF==LINBUF+3	;THE DISK BUFFER FOR 'SYS:DISPLA.INI'


	END	DDBDPY