/TITLE WPCUT - COMMAND UTILITY
/	.VERSION / /
/
/	COPYRIGHT (C) 1980
/	DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS 01754
/
/	THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
/	ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE
/	INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER
/	COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
/	OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY
/	TRANSFERRED.
/
/	THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE
/	AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT
/	CORPORATION.
/
/	DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS
/	SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
/
/
/	088	EMcD	12-Sep-85	Add Nordic translations (conditionalise)
/	087	EMcD	12-Mar-85	Add DECDEV switch
/	086	HLP	05-NOV-84	Allow for future use of header wds 18,42
/	085	HLP	13-JUL-84	Fix WPSV2-60 false nonexistent printer
/	084	SBB	21-MAY-84	MAKE ROOM AND FIX SOME ERR AND GOLD RETURNS
/	083	SBB	07-MAY-84	MAKE ROOM AND ADD POST-PROCESSOR STUFF
/	082	GDH	14-FEB-84	rearranged some code to make source
/					more similar to the foreign source.
/					Deleted extraneous SPRJOB routine.
/	081	HLP	18-JAN-84	Fix bug induced on 080 where LP to
/					newly created doc was printed instead
/	080	EH	06-JAN-84	LP check for result doc 'in use' prior
/					to displaying TBO prompt
/	079	HLP	04-JAN-84	ADD MISSING CDF! (DECII-158)
/	078	HLP	08-DEC-83	Add SMTAB entry for mismatched controls
/	077	HLP	14-NOV-83	Send current SE setting to MNTMP7
/					Remove P option on SE YES
/	076	HLP	17-OCT-83	Put SL on Stop Menu
/					Make Stop Menu use MNQINI instd MNTMP4
/					since TBO uses MNTMP4 (CM1NX)
/	075	HLP	13-SEP-83	Delete PRLOCK (DECmate is single user)
/					Delete refs to D2OGET,D2OPUT,D2OCNT
/	074	HLP	10-AUG-83	LP checks doc dest in printer code
/					so escape sequences for quality mode
/					can be sent to LA50/LA100
/	073	HLP	26-JUL-83	Delete margin check on RS command
/	072	HLP	02-JUN-83	New Page not to set PRSTOP so PRTRID
/					won't abort!
/	071	HLP	23-MAY-83	Add JWAIT to CUSTOP
/					Simplify STOPPR routine
/	070	GDH	19-MAY-83	Moved PRD error menu to PR1
/	069	HLP	18-MAY-83	Delete C option from BUSY in SMTAB
/	068	HLP	16-MAY-83	Handle PRSTTS only in CUSTOP
/	067	HLP	13-MAY-83	Don't re-call stop menu if PRSTT2=1
/					Add C option to BUSY in SMTAB
/					Add code 26 comm. error in SMTAB
/					Delete unreferenced symbols
/	066	WCE	10-MAY-83	Error message bug fixes
/	065	HLP	02-MAY-83	Restore lines illegally deleted in
/					WS102 cleanup which broke LP
/	064	HLP	27-APR-83	Move CUQMCK to end of WPCUT so it
/					can share a page with WPCRE and not
/					push CUB1 past 5400.  Fixed bug where
/					SL would make disc not verify.
/					Remove WS102 conditionals
/	063	HLP	18-APR-83	Move CUBs to WPCRE
/					Add CUQMCK to check consistency of margins
/	062	HLP	01-APR-83	DELETE JSTRTs on PRJOB
/	061	HLP	21-MAR-83	Only resume on doc read error
/	060	HLP	18-FEB-83	LPONLN in printer field
/	059	HLP	10-JAN-83	Delete STSTTS, create SPRJOB to save space
/	058	HLP	10-JAN-83	Conditionalize resume on SMTAB
/	057	HLP	07-JAN-83	If PRSTTS=0 then don't stop, start printer
/	056	HLP	30-DEC-82	Allow resume non-existent printer
/	055	DFB	15-DEC-82	Fix to return if hdr blk=0
/	054	HLP	13-DEC-82	Handle change in PRSTTS when in
/					stop printer menu
/					Deleted lock code in CUSTOP
/					Use PQFRST in CUSTOP rather than MN1
/	053	HLP	13-DEC-82	Add error code 25 to SMTAB
/					Delete N from LQP02 ASF error in SMTAB
/					DELETE R,P,B,T,N from paused at boot in  SMTAB
/	052	HLP	12-DEC-82	WAITPR to exit immediatley on resume
/					remove code to reset LQPSE from WAITPR
/	051	HLP	07-DEC-82	WAITPR not call SQREST if draft printer
/					(this did NOT get into V133)
/	050	EH	03-DEC-82	Fix for RL to print documents if name
/					is greater than 31 chars in length
/	049	HLP	02-DEC-82	Add code for selective stop menu
/	048	HLP	28-NOV-82	Copy PQFRST up to stop menu
/	047	GDH	19-NOV-82	Removed LP setting PRSTTS to "-1".
/	046	HLP	01-NOV-82	Delete automatic Resume after SL
/	045	HLP	22-OCT-82	Change WAITPR routine to reset LQP02
/					and added a JWAIT to let stop ov process
/	044	GDH	20-OCT-82	Print menu changes re: list processing
/					printer validation.
/	043	HLP	06-OCT-82	Use MNTMP4 for stop menu
/	042	HLP	05-OCT-82	Move CURWBF
/	041	HLP	05-OCT-82	Copy PRQPNT up to stop menu on DD change
/	040	HLP	11-AUG-82	Changes to allow B and T after ASF error
/					WAITPR no longer sets LPDNFG
/					WAITPR issues reset via SQREST
/	039	GDH	08-APR-82	Fixed call to RL code (routine CURWGN).
/	038	WCE	26-FEB-82	MODIFIED ERROR CALL FOR FILE IN USE
/	037	GDH	18-FEB-82	ADDED "GET DENSITY" TO PRINT COMMAND
/					UTILITY.
/	036	GDH	08-FEB-82	ADDED "READ ERROR DETECTION".
/	035	GDH	21-NOV-81	BUG FIX TO WAITPR TO NOT SET PABORT
/					FLAG ON RESUME COMMAND. ALSO INCREASED
/					THE WAITPR TIME DELAY.
/	034	GDH	21-NOV-81	MADE USE OF THE PRINTER ID ROUTINE IN
/					THE PRINTER.
/	033	AJF	19-OCT-81	MADE PRTRID ROUTINE MONITOR LPDNFG
/	032	GDH	16-OCT-81	DE-IMPLEMENTED LOCK/UNLOCK CODE.
/	031	AJF	12-OCT-81	CHANGED MNSLU3 TO MNPRTB
/	030	AJF	09-OCT-81	FIXED ASF PROBLEM IN PRTRID
/	029	AJF	15-SEP-81	REPLACED DDTABL WITH SMARTER ONE
/	028	AJF	07-SEP-81	ADDED PRINTER ID ROUTINE AND DD CHECK
/	027	AJF	06-SEP-81	DELETED EXTRANEOUS FIELD STUFF
/					FROM PAGE 0 AND UNLOCK/LOCK STUFF
/					TO MAKE ROOM FOR PRINTER ID ROUTINE
/					AND DD -LPONLN CHECK ROUTINE
/	026	GDH	04-SEP-81	WPFILS CALLING SEQ CHANGES
/	025	JM	01-SEP-81	FIXED DEFAULT DD IN DDTABLE
/	024	TT	07-JUL-81	REMOVED SUPERFLUOUS CONDITIONALS
/	023	JM	02-APR-81	CHANGES FOR CANADA
/	022	JM	02-APR-81	CHANGED "TAD I (LPDNFG)" TO
/					"DCA I (LPDNFG)"
/	021	DIM	13-MAR-81	CONDITIONALIZED PERIOD OF TIME THAT
/					WAITPR WAITS FOR VT278
/	020	JM	19-FEB-81	CONDITIONALIZED CODE AT STOPRT
/					FOR THE 278
/	017	JM	06-FEB-81	MOVED CANADIAN TEXT AT CULSBT TO
/					ANOTHER PAGE TO FIX A PAGE ERROR
/	016	JM	06-FEB-81	MOVED DUTCH TEXT AT CULS5 TO ANOTHER
/					PAGE TO FIX A PAGE ERROR
/	015	DAO	7-JAN-80	CHANGED PERIOD OF TIME THAT WAITPR
/					WAITS BEFORE IT DETERMINES THAT THE
/					PRINTER IS HUNG WHEN THE USE PICKS AN
/					OPTION FROM THE STOP PRINTER MENU.
/	014	DAO	22-DEC-80	DELETED MESSAGE "ALL DOCUMENTS WAITING
/					TO PRINT ARE FOR THE SECOND USER" IN
/					THE CASE OF A VT278
/	013	DAO	18-DEC-80	CHANGED CHECKING OF IF PRINTER ON LINE
/					OR NOT IN LIST PROCESSING TO BE
/					CONSISTENT WITH THE WAY THE PRINTER
/					DOES IT. (MAINTAINING COMPATABILITY
/					WITH POSSIBLE DOCUMENT DESTINATIONS
/					IN TH RL BASE SYSTEMS)
/	012	DAO	17-DEC-80	ADDED CHANGE TO TURN OFF FLASHING LED
/					AND BUZZING WHEN GOING TO STOP PRINTER
/					MENU
/	011	DAO	4-DEC-80	DELETED EXTRA CDFMNU IN CUSL1 ROUTINE
/	010	DAO	4-DEC-80	FIXED BUG WHICH HANGS SYSTEM WHEN
/					PRINTER HAS ERROR
/	0009	DAO	18-SEP-80	MERGED WITH X3.5
/	0008	DM,JM	15-SEP-80	MERGED SCANDI AND EUROPE/ENGLISH
/	0007	REG	12-AUG-80	ADDED THIS STANDARD HEADER
/	0006	CMW	07-AUG-80	MADE GRAMMATICAL CHANGES FOR DUTCH
/	0005	DSS	09-JUL-80	MODIFIED FOR ENGLISH/FRENCH-CANADIAN
/	0004	CMW	6-MAY-80	ENTERED CANADIAN TRANSLATIONS
/	0003	DSS	17-APR-80	ENTERED DUTCH FIXES
/	0002	GLT	10-APR-80	CHANGED CODE SO GERMAN PART OF LP LISTS
/					WILL BE ABLE TO HAVE UC LETTERS.
/	0001	GLT	31-MAR-80	ADD FRENCH GERMAN DUTCH CONDITIONAL CODE
/					DIACRITICAL SUBSTITUTIONS:
/				FRENCH: "]"=L.G.E, "["=L.A.E; "&" NO MAKE CAPS
/				GERMAN: "["=L.U.A, "\"=L.U.O, "]"=L.U.U; "&" MAKE CAPS
/	QA3.5	LDB	19-APR-78	FIX LP PRINTER BUGS AND LP T OPTION
/	III.D	KEE	29-MAR-78	CLEAN UP CODE + STUFF FOR WT FILE NUMBER
/					REPRESENTATION
/	2.7-3	KEE	1/14/78		MAKE CREATE SEPERATE SOURCE FILE
/	2.7-1	LDB	11/23/77	MERGE FROM WT78 PACK
/	2.5-3	RLT	11/9/77		ADD ERROR HANDLING FOR DDNAM
/	2.5-2	RLT	11/4/77		DO REAL DD STRING FOR WT PRINT
/	2.5.1	KEE	11/4/77		FIX SL AND RL BUGS
/	2.5-1	RLT	10/21/77	MERGED FROM WT78 PACK
/	2.4D-1	LDB	10/18/77	CHG PRINTER CALLS FOR 100 & WS78 PROPORTIONAL
/	2.4D+	KEE	10/17/77	FIX REST OF SL CODE
/	2.Q-2	LDB	9/25/77		ADD PRINTER UNLOCK CODE	
/	2.Q-1	RLT	9/24/77		ELIM LQUE AND R/W PQUE FOR WT78	
/	2.P-4	RLT	9/23/77		FIX FOR WT ASM	
/	2.P-3	LDB	9/22/77		FIX LOCKS FOR CREATE & LP AND MORE RL STUFF
/	2.P-2	LDB	9/19/77		MORE RL&SL
/	2.P-1	LDB	9/16/77		PUT IN RL & SL CODE
/	2.O	MB	9/15/77		PUT IN THE 78 CHANGES
/	2.N-1	LDB	9/14/77		MOVE STUFF TO WPCU2	
/	2.N	KEE	9/9/77		ADD LOCK CODE FOR 2.5	
/	2.L-1	LDB	9/11/77		FIX LIST Q BUG
/	2.J	KEE	8/26/77		ADD 4-FLOPPY SUPPORT
/	2.G-1	MSB	8/9/77		MOVE FROM 78 TO MASTER PACK

	*200
	JMP I	.+3
	JMP I	.+1
	7600
	RXLOAD
	*RXLDLS
	RXEWT=4
	RXEWT
	0
	RXQBLK=11
	RXQBLK
	.
	DLOCUT
	100
	IFNDEF DECDEV <
	CDF 20
	>
	IFDEF DECDEV <
	CDF 40								/A087
	>
	-DSOCUT								/M026
	DLPRQ
	200
	IFNDEF DECDEV <
	CDF 10
	>
	IFDEF DECDEV <
	CDF 30								/A087
	>
	-DSPRQ								/M026
	0


	IFNDEF DECDEV <
	FIELD 1
	>
	IFDEF DECDEV <
	FIELD 3
	>
	*200
	ZBLOCK 400		/INITIALIZE WRITEOUT OF PRINT QUEUE

/THIS IS THE PATCH TO PAGE ZERO THAT WILL CONTAIN THE ROUTINES
/THAT WILL TAKE CARE OF THE CDFS AND CIFS.

	CDIF00=CDF CIF		/CONSTANT USED TO FORM A CDF CIF CALL TO CIDPAT

	IFNDEF DECDEV <
	FIELD 2
	>
	IFDEF DECDEV <
	FIELD 4
	>
	*100			/THE FIRST 100 LOCATIONS ARE USED FOR THE SYSTEM

	CDFMYF=CDFBUF		/THIS FIELD SAME AS BUFFER FIELD
	CIFMYF=CIFBUF

