Google
 

Trailing-Edge - PDP-10 Archives - BB-F492Z-DD_1986 - 10,7/703mon/mongen.mac
There are 17 other files named mongen.mac in the archive. Click here to see a list.
TITLE	MONGEN - PROGRAM TO DEFINE MONITOR AND NETWORK CONFIGURATIONS - V060
SUBTTL	T. HASTINGS/TH/EP/DAL/JBS	26 NOV 85

EDITNO==306		;EDIT NUMBER (**MUST MATCH "M.GEN" IN COMMON.MAC**)
VERSION==057		;MAJOR VERSION NUMBER
VMINOR==0		;MINOR VERSION NUMBER
VWHO==0			;WHO LAST EDITED

	SALL
	.DIRECT	FLBLST

;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
;  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
ASCIZ	&
COPYRIGHT (C) 1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1982,1984,1986 BY DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
ALL RIGHTS RESERVED.
&


;

;DO NOT CHANGE BELOW NUMBER, IT IS A LOCATION, NOT A NUMBER!!!
JOBVER==137		;LOC OF VERSION NO IN JOB DATA AREA
	LOC	JOBVER
	BYTE	(3)VWHO(9)VERSION(6)VMINOR(18)EDITNO	;VERSION NUMBER
	RELOC

;SYMBOLS WHICH ARE PARAMETERS OF MONGEN ITSELF(PREFIX MP)
IFNDEF MP.MVN,<MP.MVN==^D703>	;MONITOR VERSION NUMBER
		;WHICH THIS MONGEN IS DESIGNED TO GENERATE
		;OTHER MONGEN VERSIONS GENERATE OTHER MONITOR VERSIONS
IFNDEF MP.PDL,<MP.PDL==40>	;PD LIST LENGTH
IFNDEF MP.AMX,<MP.AMX==^D10>	;MAX NO. OF ANSWERS INSIDE PARENS
IFNDEF MP.SMX,<MP.SMX==^D4>	;MAX SYSTEM SUPPORTED IN 7.02
		; 1070=0, 1080=1, 1090=2, 1091=3, 2020=4
IFNDEF MP.LMX,<MP.LMX==^D80>	;MAX. NO. OF CHAR ALLOWED IN INPUT LINE
		; NOT COUNTING EOL OR NULL
IFNDEF MP.FTA,<MP.FTA==^D25>	;MAX NUMBER OF FEATURE TEST SWITCHES THAT MAY BE ADDED

COMMENT	"

ASSEMBLY INSTRUCTIONS:
.COMPIL MONGEN

LOADING INSTRUCTIONS:
.LOAD MONGEN

DEBUGGING INSTRUCTION:
.DEBUG MONGEN
  BY DEPOSITING NON-ZERO IN LOCATION DEBUG WITH DDT, MONGEN WILL
  OUTPUT ALL FILE STUFF TO TTY TOO INSIDE <>.
"
;MONGEN IS A DIALOG PROGRAM(ACTUALLY 3 PROGRAMS IN ONE) WHICH
;ASKS THE CUSTOMER QUESTIONS ABOUT HIS CONFIGURATION.
;THE RESULTS OF THIS DIALOG ARE OUTPUT AS A FILE OF PARAMETER ASSIGNMENTS
;WHICH CAUSE CONDITIONAL ASSEMBLY IN THE DATA BASE MODULES OF THE MONITOR.
;THUS EACH CUSTOMER IS ABLE TO CUSTOM-MAKE HIS MONITOR FOR THE FEATURES
;HE WISHES DEPENDING ON HARDWARE AND SOFTWARE REQUIREMENTS.
;THESE PARAMETER ASSIGNMENTS TAKE THE FORM OF MACRO CALLS USING
; THE XP MACRO OF TWO ARGUMENTS AS DEFINED IN FILE S.MAC.  THE XP
; MACRO DEFINES THE FIRST SYMBOL TO BE EQUAL TO THE SECOND EXPRESSION
; AND DECLARES THE SYMBOL TO BE INTERNAL AND DDT OUTPUT SUPPRESSED.

;MONGEN CAN CONFIGURE ITSELF BY USING THE MONGEN DIALOG.  THE MONGEN
;DIALOG RESULTS IN A NEW .EXE FILE.  MONGENING MONGEN IS UNSUPPORTED.

;USER INSTRUCTIONS FOR RUNNING MONGEN:
;MONGEN WILL ASK YOU QUESTIONS ABOUT YOUR CONFIGURATION AND
; OUTPUT THEM IN A FILE.  TO HELP YOU ANSWER THESE QUESTIONS,
; MONGEN GIVES THREE LEVELS OF
; GUIDANCE.  SHORT MODE FOR THE VERY EXPERIENCED, PROMPT MODE
; WHERE YOU ARE GIVEN CHOICES, AND LONG MODE WHERE YOU
; ARE GIVEN THE CHOICES ALONG WITH AN EXPLANATION.  YOU MAY CHANGE
; THE MODE FOR A SINGLE QUESTION IF YOU DO NOT UNDERSTAND IT BY SIMPLY TYPING /H
; TO CHANGE THE MODE FOR THE REST OF THE QUESTIONS, TYPE /HELP:X
; WHERE X IS SHORT, PROMPT, OR LONG.  ACTUALLY MONGEN ALWAYS
; ALLOWS ABBREVIATIONS EVERYWHERE, SO S, P, AND L SUFFICE
; ALONG WITH H FOR HELP.
; QUESTIONS ASKING FOR A NUMBER(DECIMAL UNLESS SPECIFICALLY NOTED
; AS OCTAL) ALWAYS INDICATE THE RANGE INSIDE PARENS, IE (MIN-MAX).
; OTHER QUESTIONS ARE ASKING FOR ONE
; OF A LIST OF CHOICES.  THE CHOICES ARE LISTED INSIDE PARENS.
; STILL OTHER QUESTIONS ASK
; FOR Y OR N AND STILL OTHERS ASK FOR JUST A STRING.
; IN ALL QUESTIONS WHICH HAVE PROMPTING INSIDE PARENS, THE FIRST
; ITEM IN THE LIST IS CALLED THE DEFAULT AND IS ASSUMED IF YOU
; ANSWER JUST WITH CARRIAGE RETURN.  ALL THE YES/NO QUESTIONS
; HAVE PROMPTING OF (Y,N) SO CARRIAGE RETURN ALWAYS MEANS Y.
; (,ANS0,ANS1,...) MEANS NO DEFAULT ASSUMED ON JUST CR
; CALLER OF ASK ROUTINE MUST CHECK FOR N=0 IN THIS CASE AND TAKE
; APPROPRIATE ACTION.  (THIS FEATURE IS USED BY HELP ITSELF TO ALLOW
; JUST CR TO MEAN NEXT LONGER HELP MODE).


;RULE: ALL SYMBOLS ARE GENERATED ALL OF THE TIME,
; NO MATTER HOW DIALOG BRANCHES.  WHY?  SO USERS READING THE
; DATA BASE MODULES NEVER NEED TO LOOK AT MONGEN TO UNDERSTAND
; THE MONITOR.
;THE ONLY LOCAL STORAGE IN MONGEN IS USED TO STORE ANSWERS IF THE
; VALUES ARE NEEDED LATER FOR ERROR CHECKING.  MOST ANSWERS ARE OUTPUT
; IMMEDIATELY AND SO ARE NEVER STORED IN MEMORY.  BY CONVENTION THE NAMES
; OF VARIABLES WARE THE SAME AS THE ASSOCIATED SYMBOLS OUTPUT IN
; THE FILE.  OUTPUT SYMBOLS ALL START WITH THE TWO LETTERS "M."  OR "FT" THIS MAKES
; IT EASY TO RECOGNIZE SYMBOLS DEFINED BY MONGEN WHEN READING THE REST
; OF THE MONITOR.
;MONGEN IS STUPID AND SIMPLE MINDED.  IS KNOWS AS LITTLE ABOUT
; THE MONITOR AS POSSIBLE.  IT NEVER ADDS TWO ANSWERS TOGETHER, FOR EXAMPLE.
; IT ALWAYS GENERATES ALL SYMBOLS ALL THE TIME, NO MATTER
; HOW THE QUESTIONS ARE ANSWERED.  IT IS UP TO COMMON TO TAKE THE RAW DATA
; AND PERFORM COMPUTATION AND DEFINE NEW AND CONVENIENT SYMBOLS.
;THE FOLLOWING MACROS(AND SUBROUTINES BY THE SAME NAME) ARE USED TO ASK
; CUSTOMER QUESTIONS AND GET HIS ANSWERS:
;SOME ANSWERS ARE NUMERIC, WHILE OTHERS ARE CHOICES LIKE Y OR N
; OR AN ITEM OUT OF A LIST.  ALL ANSWERS ARE CHECKED FOR REASONABLENESS.
; THE GOAL IS TO PREVENT AS MANY ERRORS AS POSSIBLE, SINCE ERRORS
; ARE NOT USUALLY DISCOVERED UNTIL THE MONITOR IS LOADED AND SOMETIMES
; EVEN THEN IT IS HARD TO FIND THE PROBLEM.  ALL NUMERIC ANSWERS ARE
; CHECKED FOR MIN AND MAX AS INDICATED INSIDE PARENS WITH A -
; SEPARATING THE MIN AND MAX.  IF A NUMERIC QUESTION
; DOES NOT HAVE A RANGE SPECIFIED, MONGEN WILL PRINT
; ? INTERNAL MONGEN ERROR - ABOVE QUESTION MUST HAVE (...,MIN-MAX) -
; EDIT MONGEN.
; AND EXIT.  NOTE: (MIN-?) IS OK TO MEAN NO UPPER BOUND
;  THE PROGRAMMER MUST EDIT MONGEN TO FIX HIS BUG.
;  THE CUSTOMER SHOULD NEVER SEE THIS MESSAGE, SINCE IT IS A DEBUGGING
;  AID AND SHOULD BE CAUGHT DURING TESTING.
;EACH MACRO HAS A TEXT QUESTION AS AN ARGUMENT.  THE ANSWER IS RETURNED
; IN AC N.  IF AN ERROR IS DETECTED, THE QUESTION IS
; REASKED AT NEXT HIGHER LEVEL OF VERBOSITY.  RETURN IS ALWAYS WITH
; A SUCCESSFUL VALUE.  THE CUSTOMER MAY HAVE CHANGED LEVELS OF VERBOSITY
; USING THE /HELP: FEATURE.  LOCATION SAVLV HAS CURRENT PERMANENT LEVEL,
; WHILE LEVEL FOR CURRENT QUESTION IS KEPT IN AC LV.

;ASKYN  - ANSWER Y OR N, (Y=1, N=0) NOTE: OPPOSITE FROM ASKLST
;	  HOWEVER MORE USEFUL, SINCE CAN OUTPUT DIRECTLY IN XP MACRO
;	  WHERE XP SYMBOL,1 MEANS Y AND XP SYMBOL,0 MEANS N.
;	(Y,N) MUST APPEAR IN QUESTION AS A PROMPT.  FOR CONSISTENCY
;	THE Y MUST BE BEFORE THE N SO CR ALWAYS MEANS Y.
;ASKDEC - ANSWER DECIMAL NUMBER.  QUESTION SHOULD HAVE (DEFAULT,MIN-MAX).
;	IF NO DEFAULT IS REASONABLE(SUCH AS NUMBER OF JOBS), ONLY
;	(MIN-MAX) IS REQUIRED.
;ASKOCT - ANSWER OCTAL NUMBER.  QUESTION SHOULD HAVE (DEFAULT,MIN-MAX)
;	IF NO DEFAULT IS REASONABLE, ONLY (MIN-MAX) IS REQUIRED.
;ASKLIN - ANSWER OCTAL LINE NUMBER OR CTY
;ASKSTR - ANSWER ARBITRARY STRING.  STORED IN ASCSTR AS ASCIZ.
;	N=NO. OF CHARS IN STRING NOT COUNTING NULL OR CRLF.
;ASKLST - ANSWER ONE OF THE ITEMS IN THE PROMPTING LIST IN PARENS.
;	N=0,1,2,... IE POSITION OF ANSWER IN LIST.  IF ANSWER IS NOT
;	IN LIST OR ABBREVIATION IS NOT UNIQUE, THE QUESTION IS REASKED
;	AT HIGHER LEVEL OF VERBOSITY.  ERROR MESSAGES ARE:
;	? TYPE ENOUGH TO UNIQUELY DISTINGUISH ANSWER
;	? ANSWER WITH ONE OF THE CHOICES INSIDE ( )
;	? INTERNAL MONGEN ERROR - NO "(" IN ABOVE MESSAGE -
;	EDIT MONGEN AND ADD (ANS0,ANS1,...)
;	? INTERNAL MONGEN ERROR - TOO MANY POSSIBLE ANSWERS ABOVE -
;	EDIT MONGEN AND INCREASE MP.AMX
;TO ASK A MULTIPLE LINE QUESTION, THE FOLLOWING SPECIAL MACROS:
;ASKMN  - ANSWER M OR M,N WHERE M AND N ARE OCTAL LINE
;	NUMBERS OR JUST CTY
;ASKMNP - ANSWER M,P OR M-N,P WHERE M,N, AND P ARE OCTAL LINE NUMBERS
;
;ASKTMN - ANSWER M OR M,N OR ALL FOR 7 TRACK TAPE UNITS
;
;ASKTMN - ANSWER M OR M,N OR ALL FOR 7 TRACK TAPE UNITS

;TO OUTPUT TO TTY, FILE OR BOTH, USE THE FOLLOWING:
; USUAL FILE OUTPUT RADIX IS OCTAL, WHILE TTY OUTPUT RADIX IS DECIMAL,
; UNLESS NAME HAS OCT OR DEC IN IT, IN WHICH THE RADICES ARE THE SAME.

;BTHOUT - OUTPUT DECIMAL TO BOTH TTY AND FILE, FILE AS A COMMENT(IE ; INSERTED)
;BTHOCT - OUTPUT OCTAL TO BOTH TTY AND FILE, FILE AS A COMMENT
;FILEOUT - OUTPUT TO FIL ONLY
;FILCOM - OUTPUT TO FILE ONLY AS A MULTI-LINE COMMENT(IE ; INSERTED)
;TTYOUT - OUTPUT TO TTY ONLY(DECIMAL)(USUAL)
;TTYOCT - OUTPUT TO TTY ONLY(OCTAL)(UNUSUAL)
;FILSTR - OUTPUT STRING IN ASCSTR TO FILE
;FILDEC - OUTPUT TO FILE WITH RADIX DECIMAL INSTEAD OF OCTAL
;FILDC2 - OUTPUT TO FILE WITH RADIX DECIMAL, AT LEAST 2 CHARS
;ALL OF THE ABOVE MACROS(AND SUBROUTINES) CAN HAVE A SECOND
; ARGUMENT WHICH IS THE LOCATION OF A VALUE TO BE SUBSTITUTED FOR * IN
; THE FIRST ARGUMENT.  THE VALUE CAN BE LEFT JUSTIFIED SIXBIT OR A NUMBER.
; IF THE LOCATION OF THE VALUE IS AC N, NO EXTRA INSTRUCTION IS GENERATED
; SINCE THE MACRO USUALLY PICKS UP THE LOCATION AND PUTS IT IN N.
; HOWEVER IT IS RECOMENDED THAT N BE INCLUDED AS THE SECOND ARGUMENT
; TO INDICATE TO THE READER THAT A SUBSTITION IS GOING TO TAKE PLACE USING N.
; ELSE NEW CODE MAY BE INTRODUCED WHICH USES N BEFORE THE MACRO CALL.
; WHENEVER THE CHARACTER @ IS SEEN IT IS CONVERTED TO CRLF.  THIS
; MAKES IT NICER FOR FORMATTING THE MESSAGES INSIDE <>, SINCE
; THE <CLOSE ANGLE> CAN ALWAYS BE ON THE SAME LINE, EVEN WHEN CRLF IS WANTED.

