/ WP2CMF - COMMAND LOOP & OVERLAY PACKAGE WITH IOA AND MENU

/	EDIT HISTORY
/ 063	EMcD	24-Sep-85	Add Dutch and Spanish Xlations (conditionalised)
/ 062	Mart 	19-Sep-85	Load out convert change
/ 061	EMcD	17-Sep-85	Nordic translations
/ 060	Mart	17-Sep-85	Fix printscreen/decspell bug
/ 059	Mart	6- aug-85	Add convert utility
/
/---------- All below refer to V2.5 base level and earlier ----------------
/
/ 058	EMcD	23-Jul-85	Fix bug caused by deleting MCS chars
/ 057	MART	17-JUL-85	FIX BLASTR HANGUP IN PAGSWP
/ 056 	mart	12-jul-85	move the BLASTR TABLE
/ 055	EMcD	27-Jun-85	Fix 2 key strokes for Print Screen
/ 054	RCME	27-Jun-85	Fix bug caused by 053 in MENU DISP
/ 053	RCME	20-Jun-85	Fix IOA \ command to take 0 byte as a-grave
/ 052	RCME	05-Jun-85	Fix IOA table bug caused by being in swap area
/ 051	RCME	03-Jun-85	Fix Print screen hang on printer error
/				Insert MCS capability into MENU using '\'
/				Stop MENU DISP string after even or odd no
/				of characters
/ 050	Mart	28-May-85	Change printe rhole blocks
/ 049	Mart	7- may-85	add load out for printer fallback
/ 048	MART	30-APR-85	Fix bug in BLASTR
/ 047	rcme	26-Apr-85	Move IOA routines out of SWPBEG area
/ 046	rcme	18-Apr-85	Fix 041/044 interaction bug
/ 045	rcme	17-Apr-85	Fix OL6 (List Processing) to load BCDASC
/ 044	EMcD	10-Apr-85	Allow 8 bit chars in command lines
/ 043	Mart	04-mar-85	BLASTR modification for tables
/ 042	rcme	27-MAR-85	Install pink fuzzy bits in IOA
/ 041	rcme	18-MAR-85	Setup print screen blast hook
/ 040	Mart	06-MAR-85	use subroutines from panel mem (BLASTR)
/
/-------------------------------------V2.0 and earlier edits follow
/
/ 039	DFB	06-SEP-84	Fix CTRL RUB/Newline hang bug
/ 038	DFB	21-AUG-84	CHANGES TO SYSTEM STARTUP ON DISK ERROR
/				 REMOVED LABEL FN1ERR AT MUBUF+10.
/ 037	WCE	20-AUG-84	CHANGES TO SYSTEM AREA FOR TELEPHONE DIRECTORY
/ 036	WCE	15-AUG-84	CHANGE INA TO FIX CURSOR ON SCREEN PROBLEM
/ 035	WCE	07-AUG-84	CHANGE INA TO FIX TIME PROBLEM WITH EDITOR
/ 034	AH	11-JUL-84	RING BELL AND EXIT ON ILLEGAL KEYBD INPUT
/ 033	AH	09-JUL-84	CHANGE # OF BLOCKS TO SAVE/LOAD FOR UDKS
/ 032	JAC	02-JUL-84	AH Fine tuning of 100 UDK'S
/ 031	LAD	27-JUN-84	VERIFY zap field 6.
/ 030	JAC	22-JUN-84	Fix FINISH USING SYSTEM for non-winnie
/ 029	AH	20-JUN-84	Substitute F14 for GOLD U calling sequence
/ 028	JAC	20-JUN-84	100 UDK integration
/ 027	HLP	15-JUN-84	Delete initial form feed on print screen
/ 026	WJY	14-JUN-84	Reload editor each time Spell runs.
/ 025	DFB	11-JUN-84	Add NOP to be ovlayed by CX in graphics
/				....mode to ignore FLABUZ. PRTFLD not loaded
/ 024	WCE	13-MAY-84	Changes for BRITISH date and currency symbol
/ 023	WCE	11-MAY-84	Made QURX a cross-field callable routine
/				Added MENU commands CLRBIT & SETBIT & SHFBIT
/ 022	WCE	07-MAY-84	Added new IOA command to output control char.
/ 021	WCE	30-APR-84	Added spare symbols to the user and system area
/ 020	WCE	23-APR-84	Added symbol CMDBLK for CMDQUX queue block loc.
/ 019	HLP	23-MAR-84	Change writeout code for system init code being
/				moved from WPSYS to WPRINT
/ 018	WJY	17-JAN-84	More DMI compatability (Remove deleted ifdefs)
/ 017	WJY	23-JAN-84	DECmate I compatability.
/ 016	WCE	19-JAN-84	Changed size of swap area for N.L. project
/ 015	WJY	03-JAN-84	Added screen status call in PRINTSCREEN to
/				prevent clobbering panel memory.
/ 014	HLP	20-DEC-83	Change writeout code to save 3 printer blks
/ 013	SBB	30-NOV-83	Added sixel dump & ReGis tables ovrly
/ 012	GDH	28-NOV-83	Changed Spell-Check load info.
/ 011	TCW	08-NOV-83	MOVED "FINISHED USING SYSTEM" TEXT TO MN1
/ 010	WCE	31-OCT-83	Bug fix to cause DISK forget on FILNAM command
/ 009	GDH	25-OCT-83	Modified Spell Check load info.
/ 008	DFB	19-OCT-83	Finish command to dismount winnie volumes
/ 007	WCE	07-OCT-83	Modification to print screen for scroll areas
/ 006	WJY	03-OCT-83	Changed CPYDSK utility to zap field 6 lock word.
/ 005	GDH	30-SEP-83	Changed LOGON utility to zap field 5 lock word.
/ 004	GDH	22-SEP-83	Added Spelling Checker utility.
/ 003	DFB	15-SEP-83	NEW WINNIE UTILITY OVERLAY
/ 002	HLP	13-SEP-83	NEW PRINTER WRITE CODE FOR DELETION OF HNDLR
/ 001	WCE	31-AUG-83	CHANGES MADE FOR DECMATE 2 VERSION 1.5
/	WCE	28-JUN-83	COMBINED MODULES (WPCMND, IOA, MENU, WPPSCR)
/				INTO ONE NEW MODULE SO THAT MAJOR CHANGES
/				COULD BE MADE TO FIELD TWO LAYOUT.  ALL
/				PREVIOUS EDIT HISTORIES HAVE BEEN DELETED.