SPACTN,	0			/USER REQUESTED ACTION.			/A035
TENADR,	CLOCK+1			/ADDRESS OF TENTHS OF SEC (PAGE 0)

/VARIABLES FOR WAITPR ROUTINE MOVED HERE REV051

COUNT,	0			/-NUMBER OF TENTHS OF SECONDS YET TO WAIT
BUFCNT,	0			/ADDRESS (TAKEN FROM FIELD 0) OF HANDLER BUFFER COUNT
TENTH,	0			/LAST TENTH OF A SECOND
TEMP,	0			/A TEMPORARY
CUQFNO,	0
CUQFLG,	0

CUSADR,	0
CUSDIF,	0

CURWBF,	ZBLOCK 40		/ADD 1 WORD SO THAT ENDING ZERO WON'T CLOBBER
				/ANYTHING THAT FOLLOWS

IFNZRO 155-.&4000 <NOMOREROOMONPAGEZERO>
	*156			/SO WE ALWAYS KNOW WHERE QBLOCK IS
QUBLK,	DSKQUE
	0
	0
QUQBLK,				/QBLOCK-- SAVE LOTS OF LINKS BY MOVING HERE
	0			/RXQCOD	FLAGS RETURNED HERE
	0			/RXQFNC	FUNCTION CODE
	0			/RXQDN1
	0			/RXQDN2
	0			/RXQENO
	0			/RXQID1
	0			/RXQSPC
	0			/RXQCTL
	0			/RXQDRV	DRIVE NUMBER
	0			/RXQBLK	BLOCK NUMBER
	0			/RXQRS1
	0			/RXQBAD	BUFFER ADDRESS
	CDFMYF+10		/RXQBFD	BUFFER FIELD CDF
	0			/RXQTRK	TRACK
	0			/RXQSEC	SECTOR
/--------------------
	PAGE

/THIS LABEL TRIGGERS A CONDITIONAL IN WPCRE				/A054

WPCUT,	XX			/CURWPQ - READ AND WRITE PRINTER QUEUE
	JMS	CURWPQ
	CDIMNU
	JMP I	.-3

	XX			/CUPP - CREATE COMMAND
	JMS	CUPP
	CDIMNU
	JMP I	.-3

	XX			/CUQPRT - QUEUE TO PRINTER COMMAND
	JMS	CUQPRT
	CDIMNU
	JMP I	.-3

	XX			/CUSTOP - STOP THE PRINTER COMMAND
	JMS	CUSTOP
	CDIMNU
	JMP I	.-3

CULP,	XX			/CULPCM - LIST PROCESSING COMMAND
	JMS	CULPCM
	CDIMNU
	JMP I	.-3

	XX			/RESUME PRINTER
	JMS	CURPRT
	CDIMNU
	JMP I	.-3

	XX			/NEW PAGE ON PRINTER
	JMS	CUNPRT
	CDIMNU
	JMP I	.-3

CUFF,	XX			/POST PROCESS				/A083
	JMS	CPOSTP							/A083
	CDIMNU								/A083
	JMP I	.-3							/A083


CUPSOL,	XX			/SETS UP OVERLAY CHAIN INFO
	AC7775
	DCA	T1		/SET TO COPY THREE WORDS
	TAD	MNUCAL+1
	TAD	(MNONUM-1)
	DCA	X0		/TO MENU AREA
CUPSO1,	TAD I	CUPSOL		/GET NEXT WORD FROM CALLER
	ISZ	CUPSOL		/BUMP ARG PTR
	CDFMNU			/CHANGE TO MENU FIELD
	DCA I	X0		/STORE NEXT WORD IN MENU AREA
	CDFMYF			/CHANGE BACK TO MY FIELD
	ISZ	T1
	JMP	CUPSO1		/LOOP FOR ALL WORDS
	JMP I	CUPSOL		/THEN RETURN TO CALLER