;EXAMPLE:
;	ASKYN	<LPT(Y,N)[LINE PRINTER AT STATION *]>,OSN
;	FILOUT	<MACRLP	*@>,N

;ALL SUBROUTINES WHICH IMPLEMENT THE MACROS HAVE THE SAME CALLING
; SEQUENCE:
;CALL:	MOVE	LV,QUESTION LEVEL -1 FOR SHORT, 0 FOR PROMPT, 1 FOR LONG
;	MOVE	N,+NUMBER OR LEFT JUSTFIED SIXBIT TO BE
;				; SUBSTITUTED FOR *
;	MOVEI	T1,ADR OF ASCIZ MESSAGE
;	PUSHJ	P,ASKXXX OR FILXXX OR TTYXXX OR BTHXXX
;	ALWAYS RETURN WITH ANSWER IN N( AND STRING IN ASCSTR) OR
;	ORIGINAL CONTENTS OF N IF JUST OUTPUT ROUTINE.
;THE FGEN DIALOGUE MAKES USE OF AN AUXILIARY HELP FILE SYS:FGEN.HLP
;TO EXPLAIN THE USE OF FEATURE TEST SWITCHES AND TO INCLUDE COMMENTS
;IN THE OUTPUT FILE. THE FILE MUST BE IN THE FORM
;<TERMINATOR> <SWITCH> <TAB> <TEXT> <TERMINATOR>
;THE TERMINATOR IS DETERMINED BY SYMBOL C.TMFH AND IS CURRENTLY
;<CONTROL> A. IT MUST BE ONE CHARACTER.
;THE TEXT WILL BE COPIED FROM AFTER THE TAB TO THE NEXT TERMINATOR,
;SO IT SHOULD BE CONSTRUCTED CAREFULLY. NOTE PARTICULARLY THAT SINCE TO
;POSITION THE FILE THE CODE FIRST FINDS A TERMINATOR AND THEN READS TO
;A TERMINATOR IT WILL BE MORE EFFICIENT IF EACH SWITCH IS PRECEEDED BY
;TWO TERMINATORS.

;MACRO FHLPOS IS PROVIDED TO HELP POSITION THE HELP FILE.
; FHLPOS STRING,TAG POSITIONS THE FILE TO THE TEXT AFTER "STRING",
;AND TRANSFERS TO "TAG" IF THE STRING CANT BE FOUND. IF THE STRING
;HAS BEEN COMPUTED, IT SHOULD BE SIXBIT CHARACTERS LEFT JUSTIFIED IN
;ACCUMULATOR WD, AND THE FIRST ARGUMENT SHOULD BE *, E.G.
; FHLPOS *,ERROR

;FHLPOA IS THE SAME EXCEPT IT DOES NOT LOOK FOR A TAB AFTER THE TEXT

;SUBROUTINES HAVE BEEN PROVIDED TO COPY THE TEXT FROM THE HELP
;FILE TO THE OUTPUT FILE OR TTY.

;FHLPTT - COPIES TEXT FROM THE CURRENT POSITION OF THE HELP FILE TO
;THE NEXT TERMINATOR TO TTY

;FHLPFL - COPIES TEXT FROM THE CURRENT POSITION TO THE NEXT TERMINATOR
;TO THE OUTPUT FILE

;FHLPFC - COPIES TEXT FROM THE CURRENT POSITION TO THE NEXT TERMINATOR
;TO THE OUTPUT FILE AS A COMMENT, I.E. WITH A ; AT THE BEGINNING OF EACH LINE
;SOME CONVENTIONS:
;ALL SINGLE LINE ANSWERS ARE ANSWERED ON THE SAME LINE AS QUESTIONS.
; THIS SAVES PAPER. THE FORMAT IS QUESTION(WITHOUT QUESTION MARK)
; FOLLOWED BY COLON AND ONE SPACE.

;ONLY THE ASK MACROS ADD ANY CHARACTERS TO THE TEXT IN THE FIRST
; ARGUMENT.  THE BEGINNING OF THE MESSAGE IS INSERTED AN ";	" AS
; A COMMENT FOR THE FIL, AND ": " IS APPENDED TO THE END
; OF THE QUESTION SO THAT ALL QUESTIONS LOOK ALIKE.  NONE OF THE
; OUTPUT ONLY MACROS ADD ANY SPECIAL CHARACTERS.

;BY CONVENTION PROMPTING IN () APPEARS BEFORE LONG DIALOG IN [].
; THUS A USER CAN TYPE ^O IF THE USER GETS BORED, AND GET THE MOST USEFUL
; OUTPUT FIRST.

;IF JUST A CR IS GIVEN TO A QUESTION WHICH HAS A LIST, THE FIRST
; ITEM IS ASSUMED.  THIS IS TRUE FOR DECIMAL AND OCTAL QUESTIONS TOO.

;ALL NUMERIC QUESTIONS MUST HAVE A RANGE SUPPLIED.
; IF ONE IS NOT, THE USER GETS:
; ? INTERNAL MONGEN ERROR - NO (...,MIN-MAX) IN ABOVE QUESTION -
; EDIT MONGEN AND INCLUDE IN QUESTION.

;ALL ERRORS WHICH ARE MONGEN'S RATHER THAN THE CUSTOMER'S, ARE PRECEDED
; WITH ? INTERNAL MONGEN ERROR - FOLLOWED BY THE PROBLEM AND WHAT
; THE PROGRAMMER SHOULD DO TO FIX MONGEN.  NOTE THAT
; THE CUSTOMER SHOULD NEVER SEE THESE, SINCE THEY ARE DEBUGGING AIDS.

;ALL ERROR MESSAGES START WITH "? ". THE SPACE FOLLOWING ? MAKES THEM
; DISTINGUISHABLE FROM MONITOR ERRORS WHICH HAVE NO SPACE.

;ALL STRINGS ARE ASCIZ INCLUDING AS INPUT FROM TTY.
; ALL EOL CHARS(CR,LF,FF,VT,ESC,ALT1,ALT2,^Z,^C) ARE STRIPPED OUT
; AND ARE REPLACED BY A NULL.  THIS MAKES IT EASY TO SCAN STRINGS
; SINCE END IS ALWAYS DETECTED BY JUMPE CH,
; OUTPUT TO FILE MUST PUT CRLF BACK IN EXPLICITLY BY USING
; @ OR FCRLF ROUTINE.  THIS MAKES OUTPUT FILE MORE INDEPENDENT FROM
; USER INPUT.

;TO HELP THE READER OF MONGEN:
; ALL JUMPS ARE DOWN THE PAGE, EXCEPT LOOPS
; MOST PUSHJ ARE TO ROUTINES DOWN THE PAGE

;DEFINE THE MACROS:
; THE FOLLOWING MACROS SUFFIX ": " TO ASK QUESTION
; AND GET ANSWER ON SAME LINE
DEFINE	CAL	(XXX,A,B,%C)<
	XLIST			;;ALWAYS TURN OFF LISTING
IFNB <B>,<IFDIF <B> <N>,<MOVE	N,B>>	;;PICK UP VALUE TO BE SUBSTITUTED FOR *
	JSP	T1,%C		;;SETUP T1 WITH MESSAGE ADR AND JUMP AROUND
				;; MESSAGE WHICH MAY BE TOO BIG TO FIT
				;; IN REMOTE LITERAL.
	ASCIZ	\A: \		;;THE QUESTION WITH ": "
	INTERN	XXX		;;DECLARE INTERN SO MACRO WILL NOT THINK XXX A MACRO
%C:!	PUSHJ	P,XXX		;;CALL THE SUBROUTINE XXX
IFE RJRSTF,<LIST>		;;TURN LISTING BACK ON UNLESS INSIDE RJRST MACRO
>

DEFINE	ASKYN	(A,B)<
	CAL	ASKYN,<A>,B>

DEFINE	ASKDEC	(A,B)<
	CAL	ASKDEC,<A>,B>

DEFINE	ASKOCT	(A,B)<
	CAL	ASKOCT,<A>,B>

DEFINE	ASKLIN	(A,B)<
	CAL	ASKLIN,<A>,B>

DEFINE	ASKSTR	(A,B)<
	CAL	ASKSTR,<A>,B>

DEFINE	ASKLST	(A,B)<
	CAL	ASKLST,<A>,B>


;THE FOLLOWING MACROS DO NOT HAVE ANY CHARACTERS ADDED TO QUESTION

DEFINE	CAL2	(XXX,A,B,%C)<
	XLIST			;;ALWAYS TURN OFF LISTING
IFNB <B>,<IFDIF <B> <N>,<MOVE	N,B>>	;;PICKUP VALUE TO BE SUBSTITUTED FOR *
	JSP	T1,%C		;;SETUP T1 WITH MESSAGE ADR AND JUMP AROUND
				;; MESSAGE WHICH MAY BE TOO LONG FOR MACRO
				;; REMOTE LITERAL TABLE(14 WORDS)
	ASCIZ	\A\		;;THE QUESTION WITH NO ADDED CHARACTERS
	INTERN	XXX		;;DECLARE INTERN SO MACRO WILL NOT THINK XXX A MACRO
%C:!	PUSHJ	P,XXX		;;CALL THE SUBROUTINE TO JUST OUTPUT
IFE RJRSTF,<LIST>		;;TURN LISTING BACK ON UNLESS INSIDE RJRST MACRO
>
;OUTPUT IMMEDIATE VALUE

DEFINE	CAL3	(XXX,A,B,%C)<
	XLIST			;;ALWAYS TURN OFF LISTING
IFNB <B>,<IFDIF <B> <N>,<MOVEI	N,B>>	;;PICKUP VALUE TO BE SUBSTITUTED FOR *
	JSP	T1,%C		;;SETUP T1 WITH MESSAGE ADR AND JUMP AROUND
				;; MESSAGE WHICH MAY BE TOO LONG FOR MACRO
				;; REMOTE LITERAL TABLE(14 WORDS)
	ASCIZ	\A\		;;THE QUESTION WITH NO ADDED CHARACTERS
	INTERN	XXX		;;DECLARE INTERN SO MACRO WILL NOT THINK XXX A MACRO
%C:!	PUSHJ	P,XXX		;;CALL THE SUBROUTINE TO JUST OUTPUT
IFE RJRSTF,<LIST>		;;TURN LISTING BACK ON UNLESS INSIDE RJRST MACRO
>
DEFINE	ASKMN	(A,B)<
	CAL2	ASKMN,<A>,B>

DEFINE	ASKMNP	(A,B)<
	CAL2	ASKMNP,<A>,B>

DEFINE	ASKTMN	(A,B)<
	CAL2	ASKTMN,<A>,B>

DEFINE	BTHOUT	(A,B)<
	CAL2	BTHOUT,<A>,B>

DEFINE	BTHOCT	(A,B)<
	CAL2	BTHOCT,<A>,B>

DEFINE	FILOUT	(A,B)<
	CAL2	FILOUT,<A>,B>

DEFINE	FILCPU	(A,B)<
	CAL2	FILCPU,<A>,B>

DEFINE	FILCOM	(A,B)<
	CAL2	FILCOM,<A>,B>

DEFINE	FILOUD	(A,B)<
	CAL3	FILOUT,<A>,B>

DEFINE	TTYOUT	(A,B)<
	CAL2	TTYOUT,<A>,B
>
DEFINE	TTYOCT	(A,B)<
	CAL2	TTYOCT,<A>,B>

DEFINE	FILSTR	(A,B)<
	CAL2	FILSTR,<A>,B>

DEFINE	FILDEC	(A,B)<
	CAL2	FILDEC,<A>,B>

DEFINE	FILDC2	(A,B)<
	CAL2	FILDC2,<A>,B>

DEFINE	EREXIT	(A,B)<
	CAL2	EREXIT,<A>,B>
DEFINE	FHLPOS	(A,B)<
	XLIST
IFB <A>,<PRINTX FHLPOS MACRO MAY CLOBBER WD>
IFB <B>,<PRINTX FHLPOS MACRO MAY CLOBBER WD>
IFDIF <A>,<*>,<
	MOVE	WD,[SIXBIT \A\]
>
	INTERN	FHLPOS
	PUSHJ	P,FHLPOS
	  JRST	B
	LIST
>

DEFINE	FHLPOA	(A,B)<
	XLIST
IFB <A>,<PRINTX FHLPOA MACRO MAY CLOBBER WD>
IFB <B>,<PRINTX FHLPOA MACRO MAY CLOBBER WD>
IFDIF <A>,<*>,<
	MOVE	WD,[SIXBIT \A\]
>
	INTERN	FHLPOA
	PUSHJ	P,FHLPOA
	  JRST	B
	LIST
>
;DEFINE REMOTE MACROS WHICH ARE JUMPED TO ON UNUSUAL CASES
; INCLUDE CODE IN-LINE SO READABLE, BUT INDENT 2 TABS, JUST AS
; IF MULTI-LINE LITERAL.
;USED INSTEAD OF MULTI-LINE LITERAL BECAUSE MACRO LISTS
; SOURCE INSIDE OF MACROS INSIDE OF LITERALS
DEFINE	RJRST	(A,%B)<
	XLIST		;;TURN OFF LISTING SOURCE IN EXPANSION
RJRSTF==1		;;FLAG INSIDE OF RJRST, SO CAL MACRO
			;; WILL NOT TURN LIST BACK ON
	SKIPA		;;ALLOW MACRO IN ERROR RETURN OR AFTER TEST INSTR.
	JRST	%B	;;BY PASS UNUSUAL CODE
	A		;;THE UNUSAL CODE
RJRSTF==0		;;FLAG NO LONGER INSIDE RJRST MACRO
			;; SO FUTURE CAL MACROS WILL TURN LIST ON
%B:!	LIST		;;TURN LISTING BACK ON
>

DEFINE	RJUMPE	(AC,A,%B)<
	XLIST
RJRSTF==1		;;FLAG INSIDE OF RJRST, SO CAL MACRO
			;; WILL NOT TURN LIST BACK ON
	SKIPE	AC	;;CONDITION OF UNUSUAL CODE?
	JRST	%B	;;NO, BY PASS UNUSUAL CODE
	A		;;THE UNUSUAL CODE
