/	.TITLE WPINDX - INDEX COMMAND
/	.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.
/
/	WPINDX	-	INDEX COMMAND
/
/	029	EMcD	24-Sep-85	Add Dutch and Spanish Xlations (conditional)
/	028	EMcD	12-Sep-85	Add Nordic translations 
/					(conditionalised)
/	027	EMcD	11-Apr-85	Allow Dead keys in Doc name
/	026	WCE	20-AUG-84	CHANGED # TO "NO." IN HEADER
/	025	DFB	19-JUN-84	Set to recognize hard disk for ver 2.0
/	024	JFS	26-APR-84	Line up time
/	023	JFS	20-APR-84	British/American date
/	022	JFS	20-APR-84	code moved to make space for 023
/	021	WJY	06-FEB-84	DECmate I compatability
/	020	TCW	27-SEP-83	Add check and text for Winchester drive
/	019	HLP	31-AUG-83	Detect Uninitialized Diskette
/					Fixed QAR EZ-65 wrong msg CI to full disk
/	018	WCE	17-AUG-83	Removed code that generates CDF/CIF's
/	017	TCW	01-JUN-83 	QAR#341 reset flags after disk error
/	016	AIB	30-NOV-82	QAR#215 altered index display to avoid
/					empty final page
/	015	AIB	11-NOV-82	QAR#181	removed blank line from Index
/					display header, moving everything else
/					up one line
/	014	AIB	31-AUG-82	Changed title of index display from
/					"DOCUMENT INDEX" to "INDEX OF DOCUMENTS"
/	013	GDH	08-FEB-82	Fixed elapsed time display in CUIDT2.
/	012	DFB	05-NOV-81	Add get density to set den on device
/	011	GDH	16-AUG-81	De-implemented LOCK/UNLOCK code.
/	010	GDH	26-AUG-81	WPFILS calling seq changes.
/	009	TT	07-JUL-81	Removed superfluous conditionals
/	008 	DM,JM	15-SEP-80	Merged Scandi and Europe/English
/	007	REG	12-AUG-80	ADDED THIS STANDARD HEADER
/	006	GLT	23-JUL-80	French grammatical fixes
/	005	DSS	09-JUL-80	MODIFIED FOR ENGLISH/FRENCH-CANADIAN
/	004 	CMW	06-MAY-80	ENTERED CANADA TRANSLATIONS
/	003	DSS	17-APR-80	ENTERED DUTCH FIXES
/	002	DSS	14-FEB-80	ADDED FOREIGN DATE STUFF
/	001	CW GLT	09-JAN-80	Add French Dutch and German conditionals
/	/				French diacritical substitution:
/	/				"["=L.A.E, "]"=L.G.E; "&" does not capitalize
/	/				German diacritical substitutions:
/	/				"["=L.U.A, "\"=L.U.O, "]"=L.U.U; "7" usable
/	III.D	KEE	29-MAR-78	CHANGES FOR WT78 FILE # REPRESENTATION
/	/				AND PUT IN SYMBOLS FOR DX REQUESTS
/	2.7-5	KEE	02/15/78 	SOME CLEAN UP
/	2.7A-2	LDB	01/28/78	FIX I{ BUG FOR WT78 AND * BUG FOR
/	/				DOCUMENTS WITH NO NAME
/	2.7.1	KEE	11/22/77	PUT IN WT78 INDEX SPEEDUP
/	2.5.1	KEE	11/04/77 	FIX INDEX NOT IGNORING WORD WRAP BLANKS
/	/				AND CARRIAGE RETURNS
/	2.5-1	RLT	10/21/77	MERGE FROM WT78 PACK
/	2.4B	KEE	10/10/77	FIX REMEMBERANCE BUG
/	2.N	KEE	09/09/77	PUT IN WS102 INTERLOCKS
/	2.J	KEE			ALLOW 'NUMBER.DOC' FOR REFERENCES
/	2.G-3	MB	08/13/77	PUT INDEX IN SEPERATE OVERLAY


*200
	JMP  I	.+3
	JMP  I	.+1
	7600
	RXLOAD
*RXLDLS
RXEWT=4
	RXEWT
	0
RXQBLK=11
	RXQBLK
	.
	DLONDX
	100
	CDF 20
	-DSONDX
	0

CDFMYF=	CDFBUF

FIELD 2		/LOADED INTO FIELD 4
*100	/THE FIRST 100 LOCATIONS ARE USED FOR THE SYSTEM

	/LOCATIONS USED BY INDEX
CUICPO,	0	/CURRENT POSITION IN THE LINE BUFFER
CUIPCT,	0	/TEMP
CUIDFG,	0	/DOCUMENT FLAG 0 = NORMAL INDEX; NOT 0 = TO  DOCUMENT
CUIEOF,	0	/WHEN NONZERO, EOF OF INDEX DOC WAS FOUND
CUIREM,	0	/ neg count of docs remaining to display		/A016
CUIPGE,	0	/ numb of docs displayed on current screen		/A016
CUIOVR,	0	/FLAG SET TO NON ZERO IF THE DISK HAS 10 BLOCKS LEFT
CUIDRV,	0	/DRIVE NUMBER OF THE DRIVE WHOSE INDEX IS BEING DONE
CUIDC1,	0	/FILE NUMBER (DRIVE NUMBER W DOCUMENT NUMBER) OF INDEX DOCUMENT
CUIDCN,	0	/FOR CI, FILE NUMBER (DRIVE NUMBER W DOC NUMBER) OF THE DOC
		/TO RECEIVE THE COPY OF THE INDEX
CUIDFO,	0	/DOC NUMBER OF THE DOCUMENT WHOSE INFORMATION IS CURRENTLY
		/BEING DISPLAYED.
CUCPYC,	0
CUISTP,	0


QUBLK,	DSKQUE; 0; 0
QUQBLK,	ZBLOCK 17
/---------------------
PAGE

/WPINDX - INDEX FUNCTION, EITHER TO DOCUMENT OR TO THE SCREEN

/ THE INDEX PROGRAM PRODUCES A LIST OF DOCUMENTS CURRENTLY IN EXISTENCE FOR THIS
/ USER.  THE LIST OF DOCUMENTS IS PLACED ON THE SCREEN, AND MAY OPTIONALLY BE
/ WRITTEN TO A NEW OR EXISTING DOCUMENT.

/ THE INDEX OPERATION IS DONE IN THE FOLLOWING STEPS:

/ I) GET THE INFORMATION FOR THE TOP FEW LINES OF THE SCREEN.
/	A) READ THE ALLOC BLOCK AND EXTRACT INFORMATION FOUND THERE ONLY
/	B) READ THE HOME BLOCK FOR THE REST OF THE TOP INFORMATION
/	C) COUNT THE NUMBER OF DOCUMENTS THAT EXIST AND DISPLAY THE HEADER LINES

/ II) LIST ALL OF THE EXISTENT DOCUMENTS.
/    A) OPEN THE INDEX DOCUMENT.
/    B) LIST ALL THE DOCUMENTS.  LIST IN GROUPS OF FIVE AT A TIME.
/	1) FIRST LIST EACH DOCUMENT FOR WHICH THERE IS AN INDEX DOCUMENT ENTRY
/	   ALONG WITH SIZE INFORMATION, ETC. MARK EACH ENTRY WHICH HAS BEEN
/	   LISTED IN THE COPY OF THE HOME BLOCK OR BITMAP SO THAT IT WILL NOT BE
/	   LISTED ALONG WITH THOSE DOCUMENTS WITHOUT NAMES.
/	2) LIST EACH DOCUMENT WHICH WAS NOT PREVIOUSLY LISTED.
/	3) FOR EACH OF THE 5 DOCUMENTS LISTED, KEEP THE NUMBER AND NAME
/	   IN A BUFFER.
/    C) WHEN NOT TO A DOCUMENT, WAIT FOR THE USER TO PRESS RETURN OR GOLD MENU.
/	1) WHEN THE RETURN WAS ENTERED, DISPLAY THE NEXT INDEX PAGE.
/	2) FOR GOLD MENU, UPDATE THE USERS CURRENT DEFAULT FILE NUMBER AND
/	   TERMINATE THE INDEX.

/ THE INFORMATION EXPECTED FROM THE MENU IS AS FOLLOWS -
/	MNTMP1- FOR CI COMMANDS, TYPE OF MODIFICATION OF THE OUTPUT DOCUMENT
/	MNTMP2- FLAG TO INDICATE INDEX TO DOCUMENT (TO DOCUMENT WHEN NONZERO)
/	MNTMP5- CONTAINS THE DRIVE NUMBER OR AREA NUMBER WHOSE INDEX IS TO BE DONE
/	MNFNO -	FILE NUMBER (INCLUDING DRIVE NUMBER) OF DOCUMENT TO RECEIVE INDEX
/	MNDRV - DRIVE NUMBER OF DOCUMENT TO RECEIVE COPY OF INDEX
/	MNFMAT- DATE/CURRENCY CODE


/DEFINED CONSTANTS

/	BUFFERS
LENBFD=400
LENBF1=400
LENTBF=1200		/NAMES AND DOCUMENT NUMBERS FOR 5 DOCUMENTS
			/(ENTRIES 200 WORDS EACH)
LENBAD=300		/THE NEXT HIGHEST MULTIPLE OF 100 AFTER 2 LINES OF
			/80 CHARACTERS FOR AN ENTRY
CUIBFD=3200		/BUFFER USED TO HOLD HOME BLOCK/BITMAP PACKET
CUIBF1=CUIBFD+LENBFD	/BUFFER TO HOLD HEADER BLOCK/INDEX INFORMATION PACKET
			/FOR DOCUMENT CURRENTLY BEING DISPLAYED.
CUIBAD=CUIBF1+LENBF1	/BUFFER USED TO BUILD LINE FOR DISPLAY ON THE SCREEN
CUITBF=CUIBAD+LENBAD	/BUFFER USED TO STORE THE DOCUMENTS NAMES AND NO. THAT
			/ARE ON THE SCREEN.  EACH ENTRY IS ALLOWED 200 WORDS,
			/SO THAT 5 ENTRIES MAY BE DISPLAYED AT A TIME
IFNZRO 6000-CUITBF-LENTBF&4000 <BUFFER, TOO LONG> /(SCROLL BUFFERS BEGIN AT 6000)