/***************************************************************************
/****			FIELD TWO MEMORY LAYOUT DIAGRAM			****
/***************************************************************************

/    |---------|-----------------------|
/    | BLOCK 1 | 0     (DLFD2)         |
/    |---------|       IOA, INA        |
/    | BLOCK 2 |       OUTDIG, CVDBN   |
/    |---------|       TIME, PAGSWP    |
/    | BLOCK 3 |       PRTSCN          |
/    |---------|       PRINTQ          |
/    | BLOCK 4 | 1777                  |
/    |---------|-----------------------|
/    | BLOCK 5 | 2000 PRINT SCREEN BUF |
/    |         |      NATURAL LANGUAGE |
/    |---------|      TRANSLATION      |
/    | BLOCK 6 | 2777 TABLES & ROUTINES|
/    |---------|-----------------------|
/					      USER SWAP AREA
/    |---------|-----------------------|     |---------------|---------|
/    | BLOCK 1 | 3000  (DLFD3)         |     | 3000 (DLSWAP) | BLOCK 1 |
/    |---------|       WPCMND          |     |               |---------|
/    | BLOCK 2 |       OLAY            |     |  APPLICATION  | BLOCK 2 |
/    |---------|       MENU            |     |               |---------|
/    | BLOCK 3 |       NXTARG          |     |     AREA      | BLOCK 3 |
/    |---------|       STRCMP          |     |---------------|---------|
/    | BLOCK 4 |                       |     |               | BLOCK 4 |
/    |---------|                       |     |    EDITOR     |---------|
/    | BLOCK 5 | 5377                  |     |               | BLOCK 5 |
/    |---------|-----------------------|     |     ROOT      |         |
/					     |               |---------|
/    |---------|-----------------------|     |     AREA      |         |
/    | BLOCK 1 | 5400-5777    MUXBUF   |     |               | BLOCK 6 |
/    |---------|-----------------------|     |               |---------|
/    | BLOCK 2 | 6000-6377    MUBUF    |     | 6377          | BLOCK 7 |
/    |---------|-----------------------|     |---------------|---------|
/    | BLOCK 3 | 6400-6777    MNUSRA   |
/    |---------|-----------------------|
/    | BLOCK 4 | 7000-7377    UDKSTR   |
/    |---------|-----------------------|
/    | BLOCK 5 | 7377-7777    RPPGDS   |
/    |---------|-----------------------|



/***************************************************************************
/****		WRITEOUT CODE FOR FIELDS 0, 1, AND 2			****
/***************************************************************************

	FIELD 0
/
	*RXLDLS
	RXEWT			/ WRITE COMMAND
	0
	RXQBLK			/ LOCATION OF QUEUE BLOCK
	.

	DLFD0A;     0;CDF  0;-DSFD0A	/ SYSTEM FIELD PART ONE

	DLFD1 ;  PRBOTM;CDF 10;-DSFD1	/ PRINTER FIELD RESIDENT	/C019

	IFDEF DECDEV <
	DLFD2 ;     0;CDF 50;-DSFD2	/ FIRST HALF USER FIELD (IOA, PRTSCR)
					/ SECOND HALF USER FIELD (WPCMND, MENU)
	DLMFN1; MUBUF;CDF 50;-DSMFN1	/ MENU BLOCK "FINISHED USING SYSTEM"

	>

	IFNDEF DECDEV <
	DLFD2 ;     0;CDF 20;-DSFD2	/ FIRST HALF USER FIELD (IOA, PRTSCR)
					/ SECOND HALF USER FIELD (WPCMND, MENU)
	DLMFN1; MUBUF;CDF 20;-DSMFN1	/ MENU BLOCK "FINISHED USING SYSTEM"

	>


	DLOPRO;     0;CDF 30;-20	/ FIRST SIXTEEN PRINTER OVERLAYS
	DLOPRO+20;  0;CDF 40;-DSOPRO+20 / REMAINING PRINTER OVERLAYS

	DLBLPR;400   ;CDF 60;-DSBLPR	/ PRINTER HOLE BLOCK		/A041
	DLFRHL;2000  ;CDF 60;-DSFRHL	/ FALLBACK ROUTINES HOLE BLOCK	/A049
	DL2CHL;MUXBUF;CDF 60;-DS2CHL	/ 2CMF HOLE BLOCK		/A052
	0				/ END OF THE LIST


	*6562
	7605			/ SET FOR RETURN TO OS8
				/ AFTER WRITEOUT

/***************************************************************************
/****			COMMAND FIELD ROUTINES				****
/***************************************************************************

/ DEFINE LOCATIONS FOR 0-77 AREA IN SYS FIELD WHICH ARE LOADED INTO ALL FIELDS

	*MNUCAL
MNUCAL,	MENU			/ MENU SUBROUTINE CALLING ADDRESS
MUBASE,	MUBUF			/ MENU BUFFER LOCATION FOR OFFSET CALCULATIONS
TIMCAL,	TIME			/ TIME OF DAY STRING PROCESSING ROUTINE
OLAYCL,	OLAY			/ OVERLAY PROCESSOR ADDRESS
FILEIO=JMS I .			/ PSEUDO INSTRUCTION TO CALL WPFILS ROUTINES
	200			/ *** XFIELD IN WPFILS IS AT 200 *****
IOACAL,	IOA			/ LOCATION OF SYSTEM OUTPUT ROUTINE
INACAL,	INA			/ LOCATION OF SYSTEM INPUT ROUTINE
NXACAL,	NXTARG			/ LOCATION OF NEXT ARGUEMENT ROUTINE
STCCAL,	STRCMP			/ LOCATION OF STRING COMPARE ROUTINE
CVDCAL,	CVDBN			/ LOCATION OF DECIMAL STRING CONVERSION
DIGCAL,	OUTDIG			/ LOCATION OF DECIMAL STRING OUTPUT ROUTINE
PGSWAP=JMS I .			/ PSEUDO INSTRUCTION TO CALL SWAP ROUTINE
	PAGSWP			/ LOCATION OF PAGE SWAPING ROUTINE
T3,	0			/ TEMPROARY REGISTER NUMBER THREE
T2,	0			/ TEMPROARY REGISTER NUMBER TWO
T1,	0			/ TEMPROARY REGISTER NUMBER ONE

	*RXJOB			/ DEFINE RX JOB
	0;RXFLD;0;RXSTRT;0

	*U1JOB			/ DEFINE USER JOB
	0;40;0;WPCMND;0

/***************************************************************************
/****			COMMAND FIELD VALUES				****
/***************************************************************************

	IFNDEF DECDEV <
	FIELD 2		/ DEFINE LOCATIONS IN FIELD TWO
	>

	IFDEF DECDEV <
	FIELD 5		/ DEFINE LOCATIONS IN FIELD FIVE
	>


	CDFMYF=CDFMNU		/ DEFINE CDF INSTRUCTION TO THIS FIELD

	*CLKCHG			/ INCREMENTED BY SECONDS IN FIELDS 2 AND 5
	
	*UDKINH		/ TURNS OFF UDK'S WHEN NON-ZERO
UDKINH,	-1			/ MAKE SURE UDK'S ARE INHIBITED
				/ WHEN WE START UP

/ DEFINE LOCATIONS USED IN 100 - 177 AREA OF FIELD 2

	*CMNNOP
CMNNOP,	XX
	JMP I	.-1

DATESP,	DATEST
FNAMSP,	FNAMBF
FNUMS,	MUBUF+MNFNO
DRVNOP,	MUBUF+MNDRV
PQADDR,	PRINTQ
	0
PQFRST,	0
PQLAST,	PQFRST-1
PAGSWX,	PAGSW2			/ USED FOR INDIRECT JUMP IN PAGSWP	/A057

	*CMDQUX			/ DEFINED IN WPF1

/	QURX - QUEUE TO RXHAN
QURX,	XX
	JMS	GETCID		/ GET RETURN FIELD INSTRUCTION		/A023
	DCA	QURXIT		/ STORE FOR RETURN TO CALLER		/A023
	CIFSYS			/ CHANGE TO SYSTEM FIELD
	ENQUE			/ SEND QUEUE BLOCK TO QUEUING ROUTINE
	QUBLK 			/ ADDRESS OF QUEUE BLOCK

QURX1,	CIFSYS			/ CHANGE TO SYSTEM FIELD
	JWAIT			/ WAIT FOR A SIGNIFICENT EVENT
	TAD	QUQBLK+RXQCOD	/ PICK UP COMPLETION CODE
	SNA			/ ARE WE DONE YET ?
	JMP	QURX1		/ NO, GO WAIT SOME MORE
QURXIT,	XX			/ YES, RESET TO CALLERS FIELD		/A023
	JMP I	QURX		/ RETURN TO CALLER

GETCID,	XX			/ OBTAIN RETURN CDI INSTRUCTION		/A023
	CLA CLL			/ INSURE A CLEAN ACCUMULATOR AND LINK	/A023
	RDF			/ READ THE DATA FIELD INTO BITS 6-8	/A023
	TAD	CIDF0		/ COMBINE WITH RETURN FIELD INSTRUCTION	/A023
GETMYF,	CDFMYF			/ RESET DATA FIELD TO THIS FIELD	/A023
	JMP I	GETCID		/ RETURN TO CALLER

QUBLK,	DSKQUE
	0
	0

	*CMDBLK			/ DEFINED IN WPF1			/A020

QUQBLK,	ZBLOCK 17

/***************************************************************************
/****	     TEMPORARY REGISTERS FOR USE BY SWAP AREA ROUTINES		****
/***************************************************************************

TEMPA,	0			/ TEMPROARY SWAP AREA REGISTER A
TEMPB,	0			/ TEMPROARY SWAP AREA REGISTER B
TEMPC,	0			/ TEMPROARY SWAP AREA REGISTER C
TEMPD,	0			/ TEMPROARY SWAP AREA REGISTER D
TEMPE,	0			/ TEMPROARY SWAP AREA REGISTER E
TEMPF,	0			/ TEMPROARY SWAP AREA REGISTER F
TEMPG,	0			/ TEMPROARY SWAP AREA REGISTER G
TEMPH,	0			/ TEMPROARY SWAP AREA REGISTER H

LINFLG,	0			/ SWAP AREA LOCATION FOR STATUS MODE FLAG
LINRUL,	0			/ SWAP AREA LOCATION FOR RULER DETECTED FLAG
LINDIF,	0			/ SWAP AREA LOCATION FOR STATUS DIFFERENT FLAG
LINPGL, 0			/ SWAP AREA LOCATION FOR LOW PAGE NUMBERS
LINPGH, 0			/ SWAP AREA LOCATION FOR HIGH PAGE NUMBERS
LINNUM, 0			/ SWAP AREA LOCATION FOR LINE NUMBER
LINUSD, 0			/ SWAP AREA LOCATION FOR NUMBER OF BLOCKS USED
LINFRE, 0			/ SWAP AREA LOCATION FOR NUMBER OF BLOCKS FREE


	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/--------------------
	PAGE

/***************************************************************************
/****		IOA - INPUT AND OUTPUT FORMATING PACKAGE		****
/***************************************************************************

/THE CALLING SEQUENCE IS:
/	JMS I	IOACAL			/ USE PAGE ZERO REFFERENCE
/	ADDR OF OUTPUT ROUTINE (CHAR COMES IN AC)
/	ADDR OF CONTROL STRING IN TEXT FORMAT
/	OPTIONAL ARG1
/		 ARG2, ETC.
/	RETURN POINT

/ CONTROL DIRECTIVES FOLLOW THE CHARACTERS ! AND ^. THE ! MEANS INDIRECT
/ THROUGH THE ARG TO FIND THE VALUE, AND THE ^ MEANS DO NOT INDIRECT.
/
/ THE CHARACTER  "&"  MEANS THAT THE NEXT CHARACTER IS UPPER CASE. THE "&" MAY
/ BE USED IN MAIN STRINGS AS WELL AS SUBSTRINGS (!S or ^S).  NOTE: To make a
/ printable "&" use "!C& or ^C&" or use the ASCII pointer (!A or ^A) to an 046
/
/ The character "%" means that the next character is bold upper case.	/a042
/ The same restrictions and benifies apply for "%" as for "&".		/a042
/
/	THE DIRECTIVES CURRENTLY ARE:
/
/    !A - ^A	= ASCII LIST - VALUE IS ADDR OF LIST OF ASCII IN WORDS,
/			       LAST WORD ZERO
/
/    !C - ^C	= CONTROL CHARACTER OUTPUT - PRINT CHARACTER "AS-IS"	/A022
/
/    !D - ^D	= DECIMAL CONVERSION
/    !2 - ^2	= 2 DIGIT DECIMAL OUTPUT
/    !3 - ^3	= 3 DIGIT DECIMAL OUTPUT
/    !4 - ^4	= 4 DIGIT DECIMAL OUTPUT
/
/    !E - ^E	= ERASE TO END OF SCREEN (EOS) - NO ARGUMENTS
/
/    !L - ^L	= ERASE TO END OF LINE (EOL) - NO ARGUMENTS
/
/    !P - ^P	= POSITION CURSOR - LEFT BYTE IS LINE #, RIGHT BYTE IS COL #
/		  MINUS VALUE MEANS DO ERASE TO END OF LINE AFTER POSITIONING.
/		  VALUE OF -1 MEANS JUST DO ERASE TO END OF LINE (!L)
/
/    !R - ^R	= DO RUBOUT FUNCTION - NO ARGUMENTS
/
/    !S - ^S	= STRING - VALUE IS ADDRESS OF STRING USING TEXT PSEUDO-OP
/
/    !X - ^X	= SAVE VT100 CURSOR POSITION AND ATTRIBUTES - NO ARGUMENTS
/
/    !Y - ^Y	= RESTORE VT100 CURSOR POSITION AND ATTRIBUTES - NO ARGUMENTS
/
/    !Z - ^Z	= ASCII CHARACTER - OUTPUT CHARACTER IN VT100 ALTERNATE ROM
/				    (USES S.O., CHAR, S.I. SEQUENCE)
/
/    ![ - ^[	= OUTPUT AN ESCAPE CHARACTER - NO ARGUMENTS
/		  MAY BE USED IN MAIN STRINGS AS WELL AS SUBSTRINGS (!S or ^S)
/
/    !& - ^&	= TURN ON UPPER CASE MODE UNTIL NEXT NON ALPHA CHARACTER
/		  MAY BE USED IN MAIN STRINGS AS WELL AS SUBSTRINGS (!S or ^S)

/ THE FOLLOWING DEFINITIONS ARE USED HERE AND BY THE S COMMAND.		/A022
/d051	SHIFT=	PAGSWP			/ SHIFT FLAG, ZERO MEANS CONVERT TO UPPER CASE
/d051	IOAUPS=	PAGDSK			/ NON ZERO MEANS UPPER CASE UNTIL NON ALPHA

/ MAIN ENTRY POINT FOR OUTPUT DISPLAY FUNCTIONS.  RETURN ADDRESS ALSO POINTS
/ TO ARGUMENT LIST.  FIRST WE INITIALIZE THE VARIABLES, AND COPY ARGS.

IOA,	XX			/ ROUTINE TO HANDLE OUTPUT TO THE SCREEN
	JMS	GETCID		/ GET CDI INSTRUCTION TO CALLER		/A023
	DCA	IOAXIT		/ SAVE FOR RETURN TO CALLER		/A023

	AC7776			/ SET UP FOR A DECREMENT OF TWO		/A023
	TAD	IOAXIT		/ COMBINE WITH RETURN CIF/CDF INST.	/A023
	DCA	IOACDF+1	/ SAVE CDF TO CALLER

	DCA	INDARG		/ CLEAR INDIRECT FLAG
	DCA	CBYTE		/ ZERO OFFSET INTO STRING
	JMS	ARGVAL		/ GET OUTPUT ROUTINE POINTER
	JMS	IOASOU		/ USE IT TO SET OUTPUT ROUTINE

	JMS	ARGVAL		/ GET CONTORL STRING POINTER
	DCA	CSTRP

/ NOW WE GO INTO A LOOP READING CHARS OUT OF THE CSTRING, AND OUTPUTING
/ THEM BY CALLING THE OUTPUT ROUTINE (AFTER CONVERTING TO ASCII).
/ A CHECK IS MADE FOR ENDING ZERO, AND THE TWO COMMAND CHARACTERS.

	SKP CLA			/ FALL THROUGH FROM ABOVE, CLEAR UP-SWITCH
UCOM,	AC0001			/ SELECT UPPER CASE MODE
	DCA	IOAUPS		/ NONZERO MEANS SET UPPER CASE UNTIL NON ALPHA

IOALOP,	AC4000			/ INITIALIZE SHIFT TO LOWER CASE
UPCASE,	DCA	SHIFT
	JMS	NEXTCH		/ GET NEXT CHARACTER FROM CONTROL STRING
	DCA	CHAR		/ SAVE IT IN THE VAR CHAR

	TAD	MCBIT		/ If multinational, dont bomb on zero	/a053
	TAD	CHAR		/ GET THE CHARACTER
	SNA			/ IS IT ZERO?
	JMP	DONE		/ YES - END OF STRING - ALL DONE

	JMP	UPCTST		/ Check for upper case or multinational	/a051
/d051	TAD	(-46)		/ CHECK FOR SHIFT CHARACTER (AMPERSAND)
/d051	SNA
/d051	JMP	UPCASE		/ YES, SET UPPER CASE MODE FOR NEXT CHARACTER

NOUPMC,	TAD	CHAR		/ Get the chaarcter back		/a051
	TAD	(-45)		/ See if it is a % sign.		/a042
	SNA			/ No, skip.				/a042
	JMP	BLDUCS		/ Yes, do bold uppercase		/a042

	TAD	(45-34)		/ See if it is a backslash		/a051
	SNA			/ No, skip				/a051
	JMP	MCHAR		/ Yes, set the multinational char shift	/a051

	TAD	(34-36)		/ SEE IF IT IS AN UP-ARROW SIGN (^)
	SNA
	JMP	NOTCM		/ YES - A NOT COMMAND

	TAD	(36-41)		/ CHECK FOR EXCLAMATION MARK COMMAND (!)
	SZA CLA
	JMP	COPYCH		/ NO - SO MUST BE JUST A STRAIGHT COPY

	STA			/ LOAD -1 (MEANS EXCLAMATION POINT COMMAND)
NOTCM,	DCA	INDARG		/ SAVE 0 OR -1 TO KNOW WHETHER OR NOT TO INDIRECT

IOACLP,	DCA	DPREC		/ INITIALIZE PRECISION

	JMS	NEXTCH		/ GET CHARACTER AFTER COMMAND CHARACTER
	DCA	CHAR		/ SAVE IT

	TAD	(IOACLS-2)
	DCA	X0		/ SET UP SEARCH POINTER
	TAD	CHAR		/ GET THE CHARACTER TO TEST FOR

IOANXT,	ISZ	X0		/ BUMP POINTER TO NEXT ENTRY
	TAD I	X0		/ PICK UP A MATCH CHARACTER
	SPA			/ CHECK FOR A MATCH
	JMP	IOANXT		/ MINUS MEANS MORE TO CHECK
	SZA CLA			/ IS THERE A MATCH ?
	JMP	COPYCH		/ NO, NOT A COMMAND CHARACTER, JUST COPY IT
	TAD I	X0		/ YES, PICK UP ADDRESS OF COMMAND ROUTINE
	DCA	T1		/ STORE IN TEMPORARY REGISTER FOR INDIRECT
	JMP I	T1		/ GO PERFORM THE SPECIFIED COMMAND

COPYCH,	TAD	CHAR		/ PICK UP THE CHARACTER
	JMS	SIXOUT		/ CONVERT IT TO ASCII AND PRINT IT
	JMP	IOALOP		/ RETURN TO MAIN LOOP FOR THE NEXT CHARACTER

/ COME HERE WHEN ALL DONE - ZERO CHAR DETECTED JUST OUTPUT THE ZERO TO LET
/ THE OUTPUT ROUTINE KNOW THAT WE ARE DONE, THEN RETURN

DONE,	JMS	OCHAR		/ OUTPUT A ZERO FOR ENDING OF TEXT STRINGS
	JMS	IOASOU		/ RESET IOA TO SCREEN OUTPUT MODE
IOAXIT,	.-.			/ RETURN CIF/CDF
	JMP I	IOA		/ RETURN TO CALLER

/d042	IOACLS,	-64;P4COM	/ !4 OR ^4 / 4 DIGIT DECIMAL OUTPUT
/d042	64-63;P3COM	/ !3 OR ^3 / 3 DIGIT DECIMAL OUTPUT
/d042	63-62;P2COM	/ !2 OR ^2 / 2 DIGIT DECIMAL OUTPUT
/d042	62-46;UCOM	/ !& OR ^& / SET UPPER CASE UNTIL NEXT NON ALPHA CHAR
/d042	46-33;ESCOM	/ ![ OR ^[ / OUTPUT AN ESCAPE CHARACTER		/A022
/d042	33-32		/ !Z OR ^Z / OUTPUT ASCII CHARACTER IN VT100 ALTERNATE
/d042	ZCOM			   / ROM (USE S.O., CHAR,S.I. SEQUENCE)
/d042
/d042	32-31;YCOM	/ !Y OR ^Y / RESTORE CURSOR POSITION AND ATTRIBUTES
/d042
/d042	31-30;XCOM	/ !X OR ^X / SAVE CURSOR POSITION AND ATTRIBURES
/d042
/d042	30-23		/ !S OR ^S / STRING - VALUE IS ADDRESS OF STRING IN
/d042	SCOM			   / THE FORMAT OF THE TEXT PSEUDO-OP
/d042
/d042	23-22;RCOM	/ !R OR ^R / DO RUBOUT FUNCTION - NO ARG
/d042	22-20		/ !P OR ^P / POSITION CURSOR - LEFT BYTE IS LINE #,
/d042	PCOM			   / RIGHT IS COL #, MINUS VALUE MEANS DO
/d042				   / ERASE TO EOL AFTER POSITIONING.
/d042				   / VALUE OF -1 MEANS JUST DO !L
/d042
/d042	20-14;LCOM	/ !L OR ^L / ERASE TO EOL - NO ARG
/d042	14-5;ECOM	/ !E OR ^E / ERASE TO EOS - NO ARG
/d042	5-4;DCOM	/ !D OR ^D / DECIMAL CONVERSION
/d042	4-3;CCOM	/ !C OR ^C / CONTROL CHARACTER OUTPUT		/A022
/d042	3-1		/ !A OR ^A / ASCII LIST - VALUE IS ADDRESS OF LIST
/d042	ACOM			   / OF ASCII IN WORDS, LAST WORD ZERO
/d042
/d042	1;DONE			   / END OF LIST

/a042	These are the pink fuzzy bits that we want in to enrichen	/a042
/a042	the presentation of the menus					/a042

BLDUCS,	AC7777			/ Execute the next character in bold &	/a042
	DCA	BFLAG		/ uppercase				/a042
	JMS	OSTRG		/ Output the escape sequence to set the	/a042
	233			/ terminal to bold mode.		/a042
	61			/ 1					/a042
	4155			/ m + end marker			/a042
	JMP	UPCASE		/ Jump back to upper case it		/a042

BOFF,	XX			/ Routine to turn bold off again	/a042
	DCA	MCBIT		/ And zero the multinational bit	/a051
	TAD	BFLAG		/ Test the bold flag			/a042
	SNA CLA			/ Are we in bold mode?			/a042
	JMP I	BOFF		/ No, therefore nothing to do		/a042
	DCA	BFLAG		/ Yes, reset flag and turn off bold mode/a042
	JMS	OSTRG		/ Output the necessary string		/a042
	233			/ CSI					/a042
	60			/ 0					/a042
	4155			/ m + end marker			/a042
	JMP I	BOFF		/ End of routine			/a042

BFLAG,	ZBLOCK	1		/ Bold flag				/a042

/ THE FOLLOWING LINES PUT A VALUE (0, 1 OR 2 ) INTO THE AC WHICH THEN
/ GETS PUT IN DPREC TO SET THE NUMBER OF DIGITS TO BE OUTPUT. SEE THE
/ OUTDIG ROUTINE FURTHER DOWN FOR A DISCUSSION OF WHAT VALUE TO SET DPREC TO

P2COM,	IAC			/ JUMPS HERE TO SET 2 DIGIT PRECISION
P3COM,	IAC			/ JUMPS HERE TO SET 3 DIGIT PRECISION
P4COM,	JMP	IOACLP		/ JUMPS HERE TO SET 4 DIGIT PRECISION
				/ STORE PRECISION IN DPREC FOR CALL TO OUTDIG

NEXTCH,	XX			/ ROUTINE RETURNS NEXT CHAR FROM CSTRING IN AC
	JMS	GETCHR		/ GET CHAR
	CBYTE			/ ADDR OF OFFSET
CSTRP,	0			/ ADDR OF STRING
	ISZ	CBYTE		/ NEXT CHAR NEXT TIME
	JMP I	NEXTCH		/ RETURN

ARGVAL,	XX			/ GET ADDRESS OF NEXT ARGUMENT
/D022	CLA
	JMS	IOACDF		/ SET TO CALLER FIELD
	TAD I	IOA		/ GET ARGUMENT VALUE
	ISZ	IOA		/ BUMP RETURN ADDRESS POINTER
	ISZ	INDARG
	JMP	.+3		/ SKIP INDIRECT IF NOT NEEDED
	DCA	T1
	TAD I	T1		/ GET INDIRECT ARGUMENT VALUE
	CDFMYF			/ CHANGE FIELDS BACK
	JMP I	ARGVAL		/ AND RETURN

IOACDF,	XX
	.-.
	JMP I	IOACDF

CBYTE,	0
CHAR,	0
INDARG,	0
IOAUPS,	0								/a051
SHIFT,	0								/a051

/***************************************************************************
/A047	A047	A047	A047	A047	A047	A047	A047	A047	A047
/***************************************************************************
/
/Code moved out of SWPBEG area as causes problems with SPELL

/
/	Moved here from NXTARG on edit 044 for space reasons
/

NXTABL,	CLA
	TAD	T2		/ ANY CHARS GOTTEN YET?
	SNA CLA
	JMP	NXTANC		/ NOPE - TRY ANOTHER
	JMP	NXTAMN		/ Check if in Multi-Nat char	/M044

/***************************************************************************
/END A047	END A047	END A047	END A047	END A047
/***************************************************************************

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/--------------------
	PAGE

/*******************************************************************
/*******************************************************************
/****								****
/****	  OUTDIG MUST BE AT THE BEGINNING OF THIS PAGE		****
/****	  IF IT MOVES, CHANGE THE DECLARATION IN WPF0		****
/****								****
/*******************************************************************
/*******************************************************************

/ THE OUTDIG ROUTINE OUTPUTS AN ASCII STRING OF DECIMAL DIGITS FORMED
/ FROM THE VALUE CONTAINED IN THE AC.  IT HAS SINCE BECOME GENERALLY
/ USEFUL IN OTHER PLACES TO GENERATE PART OF THE CURSOR POSITIONING
/ ESCAPE SEQUENCE FOR THE VT-100.

/ BEFORE CALLING OUTDIG, WHICH IS CROSS FIELD CALLABLE,
/ SET UP DPREC TO SPECIFY THE NUMBER OF DIGITS PRECISION.
/ DPREC SHOULD EQUAL 4-(NUMBER OF DIGITS PRECISION)

/ I.E. IF DPREC=0 THEN DIGITS OUTPUT=4
/      IF DPREC=1 THEN DIGITS OUTPUT=3
/      IF DPREC=2 THEN DIGITS OUTPUT=2
/      IF DPREC=3 THEN DIGITS OUTPUT=1

OUTDIG,	XX			/ THIS IS THE DECIMAL CONVERSION ROUTINE
	DCA	VALUE		/ SAVE THE AC. VALUE MUST STAY ON THIS PAGE
				/ SINCE OUTDIG IS CROSS-FIELD CALLABLE.

	JMS	GETCID		/ GET THE CALLER'S DATA FIELD INST.	/A023
	DCA	OUTRTN		/ SAVE IT FOR RETURN TO CALLER
	
	TAD	DPREC		/ SET PRECISION BY CHANGING TABLE STARTING ADDR
	TAD	(TENS-1)
	DCA	TABLE		/ GET ADDR OF TABLE OF POWERS OF TEN

	TAD	DPREC		/ GET NUMBER DIGITS PRECISION
	DCA	DPREC1		/ STORE SO AS NOT TO DESTROY

	TAD	VALUE		/ GET THE VALUE TO BE CONVERTED
	SMA CLA			/ CHECK FOR A NUMBER GREATER THAN 2048
	JMP	DLOOP1		/ IT'S POSITIVE, SO IT IS OK

	TAD	VALUE		/ GET THE VALUE TO BE CONVERTED
	DECIMAL			/ SET TO DECIMAL MODE FOR NEXT INSTRUCTION
	TAD	(-2000)		/ SUBTRACT OFF AT LEAST 2000 WORTH OF VALUE
	OCTAL			/ SET BACK TO OCTAL MODE
	DCA	VALUE		/ SAVE NEW VALUE
	AC0002			/ SET UP TO START AT A COUNT OF TWO

DLOOP1,	DCA	COUNT		/ ZERO COUNT
	ISZ	TABLE		/ GET NEXT TABLE ENTRY
	TAD I	TABLE
	SNA
	JMP	OUTRTN		/ ZERO-DONE

	CMA
	SNA CLA
	ISZ	DPREC1		/ 1'S DIGIT, MAKE SURE DPREC1 IS NON-ZERO

DLOOP2,	TAD	VALUE		/ COMPARE WITH VALUE TO SEE IF DONE THIS DIGIT
	TAD I	TABLE
	SPA
	JMP	DDDGT		/ DONE DIGIT
	DCA	VALUE		/ AND SAVE IT
	ISZ	COUNT		/ NOT DONE - SO INCR COUNT
	JMP	DLOOP2		/ AND DO ANOTHER TIME

DDDGT,	CLA
	TAD	DPREC1		/ THIS TEST IS DONE TO SEE IF DIGIT SHOULD BE
	TAD	COUNT		/ OUTPUT. IT WORKS BECAUSE DPREC1 IS NOT 0
				/ (SMALL +) IF LESS THAN 4 DIGITS TO OUTPUT
	SNA CLA			/ OR LAST DIGIT OUTPUT; COUNT IS ALWAYS SMALL,
	JMP	DLOOP1		/ JMP IF CHARACTER IS SUPPRESSED

	TAD	(60)		/ CONVERT TO ASCII BY ADDING "0"
	TAD	COUNT
	JMS	OCHAR		/ CALL OUTPUT ROUTINE
	ISZ	DPREC1		/ MARK DPREC1 TO INDICATE CHAR HAS BEEN OUTPUT
	JMP	DLOOP1		/ NOT THE END, DO ANOTHER DIGIT

OUTRTN,	HLT			/ PATCHED TO CHANGE FIELD BACK TO USER
	JMP I	OUTDIG		/ RETURN TO CALLER

/ OUTPUT THE VALUE RETURNED BY A CALL TO ARGVAL

DCOM,	JMS	ARGVAL		/ GET VALUE TO CONVERT
	JMS	OUTDIG		/ OUTPUT DECIMAL DIGITS
	JMP	IOALOP		/ DONE, RETURN TO MAIN LOOP

TABLE,	0	/ HOLDS POINTER TO LOCATION IN TABLE OF POWERS ON TEN

VALUE,	0	/ NUMBER TO BE OUTPUT IN DECIMAL FORM

COUNT,	0	/

DPREC,	0	/ INDICATES NUMBER OF DIGITS TO OUTPUT (SEE EXPLANATION ABOVE)

DPREC1,	0	/ SAME AS DPREC1 BUT THIS COPY IS DESTOYED, DPREC IS NOT.

VALUE1,	0	/ IN PCOM, FIRST 6 BITS IS LINE NUMBER, LAST 6 BITS IS COLUMN

COUNT1,	0	/ ABSOLUTE VALUE OF VALUE1




/*********************************************************
/ THE ESCAPE SEQUENCE FOR DIRECT CURSOR ADDRESSING IN THE VT-100 IS:
/ ESC [ L1 L2 ; C1 C2 C3 H
/ L1 AND L2 ARE THE TWO DIGITS OF THE LINE NUMBER (IN ASCII),
/ C1, C2, AND C3 ARE THE THREE DIGITS OF THE COLUMN NUMBER (IN ASCII).
/ THE DIGITS MUST BE DECIMAL.

				/ POSITION CURSOR DIRECTIVE
PCOM,	JMS	ARGVAL		/ GET THE ARGUMENT.
				/ HIGH ORDER BYTE REPRESENTS THE LINE NUMBER;
				/ LOW ORDER BYTE REPRESENTS THE COLUMN  NUMBER.
	DCA	VALUE1		/ SAVE THE ARGUMENT.
	TAD	VALUE1
	IAC
	SNA CLA			/ IF THE ARGUMENT IS MINUS ONE, NO POSITIONING
				/ IS TO BE DONE.  RATHER, WE ERASE TO EOL.
	JMP	LCOM		/ THIS ERASES TO END OF LINE.
	TAD	VALUE1		/ RETRIEVE THE SAVED ARGUMENT.
	SPA			/ IF THE NUMBER IS NEGATIVE, MAKE IT POSITIVE.
	CIA
	AND	P3777		/ ELIMINATE THE UNWANTED HIGH BIT.
	DCA	COUNT1		/ SAVE THE ABSOLUTE VALUE.
	DCA	DPREC		/ PUT 0 IN DPREC TO INDICATE 4 DECIMAL DIGIT
				/ OUTPUT WANTED IN THE OUTDIG ROUTINE

/ NOW THE ESCAPE SEQUENCE OUTPUT BEGINS.
	JMS	OSTRG
	33			/ ESCAPE
	"[-200+4000		/ [

/ PUT OUT THE LINE NUMBER
	TAD	COUNT1		/ GET THE ARGUMENT
	BSW
	AND	P77		/ INTERESTED IN THE HIGH ORDER BYTE.
	IAC			/ THE ADDRESSES ARE ONE TOO SMALL.
	JMS	OUTDIG		/ OUTPUT IT

/ PUT OUT THE SEMI-COLON
	JMS	OSTRG
	";-200+4000		/ ;

/ PUT OUT THE COLUMN NUMBER
	TAD	COUNT1		/ GET THE ARGUMENT
	AND	P77		/ INTERESTED IN THE LOW ORDER BYTE.
	IAC			/ THE ADDRESSES ARE ONE TOO SMALL.
	JMS	OUTDIG

/ END THE SEQUENCE
	JMS	OSTRG
	"H-200+4000		/ H

	TAD	VALUE1		/ GET ORIGINAL ARG
	SMA CLA			/ CHECK IF WAS NEG			/M022
	JMP	IOALOP		/ POSITIVE - DO NEXT THING, RETURN TO MAIN LOOP


LCOM,	JMS	OSTRG		/ DO ERASE TO EOL FUNCTION
	33			/ ESC
	133			/ [
	"K-200+4000		/ K (4000 MEANS END OF STRING)

	JMP	IOALOP		/ DONE, RETURN TO MAIN LOOP

/	This is a copy of the ACOM routine except that it does not 	/A044
/	the dead sequence for an 8 bit char .. it outputs as is !	/A044
/	Used by WPCRE 							/A044
/
/


BCOM,	JMS	ARGVAL		/ Get address of list			/A044
	DCA	VALUE		/ Save it				/A044

BCMLP,	JMS 	IOACDF		/ Set to caller field			/A044
	TAD I	VALUE		/ Indirect through Addr			/A044
	CDFMYF			/ Set to my field			/A044
	ISZ 	VALUE		/ Incr for next time			/A044
	SNA			/ Zero is end				/A044
	JMP	IOALOP		/ Return to Main Loop			/A044
	JMS	OCHAR		/ Output char				/A044
	JMP	BCMLP		/ Next Char				/A044

ACOM,	JMS	ARGVAL		/ GET ADDR OF LIST
	DCA	VALUE		/ SAVE IT

ACMLP,	JMS	IOACDF		/ SET TO CALLER FIELD
	TAD I	VALUE		/ INDIRECT THROUGH ADDR
	CDFMYF			/ SET BACK TO MY FIELD
	ISZ	VALUE		/ INCR FOR NEXT TIME
	SNA			/ ZERO IS END
	JMP	IOALOP		/ RETURN TO MAIN LOOP
	JMS	O8CHK		/ Check if its start of 8 bit char	/M044
	JMP	ACMLP		/ NEXT CHAR

OSTRG,	XX	/ THIS ROUTINE OUTPUTS ASCII CHARS STORED IN THE
		/ WORDS FOLLOWING THE CALL. LAST ENTRY SHOULD BE NEGATIVE
/D022	CLA			/ CLEAR THE AC BEFORE STARTING
OSTRGL,	TAD I	OSTRG		/ PICK UP CHAR
	JMS	OCHAR		/ OUTPUT CHAR
	TAD I	OSTRG		/ GET CHARACTER BACK
	ISZ	OSTRG		/ BUMP FOR NEXT
	SPA CLA			/ CHECK FOR END
	JMP I	OSTRG		/ END - RETURN
	JMP	OSTRGL		/ DO NEXT CHAR

INAPS,	TEXT /^P/		/ CONTROL STRING TO POSITION THE CURSOR	/M007

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/ --------------------
	PAGE

/ CVDBN - CONVERT ASCIZ DECIMAL STRING TO BINARY

/
/	JMS	CVDBN
/		ADDR OF ASCIZ STRING
/	ERROR RETURN  - CLEAR AC
/	NORMAL RETURN - VALUE IN AC
/

CVDBN,	XX
	CLA			/ Get rid of rubbish			/a052
	RDF			/ Read previous data field		/a052
	DCA	CVDRTN		/ Save for return			/a052
	CLA CLL CMA CML		/ SET AC = -1 AND SET THE LINK
	TAD I	CVDBN		/ GET ADDR OF STRING - LINK IS NOW CLEAR
	ISZ	CVDBN
	JMS	BHOOK		/ Blast in the rest of the code		/a052
		CVBLST		/					/a052
	SKP			/ Normal return if no error		/a052
	ISZ	CVDBN		/ Skip return on error			/a052
	TAD	CVDRTN		/ Get the return field			/a052
	TAD	CIDF0		/ Make return instruction		/a052
	DCA	CVDRTN		/ Save the instruction			/a052
	TAD	T2		/ Get the result of the routine		/a052
CVDRTN,	XX			/ Return CDI				/a052
	JMP I	CVDBN		/ Return				/a052

/ The rest of the routine has been blasted out				/a052

/d052		DCA	X0		/ SAVE AS STRING ADDRESS
/d052	

/d052	CVDBL1,	DCA	T2		/ SAVE ACCUMULATED VALUE
/d052		TAD I	X0		/ GET NEXT CHAR
/d052		SNA
/d052		JMP	CVDBDN		/ ZERO - END OF STRING - DONE
/d052		AND	P177		/ ASCII PART ONLY
/d052		TAD	(-72)		/ NUMBER?
/d052		SMA
/d052		JMP	CVDBER		/ NO - ERROR
/d052		TAD	(12)		/ MAKE 0-9
/d052		SPA
/d052		JMP	CVDBER		/ ERROR
/d052	
/d052		DCA	T3		/ SAVE IN TEMP
/d052	
/d052		TAD	T2		/ GET ACCUMULATED VALUE
/d052		CLL RAL			/ MULTIPLY TIMES 2
/d052		SZL SPA			/ CHECK FOR TOO LARGE A NUMBER
/d052		JMP	CVDBER		/ GO TO ERROR RETURN
/d052		RAL			/ MULTIPLY TIMES 2 FOR EFFECTIVE TIMES 4
/d052		TAD	T2		/ ADD VALUE TO TOTAL FOR EFFECTIVE TIMES 5
/d052		SZL SPA			/ CHECK FOR TOO LARGE A NUMBER
/d052		JMP	CVDBER		/ GO TO ERROR RETURN
/d052		RAL			/ MULTIPLY TIMES 2 FOR EFFECTIVE TIMES 10
/d052		TAD	T3		/ ADD NEXT DIGIT
/d052		SNL			/ CHECK FOR TOO LARGE A NUMBER
/d052		JMP	CVDBL1		/ GO SAVE RESULT AND DO NEXT CHAR
/d052	CVDBER,	CLA CLL			/ NOT VALID NUMBER,
/d052		DCA	T2		/ RETURN WITH CLEAR AC & LINK
/d052		SKP			/ GO TO ERROR RETURN
/d052	
/d052	CVDBDN,	ISZ	CVDBN		/ SKIP RETURN IS NORMAL
/d052		JMS	GETCID		/ GET THE CALLER'S DATA FIELD INST.	/A023
/d052		DCA	CVDBEX		/ SAVE TO RESTORE TO CALLER'S FIELD
/d052		TAD	T2		/ GET VALUE - LINK SHOULD BE CLEAR
/d052	CVDBEX,	.-.			/ CIF-CDF
/d052		JMP I	CVDBN		/ AND RETURN TO CALLER
/d052	


PAGSWP,	XX				/ Hole hook for Page Swap rtns	/a051
	MQL				/ Save the AC			/a051
	JMS	GETCID			/ Get the data field of the call/a051
	DCA	PAGEXI			/ Save for exit			/a051
	ACL				/ Get the AC back		/a051
PAGSW1,
	JMS	BHOOK			/ Call the blaster		/a051
	PGSWPH				/ Get the Page Swap Hole	/a051
	JMP I	PAGSWX			/ JUMP to PAGSW2		/a057
					/  CODE IN NEXT PAGE TO DO	/a057
					/ A QURX AND RETURN TO PAGSW1	/A057
			/ ELSE IF SKIP RETURN THEN CONTINUE		/A057

PAGEXI,	XX				/ Location for CDI instruction	/a051
	JMP I	PAGSWP			/ Ret.				/a051

/ This next piece of code is from the IOA main loop, moved here to add	/a051
/ a test for multinational character mode.  If the MCS flag is set, this/a051
/ code exits to immediatly output the MCS character			/a051

UPCTST,	TAD	(-46)		/ Test for Ampersand (&) for uppercase	/a051
	SNA CLA			/ Is this ampersand?			/a051
	JMP	UPCASE		/ Yes, set upper case mode		/a051
	TAD	MCBIT		/ No, now test for multinational flag	/a051
	SZA CLA			/ Is this character multinational?	/a051
	JMP	COPYCH		/ Yes, just output it			/a051
	JMP	NOUPMC		/ No, test for all other types of char	/a051


/ COME HERE TO OUTPUT AN ESCAPE CHARACTER

ESCOM,	TAD	XESC		/ PICK UP THE ESCAPE CHARACTER CODE	/A022
	JMP	CCOM1		/ OUTPUT CHARACTER			/A022

/ COME HERE TO OUTPUT CONTROL CHARACTER - A TO Z BECOME 1 TO 32, [=33, \=34,
/ ]=35, ^=36, _=37, SPACE TO "?" GO OUT AS THEY ARE.  IE !C& PRINTS "&".

CCOM,	JMS	NEXTCH		/ GET CONTROL CHARACTER FROM STRING	/A022
CCOM1,	JMS	OCHAR		/ OUTPUT CHARACTER			/A022
	JMP	IOALOP		/ RETURN TO MAIN LOOP			/A022


/ COME HERE TO DO THE RUBOUT FUNCTION

RCOM,	JMS	IOARUB		/ CALL SUBROUTINE TO RUB OUT A CHARACTER
	JMP	IOALOP		/ RETURN TO MAIN LOOP

IOARUB,	XX			/ SUBROUTINE TO PERFORM THE RUBOUT FUNCTION
	JMS	OSTRG		/ OUTPUT BS SPACE BS
	10
	40
	4010
	JMP I	IOARUB		/ ALL DONE, RETURN TO CALLER

XCOM,	JMS	OSTRG		/ TELL TERMINAL TO SAVE CURSOR ATTRIBUTES
XESC,	33			/ ASCII CODE FOR "ESCAPE"
	67			/ ASCII CODE FOR DIGIT "7"
				/ TELL TERMINAL TO RESET TO ABSOLUTE MODE
	33			/ ASCII CODE FOR "ESCAPE"
	133			/ ASCII CODE FOR CHARACTER "["
	77			/ ASCII CODE FOR CHARACTER "?"
	66			/ ASCII CODE FOR DIGIT "6"
	4154			/ ASCII CODE FOR CHARACTER "l"
	JMP	IOALOP		/ DONE, RETURN TO MAIN LOOP


YCOM,	JMS	OSTRG		/ TELL TERMINAL TO RESTORE CURSOR ATTRIBUTES
	33			/ ASCII CODE FOR "ESCAPE"
	4070			/ ASCII CODE FOR DIGIT "8"
	JMP	IOALOP		/ DONE, RETURN TO MAIN LOOP



/ GETCHR - GET A CHARACTER OUT OF A TEXT STRING

/
/	JMS	GETCHR
/		OFFSET ADDR (OR ZERO MEANING IN AC ALREADY)
/		ADDR OF STRING
/	RETURN, CHAR IN AC
/

GETEMP=	CVDBN								/M022

GETCHR,	XX
	DCA	GETEMP		/ SAVE THE AC
	TAD I	GETCHR		/ GET THE FIRST ARG
	ISZ	GETCHR
	SNA			/ CHECK FOR ZERO
	JMP	USEAC		/ YES - USE THE VALUE IN THE AC
	DCA	GETEMP		/ OTHERWISE SAVE FOR INDIRECTION
	TAD I	GETEMP		/ GET OFFSET

GOTBBP,	CLL RAR			/ CLEAR LINK, AND PUT LOW BIT THERE
	TAD I	GETCHR		/ GET ADDR OF STRING AND ADD
	ISZ	GETCHR
	DCA	GETEMP		/ THAT IS ADDR OF WORD WITH BYTE
	JMS	IOACDF		/ SET CORRECT FIELD
	TAD I	GETEMP		/ GET THE WORD
	CDFMYF
	SNL			/ IF LINK NOT SET
	BSW			/ THEN SWAP THE BYTES
	AND	P77		/ ONLY WANT THE LOW BYTE
	JMP I	GETCHR		/ DONE

USEAC,	TAD	GETEMP		/ GET IT OUT OF THE AC
	JMP	GOTBBP		/ JOIN OTHER CODE


				/ CHAR IO ROUTINES
INCHR,	XX
	JMP	INCHR2		/ (ALLOW A CLOCK TICK ON USER INPUT)
INCHR1,	CIF 0
	JWAIT

INCHR2,	CIF 0
	XLTIN
	JMP	INCHR1
	JMP I	INCHR


IOASOU,	XX
	SNA
	JMP	IOASO1
	DCA	OROUTP
	AC0001
	TAD	IOACDF+1
	SKP
OROUTP,	.-.
	DCA	IOACIF
	JMP I	IOASOU

IOASO1,	TAD	(NOP)
	JMS	OROUTP

OUTCHR,	0
	SNA			/ CHECK FOR A ZERO VALUE
	JMP I	OUTCHR		/ YES, DON'T SEND A NULL TO THE TERMINAL
	JMP	OUTCH2

OUTCH1,	CIF 0
	JWAIT

OUTCH2,	CIF 0
	TTYOU
	JMP	OUTCH1
	JMP I	OUTCHR

OCHAR,	XX

IOACIF,	.-.			/ PATCHED TO SOMETHING
	JMS I	OROUTP		/ CALL OUTPUT ROUTINE
	CLA
	JMP I	OCHAR		/ RETURN

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/--------------------
	PAGE

/***************************************************************************
/****		  DISPLAY DATE AND TIME AND PRINTER STATUS		****
/***************************************************************************

/ CROSS FIELD CALLABLE ROUTINE TO DISPLAY THE DATE & TIME & PRINTER STATUS
/ THE DISPLAY WILL BE UPDATED ONLY IF THE VALUES CHANGE.

TIMDSP,	XX
	JMS	GETCID		/ GET THE CALLER'S DATA FIELD INST.	/A023
	DCA	TIMXIT		/ SAVE THE CIF-CDF INSTRUCTION
	
				/CIFPRT..OVERLAYED IN CX GRAPHICS/A025
				/....MODE... PRTFLD NOT LOADED
				/....REFERENCED BY TIMDSP +2....
TIMDS3,								/A025
	CIFPRT			/ CHANGE TO PRINTER FIELD
	JMS I	(FLABUZ)	/ CHECK IF PRINTER HAS AN ERROR
	CLA			/ Zero before....			/a051
	JMS	PRSCST		/ Check the PRint SCreen STatus		/a051
	JMS	TIME		/ HAS THE TIME CHANGED?
	JMP	TIMXIT		/ NO, THEN GO RETURN TO CALLER

	JMS I	IOACAL		/ USE IOA TO OUTPUT THE DATE AND TIME
		OUTCHR		/ ROUTINE TO USE FOR OUTPUT
		INAINS		/ ADDRESS OF CONTROL IOA STRING
		72		/ CURSOR POSITION TO USE FOR THE DISPLAY
		DATEST		/ ADDRESS OF THE TIME STRING

TIMXIT,	XX			/ CIF-CDF INSTRUCTION TO USER'S FIELD
	JMP I	TIMDSP		/ RETURN TO CALLER


/ TIME - SET THE TIMES ASCIZ STRING TO THE CURRENT TIME

/
/	CDFMYF
/	JMS	TIME
/	RETURN IF STRING UNCHANGED (TIME THE SAME)
/	RETURN IF STRING CHANGED (TIME CHANGES EVERY SECOND)
/
TIME,	XX
	JMS	GETCID		/ GET THE CALLER'S DATA FIELD INST.	/A023
	DCA	TIMEX		/ SAVE FOR RETURN TO CALLER

	CDFSYS
	TAD I	(CLOCK+2)	/ TEST FOR TIME CHANGE
	CIA
	TAD	TIMESE
	SNA CLA
	JMP	TIMEX
	TAD	(CLOCK+1)
	DCA	X0		/ GET NEW VALUES
	TAD I	X0
	DCA	TIMESE
	TAD I	X0
	DCA	TIMEMN
	TAD I	X0
	DCA	TIMEHR
	TAD I	X0
	DCA	TIMEDA
	TAD I	X0
	DCA	TIMEMO
	TAD I	X0
	DCA	TIMEYR
	TAD I	(DAWEEK)	/ GET DAY OF WEEK, TOO
	CDFMYF

	CLL RAL
	TAD	(TIMEWL)
	DCA	TIMEWK

	TAD	(DATEST)
	DCA	TIMES1

/ FIX THE ORDER OF THE NUMBERS OUTPUT BY THE TIME ROUTINE

	TAD	MNFMAT+MUBUF	/ PICK UP THE VALUE OF THE FORMAT WORD	/A024
	AND	(3)		/ MASK OFF DATE BITS			/A024
	TAD	TIMETB		/ CONSTRUCT JUMP INSTRUCTION TO FUNCTION/A024
	DCA	TIMEJP		/ STORE INLINE FOR TRANSFER		/A024
TIMEJP,	XX			/ JUMP INSTRUCTION TO FUNCTION		/A024
TIMETB,	JMP	.+1		/ INSTRUCTION TO JUMP INTO TABLE	/A024
	JMP	TIMEIT		/ 0 = UNINITIALIAZED, GO DO DISPLAY	/A024
	JMP	TIMEIT		/ 1 = D-M-Y, ALL DONE, GO DO DISPLAY	/A024
	JMP	TIMESW		/ 2 = M-D-Y, GO SWAP DAY WITH MONTH	/A024
	TAD	TIMEDA		/ 3 = Y-M-D, SWAP DAY WITH YEAR		/A024
	DCA	TIMEJP		/ SAVE VALUE FOR LATER			/A024
	TAD	TIMEYR		/ PICK UP YEAR VALUE			/A024
	DCA	TIMEDA		/ STORE IN DAY LOCATION			/A024
	TAD	TIMEJP		/ PICK UP DAY VALUE			/A024
	DCA	TIMEYR		/ STORE IN YEAR LOCATION		/A024
	JMP	TIMEIT		/ ALL DONE, GO DO DISPLAY		/A024

TIMESW,	TAD	TIMEDA		/ PICK UP THE DAY VALUE			/A024
	DCA	TIMEJP		/ SAVE VALUE FOR LATER			/A024
	TAD	TIMEMO		/ PICK UP MONTH VALUE			/A024
	DCA	TIMEDA		/ STORE IN DAY LOCATION			/A024
	TAD	TIMEJP		/ PICK UP DAY VALUE			/A024
	DCA	TIMEMO		/ STORE IN MONTH LOCATION		/A024
				/ ALL DONE, GO DO DISPLAY		/A024

TIMEIT,	JMS I	IOACAL		/ CALL THE SYSTEM OUTPUT ROUTINE
		TIMEPT		/ USE A SUBROUTINE TO BUILD A STRING
		DATEIO		/ ADDRESS OF CONTROL STRING

/ THE FOLLOWING THREE VARIABLE LOCATIONS ARE REARRANGED BY THE ROUTINE ABOVE

	TIMEDA,	0		/ INITIAL VALUE FOR DAY			/A024
		MNDSEP+MUBUF	/ ADDRESS OF DATE SEPARATOR		/A024
	TIMEMO,	0		/ INITIAL VALUE FOR MONTH		/A024
		MNDSEP+MUBUF	/ ADDRESS OF DATE SEPARATOR		/A024
	TIMEYR,	0		/ INITIAL VALUE FOR YEAR		/A024

	TIMEWK,	0
	TIMEHR,	0
	TIMEMN,	0
	TIMESE,	0

	ISZ	TIME		/ SKIP RETURN
TIMEX,	HLT			/ CIDF GOES HERE
	JMP I	TIME		/ RETURN TO CALLER

TIMEPT,	XX
	DCA I	TIMES1		/ SAVE IN STRING
	ISZ	TIMES1
	JMP I	TIMEPT		/ RETURN
TIMES1,	0

/ In the following text, ^4 was added to the end of the string.  This
/ modification resets DPREC to 0, thus allowing a 3 digit cursor position
/ to be output if the DATE/TIME stamp is used in wide screen mode.

	DATEIO,	TEXT '^D^S^D^S^D &^S ^D:^2D:^2D ^4'

TIMEWL,	TEXT	"..."
	IFDEF	ENGLSH	< TEXT "SUN" >
	IFDEF	ITALIAN	< TEXT "DOM" >
	IFDEF	V30SWE	< TEXT "S\V" >
	IFDEF 	V30NOR	< TEXT "S\X" >
	IFDEF 	DUTCH	< TEXT "ZON" >
	IFDEF 	SPANISH < TEXT "DOM" >


	IFDEF	ENGLSH	< TEXT "MON" >
	IFDEF	ITALIAN	< TEXT "LUN" >
	IFDEF	V30SWE	< TEXT "M\E" >
	IFDEF 	V30NOR	< TEXT "MAN" >
	IFDEF 	SPANISH	< TEXT "LUN" >
	IFDEF 	DUTCH	< TEXT "MAA" >


	IFDEF	ENGLSH	< TEXT "TUE" >
	IFDEF	ITALIAN	< TEXT "MAR" >
	IFDEF	V30SWE	< TEXT "TI"  >
	IFDEF 	V30NOR	< TEXT "TIR" >
	IFDEF 	DUTCH	< TEXT "DIN" >
	IFDEF	SPANISH < TEXT "MAR" >


	IFDEF	ENGLSH	< TEXT "WED" >
	IFDEF	ITALIAN	< TEXT "MER" >
	IFDEF	V30SWE	< TEXT "ON"  >
	IFDEF 	V30NOR	< TEXT "ONS" >
	IFDEF 	DUTCH	< TEXT "WOE" >
	IFDEF 	SPANISH	< TEXT "MIE" >

	IFDEF	ENGLSH	< TEXT "THU" >
	IFDEF	ITALIAN	< TEXT "GIO" >
	IFDEF	V30SWE	< TEXT "TO"  >
	IFDEF 	V30NOR	< TEXT "TOR" >
	IFDEF 	DUTCH	< TEXT "DON" >
	IFDEF 	SPANISH	< TEXT "JUE" >
	

	IFDEF	ENGLSH	< TEXT "FRI" >
	IFDEF	ITALIAN	< TEXT "VEN" >
	IFDEF	V30SWE	< TEXT "FR"  >
	IFDEF 	V30NOR	< TEXT "FRE" >
	IFDEF 	DUTCH	< TEXT "VRY" >
	IFDEF 	SPANISH	< TEXT "VIE" >


	IFDEF	ENGLSH	< TEXT "SAT" >
	IFDEF	ITALIAN	< TEXT "SAB" >
	IFDEF	V30SWE	< TEXT "L\V" >
	IFDEF 	V30NOR 	< TEXT "L\X" >
	IFDEF 	DUTCH	< TEXT "ZAT" >
	IFDEF 	SPANISH	< TEXT "SAB" >


	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/--------------------
	PAGE


/ The page swap routines have been blasted out to create space this edit/a051

/***************************************************************************
/****			   PAGE SWAPING ROUTINE				****
/***************************************************************************

/ THIS ROUTINE WILL SELECTIVLY SAVE AND LOAD MEMORY LOCATIONS FROM SWAP AREA
/ IN FIELD TWO ON DISK DRIVE ZERO.  THE FUNCTION PERFORMED DEPENDS UPON THE
/ VALUE CONTAINED IN THE AC.  UPON ENTRY IF:

/ AC = 0	THEN SAVE MEMORY LOCATIONS IN THE DISK SWAP SAVE AREA
/		     LOAD MEMORY LOCATIONS WITH THE MENU INTERPRETER

/ AC = +N	THEN SAVE MEMORY LOCATIONS IN THE DISK SWAP SAVE AREA
/		     LOAD MEMORY LOCATIONS WITH DISK BLOCK NUMBER (N)

/ AC = -1	THEN LOAD MEMORY LOCATIONS FROM DISK SWAP SAVE AREA

/ AC = -N	THEN LOAD MEMORY LOCATIONS FROM DISK BLOCK NUMBER (N)


/d053	PAGSWP,	XX			/ ENTRY POINT FOR PAGE SWAPING ROUTINE
/d053		DCA	PAGDSK		/ SAVE THE CONTENTS OF THE ACCUMULATOR
/d053		JMS	GETCID		/ GET THE CALLER'S DATA FIELD INST.	/A023
/d053		DCA	PAGEXI		/ SAVE SO THAT WE CAN RETURN WHEN DONE
/d053	
/d053		TAD	PAGDSK		/ RESTORE THE CONTENTS OF THE ACCUMULATOR
/d053		SMA			/ CHECK FOR A NEGARIVE NUMBER INPUT
/d053		JMP	PGPLUS		/ NO, IT WAS POSITIVE, GO SAVE THE AREA
/d053	
/d053		CMA			/ YES, IT WAS NEGATIVE, MAKE IT POSITIVE
/d053		SZA			/ SKIP IF VALUE WAS A MINUS ONE
/d053		IAC			/ COMPLETE THE NEGATION PROCESS
/d053		SNA			/ CHECK FOR A DISK BLOCK NUMBER IN AC
/d053		TAD	PGDLSW		/ NOTHING, SO PICK UP SAVE AREA NUMBER
/d053		DCA	PAGBLK		/ SAVE THE STARTING DISK BLOCK NUMBER
/d053		JMP	PAGRED		/ SKIP SAVE OPERATION, JUST DO READ OPERATION
/d053	
/d053	PGPLUS,	SNA			/ CHECK FOR A DISK BLOCK NUMBER IN AC
/d053		TAD	(DLFD3)		/ NOTHING, SO PICK UP MENU INTERPRETER NUMBER
/d053		DCA	PAGBLK		/ SAVE THE STARTING DISK BLOCK NUMBER
/d053	/D037	DCA	MUBUF+MNBLK	/ CLEAR MENU BLOCK IN MEMORY INDICATOR
/d053	
/d053		JMS	PAGDSK		/ WRITE OUT THE MEMORY SWAP AREA
/d053		RXEWT			/ DISKETTE WRITE FUNCTION CODE
/d053	PGDLSW,	DLSWAP			/ BLOCK NUMBER TO START WRITTING FROM
/d053	
/d053	PAGRED,	JMS	PAGDSK		/ GO PERFORM DISK READ FUNCTION
/d053	RXERD			/ DISKETTE READ FUNCTION CODE
/d053	PAGBLK,	0			/ BLOCK NUMBER TO START READING FROM
/d053	PAGEXI,	0			/ LOCATION FOR CIF-CDF RETURN FIELD COMAND
/d053		JMP I	PAGSWP		/ RETURN TO CALLER


/ Page swap routines balsted out to make room this edit			/a053

/***************************************************************************
/****			PAGE SWAPING DISK I/O ROUTINE			****
/***************************************************************************

/ THIS ROUTINE WILL PERFORM THE READ/WRITE FUNCTION FOR THE SWAP AREA
/ UPON ENTRY, THE AC MUST BE CLEAR.  THE CALL IS MADE AS FOLLOWS:
/
/	JMS	PAGDSK		/ ROUTINE TO DO I/O TO THE DISK
/		FUNCTION CODE	/ READ OR WRITE RX FUNCTION CODE
/		DISK BLOCK	/ BLOCK NUMBER TO START READING OR WRITTING
/	NORMAL RETURN		/ RETURN POINT, DISK ERRORS ARE NOT HANDLED

/d053	PAGDSK,	XX			/ ENTRY POINT FOR PAGE SWAPING ROUTINE
/d053		TAD I	PAGDSK		/ PICK UP THE FUNCTION CODE TO BE USED
/d053		DCA	QUQBLK+RXQFNC	/ STORE FUNCTION CODE IN QUEUE BLOCK
/d053	
/d053		ISZ	PAGDSK		/ INCREMENT POINTER TO NEXT ITEM IN LIST
/d053		TAD I	PAGDSK		/ PICK UP STARTING DISK BLOCK NUMBER
/d053		DCA	QUQBLK+RXQBLK	/ STORE BLOCK NUMBER IN QUEUE BLOCK
/d053	
/d053		ISZ	PAGDSK		/ INCREMENT POINTER TO RETURN ADDRESS
/d053		DCA	QUQBLK+RXQDRV	/ SELECT THE SYSTEM DRIVE, NUMBER ZERO
/d053		TAD	(-DSSWAP)	/ NEGATIVE OF NUMBER OF BLOCKS TO DO	/M016
/d053		DCA	X1		/ STORE IN COUNTER REGISTER
/d053		TAD	GETMYF		/ PICK UP THE INSTRUCTION "CDFMYF"
/d053		DCA	QUQBLK+RXQBFD	/ STORE CHANGE FIELD INSTRUCTION IN QUEUE BLOCK
/d053	
/d053		TAD	(SWPBEG)	/ PICK UP STARTING MEMORY ADDRESS	/M016
/d053		DCA	QUQBLK+RXQBAD	/ STORE MEMORY ADDRESS IN QUEUE BLOCK
/d053	
/d053	PAGLOP,	JMS	QURX		/ GO DO A DISK BLOCK TRANSFER
/d053		CLA			/ IGNORE ANY ERROR INDICATION
/d053	
/d053		TAD	(400)		/ OFFSET TO NEXT MEMORY BLOCK ADDRESS
/d053		TAD	QUQBLK+RXQBAD	/ COMBINE WITH CURRENT MENORY ADDRESS
/d053		DCA	QUQBLK+RXQBAD	/ STORE MEMORY ADDRESS IN QUEUE BLOCK
/d053	
/d053		ISZ	QUQBLK+RXQBLK	/ INCREMENT THE QUEUE BLOCK DISK BLOCK COUNTER
/d053		ISZ	X1		/ INCREMENT THE COUNTER, CHECK FOR DONE
/d053		JMP	PAGLOP		/ NOT DONE, GO DO IT AGAIN
/d053		JMP I	PAGDSK		/ ALL DONE, RETURN TO CALLER WITH AC=0

/a042 IOA command table moved here to make room for the pink fuzzy bits	/a042

IOACLS,	-64;P4COM	/ !4 OR ^4 / 4 DIGIT DECIMAL OUTPUT
	64-63;P3COM	/ !3 OR ^3 / 3 DIGIT DECIMAL OUTPUT
	63-62;P2COM	/ !2 OR ^2 / 2 DIGIT DECIMAL OUTPUT
	62-46;UCOM	/ !& OR ^& / SET UPPER CASE UNTIL NEXT NON ALPHA CHAR
	46-33;ESCOM	/ ![ OR ^[ / OUTPUT AN ESCAPE CHARACTER		/A022
	33-32		/ !Z OR ^Z / OUTPUT ASCII CHARACTER IN VT100 ALTERNATE
	ZCOM			   / ROM (USE S.O., CHAR,S.I. SEQUENCE)

	32-31;YCOM	/ !Y OR ^Y / RESTORE CURSOR POSITION AND ATTRIBUTES

	31-30;XCOM	/ !X OR ^X / SAVE CURSOR POSITION AND ATTRIBURES

	30-23		/ !S OR ^S / STRING - VALUE IS ADDRESS OF STRING IN
	SCOM			   / THE FORMAT OF THE TEXT PSEUDO-OP

	23-22;RCOM	/ !R OR ^R / DO RUBOUT FUNCTION - NO ARG
	22-20		/ !P OR ^P / POSITION CURSOR - LEFT BYTE IS LINE #,
	PCOM			   / RIGHT IS COL #, MINUS VALUE MEANS DO
				   / ERASE TO EOL AFTER POSITIONING.
				   / VALUE OF -1 MEANS JUST DO !L

	20-14;LCOM	/ !L OR ^L / ERASE TO EOL - NO ARG
	14-5;ECOM	/ !E OR ^E / ERASE TO EOS - NO ARG
	5-4;DCOM	/ !D OR ^D / DECIMAL CONVERSION
	4-3;CCOM	/ !C OR ^C / CONTROL CHARACTER OUTPUT		/A022
	3-2;BCOM	/ !B or ^B / ASCII LIST - DEAD THINGS LEFT IN	/a044
	2-1		/ !A OR ^A / ASCII LIST - VALUE IS ADDRESS OF LIST
	ACOM			   / OF ASCII IN WORDS, LAST WORD ZERO

	1;DONE			   / END OF LIST


/***************************************************************************
/****			SUBSTRING (^S OR !S)				****
/***************************************************************************

/ SHIFT=	PAGSWP		/ SHIFT FLAG, ZERO MEANS CONVERT TO UPPER CASE
/ IOAUPS=	PAGDSK		/ NON ZERO MEANS UPPER CASE UNTIL NON ALPHA

/ UNPACK 6 BIT STRINGS AND WRITE THEM OUT, INTERPRETS & AS A SHIFT CHARACTER

SCOM,	JMS	ARGVAL		/ GET ADDRESS OF STRING
	DCA	SCMBP		/ PUT INTO CALL
	DCA I	SCMVAL		/ INITIALIZE OFFSET TO ZERO
SCMC41,	DCA	SCMF41		/ CLEAR FLAG INDICATING EXCLAMATION POINT FOUND

SCMLP,	JMS	GETCHR		/ GET NEXT CHAR
SCMVAL,	VALUE
SCMBP,	0
	ISZ I	SCMVAL		/ INCREMENT OFFSET
	DCA	ARGVAL		/ SAVE THE CHARACTER

	TAD	MCBIT		/ Check the MCS flag			/a050
	SZA CLA			/ Is this an MCS character		/a050
	JMP	SCMN34		/ Yes, print all such characters, unless/a050
				/ ampersand found			/a050
	ISZ	SCMF41		/ CHECK THE EXCLAMATION POINT FLAG
	JMP	SCMT41		/ NONE FOUND YET, GO CHECK IF THIS IS ONE

	TAD	ARGVAL		/ EXCLAMATION POINT HAS PREVIOUSLY BEEN FOUND
	TAD	(-33)		/ MAYBE THIS CHARACTER MAKES UP THE "![" PAIR
	SNA			/ IS THERE A MATCH ?
	JMP	SCMESC		/ YES, GO PRINT AN ESCAPE CHARACTER
	TAD	(33-46)		/ MAYBE THIS CHARACTER MAKES UP THE "!&" PAIR
	SNA CLA			/ IS THERE A MATCH ?
	JMP	SCMUPS		/ YES, GO SET UPPER CASE MODE

	TAD	(41)		/ NO, PRINT PREVIOUS EXCLAMATION POINT
	JMS	SIXOUT		/ GO AND PRINT THE CHARACTER

SCMT41,	TAD	ARGVAL		/ EXCLAMATION POINT WAS NOT PREVIOUSLY FOUND
	TAD	(-41)		/ CHECK TO SEE IF MAYBE THIS IS ONE
	SZA CLA			/ IS IT AN EXCLAMATION POINT ?
	JMP	SCMN41		/ NO, GO CONTINUE WITH STRING
	AC7777			/ YES, EXCLAMATION POINT WAS FOUND, SET FLAG
	JMP	SCMC41		/ GO AND SET THE EXCLAMATION POINT FLAG

SCMN41,	TAD	ARGVAL		/ IS NOT CONTROL, RESTORE ORIGINAL VALUE/m053
	SNA			/ TEST FOR ZERO STRING TERMINATOR	/m053
	JMP	IOALOP		/ ZERO TERMINATOR FOUND, RETURN TO MAIN LOOP/m053

	TAD	(-34)		/ Test for backslash (\)		/m053
	SZA CLA			/ Is this a multinational introducer?	/a050
	JMP	SCMN34		/ No, print character			/m053
	TAD	(200)		/ Yes, set the MCS flag			/a050
	DCA	MCBIT		/ ...					/a050
	JMP	SCMLP		/ Get the next character		/a050

SCMN34,	TAD	ARGVAL		/ Get the character again		/a053
	TAD	(-46)		/ CHECK FOR AMPERSAND (&)		/m053
	SZA CLA			/ SKIP IF IT IS AN AMPERSAND (&)	/m053
	JMP	SCMN46		/ AMPERSAND IS NOT WITHIN A SUBSTRING
	DCA	SHIFT		/ CLEARING THIS LOCATION MAKES UPPERCASE
	JMP	SCMLP		/ GO GET NEXT CHARACTER

SCMN46,	TAD	ARGVAL		/ Get the character back again		/a053
	JMS	SIXOUT		/ CONVERT TO ASCII, SET SHIFT TO 4000 FOR L.C.
	JMP	SCMLP		/ DO NEXT CHARACTER

SCMUPS,	ISZ	IOAUPS		/ SET THE UPPER CASE SWITCH FLAG
	JMP	SCMC41		/ GO AND CLEAR THE EXCLAMATION POINT FLAG

SCMESC,	TAD	ARGVAL		/ PICK UP THE LEFT SQUARE BRACKET CHARACTER
	JMS	OCHAR		/ PRINT IT AS AN ESCAPE CHARACTER (33)
	JMP	SCMC41		/ GO AND CLEAR THE EXCLAMATION POINT FLAG

/ THIS ROUTINE CONVERTS SIXBIT IN THE AC TO ASCII AND OUTPUTS IT TO THE SCREEN

SIXOUT,	XX			/ OUTPUT SIXBIT CHARACTER TO SCREEN
	DCA	OCHAR		/ SAVE THE CURRENT CHARACTER
	TAD	MCBIT		/ Check if an 8 bit char is to be output/a051
	SZA CLA			/ Is this an 8 bit char?		/a051
	TAD	(33-40)		/ Yes, bias the next test so letters pass/a051
	TAD	OCHAR		/ GET THE CHARACTER BACK AGAIN
	TAD	(-33)		/ CHECK FOR A CHARACTER GREATER THAN " "/m051
	SNA			/ IF = 33 THEN IT'S A [, GO PRINT IT
	JMP	SIXOT1		/ MUST CLEAR THE SHIFT VALUE
	SMA CLA			/ IF ALPHA CHARACTER, THEN SKIP AROUND
	DCA	IOAUPS		/ NOT ALPHA, THEN ZERO THE UP-SWITCH
	TAD	IOAUPS		/ GET THE VALUE OF THE UP-SWITCH
	SZA CLA			/ IF NOT SET, THEN SKIP AROUND
SIXOT1,	DCA	SHIFT		/ IT'S SET, CLEAR THE SHIFT FLAG
	JMS	SIXXOU		/ Call the output translation routine	/a051
	JMP I	SIXOUT		/ RETURN TO THE CALLER

SCMF41,	0			/ FLAG MEANING EXCLAMATION POINT WAS FOUND
MCBIT,	0			/ Word to shift next char to 8 bit	/a051

/****************************************************************************
/ some code moved here from PAGSWP due to lack of space			/a057
/****************************************************************************

PAGSW2,	JMS	QURX			/ go do a disk block transfer	/a057
	CLA				/ IGNORE ANY ERROR INDICATION	/A057
	AC7777				/ SET FLAG TO INDICATE QURX DONE/A057
	DCA	PAGQRX			/ THIS FLAG			/A057
	JMP	PAGSW1			/ GO BACK TO THE BLAST		/A057

PAGQRX,	0			/ flag  QURX done			/a057


	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/--------------------
	PAGE

/***************************************************************************
/****	    ROUTINE TO GET CHARACTER, UPDATE TIME & PRINTER STATUS	****
/****									****
/****	  NOTE: THIS ROUTINE MUST BE HERE BECAUSE OF WPF1 DEFINITION	****
/***************************************************************************

INAIN,	XX			/ ROUTINE TO GET A CHARACTER & DISPLAY THE TIME
	JMS	GETCID		/ GET THE CALLER'S DATA FIELD INST.	/A023
	DCA	INAINX		/ STORE SO THAT WE CAN RETURN TO THE CALLER
	JMP	INAIN2		/ SKIP AROUND THE JWAIT INSTRUCTION

INAIN1,	CIFSYS			/ CHANGE TO SYSTEM FIELD
	JWAIT			/ LET OTHERS RUN WHILE WAITING FOR INPUT

INAIN2,	JMS	TIMDSP		/ CHECK FOR PRINTER ERROR AND TIME CHANGE
	CIFSYS			/ CHANGE TO SYSTEM FIELD
	XLTIN			/ CHECK FOR USER INPUT FROM THE KEYBOARD
	JMP	INAIN1		/ NONE, GO LET THE OTHER JOBS RUN FOR A WHILE

INAINX,	XX			/ YES, GOT A CHARACTER, CHANGE TO USER'S FIELD
	JMP I	INAIN		/ RETURN TO CALLER WITH CHARACTER IN AC




/***************************************************************************
/****			INPUT ASCII STRING ROUTINE			****
/***************************************************************************

/	INA - INPUT AN ASCII STRING

/	SET AC=0 FOR NORMAL USE (DISPLAYS TIME)
/	SET AC POS (=N) TO INDICATE BUFFER ALREADY HAS N CHARS
/
/	SET AC=-1 TO AVOID TIME AND CURSOR POSITIONING
/	SET AC NEG (=-N) TO INDICATE BUFFER ALREADY HAS N CHARS
/			 AND AVOID TIME AND CURSOR POSITIONING
/	JMS	INA
/		ADDR OF BUFFER
/	ERROR RETURN - AC=0 MEANS OVERFLOW, ^=0 IS CHARACTER
/	NORMAL RETURN
/
/	ON RETURN, MQ HAS NUMBER OF CHARS IN BUFFER
/
/	BUFFER,	-SIZE
/		ZBLOCK	SIZE+1
/
/ THE STRING WILL END WITH A ZERO WORD

INA,	XX
	DCA	INAFLG		/ SAVE MODE OR INITIAL COUNT OF NUMBER READ
	TAD I	INA		/ GET FIRST ARGUMENT
	ISZ	INA		/ BUMP RETURN ADDRESS POINTER
	DCA	INABAD		/ SAVE AS BUFFER ADDRESS

	JMS	GETCID		/ GET THE CALLER'S DATA FIELD INST.	/A023
	DCA	INAEXI		/ STORE IN-LINE SO WE CAN RETURN

	AC7776			/ SET UP FOR A DECREMENT OF TWO		/A023
	TAD	INAEXI		/ COMBINE WITH CID INSTRUCTION		/A023
	DCA	INACDF		/ STORE SO WE CAN GET TO USER'S DATA FIELD

	TAD	INAFLG		/ TEST OPTION
	SZA			/ CHECK FOR ZERO POSITION ON LINE	/A036
	JMP	INASET		/ NO, GO SET UP START COLUMN		/A036

	JMS I	IOACAL		/ YES, REPOSITION CURSOR TO BOTTOM LINE	/A036
INAOUT,	OUTCHR			/ OUTPUT ROUTINE TO USE			/A036
	INAPS			/ ADDRESS OF THE CONTROL STRING		/A036
	2700			/ ADDRESS OF BOTTOM LINE FOR IOA	/A036

INASET,	SPA			/ CHECK FOR THE MINUS (NO TIME DISPLAY) CASE
	CMA			/ YES, IT WAS MINUS, MAKE IT POSITIVE	/M035
INACLR,	DCA	INANUM		/ SET UP START COLUMN			/M035

INALOP,	TAD	INAFLG		/ GET MODE FLAG WORD
	SPA CLA			/ CHECK FOR TYPE OF TIME DISPLAY
	JMP	INALP1		/ MINUS MEANS NO TIME
	JMS	INAIN		/ GET A CHARACTER, SHOWING THE TIME
	SKP			/ SKIP OVER THE OTHER TYPE OF CALL
INALP1,	JMS	INCHR		/ GET A CHARACTER, NOT SHOWING THE TIME
	DCA	INACHR		/ SAVE THE CHARACTER JUST ENTERED BY USER

	TAD	INAFLG		/ GET MODE FLAG WORD
	SZA CLA			/ CHECK FOR NO CURSOR MOVEMENT		/M035
	JMP	INALP2		/ NONE, DO NOT ERASE BOTTOM LINE

	TAD	INANUM		/ GET THE NUMBER OF CHARACTERS ENTERED SO FAR
	SZA CLA			/ CHECK TO SEE IF ANY HAVE BEEN ENTERED YET
	JMP	INALP2		/ YES, THEN DO NOT ERASE THE BOTTOM LINE
	JMS I	IOACAL		/ CALL IOA TO REPOSITION THE CURSOR	/A007
	OUTCHR			/ OUTPUT ROUTINE TO USE			/A007
	INAPS			/ ADDRESS OF THE CONTROL STRING		/A007
	-2700			/ ADDRESS OF BOTTOM LINE FOR IOA

INALP2,	TAD	INACHR		/ PICK UP THE CHARACTER JUST ENTERED BY USER
	SMA			/ IF MINUS, THEN IT'S A SPECIAL CHARACTER
	JMP	INACHK		/ NORMAL CHARACTER - GO CHECK FOR OVERFLOW

	TAD	(-EDPWFL)	/ CHECK FOR A POWER FAIL CODE
	SNA			/ SKIP IF NO MATCH
	JMP	INARO		/ IT'S A POWER FAIL - TREAT AS RUBOUT

	TAD	(EDPWFL-EDRBCH)	/ CHECK FOR A RUBOUT CHARACTER CODE
	SNA			/ SKIP IF NO MATCH
	JMP	INARO		/ IT'S A  RUBOUT, GO DO IT

	TAD	(EDRBCH-EDRBWD)	/ CHECK FOR A RUB WORD CHARACTER CODE
	SNA			/ SKIP IF NO MATCH
	JMP	INARW		/ IT'S A RUB WORD, GO DO IT

	TAD	(EDRBWD-EDNWLN)	/ CHECK FOR A CARRIAGE RETURN CODE
	SNA CLA			/ SKIP IF NO MATCH
	JMP	INACR		/ IT'S A CARRIAGE RETURN, GO BACK TO CALLER
	JMP	INASPC		/ ERROR - UNKNOWN SPECIAL, GO BACK TO CALLER

INACHK,	
/d044	JMS	INAST1		/ CHANGE TO USER FIELD, SET RESULT POINTER
/d044	AC0001			/ SET UP TO INCREMENT THE COUNT
/d044	TAD	INANUM		/ PICK UP THE CHARACTER COUNT
/d044	TAD I	INABAD		/ COMPARE WITH STRING LENGTH IN USER FIELD
/d044	SMA CLA			/ TEST FOR OVERFLOW
/d044	JMP	INAOVR		/ JUMP IF OVERFLOW

/d044	TAD	INACHR		/ GET CHARACTER ENTERED BY THE USER
/d044	DCA I	T1		/ SAVE IN USER'S BUFFER AREA
/d044	CDFMYF			/ SWITCH BACK TO MY FIELD

	JMS 	BHOOK		/ Call Blaster				/A044
	INCHKR			/ IN Check routine			/A044
	 JMP	INAOVR		/ Overflow get out			/A044


	TAD	INACHR		/ GET CHARACTER ENTERED BY THE USER
	JMS I	INAOUT		/ ECHO IT TO THE SCREEN			/M036
	ISZ	INANUM		/ INCREMENT THE CHARACTER COUNTER
	JMP	INALOP		/ GO GET NEXT CHARACTER

INARO,	JMS	INAROR		/ CALL RUBOUT ROUTINE ONCE
	JMP	INALOP		/ GO GET NEXT CHARACTER

INARW,	JMS	INAROR		/ DO A RUBOUT
	TAD 	INTCHR		/ get char back				/A044
	TAD	(-40)		/ SUBTRACT VALUE FOR A SPACE
	SZA CLA			/ SITTING ON A BLANK?		/C039
	JMP	INARW		/ NO - DO RUBOUT AGAIN
	JMS	INAROR		/ Got a space so rub it out		/A058
	JMP	INALOP		/ YES - DONE, GO GET NEXT CHARACTER

INACR,	ISZ	INA		/ NORMAL SKIP RETURN
INAOVR,	DCA	INACHR		/ ZERO CHARACTER FOR CLEAR AC RETURN TO CALLER
INASPC,	JMS	INAST1		/ CHANGE TO USER FIELD, SET RESULT POINTER
	DCA I	T1		/ CLEAR LAST LOCATION IN USER'S BUFFER AREA
	TAD	INANUM		/ GET THE COUNT OF CHARACTERS ENTERED
	MQL			/ SAVE NUMBER OF CHARACTERS INPUT BY USER
	TAD	INACHR		/ GET CHARACTER TO SHOW
INAEXI,	0			/ RETURN CIF-CDF
	JMP I	INA		/ RETURN TO CALLER

INAROR,	XX			/ ROUTINE TO RUBOUT A CHARACTER
	TAD	INANUM		/ GET THE COUNT OF CHARACTERS ENTERED SO FAR
	SNA			/ CHECK FOR A ZERO COUNT		/M035
	JMP	INACLR		/ NONE, SO JUST IGNORE THE RUBOUT FUNCTION
	TAD	MINCHSZ		/ DECREMENT THE COUNT		/m044	/M035
	DCA	INANUM		/ STORE THE DECREMENTED COUNT OF CHARACTERS
	JMS	IOARUB		/ USE IOA ROUTINE TO DO THE RUBOUT
	JMS	INAST1		/ CHANGE TO USER FIELD, SET RESULT POINTER
	AC7777			/ MOVE POINTER BACK ONE			/A058
	TAD	T1		/ GET CHAR POINTER			/A058
	DCA	T1		/ AND RESET 				/A058
	TAD I	T1		/ PICK UP PREVIOUS CHARACTER FROM BUFFER
	DCA	INTCHR		/ Save it				/A044
	TAD	INTCHR		/ Get it back				/A044
	CDFMYF			/ SWITCH BACK TO MY FIELD		
	JMS	BHOOK		/ Call Blaster				/A044
	INCSZR			/ To find character size		/A044
	JMP I	INAROR		/ RETURN TO CALLER

INAST1,	XX			/ ROUTINE TO SET THE BUFFER POINTER
INACDF,	XX			/ CDF INSTRUCTION TO CHANGE TO USER FIELD
	AC0001			/ SET THE ACCUMULATOR TO A VALUE OF ONE
	TAD	INANUM		/ PICK UP THE CHARACTER COUNT
	TAD	INABAD		/ ADD TO THE USER'S BUFFER ADDRESS
	DCA	T1		/ STORE POINTER TO CHARACTER IN BUFFER
	JMP I	INAST1		/ RETURN TO CALLER



INACHR,	0			/ LOCATION TO SAVE CHARACTER ENTERED BY USER
INABAD,	0			/ START OF USER'S BUFFER, POINTS TO LENGTH
INANUM,	0			/ COUNT OF CHARACTERS ENTERED BY THE USER
INAFLG,	0			/ MODE WORD USED FOR TIME DISPLAY CHOICE
INCHSZ,	0			/ Character size 1-7 bit , 5-8 bit	/A044
MINCHSZ,0			/ -Ve char size 			/A044
INTCHR,	0			/ temp					/A044
	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/--------------------
	PAGE

/******* PAGE LEFT FOR HOOK TO PRINTSCREEN ************************

PSFLAG,	0			/ FLAG	=0	=4nnn
PSPRVF,	0			/ Previous value of the status flag	/a051

PSSTRT,	CDFPRT			/ The printer status is in the ptr field/a051
	TAD I	PSTUTS		/ Get the printer status before the loop/a051
PSLOOP,	ISZ	PSCNT		/ Wait for count to reach zero		/a041
	JMP	PSLOOP		/					/a041
	TAD I	PSTUTS		/ Check the printer status again	/a041
	CDIMNU			/ Prevent interupts until both 		/a051
				/ Non-PRINT printer busy flag and Print	/a051
				/ Screen status flag set, or error found/a051
	SZA			/ Is PRINT job dormant?			/a041
	JMP	PSEXT2		/ No, abort job			/m060	/a041
	TAD I	PSMNPU		/ Check the non-PRINT printer busy flag	/a051/M055
	SPA			/ Is it set?				/a051
	JMP	PSEXT2		/ Yes, abort job as CX must be using it	/a051/M055
	TAD	(4000)		/ Set the flag as I'm now using it	/a051
	DCA I	PSMNPU		/ Restore the flag			/a051/M055
	AC4000			/ Set the print screen flag		/a041
 	DCA	PSFLAG		/ print screen in progress		/a041
	JMS	BHOOK		/ Blast in the print screen routine	/a041
	PRTSCN			/ as a table (that is non-executing).	/a041
	CIFPRT			/ Change to print screen field		/a046
	JMS	PRTSHL		/ The routine resides in a buffer and	/a046
				/ therefore does not need to be replaced/a046

PSEXIT,	AC3777			/ Get a mask into the accumulator	/a051
	AND I	PSMNPU		/ Zero the non-print printer busy flag	/a051/M055
	DCA I	PSMNPU		/ And re-save it			/a051/M055
PSEXT2,	CLA			/ Zero Ac in case we jumped here directly/A055
	DCA	PSFLAG		/ Clear the status flag			/a041/M055
	CIFSYS			/ go back to sys
	JEXIT			/ 
	JMP	PSSTRT		/ go restart

PSCNT,	ZBLOCK	1		/ Counter for delay loop in print screen/a041
PSTUTS,	PRSTTS			/ Pointer to printer status byte in PRT	/a041
PSMNPU,	MUBUF+MNPULD		/ Address of the Non-PRINT printer busy	/a051
				/ flag					/a051

/****************************************************************************
/ PRSCST	PRint SCreen STatus reporting routine.  This routine is	/a051
/		called every time FLABUZ is called by the routine TIMDSP/a051
/		It checks if the status of the Print Screen routine has	/a051
/		changed, and if it has makes the appropriate report to	/a051
/		the user using the top status line.			/a051
/****************************************************************************

PRSCST,	XX			/ PRint SCreen STatus routine		/a051
	TAD	PSFLAG		/ Get the print screen status word	/a051
	TAD	PSPRVF		/ Compare it with the (-ve) previous state/a051
	SNA			/ Are they the same?			/a051
	JMP I	PRSCST		/ Yes, therefore no change so return	/a051
	JMS	BHOOK		/ Blast in and run the Print screen	/a051
	PSCRST			/ status routine			/a051
	JMP I	PRSCST		/ Return				/a051


/ MCHAR		Routine used by IOA to set multinational character shift/a051
/		word for SIXOUT						/a051

MCHAR,	TAD	(200)		/ Store a word with the eigth bit set	/a051
	DCA	MCBIT		/ in the mc shift word used in SIXOUT	/a051
	TAD	SHIFT		/ Preserve the status of the shift word	/a051
	JMP	UPCASE		/ when returning to the main routine	/a051

/ SIXXOU	SIXOUT output translation routine.  Moved here for space/a051
/		reasons in this edit					/a051

SIXXOU,	XX			/ Begin SIXOUT output translation routine/a051
	TAD	OCHAR		/ GET THE CHARACTER BACK AGAIN
	TAD	MCBIT		/ Add in the bit set if "\" preceeded char/a051
	BSW			/ SWAP CHARACTER TO HIGH ORDER BYTE
	SPA			/ CHECK FOR ALPHA CHARACTER
	JMP	.+3		/ IT'S NOT, SO SKIP AROUND
	IAC			/ SET ASCII ALPHA BIT
	TAD	SHIFT		/ NON ZERO SHIFT VALUE CONVERTS TO LOWER CASE
	BSW			/ RESET CHARACTER TO PROPPER ARRANGMENT
	JMS	OCHAR		/ OUTPUT CHARACTER TO THE SCREEN
	AC4000			/ RESET THE SHIFT FLAG TO LOWER CASE
	DCA	SHIFT
	JMS	BOFF		/ Test for bold, and turn off if on	/a042
	JMP I	SIXXOU		/ Return

PRINTQ,	ZBLOCK	PQSZ+PQSZ	/ Print que



/
/	This routine belongs to OSTRG and checks the display buffer 	/A044
/	for an embedded dead key sequence (Must be 8 bit char)		/A044
/	of form 							/A044
/	<St Dead><Space><62><x><EndD> and outputs the appropriate char	/A044
/


O8CHK,	XX								/A044
	TAD	(-10)		/ Check for start of dead		/A044
	SNA			/					/A044
	JMP	OS8OUT		/ Display 8 bit				/A044
	TAD	(10)		/ Replace char 				/A044
	JMS	OCHAR		/ Output it				/A044
	JMP I	O8CHK		/ And Exit				/A044
OS8OUT,	ISZ	VALUE		/ Past space				/A044
	ISZ	VALUE		/ Point to char				/A044
	TAD	VALUE		/ Get contents to indirect to		/A044
	DCA	XVALUE		/ And save				/A044
	JMS	IOACDF		/ Set to users buffer			/A044
	TAD I	XVALUE		/ Get character				/A044
	CDFMYF			/ Now back to mine			/A044
	TAD	(200)		/ Add back 8th bit			/A044
	JMS	OCHAR		/ Output it				/A044
	ISZ	VALUE		/ Point to End of Dead			/A044
	ISZ	VALUE		/ Point to End of Dead			/A044
	JMP I	O8CHK		/ Rejoin normal code			/A044

/****************************************************************************
/a047	a047	a047	a047	a047	a047	a047	a047	a047	a047
/****************************************************************************
/
/	Moved here for space reasons
/
NXTABS,	JMS	BHOOK		/ Blast in code 			/A044
	NXTDED			/ Routine name				/A044
	 JMP	NXTAOK		/ Pass start and End dead through	/A044
	 JMP	NXTABK		/ Not valid , treat as break		/A044
/
/	These routines are part of the IOA loop but are here for space 	/A044

/ THIS DOES THE SPECIAL CONVERSION FOR ASCII CHARACTERS IN ALTERNATE
/ GRAPHICS ROM

ZCOM,	JMS	ARGVAL		/ GET ARGUMENT
	DCA	.+3
	JMS	OSTRG		/ OUTPUT IT
	16			/ SHIFT OUT
	0			/ CHARACTER
	4017			/ SHIFT IN
	JMP	IOALOP		/ DONE, RETURN TO MAIN LOOP

ECOM,	JMS	OSTRG		/ DO ERASE TO EOS FUNCTION
	ESC			/ ESC
	"[			/ [
	"J-200+4000		/ J (4000 MEANS END OF STRING)
	JMP	IOALOP		/ DONE, RETURN TO MAIN LOOP

/***************************************************************************
/end a047	end a047	end a047	end a047	end a047
/***************************************************************************

XVALUE,	0			/ temp used to indirect to value	/A044
	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/----------------------------------	
	PAGE


/A040 A040A040A040A040A040A040A040A040A040A040A040A040A040A040A040A040A040A040
/A040 FOLLOWING PAGE ALL INSERTED FOR THIS EDIT ( CODE HOLE BLASTER )
/************************************************************************
/    BLASTER  
/************************************************************************
/            NB the Blaster must reside here as it is defined in WPF1
/               and called from many modules
/************************************************************************

	PR3=	6236		/ panel request 3 ?***## check this
	PANSWAP=0		/ panel swap area address
	

/**********************************************************************
/  Patent Hole Blaster
/
/ 	Runs a subroutine found in panel memory 
/		1/ saves resident code to panel memory swap area
/		2/ load the subroutine into panel memory
/		3/ runs the subroutine with a JMS to first location
/		4/ returns the subroutine code to panel
/		5/ on return restores the resident code from swap area
/
/	Also load a table from memory (as a read only table)
/		1/ saves resident code
/		2/ load the table (or table section)
/		3/ return to calling prog
/	Restores user code over table
/		1/ returns the table to panel memory
/		2/ restore user code from swap area
/		3/ return to caller
/	
/	BLASTR is called from a BHOOK in each field
/		eg.	JMS	BHOOK		/ main program call to hook
/			TABLEENTRY		/ entry position in BLATBL
/			/ table entry is negative for a table restore function
/
/		BHOOK,	0			/ hook return address
/			DCA	BLACSV		/ save accumulator
/			RDF			/ read data field
/			TAD	CDFO		/ make a CDF inst.
/			DCA	BHKEXI		/ save for a return
/			CDFMYF			/ set tn-h/i	BLASTH,	BLASTR			/ blaster address
/		BLACSV,	0			/ acc save
/
/	TABLE ENTRY defines an entry position in the blaster table BLATBL
/		This table contains the information required to load
/		anurn interrupts off before
/			JMS I	BLASTH		/ Calling blaster
/			ISZ	BHOOK		/ skip return exit
/		BHKEXI,	0			/ CDF inst (position after JMS important)
/			JMP I	BHOOK		/ return
/		BLASTH,	BLASTR			/ blaster address
/		BLACSV,	0			/ acc save
/
/	TABLE ENTRY defines an entry position in the blaster table BLATBL
/		This table contains the information required to load
/		and run the panel subroutine
/		Each entry in the table contains
/		0/	Panel memory address of the subroutine
/		1/	User address (the run position of the subroutine
/		2/	Panel field position of the subroutine
/		3/	User field   (the run field of the subroutine
/		4/	Length of the subroutine/area to swap
/		5/	No execute flag (code=0 / tables=1)
/		6/
/		7/
/
/*************************************************************************
/	Here follows the master blaster code
/								SW
/*************************************************************************

BLASTR,	0			/ blaster return address
BLASTA,	DCA	BLATSV		/ save accumulator
	CDFMYF			/ set the field to this field
	TAD  	BLABSY		/ blaster busy ?
	SZA CLA			/ skip if not
	JMP	BLAWAIT		/ go wait until blaster ready
	ISZ	BLABSY		/ set busy flag
	TAD	BLASTR		/ get the return address
	DCA	BLAXOUT		/ put it somewhere else in case of another call
	ION			/ ok allow interrupts after next inst
	TAD	BLATSV		/ get the ac temp save
	DCA	BLACSV		/ save the ac

/ first blast the table entry into its position at BLATBL

	TAD	(5024)		/ get command
	DCA	BLARG1		/ set up function argument
	MQA			/ get the table entry
	SPA			/ test for reload of table area
	JMP	BLTBRL		/ negative ac so go set flag
BLACONT,R3L			/ table entry address=entry*8
	TAD	(BLSTBL		/ blaster table starts at 7000
	DCA	BLARG2		/ save in second argument
	TAD	(BLATBL)	/ get position of table
	DCA	BLARG3		/ put in  argument 3
	TAD	(-10)		/ length of table entry
	DCA	BLARG4		/ put in argument 4
	JMS	BLATRAN		/ get the table entry

/ SET UP THE RETURN FIELDS						/A048
	
	TAD	BLATBL+3 	/ get the run field for the subroutine
	R3L			/ Rotate to 00x0			/043
	DCA	BLAR3		/ save the field :Use BLAR3 as temp
	TAD	BLAR3		/ get the field back:Use BLAR3 as temp
	TAD	CIDF0		/ set up the CIF inst
	DCA	BLARUN		/ store in position befor subroutine execution

/ now set up the return CIF-CDF instruction
/ get the real old data field that the original prog was happily 
/ running in before it was so rudely interupted by a JMS to BHOOK

	TAD	BLATBL+7	/ get the field of blast hook from table
	TAD	CIDF0		/ make a CIF CDF instruction
	DCA	BLAXIT		/ store in position for exit
	
	TAD	BLATBL+1	/ address of call the subroutine
	DCA	BLABRA		/ save the call address to JMS to

	TAD	BLATBL+7	/ get the hooks field from table
	TAD	CDF0		/ make a CDF instruction
	DCA	BLAR1		/ store it
BLAR1,	0			/ and execute the CDF
	TAD	BLAXOUT		/ get the return address
	IAC			/ increment it to get the address of
	DCA	BLAR3		/ .. the CDF instruction AND save it
	TAD I	BLAR3		/ read the CDF instruction from BHOOK code
	CDFMNU			/ OK. now back to the menu field
	DCA	BLAR3		/ save the CDF in position for subr execution 
	TAD	BLAR3		/ get it back again
	DCA	BLARE3		/ save it for use on final exit

/ now swap out the user code to panel swap area

	TAD	BLTBFL		/ get table reload flag
	SZA CLA			/ skip if flag not set
	JMP	BLAR1A		/ go reload user over table
	TAD	BLATBL+6	/ get the panel swap address
	MQL			/ save it in the MQ
	TAD	(4050		/ get the function code & panel field
	TAD	BLATBL+3	/ get the address to swap
	JMS	BLAPAN		/ blast out to panel	

/ now load in the subroutine from panel memory

	TAD	BLATBL+0	/ get panel address	
	MQL			/ save for use in BLAPAN
	TAD	BLATBL+3	/ get user memory field
	R3L			/ Rotate to 00x0			/043
	TAD	(5000)		/ set top bit of function
	TAD	BLATBL+2	/ get panel field
	JMS	BLAPAN		/ blast subroutine in from panel

/ call the subroutine

	TAD	BLATBL+5	/ check whether we are dealing with a table
	SZA CLA			/ skip if not
	JMP	BLARE4		/ go return can't run a table

	TAD	BLACSV		/ get the ac value
BLARUN,	0			/ exit CIF instruction
BLAR3,	0			/ put a CDF instruction here
	JMS I	BLABRA		/ call the subroutine
	ISZ	BLAXOUT		/ case of a normal return force a skip

/ return here from subroutine

	CDFMYF			/ restore field to here
	DCA	BLACSV		/ save the ac

/ return code or table to panel in case modifiel location exist
	SKP			/	skip over this in normal case	/a048
BLAR1A,	ISZ	BLAXOUT		/ force a normal return			/a048
BLARE1,	TAD	BLATBL+0	/ get panel address
	MQL			/ save for use in BLAPAN
	TAD 	BLATBL+2	/ get the panel field
	R3L			/ Rotate to 00x0			/a043
	TAD	(4000		/ set up the write function
	TAD	BLATBL+3	/ get the users field
	JMS	BLAPAN		/ blast the subroutine back out

/ now get back the swapped out code

	TAD 	BLATBL+6	/ get panel swap address
	MQL			/ save in MQ
	TAD	BLATBL+3;	/ get the users field
	R3L			/ Rotate to 00x0			/a043
	TAD	(5005		/ get function code 5 & swap field 5
	JMS 	BLAPAN		/ get in from panel

/ now jump back  to user

BLARE2,									/m043
	IOF			/ just hold to clear the busy flag	
	DCA	BLTBFL		/ clear the table restore flag
	DCA	BLABSY		/ retset busy flag
BLAXIT,	0			/ CIF instruction
BLARE3,	0			/ CDF instruction
	TAD	BLACSV		/ get the ac before return
	ION			/ allow ints again
	JMP I	BLAXOUT		/ RETURN

BLARE4,	ISZ	BLAXOUT		/ Incrament for a normal return from BHOOK/a046
	JMP	BLARE2		/ Go exit				/a046

		
BLAXOUT,0			/ save return address
BLABRA,	0			/ blastr branch address
BLABSY,	0			/ blaster busy flag
BLACSV,	0			/ accumulator save
BLATSV,	0			/ accumulator temp save
BLTBFL,	0			/ blaster table restore flag
TEMPBL,	0			/ temp storage 

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/----------------------------------	
	PAGE
/A040 ABOVE PAGE ALL INSERTED FOR THIS EDIT ( CODE HOLE BLASTER )
/A040 A040A040A040A040A040A040A040A040A040A040A040A040A040A040A040A040A040A040

/A040 A040A040A040A040A040A040A040A040A040A040A040A040A040A040A040A040A040A040
/A040 FOLLOWING PAGE ALL INSERTED FOR THIS EDIT ( CODE HOLE BLASTER )

/ PANEL BLASTER ROUTINE	
	
BLAPAN,	0			/ RETURN ADDRESS
	DCA	BLARG1		/ put the function code in our arg list
	TAD 	BLARG1		/ get it again
	AND	(1000)		/ test for a 4 or 5 000 function code
	SZA CLA			/ skip if 4000
	JMP	BL1		/ was a 5000
/ have a 4000 function code - save data into panel memory
	MQA			/ get PANEL memory address
	DCA	BLARG3		/ put PANEL memory address
	TAD	BLATBL+1	/ get the user mem address from table
	DCA	BLARG2		/ panel memory address
	JMP	BL2		/ skip round the other bit
/ have a 5000 function code - load data from panel memory
BL1,	MQA			/ get the panel memory address
	DCA	BLARG2		/ put panel memory address
	TAD	BLATBL+1	/ get the user address from table
	DCA	BLARG3		/ put the user  memory

/ now get the word count
BL2,	TAD 	BLATBL+4	/ get the next arg - the count
	DCA	BLACNT		/ save in the count field

/ loop round sending only 40 words at a time to allow interrupts

BLOOP,	TAD	BLACNT		/ get the no. of words left
	TAD	(-40)		/ subtract 40
	SMA	CLA		/ if there will be some left
	JMP	BL4		/ do less than 40
	TAD	BLACNT		/ get count of words to send again
	CMA IAC	 		/ negate the count (if less than 40)
	SKP			/ skip over bit for more than 40
BL4,	TAD	(-40)		/ SET UP A COUNT OF 40
	DCA	BLARG4		/ put in arg list
	JMS	BLATRAN		/ could put this in inline code
	TAD	BLARG4		/ get the count sent
	TAD	BLACNT		/ get the count to send
	DCA	BLACNT		/ save the new count
	TAD	BLACNT		/ load the count
	SNA	CLA		/ skip if all done
	JMP I	BLAPAN		/ return
	TAD	BLARG2		/ increment  arg2 address
	TAD	(40)		/ by the size of the block sent
	DCA	BLARG2
	TAD	BLARG3		/ increment arg3 address
	TAD	(40)		/ by the size of the block sent
	DCA	BLARG3 
	JMP	BLOOP		/ send next block

/ Call the PANEL FUNCTION

BLATRAN,	
	0
	PR3
BLARG1,	0			/ Function code insert here
BLARG2,	0			/ user(4)/panel(5) memory start address
BLARG3,	0			/ panel(4)/user(5) memory start address
BLARG4,	0			/ number of words
BLARG5,	7777			/ end of argument list
	JMP I	BLATRAN		/ return
 
BLACNT,	0
BLATBL,	ZBLOCK 10		/ TABLE ENTRY OVERBLAST AREA

/ wait around until blaster not busy

BLAWAIT,			/ jump here from busy test
/d056	ACL			/ test table entry to see if restore over table
/d056	SPA CLA			/ ??
/d056	JMP	BLAW1		/ go do somthing with the busy flag

	TAD	BLATSV		/ restor ac from temp save
	ION			/ can allow interrupts again now
	CIFSYS			/ wait is in sys
	JSWAP			/ OPSYS wait/ swap tasks call

	JMP	BLASTA		/ go see if not busy now

/d056BLAW1,	DCA	BLABSY		/ must be my busy so I'll clear it
/d056	JMP	BLASTA		/ go try again

BLTBRL,	DCA	BLTBFL		/ set restoring table area flag
	TAD	BLTBFL		/ get it back again
	CIA			/ get the table entry proper
	JMP	BLACONT		/ continue after jump

/***************************************************************************
/ BHOOK  Blaster hook to make this easily callable from this field
/***************************************************************************

BHOOK,	0			/ jms return address
	DCA	BLACS1		/ save accumulator
	RDF			/ read the data field
	TAD	CDF0		/ make a data field return instruction
	DCA	BHKEXI		/ save for a return
	CDFMYF			/ make sure we are in this field
	TAD I	BHOOK		/ get the table entry
	MQL			/ push into MQ
	TAD	BLACS1		/ get the acc back
	ISZ	BHOOK		/ increment the return over arg
	IOF			/ just hold interupts a few instructions
	JMS	BLASTR		/ call the blaster
	ISZ	BHOOK		/ allow for a skip return
BHKEXI,	0			/ make the CDF here (position important)
	JMP I	BHOOK		/ RETURN

BLACS1,	0			/ Accumulator save 

/A040 ABOVE PAGE ALL INSERTED FOR THIS EDIT ( CODE HOLE BLASTER )
/A040 A040A040A040A040A040A040A040A040A040A040A040A040A040A040A040A040A040A040

/********************************************************************
/ some data areas use bye TIME etc
/********************************************************************

DATEST,	ZBLOCK	27		/ ASCII list of time and date chars

	DECIMAL
TENS,	-1000
	-100
	-10
	-1
	0
	OCTAL


	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/----------------------------------	
PAGE									/A028

/ FOLLOWING PAGE OF CHUCKLES IS MOVED INTO NAT. LANG. RES. AREA FOR	/A028
/ 100 UDK DEVELOPMENT
/ CHKUDK

/ UDK CODE; CHKUDK, CHUDK0, CHRDU0

		/ ENTRY POINTS FOR UDK DISK ACCESS, CHKUDK, CHUDK0
		/ CALLED FROM U1XLAT IN WPSYS
		/ ENTRY POINTS AT PERMANENT LOCATION
		/ SO CHANGE CAN BE MADE IN WPF1

CHRUDX,		/ DISK ACCESS ROUTINE, CALLED FROM WPSYS AND THIS MODULE
	0
	JMP CHRDU0+1

CHKUXX,		/ CHECK KEYSTROKE FROM UDK
	0
	JMP CHKUDK+1

CHKUYY,		/ CHECK KEYSTROKE FROM KEYBOARD
	0
	JMP CHUDK0+1

CHKUDK,
	XX			/ ENTRY/EXIT SET UP BELOW
	CDFMNU
	DCA CHKUDA		/ SAVE AC

	TAD CHKUXX		/ SAVE RETURN ADDRESS
	DCA CHKUDK

	TAD I (UDKINH		/ INHIBIT FLAG
	SZA CLA
	JMS CHKUD9		/ FLAG SET, RETURN WITH INPUT IN AC

	TAD (-EDUDK0		/ IS INPUT A UDK?
	TAD CHKUDA
	SPA
	JMS CHKUD9		/ NOT A UDK; RETURN CALL+1 WITH CHAR IN AC
	TAD (-CUUDNM
	SMA CLA
	JMS CHKUD9		/ NOT A UDK

				/ CHARACTER IS UDK FROM A UDK. PUT UDK
				/ ADDRESS ON STACK AND SET STACK POINTER.
	CDFSYS
	TAD  I U1STPY
	TAD (-12
	SMA CLA			/ IS STACK FULL?
	JMP CHKUD8		/ YES

	ISZ I U1STPY		/ BUMP POINTER TO STACK FOR NEXT ENTRY

	TAD (DLUDKS		/ READ UDK DIRECTORY
	CDFMNU
	JMS CHRUDX


	TAD CHKUDA		/ CONVERT KEYSTROKE TO UDK NUMBER
	TAD (-EDUDK0
	TAD (CUDBUF		/ ADD BUFFER START
	DCA T1			/ NOW HAVE ADDRESS OF ADDRESS OF UDK

	CDFSYS
	TAD I U1STPY		/ SAVE CONTENTS OF STACK POINTER
	CDFMNU
	TAD (U1STCK-1
	DCA CHKSTP		/ FOR DOUBLE INDIRECT
	TAD I T1		/ GET BLOCK/WORD OF UDK
	CDFSYS
	DCA I CHKSTP		/ PUT UDK ADDRESS ON STACK (DOUBLE INDIR)

	TAD I CHKSTP		/ READ THE BLOCK
	CDFMNU
	AND (7400
	BSW
	CLL RTR			/ NOW HAVE BLOCK IN BITS 9,10,11
	TAD (DLUDKS+1		/ PLUS BASE
	JMS CHRUDX

	JMS CHKUD7		/ CALL+2

CHKUD8,				/ STACK IS FULL; CLEAR STACK ENTRY
/D032 				/ THAT GOT THIS CHARACTER AND DECREMENT
/D032 				/ STACK POINTER
/D032 	TAD I U1STPY		/ SAVE CONTENTS OF STACK POINTER
/D032 	DCA CHKSTP		/ FOR DOUBLE INDIRECT
/D032 	DCA I CHKSTP		/ THE DOUBLE INDIRECT
/D032 	CMA
/D032 	TAD I U1STPY
	DCA I U1STPY
	JMS CHKUD7

CHKUD7,				/ CALL+2
	0
	ISZ CHKUDK
	JMP CHKUD6

CHKUD9,				/ CALL+1, AC CONTAINS CHARACTER
	0
	CLA
	TAD CHKUDA
CHKUD6,
	NOP
CHKUD5,
	CDISYS
	JMP I CHKUDK

CHKUDA,	0
CHKSTP,	0
U1STPY,	U1STPT



CHUD10,			/ GET KEYSTROKE FROM TERMINAL, TEST FOR HALT
	0
	CLA
	CDISYS		/ USING FIELD 0 ROUTINE
	JMS I XTTYIN
	DCA CHUDKC
	CDFSYS
	TAD I U1HLTX
	CDFMNU
	SZA CLA
	JMP CHUDK7		/ FOUND GOLD:HALT, IGNORE UDK
	TAD CHUDKC
	TAD (-EDNWLN		/ TEST FOR RETURN
	SNA
	JMP CHUD12		/ FOUND RETURN; C+1
	TAD (EDNWLN-EDRBCH	/ TEST FOR RUBOUT
	SNA CLA
	JMP CHUD11		/ FOUND RUBOUT; C+2
	JMS CHUD20		/ TEST FOR DIGIT
/D034	JMP CHUD10+1		/ NOT A LEGAL KEYSTROKE, TRY AGAIN
	JMP CHUDK3		/ ILLEGAL KEYSTR., RING BELL AND AS G-HLT /A034
	TAD CHUDKC		/ HAVE A BINARY NUMBER; C+3
	ISZ CHUD10
CHUD11,	ISZ CHUD10
CHUD12,	JMP I CHUD10

CHUDKC,	0
U1HLTX,	U1HLTF
XTTYIN,	CTTYIN			/ ADDRESS DEFINED IN WPF1

CHUD20,				/ TEST KEYSTROKE FOR DIGIT
	0
	TAD CHUDKC
	AND P177
	TAD (-60
	DCA CHUDKC		/ SAVE BINARY NUMBER
	TAD CHUDKC
	SPA
	JMP CHUD21		/ NOT A DIGIT
	TAD (-11
	SMA SZA
	JMP CHUD21		/ NOT A DIGIT
	ISZ CHUD20
CHUD21,
	CLA
	JMP I CHUD20

/
/	Moved here on edit 44 for space reasons
/
INAINS,	TEXT '!X^P^A!L!Y'	/ CONTROL STRING FOR TIME AND DATE OUTPUT


	PAGE

/***************************************************************************
/*		W	A	R	N	I	N	G	   *
/*									   *
/*			THIS AREA BLASTED BY CVDBN			   *
/***************************************************************************
/
/ This address is defined in WPF1 and should not be moved, as will cause error

CVDHOL=.


	/ KEYBOARD INPUT FROM U1XLAT IN FIELD 0
CHUDK0,
	XX

	CDFMNU
	DCA CHUDKA		/ SAVE TRANSLATED INPUT

	TAD CHKUYY		/ SAVE RETURN ADDRESS
	DCA CHUDK0

	TAD I (UDKINH		/ TEST INHIBIT FLAG
	SZA CLA
	JMP CHUDK9		/ INHIBIT SET, GET CHARACTER AND EXIT

	TAD CHUDKA		/ WAS INPUT A GOLD U?
/D029	TAD (-EDGLDU
	TAD (-EDUDKY		/ WAS INPUT UDK KEY (F14)		/A029
	SNA CLA
	JMP CHUDK1		/ YES, LOOK FOR NUMBERS, RETURN, GOLD HALT

	TAD CHUDKA
	TAD (-EDUDK9
	SMA SZA
	JMP CHUDK9		/ NOT A UDK
	TAD (11
	SPA CLA
	JMP CHUDK9		/ NOT A UDK

	TAD CHUDKA
	TAD (-EDUDK0		/ MAKES THE KEYSTROKE A BINARY NUMBER
	DCA CHDIG2		/ SAVE THE BINARY NUMBER
	DCA CHDIG1		/ CLEAR THE HIGH ORDER DIGIT FOR LATER
	JMP CHUDK8


CHUDK1,
	CLA
	DCA CHDIG1		/ CLEAR DIGIT HOLDERS
	DCA CHDIG2

	JMS CHUD10		/ GET INPUT AND TEST
	JMP CHUDK3		/ RETURN SAME AS HALT HERE		/C034
	JMP CHUDK3		/ RUBOUT SAME AS HALT HERE		/C034
	DCA CHDIG1		/ SAVE THE DIGIT

CHUDK2,
	DCA CHDIG2		/ FOUND RUBOUT AS THIRD KEYSTROKE,
				/ CLEAR SECOND DIGIT

/D034	CHUDK3,
	JMS CHUD10		/ LOOK FOR SECOND KEYSTROKE
	JMP CHUDK5		/ RETURN AFTER ONE DIGIT		/C028
	JMP CHUDK1		/ RUBOUT AS SECOND KEYSTROKE,
				/ ERASES FIRST DIGIT
	DCA CHDIG2		/ SECOND KEYSTROKE IS A DIGIT

CHUDK4,
	JMS CHUD10		/ LOOK FOR THIRD KKEYSTROKE
	JMP CHUDK8		/ FOUND RETURN
	JMP CHUDK2		/ FOUND RUBOUT, ERASE SECOND DIGIT
/D034	CLA			/ FOUND DIGIT, NOT LEGAL HERE
/D034	JMP CHUDK4		/ LOOK AGAIN
	JMP CHUDK3		/ DIGIT NOT LEGAL, BELL AND G-HLT EXIT /A034


CHUDK9,				/ INHIBIT OR NOT UDK; C+1; AC=CHAR
	CLA
	TAD CHUDKA
	JMP CHUDEX		/ EXIT WITH INPUT IN AC

CHUDK3,				/ ILLEGAL KEYSTROKE			/A034
	CLA
	TAD (7			/ BELL
	JMS OUTCHR		/ USE EXISTING ROUTINE
CHUDK7,				/ HALT SET, IGNORE UDK; C+3; AC=0
	ISZ CHUDK0
CHUDK6,				/ EXIT FOR LEGAL UDK FOUND; C+2; AC=0
	ISZ CHUDK0
CHUDEX,
	CDISYS
	JMP I CHUDK0
	
CHUDK8,				/ UDK NUMBER IN CHDIG1, CHDIG2. NOW WE HAVE TO
				/ INSERT UDK ADDRESS INTO STACK AND SET
				/ STACK POINTER; THEN "GETUDK" CAN ACCESS
				/ STACK POINTER AND STACK.
	


	TAD CHDIG1		/ COMPUTE UDK NUMBER FROM INPUT
	CLL RTL			/ FIRST DIGIT TIMES TEN
	RAL
	TAD CHDIG1
CHUDK5,	TAD CHDIG1		/ ENTRY IF FIRST DIGIT IS ONLY ONE	/C028
	TAD CHDIG2		/ PLUS SECOND DIGIT; NO EFFECT AT CHUDK5/C028

	TAD CHRDUB		/ + START OF BUFFER
	DCA T1			/ = CORE ADDRESS IN DIRECTORY

	TAD (DLUDKS		/ READ DIRECTORY			/M028
	JMS CHRUDX							/M028

	TAD I T1		/ GET ADDRESS OF UDK FROM DIRECTORY
	SNA			/ IS A UDK DEFINED?
	JMP CHUDK7		/ NO, NOTHING TO PUT ON STACK

	CDFSYS
	DCA I U1STCX		/ PUT THE ADDRESS OF THIS UDK ON STACK
	IAC			/ SET STACK POINTER TO FIRST LOC. IN STACK
	DCA I U1STPX

	TAD I U1STCX		/ SET UP TO READ FIRST BLOCK OF UDK
	AND (7400		/ KEEP BLOCK NUMBER
	BSW
	CLL RTR
	TAD (DLUDKS+1
	CDFMNU
	JMS CHRUDX
	JMP CHUDK6		/ AND EXIT WITH UDK IN CORE

CHUDKA,	0
CHDIG1,	0
CHDIG2,	0
U1STCX,	U1STCK
U1STPX,	U1STPT



CHRDU0,		/ READ UDK DIRECTORY, UDK BLOCKS
	0	/ ENTER WITH BLOCK TO READ IN AC
	DCA QUQBLK+RXQBLK		/ BLOCK

	RDF				/ CROSS FIELD CALLABLE, SET RETURN
	TAD (CIF CDF
	DCA CHRDU9

	CDFMNU
	TAD CHRUDX			/ SAVE RETURN ADDRESS
	DCA CHRDU0

	DCA QUQBLK+RXQDRV		/ DRIVE

	TAD CHRDUA
	DCA QUQBLK+RXQFNC		/ FUNCTION

	TAD CHRDUB
	DCA QUQBLK+RXQBAD		/ BUFFER ADDRESS

	TAD CHRDUC
	DCA QUQBLK+RXQBFD		/ BUFFER FIELD

	JMS QURX			/ DISK OPERATION
CHRDU9,
	0				/ RETURN FIELD
	CLA
	JMP I CHRDU0

CHRDUA,	RXERD
CHRDUB,	CUDBUF
CHRDUC,	CDFMNU

/****************************************************************************
/ MENU		Moved here to create space				/a051
/****************************************************************************

MENU,	XX			/ ENTRY POINT FOR CALLING MENU DISPLAYS
	TAD I	MENU		/ GET BLOCK TO READ
	ISZ	MENU		/ BUMP RETURN ADDRESS
	DCA	T1		/ SAVE FOR A SECOND

	JMS	GETCID		/ GET THE CALLER'S DATA FIELD INST.	/A023
	DCA	MENUX		/ SAVE FOR RETURN
	DCA	T2		/ INIT PC TO ZERO
	TAD	T1		/ GET MENU BLOCK TO READ
	JMP	MUCOVA		/ GET OVERLAY IN

MENUX,	HLT			/ PATCHED TO CIF CDF FIELD
	JMP I	MENU		/ RETURN

/***************************************************************************
/****	    NATURAL LANGUAGE TRANSLATION TABLES AND ROUTINES		****
/***************************************************************************

/SPACE TEMPORARILY BORROWED FOR 100 UDK INTEGRATION			/A028

/D028	* PSBUF+1000		/ RESERVE SPACE FOR NATURAL LANGUAGE	/A016

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE	/A016
/--------------------
	PAGE


/***************************************************************************
/***************************************************************************
/*****		D A N G E R  -  D O   N O T   M O V E                  *****
/*****								       *****
/*****   C O D E   I N T O   O R   O U T   O F   T H I S   A R E A     *****
/*****								       *****
/*****        SWAP AREA IN CONSTANT USE BY OTHER MODULES	       *****
/***************************************************************************
/***************************************************************************

/***************************************************************************
/****	 TRANSFER VECTOR ENTRY POINTS FOR EDITOR SWAP AREA ROUTINES	****
/***************************************************************************

	SWPBEG=.		/ GENERATE ERROR IF THIS CODE IS MOVED	/A016

CALLN1,	XX			/ ENTRY POINT FOR ROUTINE NUMBER 1
	JMS	CALSUB		/ SET UP RETURN ADDRESS AND RETURN FIELD
	NOP			/ PLACE FOR TRANSFER TO SPECIAL CODE
	JMP	CALXIT		/ GO TO RETURN TO CALLER CODE

CALLN2,	XX			/ ENTRY POINT FOR ROUTINE NUMBER 2
	JMS	CALSUB		/ SET UP RETURN ADDRESS AND RETURN FIELD
	NOP			/ PLACE FOR TRANSFER TO SPECIAL CODE
	JMP	CALXIT		/ GO TO RETURN TO CALLER CODE

CALLN3,	XX			/ ENTRY POINT FOR ROUTINE NUMBER 3
	JMS	CALSUB		/ SET UP RETURN ADDRESS AND RETURN FIELD
	NOP			/ PLACE FOR TRANSFER TO SPECIAL CODE
	JMP	CALXIT		/ GO TO RETURN TO CALLER CODE

CALLN4,	XX			/ ENTRY POINT FOR ROUTINE NUMBER 4
	JMS	CALSUB		/ SET UP RETURN ADDRESS AND RETURN FIELD
	NOP			/ PLACE FOR TRANSFER TO SPECIAL CODE
	JMP	CALXIT		/ GO TO RETURN TO CALLER CODE

CALLN5,	XX			/ ENTRY POINT FOR ROUTINE NUMBER 5
	JMS	CALSUB		/ SET UP RETURN ADDRESS AND RETURN FIELD
	NOP			/ PLACE FOR TRANSFER TO SPECIAL CODE
	JMP	CALXIT		/ GO TO RETURN TO CALLER CODE

CALLN6,	XX			/ ENTRY POINT FOR ROUTINE NUMBER 6
	JMS	CALSUB		/ SET UP RETURN ADDRESS AND RETURN FIELD
	NOP			/ PLACE FOR TRANSFER TO SPECIAL CODE
	JMP	CALXIT		/ GO TO RETURN TO CALLER CODE

CALLN7,	XX			/ ENTRY POINT FOR ROUTINE NUMBER 7
	JMS	CALSUB		/ SET UP RETURN ADDRESS AND RETURN FIELD
	NOP			/ PLACE FOR TRANSFER TO SPECIAL CODE
	JMP	CALXIT		/ GO TO RETURN TO CALLER CODE

CALLN8,	XX			/ ENTRY POINT FOR ROUTINE NUMBER 8
	JMS	CALSUB		/ SET UP RETURN ADDRESS AND RETURN FIELD
	NOP			/ PLACE FOR TRANSFER TO SPECIAL CODE
	JMP	CALXIT		/ GO TO RETURN TO CALLER CODE

CALLN9,	XX			/ ENTRY POINT FOR ROUTINE NUMBER 9
	JMS	CALSUB		/ SET UP RETURN ADDRESS AND RETURN FIELD
	NOP			/ PLACE FOR TRANSFER TO SPECIAL CODE
	JMP	CALXIT		/ GO TO RETURN TO CALLER CODE


/***************************************************************************
/****	     SET UP RETURN FIELD AND ADDRESS FOR CALLN# ROUTINES	****
/***************************************************************************

CALSUB,	XX			/ ROUTINE TO SET UP RETURN FIELD AND ADDRESS
	DCA	T1		/ SAVE CONTENTS OF ACCUMULATOR

	JMS	GETCID		/ GET THE CALLER'S DATA FIELD INST.	/A023
	DCA	CALXIT		/ STORE FOR RETURN TO CALLER

	AC7776			/ SET UP TO SUBTRACT A VALUE OF TWO
	TAD	CALSUB		/ MAKE POINTER TO VECTOR ENTRY POINT
	DCA	T2		/ STORE FOR USE IN AN INDIRECT LOOKUP
	TAD I	T2		/ PICK UP CALLERS RETURN ADDRESS
	DCA	CALRTN		/ STORE ADDRESS FOR LATER RETURN TO CALLER

	TAD	T1		/ PICK UP SAVED CONTENTS OF ACCUMULATOR
	JMP I	CALSUB		/ GO TRANSFER TO SPECIALIZED ROUTINES

CALXIT,	XX			/ LOCATION FOR CDF-CIF INSTRUCTION TO CALLER
	JMP I	CALRTN		/ RETURN BACK TO CALLER
CALRTN,	XX			/ LOCATION FOR CALLERS RETURN ADDRESS


/***************************************************************************
/****			USER JOB START UP POINT				****
/***************************************************************************

WPCMND,	AC7777			/ SET AC TO MINUS ONE
	TAD	(MUBUF+MNUSRA)	/ CONBINE WITH ADDRESS OF USER AREA
	DCA	X0		/ SET UP AUTO-INDEX REG TO ZERO AREA
	TAD	(-400)		/ GET NEGATIVE OF LOCATIONS TO CLEAR
	DCA	T1		/ SET UP LOOP COUNTER
WPLOOP,	DCA I	X0		/ ZERO A LOCATION IN THE USER AREA
	ISZ	T1		/ HAVE WE REACHED THE END OF THE AREA ?
	JMP	WPLOOP		/ NO, GO DO IT AGAIN

	TAD	FNAMSP		/ YES, PICK UP ADDRESS OF FILE NAME BUFFER
	DCA	MUBUF+MNFNAM	/ STORE ADDRESS IN USER AREA
	TAD	(-STRLEN+1)	/ GET LENGTH OF INPUT BUFFER
	DCA	MUBUF+MNILEN	/ STORE LENGTH IN USER AREA
	TAD	(-17)		/ GET LENGTH OF ARGUMENT BUFFER
	DCA	MUBUF+MNALEN	/ STORE LENGTH IN USER AREA

	CDFSYS			/ CHANGE TO SYSTEM FIELD TO PICK UP VALUES
	AC7777			/ -1 TO CONVERT TO ACTUAL DRIVE NOS.
	TAD I	(RXONLN)
	MQL			/ SAVE # OF DRIVES IN MQ. CLEAR AC.
	TAD I	(RXTYPE)	/ GET SYSTEM DRIVE TYPE.
	CDFMYF
	DCA	MUBUF+MNOPTN	/ SET BIT 11 OF MNOPTN TO 1 FOR RX02
				/     OR 0 FOR RX01. INIT REST TO 0.
	MQA			/ GET SAVED # OF DRIVES.
	DCA	MUBUF+MNMXDR
	CDFSYS			/ GET STARTUP TYPE.
	TAD I	(STTYPE)	/  ...
	CDFMYF			/    ....
	SZA CLA			/ SKIP IF COLD STARTUP.
	IAC			/ SELECT WARM STARTUP TYPE.
	DCA	MUBUF+MNTMP1	/ STORE STARTUP TYPE FOR MENU.
	JMS	MENU		/ CALL START-UP DISPLAY
	DLMFN1			/ DISK ADDRESS OF START-UP MENU

CMNDLP,	CLA
	TAD	MUBUF+MNONUM	/ GET OVERLAY NUMBER
	DCA	CMNDOV		/ STORE IN CALL TO OLAY
	JMS	OLAY		/ CALL OVERLAY ROUTINE
CMNDOV,	0			/ OVERLAY NUMBER GOES HERE
	CLA
	TAD	MUBUF+MNOADR	/ GET ADDR TO START AT
	DCA	CMNDOV		/ SAVE
	RDF
	TAD	MUBUF+MNOFLD	/ GET CIF FIELD
	DCA	CMNDFD		/ STORE INLINE FOR EXECUTION
CMNDFD,	HLT			/ CHANGE TO CORRECT INSTRUCTION FIELD
	JMS I	CMNDOV		/ GO THERE AT CORRECT ADDR ON CORRECT FIELD

	SKP CLA			/ RETURN TO MAIN MENU
	JMP	CMNDLP		/ OR CHAIN TO NEXT OVERLAY

	JMS	CLRDSK		/ CLEAR MEMORY OF DISKETTE		/A010
	JMS	MENU		/ CALL NORMAL MAIN MENU
	DLMMM1

	JMP	CMNDLP		/ TRANSFER TO NEXT OVERLAY

CLRDSK,	XX			/ CLEAR MEMORY OF DISKETTE		/A010
	TAD	(RXERT)		/ COMMAND TO RESET THE HANDLER		/A010
	DCA	QUQBLK+RXQFNC 	/ STORE IN QUEUE BLOCK			/A010
	JMS	QURX 		/ EXECUTE THE COMMAND			/A010
	CLA			/ IGNORE RETURN CODE			/A010
	JMP I	CLRDSK		/ RETURN TO CALLER			/A010


	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/--------------------
	PAGE

/***************************************************************************
/***************************************************************************
/*****		D A N G E R  -  D O   N O T   M O V E                  *****
/*****								       *****
/*****   C O D E   I N T O   O R   O U T   O F   T H I S   A R E A     *****
/*****								       *****
/*****        SWAP AREA IN CONSTANT USE BY OTHER MODULES	       *****
/***************************************************************************
/***************************************************************************

/***************************************************************************
/****			OLAY - OVERLAY PACKAGE				****
/***************************************************************************
/
/	THIS ROUTINE IS CALLED AS FOLLOWS:
/
/		CIFMNU
/		JMS I OLAYCL
/		OVERLAY NUMBER
/		RETURN POINT
/
/	OVERLAY NUMBER MUST BE IN OVERLAY TABLE (WHICH IS PART OF THIS ROUTINE)

OLAY,	XX
	CLA			/ PICK UP ARG
	TAD I	OLAY		/ ...
	ISZ	OLAY
	TAD	(OLNTAB)	/ GET ADDR OF TABLE
	DCA	OLLIST		/ SAVE AS LIST OF OVERLAYS POINTER

	JMS	GETCID		/ GET THE CALLER'S DATA FIELD INST.	/A023
	DCA	OLDON		/ SAVE AT RETURN POINT

	DCA	QUQBLK+RXQDRV	/ PATCH QUEUE BLOCK TO USE SYSTEM DRIVE
	TAD	(RXERD)		/ DO A READ
	DCA	QUQBLK+RXQFNC

	TAD I	OLLIST		/ GET ADDR IT POINTS TO
	DCA	OLLIST

OLPBLK,	TAD I	OLLIST		/ GET POINTER TO NEXT OVERLAY BLOCK
	SNA			/ ZERO MEANS DONE
	JMP	OLDON		/ SO JUST RETURN
	DCA	OLBLK		/ OTHERWISE SAVE FOR INDIRECTION THROUGH

	TAD I	OLBLK		/ GET FIRST WORD - THE ADDR OF LOCK WORD
	SNA			/ THIS HAS ADDR OF OVERLAY IN THERE
	JMP	OLRD		/ ZERO MEANS MUST READ
	DCA	OLLOCK		/ OTHERWISE SAVE FOR INDIRECTION AND TEST
	TAD I	OLLOCK		/ GET THE WORD
	CIA			/ AND COMPARE TO ADDR OF OVERLAY BLOCK
	TAD	OLBLK
	SNA CLA		/ EQUAL MEANS ...
	JMP	OLNXT		/ THAT WE DON'T HAVE TO READ ANYTHING
	TAD	OLBLK		/ PUT OUR ADDR IN THERE FOR NEXT TIME
	DCA I	OLLOCK		/ ...

OLRD,	ISZ	OLBLK		/ GET NEXT WORD IN BLOCK - DSK BLOCK NUMBER
	TAD I	OLBLK
	SNA			/ ZERO MEANS DON'T READ
	JMP	OLNXT		/ ALLOWS YOU TO CLOBBER THE LOCK WORD ON DATA
	DCA	QUQBLK+RXQBLK	/ SAVE BLK NUMBER IN QUEUE BLOCK
	ISZ	OLBLK		/ GET NEXT WORD - ADDR OF WHERE TO READ IT
	TAD I	OLBLK		/ AND PUT IT IN QUEUE BLOCK
	DCA	QUQBLK+RXQBAD	/ AT THE APPROPRIATE PLACE
	ISZ	OLBLK		/ NEXT WORD IS RELATIVE FIELD
	RDF			/ GET OUT DATA FIELD (ALWAYS 2 IN 278)
	TAD I	OLBLK		/ ADD RELATIVE (USER) FIELD #
	AND	(70)		/ ISOLATE PROPER BITS
	TAD	CDF0		/ MAKE A CDF INSTRUCTION OUT OF IT
	DCA	QUQBLK+RXQBFD	/ AND PUT INTO PLACE
	TAD I	OLBLK
	AND	P7700
	BSW
	CIA
	SNA
	JMP	OLRD1		/ NON-ZERO MEANS DO THE READS
	DCA	OLLOCK		/ SAVE AS COUNT

OLRLP,	JMS	QURX		/ READ NEXT BLOCK FROM DSK
	CLA
	ISZ	QUQBLK+RXQBLK	/ INCR BLOCK NUMBER
	TAD	(400)		/ AND INCREASE ADDR
	TAD	QUQBLK+RXQBAD
	DCA	QUQBLK+RXQBAD
	ISZ	OLLOCK		/ INCR COUNT
	JMP	OLRLP		/ DO NEXT BLOCK

OLRD1,	TAD I	OLBLK
	RAR
	SNL CLA
	JMP	OLNXT
	TAD	QUQBLK+RXQBFD	/ GET THE FIELD CHANGE WORD
	DCA	OLPATI		/ AND PATCH THE CDF INSTRUCTION
	TAD	(20)		/ GET ADDR
	DCA	OLBLK		/ AND INIT POINTER
	TAD	(-60)		/ AND INIT COUNT
	DCA	OLLOCK

OLPATL,	TAD I	OLBLK

OLPATI,	HLT			/ CHANGE TO TARGET FIELD
	DCA I	OLBLK		/ AND DO THE STORE
	CDFMYF			/ CHANGE BACK
	ISZ	OLBLK		/ INCR POINTER
	ISZ	OLLOCK		/ INCR COUNTER
	JMP	OLPATL		/ AND LOOP

OLNXT,	ISZ	OLLIST		/ GET NEXT OVERLAY DESCRIPTOR BLOCK
	JMP	OLPBLK

OLDON,	HLT			/ CIF CDF RETURN-FIELD
	JMP I	OLAY		/ RETURN

OLLIST,	0
OLBLK,	0
OLLOCK,	0

/***************************************************************************
/***************************************************************************
/*****		D A N G E R  -  D O   N O T   M O V E                  *****
/*****								       *****
/*****   C O D E   I N T O   O R   O U T   O F   T H I S   A R E A     *****
/*****								       *****
/*****        SWAP AREA IN CONSTANT USE BY OTHER MODULES	       *****
/***************************************************************************
/***************************************************************************

/***************************************************************************
/****		    LOCATION FOR MENU COMMAND "CLRBIT"			****
/***************************************************************************

/ FORMAT IS  CLRBIT; MASK VALUE; DESTINATION
/	BITS SET IN THE MASK VALUE WILL BE RESET IN THE DESTINATION

MUCCBT,	JMS	MUPCWD		/ GET VALUE OF BITS TO CLEAR
	CMA			/ MAKE ONE'S COMPLEMENT FOR MASK
	DCA	T1		/ SAVE MASK VALUE
	JMS	MULDPC		/ LOAD WORD PC POINTS TO
	AND	T1		/ MASK BITS WITH SAVED MASK VALUE
	JMP	MUSTO1		/ GO STORE RESULTS AND CONTINUE NEXT INST.

/***************************************************************************
/****		    LOCATION FOR MENU COMMAND "SETBIT"			****
/***************************************************************************

/ FORMAT IS  SETBIT; BIT VALUE; DESTINATION
/	BITS SET IN THE BIT VALUE WILL BE SET IN THE DESTINATION

MUCSBT,	JMS	MUPCWD		/ GET VALUE OF BITS TO SET
	MQL			/ SAVE BIT VALUE
	JMS	MULDPC		/ LOAD WORD PC POINTS TO
	MQA			/ COMBINE BITS WITH MEMORY VALUE
	JMP	MUSTO1		/ GO STORE RESULTS AND CONTINUE NEXT INST.

/***************************************************************************
/****		    LOCATION FOR MENU COMMAND "SHFBIT"			****
/***************************************************************************

/ FORMAT IS  SHFBIT; SHIFT VALUE (+ RIGHT, - LEFT); DESTINATION
/	BITS IN THE DESTINATION VALUE WILL BE SHIFTED RIGHT OR LEFT
/	A POSITIVE VALUE WILL SHIFT BITS TO THE RIGHT
/	A NEGATIVE VALUE WILL SHIFT BITS TO THE LEFT
/	MAX VALUES ARE -12 TO +12, ANYTHING ELSE RESULTS IN A ZERO VALUE

MUCSHF,	JMS	MUPCWD		/ GET SHIFT VALUE
	SMA			/ CHECK FOR A LEFT SHIFT
	JMP	SHFSET		/ NO, IT'S A SHIFT RIGHT
	DCA	T1		/ COUNT IS IN CORRECT FORM, USE IT AS IS
	JMS	MULDPC		/ LOAD WORD THAT PC POINTS TO
SHFLFT,	CLL RAL			/ CLEAR LINK AND ROTATE TO THE LEFT
	ISZ	T1		/ INCREMENT THE COUNT
	JMP	SHFLFT		/ NOT DONE, GO AGAIN
	JMP	MUSTO1		/ GO STORE RESULTS AND CONTINUE NEXT INST.

SHFSET,	CIA			/ MAKE COUNT NEGATIVE
	DCA	T1		/ STORE IN COUNTER
	JMS	MULDPC		/ LOAD WORD THAT PC POINTS TO
SHFRGT,	CLL RAR			/ CLEAR LINK AND ROTATE TO THE RIGHT
	ISZ	T1		/ INCREMENT THE COUNT
	JMP	SHFRGT		/ NOT DONE, GO AGAIN
	JMP	MUSTO1		/ GO STORE RESULTS AND CONTINUE NEXT INST.

MULDPC,	XX			/ LOAD CONTENTS OF WORD THAT PC POINTS TO
	JMS	MUPPCW		/ PICK UP ADDRESS THAT PC POINTS TO
	TAD	MUBASE		/ ADD IN MENU BUFFER OFFSET
	DCA	T2		/ STORE FOR INDIRECT
	TAD I	T2		/ PICK UP THE CONTENTS OF LOCATION
	JMP I	MULDPC		/ RETURN TO CALLER

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/--------------------
	PAGE

/***************************************************************************
/***************************************************************************
/*****		D A N G E R  -  D O   N O T   M O V E                  *****
/*****								       *****
/*****   C O D E   I N T O   O R   O U T   O F   T H I S   A R E A     *****
/*****								       *****
/*****        SWAP AREA IN CONSTANT USE BY OTHER MODULES	       *****
/***************************************************************************
/***************************************************************************

/***************************************************************************
/****			OVERLAY TABLE FOR OLAY ROUTINE			****
/***************************************************************************

OLNTAB,	OL0			/ NULL OVERLAY
	OL1			/ COMMAND UTILTIES
	OL2			/ EDITOR
	OL3			/ XBAR
	OL4			/ COPY COMMAND
	OL5			/ DOCUMENT TRANSFER
	OL6			/ LIST PROCESSING 1
	OL7			/ LIST PROCESSING 2
	OL10			/ EDITOR MATH
	OL11			/ LIST PROCESSING 3
	OL12			/ COMMAND UTILITY II
	OL13			/ COPY DOCUMENT UTILTITY
	OL14			/ VERIFY COMMAND
	OL15			/ USER DEFINED KEYS
	OL16			/ INDEX
	OL17			/ DUMMY TO ZAP BUFFLD LOCK WORD
	OL20			/ COMMAND UTILITY III
	OL21			/ Spelling Checker
	OL22			/ WT78 TD COMMAND
	OL23			/ IBM MAG CARD I EMULATOR IN DM I
				/ "SETUP" terminal characteristics in DM II
	OL24			/ COMMAND UTILITY VI
	OL25			/ FEATURE UNBUNDLING OPERATIONS
	OL26			/ SORT - START-UP, PARSER, & SELECTOR
	OL27			/ DUMMY TO ZAP EDIT FIELD LOCK WORD

	OL30			/ Logon utility
	IFDEF	WINNIE	<
	OL31			/ WINCHESTER UTILITY OVERLAY		/A003
			>	/ END IFDEF WINNIE

	OL32			/ CONVERT STARTUP OVERLAY		/A059


OL1,	OLACUT
OL0,	0
OL2,	OLAEDT;OLAMTH;OLAMT2;OL3EDT;OLASL2  / MATH LOADS WITH THE EDITOR /M012
OL17,	OLAE12;0

OL30,	OLALOG;OLASL5		/ Logon loads itself AND CX!!!
OL3,	OLACX1;OLACX2;OLA40Z;0	/					/M004

OL4,	OLACPY;OLAE12;OLA40Z;0	/ COPY UTILITY NOW USES 2 FIELD BUFFER	/C006
OL5,	OLADWC;OLADW2;OLADW3;OLA40Z;0
OL6,	OLAPRS;OLAPR2;OLAMTH;OLAMT2;0	/ READS IN WPPARS.PA (LP PARSER)/m045
OL7,	OLASL1;OLASL2;OLASL5;0	/ READS IN WPSELC.PA (SP SELECTER)
OL10,	OL4EDT;OLASL2;0		/ READS IN EDITOR MATH CODE NOT USED	/M012
				/ DURING LIST PROCESSING
OL11,	OLASL3;0
OL12,	OLACU2;0
OL13,	OLACPF;OLAE12;OLAEFZ;0	/ COPY DOCUMENT UTILITY
OL14,	OLAVFY;OL3VFY;OLAE12;OLA40Z;0 	/VERIFY USES FIELDS 3,4,5 & 6	/C031

OL15,	OLAUDK;0
OL16,	OLANDX;0
OL20,	OLACU3;0

	IFNDEF	CONDOR	<						/A004
OL21,				/ SED TRANSFER PROGRAM is gone		/C017
/D017	OLAEFZ;OLAPR2;OLASL5;OLASL2;OLA40Z;0 / ZAP ALL LOCK WORDS
			>	/ END IFNDEF CONDOR			/A004

	IFDEF	CONDOR	<						/A004
/d026 OL21,	OLAEDT;OL3EDT;OLASL2;OLASPI;OLAE12;0 / SPELLING CORRECTOR/A004/M012

				/ SPELLING CORRECTOR			/A026
OL21,	OLAEFZ			/ ZAP FIELD 3 LOCK WORD	TO REREAD EDITOR/A026
	OLAEDT			/ READ IN THE FIELD 3 EDITOR		/A026
	OL3EDT			/ READ IN THE FIELD 5 EDITOR		/A026
	OLASL2			/ ZAP FIELD 5 LOCK WORD			/A026
	OLASPI			/ READ IN SPELL CHECK INIT CODE		/A026
	OLAE12			/ ZAP FIELD 4 LOCK WORD			/A026
	0			/ END OF LIST INDICATOR			/A026
			>	/ END IFDEF CONDOR			/A004

OL22,
OL23,				/ MAGCARD SUPPORT IS GONE		/C017
	IFDEF	CONDOR <OLASETUP; 0>
OL24,	OLACX2
OL25,	OLACU4;0
	
OL26,	OLASPR;			/ READ IN SORT PARSER
	OLASRT;			/ READ IN SORT
	OLAE12			/ ZAP FIELD 4 LOCK WORD
	OLASL5;			/ ZAP FIELD 5 LOCK WORD
				/ (SO SORT WILL RELOAD NEXT TIME)
	OLA40Z			/ ZAP FIELD 6 LOCK WORD
				/ (TO INDICATE MATH OVERWRITTEN)
OL27,	OLAEFZ;0		/ ZAP FIELD 3 LOCK WORD

IFDEF	WINNIE		<
OL31,	OLAWIN;OLAE12;0							/A003
			>	/ END IFDEF WINNIE

OL32,	OLCNVT			/ LOAD IN THE STARTUP CODE		/A059
	OLA40Z			/ ZAP field 6 lock			/a059
				/ to indicate MATH overwritten		/A059
	0			/ TERMINATOR OF LIST			/A059


/***************************************************************************
/***************************************************************************
/*****		D A N G E R  -  D O   N O T   M O V E                  *****
/*****								       *****
/*****   C O D E   I N T O   O R   O U T   O F   T H I S   A R E A     *****
/*****								       *****
/*****        SWAP AREA IN CONSTANT USE BY OTHER MODULES	       *****
/***************************************************************************
/***************************************************************************

/ ...............................................................
/ FORMAT:							/
/								/
/	LOCK PTR; BLK #; ADDR; CCFX				/
/								/
/	CC	= BLK COUNT					/
/	F	= USER FIELD #	(ACUAL FIELD # - 2)		/
/	X	= 1 MEANS LOAD MEMORY LOCATIONS 20 - 77		/
/		 (ELSE 0)					/
/								/
/ ...............................................................

OLACU2,	OLL220;DLOCU2;  0;DSOCU2^100+21
OLACU3,	OLL220;DLOCU3;  0;DSOCU3^100+21
OLACU4,	OLL220;DLOCU4;100;DSOCU4^100+21
OLAUDK,	OLL220;DLOUDK;  0;DSOUDK^100+21		/ UDK'S			/C033
OLANDX,	OLL220;DLONDX;100;DSONDX^100+21		/ INDEX COMMAND
OLACUT,	OLL220;DLOCUT;100;DSOCUT^100+21
OLAEDT,	OLL110;DLOEDT;  0;DSOEDT^100+11		/ EDITOR
OLACX1,	OLL220;DLOCX1;100;DSOCX1^100+21		/ CX
OLACX2,	OLL110;DLOCX2;100;DSOCX2^100+11		/ CX

	IFDEF	CONDOR	<
OLASETUP,OLL110; DLOSETUP; 100; DSOSETUP^100+11
			>			/ END IFDEF CONDOR


OLACPY,	OLL110;DLOCPY;000;DSOCPY^100+11		/ COPY COMMAND
OLADWC,	OLL110;DLODWC;100;DSODWC^100+11
OLADW2,	OLL220;DLOAX ;100; DSOAX^100+21		/ AX
OLAPRS,	OLL110;DLOPRS;100;DSOPRS^100+11		/ LP (WPARS)

OLALOG,	OLL301;DLOLOG;100;DSOLOG^100+31		/ LOGON utility		/A037

OLADW3,	OLL110;DLODW2;7400;DSODW2^100+10
OLASL1,	OLL301;DLOSEL; 200;DSOSEL^100+31	/ LP (WPSELC)
OLASL3,	OLL302;DLOSOV;2200;DSOSOV^100+30	/ LP (OVERLAY)
OLASL5,	OLL301;0				/ DUMMY TO ZAP LP (WPSELC) LOCK
						/ WORD SO LP WILL BE READ IN
						/ EVERY TIME
OLASL2,	OLL302;0				/ ZAP LOCK WORD
OLASPR,	OLL110;DLOSPR;100;DSOSPR^100+11
OLASRT,	OLL301;DLOSRT;100;DSOSRT^100+31
OLAEFZ,	OLL110;0
OLAPR2,
OLAE12,	OLL220;0				/ SIMPLY ZAPS LOCK WORD
OLA40Z,	OLL400;0				/ ZAPS FIELD 6 LOCK WORD

OLAMTH,	OLL400;DLMATH; 100;DSMATH^100+41	/ MATH MODULE
OLAMT2,	OLL301;DLMBCD;5400;DSMBCD^100+31	/ BCDASC MODULE
OL4EDT,	OLL302;DL4EDT; 200;DS4EDT^100+31	/ EDITOR MATH		/M012
OL3EDT,	OLL302;DL3EDT;6400;DS3EDT^100+31	/ GOTO PAGE & EDXVEC	/M012

OLAVFY,	OLL110;DLOVFY;0;DSOVFY^100+11		/ VERIFY COMMAND
OL3VFY,	OLL301;DL3VFY;200;DS3VFY^100+31		/ COS ROUTINES

OLACPF,	OLL110;DLCPFL;100;DSCPFL^100+11		/ COPY DOCUMENT UTILITY


	IFDEF	CONDOR	<						/A004
OLASPI,	OLL110; DLOSPI;7400; DSOSPI^100+10	/ Spell Checker init stuff/A004
			>			/ END IFDEF CONDOR	/A004

	IFDEF	WINNIE	<
OLAWIN,	OLL110;DLWINI;000;DSWINI^100+11		/ WINNIE UTILITY	/A003
			>			/ END IFDEF WINNIE
OLCNVT,	OLL400;DLCVTI;6000;DSCVTI^100+41	/ load convert INIT at top/a059
						/ of field 6		/a059

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE

/--------------------
	PAGE			/ Previous table extends over page

/***************************************************************************
/***************************************************************************
/*****		D A N G E R  -  D O   N O T   M O V E                  *****
/*****								       *****
/*****   C O D E   I N T O   O R   O U T   O F   T H I S   A R E A     *****
/*****								       *****
/*****        SWAP AREA IN CONSTANT USE BY OTHER MODULES	       *****
/***************************************************************************
/***************************************************************************

/***************************************************************************
/****		MENU - TAKES CARE OF MENU MANAGING			****
/***************************************************************************

	/ THE MAIN CALL IS:
	/	JMS	MENU
	/	DISK BLOCK TO READ FOR FIRST MENU
	/	RETURN POINT

	/ THE PROGRAM STARTS INTERPRETING INSTRUCTIONS
	/ AT RELATIVE LOCATION 0.

	/ ALL MENU COMMAND TRANSFER LABLES CAN HAVE THE FORM:
	/       -1-ROUTINE LABEL ; ROUTINE BLOCK NUMBER


			/ COMMANDS ALLOWED:
NOOPER=	 0		/ ZERO VALUE COMMAND IS A MENU NO-OPERATION
READ=	-1		/ READ; DESTINATION OF RESULT ADDRESS; ERROR LABEL
RETURN=	-2		/ RETURN
CALL=	-3		/ CALL; ROUTINE LABEL; ROUTINE BLOCK NUMBER
GOTO=	-4		/ GOTO; LABEL
NUMBER=	-5		/ NUMBER; DESTINATION;  ERROR LABEL
KEYWRD=	-6		/ KEYWRD; TEXT; LABEL; ...
DISP=	-7		/ DISP; POSITION; IOA CONTROL STRING; ARGP1; ARGP2; ...
SET=	-10		/ SET; VALUE; DESTINATION
ARG=	-11		/ ARG; NO ARGUEMENT LABEL; DEST OF WHERE STORED
RANGE=	-12		/ RANGE; SOURCE; MINIMUM; MAXIMUM; ERROR LABEL
CASE=	-13		/ CASE; SOURCE; VALUE; LABEL; VALUE; LABEL; ...
PQUEUE=	-14		/ PQUEUE; IN-QUEUE-LABEL; EMPTY-QUEUE-LABEL
TRNSFR=	-15		/ TRNSFR; LABEL; BLOCK NUMBER
COPY=	-16		/ COPY; FROM; TO
FILNAM=	-17		/ FILNAM; NONAME LABEL; NOT DEFINED LABEL
CMND=	-20		/ CMND; OVERLAY NUMBER; ADDRESS; CIDF FIELD
PREAD=	-21		/ PREAD; FLAG; RESULT ADDRESS; ERROR LABEL
MXDISP=	-22		/ MXDISP; POSITION; TEXT STRING LABEL; BLOCK NUMBER
MNHALT=	-23		/ MNHALT - HALT INSTRUCTION, PROGRAMMING DIAGNOSTIC AID
FBREAK=	-24		/ FBREAK; ADDRESS OF FILE NUMBER
TSTBIT=	-25		/ TSTBIT; SOURCE; MASK; ZERO RESULT LABEL
CLRV=	-26		/ CLRV;
INCV=	-27		/ INCV;
STOV=	-30		/ STOV;	DESTINATION
CLRRTN=	-31		/ CLRRTN
CLRBIT= -32		/ CLRBIT; BIT MASK VALUE; DESTINATION
SETBIT= -33		/ SETBIT; BIT SET  VALUE; DESTINATION
SHFBIT= -34		/ SHFBIT; SHIFT VALUE (+ RIGHT, - LEFT), DESTINATION

/****************************************************************************
/ MENU		Moved from here to create space for the IOA table	/a051
/****************************************************************************

MULOOP,	JMS	MUPCWD		/ GET WORD AT PC, INCR PC
MULXEQ,	TAD	(MUCLST)	/ USE AS OFFSET TO TRANSFER VECTOR
	DCA	MUTEMP
	TAD I	MUTEMP
	DCA	MUTEMP
	JMP I	MUTEMP		/ DO COMMAND

/***************************************************************************
/****			COMMAND TRANSFER TABLE				****
/***************************************************************************

	MUCSHF	/ SHFBIT= -34	/ SHFBIT; SHIFT (+ RIGHT, - LEFT), DESTINATION
	MUCSBT	/ SETBIT= -33	/ SETBIT; BIT SET  VALUE; DESTINATION
	MUCCBT	/ CLRBIT= -32	/ CLRBIT; BIT MASK VALUE; DESTINATION
	MUCLRT	/ CLRRTN= -31	/ CLRRTN
	MUSTOV	/ STOV=   -30	/ STOV;	DESTINATION
	MUINCV	/ INCV=   -27	/ INCV
	MUCLRV	/ CLRV=   -26	/ CLRV
	MUCTSB	/ TSTBIT= -25	/ TSTBIT; SOURCE; MASK; ZERO RESULT LABEL
	MUCBRK	/ FBREAK= -24	/ FBREAK; ADDRESS OF FILE NUMBER
	MUHALT	/ MNHALT= -23	/ MNHALT - PROGRAMMING DIAGNOSTIC AID
	MUXDSP	/ MXDISP= -22	/ MXDISP; POSITION; TEXT LABEL; BLOCK NUMBER
	MUCPRE	/ PREAD=  -21	/ PREAD; FLAG; RESULT ADDRESS; ERROR LABEL
	MUCCMD	/ CMND=   -20	/ CMND; OVERLAY NUMBER; ADDRESS; CIDF FIELD
	MUCFNM	/ FILNAM= -17	/ FILNAM; NONAME LABEL; NOT DEFINED LABEL
	MUCCPY	/ COPY=   -16	/ COPY; FROM; TO
	MUCTRN	/ TRNSFR= -15	/ TRNSFR; LABEL; BLOCK NUMBER
	MUCPQU	/ PQUEUE= -14	/ PQUEUE; IN-QUEUE-LABEL; EMPTY-QUEUE-LABEL
	MUCCAS	/ CASE=   -13	/ CASE; SOURCE; VALUE; LABEL; VALUE; LABEL; ...
	MUCRNG	/ RANGE=  -12	/ RANGE; SOURCE; MINIMUM; MAXIMUM; ERROR LABEL
	MUCARG	/ ARG=    -11	/ ARG; NO ARGUEMENT LABEL; DEST OF WHERE STORED
	MUCSET	/ SET=    -10	/ SET; VALUE; DESTINATION
	MUCDSP	/ DISP=   -7	/ DISP; POSITION; IOA CONTROL STRING; ARGP1; ARGP2; ...
	MUCKYW	/ KEYWRD= -6	/ KEYWRD; TEXT; LABEL; ...
	MUCNUM	/ NUMBER= -5	/ NUMBER; DESTINATION;  ERROR LABEL
	MUCGTO	/ GOTO=   -4	/ GOTO; LABEL
	MUCCAL	/ CALL=   -3	/ CALL; ROUTINE LABEL; ROUTINE BLOCK NUMBER
	MUCRET	/ RETURN= -2	/ RETURN
	MUCRED	/ READ=   -1	/ READ; DESTINATION OF RESULT ADDRESS; ERROR LABEL
MUCLST,	MULOOP	/ NOOPER=  0	/ ZERO VALUE COMMAND IS A MENU NO-OPERATION

MUCRET,	TAD	MUBUF+MNSP	/ IS THERE A RETURN LABEL?
	SNA
	JMP	MENUX		/ NO - RETURN TO REAL CALLER

	DCA	T2		/ SAVE AS IN TRNSFR INSTRUCTION
	DCA	MUBUF+MNSP	/ CLEAR FOR NEXT TIME

	TAD	MUBUF+MNSPTP	/ GET BLOCK NUMBER
	JMP	MUCOVA		/ JOIN OVERLAY CODE

MUCDSP,	JMS	MUPCWD		/ GET NEXT WORD
	DCA	MUCDS1		/ SAVE AS POSITION
	JMS I	IOACAL		/ CALL IOA TO REPOSITION THE CURSOR	/M009
	OUTCHR			/ OUTPUT ROUTINE TO USE
	INAPS			/ ADDRESS OF THE CONTROL STRING		/M007
MUTEMP,
MUCDS1,	0			/ SCREEN ADDRES TO POSITION THE CURSOR TO
	JMS	MUPCP		/ GET ADDR PC POINTS TO (ADDR OF CTL STRING)
	DCA	MUCDS5		/ SAVE IN IOA CALL

MUCDS2,	MQL			/ Set the MCS introducer flag		/a054
	JMS	MUPCWD		/ GET NEXT WORD
	SWP			/ Save the word				/m054
	MQA			/ Get it back again			/a051
	BSW			/ Test most significant part first	/a054
	AND	P77		/ Test the most significant byte	/a051
	SNA			/ Is it zero?				/a051
	JMP	MUCDS7		/ Yes, end of string found		/a054
	TAD	(-34)		/ Is it a preceding MCS introducer?	/a054
	SNA CLA			/ ....					/a054
	JMP	MUCDS2		/ Yes, ignore rest of byte		/a054
	ACL			/ No, do other checks			/a051
	AND	P77		/ CHECK TO SEE IF END OF TEXT STRING
	SNA			/					/m054
	JMP	MUCDS7		/ Yes, found end of string		/m054
	TAD	(-34)		/ No, so test to MCS itroducer		/a054
	SNA CLA			/ Is it?				/a054
	AC4000			/ Yes, so bias test for next byte	/a054
	JMP	MUCDS2

MUCDS7,	TAD	(MUCDS6-1)	/ GET ADDR OF ARG LIST IN IOA CALL	/M009
	DCA	X0		/ SAVE FOR INDIRECTION			/M009

MUCDS3,	JMS	MUPCWD		/ GET NEXT WORD
	SPA			/ SEE IF COMMAND (ALL COMMANDS NEG)
	JMP	MUCDS4		/ COMMAND
	TAD	MUBASE		/ MAKE A REAL ADDR
	DCA I	X0		/ SAVE IN ARG LIST			/M009
	JMP	MUCDS3		/ TRY FOR NEXT ARG

MUCDS4,	AC7777			/ DECR PC
	TAD	MUBUF+MNPC
	DCA	MUBUF+MNPC
	TAD	MUJMP		/					/M009
	DCA I	X0		/ AFTER LIST IS RETURN TO INTERPRET LOOP/M009

	JMS I	IOACAL
		0		/ OUTPUT STRING TO SCREEN

MUCDS5,		0		/ CTL STRING
MUCDS6,	ZBLOCK	6		/ Max of 5 args plus location for JMP when done.

MUCPQU,	AC7777			/ GET PRINTER QUEUE ADDR INTO X0
	TAD	PQADDR
	DCA	X0
	TAD	(-10)		/ COUNT OF ENTRIES IN QUEUE
	DCA	T1
	DCA	T2		/ INIT TO SAY ZERO QUEUE ENTRIES (EMPTY)

MUCPQ1,	TAD I	X0		/ GET NEXT ENTRY
	SNA
	JMP	MUCPQ3		/ ZERO ENTRY
	CIA			/ COMPARE TO OUR FILENO
	TAD	MUBUF+MNFNO

MUCPQ2,	SNA CLA			/ SAME FILENO?
	JMP	MUCGTO		/ YES
	ISZ	T2		/ REMEMBER WE FOUND SOMETHING IN THE QUEUE
MUCPQ3,	ISZ	X0		/ SKIP LINK WORD
	ISZ	T1		/ INCR COUNT
	JMP	MUCPQ1		/ MORE TO DO
	JMS	MUPSKP		/ SKIP IN-QUEUE LABEL
	TAD	T2		/ CHECK TO SEE IF QUEUE IS EMPTY
MUCPQ4,	SNA CLA
	JMP	MUCGTO		/ YEP
MUCPQ5,	JMS	MUPSKP		/ NO - SKIP EMPTY QUEUE LABEL
MUJMP,	JMP	MULOOP		/ ALL DONE, RETURN TO MAIN LOOP

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/--------------------
	PAGE

/***************************************************************************
/***************************************************************************
/*****		D A N G E R  -  D O   N O T   M O V E                  *****
/*****								       *****
/*****   C O D E   I N T O   O R   O U T   O F   T H I S   A R E A     *****
/*****								       *****
/*****        SWAP AREA IN CONSTANT USE BY OTHER MODULES	       *****
/***************************************************************************
/***************************************************************************

/ MUPCP - RETURNS ADDRESS OF WORD PC POINTS TO

MUPCP,	XX
	CLA
	TAD	MUBUF+MNPC
	TAD	MUBASE
	JMP I	MUPCP

/ MUPPCW - RETURNS WORD PC POINTS TO

MUPPCW,	XX
	JMS	MUPCP
	DCA	MUPCW1
	TAD I	MUPCW1
	JMP I	MUPPCW
MUPCW1,	0

/ MUPCWD - RETURNS WORD PC POINTS TO, AND INCREMENTS PC

MUPCWD,	XX
	JMS	MUPPCW
	ISZ	MUBUF+MNPC
	JMP I	MUPCWD

/ MUPCST - DOES MUPCWD AND STORES AC WHERE IT POINTS

MUPCST,	XX
	DCA	T1
	JMS	MUPCWD
	TAD	MUBASE
	DCA	T2
	TAD	T1
	DCA I	T2
	JMP I	MUPCST

/ MUPCLD - LOAD WORD PCWD POINTS TO

MUPCLD,	XX
	JMS	MUPCWD
	TAD	MUBASE
	DCA	T1
	TAD I	T1
	JMP I	MUPCLD

/ MUPSKP - SKIP OVER LABEL (SHORT OR LONG FORM)

MUPSKP,	XX
	JMS	MUPCWD		/ GET NEXT WORD AND THROW IT AWAY
	SPA			/ TEST FOR SHORT JUMP - SKIP IF YES
	JMS	MUPCWD		/ GET NEXT WORD AND THROW IT AWAY
	CLA			/ INSURE CLEAR ACCUMULATOR
	JMP I	MUPSKP		/ RETURN TO CALLER

MUCARG,	JMS I	NXACAL		/ GET NEXT ARG FROM ISTR
		MUBUF+MNPOS
		MUBUF+MNARG-1
	JMP	MUCGTO		/ ERROR
	JMS	MUPSKP		/ NO ERRORS, SKIP LABEL
	TAD	(MUBUF+MNARG)	/ STORE ADDR IN NEXT WORD
	JMS	MUPCST
	JMP	MULOOP		/ ALL DONE, RETURN TO MAIN LOOP

MUCKYW,	JMS	MUPCP		/ GET PC ADDR
	DCA	MUCKY4		/ SAVE AS ADDR OF TEXT STRING TO COMPARE WITH

MUCKY2,	JMS	MUPCWD		/ GET NEXT WORD
	SMA			/ SEARCH TIL END OF STRING OR COMMAND
	JMP	MUCKY3		/ NOT COMMAND
	TAD	P77		/ COMMANDS ARE LESS THAN 64
	SMA
	JMP	MUCKY6		/ COMMAND - DONE THIS ONE - GO TO NEXT
	IAC			/ GET LOW BYTE BACK FOR END OF STRING TEST

MUCKY3,	AND	P77		/ END OF STRING?
	SZA
	JMP	MUCKY2		/ NO

	JMS I	STCCAL		/ COMPARE TEST WITH OUR STRING
		MUBUF+MNARG
MUCKY4,	0
	JMP	MUCGTO		/ YES - GO TO LABEL IN NEXT WORD
	JMS	MUPSKP		/ NO - SKIP TRANSFER LABEL
	JMP	MUCKYW		/ AND TRY NEXT KEYWORD

MUCKY6,	AC7777			/ DECR PC AND EXECUTE THE COMMAND WE JUST READ
	TAD	MUBUF+MNPC
	DCA	MUBUF+MNPC
	JMP	MULOOP		/ ALL DONE, RETURN TO MAIN LOOP

MUFGTO,	CLA
	DCA	MUBUF+MNFNO
MUCGTO,	JMS	MUPCWD		/ GET NEXT WORD
	SPA
	JMP	MUCOV1		/ JUMP TO TRNSFR IF LONG JUMP
	DCA	MUBUF+MNPC	/ AND GO THERE
	JMP	MULOOP		/ ALL DONE, RETURN TO MAIN LOOP

MUCPRE,	JMS	MUPCWD		/ GET FLAG WORD
MUCRED,	DCA	MUBUF+MNSYSA	/ SAVE IT
	TAD	(MUBUF+MNIBUF)
	DCA	MUBUF+MNPOS	/ SET TO START OF STRING
	TAD	(MUBUF+MNIBUF)	/ MOVE ADDR TO WORD
	JMS	MUPCST

	TAD	MUBUF+MNSYSA	/ GET FLAG WORD
	JMS I	INACAL		/ INPUT LINE
		MUBUF+MNIBUF-1
	JMP	MUCRE1		/ ERROR
	JMP	MUCPQ5		/ DONE, SKIP ERROR LABEL, RETURN TO MAIN LOOP

MUCRE1,	AND	P3777		/ MAKE ALWAYS POSITIVE
	DCA	MUBUF+MNSYSA	/ SAVE IN LOCATION USER CAN GET TO
	JMP	MUCGTO		/ GO TO ERROR LABEL

MUCRNV=	MUCKY4			/ USE FOR TEMPORARY STORAGE
MUCNUM,	JMS I	CVDCAL		/ CONVERT TO BINARY
		MUBUF+MNARG
	JMP	MUCNU1		/ ERROR RETURN
	JMS	MUPCST		/ SAVE VALUE IN DEST
	JMP	MUCPQ5		/ DONE, SKIP ERROR LABEL, RETURN TO MAIN LOOP

MUCRNG,	JMS	MUPCLD		/ GET SOURCE VALUE FOR RANGE CHECK
	DCA	MUCRNV		/ SAVE IT
	JMS	MUPCWD		/ GET MINIMUM RANGE VALUE
	CLL CIA			/ COMPARE TO SOURCE VALUE
	TAD	MUCRNV
	SNL			/ SKIP IF VALUE IS NOT SMALLER THAN MINIMUM
	JMP	MUCNU1		/ ERROR - GO TO ERROR LABEL
	JMS	MUPCWD		/ COMPARE WITH MAXIMUM RANGE VALUE
	CLL CIA
	TAD	MUCRNV
	SNL			/ SKIP IF VALUE IS NOT SMALLER THAN MAXIMUM
	JMP	MUCPQ5		/ OK - IT IS WITHIN RANGE
MUCRN0,	SZA			/ RETURN HERE FROM BIT TEST COMMAND
	JMP	MUCGTO		/ NOT EQUAL - GO TO ERROR LABEL
	JMP	MUCPQ5		/ DONE, SKIP ERROR LABEL, RETURN TO MAIN LOOP

MUCNU1,	JMS	MUPCWD		/ SKIP DESTINATION ADDRESS OR SKIP MAX WORD
	JMP	MUCGTO		/ AND GO TO ERROR LABEL


MUCCMD,	JMS	MUPCWD		/ COPY IN VALUES
	DCA	MUBUF+MNONUM
	JMS	MUPCWD
	DCA	MUBUF+MNOADR
	JMS	MUPCWD
	DCA	MUBUF+MNOFLD
	JMP	MULOOP		/ ALL DONE, RETURN TO MAIN LOOP

MUHALT,	HLT

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/--------------------
	PAGE

/***************************************************************************
/***************************************************************************
/*****		D A N G E R  -  D O   N O T   M O V E                  *****
/*****								       *****
/*****   C O D E   I N T O   O R   O U T   O F   T H I S   A R E A     *****
/*****								       *****
/*****        SWAP AREA IN CONSTANT USE BY OTHER MODULES	       *****
/***************************************************************************
/***************************************************************************

MUCCAS,	JMS	MUPCLD		/ GET SOURCE
	CIA
	DCA	MUCCAV		/ SAVE

MUCCA1,	JMS	MUPCWD		/ GET NEXT VALUE TO COMPARE WITH
	SPA			/ ***** NEGATIVE MEANS COMMAND *****
	JMP	MULXEQ		/ CAN'T COMPARE TO NEGATIVE NUMBERS

	TAD	MUCCAV
	SNA
	JMP	MUCGTO		/ MATCH - GO TO ASSOCIATED LABEL
	JMS	MUPSKP		/ NO MATCH - SKIP OVER LABEL
	JMP	MUCCA1		/ AND TRY NEXT ELEMENT IN LIST

MUCCAV,	0

MUCCAL,	AC0002
	TAD	MUBUF+MNPC	/ SAVE PC AND BLOCK NUMBER FOR RETURN
	DCA	MUBUF+MNSP	/ ADD 2 TO PC TO SKIP OVER TRNSFR WORDS
	TAD	MUCBLK		/ PICK UP NUMBER OF MENU BLOCK IN MEMORY /M037
	DCA	MUBUF+MNSPTP	/ NOW TREAT AS IF A TRNSFR INSTRUCTION

MUCTRN,	JMS	MUPCWD		/ GET JUMP LABEL
MUCOV1,	SPA
	CMA			/ FIX IF COMPLEMENTED
	DCA	T2		/ SAVE FOR NEW PC
	JMS	MUPCWD		/ GET BLOCK NUMBER TO OVERLAY
MUCOVA,	DCA	QUQBLK+RXQBLK	/ SAVE AS BLOCK NUMBER
	TAD	T2		/ SET NEW PC
	DCA	MUBUF+MNPC
	TAD	QUQBLK+RXQBLK	/ CHECK FOR BLOCK ALREADY IN CORE.
	CIA
	TAD	MUCBLK		/ COMBINE WITH RESIDENT MENU BLOCK NUMBER /M037
	SNA CLA
	JMP	MULOOP		/ IF ALREADY THERE, RETURN TO MAIN LOOP
	TAD	QUQBLK+RXQBLK	/ SAVE IN OUR TEMP
	DCA	MUCBLK		/ UPDATE NUMBER OF RESIDENT MENU BLOCK	/M037
	TAD	(MUBUF)		/ READ INTO BUFFER
	JMS	MUQURX		/ READ THE DISK BLOCK
	JMP	MULOOP		/ DO FIRST COMMAND, RETURN TO MAIN LOOP

MUCBLK,	0			/ LOCATION FOR RESIDENT MENU BLOCK NUMBER /A037

MUQURX,	XX			/ READ A DISK BLOCK ROUTINE
	DCA	QUQBLK+RXQBAD
	TAD	GETMYF		/ SET TO OUR FIELD			/M023
	DCA	QUQBLK+RXQBFD
	TAD	(RXERD)		/ DO A READ OPERATION
	DCA	QUQBLK+RXQFNC
	DCA	QUQBLK+RXQDRV	/ MENUES ARE ON DRIVE 0
	JMS	QURX		/ SEND READ REQUEST TO DISK TASK
	JMP I	MUQURX		/ RETURN TO CALLER

/ 'RDFNUM' LOOKS FOR THE DOCUMENT NUMBER IN A FORMAT THAT OCCURS IN
/ THE INDEX.  IF IS NOT NECESSARY TO TEST FOR IMBEDDED WORD WRAP CARRIAGE
/ RETURNS, ETC. BECAUSE A BLANK PRECEDES THE CONSTRUCTION <#>NUM, SO ANY WORD
/ WRAPS WOULD HAVE OCCURRED AT THAT BLANK.

RDFSRC,	XX
RDFSL1,	CLA
	TAD I	RDFSRC		/ GET ARG - ADDR OF STRING TO COMPARE
	DCA	RDFSSP

RDFSL2,	JMS	MURDC		/ GET NEXT CHAR FROM FILE
	SNA
	JMP	RDFSNM		/ NO MATCH - END OF FILE
	JMS	MUFXLU		/ XLAT TO UPPER CASE
	CIA
	DCA	T1		/ SAVE FOR COMPARE
	TAD I	RDFSSP		/ GET NEXT CHAR FROM STRING
	JMS	MUFXLU		/ XLAT TO UPPER CASE
	TAD	T1		/ COMPARE WITH CHAR FROM FILE
	SZA CLA			/ EQUAL?
	JMP	RDFSL1		/ NO - RE-INIT

	ISZ	RDFSSP		/ GET NEXT CHAR FROM STRING
	TAD I	RDFSSP
	SZA CLA			/ END?
	JMP	RDFSL2		/ NO - CHECK NEXT CHAR

	ISZ	RDFSRC		/ SKIP RETURN

RDFSNM,	ISZ	RDFSRC
	JMP I	RDFSRC		/ RETURN

RDFSSP,	0
RDFNUM,	XX			/ READ NUMBER FROM FILE
	CLA
	DCA	RDFNV		/ INIT VALUE

RDFNL1,	JMS	MURDC		/ GET NEXT CHAR
	TAD	(-72)		/ NUMERIC?
	SMA
	JMP	RDFNDN		/ NO
	TAD	(12)
	SPA
	JMP	RDFNDN		/ NO

	DCA	T1		/ SAVE
	TAD	RDFNV		/ MULT WHAT WE HAVE SO FAR BY 10.
	CLL RTL
	TAD	RDFNV
	CLL RAL
	TAD	T1		/ ADD NEXT DIGIT
	DCA	RDFNV		/ SAVE
	JMP	RDFNL1		/ NEXT CHAR

RDFNDN,	CLA
	TAD	RDFNV		/ GET VALUE

	JMP I	RDFNUM		/ RETURN

RDFNV,	0

MURDC,	XX			/ READ NEXT CHAR FROM INDEX FILE
MURDC1,	CIFFIO			/ MAP FILE SYSTEM.
	FILEIO			/ CALL FILE SYSTEM TO
	XRDFNC			/ GET CHAR
	SPA
	CLA			/ Treat "read errors" like E-O-F.
	TAD	(-2012)		/ IGNORE WORD WRAP CR
	SZA
	TAD	(2012-2040)	/ ALSO IGNORE WORD WRAP BLANKS
	SNA			/ EITHER?
	 JMP	MURDC1		/ YES, GET NEXT CHARACTER
	TAD	(2040)		/ RESTORE CHARACTER
	AND	P177		/ ONLY ASCII PART IS OF INTEREST
	TAD	(-7)		/ CHECK FOR WORD WRAP MARKS
	SNA
	JMP	MURDC1
	TAD	(7)
	JMP I	MURDC		/ DONE

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/--------------------
	PAGE

/***************************************************************************
/***************************************************************************
/*****		D A N G E R  -  D O   N O T   M O V E                  *****
/*****								       *****
/*****   C O D E   I N T O   O R   O U T   O F   T H I S   A R E A     *****
/*****								       *****
/*****        SWAP AREA IN CONSTANT USE BY OTHER MODULES	       *****
/***************************************************************************
/***************************************************************************

/	FILNAM - Test the rest of the input string to see if it is the name
/		 of an existing file.  Syntax is as follows:

/		FILNAM		Operation code name
/		Noname Label	Where to go when there are no more tokens.
/		Notvalid Label	Where to go when the string is not the name
/				of an existing file or there is a drive error.
/		Normal Return	Return here if name or number is valid.

MUFT11,	.-.			/ Location of Alternate string pointer

/ Make a special check to see if there are any tokens on the line.  This
/ is to prevent a user error from accidently clearing the FNAMBF locations

MUCFNM,	TAD	MUBUF+MNPOS	/ Get pointer to string address
	DCA	MUFT11		/ Set up alternate string pointer location
	JMS I	NXACAL		/ Pick up next token using Page 0 Reference
		MUFT11		/ Address of string pointer
		MUBUF+MNARG-1	/ Pointer to string length and buffer address
		JMP MUCGTO	/ ERROR - Empty line

/	Set up default conditions.  Use Drive 1 and clear File Name Buffer

	AC0001			/ DEFAULT DRIVE IS 1
/D037	TAD	MUBUF+MNUSR2	/ Pick up the USER number
	DCA	MUBUF+MNDRV	/ Store DRIVE number

	DCA	FNAMBF		/ Initial name is null so clear buffer pointer
	TAD	(-STRLEN+1)	/ Pick up maximum buffer length
	DCA	FNAMB1		/ Store buffer length for =nxtarg= call

/	LOOK FOR LEADING NUMBER

	JMS	MUFNUM		/ Check for a leading number
	JMP	MUFL2		/ NOT A NUMBER, GO CHECK FOR A BRACE
	
/	LOOK FOR =.=

/	USE ALTERNATE =NXTARG= CALL AND BUFFER AREA TO AVOID LOSING THE
/	CONTENTS OF THE ARGUMENT BUFFER =FNAMSP= WHEN NOTHING FOLLOWS THE
/	NUMBER.  (THIS IS TO ACCOMODATE CREATE)

	JMS I	NXACAL		/ Pick up next token using Page 0 Reference
		MUBUF+MNPOS	/ Address of string pointer
		MUKST2-1	/ Pointer to string length and buffer address
		JMP MUF1NM	/ Empty line - Must be Document number

/	CLA			/ Not needed - NXACAL will clear the AC
	TAD	MUKST2		/ Pick up the character just returned
	TAD	(-56)		/ Compare to the value for a PERIOD
	SZA CLA			/ Skip if a match
	JMP	MUF1NM		/ IF NOT A =.= IGNORE THE TOKEN

/	LOOK FOR NUMBER OR DOCUMENT NAME

	TAD	MUBUF+MNDOCN	/ Get the number that the user entered
	DCA	MUBUF+MNDRV	/ Save as the dirve number
	JMP	MUF0NM		/ GO TRANSFER NAME, ETC.

/	LOOK FOR ={NUM=, =[NUM=, ={DOC= OR =[DOC= SYNTAXES.  FIRST, ={= OR =[=

MUFL2,	TAD	FNAMBF		/ GET FIRST CHARACTER OF TOKEN
	TAD	(-173)		/ CHECK FOR A CURLY BRACKET
	SZA			/ SKIP IF YES
	TAD	(173-133)	/ CHECK FOR A SQUARE BRACKET
	SZA CLA			/ SKIP IF YES
	JMP	MUF1NA		/ IF NOT ={= OR =[=, MUST BE A NAME.
/D037	TAD	MUBUF+MNUSR2	/ Get user number
	DCA	MUBUF+MNDRV	/ RESET DEFAULT DRIVE TO SYSTEM DRIVE

/	LOOK FOR NUMBER OR NAME

MUF0NM,	JMS	MUFNUM		/ Check for a leading number
	JMP	MUF1NA		/ NOT A NUMBER, GO PROCESS NAME

MUF1NM,	JMS	MUFDRA		/ VALIDATE DRIVE NUMBER AND POSITION IT
	JMP	MUFCN		/ Skip INDEX lookup code, DOC num is known

/	FINISH PROCESSING DOCUMENT NAME

MUF1NA,	JMS	MUFDRA		/ VALIDATE AND POSITION FLOPPY NUMBER

MUFN1,	TAD	(FNAMB3-1)	/ GET ADDR OF BUFFER
	DCA	X0		/ SAVE IN INDEX REG
	TAD	(74)		/ ASCII CODE FOR LEFT BRACKET
	DCA I	X0		/ PATCH IN LEFT BRACKET
	TAD	(156)		/ ASCII CODE FOR LOWER CASE "N"
	DCA I	X0		/ PATCH IN LOWER CASE "N"
	TAD	(76)		/ ASCII CODE FOR RIGHT BRACKET
	DCA I	X0		/ PATCH IN RIGHT BRACKET

	AC7777
	TAD	MUBUF+MNPOS	/ GET ADDR AND PUT IN X1
	DCA	X1

MUFN2,	TAD I	X0		/ FIND END OF LAST TOKEN,
				/ SO WE CAN ADD REST OF NAME
	SZA CLA
	JMP	MUFN2

MUFN3,	AC7777			/ BACK UP
	TAD	X0
	DCA	X0

MUFN3A,	TAD I	X1		/ COPY IN THE REST
	SNA
	JMP	MUFN4
	DCA I	X0
	JMP	MUFN3A

MUFN4,	TAD	(" -200)	/ ADD A SPACE AT THE END
	DCA I	X0
	DCA I	X0		/ AND MAKE ASCIZ

	AC0001			/ GET DOCUMENT 1 FROM FLOPPY
	TAD	MUFDR2
	CIFFIO			/
	FILEIO			/
	XRDFIN			/ INIT INDEX FOR READ
	JMS	RDFSRC		/ SEARCH FOR NAME
		FNAMB3		/ FILE NAME BUFFER MINUS THREE LOCATIONS

	JMP	MUFGTO		/ NOT FOUND
	JMS	RDFSRC		/ NOW LOOK FOR # THING
		MUFNST

	JMP	MUFGTO		/ NOT FOUND
	JMS	RDFNUM		/ GET THE NUMBER
	DCA	MUBUF+MNDOCN	

MUFCN,	TAD	MUBUF+MNDOCN	/ PUT DRIVE NUMBER INTO MENU
	TAD	MUFDR2
	DCA	MUBUF+MNFNO

	TAD	MUBUF+MNDOCN	/ SEE IF ZERO (ERROR)
	SNA CLA
	JMP	MUFGTO		/ YES, IT IS ZERO, WHICH IS NOT LEGAL

	TAD	MUBUF+MNDOCN	/ GET NUMBER AGAIN
	DCA	QUQBLK+RXQFNO	/ SAVE AS NUMBER
	TAD	QUQBLK+RXQFNO	/ CHECK RANGE
	TAD	(-MAXDOC)
	SMA CLA		
	JMP	MUFGTO		/ BAD NUMBER - DOESN'T EXIST

	TAD	(RXEGF+4000)	/ GET FIRST BLOCK NUMBER
	DCA	QUQBLK+RXQFNC
	JMS	QURX
	SPA CLA
	JMP	MUFGTO		/ IF DISK ERROR RETURN AS AN ERROR
	TAD	QUQBLK+RXQBLK	/ GET FIRST BLOCK NUMBER
	JMP	MUCPQ4		/ GO JOIN TESTING CODE
				/ ZERO VALUE MEANS NOT DEFINED - ERROR
				/ ELSE DONE, SKIP NOT DEFINED LABEL


	-1			/ USE ONLY A 1 CHARACTER BUFFER FOR
MUKST2,	ZBLOCK	2		/ THE =NXTARG= BUFFER USED WHEN LOOKING FOR A
				/ PERIOD.

MUFNST,	"<-200;"#-200;">-200;0

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/--------------------
	PAGE

/***************************************************************************
/***************************************************************************
/*****		D A N G E R  -  D O   N O T   M O V E                  *****
/*****								       *****
/*****   C O D E   I N T O   O R   O U T   O F   T H I S   A R E A     *****
/*****								       *****
/*****        SWAP AREA IN CONSTANT USE BY OTHER MODULES	       *****
/***************************************************************************
/***************************************************************************

/	MUFNUM WILL CHECK THE FILE NAME BUFFER FOR A LEADING NUMBER AND
/	THEN CHECK IT FOR A RANGE OF 0 - 999.  A NUMBER GREATER THAN 999
/	IS TO BE CONSIDERED THE START OF A VALID DOCUMENT NAME.
/	THE CALL IS AS FOLLOWS:
/		JMS	MUFNUM		/ CHECK FOR A LEADING NUMBER
/		NOT VALID NUMBER RETURN
/		NORMAL RETURN
/	UPON RETURN, THE AC WILL BE CLEAR

MUFNUM,	XX
	JMS I	NXACAL		/ MOVE UP TO THE NEXT TOKEN
	MUBUF+MNPOS		/ POSITION COUNTER
	FNAMB1			/ FILE NAME BUFFER LESS ONE LOCATION
	JMP	MUFGTO		/ ERROR - EMPTY LINE
	JMS I	CVDCAL		/ CHECK FOR A LEADING NUMBER
	FNAMBF			/ ADDRESS OF THE FILE NAME BUFFER
	JMP I	MUFNUM		/ IT'S NOT A NUMBER, BUT IT MIGHT BE A NAME
	TAD	(-1750)		/ CHECK FOR A NUMBER LARGER THAN 999
	SZL CLA			/ CLEAR LINK MEANS NUMBER IN RANGE 0-999
	JMP I	MUFNUM		/ NOT VALID NUMBER, USE AS DOCUMENT NAME
	TAD	T2		/ RECOVER NUMBER STORED IN T2 BY CVDBN ROUTINE
	DCA MUBUF+MNDOCN	/ SAVE NUMBER AS DOCUMENT NUMBER
	ISZ	MUFNUM		/ INCREMENT PAST ERROR RETURN
	JMP I	MUFNUM		/ RETURN TO CALLER

/	MUFDRA VALIDATES AND POSITIONS THE DRIVE NUMBER.  IT ALSO WILL DO
/	A DENSITY CHECK ON THE DRIVE TO VERIFY THAT IT EXISTS.  UPON RETURN,
/		MUFRDV  CONTAINS THE DRIVE NUMBER AS AN INTEGER AND,
/		MUFDR2  CONTAINS THE DRIVE NUMBER POSITIONED TO BE
/			COMBINED WITH THE DOCUMENT NUMBER.

MUFDRA,	XX
	TAD	MUBUF+MNMXDR	/ Get the MAXIMUM number of drives on system
	CIA			/ Negate the value for comparison
	TAD	MUBUF+MNDRV	/ Combine with the USER sepcified drive number
	SMA SZA CLA		/ Check for within range
	JMP	MUFGTO		/ IF OUT OF RANGE, JUMP
	JMS	MUPSKP		/ SKIP =NO NAME= LABEL IN MENU
	TAD	MUBUF+MNDRV	/ Pick up the DRIVE number
	BSW;RTL CLL		/ PUT INTO BITS 0-3
	DCA	MUFDR2		/ Save for later use

	JMS	CLRDSK		/ CLEAR MEMORY OF DISKETTE		/A010
	TAD	MUBUF+MNDRV	/ Get the dirve number
	DCA	QUQBLK+RXQDRV	/ Put in Q-block
	TAD	(RXEDN+4000)	/ Pick up FUNCTION code for DENSITY check
	DCA	QUQBLK+RXQFNC	/ Put is Q-block
	JMS	QURX		/ Perform DENSITY check
	SPA CLA			/ IF UNABLE TO READ DISK THEN
	JMP	MUFGTO		/    TREAT AS ERROR.
	JMP I	MUFDRA		/ Return to caller

MUFDR2, 0			/ USED TO CONTAIN THE POSITIONED DRIVE NUMBER.

/ MUCBRK - PROCESS 'FBREAK' OPERATION.  THE FOLLOWING GUIDELINES SHOULD BE
/ USED IN REGARDS TO THE CONTENTS OF 'MNFNO'

/	1.  'FILNAM' SETS 'MNDRV' AND 'MNDOCN' WHEN DEFINING 'MNFNO'.
/	2.  'FBREAK' CAN BE USED TO REDEFINE 'MNDOCN' AND 'MNDRV', BUT
/	    ANY ROUTINES TO DO THIS SHOULD RETURN 'MNDRV' AND 'MNDOCN'
/	    TO AGREEMENT WITH 'MNFNO'.  ('FBREAK' CAN BE USED TO DO THIS)

/
/	FBREAK; ADDRESS OF WORD CONTAINING PACKED FILE AND DRIVE NUMBERS

MUCBRK,	JMS	MUPCLD		/ GET FILE NUMBER WITH DRIVE NUMBER
	AND	P377		/ MASK OFF FILE NUMBER
	DCA	MUBUF+MNDOCN	/ STORE AS DOCUMENT NUMBER
	TAD I	T1		/ GET FILE NUMBER WITH DRIVE NUMBER
	BSW;RTR			/ POSITION TO ISOLATE DRIVE NUMBER
	AND	(17)		/ MASK OFF DRIVE NUMBER
	DCA	MUBUF+MNDRV	/ STORE DRIVE NUMBER
	JMP	MULOOP		/ ALL DONE, RETURN TO MAIN LOOP



MUFXLU,	XX			/ XLAT CHAR IN AC TO UPPER CASE
	TAD	(-140)		/ LOWER CASE?
	SPA
	TAD	(40)		/ SKIP IF SO
	TAD	(100)		/ GET BACK TO CORRECT CODE
	JMP I	MUFXLU		/ AND RETURN


/***************************************************************************
/***************************************************************************
/*****		D A N G E R  -  D O   N O T   M O V E                  *****
/*****								       *****
/*****   C O D E   I N T O   O R   O U T   O F   T H I S   A R E A     *****
/*****								       *****
/*****        SWAP AREA IN CONSTANT USE BY OTHER MODULES	       *****
/***************************************************************************
/***************************************************************************

	/*******************************************************************
	/*******************************************************************
	/****                                                           ****
	/****                 NEW BIT TEST MENU COMMAND                 ****
	/****                                                           ****
	/****  TRANSFER TO LABEL IF ALL SPECIFIED MASK BITS ARE CLEAR   ****
	/****                                                           ****
	/*******************************************************************
	/*******************************************************************

	/	COMMAND FORMAT OF TEST BIT INSTRUCTION
	/	........................................
	/	: TSTBIT ; : NUMVAR ; : MASK ; : LABEL :
	/	:..........:..........:........:.......:

	/	WHERE:
	/	TSTBIT	= THE NAME OF THE TEST BIT INSTRUCTION
	/	NUMVAR	= THE ADDRESS OF THE SOURCE VALUE TO BE TESTED
	/	MASK	= THE VALUE OF THE MASK WORD TO BE USED
	/	LABEL	= THE LABEL TO TRANSFER TO IF RESULT IS ZERO

MUCTSB,	JMS	MUPCLD		/ GET SOURCE VALUE
	DCA	T1		/ SAVE VALUE FOR LATER USE
	JMS	MUPCWD		/ GET MASK VALUE
	AND	T1		/ CLEAR BITS WITH SOURCE VALUE
				/ REVERSE SENSE OF MASK OPERATION
	SNA CLA			/ IF NON ZERO RESULT, MAKE IT ZERO
	IAC			/ MAKE ZERO RESULT VALUE NON ZERO
	JMP	MUCRN0		/ GOTO RANGE CODE TO PERFORM TEST


/***************************************************************************
/***************************************************************************
/*****		D A N G E R  -  D O   N O T   M O V E                  *****
/*****								       *****
/*****   C O D E   I N T O   O R   O U T   O F   T H I S   A R E A     *****
/*****								       *****
/*****        SWAP AREA IN CONSTANT USE BY OTHER MODULES	       *****
/***************************************************************************
/***************************************************************************

/***************************************************************************
/****			CLRV,INCV,STOV ROUTINES				****
/***************************************************************************

MUSTOV,	TAD	MUBUF+MNMUTM	/ STORE A VALUE COMMAND	- STOV ; DESTINATION
	JMP	MUSTO1		/ COPY MNMUTM TO THE DESTINATION ADDRESS

MUCLRV,	DCA	MUBUF+MNMUTM	/ CLEAR THE VALUE COMMAND
	JMP	MULOOP		/ ALL DONE, RETURN TO MAIN LOOP

MUINCV,	ISZ	MUBUF+MNMUTM	/ INCREMENT THE VALUE
	NOP			/ DON'T CARE FOR SKIP RETURN
	JMP	MULOOP		/ ALL DONE, RETURN TO MAIN LOOP

/***************************************************************************
/****			COPY AND SET ROUTINES				****
/***************************************************************************

MUCCPY,	JMS	MUPCLD
	SKP
MUCSET,	JMS	MUPCWD	/GET DESTINATION
MUSTO1,	JMS	MUPCST	/STORE AC IN WHERE NEXT WORD POINTS
	JMP	MULOOP	/ ALL DONE, RETURN TO MAIN LOOP

/***************************************************************************
/****									****
/****	CLRRTN--CLEAR PENDING RETURN					****
/****		FORM:	CLRRTN		/CLEAR PENDING RETURN		****
/****			(NO ARGUMENTS)					****
/****		THIS SINGLE WORD MENU OPERATOR IS USED TO CLEAR ANY	****
/****		PENDING RETURN.  ONE APPLICATION OF THIS OPERATOR IS	****
/****		TO BE ABLE TO ISSUE A CMND;RETURN INSIDE A MENU		****
/****		SUBROUTINE AND HAVE IT TAKE EFFECT IMMEDIATELY.		****
/****		ANOTHER APPLICATION IS TO PERMIT A TRANSITION TO	****
/****		ASSEMBLY LANGUAGE, RETURN TO MENU CODE VIA A		****
/****		JMS I MNUCAL, DO A CLRRTN;CMND;RETURN, AND HAVE THE	****
/****		CMND STATEMENT TAKE EFFECT IMMEDIATELY			****
/****									****
/***************************************************************************


MUCLRT,	DCA	MUBUF+MNSP	/ CLEAR ANY PENDING RETURN
	TAD	(CDIMNU)
	DCA	MENUX
	TAD	(CMNDLP)
	DCA	MENU
	JMP	MULOOP		/ ALL DONE, RETURN TO MAIN LOOP

/***************************************************************************
/***************************************************************************
/*****		D A N G E R  -  D O   N O T   M O V E                  *****
/*****								       *****
/*****   C O D E   I N T O   O R   O U T   O F   T H I S   A R E A     *****
/*****								       *****
/*****        SWAP AREA IN CONSTANT USE BY OTHER MODULES	       *****
/***************************************************************************
/***************************************************************************

/***************************************************************************
/****			MENU INSTRUCTION "MXDISP"			****
/***************************************************************************

/ THIS MENU STATEMENT READS A PURE TEXT OVERLAY INTO "MUXBUF" WHICH AT THIS
/ WRITING IS THE PRINT SCREEN BUFFER.  THE PURE TEXT OVERLAY CONTAINS "TEXT"
/ STATEMENTS ONLY.  IT DOES NOT CONTAIN ATTRIBUTES SUCH AS "!S", OR "^A", ETC.
/ THE MENU CALL FROM WITHIN THE "NORMAL" MENU OVERLAYS IS:

/	MXDISP ; POSITION ; TEXT LABEL ; BLOCK NUMBER

/ POSITION IS THE LINE/COLUMN POSITION IN STANDARD IOA FORMAT:
/	BITS 0-5 ARE THE LINE NUMBER FROM 0 TO 23 OCTAL, AND
/	BITS 6-11 ARE THE COLUMN NUMBER FROM 0 TO 117 OCTAL.
/	(REMEMBER THAT THE SCTEEN IS 24 LINES BY 80 COLUMNS)

/ TEXT LABEL IS THE ADDRESS LABEL OF THE TEXT STATEMENT TO DISPLAY (0-377)

/ BLOCK NUMBER IS THE OVERLAY DISK BLOCK NUMBER CONTAINING THE TEXT STATEMENT

MUXDSP,	JMS	MUPCWD		/ GET THE LINE/COLUMN SCREEN POSITION
	DCA	MUXP		/ STORE IN IOA CALL (WILL LOOK LIKE AN ^P)

	JMS	MUPCWD		/ GET THE TEXT STRING ADDRESS LABEL
	AND	P377		/ MASK OFF ANY HIGH ORDER BITS
	TAD	(MUXBUF)	/ COMBINE WITH BUFFER ADDRESS
	DCA	MUXS		/ STORE IN IOA CALL (WILL LOOK LIKE AN ^S)

	JMS	MUPCWD		/ GET THE DISK BLOCK NUMBER TO READ IN
	DCA	QUQBLK+RXQBLK	/ STORE IN QUEUE BLOCK

	TAD	QUQBLK+RXQBLK	/ GET THE BLOCK NUMBER BACK AGAIN
	CIA			/ NEGATE IT
	TAD	MUXBLK		/ COMBINE WITH RESIDENT OVERLAY BLOCK NUMBER
	SNA CLA			/ CHECK TO SEE IF THE BLOCK IS ALREADY LOADED
	JMP	MUXOK		/ YES, WE HAVE IT IN MEMORY, DON'T READ IT AGAIN

	TAD	QUQBLK+RXQBLK	/ GET THE BLOCK NUMBER BACK AGAIN
	DCA	MUXBLK		/ SAVE THE BLOCK NUMBER FOR THE NEXT CALL
	TAD	(MUXBUF)	/ PICK UP THE BUFFER ADDRESS FOR THE TRANSFER
	JMS	MUQURX		/ READ IN THE TEXT BLOCK OVERLAY

MUXOK,	JMS I	IOACAL		/ CALL THE SCREEN DISPLAY ROUTINE
	0			/ USE DEFAULT OUTPUT ROUTINE
	MUXCTL			/ ADDRESS OF THE TEXT CONTROL STRING
MUXP,	0			/ LINE/COLUMN DISPLAY POSITION (LOOKS LIKE ^P)
MUXS,	0			/ ADDRESS OF TEXT STRING (LOOKS LIKE ^S)
	JMP	MULOOP		/ ALL DONE, RETURN TO MAIN LOOP

MUXBLK,	0			/ LOCATION TO STORE DISPLAY BLOCK NUMBER /A021
MUXCTL,	TEXT	'^P^S'		/ CONTROL STRING FOR DISPLAY OUTPUT ROUTINE

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/--------------------
	PAGE

/***************************************************************************
/***************************************************************************
/*****		D A N G E R  -  D O   N O T   M O V E                  *****
/*****								       *****
/*****   C O D E   I N T O   O R   O U T   O F   T H I S   A R E A     *****
/*****								       *****
/*****        SWAP AREA IN CONSTANT USE BY OTHER MODULES	       *****
/***************************************************************************
/***************************************************************************

/***************************************************************************
/**** NXTARG - NEXT ARGUMENT ROUTINE - BREAKS ASCIZ STRING INTO TOKENS	****
/***************************************************************************
/
/	JMS	NXTARG
/		ADDR OF ADDR OF STRING1 (SOURCE)
/		ADDR OF BUFFER LIKE FOR INA (DESTINATION)
/	RETURN ON NO ARGS
/	NORMAL RETURN
/
/	THE FIRST ARGUMENT WILL BE CHANGED SO THAT SUCCESSIVE
/	CALLS WILL PICK UP THE ARGUMENTS ONE AT
/	A TIME.
/

NXTARG,	XX
	CLA
	RDF			/ SAVE RETURN FIELD
	TAD	CIDF0
	DCA	NXTARX
	TAD I	NXTARG		/ GET ADDR OF ADDR OF STRING
	ISZ	NXTARG
	DCA	T3		/ SAVE
	AC7777
	TAD I	T3		/ GET ADDR IT POINTS TO
	DCA	X0		/ SAVE AS S1 POINTER
	AC7777
	TAD I	NXTARG		/ GET NEXT ARG - ADDR OF BUFFER TO PUT IT IN
	ISZ	NXTARG
	DCA	X1		/ SAVE AS ADDR OF S2
	TAD I	X1		/ GET FIRST WORD - THE MAX
	DCA	T1		/ SAVE AS COUNT FOR S2
	DCA	T2		/ INIT COUNT OF NUMBER PLACED IN S2

NXTAL1,	TAD I	X0		/ GET NEXT CHAR
	MQL
	MQA			/ SAVE IT
	DCA	MQSAV
	TAD	MQSAV
	SNA
	JMP	NXTADN		/ ZERO IS THE END OF THE STRING
	TAD	(-40)		/ BLANK?
	SNA
	JMP	NXTABL		/ YES - A BLANK
	TAD	(40-60)
	SPA
	JMP	NXTABS		/ SOME SPECIAL CHAR
	TAD	(60-72)
	SPA
	JMP	NXTAOK		/ OK - A NUMERIC CHAR
	TAD	(72-101)
	SPA
	JMP	NXTABK		/ SPECIAL CHAR
	TAD	(101-141)
	SMA
	TAD	(-40)		/ GET COLUMNS FROM ASCII CHART TOGETHER
	TAD	(141-133)
	SMA
	JMP	NXTABK		/ SPECIAL CHARS

NXTAOK,	ISZ	T1		/ ANY MORE ROOM?
	SKP CLA			/ YES
	JMP	NXTAOV		/ NO
	ISZ	T2		/ INCR COUNT OF NUMBER GOTTEN SO FAR
	TAD 	MQSAV		/ GET CHAR AGAIN
	DCA I	X1		/ SAVE IN OUTPUT PLACE

NXTANC,	JMP	NXTAL1		/ GET NEXT ONE

NXTAMN,	TAD	NXDINP		/ Are we in a dead seq ?	/A044
	SNA CLA			/				/A044
	JMP	NXTADN		/ No , space is a terminator	/A044
	JMP 	NXTAOK		/ Yes , its part of string	/A044

NXTABK,	CLA
	TAD	T2		/ ANY GOTTEN YET?
	SZA CLA
	JMP	NXTADN		/ YES - SAVE BREAK CHAR FOR NEXT TIME

	ISZ	T2		/ ASSUME THAT IT FITS
				/ (BUFFER MUST HOLD AT LEAST ONE)
	TAD 	MQSAV			/ GET CHAR
	DCA I	X1		/ SAVE IN OUTPUT BUFFER
	ISZ	X0		/ INCR ADDR FOR NEXT TIME

NXTAOV,
NXTADN,	CLA
	DCA I	X1		/ STORE ZERO THERE (TO MAKE IT ASCIZ)
	TAD	T2		/ GET NUMBER OF CHARS IN TOKEN
	SZA CLA
	ISZ	NXTARG		/ ZERO MEANS NON-SKIP RETURN, SKIP OTHERWIZE
	TAD	X0		/ GET UPDATED ADDR
	DCA I	T3		/ SAVE WHERE CALLER KEEPS STRING POINTER

NXTARX,	.-.			/ RETURN CIF-CDF
	JMP I	NXTARG		/ RETURN TO CALLER


NXDINP,	0			/ Dead sequence in progress flag	/A044
MQSAV,	0			/ Saved MQ reg				/A044

/***************************************************************************
/***************************************************************************
/*****		D A N G E R  -  D O   N O T   M O V E                  *****
/*****								       *****
/*****   C O D E   I N T O   O R   O U T   O F   T H I S   A R E A     *****
/*****								       *****
/*****        SWAP AREA IN CONSTANT USE BY OTHER MODULES	       *****
/***************************************************************************
/***************************************************************************

/***************************************************************************
/****	STRCMP - STRING COMPARE - COMPARES ASCIZ STRING TO TEXT STRING	****
/***************************************************************************
/
/	JMS	STRCMP
/		ADDR OF ASCIZ STRING
/		ADDR OF TEXT STRING
/	EQUAL RETURN, AC = 0
/	NOT EQUAL RETURN, AC = 0
/
/	NOTE THAT CASE IS IGNORED
/

STRCMP,	XX
	CLA
	TAD I	STRCMP		/ GET ADDR OF S1, THE ASCIZ STRING
	ISZ	STRCMP
	DCA	STRCS1		/ SAVE
	TAD I	STRCMP		/ GET ADDR OF S2, THE TEXT STRING
	ISZ	STRCMP
	DCA	STRCS2		/ SAVE
	DCA	STRCOF		/ INIT OFFSET INTO TEXT STRING

	JMS	GETCID		/ GET THE CALLER'S DATA FIELD INST.	/A023
	DCA	STRCEQ		/ SAVE FOR RETURN TO CALLER		/A023

	AC7776			/ SET UP FOR A DECREMENT OF TWO		/A023
	TAD	STRCEQ		/ COMBINE WITH RETURN CDF-CIF INST.	/A023
	DCA	IOACDF+1	/ SAVE FOR GETCHR INTO CALLERS FIELD	/A023

STRCL1,	JMS	IOACDF		/ SWITCH FIELDS
	TAD I	STRCS1		/ GET CHAR FROM ASCIZ STRING
	CDFMYF			/ BACK TO MY FIELD
	ISZ	STRCS1		/ INCR FOR NEXT TIME
	SNA			/ END?
	JMP	STRCEQ		/ YES - STRINGS EQUAL SO FAR
	AND	P177		/ ONLY ASCII PART
	TAD	(-140)		/ MAKE SIXBIT
	SPA
	TAD	(140)
	AND	P77
	DCA	STRCCH		/ SAVE AS CHAR TO COMPARE WITH

	JMS	GETCHR		/ GET NEXT CHAR FROM TEXT STRING
		STRCOF		/ OFFSET ADDR
STRCS2,		0		/ ADDR OF TEXT STRING
	ISZ	STRCOF		/ INCR OFFSET FOR NEXT TIME
	SNA
	JMP	STRCEQ		/ DONE THIS STRING - EQUAL
	CIA			/ NEGATE
	TAD	STRCCH		/ ADD OTHER CHAR
	SNA CLA
	JMP	STRCL1		/ EQUAL, TRY NEXT CHARS

STRCNE,	ISZ	STRCMP		/ NOT EQUAL IS SKIP RETURN

STRCEQ,	.-.			/ AND DO IT
	JMP I	STRCMP		/ RETURN TO CALLER

STRCCH,	0
STRCS1,	0
STRCOF,	0

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/--------------------
	PAGE

/***************************************************************************
/***************************************************************************
/*****		D A N G E R  -  D O   N O T   M O V E                  *****
/*****								       *****
/*****   C O D E   I N T O   O R   O U T   O F   T H I S   A R E A     *****
/*****								       *****
/*****        SWAP AREA IN CONSTANT USE BY OTHER MODULES	       *****
/***************************************************************************
/***************************************************************************

/***************************************************************************
/****				MXDISP BUFFER AREA			****
/***************************************************************************

MUXBUF,	ZBLOCK 400		/ WAS 6400 AND SHOULD NOW BE 5400
				/ END IFDEF CONDOR


/***************************************************************************
/****		MENU OVERLAY AND VARIABLE STORAGE AREA			****
/***************************************************************************

	*MUBUF			/ WAS 5400 AND NOW SHOULD BE 6000

	/ THIS IS THE AREA WHERE INDIVIDUAL MENU BLOCKS ARE LOADED FOR
	/ EXECUTION BY THE MENU INTERPRETER.  THE MENU BLOCK WHICH IS
	/ ASSEMBLED HERE IS FOR STARTUP AND FINISH USING SYSTEM.

	/ MUBUF IS THE BASE ADDRESS USED BY ROUTINES TRYING TO GET MENU VALUES.
	/ FOR EXAMPLE TO GET MNTMP1 USE MUBUF+MNTMP1 FOR THE ADDRESS.

MUBUF,	RELOC 0
	CASE;MNTMP1			/ CHECK FOR TYPE OF MENU ENTRY
		0;FN1BG			/ COLD START ENTRY VALUE
		1;FN1BG			/ WARM START ENTRY VALUE	/M024
		2526;FN1S	/ FINISH USING THE SYSTEM VALUE	(WINNIE)/M024
		2525;FN1S	/ FINISH USING SYSTEM (NON-WINNIE)	/A030
				/ SEE ALSO MN1, TAGS MM1OK,MM1WIN,MM0F0K/A030

	DISP;0;TEXT '!E ILLEGAL ENTRY INTO DLMFN1';MNHALT

FN1S,	TSTBIT;MNOPTN;MNRX5X;FN1RD	/ IS WINNIE ON LINE?		/A008

	IFDEF	ENGLSH	<
	DISP;2515;TEXT '&PRESS !&RETURN TO RECALL &MASTER &MENU'
	DISP;2615;TEXT '!&OR &GOLD !&MENU TO GO TO &MAIN &MENU'		/A008
			>		/ END IFDEF ENGLISH
	IFDEF	ITALIAN <
	DISP;2505;TEXT '&PREMERE !&RITORNO PER TORNARE AL &MASTER &MENU'
	DISP;2605
TEXT '&OPPURE PREMERE &ORO &MENU PER RICHIAMARE IL &MENU &PRINCIPALE'
			>

	IFDEF V30SWE <
	DISP;2515;TEXT '&TILLBAKA TILL INLEDNINGSMENYN: TRYCK P\E RETUR'
	DISP;2615;TEXT '&TILLBAKA TILL HUVDMENYN: ANV\DND GULD MENY'		/A008
			>		/ END IFDEF V30SWE

	IFDEF V30NOR <
	DISP;2515;TEXT '&TRYKK P\E !&RETUR FOR \E F\E &STARTMENYEN'
	DISP;2615;TEXT '&EL. &GULL !&MENY FOR \E F\E &HOVEDMENYEN'
			>		/ END IFDEF V30NOR

	IFDEF DUTCH <
	DISP;2515
	TEXT '&DRUK OP !&RETURN OM TERUG TE GAAN NAAR HET &MASTER &MENU'
	DISP;2615
	TEXT '&DRUK OP &GOUD !&MENU OM TERUG TE GAAN NAAR HET &HOOFDMENU'
	>

	IFDEF SPANISH <
	DISP;2525
	TEXT '&PULSE !&RETORNO PARA VOLVER AL &MEN\Z &PRINCIPAL'
	DISP;2615
	TEXT '!&O &DORADA !&MENU PARA VOLVER AL &MEN\Z &PRINCIPAL'>


FN1RD,	READ;MNTMP1;FN1BF		/ WAIT FOR USER TO TYPE RETURN	/C038
	ARG;FN1BE;MNTMP1		/ CHECK FOR BLANK LINE		/A038

FN1ERR,	DISP;-2700;TEXT '^CG^CG'	/ ERROR - RING THE BELL		/A038
	GOTO;FN1RD			/ GO BACK AND READ AGAIN	/A038

FN1BE,	CMND;31;204;CIF 10		/ WINUTL TO BOOT WINNIE OR RX50	/C038
	RETURN								/A008

FN1BF,	CASE;MNSYSA			/ USER TYPED A GOLD KEY		/A038
	    EDMENU&3777;FN1GM		/ CHECK FOR GOLD MENU		/A038
	GOTO;FN1ERR			/ NOPE, GO REPORT THE ERROR	/A038

FN1GM,	TSTBIT;MNOPTN;MNRX4X;FN1BE	/ ARE WE BOOTING FROM WINNIE?	/C038
					/ YES, FALL THROUGH		/A038

FN1BG,	DISP;0;TEXT '![C!E!CO'		/ RESIDENT STARTUP DISPLAY	/M024

	CASE;MNTMP1			/ CHECK FOR TYPE OF MENU ENTRY	/A024
		1;FN1BG1		/ WARM START ENTRY VALUE	/A024

	SET;-1;MNDTDY			/ CLEAR DAY REGISTER		/A037

	IFDEF	ENGLSH	<
	DISP;1430;TEXT "&DIGITAL &EQUIPMENT &CORPORATION"		/M024
			>		/ END IFDEF ENGLSH

	IFDEF	ITALIAN	<
	DISP;1430;TEXT "&DIGITAL &EQUIPMENT &CORPORATION"		/M024
			>		/ END IFDEF ITALIAN

	IFDEF	DUTCH	<
	DISP;1421;TEXT "&DIGITAL &EQUIPMENT &CORPORATION"		/M024
			>		/ END IFDEF DUTCH

	IFDEF	V30SWE	<
	DISP;1430;TEXT "&DIGITAL &EQUIPMENT &CORPORATION"		/M024
			>		/ END IFDEF V30SWE
	IFDEF	V30NOR	<
	DISP;1430;TEXT "&DIGITAL &EQUIPMENT &CORPORATION"		/M024
			>		/ END IFDEF V30SWE

	IFDEF	SPANISH	<
	DISP;1430;TEXT "&DIGITAL &EQUIPMENT &CORPORATION"		
			>		/ END IFDEF SPANISH


FN1BG1,	SET;1;MNTMP1
	CMND;12;200;CIF CDF 20		/ LOAD DATE-TIME AND SYSVALS
	RETURN				/ CHAIN TO DATE-TIME OVERLAY


XTRMNU=400-.

IFZERO .-401&4000 <?TOO LARGE>

	ZBLOCK	XTRMNU		/ MOVE UP TO END OF BLOCK

/***************************************************************************
/****			USER AREA CONSTANTS				****
/***************************************************************************

X=MUBUF+MNUSRA			/ LOCATION OF THE USER AREA IN FIELD TWO

MNFNO,	0			/ FILE NUMBER, WITH DRIVE NUMBER IN BITS 0-3
MNFNO0,	0			/ "ZERO" FILE NUMBER
MNFNAM,	FNAMBF			/ ADDRESS OF FILE NAME BUFFER
MNWRDT,	0			/ WHERE DATE/TIME IS DISPLAYED OR ZERO
MNONUM,	0			/ OVERLAY NUMBER
MNOADR,	0			/ ADDRESS TO START AT
MNOFLD,	0			/ CIDF FIELD NUMBER
MNDTYR,	0			/ YEAR
MNDTMO,	0			/ MONTH
MNDTDY,	0			/ DAY
MNDTHR,	0			/ HOUR
MNDTMN,	0			/ MINUTE
MNMMSW,	0			/ SWITCH TELLING WHICH MAIN MENU TO RETURN TO

MNTMP1,	0			/ MENU TEMPORARY REGISTER NUMBER 1
MNTMP2,	0			/ MENU TEMPORARY REGISTER NUMBER 2
MNTMP3,	0			/ MENU TEMPORARY REGISTER NUMBER 3
MNTMP4,	0			/ MENU TEMPORARY REGISTER NUMBER 4
MNTMP5,	0			/ MENU TEMPORARY REGISTER NUMBER 5
MNTMP6,	0			/ MENU TEMPORARY REGISTER NUMBER 6
MNTMP7,	0			/ MENU TEMPORARY REGISTER NUMBER 7
MNTMP8,	0			/ MENU TEMPORARY REGISTER NUMBER 8
MNTMP9,	0			/ MENU TEMPORARY REGISTER NUMBER 9

MNMXDR,	0			/ MAX NUMBER OF FLOPPYS ON THE SYSTEM - 1
/D037	MNUSER,	0		/ USER NUMBER, 0 OR 1
/D037	MNUSR2,	0		/ 0 OR 2, DEPENDING ON WHICH USER
MNDRV,	0			/ DRIVE NUMBER, WITHOUT DOCUMENT NUMBER
MNDOCN,	0			/ DOCUMENT NUMBER, WITHOUT DRIVE NUMBER
MNMATH,	0			/ 1 MEANS MATH IS ACTIVE
MNLOCK,	0			/ AX log doc doc #.
				/ only valid when AX/DX is running
MNOPTN,	0			/ ANOTHER OPTIONS WORD
MNPROP,				/ PRINTER OPTIONS (SEE THE FIRST PRINTER
				/ MENU FOR DETAILS)
				/ THIS AREA IS ALSO USED FOR A SCRATCH AREA BY
				/ THE COMMUNICATIONS SETTINGS MENU OF CX

CX0DBT,	0			/ PRIMARY PORT DATA BITS.
CX0PAR,	0			/   ""     ""  PARITY.
CX0SBT,	0			/   ""     ""  STOP BITS.
CX0BAU,	0			/   ""     ""  BAUD RATE.
CX1DBT,	0			/ SECONDARY PORT DATA BITS.
CX1PAR,	0			/     ""     ""  PARITY.
CX1SBT,	0			/     ""     ""  STOP BITS.
CX1BAU,	0			/     ""     ""  BAUD RATE.
CXPORT,	0			/ PORT SELECT
CXBRTM,	0			/ BREAK TIME.
CXTMOD,	0			/ TERMINAL MODE.
CXPBAU,	0			/ PRINTER BAUD RATE.

ZBLOCK	MNSYSA-CXPBAU-1		/ RESERVE SPACE TO THE SYSTEM AREA


/***************************************************************************
/****				THE SYSTEM AREA				****
/***************************************************************************

X=MUBUF+MNSYSA			/ LOCATION OF THE SYSTEM AREA IN FIELD TWO

MNSYSA,	0			/ CHAR THAT ENDED READ (0 MEANS TOO MANY CHARS)
MNOFF,	0			/ OFFSET IN INPUT STRING TO START READ
MNPC,	0			/ MENU PC OFFSET
MNPOS,	0			/ POINTER TO FIRST CHARACTER OF NEXT SYMBOL
				/ IN THE INPUT STRING (USED BY NXTARG)

MNSP,	0			/ ADDRESS OF STACK POINTER, RETURN LABEL OR ZERO
				/ ADDRESS OF TOP OF STACK AREA (USED BY
				/ MAIN MENU TO RE-INITALIZE THE STACK POINTER)

MNSPTP,	0			/ RETURN BLOCK NUMBER

		-STRLEN+1	/ -STRLEN (NEG MAX CHARS IN INPUT BUFFER)
MNIBUF,	ZBLOCK	STRLEN+2	/ START OF SCREEN INPUT BUFFER AREA
	
		-17		/ -NUMBER OF CHARACTERS IN ARGUMENT AREA
MNARG,	ZBLOCK	20		/ ARGUMENT RETURN AREA
/D037	MNBLK,	0		/ MENU BLOCK LOADED INTO MUBUF AREA OF MEMORY
MNPULD, 0			/ SOFTWARE TYPE LOADED INTO EXTERNAL PROCESSOR
				/ BIT 11 MEANS THAT AMERICAN SPELLING IS LOADED
				/ BIT 10 MEANS THAT BRITISH SPELLING IS LOADED
				/ BIT  9 RESERVED FOR POST PROCESSING
				/ BITS 0-8 ARE UNUSED AT THIS TIME
MNLANG, 0			/ LANGUAGE SET IDENTIFIER IN TEXT MODE FORMAT
MNMUTM, 0			/ ACCUMULATOR USED FOR CLRV, INCV, AND STOV
MNUTFN,	0			/ DRIVE & FILE NUMBER FOR UTILITY PROGRAMS /A037
MNFREE,	0			/ ** UNUSED LOCATION IN MENU AREA **

/***************************************************************************
/****			START OF THE SYSTEMS OPTION AREA		****
/****	THESE VALUES ARE SET BY THE SYSTEM AND SAVED ACROSS BOOTS	****
/**** THEY ARE INITIALIZED BY 'WPUDKD.PA' AND SAVED IN THE SYSTEM AREA	****
/***************************************************************************

X=MNABRV+MUBUF			/ LOCATION OF THE OPTIONS AREA IN FIELD TWO

MNABRV,	0			/ FILENO OF ABBREVIATION DOCUMENT
MNLBRY,	0			/ FILENO OF LIBRARY DOCUMENT
MNPGSZ,	0			/ DEFAULT PAGE SIZE FOR EDITOR
MNSTAT,	0			/ SWITCH FOR STATUS LINE IN EDITOR

MNFMAT, 0			/ FORMAT WORD FOR DATE, CURRANCY, DICTIONARY
MNSDRV, 0			/ USER DRIVE SELECTION FOR SPELLING
				/ BITS 0-3 INDICATE DRIVE FOR DICTIONARY
				/ BITS 4-7 ARE NOT USED AT THIS TIME
				/ BITS 8-11 INDICATE DRIVE FOR UTILITY SOFTWARE
MNPDFN, 0			/ PERSONAL DICTIONARY DRIVE AND FILE NUMBER
MNLGFN, 0			/ EASY COMM DRIVE AND FILE NUMBER
MNADFN,	0			/ AUTODIAL DIRECTORY DRIVE & FILE NUMBER /A037
MNDSEP,	0			/ DATE SEPARATOR TYPED IN BY USER	/A024
MNXTRA,	0			/ EXTRA WORD AVAILABLE TO BE SAVED ACROSS BOOTS

/***************************************************************************
/****		THE COMMUNICATIONS PART OF THE SYSTEM OPTIONS AREA	****
/***************************************************************************

MNCMTP,	0			/ WHAT THE COMMUNICATIONS IS SET FOR
				/ 0 = NORMAL CX
				/ 1 = MAGCARD

MNXONF,	0			/ 0 = ENABLE XON/XOF PROCESSING
				/ 1 = DISABLE THE XON/XOF PROCESSING IN HANDLER
MNPRIM,	0			/ STATUS WORD FOR PORT 0; CONTAINS CHAR SIZE,
				/ PARITY,ECT. ALSO BAUD RATE TO FIND OUT
				/ WHAT THE VALUES ARE SEE WPCU3/WPCU4
				/ WHERE IT IS DISPALYED IN CU3OPT/CU4OPT
MNSECN,	0			/ BAUD RATE FOR PORT 1; FOR DETAILS
				/ ALSO LOOK AT WPCU3/WPCU4
MNPRTB,	0			/ CONTAINS PRINTER BAUD INFO. ALSO CONTAINS
				/ PORT SELECT & BREAK TIME INFO. FOR DETAILS
				/ SEE WPCU3/WPCU4
MNCXP,	0			/ THIS IS THE DOCUMENT THAT CONTAINS
				/ THE PROTOCOL - FORMAT FOR CX TO USE
				/ WHEN TRANSFERRING DOCUMENTS
MNOPTC,	0			/ UNBUNBLING OPTIONS WORD
				/ LOADED BY RD MENU

MNXDLY,	0			/ VARIABLE TIMEOUT DELAY FOR DX

MUSYSL=MNXDLY-MNABRV+1		/ LENGTH OF SYSVAL AREA


/***************************************************************************
/****		    THIS IS THE END OF THE SYSTEM AREA			****
/***************************************************************************
	RELOC

/***************************************************************************
/****	THE FOLLOWING BUFFERS ARE LOCATED HERE SO THAT THEY MAY BE	****
/****	PERSERVED ACROSS A SWAP OF THE USER AREA WITH THE MENU AREA	****
/***************************************************************************

/ LOCK WORDS FOR THE OVERLAY ROUTINE
/ THERE IS ONE LOCK WORD FOR EACH REGION OF MEMORY. THE VALUE OF A
/ LOCKWORD WILL BE EITHER A 0, MEANING NOTHING IS CURRENTLY LOADED
/ INTO THAT REGION, OR A DISK BLOCK NUMBER, THAT NUMBER BEING THE
/ FIRST BLOCK (OF THE SYSTEM FLOPPY) OF THE MODULE CURRENTLY IN THAT
/ REGION OF MEMORY. OLAY WILL LOOK AT THE LOCK WORD FOR THE MODULE
/ BEING REQUESTED TO SEE IF IT IS ALREADY LOADED.

OLL110,	0			/ FIELD 3 (USER FIELD 1) VERIFY, EDITOR,
				/ CX, MAGCARD, COPY, DX,SORT, LP (WPPARS)

OLL220,	0			/ FIELD 4 (USER FIELD 2) WPCU2, WPCU3, WPCU4,
				/ UDK, INDEX, VERIFY (BUFFER SPACE), WPCUT,
				/ CX, MAGCARD, SORT

OLL301,	0			/ FIELD 5 (USER FIELD 3) LP (WPSELC), SORT
OLL302,	0			/ FIELD 5 (USER FIELD 3) LP (OVERLAYS)

OLL400,	0			/ FIELD 6 (USER FIELD 4) MATH,SORT


/ THE FOLLOWING THREE LOCATIONS SERVE TWO PURPOSES.  THEY HOLD THE '<N>'
/ THAT PRECEEDS THE FILE NAME IN AN INDEX ENTRY, AND THE THIRD LOCATION
/ HOLDS THE NEGATIVE LENGTH (+1) OF THE INA ARGUMENT BUFFER THAT FOLLOWS.
/ **** CAUTION **** THESE LOCATIONS ARE LOADED BY THE FILE NAME PARSER

FNAMB3,	0			/ WILL CONTAIN "<-200    (LEFT BRACKET)
	0			/ WILL CONTAIN "N-200+40 (LOWER CASE "N")
FNAMB1,	0			/ WILL CONTAIN ">-200    (RIGHT BRACKET)

FNAMBF,	ZBLOCK	STRLEN		/ BUFFER CONTAINING NAME OF THE CURRENT FILE

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/--------------------
	PAGE

/***************************************************************************
/****			USER DEFINED KEY BUFFER AREA			****
/***************************************************************************

UDKSTR,	ZBLOCK 400		/ WAS 5000 AND SHOULD NOW BE 7000

/***************************************************************************
/****			WPFILS GO-TO-PAGE BUFFER AREA			****
/***************************************************************************

RPPGDS,	ZBLOCK 400		/ WAS 7400 AND SHOULD NOW BE 7400

/***************************************************************************
/****			END OF FIELD TWO BUFFER AREA			****
/***************************************************************************

