Google
 

Trailing-Edge - PDP-10 Archives - BB-4157D-BM - sources/forddt.mac
There are 27 other files named forddt.mac in the archive. Click here to see a list.
TITLE FORDDT - FORTRAN INTERACTIVE DEBUGGING AID

SUBTTL  23-Oct-77	/P.E.T. HARDING/DBT/FLD/MD/JMT/MA/SJW		READING  .  .  UK.



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


;**;[100] add universal search  ma 26-aug-77
	search monsym



EDITNO==101	;EDIT NO
VERSION==5	;MAJOR VERSION NO
VMINOR==1	;MINOR VERSION NO
VWHO==0		;WHO LAST EDITED



.JBDDT=74
.JBREN=124
.JBVER=137






LOC	.JBVER

BYTE(3)VWHO(9)VERSION(6)VMINOR(18)EDITNO	;SETS FORDDT VERSION #



LOC	.JBREN

RE.ENT		;SETS THE RE - ENTER ADDRESS



LOC	.JBDDT

FORDDT		;MAKES DEBUG PROG,FORDDT WORK



RELOC
	PAGE
;  REVISION HISTORY



;21		REMOVE ALL HIBERNATE CALLS - JUST USE TTCALL 4
;22		CHANGE TRACE% TO TRACE.
;23		BEGIN UPDATE FOR (1) SYMBOL TABLE LOOKUP ALGORITHMS
;				 (2) GENERAL CLEAN UP
;24		(CONTINUING)
;25		CONTINUING;  ALSO REWRITE OF LOOK
;26		CONTINUING;  REWRITE OF OFFSET
;			     REMOVAL OF 'BIGCOD'
;27		CONTINUING
;30		CONTINUING;  INCLUDING SYMBOL USAGE CLEANUP AND REMOVAL
;			     OF SYMSET
;31		CONTINUING;  REMOVAL OF MOST 'DEBUG' CONDITIONAL CODE
;			     AND INTCPT CONDITIONAL AND CODE
;32		CONTINUING;  REMOVAL OF SMART PORTION OF LOOK
;33		CONTINUING;  FIXUP OF PAUSE LOGIC
;34		CONTINUING;  REINSERT OF SMART CODE TO LOOK - IGNORE
;			     UDDT, FORDDT, AND JOBDAT ON LOOKUP.
;35		FINAL EDIT OF UPDATE - PATCH AREA GOES UNDER DEBUG
;		   CONDITIONAL, CALL TO DO MACRO IS FIXED, SO THIS WILL
;		   NOW ASSEMBLE WITH MACRO V50.
;36		ANOTHER FINAL - HIERARCHY IN LOOK;  FNDSYM RESOLVED
;37		CONTINUING FINAL - SCATTERED BUGS
;40		FIX AC LONG ASCII AND RASCII
;		FIX - LOCATE FOR LOCALS OUTSIDE OPEN
;		FIX - DIM A(X(1)/1)
;41		FIX USAGE OF PROGRAMS NAMED OTHER THAN MAIN.
;42		INITIALIZE  ODF (NUMERIC BASE) FOR GROUP TYPEOUT
;43		ADD  CURGRP (BIT MASK ) TO NOTE CURRENT GROUPS
;		ACTIVE IN A TYPEOUT  AND CATCH RECURSION
;44		FIX UP "LOOK" SO THAT IF "MATHSM" IS NON-0 THAT IT
;		WILL ACCEPT ONLY A SYMBOL WHOSE NAME IS IN "MATHSM"
;45		FIX PAUSE TYPING TO LISTEN TO TTY BETTER
;46		CHECK RANGES TO SEE THAT EACH  SYMBOL IS THE SAME
;***** BEGIN VERSION 4A
;47		DIFFERENTIATES ASCII- AND RASCII-MODE "TYPE"-OUTPUT
;50		ALLOWS = AS DELIMITER IN ACCEPT STATEMENTS
;51		FIXES "HELP" TO LIST COMMANDS
;52		FIX TYPEOUT OF COMPLEX VALUES
;53	15732	FIX TYPOUT OF SYMBOL WHEN LOCAL SYMBOL FOUND BEFORE GLOBAL
;***** DELETED ;54	15732	TYPE OUT NAMES OF ARGUMENTS WHEN PAUSE AT ROUTINE
;55	15708	MAKE TYPE KNOW ABOUT FORMAL ARGUMENTS
;***** BEGIN VERSION 4B
;56	16928	ACCEPT LOWER CASE MODE MODIFIERS
;57	17043	IF TWO SYMBOLS HAVE SAME ADDRESS VALUE AND SAME
;		NAME VALUE , THEN THEY MUST BE IN COMMON , SO LOOK
;		SHOULD SUCCEED (OK SKIP 2 RETURN)
;		ALSO REMEMBER NAME OF ARRAY FOR DIM COMMAND.
;60	17272	IF ARRAY INFORMATION DOES NOT EXIST, TELL THE USER
;		BUT DO NOT GIVE FDTIER ERROR.
;61	17574	IF ERROR HAPPENS IN TYPING GROUP, CURRENT GROUP VARIABLE
;		IS NOT CLEARED AND LATER GIVES ERROR FDTRGR.
;62	18059	ADD INFORMATION IN THE "WHAT" OUTPUT
;		(LOCATION OF THE PAUSE LABEL)
;63	18374	GIVE CORRECT INFORMATION FOR "WHAT" COMMAND:
;		SINGLE VARIABLE NAME + ARRAY NAMES AND SUBSCRIPT
;		+ LOCATION OF NAMES
;64	S19206	DONT TYPE EXTRA CRLF BETWEEN TYPED VALUES.
;65	18715	ACCEPT COMMENTS ON COMMAND LINES
;		DELIMITER IS !  TO END OF LINE OR OTHER !
;66	 --- 	FIX TEST FOR ARRAY BOUNDS EXCEEDED IN DIM COMMAND
;67	19541	FIX LOWER CASE RANGE CHECK
;70	QA570	FIX REENTER MESSAGE TO ALWAYS GIVE SECTION NAME
;
;	BEGIN VERSION 5A, 7-NOV-76
;
;71	20553	TYPING A FORMAT STATEMENT CAUSES AN E8 INTERNAL
;		ERROR IF THE PROGRAM WAS NOT COMPILED WITH THE
;		/DEBUG SWITCH. ADD MORE INFORMATIVE ERROR MESSAGE
;		AREAS AFFECTED: FRMSET, ERR41
;72	10088	WHEN TYPING AN ARRAY, THE INDEXES ARE NOT CORRECTLY
;		TYPED IF AND ONLY IF THE IS A HIGH SEGMENT SYMBOL
;		TABLE (FOR EXAMPLE FOROTS IS LOADED WITH SYMBOLS).
;73	21818	WHEN TYPING A COMPLEX ITEM OR ARRAY, OR ACCEPTING A
;		VALUE FOR A COMPLEX ARRAY, FORDDT DOESN'T NOTICE THAT
;		EACH ENTRY IS TWO WORDS AND MESSES UP SUBSCRIPTS ETC.
;74	21988	FORDDT CANT SET BREAK POINTS (PAUSE) IN HIGH SEGMENT
;		OF A FORTRAN PROGRAM. ROUTINE CHKADR CLOBBERS (T)
;75	21910	WHEN DOING A START, PROGRAM SHOULD CLEAR
;		ANY SUPPLIED ARGUMENTS FROM THE TTY BUFFER.
;76	21910	FIX ERROR IN ACCEPT ROUTINE WHICH CAUSES UNNECESSARY
;		WARNING MESSAGE WHEN EXACTLY 5 (OR EXACTLY 10 IF IN
;		LONG MODE) CHARACTERS ARE ACCEPTED
;77	21910	MAKE THE PAUSE COMMAND WITH NO ARGUMENTS DISPLAY
;		THE PAUSES.
;100		Add TOPS20 conditional, make FORDDT run in native
;		mode under TOPS-20.
;101	QA2171	FIX FORDDT OUTPUT TO USE FOROTS CORRECTLY AFTER OTS EDIT
;		  661: OUTPUT MUST START WITH + AND CLEAR TTY BUFFER
;		  AFTERWARDS
;*** END REVISION HISTORY
	PAGE
SUBTTL	DEFINITIONS	


;DEFINE ACCUMULATORS

ENTRY FDDT.,.F10
EXTERN .JBREL,.JBHRL,.JBSYM,.JBHSM,.JBSA,.JBUSY,.JBOPC,.JBDA

F=0		;FLAGS
TF=1		;TEMPORARY FLAGS  RESET EACH RETURN TO RET:
R=<T1=<A=2>>	;POINTERS TO TABLES, CORE, ETC.
S=<T2=<B=3>>
W=<T3=<C=4>>	;CONTAINS DISPATCH ADDRESS IN WORD ASSEMBLER
T=<T4=5>	;TRANSFER DATA
W1=<T5=6>
W2=<T6=7>
TMOD=10		;TYPE MODE FLAGS
AR=11		;
ODF=12		;RADIX DEFINITION
TT=<P3=13>	;TEMPORARY
TT1=<P4=14>	;TEMPORARY
RAY.==15	;POINTS TO NEXT F10 DEFINE ARRAY DIMENSION
P=17		;PUSH DOWN



;DEFINE SYMBOL TABLE SYMBOL TYPES

GLOBAL==040000		;GLOBAL SYMBOL
LOCAL==100000
PNAME==740000		;PROGRAM NAME
DELI==200000		;DELETE INPUT
DELO==400000		;DELETE OUTPUT



;GETTAB TABLES

.GTSGN==14	; GETTAB FOR DETERMINING HISEG INDEX
.GTUPM==100	; GETTAB FOR FINDING HISEG START ADR
	PAGE
;	DEFINE SYSTEM PARAMETERS


IFNDEF NBP,<NBP==^D10>		;NUMBER OF PUASE REQUESTS

IFNDEF GPMAX,<GPMAX==10>	;NUMBER OF GROUP STRINGS (MAX 35 )

IFNDEF PDSIZ,<PDSIZ==10*GPMAX+40>	;DEFINE PDL SIZE TO ALLOW ALL GROUPS TOGETHER
IFG PDSIZ-100,<PDSIZ==100>	;LIMIT SIZE TO ^D64

IFNDEF CFSIZ,<CFSIZ==^D15>	;CORE FILE LENGTH



IFNDEF DIMSIZ,<DIMSIZ==^D50>	;AMOUNT OF SPACE FOR DIMENSION DEFINITIONS




IFNDEF DEBUG,<DEBUG==0>		;KEEP OFF - DEVELOPMENT ONLY - UNSUPORTED
				IFN DEBUG<  IF1<
	PRINTX	FORDDT - DEVELOPMENT VERSION
					>	>

;**;[100] add conditional  ma 25-aug-77
ifndef tops20,<tops20==0>	;[100]set tops20==1 to run in native mode

	PAGE
COMMENT \

NBP	DEFINE THE MAXIMUM NUMBER OF PAUSE REQUESTS ALLOWED
	EACH PAUSE INCREASES CORE REQUIREMENTS BY DECIMAL 10

GPMAX	DEFINE THE MAXIMUM NUMBER OF GROUPS
	EACH GROUP SETTING REQUIRES AN EXTRA DECIMAL 23 LOCATIONS

PDSIZ	DEFINE THE SIZE OF THE PUSH DOWN STACK 
	ALLOW SUFFICIENT STACK FOR ALL GROUPS TOGETHER
	LIMITS PDSIZE TO ^D64

CFSIZ	DEFINE THE SIZE OF EACH CORE FILE

DIMSIZ	DEFINE THE NUMBER OF TWO WORD PAIRS
	USED TO HOLD ARRAY DIMENSION DATA

\
	PAGE
;FLAG F DEFINITIONS,  LEFT HALF:

EOL==   400000	;END OF USER LINE 
FPF==   200000	;PERIOD TYPED FLAG
FEF==   100000	;EXPONENT FLAG

MF==    040000	;MINUS FLAG
SIGN==  020000	;PLUS OR MINUS TYPED
CFLIU== 010000	;CORE FILE IN USE FLAG

OFCFL== 004000	;OUTPUT FROM CORE FILE REQUESTED
CONS==  002000	;CONSTANT SEEN FLAG
GRPFL== 001000	;GROUP FLAG - ALLOWS GROUP LOGIC

AUTO==  000400	;AUTO PROCEDE FLAG
OCTF==  000200	;OCTAL NUMBER TYPED FLAG
FGLSNM==000100	;ALLOW GLOBAL SYMBOL NAMES (FOR LOOK AND FINDSYM)

LABEL== 000040	;INDICATES STATEMENT LABEL BEING PROCESSED
LFTSQB==000020	;FLAG THAT A [ IS SEEN - SO A ] WILL END THE SPECIFICATION
BAR==   000010	;FLAG THAT WE HAVE SEEN A / IN DIMENSION ANALYSIS

DIMEND==000004	; ) OR ] FOUND I.E. END OF DIMENSION SPEC IMINENT
FPRNM== 000002	; FIND PROGRAM NAME (FOR FNDSYM)
FLCLNM==000001	; FIND LOCAL IN CURRENT OPEN PROGRAM (FOR FNDSYM)



;RIGHT HALF

POWF==  400000	;POWER FLAG # TO FOLLOW
DOUBLE==200000	;FLAG FOR DOUBLE PRECISION ARRAY DATA
BASENM==100000	;AN ARRAY BASE NAME HAS BEEN ACCEPTED

TRLABL==040000	;TRACING LABEL ONLY FLAG
PNAMEF==020000	;PROGRAM NAME SEEN IN SYBOL TABLE SEARCH
MDLCLF==010000	;USED BY LOKSYM AND FNDSYM - MULTIPLY DEFINED LOCAL SYBOL

ID==    004000	;SYMBOL IDENTIFIED FLAG
IDINOS==002000	;SYMBOL IDENTIFIED IN OPEN SECTION
SILENT==001000	;DO NOT TYPE SYMBOL IF FOUND IN 'LOOK'UP

SUBFLG==000400	;SUBSCRIPT FLAG - CHECK SUBSCRIPTS IF ON
FLSHAL==000200	;FLUSH ALL ARRAY NAMES FROM BASRAY ONWARDS
IDPNAM==000100	;IF SET CAUSES 'LOOK' TO REMEMBER SECTION NAME

NEARST==000040	;IF SET CAUSES 'LOOK' TO RETURN THE NEXT LARGER SYMBOL
F10RAY==000020	;CURRENT ARRAY IS F10 DEFINED
TRLINE==000010	;TRACE AT LINES LEVEL

FORMAL==000004	;HANDLING ARRAY AS SUBROUTINE FORMAL PARAMETER
SURGFL=000001	;ACCEPT  / AND : AS DIMENSION RANGE DELIMETERS
;	*** FLAG TF ***
;
;	TF TEMPORARY FLAG DEFINITIONS:
;	CLEARED ON EVERY RETURN TO USER (RET:)
;
;	RIGHT HALF

DCOPFG==000001	;DON'T CHANGE OPEN PROGRAM FOR GROUP
ALPHA== 000002	;PERSUADES ROUTINE EITHER TO RETURN SIXBIT ON NON # INPUT
ACCPT== 000004	;SIGNALS AN ACCEPT IN PROGRESS
ADELIM==000010	;FLAG THAT WE HAVE HAD AN ASCII TEXT DELIMITER
IMPRNG==000020	;REQUEST FOR IMPLIED RANGE
;**;[060] FLAG TF DEFINITION
ARRAY.==000040	;AN ARRAY HAS BEEN DETECTED DURING ACCEPT LOGIC
		;[060] ALSO DURING TYPE OFFSET PROCESS
GUDLBL==000100	;A GOOD NUMERIC LABEL FOUND IGNORING LAST CHARACTER
FGLONL==000200	;FIND GLOBAL SYMBOL ONLY
SYMLAB==000400	;SYMBOL IS A LABEL
DCEVAL==001000	;DON'T CALL EVAL ( FROM SYMIN )
;**;[065],FLAG TF DEFINITION,MD,APR-76
COMDEL==002000	;[065] COMMENT PROCESS IN PROGRESS




;	*** FLAG TMOD ***
;
;	DEFINE THE PRINT OPTION FLAGS USED IN LEFT & RIGHT OF TMOD
;	RIGHT HAND - DEFAULT USER SETTING
;	LEFT HAND  - LOCAL TEMPORARY SETTING (TAKES PRIORITY)

F.==000001	;TYPE FLOATING POINT FORMAT
I.==000002	;TYPE INTEGER FORMAT
O.==000004	;TYPE OCTAL FORMAT
A.==000010	;TYPE ASCII FOMAT
D.==000020	;TYPE DOUBLE PRECISION FORMAT
R.==000040	;TYPE RIGHT JUSTIFIED ASCII
C.==000100	;TYPE COMPLEX FORM
L.==000200	;'LONG' OPTION REQUESTED OR TRACE LABELS

S.==000400	;TRACE SOURCE LINES
E.==001000	;TRACE ENTRIES

ANYMOD==400000	;USED BY OPTION TO SHOW LEGAL MODIFIER SEEN





;FLAG F - "STICKY FLAGS"

STIKYS==TRLABL!TRLINE
	PAGE
;	USEFUL OPDEFS

	OPDEF	INCHWL	[TTCALL 4,]	;INPUT CHARACTER - LINE MODE
	OPDEF	CLRBFI	[TTCALL 11,]	;CLEAR INPUT
	OPDEF	PJRST	[JRST]		;PUSHJ/=POPJ
	OPDEF	SKPINL	[TTCALL 14,]	;SKIP ON NO CHARS TYPED




;	POSSIBLE ERROR MESSAGES OF THE FORM ? E#

;	? E1	CANNOT FIND SYMBOLIC NAME FOR THE PAUSE IN A 'WHAT'
;	? E2	CANNOT FIND SYMBOLIC NAME FOR THIS PAUSE(BREAK)
;	? E3	CANNOT FIND SYMBOLIC NAME FOR AN ARGUMENT OF THE
;		ROUTINE ABOUT TO BE ENTERED
;	? E4	BAD LABEL FOUND WHERE SOURCE LINE OR STATEMENT LABEL EXPECTED
;	? E5	CANNOT FIND SYMBOL IN DIMENSION LOGIC
;	? E6	CANNOT FIND SYSMBOL MATCH IN A RE-ENTER
;	? E7	CANNOT FIND SYMBOL IN A TRACE INTERUPT
;	? E8	CANNOT FIND END OF F10 FORMAT STATEMENT = LABEL+F
;	? E9	INTERNAL INCONSISTENCY (FNDSYM)


;	THESE ERRORS SHOULD NEVER OCCUR - BUT COULD INDICATE THAT
;	THE SYMBOL TABLE HAD BEEN MODIFIED(OVERLAYED?) OR SOMETHING
	PAGE
SUBTTL	MACRO'S	

	DEFINE	SETPDL		;SETUP PDL STACK
<	MOVE	P,[IOWD	PDSIZ,PDL]	>

	DEFINE	QUERY
<	TYPE	(? )	>

;**;[100] conditionalize TOPS10 macros  ma 28-aug-77
ife tops20,<
	DEFINE	TYPE(X)
<	OUTSTR	[ASCIZ/X/]	>

	DEFINE	LINE
<	OUTSTR	CRLF	>

	define	atype(x)
<	outstr x	>

	define	stype(x)
<	outstr [asciz x]>

	define	tab
<	outstr	[byte(7)11,0]	>

	define	openp
<	outstr	[byte(7)"(",0]	>

	define	closep
<	outstr	[byte(7)")",0]	>

	define	openb
<	outstr	[byte(7)74,0]	>

	define	closeb
<	outstr	[byte(7)76,0]	>

	define	putchr(x)
<	outchr x>
>				;[100] end of conditional
;**;[100] add native macros  ma 28-aug-77
ifn tops20,<
	define	type(x)
<	push	p,tf
	hrroi	tf,[asciz/x/]
	psout
	pop	p,tf	>

	define	atype(x)
<	push	p,tf
	hrroi	tf,x
	psout
	pop	p,tf	>

	define	stype(x)
<	push	p,tf
	hrroi	tf,[asciz x]
	psout
	pop	p,tf	>

	define	line
<	push	p,tf
	hrroi	tf,[byte(7)15,12,0]
	psout
	pop	p,tf	>

	define	openp
<	push	p,tf
	hrrzi	tf,"("
	pbout
	pop	p,tf	>

	define	closep
<	push	p,tf
	hrrzi	tf,")"
	pbout
	pop	p,tf	>

	define	openb
<	push	p,tf
	hrrzi	tf,74
	pbout
	pop	p,tf	>

	define	closeb
<	push	p,tf
	hrrzi	tf,76
	pbout
	pop	p,tf	>

	define	tab
<	push	p,tf
	hrrzi	tf,11
	pbout
	pop	p,tf	>

	define	putchr(x)
<	push	p,tf
	move	tf,x
	pbout
	pop	p,tf	>
>				;[100] end of conditional





	DEFINE SKIPIF(STRING)		;IS STRING LOADED? - SKIP IF IT IS
<	MOVE	T,[SQUOZE 0,STRING]	;GET RAD50 FORM OF 'STRING'
	PUSHJ	P,FINDST		;SEE IF STRING IS LOADED>



	DEFINE PROGIF(NAME)		;IS NAME LOADED?  SKIP IF SO
<	MOVE	T,[SQUOZE 0,NAME]
	MOVEM	T,SYM
	TLO	F,FPRNM
	PUSHJ	P,FNDSYM	>
	PAGE
;	RECURSION MACRO'S
;
;	MACRO -RECURS- TO SAVE RELEVANT INFORMATION TO
;	ALLOW RECURSION
;	CALL SRUCER TO RESTORE



	DEFINE RECURS(X)
<	XLIST
	IRP(X)<	PUSH	P,X>
	DEFINE SRUCER<NAMLST <X>	>
	LIST	>



	DEFINE NAMLST(X)
<	..A=100
	IRP(X)<DO(\..A,X)>
	..A=..A-1
	IRP(X)<UNDO(\..A)>
	PURGE	..A	>



	DEFINE DO(I,J)
<	..K'I=J
	..A=..A+1	>



	DEFINE UNDO(I)
<	XLIST
	POP	P,..K'I
	..A=..A-1
	PURGE	..K'I
	LIST	>



	DEFINE	JUSTIFY		;JUSTIFY THE OUTPUT & RESET T
<	PUSHJ	P,JUSTFY	;DO TYPE COMMAND OUTPUT JUSTIFICATION>



;**;hack by ma!!1
	;SALL			;SUPPRESS ALL MACRO EXPANSIONS
	PAGE
	DEFINE NAMES<
	XLIST
	C	ACCEPT,ACCEPT
	C	CONTIN,CONTIN
	C	DDT,DDT
	C	DIMENS,DIM
	C	DOUBLE,DUBLE
	C	GROUP,GROUP
	C	GOTO,GOTO
	C	HELP,HELP
	C	LOCATE,Q
	C	MODE,MODE
	C	NEXT,NEXT
	C	OPEN,OPEN
	C	PAUSE,PAUSE
	C	REMOVE,RESET
	C	START,START
	C	STOP,EX.
	C	STRACE,TRACE
	C	TYPE,DISPLA
	C	WHAT,WHAT
	LIST
>

	PAGE
SUBTTL	INITIALIZATION

FDDT.:	JFCL			;DEFAULT TO NO TRACE  MODE
				;OTHERWISE PUSHJ P,STEP4 TO TRACE
.F10:	JSR	SAVE		;SAVE USERS ACS
	PUSHJ	P,REMOVB	;REMOVE PAUSES
	JRST	MODRET		;DO A RE-ENTER - FOR DDT ONLY

FORDDT:	JSR	SAVE		;SAVE THE WORLD
	PUSHJ	P,REMOVB	;REMOVE ANY STANDING PAUSE REQUESTS
	LINE
	TYPE(STARTING FORTRAN DDT)
	LINE

	PUSHJ	P,GHSSYP	;ANY HISEG SYMBOLS?
	 SKIPGE	.JBSYM		;NO, ANY LOSEG SYMBOLS?
	CAIA
	PUSHJ	P,ERR20		;NO - WARN USER
	PUSHJ	P,SETLST	;SETUP SYM TABLE LISTS
	HRRZ	T,.JBSA		;REMEMBER THE START ADDRESS
	MOVEM	T,JOBSA		; AND THE
	MOVE	T,.JBSYM	;  SYMBOL TABLE DETAILS AT THE-
	MOVEM	T,JOBSYM	;    TIME FORDDT IS ENTERED