RJRSTF==0		;;FLAG NO LONGER INSIDE RJRST MACRO
			;; SO FUTURE CAL MACROS WILL TURN LIST ON
%B:!	LIST		;;TURN LISTING BACK ON
>

DEFINE	RJUMPL	(AC,A,%B)<
	XLIST
RJRSTF==1		;;FLAG INSIDE OF RJRST, SO CAL MACRO
			;; WILL NOT TURN LIST BACK ON
	SKIPL	AC	;;CONDITION OF UNUSUAL CODE?
	JRST	%B	;;NO, BY PASS UNUSUAL CODE
	A		;;THE UNUSUAL CODE
RJRSTF==0		;;FLAG NO LONGER INSIDE RJRST MACRO
			;; SO FUTURE CAL MACROS WILL TURN LIST ON
%B:!	LIST
>

DEFINE	RJUMPN	(AC,A,%B)<
	XLIST
RJRSTF==1		;;FLAG INSIDE OF RJRST, SO CAL MACRO
			;; WILL NOT TURN LIST BACK ON
	SKIPN	AC	;;CONDITION OF UNUSUAL CODE?
	JRST	%B	;;NO, BY PASS UNUSUAL CODE
	A		;;THE UNUSUAL CODE
RJRSTF==0		;;FLAG NO LONGER INSIDE RJRST MACRO
			;; SO FUTURE CAL MACROS WILL TURN LIST ON
%B:!	LIST
>
DEFINE	RJUMPGE	(AC,A,%B)<
	XLIST
RJRSTF==1		;;FLAG INSIDE OF RJRST, SO CAL MACRO
			;; WILL NOT TURN LIST BACK ON
	SKIPGE	AC	;;CONDITION OF UNUSUAL CODE?
	JRST	%B	;;NO, BY PASS UNUSUAL CODE
	A		;;THE UNUSUAL CODE
RJRSTF==0		;;FLAG NO LONGER INSIDE RJRST MACRO
			;; SO FUTURE CAL MACROS WILL TURN LIST ON
%B:!	LIST
>

RJRSTF==0		;START FLAG AT 0 MEANING NOT INSIDE RJRST
;PARAMETERS:
;ACS
F=0		;FLAGS
  ;LH(DEFINED AS 36 BIT QUANTITIES):
  F.MTCH==1B0	;MATCH FOUND IN FNDASK ROUTINE
  F.OFO==1B1	;OUTPUT FILE OPEN.  FILE CALLS IGNORED IF 0
		; NEEDED SO ASK ROUTINES CAN BE USED TO ASK ABOUT FILE NAME
  F.TF==1B2	;TTY/FIL FLAG, 1 ON FIRST CHAR TO FILE
		; USED FOR DEBUG FEATURE TO PRINT <> ON TTY
		; SET BY TTYPUT ROUTINE, CLEARED BY FILPUT ROUTINE
  F.CTY==1B3	;CTY IS AN ACCEPTABLE OCTAL NUUMBER IF 1
		; SET BY ASKLIN, CLEARED BY ASKDEC,ASKOCT,ASKNUM ROUTINES
  F.FLF==1B4	;LAST CHAR ON FILE WAS LINE FEED
		; USED TO PRECEDE NEXT CHAR WITH ; TO MAKE A COMMENT IN FILE
		; IF F.COM IS ALSO ON.  SET, CLEARED AND LOOKED AT BY FILPUT ONLY
  F.COM==1B5	;MAKE ALL LINES TO FILE BE COMMENT IF THIS FLAG IS ON
		; USES F.FLF TO KNOW WHEN TO PUT ; OUT
		; SET AND CLEARED BY FILCOM AND TTYIN ROUTINES ONLY
		; LOKED AB BY FILPUT ROUTINE
  F.LPAR==1B6	;LEFT PAREN SEEN BY TTYOUT IN TTY OUTPUT STREAM.
		; USED TO SUPPRESS PROMPTING IF IN SHORT HELP MODE
		; CLEARED WHEN RIGHT PAREN SEEN.  SET, CLEARED,
		; AND USED BY TTYOUT ROUTINE ONLY.
  F.LBRK==1B7	;LEFT BRACKET SEEN BY TTYOUT IN TTY OUTPUT STREAM
		; YSED TO SUPPRESS EXPLANATION UNLESS IN LONG MODE
		; SET, CLEARED AND TESTED BY TTYOUT ROUTINE ONLY
  F.CONZ==1B8	;CONTROL Z TYPED IN ON TTY, SET BY TTYGET
  F.EXP==1B9	;IN LSTEXP, SET IF EXPLAIN, CLEARED IF LIST
  F.HOPN==1B10	;SET IF FGEN EXPLAIN FILE IS OPEN FOR READING
  F.HRRD==1B11	;SET IF READING EXPLAIN FILE A SECOND TIME
		; IF FILE WAS OPEN, MAY START SEARCHING PAST THE ENTRY DESIRED.
		; AT END OF FILE, REREAD FROM THE BEGINNING ONCE.
  F.2DEC==1B12	;SET IF WANT AT LEAST TWO CHARS IN DECIMAL OUTPUT
  F.FHLC==1B13	;SET IF LOOKING FOR TAB AFTER TEXT IN FGEN HELP FILE
  F.PER==1B14	;SET IF A PERIOD, DOLLAR SIGN  OR PERCENT CAN BE PART OF SYMBOL
		; USED TO DISTINGUISH BETWEEN FILE NAMES AND SYMBOLS
  F.INFO==1B15	;SET BY ASKMNP TO INDICATE MORE INFO WILL FOLLOW M-N OR CTY
		; RESET BY ASKMN TO INDICATE END OF STRING EXPECTED AFTER M,M-N, OR CTY
  F.BANG==1B16	;ALLOW THE INPUT LINE TO CONTAIN A "!" WITHOUT TAKING
		;  IT AS A COMMENT
;RH(F) BITS
  F.1FH==1B35	;1ST RC10 ON CPU
  F.1RP==1B34	;1ST RH10/RP04 ON CPU
  F.1FS==1B33	;1ST RH10/RS04 ON CPU
  F.1DP==1B32	;1ST RP10 ON CPU
  F.1TX==1B31	;1ST TX01 ON CPU
  F.1T1==1B30	;1ST TM10 ON CPU
  F.1T2==1B29	;1ST TM02 ON CPU
  F.1D2==1B28	;1ST DX20 ON CPU
  F.1RN==1B27	;1ST RH20/RP20 ON CPU
  F.KONS==F.1FH+F.1RP+F.1FS+F.1DP+F.1TX+F.1T1+F.1T2+F.1D2+F.1RN
 F.NORN==1B28	;NO SUPPORT FOR RP20S
 F.NOT2==1B29	;NO SUPPORT FOR TM02/TM03
 F.NOT7==1B30	;NO SUPPORT FOR TM78
 F.NOTD==1B31	;NO SUPPORT FOR DX20 TAPES
 F.NOTX==1B32	;NO SUPPORT FOR DX10
 F.NORA==1B33	;NO SUPPORT FOR CI DISKS

N=1		;NUMERIC VALUE OF ASKED QUESTION.
		; ALSO USED TO SUBSTITUTE FOR * IN ALL STRINGS.
		; CAN BE LEFT JUSTIFIED SIXBIT.
		; YES ANSWERS ARE 1, NO ANSWERS ARE 0.
T1=2		;TEMPORARY AC. USUALLY ADR OF ASCIZ MESSAGE ON SUB CALL.
T2=T1+1		;FOR REMAINDER IN DIVISION
WD=4		;WORD AC ON CALLS TO GETWRD(LEFT JUSTIFIED SIXBIT)
B=5		;BYTE POINTER TO TEXT STRING
R=6		;INPUT AND OUTPUT RADIX
LV=7		;MODE OF ASKING QUESTIONS(-1=SHORT,0=PROMPT,1=LONG)
I=10		;INDEX FOR LOOP COUNTS
CH=11		;CHARACTER AC
I2=12		;SECOND INDEX FOR LOOP COUNTS
I3=13		;3RD INDEX FOR LOOP COUNTS
RH12=14		;=0 FOR RH10, =1 FOR RH20
P1=15		;"PERMANENT" ACS. THE SAVE ROUTINES DON'T EXIST,
P2=16		; USE AT GEN LEVEL FOR LOOP VARIABLES, ETC.
P=17		;PD POINTER

;SPECIAL ASCII CHARACTERS(NEVER CODE IN OCTAL SO CAN USE CREF):
C.RUB==177	;RUBOUT
C.ALT1==175	;OLD ALT MODES
C.ALT2==176	;OLD ALT MODE ON SOME TTYS
C.ESC==33	;MAP ALTS INTO ESCAPE
C.CONZ==32	;CONTROL Z
C.FF==14	;FORM FEED
C.CR==15	;CARIAGE RETURN
C.LF==12	;LINE FEED
C.CONC==3	;CONTROL C
C.TMFH==1	;CONTROL A IS TERMINATOR IN FGEN AUXILIARY HELP FILE

;STANDARD MAXIMUMS FOR QUESTIONS

SM.CPU==3	;MAXIMUM NUMBER OF CPU'S
SU.CPU==6	;MAX UNSUPPORTED CPUS
SM.DF==^D8	;MAXIMUM NUMBER OF DF10 DATA CHANNELS
SM.RC==2	;MAXIMUM NUMBER OF RC10S PER CHANNEL
SM.RP==3	;MAXIMUM NUMBER OF RP10S PER CHANNEL
SM.KPC==10	;MAXIMUM NUMBER OF KONTROLLERS PER CHANNEL
SM.JOB==777	;MAXIMUM NUMBER OF JOBS SYSTEM MAY INCLUDE
SM.PI==7	;MAXIMUM PI CHANNEL NUMBER
SM.AC==17	;HIGHEST AC NUMBER FOR HIGHEST-AC-TO-SAVE
SM.RTD==^D77	;MAXIMUM NUMBER OF REAL TIME DEVICES
SM.HPQ==^D15	;MAXIMUM NUMBER OF HIGH PRIORITY QUEUES
SM.CDR==2	;MAXIMUM NUMBER OF CDRS
SM.DTA==2	;MAXIMUM NUMBER OF DTA CONTROLLERS
SM.LPT==3	;MAXIMUM NUMBER OF LPTS
SM.PLT==2	;MAXIMUM NUMBER OF PLOTTERS
SM.PTY==^D510	;MAXIMUM NUMBER OF PTYS
SM.DL10==2	;MAXIMUM NUMBER OF DL10'S
SM.CONN==^D512	;MAXIMUM NUMBER OF CONNECTS
SM.RMCR==^D512	;MAXIMUM NUMBER OF REMOTE TTY'S
SM.KDUP==^D2	;MAXIMUM NUMBER OF DUP-11S ON A KMC-11
SM.DMRN==^D8	;Maximum number of DMR11s on a 2020
SM.RXK==^D2	;Maximum number of RX211 controllers on a 2020
SM.RXD==^D2	;Maximum number of RX02 drives on an RX02
SM.TTG==^D8	;MAXIMUM NUMBER OF TTY 8-LINE GROUPS
SM.68L==^D100	;MAXIMUM NUMBER OF LINES ON DC68
SM.MPI==^D16384	;MAXIMUM NUMBER OF PAGES SUPPORTED ON KL10
SM.XTC==4	;MAXIMUM NUMBER OF DA28C CHANNELS
SM.D78==^D8	;MAXIMUM NUMBER OF DAS78'S (IBM 360,370,2780 SUPPORT)
SM.D60==^D7	;MAXIMUM NUMBER OF DN60'S (IBM BSC INTERFACES)
SM.XTC==4	;MAXIMUM NUMBER OF DA28C CHANNELS
SM.DLP==2	;MAXIMUM NUMBER OF LINE PRINTER ON 1091 FRONT END
SM.DCR==1	;MAXIMUM NUMBER OF CARD READERS ON 1091 FRONT END
;DEFAULT VALUES OUTPUT BY MONGEN, MOSTLY FOR OLD SYMBOLS

IFNDEF MD.PG,<MD.P6==0>		;NO PDP 6
IFNDEF MD.2RR,<MD.2RR==1>	;ALWAYS 2 RELOCATION REGISTERS
IFNDEF MD.SEG,<MD.SEG==0>	;ALWAYS NO EXTRA SEGMENTS
IFNDEF MD.DDT,<MD.DDT==1>	;ALWAYS LOAD EDDT
IFNDEF MD.MOV,<MD.MOV==0>	;NO MOVIE
IFNDEF MD.C10,<MD.C10==1>	;CDR IS ALWAYS CR10
IFNDEF MD.DTC,<MD.DTC==0>	;NO PDP 6 DECTAPE
IFNDEF MD.TMC,<MD.TMC==0>	;NO PDP 6 MAGTAPE
IFNDEF MD.TWJ,<MD.TWJ==0>	;STANDARD VALUE FOR TMPCOR PARAMETERS
IFNDEF MD.TLJ,<MD.TLJ==0>	;...

	SUBTTL	MACROS AND DEFINITIONS FOR MONGEN'S MONGEN DIALOG

;THE FOLLOWING MACRO DEFINES ALL OF THE UNSUPPPORTED QUESTIONS.
;THE ORDER OF ENTRIES IS NOT IMPORTANT TO MONGEN, BUT IT DOES EFFECT
;DOCUMENTATION/CONTROL FILES WHICH USE THE "ALL" MODE.

;TO ADD AN UNSUPPORTED FEATURE, ADD AN "FT" LINE BELOW, THEN USE
;SKPFTT	FEATURE 	SKIP IF FT TRUE
;SKPFTF FEATURE		SKIP IF FT FALSE

	DEFINE	UNSUPPORTED,<
	XLIST
FT	CD20,<CD20 Unibus card-readers>
FT	CR10,<I/O bus card reader>
FT	CP10,<I/O bus card punch>
FT	CPUS,<More than supported number of CPUs>
FT	CPUTYP,<Unsupported CPU types>
FT	DA28,<DA28 Interprocessor link>
FT	DAS78,<DAS78 IBM interface>
FT	DMR,<DMR-11 synchronous line controller>
FT	DN60,<IBM 2780/3780/HASP communications>
FT	DC10,<DC10 data line scanner>
FT	DC68,<680I PDP-8 based terminal concentrator>
FT	DC72,<DC72 PDP-8 remote stations>
FT	DC75,<DC75-NP network>
FT	DC76,<DC76 Asynchronous Front End>
FT	DIS,<VP series displays>
FT	DN87,<DN87 DL10-based ANF front end>
FT	DTA,<DECtapes>
FT	DX10,<DX10 Tape controller>
FT	EXTCHN,<External channels>
FT	KASER,<KA Floating-point simulator>
FT	METER,<Software performance meter>
FT	PLT,<Plotters>
FT	PTP,<Paper-tape punch>
FT	PTR,<Paper-tape reader>
FT	RTRXPW,<Control ROUTER's transmit password>
FT	RC10,<RC10 controller for RD10 disk>
FT	RX20,<RX20 Floppy disk controller for 2020>
FT	TM10,<TM10 I/0 bus magtape controller>
	LIST
		>