/***********************************************************************

/CUNPRT--NEW PAGE ON PRINTER
/NO LONGER SETS PRSTOP ELSE PRTRID WILL ABORT				/A072

CUNPRT,	XX			/NEW PAGE ON PRINTER
	CLA
	CDFPRT			/CDF TO PRINTER
	TAD I	(PRSTTS)	/SEE IF PRINTER NOT BUSY
	SZA CLA
	JMP	CUNPR1		/BUSY, GIVE MESSAGE
	ISZ I	(PRSTTS)	/SET STATUS TO BUSY			/A072
	AC0001
	JMS	STRTPR		/GIVE NEW PAGE COMMAND
	JMP I	CUNPRT

CUNPR1,	CDFMYF
	CIFMNU
	JMS I	MNUCAL		/CALL MENU
	DLMPS3			/FOR BUSY MESSAGE
	JMP I	CUNPRT		/AND RETURN

/CUPP - CREATE COMMAND

CUPP,	0
	JMS	ADRCRT		/DO THE CREATE
	JMP	CUPRTR		/ERROR, RETURN TO MAIN MENU

	CDFMNU
	DCA I	(MUBUF+MNFNO)
	TAD I	(MUBUF+MNFNO)
	AND	P377
	DCA I	(MUBUF+MNDOCN)
	CDFMYF			/BACK TO US TO SET RETURN ADDR
	ISZ	204		/SET FOR CHAIN CALL

/- IS USED BY CREATE TO SEE WHICH OVERLAY TO CALL IN WHEN DONE
/0 = EDITOR
/1 = INDEX

	CDFMNU
	TAD I	(MUBUF+MNTMP2)
	CDFMYF
	SNA CLA
	JMP	CUPCE3		/EDITOR
	JMS	CUPSOL
	16
	200
	CIF CDF 20		/INDEX
	JMP	CUPRTR

CUPCE3,	JMS	CUPSOL
	2
	200
	CIF 10
CUPRTR,	JMP I	CUPP		/RETURN TO MAIN MENU

/A LITTLE ROUTINE TO GET THE SYSTEM VALUE LPONLN
/CALLED BY JMS GTLP RETURNS WITH LPONLN IN AC

GTLP,	XX
	CLA			/CLEAR AC
	CDFPRT			/CHANGE DATA FIELD TO PRINTER
	TAD I	(LPONLN)	/GET LPONLN
	CDFMYF			/CHANGE DATA FIELD TO MINE
	JMP I	GTLP		/RETURN TO CALLER

/ROUTINE TO READ AND WRITE THE BLOCK CONTAINING
/THE NAMES OF THE FILES IN THE PRINT QUEUE.
/CALLED WITH:
/JMS	CURDQB
/ACTION FOR RXHAN (RXERD OR RXEWT)

CURDQB,	XX			/RETURN
	CLA
	TAD I	CURDQB		/GET ACTION FOR RXHAN
	ISZ	CURDQB
	DCA	QUQBLK+RXQFNC

	JMS	CUPDRS		/SET TO SYSTEM DRIVE
	TAD	(DLPRQ)
	DCA	QUQBLK+RXQBLK
	TAD	(CUB1)
	DCA	QUQBLK+RXQBAD
	JMS	QURX
	CLA
	JMP I	CURDQB		/RETURN
/--------------------
	PAGE

/CUQPRT - QUEUE TO PRINTER COMMAND

	FHPSET=23

CUQPRT,	0
	DCA	CUQOPT
	CDFMNU
	TAD I	(MUBUF+MNFNO)
	CDFMYF
	DCA	CUQFNO
	TAD	CUQFNO
	BSW
	RTR			/POSITION DRIVE NUMBER
	JMS	CUPDRS
	TAD	(RXEDN)		/GET DENSITY OF DRIVE IN QUESTION.	/A037
	DCA	QUQBLK+RXQFNC						/A037
	JMS	QURX							/A037
	CLA			/CLEAR THE AC				/A037
	TAD	CUQFNO
	AND	P377
	DCA	QUQBLK+RXQFNO
	TAD	(RXEGF)
	DCA	QUQBLK+RXQFNC
	JMS	CUINDX		/CHECK AND READ INDEX BLK(ERR IF=0)	/A055
	TAD	(RXERD)
	DCA	QUQBLK+RXQFNC
	TAD	(CUB1)
	DCA	QUQBLK+RXQBAD	/READ INTO BUFFER 1
	JMS	QURX

	AC0001			/SET COPIES TO 1, FROM 1, TO 0
	DCA	CUB1+FHPSET+1
	AC0001
	DCA	CUB1+FHPSET+10
	DCA	CUB1+FHPSET+11
	TAD	QUQBLK+RXQBLK	/SAVE SOME VALUES FOR USE LATER
	DCA	CUQHBK
	TAD	QUQBLK+RXQDRV
	DCA	CUQHDV
	TAD	CUB1+FHPSET	/GET FIRST WORD OF OUR INFO IN HDR BLK
	SZA CLA
	JMP	CUQCPS		/ALREADY SET - SO COPY SETTINGS INTO MENU

CUQGTS,	CMA			/MAKE A NEGATIVE-1 STORED SETTING #	/C086
	DCA	CUQTMP
	TAD	(PRSETZ+2)	/ALLOW FOR FUTURE EXPANSION OF PRSETZ BY 2/C086
	ISZ	CUQTMP		/MULTIPLY DONE?
	JMP	.-2		/NO - CONTINUE ADDING SO HAVE OFFSET
	TAD	(CUB2-PRSETZ-1)	/ADD TO START OF BUFFER,WITH CORRECTION FACTOR
	/		     ^						/C086
	DCA	CUQSS1		/SAVE PTR TO SETTING FOR LATER
	TAD	(RXERD)		/SET UP TO READ THE RIGHT BLOCK
	DCA	QUQBLK+RXQFNC
	TAD	(CUB2)
	DCA	QUQBLK+RXQBAD	/READ INTO BUFFER 2
	JMS	CUPDRS		/SET TO SYSTEM DRIVE

	TAD	(DLRLRP)	/GET BLOCK NUMBER
	DCA	QUQBLK+RXQBLK
	JMS	QURX		/READ IT IN

	JMS	CUCOPY		/COPY VALUES INTO HDR
CUQSS1,	0
	CDFMYF
	CUB1+FHPSET
	CDFMYF
	PRSETZ

CUQCPS,	JMS	CUCOPY		/COPY SETTINGS FROM HDR TO MENU
	CUB1+FHPSET
	CDFMYF
	MUBUF+MNPROP
	CDFMNU
	PRSETZ

CUQCMU,	CDFMNU			/CALL MENU
	DCA I	(MUBUF+MNTMP1)	/SET REASON FOR CALL
	CDFMYF
	CIFMNU
	JMS I	MNUCAL
	DLMPR2

	CLA			/CHECK RETURNED ACTION CODE
	CDFMNU
	TAD I	(MUBUF+MNTMP1)
	CDFMYF
	TAD	(JMP I CUQATB-1)/GET JMP THROUGH TABLE
	DCA	.+1
	HLT			/DO IT

CUQATB,	CUQWOQ			/1- WRITE OUT VALUES TO HDR AND QUEUE
	CUQWON			/2- WRITE OUT VALUES TO HDR AND DON'T QUEUE
	CUQWOB			/3- WRITE OUT VALUES TO STORED SETTINGS
	CUQRDB			/4- READ IN BLOCK OF SETTINGS TO HDR
	CUQCKP			/5- CHECK PRINTER SETTING		/A044

CUQRET,	CLA
	JMP I	CUQPRT		/RETURN TO CALLER

CUQTMP,	0
CUQHBK,	0
CUQHDV,	0
CUQOPT,	0

/THIS ROUTINE STICKS AN L.G.A (ACCENTED CHAR) ON THE SCREEN FOR CANADA	/A023
/IF THE BOTTOM MESSAGE (L.P.) HAS BEEN DISPLAYED			/A023

IFDEF CANADA <								/A023
CANLGA,	XX								/A023
	AC7777			/SET AC TO -1				/A023
	TAD	CULTBO		/ADD CULTBO				/A023
	SZA CLA			/IF CULTBO NE 1				/A023
	JMP	CULT2		/THEN CONTINUE				/A023
	CIFMNU			/ELSE DISPLAY L.G.A			/A023
	JMS I	IOACAL							/A023
		0							/A023
		CULCAN							/A023
		1030		/CURSOR POS				/A023
		141		/L.G.A					/A023
	JMP I	CANLGA		/RETURN					/A023

CULCAN,	TEXT '^P^Z'							/A023
	>			/END IFDEF CANADA			/A023

CURLST,	ZBLOCK	10		/LIST OF DOCUMENTS TO BE DELETED FROM QUEUE

CUQCKP,	JMS	CULCKP		/CHECK PRINTER DESTINATION		/A044
				/RETURNS 0 FOR DD OK			/A044
				/	  1 FOR DD NON-EXISTENT		/A044
				/	  2 FOR INCORRECT PRINTER ATCHD	/A044
CUQCK1,	IAC			/MAP TO MENU PARAMETER VALU.		/A044
	JMP	CUQCMU		/BACK TO THE MENU.			/A044

CUQRDB,
	CDFMNU
	TAD I	(MUBUF+MNTMP2)
	CDFMYF
	JMP	CUQGTS		/NOW GO GET SETTING
/--------------------
	PAGE

CUQWOB,	JMS	CUQMCK		/CHECK VERTICAL MARGINS			/A063
	CDFMNU
	TAD I	(MUBUF+MNTMP2)
	CDFMYF
	CMA			/NEG-1 SETTINGS NUMBER			/C086
	DCA	T1		/MAKE COUNTER
	TAD	(PRSETZ+2)						/C086
	ISZ	T1
	JMP	.-2
	TAD	(CUB2-PRSETZ-1)						/C086
	DCA	CUQSS2

	TAD	(RXERD)		/READ BLOCK IN
	DCA	QUQBLK+RXQFNC
	TAD	(CUB2)
	DCA	QUQBLK+RXQBAD
	JMS	CUPDRS		/SET SYSTEM DRIVE AND BUFFER FIELD
	TAD	(DLRLRP)
	DCA	QUQBLK+RXQBLK
	JMS	QURX

	JMS	CUCOPY		/COPY NEW VALUES
	MUBUF+MNPROP
	CDFMNU
CUQSS2,	0
	CDFMYF
	PRSETZ

	TAD	(RXEWT+2000)	/WRITE IT BACK OUT
	DCA	QUQBLK+RXQFNC
	JMS	QURX
	JMP	CUQCMU		/CALL MENU

CUQWON,	JMS	CUQMCK		/CHECK VERTICAL MARGINS			/A063
	AC7777			/SAY NOT TO QUEUE
	JMP	CUQWQ1		/MERGE BELOW.				/A044

CUQWOQ,	JMS	CUQMCK		/CHECK VERTICAL MARGINS			/A063
	JMS	CULCKP		/CHECK LIST PROCESSING PRINTER.		/A044
	SZA			/SKIP IF EXISTENT.			/A044
	JMP	CUQCK1		/REPORT ERROR.				/A044
CUQWQ1,	DCA	CUQFLG		/SAVE WHETHER OR NOT TO QUEUE

	JMS	CUCOPY
	MUBUF+MNPROP
	CDFMNU
	CUB1+FHPSET
	CDFMYF
	PRSETZ

	TAD	CUQHBK		/SET QUEUE BLOCK VALUES
	DCA	QUQBLK+RXQBLK
	TAD	(CUB1)
	DCA	QUQBLK+RXQBAD
	TAD	CUQHDV
	DCA	QUQBLK+RXQDRV
	TAD	(RXEWT+2000)
	DCA	QUQBLK+RXQFNC
	JMS	QURX		/WRITE IT OUT
	CLA
	TAD	CUQOPT		/GET "LIST PROCESSING" FLAG.		/A044
	ISZ	CUQFLG		/ARE WE TO QUE?				/A044
	SZA CLA			/SKIP IF NOT LIST PROCESSING.		/A044
	JMP	CUQRET		/RETURN IF LIST PROCESSING OR NOT Q-ING	/A044

	CDFMNU			/SEE IF ANY FREE SPOTS IN THE QUEUE
	CLA
	TAD	(-PQSZ)
	DCA	T1
	TAD I	(PQADDR)	/GET LENGTH AND FIRST ADDR
	DCA	T2

CUQWO1,	TAD I	T2		/FIRST WORD (THE FILE NUMBER) FREE?
	SNA CLA
	JMP	CUQWO2		/YES
	ISZ	T2		/NO - SKIP OVER FLINK WORD TO NEXT ENTRY
	ISZ	T2
	ISZ	T1		/ANY MORE?
	JMP	CUQWO1		/YES

	DCA I	(MUBUF+MNTMP1)	/0 FOR NO MORE ROOM ERROR MESSAGE	/A070
	CDFMYF			/NO MORE ROOM
	CIFMNU
	JMS I	MNUCAL
	DLMPR1			/TELL USER BAD NEWS
	JMP	CUQRET

CUQWO2,	TAD	CUQFNO		/GET FILE NUMBER TO BE QUEUED
	DCA I	T2		/SAVE IN FIRST WORD OF QUEUE BLOCK
	TAD I	(PQLAST)	/GET ADDR OF LAST ENTRY IN QUEUE
	IAC			/GET FLINK WORD
	DCA	T1		/SAVE IN T1
	TAD	T2		/GET OUR ENTRY'S ADDR
	DCA I	T1		/DO THE FLINKING
	JMP	CUQWO3		/NEXT PAGE

STRTPR,	XX			/START THE PRINTER
	DCA	SPACTN		/SAVE USER ACTION.			/A035
	TAD	SPACTN		/SEND IT TO THE PRINTER.		/A035
	CDFPRT			/CDF TO PRINTER
	DCA I	(PRACTN)	/SET ACTION
	MQA
	DCA I	(PRACTV)	/AND AUX VALUE
	CDFMYF			/BACK TO OUR FIELD.			/A082
	JMP I	STRTPR		/RETURN
/--------------------
	PAGE

CUQWO3,	TAD	T2		/SET LASTP
	DCA I	(PQLAST)
	ISZ	T2		/ZERO OUR FLINK
	DCA I	T2

	TAD I	(PQADDR)	/GET ADDR OF QUEUE BLOCK START TO CALC OFFSET
	CDFMYF			/BACK TO US
	CIA			/NEGATE
	TAD	T2		/SO WE GET OUR THING MINUS START
	CLL RTL			/MULT BY 16 (ENTRY NUMBER TIMES 32.)
	CLL RTL
	AND	(3740)		/MAKE INTO OFFSET FROM BUFFER FOR NAME
	TAD	(CUB1)
	DCA	CUQWO5		/SAVE IN COPY CALL

	TAD	(RXERD)		/SET UP READ OF QUEUE NAME BLOCK
	DCA	QUQBLK+RXQFNC
	TAD	(DLPRQ)
	DCA	QUQBLK+RXQBLK
	JMS	CUPDRS		/SET TO SYSTEM DRIVE
	JMS	QURX		/READ IT INTO BUF1

	CLA			/GET ADDR OF FILE NAME
	CDFMNU
	TAD I	(FNAMSP)
	CDFMYF
	DCA	CUQWO4

	JMS	CUCOPY		/COPY NAME INTO BUFFER
CUQWO4,	0			/WHERE IT COMES FROM
	CDFMNU
CUQWO5,	0			/WHERE IT GOES
	CDFMYF
	37			/ONLY FIRST 31. CHARS, LAST STAYS ZERO
	JMS	CUQWO6		/MAKE SURE EVERY NAME ENDS WITH A SPACE /A050

	TAD	(RXEWT+2000)	/NOW WRITE IT BACK OUT
	DCA	QUQBLK+RXQFNC
	JMS	QURX
	JMP	CUQRET		/DONE

/THIS SUBROUTINE IS ENTERED WHEN THE USER HAS SELECTED AN OPTION FROM
/THE STOP PRINT MENU. IT WILL POLE THE PRACTN FLAG AND EXIT WHEN IT WAS
/CLEARED.  IF NUMTEN/10  SECONDS OF REAL TIME PASSES AND THE NUMBER IN
/BUFCNT HAS NOT CHANGED, THE PABORT FLAG IS SET (BECAUSE THE PRINTER IS
/PROBABLY OFF LINE).  THIS TELLS THE PRINTER CODE TO ABORT. THE PRINTER CODE
/WILL THEN SET THE PRACTN FLAG AND THIS ROUTINE WILL EXIT NORMALLY.

/A) THE PRINTER IS OFF LINE      AND
/B) THE USER HAS SELECTED AN OPTION FROM THE STOP PRINT MENU

/CONSTANTS
/HBCNT:		IN FIELD 0, POINTS TO ADDRESS OF HANDLER BUFFER COUNT

NUMTEN= -36			/NUMBER OF TENTHS OF SECONDS TO WAIT	/M035
				/CHANGED TO 3.0 SECS.			/M035
				/AND SEE IF HUNG
WAITPR,	XX
WAITP1,				/ADDED LABEL TO AVOID PROBLEMS		/A040
	CDFSYS			/CHANGE TO SYSTEM DATA FIELD		/M010
	TAD I	(HBCNT)		/GET ADDRESS OF HANDLER BUFFER COUNT
	DCA	TEMP		/SAVE TO INDIRECT THROUGH
	TAD I	TEMP		/GET THE BUFFER COUNT
	CDFMYF			/CDF BACK TO MY FIELD
	DCA	BUFCNT		/AND STORE IN BUFCNT
	TAD	(NUMTEN)	/NOW GET HOW MUCH TIME TO WAIT
	DCA	COUNT		/AND STORE IN COUNT

WATPR,	CDFPRT			/CDF TO PRINTER FIELD
	TAD I	(PRACTN)	/DONE YET?
	CDFMYF
	SNA SPA CLA		/SKIP IF AC GREATER THAN ZERO		/C040
	JMP I	WAITPR		/EXIT IF DONE
	CIFSYS
	JWAIT			/ELSE WAIT
				/NOW CHECK TIME

/IF THE SAVED ACTION WAS RESUME, THEN ENOUGH JWAITS			/A045
/HAVE OCCURED TO LET THE STOP OVERLAY PROCESS THE ACTION		/A045
/SO EXIT NOW								/A045

	TAD	(-6)		/CHECK FOR 'RESUME' ACTION		/A035
	TAD	SPACTN							/A035
	SNA CLA			/SKIP IF NOT RESUME. ABORT PRINTER	/A035
	JMP I	WAITPR		/JUST RETURN IF RESUME		/A035	/C079

	CDFSYS			/CDF TO FIELD 0
	TAD I	TENADR		/GET TENTHS OF A SECOND
	CDFMYF
	CIA
	TAD	TENTH		/IF TENTHS IS SAME
	SNA CLA
	JMP	WATPR		/THEN JUMP TO WATPR
	CDFSYS			/ELSE CDF TO SYS
	TAD I	TENADR		/GET NEW TENTHS
	CDFMYF			/CDF BACK TO MY FIELD
	DCA	TENTH		/AND STORE NEW TENTHS
	ISZ	COUNT		/INCREMENT COUNT
	JMP	WATPR		/IF TIME NOT UP THEN JUMP TO WATPR

/AT THIS POINT THE TIMER HAS EXPIRED					/A045

	TAD	BUFCNT		/GET SAVED HANDLER BUF COUNT
	CLL CIA
	CDFSYS
	TAD I	TEMP		/COMPARE WITH NEW BUF COUNT
	SZA CLA			/IF BUF COUNT HAS CHANGED /ADDED CLA	/V045
	JMP	WAITP1		/THEN REENTER ROUTINE

/AT THIS POINT THE BUFFER COUNT HAS NOT CHANGED				/A045
/AND THE TIME IS UP							/A045

	CDFPRT
	TAD I	(PABORT)	/SEE IF ABORT FLAG IS SET		/A052
	SZA CLA								/A052
	JMP	WAITP3		/YES, GO RESET HANDLER BUFFER		/A052
	AC0001			/SO SET THE ABORT FLAG
	DCA I	(PABORT)
	CDFMYF			/AND DO A JWAIT				/A045
	CIFSYS								/A045
	JWAIT								/A045
	JMP	WAITP1		/GO TRY AGAIN				/A052

/RESET THE HANDLER POINTERS						/A052

WAITP3,	CDFMYF			/!!! *** (DECII-158) *** !!!		/A079
	CIFSYS			/LET THE HANDLER DO IT			/A075
	AC7777			/BY CALLING WITH NEG. AC		/A075
	LPTOU			/CALL HANDLER				/A075
	CIFSYS								/A052
	JWAIT								/A052

	JMP I	WAITPR		/AND RETURN				/A045

/THIS ROUTINE IS HERE BECAUSE IT DOESN'T FIT WHERE IT BELONGS		/A084

SAMFIL,	XX			/HERE TO SEE IF SOURCE AND RESULT  =	/A084
	CDFMNU			/NOW SEE WHAT CAME FROM MENU INPUT	/A084
	AC0004			/NEED TO RESTORE FLAG RESET BY 1ST LP2	/A084
	DCA I	(MUBUF+MNTMP4)	/TO XFER AND RETURN TO/FROM TBO MENU	/A084
	TAD I	(MUBUF+MNFNO)	/FOR RESULT FILE NAME			/A084
	CIA			/NEGATE IT FOR TEST			/A084
	CDFMTH			/READ-ONLY-FILE # WAS STORED HERE	/A084
	TAD I	(7500)		/HERE TO BE SPECIFIC			/A084
	CDFMYF			/NEED TO BE WHERE WE ARE		/A084
	SZA CLA			/SKIP IF SAME FILE FOR SOURCE & RESULT	/A084
	JMP I	SAMFIL		/JUST LEAVE NOW. IS OK			/A084
	CIFMNU			/GO CALL A LIST PROCESSING ERR MESSAGE	/A084
	JMS I	MNUCAL		/GO USE THIS ERROR MENU			/A084
	DLMCR2			/GIVES NO CHOICE BUT RETURN		/A084
	JMP	RESRPT		/GIVE ANOTHER CHANCE (OR GOLD MENU)	/A084

/--------------------
	PAGE

/BUFFERS CUB1 AND CUB2 MOVED TO WPCRE, CONDITIONALIZED ON IFDEF WPCUT	/A063

/************************************************************************
/	CUSTOP--STOP THE PRINTER COMMAND
/	THIS ROUTINE IS CALLED WHEN THE USER HITS S FROM
/	MAIN MENU TO PUT UP THE STOP MENU
/	THE SELECTIONS ON THE STOP MENU ARE DEPENDENT ON
/	TWO PARAMETERS:  1) WHETHER OR NOT THE PRINT QUEUE
/	IS EMPTY, AND  2) THE ENTRIES IN A TABLE INDEXED
/	BY THE ERROR CODE.   IF THE QUEUE IS EMPTY, THEN
/	THE ONLY OPTIONS WHICH APPEAR ON THE MENU ARE S AND L.

/	A071...PRSTOP IS SET FIRST.  THEN WE HAVE SOME JWAITS
/	SO THE PRINTER CODE CAN SEE THAT WE WANT TO STOP
/	IF THE PRINTER CODE IS DOING AN ID IT WILL DECLARE
/	A NON EXISTENT PRINTER WHEN IT SEES THE STOP FLAG
/	AND THE STATUS WILL BE UPDATED BEFORE WE TAKE THE
/	SNAPSHOT FOR THE MENU.						/C071
/************************************************************************

	CDFQUE=CDFMNU							/A048

CUSTOP,	XX
	JMS	STOPPR		/STOP THE PRINTER			/A071
CUSL1,	CDFPRT			/CDF TO PRINTER
	TAD I	(PRSTTS)	/GET STOP REASON
	CDFMNU
	DCA I	(MUBUF+MNQINI)	/SAVE FOR MENU				/C076
	CDFQUE								/A048
	TAD I	(PQFRST)	/SEE IF ANYTHING IN QUEUE		/A048
	CDFMNU			/IF THERE IS				/A048
	SNA CLA			/SET UP THE QUEMASK			/A054
	TAD	(2020-7777)	/2020 ALLOWS ONLY N			/A054
	TAD	(7777)		/INITIALIZE VALID ACTIONS		/A058
	DCA	X5							/A058
	TAD I	(MUBUF+MNQINI)	/GET STOP REASON			/C076
	SNA			/IF PRINTER IS NOT IN USE		/A057
	JMP	CUSL2M		/BYPASS STOPPING PRINTER		/A057

/WE READ SMTAB TO DETERMINE WHAT OPERATOR RESPONSES ARE ALLOWED		/C068

	JMS	VACHK		/CHECK FOR VALID ACTION			/A058
	CDFMNU								/A049
	DCA I	(MUBUF+MNTMP6)	/PASS VALUE TO MENU			/A049
	CDFPRT								/A041
	TAD I	(PRQPNT)	/PICK UP DOCUMENT DESTINATION		/A041
	CDFMNU								/A041
	DCA I	(MUBUF+MNTMP3)	/PASS TO MNTMP3				/A041
	CDFPRT								/A077
	TAD I	(PRQPNT-3)	/PICK UP CURRENT SE SETTING		/A077
	CDFMNU								/A077
	DCA I	(MUBUF+MNTMP7)	/AND SEND UP TO MENU			/A077

CUSL2M,	CDFMYF			/BYPASS JMS	STOPPR			/A057
	CIFMNU			/CALL THE MENU
	JMS I	MNUCAL
	DLMPS1			/WITH PRINTER STOP MENU AS ARG

/THE USER NOW RESPONDS TO THE STOP MENU					/A054

	CDFMNU			/LOOK AT RESULTS
	TAD I	(MUBUF+MNQINI)	/FIRST, SEE IF WAS NOT IN USE		/C076
	SNA CLA								/A057
	JMP	CUSNIU		/WAS, GO RESET PRSTOP & EXIT		/C085
	TAD I	(MUBUF+MNTMP5)
	SPA			/CHECK FOR LIST QUEUE (-1)
	JMP	CUSLQ		/YES
	SNA
	JMP	CUSTQT
	TAD	(-10)		/SEE IF SL				/A076
	SNA								/A076
	JMP	CUSSL		/YES					/A076
	IAC			/NO, BUMP UP TO RESUME (-6)		/A076
	IAC								/A076
	SNA			/SKIP IF NOT RESUME
	JMP	CUSL3		/LET RESUME CODE PROCESS
	TAD	(6)		/NO, GET BACK AND FEED TO PRINTER
	MQL
	TAD I	(MUBUF+MNTMP2)
	SWP
	JMS	STRTPR		/START PRINTER
CUSL4,	JMS	WAITPR		/WAIT FOR DONE
	CDFPRT			/CDF TO PRINTER
	TAD I	(PRSTOP)	/STILL STOPPED?
	SZA CLA
	JMP	CUSL1		/BACK TO MENU IF SO

CUSTQT,	CDFMYF			/RETURN TO MAIN MENU
	JMP I	CUSTOP		/ALL DONE

CUSL3,	JMS	CURPRT		/DO A RESUME
	JMP	CUSTQT		/AND GO RETURN				/A052

CUSLQ,	CDFMYF			/BACK TO OUR FIELD
	JMS	CURDQB		/READ QUEUE BLOCK WITH NAMES
	RXERD
	TAD	(605)		/INIT LINE FOR OUTPUT
	DCA	CUSLIN
	CDFMNU
	TAD I	(PQFRST)
	CDFMYF			/GET ADDR OF FIRST ENTRY IN QUEUE
	SNA
	JMP	CUSWAT		/NONE - WAIT FOR RETURN
	JMP	CUSLQ1		/GO TO ANOTHER PAGE COURTESY BUCK ROGERS

CUSSL,				/SL FROM STOP MENU			/A076
	JMS	CURWPQ		/CALL THE RL/SL SUBROUTINE FOR SL	/A076
	JMP	CUSL1		/RETURN TO STOP PRINTER MENU		/A076

/THIS CODED ADDED TO FIX WPWV2-60; S RETURN (THE PRINTER IS NOT IN
/USE), RETURN (TO MAIN MENU), N RETURN (GAVE NEW PAGE AND
/"PRINTER STOPPED" (NON EXISTENT PRINTER)

CUSNIU,	CDFPRT			/PRINTER NOT IN USE			/A085
	DCA I	(PRSTOP)	/RESET STOP FLAG			/A085
	JMP	CUSTQT		/GO EXIT CUSTOP				/A085

/***********************************************************************
/VACHK--VALID ACTION CHECK
/THIS ROUTINE READS THE SMTAB AND PERFORMS A CONJUNCTION OF X5 AND THE
/TABLE ENTRY. IT IS ENTERED WITH THE INDEX OF THE TABLE IN THE AC AND
/THE SIX BIT CONJUNCTION RESULT IS IN THE AC UPON EXIT.
/***********************************************************************

VACHK,	XX			/VALID ACTION CHECK			/A058
	CDFMYF								/A054
	TAD	(SMTAB-1)	/ADD TO TABLE BASE			/A054
	DCA	X4		/SAVE IN AN INDEX REGISTER		/A054
	TAD I	X4		/READ THIS ENTRY			/A054

/NOW PERFORM THE CONJUNCTION						/A054
	AND	X5		/BOTH MUST BE 1 TO BE ALLOWED		/A054
	DCA	X5		/AND SAVE THE RESULT			/A054

/NOW PICK THE CORRECT HALF OF THE WORD					/A054
	JMS	GTLP		/SEE WHAT KIND OF PRINTER IS ON LINE	/C058
	AND	(LQPSE)		/SEE IF IS LQPSE			/A060
	CIA								/A060
	TAD	(LQPSE)							/A060
	CLL			/CLEAR LINK				/A060
	SZA CLA								/A060
	STL			/IF NOT LQPSE, SET THE LINK		/A060
	TAD	X5		/GET THE TABLE ENTRY BACK		/A049
	SZL			/SKIP IF LQPSE				/A049
	BSW			/SWAP FOR LPQ02 OR DP			/A049
	AND	P77		/MASK					/A049
	JMP I	VACHK							/A058
/--------------------
	PAGE

/CULPCM - LIST PROCESSING START COMMAND

CULPCM,	XX
	CLA
	CIFMNU
	JMS I	MNUCAL
	DLMLP1			/PUT UP FIRST MENU

	DCA	FORMNO		/ZERO FILE NUMBERS FOR ERROR RECOVERY
	DCA	OTFIL
	DCA	LSTFIL
	DCA	CULSFO

	CDFMNU
	TAD I	(MUBUF+MNTMP3)
	CDFMYF			/GET RETURNED VALUE
	SNA
	JMP	CULRT1		/GOLD MENU - JUST RETURN
	DCA	CULACT		/SAVE AS ACTION DESIRED

	CDFMNU			/GET ADDR OF FILENO
	TAD I	(FNAMSP)
	CDFMYF
	DCA	CULFNM

	AC7776			/SEE IF 2 (MEANING TO PRINTER)
	TAD	CULACT
	SZA
	JMP	CULPC1		/NO
	CDFPRT			/YES, SEE IF PRINTER IDLE
	TAD I	(PRSTTS)
	CDFMYF			/SAVES 2 OF THESE ON NEXT PAGE		/A084
	SZA CLA
	JMP	CULPSB		/NO, TELL USER IT'S BUSY
	JMP	CULPC0

CULRT1,	JMP I	CULPCM		/RETURN TO CALLER

	IFDEF DUTCH <							/A016
CULS5,	TEXT "AFGEDRUKT"						/A016
	>	/END IFDEF DUTCH					/A016

CUSAGN,	CDFMNU
	TAD I	CUSADR
	CDFMYF			/GET ENTRY IN QUEUE
	SNA
	JMP	CUSWAT		/DONE
	DCA	T1
	TAD	T1
	AND	P377
	DCA	CUSFNO		/SAVE FILENO FOR OUTPUTTING
	TAD	T1
	BSW
	RTR
	AND	(17)
	DCA	CUSDR2		/SAVE DRIVE NUMBER FOR OUTPUT
	TAD	CUSADR
	TAD	CUSDIF		/CALC NAME ADDR
	CLL RTL
	CLL RTL
	TAD	(CUB1)
	DCA	CUSSAD

	CIFMNU
	JMS I	IOACAL
	0
	CUSSTG			/OUTPUT INFO
CUSLIN,	0
CUSDR2,	0
CUSFNO,	0
CUSSAD,	0

	AC0100			/INCR LINE NUMBER
	CLL RAL
	TAD	CUSLIN
	DCA	CUSLIN
	ISZ	CUSADR		/DO FLINK STUFF

	CDFMNU
	TAD I	CUSADR
	CDFMYF
	SNA
	JMP	CUSWAT		/NONE - DONE
	DCA	CUSADR		/NEXT ENTRY
	JMP	CUSAGN

CUSSTG,	TEXT '^P(^D.^D) ^A'

CUSLQ1,	DCA	CUSADR		/SAVE PQFRST
	CDFMNU
	TAD I	(PQADDR)
	CDFMYF
	CIA			/GET DIFFERENCE TO CALC POSITION
	DCA	CUSDIF
	JMP	CUSAGN

CUSWAT,	CIFMNU
	JMS I	MNUCAL
	DLMPS2			/WAIT FOR RETURN

	JMP	CUSL1		/DONE - BACK TO STOP MENU

/**********************************************************************
/SMTAB--SELECTIVE STOP MENU TABLE
/TABLE IS INDEXED BY PRSTTS. THE ENTRIES ARE BIT PATTERN SELECTORS FOR
/EACH OPTION ON THE STOP MENU, WHETHER OR NOT IT GETS DISPLAYED AND IS
/THEREFORE ALLOWED ONLY ALLOWED OPTIONS ON THE MENU ARE DISPLAYED THE
/TABLE IS DIVIDED IN HALF BITWISE THE LEFT HALF SERVES THE LQP02 AND
/DRAFT PRINTERS THE RIGHT HALF SERVES THE LQPSE THE SIX BITS OF EACH
/HALF WORD ARE ORGANIZED THUSLY:

	R=01	/LSB
	P=02
	B=04
	T=10
	N=20
	C=40
/	S AND L ARE ALWAYS ALLOWED
/***********************************************************************

SMTAB,				/SELECTIVE STOP MENU TABLE		/A049

		   7777		/0 -- NOT IN USE:
				/0 - A FULL LINE SO IF THERE IS NO 2ND ERROR
				/WE WILL NOT DISABLE OTHER OPTIONS
	R+P+B+T+N^100+R+P+B+T+N /1 - BUSY			/C067	/C069
	R+P+B+T+N^100+R+P+B+T+N	/2 - USER REQUEST
	    R+P+N^100+R+P+N	/3 - SE FIRST
	  R+B+T+N^100+R+B+T+N	/4 - SE YES				/C077
	R+P+B+T+N^100+R+P+B+T+N	/5 - END OF PAGE
	R+P+B+T+N^100+R+P+B+T+N	/6 - TWO WHEEL CHANGE
		R^100+R		/7 - NON EXISTENT PRINTER		/C056
	      R+C^100+R+C	/10 - CHANGE DOCUMENT DESTINATION
		0^100+0		/11 - PAUSE ON AT PRTID
		R^100+R		/12 - COMM BUSY
		0^100+0		/13 - MALFUNCTION (HANDLER ABORT)
		0^100+0		/14 - MALFUNCTION
	R+P+B+T+N^100+R+P+B+T+N	/15 - PAUSE SWITCH ON
	R+P+B+T+N^100+R+P+B+T+N	/16 - RIBBON OUT
	  R+P+B+T^100+R+P+B+T	/17 - LQP02 ASF ERROR
	R+P+B+T+N^100+R+P+B+T+N	/20 - COVER OPEN
	R+P+B+T+N^100+R+P+B+T+N	/21 - PAPER OUT
		R^100+R		/22 - DOCUMENT READ ERROR		/C061
		0^100+0		/23 - SYSTEM DISK READ ERROR
		0^100+B+T	/24 - LQPSE ASF ERROR
		0^100+0		/25 - LQPSE CANCEL RECEIVED		/A053
	      B+T^100		/26 - COMMUNICATIONS ERROR		/A067
		0^100+0		/27 - MISMATCHED CONTROLS		/A078
/--------------------
	PAGE

CULPSB,	AC3777			/SET FLAG FOR BUSY MESSAGE
	CDFMNU
	DCA I	(MUBUF+MNTMP2)
	CDFMYF
	CIFMNU
	JMS I	MNUCAL		/CALL MENU
	DLMLP4
CULRET,	JMP	CULRT1		/MADE INTO COMMON EXIT POINT		/M083

CULPC1,	IAC			/SEE IF 1 (MEANING JUST DO SPEC CHECKING)
	SNA CLA
	JMP	CULGSP		/GET SPEC

/	***************   HANDLE THE LIST FILE NAME   ***************	/A066

CULPC0,	
CULPC2,	AC0001			/GET LIST DOCUMENT NAME AND NUMBER
	JMS	CULMCL		/COPY NAME AND NUMBER
	TAD I	(MUBUF+MNFNO)	/GET NUMBER
	CDFMYF
	DCA	LSTFIL		/SAVE THE LIST FILE NUMBER
	TAD	CULFNM		/PATCH COPY COMMAND TO PICK UP STUFF
	DCA	CULL1
	JMS	CUCOPY		/COPY NAME TO OUR FIELD
CULL1,	0
	CDFMNU
	CULLFN
	CDFMYF
	STRLEN

/	***************   HANDLE THE SPEC FILE NAME   ***************	/A066

CULGSP,	AC0002			/GET SPEC
	JMS	CULMCL		/CALL APPROPRIATE MENU
	TAD I	(MUBUF+MNFNO)	/PICK UP THE SPEC FILE NUMBER
	CDFMYF
	JMS	FILCHK		/CHECK TO SEE IF IT IS ALREADY IN USE	/A066
	JMP	CULGSP		/YES IT WAS, GO ASK FOR ANOTHER NAME	/A066
	DCA	CULSFO		/SAVE THE SPEC FILE NUMBER		/A066

	TAD	CULFNM		/GET POINTER TO FILE NAME BUFFER
	DCA	CULL1A		/STORE FOR COPY ROUTINE
	JMS	CUCOPY		/COPY THE NAME
CULL1A,	0
	CDFMNU
	CULSPN
	CDFMYF
	STRLEN

	AC7777			/CHECK IF SPEC (MEANING DONE)
	TAD	CULACT
	SNA CLA
	JMP	CULTSP		/YES - JUST TEST SPEC

/	***************   HANDLE THE FORM FILE NAME   ***************	/A066

CULFOR,	AC0003			/GET FORM NAME AND NUMBER		/M066
	JMS	CULMCL
	TAD I	(MUBUF+MNFNO)	/PICK UP THE FORM FILE NUMBER
	CDFMYF
	JMS	FILCHK		/CHECK TO SEE IF IT IS ALREADY IN USE	/A066
	JMP	CULFOR		/YES IT WAS, GO ASK FOR ANOTHER NAME	/A066
	DCA	FORMNO		/SAVE THE FORM FILE NUMBER

	TAD	CULFNM		/GET POINTER TO FILE NAME BUFFER	/A027
	DCA	CULL2		/STORE FOR USE OF COPY ROUTINE
	JMS	CUCOPY
CULL2,	0
	CDFMNU
	CULFFN
	CDFMYF
	STRLEN

	AC7776
	TAD	CULACT		/SEE IF TO PRINTER
	SZA CLA
	JMP	CULTOD		/NO - TO DOCUMENT
	DCA	OTFIL		/TELL MERGER ROUTINE
	AC0001
	JMS	CUQPRT		/CALL PRINT COMMAND
	TAD	CUQFLG
	SZA CLA
	JMP	CULTTS		/NO - TIME TO START?
CULABT,	JMP	CULRET		/DONE

CPOSTP,	XX			/HERE FOR POST PROCESSING		/A083
	CDFMNU			/NEED TO GET AT MENU FLD		/A083
	TAD I	(MUBUF+MNFNO)	/CONTAINS DRV AND FILE NO		/A083
	CDFMTH			/MATH FLD IS SAME AS WPSFF AND WPSPEL	/A083
	DCA I	(7500)		/WPSFF WILL NEED THIS IN  FLD 6		/A083
	TAD I	(7500)		/NEED IT AGAIN				/A084
	CDFMYF			/IF I HAD A $ FOR EACH 1 OF THESE I 4GOT/A084
	CIFFIO			/AM GOING TO GO TO FLD 7		/A084
	FILEIO			/WHERE THIS ROUTINE IS			/A084
	XRDFIN			/OPEN FILE FOR READ ONLY		/A084
	CDFFIO			/NOW REF RESULT OF THIS CALL		/A084
	TAD I	(RDFSIZ)	/THIS LOC HOLDS # OF FREE BLKS ON DSKET /A084
	CIA			/MAKE IT NEG				/A084
	CDFMYF			/NEED TO BE WHERE WE ARE		/A083
	DCA	CUFSIZ		/SAVE FOR LATER TEST			/A084
RESRPT,	CIFMNU			/GET READY FOR "RESULT" MENU		/A083
	JMS I	MNUCAL		/GO TO IT				/A083
	DLMLP2			/THERE IS  STILL A 4 IN MNTMP4		/A083
	JMS	SAMFIL		/CK THAT RESULT FILE NOT = SOURCE FILE	/A084
		/** WARNING** ERROR RETURN IS TO RESRPT ABOVE		/A084
	CDFMNU			/TO PICK UP MNU RESPONSE		/A083
	TAD I	(MUBUF+MNTMP3)	/WAS -1  FOR NON-EXIST FILE		/A083
	CDFMYF			/BACK HERE				/A083
	SNA			/WAS 0 FOR GOLD MENU			/A084
	JMP	POSTEX		/LEADS BACK TO MAIN MENU		/A084
	SMA CLA			/SKIP TO CREATE NEW FILE		/A083
	JMP	CRTSKP		/DONT NEED TO CREATE A NEW FILE		/A083
	JMS	ADRCRT		/GO CREATE DESIRED FILE	ALLOCATION	/A083
	JMP	CRTERR		/MNTMP1 HAS BEEN SET FOR ERRORTYPE	/A083
	CDFMNU			/I THINK THE AC CONTAINS DOC #		/A083
	DCA I	(MUBUF+MNFNO)	/PLUG IN FOR SUBSEQUENT OPEN		/A083
CRTSKP,	CDFMNU			/NEED WHEN HERE BY JMP CRTSKP		/A084
	TAD I	(MUBUF+MNDRV)	/NEED DRIVE # FOR SPACE REMAINING TEST	/A084
	CDFMYF			/NEVER FORGET TO COME BACK TO WHERE U R	/A083
	DCA	CUPDRV		/SIZE TEST LOOKS HERE FOR DRIVE #	/A084
	JMP	CONTAP		/CONTINUE ON A PAGE THAT HAS ROOM	/A084

POSTEX,	JMP I	CPOSTP		/NEED COMMON EXIT ON THIS PAGE(INCL.ERR	/A084

	IFDEF CANADA <							/A017
CULSBT,	TEXT "AJOUT[   LA FIN DU "					/M023
		>	/END IFDEF CANADA				/A017
/--------------------
	PAGE

/SUBROUTINE TO CHECK IF THE SPECIFIED FILE NUMBER HAS ALREADY		/A066
/BEEN SPECIFIED AS AN INPUT FILE BY THE USER.  IT CHECKS THE		/A066
/FILE NUMBER AGAINST THE LIST DOCUMENT, SPEC DOCUMENT AND THE		/A066
/FORM DOCUMENT NUMBER.  THE CALLING CONVENTION IS AS FOLLOWS:		/A066
/	TAD	FILE-NUMBER-TO-CHECK					/A066
/	JMS	FILCHK							/A066
/	ERROR-RETURN		/LOCATION FOR FILE ALREADY IN USE	/A066
/	NORMAL-RETURN		/AC CONTAINS FILE NUMBER		/A066

FILCHK,	XX			/CHECK IF FILE NUMBER HAS BEEN USED	/A066
	CIA			/MAKE FILE NUMBER NEGATIVE		/A066
	DCA	T1		/STORE NUMBER FOR CHECKS BELOW		/A066

	TAD	LSTFIL		/GET THE LIST FILE NUMBER		/A066
	TAD	T1		/COMBINE WITH FILE NUMBER TO BE CHECKED	/A066
	SNA CLA			/SKIP IF NUMBERS ARE DIFFERENT		/A066
	JMP	FILERR		/MATCH - GO REPORT THE ERROR		/A066

	TAD	CULSFO		/GET THE SPEC FILE NUMBER		/A066
	TAD	T1		/COMBINE WITH FILE NUMBER TO BE CHECKED	/A066
	SNA CLA			/SKIP IF NUMBERS ARE DIFFERENT		/A066
	JMP	FILERR		/MATCH - GO REPORT THE ERROR		/A066

	TAD	FORMNO		/GET THE FORM FILE NUMBER		/A066
	TAD	T1		/COMBINE WITH FILE NUMBER TO BE CHECKED	/A066
	SNA CLA			/SKIP IF NUMBERS ARE DIFFERENT		/A066
	JMP	FILERR		/MATCH - GO REPORT THE ERROR		/A066
	ISZ	FILCHK		/BUMP RETURN ADDRESS TO SUCCESS RETURN	/A066
	TAD	T1		/GET THE FILE NUMBER TO BE CHECKED	/A066
	CIA			/RETURN IT TO IT'S CORRECT FORM		/A066
	JMP I	FILCHK		/GO RETURN TO CALLER			/A066

FILERR,	CIFMNU			/'THIS FILE IS ALREADY IN USE' MESSAGE	/A066
	JMS I	MNUCAL		/CALL THE MENU OUTPUT ROUTINE		/A066
	DLMCR2								/A066
	JMP I	FILCHK		/ERROR RETURN TO SELECT NEW NAME	/A066

/	***************   HANDLE THE RESULT FILE NAME   ***************	/A066

CULTOD,	AC0004			/GET RESULT DOCUMENT NAME AND NUMBER
	JMS	CULMCL

	AC0001								/A080
	TAD I	(MUBUF+MNTMP3)	/SEE IF SHOULD CREATE FILE		/A080
	SNA CLA								/A080
	JMP	CULTD0		/CREATE THE FILE			/A080

	CDFMNU								/M080
	TAD I	(MUBUF+MNFNO)	/PICK UP THE OUTPUT RESULT FILE NUMBER	/M080
	CDFMYF								/M080

	JMS	FILCHK		/CHECK TO SEE IF IT'S ALREADY IN USE/A066/M080
	JMP	CULTOD		/YES IT WAS, GO ASK FOR ANOTHER NAME/A066/M080
	DCA	OTFIL		/SAVE THE OUTPUT RESULT FILE NUMBER	/M080

	TAD	(5)		/CHECK FOR TOP,BOTTOM,OVERWRITE		/A080
	JMS	CULMCL							/A080

	JMP	CULTD1		/DON'T CREATE THE FILE

CULTD0,	CDFMYF
	AC7777			/SET FOR OVERWRITE
	DCA	CULTBO

	JMS	CULCRE		/CREATE THE DOCUMENT, RETURN WITH FILE NUMBER
	DCA	OTFIL		/SAVE NEW FILE INFO			/A081
	JMP	CULTD2		/JOIN COMMON CODE

CULTD1,	TAD I	(MUBUF+MNTMP1)	/SAVE TOP, BOTTOM, OVERWRITE
	CDFMYF
	DCA	CULTBO
	AC7776
	TAD	CULTBO
	SNA CLA			/SEE IF GOLD MENU ?
	JMP	CULTOD		/YES, GIVE ANOTHER CHANCE

CULTD2,	TAD	CULFNM		/GET POINTER TO FILE NAME BUFFER
	DCA	CULL3		/STORE FOR COPY ROUTINE
	JMS	CUCOPY
CULL3,	0
	CDFMNU
	CULRFN
	CDFMYF
	STRLEN

CULTTS,	AC0001
	CDFMNU
	DCA I	(MUBUF+MNTMP2)	/SET FROM-TO
	DCA I	(MUBUF+MNTMP3)
	CDFMYF

CULT0,	TAD	LSTFIL		/GET FILE AND DRIVE NUMBERS
	AND	P377
	DCA	CULSC1
	TAD	LSTFIL
	BSW
	RTR
	AND	(17)
	DCA	CULSC2

	TAD	CULSFO
	AND	P377
	DCA	CULSC3
	TAD	CULSFO
	BSW
	RTR
	AND	(17)
	DCA	CULSC4

	TAD	FORMNO
	AND	P377
	DCA	CULSC5
	TAD	FORMNO
	BSW
	RTR
	AND	(17)
	DCA	CULSC6

	CIFMNU
	JMS I	IOACAL		/OUTPUT WHAT WE THINK THINGS ARE
	0
	CULS1
	0
	IFNDEF CANADA < 505 >
	IFDEF CANADA < 500;141 >/FRECAN WANTED 0 MARGIN

CULSC2,	0
CULSC1,	0
	CULLFN

	IFNDEF CANADA < 605 >
	IFDEF CANADA < 600 >	/0MARGIN
CULSC4,	0
CULSC3,	0
	CULSPN

	IFNDEF CANADA < 705 >
	IFDEF CANADA < 700 >	/0MARGIN

CULSC6,	0
CULSC5,	0
	CULFFN

	IFNDEF CANADA < 1005 >
	IFDEF CANADA < 1000 >	/0MARGIN

	JMP	CULTT0		/CONTINUE ON NEXT PAGE

CULTBO,	0
CULSTB,	CULSOV
	CULSTP
	CULSBT
/--------------------
	PAGE

CULTT0,	AC7776			/TO PRINTER?
	TAD	CULACT
	SZA CLA
	JMP	CULT1		/NO

	CIFMNU
	JMS I	IOACAL		/YES
	0
	CULS5
	JMP	CULT2

CULT1,	AC0001
	TAD	CULTBO		/GET CORRECT STRING FOR TOP, BOTTOM, OVERWRITE
	TAD	(CULSTB)
	DCA	CULT1A

	IFDEF GERMAN <
	JMS	GERPHR		/PRINT SPECIAL PHRASE
		>	/END IFDEF GERMAN

	TAD	OTFIL		/BREAK OUT FILE AND DRIVE NUMBERS
	AND	P377
	DCA	CULSC7
	TAD	OTFIL
	BSW
	RTR
	AND	(17)
	DCA	CULSC8

	CIFMNU
	JMS I	IOACAL
	0			/DEFAULT OUTPUT ROUTINE
	CULS6			/'DOCUMENT: (X.Y)'
CULT1A,	XX
CULSC8,	0
CULSC7,	0
	CULRFN

/IF BOTTOM MESSAGE HAS BEEN DISPLAYED MUST STICK A L.G.A ON SCREEN FOR CANADA /A023
IFDEF CANADA < JMS CANLGA >						/A023

CULT2,	CIFMNU
	JMS I	MNUCAL
	DLMLP3			/CALL MENU FOR GO

/CHECK WHAT TO DO (NOTE MENU SHOULD LEAVE AC 0)
	CDFMNU
	TAD I	(MUBUF+MNTMP1)
	CDFMYF
	SNA
	JMP	CULABT		/ABORT - GOLD MENU PRESSED

	TAD	(-1)
	SNA CLA
	JMP	CULT0		/ERROR - TRY AGAIN

	CDFMNU
	TAD I	(MUBUF+MNTMP2)
	CDFMYF
	DCA	CULFRM		/COPY FROM-TO
	CDFMNU
	TAD I	(MUBUF+MNTMP3)
	CDFMYF
	DCA	CULTO

CULT3,	TAD	CULTBO		/SET TO OVERWRITE RESULT, IF ANY
	DCA	OTACT
	TAD	(CULSFO)	/ADDR OF SPECIFICATION INFO
	DCA	SPCADR
	JMS	CUPSOL		/SET OVERLAY CHAIN
	6
	200
	CIF 10			/FOR PARSER

	ISZ	CULP		/DO SKIP RETURN
	JMP	CULRT1		/TO CHAIN

CULTSP,	DCA	FORMNO		/TEST SPEC ONLY
	JMP	CULT3		/GET TO PARSER

/CALL THE MENUS.  AC CONTINS THE NUMBER OF THE MENU TO CALL.

CULMCL,	0			/CALL MENU FOR LIST, ETC.
	CDFMNU
	DCA I	(MUBUF+MNTMP4)	/WHAT TO DO IS IN AC
	CDFMYF

	CIFMNU
	JMS I	MNUCAL
	DLMLP2

	CDFMNU			/CHECK FOR GOLD MENU - MENU LEAVES AC 0
	TAD I	(MUBUF+MNTMP3)
				/LEAVES FIELD AT MNUFLD
	SNA CLA
	JMP	CULRET
	JMP I	CULMCL

/CREATE THE OUTPUT FILE

CULCRE,	XX
	JMS	ADRCRT		/CREATE OUTPUT FILE
	JMP	CULRET		/COULDN'T DO IT

/ADRCRT RETURNS WITH CUPFNO IN AC ALREADY.
	JMP I	CULCRE

	IFDEF GERMAN <
/GERPHR
/THIS ROUTINE WILL PRINT OUT "INSERTED AT THE TOP OF/BOTTOM OF" IN GERMAN
/ALLOWING UPPERCASE AND LOWERCASE CHARACTERS

GERPHR,	0000
	TAD I	CULT1A		/GET THE ACTUAL STRING POINTER INSTEAD OF TABLE LOC.
	DCA	CULT1A		/SAVE IT AS THE IOA PARAMETER
	CIFMNU
	JMS I	IOACAL		/PRINT THE MESSAGE DESIRED
	0			/USING DEFAULT OUTPUT ROUTINE
CULT1A,	XX			/MESSAGE STRING
	JMP I	GERPHR		/RETURN
	>			/END IFDEF GERMAN

CULSOV,	IFNDEF CANADA <	0 >	/NO MORE TEXT				/A023
	IFDEF CANADA < TEXT 'LE ' >					/A023

/THE FOLLOWING THREE LOCATIONS ARE ASSUMED TO BE IN THIS ORDER BY THE
/PARSER.  (SEE WPSSDF.PA FOR DETAILS)

CULSFO,	0			/SPECIFICATIONS FILE NUMBER WITH DRIVE NUMBER
CULFRM,	0
CULTO,	0

CUFSIZ,	0			/TO STORE NEG FREE SPACE		/A084

WPSCEX,	ISZ	CUFF		/TO EXIT CORRECTLY			/A083
	JMS	CUPSOL		/SET OVERLAY STUFF			/A083
	21			/OVERLAY # (TO CALL NEXT)		/A083
	7400			/STRTUP IN DLOPPI			/A083
	CIF	10		/WILL RUN IN FIELD 3 RETURN TO FLD 2	/A083
	JMP	POSTEX		/EVENTUALLY GETS TO 2CMF TO CALL WPSC	/A083

CONTAP,	JMS	CUPCSZ		/CHECK FOR ROOM IN DISK			/A084
	JMP	CSZERR		/CAUSE NOT EVEN 8 BLOCKS LEFT		/A084
	TAD	CULTO		/RETRIEVE NEG SIZE OF READ ONLY FILE	/A084
	TAD	QUQBLK+RXQSPC	/SPACE LEFT (LOADED BY  CUPCSZ)		/A084
	SMA CLA			/SKIP TO HANDLE 'TOO BIG'		/A084
	JMP	WPSCEX		/GO TO SET UP FOR NORMAL EXIT		/A084
CSZERR,	AC0004			/CASE FOR ERROR MENU			/A084
	CDIMNU			/IN MENU FLD				/A084
	DCA I	(MUBUF+MNTMP1)	/FOR SPECIAL CASE IN PP2 ERROR MENU	/A084
	CDFMYF			/THIS IS WHERE WE WANT TO COME BACK TO	/A084
	JMS I	MNUCAL		/GO PUT UP ERROR MSG			/A084
	DLMPP2			/ERROR MENU BLK				/A084
CRTERR,	CDFMNU			/SEE WHAT HAPPENED THERE		/A083
	TAD I	(MUBUF+MNTMP6)	/WAS SET TO 0 IF GOLD MENU		/A083
	CDFMYF			/RETURN TO WHERE WE ARE			/A083
	SNA CLA			/SKIP TO GIVE ANOTHER TRY		/A083
	JMP	POSTEX		/GOES BACK TO MM			/A083
	JMP	RESRPT		/REPEAT "RESULT" PROMPT IF NO GOLDMENU	/A083
/--------------------
	PAGE

CULACT,	0
CULFNM,	0

CULLFN,	ZBLOCK STRLEN
CULFFN,	ZBLOCK STRLEN
CULRFN,	ZBLOCK STRLEN

CULSTP,	IFDEF ENGLSH < TEXT 'INSERTED AT THE TOP OF ' >
	IFDEF ITALIAN < TEXT "INSERITO ALL'INIZIO DEL ">
	IFDEF DUTCH < TEXT "TOEVOEGEN AAN BOVENKANT VAN " >
	IFDEF V30NOR < TEXT 'TILF\XYET P\E TOPPEN AV'>			/A088
	IFDEF V30SWE < TEXT 'INSATT I B\VRJAN AV'>


CULSBT,	IFDEF ENGLSH < TEXT 'ADDED TO THE BOTTOM OF ' >
	IFDEF ITALIAN < TEXT "INSERITO ALLA FINE DEL " >
	IFDEF V30NOR <TEXT 'TILF\XYET P\E TOPPEN AV '>			/A088
	IFDEF V30SWE < TEXT 'INSATT I SLUTET AV'>


/EACH OF THE FOLLOWING TEXT STATEMENTS MUST HAVE AN EVEN
/NUMBER OF CHARACTERS IF IT IS FOLLOWED BY A *.-1
CULS1,	IFDEF ENGLSH <
	TEXT '^P!E^P&SELECTING FROM LIST DOCUMENT: (^D.^D) ^A '
	*.-1
	TEXT '^P&USING SELECTION SPECIFICATION: (^D.^D) ^A '
	*.-1
	TEXT '^P&THE SELECTED RECORDS WILL BE MERGED WITH DOCUMENT: (^D.^D) '
	*.-1
	TEXT ' ^A^P&THE RESULT WILL BE '
	>	/END IFDEF ENGLISH

	IFDEF ITALIAN <
	TEXT '^P!E^P&DOCUMENTO LISTA: (^D.^D) ^A '
	*.-1
	TEXT '^P&DOCUMENTO SPECIFICA DI SELEZIONE: (^D.^D) ^A '
	*.-1
	TEXT '^P&DOCUMENTO MODULO: (^D.^D) '
	*.-1
	TEXT ' ^A^P&DOCUMENTO USCITA '
	>

	IFDEF V30NOR <
	TEXT '^P!E^P&VELGER UT FRA LISTEDOKUMENT: (^D.^D) ^A  '
	*.-1
	TEXT '^P&BRUKER UTVALGSSPESIFIKASJON: (^D.^D) ^A  '
	*.-1
	TEXT '^P&UTVALGTE POSTER BLIR SL\ETT SAMMEN MED DOKUMENT: (^D.^D) '
	*.-1
	TEXT ' ^A^P&RESULTATET BLIR'
	>	/END IFDEF V30NOR

	IFDEF V30SWE <
	TEXT '^P!E^P&V\DLJ I REGISTERDOKUMENTET: (^D.^D) ^A '
	*.-1
	TEXT '^P&ANV\DND URVALSSPECIFIKATIONEN: (^D.^D) ^A  '
	*.-1
       TEXT '^P&DE VALDA POSTERNA KOMMER ATT L\DGGAS IN I DOKUMENTET: (^D.^D)  '
	*.-1
	TEXT '^A^P&SLUTRESULTATET BLIR: '
	>	/END IFDEF V30SWE


CULS5,	IFDEF ENGLSH < TEXT 'PRINTED' >
	IFDEF ITALIAN < TEXT /VIENE STAMPATO/ >
	IFDEF V30NOR < TEXT 'SKREVET UT'>				/A088
	IFDEF V30SWE < TEXT 'UTSKRIVET'>

CULS6,	IFDEF ENGLSH < TEXT '!SDOCUMENT: (^D.^D) ^A' >
	IFDEF ITALIAN < TEXT /!S: (^D.^D) ^A/ >
	IFDEF DUTCH < TEXT "!SDOCUMENT: (^D.^D) ^A" >
	IFDEF V30NOR< TEXT "!SDOKUMENT: (^D.^D) ^A" >			/A088
	IFDEF V30SWE < TEXT 'DOKUMENT'>


CULSPN,	ZBLOCK STRLEN		/ONE OF THE LIST PROCESSING BUFFERS

CURWST,	TEXT '^<N>^A^<#>^D^<>^A'

CURWBN,	ZBLOCK 4

/THIS ROUTINE MAKES SURE THAT THE PRINTER TYPE SPECIFIED FOR LIST	/M044
/PROCESSING IS ON LINE. THE RETURNS ARE:				/M044
/	AC = 0		PRINTER (OR HOST) IS ONLINE.			/M044
/	AC = 1		PRINTER ON LINE DOESN'T MATCH DD		/M044
/	AC = 2		REQUESTED PRINTER TYPE NOT ONLINE		/M044

CULCKP,	XX
	TAD	CUQOPT		/GET CUQPRT OPTION. SEE IF CALLED FROM LP/A044
	SNA CLA			/SKIP IF CALLED FROM LIST PROCESSING.	/A044
	JMP I	CULCKP	/RETURN 0 (OK RETURN) IF REGULAR QUEING A DOC	/A044

/WE MUST NOW MAP THE SETTINGS WHICH ARE POSSIBLE ON THE RL BASED SYSTEMS
/TO MORE APPROPRIATE SETTINGS

	CDFMNU
	AC3777			/GET DOCUMENT DESTINATION AND MASK OUT	/A013
	AND I   (MUBUF+MNPROP+23)/SIGN BIT TO ASSURE IT IS POSITIVE	/A013
	CDFMYF			/CHANGE DATA FIELD TO MY FIELD		/A013
	DCA	T1		/AND STORE ID
	TAD	T1		/AND RETRIEVE IT AGAIN
	TAD	(DDTABL-DDEND)	/USE IT AS CHECK IF OUT OF RANGE OF TABL/A013
	SMA CLA			/IS PRQPNT OUT OF RANGE?		/M044
	JMP	DDCHK		/JMP IF YES. USE DEFAULT VALUE.		/M044

/JUMP HERE IF PRQPNT IS IN THE RANGE OF OUR TABLE

	TAD	(DDTABL)	/GET ADDRESS OF TABLE OF DOCUMENT DEST'S/A013
	TAD	T1		/USE CURRENT DESTINATION AS OFFSET	/A013
	DCA	T1		/STORE ADDRESS OF NEW DESTINATION	/A013
	TAD I	T1		/PUT NEW DESTINATION INTO AC		/A013
DDCHK,	TAD	DDEFAU		/ADD IN DEFAULT BAIS.			/A044
	DCA	T2		/SAVE DOC'S DD.				/A044
	TAD	T2		/SEE IF DD HOST.			/A044
	TAD	(-DHOST)						/A044
	SNA CLA			/SKIP IF NO. GET PRINTER ID.		/A044
	JMP	CHKHST		/DO HOST CHECKING.			/A044
	TAD	T2		/GET DECMATE DOC DEST			/A074
	CDFPRT			/IN THE PRINTER FIELD
	DCA I	(PRQPNT)	/SET THE DOCUMENT DESTINATION		/A074
	TAD I	(PRTID)		/GET ADDRESS OF PRINTER ID
	CDFMYF
	DCA	T1		/SAVE TO CALL THRU.			/A034
	CIFPRT			/SET UP TO DO A CALL TO IT.		/A034
	AC0001			/SPECIFY PRINTER ID			/A034
	JMS I	T1		/CALL PRTRID ROUTINE			/A034
	SKP			/SUCCESS RETURN. PRINTER IS ONLINE.	/A034
	JMP	CULCK2		/ERROR RETURN. NON-EXISTENT PRINTER.	/A034

	AC0002			/SPECIFY CHECK DOCUMENT DESTINATION	/A074
	CIFPRT			/IN THE PRINTER FIELD			/A074
	JMS I	T1		/CALL TO CHECK DOCUMENT DESTINATION	/A074
	JMP	CULRTN		/DD OK					/A074
	JMP	CULCK1		/WRONG DD				/A074

CHKHST,	CDFSYS			/CMONLN IS IN SYSTEM FIELD		/A060
	TAD I	(CMONLN)	/GET THE COMM FLAG WORD			/A060
	CDFMYF								/A060
	SZA CLA			/SKIP IF NO COMM HARDWARE		/A060
	JMP	CULRTN		/COMM PRESENT. RETURN TO CALLER.	/A044
CULCK2,	IAC			/RETURN AC = 2. NON-EXISTENT PRINTER ERROR/A044
CULCK1,	IAC			/RETURN AC = 1. PRINTER NOT ATTACHED ERROR/A044
CULRTN,	JMP I CULCKP		/EXIT


/CHECK FOR INDEX BLOCK=0
/IF 0 EXIT.... CAN OCCUR IF DISKETTE DOES NOT CONTAIN
/	DOCUMENT SPECIFIED IN DEFAULT
/	OCCURS IF INDEX SET AT DOC  THEN DISKETTE CHANGED
/	AND PRINT COMMAND REQUESTEDUSING DEFAULT

CUINDX,	0								/A055
	JMS	QURX							/A055
	CLA								/A055
	TAD	QUQBLK+RXQBLK	/GET HDR BLK				/A055
	SZA CLA			/IS 0?					/A055
	JMP I	CUINDX		/NO..CONT.				/A055
	JMP	CUQRET		/YES GO TO EXIT(IGNORE)			/A055
/--------------------
	PAGE

CURWPQ,	XX			/ROUTINE TO STORE AND RECALL THE PRINTER QUEUE
	CLA
	CDFMNU
	TAD I	(MUBUF+MNFNO)	/PICK UP FILE NO. FROM MENU
	CDFMYF
	DCA	CURWFN		/AND SAVE
	CDFMNU
	AC7776
	TAD I	(MUBUF+MNTMP3)	/PICK UP TMP 3 TO SEE WHETHER RL OR SL COMMAND
	CDFMYF
	SZA CLA			/1= RL, 2 = SL
	JMP	CURWRL		/GO DO RL STUFF
	CDFMNU
	TAD I	(MUBUF+MNTMP1)	/TMP1 HAS TOP, BOTTOM, OR OVERWRITE
	CDFMYF
	DCA	CURWOP
	AC0002			/NO, TEST IF NEED TO CREATE FILE
	TAD	CURWOP
	SNA CLA
	JMS	CURWCR		/YES, CREATE -- WON'T RETURN IF USER GOLD MENU'S OUT
	TAD	CURWFN		/GET FILE AND DRIVE NOS.
	MQL			/SET UP FOR SCROLL CALL
	TAD	CURWOP		/GET TOP, BOTTOM, OVERWRITE OPTION
	CIFFIO								/A026
	FILEIO								/A026
	XDSKIN			/OPEN FILE
	TAD	CURWFN		/STRIP OUT DRIVE NO.
	BSW
	RTR
	AND	(17)
	CIA			/NEGATE FOR TEST LATER
	DCA	CURWDR
	JMS	CURDQB		/GET Q NAMES BLOCK
	RXERD
	TAD	(CURLST)	/SET TO START OF LIST OF DOCS TO BE DELETED
	DCA	CURLPP		/FROM THE PRINT QUEUE
	CDFMNU
	TAD I	(PQFRST)
	CDFMYF			/GET PTR TO FIRST ENTRY
	SNA
	JMP	CURWCL		/NOTHING THERE, CLOSE FILE
	DCA	CURWPT		/SAVE PTR
	CDFMNU
	TAD I	(PQADDR)
	CDFMYF			/GET ADDR OF FIRST POSSIBLE Q ENTRY
	CIA
	DCA	CURWDF		/SAVE FOR LATER
	JMS	STOPPR		/ENSURE THAT THE PRINTER IS STOPPED

CURWLP,	CDFMNU
	TAD I	CURWPT
	CDFMYF			/GET FIRST ENTRY
	SNA
	JMP	CURWCL		/EMPTY, CLOSE FILE
	DCA	CURWNO		/SAVE FILE NO.
	TAD	CURWNO		/PICK OUT DRIVE NO.
	BSW
	RTR
	AND	(17)
	TAD	CURWDR		/AND COMPARE WITH DRIVE WE ARE STORING ON
	SZA CLA			/SAME ?
	JMP	CURMNX		/NO, GET NEXT ENTRY

	TAD	CURWNO		/YES, FIRST PUT INTO LIST OF FILES TO DELETE
	DCA I	CURLPP
	ISZ	CURLPP
	TAD	CURWNO		/YES, JUST SAVE FILE NO. WITHOUT DRIVE
	AND	P377
	DCA	CURWNO
	TAD	CURWPT		/FIND NAME IN BLOCK
	TAD	CURWDF
	CLL RTL
	CLL RTL
	TAD	(CUB1)
	DCA	CURWNM		/AND SAVE PTR TO IT FOR IOA CALL
	CIFMNU
	JMS I	IOACAL
	CUPOTD			/OUTPUT TO FILE
	CURWST
CURWNM,	0			/FOR PTR TO FILE NAME
CURWNO,	0			/FOR FILE NO.
CURWNL,	CURWLF			/NEWLINE

CURMNX,	ISZ	CURWPT		/GET FLINK
	CDFMNU
	TAD I	CURWPT
	CDFMYF
	SNA
	JMP	CURWCL		/END,CLOSE FILE
	DCA	CURWPT		/SAVE AS NEW PTR
	JMS	STOPPR		/ENSURE THAT PRINTER IS STOPPED
	JMP	CURWLP		/AND TRY AGAIN

CURWLF,	12
	0

/DELETE THE AUTOMATIC RESUME SO THAT THE USER CAN DECIDE WHAT		/A046
/ACTION HE WISHES TO TAKE.   HE MAY WISH TO LOOK AT THE QUEUE,		/A046
/CREATE ANOTHER SL DOCUMENT ON ANOTHER DOCUMENT DISK,			/A046
/OR KILL THE FIRST DOCUMENT IN THE QUEUE BECAUSE IT IS GOING		/A046
/TO BE PRINTED LATER.							/A046

CURWRT,	CLA
	JMP I	CURWPQ		/AND RETURN

/THIS IS THE TABLE OF DOCUMENT DESTINATIONS POSSIBLE ON THE RL BASED SYSTEMS
/WHICH WE ARE MAINTAINING COMPATABILITY WITH, IF NEW PRINTERS ARE PUT
/ONTO A SYSTEM THEN THIS TABLE CAN BE EASILY BE CHANGED OR CONDITIONALIZED
/THIS TABLE IS USED IN MN1 WHEN DISLPAYING DOCUMENT DESTINATIONS AND IN
/WPRTOV.PA WHEN DECIDING WHICH PRINTER TO USE.
/HOWEVER, HERE WE ARE MAPPING DOCUMENT DESTINATIONS TO HANDLER TYPES WHEREAS
/IN MN1.PA AND WPRTOV.PA WE ARE MAPPING DOCUMENT DESTINATIONS TO DOCUMENT
/DESTINATIONS

/POSSIBLE DESTINATION TYPES ARE:
/	LQP=0		/PARALLEL LETTER QUALITY PRINTER
/	DP=1		/PARALLEL DRAFT PRINTER
/	HOST=2		/SERIAL COMMUNICATIONS
/	SERIAL=3	/SERIAL LQP

/POSSIBLE DOCUMENT DESTINATIONS ARE
/	      DLPQ (PARALLEL LETTER QUALITY PRINTER)
/	      DSQ1 (SERIAL LETTER QUALITY PRINTER)
/	      DSQ2  (TWO HEADED SERIAL LETTER QUALITY PRINTER)
/	      DDP   (PARALLEL DRAFT PRINTER)
/	      DDP2   (SERIAL DRAFT PRINTER)
/	      DHOST (SERIAL COMMUNICATIONS PORT)

DFLTV=DSQ1								/M044
DDTABL,	DSQ1-DFLTV	/0 (LQP1)ON RL SYSTEMS)				/M044
	DDP2-DFLTV	/1 (DP1 ON RL SYSTEMS)				/M044
	DHOST-DFLTV	/2 (HOST1 ON RL SYSTEMS)			/M044
	DDP2-DFLTV	/3 (DP2 ON RL SYSTEMS)				/M044
	DSQ1-DFLTV	/4 (LQP2 ON RL SYSTEMS)				/M044
	DSQ1-DFLTV	/5 (LQP3 ON RL SYSTEMS)				/M044
	DSQ1-DFLTV	/6 (LQP4 ON RL SYSTEMS)				/M044
	DHOST-DFLTV	/7 (HOST2 ON RL SYSTEMS)			/M044
	DHOST-DFLTV	/10 (HOST3 ON RL SYSTEMS)			/M044
	DHOST-DFLTV	/11 (HOST4 ON RL SYSTEMS)			/M044
	DSQ1-DFLTV	/12 (NULL DEVICE ON RL SYSTEMS)			/M044

DDEFAU,		/THIS IS THE DEFAULT. IF THE ORIGINAL DOCUMENT DESTINATION IS
		/OUT OF RANGE THAN THIS DESTINATION IS USED

DDEND,	DFLTV		/13 (LQP5 ON RL SYSTEMS)			/M044
		/14, 15 AND 16 ALSO MAP TO SERIAL BUT SINCE THEY FALL OUT OF
		/RANGE OF THE TABLE THEY GET MAPPED TO THE DEFAULT (DDEFAU)
		/WHICH HAPPENS TO BE SERIAL ALSO			/A013
CURWFN,	0
CURWOP,	0
CURWDR,	0
CURWDF,	0
CURWPT,	0
CURLPP,	0			/POINTER INTO 'CURLST'
/--------------------
	PAGE

CURWCL,	CIFFIO								/A026
	FILEIO								/A026
	XDSKCL			/CLOSE DOCUMENT FILE

	CLA			/CALCULATE NEGATIVE NUMBER OF DOCUMENTS TO DELETE
	JMS	STOPPR		/ENSURE THAT PRINTER IS STOPPED
	TAD	CURLPP		/=-(ADDRESS OF LAST ENTRY - ADDRESS OF FIRST
	CIA			/ENTRY)
	TAD	(CURLST)
	SNA			/ANY TO DELETE?
	JMP	CURWRT		/NONE, GO RETURN
	DCA	CURLEN		/YES, INITIALIZE AND THEN DELETE DOCUMENT

	CDFMNU
	TAD I	(PQFRST)
	CDFMYF
	DCA	CURPT2		/ADDRESS OF NEXT ENTRY TO CONSIDER

	TAD	(PQFRST)	/ADDRESS TO UPDATE IF A DELETION IS DONE
	DCA	CURDF2

	IAC			/SET FLAG SAYING POTENTIAL FIRST DELETE
	DCA	CURWFL

/DELETE ENTRIES FROM THE QUEUE.  GET THE NEXT QUEUE ENTRY AND SEE IF
/IT IS ON THE LIST BUILT EARLIER.  IF SO AND 'CURWFL' IS SET TO INDICATE
/THAT THE FIRST ENTRY ON OUR QUEUE IS BEING PRINTED AND THIS IS THE FIRST
/PASS THRU THE LOOP ('CURWFL' = 1), SET TO -1 INDICATING THAT THE FIRST
/ENTRY IS ELIGIBLE TO BE DELETED AT THE END BY THE PRINTER.  OTHERWISE DELETE
/ANY MATCHES DIRECTLY.

CURLP1,	CDFMNU
	TAD I	CURPT2
	CDFMYF
	CIA
	DCA	T1		/SAVE FILE NUMBER TO COMPARE AGAINST
	ISZ	CURPT2		/INC POINTER TO POINT TO FLINK WORD
	TAD	CURLEN
	DCA	T2		/COUNTER OF NUMBER OF PASSES

	TAD	(CURLST)	/POINTER TO NEXT DELETION LIST ENTRY
	DCA	T3

/COMPARE THE Q ENTRY WITH THE LIST

CURLP2,	TAD I	T3
	TAD	T1
	SNA CLA			/MATCH?
	JMP	CUROUT		/YES, EXIT
	ISZ	T3
	ISZ	T2		/NO, GET NEXT LIST ENTRY AND CONTINUE
	JMP	CURLP2		/IF ANY REMAIN, LOOP
	JMP	CURNX0		/ELSE GET NEXT Q ENTRY

CUROUT,	AC7777
	TAD	CURWFL
	SZA			/FIRST ENTRY AND OUR DOC PRINTING??
	JMP	CUROU2		/NO, GO DELETE ENTRY DIRECTLY
	AC7777			/SET FLAG TO EVICT PRINTER JOB LATER
	DCA	CURWFL
	JMP	CURNX0		/GO GET NEXT Q ENTRY

CUROU2,	AC7777			/GET POINTER TO FIRST WORD OF Q ENTRY
	TAD	CURPT2
	DCA	T1

	CDFMNU
	TAD I	CURPT2		/COPY FLINK TO LAST Q ENTRY
	DCA I	CURDF2
	DCA I	T1		/ZERO FIRST WORD OF Q ENTRY BEING DELETED
	CDFMYF

	JMP	CURNXT

/SKIP OVER CURRENT Q ENTRY

CURNX0,	TAD	CURPT2
	DCA	CURDF2		/UPDATE POINTER TO FLINK TO BE MODIFIED
				/DURING A DELETION

/PICK UP NEXT Q ENTRY.

CURNXT,	CDFMNU
	TAD I	CURDF2		/GET FLINK
	CDFMYF
	DCA	CURPT2		/UPDATE CURRENT ENTRY POINTER

	AC7777			/IF 'CURWFL' = 1 (INDICATING FIRST PASS THRU LOOP),
	TAD	CURWFL
	SNA CLA
	DCA	CURWFL		/THEN RESET FLAG TO ZERO

	TAD	CURPT2		/CHECK FOR END OF Q
	SZA CLA			/DONE?
	JMP	CURLP1		/NO, LOOP

/CLEAN UP AND RETURN.  UPDATE 'PQLAST', AND, IF INDICATED, EVICT THE JOB
/CURRENTLY PRINTING.

	AC7777			/GET ADDRESS OF FIRST WORD OF LAST Q ENTRY FOR
	TAD	CURDF2		/'PQLAST'

	CDFMNU
	DCA I	(PQLAST)
	CDFMYF

	AC0001
	TAD	CURWFL
	SZA CLA			/OUR JOB CURRENTLY PRINTING?
	JMP	CURWRT		/NO, JUST RETURN

	TAD	(-7)		/ONLY EVICT PRINTING JOB WHEN WAITING FOR NO
				/SUCH PRINTER
	CDFPRT
	TAD I	(PRSTTS)
	CDFMYF
	SZA CLA			/WAITING FOR NO SUCH PRINTER?
	JMP	CURWRT		/NO, EXIT

	AC0002			/EVICT PRINTING JOB
	JMS	STRTPR
	JMS	WAITPR
	JMP	CURWRT		/RETURN

CURLEN,	0			/NEG NUMBER OF ENTRIES IN DELETE LIST
CURWFL,	0			/FLAG, 1 WHEN THIS IS FIRST Q ENTRY BEING CONSIDERED
				/AND OUR JOB IS PRINTING
				/-   -1 WHEN THE PRINTING JOB IS ALSO BEING SAVED
				/WITH THE PRINT LIST
				/-   0 OTHERWISE

CURDF2,	0			/POINTER TO FLINK WORD OF LAST Q ENTRY CONSIDERED
CURPT2,	0			/CURRENT ENTRY POINTER (SOEMTIMES POINTS TO FIRST WORD
				/OF ENTRY, SOMETIMES TO SECOND WORD)

CURPRT,	XX			/RESUME PRINTER
	CDFPRT			/CDF TO PRINTER
	TAD I	(PRSTOP)	/WAS IT STOPPED?
	CDFMYF
	SNA CLA
	JMP I	CURPRT		/JUST RETURN, IF NOT
	AC7777			/INITIALIZE RESULT			/A058
	DCA	X5							/A058
	CDFPRT								/A058
	TAD I	(PRSTTS)	/GET STOP REASON			/A058
	JMS	VACHK		/DO VALID ACTION CHECK			/A058
	AND	(R)		/SEE IF RESUME IS ALLOWED		/A058
	SNA CLA			/SKIP IF SO				/A058
	JMP I	CURPRT		/ELSE JUST RETURN			/A058

	AC0006			/LOAD RESUME CODE
	JMS	STRTPR		/RESTART IT
	JMP I	CURPRT

/MO83	MOVED HERE TO MAKE ROOM ON CPOSTP PAGE				/AO83
/STOPPR SIMPLIFIED DUE TO STANDARDIZATION ON NEW FLABUZ ROUTINE		/A071
/ALSO CONTAINS JWAIT SO PRINTER CODE CAN SEE STOP FLAG BEFORE THE	/A071
/REST OF THE COMMAND UTITLITY PROCESSES					/A071

STOPPR,	XX			/STOP THE PRINTER
	AC0001			/SET STOP FLAG				/A071
	CDFPRT			/IN THE PRINTER FIELD			/A071
	DCA I	(PRSTOP)	/FOR REASON GIVEN IN COMMENTS ABOVE	/A071
	CDFMYF			/BACK TO OUR FIELD			/A071
	CIFSYS			/AND DO A JWAIT				/A071
	JWAIT								/A071
	JMP I	STOPPR

/--------------------
	PAGE

CURWCR,	XX			/CREATES A FILE USING MENU INFO
	JMS	ADRCRT		/DO CREATE
	JMP	CURWRT		/ERROR CAN'T CREATE
/ADRCRT RETURNS WITH CUPFNO IN AC
	DCA	CURWFN
	AC7777			/SET OVERWRITE
	DCA	CURWOP
	JMP I	CURWCR		/AND RETURN


CURWRL,	TAD	CURWFN		/GET FILE NO.
	CIFFIO								/A026
	FILEIO								/A026
	XRDFIN			/AND OPEN IT
	JMS	CURDQB		/READ Q BLOCK NAMES
	RXERD
	TAD	CURWFN		/SET DRIVE NO. FOR QURX
	BSW
	RTR
	JMS	CUPDRS
CURWRR,	JMS	CURWGN		/GET FILE NAME
	JMP	CURWEX		/EOF
	JMP	CURWEX		/ERR ("READ ERROR") RETURN.		/A036
	JMS	CURWGF		/GET FILE NO.
	JMP	CURWEX		/EOF
	JMP	CURWRR		/ERROR, TRY NEXT ENTRY
	DCA	CURWFR		/SAVE FILE NO.
	TAD	CURWFR		/SET FILE NO.
	DCA	QUQBLK+RXQFNO
	TAD	(RXEGF)		/GET FIRST BOCK
	DCA	QUQBLK+RXQFNC
	JMS	QURX
	CLA
	TAD	QUQBLK+RXQBLK	/SEE IF FILE EXISTS
	SNA CLA
	JMP	CURWRR		/NO, TRY NEXT ONE
	TAD	(RXERD)		/YEX, READ HEADER
	DCA	QUQBLK+RXQFNC
	TAD	(CUB2)
	DCA	QUQBLK+RXQBAD
	JMS	QURX
	CLA
	TAD	CUB2+FHPSET	/SEE IF PRINTER SETTINGS INIT'ED
	SNA CLA
	JMP	CURWRR		/NO, TRY NEXT ONE
	TAD	CURWFN		/YES, GET FILE NO.
	AND	(7400)		/AND OUT FILE NO.
	TAD	CURWFR		/OR FILE NO. WITH DRIVE NO.
	DCA	CURWFR		/AND STASH IT
	CDFMNU			/START TO Q
	TAD	(-PQSZ)		/SAVE SIZE
	DCA	T1
	TAD I	(PQADDR)	/AND PTR TO FIRST ENTRY
	DCA	T2

CURWQ1,	TAD I	T2		/GET A FREE ENTRY
	SNA CLA
	JMP	CURWQ2		/FOUND A FREE ONE
	ISZ	T2		/SKIP FILE NO. ENTRY
	ISZ	T2		/AND FLINK
	ISZ	T1		/ANY ROOM LEFT
	JMP	CURWQ1		/YES TRY NEXT ENTRY
	CDFMYF			/NO, CLEAN UP AND LEAVE
CURWEX,	JMS	CURDQB		/WRITE OUT Q NAME BLOCK
	RXEWT+2000
	JMP	CURWRT		/AND RETURN

CURWQ2,	TAD	CURWFR		/GET FILE NO.
	DCA I	T2		/AND SAVE IN Q
	TAD I	(PQLAST)
	IAC
	DCA	T1
	TAD	T2		/MAKE US LAST ENTRY
	DCA I	T1
	TAD	T2
	DCA I	(PQLAST)
	ISZ	T2
	DCA I	T2		/CLEAR MY FLINK
	TAD I	(PQADDR)	/CALCULATE POSITION IN Q NAME BLOCK
	CDFMYF
	CIA
	TAD	T2
	CLL RTL
	CLL RTL
	AND	(3740)
	TAD	(CUB1)
	DCA	CURWQ5		/AN SAVE IT FOR COPY CALL
	JMS	CUCOPY		/COPY TO Q NAME BLOCK
	CURWBF
	CDFMYF
CURWQ5,	0
	CDFMYF
	37			/ONLY FIRST 31 CHARS. COUNT
	JMP	CURWRR		/GO GET NEXT ENTRY

CURWFR,	0
/--------------------
	PAGE

/READS THE FIRST 31 CHARS OF THE NEXT FILE NAME
/INTO CURWBF.
/CALLED BY:
/JMS	CURWGN
/EOF		END OF FILE RETURN
/ERR		(READ) ERROR RETURN					/A036
/REGULAR RETURN (AC=0)

CURWGN,	XX
	CLA
CURWG1,	JMS	CURGET		/GET NEXT CHAR
	ISZ	CURWGN		/ERR RETURN.				/A036
	JMP I	CURWGN		/EOF
	TAD	(-74)
	SZA CLA
	JMP	CURWG1		/NOT A LEFT ANGLE BRACKET, KEEP LOOKING
	JMS	CURGET		/NEXT CHAR
	ISZ	CURWGN		/ERR RETURN.				/A036
	JMP I	CURWGN		/EOF
	TAD	(-"N+200)
	SNA
	JMP	CURWG2		/MATCHED A N, KEEP GOING
	TAD	("N-200-"N+140) /TRY LOWER CASE N
	SZA CLA
	JMP	CURWG1		/NO, BACK TO THE BEGINNING
CURWG2,	JMS	CURGET		/GET CHAR
	ISZ	CURWGN		/ERR RETURN.				/A036
	JMP I	CURWGN
	TAD	(-76)
	SZA CLA
	JMP	CURWG1		/NOT A RIGHT ANGLE BRACKET, START OVER
	TAD	(CURWBF-1)	/MATCHED, SET UP FOR COPYING NAME
	DCA	X0
	TAD	(-37)		/ONLY COPY FIRST 31 CHARS
	DCA	T1
CURWG3,	JMS	CURGET		/GET NEXT CHAR
	ISZ	CURWGN		/ERR RETURN.				/A036
	JMP I	CURWGN		/EOF
	TAD	(-74)		/CHECK IF LEFT ANGLE BRACKET MEANING DONE
	SNA
	JMP	CURWG4		/YES, RETURN
	TAD	(74)		/MAKE BACK TO INITIAL CHAR
	DCA I	X0		/AND STORE IT
	ISZ	T1		/NEED MORE ?
	JMP	CURWG3		/YES

CURWG4,	CLA
	DCA I	X0		/STORE END OF STRING
	ISZ	CURWGN		/BUMP OVER EOF RETURN.			/A039
	ISZ	CURWGN		/BUMP FOR GOOD RETURN
	JMP I	CURWGN

/GET THE NEXT CHAR FROM THE FILE.
/CALLED BY:
/JMS	CURGET
/ERR RETURN								/A036
/EOF RETURN
/REGULAR RETURN (AC CONTAINS CHAR)

CURGET,	XX
	CLA
	CIFFIO								/A026
	FILEIO								/A026
	XRDFNC
	SZA SMA			/SKIP IF CHAR.				/A036
	ISZ	CURGET		/CHAR.					/A036
	SMA			/SKIP IF ERROR.				/A036
	ISZ	CURGET		/EOF OR CHAR.				/A036
	SPA
	CLA			/RETURN 0 FOR ERROR CHAR.		/A036
	AND	P177
	JMP I	CURGET

/GETS THE NEXT FILE NO. AND RETURNS IT IN THE AC.
/CALLED BY:
/JMS	CURWGF
/EOF RETURN
/ERROR RETURN
/REGULAR RETURN (AC=FILE NO.)

CURWGF,	XX
	TAD	T1		/NEG COUNT OF WORDS LEFT IN NAME BUFFER	/A050
	SZA CLA			/SKIP IF: BUFFER FULL			/A050
				/IF THE BUFFER IS FULL, THEN WE ARE	/A050
				/POINTING AT THE LEFT BRACKET		/A050
	JMP	CURWH0		/MAY HAVE ALREADY FOUND INITIAL LEFT
				/ANGLE BRACKET SO SKIP OVER TEST
				/FIRST TIME THROUGH
CURWH1,	JMS	CURGET		/GET NEXT CHAR
	ISZ	CURWGF		/ERR					/A036
	JMP I	CURWGF		/EOF
	TAD	(-74)
	SZA CLA
	JMP	CURWH1		/NOT A LEFT ANGLE BRACKET, KEEP LOOKING
CURWH0,	JMS	CURGET		/NEXT CHAR
	ISZ	CURWGF		/ERR					/A036
	JMP I	CURWGF		/EOF
	TAD	(-"#+200)
	SZA CLA
	JMP	CURWH1		/NO, BACK TO THE BEGINNING
CURWH2,	JMS	CURGET		/GET CHAR
	ISZ	CURWGF		/ERR					/A036
	JMP I	CURWGF
	TAD	(-76)
	SZA CLA
	JMP	CURWH1		/NOT A RIGHT ANGLE BRACKET, START OVER
	TAD	(-4)
	DCA	T1
	TAD	(CURWBN-1)
	DCA	X0
CURWH3,	JMS	CURGET
	ISZ	CURWGF		/ERR					/A036
	JMP I	CURWGF
	TAD	(-74)		/SEE IF LEFT ANGLE BRACKET
	SNA
	JMP	CURWH4		/YES, ALL DONE
	TAD	(74)		/GET CHAR BACK
	DCA I	X0		/AND STORE IT
	ISZ	T1		/NO. MUST BE LESS 1000
	JMP	CURWH3
	JMP	CURWH5

CURWH4,	DCA I	X0		/STORE TRAILING 0
	CIFMNU
	JMS I	CVDCAL		/CONVERT TO BINARY
	CURWBN
	SKP			/ERROR RETURN
	ISZ	CURWGF		/CONVERTED BUMP RETURN TWICE
CURWH5,	ISZ	CURWGF
	JMP I	CURWGF

/THIS ROUTINE CHECKS THE NAME BEING STORED IN THE DOCUMENT CONTAINING
/THE PRINT QUEUE.  IT MAKES SURE THAT THE LAST CHARACTER IN THE NAME
/IS A SPACE (FOR DISPLAY PURPOSES).  IF A NAME IS LESS THAN 30 CHAR
/IN LENGTH, THEIR WILL BE A TRAILING SPACE, HOWEVER IF THE NAME IS
/LONGER THAN 31 CHAR, THE NAME IS TRUNCATED AND A SPACE MUST BE
/ADDED.  X1 IS LEFT OVER FROM CUCOPY AND WILL BE POINTING TO THE
/LAST LEGAL CHAR IN THE NAME BUFFER (WORD 37).

CUQWO6,	XX			/RETURN ADDRESS
	TAD	X1		/POINTER TO THE 31ST CHAR IN THE DOC NAME
	DCA	T1		/SAVE THE POINTER
	TAD I	T1		/GET THE CHAR
	TAD	(-40)		/COMPARE TO A SPACE
	SPA SNA CLA		/SKIP IF: CHAR IS .GT. A SPACE
	JMP	CUQWO7		/CHAR IS A NULL OR A SPACE
	TAD	(40)		/CHAR IS TO BE REPLACED BY A SPACE
	DCA I	T1
CUQWO7,	JMP I	CUQWO6		/RETURN TO CALLER
/--------------------
	PAGE

/***********************************************************************/
/	CUQMCK--CHECK VERTICAL MARGINS
/	PS-TM-BM MUST BE 1 OR GREATER, OR ELSE THE PRINT SPOOLER WILL DO
/	NOTHING EXCEPT PRINT HEADERS AND FOOTERS AND PAGE NUMBERS,
/	WHICH IS VERY ALARMING
/***********************************************************************/

	PRQTMG=4		/TOP MARGIN OFFSET
	PRQBMG=5		/BOTTOM MARGIN OFFSET
	PAGSIZ=6		/PAGE SIZE OFFSET

CUQMCK, XX
	CLA
	CDFMNU
	TAD I	(MUBUF+MNPROP+PRQTMG)
	TAD I	(MUBUF+MNPROP+PRQBMG)
	CIA
	TAD I	(MUBUF+MNPROP+PAGSIZ) /AC=PS-TM-BM
	CDFMYF
	SMA SZA CLA		/WAS PS GREATER?
	JMP I	CUQMCK		/YES, RETURN

	CDFMNU			/MAP MENU AREA BACK.			/A070
	AC0001			/SET MNTMP1 TO 1 FOR ERROR MESSAGE.	/A070
	DCA I	(MUBUF+MNTMP1)						/A070
	CDFMYF			/BACK TO OUR FIELD.			/A070
	CIFMNU
	JMS I	MNUCAL
	DLMPR1			/PRINT ERROR MENU
	CLA
	JMP	CUQCMU		/ALWAYS RETURN ONLY TO PRINT MENU