/STARTING COLUMN FOR EACH FIELD IN THE INDEX
	DECIMAL
		IFDEF ENGLSH <
CUINMB=0		/NUMBER
CUINME=8		/NAME
CUICRE=29		/CREATION DATE
CUIERO=29		/ERROR MESSAGE
CUIMOD=38		/LATE MODIFIED DATE
CUISIZ=53		/DOCUMENT SIZE
CUIVER=58		/VERSION
CUILTE=67		/THE TIME OF THE LATE EDIT (DELTA TIME)
CUITTE=74		/THE TOTAL TIME SPENT ON THIS DOCUMENT EDITING
		>
	IFDEF ITALIAN <
CUINMB=0		/NUMBER
CUINME=8		/NAME
CUICRE=29		/CREATION DATE
CUIERO=29		/ERROR MESSAGE
CUIMOD=38		/LATE MODIFIED DATE
CUISIZ=53		/DOCUMENT SIZE
CUIVER=58		/VERSION
CUILTE=67		/THE TIME OF THE LATE EDIT (DELTA TIME)
CUITTE=74		/THE TOTAL TIME SPENT ON THIS DOCUMENT EDITING
	>
	IFDEF V30NOR <
CUINMB=0		/NUMBER
CUINME=8		/NAME
CUICRE=29		/CREATION DATE
CUIERO=29		/ERROR MESSAGE
CUIMOD=38		/LATE MODIFIED DATE
CUISIZ=53		/DOCUMENT SIZE
CUIVER=58		/VERSION
CUILTE=67		/THE TIME OF THE LATE EDIT (DELTA TIME)
CUITTE=74		/THE TOTAL TIME SPENT ON THIS DOCUMENT EDITING
		>

	IFDEF V30SWE <
CUINMB=0		/NUMBER
CUINME=8		/NAME
CUICRE=29		/CREATION DATE
CUIERO=29		/ERROR MESSAGE
CUIMOD=38		/LATE MODIFIED DATE
CUISIZ=53		/DOCUMENT SIZE
CUIVER=58		/VERSION
CUILTE=67		/THE TIME OF THE LATE EDIT (DELTA TIME)
CUITTE=74		/THE TOTAL TIME SPENT ON THIS DOCUMENT EDITING
>

		IFDEF DUTCH <
CUINMB=0		/NUMBER
CUINME=8		/NAME
CUICRE=29		/CREATION DATE
CUIERO=29		/ERROR MESSAGE
CUIMOD=38		/LATE MODIFIED DATE
CUISIZ=52		/DOCUMENT SIZE
CUIVER=58		/VERSION
CUILTE=67		/THE TIME OF THE LATE EDIT (DELTA TIME)
CUITTE=74		/THE TOTAL TIME SPENT ON THIS DOCUMENT EDITING
		>

		IFDEF SPANISH <
CUINMB=0		/NUMBER
CUINME=8		/NAME
CUICRE=29		/CREATION DATE
CUIERO=29		/ERROR MESSAGE
CUIMOD=38		/LATE MODIFIED DATE
CUISIZ=53		/DOCUMENT SIZE
CUIVER=58		/VERSION
CUILTE=67		/THE TIME OF THE LATE EDIT (DELTA TIME)
CUITTE=74		/THE TOTAL TIME SPENT ON THIS DOCUMENT EDITING
		>


/ MISCELLANEOUS CONSTANTS
	OCTAL
OFSBTM=12		/OFFSET OF INDIVIDUAL FILE POINTERS WITHIN HOME BLOCK
TAB=11
SPACE=40
BS=10			/BACK SPACE INDICATING START OF DEAD KEY
WRAPBT=2000		/WORD WRAP BIT
BELL=7			/CONTROL-G (NEEDS-WORD-WRAPPING)
LT=74			/LEFT ANGLE BRACKET
FF=14			/FORM FEED (NEW PAGE OF SOME VARIETY)
ERBIT=4000		/ERROR BIT FOR HANDLER CALLS

CUIRTZ,	XX		/CUINDX - INDEX COMMAND
	JMS	CUINDX
	CDIMNU
	JMP I	CUIRTZ


/CUCOPY - ROUTINE TO COPY BLOCK OF MEMORY
/	JMS	CUCOPY
/		ADDR OF FROM
/		CDF FROM FIELD
/		ADDR OF TO
/		CDF TO FIELD
/		NUMBER OF WORDS TO COPY
/	RETURN, AC = 0
CUCOPY,
	XX
	AC7777		/GET FIRST ADDR - 1 FOR INDEX REGISTER
	TAD I	CUCOPY
	ISZ	CUCOPY
	DCA	X0
	TAD I	CUCOPY	/AND FIELD
	ISZ	CUCOPY
	DCA	CUCPY0	/SAVE FOR LATER USE
	AC7777		/DO SAME FOR TO VALUES
	TAD I	CUCOPY
	ISZ	CUCOPY
	DCA	X1
	TAD I	CUCOPY
	ISZ	CUCOPY
	DCA	CUCPY1
	TAD I	CUCOPY
	ISZ	CUCOPY	/GET COUNT
	CIA		/MAKE ISZ COUNT
	DCA	CUCPYC	/AND SAVE FOR USE
CUCPYL,
CUCPY0,	.-.		/A CDF FOR FIRST FIELD
	TAD I	X0	/GET WORD
CUCPY1,	.-.		/A CDF FOR THE RECEIVING FIELD
	DCA I	X1	/STORE WORD
	ISZ	CUCPYC	/DONE?
	JMP	CUCPYL	/NO - DO NEXT WORD
	CDFMYF	/YES - BACK TO OUR FIELD
	JMP I	CUCOPY	/RETURN TO CALLER

CUISTR,	XX	/STORE DOCUMENT NO. CONVERTED TO ASCIZ INTO FNAMBF.
	DCA	T1		/SAVE CHAR
	RDF; TAD CIDF0		/COMPUTE RETURN FIELD
	DCA	CUISTX		/AND STORE FOR RETURN
	CDFMNU
	TAD	T1
	DCA I	CUISTP		/STORE INTO MENU NAME BUFFER
	ISZ	CUISTP		/BUMP PTR (NO. BETTER BE LESS THAN STRLEN)
CUISTX,	.-.
	JMP I	CUISTR


/ CUICLS -- takes care of the positioning for the screen		/R016
CUICLS,	XX								/R016
	CLA								/R016
	TAD	CUIDFG		/ don't erase if going to a document	/R016
	SZA CLA								/R016
	JMP I	CUICLS							/R016
	CIFMNU								/R016
	JMS I	IOACAL							/R016
		0		/ go directly to the screen		/R016
		CUICSR		/ ^P!E					/R016
		600							/R016
	JMP I	CUICLS							/R016

CUIFNO,	0
CUIDST,	ZBLOCK STRLEN

IFNZRO CUIFNO+1-CUIDST <XCOPY,WILLNOTWORK>
/----------------
	PAGE