;BUILD THE MONGEN SYMBOL TABLE.  EACH ENTRY IS OF THE FORM
;	$FEATURE:	SIXBIT/FEATURE/
;			XWD	FLAGS,,STRING
;
;WHERE THE SIGN BIT OF FLAGS INDICATES WHETHER TO ASK THE QUESTION, AND
;STRING IS THE ADDRESS OF THE ASCIZ ASKYN STRING USED TO ASK IT.

	DEFINE	FT(DEVICE,STRING),<
$'DEVICE:	EXP	SIXBIT	/DEVICE/
	XWD	0,[ASCIZ ~'DEVICE'(Y,N)['STRING']: ~]
		>

UNSTAB:	UNSUPPORTED
	UNSTBL==<.-UNSTAB>/2

;MACROS TO MAKE IT OBVIOUS WHEN WE FIDDLE WITH UNSUPPORTED STUFF
;

;SKIP IF FEATURE TEST TRUE
	DEFINE	SKPFTT(FTX),<SKIPL	$'FTX+1>

;SKIP IF FEATURE TEST FALSE
	DEFINE	SKPFTF(FTX),<SKIPGE	$'FTX+1>
IFNDEF MD.DCS,<MD.DCS==0>	;NO PDP 6 SCANNER
;BITS IN FEATURE TEST SWITCH TABLE

FS.VAL==1B0	;CURRENT VALUE MUST BE SIGN BIT

ZZ==1		;CURRENT BIT

FS.0==1B<ZZ>	;LEFT MOST BIT FOR CONFIGURATION FIELD

	DEFINE	FTSDEF(A),<
IRP A,<FS'A==1B<ZZ>	;ON IF DEFAULT ON FOR A
ZZ==ZZ+1
>>

	FTSDEF	<1070,1080,1090,1091,2020>

IFG ZZ-^D12,<PRINTX TOO MANY CONFIGURATIONS - MUST CHANGE FEATURE TEST TABLE>
;IO CHANNELS:
TTYCHN==0	;TTY INPUT AND OUTPUT CHANNEL
FILCHN==1	;FILE OUTPUT CHANNEL
FHLPCH==2	;FGEN AUXILIARY HELP FILE CHANNEL

;IO STATUS BITS:
IO.EOF==20000	;END OF FILE

;NUMBER OF I/O BUFFERS
NFILBF==2	;NUMBER OF BUFFERS FOR FILE OUTPUT
NFHLPB==2	;NUMBER OF BUFFERS FOR FGEN AUXILIARY HELP FILE

;OPDEFS:
OPDEF	PJRST	[JRST]		;EQUIVALENT TO PUSHJ POPJ PAIR
OPDEF	PJUMPE	[JUMPE]		;EQUIVALENT TO JUMPE [PJRST]
OPDEF	GETTAB	[CALLI 41]	;READ MONITOR TABLE
OPDEF	SAVE.	[CALLI 210]	;SAVE. UUO

;UUOSYM SYMBOLS

.GTRDV==135			;DEVICE PROGRAM IS RUN FROM
.GTRDI==136			;DIRECTORY PROGRAM IS RUN FROM
.GTRFN==137			;FILE PROGRAM IS RUN FROM
.GTRS0==145			;SFD PROGRAM IS RUN FROM
.PTPPN==2			;PPN OF THE PATH
.PTSFD==3			;BEGIN SFDS IN PATH BLOCK
.PTMAX==11			;LENGTH OF PATH BLOCK
SUBTTL	INITIALIZATION, AND DISPATCH TO PROPER GEN, CLOSE FILES

BEGINA:	HLRZ	16,.JBSA##	;GET TRUE .JBFF
	CAME	16,.JBFF	;SEE IF SAME
	JRST	BEGIN		;NO--MUST BE ^C START
	HRROI	T1,.GTRDV	;GET DEVICE WE RAN FROM
	GETTAB	T1,
	  SETZ	T1,		;ERROR, ZERO THE AC
	MOVEM	T1,RUNDEV	;STORE
	HRROI	T1,.GTRDI	;GET THE PPN WE RAN FROM
	GETTAB	T1,
	  SETZ	T1,		;ERROR. ZERO THE AC
	MOVEM	T1,RUNPPN	;STORE
	MOVEM	T1,RUNPTH+.PTPPN;STORE PPN IN PATH BLOCK TOO
	MOVSI	T2,-5		;SET UP AOBJN FOR SFD GETTABS

BEGINB:	HRROI	T1,.GTRS0(T2)	;GET AN SFD NAME
	GETTAB	T1,
	  JRST	BEGINC		;NO MORE SFD'S
	JUMPE	T1,BEGINC	;END OF SFD'S
	MOVEM	T1,RUNPTH+.PTSFD(T2)	;STORE THE SFD NAME IN THE PATH BLOCK
	AOBJN	T2,BEGINB	;GET NEXT SFD

BEGINC:	SETZM	RUNPTH+.PTSFD(T2);ZERO NEEDS TO TERMINATE THE PATH BLOCK
	MOVEI	T1,RUNPTH	;GET ADDRESS OF PATH BLOCK
	SKIPE	RUNPTH+.PTSFD	;ANY SFDS?
	MOVEM	T1,RUNPPN	;YES. POINT TO PATH BLOCK FOR LOOKUP

BEGIN:	RESET			;RESET IO DEVICES
	AOS	.JBFF		;ADVANCE .JBFF TO FLAG BEGINA THAT AC'S WERE CLOBBERED
	MOVE	P,[IOWD MP.PDL,PDLIST]	;RESET PD PTR, SINCE HERE ON IO ERRORS
				; FROM ROUTINE DEEP IN STACK
	SETZB	F,VARBEG	;CLEAR ALL FLAGS AND VARIABLE AREA
				; EXCEPT SAVLV WHERE VERBOSCITY
				; LEVEL IS SAVED AND DEBUG AND HELPF
	MOVE	LV,SAVLV	;SETUP HELP LEVEL FOR NEXT QUESTION
				; FROM LONG TERM VALUE(INITIALLY PROMPT)
				; ^C START REMEMBERS LAST PERMANENT LEVEL
				; SINCE SAVLV IS NOT CLEARED
	MOVE	T1,[XWD VARBEG,VARBEG+1]
	BLT	T1,VAREND	;CLEAR VARIABLE AREA
	INIT	TTYCHN,1	;TTY IN LINE MODE
	SIXBIT	/TTY/
	XWD	TOBUF,TIBUF	;OUTPUT,INPUT BUFFER HEADERS
	  RJRST	<EREXIT	<Cannot INIT TTY>,,>	;TYPE ? INTERNAL ERR AND EXIT
	AOSLE	HELPF		;ALREADY TOLD USER ABOUT HELP?
	JRST	BEGINR		;YES, SKIP THIS
	MOVSI	N,-UNSTBL	;POINT TO TABLE
	SETZ	N+1,		;CLEAR ACCUMULATED FLAGS
BEGINP:	IOR	N+1,UNSTAB+1(N)	;SEE IF THIS IS ON
	AOJ	N,		;2 WORD ENTRIES
	AOBJN	N,BEGINP	;LOOP ON
	JUMPGE	N+1,BEGINQ	;ALL IS WELL, JUST ASK FOR HELP
	TTYOUT	<@@			CAUTION@
	This MONGEN includes dialog for UNSUPPORTED monitor options.
    Digital may not support a monitor generated with such code enabled.@@>
BEGINQ:	PUSHJ	P,TTYHLP	;NO, ASK USER FOR LEVEL OF VERBOSITY WITH /HELP
BEGINR:	TLZ	F,(F.CONZ)	;CLEAR CONTROL Z TYPED FLAG
	SKIPN	N+1,RUNDEV	;SKIP IF DEVICE FROM WHICH MONGEN WAS RUN
	MOVSI	N+1,'DSK'	;SPECIFIED, ELSDE START WITH DSK
	SETZB	N,N+2		;CLEAR MODE AND BUFFER HEADERS
	MOVEM	N+1,FGDEV	;STORE DEVICE IN CASE WINS
	OPEN	FILCHN,N	;OPEN DEVICE
	  JRST	FNDF1		;NO SUCH DEVICE?
	MOVE	N,FHNAME	;NAME OF FGEN HELP FILE
	HLLZ	N+1,FHNAME+1	;AND EXT
	MOVE	N+3,RUNPPN	;PPN FROM WHICH MONGEN WAS RUN
	MOVEM	N+3,FGPPN	;SAVE IN CASE WINS
	LOOKUP	FILCHN,N	;SEE IF FOUND HELP FILE
	  JRST	FNDF1		;NO, TRY SYS
	JRST	FNDFOK		;FOUND OUR HELP FILE