;**;[100] conditionalize TOPS10 code @ forddt+20 ma 29-aug-77
ife tops20,<			;[100]this hack doesn't work under TOPS20
	MOVE	T,[XWD -1,3]	;GET THE CURRENT JOB
	GETTAB	T,		;   NAME
	 CAIA			;DON'T PANIC IF NO JOB NAME
	MOVEM	T,JOBNAM>	;AND SAVE, end of conditional
				;THIS WILL SERVE TO DETECT OVERLAYS
	HRRZI	T,[JRST RET]	;GUARD AGAINST CONTINUE AFTER CNTRL C
	HRRM	T,PROC0
	MOVEI	T,1		;RESET THE INITIAL TRACE VALUE
	MOVEM	T,STPVAL	;   TO ONE
	MOVE	T,STARTU
	HLLZM	T,STARTU	;RESET - SO USER MUST 'START'
	PUSHJ	P,RE.NTR	;ALLOW A RE-ENTER TO WORK
	SETOM	ESCAPE		;NO ^C'S SO ALLOW ESCAPES TO FOROTS

	SKIPIF	(RESET.)	;SKIP IF RESET. IS LOADED
	  JRST	RE.RET		;NOT LOADED WITH FOROTS - DO OTHER INITS
	JSP	16,@GOLOC	;INITIALISE THE FOROTS SYSTEM
	0,,0			;DUMMY RESET ARG
	PAGE
;	RE - ENTER ENTRY

RE.RET:	SETPDL
	SKIPIF	(CEXIT.)	;
	   SETZM T		;NO CLUDGE CONECTIONS IN THIS PROG
	HRRM	T,HELLO		;SET UP FOR HELLO MACRO DETECTOR
	MOVE	F,STKYFL	;REINSTATE THE FLAG REGISTER
	MOVSI	T,(JFCL)	;RESET THE TRACE ENTRY
	MOVEM	T,FDDT.		;
	MOVE	T,M2.F		;GET THE FOROTS FIN CALL
	MOVEM	T,M2.I		;RE-INSTATE IN FORMAT - AFTER COMPLEX INPUT

;	SET THE DEFAULT TYPING FORMAT TO FLOATING  -  ALSO SET STKYFL

MODRET:	HRRZI	T,F.		;SET UP TO TYPE FLOATING FORM
	MOVEM	T,MODFLG	;SAVE AS THE STANDARD DEFAULT
	HRRZ	T,STARTU	;SEE IF ALREADY STARTED
	JUMPN	T,RET		;YES LEAVE ANY OPENED SECTIONS ALONE
	SKIPE	PRGNAM		;HAS ANY SECTION BEEN OPENED?
	JRST	RET		;YES - SO NOT FIRST TIME THROUGH
	PROGIF	(MAIN.)		;SKIP IF MAIN. IS LOADED
BEGIN2:	   PUSHJ P,GETPRG	;NOT FOUND - GET THE MAIN PROGRAM NAME
			MOVE	T3,[SQUOZE 0,MAIN.]
	MOVEM	T3,PRGNAM	;DEFAULT MAIN PROG NAME IS MAIN.
	MOVEM	T3,SYM		;SET SO SETNAM CAN OPEN THE MAIN PROGRAM
	PUSHJ	P,SETNAM	;'OPEN' THE MAIN PROGRAM
	PAGE
SUBTTL	USER INPUT

RET:	HRRZ	TMOD,MODFLG	;SET UP THE DEFAULT TYPING OPTIONS ONLY
	AND	F,[STIKYS]	;MAKE SURE WE SAVE THE GOOD FLAGS
	MOVEM	F,STKYFL	; IN THE STICKY STORE
	SETZI	TF,		;RESET THE TEMPORARY FLAGS
	SKIPGE	TERMK		;END OF LAST LINE SEEN?
	PUSHJ	P,CLRLIN	;CLEAR OUT THE REST OF USERS LINE
	SETPDL
;**;[61],RET+7,INSERT,MD, 28-OCT-75
	CLEARM	CURGRP		;CLEAR CURRENT GROUP NUMBERS
	CLEARM	SYL
	CLEARM	MATHSM
	CLEARM	SYM
	CLEARM	DEN
	CLEARM	RANGE
	CLEARM	GETCHR
;**;[063],RET+15,  INSERT, MD,APR-76
	CLEARM	SECSAV		;[063] CLEAR SECTION NAME SAVED
;**;[100] conditionalize TOPS10 code @ ret+17 ma 28-aug-77
ife tops20,<
	SKPINL			;CLEARS THE EFFECT -
	JFCL>			;   OF ^O, end of conditional
;**;[100] add native code @ ret+17 ma 28-aug-77
ifn tops20,<
	push	p,tf		;[100]save tf
	push	p,r		;[100]save r
	hrrzi	tf,.priou	;[100]get terminal output designator
	rfmod			;[100]get terminal JFN word
	tlz	r,(tt%osp)	;[100]clear ^o effects
	hrrzi	tf,.priou	;[100]get terminal output designator
	sfmod			;[100]set new JFN word
	pop	p,r		;[100]restore r
	pop	p,tf>		;[100]restore tf, end of conditional
	LINE
	PUSHJ	P,OVRLAY	;HAS AN OVERLAY OCCURED

;**;[100] delete/modify @ comcon-10 ma 29-aug-77
	pushj	p,readcm	;prompt and read user command
	JUMPE	T2,RET		;NO SIGNIFICANT INFORMATION

	MOVEM	T2,COMAND	;SAVE USER COMAND
	JUMPN	T1,BADSYN	;COMMAND TERMINOLOGICAL INEXACTITUDE

	SKIPGE	T1,TERMK	; SPACE IS NOT EOL
	TLZA	F,EOL		;CLEAR EOL FLAG
	TLO	F,EOL		;SET EOL FLAG
				;NOW SEE WHAT USER WANTS!
	PAGE
;	ENTER WITH SIXBIT USER COMMAND IN T2
;
;	EXIT TO COMMAND IF RECOGNISED AND UNIQUE, OTHERWISE
;	DISPATCH TO UNKNOWN OR COMMAND NOT UNIQUE ROUTINES
;	N.B.    T1 = DISPATCH ADDRESS
;		T2 = USER COMMAND NAME
;		T3 = OFFICIAL COMMAND NAME

COMCON:	MOVE	T2,COMAND	;GET USER COMMAND IN T2
	MOVEI	P3,DISP		;START OF DISPATCH TABLE
	MOVE	P4,[XWD -DISPL,COMTAB]	;STEP THRO COMMANDS
	MOVE	T1,T2		;COPY USER COMMAND
	SETOI	T4,		;SET ALL ONES MASK
	LSH	T4,-6		;SET MASK IN
	LSH	T1,6		;      T4 TO LENGTH OF
	JUMPN	T1,.-2		;              USER COMMAND
	MOVEI	AR,0		;NO. OF NON-UNIQUE OCURRENCES
	MOVE	T1,P4		;AOBJN FOR COMMAND TABLE
COMLP:	MOVE	T3,(T1)		;GET NEXT COMMAND
	TDZ	T3,T4		;MASK OUT FOR MATCH WITH USER
	CAMN	T2,(T1)		;EXACT MATCH?
	JRST	COMFND		; YES - THIS IS IT

	CAME	T2,T3		;MATCH SO FAR
	JRST	COMNEQ		;NO MATCH AT ALL

	AOS	AR		;FLAG ANOTHER MATCH
	HRL	P3,T1		;MARK LAST INDEX
COMNEQ:	AOBJN	T1,COMLP	;TRIED ALL KNOWN COMMANDS?

	JUMPN	AR,.+2		;UNKNOWN?
	AOS	T1		;SET FOR NONE UNIQUE
	CAIN	AR,1		;WAS THE COMMAND UNIQUE?
	HLR	T1,P3		;YES - REMEMBER THIS INDEX
COMFND:	MOVE	T3,(T1)		;SAVE OFFICIAL COMMAND NAME
	SUBI	T1,(P4)		;INDEX DOWN DISPATCH
	ADDI	P3,(T1)		;INDEX INTO DISPATCH
	MOVE	T1,(P3)		;GET DISPATCH ADDRESS
	JRST	@T1		;     DISPATCH
	PAGE
	SUBTTL	COMMAND DECODER



	DEFINE C(A,B)
<	SIXBIT/A/	>


COMTAB:	XLIST		;NAMES
	NAMES
	LIST

DISPL=.-COMTAB




	DEFINE C(A,B)
<	EXP	B	>


DISP:	XLIST		;HANDLERS
	NAMES
	EXP	NOTUNQ		;COMMAND NOT UNIQUE
	EXP	ERROR		;UNKNOWN COMMAND
	LIST
	PAGE
SUBTTL	COMMAND SERVICE MODULES


;STRACE - SUBROUTINE CALLING SEQUENCE TRACE (WALK-BACK)

TRACE:	HRRZ	T,STARTU	;USER MUST INITIALISE WITH START
	JUMPE	T,ERR4		;MUST TYPE START FIRST
	SKIPIF	(TRACE.)	;
	  POPJ	P,		;NO TRACE LOADED
	SKIPN	ESCAPE		;ARE WE ALLOWING ESCAPES
	JRST	ERR30		;NO TRACE
	MOVE	T,P		;SAVE FORDDT STACK PIONTER
	MOVE	T1,16		;SAVE FORDDT REG 16??
	MOVE	P,AC0+17	;SET UP FORTRAN STACK
	MOVE	16,AC0+16	;- AND REG 16
	PUSHJ	P,@GOLOC	;DO A FORTRAN TRACE
	MOVE	P,T		;MUST RESTORE FORDDT STACK
	MOVE	16,T1		;AND 16
	JRST	RET		;END OF TRACE
	PAGE
;	START FUNCTION

START:	MOVSI	T,(JFCL)	;RESET THE TRACE ENTRY
	MOVEM	T,FDDT.		;
;**;[75] insert @ start2-1 ma 22-aug-77
	PUSHJ	P,CLRLIN	;[75]FLUSH OUT LINE BUFFER
START2:	MOVE	T,PRGNAM	;GET THE MAIN PROGRAM NAME
	MOVEM	T,SYM		;SAVE FOR EVAL
	TLO	F,FPRNM		;LOOK FOR PROGRAM NAMES
	PUSHJ	P,FNDSYM	;FIND THE START
	   JRST	ERR8		;NO START ADDRESS
	HRRM	T,STARTU	;SAVE FOR GO
	MOVEM	F,STKYFL	;MAKE THE FOROTS FLAG STICK
	PUSHJ	P,RE.NTR	;ALLOW RE-ENTERS AGAIN
	PUSHJ	P,INSRTB	;PUT IN BREAKPOINTS
	JSP	T,RESTORE
	SETZI	16,		;MAKE F40 STRACE WORK
STARTU:	JRST	.-.		;START USER PROGRAM


;	GOTO  STATEMENT LABEL OR SYMBOL CONTENTS

GOTO:	JUMPL	F,START4	;NO ARGUMENTS = START AT LAST GOTO
	PUSHJ	P,SYMIN		;GET USERS ARGUMENT
	  JRST	ERR6		;NONE SUCH
	  CAIA			;NUMERIC
	MOVE	T,(T)		;GET CONTENTS
	PUSHJ	P,ONFORM	;ON A FORMAT STATEMENT?
	  JRST	ERR36		;YES - ERROR
	PUSHJ	P,CHKADR	;DO A CHECK OF USER AREA
	 JRST	ERR31		;ILLEGAL - ERROR
	 JFCL
	CAIA
START4:	HRRZ	T,STARTU	;GET START ADDRESS
	HRRZ	T1,STARTU	;SEE IF A START HAS BEEN DONE
	JUMPE	T1,ERR4		;NO, REFUSE STARTS AND GOTO'S

	MOVEM	T,GOLOC		;SET UP FOR EXTASK
	SETOI	T1,
	MOVSI	T,(POPJ P,)	;HAVE WE STOPPED AFTER A NEXT?
	CAMN	T,LEAV		;IF SO LEAV WILL BE A POPJ P,
	SUBM	T1,AC17		;SOBJN!!!!
	SKIPN	ESCAPE		;HAS A RE ENTER BEEN DONE?
	JRST	ERR30		;YES - ONLY SOME FORM OF CONTINUE ALLOWED
	PUSHJ	P,ONFORM	;SKIP IF NOT A FORMAT AT (T)
	  JRST	ERR24		;NOT ALLOWED
	PUSHJ	P,RE.NTR	;ALLOW RE-ENTERS AGAIN
	MOVSI	T,(JFCL)	;RESET THE TRACE ENTRY
	MOVEM	T,FDDT.		;
	PUSHJ	P,EXTASK	;TRANSFER TO EXTERNAL TASK
	PAGE
;	OPEN

OPEN:	JUMPL	F,OPEN2		;ASSUME MAIN PROG IF JUST 'OPEN'
	PUSHJ	P,TTYIN		;WHAT NEXT
	JUMPN	T1,BADSYN	;MUST BE LINE END DELIMITER
	JUMPE	T2,BADSYN	;MUST HAVE SOME CHARACTERS
	PUSHJ	P,VALID		;CHECK VALIDITY & GET RAD50 IN T3
OPEN3:	MOVEM	T3,SYM		;SAVE FOR 'OPEN'
	PUSHJ	P,SETNAM	;DO THE OPEN
	JRST	RET		;WHAT NEXT

OPEN2:	MOVE	T3,PRGNAM	;GET FORTRAN MAIN PROG NAME
	JRST	OPEN3		;OPEN THIS

;	DDT FUNCTION

DDT:	PROGIF	(UDDT)		;IS DDT LOADED?
	   JRST	ERR11		;NO  - COMPLAIN
	HRRZM	T,GOLOC		;SAVE ADDRESS
	JRST	EXTASK		;TRANSFER TO EXTERNAL TASK

;	EXIT FUNCTION

EX.:	JUMPGE	F,EX.R		;IS THE USER REQUESTING A MONITOR RETURN
	HRRZ	T,STARTU	;NO - SEE IF A START HAS BEEN DONE
	JUMPN	T,.+2
;**;[100] modify @ ex.+3 ma 28-aug-77
	jrst	ex.a		;JUST A NORMAL EXIT
	MOVE	T,STARTU	;REMOVE START ADDRESS SO-
	HLLZM	T,STARTU	;NO CONTINUES OR RE-ENTERS
	SKIPIF	(EXIT.)		;IS EXIT. LOADED?
;**;[100] modify @ ex.+7 ma 28-aug-77
	   jrst	ex.a		;MUST BE THERE????
	SETZM	TEM		;SET UP ARG BLOCK
	SETZM	TEM1		;  TO EXIT FOROTS
	PUSHJ	P,INSRTB	;REPLACE PAUSES
	JSP	T,RESTORE	;RESTORE USERS ACS
	MOVEI	16,TEM		;GET EXIT ARGBLOCK
	PUSHJ	P,@GOLOC	;DO A FOROTS EXIT

EX.R:	PUSHJ	P,TTYIN		;GET NEXT INPUT
	JUMPN	T2,BADSYN	;LOOKING FOR / - NOCHARACTERS ALLOWED
	JUMPE	T1,BADSYN	;BETTER BE /
	CAIE	T1,"/"
	JRST	BADSYN		;SORRY
	PUSHJ	P,TTYIN		;LOOK FOR RETURN
	JUMPN	T1,BADSYN	;NO MORE CHARACTERS ALLOWED
	JUMPE	T2,BADSYN	;NO CHARACTERS IN INPUT????
	LSHC	T1,6		;GET FIRST CHARACTER
	CAIE	T1,'  R'	;LOOK FOR 'RETURN' - IMPLIED BY R
	JRST	BADSYN		;WE DONT UNDERSTAND ANY OTHER CHARACTER
;**;[100] add TOPS10 conditional and native code @ ex.r+13
ife tops20,<
	CALLI	1,12>		;DO A MONRET
ifn tops20,<
	haltf>			;do a monret
	JRST	RET		;CONTINUE'S ALLOWED
;**;[100] add routine ex.a @ ovrlay-1 ma 28-aug-77
ife tops20,<
ex.a:	exit>			;do a non-returnable return
ifn tops20,<
ex.a:	reset			;close files, etc.
	haltf			;stop
	jrst	ex.a>		;and don't permit continues
	PAGE
;	ROUTINE OVERLAY - TO DETECT WHEN THERE HAS BEEN AN APPARENT
;	OVERLAY OF THE PROGRAM.	THIS IS DONE BY OBSERVING THE
;	VALUES OF .JBSA AND .JBSYM EVERY RETURN TO USER MODE (>>)

OVRLAY:	MOVE	T,.JBSYM	;GET THE SYMBOL TABLE PARAMETERS
	EXCH	T,JOBSYM	;SAVE NEW SYMBOL POINTERS
	JUMPE	T,OVRL4		;OLD VALUE COULD BE ZERO IF NOT INITED
	CAME	T,JOBSYM	;COMPARE WITH LAST KNOWN VALUE
	JRST	OVRL2		;SOMETHING CHANGED!!

OVRL4:	HRRZ	T,.JBSA		;GET THE START ADDRESS
	EXCH	T,JOBSA		;SAVE NEW - AND FIND OLD START ADDRESS
	JUMPE	T,CPOPJ		;EXIT IF OLD START NOT SET-UP
	CAMN	T,JOBSA		;HAS THIS CHANGED
	POPJ	P,		;ALL IS WELL

OVRL2:	LINE
	TYPE(%FDTPOV PROGRAM OVERLAYED)
;**;[100] conditionalize TOPS10 code @ ovrl2+2 ma 29-aug-77
ife tops20,<			;[100]this doesn't work under TOPS20
	MOVE	T,[XWD -1,3]	;SET FOR PROGRAM NAME
	GETTAB	T,>		;FIND THE CURRENT NAME,end of conditional
	JRST	OVRL3		;SECRETIVE TYPE??
	SKIPN	JOBNAM		;HAS ANY NAME BEEN STORED?
	MOVEM	T,JOBNAM	;NO - REMEMBER THIS
	CAMN	T,JOBNAM	;OVERLAYED BY SYSTEM WHICH DOSN'T CHANGE NAME?
	JRST	OVRL3		;YES

	MOVEM	T,JOBNAM	;REMEMBER NEW NAME
	TYPE( BY )
	PUSHJ	P,SIXBP		;OUTPUT PROGRAM NAME

OVRL3:	TYPE( ***)
	LINE
	SKIPN	T,JOBOPC	;ANY RE-ENTER ADDRESS?
	MOVE	T,BCOM		;IF NOT BCOM SHOULD BE USER BREAK
	HRRZ	T,T		;JUST THE ADDRESS THANK YOU
	PJRST	WHERE		;TELL WHERE - END OF OVERLAY
	PAGE
;	RE-ENTER LOGIC

RE.ENT:	MOVEM	P,SAVLOC	;FREE UP A SPARE REG
	HRRZ	P,.JBOPC	;GET THE BREAK P.C.
	SKIPE	ESCAPE		;RE-ENTERS ALLOWED ONCE(SEE ER.ENT)
	JRST	RE.BRK		;DONT DESTROY USER PROFILE

	MOVE	P,SAVLOC	;RE-INSTATE THE OLD REG
	JSR	SAVE		;SAVE THE EXTERNAL PROG STATUS
	PUSHJ	P,REMOVB	;AND REMOVE THE PAUSES
	MOVE	T,.JBOPC	;GET THE PROG P.C.
	MOVEM	T,JOBOPC	;STORE AND FLAG THAT WE ARE HANDLING RE-ENTER
	MOVEM	T,JOBBRK	;SAVE THE JOB BREAK LOCATION
	HRRM	T,STARTU	;ALLOW CONTINUES TO WORK
	MOVEI	T,ER.ENT	;CLOSE THE DOOR ON FURTHER ENTRIES
	MOVEM	T,.JBREN	;LIKE SO
	SKIPE	PRGM		;HAS ANY SECTION BEEN OPENED
	JRST	RE.LOC		;YES

	PROGIF(MAIN.)		;NO - SO OPEN MAIN PROG
	  CAIA			;NO SECTION CALLED MAIN.
	PUSHJ	P,SETNAM	;OPEN MAIN PROG IF FOUND

;	HERE TO DISPLAY THE CURRENT SUSPEND POINT
;	JOBBRK IS THE BREAK - NEED NOT = JOBOPC

;**;[100] insert/modify @ re.loc ma 28-aug-77
RE.LOC:				;CLEAR THE OUTPUT BUFFER
ife tops20,<
	clrbfo	>
ifn tops20,<
	push	p,tf
	hrrzi	tf,.priou
	cfobf
	pop	p,tf	>
	TYPE([ PROGRAM SUSPENDED )
	HRRZ	T,JOBBRK	;SET UP THE ACTUAL SUSPEND POINT
	PUSHJ	P,WHERE		;TELL USER WHERE HE IS SUSSPENDED
	TYPE(OPEN SECTION: )
	MOVE	T,OPENED	;WHAT IS THE CURRENTLY OPEN SECTION
	PUSHJ	P,SPT1		;TYPE THAT
	TYPE	( ])
	MOVE	F,STKYFL	;RESET THE FLAG REGISTER
	JRST	RET		;RETURN TO NORMAL WORKING

	PAGE
ER.ENT:	SETPDL			;RESET THE PDL
	JRST	RE.LOC		;INDICATE THAT WE ARE ALREADY HANDLING A REENTER

RE.NTR:	MOVEI	T,RE.ENT	;AND SET UP THE RE-ENTER ADDRESS
	MOVEM	T,.JBREN	;SO THAT FUTURE RE ENTERS WILL WORK
	SETZM	JOBOPC		;CLEAR THE RE-ENTER IN PROGRESS FLAG
	SETZM	ESCAPE		;DO NOT ALLOW ESCAPES FROM FORDDT
	POPJ	P,

RE.BRK:	SETPDL			;RESTORE THE STACK
	HRRZ	T,STARTU	;HAS A START BEEN DONE
	JUMPE	T,RE.RET	;NO - JUST RETURN TO FORDDT USER MODE

	MOVE	T,BCOM		;GET THE PAUSE POINT
	MOVEI	T,-1(T)		;CORRECT FOR JSA
	ANDI	T,-1		;JUST THE ADDRESS PORTION
	MOVEM	T,JOBBRK	;SAVE THE JOB BREAK FOR RE.LOC
	JRST	RE.LOC		;DISPLAY PROGRAM EXECUTION SUSPENSION


;	ROUTINE TO DISPLAY WHERE THE PROGRAM IS SUSPENDED

WHERE:	SKIPN	.JBHRL		;SKIP IF WE HAVE A HIGH SEG.
	JRST	RE.L2

	CAMLE	T,.JBREL	;ARE WE SUSPENDED OVER THE LOW SEG.
;**;[100] modify @ where+3 ma 27-aug-77
	JRST	[type(IN HIGH SEGMENT)
		JRST	RE.L2]
	type(IN LOW SEGMENT)
RE.L2:	TYPE( AT )
	TLO	F,FGLSNM	;GLOBALS ARE OK
	PUSHJ	P,LOOK		;DO A SYSMBOL 'LOOK'-UP
	  JRST	E6		;
	  CAIA			;NOTHING TYPED
;**;[070], RE.L2+5, MD, AUG-76
	JRST	RE.L3A		;[070] FOUND AND TYPED
	MOVEM	T,TEM		;REMEMBER NEAREST REFERENCE
	PUSHJ	P,SPT		;TYPE THE SYMBOL
	TYPE( + )
	MOVE	T,TEM		;GET THE OFFSET
	PUSHJ	P,TYP4		;DISPLAY AS OCTAL
;**;[070], RE.L2+13, MD, AUG-76
RE.L3A:	SKIPN	PNAMSV		;[070] DID WE FIND A SECTION NAME
	JRST	RE.L3		;[070] NO
	TYPE( IN )
	MOVE	T,PNAMSV	;GET THE SECTION NAME
	PUSHJ	P,SPT1		;DISPLAY THAT
RE.L3:	LINE			;
	POPJ	P,		;
	PAGE
;	PAUSE LOGIC

;**;[77] modify @pause ma 22-aug-77
PAUSE:	JUMPL	F,PSEALL	;[77]DISPLAY ALL PAUSES IF NO ARGUMENTS
	TRO	TF,FGLONL	;FIND GLOBAL SYMBOL ONLY
	PUSHJ	P,SYMIN		;GET THE NEXT SYMBOL IN SYM
	   JRST	ERR6		;NONE SUCH!
	   CAIA			;STATEMENT # FROM USER
	JRST	PAUS10		;SYMBOL - MEANS STOP AT ROUTINE