CUINDX,	XX	/INDEX COMMAND
/ I) GET INFORMATION FOR THE TOP LINES OF THE LISTED INDEX
	CLA
	DCA	CUIOVR		/CLEAR THE OVERFLOW DISK FLAG
	TAD	(CUIBAD)
	DCA	CUICPO		/SET THE STARTING POINTER TO LINE BUFFER
	DCA	CUINFS			/ZERO TOTAL DOCUMENTS PROCESSED
	CDFMNU
	TAD I	(MUBUF+MNTMP5)
	CDFMYF
	DCA	CUIDRV		/SAVE
	TAD	CUIDRV		/BUILD INDEX NUMBER WITH DRIVE NUMBER
	BSW
	RTL CLL
	IAC
	DCA	CUIDC1
	JMS	CUICKW		/ CK FOR WINCHESTER DRIVE INST.	/A020
	TAD	CUIDRV		/CURRENT DRIVE			/A012
	DCA	QUQBLK+RXQDRV					/A012
	TAD	(RXEDN+4000	/SET GET DEN CMND		/A012
	DCA	QUQBLK+RXQFNC					/A012
	JMS	QURX						/A012
	SPA CLA			/ERROR?				/A012
	JMP	CUIDER		/YES				/A012
	JMS	CUINGD		/SEE IF GOING TO A DOCUMENT
	RIF
	TAD	CDF0
	DCA	QUQBLK+RXQBFD	/SET FIELD
	TAD	(CUIBFD		/GET BUFFER ADDRESS
	DCA	QUQBLK+RXQBAD

/ A) FOR NON-78 ASSEMBLIES -
/    1) READ THE ALLOC BLOCK AND EXTRACT ITS INFORMATION
/	- TOTAL NUMBER OF BLOCKS IN THE FILE SYSTEM
/	- NUMBER OF REMAINING FREE BLOCKS
/    2) READ THE HOME BLOCK AND GET THE REST OF ITS INFORMATION
/	- THE FLOPPY NAME
/	- THE MAXIMUM NUMBER OF FILES ON THE FLOPPY (NEGATIVE)
	TAD	(RXERD+ERBIT	/ERROR RECOVER READ
	DCA	QUQBLK+RXQFNC
	TAD	CUIDRV	/SET THE DRIVE IN THE Q BLOCK
	DCA	QUQBLK+RXQDRV
	TAD	(RXBALC		/GET ALLOC BLOCK FIRST
	DCA	QUQBLK+RXQBLK
	JMS	QURX
	 SPA CLA
	JMP	CUIDER		/DISK ERROR
	TAD	CUIBFD+1	/GET BLOCK TYPE				/A019
	AND	(70)							/A019
	TAD	(-40)		/SEE IF REALLY IS ALLOC BLOCK		/A019
	SZA CLA			/					/A019
	JMP	CUIINV		/NO, INVALID DISK			/A019
	TAD	CUIBFD+2	/GET # OF BLOCKS IN FILE SYSTEM
	DCA	CUINBF
	TAD	CUIBFD+3	/AND # FREE
	DCA	CUINFB
	TAD	(RXBDIR		/NOW READ IN HOME BLOCK AND LEAVE IN CORE
	DCA	QUQBLK+RXQBLK
	JMS	QURX
	SPA CLA
	JMP	CUIDER		/DISK ERROR
	TAD	CUIBFD+1	/ GET THE BLOCK TYPE			/A019
	AND	(70)							/A019
	TAD	(-30)		/ SEE IF HOME BLOCK			/A019
	SZA CLA			/					/A019
	JMP	CUIINV		/ INVALID WPS DISK			/A019
	TAD	(CUIBF1		/CONVERT THE FLOPPY NAME
	DCA	CUIB1P	/SAVE BUFFER 1 PTR, TO CONVERT NAME TO ASCII
	DCA	CUICNT	/INIT COUNT OF BYTES
	TAD	(-6	/INIT MAX CHARACTERS COUNTER
	DCA	CUITMP
CUIND2,
	JMS	GETCHR		/GET NEXT BYTE
		CUICNT
		CUIBFD+2
	SNA
	TAD	(-37		/ZERO IS END
	TAD	(37		/MAKE ASCII
	DCA I	CUIB1P
	ISZ	CUIB1P		/SAVE AND DO NEXT BYTE
	ISZ	CUICNT
	ISZ	CUITMP
	JMP	CUIND2
	DCA	CUIBF1+6	/ENSURE THAT IT'S ASCIZ
	TAD	CUIBFD+11	/INITIAL NEG MAX NUMBER OF DOCUMENTS
	DCA	CUIDPC

/ B) COUNT THE NUMBER OF DOCUMENTS AND DISPLAY THE HEADER
	TAD	(CUIBFD+OFSBTM-1	/INIT ADDR TO CHECK TO COUNT
	DCA	X0
	TAD	CUIDPC		/NUMBER OF DOCS MAX (NEGATIVE)
	DCA	T1
CUIND1,
	TAD I	X0		/GET WORD
	SZA CLA
	ISZ	CUINFS		/GOT ANOTHER ONE
	ISZ	T1		/INCR MAX COUNT
	JMP	CUIND1		/TRY ANOTHER ONE
	JMP	CUIN2A		/NEXT PAGE

/ CLEAN UP AND TERMINATE
/ 1 - IF TO A DOCUMENT,
/	CLOSE THE DOCUMENT
/	CLEAR TO TO DOCUMENT FLAG
/ 2 - IF WT78
/	CLOSE THE INDEX DOCUMENT
/	IF AT LEAST ONE DUCUMENT WAS LISTED, SEND A QUIT INDEX
CUINDR,
	CLA
	TAD	CUIDFG		/IF GOING TO A DOCUMENT WHEN DONE CLOSE IT.
	SNA CLA
	JMP CUIN4D
	DCA	CUIDFG		/CLEAR FOR NEXT TIME
	CIFFIO
	FILEIO
	XDSKCL			/CLOSE					/M0010
CUIN4D,
	JMP I	CUINDX		/RETURN

CUIB1P,	0
CUITMP,	0								/R016
/-----------------
	PAGE


CUIN2A,
	TAD	CUINFS		/ MAKE COUNTER FROM NUMBER OF DOCS	/A016
	CMA IAC								/A016
	DCA	CUIREM							/A016
	TAD	CUIDRV		/PUT DRIVE NUMBER IN DISPLAY REQUEST
	DCA	CUIDRN
	IFDEF	CONDOR	<						/A020
	JMS	CUICKW		/ CK FOR WINCHESTER DRIVE		/A020
		>	/ END IFDEF CONDOR				/A020
	JMS	CUIPDS		/DISPLAY THE TOP LINES

/II. LIST ALL EXISTENT DOCUMENTS.					/R016
/   A) OPEN THE INDEX DOCUMENT						/R016
	TAD	(CUIBFD+OFSBTM	/INIT PTR AND COUNT FOR ENTRY SEARCH	/R016
	DCA	CUIDPT							/R016
	TAD	(CUIBF1		/PATCH WHERE WE READ TO BE BUFFER
	DCA	QUQBLK+RXQBAD
	DCA	CUIEOF
	TAD	CUIDC1		/OPEN INDEX DOCUMENT FOR READ
	CIFFIO
	FILEIO
	XRDFIN						/M0010

/ B) LIST ALL DOCUMENTS IN GROUPS OF FIVE AT A TIME.
CUIND3,
	CLA		/GET 5 ENTRIES
	TAD	(-5
	DCA	CUICNT
	DCA	CUIPGE	/ clear displayed doc count for this page	/A016
	JMS	CUICLS	/POSTIONS THE CURSOR AND CLEARS THE SCREEN
CUIND4,
	JMS	CUIENT	/DO ENTRY PROCESSING

/ C) FOR EACH OF THE FIVE LISTED DOCUMENTS, KEEP ITS NAME AND NUMBER IN A
/    BUFFER.
/	FIRST COMPUTE THE BUFFER SLOT TO BE USED.  THE FORMULA USED:
/		SLOT = BUFFER START + 200 * (NUMBER OF ENTRIES ON PAGE) - 200
	TAD	CUIPGE	/ this numb is bumped by CUIENT by CUIDSP	/M016
	BSW
	CLL RAL		/TIMES 200
	TAD	(CUITBF-200)	/PLUS BUFFER ADDRESS - 200
	DCA	CUIN4A	/SAVE IN COPY CALL
	TAD	CUID1	/GET DOCUMENT NUMBER (WITHOUT DRIVE)
	DCA	CUIFNO
	JMS	CUCOPY	/COPY NAME AND NUMBER
		CUIFNO
		CDFMYF
CUIN4A,		0
		CDFMYF
		STRLEN+1	
	TAD	CUIREM	/END OF DOCUMENTS?				/M016
	SNA CLA								/M016
	JMP	CUIND5	/YES
	ISZ	CUICNT	/NEXT?
	JMP	CUIND4
	JMS	CUIWAT	/WAIT FOR USER TO TYPE SOMETHING		/A016
	JMP	CUINDR	/ :G:Menu -- return to main menu		/A016
	JMP	CUIND3	/ :RETURN -- continue with next entry		/A016
CUIND5,
	JMS	CUIWAT	/WAIT FOR USER TO TYPE SOMETHING
	JMP	CUINDR	/ :G:Menu -- return to main menu
	JMP	CUINDR	/ :RETURN -- return to main menu anyway		/M016

CUICNT,	0

CUIINV,		/ INVALID DISK INSTALLED				/A019
	CDFMNU			/ SET UP CODE FOR MENU			/A019
	AC0004			/					/A019
	DCA I	(MUBUF+MNTMP1	/					/A019
	CDFMYF			/					/A019
	CIFMNU			/ GO TO A MENU				/A019
	JMS I	MNUCAL		/ AND TELL USER				/A019
		DLMEM1		/ MENU BLOCK				/A019
	JMP	CUINDR		/					/A019

IFNZRO 200-STRLEN-1&4000  <XSAVE, AREATOOSMALL>

/-------------------------
	PAGE


/CUIWAT - WAIT FOR USER TO DO SOMETHING
/ C) WHEN NOT TO A DOCUMENT, WAIT FOR THE USER TO PRESS EITHER RETURN OR GOLD M
/    1)WHEN RETURN IS PRESSED, SIMPLY GET THE NEXT SCREENFUL
CUIWAT,
	XX
	CLA
	TAD	CUIDFG	/IF SET FOR DOCUMENT THE USER CANNOT RESPOND SO RETURN
	SNA CLA
	JMP	CUIWAJ
	TAD	CUIOVR	/SEE IF THE DISK HAS OVERFLOWED IF SO PUT UP ERROR MESS
	SZA CLA
	JMP	CUIFLL
	JMP	CUIWAC	/NOT OVERFLOWED RETURN
CUIWAJ,
	TAD	CUIPGE		/ GET NUMBER OF ENTRIES			/M016
	CDFMNU
	DCA I	(MUBUF+MNTMP1)	/SAVE IN TEMP1
	TAD	CUIREM		/ pass number of undisplayed docs	/A016
	DCA I	(MUBUF+MNTMP2)						/A016
	CDFMYF
	CIFMNU
	JMS I	MNUCAL	/CALL MENU
		DLMIN2
	CDFMNU
	TAD I	(MUBUF+MNTMP1)	/GET TEMP1
	CDFMYF
	SZA		/ZERO MEANS JUST RETURN PRESSED
	JMP	CUIWA1	/OTHERWISE SET REMEMBERENCE AND RETURN TO CALLER
CUIWAC,
	ISZ	CUIWAT	/SKIP RETURN
CUIWAR,
	JMP I	CUIWAT

/    2) WHEN GOLD MENU IS PRESSED, REMEMBER THAT THE USERS LAST USED DOCUMENT
/	IS THE ONE MARKED BY THE ASTERISK
CUIWA1,
	BSW		/GET BUFFER ADDRESS = BASE + 200 * (ENTRY NUMBER FROM
	CLL RAL		/SCREEN)
	TAD	(CUITBF-200)	/ADD OFFSET
	DCA	CUIWA2	/SAVE
	TAD	CUIDRV	/
	DCA	T3
	TAD I	CUIWA2
	CDFMNU		/SAVE
	SNA		/DOCUMENT NUMBER NON-ZERO?
	JMP	CUIWA6	/ZERO, DON'T ADD DRIVE NUMBER IN (THIS FILE NUMBER
			/IS IN ERROR)
	DCA I	(MUBUF+MNDOCN	/STORE DOCUMENT NUMBER, ETC.
	TAD	T3	/THEN STORE DRIVE NUMBER
	DCA I	(MUBUF+MNDRV)
	TAD	T3	/PLACE DRIVE NUMBER WITH DOCUMENT NUMBER
	BSW
	RTL CLL
	TAD I	(MUBUF+MNDOCN)
CUIWA6,	DCA I	(MUBUF+MNFNO)	/STORE ZERO OR FILE NUMBER 'MNFNO'
	TAD I	(FNAMSP
	CDFMYF
	DCA	CUIWA5
	TAD	CUIWA2	/NOW COPY NAME
	IAC		/(SKIP THE WORD WITH THE FILE NUMBER)
	DCA	CUIWA4
	TAD I	CUIWA4		/CHECK FOR NO NAME
	SNA CLA
	JMP	CUIWA7		/YES, USE NO.
	JMS	CUCOPY
CUIWA4,		0
		CDFMYF
CUIWA5,		0
		CDFMNU
		STRLEN
	JMP I	CUIWAT	/DONE - NON-SKIP
CUIWA7,	TAD	CUIWA5
	DCA	CUISTP		/SET UP PTR
	TAD	CUIWA2
	DCA	CUIWA8
	CIFMNU
	JMS I	IOACAL		/CONVERT NO. TO ASCIZ
		CUISTR
		CUISTT
CUIWA8,		.-.
	CLA
	JMS	CUISTR		/STORE 0 FOR END
	JMP I	CUIWAT		/RETURN

CUISTT,	TEXT '!D'


CUIOUS,	XX	/OUTPUTS TO THE SCREEN
	AND	P377	/GET RID OF ANY FUNNIES			/M027
	TAD	(-TAB)	/MAKE TABS SPACES
	SNA
	TAD	(SPACE-TAB)
	TAD	(TAB)
	JMP	CUIOSS
CUIOSW,
	CIF 0
	JWAIT
CUIOSS,
	CIF 0
	TTYOU
	JMP	CUIOSW
	JMP I	CUIOUS

CUIWA2,	0								/R016

CUIFLL,		/DISPLAY ERROR IN CI COMMAND IF THERE ARE 10 BLOCKS OR FEWER
/			ON THE DISKETTE
	CIFMNU
	JMS I	IOACAL	/CLEAR THE SCREEN
		0
		CUICSR
		0
	CDFFIO			/					/M0010
	TAD I 	(SCFSPC)	/PUT UP THE NUMBER OF BLOCKS LEFT
	CDFMNU			/THIS WAS MISSING CAUSING BUG EZ-65	/A019
	DCA I	(MUBUF+MNTMP2)
	AC0003		/SET TO 3 TO TELL THE MENU WHICH DISPLAY
	DCA I	(MUBUF+MNTMP1)
	CDFMYF
	CIFMNU
	JMS I	MNUCAL
		DLMEM1
	JMP	CUIWAR
/--------------------
	PAGE


/CUIENT - DO NEXT ENTRY
/    B) LIST ALL THE DOCUMENTS.  LIST IN GROUPS OF FIVE AT A TIME.
/	1) FIRST LIST EACH DOCUMENT FOR WHICH THERE IS AN INDEX DOCUMENT ENTRY
/	   ALONG WITH SIZE INFORMATION, ETC. MARK EACH ENTRY WHICH HAS BEEN
/	   LISTED IN THE COPY OF THE HOME BLOCK OR BITMAP SO THAT IT WILL NOT BE
/	   LISTED ALONG WITH THOSE DOCUMENTS WITHOUT NAMES.
CUIENT,	XX
	CLA		/INIT NAME PTRS
	TAD	(CUIDST
	DCA	CUINP
	TAD	CUIEOF	/END OF FILE ON INDEX FILE - CHECK FOR UN-OUTPUTTED
	SZA CLA
	JMP	CUIEN1	/GO LOOK FOR THEM
	JMS	CUISRC	/LOOK FOR NEXT <N>
		CUIBN
	JMP	CUIEO1	/EOF
	TAD	(-STRLEN	/MAX NUMBER OF CHARS IN DISPLAYED NAME
	DCA	CUIECT
CUIEL1,			/ASSUME AC ZERO HERE
	JMS	CUIGCH	/GET NEXT CHAR
	JMP	CUIEO1	/EOF
	TAD	(-LF	/IS IT EOL?
	SNA
	JMP	CUIEGN	/YES - END OF NAME, GET NUMBER
	TAD	(LF-LT	/LEFT ANGLE BRACKET?
	SNA
	JMP	CUIEGN	/YES
	TAD	(LT-TAB	/TAB?
	SNA
	JMP	CUIEGN	/YES
	TAD	(TAB-FF	/FF OF SOME SORT?
	SNA
	JMP	CUIEGN
	TAD	(FF
	DCA I	CUINP	/SAVE AS NEXT CHAR OF NAME
	ISZ	CUINP	/NEXT TIME NEXT CHAR
	ISZ	CUIECT	/INCR COUNT
	JMP	CUIEL1	/LOOP
CUIEGN,
	DCA I	CUINP	/ZERO LAST BYTE FOR ASCIZ
	JMS	CUISRC	/SEARCH FOR <#>
		CUIBNO
	JMP	CUIEO1
	JMS	CUINUM	/GET NUMBER
	JMP	CUIEO1	/EOF
	DCA	CUIFNO	/SAVE NUMBER
	TAD	CUIFNO
	JMS	CUIDSP	/DISPLAY INFO
	JMP I	CUIENT	/DONE

CUIEO1,
	AC7777		/DON'T DO FILE STUFF NEXT TIME
	DCA	CUIEOF

/	2) LIST EACH DOCUMENT WHICH WAS NOT PREVIOUSLY LISTED.
CUIEN1,
	CLA
	TAD I	CUIDPT	/GET DIR PTR
	SPA
	JMP	CUIEN2	/NEGATIVE MEANS ENTRY ALREADY SHOWN
	SZA
	JMP	CUIEN3	/NOT SHOWN - DO IT
CUIEN2,
	ISZ	CUIDPT	/INCR PTR
	ISZ	CUIDPC	/AND COUNT
	JMP	CUIEN1	/DO ANOTHER ENTRY
	JMP I	CUIENT	/DONE - RETURN
CUIEN3,
	CLA
	TAD	CUIDPT	/GET ADDR CHECKED
	TAD	(-CUIBFD-OFSBTM+1	/MAKE INTO A FILE NUMBER
	DCA	CUIFNO
	DCA	CUIDST	/ZAP STRING TO ASCIZ EMPTY
	TAD	CUIFNO	/GET NUMBER
	JMS	CUIDSP	/DISPLAY IT
	JMP I	CUIENT	/RETURN TO CALLER

CUINP,	0
CUIECT,	0
CUIDPT,	0
CUIDPC,	0


/ GET THE NEXT CHARACTER FROM THE DOCUMENT THAT 'RDFIL' CURRENTLY HAS OPEN -
/ UPON ENTRY -
/	AC	ZERO, GET THE NEXT CHARACTER FROM THE DOCUMENT
/		NONZERO, RETURN THE LAST CHARACTER A SECOND TIME
/	PAR 1	LOCATION RETURNED TO WHEN EOF IS ENCOUNTERED
/	'RDFIL' HAS A DOCUMENT OPENED.
/ UPON RETURN -
/	AC	NEXT CHARACTER, WITH THE FOLLOWING EXCEPTIONS -
/			WORD-WRAP BLANKS AND RETURNS
/			START AND END OF DEADKEY
/			'NEEDS-WORD-WRAP' CHARACTERS
CUIGCH,	XX		/GET CHAR FROM DOCUMENT
	SNA CLA			/RETURN LAST CHARACTER AGAIN?
	 JMP	CUIGC2		/NO, GET NEXT ONE INSTEAD.
	TAD	CUIBK
	JMP	CUIGC1
CUIGC2,	CIFFIO
	FILEIO
	XRDFNC			/GET NEXT CHAR				/M0010
	SPA SNA
	JMP I	CUIGCH		/EOF OR DISKERR
CUIGC1,
	DCA	CUIBK		/SAVE BACKUP
	TAD	CUIBK
	TAD	(-WRAPBT-LF)	/IGNORE WORD WRAP CR
	SZA
	TAD	(WRAPBT+LF-WRAPBT-SPACE)	/OR WORD WRAP BLANKS
	SNA CLA			/EITHER?
	 JMP	CUIGC2		/YES, ONE OR THE OTHER - GET NEXT CHARACTER
	TAD	CUIBK		/GET CHARACTER
	AND	P177		/ONLY LOW ORDER BITS
	TAD	(-BS		/IGNORE BACKSPACE (START OF DEADKEY)
/d027	SNA
/d027	JMP	CUIGC2
	IAC			/AND ALSO CNTRL-G ('NEEDS-WORD-WRAP')
	SNA
	 JMP	CUIGC2
/d027	TAD	(BELL-CR	/BETTER IGNORE CR ALSO (END OF DEADKEY)
/d027	SNA
/d027	JMP	CUIGC2
	TAD	(BELL		/GET CHAR BACK			/M027
	ISZ	CUIGCH		/SKIP EOF RETURN
	JMP I	CUIGCH		/RETURN

CUIBK,	0
IFNZRO 7-BELL <XBELL7, THISCODEASSUMESABELLIS7>
/--------------------------------
	PAGE

CUIBN,	"<-200; "N-200+40; ">-200; 0
CUIBNO,	"<-200; "#-200; ">-200; 0
CUIDSP,	XX		/DISPLAY INFO ABOUT DOCUMENT
	AND	P377
	DCA	CUIDFO	/SAVE THE FILE NUMBER
	DCA	CUID1	/INIT FILENO
	ISZ	CUIPGE	/ count docs displayed on this page		/A016
	TAD	CUIDFO	/CHECK IT
	SNA
	JMP	CUIDBN
	SPA
	JMP	CUIDBN
	TAD	(-MAXDOC
	SMA CLA
	JMP	CUIDBN	/DISPLAY BAD NUMBER
	TAD	CUIDFO	/GET HEADER BLOCK NUMBER
	TAD	(CUIBFD+OFSBTM-1
	DCA	T1
	TAD I	T1
	SNA
	JMP	CUIDBN	/DOESN'T EXIST
	SMA			/ if >0, incr undisplayed doc counter	/A016
	ISZ	CUIREM							/A016
	NOP								/A016
	SMA		/MAKE IT NEGATIVE IF IT ISN'T ALREADY
	CIA		/SO THAT WE REMEMBER THAT WE DISP'ED IT
	DCA I	T1
	TAD I	T1
	CIA		/GET POSITIVE
	DCA	QUQBLK+RXQBLK
	JMS	QURX	/GET HEADER
	SPA CLA		/CHECK ERROR CODES
	JMP	CUIDBN
	TAD	CUIDFO
	DCA	CUID1
	CIFMNU
	JMS I	IOACAL	/RETURNS AC=0
		CUIOUT
		CUID10
CUID1,		0
	JMS	CUIPOS
		CUINME		/DO THE NAME
	CIFMNU
	JMS I	IOACAL
		CUIOUT
		CUIDS2
		CUIDST
	JMS	NWLINE		/NEXT LINE, RETURNS AC=0
	JMS	CUIPOS
		CUICRE
	TAD	(CUIBF1+6)	/DISPLAY THE CREATED DATE
	JMS	CUIDDT		/RETURNS AC=0
	NOP			/IGNORE 'NODATE'
	JMS	CUIPOS
		CUIMOD		/DISPLAY THE DATE/TIME LAST MODIFIED
	TAD	(CUIBF1+10)	/OUTPUT THE DATE
	JMS	CUIDDT
	JMP	CUIDN6		/SKIP IF NO DATE
	TAD 	CUIBF1+14	/ELSE, OUTPUT TIME		/A022
	BSW							/A022
	AND	P77						/A022
	DCA	CUID6	/SAVE THE HOURS				/A022
	TAD 	CUIBF1+14	/FETCH MINUTES			/A022
	AND	P77						/A022
	DCA	CUID7						/A022
	JMS	CUIPOS	/TAB TO TIME COLUMN			/A024
		CUIMOD+11					/A024
	CIFMNU							/A022
	JMS I	IOACAL						/A022
		CUIOUT						/A022
		CUIDS4						/A022
CUID6,		0						/A022
CUID7,		0						/A022
CUIDN6,
	JMS	CUIPOS
		CUISIZ		/SIZE
	CIFMNU
	JMS I IOACAL
		CUIOUT
		CUIDS5
		CUIBF1+5
	JMS	CUIPOS
		CUIVER		/VERSION
	CIFMNU
	JMS I IOACAL
		CUIOUT
		CUIDS6
		CUIBF1+12
	JMS	CUIPOS
		CUILTE		/DISPLAY TIME EDITED
	IFNDEF ITALIAN <
	TAD	CUIBF1+16
	JMS	CUIDT2		/RETURNS AC=0
	JMS	CUIPOS
		CUITTE		/DISPLAY TOTAL TIME EDITED
	TAD	CUIBF1+17
	JMS	CUIDT2
	>
CUIDSR,
	JMS	NWLINE		/GO TO NEXT LINE
	JMS	NWLINE		/GO TO NEXT LINE
	JMP I	CUIDSP		/AND RETURN TO CALLER
/-----------------------------
	PAGE


/CUIDDT - DISPLAY THE DATE THAT IS POINTED TO BY AC
/	THE FIRST WORD HAS DATE, PACKED MONTH, DAY
/	THE SECOND WORD CONTAINS THE YEAR.
/	CUIPCT CONTAINS THE DATE SEPARATOR
CUIDDT,	XX
	DCA	T1		/SAVE THE DATE ADDRESS
	TAD I	T1
	SNA
	JMP	CUIDTN		/IF ZERO DISPLAY 'NODATE'
	AND	P77		/ELSE, UNPACK MO/DAY
	DCA	CUID3
	TAD I	T1
	BSW
	AND	P77
	DCA	CUID2		/SET UP AS IF DD/MM/YY
	ISZ	T1		/POINT TO YEAR				/A023
	TAD I	T1
	DCA	CUID4
	CDFMNU								/A023
	TAD	MNDSEP+MUBUF						/A023
	DCA	CUIPCT		/SET UP SEPARATOR FOR IOA		/A023
	AC0002								/A023
	AND	MNFMAT+MUBUF	/DMYDAT SELECTED?			/A023
	SNA								/A023
	JMP	CUIDD8		/DONE IF REALLY DMY			/A023
	AC0001								/A023
	AND	MNFMAT+MUBUF	/NO, IS IT YMD?				/A023
	SNA CLA								/A023
	JMP	CUIDD0							/A023
	TAD	CUID4		/YES,	IT'S YMD, SO			/A023
	MQL			/	SWITCH Y,D			/A023
	TAD	CUID2							/A023
	DCA	CUID4							/A023
	JMP	CUIDD5							/A023
CUIDD0,				/NO,	IT'S MDY, SO			/A023
	TAD	CUID3		/	SWITCH M,D			/A023
	MQL								/A023
	TAD	CUID2							/A023
	DCA	CUID3							/A023
CUIDD5,									/A023
	ACL			/COMPLETE DAY MOVE			/A023
	DCA	CUID2							/A023
CUIDD8,									/A023
	CDFMYF								/A023
	CIFMNU
	JMS I	IOACAL
		CUIOUT
		CUIDS3
CUID2,		0		/DATE VALUES				/A023
CUISEP,		CUIPCT							/A023
CUID3,		0	
		CUIPCT							/A023
CUID4,		0
	ISZ	CUIDDT
	JMP I	CUIDDT
CUIDTN,
	CIFMNU
	JMS I	IOACAL
		CUIOUT
		CUIDN2		/ "NO/DA/TE"
	JMP I	CUIDDT


CUIPOS,	XX	/SIMULATE TAB IN LINE BUFFER, CUIBAD
/    Call:	AC=0							/A022
/	    JMS	CUIPOS
/		<column position>
/  Return:	AC = 0
	TAD I	CUIPOS		/Get the column position
	TAD	(CUIBAD)	/MAKE IT A buffer pointer
	ISZ	CUIPOS		/Increment the argument pointer for return
	CIA			/Negate the value of the buffer address
	TAD	CUICPO		/Get current pos.(AC=# columns to desired col)
	SMA
	JMP	CUIPRT		/Exit if currrent position after desired pos
	DCA	CUIPCT		/Store the # of columns to get to desired col
	TAD	(TAB)		/INSERT A TAB FOR A DOCUMENT
	JMS	CUIOUT
	ISZ	CUIPCT		/Increment positions to move
	SKP			/Skip if not done.
	JMP	CUIPRT		/IF ONLY ONE CHAR TO INSERT RETURN
CUIPLP,
	TAD	(WRAPBT+SPACE)	/FILL REST WITH SPECIAL SPACES FOR THE EDITOR
	JMS	CUIOUT		/OUTPUT A JUSTIFYING SPACE
	ISZ	CUIPCT		/Increment the spaces-to-be-output counter
	JMP	CUIPLP		/Not done: loop
CUIPRT,				/Finished: Exit.
	CLA
	JMP I	CUIPOS


/ CUISRC - SEARCH FOR STRING IN DOCUMENT CURRENTLY OPEN BY 'RDFIL'
/   CALL:
/	JMS	CUISRC
/		ADDRESS OF ASCII STRING TO BE MATCHED, ENDING WITH ZERO
/	RETURN LOCATION WHEN NO MATCH FOUND BEFORE EOF
/	MATCH RETURN
/ ON RETURN -
/	AC	NORMAL RETURN - 0
/		ERROR RETURN - UNCERTAIN
/	T1,T2 CLOBBERED					/A022
/	THE LAST CHARACTER TAKEN FROM THE DOCUMENT MATCHED THE LAST CHARACTER
/	OF THE STRING.
CUISRC,	XX		/SEARCH FOR STRING IN DOCUMENT
	AC7777
	DCA	CUIFRS	/RETURN THE LAST CHARACTER A SECOND TIME
CUISR1,
	TAD I	CUISRC	/GET ARG
	DCA	CUISSP	/SAVE AS STRING PTR
CUISR2,			
	AC0001		/RETURN LAST CHAR AGAIN
	ISZ	CUIFRS	/FIRST CALL?
	 CLA		/NO, RETURN NEXT CHARACTER FROM FILE
	JMS	CUIGCH	/GET NEXT CHAR
	 JMP	CUISR3	/NON-SKIP EOF RETURN
	CIA		/COMPARE WITH NEXT CHAR IN STRING
	TAD I	CUISSP	/GET THE CHAR
	SZA CLA
	 JMP	CUISR1	/NO - RE-INIT
	ISZ	CUISSP	/GET NEXT CHAR FROM STRING
	TAD I	CUISSP	/END?
	SZA CLA
	 JMP	CUISR2	/NO - CHECK NEXT CHAR
	ISZ	CUISRC	/YES - ALL DONE - SKIP RETURN
CUISR3,	ISZ	CUISRC
	JMP I	CUISRC	/RETURN

CUISSP=T2		/CHAR PTR				/A022
CUIFRS=T1	/FLAG TO INDICATE FIRST PASS THRU SEARCH LOOP -
		/IF FIRST PASS, RETURN LAST FILE CHARACTER A SECOND TIME.

CUINUM,	XX	/PICK UP THE NUMBER FROM THE DOCUMENT CURRENTLY OPEN TO 'RDFIL'
	DCA	CUINNV	/INIT VALUE (ASSUME AC ZERO HERE)
CUINL1,			/ASSUME AC ZERO HERE
	JMS	CUIGCH	/GET CHAR
	 JMP I	CUINUM	/NON-SKIP RETURN
	TAD	(-72	/NUMERIC?
	SMA
	 JMP	CUINDN	/DONE
	TAD	(LF
	SPA
	 JMP	CUINDN	/STILL NO
	DCA	T1	/SAVE
	TAD	CUINNV
	CLL RTL
	TAD	CUINNV
	CLL RAL
	TAD	T1
	DCA	CUINNV
	JMP	CUINL1	/LOOP - NEXT CHAR
CUINDN,
	CLA
	TAD	CUINNV
	ISZ	CUINUM	/SKIP RETURN
	JMP I	CUINUM	/RETURN

CUINNV=T2		/NUMBER ACCUMULATOR			/A022
/-------------------------------------------
	PAGE

CUIPDS,	XX	/THE FIRST N LINES DISPLAYED AND NOT ERASED
	CIFMNU
	JMS I	IOACAL
		0
		CUICSR	/CLEAR THE SCREEN
		0
	CIFMNU
	JMS I	IOACAL	/PUT THE RULER AND START IF PRINTER CONTROL IN
		CUIOUD
		CUIDS2
		CUIDRL
	CIFMNU		/DISPLAY THE DOCUMENT INDEX MESSAGE
	JMS I	IOACAL
		CUIOUT
		CUILN1
	JMS	NWLINE
	CIFMNU
	JMS I	IOACAL	/OUTPUT THE STATUS LINE
		CUIOUT
		CUIIS1
CUISA1,		CUIWS1	/ ADDR OF SUB-STRING				/A020
CUIDRN,		0
		CUIBF1
CUINFS,		0
CUINFB,		0
CUINBF,		0
	JMS	NWLINE	/NEXT LINE
	JMS	CUIDOT	/OUTPUT ------
	JMS	NWLINE	/NEXT LINE
	JMS	CUITLN	/DISPLAY THE first line of COLUMN INFO
		CUITP1		/"Document"
		CUICRE		/column for creation date
		CUITNL		/"null" to INSERT A TAB (for document)
		CUIMOD		/column for last modified date
		CUITNL		/"null" to insert a tab (for document)
		CUISIZ		/column for document size
		CUITNL		/"null" to insert a tab (for document)
		CUIVER		/column for document version number
		CUITNL		/"null" to insert a tab
		CUILTE		/column for the time of the last edit
		CUIP11		/"Elapsed Time"
		0		/end of list
	JMS	NWLINE
	JMS	CUITLN	/Display the second line of column info
		CUITP2		/"Number Name"
		CUICRE		/column for creation date/time
		CUITP3		/"Created"
		CUIMOD		/column for modification date/time
		CUITP4		/"modified"
		CUISIZ		/column for document size
		CUITP5		/"Size"
		CUIVER		/column for version number
		CUITP6		/"Version"
		CUILTE		/column for time of last edit
		CUITPE		/"Last"
		CUITTE		/column for total time spent editing
		CUIP13		/"Total"
		0		/end of list

	JMS	NWLINE	/NEXT LINE
	JMS	CUIDOT	/DISPLAY -----
	JMS	NWLINE	/NEXT LINE
	CIFMNU
	JMS I	IOACAL	/PUT IN THE END OF PRINTER CONTROL
		CUIOUD
		CUIDS2
		CUIDR2
	JMP I	CUIPDS


CUIDT2,	XX	/DISPLAY THE TIME FROM WHAT IS IN THE AC.
/		THE FORMAT IS IN MINUTES AND IS DISPLAYED IN HOURS AND MINUTES.
/	the elapsed time is given in minutes and is to be taken to be a positive/M013
/	value. ie. 4000 is taken to mean 34 hrs, 8 minutes. 4001 is 34:09, etc. /M013
/		RETURNS AC=0
	IFNDEF ITALIAN <
	MQL
	DCA	CUID2T	/CLEAR THE HOUR COUNTER
	MQA
	SMA
	JMP CUIDL2	/Skip if elapsed time more than 34:07		/A013
CUIDL1,	TAD	(-74)	/ 1 less Hr.					/A013
	SMA		/ skip if still more than 34:07			/A013
	JMP	CUIDL3	/ Jmp if new time  less than or equal to 34:07	/A013
	ISZ	CUID2T	/ 1 more Hr.					/A013
	JMP	CUIDL1	/ do this again.				/A013
CUIDL2,
	TAD	(-74)	/GET HOURS
	SPA
	JMP CUIDL4
CUIDL3,	ISZ	CUID2T
	JMP 	CUIDL2
CUIDL4,
	TAD	(74)
	DCA	CUID3T	/STORE THE MINUTES
	CIFMNU
	JMS I	IOACAL
		CUIOUT
		CUIDS4
CUID2T,		0
CUID3T,		0
	>
	JMP I	CUIDT2


CUIOUT,	XX	/OUTPUT ROUTINE FOR SCREEN OR GO TO DOCUMENT OPTION
	DCA	T1	/SAVE THE CHARACTER TO OUTPUT
	RDF
	TAD	CIDF0	/MAKE CROSS FIELD CALLABLE
	DCA	CUIOUX
	CDFMYF
	TAD	T1	/Get the character to output
	SNA
	JMP CUIOUX	/SKIP NULLS
	DCA I	CUICPO	/STORE IN BUFFER
	ISZ	CUICPO	/Increment the buffer pointer
CUIOUX,	0		/Restore field
	JMP I	CUIOUT	/Exit


CUITLN,	XX	/DISPLAY THE IOA TEXT STRINGS THAT ARE PASSED
/	TO IT BY ARGUMENTS BY THE CALLER. THE NEXT ARGUMENT TELLS WHERE
/	HORIZONTALLY TO MOVE AFTER THE DISPLAY. TO MAKE THE DOCUMENT APPEAR THE SAME
/	A TAB HAS TO BE INSERTED INTO THE DOCUMENT INSTEAD OF THE MOVE IF THE
/	DOCUMENT OPTION IS BEING USED.
/	CALL:	JMS	CUITLN
/		ADDRESS IF 6-BIT IOA STRING - NO ARGS.
/		LOCATION TO MOVE OR ZERO FOR THE END
CUITLP,
	CLA		/Clear the AC
	TAD I	CUITLN	/Get the string address
	ISZ	CUITLN	/Increment the arg pointer
	DCA	CUITL1	/Store the string address
	CIFMNU
	JMS I	IOACAL	/Print the IOA string
		CUIOUT	/Using this output routine
CUITL1,		0	/Address of the string to be printed
	TAD I	CUITLN	/Get the column to print the next string at
	ISZ	CUITLN	/Increment the col pointer
	SNA
	JMP I	CUITLN	/If col is Zero then exit
	DCA	CUITL2	/Otherwise store the column position
	JMS	CUIPOS	/Position the cursor or make tabs in document
CUITL2,		0	/column position
	JMP	CUITLP	/Loop for next argument set
/-----------------------------------
	PAGE

/	IOA OUTPUT STRINGS
CUIIS1,	
IFDEF ENGLSH <
  TEXT '&^S: ^D, &NAME: ^A, &NO. OF &DOCS: ^D, &BLOCKS LEFT: ^D (OF ^D)' > /C026
IFDEF ITALIAN <
  TEXT '&^S: ^D, &NOME: ^A, &QUANTIT\A: ^D, &BLOCCHI LIBERI: ^D (SU ^D)' >
IFDEF V30NOR <
  TEXT '&^S: ^D, &NAVN: ^A, &ANT. DOK.: ^D, &LEDIGE BLOKKER: ^D (AV ^D)'> /A028
IFDEF V30SWE <
  TEXT '&^S: ^D, &NAMN: ^A, &ANTALDOK: ^D, &LEDIGA BLOCK: ^D (AV ^D)'>
IFDEF DUTCH <
  TEXT '&^S: ^D, &NAAM: ^A, &AANTAL DOCUMENTEN: ^D, &VRIJE BLOKKEN:'
  *.-1
  TEXT '& ^D (UIT ^D)'
	>
IFDEF SPANISH <
  TEXT '&^S: ^D, &NOM: ^A, &NO. DE &DOC: ^D, BLOQUES RESTANTES: ^D (OF ^D)'> 



CUIDS2,	TEXT '^A'
CUIDS3,			/DATE FORMAT, WITHOUT TRAILING SPACE	/A024
	TEXT '^D^S^D^S^D'					/A023
CUIDS4, TEXT '^D:^2D'		/TIME
	IFNDEF DUTCH <
CUIDS5,	TEXT ' !D'		/SIZE
	>
	IFDEF DUTCH <
CUIDS5,	TEXT '  !D'		/SIZE
	>
CUIDS6,	TEXT '  !D'		/VER#
CUIDS7,	
IFDEF ENGLSH  < TEXT '&THERE IS NO DOCUMENT WITH THE NUMBER !D' >
IFDEF ITALIAN < TEXT '&NON ESISTE IL DOCUMENTO !D' >
IFDEF V30NOR  < TEXT '&DOKUMENT NR. !D FINNES IKKE'>			/A028
IFDEF V30SWE  < TEXT '&DET FINNS INGET DOUKMENT MED NUMMER !D'>
IFDEF DUTCH   < TEXT '&ER IS GEEN DOCUMENT MET NUMBER !D'>
IFDEF SPANISH < TEXT '&NO HAY DOCUMENTO CON N\ZMERO !D'>

CUIDE2,	
IFDEF ENGLSH <
  TEXT '^P!E    ^P&UNABLE TO READ INDEX INFORMATION FROM ^S ^D.'>
IFDEF ITALIAN <TEXT "^P!E^P&IMPOSSIBILI LEGGERE L'INDICE DALL'^S ^D." >
IFDEF V30NOR <
  TEXT '^P!E    ^P&KAN IKKE LESE DATA I DOK.-FORTEGNELSEN I ^S ^D.'>	/A028
IFDEF V30SWE < TEXT '&KAN INTE L\DSA INNEH\ELLSF\VRTECKNINGEN I ^S ^D' >
IFDEF DUTCH <
  TEXT '^P!E    ^P&INDEX-INFORMATIE ONLEESBAAR VAN ^S ^D.'>
IFDEF SPANISH <
  TEXT '^P!E    ^P&IMPOSIBLE LEER LA INFORMACI\SN \MNDICE DE ^S ^D.'>


CUILN2,	TEXT '-^S^S' /Used for ------- in index display
CUID10,	TEXT '  ^D'
CUIDN2,	
	IFDEF ENGLSH  < TEXT '&N&O/&D&A/&T&E' >
	IFDEF ITALIAN < TEXT '00/00/00' >
	IFDEF V30NOR  < TEXT "&B&L/&A&N/&K&T" >				/A028
	IFDEF V30SWE  < TEXT '00/00/00' >
	IFDEF DUTCH   < TEXT '00-00-00'>
	IFDEF SPANISH < TEXT '00-00-00'>

CUILN1,	
	IFDEF ENGLSH  < TEXT '-- !&INDEX !&OF !&DOCUMENTS --' >	/M014
	IFDEF ITALIAN < TEXT '-- !&INDICI !&DOCUMENTI --' >
	IFDEF V30NOR  < TEXT '-- !&DOKUMENTFORTEGNELSE --'>		/A028
	IFDEF V30SWE  < TEXT '-- &INNEH\ELLSF\VRTECKNING \VVER DOKUMENT --'>
	IFDEF DUTCH   < TEXT '-- !&INDEX --'>
	IFDEF SPANISH < TEXT '-- !&INDICE !&DE !&DOCUMENTOS --'>


CUITP1,	
	IFDEF ENGLSH  < TEXT '&DOCUMENT' >
	IFDEF ITALIAN < TEXT '&DOCUMENTO' >
	IFDEF V30NOR  < TEXT "&DOKUMENT" >				/A028
	IFDEF V30SWE  < TEXT '&DOKUMENT' >
	IFDEF DUTCH   < TEXT '&DOCUMENT'>
	IFDEF SPANISH < TEXT '&DOCUMENTO'>


CUITP2,	
	IFDEF ENGLSH  < TEXT '&NUMBER  &NAME' >
	IFDEF ITALIAN < TEXT '&NUMERO  &NOME' >
	IFDEF V30NOR  < TEXT "&NUMMER  &NAVN" >				/A028
	IFDEF V30SWE  < TEXT '&NUMMER   &NAMN' >
	IFDEF DUTCH   < TEXT '&NUMMER  &NAAM'>
	IFDEF SPANISH < TEXT '&NOMBRE  &N\ZMERO'>


CUITP3,	
	IFDEF ENGLSH  < TEXT '&CREATED' >
	IFDEF ITALIAN < TEXT '&CREATO' >
	IFDEF V30NOR  < TEXT '&OPPRETTET'>				/A028
	IFDEF V30SWE  < TEXT '&SKAPAT'>
	IFDEF DUTCH   < TEXT '&GEEMAKT'>
	IFDEF SPANISH < TEXT '&CREADO'>


CUITP4,	
	IFDEF ENGLSH  < TEXT '&MODIFIED' >
	IFDEF ITALIAN < TEXT '&MODIFICATO' >
	IFDEF V30NOR  < TEXT '&REDIGERT'>				/A028
	IFDEF V30SWE  < TEXT '&DNDRAD'>
	IFDEF DUTCH   < TEXT '&BEWERKT'>
	IFDEF SPANISH < TEXT '&MODIFICADO'>


CUITP5,	
	IFDEF ENGLSH  < TEXT '&SIZE' >
	IFDEF ITALIAN < TEXT '&DIMENS.' >
	IFDEF V30NOR  < TEXT '&STR.'>					/A028
	IFDEF V30SWE  < TEXT '&STORLEK'>
	IFDEF DUTCH   < TEXT '&OMVNG'>
	IFDEF SPANISH < TEXT '&TAMA\QO'>


CUITP6,	
	IFDEF ENGLSH  < TEXT '&VERSION' >
	IFDEF ITALIAN < TEXT '&VERS.' >
	IFDEF V30NOR  < TEXT 'VERSJON'>					/A028	
	IFDEF V30SWE  < TEXT '&VERSION'>
	IFDEF DUTCH   < TEXT '&VERSIE'>
	IFDEF SPANISH < TEXT '&VERSI\SN'>


	IFDEF ENGLSH <
CUIWS1,	TEXT 'DRIVE'							/A020
CUIWS2,	TEXT 'DEVICE'							/A020
	>
	IFDEF ITALIAN <
CUIWS1,
CUIWS2,	TEXT 'UNIT\A'
	>
	IFDEF V30NOR <
CUIWS1,	TEXT 'STASJON'							/A028
CUIWS2,	TEXT 'ENHET'							/A028
	>								
	IFDEF V30SWE <
CUIWS1, TEXT 'ENHET'
CUIWS2, TEXT 'ENHET'
	>
	IFDEF DUTCH <
CUIWS1,	TEXT 'DISKETTE'
CUIWS2,	TEXT 'GEBIED'
	>

	IFDEF SPANISH <
CUIWS1,	TEXT 'UNIDAD'
CUIWS2,	TEXT 'DISPOSITIVO'>


CUINGD,	XX	/GET THE DOCUMENT THAT THE INDEX IS TO GO TO IF DESIRED.
/		OPEN THE DOCUMENT AND SET THE FLAGS FOR IT.
	CDFMNU
	TAD I	(MUBUF+MNTMP2)	/ZERO TO SCREEN, NONZERO TO DOCUMENT
	CDFMYF
	SNA
	JMP I CUINGD
	DCA	CUIDFG	/SET THE FLAG
	CDFMNU
	TAD I	(MUBUF+MNFNO)	/GET DOCUMENT NUMBER
	CDFMYF
	DCA	CUIDCN
	TAD	CUIDCN
	MQL		/SAVE IN MQ FOR SCROLL
	AC7776		/IF 2 THEN GO TO MAIN MENU
	CDFMNU
	TAD I 	(MUBUF+MNTMP1)	/GET TYPE OF OPEN
	CDFMYF
	SNA
	JMP CUINDR	/RETURN
	TAD	(2)
	CIFFIO
	FILEIO
	XDSKIN						/M0010
	JMP I	CUINGD


NWLINE,	XX	/FLUSH THE BUFFER TO THE SCREEN AND THE DOCUMENT IF HAVE TO
	CLA
	TAD	(CR)	/PUT A CR INTO THE BUFFER FOR THE SCREEN
	DCA I 	CUICPO
	ISZ	CUICPO
	TAD	(LF)		/AND ADD THE LINE FEED
	DCA I	CUICPO
	ISZ	CUICPO
	TAD	(CUIBAD)
	DCA	CUIPCT	/SET THE POINTER  TO THE BEGINING
NWLINL,
	TAD I	CUIPCT
	JMS	CUIOUS	/OUTPUT TO SCREEN
	TAD I	CUIPCT	/NOW TO DOCUMENT
	JMS	CUIOUD
	ISZ	CUIPCT
	TAD	CUICPO	/COMPARE TO LAST CHAR
	CIA
	TAD	CUIPCT
	SPA CLA
	JMP	NWLINL
	TAD	(CUIBAD)	/RESET THE CURRENT POSITION
	DCA	CUICPO
	JMP I	NWLINE


CUIDOT,	XX
	CIFMNU
	JMS I	IOACAL	/DISPLAY THE ----
		CUIOUT
		CUILN2
		IN1DAS
		IN1DAS
	JMP I	CUIDOT
/--------------------------------------
	PAGE

/	IOA OUTPUT STRING
IN1DAS,	TEXT '---------------------------------------'

/RULER AND PRINTER CONTROLS
CUIDRL,
IFDEF ENGLSH <
	16		/Begin ruler code
	"@-200		/Marker to introduce the forward pointing ruler
	"1-200;"D-200	/Left margin (single spacing)
	"9-200;"C-200	/Tab at column 9
	"1-200;76;"C-200	/Tab at column 30 (76 is closing angle brckt
	"2-200;"7-200;"C-200	/Tab at column 39      and cannot be used in
	"3-200;"6-200;"C-200	/Tab at column 54      conditional code.)
	"3-200;";-200;"C-200	/Tab at column 59
	"4-200;"4-200;"C-200	/Tab at column 68
	"4-200;";-200;"C-200	/Tab at column 75
	"4-200;"?-200;"E-200	/Ragged Right margin at 79
	17		/End ruler code
	207		/Word wrap next line
	1014	/Start print control
	164	/t
	157	/o
	160	/p
	12	/End print control
	0
			>
IFDEF ITALIAN	<
	16		/Begin ruler code
	"@-200		/Marker to introduce the forward pointing ruler
	"1-200;"D-200	/Left margin (single spacing)
	"9-200;"C-200	/Tab at column 9
	"1-200;76;"C-200	/Tab at column 30 (76 is closing angle brckt
	"2-200;"7-200;"C-200	/Tab at column 39      and cannot be used in
	"3-200;"6-200;"C-200	/Tab at column 54      conditional code.)
	"3-200;";-200;"C-200	/Tab at column 59
	"4-200;"4-200;"C-200	/Tab at column 68
	"4-200;";-200;"C-200	/Tab at column 75
	"4-200;"?-200;"E-200	/Ragged Right margin at 79
	17		/End ruler code
	207		/Word wrap next line
	1014	/Start print control
	"I-200	/I
	"N-200	/N
	"I-200	/I
	"Z-200	/Z
	"I-200	/I
	"O-200	/O
	12	/End print control
	0
		>
IFDEF DUTCH <
	16		/Begin ruler code
	"@-200		/Marker to introduce the forward pointing ruler
	"1-200;"D-200	/Left margin (single spacing)
	"9-200;"C-200	/Tab at column 9
	"1-200;"4-200;"C-200	/Tab at column 20
	"2-200;"2-200;"C-200	/Tab at column 34
	"3-200;"0-200;"C-200	/Tab at column 48
	"3-200;"9-200;"C-200	/Tab at column 57
	"4-200;"2-200;"C-200	/Tab at column 66
	"4-200;"9-200;"C-200	/Tab at column 74
	"4-200;"?-200;"E-200	/Ragged Right margin at 79
	17		/End ruler code
	207		/Word wrap next line
	1014	/Start print control
	164	/t
	157	/o
	160	/p
	12	/End print control
	0
			> /End IFDEF DUTCH
IFDEF NORWAY <
	16		/Begin ruler code
	"@-200		/Marker to introduce the forward pointing ruler
	"1-200;"D-200	/Left margin (single spacing)
	"9-200;"C-200	/Tab at column 9
	"1-200;76;"C-200	/Tab at column 30 (76 is closing angle brckt
	"2-200;"7-200;"C-200	/Tab at column 39      and cannot be used in
	"3-200;"6-200;"C-200	/Tab at column 54      conditional code.)
	"3-200;74;"C-200	/Tab at column 60 (74 is opening angle brkt
	"4-200;"4-200;"C-200	/Tab at column 68      see above.)
	"4-200;";-200;"C-200	/Tab at column 75
	"4-200;"?-200;"E-200	/Ragged Right margin at 79
	17		/End ruler code
	207		/Word wrap next line
	1014	/Start print control
	164	/t
	157	/o
	160	/p
	160	/p
	12	/End print control
	0
			> /END IFDEF NORWAY
IFDEF SWEDSH <
	16		/Begin ruler code
	"@-200		/Marker to introduce the forward pointing ruler
	"1-200;"D-200	/Left margin (single spacing)
	"8-200;"C-200	/Tab at column 8
	"1-200;":-200;"C-200	/Tab at column 26
	"2-200;"3-200;"C-200	/Tab at column 35
	"3-200;"1-200;"C-200	/Tab at column 49
	"3-200;"9-200;"C-200	/Tab at column 57
	"4-200;"2-200;"C-200	/Tab at column 66
	"4-200;":-200;"C-200	/Tab at column 74
	"4-200;"?-200;"E-200	/Ragged Right margin at 79
	17		/End ruler code
	207		/Word wrap next line
	1014	/Start print control
	164	/t
	157	/o
	160	/p
	160	/p
	12	/End print control
	0
			> /END IFDEF SWEDSH
IFDEF SPANISH <
	16		/Begin ruler code
	"@-200		/Marker to introduce the forward pointing ruler
	"1-200;"D-200	/Left margin (single spacing)
	"9-200;"C-200	/Tab at column 9
	"1-200;"4-200;"C-200	/Tab at column 20
	"2-200;"2-200;"C-200	/Tab at column 34
	"3-200;"0-200;"C-200	/Tab at column 48
	"3-200;"9-200;"C-200	/Tab at column 57
	"4-200;"2-200;"C-200	/Tab at column 66
	"4-200;"9-200;"C-200	/Tab at column 74
	"4-200;"?-200;"E-200	/Ragged Right margin at 79
	17		/End ruler code
/	207		/Word wrap next line
	1014	/Start print control
/	164	/t
/	157	/o
/	160	/p
	151	/i
	12	/End print control
	0
	>

CUIDR2,	1414
CUITNL,	0
CUITPE,
	IFDEF ENGLSH  < TEXT '&LAST' >
	IFDEF ITALIAN < TEXT ' ' >
	IFDEF V30NOR  < TEXT '&SIST'>					/A028
	IFDEF V30SWE  < TEXT '&SENASTE'>
	IFDEF DUTCH   < TEXT '&BEWERK'>
	IFDEF SPANISH < TEXT '&ULTIMO'>

CUIP11,
	IFDEF ENGLSH  < TEXT '&ELAPSED &TIME' >
	IFDEF ITALIAN < TEXT ' ' >
	IFDEF V30NOR  < TEXT '&MEDG\ETT TID'>				/A028
	IFDEF V30SWE  < TEXT '&ANV\DND TID'>
	IFDEF DUTCH   < TEXT '&LAATST/TOT.'>
	IFDEF SPANISH < TEXT '&TIEMPO &TRANSCURRIDO'>

CUIP13,
	IFDEF ENGLSH  < TEXT '&TOTAL' >
	IFDEF ITALIAN < TEXT ' ' >
	IFDEF V30NOR  < TEXT '&I ALT'>					/A028
	IFDEF V30SWE  < TEXT '&SAMMANLAGD'>
	IFDEF DUTCH   < TEXT '&TIJD'>
	IFDEF SPANISH < TEXT '&TOTAL'>


QURX,	XX
	CLA
	CIFSYS; ENQUE; QUBLK
	CIFSYS; JWAIT
	TAD QUQBLK+RXQCOD
	SNA;JMP .-4
	JMP I QURX


GETCHR,	XX
	CLA
	TAD I	GETCHR
	DCA	T1
	ISZ	GETCHR
	TAD I	T1
	CLL RAR
	TAD I	GETCHR
	DCA	T1
	TAD I	T1
	SNL
	BSW
	AND	P77
	ISZ	GETCHR
	JMP I	GETCHR

/
/	The following piece of code really belongs to CUIOUD but guess 
/	what ... there isn't enough room on that page , quel surprise.
/
/


CUI8BT,				/ Ouput 8 bit char as dead 		/A027
	CLA			/					/A027
	MQA			/ Get char back				/A027
	AND 	P177		/ Strip off 8th bit			/A027
	DCA	CUMNCH		/ Save char				/A027
	TAD	(CUMNSTR	/ Get address of dead string		/A027
	DCA	CUMNPTR		/ Save it				/A027
CU8NXT,	TAD I	CUMNPTR		/ Get next char in loop			/A027
	SNA			/ Is it the zero terminator ?		/A027
	JMP	CUIODX		/ Yes rejoin mailine			/A027
	CIFFIO			/ Off to Files				/A027
	FILEIO			/ Output to document			/A027
	XPUTST			/ Put char to scroll			/A027
	ISZ	CUMNPTR		/ Bump to next				/A027
	JMP	CU8NXT		/ And go again				/A027



CUMNSTR,10;40;62		/ Start of dead , space , MNC intro	/A027
CUMNCH,	0			/ MN char (modified in line)		/A027
CUMNRST,15;0			/ End of dead and terminator		/A027
CUMNPTR,0			/ Pointer into "dead thing" string	/A027




/------------------------------------------
	PAGE







/THE ERROR ROUTINE THAT IS USED BY INDEX WHEN THE FILE DOESNT
/MATCH THE NUMBER IN THE INDEX FILE
CUIDBN,
	CLA
	TAD	CUIDFO
	DCA	CUID8
	CIFMNU
	JMS I IOACAL
		CUIOUT
		CUID10
CUID8,		0
	JMS CUIPOS
		CUINME
	CIFMNU
	JMS I IOACAL
		CUIOUT
		CUIDS2
		CUIDST
	JMS	NWLINE
	JMS CUIPOS
		CUIERO
	CIFMNU
	JMS I IOACAL		/Print "No document with number !D"
		CUIOUT		/Output routine
		CUIDS7		/Address of string
		CUID8		/Document number
	JMP	CUIDSR		/RETURN

CUIDER,
	CLA
	TAD	CUIDRV		/GET DRIVE NUMBER FOR ERROR MESSAGE
	DCA	CUIDE1
	CIFMNU
	JMS I IOACAL
		0
		CUIDE2
		0
		700
CUISA2,		CUIWS1		/ ADDR OF SUB-STRING			/A020
CUIDE1,		0
	CLA
	DCA	CUIPGE		/ SET ENTRIES = 0		/A017
	DCA	CUIREM		/ SET DOC. REMAINING = 0	/A017
	TAD	(-5)
	DCA	CUICNT
	JMS	CUIWAT		/ WAIT FOR USER RESPONSE
	JMP	CUINDR		/ CLEAN UP AND TERMINATE
	JMP	CUINDR		/DON'T REMOVE THIS LINE

CUIOUD,	XX	/OUTPUT TO A DOCUMENT IF NEEDED
	MQL		/FIRST SEE IF SHOULD GO TO DOCUMENT
	RDF		/MAKE CROSS FIELD CALLABLE
	TAD	CIDF0
	DCA	CUIODX
	TAD	(-13)	/SEE IF THE DISK HAS 10 BLOCKS OR LESS ON IT FREE
	CDFFIO
	TAD I (SCFSPC)
	CDFMYF					/M0010
	SMA CLA
	JMP	CUIOU2
	AC0001
	DCA	CUIOVR	/SET FLAG FOR OVERFLOW
	JMP	CUIODX
CUIOU2,
	CDFMYF
	TAD	CUIDFG
	SNA CLA
	JMP	CUIODX
	MQA
	TAD	(-CR)	/GET RID OF CR
	SNA
	TAD	(-CR)
	TAD	(CR)
	TAD	(-200)		/ Is it 8 bit 				/A027
	SMA SZA			/					/A027
	JMP	CUI8BT		/ yes , Go set it up			/A027
	TAD	(200)		/ No , Add back 200			/A027
	CIFFIO
	FILEIO
	XPUTST						/M0010
CUIODX,	XX
	JMP I	CUIOUD

/THIS IS USED IN CUIOVR, HERE FOR ROOM
CUICSR,
	TEXT '^P!E'

/****************************************************************************
/
/	THIS ROUTINE CHECKS FOR A WINCHESTER DRIVE ON THE SYSTEM.
/
/****************************************************************************
CUICKW,	XX				/ RETURN ADDR			/A020
	CLA				/ CLEAR AC			/A020
/D025	CDFMNU				/ MENU FIELD			/A020
/D025	TAD	MUBUF+MNOPTN		/ FETCH OPTION WORD		/A020
/D025	CDFMYF				/ BACK TO THIS FIELD		/A020
/D025	DCA	CUIOPT			/ SAVE VALUE			/A020
/D025	AC0004				/ MASK VALUE FOR WINNIE		/A020
/D025	AND	CUIOPT			/ IS WINNIE BIT SET ?		/A020
/D025	SNA	CLA			/ YES - SKIP & CONTINUE		/A020
/D025	JMP	CUICTD			/ NO  - INSERT "DRIVE		/A020
/D025	TAD	CUIDRV			/ CK FOR DRIVE 0		/A020
/D025	SNA				/ NO  - SKIP & CONTINUE		/A020
/D025	JMP	CUICTD			/ YES - INSERT "DRIVE		/A020
/D025	TAD	(-1			/ IS IT 1 ?, DRIVE OR DEVICE	/A020
/D025	SZA	CLA			/ YES - SKIP & CONTINUE		/A020
/D025	JMP	CUICTW			/ NO  - INSERT "DEVICE		/A020
/D025	AC0010				/ MASK - VOLUME ASSIGNED TO 1	/A020
/D025	AND	CUIOPT			/ IS VOLUME ASSIGNED ?		/A020
/D025	SNA	CLA			/ YES - SKIP & CONTINUE		/A020
	TAD	CUIDRV			/CURRENT DRIVE NUMBER		/A025
	TAD	(RXSTRT+1		/ACP DRIVE TABLE START ADDRESS	/A025
	DCA	CUIPTR			/POINTER TO DRIVE DATA IN ACP	/A025
	CDFACP				/ACP DATA FIELD			/A025
	TAD I	CUIPTR			/GET DEVICE DATA		/A025
	CDFMYF								/A025
	SMA CLA				/IS HARD DISK DEVICE?		/A025
					/....4000=H.D.UNMOUNTED		/A025
					/....4001 = H.D. MOUNTED	/A025
					/.... H. ORDER BIT =0 =RXDEVICE	/A025
	JMP	CUICTD			/ NO  - INSERT "DRIVE		/A020

/		****** CHANGE TEXT TO "DEVICE				/A020
CUICTW,	TAD	(CUIWS2)		/ ADDR OF "DEVICE		/A020
	DCA	CUISA1			/ INTO PARAMETER LIST		/A020
	TAD	(CUIWS2)		/ AGAIN, THERE ARE 2 CALLS	/A020
	DCA	CUISA2			/ INTO PARAMETER LIST		/A020
	JMP	CUICWE			/ BRANCH TO EXIT		/A020
CUIPTR,	RXSTRT+1			/POINTER TO ACP TABLE		/A025

/		****** CHANGE TEXT TO "DRIVE				/A020
CUICTD,	CLA				/ CLEAR AC			/A020
	TAD	(CUIWS1)		/ ADDR OF "DRIVE		/A020
	DCA	CUISA1			/ INTO PARAMETER LIST		/A020
	TAD	(CUIWS1)		/ AGAIN, THERE ARE 2 CALLS	/A020
	DCA	CUISA2			/ INTO PARAMETER LIST		/A020
CUICWE,	JMP I	CUICKW			/ THIS IS THE EXIT POINT	/A020

CUIOPT,	0				/ OPTION WORD			/A020
/-------------------------------------------
	PAGE

/ IF CODE OVERFLOWS INTO BUFFER AREA, ERROR.

IFNZRO CUIBFD-.&4000  <XOVFLO, CODETOOLONG>