FNDF1:	MOVSI	N+1,'SYS'	;TRY DEVICE SYS
	MOVEM	N+1,FGDEV
	SETZB	N,N+2
	OPEN	FILCHN,N	;OPEN SYS
	  JRST	FNDF2		;NO SYS?
	MOVE	N,FHNAME	;NAME OF HELP FILE
	HLLZ	N+1,FHNAME+1	;AND EXT
	SETZB	N+3,FGPPN	;CLEAR PPN
	LOOKUP	FILCHN,N	;SEE IF FO[UND HELP FILE
	  JRST	FNDF2		;NO, GIVE UP
	JRST	FNDFOK		;OK, USE SYS VERSION
FNDF2:	SETZM	FGDEV		;CLEAR DEVICE SO ALWAYS FAILS
	TTYOUT	<%Can't find FGEN.HLP@>
FNDFOK:	ASKLST	<Which GEN(HDW,NET,F,MUNGEN)[
HDW to define hardware configuration
NET to define network configuration
F to define software features
MUNGEN to include UNSUPPORTED questions in the other dialogs]>
	TLNE	F,(F.CONZ)	;DID USER TYPE CONTROL Z?
	EXIT			;YES, EXIT TO MONITOR
	MOVEM	N,WCHGEN	;STORE WHICH GEN(0=HDW, 1=NET, 2=F, 3=MONGEN)

	CAIN	N,3		;MONGEN?
	 JRST	MUNGEN		;YES, DO MUNGEN STUFF

;LOOP TO ASK FOR FILE UNTIL SUCCESSFUL ENTER CAN BE DONE.  SO INIT VARIABLES.
ASKFIL:	MOVSI	T1,(SIXBIT /DSK/) ;ASSUME DSK
	MOVEM	T1,OUTDEV	;IF USER DOES NOT SPECIFY DEVICE
	MOVE	N,WCHGEN	;THE GEN NUMBER(0-2)
	MOVE	N,FILTAB(N)	;DEFAULT FILE NAME FOR THIS GEN
				; HDWCNF,NETCNF,F
	HLLZM	N,WCHNAM	;STORE NAME OF THIS GEN(NET,MON,F)
	MOVEM	N,OUTNAM	;ALSO SETUP DEFAULT FILE NAME FOR THIS GEN
	MOVSI	T1,(SIXBIT /MAC/) ;ASSUME EXTENSION OF MAC
	MOVEM	T1,OUTEXT	;FOR FILE EXTENSION
	SETZM	OUTDAT		;CLEAR DATE ARG
	SETZM	OUTPPN		;AND PROJECT,PROGRAMMER ARG
	ASKSTR	<Output(DSK:*.MAC)>,OUTNAM ;ASK FOR FILE SPEC
	MOVEI	WD,0		;SET WORD VALUE TO 0 AS FLAG THAT NO SPEC
	JUMPE	CH,OPNDEV	;IF CHARACTER IS 0, JUST CR TYPED
	PUSHJ	P,GETWRD	;GO GET WHAT MAY BE DEV: OR FILENAME
	CAIE	CH,":"		;IS BREAK DEVICE SEPARATOR?
	JRST	OPNDEV		;NO, SAVE FILE NAME AND GO INIT DEVICE
	MOVEM	WD,OUTDEV	;YES, STORE USER SUPPLIED DEVICE NAME
	PUSHJ	P,GETWRD	;GET NEXT WORD USER TYPED(FILE NAME)
OPNDEV:	INIT	FILCHN,1	;INIT FILE CHANNEL IN ASCII LINE MODE
OUTDEV:	SIXBIT	/DSK/		;DEVICE NAME
	XWD	FOBUF,0		;OUTPUT BUFER HEADER
	  RJRST	<TTYOUT <? Device * not available@>,OUTDEV ;TYPE ERROR
		 JRST	ASKFIL>	;GO ASK FOR FILE SPEC AGAIN
	PUSH	P,.JBFF##	;SAVE JOBFF
	MOVEI	T1,FILBUF	;ADDR OF FILE BUFFERS
	MOVEM	T1,.JBFF	;SET UP JOBFF TO ALLOCATE OUR BUFFERS
	OUTBUF	FILCHN,NFILBF	;ALLOCATE BUFFERS
	POP	P,.JBFF		;RESTORE JOBFF
	JUMPE	WD,OUTDV0	;WAS NO FILE NAME TYPED?
	MOVEM	WD,OUTNAM	;STORE CUSTOMER SUPPLIED FILE NAME

OUTDV0:	CAIE	CH,"."		;NO, WELL BETTER BE EXTENSION NEXT
	JRST	OUTDV3		;NO, GO CHECK FOR BRACKET FOR PPN
	PUSHJ	P,GETWRD	;GO GET EXTENSION
	HLLM	WD,OUTEXT	;AND STORE FOR ENTER
OUTDV3:	JUMPE	CH,OUTDV4	;END OF LINE(CR=0)?
	CAIE	CH,"["		;NO, BETTER BE LEFT BRACKET FOR PPN
OUTDV1:	JRST	FMTERR		;NO, INCREASE VERBOSITY LEVEL AND ASK AGAIN
	PUSHJ	P,GETOCT	;GET PROJ NUMBER
	CAIE	CH,","		;IS BREAK COMMA?
	JRST	FMTERR		;NO, INCREASE VERBOSITY AND ASK AGAIN
	HRLZM	N,OUTPPN	;YES, STORE PROJECT NO.
	PUSHJ	P,GETOCT	;GET PROG NUMBER
	JUMPE	CH,OUTDV2	;JUMP IF END OF LINE, END OF PPN
	CAIE	CH,"]"		;IS BREAK RIGHT BRACKET?
FMTERR:	RJRST	<TTYOUT	<? Not DEV:FILE.EXT[P,PN]@>
		AOJA	LV,ASKFIL>	;INCREASE LEV AND ASK AGAIN
OUTDV2:	HRRM	N,OUTPPN	;STORE PROG NUMBER
	JUMPE	CH,OUTDV4	;JUMP IF END OF LINE
	PUSHJ	P,GETWRD	;GET NEXT WORD
	JUMPN	WD,FMTERR	;BETTER NOT BE ANYTHING AFTER RIGHT BRACKET
	JUMPN	CH,FMTERR	;IS BREAK CR?
OUTDV4:	MOVE	N,OUTPPN	;GET PPN TYPED
	MOVEM	N,SAVPPN	;SAVE FOR LATER
	ENTER	FILCHN,OUTNAM	;TRY TO ENTER FILE ON DEVICE
	  RJRST	<HRRZ N,OUTEXT	;ENTER ERROR CODE FOR *
		 TTYOCT <? Enter error *@>,N
		 JRST ASKFIL>	;ASK FOR FILE NAME AGAIN
	MOVE	LV,SAVLV	;RESTORE PERMANENT HELP LEVEL
	TLO	F,(F.OFO!F.PER)	;FLAG THAT OUTPUT FILE IS NOW OPEN
				; SO FILPUT WONT BE A NO-OP
				; AND ALLOW PERIODS IN SYMBOLS
	MOVE	T1,WCHGEN	;ENTER OK, GET WHICH GEN THIS IS
	PUSHJ	P,@GENTAB(T1)	;DISPATCH TO PROPER GEN
				; HDWGEN, NETGEN, FGEN
	MOVE	LV,SAVLV	;RESTORE PERMANENT HELP LEVEL
				; IN CASE USER TYPED /H<CR>
	FILCOM	<@END OF *>,OUTNAM
	HLLZ	N,OUTEXT	;EXTENSION OF FILE WRITTEN
	FILCOM	<.*@>,N
	MOVEI	CH,C.FF		;FORM FEED
	PUSHJ	P,FILPUT	;TO OUTPUT FILE
	CLOSE	FILCHN,		;CLOSE OUTPUT FILE
	TLZ	F,(F.OFO)	;FLAG THAT OUTPUT FILE IS NOT OPEN
				; SO FILPUT WILL BE A NO-OP
	STATZ	FILCHN,740000	;ANY ERRORS ON LAST BUFFER

;HERE ON ANY FILE ERRORS DURING EXECUTION
FILERR:	  RJRST	<TTYOUT <? File * error>,OUTNAM
		 GETSTS	FILCHN,N ;GET FILE STATUS FROM MONITOR
		 TLZ	N,-1	;MAKE SURE NO STUFF IN LH
		 TTYOCT	<*@>;OUTPUT STATUS NUMBER AND CR
		 JRST .+1>	;CONTINUE
	RELEASE	FILCHN,		;RELEASE FILE CHANNEL
	TTYOUT	<File >
	SKIPN	N,OUTDEV	;SKIP IF DEVICE SPECIFIED
	JRST	CLTY1		;NO, DONT TYPE DEVICE
	TTYOUT	<*:>,N
CLTY1:	TTYOUT	<*>,OUTNAM
	HLLZ	N,OUTEXT	;INCLUDE EXTENSION
	TTYOUT	<.*>,N
	SKIPN	N,SAVPPN	;SKIP IF PPN SPECIFIED
	JRST	CLTY2		;NO, DONT TYPE PPN
	PUSH	P,LV		;SAVE CURRENT HELP LEVEL
	MOVEI	LV,1		;ASSUME LONG SO PPN WILL PRINT
	HLRZS	N		;N=PROJECT
	TTYOCT	<[*,>,N
	HRRZ	N,SAVPPN	;N=PROGRAMMER
	TTYOCT	<*]>,N
	POP	P,LV		;RESTORE CURRENT HELP LEVEL
CLTY2:	MOVE	N,WCHGEN	;WHICH GEN RUN
	HLLZ	N,FILTAB(N)	;PICK UP NAME OF GEN
	TTYOUT	< Closed [*GEN finished]@@>,N ;ALSO WHICH GEN
	JRST	BEGIN		;GO BACK AND ASK FOR NEXT GEN
				; KEEP SAME HELP LEVEL AND DO NOT ASK /HELP
	SUBTTL	MUNGEN - DIALOG TO DEFINE MONGEN FEATURES

	COMMENT	@

If thou art in haste, remember the words of Mablung the seer, and the
Paths of the Dead....

		@

MUNGEN:	TTYOUT	<@@			CAUTION
    The MONGEN dialog alters MONGEN so that it includes dialog for devices
    not currently supported by Digital.  

    Digital may not support a monitor generated with such code enabled.@@>

MUNLUP:	ASKLST	<Mode(EXIT,ALL,INCLUDE,EXCLUDE,LIST)[
EXIT	Exits the MUNGEN configuration dialog
ALL	Asks about all known unsupported options
INCLUDE	Allows you to include a list of unsupported options by name
EXCLUDE	Allows you to exclude a list of unsupported options by name
LIST	Allows you to list unsupported option status]>
	PUSHJ	P,@[EXP	MUNXIT,MUNALL,MUNINC,MUNEXC,MUNLST](N)
	JRST	MUNLUP

;EXIT MUNGEN MODE
MUNXIT:	POP	P,(P)		;FIX STACK, NOT THAT IT MATTERS
	MOVE	LV,SAVLV	;RESTORE PERMANENT HELP LEVEL
	SETOM	HELPF		;MAKE SURE WE SAY WE'RE UNSUPPORTED
	SETZM	SAVLV		;RETURN TO 'PROMPT' MODE
	MOVE	T1,SAVBLK+1	;GET OUR NEW NAME
	SETNAM	T1,		;Ummm
	ASKYN	<Save(Y,N)[
Do you want to save this configured MONGEN on DSK:MUNGEN.EXE for later use]>
	JUMPE	N,BEGIN		;IF NOT, DON'T
	MOVE	LV,SAVLV
	SETOM	HELPF
	MOVEI	T1,SAVBLK	;POINT TO SAVE SPEC
	SAVE.	T1,		;SAVE OURSELF
	 HALT	.		;SIGH
	OUTSTR	[ASCIZ	/
[DSK:MUNGEN.EXE written]
/]
	JRST	BEGIN		;OFF WE GO.

SAVBLK:	SIXBIT	/DSK/
	SIXBIT	/MUNGEN/
	SIXBIT	/EXE/
	EXP	0,0,0
;SET ALL MODE
MUNALL:	MOVSI	I,-UNSTBL	;LENGTH OF UNSUPPORTED TABLE
MUNALP:	HRRZ	T1,UNSTAB+1(I)	;GET ADDRESS OF STRING
	PUSHJ	P,ASKZYN	;ASK
	SKIPN	N		;YES?
	 SKIPA	N,[ANDCAM T1,UNSTAB+1(I)] ;NO, CLEAR BIT
	MOVE	N,[IORM   T1,UNSTAB+1(I)];YUP, ENABLE QUESTION
	MOVSI	T1,(1B0)	;SO
	XCT	N		;DO WHAT WE'RE TOLD
	AOJ	I,		;BI-WORDS
	AOBJN	I,MUNALP	;DO FOR ALL OPTIONS
	MOVE	LV,SAVLV	;RESTORE HELP LEVEL
	POPJ	P,		;RETURN

;INCLUDE MODE
MUNINC:	MOVSI	N,'*  '		;ALLOW WILDCARDS
	ASKSTR	<Options(Name,Name...or "*")[
Enter one or more option names to be included, delimited by commas.@]>
	SETZ	WD,
	JUMPE	CH,MNIEND	;ALL DONE
MNILP1:	PUSHJ	P,GETWRD	;READ OPTION NAME
	JUMPN	WD,MNILP2	;LEGAL IF NON-ZERO
	CAIE	CH,"*"		;SEE IF WANT ALL
	 JRST	MNIERR		;ERROR
	ILDB	CH,B		;GET NEXT CHAR
	JUMPE	CH,SETOPT	;CLEAR ALL OPTIONS
	JRST	MNIERR		;ERROR IF NOT EOL
MNILP2:	PUSHJ	P,FNDOPT	;FIND THIS OPTION
	 JRST	MNIERR		;ERROR
	MOVSI	T1,(1B0)	;BIT
	IORM	T1,UNSTAB+1(I)	;SET IT FOR NAMED OPTION
	CAIN	CH,","		;BREAK ON COMMA
	 JRST	MNILP1		;COMMA,GET ANOTHER
	JUMPN	CH,MNIERR	;IF NOT EOL, ERROR
MNIEND:	JRST	MNEEND		;COMMON EXIT

MNIERR:	MOVE	N,WD		;GET LAST WORD
	TTYOUT	<@? Unknown option name "*"@>
	JRST	MUNINC		;TRY AGAIN
;EXCLUDE MODE
MUNEXC:	MOVSI	N,'*  '		;ALLOW WILDCARDS
	ASKSTR	<Options(Name,Name...or "*")[
Enter a list of option names to be excluded, delimited by commas@]>
	SETZ	WD,
	JUMPE	CH,MNEEND	;ALL DONE
MNELP1:	PUSHJ	P,GETWRD	;READ OPTION NAME
	JUMPN	WD,MNELP2	;LEGAL IF NON-ZERO
	CAIE	CH,"*"		;SEE IF WANT ALL
	 JRST	MNEERR		;ERROR
	ILDB	CH,B		;GET NEXT CHAR
	JUMPE	CH,CLROPT	;CLEAR ALL OPTIONS
	JRST	MNEERR		;ERROR IF NOT EOL
MNELP2:	PUSHJ	P,FNDOPT	;FIND THIS OPTION
	 JRST	MNEERR		;ERROR
	MOVSI	T1,(1B0)	;BIT
	ANDCAM	T1,UNSTAB+1(I)	;CLEAR IT FOR NAMED OPTION
	CAIN	CH,","		;BREAK ON COMMA
	 JRST	MNELP1		;COMMA,GET ANOTHER
	JUMPN	CH,MNEERR	;IF NOT EOL, ERROR
	JRST	MNEEND		;COMMON EXIT

MNEERR:	MOVE	N,WD		;GET LAST WORD
	TTYOUT	<@? Unknown option name "*"@>
	JRST	MUNEXC		;TRY AGAIN

;HELPER ROUTINE TO FIND AN OPTION NAME BLOCK (WD) IN UNSTAB
;RETURNS OFFSET TO FIRST WORD OF ENTRY IN I

FNDOPT:	MOVSI	I,-UNSTBL	;TABLE LENGTH
FNDOPL:	CAMN	WD,UNSTAB(I)	;MATCH THIS ENTRY
	 JRST	CPOPJ1		;YES, RETURN I
	AOJ	I,		;BIWORDS
	AOBJN	I,FNDOPL	;LOOP
	POPJ	P,		;ERROR RETURN

;HELPER ROUTINES TO SET/CLEAR ALL OPTIONS

SETOPT:	SKIPA	WD,[IORM T1,UNSTAB+1(I)]
CLROPT:	 MOVE	WD,[ANDCAM T1,UNSTAB+1(I)]
	MOVSI	I,-UNSTBL	;TABLE LENGTH
	MOVSI	T1,(1B0)	;BIT
OPTXXL:	XCT	WD		;SET/CLEAR
	AOJ	I,		;BIWORDS
	AOBJN	I,OPTXXL	;LOOP

MNEEND:	MOVE	LV,SAVLV
	TTYOUT	<@>
	POPJ	P,		;DONE
;LIST MODE
MUNLST:	MOVSI	I,-UNSTBL	;LENGTH OF TABLE
	TTYOUT	<
Option	 State		Option	 State		Option	 State@>
MUNLLP:	MOVE	N,UNSTAB(I)	;GET OPTION NAME
	TTYOUT	<*	>
	SKIPGE	UNSTAB+1(I)	;SET?
	 JRST	MUNLL1		;YES
	TTYOUT	< Excluded>
	JRST	MUNLL2		;NO
MUNLL1:	MOVSI	N,'*  '		;MAKE INCLUDED ENTRIES STICK OUT
	TTYOUT	<*Included>
MUNLL2:	HRRZ	N,I		;GET COLUMN
	LSH	N,-1		;MAKE TABLE INDEX INTO ITEM INDEX
	IDIVI	N,3		;COLUMNS
	CAIE	N+1,2		;IF COL 3, NEW LINE
	 JRST	[TTYOUT	<	>
		 JRST	MUNLL3]	;0-1
	TTYOUT	<@>
MUNLL3:	ADDI	I,1		;BIWORDS
	AOBJN	I,MUNLLP	;TRY ALL
IFN	UNSTBL-<<UNSTBL/3>*3>,<	;IF LAST LINE NOT FULL, END IT
	TTYOUT	<@>
>
	TTYOUT	<@>		;BLANK LINE
	MOVE	LV,SAVLV
	POPJ	P,
SUBTTL	FGEN - DIALOG TO DEFINE SOFTWARE FEATURES

FGEN:	FILOUT	<UNIVERSAL	F - SOFTWARE FEATURE TEST FILE OUTPUT BY MONGEN DIALOG@@@>
	MOVEI	N,VERSION	;PUT MONGEN VERSION IN FILE FOR COMMON TO CHECK
	FILOUT	<INTERN	[email protected]==*@XLIST@>,N	;OUTPUT TO FILE

;HERE TO FIND OUT WHAT TYPE OF SYSTEM
	SKPFTT	CPUTYP		;UNSUPPORTED CPUTYPES
	 JRST	FGENCP		;NO, USE REGULAR QUESTION
	ASKLST	<Feature set(KIFULL,KLFULL,KSFULL)[
KIFULL Includes all Tops-10 features supported for KI10 based systems
KLFULL	Same as KIFULL but for KL10 based systems
KSFULL  Same as KIFULL but for KS10 based systems]>
	JRST	FGENCZ		;OK
FGENCP:	ASKLST	<Feature set(KLFULL,KSFULL)[
KLFULL Includes all Tops-10 features supported for KL10 based systems
KSFULL  Same as KLFULL but for KS10 based systems]>
FGENCZ:	PUSH	P,.JBFF		;SAVE JOBFF SO WILL REUSE SPACE EVERY RERUN OF FGEN
;HERE TO READ HELP FILE AND ESTABLISH SWITCHES AND THEIR BEGINNING VALUES

	PUSH	P,ASKTAB(N)	;SAVE TYPE OF SYSTEM IN SIXBIT
	MOVE	T1,.JBFF	;FIRST AVAILABLE LOCATION FOR SWITCH TABLE
	HRLI	T1,T1		;ALWAYS INDEXED BY T1
	MOVEM	T1,FTTAB	;STORE POINTER TO TABLE

;HERE TO FIND NEXT SWITCH IN FILE

FSETDF:	HRRZ	T1,.JBFF	;SWITCH TABLE ADDRESS
	ADDI	T1,MP.FTA	;ADD SIZE OF SWITCH TABLE
	CAMG	T1,.JBREL##	;IN BOUNDS?
	JRST	FSETD0		;YES,PROCEED
	CORE	T1,		;NO, GET MORE CORE
	  RJRST	<EREXIT	<Insufficient user core@>,,>
FSETD0:	FHLPOA	FT,FTABEN	;POSITION FILE AT NEXT SWITCH
	MOVE	T1,[POINT 6,WD,11] ;BYTE POINTER TO BUILD SWITCH NAME
	SETZ	WD,		;START WITH FRESH AC

FSETD1:	PUSHJ	P,FHLPRC	;GET NEXT CHAR FROM FILE
	JUMPE	CH,FSETDN	;JUMP IF END OF FILE, END OF NAME
	CAIN	CH,"("		;SKIP IF NOT END OF NAME
	JRST	FSETDN		;JUMP IF FOUND BEGINNING OF SYSTEMS FOR DEFAULT ON
	CAIL	CH,"A"		;SKIP IF NOT A LETTER
	CAILE	CH,"Z"		;SKIP IF A LETTER
	SKIPA			;NOT A LETTER, SEE IF A NUMBER
	JRST	FSETD5		;A LETTER IS PART OF A SWITCH
	CAIL	CH,"0"		;SKIP IF NOT A NUMBER EITHER
	CAILE	CH,"9"		;SKIP IF A NUMBER
	SKIPA			;NOT EITHER, TRY SPECIAL CHARACTER
	JRST	FSETD5		;A NUMBER IS PART OF A SWITCH
	CAIE	CH,"$"		;SKIP IF "$"
	CAIN	CH,"%"		;SKIP IF NOT "%"
	JRST	FSETD5		;EITHER CHARACTER IS OK
	CAIE	CH,"."		;SKIP IF "."
	JRST	FSETD4		;NOT A NUMBER,LETTER OR ($,%,.),ASSUME END
FSETD5:	SUBI	CH,"0"-'0'	;CONVERT TO SIXBIT
	TLNE	T1,770000	;NO, MORE CHARS IN NAME, SKIP IF MORE THAN SIX
	IDPB	CH,T1		;STORE CHAR IN NAME
	JRST	FSETD1		;AND LOOP

FSETDN:	MOVEM	WD,@.JBFF	;STORE NAME IN SWITCH TABLE
FSETD2:	PUSHJ	P,GETWRF	;GET NEXT SYSTEM TYPE FOR WHICH SHOULD BE ON
	CAMN	WD,(P)		;SKIP IF NOT THIS TYPE OF SYSTEM
	JRST	FSETDO		;YES, TURN SWITCH ON
	CAIE	CH,")"		;SKIP IF END OF LIST OF SYSTEMS
	JRST	FSETD2		;NO, SEE IF NEXT IS OUR TYPE
	JRST	FSETD3		;YES, MUST BE OFF
;HERE IF SWITCH IS TO BE ON FOR THIS TYPE OF SYSTEM

FSETDO:	MOVSI	WD,400000	;SET SIGN BIT FOR CURRENT VALUE
	IORM	WD,@.JBFF	;STORE IN TABLE

	JRST	FSETD3		;MOVE TO NEXT SWITCH
FSETD4:	MOVEM	WD,@.JBFF	;STORE SWITCH NAME AND VALUE OFF
FSETD3:	AOS	.JBFF		;BUMP POINTER TO NEXT SWITCH
	JRST	FSETDF		;AND KEEP READING SWITCHES
;HERE WHEN NO MORE SWITCHES TO BE FOUND

FTABEN:	MOVE	T1,.JBFF	;END OF TABLE SO FAR
	HRLI	T1,N		;PLUS N FOR INDEXING TO ADD ENTRIES
	MOVEM	T1,FTADD	;STORE POINTER FOR ADDING ENTRIES
	SETZM	(T1)		;CLEAR EXTRA SPACE
	HRRZI	WD,1(T1)
	HRL	WD,T1		;MAKE BLT PTR
	BLT	WD,MP.FTA-1(T1)	;CLEAR THE SPACE
	MOVEI	T1,MP.FTA(T1)	;SAVE SOME SPACE FOR ADDING
	MOVEM	T1,.JBFF	;AND STORE THE NEW JOBFF
	HRRZ	WD,FTTAB	;LOCATION OF BEGINNING OF TABLE
	SUB	WD,T1		;MINUS LOC OF END+1=-LENGTH OF TABLE
	MOVEM	WD,FTLEN	;STORE MINUS LENGTH OF TABLE
	POP	P,(P)		;GET RID OF SYSTEM TYPE

;HERE TO ASK IF WANT STANDARD SETTING
ASKSTD:	ASKLST	<Standard setting(YES,NO,LIST,EXPLAIN)[
Standard values for all feature test switches for your configuration]>
	JUMPE	N,FNDSTD	;JUMP IF WANT STANDARD VALUES
	TTYOUT	<@Only standard settings have been tested by DEC
all other settings may produce incorrect operation. @@>
	SOJE	N,ASKFSD	;JUMP IF SAID NO
	PUSHJ	P,LSTEXP	;LIST OR EXPLAIN FEATURE TEST SWITCHES
	JRST	ASKSTD		;NOW ASK AGAIN ABOUT STANDARD SETTING
;HERE TO ASK FOR SWITCHES
ASKFSD:	BTHOUT	<Type "switch,value"(or LIST or EXPLAIN)[
For any feature test switch to define,
type "switch,value", value=0 for off or -1 for on, or
type LIST or EXPLAIN to list or explain switches.
Type one per line, extra carriage return when through.]@@>

FSDLOP:	PUSHJ	P,TTYIN		;GET NEXT LINE
	  JRST	ASKFSD		;/HELP TYPED, ASK AT PROPER HELP LEVEL
	JUMPE	CH,FSDEND	;JUMP IF END OF LINE
	PUSH	P,B		;SAVE POSITION BEFORE SWITCH
	PUSHJ	P,GETWRD	;GET SWITCH NAME
	POP	P,T1		;POSITION BEFORE READING SWITCH
	HLRZ	N,WD		;N=BEGINNING OF WORD
	TRZ	N,77		;CLEAR OUT LOWER CHAR
	CAIN	N,'FT '		;SKIP IF NOT "FT..."
	JRST	FSDLP0		;YES, DO THIS SWITCH
	MOVE	B,T1		;RESTORE BYTE POINTER TO BEFORE KEYWORD
	MOVEI	T1,[ASCIZ .(,LIST,EXPLAIN).] ;FIRST COMMA TO MAKE N COME OUT RIGHT
	PUSHJ	P,SETASK
	PUSHJ	P,FNDASK	;SEE IF LIST OR EXPLAIN
	  JRST	ASKFSD
	PUSHJ	P,LSTEXP	;DO LIST OR EXPLAIN
	JRST	ASKFSD		;AND BEGIN ASKING AGAIN

FSDLP0:	CAIE	CH,","		;SKIP IF FOLLOWED BY COMMA
	JRST	FSDERR		;JUMP IF IMPROPER FORMAT
	TLZ	WD,777700	;CLEAR "FT"
	JUMPE	WD,FSDERR	;JUMP IF NO SWITCH NAME
	PUSHJ	P,FNDSWT	;FIND SWITCH IN TABLE, RETURN INDEX IN N
	PUSH	P,WD		;SAVE SWITCH NAME
	PUSH	P,T1		;SAVE INDEX IN TABLE, EVEN IF NEW SWITCH
	PUSHJ	P,GETDEC	;GET VALUE
	JUMPE	CH,FSDLP2	;JUMP IF END OF LINE FOUND
	CAIE	CH,"-"		;SKIP IF FOUND MINUS SIGN
	JRST	FSDERR		;NO, ILLEGAL FORMAT
	PUSHJ	P,GETDEC	;GET ACTUAL VALUE
	JUMPN	CH,FSDERR	;ERROR IF NOT END OF LINE NOW
FSDLP2:	POP	P,T1		;RESTORE INDEX IN TABLE OF SWITCH
	POP	P,WD		;RESTORE SWITCH NAME IN CASE NEW
	JUMPGE	T1,FSDNEW	;JUMP IF NEW SWITCH
	MOVSI	T2,(FS.VAL)	;BIT FOR CURRENT VALUE
	ANDCAM	T2,@FTTAB	;TURN VALUE OFF
	SKIPE	N		;SKIP IF 0 SPECIFIED
	IORM	T2,@FTTAB	;NO, TURN VALUE ON
	JRST	FSDLOP		;LOOP FOR ALL SWITCHES USER TYPES
;HERE IF USER TYPED NEW SWITCH, MAKE SURE AND IF SO OUTPUT SWITCH DIRECTLY
FSDNEW:	MOVSI	T1,(FS.0)	;LEFT MOST DEFAULT BIT FOR SWITCH ENTRY
	MOVN	T2,CNFIND	;INDEX OF CONFIGURATION IN CNF TABLES
	LSH	T1,(T2)		;POSITION BIT FOR THIS CNF
	TDO	T1,WD		;ADD IN SWITCH NAME
	SKIPE	N		;SKIP IF SWITCH IS OFF
	TLOA	T1,(FS.VAL)	;SWITCH IS ON, SET VALUE BIT
	TLZ	T1,777700	;SWITCH IS OFF, CLEAR VALUE AND DEFAULT
	MOVE	N,WD		;N=SWITCH NAME
	TLO	N,'FT '		;ADD BACK "FT"
	PUSH	P,T1		;SAVE NEW SWITCH ENTRY
	ASKYN	<%New switch *(Y,N)[if Y, keep switch, else ignore it]>
	POP	P,T1		;RESTORE NEW SWITCH TABLE ENTRY
	JUMPE	N,ASKFSD	;JUMP IF IGNORE THE SWITCH
;HERE TO ADD SWITCH TO TABLE IF POSSIBLE
	MOVSI	N,-MP.FTA	;LENGTH OF EXTENDABLE TABLE
	SKIPE	@FTADD		;SKIP IF FOUND EMPTY PLACE
	AOBJN	N,.-1		;NO, KEEP LOOKING
	JUMPGE	N,FSDFUL	;JUMP IF EXTENDABLE TABLE IS FULL
	MOVEM	T1,@FTADD	;STORE NEW SWITCH IN TABLE
	JRST	ASKFSD		;GO BACK FOR MORE
FSDFUL:	FILSTR	<XP *@>
	JRST	ASKFSD

FSDERR:	TTYOUT	<? Not "switch,value" or keyword@>
	AOJA	LV,ASKFSD	;ASK AGAIN WITH NEW HELP LEVEL

FSDEND:	MOVE	LV,SAVLV	;RESTORE PERMANENT HELP LEVEL
ASKFSA:	ASKYN	<Set each switch(Y,N)[List each switch with its current value and ask for new value]>
	JUMPE	N,FSAEND	;JUMP IF NO
	HRLZ	T1,FTLEN	;AOBJN PTR TO SWITCHES

FSALOP:	SKIPN	N,@FTTAB	;N=SWITCH ENTRY
	JRST	FSAEN2		;END OF TABLE
	LSH	N,^D12		;N=SWITCH NAME
	PUSH	P,N		;SAVE NAME OF SWITCH IN CASE LOOP
	PUSH	P,T1		;SAVE AOBJN PTR
FSALP0:	MOVE	N,-1(P)		;RESTORE NAME OF SWITCH IN CASE LOOPING
	MOVE	T1,(P)		;RESTORE AOBJN PTR IN CASE LOOPING
	SKIPL	@FTTAB		;SKIP IF SWITCH IS ON
	JRST	FSALP1		;NO, ITS OFF
	ASKLST	<FT*,-1(ON,OFF,LIST,EXPLAIN,END)>
	JRST	FSATST
FSALP1:	ASKLST	<FT*,0(ON,OFF,LIST,EXPLAIN,END)>
FSATST:	MOVE	T1,(P)		;RESTORE AOBJN PTR
	CAIN	N,4		;NO SKIP IF END TYPED
	JRST	FSAEN1		;YES, DO NO MORE
	SOJG	N,FSALEX	;JUMP IF LIST OR EXPLAIN
	MOVSI	T2,(FS.VAL)	;VALUE BIT
	ANDCAM	T2,@FTTAB	;TURN VALUE OFF
	CAIE	N,0		;SKIP IF OFF TYPED
	IORM	T2,@FTTAB	;TURN SWITCH ON
	POP	P,T1		;RESTORE AOBJN PTR
	POP	P,N		;GET RID OF NAME ON STACK
FSAEN2:	AOBJN	T1,FSALOP	;LOOP FOR ALL SWITCHES IN TABLE
	JRST	FSAEND

FSAEN1:	POP	P,T1		;RESTORE AOBJN PTR
	POP	P,N		;GET RID OF NAME ON STACK
FSAEND:	JRST	FNDSTD

FSALEX:	PUSHJ	P,LSTEXP	;DO LIST OR EXPLAIN
	JRST	FSALP0		;AND REASK ABOUT THIS SWITCH

;HERE TO CREATE FGEN OUTPUT FILE
FNDSTD:	FILOUT	<@LIST@>
	TLZ	F,(F.HOPN)	;CLEAR OPEN FLAG, HEADER IS AT BEGINNING

;HERE TO POSITION FGEN HELP FILE AT HEADER
	FHLPOS	HEADER,FNDSTE
	PUSHJ	P,FHLPFL	;COPY HEADER TO OUTPUT FILE
	JRST	FNDST1		;GO DO THE FILE

;HERE IF CANT FIND HEADER
FNDSTE:	TTYOUT	<% Can't find file header in help file@>

;HERE TO OUTPUT SWITCHES FROM TABLE
FNDST1:	HRLZ	T1,FTLEN	;AOBJN PTR TO SWITCH TABLE

STDOUT:	SKIPN	N,@FTTAB	;N=SWITCH ENTRY
	JRST	STDOUL		;IGNORE 0 ENTRIES
	PUSH	P,T1		;SAVE AOBJN PTR
	TLZ	N,777700	;CLEAR JUNK
	TLO	N,'FT '		;AND MAKE FT...
	PUSH	P,N		;SAVE NAME OF SWITCH FOR COMMENT
	MOVE	N,(P)		;REMEMBER SWITCH NAME
	FILOUT	<XP *,>
	MOVE	T1,-1(P)
	SKIPL	@FTTAB		;SKIP IF SWITCH ON
	JRST	STDOU1		;NO, ITS OFF
	FILOUT	<-1>
	JRST	STDOU2
STDOU1:	FILOUT	<0>
;HERE TO COPY TEXT FROM HELP FILE ABOUT THIS SWITCH
STDOU2:	POP	P,WD		;RESTORE NAME OF SWITCH TO SEARCH AUX FILE
	FHLPOS	*,STDOU3
	PUSHJ	P,FHLPFC	;OUTPUT TEXT AS COMMENT
STDOU3:	FILOUT	<@>
	POP	P,T1		;RESTORE AOBJN PTR
STDOUL:	AOBJN	T1,STDOUT	;LOOP FOR ALL SWITCHES IN TABLE

FEND:	FILOUT	<	IF2 <PURGE XP,XPL,XPP>@@	END>
	POP	P,.JBFF		;RESTORE ORIGINAL JOBFF
	POPJ	P,
SUBTTL	HDWGEN - DIALOG TO DEFINE HARDWARE CONFIGURATION

HDWGEN:	FILOUT	<SUBTTL HDWCNF - HARDWARE CONFIGURATION DEFINITION FILE OUTPUT BY MONGEN@@@>
	FILOUT	<DEFINE XP(A,B),<A==:B>@@@>
	MOVEI	N,EDITNO	;MONGEN<=>COMMON "VERSION" NUMBER
	FILOUT	<XP M.GEN,*@>,N	;OUTPUT TO FILE


	PUSHJ	P,ASKSYS	;FIND OUT WHAT TYPE OF SYSTEM
	FILOUT	<XP M.KI10,*@>,M.P10I
	FILOUT	<XP M.KL10,*@>,M.KL10
	FILOUT	<XP M.KS10,*@>,M.KS10
	FILOUT	<XP M.1070,*@>,M.1070
	FILOUT	<XP M.1080,*@>,M.1080
	FILOUT	<XP M.1090,*@>,M.1090
	FILOUT	<XP M.1091,*@>,M.1091
	FILOUT	<XP M.2020,*@>,M.2020
	SKIPN	N,M.2020
	SKIPE	N,M.1091
	JRST	HDWGN1
	MOVEI	N,SM.CPU
	SKPFTF	CPUS		;UNSUPPORTED CPUS?
	 MOVEI	N,SU.CPU	;YES, USE UNSUPPORTED NUMBER
	ASKDEC	<Cpu's(1,1-*)[Total number of cpu's in the system]>