PAUS11:	HRRZM	T,TEM1		;SAVE POINTER TEMPORARILY
	SETZM	TEM		;CLEAR CONDITIONAL REQUEST
	SKIPL	TERMK		;WAS THAT ALL THE USER WANTED?
	JRST	PAUS5		; YES

	PUSHJ	P,TTYIN		; NO,GET MOR
	JUMPN	T1,BADSYN	;DO WE HAVE A LEGAL DELIMITER
	CAMN	T2,[SIXBIT/AFTER/]	;FORCE USER TO TYPE WHOLE WORD
	JRST	PAUS4		;AFTER REQUESTED
	CAMN	T2,[SIXBIT/TYPING/]	;MAYBE A 'TYPING' REQUEST
	JRST	PAUS7
	CAME	T2,[SIXBIT/IF/]	;WAS IT 'IF'?
	JRST	BADSYN		;ANYTHING ELSE MEANS TROUBLE
	TLZ	F,CONS		;CLEAR CONSTANT SEEN FLAG
	PUSHJ	P,EITHER	;NUMBER OR SYMBOL SHOULD FOLLOW
	  PUSHJ	P,NUMB		;CONSTANT SEEN
	  MOVEM	T,COND1		;SAVE CONSTANT
	CLEARM	COND0		;CLEAR FOR TYPE OF TEST
	JUMPN	T1,.+2		;DELIMITER?
	PUSHJ	P,GETSKB	;NEXT CHARACTER
	CAIE	T1,"."		;MUST BE . OF .EQ. ETC
	JRST	BADSYN
	PUSHJ	P,TTYIN		;GET SIXBIT STRING
	CAIE	T1,"."		;MUST AGAIN BE TERMINATED BY .
	JRST	BADSYN
	HLRZS	T2,T2		;MORE USEFUL IN RIGHT HALF
	CAIN	T2,'LT '
	JRST	TEST1
	CAIN	T2,'LE '
	JRST	TEST2
	CAIN	T2,'EQ '
	JRST	TEST3
	CAIN	T2,'NE '
	JRST	TEST4
	CAIN	T2,'GT '
	JRST	TEST5
	CAIN	T2,'GE '
	JRST	TEST6
	JRST	BADSYN		;UNKNOWN CONDITION
	PAGE
TEST6:	AOS	COND0		;GE=5
TEST5:	AOS	COND0		;GR=4
TEST4:	AOS	COND0		;NE=3
TEST3:	AOS	COND0		;EQ=2
TEST2:	AOS	COND0		;LE=1
TEST1:	PUSHJ	P,EITHER
	  PUSHJ	P,NUMB		;SAVE AS A NUMBER
	  MOVEM	T,COND2		;SAVE THE LOCATION
	MOVE	T,[JSR	COND]
	MOVEM	T,TEM		;FORM THE (CONDITIONAL TEST) LOCATION LINK
PAUS5:	SKIPA	T,[Z 1]		;PROCEDE COUNT=1
PAUS4:	PUSHJ	P,EITHER	;GET USERS PROCEDE COUNT IN T
	   CAIA			;CONSTANT GIVEN
	   MOVE T,(T)		;SYMBOL - GET CONTENTS
	JUMPL	T,BADSYN	;DO NOT ALLOW NEGATIVE PROCEDE COUNTS
	EXCH	T,TEM1		;GET BACK BREAKPOINT ADDRESS
	SKIPL	TERMK		;WAS THAT ALL
	JRST	PAUS6		; YES

	MOVEM	T,SAVLOC	;SAVE PAUSE ADDRESS TEPORARILY
	PUSHJ	P,TTYIN		;GET SIXBIT USER INPUT
	JUMPN	T1,BADSYN
	CAME	T2,[SIXBIT/TYPING/]
	JRST	BADSYN
PAUS8:	PUSHJ	P,GETNUM	;USER WANTS AUTO DISPLAY
	JUMPN	T,PAUS3		;ASSUME ZERO MEANS NO INPUT

	CAIN	T1,"/"		;A / HERE DENOTES THAT A GROUP# FOLLOWS
	JRST	PAUS8		;TRY FOR THE NUMBER AGAIN

PAUS3:	CAIL	T,1		;MAKE SURE HE GETS
	CAILE	T,GPMAX		;  ONLY A VALID GROUP #
	JRST	ERR15		;COMPLAIN ABOUT GROUP #
	HRL	T,T		;SET UP FOR AUTO TYPE
	HRR	T,SAVLOC	;GET BACK PAUSE ADDRESS
	TLO	F,AUTO		;SET THE AUTO PROCEDE FLAG

PAUS6:	PUSHJ	P,ONFORM	;SKIP IF NOT A FORMAT AT (T)
	  JRST	ERR19
	PUSHJ	P,BPS1		;PLACE ALL PARAMETERS TO EFFECT A PAUSE
	JRST	RET		;DONE!
	PAGE
PAUS7:	SETZI	T,		;CLEAR PROCEDE COUNT
	EXCH	T,TEM1		;GET PAUSE PLACE
	MOVEM	T,SAVLOC	;STORE PAUSE LOCATION
	JRST	PAUS8

PAUS10:	MOVE	T1,@SYMSAV	;GET SYMBOL
	TLNE	T1,700000	;IS THIS A PROGRAM NAME OR GLOBAL
	JRST	ERR19		;NO SO DONT ALLOW

	SKIPE	SUBSCR		;NOR MUST THERE BE AN OFFSET
	JRST	ERR19
	MOVE	T1,1(T)		;DOES THIS ROUTINE INVOKE THE 'HELLO' MACRO?
	CAMN	T1,HELLO	;YES IT DOES - STOP 2 ON
	ADDI	T,2		;
	JRST	PAUS11

COND0:	Z			;SAVE # NUMBER OF TEST
COND1:	Z			;SAVE ADDRESS OF FIRST ARGUMENT
COND2:	Z			;SAVES ADDRESS OF SECOND ARGUMENT
COND3:	Z			;SAVE VALUE OF CONSTANT IF DEFINED

NUMB:	TLOE	F,CONS			;SET CONSTANT SEEN FLAG IF NOT ALREADY SET
	JRST	ERR14
	MOVEM	T,COND3		;SAVE VALUE OF CONSTANT
	MOVEI	T,COND3		;SAVE ADDRESS OF CONSTANT
	POPJ	P,


;	ROUTINE TO CHECK IF A FORTRAN FORMAT EXISTS AT 
;	THE ADDRESS POINTED TO BY T
;	RETURN 1   IF IT IS A FORMAT
;	RETURN 2   IF NOT A FORMAT

ONFORM:	LDB	W1,[POINT 7,(T),6]	;
	CAIN	W1,"("		;TRUE IF FIRST CHAR IS AN OPEN PAREN
	POPJ	P,
	JRST	CPOPJ1		;FOUND A FORMAT STATEMENT REFFERENCE
	PAGE
;	CONTINUE LOGIC


CONTIN:	MOVSI	T,(JFCL)	;RESET THE TRACE ENTRY
	MOVEM	T,FDDT.		;
	HRRZ	T,STARTU	;HAS START BEEN SEEN
	JUMPE	T,ERR4		;N0 - PLIS TYPE START
	SKIPE	T,JOBOPC	;ARE WE IN A RE-ENTER CONDITION
	JRST	CONT2		;YES - DEAL WITH IT

	MOVEI	T,[POPJ P,]	;POPJ P,  IS THE EXIT AFTER A 'NEXT'
	CAMN	T,LEAV		;DID WE DO A 'NEXT' LAST TIME
	JRST	PROCED		;YES - DO NOT TAKE ARGS - RETURN WITH A POPJ

	JUMPL	F,PROCED	;CONTINUE 1
	PUSHJ	P,EITHER	; NO - GET ARGUMENT
	   CAIA			;NUMBER TYPED
	   MOVE	T,(T)		;SYMBOL TYPED - GET CONTENTS
	JUMPL	T,BADSYN	;DO NOT ALLOW NEGATIVE PROCEDE SETTINGS
	JRST	PROCDX		;SET UP A PROCEDE COUNT

CONT2:	MOVE	T,JOBOPC	;GET THE CONTINUE P.C.
	MOVEM	T,GOLOC		;PREPARE TO CONTINUE
	PUSHJ	P,RE.NTR	;ALLOW RE-ENTERS AGAIN
	PUSHJ	P,INSRTB	;PUT BACK PAUSES
	JSP	T,RESTORE	;RESTORE USER ACS
	JRSTF	@GOLOC		;DO AN OFFICIAL RE-ENTER


;**;[100] modify @ help ma 27-aug-77
HELP:	atype(HLPTXT)		;TYPE AN ABREVIATED HELP TEXT
	JRST	RET		;FOR MORE HELP TRY HELP FORDDT?!!
	PAGE
;	REMOVE LOGIC

RESET:	JUMPL	F,RESET5	;'RESET' - RESET ALL PAUSES
	TRO	TF,FGLONL	;FIND GLOBAL ONLY IF NOT LABEL
	PUSHJ	P,SYMIN		; NO - MUST BE ANOTHER SYMBOL TO FOLLOW
	  JRST	ERR6		;SOME ONE SLIPPED UP
	  JFCL			;STATEMENT #
RESET6:	MOVEI	R,B1ADR		;LOOK THRO PAUSE POINTS FOR THE RIGHT ONE
RESET3:	HRRZ	W,(R)		;GET THE PAUSE CONTENTS
	CAIN	W,(T)		;IS THIS IT?
	JRST	RESET2		; YES - REMOVE IT!

	ADDI	R,3		; NO  - TRY ANOTHER
	CAIG	R,BNADR		;TRIED ALL POINTS YET?
	JRST	RESET3		; NO - FIND THE NEXT

	JRST	ERR17		;NO - NOT AN ARRAY NAME -  YOU LOSE

RESET2:	MOVE	W,1(T)		;DOES THIS ROUTINE USE THE HELLO MACRO
	CAMN	W,HELLO		;
	ADDI	T,1		;YES IT DOES - SO STOP 2 ON
	ADDI	T,1		;STOP 1 ON FOR NORMAL ROUTINES
	CLEARM	(R)		;CLEAR LOCATION OF PAUSE
	CLEARM	1(R)		;CLEAR CONDITIONAL CLAUSE
	CLEARM	2(R)		;CLEAR PROCEDE COUNT
	JRST	RET		;REMOVED!

RESET5:	CAME	T2,[SIXBIT/REMOVE/] ;DO NOT ALLOW ABREVIATIONS OF REMOVE
	JRST	BADSYN		;THIS ANNOYS MANY USERS
	PJRST	BPS		;RESET ALL PAUSES
	PAGE
;	ACCEPT LOGIC	= ACCEPT NAME/X #

ACCEPT:	JUMPL	F,BADSYN	;ACCEPT ALONE IS MEANINGLESS!
	SETZM	ARGVAL+1	;CLEAR IN CASE LONG INPUT
	SKIPN	ESCAPE		;ESCAPE TO FOROTS?
	JRST	ERR30		;SORRY
	TRO	TF,ACCPT	;ACCEPT IN PROGRESS
	PUSHJ	P,SYMIN		;GET USERS SYMBOL
	  JRST	ERR6		;SORRY - WE DONT HAVE IT!
	  JRST	ACC2		;STATEMENT # = FORMAT
	MOVEM	T,TEM2		;STORE FOR UPDATE
	TRNE	TF,IMPRNG	;IS THIS AN IMPLIED RANGE?
	PUSHJ	P,DISP14	;YES SETUP RANLIM/RANGE IN CASE OF A RANGE
	PUSHJ	P,EVAL		;SETUP SYMSAV TO POINT TO RAD50 SYMBOL
	 JFCL			;CAN'T HAPPEN!!?
	MOVE	T,SYMSAV	;GET THE SYMBOL POINTER
	HLRZ	T,(T)		;GET RADIX 50 FORM AND FLAGS
	TRNN	T,LOCAL		;ALLOW ONLY LOCAL VARIABLS TO CHANGE
	JRST	ERR24		;YOU LOOSE
	MOVE	T1,LSTCHR	;RESTORE USERS LAST CHARACTER

;	HERE HAVING READ A GOOD VARIABLE	= ACCEPT NAME/

	SKIPL	TERMK		;END OF LINE SEEN?
	JRST	BADSYN		;YES - BAD NEWS
	JUMPE	T1,ACCF		;SPACE DELIMITER ASSUMES REAL TO FOLLOW
	CAIN	T1,"="		;[50] ALLOW = AS DELIMITER
	JRST	ACCF		;[50]
	CAIN	T1,"-"		;A - MEANS A RANGE OF VALUES TO SET
	JRST	ACC23		;
	CAIE	T1,"/"		; WE EXPECT ONLY / FROM NOW ON
	JRST	BADSYN		;ANYTHING ELSE LOOSES
ACC22:	PUSHJ	P,TTYIN		;READ ARGUMENT TYPE REQUIRED BY USER
	JUMPE	T2,BADSYN	;NO CHARACTERS - BAD
	LDB	T,[POINT 6,T2,5];GET 1ST. CHARACTER TO IDENTIFT ARG TYPE
	CAIN	T,'L'		; LONG SWITCH ?
	TLOA	TMOD,L.		;YES - SET IT AND LOOK FOR ANOTHER SWITCH
	MOVEM	T,TEM		;NOT 'LONG' SO SAVE SWITCH IN CASE L FOLLOWS
	JUMPE	T1,ACC21	;NOTHING FOLLOWS
	CAIN	T1,"="		; ALLOW = AS DELIMITER
	JRST	ACC21		;PROCESS FORMAT
	CAIE	T1,"/"		;ANOTHER SWITCH ?
	JRST	BADSYN		;NO - ONLY / ALLOWED
	JRST	ACC22		;PROCESS ANOTHER SWITCH
	PAGE
;	HERE HAVING READ ALL THE MODE SWITCHES
;	THE LAST SWITCH TAKES PRIORITY (/F/D/C/I/O/A/R) /L ALLOWED
;	ACCEPT NAME/L/I

ACC21:	MOVE	T,TEM		;GET THE CURRENT FORMAT REQUEST
	CAIN	T,'S'		;SYMBOLIC?
	JRST	ACCS		;DO SYMBOL INPUT
	CAIN	T,'A'		;ASCII?
	JRST	ACCA		;PROCESS ASCII
	CAIN	T,'R'		;RASCII?
	JRST	RASCII		;PROCESS RIGHT JUSTIFIED ASCII
	CAIN	T,'O'		;OCTAL?
	JRST	ACCO		;PROCESS OCTAL
	TLZ	TMOD,L.		;IGNORE /LONG FOR THE REST
	CAIN	T,'F'		;FLOATING?
	JRST	ACCF		;PROCESS A FLOATING INPUT
	CAIN	T,'D'		;REAL*8?
	JRST	ACCD		;PROCESS REAL*8
	CAIN	T,'I'		;INTEGER?
	JRST	ACCI		;PROCESS INTEGER INPUT
	CAIN	T,'C'		;COMPLEX?
	JRST	ACCC		;PROCESS COMPLEX INPUT
	JRST	BADSYN		;NO OTHER TYPES SUPPORTED

;	ACCEPT A RANGE PROCESSING	= ACCEPT NAME(X)-

ACC23:	MOVE	T,TEM2		;SAVE THE FIRST VALUE SOMEWHERE SAFE
	MOVEM	T,RANGE		;SAVE THE FIRST VALUE OF A RANGE
	TLZ	F,GRPFL		;MAKE SURE WE DONT DO GROUP LOGIC
				;OR ACCEPT ANY PRINT MODIFIERS
	PUSH	P,MATHSM	;SAVE CURRENT SYMBOL
	PUSHJ	P,SYMIN		;GET THE NEXT VALUE
	  JRST	ERR6		;DOSNT EXIST
	  JRST	BADSYN		;NUMERICS????
	POP	P,T3		;GET FIRST SYMBOL BACK
	CAME	T3,MATHSM	;ARE THEY THE SAME
	JRST	ERR40		;NO - SORRY
	CAML	T,RANGE		;SORT OUT THE RANGE ORDER
	EXCH	T,RANGE		;WRONG WAY ROUND
	MOVEM	T,TEM2		;LOWER VALIUE IN RANLIM, HI IN RANGE
	PUSHJ	P,EVAL		;GET SYMBOL IN SYMSAV
	 JFCL			;
	MOVE	T,SYMSAV	;GET THE SYMBOL POINTER
	HLRZ	T,(T)		;GET SYMBOL FLAGS
	TRNN	T,LOCAL		;MODIFY LOCALS ONLY
	JRST	ERR24		;NOT ALLOWED
	MOVE	T1,LSTCHR	;RESTORE USERS LAST CHARACTER
	CAIN	T1,"/"		;MAYBE FORMAT SPECIFIER
	JRST	ACC22		;YES - GO FIND THEM
	JUMPE	T1,ACCF		;SPACE IMPLIES REAL*4
	JRST	BADSYN		;DONT ACCEPT ANYTHING ELSE HERE
	PAGE
;	*** FLOATING INPUT ***

ACCF:	TLO	TMOD,F.		;DISPLAY TO USER AS FLOATING
	MOVEI	T2,4		;ARG TYPE REAL FOR FOROTS
	PUSHJ	P,FORINP	;YES - ASK FOROTS FOR INPUT

;	HERE TO PLACE ALL ACCEPTED VALUES

ACC10:	MOVE	T,ARGVAL	;LETS SEE WHAT FOROTS HAS BEEN UP TO
ACC13:	MOVEM	T,@TEM2		;PLACE VALUE WHERE USER REQUESTED
	MOVEM	T,ARGVAL	;SOME PRINT OPTIONS NEED THIS
	AOS	T1,TEM2		;NEXT ARRAY LOCATION
	TLNN	TMOD,C.!L.!D.	;IF EITHER COMPLEX REAL*8 OR LONG OR -
	TRNE	F,DOUBLE	;WE HAVE A REAL*8 ARRAY?
	CAIA			;THEN WE PLACE TWO ARGUMENTS
	JRST	ACC14		;IF NOT THEN CHECK THE RANGE CONDITION
	TRO	F,SILENT	;QUIET
	PUSH	P,MATHSM	;SAVE CURRENT SYMBOL
	MOVE	T,[SQUOZE 0,.VEND]	;END OF VARIABLE AREA
	MOVEM	T,MATHSM	;ONLY ACCEPTABLE SYMBOL
	MOVE	T,TEM2		;GET DESTINATION
	PUSHJ	P,LOOK		;FIND A SYMBOL FOR IT
	  JFCL			;NONE-OK
	  CAIA			;OFFSET - OK
;	 JRST	ACC37		;  NONE - OK
;	 JRST	ACC37		;  OFFSET - OK
;	MOVE	T,(W1)		;GET SYMBOL
;	TLZ	T,PNAME		;NO BITS
;	CAMN	T,[SQUOZE 0,.VEND]	;END OF VARIABLE AREA?
	JRST	ERR35		;YES - ERROR

;ACC37:	
	POP	P,T
	MOVEM	T,MATHSM	;RESTORE CURRENT SYMBOL
	MOVE	T,ARGVAL+1	;GET THE 2ND WORD
	MOVEM	T,@TEM2		; - AND PLACE IN NEXT LOCATION
	AOS	T1,TEM2		;YES - SO NEXT DOUBLE WORD
ACC14:	SKIPN	RANGE		;ACCEPT A RANGE ?
	JRST	ACCPUT		;NO - UNLESS IMPLIED
	TLNE	TMOD,A.		;SPECIAL TREATMENT FOR ASCII ARRAYS
	JRST	[CAMG	T1,RANGE	;END OF ARRAY?
		 JRST	ACC12		;GET SOME MORE
		 JRST	RET	]	;QUIT
	CAMG	T1,RANGE	;ALL DONE ?
	JRST	ACC10		;NO - KEEP GOING
	JRST	RET		;ALL OVER

;	VARIABLE 'ACCEPT'ED - NOW CONFIRM TO USER

ACCPUT:	SETZM	TERMK		;PREPARE FOR -
	SETZM	RANGE		;  INPUT CONFIRMATION
	SOS	T,TEM2		;REMOVE OFFSET FROM ACC13
	TRZN	F,DOUBLE	;CHECK FOR ANY -
	TLNE	TMOD,C.!L.!D.	;  DOUBLE WORD WORKING
	SOS	T,TEM2		;    AND IF SO CORRECT BASE ADDRESS
	PUSHJ	P,DISP10	;AND LET HIM SEE HIS EFFORTS
	JRST	RET		;END OF ACCEPT
	PUSHJ	P,GETNUM	;GENERAL GET NUMBER ROUTINE
	JRST	ACC13		;STORE FOR USER
	PAGE
;	*** DOUBLE PRECISION INPUT ***

ACCD:	TLO	TMOD,D.		;DISPLAY TO USER AS REAL*8
	MOVEI	T2,10		;ARG TYPE FOR REAL*8
	PUSHJ	P,FORINP	;REQUEST INPUT
	JRST	ACC10		;PLACE FINAL ARG


;	*** INTEGER INPUT ***

ACCI:	TLO	TMOD,I.		;DISPLAY TO USER AS INTEGER
	MOVEI	T2,2		;GET ARG TYPE INTEGER FOR FOROTS
	PUSHJ	P,FORINP	;GO TO FOROTS
	JRST	ACC10		;PLACE ARG FOR USER

;	*** COMPLEX INPUT ***