HDWGN1:	MOVEM	N,M.CPU
	FILOUT	<XP M.CPU,*@>,M.CPU


ASKNAM:	ASKSTR	<System name[24 characters or less]>
	CAILE	N,^D24		;24 OR LESS?
	RJRST	<TTYOUT <% More than 24 characters@>
		 JRST	ASKNMA>
ASKNMA:	MOVEI	N,0		;STORE 0 TO MAKE SURE ONLY 24 CHARS OUTPUT
	DPB	N,[POINT 7,ASCSTR+4,34]
	MOVSI	N,'*  '		;IN CASE "*" IS IN SYSNAM
	FILSTR	<DEFINE	SYSNAM
<	ASCIZ	&*&>@>
ASKDAT:	DATE	T1,		;GET TODAYS DATE
	IDIVI	T1,^D12*^D31	;YEAR + DAYS IN THIS YEAR
	ADDI	T1,^D64		;1964 IS YEAR 0
	PUSH	P,T1		;SAVE YEAR
	MOVE	T1,T2		;NO. DAYS IN CURRENT YEAR
	IDIVI	T1,^D31		;T1=MONTH-1, T2=DAY OF MONTH-1
	PUSH	P,T2		;SAVE DAYS-1 OF MONTH
	MOVEI	N,1(T1)		;MONTH (1-12)
	FILOUT	<DEFINE	SYSDAT> ;START MACRO DEFINITION IN FILE
	PUSHJ	P,FILLAB	;OUTPUT LEFT ANGLE BRACKET TO FILE, CRLF
	FILDC2	<ASCIZ &*>,N		;OUTPUT MONTH
	MOVEM	N,M.MON		;SAVE FOR SYMBOL OUTPUT TOO
	POP	P,T1		;DAYS-1 IN MONTH
	MOVEI	N,1(T1)		;DAY OF MONTH(1-31)
	FILDC2	<-*>,N		;OUTPUT TO FILE
	MOVEM	N,M.DAY		;SAVE FOR SYMBOL OUTPUT TOO
	POP	P,N		;YEAR(64-99)
	FILDC2	<-*&>,N		;OUTPUT TO FILE
	MOVEM	N,M.YEAR	;SAVE FOR SYMBOL OUTPUT TOO
	PUSHJ	P,FILRAB	;OUTPUT RIGHT ANGLE BRACKET,CRLF
	FILOUT	<XP M.MON,*@>,M.MON
	FILOUT	<XP M.DAY,*@>,M.DAY
	FILOUT	<XP M.YEAR,*@>,M.YEAR

ASKSER:	SETZB	I,CPU		;SET LOOP COUNTER TO 0

;LOOP TO ASK FOR SERIAL NUMBERS FOR ALL CPUS IN SYSTEM
ASKSLP:	ASKDEC	<CPU* serial #(1-10000)>,I ;ASK FOR CPUN
	MOVEM	N,M.C0SN(I)	;SAVE FOR CPU1 CHECK
	SOJL	I,ASKSN1	;ANY PREVIOUS CPUS ALREADY ANSWERED?

;LOOP TO SCAN ALL PREVIOUS CPU SERIAL NUMBERS TO SEE IF THE SAME
ASKSN0:	CAMN	N,M.C0SN(I)	;SAME AS PREVIOUS SERIAL NUMBER?
	RJRST	<TTYOUT	<? Cannot be same as CPU*@>,I
		 JRST	ASKSER>	;ASK ALL CPUS OVER AGAIN
	SOJGE	I,ASKSN0	;ANY MORE PREVIOUS CPUS?
ASKSN1:	SETZM	M.DN60		;CLEAR COUNT OF DN60 DEVICES IN SYSTEM
	MOVE	I,CPU		;CPU NUMBER

;ASK FOR DEVICES ON THIS CPU IO BUS:

	SETZ	N,		;IN CASE THIS IS A KL10 OR KS10
	SKIPN	M.KS10		;KS10 DOES NOT HAVE DK10'S
	SKIPE	M.KL10		;KL10 DOES NOT HAVE DK10'S
	JRST	ASKSN2
	ASKDEC	<# DK10's on CPU*(1,0-2)[Real time clock]>,CPU
ASKSN2:	MOVEM	N,M.RT0(I)	;STORE ANSWER FOR THIS CPU
	SKIPN	N		;THIS CPU HAVE A DK10?
	SETOM	SCPUNR		;NO, FLAG SOME CPU AS NO REAL-TIME CLOCK
	ADDM	N,M.RTX		;ACCUM. TOTAL NO. OF DK10S FOR SYSTEM
	AOS	I,CPU		;INCREMENT CPU ITERATION COUNTER
	CAMGE	I,M.CPU		;DONE FOR ALL CPUS IN THIS SYSTEM?
	JRST	ASKSLP		;NO, GO BACK AND ASK FOR ANOTHER
	FILOUT	<XP M.C0SN,*@>,M.C0SN
	FILOUT	<XP M.C1SN,*@>,M.C1SN
	FILOUT	<XP M.C2SN,*@>,M.C2SN
	FILOUT	<XP M.C3SN,*@>,M.C3SN
	FILOUT	<XP M.C4SN,*@>,M.C4SN
	FILOUT	<XP M.C5SN,*@>,M.C5SN
	FILOUT	<XP M.RT0,*@>,M.RT0
	FILOUT	<XP M.RT1,*@>,M.RT1
	FILOUT	<XP M.RT2,*@>,M.RT2
	FILOUT	<XP M.RT3,*@>,M.RT3
	FILOUT	<XP M.RT4,*@>,M.RT4
	FILOUT	<XP M.RT5,*@>,M.RT5
	FILOUT	<XP M.RTX,*@>,M.RTX
	SKPFTT	CPUTYP		;UNSUPPORTED CPU TYPE?
	 JRST	EXMZZ1		;NO
	ASKYN	<Exclude monitor overhead from user run time(Y,N)[
Overhead is CPU time spent clock queue processing, command
decoding, swapping, and scheduling.
User run time always includes UUO execution and
unless EBOX/MBOX runtime accounting is selected
(KL10 systems only) includes IO interrupt service time.
On KI systems, each CPU must have a DK10]>
	JRST	EXMZZ2

EXMZZ1:	ASKYN	<Exclude monitor overhead from user run time(Y,N)[
Overhead is CPU time spent clock queue processing, command
decoding, swapping, and scheduling.
User run time always includes UUO execution and
unless EBOX/MBOX runtime accounting is selected
(KL10 systems only) includes IO interrupt service time.]>

EXMZZ2:	FILOUT	<XP M.RTCO,*@>,N
ASKEMT:	SKIPN	M.KL10		;KL10 SYSTEM?
	JRST	NOEMRT		;NO, NO EBOX/MBOX TIME ACCOUNTING
	ASKYN	<EBOX/MBOX runtime accounting(Y,N)[
If EBOX/MBOX runtime accounting is selected in a KL10
based system, user runtime is computed using the KL10
internal accounting clocks]>
	MOVEM	N,M.EMRT	;SAVE FOR LATER
	FILOUT	<XP M.EMRT,*@>,M.EMRT
	SKIPN	M.EMRT
	JRST	NOEMR1		;NO PI EXCLUSION EITHER
	ASKYN	<Exclude PI time from user runtime(Y,N)[
An answer of "yes" to this question will cause the monitor
to set up the KL10 accounting meters in such a manner that
users will not be charged for cpu time used during interrupts]>
	MOVEM	N,M.XPI		;SAVE
	FILOUT	<XP M.XPI,*@>,M.XPI
	JRST	ASKRTC		;NOW GO ASK ABOUT DK10'S
NOEMRT:	FILOUT	<XP M.EMRT,0@>
NOEMR1:	FILOUT	<XP M.XPI,0@>
ASKRTC:	SKIPE	M.RTX		;ANY DK10'S ON SYSTEM?
	SKIPE	M.KL10		;SKIP IF NOT A KL10 SYSTEM
	JRST	OUTRTC		;NO, SKIP BUNCH OF QUESTIONS
	SKIPE	SCPUNR		;IS SOME CPU WITHOUT A DK10?
	JRST	ASKRCS		;YES, TOO BAD SKIP HIGH PREC QUESTION
	ASKYN	<High precision time accounting(Y,N)[Use DK10 clock for 
10 micro-second time accounting]>
	MOVEM	N,M.RTCA
	JUMPN	N,OUTRC1	;IF HIGH PRECISION NEED SERVICE ROUTINE
ASKRCS:	ASKYN	<DK10 software(Y,N)[Include real time clock service routine]>
OUTRC1:	MOVEM	N,M.RTC		;NON-ZERO IF NEED RTC CLOCK SERVICE
OUTRTC:	FILOUT	<XP M.RTCA,*@>,M.RTCA
	FILOUT	<XP M.RTC,*@>,M.RTC

	ASKYN	<Account verification(Y,N)[LOGIN and the batch system will
verify that the user has specified a valid account]>
	FILOUT	<XP M.ACV,*@>,N
	MOVEI	N,0		;ASSUME NO MOS MEMORY SUPPORT
	SKIPE	M.KL10		;A KL10?
	SKIPE	M.1080		;YES, BUT NOT 1080'S
	JRST	MOSEND		;NO, CAN'T HAVE RECONFIGURABLE MOS
	ASKYN	<MOS memory(Y,N)[Include support for the user mode MOS memory diagnostic THGA
which collects statistics on single bit memory errors and substitutes the spare
bit when a single bit error is determined to be hard]>
MOSEND:	FILOUT	<XP M.MOS,*@>,N	;OUTPUT THE ANSWER
	SKIPN	N,M.KL10	;A KL10?
	JRST	SCAEND		;NO, CAN'T HAVE SCA SUPPORT
	ASKYN	<SCA support(Y,N)[Load monitor modules needed to provide Systems
Communications Architecture support]>
SCAEND:	MOVEM	N,M.SCA		;SAVE FOR LATER QUESTION ABOUT RAXKON
	FILOUT	<XP M.SCA,*@>,N	;OUTPUT THE ANSWER
	SETOM	CPUN
	SKIPE	M.KS10		;KS10 SYSTEM?
	JRST	ASKKSI		;YES--GO ASK ABOUT KS10 IO
	SKPFTT	EXTCHN		;EXTERNAL CHANNELS?
	 JRST	DOAUT		;NO, DO AUTCON AUTOMATICALLY
				;YES, ASK IF AUTCON
	ASKYN	<Auto-Configure(Y,N)[Automatically determine disk/tape configuration when
system starts. Can only be used for RH10, RH20, DX10 devices]>
	JUMPE	N,NOAUTO	;NO AUTO CONFIG IF 0

DOAUT:	SKIPE	M.1070
	JRST	AUTCN1		;NO RP20S ON A KI
	ASKYN	<Include RNXKON(Y,N)[Support for RP20 disks]>
	SKIPN	N
AUTCN1:	TRO	F,F.NORN
	SKIPE	M.SCA		;SKIP IF SCA SUPPORT NOT INCLUDED
	SKIPE	M.1070
	JRST	AUTCN2		;NO CI DISK ON A KI
	ASKYN	<Include RAXKON(Y,N)[Support for disks on the CI bus]>
	SKIPN	N		;ANY?
AUTCN2:	TRO	F,F.NORA	;NO
	ASKYN	<Include TM2KON(Y,N)[Support for TU16/TU45/TU77 tape drives]>
	SKIPN	N
	TRO	F,F.NOT2
	SKPFTT	DX10		;SUPPORT DX10S
	 JRST	TX1ZZ1		;DON'T ASK
	ASKYN	<Include TX1KON(Y,N)[Support for DX10/TU7x tape drives]>
	SKIPN	N
TX1ZZ1:	 TRO	F,F.NOTX
	SKIPE	M.1070
	JRST	[TRO F,F.NOTD!F.NOT7
		 JRST AUTDFS]	;NO DX20, TM78 ON A KI
	ASKYN	<Include TD2KON(Y,N)[Support for DX20/TU7x tape drives]>
	SKIPN	N
	TRO	F,F.NOTD
	ASKYN	<Include T78KON(Y,N)[Support for TU78 tape drives]>
	SKIPN	N
	TRO	F,F.NOT7
AUTDFS:	AOS	N,CPUN		;NEXT CPU
	CAML	N,M.CPU		;OVER THE TOP?
	JRST	AUTDF1		;YES, FINISH UP
	FILCPU	<XP M.DPC,0@>	;NO. MAKE DEFINITIONS
	FILCPU	<XP M.FHD,0@>
	FILCPU	<XP M.FSD,0@>
	FILCPU	<XP M.MDF,0@>
	SKIPE	I,N		;FOR CPU0 SOME SYMBOLS ARE 1, 0 FOR OTHER CPUS
	TDZA	I,I
	MOVEI	I,1
	FILCPU	<XP M.RPX,*@>,I
	FILCPU	<XP M.TAPN,*@>,I
	MOVE	N,I		;COPY DIGIT TO N
	TRNN	F,F.NORN
	SKIPE	M.1070
	SETZ	N,		;NO RP20 ON A KI
	FILCPU	<XP M.RNX,*@>,N
	MOVE	N,I		;COPY DIGIT TO N
	TRNN	F,F.NORA	;WANT RAXKON?
	SKIPE	M.1070		;AND NOT A KI?
	SETZ	N,		;NO CI DISKS ON A KI
	FILCPU	<XP M.RAX,*@>,N
	JRST	AUTDFS