ACCC:	TLO	TMOD,C.!L.	;DISPLAY TO USER AS COMPLEX
ACC11:	PUSHJ	P,GETSKB	;GET SIGNIFIGANT CHARACTER
	CAIE	T1,"("		;MAKE SURE ITS A (
	JRST	ERR32		; ( REQUIRED
	MOVE	T,[1200,,ARGVAL+1]  ;WHERE TO PUT IMAGINARY OF COMPLEX
	MOVEM	T,M2.I		;SET UP THE FORMAT
	MOVEI	T2,4		;SET UP FOR TYPE REAL INPUT
	PUSHJ	P,FORINP	;LET FOROTS GET THE REAL PART
	MOVE	T,M2.F		;RECOVER THE FIN CALL
	MOVEM	T,M2.I		;AND REMOVE THE COMPLEX SETTING
	JRST	ACC10		;GO PLACE THE RESULTS

;	*** SYMBOLIC INPUT ***

ACCS:	TLNE	TMOD,L.		;IF 'LONG' SET THEN
	TLOA	TMOD,C.		;DISPLAY TO USER AS TWO REAL*4
	TLO	TMOD,F.		;ELSE DISPLAY JUST ONE REAL*4
	PUSH	P,MATHSM	;SAVE MATHSM
	PUSH	P,SAVLOC	;SAVE SAVLOC AROUND CALL
	PUSHJ	P,SYMIN		;GET A USER SYMBOL
	  JRST	ERR6		;CAN'T FIND IT!
	  JRST	BADSYN		;DONT GIVE ME STATEMENT #
	POP	P,SAVLOC	;RESTORE SAVLOC
	POP	P,MATHSM	;RESTORE
	MOVE	T1,(T)		;I'LL ACCEPT THAT ONE
	MOVEM	T1,ARGVAL	;SAVE THE FIRST WORD VALUE
	TLNN	TMOD,L.		;DOUBLE WORD WORKING?
	JRST	ACC10		;NO JUST PLACE SINGLE VALUE
	MOVE	T,1(T)		;GET SECOND VALUE
	MOVEM	T,ARGVAL+1	;STORE THAT
	JRST	ACC10		;   AND EVEN STORE IT
	PAGE
;	*** ASCII INPUT RIGHT JUSTIFIED ***

RASCII:	TLO	TMOD,R.		;DISPLAY TO USER AS RASCII
	JRST	ACC1		;DO ASCII INPUT TO T


;	*** ASCII INPUT ***

ACCA:	TLO	TMOD,A.		;DISPLAY TO USER AS ASCII
	MOVE	T,[ASCII .     .]	;BLANK SECOND WORD FOR POSSIBLE
	MOVEM	T,ARGVAL+1		;LONG OR DOUBLE
	SKIPN	RANGE		;IGNORE /LONG IF ACCEPTING LONG ASCII
	JRST	ACC1		;OK IF NOT A RANGE
	TLZ	TMOD,L.		;CLEAR /L FLAG
	TRZ	F,DOUBLE	;CLEAR DOUBLE
ACC1:	PUSHJ	P,GETSKB	;GETA SIGNIFICANT USER CHARACTER
	SKIPL	TERMK		;EOL?
	JRST	BADSYN		;YES - SYNTAX ERROR
	MOVEI	T5,(T1)		;SAVE IN T2
ACC12:	SETZM	ARGVAL		;CLEAR FOR DOUBLE LENGTH ASCII
	TRZE	TF,ADELIM	; IF SET WE CLEAR THE REST OF THE ARRAY
	JRST	ACCA2		;
ACC24:	MOVE	T,[ASCII .     .]	;T BUILDS ASCII INPUT
	TLNE	TMOD,R.		;BUILD WITH ZERO IF RASCII
	SETZI	T,
	MOVE	T6,[POINT 7,T]	;STORES BYTES IN T
;**;[100] modify @ acc15 ma 29-aug-77
ACC15:	pushj	p,loadch	;NEXT ASCII CHARACTER
	CAIN	T1,(T5)		;TEXT DELIMITER FOUND?
	JRST	ACC18		;YES - CHECK FOR A SECOND
	TRZE	TF,ADELIM	;WAS THE LAST CHARACTER OUR DELIMITER
;**;[065],ACC15+4,MD,APR-76
;**;[100] modify @ acc15+4 ma 29-aug-77
	JRST	[PUSH P,T1		;[065] YES
		 MOVE T1,[pushj p,loadch];[065] FOR GETSKB
		 MOVEM	T1,GETCHR	;[065]
		 POP	P,T1		;[065]
		 PUSHJ	P,GETSK2	;[065] CHECK FOR COMMENT
		 PUSHJ P,CLRLIN	; WIND UP
		 JRST	ACC17]
ACC19:	IDPB	T1,T6		;SAVE USERS TEXT
	TLNE	T6,760000	;FILLED T?
	JRST	ACC15		;NO - TAKE MORE

	CAIA			;DONT CONFUSE THE INDEFINATE ACCEPT
ACC17:	TRO	TF,ADELIM	;SET TO CLEAR REST OF ARRAY IF IN A RANGE
	TRNE	F,DOUBLE	;TEST FOR ANY DOUBLE WORD -
	JRST	ACC2WD		;  WORKING -
	TLNN	TMOD,L.		;    IMPLIED BY REAL*8 OR L.
	JRST	ACC20		;STORE FINAL SINGLE VALUE IN T
	PAGE
;	DOUBLE WORD WORKING

ACC2WD:	SKIPN	ARGVAL		;IS THE FIRST VALUE STOREF?
	JRST	ACC3WD		;NO
	MOVEM	T,ARGVAL+1	;YES STORE SECOND
	JRST	ACC25		;PLACE BOTH VALUES
ACC3WD:	MOVEM	T,ARGVAL	;HOLD FIRST OF PAIR
	TRNN	TF,ADELIM	;ANY MORE TO COME
	JRST	ACC24		;YES - GO FIND IT
;**;[76] insert @ acc25 ma 22-aug-77
ACC25:	HRRZM	T5,DELCHR	;[76]SAVE DELIMITER FOR CLRLIN
	PUSHJ	P,CLRLIN	;CLEAR REST OF LINE
	TLNN	TMOD,R.		;ARE WE ACCEPTING RIGHT JUSTIFIED TEXT
	JRST	ACC10		;RELAX JUST ASCII
	MOVE	T1,ARGVAL	;GET BACK THE DOUBLE WORD
	JUMPE	T1,ACC10	;NO TEXT?????
	MOVE	T2,ARGVAL+1	;INTO A LONG SHIFT FORM
	LSH	T1,-1		;FIRST MAKE A CONTINUOUS STRING OF TEXT
	LSHC	T1,-1		;GET READY FOR 7BIT CHARACTER SHIFTS
ACC27:	LDB	T3,[POINT 7,T2,35]
	JUMPN	T3,ACC26	;TEST FOR SUCCESSFUL RIGHT JUSTIFICATION
	LSHC	T1,-7		;NOT YET MOVE DOWN
	JRST	ACC27		;TRY AGAIN
ACC26:	LSH	T1,1		;ASCII-ISE
	TLZE	T2,400000	;SHOULD THERE BE A LOWER BIT FOR T1
	TRO	T1,1		;YES - PUT IT IN
	MOVEM	T1,ARGVAL	;STORE TOP VALUE
	MOVEM	T2,ARGVAL+1	;AND FINALLY LAST VALUE
	JRST	ACC10		;AND GIVE THEM TO THE USER

ACC18:	TRON	TF,ADELIM	;FLAG THIS AS OUR DELIMITER
	JRST	ACC15		;SEE IF NEXT CHARACTER IS SAME
	TRZ	TF,ADELIM	;YES IT IS -
	JRST	ACC19		;PASS ON JUST ONE

ACCA2:	TLZ	TMOD,A.!R.	;REMOVE THE TEXT FLAGS
	MOVE	T,[ASCII .     .]	;FILL THE REST OF THE ARRAY
	MOVEM	T,ARGVAL	;WITH SPACES
	MOVEM	T,ARGVAL+1
	JRST	ACC13


;	FINISHED TEXT INPUT

;**;[76] insert @ acc20 ma 22-aug-77
ACC20:	HRRZM	T5,DELCHR	;[76]SAVE DELIMITER FOR CLRLIN
	SKIPN	RANGE		;IF NOT IN A RANGE SETTING -
	PUSHJ	P,CLRLIN	;THEN CLEAR THE REST OF THE USER INPUT
	TLNN	TMOD,R.		;LEFT OR RIGHT JUSTIFY
	JRST	ACC13		;LEFT
	LDB	T1,[POINT 6,T6,5] ;RIGHT - GET THE T3 POINTER RESIDUE
	SETCA	T1,		;RIGHT SHIFT
	LSH	T,1(T1)		; NOW
	JRST	ACC13		;NOW PLACE TEXT
	PAGE
;	*** OCTAL INPUT ***

ACCO:	TLO	TMOD,O.		;DISPLAY TO USER AS OCTAL
	SETZI	T,		;CLEAR FOR OCTAL BUILD
	SKIPL	TERMK		;END OF LINE SEEN?
	JRST	ACC13		;YES - ASSUME OCTAL = 0
	PUSHJ	P,GETSKB	;LOOK FOR "-"
	SKIPL	TERMK
	JRST	ACC13		;END OF LINE - =0
	SETZB	W1,W2		;CLEAR BUILD AREA
	MOVEI	T,^D12		;INITIALIZE COUNT
	TLNE	TMOD,L.		;CHECK LONG
	MOVEI	T,^D24		;DOUBLE IT FOR LONG
	CAIA

ACC29:	PUSHJ	P,GETSKB	;GET NEXT CHARACTER
	SKIPL	TERMK		;END OF LINE?
	JRST	ACC16		;
	CAIE	T1,"+"		;PLUS?
	JRST	ACC31
	TLNE	F,MF		;YES - MINUS SEEN?
	JRST	BADSYN
	JRST	ACC29		;NO - IGNORE THE +
ACC31:	CAIN	T1,42		;DOUBLE QUOTE?
	JRST	ACC29		;YES - IGNORE
	CAIE	T1,"-"
	JRST	ACC16		;NOT A "-"
	TLC	F,MF		;COMPLEMENT FLAG
	JRST	ACC29		;GET NEXT CHARACTER

ACC16:	SUBI	T1,60		;OCTALISE
	JUMPL	T1,ERR2		;CHARACTER MUST OF COURSE -
	CAIL	T1,10		;   BE OCTAL
	JRST	ERR2		;NOT OCTAL - COMPLAIN
	LSHC	W1,3		;BUILD OCTAL VALUE IN T
	IOR	W2,T1		;
	SOJE	T,ACC28		;CHECK FOR PROPER NUMBER OF CHARACTERS
ACA16:	PUSHJ	P,GETSKB	;GET A CHARACTER
	SKIPGE	TERMK		;END OF LINE
	JRST	ACC16		;BACK FOR MORE
	PAGE
;	HERE WITH LINE END OR FULL WORD(S)

ACC28:	TLNN	TMOD,L.		;LONG WORKING?
	JRST	ACC30		;AS YOU WERE - STORE OCTAL
	MOVEM	W1,ARGVAL	;STORE LONG OCTAL
	MOVEM	W2,ARGVAL+1
	JRST	ACC32
ACC30:	MOVEM	W2,ARGVAL	;STORE SINGLE OCTAL

;	HERE AT END OF INPUT

ACC32:	PUSHJ	P,CLRLIN	;CLEAR THE LINE
	TLZN	F,MF		;FLAGGED AS A NEGATIVE #?
	JRST	ACC10		;NORMAL
	SETCMM	ARGVAL		;SET TO NEGATIVE -
	SETCMM	ARGVAL+1	;	= 1'S COMPLEMENT
	AOS	ARGVAL+1	; LETS MAKE IT 2'S COMPLEMENT
	SKIPN	ARGVAL+1
	AOS	ARGVAL
	JRST	ACC10		;NOW PLACE THAT LOT
	PAGE
;	'ACCEPT' FORMAT PROCESSING

ACC2:	PUSHJ	P,EVAL
	   JRST	ERR6		;NO SUCH STATEMENT NO
	PUSHJ	P,FRMSET	;SET UP TO ACCESS A FORMAT STATEMENT
	  JRST	RET		;CANT DO IT!
	MOVE	W1,T3		;FORMAT START
	MOVE	W2,T1		;FORMAT END

;	HERE WITH A RECOGNISED FORMAT REFFERENCE SET UP


ACC3:	MOVE	T,[POINT 7,(W1)]
;**;[100] modify @ acc3+1 ma 29-aug-77
	pushj	p,loadch	;GET A USER CHARACTER
	CAIE	T1," "		;BLANKS
	CAIN	T1,11		; AND TABS IGNORED TO START WITH
	JRST	ACC3

;**;[100] modify @ acc3+5 ma 29-aug-77
	MOVE	T2,[pushj p,loadch]
	MOVEM	T2,GETCHR	;SET TO READ FROM USER
	PUSHJ	P,GETSK2
	CAIE	T1,"("		;FIRST FORMAT CHARACTER MUST BE (
	JUMPA	T1,BADSYN
ACC4:	ILDB	T2,T		;INCREMENT POINTER NOW
	HRRM	T,.+1
	CAIG	W2,(W1)		;HAVE WE EXHAUSTED THE FORMAT
	JRST	[JUMPE	T1,RET
		 JRST	ERR13]	;YES
	DPB	T1,T		;STORE NEXT CHARACTER
	JUMPE	T1,ACC4

;**;[100] modify @ acc6 ma 29-aug-77
ACC6:	pushj	p,loadch	;GET ANOTHER USER FORMAT CHARACTER
	CAIE	T1," "		;NOW ALLOW
	CAIN	T1,11		;BLANKS AND TABS AS USER WANTS
	CAIA
	PUSHJ	P,GETSK2
	JUMPN	T1,ACC7		;NOT THE LAST CHARACTER YET IF NON ZERO
	CAIE	T3,")"		;LAST USER CHARACTER MUST BE A )
	JRST	ERR32		;  IT WASN'T SO COMPLAIN
ACC7:	MOVE	T3,T1		;REMEMBER THE LST USER CHARACTER
	CAIE	T1,37		;DOES USER WANT LINE CONTINUATION = ^_
	JRST	ACC4		;NO - NORMAL

;**;[100] modify @ acc5 ma 29-aug-77
ACC5:	pushj	p,loadch	;ACCEPT ANOTHER USER CHARACTER
	CAIN	T1,12		;UNTIL END OF LAST LINE
	JRST	ACC6
	JRST	ACC5		;DO A CONTINUATION
	PAGE
;	TYPE LOGIC

DISPLA:	SKIPN	ESCAPE		;CAN WE USE FOROTS?
	JRST	ERR30		;NOT AFTER A ^C RE-ENTER
	SETZM	CURGRP		;CLEAR CURRENT GROUP STACK FLAGS
	TLO	F,CFLIU!GRPFL	;SET CORE FILE IN USE - ALLOW GROUPS
	CLEARM	GETCHR		;THIS IS THE FIRST ACCESS TO CORE FILE THIS LINE
	TLNE	F,EOL		;USER GAVE ANY ARGUMENTS?
	TLOA	F,OFCFL		;NO - GET THEM FROM CORE FILE
	TLZ	F,OFCFL		;YES - PUT THEM INTO CORE FILE
	PUSHJ	P,DISP4		;DISPLAY ROUTINE
	TLZ	F,CFLIU!OFCFL!GRPFL	;PULL DOWN DANGEROUS FLAGS
	PUSHJ	P,REINOP	;REINSTATE OPEN PROGRAM
	JRST	RET		;END OF TYPE COMMAND

DISP4:	CLEARM	RANGE		;CLEAR FOR RANGE INDICATION
	PUSHJ	P,SYMIN		;GET USERS NEXT SYMBOL VALUE
	   JRST	DISP3		;NOT THERE
	   CAIA			;STATEMENT # FOUND
	JRST	DISP2		;TRUE VARIABLE

;	FORMAT STATEMENT PROCESSOR


DISP13:	PUSHJ	P,FRMSET	;SET UP TO ACCESS A FORMAT STATEMENT
	  JRST	DISP5		;CANNOT DO IT

;	NOW FOUND A RECOGNISED FORMAT STATEMENT

	MOVE	T2,[POINT 7,(T3)]
	MOVEI	W1,SYM		;SET UP FOR SYMBOL PRINT
	PUSHJ	P,SPT		;PRINT SYMBOL=STATEMENT #
	TYPE(	FORMAT)
DISP6:	ILDB	T,T2		;GET A CHARACTER FROM THE FORMAT TEXT
	HRRM	T2,.+1		;GET NO OF WORDS DONE
	CAIG	T1,(T3)		;ALL DONE?
	JRST	DISP5		;DONE WITH FORMAT
;**;[100] modify @ disp6+4 ma 28-aug-77
	putchr	(T)		;[100]TYPE IT
	JRST	DISP6		;MORE TO DO - BACK FOR MORE
	PAGE
;	SET UP ACCESS TO A FORMAT STATEMENT  T3=START  T1=END
;	SKIP ON SUCCESS.

FRMSET:	MOVEI	T3,(T)		;SHOULD POINT TO A JRST
	LINE
	LDB	T,[POINT 7,(T3),6]	;GET FIRST CHARACTER OF FORMAT
	CAIE	T,"("		;FIRST CHARACTER MUST BE A (
	PJRST	ERR16		;USER LOSES
	MOVE	T,T3		;ACCEPTED START OF FORMAT -
	MOVEM	T,SAVLOC	; NOW FIND END OF F10 FORMAT
	HRREI	T,-12		;CHANGE LABEL+P TO LABEL+F
	ADDM	T,SYM		;LIKE SO
	PUSH	P,T3		;SAVE (T3)
	PUSHJ	P,EVAL		;LOCATE THE FORMAT END
; [71] Change @FRMSET+11 lines, JMT, 6-Dec-76
; [71] Delete 	  JRST	E8		;CANT FIND FORMAT END
	  JRST	ERR41		;[71] CANT FIND FORMAT END
	POP	P,T3		;RESTORE
	MOVEI	T1,1(T)		;SET UP END OF FORMAT IN T1
	JRST	CPOPJ1		;T3 START - T1 END . . . ALL SET UP

VAL2:	TAB
	MOVE	T,RANLIM	;GET THE CURRENT VALUE POINTER
	MOVE	T,1(T)		;GET THE NEXT VALUE
	POPJ	P,

;	IMPLIED RANGE   I.E. TYPE ARRAY

DISP2:	CAIN	T1,"-"
	JRST	DISP1		;GET LIMIT OF RANGE
	TRZN	TF,IMPRNG	;IS THIS A SIMULATED RANGE
	JRST	DISP10		; NO - JUST NORMAL

DISP11:	PUSHJ	P,DISP14	;SET UP RANGE WITH UPPER LIMIT
	TLOA	F,GRPFL		;PERMIT GROUP LOGIC AGAIN
;**; [73] Change @ DISP0, JMT, 12-Apr-77
DISP0:	HRL	TMOD,TMOD	;[73] UNFUDDLES THE MODIFIERS FOR A RANGE


;	ONE-SHOT TYPE REQUEST
;	ENTER WITH SYMBOL VALUE IN T
;	ENSURE TERMK,RANGE=0

DISP10:	MOVEM	T,LWT		;SAVE SYMBOL VALUE
	MOVE	T,(T)		;GET CONTENTS OF SYMBOLIC ADDRES
	EXCH	T,LWT		;SAVE CONTENTS AND GET SYMBOL VALUE
				;SAVE SYMBOL VALUE IN CASE WE DO A RANGE
	MOVEM	T,RANLIM	;SAVE FOR RANGE NAME ID SUPRESSION
;**;[064],DISP10+4, DELETE 1 LINE ,MD,APR-76
	PUSHJ	P,OFFSET	;TYPE USERS SYMBOL
	   JRST	DISP3
	EXCH	T,SYM		;GET BACK SYMBOL CONTENTS
	TLNE	TMOD,-1		;ANY LOCAL MODIFIERS?
	MOVS	TMOD,TMOD	;YES - USE THEM
	TRO	TMOD,ANYMOD	;FLAG FIRST PRINT ON LINE
	PAGE
;	*** TYPE FLOATING *** 

TYPF:	TRNN	TMOD,F.		;TEST THE FLOATING FLAG
	JRST	TYPD		;NO REAL TRY DOUBLE REAL
	JUSTIFY
	MOVEI	T2,4		;ARG TYPE REAL FOR FOROTS
	PUSHJ	P,FOROUT	;ONE ARG OUTPUT

;	*** TYPE DOUBLE REAL ***

TYPD:	TRNN	TMOD,D.		;TEST FOR DOUBLE REAL
	JRST	TYPC		;NO FLOATING TRY COMPLEX
	JUSTIFY
	MOVE	T2,RANLIM	;GET ARG POINTER
	MOVE	T,1(T2)		;GET SECOND ARG
	MOVEM	T,ARGVAL+1	;SAVE 2ND. HALF FOR FOROTS
	MOVE	T,(T2)		;RE-INSTATE IST.ARG IN T
	MOVEI	T2,10		;ARG TYPE REAL*8 FOR FOROTS
	PUSHJ	P,FOROUT	;OUTPUT REAL*8

;	*** TYPE COMPLEX ***

TYPC:	TRNN	TMOD,C.		;TEST FOR COMPLEX TYPE OUT
	JRST	TYPI		;NO COMLEX TRY FOR INTEGER
	JUSTIFY
	MOVE	T2,RANLIM	;[52] GET ARG POINTER
	MOVE	T,1(T2)		;[52] GET SECOND ARG
	MOVEM	T,ARGVAL+1	;[52] SAVE 2ND HALF FOR FOROTS
	MOVE	T,(T2)		;[52] REINSTATE 1ST ARG IN T
	MOVEI	T2,14		;SET UP ARGTYPE FOR COMPLEX
	PUSHJ	P,FOROUT	;ONE ARG OUTPUT

;	** TYPE INTEGER ***

TYPI:	TRNN	TMOD,I.		;TYPE AS INTEGER?
	JRST	TYPO		;NO - TRY OCTAL
	JUSTIFY
	MOVEI	ODF,^D10	;PREPARE FOR DECIMAL TYPE OUT
	PUSHJ	P,FTOC		;CONSTANT PRINT

;	*** TYPE OCTAL ***

TYPO:	TRNN	TMOD,O.		;TYPE AS OCTAL?
	JRST	TYPA		;NO - TRY ASCII
	JUSTIFY
	MOVEI	ODF,10		;PREPARE FOR OCTAL PRINT
	PUSHJ	P,FTOC		;PRINT IN OCTAL
	TRNN	TMOD,L.		;DOUBLE WORD
	JRST	TYPA		;NO - TRY ASCII
	PUSHJ	P,VAL2		;GET THE NEXT VALUE
	PUSHJ	P,FTOC		; DISPLAY THAT
	PAGE
;	*** TYPE ASCII ***

TYPA:	TRNN	TMOD,A.		;TYPE AS ASCII?
	JRST	TYPR		;NO - SEE IF RIGH JUSTIFIED ASCII
	JUSTIFY
	PUSHJ	P,TXT341	;THROW UP ASCII
	TRNN	TMOD,L.		;DOUBLE?
	JRST	TYPR		;NO - TRY RASCII
	PUSHJ	P,VAL2		;GET THE NEXT VALUE
	PUSHJ	P,TXT341	;AND TYPE THAT AS ASCII

;	*** TYPE RIGHT JUSTIFIED ASCII ***

TYPR:	TRNN	TMOD,R.		;TYPE AS ASCII RIGHT JUSTIFY
	JRST	TYPS		;NO - SEE IF IN RANGE
	JUSTIFY
	TYPE(R)			;[47] RASCII IDENTIFIER
	LSH	T,1		;MAKE LEFT JUSTIFIED ASCII
	PUSHJ	P,TXT341	;TYPE AS USUAL
	TRNN	TMOD,L.		;DOUBLE RASCII?
	JRST	TYPN		; NO
	PUSHJ	P,VAL2		;GET NEXT VALUE
	LSH	T,1		;FAKE ASCII
	PUSHJ	P,TXT341	;TYPE AS ASCII

TYPS:	TRNN	TMOD,S.		;/S IS ILLEGAL FOR TYPE
	JRST	TYPN
	JRST	ERR37		; - ERROR
	PAGE
;	HERE AT END OF TYPING - EXAMINE RANGE CONDITION

TYPN:	LINE
	SKIPN	RANGE		;ARE WE IN A RANGE CONDITION
	JRST	DISP5		; NO

	AOS	T,RANLIM	; YES INCREMENT VARIABLE
	TRNN	F,DOUBLE	;IS THIS A REAL*8 ARRAY RANGE
	TRNE	TMOD,C.!D.!L.	;OR ANY DOUBLE WORD MODIFIER
	AOS	T,RANLIM	;REAL*8 ARRAYS GO UP BY TWO
	CAMG	T,RANGE		;TO LIMIT OF RANGE
	JRST	DISP0		;AND TYPE ALL REQUIRED

DISP5:	TLNE	TMOD,-1		;LOCAL MODIFIERS?
	HLRZ	TMOD,TMOD	;YES - REMOVE THEM
	SKIPGE	TERMK		;END OF USER INPUT LINE YET?
	JRST	DISP4		; NO - KEEP GOING
	POPJ	P,		; YES - END OF TYPE COMMAND

JUSTFY:	TRZN	TMOD,ANYMOD	;SEE IF FIRST OUTPUT THIS VARIABLE
;**;[100] modify @ justify+1 ma 27-aug-77
	jrst	[LINE
		jrst	.+1]
	TYPE(	=  )
	MOVE	T,LWT		;GET BACK THE OUTPUT VARIABLE CONTENTS
	POPJ	P,



;	GET THE LIMIT OF A RANGE CONDITION AND CHECK THE ORDER

DISP1:	MOVEM	T,RANGE		;REMEMBER START OF RANGE
	TLZ	F,GRPFL		;NO GROUP REQUESTS HERE OR PRINT MODIFIERS
	PUSH	P,MATHSM	;SAVE CURRENT SYMBOL
	PUSHJ	P,SYMIN		;GET NEXT SYMBOL
	   JRST	DISP3		;BAD LABEL
	   JRST	BADSYN		;STATEMENT NO. ????
	POP	P,T3		;GET FIRST SYMBOL BACK
	CAME	T3,MATHSM	;ARE THEY THE SAME
	JRST	ERR40		;NO - SORRY
	TRZE	F,SUBFLG	;WAS THERE AN IMPLIED RANGE
	JRST	DISP11		;YES - GO DEAL WITH IT

	CAML	T,RANGE		;SORT OUT SYMBOL ORDER
	EXCH	T,RANGE		;CHANGE THEIR ORDER
	CAIN	T1,"-"		;"-" IS A DELIMITER BUT IS BAD HERE
	JRST	BADSYN
	TLO	F,GRPFL		;O.K. FOR GROUPS AGAIN
	JRST	DISP10		;NOW TYPE RANGE

SYM4:	TLNE	F,GRPFL		;ARE WE ALLOWING CORE STRINGS
	CAIE	T1,"/"		;AND IF SO DOES THE USER WANT ONE
	JRST	SYM1		;NOT IN GROUP LOGIC
	PAGE
;	ACCEPT TEMPORARY PRINT OPTION MODIFIERS

SYM15:	PUSHJ	P,OPTION	;GET THE PRINT OPTION SETTINGS
	  JRST	SYM14		;NUMERIC - MUST HAVE BEEN A GROUP REQUEST
	SKIPL	TERMK		;EOL?
	JRST	BADSYN		;CAN'T HAVE THAT!
	PJRST	SYMIN		;RESUME SYMIN ACTIVITIES

;	HANDLE GROUP REQUESTS

SYM14:	CAIL	T,1
	CAILE	T,GPMAX		;WHICH MUST BE IN RANGE
	JRST	ERR15		;NO GOOD
	CAIE	T1,","		;ALLOW COMMA AS DELIMITER
	JUMPN	T1,BADSYN	;ANYOTHER CHARACTER IS BAD


	PUSHJ	P,SYM5		;PROCESS GROUP CONTENTS


	POP	P,(P)		;REMOVE SYMIN PUSH
	JRST	DISP5		;ANYTHING ELSE ON USERS LINE?

SYM1:	TLNN	F,GRPFL		;IS GROUP LOGIC IN ACTION
	JRST	RET		;ASSUME NUL INPUT GO BACK TO USER

	POP	P,(P)		;REMOVE THE SYMIN PUSH
	JUMPE	T1,DISP5	;EMPTY GROUP?
	JRST	BADSYN		;MUST BE BAD SYNTAX


;	ROUTINE TO DETERMINE THE LENGTH OF AN IMPLIED RANGE

DISP14:	MOVEM	T,RANLIM	;SAVE THE BASE ARRAY REFFERENCE
	SETZM	PUTTER		;SET FOR RAYNAM
	PUSHJ	P,GET.RP	;GET THE RANGE PRODUCT FOR THIS ARRAY
	MOVE	T,DIMTOT	;
	ADD	T,RANLIM	;FORM UPPER RANGE LIMIT
	SOJ	T,		;
	MOVEM	T,RANGE		;SAVE THE RANGE
	MOVE	T,RANLIM	;GET THE START ADDRESS
	POPJ	P,
	PAGE
;	ENTRY POINT FOR A GROUP 'TYPE' REQUEST
;	PUSHJ P,SYM5
;	WITH GROUP # 1-GPMAX IN T
;	AND TERMK=0

SYM5:	TRZE	TF,DCOPFG	;DON'T OPEN PROG?
	JRST	SYM16		;NO - DON'T
	SKIPN	T3,GRP2(T)	;GET GROUP'S PROG
	JRST	SYM16		;NULL - IGNORE IT
	CAMN	T3,OPENED	;IS IT CURRENT?
	JRST	SYM16		;YES
	MOVEM	T3,SYM		;NO - SAVE IT
	MOVE	T3,OPENED
	MOVEM	T3,OLDOPN	;AND SAVE OLD OPENED
	PUSH	P,T		;SAVE (T)
	PUSHJ	P,IMPOPN	;DO THE OPEN AND MESSAGE
	POP	P,T		;RESTORE (T)

SYM16:	
;	CHECK FOR GROUP RECURSION

	MOVEI	T3,1
	LSH	T3,(T)	;SET UP MASK BIT
	TDOE	T3,CURGRP	;CHECK AND SET
	JRST	ERR39		;GROUP ALREADY ACTIVE - ERROR
	MOVEM	T3,CURGRP	;SAVE STATE
	PUSH	P,T		;SAVE T

	IMULI	T,CFSIZ		;GET RELEVANT GROUP SECTION
	ADD	T,[POINT 7,GRP1-CFSIZ]	;FORM POINTER TO IT

	RECURS <CFLPTR,CFLST,GETCHR,TERMK>
				;CFLPTR - SAVE CURRENT CORE POINTER
				;CFLST - SAVE CURRENT CORE LIMIT
				;GETCHR - SAVE CURRENT STRING SOURCE
				;TERMK - SAVE CURRENT DELIMITER DESCRIPTOR
	MOVEM	T,CFLPTR	;SET UP NEW POINTER
	HRRZM	T,CFLST		;DEFINE NEW STRING LIMIT
	MOVE	T,[ILDB T1,CFLPTR]	;GET POINTER TO NEW INFORMATION
	MOVEM	T,GETCHR	;STATE NEW STRING SOURCE
	PUSHJ	P,DISP4		;DO A RE-ENTER

	SRUCER			;POP BACK ALL ABOVE RECURS-ED VALUES

;	CLEAR CURRENT GROUP FLAG

	POP	P,T		;GET NUMBER BACK
	MOVEI	T3,1
	LSH	T3,(T)	;SET UP MASK
	TDC	T3,CURGRP	;CLEAR THIS GROUP FLAG
	MOVEM	T3,CURGRP	;SAVE IT

	PJRST	DISP5		;SEE IF THERE IS AN ORIGINAL USER
				;STRING TO PROCESS

DISP3:	PJRST	DISP9		;CANNOT FIND SYMBOL
	PAGE
;OPEN LOGIC

SETNAM:	TLO	F,FPRNM		; FIND PROGRAM NAME
	PUSHJ	P,FNDSYM	;
	 JRST	ERR6		; NO SUCH NAME
	HLRE	T,(R)		; GET (XWD -LEN,...)
	HRLM	T,OPENLS
	ADDI	T,1(R)		; POINT TO BEG OF PROGS SYMBOLS
	HRRM	T,OPENLS	;
	MOVE	T,SYM
	MOVEM	T,OPENED	; PROGRAM NAME OPENED
	POPJ	P,		;
	PAGE
;	DIMENSION LOGIC



	DEFINE	PAIRS(K)
<	K=K+2
	XWD	0,K		;START OF STRING,NEXT IN STRING
	XWD	0,0		;PARAMETER WORD>



K=DIMTAB

DIMTAB:	XLIST			;DEFINE TABLE OF TWO WORD PAIRS
	REPEAT	DIMSIZ-1,<PAIRS(K)>

	XWD	0,0		;END OF LIST IS SPECIAL
	XWD	0,0
	LIST



NUMPRS=DIMFRE-DIMTAB		;THE NUMBER OF AVAILABLE WORDS
NUMPRS=NUMPRS/2			;DEFINES THE # OF 'PAIRS' AVAILABLE

DIMFRE:	XWD	K,DIMTAB	;END, AND START OF FREE SPACE

DIMNAM:	XWD	0,0		;END, AND START OF LIST OF ARRAY NAMES
	PAGE
;	ROUTINE TO OBTAIN A FREE TWO WORD PAIR
;	CALL PUSHJ	P,GET2WD
;	     RETURN - ADDRESS OF 'PAIR' IN T

GET2WD:	HRRZ	T,DIMFRE	;GET THE START OF THE FREE LIST
	HRRZ	T1,(T)		;FIND THE LOCATION OF THE NEXT 'PAIR'
	JUMPE	T1,GETNON	;END OF LIST REACHED
	HRRM	T1,DIMFRE	;REMOVE THIS 'PAIR' FROM THE LIST
	POPJ	P,		;RETURN WITH GOOD 'PAIR' ADDRESS IN T

GETNON:	PUSHJ	P,FLUSHA	;REMOVE ALL STRUCTURES CREATED FOR
				;THE ARRAY VALUE IN SAVLOC
	TYPE(?FDTDTO DIMENSION TABLE OVERFLOW)
	JRST	RET

;	SUBROUTINE TO RETURN A 'PAIR' TO THE FREE LIST
;	CALL PUSHJ P,PUT2WD
;	     ENTER WITH ADDRESS OF 'PAIR' IN T
;	     RETURN

PUT2WD:	HLRZ	T1,DIMFRE	;GET THE ADDRESS OF THE END OF THE LIST
	HRRM	T,(T1)		;APPEND THE NEW 'PAIR'
	SETZM	(T)		;NEW 'PAIR' BECOMES END OF LIST
	HRLM	T,DIMFRE	;RECORD THE FACT
	POPJ	P,

;	ROUTINE TO LOOK THROUGH LIST OF ARRAY NAMES TO FIND IF 
;	THIS (SAVLOC) NAME IS ALREADY IN USE
;	CALL PUSHJ	P,RAYNAM
;	RETURN HERE IF NOT FOUND
;	RETURN HERE IF FOUND . . . T=ADDRESS OF ARRAY,  T2=LAST ARRAY
;				   F10RAY IN TF IS SET IF F10 DEFINED

RAYNAM:	HRRZI	T2,DIMNAM	;SET UP FOR FIRST ARRAY
	HRRZ	T,DIMNAM	;IS THERE AN ENTRY AT ALL?
RAY:	JUMPE	T,RAY3		;T2 WILL POINT TO THE END OF THE LIST
	HRRZ	T1,1(T)		;THIS IS AN ARRAY BLOCK - GET THE NAME(VALUE)
	CAMN	T1,SAVLOC	;ARE WE REDEFINING CURRENT NAME?
	JRST	RAY2		; YES - REMOVE THE ENTRY FIRST

	MOVE	T2,T		;T2 WILL POINT TO THE CURRENT GOOD ENTRY
	HRRZ	T,(T)		;FIND THE NEXT 'PAIR' ADDRESS
	JRST	RAY

RAY2:	SKIPL	1(T)		;IS THE DOUBLE PRECISION BIT ON = 400000,,0
	TRZA	F,DOUBLE	;NO  - MAKE SURE 'DOUBLE' IS OFF
	TRO	F,DOUBLE	;YES - SET THE DOUBLE FLAG
	TRZ	F,FORMAL!F10RAY	;THESE CAN'T APPLAY HERE
	JRST	CPOPJ1		;ARRAY IDENTIFIED EXIT
	PAGE
;	HERE IF NO USER DEFINITION EXISTS IN FORDDT DIMENSION LISTS
;	NOW CHECK FOR AN F10 DEFINITION

RAY3:	PUSH	P,T		;SAVE BOTH T AND-
	PUSH	P,T2		;  T2 AROUND EVAL
	MOVE	T,SAVLOC
	TRO	F,SILENT	;DON'T PRINT SYMBOL
	PUSHJ	P,LOOK		;SETS UP W1 FROM T
	  JRST	RAYPOP		;
	  JRST	RAYPOP		;DOSENT EXIST
	POP	P,T2		;RETURN T2
	POP	P,T		; AND T
	MOVE	RAY.,W1		;GET THE ARRAY SYMBOL
	MOVE	T1,(RAY.)	; AND SEE IF WE HAVE AN F10 ARRAY -
	TLZ	T1,PNAME	;    DEFINITION -
	IOR	T1,[XWD 500000,0];      THIS IS THE SAME SYMBOL
	CAME	T1,2(RAY.)	;        WITH FLAGS 50 SET
	POPJ	P,		;NO - NOT AN F10 DEFINITION
	TRO	F,F10RAY	;YES - FLAG THIS AS AN F10 ARRAY
	MOVE	RAY.,3(RAY.)	;SET POINTER TO ARRAY TABLE INFORMATION
	LDB	T1,[POINT 4,1(RAY.),12]
	CAIE	T1,10		;IS THIS A REAL*8 ARRAY?
	TRZA	F,DOUBLE	;NO MAKE SURE DOUBLE IS OFF
	TRO	F,DOUBLE	;YES FLAG IT
	LDB	T1,[POINT 9,1(RAY.),8]
	MOVEM	T1,DIMCNT	;SET UP THE NUMBER OF DIMENSIONS
	LDB	T1,[POINT 1,1(RAY.),13]
	JUMPN	T1,RAY4		;PASSING FORMAL ARRAY ARGUMENTS?
	TRZ	F,FORMAL	;THIS IS NOT A FORMAL PARAMETER
RAY5:	HRRZI	RAY.,3(RAY.)	;SET TO POINT TO THE FIRST DIMENSION
	JRST	CPOPJ1


RAYPOP:	POP	P,T1		;MUST RESET T2-
	POP	P,T		; AND T BEFORE
	POPJ	P,		; GIVING A NO FOUND EXIT


RAY4:	TRO	F,FORMAL	;FLAG FORMAL WORKING
	HRRZI	T,@1(RAY.)	;GET THE ACTUAL ARRAY BASE
	MOVEM	T,FRMSAV	;SAVE THE FORMAL REFFERENCE
	JRST	RAY5		;
	PAGE
;	ROUTINE TO CREATE AN ARRAY ENTRY
;	MUST HAVE A PAIR OF SUBSCRIPTS IN TEM,TEM1
;	 CALL PUSHJ P,PUTNAM
;	     ENTER WITH SAVLOC = VALUE OF NAME OF ARRAY

PUTNAM:	PUSH	P,F		;SAVE FLAGS ROUND THE NEXT FEW LINES
	PUSHJ	P,SIMDEF	;SEE IF THIS ARRAY NAME IS AFTER BASE-ARRAY
PUTCHK:	PUSHJ	P,RAYNAM	;HAVE WE USED THIS NAME BEFORE?
	  JRST	PUTOK		;NO  - GO AHEAD - PLACE NEW NAME
	PUSHJ	P,FLUSH		;NAME ALREADY IN USE STAND BY FOR REDEFINITION
	TRZE	F,FORMAL	;ATTEMPT TO RE-DIMENSION A FORMAL PARAMETER
	JRST	ERR33		;NO YOU DON'T
	TRNN	F,F10RAY	;F10 DEFINED ARRAY?
	JRST	PUTCHK		;RESET ALL
	JRST	ERR28		;WARN OF F10 REDEFINITION

PUTOK:	POP	P,F		;RESTORE FLAGS FROM ABOVE
	PUSHJ	P,GET2WD	;GET A 'PAIR' - END OF NAMES = T2
	MOVEM	T,T3		;SAVE FOR NAME DEFINITION - T3
	PUSHJ	P,GET2WD	;GET A 'PAIR' FOR DIMENSION DEFINITION
				;ENSURE WE HAVE 2 'PAIRS' FREE NOW
				;SAVE PAIN IN 'FLUSHING' LATER
	HRRM	T3,(T2)		;SAY HELLO TO NEW MEMBER
	SETZM	(T3)		;NEW MEMBER BECOMES END OF CHAIN
	MOVE	T1,SAVLOC	;GET THE NEW MEMBERS NAME
	TRNE	F,DOUBLE	;IS THIS A DOUBLE PRECISION ARRAY
	TLO	T1,400000	;YES - SAVE THE FACT
	MOVEM	T1,1(T3)	;ACCEPT THE NEW MEMBER TO THE FAMILY
	HRLM	T,(T3)		;NEW MEMBERS ARE GIVEN A DIMENSION LIST
	PUSHJ	P,PUTSUB	;STORE THE SUBSCRIPTS
	JRST	CPOPJ1		;JUMP OVER POSSIBLE PUTDIM ENTRY

PUTSUB:	MOVE	T1,TEM1		;GET THE UPPER SUBSCRIPT
	SUB	T1,TEM		;FORM THE DIMENSION RANGE < 256K
	HRLZM	T1,(T)		;SAVE IN LINK LOCATION OF PAIR
				;   AND DENOTE END OF PRESENT DIMENSION LIST
	MOVE	T1,TEM		;GET THE LOWER SUBSCRIPT
	MOVEM	T1,1(T)		;SAVE FOR FUTURE REFERENCE
	MOVEM	T,PUTTER	;SAVE THE END OF THE DIMENSION LIST
	POPJ	P,

;	ROUTINE TO ADD ANOTHER DIMENSION TO AN ARRAY DIMENSION LIST
;	CALL PUSHJ P,PUTDIM
;	     ENTER WITH TEM,TEM1 = LOWER AND UPPER SUBSRIPTS

PUTDIM:	PUSHJ	P,GET2WD	;GET A FREE 'PAIR'
	MOVE	T1,PUTTER	;FIND WHERE THE LAST DIMENSION WAS STORED
	HRRM	T,(T1)		;LINK NEW 'PAIR' TO OLD LIST
	PJRST	PUTSUB		;SAVE THE SUBSCRIPTS
	PAGE
;	ROUTINE TO GET THE DIMENSIONS, IN ORDER, FOR THE ARRAY VALUE(SAVLOC)
;	CALL PUSHJ P,GETDIM
;	WITH ARRAY VALUE IN SAVLOC AND PUTTER = 0 FOR FIRST CALL
;	EXIT WITH TEM=SUB LOWER   TEM1=SUB UPPER

GETDIM:	SKIPE	T,PUTTER	;IS THIS THE FIRST CALL?
	JRST	GET4		; NO - GET NEXT DIMENSION RANGE

	PUSHJ	P,RAYNAM	;YES - SET UP THE ARRAY REFERENCES
	  JRST	E5		;SAVLOC NAME NOT KNOWN??
	TRNE	F,F10RAY	;F10 DEFINED?
	JRST	GET3		;YES
	HLRZ	T,(T)		;GET THE START OF DIMENSION LIST
	JRST	GET5		;FIRST TIME IS SPECIAL
GET4:	TRNE	F,F10RAY	;F10 ARRAY DEFINITION?
	JRST	GET3		;YES
	HRRZ	T,(T)		;GET NEXT DIMENSION IF ANY
GET5:	JUMPE	T,ERR22		;END OF LIST - TOO MANY DIMENSIONS EXPECTED
	MOVEM	T,PUTTER	;SAVE LINK TO NEXT DIMENSION
	MOVE	T2,1(T)		;GET THE LOWER SUBSCRIPT
	MOVEM	T2,TEM		;SAVE THE LOWER SUBSCRIPT
	HLRZ	T2,(T)		;GET THE RANGE OF THIS DIMENSION
	ADD	T2,TEM		;FORM THE UPPER SUBSCRIPT
	MOVEM	T2,TEM1		;SAVE AS THE UPPER SUBSCRIPT
	POPJ	P,


;	HERE TO GET THE NEXT UPPER AND LOWER BOUNDS
;	FOR AN F10 DEFINED ARRAY

GET3:	SETOM	PUTTER		;FLAG NOT FIRST TIME FOR F10 ARRAYS
	SOSGE	DIMCNT		;ARE THERE ANY MORE DIMENSIONS TO COME?
	JRST	ERR22		;NO HARD LUCK
	MOVE	T,@(RAY.)	;GET THE LOWER BOUND
	MOVEM	T,TEM		;SAVE LOWER
	MOVE	T,@1(RAY.)	;GET THE UPPER BOUND
	MOVEM	T,TEM1		;SAVE LOWER
	HRRZI	RAY.,3(RAY.)	;RAY. NOW POINTS TO NEXT DIMENSION-
	POPJ	P,		;	IF ANY
	PAGE
;	ROUTINE TO GUARD AGAINST SIMULTANEOUS SINGLE COMMAND RE-DIMENSIONING
;	OF THE SAME ARRAY. THE LOCATION BASRAY CONTAINS A REFFERENCE TO 
;	THE ARRAY NAME WHICH STARTED THE CURRENT DIMENSION WORKING
;	AND WILL BE THE POINT IN THE NAMES LIST AFTER WHICH A REDEFINITION
;	OF THE NAME NOW FOUND IN SAVLOC WILL BE ILLEGAL

SIMDEF:	MOVE	T3,SAVLOC	;GET THE NEW ARRAY NAME(VALUE)
	EXCH	T3,BASRAY	;SAVE AND START AT BASE-ARRAY NAME
	PUSHJ	P,RAYNAM	;SET UP POINTERS TO BASE-ARRAY
	  POPJ	P,		;   ????
	MOVEM	T3,BASRAY	;RESET BASE ARRAY AND CURRENT NAME
	TRNE	F,F10RAY	;F10 DEFINED ARRAY?
	POPJ	P,		;MUST BE A NEW DEFINITION
	PUSHJ	P,RAY		;SEE IF THIS ARRAY NAME OCCURS AFTER BASRAY
	  POPJ	P,		;NO
	TYPE	(?FDTMLD )
	MOVE	T,SAVLOC	;GET THE OFFENDING VALUE
	PUSHJ	P,LOOK		;DISPLAY IT
	  JFCL
	  JFCL
	TYPE( MULTI-LEVEL ARRAY DEFINITION NOT ALLOWED.)
	PUSHJ	P,FLUSHA	;FLUSH ALL FROM BASRAY TO END OF NAME LIST
	JRST	RET		;EXIT TO USER MODEFORDDT


;	ROUTINE TO ENSURE THAT THERE ARE NO MORE DIMENSIONS
;	TO BE CHECK FOR THIS (SAVLOC) ARRAY

SUBCHK:	PUSHJ	P,MORDIM	;ARE THERE ANY MORE DIMENSIONS LEFT
	POPJ	P,		;O.K.
	JRST	ERR1		;NOT ENOUGH DIMENSION INFO

;	TYPE THE DIMENSION LIST FOR THE ARRAY NAME VALUE IN SAVLOC

DIM1:	PUSHJ	P,RAYNAM	;SET UP REFERENCES TO THIS ARRAY NAME
	JRST	ERR34		;NONE SUCH
	TRNE	F,F10RAY	;IS THIS AN F10 DEFINED ARRAY
	SKIPA	T3,[EXP SAVLOC-1]  ;IF SO FOOL TYPDIM
	MOVE	T3,T		;PREPARE FOR TYPDIM
	PUSHJ	P,TYPDIM	;TYPE OUT THE DIMENSIONS
	JRST	RET		;ALL DONE
	PAGE
;	ROUTINE TO REMOVE AND RETURN(GARBAGE COLLECTION) ALL REFERENCE
;	TO THE ARRAYS WHICH FOLLOW THAT DEFINED IN SAVLOC IF FLSHAL IS SET

FLUSHA:	TRO	F,FLSHAL	;SET UP TO FLUSH ALL FROM BASE-ARRAY
	MOVE	T,BASRAY	;GET THE BASE ARRAY VALUE
	MOVEM	T,SAVLOC	;AND SET UP FOR RAYNAM
	PUSHJ	P,RAYNAM	;RESET F10RAY FLAG TO NEW BASRAY SETTING
	  POPJ	P,		;?????

FLUSH:	TRNN	F,F10RAY	;NOTHING TO DO IF AN F10 ARRAY
	PUSHJ	P,RAYNAM	;SET UP POINTERS TO THE ARRAY IN SAVLOC
	  POPJ	P,		; CAN'T FIND THE ARRAY NAME
				;T2=POINTS TO LAST ARRAY NAME BLOCK
				;T= CURRENT ARRAY NAME BLOCK
FLUSH2:	HLRZ	T3,(T)		;GET DIMENSION LIST ADDRESS
	HRRZ	T1,(T)		;GET NEXT MEMBER ADDRESS
	HRRM	T1,(T2)		;LOOP OUT THE OFFENDING ARRAY NAME ENTRY
	PUSHJ	P,PUT2WD	;RETURN A PAIR
	PUSHJ	P,DELIST	;DELETE THE LIST STARTING AT C(T3)
	TRNN	F,FLSHAL	;HARD FLUSH?
	POPJ	P,		;JUST ONE ARRAY FOR NOW
	HRRZ	T,(T2)		;GET NEXT ARRAY REFERENCE IF ANY
	JUMPE	T,CPOPJ		;EXIT IF END OF LIST
	JRST	FLUSH2		;MORE TO DO

;ROUTINE TO DELETE A LIST - STARTING IN T3

DELIST:	SKIPN	T,T3		;TEST FOR END OF LIST - RETURN PAIR IN T
	  POPJ	P,		;END OF LIST
	HRRZ	T3,(T3)		;GET NEXT PAIR ADDRESS
	PUSHJ	P,PUT2WD	;RETURN THE OLD PAIR
	PJRST	DELIST		;FOLLOW THROUGH TO END OF LIST

DIM5:	PUSHJ	P,DIMOUT	;DISPLAY ALL ARRAY INFO.
	LINE
	JRST	RET
	PAGE
;	DIMENSION LOGIC


DUBLE:	TRO	F,DOUBLE	;FLAG THIS ARRAY DEFINITION AS REAL*8

DIM:	JUMPL	F,DIM5		;OUTPUT ALL DIMENSION SPECS
	PUSHJ	P,TTYIN		;GET NEXT USER STRING
	JUMPE	T2,DIM5		;TYPE ALL ARRAYS IF EOL

	PUSHJ	P,ALLNUM	;SEE IF USER TYPED A LABEL
	  JRST	DIM13		;NO - MUST BE VARIABLE
	JRST	BADSYN		;BAD SYNTAX
DIM13:	PUSHJ	P,VALID		;CHECK VALIDITY OF VARIABLE
;**;[057], DIM13+1 ,INSERT , MD , 8/11/75
	MOVEM	T3,MATHSM	;[057] THATS WHAT USER TYPED
	MOVEM	T3,SYM		;SAVE FOR 'EVAL'UATION
	PUSHJ	P,EVAL		;EVALUATE SYMBOL
	  JRST	ERR6		;WE DON'T HAVE IT
	MOVEM	T,SAVLOC	;SAVE ARRAY NAME VALUE
	MOVE	T1,LSTCHR	;RE-INSTATE USERS LAST CHARACTER
	SKIPL	TERMK		;END OF LINE?
	JRST	DIM1		;YES - USER WANTS TO SEE DIMENSION LIST

	PUSHJ	P,NXTCHR	;MOVE TO NEXT SIGNIFICANT CHARACTER
	CAIN	T1,"("		; [ DENOTES START OF DIMENSION DEFINITION
	JRST	DIM14		;COMMAND - WILL NOW BE NON ZERO

	CAIE	T1,"["		; ( IS AN ALTERNATIVE TO [
	JRST	DIM7
	TLO	F,LFTSQB	;FLAG THAT A LSB FOUND - SO RSB MUST END SPEC
DIM14:	PUSHJ	P,DIMIN		;SET UP A NEW ARRAY DEFINITION
	JRST	RET

DIM7:	CAIE	T1,"/"		;A / IS ACCEPTABLE TO REMOVE ARRAYS
	JRST	BADSYN		;ANYTHING ELSE WONT DO
	PUSHJ	P,TTYIN		;GET NEXT INPUT
	JUMPN	T1,BADSYN	;MUST BE LINE END NOW
	JUMPE	T2,BADSYN	;NO CHARACTERS??
	LSHC	T1,6		;GET THE FIRST SWITCH CHARACTER
	CAIE	T1,'R'		;DID THE USER REQUEST A REMOVE
	JRST	BADSYN		;NO - WELL TOO BAD
	PUSHJ	P,RAYNAM	;SEE IF WE KNOW ABOUT HIS ARRAY
	  JRST	ERR26		;NO - TELL HIM
	PJRST	DMFLSH		;REMOVE IT
	PAGE
;	ROUTINE TO SET UP A NEW ARRAY DEFINITION

DIMIN:	SETZM	DIMTOT		;CLEAR TOTAL ELEMENT COUNT
	TROE	F,BASENM	;HAS A BASE NAME BEEN ACCEPTED
	JRST	DIM0		;YES - DON'T FLUSH YET

	PUSH	P,F		;PROTECT THE DOUBLE FLAG AWHILE
	PUSHJ	P,RAYNAM	;HAVE WE HAD THIS BASE ARRAY BEFORE
	  CAIA			;NO - VIRGIN
	TRNN	F,F10RAY	;F10 DEFINED?
	PUSHJ	P,FLUSH		;YES - WE MUST REMOVE IT NOW FOR REDEFINITION
	MOVE	T,SAVLOC	;GET THE ARRAY VALUE
	MOVEM	T,BASRAY	;MARK THIS AS OUR BASE ARRAY
	POP	P,F		;RE-INSTATE THE DOUBLE FLAG IF THERE

DIM0:	TRO	F,SURGFL	;FLAG THIS CALL AS SUBSCRIPT GATHERING
	PUSHJ	P,EITHER	;READ A SUBSCRIPT
	  CAIA			;CONSTANT
	  MOVE	T,(T)		;VARIABLE - GET VALUE
	TRZ	F,SURGFL	;CLEAR SUBSCRIPT RANGE ACCEPT FLAG
	MOVEM	T,TEM1		;SAVE TEMPORARILY AS UPPER SUBSRIPT
	PUSHJ	P,NXTCHR	;MOVE TO NEXT CHARACTER
	CAIN	T1,","		;COMMA IS THE USUAL DELIMITER
	JRST	DIMCOM		;PROCESS A COMMA

	CAIE	T1,":"		;A : IS AS GOOD AS A BAR=/
	CAIN	T1,"/"		;BAR IS THE SUBSCRIPT SEPARATOR
	JRST	DIMBAR		;PROCESS A BAR
	TLNN	F,LFTSQB	;SKIP IF WE HAD A [ TO START
	ADDI	T1,"]"-")"	;ACCEPTABLE DELIMITER IF )
	CAIN	T1,"]"		;ONLY ] ACCEPTED AS DELIMITER
	JRST	DIM4		;DENOTE END OF DEFINITIONS

	PUSHJ	P,FLUSHA	;REMOVE THE PRESUMABLY WRONG DEFINITION
	JRST	BADSYN		;COMPLAIN ABOUT SYNTAX
	PAGE
DIM4:	TLO	F,DIMEND	;FLAG THAT THIS IS THE END OF THE LIST
DIMCOM:	TLZE	F,BAR		;HAVE HAD TWO SUBSCRIPTS?
	JRST	DIM2		;YES - CHECK THE ORDER
	MOVEI	T,1		;ADJUST LOWER SUBSCRIPT TO BE 1
	MOVEM	T,TEM		;LOWER SCR IN TEM
	JRST	DIM2		;CHECK THE SUBSCRIPTS
DIM3:	SKIPN	DIMTOT		;IS THIS THE FIRST SETTING FOR THIS ARRAY
	PUSHJ	P,PUTNAM	;YES - USE PUTNAM
	PUSHJ	P,PUTDIM	;N0  - ADD ANOTHER DIMENSION
	MOVE	T,TEM1		;GET UPPER SUBSCRIPT
	SUB	T,TEM		;FORM RANGE
	AOJ	T,		;MUST HAVE AT LEAST ONE
	SKIPN	DIMTOT		;IS THIS THE FIRST DIMENSION
	AOS	DIMTOT		;YES - MAKE FIRST RANGE DEFAULT = ONE
	IMULM	T,DIMTOT	;FORM TOTAL SUBSCRIPT COUNT IN DIMTOT
	TLNN	F,DIMEND	;WAS A LEFT SQUARE BRACKET SEEN LAST?
	JRST	DIM0		;NO - BACK FOR MORE
	MOVE	T,SAVLOC	;GET THE ARRAY VALUE
	ADD	T,DIMTOT	;FORM REFERENCE TO LAST ELEMENT OF ARRAY
	TRNE	F,DOUBLE	;DO WE HAVE A REAL*8 ARRAY
	ADD	T,DIMTOT	;YES - SO THE RANGE MUST BE DOUBLED
	SUBI	T,1
	TRO	F,SILENT	;DO NOT TYPE SYMBOL IF GOOD MATCH
;**;[066],DIM3+21,MD,APR-76
	SETZM	MATHSM		;[066] NO SPECIFIC SYMBOL TO FIND
	PUSHJ	P,LOOK		;DO A LOOK-UP ON LAST ELEMENT
	  JRST	E5		;INTERNAL ERROR
	  JFCL			;FOUND SOME REFERENCE - NOT EXACT
	MOVE	W1,1(W1)	;EXACT - FOR DIMENSION OF 1 ONLY
	TRZ	F,F10RAY	;NO LONGER REQUIRE F10 INDICATOR
	MOVE	T1,LSTCHR	;RE-INSTATE USERS LAST CHARACTER
	CAMN	W1,SAVLOC	;THE LAST REFERENCE SHOULD BE TO THE SAME ARRAY
	POPJ	P,

	LINE
	TYPE	(%FDTABX )		;WARNING
	PUSHJ	P,TYPRAY	;TYPE THE (SAVLOC) ARRAY NAME
	TYPE( COMPILED ARRAY BOUNDS EXCEEDED)
	POPJ	P,

DMFLSH:	PUSHJ	P,FLUSH		;THE WHOLE SETUP FAILS
	JRST	RET

TYPRAY:	MOVE	T,SAVLOC	;GET THE OFFENDING ARRAY NAME
	TRZ	F,SILENT	;SPEAK-UP
	PUSHJ	P,LOOK		;SHOW THE USER
	  JFCL
	  JFCL
	POPJ	P,
	PAGE
DIM2:	MOVE	T,TEM1		;GET THE SECOND SUBSCRIPT
	CAMGE	T,TEM		;ENSURE THAT IT IS GREATER THAN THE FIRST
	JRST	ERR3		;TELL USER ABAOUT THE ERROR
	SUB	T,TEM		;FIND THE RANGE
	CAIG	T,777777	;CANT HAVE ARRAYS OWNING WHOLE OF CORE
	JRST	DIM3		;SUBSCRIPTS OK
	JRST	ERR27		;BAD SUBSCRIPTS

DIMBAR:	TLOE	F,BAR		;FLAG A BAR IF NOT ALREADY SET
	JRST	BADSYN
	MOVE	T,TEM1		;MOVE FIRST SUBSCRIPT TO APPROPRIATE PALCE
	MOVEM	T,TEM		; IN TEM
	JRST	DIM0		;LOOK FOR SECOND SUBSCRIPT

NXTCHR:	SKIPL	TERMK		;END OF LINE?
	JRST	BADSYN		;YES - SHOULD'T BE
	JUMPN	T1,CPOPJ	;TERMINATOR?
	PJRST	GETSKB		;MOVE TO NEXT SIGNIFICANT CHARACTER

;	DISPLAY ALL ARRAY DATA ENTERED BY USER

DIMOUT:	LINE
;**;[100] conditionalize TOPS10 code @ dimout+1 ma 28-aug-77
ife tops20,<
	SKPINL			;INTERCEPT A USER CONTROL O
	JFCL>			;end of conditional
;**;[100] add native code @ dimout+1 ma 28-aug-77
ifn tops20,<
	push	p,tf		;[100]save tf
	push	p,r		;[100]save r
	hrrzi	tf,.priou	;[100]get terminal output designator
	rfmod			;[100]get terminal JFN word
	tlz	r,(tt%osp)	;[100]clear ^o effects
	hrrzi	tf,.priou	;[100]get terminal output designator
	sfmod			;[100]set new JFN word
	pop	p,r		;[100]restore r
	pop	p,tf>		;[100]restore tf, end of conditional
	LINE
	SKIPN	T3,DIMNAM	;START AT HEAD OF ARRAY NAMES
;**;[100] modify @ dimout+5 ma 27-aug-77
	jrst	[TYPE(NO )
		jrst	.+1]
	TYPE(ARRAY SPECIFICATIONS)
	LINE
	JUMPE	T3,CPOPJ	;EXIT IF NOTHING TO PRINT
	LINE
	TYPE(USED	MAX	ARRAY	DIMENSIONS)
	LINE
	HRRZI	T3,DIMNAM	;START AT HEAD OF ARRAY NAMES
TYPNXT:	HRRZ	T3,(T3)		;FIND NEXT ARRAY REFERENCE
	JUMPE	T3,CPOPJ	;ALL PROCESSED?

	PUSHJ	P,TYPDIM	;NO - TYPE DIMENSIONS
	JRST	TYPNXT		;LOOK FOR MORE
	PAGE
;	TYPE THE DIMENSION LIST FOR THE ARRAY 'PAIR' IN T3

TYPDIM:	PUSH	P,T3		;SAVE T3 ROUND LOOK-UP
	LINE
	HRRZ	T,1(T3)		;GET THE ARRAY NAME VALUE
	MOVEM	T,SAVLOC	;SAVE THE ARRAY REFERENCE
	PUSHJ	P,GET.RP	;GET THE RANGE PRODUCT = DIMTOT
	MOVE	T,DIMTOT	;GET TOTAL ELEMENT COUNT
	PUSHJ	P,TYP0		;AND DISPLAY IT
	TAB
	TYPE([)
	MOVE	T,SAVLOC	;GET THE USER ARRAY NAME
	TRO	F,SILENT!NEARST	;DO NOT PRINT IF EXACT MATCH & FIND NEAREST SYMBOL
	PUSHJ	P,LOOK		;SEE IF THE ARRAY EXISTS
	  JRST	E5		;CANNOT FIND IT!
	  JFCL			;NOT EXACT
				;EXACT MATCH RETURN
	SUB	T,SAVLOC	;REMOVE BASE ARRAY OFFSET
	PUSHJ	P,TYP0		;DISPLAY
;**;[100] modify/insert @ typdim+20 ma 27-aug-77
	type(])
	tab
	SETZM	PUTTER		;RESET FOR RESCAN OF ARRAY'S DIMENSIONS
	MOVE	T,SAVLOC	;GET THE ARRAY NAME VALUE
	TRZ	F,SILENT!NEARST	;TURN OF PRINT SUPRRESS SWITCH & NEAREST
	PUSHJ	P,LOOK		;DO A LOOK UP ON C(T)
	  JFCL			;NOT FOUND
	  JRST	E5		;  OR NOT EXACT??
	TAB
	TYPE([)
DIM10:	PUSHJ	P,GETDIM	;GET THE SUBSCRIPTS FOR THE NEXT DIMENSION IN TEM,TEM1
	MOVE	T,TEM		;GET THE LOWER SUBSCRIPT
	PUSHJ	P,TYP0		;AND TYPE IT
;**;[100] modify @ dim10+3 ma 27-aug-77
	stype("/")
	MOVE	T,TEM1		;GET TUE UPPER SUBSCRIPT
	PUSHJ	P,TYP0		;AND TYPE THAT
	PUSHJ	P,MORDIM	;ANY MORE DIMENSIONS?
	  JRST	DIM20		;NO
;**;[100] modify @ dim10+11 ma 27-aug-77
	stype(</,/>)
	JRST	DIM10		;PROCESS NEXT DIMENSION

DIM20:	TYPE(])
	POP	P,T3		;GET BACK ARRAY REFERENCE
;**;[100] recode routine @ dim20+2 ma 27-aug-77
	TRNE	F,F10RAY	;F10 ORIGINATED?
	jrst	[TYPE( - F10 ORIGINATED)
		jrst	.+1]
	TRNE	F,DOUBLE	;REAL*8
	jrst	[TYPE(  DP)
		jrst	.+1]
	TRNN	F,DOUBLE	;REAL*4
	jrst	[TYPE(  SP)
		jrst	.+1]
	TRNE	F,FORMAL	;ARRAY IS A FORMAL ?
	jrst	[TYPE(  FORMAL)
		jrst	.+1]
	POPJ	P,
	PAGE
;	SUBROUTINE TO SEE IF THERE ARE ANY MORE DIMENSIONS TO COME
;	FOR THE CURRENT ARRAY
;	CALL PUSHJ P,MORDIM
;	     RETURN NO MORE
;	     RETURN MORE TO FOLLOW

MORDIM:	TRNE	F,F10RAY	;F10 DEFINED ARRAY?
	JRST	MORD2		;YES
	SKIPN	T,PUTTER	;EXIT IF PUTTER = 0
	POPJ	P,		;NO MORE TO COME
	HRRZ	T,(T)		;NO MORE IF NEXT IN LINE = 0
	JUMPE	T,CPOPJ		;T WILL BE ZERO IF THIS IS THE LAST DIMENSION
	JRST	CPOPJ1		;MUST BE MORE THERE

MORD2:	SKIPG	DIMCNT		;ANY MORE DIMENSIONS TO COME?
	POPJ	P,		;NO
	JRST	CPOPJ1		;YES


;	ROUTINE TO GET THE RANGE PRODUCT FOR THE ARRAY WHOSE VALUE
;	IS HELD IN SAVLOC.  EXIT WITH DIMTOT = RANGE PROD.

GET.RP:	SETZM	DIMTOT		;CLEAR THE ELEMENT COUNT CELL
	SETZM	PUTTER		;CLEAR FOR NEW SCAN IN GETDIM
DIM11:	PUSHJ	P,GETDIM	;GET THE NEXT SET OF DIMENSIONS FOR THE (SAVLOC) ARRAY
	MOVE	T,TEM1		;GET THE UPPER SUBSCRIPT SU
	SUB	T,TEM		;FORM SU-SL
	AOJ	T,		;FORM SU-SL+1
	SKIPN	DIMTOT		;FIRST TIME IS SPECIAL
	AOS	DIMTOT
	IMULM	T,DIMTOT	;FORM TOTAL SPACE DECLARED FOR THIS ARRAY
	PUSHJ	P,MORDIM	;SEE IF THERE ARE ANY MORE DIMENSIONS
	SKIPA	T,DIMTOT	; NO - ALL DONE
	JRST	DIM11		;YES - BACK FOR MORE

;**; [73] Insert @ DIM11 + 10 1/2 source lines, JMT, 12-Apr-77
	TRNN	TMOD,C.!L.!D.	;[73] IS THIS ARRAY TWO WORDS / ENTRY ?
	TRNE	F,DOUBLE	;IS THIS ARRAY REAL*8
	ADDM	T,DIMTOT	;YES - DOUBLE UP THE RANGE ACCESSED
	POPJ	P,		;WE NOW HAVE THE TRUE SCOPE OF THE ARRAY
	PAGE
;	GROUP LOGIC

GROUP:	JUMPL	F,GRPALL	;DISPLAY ALL GROUPS
	PUSHJ	P,GETNUM	;WHICH GROUP IS THE USER SETTING?
	JUMPLE	T,ERR15		;NOT VALID
	CAILE	T,GPMAX		;GPMAX IS THE MOST HE SHOULD ASK FOR
	JRST	ERR15
	MOVE	T1,OPENED
	MOVEM	T1,GRP2(T)	;THIS GROUP BELONGS TO THIS SECTION
	IMULI	T,CFSIZ		;END OF GROUP AREA
	SKIPL	TERMK
	JRST	[PUSHJ P,GRTYP	;FORGETFULL USER WANTS TO SEE GROUP CONTENTS
		 JRST RET]
	ADD	T,[POINT 7,GRP1-CFSIZ]
	MOVEM	T,CFLPTR	;WHERE TO STORE NEW STRING
	HRRZM	T,CFLST		;GUARD AGAINST OVERFLOW
	MOVE	T,[PUSHJ P,I2CFIL]
	MOVEM	T,GETCHR	;SETUP TTYIN TO READ CORE FILE

GRPMOR:	PUSHJ	P,I2CFIL	;CRAFTY READ AND STORE ROUTINE
	PUSHJ	P,GETSK2	;SET UP ANY DELIMITER FLAGS
	JUMPN	T1,GRPMOR	;IF NO DELIMITERS - DO MORE
	SKIPL	TERMK		;END OF INPUT?
	JRST	RET		; YES - ALL DONE
	JRST	GRPMOR		; NO - DO MORE, WAS A SPACE

;	DISPLAY THE CONTENTS OF THE GROUP WHOSE # IS IN T

GRTYP:	HRRZM	T,T2		;
	ADD	T,[POINT 7,GRP1-CFSIZ]
	MOVE	T1,[ILDB T1,T]
	MOVEM	T1,GETCHR	; INPUT FROM GROUP FILE
GRPNXT:	SETOM	TERMK		;SET UP FOR DELIMETER TEST
	ILDB	T1,T		;GET NEXT CHAR FROM STRING
	PUSHJ	P,GETSK2	;END OF STRING?
	JUMPN	T1,.+2
	MOVEI	T1, " "		;SPACE IS SPECIAL
	SKIPL	TERMK
	POPJ	P,		;YES - IF TERMINAL CHARACTER TERMK +VE
;**;[100] modify @ grpnxt+7 ma 28-aug-77
	putchr	(T1)		;SHOW CHARACTER
	HRRZM	T,T3
	CAIE	T3,GRP1(T2)	;OVERFLO CHECK
	JRST	GRPNXT		;KEEP GOING
	POPJ	P,		;BETTER STOP
	PAGE
;	GROUP STRING CORE STORAGE

GRP1:	REPEAT	GPMAX,<	XWD	050000,0	;NULL GROUP CONTENTS
	BLOCK	CFSIZ-1		;SPACE FOR GROUP STRING
			>


GRP2=.-1
	BLOCK	GPMAX		;PROGRAM NAMES FOR GROUPS
CURGRP:	BLOCK	1		;BITS  TO FLAG CURRENT GROUP STACK
				;IN ORDER TO CATCH RECURSION
	PAGE
;	WHAT LOGIC

WHAT:	LINE
	TYPE(OPEN SECTION: )
	MOVE	T,OPENED
	PUSHJ	P,SPT1		;TYPE NAME OF OPEN SECTION
	LINE
;**;insert @what+5 ma 22-aug-77
	SKIPA	T,[0]		;[77]FLAG DISPLAY OF EVERYTHING
PSEALL:	SETO	T,		;[77]FLAG DISPLAY OF PAUSES ONLY
	PUSH	P,T		;[77]SAVE FLAG
	MOVEI	T,^D10
	MOVEM	T,ODF		;SET RADIX 10 AS STANDARD IN 'WHAT'
	MOVEI	T,B1ADR		;START OF PAUSES
WT10:	SKIPE	(T)
	JRST	WT9		;THERE IS AT LEAST ONE PAUSE SET
	ADDI	T,1		;NO PAUSES SEEN SO FAR
	CAIG	T,BNADR		;ALL PAUSES EXAMINED?
	JRST	WT10		;NO

	LINE
	TYPE(NO PAUSE REQUESTS)
	JRST	WT11

WT9:	LINE
;**;[062] WT9+1 , REPLACE MESSAGE , MD , 6-APR-76
	TYPE(GROUP	AFTER	PAUSE	LOCATED IN)
	LINE
	MOVEI	AR,B1ADR		;GET START OF PAUSES
WT6:	HRRZ	T,(AR)		;GET THE PAUSE ADDRESS
	JUMPE	T,WT5		;OMIT IF NO PAUSE SETTING

;	TYPING OPTION = GROUP

	HLRZ	T,(AR)		;GET THE 'TYPING' OPTION
	JUMPE	T,WT12		;WAS TYPING REQUESTED?
	HLRZ	T,(AR)		;YES - GET GROUP #
	PUSHJ	P,FTOC		;DISPLAY GROUP #

;	PROCEDE SETTING

WT12:	TAB
	MOVE	T,1(AR)		;GET CONDITIONAL SETTING
	JUMPE	T,WT2		;NO CONDITIONALS
;**;[100] modify @ wt12+3 ma 27-aug-77
	stype("N/A")		;NOT APLICABLE DUE TO CONDITIONAL
	JRST	WT13		;DISPLAY GROUP
WT2:	MOVE	T,2(AR)		;GET PROCEDE COUNT
	PUSHJ	P,FTOC		;TYPE THE PROCEDE COUNT
	PAGE
;	PAUSE IDENTIFICATION

WT13:	TAB
	HRRZ	T,(AR)		;GET PAUSE ADDRESS
	JUMPE	T,WT5		;NO PAUSE SET UP HERE
	TLO	F,FGLSNM	;GLOBALS OK
	PUSHJ	P,LOOK		;LOOKUP SYMBOL
	  JRST	E1		;NOT THERE??
	  PUSHJ	P,SPT		;TYPE SUBROUTINE NAME
;**;[062] , WT13+10 , MD , 6-APR-76
	TAB			;[062] ADD PROGRAM NAME WHERE PAUSE IS
	SKIPE	T,PNAMSV	;[062] WAS A PG NAME FOUND?
	PUSHJ	P,SPT1		;[062] YES TYPE IT

;	ANY CONDITIONALS?

	SKIPE	1(AR)		;IS THIS A CONDITIONAL PAUSE?
	JRST	WT14		; YES

WT5:	SKIPE	(AR)
;**;[100] modify @ wt5+1 ma 27-aug-77
	jrst	[LINE
		jrst	.+1]
	ADDI	AR,3		;MOVE ON TO NEXT PAUSE
	CAIG	AR,BNADR	;DONE ALL PAUSES?
	JRST	WT6		;NO - BACK FOR MORE
	JRST	WT11		;FINISHED PAUSE DISPLAY - DO GROUPS


;	TYPE PARAMETERS OF CONDITIONAL PAUSE

WT14:	TAB
	TYPE(IF )
	HRRZ	T1,AR		;GET CURRENT PAUSE ADDRESS
	SUBI	T1,B1ADR	;REMOVE OFFSETT
	IDIVI	T1,3		;FORM PAUSE#
	LSH	T1,2		;FORM INDEX TO TESTAB
	MOVEM	T1,WT16		;SAVE T1 TEMPORARILY
	MOVE	T,TESTAB+1(T1)	;GET FIRST ARG ADDRESS
	CAIN	T,TESTAB+3(T1)	;IS IT A CONSTANT?
	JRST	[MOVE  T,(T)	;YES
		 PUSHJ P,TFLOT	;TYPE FLOATING
		 JRST  WT15]
;**;[063],WT14+12,INSERT,MD,APR-76
	CLEARM	SAVLOC		;[063] USER DIDNT GIVE ANY INFO!
	CLEARM	SECSAV		;[063] CLEAR SAVED NAME OF SECTION
	PUSHJ	P,OFFSET	;TYPE THE ARGUMENT NAME
	  JRST	E1		;NAME NOT FOUND?
WT15:	MOVE	T1,WT16		;RE-INSTATE T1
	MOVE	T,TESTAB(T1)	;GET CONDITIONAL TYPE
	TYPE( .)
;**;[100] modify @ wt15+3 ma 27-aug-77
	atype(TYPTST(T))	;TYPE THE CONDITION
	MOVE	T,TESTAB+2(T1)	;GET SECOND ARG ADDRESS
	CAIN	T,TESTAB+3(T1)	;IS THIS A CONSTANT?
	JRST	[MOVE  T,(T)	;YES -
		 PUSHJ P,TFLOT	;TYPE FLOATING
		 JRST  WT5]
;**;[063],WT15+7,INSERT,MD,APR-76
	CLEARM	SAVLOC		;[063] USER DIDNT GIVE ANY INFO!
	CLEARM	SECSAV		;[063] CLEAR SAVED NAME OF SECTION
	PUSHJ	P,OFFSET	;DISPLAY THE SECOND ARGUMENT NAME
	  JRST	E1		;NAME NOT FOUND
	JRST	WT5		;RETURN FOR NEXT PAUSE
	PAGE
TYPTST:	ASCIZ/LT. /
	ASCIZ/LE. /
	ASCIZ/EQ. /
	ASCIZ/NE. /
	ASCIZ/GT. /
	ASCIZ/GE. /

WT16:	0

;	GROUP SETTINGS

WT11:	LINE
;**;[77]insert @wt11+1 ma 22-aug-77
	POP	P,T		;[77]GET DISPLAY FLAG BACK
	JUMPL	T,RET		;[77]DONE IF FLAG IS SET
	PUSHJ	P,GROUPS	;DISPLAY THE USERS GROUP SETTINGS
	PUSHJ	P,DIMOUT	;DISPLAY ANY USER DEFINED ARRAY SPECS.
	LINE
	JRST	RET		;END OF WHAT


;	PUSHJ P,GRPALL TO TYPE ALL GROUP SETTINGS

GRPALL:	PUSHJ	P,GROUPS
	JRST	RET

GROUPS:	MOVEI	AR,GPMAX	;CHECK IF ANY ARE USED

GROU1:	SKIPE	GRP2(AR)	;USED?
	JRST	GROU2		;YES
	SOJG	AR,GROU1	;NO, TRY NEXT
	LINE
	TYPE	(NO GROUP SPECIFICATIONS)
	POPJ	P,

GROU2:	MOVEI	AR,1		;SET UP FOR FIRST GROUP
	JRST	WT7.5		;

WT7:	SKIPN	GRP2(AR)	;THIS ONE USED?
	JRST	WT7.3		;NO - IGNORE IT
	LINE
	TLO	F,CFLIU!OFCFL	;MAKE REQUEST FOR CORE FILE USE
	TYPE(GROUP )
	MOVE	T,AR
	MOVEI	ODF,12		;DECIMAL BASE FOR GROUP NUMBERS
	PUSHJ	P,FTOC		;TYPE GROUP #
;**;[100] insert/modify @ wt7+10 ma 27-aug-77
	type(:)
	tab
	MOVEI	T,(AR)		;GET GROUP # BACK
	IMULI	T,CFSIZ		;POINT TO ACTUAL LOCATION OF GROUP START
	PUSHJ	P,GRTYP		;DISPLAY GROUP CONTENTS
WT7.3:	ADDI	AR,1		;BUMP GROUP NUMBER
WT7.5:	CAIG	AR,GPMAX	;DONE ALL GROUPS?
	JRST	WT7		;NO - BACK FOR MORE

WT8:	TLZ	F,CFLIU!OFCFL	;REMOVE DANGEROUS FLAGS
	POPJ	P,		;
	PAGE
;	NEXT LOGIC - STEPS THROUGH SOURCE LINE STATEMENTS(S)
;			OR LABELS(L) OR SUBROUTINE ENTRIES(E)

NEXT:	JUMPL	F,STEP2		;NO ARGUMENTS USES DEFAULTS
	PUSHJ	P,EITHER	;ACCEPT EITHER A NUMERIC OR VARIABLE
	  CAIA			;NUMERIC
	MOVE	T,(T)		;GET VARIABLE CONTENTS
	JUMPE	T,.+2		;ZERO = LAST VALUE SUPPLIED
	MOVEM	T,STPVAL	;STORE THE NEW STEP VALUE
	CAIE	T1,"/"		;TRACE OPTION FOLLOWS?
	JRST	STEP2		;NO SWITCHES
	PUSHJ	P,OPTION	;FIND WHICH
	JRST	BADSYN		;NO GROUP REQUESTS HERE
	TRNN	TMOD,L.!S.!E.	;ANY TRACE OPTIONS SELECTED?
	JRST	STEP2		;NO JUST 'NEXT'
	TRZ	F,TRLABL!TRLINE	;FIRST RESET THE TRACE FLAGS
	TRZE	TMOD,L.		;DO WE TRACE LINES?
	TRO	F,TRLINE	;YES
	TRZE	TMOD,S.		;DO WE TRACE LABELS?
	TRO	F,TRLABL	;YES
STEP2:	MOVEM	F,STKYFL	;RECORD THE STICKY FLAGS
	MOVE	T,STPVAL	;GET THE STEP VALUE
	MOVEM	T,STPCNT	;AND SET UP THE STEP COUNT
	MOVE	T,[PUSHJ P,STEP4]	;PREPARE TO SET UP THE TRACE FEATURE
	MOVEM	T,FDDT.		;LIKE-SO
	HRRZ	T,STARTU	;HAS A 'START' BEEN DONE
	JUMPE	T,START2	;SIMULATE A START WITH TRACE ON
	SKIPE	T,JOBOPC	;WAS A RE-ENTER THE LAST ACTION
	JRST	CONT2		;YES - PROCEED FROM THERE
	JRST	PROCED		; NO - DO A NORMAL CONTINUE

;	THIS IS THE ENTRY POINT FOR TRACING EACH SOURCE LINE OR LABEL

STEP4:	JSR	SAVE		;SAVE THE USERS ACS
	PUSHJ	P,REMOVB	;AND REMOVE THE PAUSES
	HRRZ	T,AC17		;GET THE FORTRAN PDL POINTER TO FIND THE PUSHJ
	HRRZ	T,(T)		;FIND WHERE WE ARE TRACING
	SOJ	T,		;P.C. = STOPS ONE ON
	MOVEM	T,BCOM		;SET UP FOR RE.BRK
	SETZM	SYM		;ACCEPT FIRST SYMBOL FOUND IN 'LOOK'UP
	SETOM	ESCAPE		;ALLOW ESCAPES
	TRO	F,SILENT	;RIG FOR SILENT RUNNING
	TLO	F,FGLSNM	;GLOBALS ARE OK
	PUSHJ	P,LOOK		;'LOOK'-UP THE INTERCEPT
	  JRST	E7		;JUST HAS TO BE THERE
	  JRST	E7		;     AN OFFSET IS EVEN WORSE
	PUSHJ	P,STEP11	;OPEN AND NAME SECTION IF NEW
	TRNN	F,TRLINE!TRLABL	;REQUESTED TO TRACE ENTRIES ONLY?
	JRST	STEP7		;YES
	PAGE
STEP13:	MOVEM	W1,W2		;SAVE THE NOW RECOGNISED SYMBOL(LINE)
	MOVE	T,TRUFST	;GET THE LAST CHARACTER OF THE LABEL
	CAIN	T,32		;"P"?
	TRNN	F,TRLABL	;AND TRACING LABELS?
	CAIA
	JRST	STEP5		;YES - OK
	TRNN	F,TRLINE	;ARE WE TRACING LINES?
	JRST	STEP7		;NO - IGNORE


;	PREPARE TO TYPE NEXT LABEL OR LINE

STEP5:	SOSG	TABCNT		;COUNT UP TO 8 LABELS PER LINE
;**;[100] modify @ step5+1 ma 27-aug-77
	JRST	[line
		 MOVEI	T,10	;SET FOR 8 LABELS/LINE
		 MOVEM	T,TABCNT	;RECORD IN TABCNT
		 JRST	.+1]

	TAB
	MOVE	W1,W2		;GET BACK THE NEW FOUND SOURCE LINE
	PUSHJ	P,SPT		;AND PROUDLY DISPLAY IT
	SKIPL	STPCNT		;SKIP IF AN INFINITE TRACE
	JRST	STEP6		;OTHERWISE GO COUNT DOWN STPCNT


;	HERE BEGINS THE EXIT

STEP7:	PUSHJ	P,LISTEN	;HAS THE USER HAD ENOUGH
	CAIA			;NO
	JRST	STEP8		;ENOUGH - ENOUGH
	PUSHJ	P,INSRTB	;REPLACE PAUSES
	JSP	T,RESTORE	;RESTORE FORTRAN ACS
	POPJ	P,		;RETURN THE WAY WE CAME IN

;	TRACE COUNT EXHAUSTED?

STEP6:	SOSE	STPCNT		;DECREMENT THE STEP COUNT
	JRST	STEP7		;MORE TO DO - SEE IF THE USER INTERCEPTS

;	TRAP TO USER COMMAND LEVEL

STEP8:	MOVEI	T,[POPJ	P,]	;MAKE SURE WE DO A POPJ RETURN
	MOVEM	T,LEAV		;PLACE IT IN THE LEAVE LOCATION
	HRRM	T,PROC0		;TO MAKE SURE WE DO A POPJ RETURN TO FORTRAN
	JRST	RET		;NORMAL WORKING
	PAGE
;	XCT REFFERENCE FOUND BUT NOT 'P' OR 'L'

STEP12:	TRZN	TF,GUDLBL	;DID WE FIND A GOOD NUMERIC LABEL?
	JRST	STEP7		;NO  - THEN IT MUST BE A SUBROUTINE
	MOVE	T,BCOM		;WHAT ARE WE 'LOOK'ING FOR
	TRO	F,SILENT	;SILENCE AGAIN
	PUSHJ	P,RELOOK	;REFFERENCE DID NOT POINT TO A KNOWN LINE#
	  JRST	E7		;CAN'T FIND A PROPPER REFFERENCE?
	  JRST	E7		;THERE REALLY SHOULD BE SOMETHING THERE
	JRST	STEP13		;VALIDATE THIS ONE THEN


;	ROUTINE TO TYPE OUT NEW SECTION NAME

STEP11:	PUSHJ	P,SAV2AC	;SAVES T & W1
	PUSHJ	P,OVRLAY	;LOOK FOR AND TELL WHERE & IF AN OVERLAY HAPPENED
	MOVE	T,PNAMSV	;WHAT WAS THE SECTION IN WHICH IT WAS FOUND
	CAMN	T,OPENED	;DO WE ALREADY NOW ABOUT IT
	POPJ	P,		;YES JUST EXIT - AND RESET T,W1
	MOVEM	T,SYM		;SET UP FOR SETNAM
	PUSHJ	P,SETNAM	;AND OPEN THIS SECTION FOR EFFICIENT SEARCHES
	LINE
;**;[100] modify @ step11+10 ma 27-aug-77
	type([)
	PUSHJ	P,SPT1		;DISPLAY THE SECTION NAME
;**;[100] insert/modify @ step11+12 ma 27-aug-77
	type(])
	tab
	TRNN	F,TRLINE!TRLABL	;ARE WE TRACING ENTRIES?
	JRST	STEP6		;YES - COUNT THEM - RET: RESETS PDL
	SETZM	TABCNT		;PRODUCE A PRETTY PRINT OF 8 LABELS/LINE
	POPJ	P,		;RESET T,W1
	PAGE
;	Q LOGIC

Q:	LINE
	JUMPL	F,BADSYN	;MUST HAVE AN ARGUMENT
	TRO	TF,DCEVAL	;DON'T CALL EVAL
	PUSHJ	P,SYMIN		;GET A SYMBOL REFERENCE
	 TRZ	F,ID		;SYMBOL FOUND FLAG
	SKIPGE	R,.JBSYM	;FIRST CHECK LOSEG TABLE
	JRST	QLIST1
QLIST0:	PUSHJ	P,GHSSYP	;NOW TRY HISEG TBL
	  JRST	QLIST9		;DONE
	MOVE	R,TT		;GET LIST
QLIST1:	SETZM	QLPNT		;ZERO FLAG SHOWING REFERENCE

QLIST2:	PUSHJ	P,FIXSYR	;UPDATE PTR
	MOVE	T,(R)		;PICK UP SYMBOL
	JUMPE	T,QLIST3
	TLZN	T,PNAME		;A PROGRAM NAME?
	JRST	QLIST6		;YES
	CAMN	T,SYM		;NO, IS AN OCCURANCE FOUND?
	HRRZM	R,QLPNT		;YES, REMEMBER WHERE

QLIST3:	ADD	R,[XWD 2,2]	;POINT TO NEXT ENTRY
	JUMPL	R,QLIST2	;AND GO IF MORE
	TRNN	R,1B18		;TABLE EXHAUSTED - LOSEG?
	JRST	QLIST0		;YES - TRY HISEG
QLIST9:	TRZE	F,ID		;ANY FOUND
	JRST	RET		;DONE
	JRST	ERR6		;NO - ERROR

QLIST6:	SKIPN	QLPNT		;FOUND THE SYMBOL?
	JRST	QLIST3		;NO
	TRO	F,ID
	PUSHJ	P,SPT1		;YES, PRINT THE PROGRAM NAME
	MOVE	T,@QLPNT	;GET THE SYMBOL BACK AND
	TLNE	T,GLOBAL	; TEST FOR A GLOBAL SYMBOL
	JRST	QLIST8		; THIS IS A GLOBAL SYMBOL
QLIST7:	TYPE(	)
	SETZM	QLPNT		;RESET FLAG
	JRST	QLIST3		; AND SEARCH THE NEXT SET OF SYMBOLS

;**;[100] insert/modify @ qlist8 ma 27-aug-77
QLIST8:	type( )
	openp
	MOVE	T,SYM		;PREPARE TO -
	PUSHJ	P,SPT1		; PRINT THE SYMBOL
;**;[100] insert/modify @ qlist8+4 ma 27-aug-77
	type( IS GLOBAL)
	closep
	JRST	QLIST7		;LOOK FOR MORE - SHOULD BE NONE
	PAGE
;	MODE CHANGE LOGIC

MODE:	JUMPL	F,MODRET	;'MODE' ALONE - MEANS RESUME STANDARD SETTING
	SETZI	W1,		;NO  - PREPARE FOR A MODE CHANGE
MODNXT:	PUSHJ	P,TTYIN		;GET AN ARGUMENT FROM USER
	JUMPE	T2,BADSYN
	LDB	T2,[POINT 6,T2,5]	;GET FIRST CHARACTER OF USERS ARGUMENT
	CAIN	T2,'F'
	JRST	[TRO	W1,F.
		 JRST	MODMOR]
	CAIN	T2,'D'
	JRST	[TRO	W1,D.
		 JRST	MODMOR]
	CAIN	T2,'I'
	JRST	[TRO	W1,I.
		 JRST	MODMOR]
	CAIN	T2,'O'
	JRST	[TRO	W1,O.
		 JRST	MODMOR]
	CAIN	T2,'R'
	JRST	[TRO	W1,R.
		 JRST	MODMOR]
	CAIN	T2,'C'
	JRST	[TRO	W1,C.
		 JRST	MODMOR]
	CAIE	T2,'A'
	JRST	BADSYN
	TRO	W1,A.

MODMOR:	SKIPL	TERMK
	JRST	MODSET		;END OF USER LINE SET MODES

	JUMPE	T1,MODNXT	;SPACE IS A DELIMITER
	CAIE	T1,","		;COMMA IS THE ONLY ARG SEPARATOR
	JRST	BADSYN
	JRST	MODNXT		;GET MORE ARGUMENTS

MODSET:	MOVEM	W1,MODFLG	;SAVE USERS DEFAULT TYPE OPTIONS
	JRST	RET		;END OF MODE CHANGE
	PAGE
SUBTTL SYMBOL TABLE LOGIC

;	SYMBOL EVALUATION ROUTINE - EVALUATES THE SYMBOL IN SYM

EVAL:	MOVEI	R,SYM		;CHECK SYM
	PUSHJ	P,TRUVAR	;LABEL OR STATEMENT #?
	  TROA	TF,SYMLAB	;YES
	TRZ	TF,SYMLAB
	TRZE	TF,FGLONL	;LOOKING FOR GLOBALS ONLY?
	TRNE	TF,SYMLAB	;AND THIS IS NOT A LABEL?
	CAIA
	JRST	EVAL1		;YES
	TLO	F,FLCLNM	; FIND LOCAL NAME
	PUSHJ	P,FNDSYM	;
	 CAIA
	JRST	EVAL2		; FOUND
	TRNE	TF,SYMLAB	;IS IT A LABEL?
	 POPJ	P,		;YES - FAIL
	MOVSI	R,LOCAL		;YES, LOOK FOR OUTSIDE LOCALS
EVAL0:	TLO	F,FGLSNM	;THROUGH THE WHOLE TABLE
	MOVEM	R,SYMASK	;
	PUSHJ	P,FNDSYM
	 POPJ	P,		; FAIL

EVAL2:	HRRZM	R,SYMSAV	;ALWAYS SAVE POINTER
	MOVE	W1,R		;
	MOVE	W2,1(R)
	SKIPA	T,1(R)		;GET VALUE OF SYMBOL
CPOPJ2:	AOS	(P)		;SKIP TWICE
CPOPJ1:	AOS	(P)		;FOUND SYMBOL, SKIP
	TLZ	F,FGLSNM	;KILL FLAG
CPOPJ:	POPJ	P,


EVAL1:	MOVSI	R,GLOBAL	;GLOBALS ONLY
	JRST	EVAL0		;GO
	PAGE
;  GHSSYP LOOKS TO SEE IF THERE IS A HISEG FOR THIS CORE IMAGE;  IF
;SO, IT GETS THE POINTER TO THE HISEG SYMBOL TABLE IN T.  THERE IS
;A SKIP RETURN ON SUCCESS.
;
; AC'S USED:  R, T



GHSSYP:	SKIPN	.JBHRL		; ANY HISEG?
	POPJ	P,		; NO - FAIL
	PUSHJ	P,GSTAH		;GET START ADDR OF HISEG
	MOVE	TT, .JBHSM(R)	;GET HISEG SYMBOL TABLE PTR
	JUMPE	TT,CPOPJ	;FAIL IF NO TBL
	JRST	CPOPJ1		;OK


;	GET HISEG START ADDRESS IN (R)

;**;[100] conditionalize TOPS10 code @ gstah ma 25-aug-77
ife tops20,<
GSTAH:	MOVE	R,[XWD -1,.GTSGN]
	GETTAB	R,		; GET HISEG INDEX
	 HALT	.		; *****
	HRLZI	R, (R)		; GET INDEX
	HRRI	R,.GTUPM
	GETTAB	R,		; GET HISEG START
	 HRLZI	R,400000	;PRE-507 MONITOR - FUDGE VALUE
	HLRZ	R,R
	POPJ	P,>		;[100]end of conditional
;**;[100] add native code @ gstah ma 25-aug-77
ifn tops20,<
gstah:	move	r,.jbhso	;[100]get page of high segment
	lsh	r,11		;[100]get address of high segment
	popj	p,>		;[100]return,end of conditional
	PAGE
;THIS ROUTINE SETS UP IGNORE LISTS FOR SYMBOL TABLE LOOKUPS.

SETLST:	MOVEI	AR,0		;COUNT
	SKIPN	R,.JBSYM	;LOSEG FIRST
	CAIA
	PUSHJ	P,SETL		;SET UP THAT PART
	PUSHJ	P,GHSSYP	;NOW THE HISEG TABLE
	 POPJ	P,		;NONE

SETL:	MOVE	W2,(R)		;GET NEXT ENTRY
	TLNN	W2,PNAME	;PRIG NAME?
	JRST	SETL1		;YES
SETL0:	ADD	R,[2,,2]	;NO
	JUMPL	R,SETL		;CHECK NEXT
	POPJ	P,		;DONE

SETL1:	CAME	W2,[SQUOZE 0,UDDT]	;IGNORE THESE PROGRAMS
	CAMN	W2,[SQUOZE 0,FORDDT]
	JRST	SETL2
	CAME	W2,[SQUOZE 0,JOBDAT]
	JRST	SETL0		;NO

SETL2:	HLRE	T2,1(R)		;GET THE -LENGTH
	ADDI	T2,2(R)		;BEG OF SYMBOLS FOR PROGRAM
	HRRZM	T2,SYMLST(AR)	;
	HLRE	T2,1(R)
	MOVM	T2,T2		;GET LENGTH
	HRLM	T2,SYMLST(AR)	;SAVE THAT TOO
	AOJA	AR,SETL0	;NEXT


;FIX (R) AS PTR TO SYMBOL TABLE.

FIXSYR:	MOVEI	W2,(R)		;GET ADDR POINTED TO
	MOVEI	TT,PSYLST-1	;GET # OF IGNORED PROGRAMS

FIXS1:	HRRZ	T3,SYMLST(TT)	;NEXT LOCATION
	CAIN	T3,(W2)		;PART OF AN IGNORED PROG?
	JRST	FIXS2
	SOJGE	TT,FIXS1	;NO - TRY NEXT
	POPJ	P,		;NONE - LET IT GO

FIXS2:	HLRZ	T3,SYMLST(TT)	;GET LENGTH OF IGNORED SYMBOLS
	HLL	T3,SYMLST(TT)	;LENGTH,,LENGTH
	ADD	R,T3		;UPDATE PTR
	POPJ	P,		;DONE


SYMLST:	BLOCK	5		;# OF POSSIBLE PROGRAMS TO IGNORE (CONSERVATIVE)
PSYLST==.-SYMLST		;LENGTH
	PAGE
;FNDSYM:  FIND A SYMBOL IN THE SYMBOL TABLE.  ACCORDING TO THE FOLLOWING
;BITS:		FPRNM - FIND PROGRAM NAME
;		FLCLNM - FIND LOCAL NAME
;		FGLSNM - FIND GLOBAL (ANYWHERE IN TABLE)  (SYMASK CONTROLS
;			    THE TYPES OF SYMBOLS ALLOWED)
;
;  THE SYMBOL (IN RADIX50) IS GIVEN IN SYM, AC R IS LEFT POINTING TO
;THE ENTRY THAT MATCHED.


FNDSYM:	SETZI	W1,
	TLZN	F,FPRNM		;LOOK FOR PROGRAM NAME?
	JRST	FNDS3		;NO
	MOVE	R,.JBSYM	; CHECK LOSEG TABLE FIRST
	MOVEM	R,OJBSYM
	PUSHJ	P,FINDS		; TRY
	 CAIA			; NO GOOD
	JRST	CPOPJ1
	PUSHJ	P,GHSSYP	;GET HISEG SYM TBL PTR
	 POPJ	P,		;FAIL
	MOVEM	TT,OJBSYM
	JRST	FINDS		;TRY

FNDS3:	TLZN	F,FLCLNM	;LOOKING FOR A LOCAL?
	JRST	FNDS5		;NO
	SKIPN	R,OPENLS	; YES - GET PROG SYM LIST
	 POPJ	P,		;NO PROGRAM OPENED, OR NO SYMS FOR PROG

FNDS4:	MOVE	W,(R)		;GET NEXT SYM
	TLNN	W,PNAME		;PROGRAM NAME?
	JRST	FNDS45		;YES - IGNORE
	TLZ	W,LOCAL		;LOCALS ONLY
	CAMN	W,SYM		;FOUND?
	JRST	FNDS9		;YES
FNDS45:	ADD	R,[XWD 2,2]	; NO, UPDATE PTR
	JUMPL	R,FNDS4
	POPJ	P,		;NOT FOUND

FNDS5:	TLZN	F,FGLSNM	;LOOKING FOR A GLOBAL?
	 JRST	E9		;ERROR - NO SPEC
	MOVE	R,.JBSYM
	JUMPE	R,FNDS6
	PUSHJ	P,FNDS7		;LOOK FOR SYM IN LOSEG SYM TABLE
	 CAIA			;N.G.
	JRST	FNDS9		;FOUND IT - SET T
FNDS6:	PUSHJ	P,GHSSYP	;GET HISEG SYM TABLE PTR
	 POPJ	P,		;
	JUMPE	TT,CPOPJ	;
	MOVE	R,TT
	PAGE
FNDS7:	PUSHJ	P,FIXSYR	;FIX PTR IN (R)
	MOVE	W,(R)		;GET NEXT SYM
	TLNN	W,PNAME		;PROGRAM NAME?
	JRST	FNDS8		;YES - IGNORE
	TDZ	W,SYMASK	;CLEAR LEGAL BITS
	CAMN	W,SYM		;MATCH?
	JRST	FNDS11		;YES
FNDS8:	ADD	R,[XWD 2,2]
	JUMPL	R,FNDS7		;TRY NEXT
	JUMPE	W1,CPOPJ	;FAIL IF NOTHING FOUND
	SKIPA	R,W1		;USE LOC OF MATCH

FNDS10:	SKIPA	T,(R)		;GET VALUE (FOR FINDS)
FNDS9:	MOVE	T,1(R)		;GET VALUE OF SYMBOL
	JRST	CPOPJ1		;SUCCESS

FNDS11:	MOVE	W,(R)		;GET SYMBOL
	TLNE	W,GLOBAL	;GLOBAL?
	JRST	FNDS9		;YES - USE IT
	JUMPN	W1,FNDS12	;MATCH ALREADY?
	MOVE	W1,R		;NO - MARK THIS ONE
	JRST	FNDS8		;GO AHEAD
FNDS12:	TRO	F,MDLCLF	;MULT. DEF.
	POPJ	P,		;FAIL




;  THIS ROUTINE SEARCHES THE SYMBOL TABLE IN A BACKWARDS DIRECTION
;LOOKING ONLY FOR PROGRAM NAMES.

FINDS:	HLRE	R,OJBSYM	; GET -# OF ENTRIES
	JUMPE	R,CPOPJ		;IGNORE IF TABLE EMPTY
	MOVM	R,R
	ADD	R,OJBSYM	;POINTER TO END OF TABLE
	MOVEI	R,-1(R)

FNDS1:	MOVE	W,-1(R)		;GET NEXT PROG NAME
	CAMN	W,SYM		;IS THIS IT?
	JRST	FNDS10		;YES
	HLRE	W,(R)		; NO, GET LEN OF SYMBOLS
	ADD	R,W		;POINT TO PREVIOUS PROG
	HRRZ	W,OJBSYM
	CAIL	W,-3(R)		;DONE?
	POPJ	P,		;YES - NO FOUND
	JRST	FNDS1		; NO - TRY NEXT
	PAGE
SUBTTL	ENTER AND LEAVE FORDDT LOGIC

;	SAVE THE ACS AND PI SYSTEM

SAVE:	0			;SAVE THE ACS AND PI SYSTEM
	SKIPN	SARS
	JRST	SAV1
	AOS	SAVE
	JRST	SAV5
SAV1:	MOVEM	17,AC17
	HRRZI	17,AC0
	BLT	17,AC0+16
	MOVE	T, SAVE
	HLLM	T, SAVPI
	SETPDL

SAV5:	MOVE	F,STKYFL	;INIT THE FLAG REGISTER
	SETOM	SARS		;FLAG PROTECTING SAVED REGISTERS
	SETPDL
	JRST	@SAVE


;	RESTORE ACS AND PI SYSTEM

RESTOR:	HRRM	T,SAVE
	MOVE	T,SAVPI
	TLZ	T,010037	;DON'T TRY TO RESTORE USER MODE FLAG
	HLLM	T, SAVE
	HRLZI	17,AC0
	BLT	17,17
	SETZM	SARS
	JRST	2,@SAVE
	PAGE
;	PAUSE LOGIC



BP1:	XLIST			;TABLE FOR ENTRY FROM BREAKPOINTS
	REPEAT	NBP,<	0	;JSR TO HERE FOR A PAUSE
	JSA	T, BCOM
	0		;HOLDS INSTRUCTION WHILE PAUSE IS IN PLACE>
	LIST


B1INS=BP1+2
BPN=.-3




;	CONDITIONAL LOGIC

TESTAB:	XLIST
	REPEAT	NBP,<	0	;NUMBER OF TEST
	0	;ADDRESS OF ARG1
	0	;ADDRESS OF ARG2
	0	;CONSTANT VALUE>
	LIST
	PAGE
COMPAR:	CAML	T2,T3
	CAMLE	T2,T3
	CAME	T2,T3
	CAMN	T2,T3
	CAMG	T2,T3
	CAMGE	T2,T3
COND:	0
	JSR	CONSAV		;SAVE RELEVANT REGS
	AOS	COND		;PREPARE FOR SKIP RETURNS
	HRRZ	T,BCOM3
	SUBI	T,B1ADR+1
	IDIVI	T,3
	LSH	T,2
	MOVE	T1,TESTAB(T)
	MOVE	T2,@TESTAB+1(T)
	MOVE	T3,@TESTAB+2(T)
	XCT	COMPAR(T1)
	AOS	COND
	JSR	CONSAV		;REINSTATE USERS ACS
	JRST	@COND

CONSAV:	0
	EXCH	T,CONSV0
	EXCH	T1,CONSV1
	EXCH	T2,CONSV2
	EXCH	T3,CONSV3
	JRST	@CONSAV

CONSV0:	Z
CONSV1:	Z
CONSV2:	Z
CONSV3:	Z
	PAGE
BCOM:	0
	POP	T,LEAV		;MOVE INSTRUCTION TO LEAV
	MOVEI	T,B1SKP-B1INS+1(T)
	HRRM	T,BCOM3		;CONDITIONAL BREAK SETUP
	MOVEI	T,B1CNT-B1SKP(T)
	HRRM	T,BCOM2		;PROCEDE COUNTER SETUP
	MOVE	T,BP1-B1CNT(T)	;GET PC WORD
	HLLM	T,LEAV1		;SAVE FLAGS FOR RESTORING
	EXCH	T,BCOM		; ALSO SAVE PC WORD IN BCOM

BCOM3:	SKIPE	B1SKP		;ADDR MOD TO LOOK AT COND. INST.
	XCT	@.-1
BCOM2:	SOSG	B1CNT		;ADDR MOD TO LOOK AT PROCEED COUNTER
	JRST	BREAK

	MOVEM	T,AC0+T
	HRRZ	T,BCOM3		;ADDRESS OF CONDITIONAL
	HLRZ	T,-1(T)		;SEE IF A 'TYPING' REQUESTED
	JUMPN	T,BCOM1		;'TYPING' REQUESTED
	LDB	T,[POINT 9,LEAV,8]	;GET INSTRUCTION
	CAIL	T,264		;JSR
	CAILE	T,266		;JSA,JSP
	TRNN	T,700		;UUO
	JRST	PROC1		;MUST BE INTERPRETED
	CAIE	T,260		;PUSHJ
	CAIN	T,256		;XCT
	JRST	PROC1		;MUST BE INTERPRETED
	MOVE	T,AC0+T
	JRST	2,@LEAV1	;RESTORE FLAGS, GO TO LEAV

LEAV1:	XWD	0,LEAV

BCOM1:	MOVE	T,AC0+T		;RESTORE T
	JSR	SAVE		;SAVE ACS
	PUSHJ	P,LISTEN	;DID THE DOOR BELL RING?
	JRST	BREAK3		;NO - THIS IS NOT A TRUE BREAK
	CAIA			;YES - LETS STOP HERE

BREAK:	JSR	SAVE		;SAVE THE WORLD
	TLO	F,AUTO		;SIGNAL THAT THIS WAS A TRUE BREAK
BREAK3:	PUSHJ	P,REMOVB	;REMOVE BREAKPOINTS
	SETZM	MATHSM		;CLEAR SPECIFIC SYMBOL LOOKUP FLAG
	SETOM	ESCAPE		;USER ENVIRONMENT PROTECTED ALLOW ESCAPES
	PUSHJ	P,TTYCLR	;FLUSH WAITING TTY CHARACTERS FOR INPUT
	PUSHJ	P,FORBUF	;LET FOROTS CLEAR ITS BUFFER
	SOS	T,BCOM3
	HRRZS	T		;GET ADR OF CONDITIONAL BREAK INST
	SUBI	T,B1ADR-3	;CHANGE TO ADDRESS OF $0B
	IDIVI	T,3		;QUOTIENT IS BREAK POINT NUMBER
	HRRM	T,BREAK2	;SAVE BREAK POINT #
	PAGE
;NOW DISPLAY BREAK INFORMATION

	SETZI	TF,		;
	LINE
	TYPE(PAUSE AT )		;ANNOUNCE BREAK POINT
	MOVE	T,BCOM
	HLLM	T, SAVPI	;SAVE PROCESSOR FLAGS
	MOVEI	T,-1(T)
	ANDI	T,-1		;ADDRESS PORTION ONLY THANK YOU
	TRO	F,SILENT	;SILENCE
	TLO	F,FGLSNM	;GLOBALS ARE OK
	PUSHJ	P,LOOK		;TYPE PC AT BREAK
	  JRST	E2		;NO NAME?
	  JRST	E2		;OFFSET?
	MOVE	T,(R)		;GET SYMBOL
	TLNE	T,GLOBAL	;GLOBAL?
	JRST	BREAK6		;YES - THIS IMPLIES A ROUTINE
	PUSHJ	P,SPT1		;NO, SO PRINT IT
	TYPE( IN )
	MOVE	T,PNAMSV	;GET NAME OF SYMBOL'S SECTION
	MOVEM	T,SYM		;SAVE IT
	PUSHJ	P,SPT1		;AND TYPE IT
	MOVE	T,PNAMSV
	CAME	T,OPENED	;THIS PROGRAM OPENED?
	JRST	BREAK7		;NO - DO IT

BREAK4:	LINE
	HRRZ	T,@BCOM3
	HRRM	T,PROC0		;SETUP ADDRESS OF BREAK
	HLRZ	T,@BCOM3
	JUMPE	T,BREAK1	;TEST FOR REGISTER TO EXAMINE
	MOVE	TMOD,MODFLG	;REMEMBER TO SET UP THE PRINT FLAGS
	TLO	F,GRPFL!CFLIU!OFCFL	;WE WANT TO ALLOW GROUP LOGIC HERE
	SETZM	TERMK
	PUSHJ	P,SYM5		;DISPLAY USERS GROUP IN 'TYPING' REQUEST
	PUSHJ	P,REINOP	;RE-OPEN PROG
	TLZ	F,GRPFL!CFLIU!OFCFL	;REMOVE FLAG, IT MAY CAUSE TROUBLE

BREAK1:	MOVSI	S,400000
BREAK2:	ROT	S,.-.		;ROT BY # OF BREAK POINT
	TLZE	F,AUTO		;DO WE HAVE A TRUE BREAK CONDITION?
	ANDCAM	S,AUTOPI	;YES - END OF 'TYPING' LOGIC
	TDNN	S,AUTOPI	;DONT PROCEED IF NOT AUTOMATIC
	JRST	RET		;DONT PROCEED
	JRST	PROCD1

BREAK6:	MOVEM	R,SAVLOC	;NAME OR ROUTINE
	TYPE	(ROUTINE )
	PUSHJ	P,SPT		;TYPE ROUTINE NAME
	PUSHJ	P,GETARG	;DISPLAY ANY ARGS
	MOVE	T,PNAMSV	;GET PROGRAM NAME
BREAK7:	MOVEM	T,SYM		;SAVE IT
	PUSHJ	P,IMPOPN	;AND OPEN IT
	JRST	BREAK4
	PAGE
PROCED:	MOVEI	T,1		;SET UP FOR PROCEDE OF 1
	SKIPG	@BCOM2		;DO NOT CHANGE VALUE IF ALREADY SET
PROCDX:	MOVEM	T,@BCOM2	;STORE IN B#CNT
	HRRZ	R,BCOM3
	SETZM	TEM		;DO NOT RE-INSERT 'CONDITIONAL' INFO.
	HLRZ	S,(R)
	JUMPE	S,.+2		;SET THE AUTO PROCEDE FLAG 
	TLO	F,AUTO		;IF THIS IS A 'TYPING' REQUEST
	PUSHJ	P,AUTOP
PROCD1:	LINE

PROC0:	HRRZI	R,[JRST RET]	;MODIFIED TO ADDR OF BREAKPOINT
	PUSHJ	P,FETCH
	JRST	BPLUP1		; GET HERE ONLY IF MEMORY SHRANK
	MOVEM	T,LEAV
	PUSHJ	P,INSRTB
	JRST	PROC2

PROC1:	MOVE	T,AC0+T
	JSR	SAVE
	JFCL
	MOVE	T,BCOM		;STORE FLAGS WHERE "RESTORE"
	HLLM	T,SAVPI		;  CAN FIND THEM
PROC2:	MOVEI	W,100
	MOVEM	W,TEM1		;SETUP MAX LOOP COUNT
	JRST	IXCT5

IXCT4:	SUBI	T,041		;IS UUO "INIT"?
	JUMPE	T,BPLUP
	AOJGE	T,IXCT6		;DONT PROCEDE FOR INIT
				;DONT INTERPRET FOR SYSTEM UUOS
	MOVEM	R,40		;INTERPRET FOR NON-SYSTEM UUOS
	MOVEI	R,41
IXCT:	SOSL	TEM1
	PUSHJ	P,FETCH
	JRST	BPLUP		;BREAKPOINT LOOPING OR FETCH FAILED
	MOVEM	T,LEAV
IXCT5:;	SETZM	ESCAPE		;NO ESCAPES FROM FORDDT
	LDB	T,[POINT 9,LEAV,8]	;GET INSTRUCTION
	CAIN	T,254		;DON'T DO ANYTHING TO JRST
	JRST	IXCT6
	HRLZI	17,AC0
	BLT	17,17
	MOVEI	T,@LEAV
	DPB	T,[POINT 23,LEAV,35]	;STORE EFFECTIVE ADDRESS
	LDB	W1,[POINT 4,LEAV,12]	;PICK UP AC FIELD
	LDB	T,[POINT 9,LEAV,8]	;PICK UP INSTRUCTION FIELD
	SETPDL
	CAIN	T,260
	JRST	IPUSHJ		;INTERPRET PUSHJ

	CAIN	T,264
	JRST	IJSR		;INTERPRET JSR
	CAIN	T,265
	JRST	IJSP		;INTERPRET JSP
	CAIN	T,266
	JRST	IJSA		;INTERPRET JSA
	MOVE	R,LEAV
	TRNN	T,700
	JRST	IXCT4		;INTERPRET UUO
	CAIN	T,256
	JRST	IXCT		;INTERPRET XCT

IXCT6:	JSP	T,RESTORE
LEAV:	0			;INSTRUCTION MODIFIED
	JRST	@BCOM
	AOS	BCOM
	JRST	@BCOM

BPLUP:	PUSHJ	P,REMOVB	;BREAKPOINT PROCEED ERROR
BPLUP1:	JSR	SAVE
	JFCL
	JRST	ERR18

IPUSHJ:	DPB	W1,[POINT 4,CPUSHP,12]	;STORE AC FIELD INTO A PUSH
	HLL	T,SAVPI		;PICK UP FLAGS
	HLLM	T,BCOM		;SET UP THE OLD PC WORD
	MOVSI	T,(1B4)		;TURN OFF BIS FLAG IN NEW PC WORD
	ANDCAM	T,SAVPI
	JSP	T,RESTORE	;RESTORE THE MACHINE STATE
CPUSHP:	PUSH	.-.,BCOM	;GETS MODIFIED IN AC FIELD
	JRST	@LEAV		;JUMP TO "E" OF THE PUSHJ

IJSA:	MOVE	T,BCOM		;INTERPRET JSA
	HRL	T,LEAV
	EXCH	T,AC0(W1)
	JRST	IJSR2

IJSR:	MOVE	T,BCOM		;INTERPRET JSR
	HLL	T,SAVPI		;SET UP THE OLD PC WORD
	MOVSI	W,(1B4)		;TURN OFF BIS IN NEW PC WORD
	ANDCAM	W,SAVPI
IJSR2:	MOVE	R,LEAV
	PUSHJ	P,DEPMEM
	 JRST	BPLUP		;ERROR, CAN'T STORE
	AOSA	T,LEAV
IJSR3:	MOVE	T,LEAV
	JRST	RESTORE

IJSP:	MOVE	W,BCOM		;INTERPRET JSP
	HLL	W,SAVPI		;PICK UP PC WORD FLAGS
	MOVEM	W,AC0(W1)	;INSERT OLD PC WORD INTO AC
	MOVSI	T,(1B4)		;TURN OFF BIS FLAG IN NEW PC WORD
	ANDCAM	T,SAVPI
	JRST	IJSR3
	PAGE
;	INSERT PAUSES REQUESTS

INSRTB:	MOVE	S,[JSR BP1]
INSRT1:	SKIPE	R,B1ADR-BP1(S)
	PUSHJ	P,FETCH
	JRST	INSRT3

	MOVEM	T,B1INS-BP1(S)
	MOVE	T,S
	PUSHJ	P,DEPMEM
	 JFCL			;HERE ONLY IF CAN'T WRITE IN HIGH SEG

INSRT3:	ADDI	S,3
	CAMG	S,[JSR BPN]
	JRST	INSRT1
	POPJ	P,

;REMOVE PAUSE REQUESTS

REMOVB:	MOVEI	S,BNADR
REMOV1:	MOVE	T,B1INS-B1ADR(S)
	SKIPE	R,(S)
	PUSHJ	P,DEPMEM
	 JFCL			;HERE ONLY IF NO WRITE IN HIGH SEG
	SUBI	S,3
	CAIL	S,B1ADR
	JRST	REMOV1
	POPJ	P,		;
	PAGE
;	HERE TO SET PAUSE BREAKS



BPS:	MOVE	T,[XWD B1ADR,B1ADR+1]	; CLEAR ALL PAUSES
	CLEARM	B1ADR
	BLT	T,AUTOPI	;CLEAR OUT ALL PAUSES AND AUTO PROCEDE REGESTER
	JRST	RET

BPS1:	MOVE	R,T
	PUSHJ	P,FETCH		;CAN PAUSE BE INSERTED HERE?
	 JRST	ERR19		;NO
	PUSHJ	P,DMEMER	; AGAIN NO
	MOVE	T,R		;PUT THE PAUSE ADR BACK IN T
	SETZM	SAVLOC		;STORES AVAILABLE PAUSE SLOT
	MOVEI	R,B1ADR		;START OF PAUSE ARGUMENTS
BPS4:	HRRZ	W,(R)		;GET ADDRESS OF PAUSE IF ALREADY SET
	CAIN	W,(T)		;SEE IF ALREADY SET
	JRST	BPS5		;YES - USE THIS

	SKIPN	(R)		;IS IT FREE?
	HRRM	R,SAVLOC	;YES - REMEMBER WHERE
	ADDI	R,3		;LOOK AT NEXT
	CAIG	R,BNADR		;ALL EXAMINED?
	JRST	BPS4		;NO GO ON IN CASE THIS ADDRESS USED ALREADY

	SKIPN	R,SAVLOC	;WHERE THERE ANY FREE?
	JRST	ERR9		;NO - UNLUCKY USER
BPS5:	MOVEM	T,(R)		;SET UP PAUSE ADDRESS
	MOVE	T,TEM		;GET CONDITIONAL IF ANY   L.H. = WHAT TO TYPE
	MOVEM	T,1(R)
	MOVE	T,TEM1		;GET THE PROCEDE COUNT
	MOVEM	T,2(R)		;PLACE WHERE IT DOES THE MOST GOOD
	PAGE
AUTOP:	SUBI	R,B1ADR		;AUTO PROCEDE SETUP SUBROUTINE
	IDIVI	R,3
	MOVEI	S,1
	LSH	S,(R)
	ANDCAM	S,AUTOPI
	TLNE	F,AUTO		;DID USER ASK FOR AUTO PROCEDE?
	IORM	S,AUTOPI	;YES - LET HIM HAVE IT
	HRRZ	T,TEM		;DID USER ASK FOR A CONDITIONAL
	JUMPE	T,CPOPJ		;NO - ALL DONE

	LSH	R,2		;FORM INDEX TO TEST TABLES
	ADDI	R,TESTAB
	MOVE	T,COND0
	MOVEM	T,(R)		;SAVE TEST NO.
	MOVE	T,COND1
	CAIN	T,COND3		;SHOULD THIS BE A CONSTANT
	MOVEI	T,3(R)		;YES CORRECT IT
	MOVEM	T,1(R)		;SAVE ADDRESS OF FIRST ARG
	MOVE	T,COND2
	CAIN	T,COND3
	MOVEI	T,3(R)		;SAVE ADDRESS OF SECOND ARG
	MOVEM	T,2(R)		;SAVE ADDRESS OF SECOND ARG
	MOVE	T,COND3		;GET CONSTANT IF ANY
	MOVEM	T,3(R)		;AND SAVE
	POPJ	P,
	PAGE
SUBTTL MEMORY MANAGER SUBROUTINES

;DEPOSIT INTO MEMORY SUBROUTINE

DEPMEM:	EXCH	R,T		;CHECK (T)
	PUSHJ	P,CHKADR	;LEGAL ADDRESS?
	 POPJ	P,		;NO - ILLEGAL
	 JRST	DEP4		;YES BUT IN HI SEGMENT
	EXCH	R,T
	TRNN	R,777760
	JRST	DEPAC		;DEPOSIT IN AC
	MOVEM	T,(R)
	JRST	CPOPJ1		;SKIP RETURN

DEPAC:	MOVEM	T,AC0(R)	;DEPOSIT IN AC
	JRST	CPOPJ1		;SKIP RETURN


;**;[100] conditionalize TOPS10 code @ dep4 ma 25-aug-77
ife tops20,<
DEP4:	EXCH	R,T
	MOVEI	TT1,0
	SETUWP	TT1,		;IS HI SEGMENT PROTECTED? TURN OFF
	POPJ	P,		;PROTECTED, NO SKIP RETURN
	MOVEM	T,(R)		;STORE WORD IN HI SEGMENT
	TRNE	TT1,1		;WAS WRITE PROTECT ON?
	SETUWP	TT1,		;YES, TURN IT BACK ON
	JFCL
	JRST	CPOPJ1>		;[100]skip return, end of conditional
;**;[100] add native code @ dep4 ma 25-aug-77
ifn tops20,<
dep4:	exch	r,t		;[100]restore r and t
	push	p,tf		;[100]save regs for JSYS
	push	p,r
	lsh	r,-11		;[100]form page number from address
	hrrzi	tf,(r)		;[100]put into AC1
	hrli	tf,400000	;[100]get process handle into left half
	push	p,tf		;[100]save this argument, just in case!
	rpacs			;[100]get access bits into AC2
	tlne	tf,(pa%wt)	;[100]can we write to this page?
	jrst	dep5		;[100]yes, go do it
	move	tf,(p)		;[100]no, get saved argument
	and	r,[pa%wt!pa%rd!pa%cpy!pa%ex]
				;[100]clear unneeded bits
	tlo	r,(pa%cpy)	;[100]get cw access for page
	spacs			;[100]
	hrroi	tf,[asciz/
%FDTWSP	Writing to shared page
/]				;[100]prepare to warn him once
	aosn	pagwrn		;[100]skip if he has already been warned
	psout			;[100]send warning
dep5:	pop	p,r		;[100]flush extra stack level
	pop	p,r		;[100]restore r
	pop	p,tf		;[100]restore flags
	movem	t,(r)		;[100]save away t
	jrst	cpopj1>		;[100]skip return,end of conditional


DMEMER:	PUSHJ	P,DEPMEM	;DEPOSIT AND GO TO ERR IF IT FAILS
	 JRST	ERR19
	POPJ	P,
FETCH:	EXCH	R,T		;CHECK (T)
	PUSHJ	P,CHKADR	;LEGAL ADDRESS?
	 POPJ	P,		;NO
	 JFCL			;HIGH OR LOW OK FOR FETCH
	EXCH	R,T
	TRNN	R,777760	;ACCUMULATOR?
	SKIPA	T,AC0(R)	;YES
	MOVE	T,(R)		;NO
	JRST	CPOPJ1		;SKIP RETURN ONLY FOR LEGAL ADDRESS
	PAGE
SUBTTL BINARY TO SYMBOLIC CONVERSION

;	PUSHJ	P,LOOK		;AC T CONTAINS BINARY TO BE INTERPRETED
;	  RETURN 1		;NOTHING AT ALL FOUND THAT'S USEFUL
;	  RETURN 2		;SOMETHING FOUND, BUT NO EXACT MATCH
;				; OR MULTIPLY DEFINED IF OFFSET = 0 IN T
;	  RETURN 3		;EXACT MATCH FOUND AND PRINTED IF R=0
;				;R=SYMBOL VALUE IF SILENT FLAG ON
;				;T = SYMBOL VALUE BEING 'LOOKED' UP
;				;W1 = ADDRESS OF BEST SYMBOL SO FAR
;				;TRULST=LAST CHARACTER IF LABEL FOUND

LOOK:	SETZM	PNAMSV		;[070] RESET PROGRAM NAME OF SYMBOL
	TRZ	F,MDLCLF!PNAMEF!ID	;CLEAR FLAGS
	MOVEI	R,377777
	TRNE	F,NEARST	;
	MOVNI	R,377777
	MOVEM	R,BESTVA	;SETUP FALSE OFFSET
	PUSHJ	P,LOKSYM	;CHECK IT
LOOK0:	 POPJ	P,		;NOTHING FOUND
	 JRST	LOOK4		;MULT. DEF. OR OFFSET
	MOVE	R,W1		;PTR TO SYMBOL
	MOVEM	R,LASYM		;SAVE THIS SYMBOL
	MOVE	W2,1(R)		;GET VALUE
	MOVEM	W2,LASVAL	;SAVE
	TRZN	F,SILENT	;FOUND - SILENCE?
	PUSHJ	P,SPT		;NO - TYPE SYMBOL
;**;[070], LOOK0+10 , MD, AUG-76
	PUSHJ	P,LOOKPG	;[070] LOOKUP FOR PROGRAM NAME
	JRST	CPOPJ2		;[070] DOUBLE SKIP - SUCCESS

;**;[070],LOOK2,MOVE CODE TO CREATE ROUTINE LOOKPG,MD,AUG-76

LOOK4:	JUMPE	T,CPOPJ1	;MULT DEF
	MOVEM	R,LASYM		;UPDATE LAST SYMBOL
	MOVE	W2,1(R)		;GET VALUE
	ADDI	W2,(T)		;WITH OFFSET
	MOVEM	W2,LASVAL	;AS LAST VALUE
;**;[070], LOOK4+5 ,MD, AUG-76
	PUSHJ	P,LOOKPG	;[070] GET PROGRAM NAME
	JRST	CPOPJ1		;2ND SKIP

RELOOK:	MOVE	R,W1		;RESET (R)
	PUSH	P,[LOOK0]	;RETURN
	TRZ	F,ID		;ALLOW LOKSYM TO FIND IT
	JRST	LOK3		;HERE WE GO AGAIN


;**;[070],RELOOK+4,INSERT ROUTINE LOOKPG,MD,AUG-76
;[070] ROUTINE TO LOOKUP FOR PROGRAM NAME
LOOKPG:				;[070]
	PUSH	P,R		; SAVE R
LOOK2:	ADD	R,[2,,2]
	JUMPGE	R,LOOK3		;END OF TABLE
	MOVE	W2,(R)		;GET NEXT ENTRY
	TLNE	W2,PNAME	;PROGRAM NAME?
	JRST	LOOK2		;NO
	MOVEM	W2,PNAMSV	;YES - SAVE IT
LOOK3:	POP	P,R		;RESTORE R
	POPJ	P,		;[070] END ROUTINE
	PAGE
;THIS ROUTINE SEARCHES THE SYMBOL TABLE SPECIFIED BY FLAG FGLSNM FOR
;THE VALUE SUPPLIED IN AC T.  THERE IS A FAIL RETURN FOR SYMBOL NOT
;FOUND OR MULT. DEF. LOCAL.

LOKSYM:	SETZB	W1,TEM3
; [72] Insert @ LOKSYM+1/2, JMT, 13-Jan-77
	MOVEM	T,TEM8		;[72] STORE VALUE
	MOVE	R,.JBSYM	;USE LOSEG TBL
	PUSHJ	P,LOK2		;
	 JRST	LOK1		;NOT FOUND
	 CAIA			;OFFSET OR MULT DEF.
	JRST	CPOPJ2		;FOUND
	TRNE	F,MDLCLF	;MULT. DEF.?
	JRST	CPOPJ1		;FAIL - 2ND SKIP
	MOVEM	T,TEM3		;OFFSET - SAVE IT
	MOVEM	W1,TEM4		;SAVE PTR
LOK1:	PUSHJ	P,GHSSYP	;GET HISEG SYM TBL PTR
	 JRST	[SKIPN	TEM3	;OFFSET FOUND?
		 JRST	CPOPJ	;NO - FAIL
		 JRST	LOK15]	;YES - USE IT
; [72] Insert @ LOK1+3 1/2 lines, JMT, 13-Jan