AUTDF1:	FILOUT	<XP M.P0T,1@>
	FILOUT	<XP M.N0T,1@>
	FILOUT	<RP0==650@>
	FILOUT	<RN0==650@>
	FILOUT	<RA0==650@>
	SETOM	MKON		;SO WON'T ASK ABOUT 7-TRACK, 6250 TAPES
	MOVEI	I,1
	MOVEM	I,CHN		;SET UP TME NON-0 M.XXX SYMBOLS
	MOVEM	I,M.RHP4
	TRNN	F,F.NOT2
	MOVEM	I,M.T210
	TRNN	F,F.NOTX
	MOVEM	I,M.TX01
	SKIPE	M.1070
	JRST	CHNEND		;NO TM78, DX20 ON A KI
	TRNN	F,F.NORN
	MOVEM	I,M.RP20
	TRNN	F,F.NOT7
	MOVEM	I,M.T78
	TRNN	F,F.NOTD
	MOVEM	I,M.DX20
	JRST	CHNEND		;MAKE ALL THE M.XXX DEF'S
NOAUTO:	AOSN	N,CPUN
	SETOM	MKON		;MAGTAPE CONTROLLER NUMBER
	SKIPGE	MKON
	SETOM	MKONP
	CAML	N,M.CPU
	JRST	CHNEND
	SKPFTT	EXTCHN		;EXTERNAL CHANNELS
	 JRST	CHNZZ1		;NO
	ASKDEC	<# Data Channels on CPU*(2,0-?)[DF10s, DF10Cs, DX10s or RH20s for disk and tape]>
	JRST	CHNZZ2

CHNZZ1:	ASKDEC	<# Data Channels on CPU*(2,0-?)[DX10s or RH20s for disk and tape]>

CHNZZ2:	FILCPU	<XP M.CHN,*@>,N
	JUMPE	N,NOCHNS
	MOVEM	N,M.CHN		;SAVE FOR CHANNEL LOOP
	SETZM	CCHN
	TRO	F,F.KONS	;INDICATE 1ST OF EVERYTHING
;LOOP ONCE FOR EACH CHANNEL
CHNLOP:	MOVEI	N,3		;ASSUME 1091, ONLY RH20'S
	SKIPE	M.1091		;IS IT A 1091?
	JRST	CHNLP1		;YES, ONLY RH20'S
	MOVE	N,CHN		;CHANNEL ITERATION COUNTER(0,1,...)
	SKPFTT	EXTCHN		;EXTERNAL CHANNELS?
	 JRST	CHNZZ3		;NO
	ASKLST	<Channel * Type (DF10,DF10C,DX10,RH20)>
	JRST	CHNLP1		;SKIP

CHNZZ3:	ASKLST	<Channel * Type (DX10,RH20)>
	ADDI	N,2		;ADJUST

CHNLP1:	CAILE	N,3		;ADJUST FOR GAP IN NUMBERS CAUSED BY
	ADDI	N,1		;RH11 CHN TYPE (SEE ASKKSI)
	MOVEM	N,CHNTYP
	FILOUT	<XP M.CH*T,>,CHN;OUTPUT CHANNEL TYPE
	FILOUT	<*@>,CHNTYP	;AND COMPLETE OUTPUT
	FILOUT	<XP M.*RH,0@>,CHN ;NO RH11'S IF WE'RE HERE
	FILCPU	<XP M.*RH,0@>,CHN ;...DITTO
	MOVE	N,CHN
	BTHOUT	<On channel # *:@>,CHN
	MOVE	N,CHNTYP	;TYPE OF CHANNEL
	CAIN	N,2		;DX10?
	JRST	DXLOOP		;YES, ASK ABOUT DX10, TX01, TU70'S
	MOVEI	RH12,0		;NO, ASSUME SOME FLAVOR FO RH10/DF10
	CAIN	N,3		;IS IT AN RH20?
	MOVEI	RH12,1		;YES
	ADDM	RH12,M.RH20	;COUNT NO OF RH20S
	ADDM	RH12,RH20CP	;COUNT RH20S ON THIS CPU
	FILOUT	<XP M.*TX,0@>,CHN ;NO TX01S ON THIS CHL
	FILCPU	<XP M.*TX,0@>,CHN ;NO TX01S ON THIS CPU
	SKIPE	N,RH12		;IF AN RH20,
	SOJA	N,NORD10	; THERE AREN'T ANY RD10S
	MOVEI	N,0		;NO RD10'S
	SKPFTT	RC10		;RC10 SUPPORT?
	 JRST	NORD10		;NO
	ASKDEC	<  # RC10s(0-2)[Controllers for RD10 Burroughs disks and
RM10B Bryant drums on channel *]>,CHN
NORD10:	MOVE	I,N		;SET UP ITERATION FOR THIS CONTROLLER
	FILOUT	<XP M.*FH,>,CHN ;FIRST PART OF CALL
	FILOUT	<*@>,I		;SECOND HALF
	MOVE	N,M.RC10
	TRZE	F,F.1FH		;IF 1ST KONTROLLER ON CPU
	MOVEM	N,FHCPUN	; SAVE NO ON PREVIOUS CPUS
	JUMPE	I,FHEND		;ANY CONTROLLERS AT ALL?

;LOOP FOR FH* ON THIS CHANNEL:
FHLOOP:	FILOUT	<XP M.FH*P,>,M.RC10 ;YES, DEFINE NO OF FHS ON PREVIOUS CPUS
	FILOUT	<*@>,FHCPUN
	FILOUT	<XP FH*CPU,>,M.RC10
	FILOUT	<*@>,CPUN
	AOS	N,M.RC10	;INCREMENT NO. OF RC10 IN SYSTEM
	ADDI	N,'A'-1		;MAKE SIXBIT LETTER
	ROT	N,-6		;LEFT JUSTIFIED
	ASKDEC	<  # Units on FH*(1-4)>,N
	PUSH	P,N		;SAVE NO. OF FH* UNIT ON THIS CONTROLLER
	MOVE	N,M.RC10	;MAKE SIXBIT CONTROLLER LETTER AGAIN
	ADDI	N,'A'-1
	ROT	N,-6
	FILOUT	<XP M.FH*,>,N	;FIRST HALF
	POP	P,N		;RESTORE NO OF FH* UNITS ON THIS CONTROLLER
	FILOUT	<*@>,N
	SOJG	I,FHLOOP
FHEND:	SKIPE	N,RH12		;IF AN RH20,
	SOJA	N,NORS04	; THERE AREN'T ANY RS04S
	ASKDEC	<  # RH10S for RS04'S(0-3)[Controllers for RS04 swapping
disks on channel *]>,CHN
NORS04:	MOVE	I,N
	FILOUT	<XP M.*FS,>,CHN
	FILOUT	<*@>,I
	TRNE	F,F.1FS		;1ST KONTROLLER ON CPU?
	SETZM	RSCPUN		;YES, CLEAR TOTAL RS04S ON CPU
	JUMPE	I,FSEND
;LOOP FOR FS* ON THIS CHANNEL:
FSLOOP:	FILOUT	<XP M.FS*F,>,M.RH1S
	MOVEI	N,1
	TRZE	F,F.1FS		;IF 1ST KONTROLLER
	SETZ	N,		;SET FS*F=0
	FILOUT	<*@>,N
	FILOUT	<XP FS*CPU,>,M.RH1S
	FILOUT	<*@>,CPUN
	AOS	N,M.RH1S	;INCREMENT NO. OF RH10 IN SYSTEM
	AOS	RSCPUN
	ADDI	N,'A'-1		;MAKE SIXBIT LETTER
	ROT	N,-6		;LEFT JUSTIFIED
	ASKDEC	<  # Units on FS*(1-8)>,N
	PUSH	P,N		;SAVE NO. OF FS* UNIT ON THIS CONTROLLER
	MOVE	N,M.RH1S	;MAKE SIXBIT CONTROLLER LETTER AGAIN
	ADDI	N,'A'-1
	ROT	N,-6
	FILOUT	<XP M.FS*,>,N	;FIRST HALF
	POP	P,N		;RESTORE NO. OF FS* UNITS ON THIS CONTROLLER
	FILCPU	<*@>,N
	SOJG	I,FSLOOP
FSEND:	JUMPN	RH12,ASKRP2
	ASKDEC	<  # RH10S for RP04'S,RP06'S(0-3)[Controllers for RP04,RP06
disk pack units on channel *]>,CHN
	JRST	ASKRP3
ASKRP2:	ASKDEC	<  # RH20S for RP04'S,RP06'S,RP07'S(0-1)[Controllers for RP04,RP06,RP07
disk pack units on channel *]>,CHN
ASKRP3:	MOVE	I,N
	FILOUT	<XP M.*RP,>,CHN
	FILOUT	<*@>,I
	MOVE	N,M.RHP4
	TRNE	F,F.1RP
	MOVEM	N,RPCPUN		;RHP'S ON PREVIOUS CPU'S
	JUMPE	I,RPEND

;LOOP FOR RP* ON THIS CHANNEL
RPLOOP:	FILOUT	<XP M.P*F,>,M.RHP4
	MOVEI	N,1
	TRZE	F,F.1RP
	SETZ	N,
	FILOUT	<*@>,N
	FILOUT	<XP RP*CPU,>,M.RHP4
	FILOUT	<*@>,CPUN
	AOS	M.RH1P(RH12)		;INCR COUNT OF RH10S OR RH20S
	AOS	N,M.RHP4
	ADDI	N,'A'-1
	ROT	N,-6
	PUSH	P,N
	ASKDEC	<  # Units on RP*(1-8)>,N
	EXCH	N,(P)
	FILOUT	<XP M.RP*,>,N
	POP	P,N
	FILOUT	<*@>,N
	MOVE	I2,M.RHP4
	SUBI	I2,1
	FILOUT	<XP M.P*T,>,I2		;INDICATE TYPE
	SKIPE	N,RH12
	MOVE	N,rh20cp		;0 FOR RH10, CONTROL NUMBER FOR RH20
	FILOUT	<*@>,N
	MOVE	N,M.RHP4
	SUBI	N,1
	FILOUT	<XP M.RS*P,>,N	;NO OF RS04S PREVIOUS ON THIS CPU
	FILOUT	<*@>,RSCPUN
	SOJG	I,RPLOOP
RPEND:	SKIPN	N,RH12		;RH20?
	JRST	ASKRN1		;NO, NO RP20'S POSSIBLE
	ASKDEC	<  # RH20S for RP20'S(0-1)[Controllers for RP20
disk units on channel *.]>,CHN
ASKRN1:	MOVE	I2,N		;SAVE VALUE IN I2
	MOVE	N,M.RP20	;GET NUMBER OF RP20 "KONTROLLERS"
	TRZE	F,F.1RN		;FIRST ON THIS CPU?
	MOVEM	N,RNCPUN	;RP20'S ON PREVIOUS CPU'S
	FILOUT	<XP M.*RN,>,CHN ;OUTPUT NUMBER OF "KONTROLLERS" ON THIS
	FILOUT	<*@>,I2		;  CHANNEL
	JUMPE	I2,RNEND
	MOVN	I,I2		;MAKE AN AOBJN POINTER
	HRLZS	I

;LOOP FOR RN* ON THIS CHANNEL
RNLOOP:	FILOUT	<XP RN*CPU,>,M.RP20
	FILOUT	<*@>,CPUN
	AOS	N,M.RP20
	ADDI	N,'A'-1
	ROT	N,-6
	PUSH	P,N
	ASKDEC	<  # Units on RN*(1-16)>,N
	EXCH	N,(P)
	FILOUT	<XP M.RN*,>,N
	POP	P,N
	FILOUT	<*@>,N
	MOVE	I2,M.RP20
	SUBI	I2,1
	FILOUT	<XP M.N*T,>,I2	;INDICATE TYPE
	MOVE	N,RH20CP	;CONTROL NUMBER FOR RH20
	FILOUT	<*@>,N
	AOBJN	I,RNLOOP
;NO CI DISKS IF NOT AUTO CONFIGURE

RNEND:	SETZ	N,		;GET A ZERO
	FILOUT	<XP M.*RA,>,CHN
	FILOUT	<*@>,N
	SKIPE	N,RH12
	SOJA	N,NORP10		;NO RP10S IF RH20
	ASKDEC	<  # RP10s(0-3)[Controllers for Memorex and ISS RP02 and RP03 
disk pack units on channel *]>,CHN
NORP10:	MOVE	I,N		;SETUP ITERATION COUNT FOR RP FOR THIS CHANNEL
	FILOUT	<XP M.*DP,>,CHN	;OUTPUT FIRST HALF
	FILOUT	<*@>,I		;NO. OF CONTROLLERS ON THIS CHANNEL
	MOVE	N,M.RP10
	TRZE	F,F.1DP
	MOVEM	N,DPCPUN
	JUMPE	I,DPEND		;ANY RP10S AT ALL ON THIS CHANNEL?

;LOOP FOR RP10S ON THIS CHANNEL
DPLOOP:	FILOUT	<XP M.DP*P,>,M.RP10	;NO OF RP10S ON PREVIOUS CPUS
	FILOUT	<*@>,DPCPUN
	FILOUT	<XP DP*CPU,>,M.RP10
	FILOUT	<*@>,CPUN
	AOS	N,M.RP10	;INCREMENT NO. OF RP10S ON SYSTEM
	ADDI	N,'A'-1		;FORM CONTROLER LETTER
	ROT	N,-6
	ASKDEC	<  # Units on DP*(1-8)>,N
	PUSH	P,N		;SAVE NO. UNITS ON THIS CONTROLLER
	MOVE	N,M.RP10	;NO. OF RP10S SO FAR
	ADDI	N,'A'-1		;FORM CONTROLER LETTER
	ROT	N,-6		;LEFT JUSTIFY
	FILOUT	<XP M.DP*,>,N
	POP	P,N		;RESTORE NO. UNITS ON THIS CONTROLLER
	FILOUT	<*@>,N		;AND OUTPUT
	SOJG	I,DPLOOP	;ANY MORE RP CONTROLLERS ON THIS CHANNEL?
DPEND:	SKIPE	N,RH12
	SOJA	N,NOT1B		;NO TM10B IF RH20
	ASKDEC	<  # TM10Bs(0-2)[Tape Controller for NRZI only drives
on channel  *]>,CHN
NOT1B:	MOVE	I,N		;SET UP ITERATION COUNTER
	FILOUT	<XP M.*TB,>,CHN	;FIRST PART OF CALL
	FILOUT	<*@>,I		;SECOND PART
	MOVE	N,M.TM10	;TOTAL NO OF TM10S SO FAR
	TRZE	F,F.1T1		;IF THIS IS THE 1ST TM10 ON CPU
	MOVEM	N,T1CPUN	;SAVE AS NO OF TM10S ON PREVIOUS CPUS
	JUMPE	I,TBEND		;ANY TM10B'S AT ALL?
;LOOP FOR TB* ON THIS CHANNEL
TBLOOP:	AOS	M.TM10		;COUNT OF TM10'S ON SYSTEM
	AOS	N,MKON		;CONTROLLER #
	FILOUT	<XP M.MT*T,1@>,N ;MARK AS TM10B
	FILOUT	<XP M.T1*P,>,N
	FILOUT	<*@>,T1CPUN
	PUSHJ	P,TA