/ WPEDIT 3.XX
/
/		********  EDIT HISTORY  ********

/ 258	KMD	23-Sep-85	Add Spanish Xlations and Page size check
/ 257	KMD	17-Sep-85	Add Sveeedish translation IFDEFs
/ 256	KMD	16-Sep-85	Add Norwegen (?) ifdefs.
/				MAKE SURE !!!!!
/				That you don't push the area of NWRUL buffer
/				up by a page by having translations that are
/				slightly too long .. Great fun..
/
/
/ 255   KMD	13-Sep-85	Add Spanish technical changes (not xlations)
/ 254	EMcD	26-Aug-85	Add Insert-Overstrike mode
/ 253	EMcD	19-Aug-85	Conditionalise Swedish Ruler store /recall
/ 252 	Mart	15-aug-85	add DUTCH
/ 251	KMD	02-AUG-85	Allow international radix characters
/ 250	EMcD	13-Jul-85	Put in FAO keyboard for Ruler store/recall
/ 249	RCME	03-Jul-85	Fix bug in LP and spell caused by 247
/ 248	RCME	01-Jul-85	Define new table to take 8-bit characters
/				in ruler definitions
/ 247	RCME	24-Jun-85	Allow MCS currency symbols
/ 246	EMcD	07-jun-85	Fix write out of WPHOLE
/ 245	EMcD	22-may-85	Move PGECHO out to Panel to make some room
/ 244	EMcD	22-May-85	More Hyphenation code for 8 bit
/ 243	EMcD	21-May-85	Write out one more block of blasts
/ 242	EMcD	06-May-85	Expand write-out code for WPHOLE because
/				of extra block for Blast for 8 bit GOLD SWAP
/ 241	EMcD	23-Apr-85	Allow trans of 8 bit input only for
/				KB input chars
/ 240	rcme	22-Apr-85	Added load information for merge overlay hole
/ 239	Mart	19-mar-85	moved CMPRUL,CLRRULR to WPHOLE added ESIMCH
/ 238	Mart	11-mar-85	added blaster hook and made space by removing
/				part of the ruler buffer copy to panel mem
/
/ *********** mods below are V2.0 and earlier
/
/ 237	WCE	20-DEC-84	Fix PUTSCH to output attributes across screens
/ 236	WCE	12-NOV-84	Editor MATH changes for spaces in tab fields
/ 235	WCE	12-OCT-84	Change Status Line for Column Cursor display
/ 234	WCE	24-SEP-84	Change to Tech Character overlay call
/ 233	EJL	23-AUG-84	CALLAR checks menu code is swapped out before
/				JMS into field 2
/				Fix reset of ruler during window change
/ 232	WCE	21-AUG-84	Fix to EDITOR MATH error handling during SWAP
/ 231	WJY	21-AUG-84	Fix to caller routine to clear skip return flag
/ 230	WCE	20-AUG-84	Change to file open for Personal Dict and Spell
/ 229	WJY	09-AUG-84	Return to main menu when the SPELL overlay INITSP
/				is unable to open a file.
/ 228	WCE	07-AUG-84	CHANGED GETLIN TO FIX PROBLEM WITH TIME DISPLAY
/ 227	EJL	07-AUG-84	Change FMSWAP calls to CALLAR and remove FMSWAP
/				Added stacking of 10 levels to CALLAR
/ 226	BC	26-JUL-84	Delete SPLTFL, use WIDNAR flag for 80/132
/ 225	WCE	24-JUL-84	Added REGION indicator to Status Line display
/ 224	WCE	16-JUL-84	Changes for BRITISH pound sign
/ 223	BC	16-JUL-84	Added manual screen width choice
/ 222	BC	09-JUL-84	Deleted routine PPCALL from editor (not needed)
/ 221	WCE	28-JUN-84	Fix to COPY-DOC then EDIT crashing system
/ 220	WCE	27-JUN-84	Various bug fixes to EDITOR
/ 219	EJL	25-JUN-84	Expand ruler from 158 to 238
/ 218	GDC	05-JUN-84	Field 2 routines using own callaroutine.
/ 217	GDC	05-JUN-84	Moved CENTER to field 2.
/ 216	DKR	01-JUN-84	Test MNSTAT for Ruler Display ON/OFF. Added
/				@RULOFF' to pt to Case-Table for Ruler Display
/ 215	DKR	29-MAY-84	Gold:Tab changes for key trapping
/				removed code associated with @tab center'
/ 214	BC	22-MAY-84	Add PPCALL (=CALLAROUTINE) to 2nd overlay
/				for Post Proc. calls to Edit subrs; add SB's
/				footnote fixes to INITSP.
/ 213	GDC	14-MAY-84	Added handling for second overlay area.
/ 212	WCE	11-MAY-84	Remove all occurrances of USERNO
/ 211	EJL	08-MAY-84	Add hooks for technical character
/ 210	WCE	02-MAY-84	Moved Resident Overlay from WPEDOV to WPEDIT
/ 209	GDC	29-APR-84	Moved LINDNT to field 2.
/ 208	GDC	23-APR-84	Moved FNTABSTOP and TBJUST to field 2.
/ 207	GDC	12-APR-84	Moved CHKMAR into field 2 freeing space in
/				editor root.
/ 206	GDC	24-MAR-84	Space saving mods
/ 205	AH	21-MAR-84	Add code for COLUMN CUT
/ 204	WCE	14-MAR-84	Change startup point from EIFIX to EINEXA to
/				correct a problem with blocks used display
/ 203	GDH	 2-MAR-84	Fix SELECT bug with line exactly R-MARG long.
/ 202	WJY	29-FEB-84	Fix top of document display when DMI document
/				is opened in wide screen mode
/ 201	WJY	24-FEB-84	Fix DMI wide screen bug caused by removing DMI
/				specific code
/ 200	WJY	07-FEB-84	DECmate I compatability.
/ 199	EH	21-DEC-83	Fix for CHKMAR, handling tabs on wrapped lines
/ 198	GDH	20-DEC-83	Unconditionalized the math checks.
/ 197	EH	20-DEC-83	Moved the 5 ruler words on page 0 so as not to
/				get cleared at INITialization. (for GTR)
/ 196	GDH	13-DEC-83	Changed DSPRUL to accomodate status line changes.
/ 195   WJD     31-OCT-83	Remove GOLD_HALT from GTP & GOLD_BOTTOM
/				and change GOLD_BOTTOM logic to GTP logic
/ 194	WCE	27-OCT-83	REMOVED ALL PREVIOUS EDIT HISTORIES FOR
/				NEW VERSION 1.5 SOURCES


	FIELD 0			/ FIELD WHERE RXHAN IS LOCATED
	*200			/ START ADDRESS USED BY OS8 "GO" COMMAND
	JMP I	.+3		/ LOCATION USED TO START UP RXHAN
	JMP I	.+1		/ LOCATION USED TO RETURN TO OS8 MONITOR
	7605			/ ADDRESS OF OS8 MONITOR RETURN POINT
	RXLOAD			/ ADDRESS OF START LOCATION FOR RXHAN

	*RXLDLS			/ ADDRESS WITHIN RXHAN TO OVERLAY
	RXEWT			/ WRITE FUNCTION CODE
	0
	RXQBLK			/ ADDRESS OF QUEUE BLOCK TO USE
	.			/ ADDRESS OF TABLE OF DISK COMMANDS

	DLSTAT	 ; 400;CDF  0;-DSSTAT	/ SWAP AREA CODE & STATUS LINE
	DLOEDT	 ;   0;CDF 10;-DSOEDT	/ MAIN EDITOR
	DL3EDT	 ; 200;CDF 20;-DS3EDT	/ MORE EDITOR RESIDENT CODE
	DL4EDT	 ;1600;CDF 20;-DS4EDT	/ EDITOR MATH CODE, ONLY LOADED
					/ IN WHEN NOT IN LIST PROCESSING
	DLBLED	;HOLEPG	;CDF 60	;-DSBLED/ load out editor blastr holes
	DLBEOV	;HOLEOV ;CDF 50 ;-DSBEOV/ Load out Extra Blast holes	/a242
	DLEHL2	;HOLEOV ;CDF 60 ;-DSEHL2/ Load out one more hole block/M245/A243
	0

/ WPEDIT - EDITOR JOB

ECMTH1=	06			/ START OF MATH CODE
ECMTH2=	206			/ END OF MATH CODE

RECBUF=	10			/ Start of RECord_BUFfer in buffer field
				/ (for List Processing)

HDRBUF=	6000			/ START OF EDIT FILE HEADER BUFFER
HDRFSZ=	5			/ # BLOCKS IN THIS FILE
HDRPSZ=	15			/ #LINES PER PAGE
ETXBUF=	HDRBUF+400		/ ETX BUFFER
STXBUF=	ETXBUF+400		/ STX BUFFER
PSTEBF=	STXBUF+400		/ PASTE BUFFER
PRTBUF=	HDRBUF			/ MERGE-TO-PRINTER BUFFER
PRTSIZ=	STXBUF-PRTBUF		/   "         "    SIZE
BUFEND=	HDRBUF			/ END OF EDIT BUFFER +1

BASKET=	PSTEBF			/ WASTEBASKET
BASKSZ=	400			/ WASTEBASKET CAPACITY

PSTEBG=	DLCUTB			/ FIRST PASTE BLOCK
PSTEND=	PSTEBG+36		/ LAST PASTE BLOCK +1

CR=	15
LF=	12
WIDTH=	204			/ WIDTH OF SCREEN
COLLIM=	360			/ M219 Display ruler out to 240
				/ RULSV2 displays out to 240
				/ RLADV1, RLINE1 limits advance to 238
HAFRUL=	COLLIM-1%2		/ A219 Limit ruler to 238
COLM80=	117			/ 80TH COLUMN POINTER
COLM81=	COLM80+1		/ A219
NPTRS=	30			/ NUMBER OF SCREEN LINES AVAILABLE ON TERMINAL
CURPOS=	46			/ CURRENT HORIZ POSITION  ON SCREEN
LOWLIM=	47			/ SCREEN'S CURRENT LOW LIMIT,
				/	EITHER 0 OR 27 DECIMAL


/***************************************************************************
/****	  PAGE ZERO LOCATIONS USED BY STATUS LINE DISPLAY ROUTINE	****
/***************************************************************************

CDFMYF=	CDFMNU

	*170
LINFLG,	0			/ LOCATION FOR STATUS DISPLAY MODE FLAG
LINRUL,	0			/ LOCATION FOR RULER DETECTED FLAG
LINDIF,	0			/ LOCATION FOR STATUS DIFFERENT FLAG
LINPGL,	0			/ LOCATION FOR CURRENT LOW ORDER PAGE NUMBER
LINPGH,	0			/ LOCATION FOR CURRENT HIGH ORDER PAGE NUMBER
LINNUM,	0			/ LOCATION FOR CURRENT LINE NUMBER
LINUSD,	0			/ LOCATION FOR NUMBER OF BLOCKS USED
LINFRE,	0			/ LOCATION FOR NUMBER OF BLOCKS FREE

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/--------------------
	PAGE

	RELOC			/ RESET RELOCATION MECHANISM OF ASSEMBLER
	*400			/ SET LOCATION COUNT TO FREE AREA IN FIELD 0
	RELOC SWPBEG		/ LOCATION FOR STATUS LINE CODE TO RUN

DSKBLK=.-SWPBEG%400+DLSTAT	/ DISK BLOCK WHERE PAGE IS LOADED

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

CALLN1,	XX			/ ENTRY POINT FOR ROUTINE NUMBER 1
	JMS	CALSUB		/ SET UP RETURN ADDRESS AND RETURN FIELD
	JMS	LINDSP		/ GO UPDATE STATUS LINE INFORMATION
	JMP	CALXIT		/ GO TO RETURN TO CALLER CODE

CALLN2,	XX			/ ENTRY POINT FOR ROUTINE NUMBER 2
	JMS	CALSUB		/ SET UP RETURN ADDRESS AND RETURN FIELD
	JMS	LINCHK		/ GO CHECK FOR STATUS VALUE CHANGES
	JMP	CALXIT		/ GO TO RETURN TO CALLER CODE

CALLN3,	XX			/ ENTRY POINT FOR ROUTINE NUMBER 3
	JMS	CALSUB		/ SET UP RETURN ADDRESS AND RETURN FIELD
	JMS	LINSDN		/ GO HANDLE SCROLL DOWN EVENT
	JMP	CALXIT		/ GO TO RETURN TO CALLER CODE

CALLN4,	XX			/ ENTRY POINT FOR ROUTINE NUMBER 4
	JMS	CALSUB		/ SET UP RETURN ADDRESS AND RETURN FIELD
	JMS	LINSUP		/ GO HANDLE SCROLL UP EVENT
	JMP	CALXIT		/ GO TO RETURN TO CALLER CODE

CALLN5,	XX			/ ENTRY POINT FOR ROUTINE NUMBER 5
	JMS	CALSUB		/ SET UP RETURN ADDRESS AND RETURN FIELD
	JMS	LINCOL		/ SPECIAL CHECK FOR STATUS VALUE CHANGES /C235
	JMP	CALXIT		/ GO TO RETURN TO CALLER CODE

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

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

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

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

CALSUB,	XX			/ ROUTINE TO SET UP RETURN FIELD AND ADDRESS
	DCA	LINFLG		/ SAVE CONTENTS OF ACCUMULATOR IN FLAG WORD

	RDF			/ READ CALLERS DATA FIELD
	TAD	CIDF0		/ MAKE CDF-CIF INSTRUCTION BACK TO CALLER
	DCA	CALXIT		/ STORE FOR RETURN TO CALLER
	CDFMYF			/ SET DATA FIELD BACK TO MY FIELD

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

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


	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/--------------------
	PAGE

DSKBLK=.-SWPBEG%400+DLSTAT	/ DISK BLOCK WHERE PAGE IS LOADED


/***************************************************************************
/****	THE CODE ASSEMBLED HERE IS USED BY THE EDITOR FOR STATUS LINE	****
/***************************************************************************


LINCOL,	XX			/ SPECIAL CHECK FOR STATUS VALUE CHANGES /A235
	TAD I	(MUBUF+MNSTAT)	/ PICK UP THE NUMBER OF STATUS LINES	/A235
	SNA CLA			/ ARE WE DISPLAYING STATUS INFORMATION	/A235
	JMP I	LINCOL		/ NO, RETURN TO CALLER			/A235
	CDFEDT			/ CHANGE TO EDIT FIELD			/A235
	TAD I	(GSRF)		/ PICK UP THE GLOBAL SEARCH FLAG	/A235
	CDFMYF			/ RESET BACK TO THIS FIELD		/A235
	SZA CLA			/ ARE WE DOING A GLOBAL SEARCH & REPLACE/A235
	JMP	LINPOS		/ YES, GO UPDATE COLUMN INFORMATION	/A235
	JMS	LINCHK		/ GO CHECK FOR STATUS VALUE CHANGES	/A235
	AC7775			/ SET UP FOR A COUNT OF THREE		/A235
	DCA	T2		/ STORE IN COUNTER REGISTER		/A235
LINLOP,	CIFSYS			/ CHANGE TO SYSTEM FIELD		/A235
	JWAIT			/ WAIT FOR A SIGNIFICANT EVENT		/A235
	CIFSYS			/ CHANGE TO SYSTEM FIELD		/A235
	XLTIN			/ GET A CHARACTER FROM KEYBOARD BUFFER	/A235
	JMP	LINNCH		/ NO CHARACTERS AVAILABLE, SKIP AROUND	/A235
	ISZ	CALRTN		/ GOT ONE, BUMP RETURN ADDRESS		/A235
	JMP I	LINCOL		/ RETURN TO CALLER			/A235
LINNCH,	ISZ	T2		/ INCREMENT THE COUNTER			/A235
	JMP	LINLOP		/ NOT DONE, GO WAIT SOME MORE		/A235
LINPOS,	TAD	LINCUR		/ PICK UP THE LAST DISPLAYED POSITION	/A235
	DCA	T2		/ SAVE FOR LATER COMPARE		/A235
	CDFEDT			/ CHANGE TO EDIT FIELD			/A235
	TAD I	(CURSOR)	/ PICK UP THE CURRENT CURSOR POSITION	/A235
	CDFMYF			/ RESET BACK TO THIS FIELD		/A235
	IAC			/ BUMP TO REAL VALUE			/A235
	DCA	LINCUR		/ SAVE THE VALUE FOR DISPLAY		/A235
	TAD	LINCUR		/ PICK UP THE COLUMN POSITION		/A235
	CIA			/ MAKE IT NEGATIVE			/A235
	TAD	T2		/ COMBINE WITH PREVIOUS VALUE		/A235
	SNA CLA			/ ARE THEY THE SAME ?			/A235
	JMP I	LINCOL		/ YES, DON'T REDISPLAY, RETURN TO CALLER/A235
	JMS I	IOACAL		/ CALL IOA TO DISPLAY THE VALUE		/A235
	0			/ USE DEFAULT IOA OUTPUT ROUTINE	/A235
	LINST1			/ CONTROL STRING TO DISPLAY VALUE	/A235
	24			/ SCREEN POSITION			/A235
	LINREV			/ SELECT REVERSE VIDEO IF SPECIFIED	/A235
LINCUR,	XX			/ LOCATION FOR CURRENT CURSOR POSITION	/A235
	JMP I	LINCOL		/ RETURN TO CALLER			/A235

LINCLR,	XX			/ ROUTINE TO CLEAR SCREEN AND SET VALUES
	JMS I	IOACAL		/ CALL IOA TO CLEAR THE SCREEN
	0			/ USE DEFAULT IOA OUTPUT ROUTINE
	LINST2			/ CLEAR SCREEN AND SCROLL AREA		/C235

	TAD	LINTXT		/ GET POINTER TO CURRENT TEXT SIZE
	CIFFIO			/ CHANGE TO FILE SYSTEM FIELD
	FILEIO			/ CALL FILE SYSTEM TO GET HEADER VALUE
	XHDRGT			/ GET VALUE FROM HEADER FUNCTION WORD
	DCA	LINSIZ		/ STORE VALUE OF CURRENT TEXT SIZE

	CDFFIO			/ CHANGE TO FILE SYSTEM FIELD
	TAD I	(SCFSPC)	/ GET NUMBER OF BLOCKS LEFT ON DISK
	CDFMYF			/ CHANGE BACK TO MENU FIELD
	DCA	T3		/ SAVE NUMBER OF FREE BLOCKS IN TMP

/ THE VALUE STORED IN LINFRE IS USED AS A FLAG TO INDICATE THAT THE MID SCREEN
/ DOCUMENT HEADER INFORMATION SHOULD BE DISPLAYED ON THE SCREEN.  IF THE VALUE
/ OF LINFRE IS ZERO, IT INDICATES THAT THE NUMBER OF FREE BLOCKS REMAINING ON
/ THE DISKETTE HAS NOT BEEN UPDATED WHICH HAPPENS AT DOCUMENT OPEN TIME AND
/ THAT THE MID SCREEN DATA IS REQUIRED.
/
/ THERE IS A CASE WHERE LINFRE HAS NOT BEEN UPDATED AND THE MID SCREEN
/ INFORMATION IS NOT WANTED.  WHEN THIS HAPPENS, THE VLAUE OF THE OPERATION
/ FLAG WORD STORED IN LINFLG IS A THREE WHICH MEANS THAT ONLY A CLEAR SCREEN
/ IS DESIRED.  A VALID TEST IS MADE BY COMBINING THE VALUES OF BOTH WORDS.

	TAD	LINFLG		/ GET FLAG WORD FOR CURRENT OPERATION
	TAD	LINFRE		/ GET LAST VALUE OF BLOCKS FREE
	SNA CLA			/ HAS IT BEEN INITIALIZED AND LINFLG=0
	JMP	LINMID		/ NO, GO DISPLAY MIDDLE LINES OF SCREEN
	TAD	T3		/ GET CURRENT BLOCKS FREE
	CIA			/ NEGATE VALUE FOR CHECK
	TAD	LINFRE		/ COMBINE WITH LAST VALUE OF BLOCKS FREE
	TAD	LINUSD		/ ADD RESIDUE TO NUMBER OF BLOCKS USED
	DCA	LINUSD		/ STORE UPDATED NUMBER OF BLOCKS USED
	JMP	LINSET		/ GO STORE CURRENT VALUE OF BLOCKS FREE

LINMID,	JMS I	IOACAL		/ CALL IOA TO DISPLAY MID SCREEN DATA
	0			/ USE DEFAULT IOA OUTPUT ROUTINE
	LINST3			/ CONTROL STRING FOR TEXT DISPLAY
IFDEF CONDOR < 710 >		/ LOCATION FOR DOCUMENT NAME		/C202
IFNDEF CONDOR < 310 >		/  COMPROMISE VALUE, WORKS IN BOTH	/A202
				/   WIDE SCREEN & NORMAL MODES FOR DMI	/A202
	MUBUF+MNDRV		/ MENU LOCATION FOR DRIVE NUMBER
	MUBUF+MNDOCN		/ MENU LOCATION FOR DOC NUMBER
	MUBUF+MNFNAM		/ MENU LOCATION FOR DOC NAME
IFDEF CONDOR < 1110 >		/ LOCATION FOR FIRST SCREEN LINE	/C202
IFNDEF CONDOR < 510 >		/  COMPROMISE VALUE, WORKS IN BOTH	/A202
				/   WIDE SCREEN & NORMAL MODES FOR DMI	/A202
	LINUSD			/ LOCATION FOR BLOCKS USED VALUE
IFDEF CONDOR < 1310 >		/ LOCATION FOR SECOND SCREEN LINE	/C202
IFNDEF CONDOR < 710 >		/  COMPROMISE VALUE, WORKS IN BOTH	/A202
				/   WIDE SCREEN & NORMAL MODES FOR DMI	/A202
	T3			/ LOCATION FOR BLOCKS FREE VALUE
IFDEF CONDOR < 1510 >		/ LOCATION FOR THIRD SCREEN LINE	/C202
IFNDEF CONDOR < 1110 >		/  COMPROMISE VALUE, WORKS IN BOTH	/A202
				/   WIDE SCREEN & NORMAL MODES FOR DMI	/A202
	LINSIZ			/ LOCATION FOR CURRENT TEXT SIZE VALUE

LINSET,	TAD	T3		/ GET CURRENT NUMBER OF BLOCKS FREE
	DCA	LINFRE		/ STORE UPDATED NUMBER OF BLOCKS FREE

	AC7775			/ SET UP FOR A DECREMENT
	TAD I	(MUBUF+MNSTAT)	/ PICK UP NUMBER OF STATUS LINES
	SMA CLA			/ CHECK FOR A ONE OR TWO LINE TOP AREA
	IAC			/ BUMP UP TO A TWO LINE AREA
	TAD	LINTWO		/ SET UP FOR A ONE OR TWO LINE TOP AREA
	DCA	LINAD1		/ STORE FOR USE WITH IOA CALL

	AC7776			/ SET UP FOR A DECREMENT
	TAD I	(MUBUF+MNSTAT)	/ PICK UP NUMBER OF STATUS LINES
	SPA CLA			/ CHECK FOR A RULER LINE AREA
	IAC			/ NO RULER, BUMP UP TO FULL SCREEN
	TAD	("3)		/ SET UP RULER AREA IF SPECIFIED
	DCA	LINAD2		/ STORE FOR USE WITH IOA CALL
	DCA	LINCUR		/ CLEAR COLUMN POSITION FOR REDISPLAY	/A235
	JMP I	LINCLR		/ RETURN BACK TO CALLER

LINTXT,	15-2			/ POINTER TO HEADER CURRENT TEXT SIZE

LINSTE,	TEXT '!Y'		/ RESTORE CURSOR ATTRIBUTES

LINSTF,	TEXT '![(&^S^A![[?6H'	/ SELECT LANGUAGE & RELITIVE MODE	/C235
		/ ESC [ ? 6 h	/ SELECT RELITIVE ORIGIN MODE		/C235
LINSTG,	ESC; "[			/ START SELECTION OF SCROLL REGION	/C224
LINAD1,	"2; ";			/ FIRST ROW OF SCROLL REGION 2 OR 3
LINTWO,	"2
LINAD2,	"3; "r                  / LAST ROW OF SCROLL REGION AT 23 OR 24
	0			/ ASCII STRING TERMINATOR

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/--------------------
	PAGE

DSKBLK=.-SWPBEG%400+DLSTAT	/ DISK BLOCK WHERE PAGE IS LOADED


/***************************************************************************
/****	THE CODE ASSEMBLED HERE IS USED BY THE EDITOR FOR STATUS LINE	****
/***************************************************************************

/ LINDSP ROUTINE IS USED TO DISPLAY THE STATUS LINE INFORMATION IN THE EDITOR
/
/ THE STATUS LINE AREA CONSISTS OF ONE OR TWO OR THREE LINES AS FOLLOWS:
/ LINE  1 = TOP LINE OF SCREEN - CURRENT PAGE NUMBER, CURRENT LINE NUMBER,
/           DRIVE NUMBER, DOCUMENT NUMBER AND DOCUMENT NAME BEING EDITED
/ LINE  2 = (IF SPECIFIED) A GRAPHICS BAR UNDER LINE ONE
/ LINE 24 = (IF SPECIFIED) CURRENT RULER IN EFFECT FOR EDITING
/
/ PRIOR TO ENTRY, THE VALUE CONTAINED IN MNSTAT DETERMINES TYPE OF STATUS
/ DISPLAYED AS FOLLOWS:
/
/	MNSTAT = 0	NO STATUS DISPLAYED WHILE EDITING
/	MNSTAT = 1	REVERSE VIDEO TOP STATUS LINE ONLY
/	MNSTAT = 2	REVERSE VIDEO TOP STATUS LINE AND CURRENT RULER
/	MNSTAT = 3	TOP STATUS LINE WITH GRAPHICS BAR AND CURRENT RULER
/
/ UPON ENTRY, THE VALUE CONTAINED IN THE AC DETERMINES FUNCTION AS FOLLOWS:
/
/	AC = 0	CLEAR THE SCREEN AND DISPLAY COMPLETE STATUS AREA
/		DEFINE SCROLLING REGION AND SET RELITIVE SCREEN ADDRESSING
/	AC = 1	UPDATE DISPLAY OF TOP STATUS LINE ONLY
/	AC = 2	UPDATE DISPLAY OF BOTTOM STATUS LINE ONLY (DISPLAY RULER)
/	AC = 3	CLEAR THE SCREEN AND RESET SCROLLING AREA TO FULL SCREEN

LINDSP,	XX			/ DISPLAY STATUS LINE ROUTINE
	TAD	LINFLG		/ GET STATUS DISPLAY MODE FLAG
	SZA			/ CHECK FOR DISPLAY ALL MODE
	TAD	LINM3		/ NO, CHECK FOR SCREEN CLEAR & RESET
	SNA CLA			/ WAS SCREEN CLEAR & RESET REQUESTED
	JMS	LINCLR		/ YES, GO CLEAR SCREEN AND SET VALUES

	TAD I	(MUBUF+MNSTAT)	/ PICK UP NUMBER OF STATUS LINES
	SNA			/ CHECK TO SEE IF STATUS AREA IS ACTIVE
	JMP	LINXIT		/ NO, STATUS IS NOT ACTIVE, RETURN TO CALLER
	TAD	LINM3		/ DECREMENT THE COUNT
	SMA CLA			/ CHECK FOR TOP LINE TO BE REVERSE VIDEO
	AC0004			/ NO REVERSE VIDEO, BUMP ADDRESS TO NULL POINT
	TAD	(LINST5)	/ PICK UP ADDRESS OF REVERSE VIDEO STRING
	DCA	LINREV		/ STORE FOR USE WITH IOA CALLS

	TAD	LINFLG		/ GET STATUS DISPLAY MODE FLAG
	SZA CLA			/ CHECK FOR DISPLAY ALL MODE
	JMP	LINTOP		/ NO, GO CHECK FOR TOP LINE

	JMS I	IOACAL		/ CALL IOA TO DISPLAY TOP REVERSE VIDEO LINE
	0			/ USE DEFAULT IOA DISPLAY ROUTINE
	LINST4			/ DISPLAY REVERSE VIDEO AREA AND DOC NAME
	0			/ SCREEN POSITION FOR REVERSE SPACE
	LINREV			/ SELECT REVERSE VIDEO IF SPECIFIED
	LINST6			/ DISPLAY 27 REVERSE SPACE CHARACTERS
	LINST6			/ DISPLAY 27 REVERSE SPACE CHARACTERS
	LINST6			/ DISPLAY 27 REVERSE SPACE CHARACTERS
	LINST6			/ DISPLAY 27 REVERSE SPACE CHARACTERS
	LINST6			/ DISPLAY 27 REVERSE SPACE CHARACTERS
	41			/ SCREEN POSITION FOR DOCUMENT NAME/C254/C235
	MUBUF+MNDRV		/ MENU LOCATION FOR DRIVE NUMBER
	MUBUF+MNDOCN		/ MENU LOCATION FOR DOC NUMBER
	MUBUF+MNFNAM		/ MENU LOCATION FOR DOC NAME

LINTOP,	TAD	LINFLG		/ GET STATUS DISPLAY MODE FLAG
	SZA			/ CHECK FOR DISPLAY ALL MODE
	TAD	LINM1		/ NO, CHECK FOR TOP LINE
	SZA CLA			/ IS IT JUST THE TOP LINE
	JMP	LINBOT		/ NO, GO CHECK FOR BOTTOM LINE

	DCA	LINDIF		/ CLEAR STATUS DIFFERENT FLAG
	JMS I	IOACAL		/ CALL IOA TO START DISPLAY OF TOP LINE
	0			/ USE DEFAULT IOA OUTPUT ROUTINE
	LINST7			/ SAVE CURSOR, SET ABSOLUTE, DISPLAY PAGE /C235
	0			/ SCREEN POSITION FOR PAGE
	LINREV			/ SELECT REVERSE VIDEO IF SPECIFIED

	TAD	LINPGH		/ GET VALUE OF HIGH ORDER PAGE NUMBER
	SNA CLA			/ DO WE HAVE A THOUSAND PAGES ?
	JMP	LINLOW		/ NO, JUST PUT UP LOW ORDER PAGE NUMBER

	JMS I	IOACAL		/ CALL IOA TO DISPLAY THOUSANDS NUMBER
	0			/ USE DEFAULT IOA OUTPUT ROUTINE
	LINST9			/ THOUSANDS NUMBER CONTROL STRING
	LINPGH			/ HIGH ORDER PAGE NUMBER
	LINPGL			/ LOW ORDER PAGE NUMBER
	JMP	LINLIN		/ CONTINUE WITH LINE DISPLAY

LINLOW,	JMS I	IOACAL		/ CALL IOA TO DISPLAY LOW PAGE NUMBER
	0			/ USE DEFAULT IOA OUTPUT ROUTINE
	LINSTA			/ HUNDREDS CONTROL STRING AND LINE NUMBER
	LINPGL			/ LOW ORDER PAGE NUMBER

LINLIN,	JMS	INOVDP		/ Go display Insert-Overstrike 		/A254
	JMS I	IOACAL		/ CALL IOA TO START THE LINE DISPLAY
	0			/ USE DEFAULT IOA OUTPUT ROUTINE
	LINSTB			/ CONTROL STRING FOR LINE DISPLAY
	11			/ SCREEN POSITION FOR LINE		/C235

	TAD	LINNUM		/ PICK UP THE CURRENT LINE NUMBER
	SNA CLA			/ IS THE LINE NUMBER DEFINED ?
	JMP	LINUKN		/ NO, GO PUT UP "N/A" MESSAGE

	JMS I	IOACAL		/ CALL IOA TO DISPLAY LINE NUMBER
	0			/ USE DEFAULT IOA OUTPUT ROUTINE
	LINSTC			/ DISPLAY LINE NUMBER
	LINNUM			/ POINTER TO CURRENT LINE NUMBER
	21			/ SCREEN POSITION FOR COLUMN POSITION	/C235
	JMP	LINBOT		/ GO CHECK FOR BOTTOM LINE

LINUKN,	JMS I	IOACAL		/ CALL IOA TO DISPLAY "N/A" MESSAGE
	0			/ USE DEFAULT IOA OUTPUT ROUTINE
	LINSTD			/ DISPLAY "N/A"

LINBOT,	TAD	LINFLG		/ GET STATUS DISPLAY MODE FLAG
	SZA			/ CHECK FOR DISPLAY ALL MODE
	TAD	LINM2		/ NO, CHECK FOR BOTTOM LINE RULER
	SNA CLA			/ WAS BOTTOM LINE RULER REQUESTED
	TAD I	(MUBUF+MNSTAT)	/ YES, PICK UP NUMBER OF STATUS LINES
	TAD	LINM2		/ DECREMENT THE COUNT
	SPA CLA			/ WAS BOTTOM LINE RULER SPECIFIED
	JMP	LINSAM		/ NO, GO CHECK IF SETUP IS NEEDED

	DCA	LINRUL		/ CLEAR RULER DETECTED FLAG
	JMS I	IOACAL		/ CALL IOA TO DISPLAY BOTTOM LINE
	0			/ USE DEFAULT IOA OUTPUT ROUTINE
	LINST8			/ SAVE CURSOR & SET ABSOLUTE ADDRESSING	/C235

	CDFEDT			/ CHNAGE TO EDIT FIELD
	TAD	(NPTRS)		/ PICK UP VALUE FOR MAXIMUM SCREEN LINES
	DCA I	(SCRNLN)	/ STORE MAX VALUE FOR PCUR ROUTINE

/D220	CDFMYF			/ CHANGE BACK TO THIS FIELD
/D220	CIFEDT			/ SET UP TO GO TO THE EDITOR FIELD
/D220	JMS I	(CALLAR)	/ CALL A ROUTINE IN THE EDITOR
/D220	DSPCUR			/ ROUTINE TO DISPLAY THE CURRENT RULER	/M196
/D220	CDFBUF			/ DATA FIELD TO USE FOR ROUTINE

	CDIEDT			/ SET UP TO GO TO THE EDITOR FIELD	/A220
	JMS I	(DSPCUR)	/ ROUTINE TO DISPLAY THE CURRENT RULER	/A220

	JMS I	IOACAL		/ CALL IOA TO FINISH DISPLAY OF BOTTOM LINE
	0			/ USE DEFAULT IOA OUTPUT ROUTINE
	LINSTE			/ RESTORE CURSOR ATTRIBUTES

LINSAM,	TAD	LINFLG		/ GET STATUS DISPLAY MODE FLAG
	SZA CLA			/ CHECK FOR DISPLAY ALL MODE
	JMP	LINXIT		/ NOT ZERO, MUST BE ALL DONE

	TAD I	(MUBUF+MNSTAT)	/ PICK UP NUMBER OF STATUS LINES
	TAD	LINM3		/ DECREMENT COUNT OF NUMBER OF LINES
	SMA CLA			/ CHECK FOR ONLY ONE TOP LINE
	JMS	LINBAR		/ NO, GO PUT UP GRAPHICS LINE

	JMS I	IOACAL		/ CALL IOA TO SET UP SCROLL AREA AND MODE
	0			/ USE DEFAULT IOA DISPLAY ROUTINE
	LINSTF			/ CONTROL STRING TO SET AREA AND MODE	/C224
	MNLANG+MUBUF		/ POINTER TO LANGUAGE WORD		/A224
	LINSTG			/ SET SCROLL AREA, RELITIVE MODE	/C224

LINXIT,	TAD I	(MUBUF+MNSTAT)	/ PICK UP NUMBER OF STATUS LINES
	CIA			/ NEGATE THE VALUE FOR A SUBTRACT
	TAD	(NPTRS)		/ PICK UP VALUE FOR MAXIMUM SCREEN LINES
	CDFEDT			/ CHANGE TO EDIT FIELD
	DCA I	(SCRNLN)	/ STORE NUMBER OF LINES IN SCROLL AREA
	CDFMYF			/ RESET BACK TO THIS FIELD

	JMP I	LINDSP		/ RETURN TO CALLER

LINREV,	0			/ POINTER TO REVERSE VIDEO STRING
LINSIZ,	0			/ LOCATION FOR CURRENT TEXT SIZE

LINM1,	-1			/ VALUE TO CHECK FOR TOP LINE
LINM2,	-2			/ VALUE TO CHECK FOR BOTTOM LINE
LINM3,	-3			/ VALUE TO CHECK FOR SCREEN RESET

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/--------------------
	PAGE

DSKBLK=.-SWPBEG%400+DLSTAT	/ DISK BLOCK WHERE PAGE IS LOADED

TRANTP=.			/ TOP OF TRANSLATIONS			/A258

LINST1,	TEXT '!X^P!A^D !Y'	/ CONTROL STRING FOR COLUMN NUMBER	/C235

LINST2,	TEXT '![[?6L![[2&J![[R'	/ SEQUENCES DESCRIBED BELOW		/C235
		/ ESC [ ? 6 l	/ SET ABSOLUTE ADDRESSING MODE		/C235
		/ ESC [ 2 J	/ ERASE ENTIRE SCREEN			/C235
		/ ESC [ r	/ CLEAR SCROLLING REGION		/C235

LINST3,	
	IFDEF ENGLSH <
	TEXT '^P&DOCUMENT: (!D.!D) !A '; *.-1
	TEXT '^P&BLOCKS USED: !D '; *.-1
	TEXT '^P&BLOCKS REMAINING: !D '; *.-1
	TEXT '^P&TEXT SIZE: !D LINES'
	>
	IFDEF V30NOR <
	TEXT '^P&DOKUMENT: (!D.!D) !A '; *.-1
	TEXT '^P&BRUKTE BLKR: !D '; *.-1
	TEXT '^P&LEDIGE BLKR: !D '; *.-1
	TEXT '^P&TEKSTSTR.: !D LINJER'
	>
	IFDEF V30SWE <
	TEXT '^P&DOKUMENT: (!D.!D) !A '; *.-1
	TEXT '^P&ANV\DNDA BLK: !D '; *.-1
	TEXT '^P&LEDIGA BLK: !D '; *.-1
	TEXT '^P&TEXTSTORLEK.: !D RADER'
	>
	IFDEF SPANISH <					/NB: NEEDS XLATING/A255
	TEXT '^P&DOC.: (!D.!D) !A '; *.-1
	TEXT '^P&BLQS USADOS: !D'; *.-1
	TEXT '^P&BLQS SIN USAR: !D'; *.-1
	TEXT '^P&TATA\QO DEL TEXTOS: !D L\MNS'
	>
	IFDEF ITALIAN <
	TEXT '^P&DOCUMENTO: (!D.!D) !A '; *.-1
	TEXT '^P&BLOCCHI USATI: !D '; *.-1
	TEXT '^P&BLOCCHI LIBERI: !D '; *.-1
	TEXT '^P&DIMENSIONE: !D RIGHE'
	>
	IFDEF DUTCH <
	TEXT '^P&DOC: (!D.!D) !A'; *.-1
	TEXT '^P&GEBRUIKTE BLOKKEN: !D '; *.-1
	TEXT '^P&VRIJE BLOKKEN: !D '; *.-1
	TEXT '^P&REGELS / PAGINA: !D LINES'
	>


LINST4,	
IFNDEF	V30NOR <
IFNDEF	V30SWE <
	TEXT '!X^P!A^S^S^S^S^S^P&DOC: (!D.!D) !A!Y'			/C235
	>
	>

IFDEF	V30NOR <
	TEXT '!X^P!A^S^S^S^S^S^P&DOK: (!D.!D) !A!Y'			/C235
	>

IFDEF	V30SWE <
	TEXT '!X^P!A^S^S^S^S^S^P&DOK: (!D.!D) !A!Y'			/C235
	>

LINST5,	ESC; "[; "7; "m		/ SELECT REVERSE VIDEO
	0			/ ASCII STRING TERMINATOR

LINST6,	TEXT '                           ' / GRAPHICS BAR CHARACTER

LINST7,	TEXT '!X^P!A&P: '	/ SAVE CURSOR, SET ABSOLUTE, DISPLAY PAGE /C235

LINST8,	TEXT '!X'		/ SAVE CURSOR, SET ABSOLUTE		/C235

LINST9,	TEXT '!D!3D'

LINSTA,	TEXT '!D'


LINSTB,	
	IFDEF ENGLSH <TEXT ' ^P&L: '>
	IFDEF V30NOR <TEXT ' ^P&L: '>
	IFDEF V30SWE <TEXT ' ^P&L: '>
	IFDEF SPANISH <TEXT ' ^P&L: '>					/A255
	IFDEF ITALIAN <TEXT ' ^P&R: '>
	IFDEF DUTCH <TEXT ' ^P&R: '>

LINSTC,	
	IFDEF ENGLSH <TEXT '!D  ^P&C:!Y'>						/C235
	IFDEF V30NOR <TEXT '!D  ^P&K:!Y'>						/C235
	IFDEF V30SWE <TEXT '!D  ^P&K:!Y'>						/C235
	IFDEF SPANISH <TEXT '!D  ^P&C:!Y'>				/A255
	IFDEF ITALIAN <TEXT '!D  ^P&C:!Y'>						/C235
	IFDEF DUTCH <TEXT '!D  ^P&T:!Y'>						/C235

IFDEF ENGLSH <LINSTD,	TEXT '&N/&A  &C:!Y'>	/ LINE NUMBER NOT AVAILABLE	/C235
IFDEF V30NOR <LINSTD,	TEXT '&I/&T  &K:!Y'>	/ LINE NUMBER NOT AVAILABLE	/C235
IFDEF V30SWE <LINSTD,	TEXT '&I/&T  &K:!Y'>	/ LINE NUMBER NOT AVAILABLE	/C235
IFDEF SPANISH <LINSTD,	TEXT '&N/&A  &C:!Y'>	/ LINE NUMBER NOT AVAILABLE/A255
IFDEF DUTCH <LINSTD,	TEXT '?  &T:!Y'>	/ LINE NUMBER NOT AVAILABLE		/C235

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
XTRLIN=200-.-TRANTP
/--------------------
	PAGE
IFNZRO	.-TRANTP-200	<?TRANS TOO BIG>				/A258

DSKBLK=.-SWPBEG%400+DLSTAT	/ DISK BLOCK WHERE PAGE IS LOADED


/***************************************************************************
/****		  EDITOR HOOKS FOR STATUS LINE DISPLAY			****
/***************************************************************************

/ CHECK STATUS CHANGE	CALLED FROM THE HALT TEST ROUTINE IN LP FIELD AND BY
/			THE GET CHARACTER ROUTINE IN MGOVLY.
/
/			THIS ROUTINE CHECKS TO SEE IF ANY OF THE DISPLAY
/			LOCATIONS OF THE STATUS LINE HAVE CHANGED SINCE
/			LAST CHECKED AND IF SO WILL DISPLAY THE NEW VALUES.

LINCHK,	XX			/ CHECK FOR STATUS VALUE CHANGE
	TAD	LINDIF		/ PICK UP THE STATUS DIFFERENT FLAG
	SNA CLA			/ HAS THE TOP LINE OF STATUS CHANGED ?
	JMP	LINCK1		/ NO, GO UPDATE PRINTER STATUS AND TIME

	AC0001			/ SET UP TO DISPLAY THE TOP STATUS LINE
	DCA	LINFLG		/ STORE IN STATUS DISPLAY MODE FLAG
	JMS	LINDSP		/ GO DISPLAY A NEW TOP STATUS LINE

LINCK1,	TAD	LINRUL		/ PICK UP THE RULER DETECTED FLAG
	SNA CLA			/ HAS A RULER BEEN DETECTED ?
	JMP I	LINCHK		/ NO, GO RETURN TO CALLER

	AC0002			/ YES, DISPLAY THE BOTTOM STATUS LINE
	DCA	LINFLG		/ STORE IN STATUS DISPLAY MODE FLAG
	JMS	LINDSP		/ GO DISPLAY THE NEW RULER
	JMP I	LINCHK		/ RETURN TO CALLER

/***************************************************************************
/****  HANDLE SCROLL DOWN AND SCROLL UP EVENTS FOR STATUS LINE DISPLAY	****
/***************************************************************************

LINSDN,	XX			/ HANDLE SCROLL DOWN EVENT
	JMS	LINTST		/ GO CHECK FOR SPECIAL CHRACTER
	JMP	LINDNP		/ NEW PAGE OR PAGE MARKER DETECTED
	JMP	LINDNR		/ RULER DETECTED - CHECK FOR TOP OF DOCUMENT
	JMP I	LINSDN		/ IGNORE LINE - RETURN TO CALLER

	AC7777			/ SET UP TO DECREMENT THE COUNT
	TAD	LINNUM		/ COMBINE WITH CURRENT LINE COUNT
	DCA	LINNUM		/ STORE NEW LINE COUNT
	JMP 	LINDNX		/ DONE WITH LINE, GO SET STATUS CHANGED FLAG

LINDNP,	AC7777			/ SET UP TO DECREMENT THE COUNT
	TAD	LINPGL		/ COMBINE WITH CURRENT LOW ORDER PAGE COUNT
	SMA			/ DID WE GO NEGATIVE ?
	JMP	LINDNL		/ NO, THEN GO STORE NEW LOW ORDER PAGE NUMBER

	AC7777			/ SET UP TO DECREMENT THE COUNT
	TAD	LINPGH		/ COMBINE WITH CURRENT HIGH ORDER PAGE COUNT
	DCA	LINPGH		/ STORE NEW HIGH ORDER PAGE COUNT
	TAD	(1747)		/ PICK UP RESET VALUE OF 999
LINDNL,	DCA	LINPGL		/ STORE NEW LOW ORDER PAGE COUNT

LINDNS,	DCA	LINNUM		/ MAKE LINE NUMBER "UNKNOWN"
LINDNX,	AC0001			/ DONE WITH PAGE
	DCA	LINDIF		/ SET STATUS CHANGED FLAG
	JMP I	LINSDN		/ RETURN TO CALLER

LINDNR,	CDFEDT			/ CHANGE TO EDITOR DATA FIELD
	TAD I	(PTRBLK+NPTRS-3)/ GET POINTER TO THIRD FROM LAST LINE
	CDFMYF			/ RESET BACK TO THIS FIELD
	SZA CLA			/ IS THIS THE TOP OF DOCUMENT
	JMP I	LINSDN		/ NO, IGNORE RULER - RETURN TO CALLER
	AC0001			/ YES, SET UP TO INITIALIZE THE COUNT
	JMP	LINDNS		/ GO SET LINE NUMBER TO FIRST LINE

LINSUP,	XX			/ HANDLE SCROLL UP EVENT
	JMS	LINTST		/ GO CHECK FOR SPECIAL CHRACTER
	JMP	LINUPP		/ NEW PAGE OR PAGE MARKER DETECTED
	JMP I	LINSUP		/ IGNORE RULER - RETURN TO CALLER
	JMP I	LINSUP		/ IGNORE LINE - RETURN TO CALLER

	AC0001			/ SET UP TO INCREMENT THE COUNT
	TAD	LINNUM		/ COMBINE WITH CURRENT LINE COUNT
	DCA	LINNUM		/ STORE NEW LINE COUNT
	JMP	LINUPX		/ DONE WITH LINE, GO SET STATUS CHANGED FLAG

LINUPP,	TAD	LINPGL		/ PICK UP CURRENT LOW ORDER PAGE NUMBER
	TAD	(-1747)		/ COMBINE WITH NEGATIVE 999 PAGE COUNT
	SPA CLA			/ ARE WE AT LOW ORDER PAGE NUMBER 999
	JMP	LINUPL		/ GO INCREMENT LOW ORDER PAGE COUNT

	AC0001			/ SET UP TO INCREMENT THE COUNT
	TAD	LINPGH		/ COMBINE WITH CURRENT HIGH ORDER PAGE COUNT
	DCA	LINPGH		/ STORE NEW HIGH ORDER PAGE COUNT
	JMP	LINUPH		/ GO CLEAR LOW ORDER PAGE COUNT

LINUPL,	AC0001			/ SET UP TO INCREMENT THE COUNT
	TAD	LINPGL		/ COMBINE WITH CURRENT LOW ORDER PAGE COUNT
LINUPH,	DCA	LINPGL		/ STORE NEW LOW ORDER PAGE COUNT

	AC0001			/ SET UP TO INITIALIZE THE COUNT
	DCA	LINNUM		/ SET LINE NUMBER TO FIRST LINE
LINUPX,	AC0001			/ DONE WITH PAGE
	DCA	LINDIF		/ SET STATUS CHANGED FLAG
	JMP I	LINSUP		/ RETURN TO CALLER


/***************************************************************************
/****	      SUBROUTINE TO TEST VALUES FOR SPECIAL CHARACTERS 		****
/***************************************************************************

/ THIS SUBROUTINE IS THE HEART OF THE STATUS LINE PAGE AND LINE NUMBER CHECK.
/ IT WORKS ON THE BASIS OF DETERMINING WHAT CHARACTER IS AT THE START OF THE
/ NEXT TO LAST LINE ON THE SCREEN BEFORE A SCROLL DOWN OPERATION AND AFTER A
/ SCROLL UP OPERATION.
/
/ THIS ROUTINE WILL GENERATE MULTIPLE EXIT RETURNS BASED ON THE VALUE OF THE
/ CHARACTER AT THE START OF THE NEXT TO LAST LINE AND THE VALUE OF THE CONTROL
/ BLOCK FLAG AND ON THE VALUE OF THE LINE NUMBER AS FOLLOWS:

/	THE FIRST RETURN WILL BE THE DETECTION OF A VALID PAGE INDICATOR
/	THIS MEANS THAT IT IS TIME TO INCREMENT OR DECREMENT THE PAGE NUMBER
/
/	THE SECOND RETURN WILL INDICATE THAT A START OF RULER HAS BEEN FOUND
/
/	THE THIRD RETURN WILL INDICATE THAT THE CURRENT LINE SHOULD BE
/	IGNORED AND NOT COUNTED
/
/	THE FOURTH RETURN WILL INDICATE THAT THE LINE IS A PRINTABLE LINE AND
/	THAT THE LINE NUMBER SHOULD BE INCREMENTED OR DECREMENTED


LINTST,	XX			/ TEST FOR SPECIAL CHARACTERS
	CDFEDT			/ CHANGE TO EDITOR DATA FIELD
	TAD I	(PTRBLK+NPTRS-2)/ POINTER TO START OF NEXT TO LAST LINE
	DCA	T1		/ STORE POINTER INTO BUFFER FIELD

	CDFBUF			/ CHANGE TO BUFFER FIELD
	TAD I	T1		/ GET CHARACTER TO BE TESTED
	CDFMYF			/ RESET BACK TO THIS FIELD

	TAD	(-ECPMRK)	/ CHECK FOR A PAGE MARKER
	SZA			/ SKIP IF THERE IS A MATCH
	TAD	(ECPMRK-ECNWPG)	/ CHECK FOR A NEW PAGE
	SNA			/ SKIP IF THERE IS NO MATCH
	JMP I	LINTST		/ PAGE DETECTED, TAKE FIRST RETURN

	ISZ	LINTST		/ BUMP RETURN UP TO NEXT EXIT POINT
	TAD	(ECNWPG-ECSTRL)	/ CHECK FOR A START OF RULLER
	SZA			/ IS THIS THE START OF A RULER ?
	JMP	LINTS1		/ NO, CONTINUE WITH THE TEST
	AC0001			/ YES, THIS IS A RULER
	DCA	LINRUL		/ SET RULER DETECTED FLAG
	JMP I	LINTST		/ RULER DETECTED, TAKE SECOND RETURN

LINTS1,	ISZ	LINTST		/ BUMP RETURN UP TO NEXT EXIT POINT
	TAD	(ECSTRL-ECPCT1)	/ CHECK FOR A START CONTROL
	SZA			/ SKIP IF THERE IS A MATCH
	TAD	(ECPCT1-ECPCT2)	/ CHECK FOR AN END CONTROL
	SZA CLA			/ SKIP IF THERE IS A MATCH
	TAD	LINNUM		/ CHECK IF LINE NUMBER IS DEFINED
	SNA CLA			/ SKIP IF CONDITIONS VALID SO FAR
	JMP I	LINTST		/ IGNORE LINE, TAKE THIRD RETURN

	CDFEDT			/ CHANGE TO EDITOR DATA FIELD
	TAD I	(PCTLFL)	/ PICK UP VALUE FOR CONTROL BLOCK FLAG
	CDFMYF			/ RESET BACK TO THIS FIELD
	SNA CLA			/ IF SET THEN TAKE IGNORE LINE RETURN
	ISZ	LINTST		/ BUMP RETURN UP TO COUNT THE LINE RETURN
	JMP I	LINTST		/ RETURN BACK TO CALLER

/ Moved here for space reasons

IFDEF ITALIAN < LINSTD,	TEXT '&N/&D  &C:!Y'>/ LINE NUMBER NOT AVAILABLE	/C235

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/--------------------
	PAGE

DSKBLK=.-SWPBEG%400+DLSTAT	/ DISK BLOCK WHERE PAGE IS LOADED


LINBAR,	XX			/ ROUTINE TO PUT UP THE SECOND STATUS LINE
	JMS I	IOACAL		/ CALL IOA TO DISPLAY GRAPHICS LINE
	0			/ USE DEFAULT IOA DISPLAY ROUTINE
	LINSTX			/ DISPLAY GRAPHICS LINE			/C235
	100			/ SCREEN POSITION FOR GRAPHICS LINE
	LINSTY			/ DISPLAY 27 GRAPHIC LINE CHARACTERS	/C235
	LINSTY			/ DISPLAY 27 GRAPHIC LINE CHARACTERS	/C235
	LINSTY			/ DISPLAY 27 GRAPHIC LINE CHARACTERS	/C235
	LINSTY			/ DISPLAY 27 GRAPHIC LINE CHARACTERS	/C235
	LINSTY			/ DISPLAY 27 GRAPHIC LINE CHARACTERS	/C235
	JMP I	LINBAR		/ ALL DONE, RETURN TO CALLER


/
/	This routine displays OVRSTK if the user toggles the 		/A254
/	Insert-Overstrike Key into Overstrike				/A254
/	

INOVDP,	XX								/A254
	CLA			/ Just in case				/A254
	CDFEDT			/ Point to Edit Field			/A254
	TAD I	(INSOVF)	/ Get Insert-Overstrike Flag		/A254
	CDFMYF			/ Point back here			/A254	
	SNA CLA			/ 0 for Ins , 1 for Over		/A254
	JMP 	INCLR		/ Clear screen				/A254
INDPOV,	JMS I	IOACAL		/ Call display				/A254
	0			/ default				/A254
	OVTOVS			/ Text for OVRSTK			/A254
	31			/ Col Pos				/A254
	JMP I	INOVDP		/ Bi Bi					/A254
INCLR,	JMS I	IOACAL		/ Call display				/A254
	0			/ default				/A254
	OVTCLR			/ Clear message				/A254
	31			/ Col Pos				/A254
	JMP I	INOVDP		/ Bi Bi					/A254


OVTCLR,	TEXT '^P      '							/A254
OVTOVS,	TEXT '^P![[1M&OVRSTK![[22M'					/A254


LINSTX,	TEXT '^P!CN^S^S^S^S^S!CO' / SEQUENCE DESCRIBED BELOW		/C235
		/ ESC ( 0	/ SELECT GRAPHICS CHARACTER SET		/C235

LINSTY,	TEXT 'QQQQQQQQQQQQQQQQQQQQQQQQQQQ' / GRAPHICS LINE CHARACTER	/C235


	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/--------------------
	PAGE

DSKBLK=.-SWPBEG%400+DLSTAT	/ DISK BLOCK WHERE PAGE IS LOADED



/									/A207
/++									/A207
/		CALSWAP		CALL_A_ROUTINE IN EDITOR SWAP AREA	/A207
/									/A207
/FUNTIONAL DESCRIPTION:	CALSWAP						/A207
/									/A207
/ THIS ROUTINE CAN BE USED TO CALL ANY SUBROUTINE IN THE EDITOR SWAP	/A207
/ AREA FROM ANY FIELD IN THE SYSTEM AS LONG AS THE EDITOR SWAP AREA	/A207
/ SUBROUTINE MAKES ONLY A NORMAL OR SKIP RETURN.			/A207
/									/A207
/CALLING SEQUENCE:	CIFMNU (DF = CALLER FIELD)			/A207
/			JMS	CALSWAP					/A207
/			    CALLED ROUTINE RESIDING IN EDITOR SWAP AREA	/A207
/			    DATA FIELD TO SET FOR CALLED ROUTINE	/A207
/									/A207
/INPUT PARAMETERS:	AC = VALUE (IF ANY) NEEDED FOR CALLED ROUTINE	/A207
/									/A207
/IMPLICIT INPUT:	CIDF0, CALSW1, T1, CALSWAP			/A207
/									/A207
/OUTPUT PARAMETERS:	AC = OUTPUT OF CALLED ROUTINE			/A207
/			MQ = OUTPUT OF CALLED ROUTINE			/A207
/			DATA AND INSTRUCTION FIELD = CALLING FIELD	/A207
/									/A207
/IMPLICIT OUTPUT:	CALSW1, T1, CALSW2				/A207
/									/A207
/COMPLETION CODE:	NONE						/A207
/									/A207
/SIDE EFFECTS:		1) CALSWAP USES T1				/A207
/									/A207
/--									/A207
/									/A207
CALSWAP,XX			/ CALL_A_ROUTINE IN EDITOR SWAP AREA	/A207
	MQL			/ HOLD VALUE IN AC			/A207
	RDF			/ SET UP RETURN CIF CDF	INSTRUCTION	/A207
	TAD	(CDF CIF 0)						/A207
	DCA	CALSW1		/ SAVE INSTRUCTION			/A207
	TAD I	CALSWAP		/ GET ADDRESS OF ROUTINE TO JMS TOO	/A207
	DCA	T1		/ SAVE IT				/A207
	ISZ	CALSWAP		/ BUMP RETURN FOR NEXT PARAMETER	/A207
	TAD I	CALSWAP		/ GET CDF INSTRUCTION			/A207
	DCA	CALSW2		/ SAVE IT				/A207
	ISZ	CALSWAP		/ BUMP RETURN				/A207
CALSW2,	.-.			/ HOLDS CIF CDF INSTRUCTION		/A207
	SWP			/ RESTORE TO AC CALLING VALUE		/A207
	JMS I	T1		/ JMS TO ROUTINE SPECIFIED AT CALLER+1	/A207
	SKP			/ NONSKIP RETURN			/A207
	ISZ	CALSWAP		/ SKIP RETURN - BUMP RETURN POINTER	/A207
CALSW1,	.-.			/ RETURN CIF CDF INSTRUCTION PLACED HERE/A207
	JMP I	CALSWAP		/ RETURN TO CALLER			/A207
/									/A207
/									/A207
/									/A207

/	EFSCLU	SCROLL SCREEN UP					/A207
/									/A207

EFSCLU,	XX								/A207
	CDFMNU								/A207
	CIFEDT								/A207
	JMS I	(FMSWAP)						/A207
		SCRLUP							/A207
		CDFBUF							/A207
	CDFEDT								/A207
	JMP I	EFSCLU							/A207

/	EFSECO	CALL SCECHO IN EDITOR FIELD				/A207
/									/A207

EFSECO,	XX								/A207
	CDFMNU								/A207
	CIFEDT								/A207
	JMS I	(FMSWAP)						/A207
		SCECHO							/A207
		CDFEDT							/A207
	CDFEDT								/A207
	JMP I	EFSECO							/A207

/	EFINSR	INSERT CHAR IN TEXT BUFFER				/A207
/									/A207

EFINSR,	XX			/ INSERT CHAR IN TEXT BUFFER		/A207
	CDFMNU								/A207
	CIFEDT								/A207
	JMS I	(FMSWAP)						/A207
		INSERT							/A207
		CDFBUF							/A207
	CDFEDT								/A207
	JMP I	EFINSR							/A207

/	EFSLMD	SET LINE MODIFIED					/A207
/									/A207

EFSLMD,	XX			/ SET LINE MODIFIED			/A207
	CDFMNU								/A207
	CIFEDT								/A207
	JMS I	(FMSWAP)						/A207
		SETLMD							/A207
		CDFEDT							/A207
	CDFEDT								/A207
	JMP I	EFSLMD							/A207

/	EFBZZR	RING THE KEYBOARD BELL					/A207
/									/A207

EFBZZR,	XX			/ RING THE BELL				/A207
	CDFMNU								/A207
	CIFEDT								/A207
	JMS I	(FMSWAP)						/A207
		BUZZER							/A207
		CDFEDT							/A207
	CDFEDT								/A207
	JMP I	EFBZZR							/A207

/	EFADSP	ADVANCE ONE PRINT SPACE IN TEXT BUFFER RETURNING CHAR	/A207
/									/A207

EFADSP,	XX			/ CALL BKPSPC IN EDIT FIELD		/A207
	CDFMNU								/A207
	CIFEDT								/A207
	JMS I	(FMSWAP)						/A207
	ESASPC			/ ROUTINE TO BE CALLED			/A207
	CDFBUF			/ SET BUFFER FIELD			/A207
	SKP			/ NONSKIP RETURN			/A207
	ISZ	EFADSP		/ SKIP RETURN				/A207
	CDFEDT								/A207
	JMP I	EFADSP		/ RETURN TO CALLER			/A207

/	EFBKSP	BACKUP ONE PRINT SPACE IN TEXT BUFFER RETURNING CHAR	/A207
/									/A207

EFBKSP,	XX			/ CALL BKPSPC IN EDIT FIELD		/A207
	CDFMNU								/A207
	CIFEDT								/A207
	JMS I	(FMSWAP)						/A207
	ESBSPC			/ ROUTINE TO BE CALLED			/A207
	CDFBUF			/ SET BUFFER FIELD			/A207
	SKP			/ NONSKIP RETURN			/A207
	ISZ	EFBKSP		/ SKIP RETURN				/A207
	CDFEDT								/A207
	JMP I	EFBKSP		/ RETURN TO CALLER			/A207

/	EFLDCH	GET CURRENT CHAR FROM TEXT BUFFER			/A207
/									/A207

EFLDCH,	XX			/ CALL LODCHR IN EDT FIELD		/A207
	CDFMNU								/A207
	CIFEDT								/A207
	JMS I	(FMSWAP)						/A207
		LODCHR		/ ROUTINE TO BE CALLED			/A207
		CDFEDT		/ CALL WITH EDITOR DATA FIELD SET	/A207
	SKP			/ NONSKIP RETURN			/A207
	ISZ	EFLDCH		/ SKIP RETURN				/A207
	CDFEDT								/A207
	JMP I	EFLDCH		/ RETURN TO CALLER			/A207

/	EFSSPT	SET SPLIT SCREEN FLAG IF NECESSARY			/A207
/									/A207

EFSSPT,	XX			/ SET SCREEN NEEDS TO BE SET FLAG	/A207
	CDFEDT			/ FROM MENU FIELD			/A207
/D226	TAD I	(SPLTFL)	/ GET SLPIT FLAG			/A207
/D226	SNA								/A207
	AC7777			/ SET TO NEEDS SPLIT			/A207
	DCA I	(SPLTFL)						/A207
/D226	CDFEDT								/A207
	JMP I	EFSSPT							/A207

/	EFCKAL	CHECK FOR PRINTING ASCII CHAR				/A207
/									/A207

EFCKAL,	XX			/ CHKALP IN MENU FIELD			/A207
	MQL			/ SAVE AC IN MQ				/A207
	MQA								/A207
	AND	P177		/ STRIP BITS				/A207
	TAD	(-ECSPC)	/ GREATER THAN SPACE?			/A207
	SMA SZA								/A207
	ISZ	EFCKAL		/ YES, OK CODE				/A207
	CLA MQA			/ RESTORE AC				/A207
	CDFEDT								/A207
	JMP I	EFCKAL		/ RETURN				/A207

EFRSLN,	XX								/A208
	CDFMNU								/A208
	CIFEDT								/A208
	JMS I	(FMSWAP)						/A208
		RSTRLN							/A208
		CDFEDT							/A208
	JMP I	EFRSLN							/A208

EFADPT,	XX								/A208
	CDFMNU								/A208
	CIFEDT								/A208
	JMS I	(FMSWAP)						/A208
		ESAPTR							/A208
		CDFBUF							/A208
	SKP								/A208
	ISZ	EFADPT							/A208
	JMP I	EFADPT							/A208


	X=	.

	PAGE

DSKBLK=.-SWPBEG%400+DLSTAT	/ DISK BLOCK WHERE PAGE IS LOADED	/A207

EFCKMR,	XX			/ CHK RIGHT MARGIN			/A207
	DCA	CHKMRF		/ CLEAR HYPHEN FLAG			/A207
	CDFEDT								/A207
	TAD I	(CURSOR)						/A207
	TAD	(-COLLIM+1)	/ LIMIT TO SCREEN WIDTH			/A207
	SMA								/A207
	JMP	CHKMR5							/A207
	TAD	(COLLIM-COLM81)						/M219
	SZA CLA								/A207
	JMP	CHKMR1							/A207
	TAD I	(RGTMAR)						/A207
/D226	CLL			/ CLEAR LINK BEFORE CHECK		/A226
	TAD	(-COLM80)						/M219
	SMA CLA								/A207
	JMS	EFSSPT		/ SPLIT SCREEN IF APPROPRIATE		/A207
	TAD I	(SPLTFL)						/A207
	SNA CLA								/A207
	JMP	CHKMR5							/A207
CHKMR1,	TAD I	(LINMOD)						/A207
	SNA CLA								/A207
	JMP	CHKMR9		/ NO CHECK IF NO MOD FLAG		/A207
	TAD I	(CURSOR)						/A207
	CIA								/A207
	TAD I	(RGTMAR)	/ LIMIT TO RIGHT MARGIN			/A207
	SMA CLA								/A207
	JMP	CHKMR9		/ RETURN IF OK				/A207
	JMS	EFLDCH		/JMS	LODCHR				/A207
	JMP	CHKMR9							/A207
	AND	P177		/ OR IF ONLY BLANKS OUTSIDE MARGIN	/A207
	TAD	(-ECSPC)						/A207
	SNA								/A207
	JMP	CHKMR9							/A207
	TAD	(ECSPC-ECTAB)						/A207
	SNA CLA								/A207
	JMP	CHKMR4		/ DO NOW IF TAB				/A207
CHKMR5,	CLA								/A207
	TAD I	(CURSOR)						/A207
	CIA								/A207
	DCA	CHKMRT		/ SET MOVE LIMIT			/A207
CHKMR2,	JMS	EFBKSP		/ BKPSPC				/A207
	JMP	CHKMR3		/ LOOK FOR BLANK			/A207
	JMS	EFCKAL		/ JMS	CHKALP				/A207
	JMP	CHKMR6		/ CHECK FOR HYPHEN POINT		/A207
	AND	(7177)		/ MASK OUT BOLD AND UNDERLINE BITS	/A207
	TAD	(-ECPHYP)						/A207
	SNA CLA								/A207
	JMP	CHKMR3							/A207
	CLA MQA								/A207
	AND	(2000)							/A207
	SNA CLA								/A207
	JMP	CHKMR7							/A207
CHKM2A,	TAD I	(CURSOR)					/M244	/A207
	TAD	CHKMRT							/A207
	SNA CLA								/A207
	JMP	CHKMR7		/ NOT TOO CLOSE				/A207
	TAD	(ECHYLN-ECWWLN)						/A207
	DCA	CHKMRF		/ SET HYPHEN FLAG			/A207
	JMP	CHKMR3							/A207

CHKMR7,	ISZ	CHKMRT							/A207
	JMP	CHKMR2							/A207
	AC7777								/A207
	DCA	CHKMRT	/ HERE IF O.W.L.				/A207
	TAD I	(CURSOR)						/A207
	TAD	CHKMRT							/A207
CHKMR3,	CMA								/A207
	DCA	CHKMRS		/ -# TO SKIP BEFORE BREAKING		/A207
	AC0001								/A207
	TAD I	(CURSOR)						/A207
	TAD	CHKMRT							/A207
	TAD	CHKMRS							/A207
	DCA	CHKMRT	/ # TO ADVANCE AFTER BREAKING			/A207
	JMS	EFADSP		/ADVSPC					/A207
	NOP								/A207
	CLA			/ GO BACK TO WHERE WE WERE		/A207
	ISZ	CHKMRS							/A207
	JMP	.-4							/A207
	TAD	CHKMRT							/A207
CHKMR4,	CMA								/A207
	DCA	CHKMRT	/ ...IN FORM FOR ISZ LOOP			/A207
	TAD I	(CURSOR)						/A207
	TAD	CHKMRT							/A207
	IAC								/A207
	DCA I	(CURSOR)	/ FIX CURSOR				/A207
	TAD I	(CURSOR)						/A207
	CMA								/A207
	TAD I	(NWHMAR-NWRUL+CURUL)					/A207
	SMA CLA								/A207
	JMS	EFBZZR		/JMS	BUZZER	/ BEEP ON VIOLATION	/A207
	JMS	EFSLMD		/SLNMOD					/A207
	TAD	CHKMRF		/ GET HYPHEN FLAG			/A207
	TAD	(ECWWLN)	/ +NEW LINE CODE			/A207
	JMS	EFINSR		/JMS	INSERT				/A207
	JMS	EFSCLU		/JMS	SCRLUP				/A207
	JMP	CHKMRX							/A207

	JMS	EFSECO		/JMS	SCECHO				/A207
CHKMRX,	ISZ	CHKMRT							/A207
	JMP	.-2		/ GET BACK TO ORIGINAL POSITION		/A207
	SKP								/A207
CHKMR9,	ISZ	EFCKMR		/ TAKE SKIP RETURN IF NO WRAPPING DONE	/A207
	JMP I	EFCKMR		/ THEN RETURN TO CALLER			/A207

CHKMRF,	0								/A207
CHKMRS,	0								/A207
CHKMRT,	0								/A207

	X=	.
	PAGE

DSKBLK=.-SWPBEG%400+DLSTAT	/ DISK BLOCK WHERE PAGE IS LOADED	/A207

/									/A207
/ THIS ROUTINE BELONGS WITH THE CHKMAR ROUTINE, IF ANY ROOM EVER	/A207
/  SHOWS UP ON THAT PAGE, THIS SHOULD BE MOVED WITH IT.			/A207
/									/A207

CHKMR6,	AND	(7177)		/ ELIM BOLD-UNDL BITS			/A207
	TAD	(-ECSPC)	/ HARD SPACE?				/A207
	SNA							/M199/A207
	 JMP	CHKMR3		/ PROCESS SPACE				/A207
	TAD	(ECSPC-ECTAB)	/ TAB STOPPER?			/A199/A207
	SNA 							/M244	/A207
	 JMP	CHKMR8		/ PROCESS TAB			/A199/A207
	JMP	CHKTCC						/M244	/A207

CHK8MR,	CDFMNU			/ BACK TO MY FIELD		/A199/A207
	AC7777			/ BUMP POS COUNTER FOR THE SOFT SPACE/A199/A207
	TAD	CHKMRT	/  ...					/A199/A207
	DCA	CHKMRT	/   ...					/A199/A207
CHKMR8,	JMS	EFADSP		/ SCAN THE SOFT SPACES TO THE END/A199/A207
	NOP			/				/A199/A207
	AND	(7177)		/  THE TAB STOP.		/A199/A207
	TAD	(-ECJSPC)	/   ...				/A199/A207
	SNA CLA			/				/A199/A207
	JMP	CHK8MR		/ JMP WHILE IN THE TAB.		/A199/A207
	JMS	EFBKSP		/ BACK UP TO THE PRIOR CHAR.	/A199/A207
	NOP			/				/A199/A207
	CLA			/  ...				/A199/A207
	JMP	CHKMR3		/ MERGE BELOW			/A199/A207


/	EFCASE	A SUBROUTINE TO PERFORM CASE STYLE CHECKING
/
/	CALL:
/
/	JMS	EFCASE
/	TABLE-1	(ADDRESS OF THE TABLE TO COMPARE AGAINST)
/	(ON NO MATCH RETURNS HERE)
/
/	AC ==>	(VALUE TO COMPARE AGAINST)
/
/	THE COMPARE TABLE HAS THE FORMAT OF:
/
/	VALUE;ADDRESS		/ VALUE 1 AND ADDRESS TO JUMP TO ON MATCH
/	VALUE;ADDRESS		/ VALUE 2 AND ADDRESS TO JUMP TO ON MATCH
/	...			/ ETC.
/	0			/ TABLE TERMINATOR
/
/	NOTE: THIS SUBROUTINE DESTROYS THE CONTENTS OF AUTO INDEX
/	REGISTERS 6 AND 7
/
	CASTMP=IX0		/ AUTO INDEX REGISTER 6
	X7=IX1			/ AUTO INDEX REGISTER 7

EFCASE,	XX			/ ENTRY TO CASE SUBROUTINE
	DCA	CASTMP		/ SAVE AC FOR COMPARES
	RDF			/ SAVE DATA FIELD
	TAD	(CDF 0)		/ ADD TO CDF TO FIELD 0
	DCA	EFCS02		/ AND PUT FOR RETURN
	CDFMNU			/ SET TO MYFIELD
	TAD I	EFCASE		/ GET THE TABLE ADDRESS
	DCA	X7		/ SAVE IN AUTO INDEX REGISTER

/
/	THIS IS THE CHECK LOOP FOR CASE MATCHING
/
EFCS01,	TAD I	X7		/ GET VALUE
	SNA			/ TERMINATOR?
	JMP	EFCSEX		/ YES TAKE DEFAULT RETURN
	CIA			/ NEGATE THE OPERAND
	TAD	CASTMP		/ COMPARE
	SNA CLA			/ MATCHED?
	JMP	EFCSMT		/ YES! GO TO MATCH EXIT
	ISZ	X7		/ SKIP JUMP VECTOR
	JMP	EFCS01		/ TRY THE NEXT VALUE
/
/	END OF LOOP
/
EFCSMT,	TAD I	X7		/ GET RETURN ADDRESS
	DCA	EFCASE		/ STORE FOR RETURN
	SKP			/ DON'T INCREMENT
EFCSEX,	ISZ	EFCASE		/ SKIP TABLE VECTOR
EFCS02,	CDFMYF			/ RESET DATA FIELD
	JMP I	EFCASE		/ AND GO HOME

EFLDNT,	XX			/ INDENT TO LEFT MARGIN
EFLDN1,	JMS	EFBKPT		/ CHECK LINE ENDING
	JMP	LINDN4
	CDFEDT
	AND	P177		/ MASK MODE BITS

	TAD	(-ECNWLN)	/ IS CHAR. = NEW LINE?
	SZA CLA			/ SKIP IF: SO
	JMP	EFLDN1
	TAD I	(CURPTR)	/ GET CHARACTER BACK
	DCA	T1
	CDFBUF
	TAD I	T1

	JMS	EFCASE		/ CHECK FOR EOL MARK MATCH
	CTB001-1		/ TABLE ADDRESS FOR CASE
/
/	ECWWLN; LINDN5		/ WORD WRAP EOL
/	ECHYLN; LINDN5		/ HYPHENATION EOL
/	ECPGRF; LINDN3		/ PARAGRAPH MARK
/	ECSLPT; LINDN8		/ SELECT POINT
/	0			/ INDICATE END OF TABLE

	JMP	LINDN4		/ OR NORMAL (NOT SELECT ETC...)
LINDN8,	DCA	LINDN2		/ FIND CURSOR, IF SELECT POINT
LINDN7,	JMS	EFBKSP
	JMP	LINDN6
	AND	P177

	JMS	EFCASE		/ COMPARE TO EOL MARKS
	CTB002-1		/ TABLE ADDRESS FOR CASE

/	ECNWLN; LINDN6		/ NEWLINE
/	ECNWPG; LINDN6		/ NEW PAGE
/	ECNDRL; LINDN6		/ END RULER
/	0			/ INDICATE END OF TABLE

	ISZ	LINDN2
	JMP	LINDN7

LINDN3,	CDFEDT
	TAD I	(PGFMAR)	/ THEN SET PROPER INDENT
	JMP	LINDN9
LINDN4,	CDFEDT
	TAD I	(LFTMAR)
	JMP	LINDN9
LINDN5,	CDFEDT
	TAD I	(WRPMAR)
LINDN9,	DCA	LINDN2		/ INTO LINDN2
LINDN6,	CDFEDT
	TAD I	(LINE23)
	DCA I	(CURPTR)	/ RESTORE TEXT PTR
	TAD	LINDN2		/ SEE IF INDENT COUNT IS BEYOND		/A203
	CIA			/  THE RIGHT MARGIN.			/A203
	TAD I	(RGTMAR)	/ IF SO, THEN CHANGE INDENT TO		/A203
	SPA CLA			/  INDENT ONLY TO THE LEFT MARGIN.	/A203
	 JMP	LINDN4		/  ...					/A203
LINDN1,	CDFEDT
	TAD	LINDN2
	CIA
	TAD I	(CURSOR)
	SMA CLA
	JMP I	EFLDNT		/ RETURN IF DONE
	TAD	(ECJSPC)
	JMS	EFINSR		/ ELSE INSERT JSPACE
	JMS	EFSECO		/ ...ECHO IT
	JMP	LINDN1		/ AND LOOP FOR MORE
LINDN2,	.-.


CTB001,	ECWWLN; LINDN5		/ WORD WRAP EOL
	ECHYLN; LINDN5		/ HYPHENATION EOL
	ECPGRF; LINDN3		/ PARAGRAPH MARK
	ECSLPT; LINDN8		/ SELECT POINT
	0			/ INDICATE END OF TABLE

	X=	.

	PAGE

DSKBLK=.-SWPBEG%400+DLSTAT	/ DISK BLOCK WHERE PAGE IS LOADED	/A208

/									/A208
/FIND_NEXT_TAB_STOP:							/A208
/									/A208
/ENTER: AC = LINE POSITION						/A208
/EXIT:	AC = TAB_CLASS							/A208
/	MQ = POSITION OF TAB IN RULER					/A208
/									/A208
/PSEUDO CODE:								/A208
/	SAVE POSITION IN LINE						/A208
/									/A208
/	REPEAT								/A208
/		INCREMENT SAVED_LINE_POSITION				/A208
/		GET SAVED_LINE_POSITION + 1				/A208
/		CALL EFGTBY (GET RULER SETTING FOR THIS POSITION)	/A208
/		CALL EFGTBY (SEE WHAT CLASS)				/A208
/	UNTIL [RULER TAB DETECTED]					/A208
/									/A208
/	SAVE TAB_CLASS IN MQ						/A208
/	GET POSITION OF TAB IN RULER					/A208
/	RETURN WITH TAB_CLASS IN AC, POSITION OF TAB IN MQ		/A208
/									/A208
FNTABSTOP,			/ FIND_NEXT_TAB_STOP			/A208
	XX								/A208
	DCA	FNTAB2		/ SAVE POSITION ON LINE			/A208
FNTAB1,	ISZ	FNTAB2		/ INCREMENT POSITION			/A208
	NOP			/ ALLOW LEFT-MARGIN LOOKUP		/A208
	AC0001			/ GET SAVED_LINE_POSITION + 1		/A208
	TAD	FNTAB2							/A208
	JMS	EFGTBY							/A208
	CURUL			/ GET RULER SETTING OF THIS POSITON	/A208
	JMS	EFGTBY							/A208
	TBSTR			/ GET CLASS OF SETTING			/A208
	SNA			/ SKIP IF: TAB SETTING			/A208
	JMP	FNTAB1		/ NEXT POSITION				/A208
	MQL			/ HOLD CLASS IN MQ			/A208
	TAD	FNTAB2		/ GET POSITION OF TAB_SETTING		/A208
	SWP			/ PUT POSITION IN MQ AND CLASS IN AC	/A208
	JMP I	FNTABSTOP	/ RETURN				/A208
/									/A208
/									/A208
/									/A208

/ THIS ROUTINE ORIGIONALLY WAS SET UP TO REFRESH ONLY WHAT NEEDED TO BE	/A208
/ REFRESHED. DUE TO THE HIGH NUMBER OF EXCEPTION CASES & THE LACK OF SPACE/A208
/ TO TEST FOR EACH EXCEPTION, THE ENTIRE LINE WILL BE REPAINTED WHENEVER A/A208
/ TAB CHARACTER IS SEEN.						/A208
/									/A208
EFTJST,	XX			/ JUSTIFY NEXT TAB STOP			/A208
	CDFEDT								/A208
	TAD I	(RGTMAR)	/ GET RIGHT MARGIN			/A208
	CIA			/ NEGATE IT				/A208
	TAD I	(CURSOR)	/ GET CURSOR POSITION			/A208
	SMA CLA			/ SKIP IF: CURSOR POSITIONED PREVIOUS	/A208
				/  TO THE RIGHT MARGIN			/A208
	JMP I	EFTJST		/ NOTHING TO DO IF AT RIGHT MARGIN	/A208
	TAD I	(CURPTR)	/ SAVE POINTER				/A208
	DCA	TBECH3							/A208
	TAD I	(CURSOR)	/ INIT TAB SEARCH COUNTER		/A208
	JMS	FNTABSTOP	/ JMS TO FIND_NEXT_TAB_STOP		/A208
				/  RETURN WITH	AC = TAB_CLASS		/A208
				/		MQ = TAB_SET POSITION	/A208
				/		     IN RULER		/A208
	TAD	(-2)							/A208
	DCA	TBECH2		/ SAVE CLASS				/A208
	SWP			/ GET DISTANCE FROM SAVED CURSOR POSIT.	/A208
				/  TO THIS TAB STOP			/A208
	CIA			/ NEGATE IT				/A208
	TAD I	(CURSOR)						/A208
	DCA	TBECH1							/A208
	TAD	TBECH2		/ TEST CLASS OF TAB			/A208
	SPA CLA			/ SKIP IF: NOT NORMAL TAB		/A208
	JMP	TBECHB		/ JUMP IF NORMAL TAB			/A208
TBECHC,	JMS	EFADSP							/A208
	JMP	TBECHB		/ SEARCH FOR TERMINATOR			/A208
	CDFEDT								/A208
	TAD	(-ECCMRK)	/ IGNORE MARKER				/A208
	SNA CLA								/A208
	JMP	TBECHC		/ IGNORE MARKER. GET NEXT CHAR.		/A208
TBECHX,	TAD	TBECH2		/ TEST CLASS				/A208
	SNA CLA								/A208
	JMP	TBECHD		/ JUMP IF RIGHT-ADJUSTED TAB		/A208
	CDFEDT								/A208
	TAD I	(CURPTR)	/ ELSE CHECK FOR DECIMAL TERMINATOR	/A208
	DCA	T1							/A208
	CDFBUF								/A208
	TAD I	T1							/A208
	AND	P177							/A208

	IFDEF	PERDEC	<						/A208
	TAD	(-".+200)						/A208
	SZA								/A208
	TAD	(".-"))							/A208
			>	/ END IFDEF PERDEC			/A208

	IFDEF	COLDEC	<						/A208
	TAD	(-":+200)						/A208
	SZA								/A208
	TAD	(":-"))							/A208
			>	/ END IFDEF COLDEC			/A208

	IFDEF	COMDEC	<						/A208
	TAD	(-",+200)						/A208
	SZA								/A208
	TAD	(",-"))							/A208
			>	/ END IFDEF COMDEC			/A208

	SNA CLA								/A208
	JMP	TBECHB		/ JUMP IF GOT ONE			/A208
TBECHD,	CDFEDT								/A208
	TAD I	(CURPTR)	/ CHECK FOR RIGHT-ADJUST TAB TERMINATOR	/A208
	DCA	T1							/A208
	CDFBUF								/A208
	TAD I	T1							/A208
	AND	P177		/ STRIP MODE BITS			/A208
	TAD	(-ECSTOV)	/ CHARACTER = "START_DEAD_KEY_SEQ."?	/A208
	SZA			/ SKIP IF: SO				/A208
	TAD	(ECSTOV-ECSPC)						/A208
	SPA CLA								/A208
	JMP	TBECHB		/ JUMP IF GOT ONE			/A208
	ISZ	TBECH1							/A208
	JMP	TBECHC		/ LOOP IF WE CAN			/A208
	JMP	TBECHE		/ ELSE NOTHING TO DO			/A208

TBECHB,	TAD	TBECH2		/ WAS THIS A DECIMAL TAB OR NORMAL TAB?	/A208
	SZA CLA			/ SKIP IF: NORMAL TAB			/A208
	ISZ	TBECH1		/ REDUCE DISTANCE CNT BY 1 FOR DECIMAL TAB/A208
	NOP								/A208

TBECHE,	JMS	EFRSLN		/ SET REFRESH FLAGS FOR ENTIRE LINE.	/A208
TBECHF,	CDFEDT								/A208
	TAD	TBECH3							/A208
	DCA I	(CURPTR)	/ RESTORE PTR				/A208
	TAD	TBECH1		/ GET DISTANCE COUNT			/A208
	SMA CLA			/ SKIP IF: JUSTIFYING SPACES NEEDED	/A208
	JMP I	EFTJST		/ RETURN IF NO SPACES NEEDED		/A208
TBECHG,	JMS	EFADPT							/A208
	NOP			/ ELSE INSERT THEM			/A208
	CLA								/A208
	TAD	(ECJSPC)	/ GET "JUSTIFY_SPACE" CHARACTER		/A208
	JMS	EFINSR		/ INSERT IT				/A208
	ISZ	TBECH1		/ BUMP COUNT				/A208
	JMP	TBECHG		/ MORE 'JUSTIFY_SPACES" TO INSERT	/A208
	JMP	TBECHF		/ RETURN AFTER RESTORING CURPTR		/A208
/									/A208
/ TEMPS:								/A208
FNTAB2,				/ SAVED_LINE_POSITION (USED BY		/A208
				/ FNTABSTOP ROUTINE)			/A208
TBECH1,	.-.			/ LOADED WITH CURSOR POSITION		/A208
TBECH2,	.-.			/ LOADED WITH CLASS OF RULER SETTING	/A208
TBECH3,	.-.			/ LOADED WITH CURPTR			/A208

/	EFBKPT	BACKUP CURPTR
/
/

EFBKPT,	XX
	CDFMNU
	CIFEDT
	JMS I	(FMSWAP)
		ESBPTR
		CDFBUF
	SKP
	ISZ	EFBKPT
	CDFBUF
	JMP I	EFBKPT

CTB002,	ECNWLN; LINDN6		/ NEWLINE
	ECNWPG; LINDN6		/ NEW PAGE
	ECNDRL; LINDN6		/ END RULER
	0			/ INDICATE END OF TABLE

	X=	.

	PAGE

DSKBLK=.-SWPBEG%400+DLSTAT	/ DISK BLOCK WHERE PAGE IS LOADED

EFGTBY,	XX			/ TAD INDEX - JMS EFGTBY - SPTR		/A208
				/ RETURNS BYTE				/A208
	TAD	(-1)							/A208
	CLL RAR								/A208
	CDFMNU								/A208
	TAD I	EFGTBY		/ GET PTR				/A208
	DCA	T1							/A208
	CDFEDT								/A208
	TAD I	T1		/ GET WORD				/A208
	SNL								/A208
	BSW			/ GET BYTE				/A208
	AND	P77		/ ISOLATE IT				/A208
	ISZ	EFGTBY							/A208
	JMP I	EFGTBY		/ AND RETURN				/A208




	/
	/  CROSS FIELD CALLS FOR FIELD 3
	/



EFPOUT,	XX			/ call putout routine
	CDFMYF
	CIFEDT
	JMS I	(FMSWAP)
	  EDOCHR
	  CDFEDT
	JMP I	EFPOUT

/ CALLING SEQUENCE
/
/	CDIMNU
/	JMS I	(TCCHK)
/	  RETURN + 0 = REGULAR DEAD KEY SEQEUENCE
/	  RETURN + 1 = REQUIRED SPACE
/	  RETURN + 2 = F6 FUNCTION
/

/ THE INTERNAL DEAD KEY SEQUENCE FOR A TECHNICAL CHARACTER IS AS FOLLOWS:
/
/	SD SP GS CH ED
/
/	SD = START DEAD INDICATOR
/	SP = SPACE
/	GS = GRAPHICS SET G1 - G3 (OCTAL CODE 61-63)
/	TC = TECHNICAL CHARACTER
/	ED = END DEAD INDICATOR

/ WHEN CALLED THE START DEAD INDICATOR HAS ALREADY BEEN FOUND


/	TCCHK has been modified as of edit 244.				/M244
/	The purpose is to allow TCCHK to perform the same function	/M244
/	but split it into two routines					/M244
/		1. Checks the dead key as above				/M244
/			(this to run only in field 2)			/M244
/		2. Displays the tech char if found			/M244
/									/M244
/	The purpose is to allow other routines to access TCCHK or 	/M244
/	something similar						/M244
/
/

TCCHK,	XX			/ Set up to call TCCHR			/M244
	JMS	TCCHR		/ Call scan routine			/A244
	  JMP	TCDED		/ Ordinary dead				/A244
	  JMP	TCREQ		/ Required space			/A244
				/					/A244
				/ Must be tech so print it		/A244
				/					/A244
	TAD	TCTEMP		/ WE PAST ALL THE CHECK POINTS DISPLAY THE TC
	AND	(3)		/ START BY ACTIVATING THE PROPER CHARACTER SET
	SNA			/ EXCEPTION, TEST FOR GRAPHICS SET SELECTION 0
	JMP	TCTEC		/ NOT ALLOWED, DISPLAY IT AS A NORMAL DEAD/M244
	TAD	(JMP TCJMP) 	/ BUILD JUMP TO PROPER SET GRAPHICS DISPLAY CODE
	DCA	.+1
TCJMP,	XX
	 JMP	TCGS1		/ GO SET GRAPHICS SET 1
	 JMP	TCGS2		/ GO SET GRAPHICS SET 2
	TAD	(ESC)		/ SET GRAPHICS SET 3
	JMS	EFPOUT
	TAD	(157)		/ TAD A SMALL o
	JMS	EFPOUT
	JMP	TCCONT

TCGS1,	TAD	(16)		/ SET GRAPHICS SET 1
	JMS	EFPOUT
	JMP	TCCONT

TCGS2,	TAD	(ESC)		/ SET GRAPHICS SET 2
	JMS	EFPOUT
	TAD	(156)		/ TAD A SMALL n
	JMS	EFPOUT		/ FALL INTO NEXT ROUTINE
TCCONT,	TAD	TCTMP1		/ DISPLAY CHARACTER IN PROPER TECHNICAL CHAR SET
	JMS	EFPOUT
	TAD	(17)		/ RESET GRAPHICS TO DEFAULT SET
	JMS	EFPOUT
	CDFEDT
	DCA I	(PUTSC6)	/ TELLS VIEW CODE IT WAS NOT A REQUIRES SPACE
	CDFMYF
TCTEC,	ISZ	TCCHK							/A244
TCREQ,	ISZ	TCCHK							/A244
TCDED,	CDIEDT			/ Change back to Edit field		/A244
	JMP I	TCCHK		/ Return				/A244

/
/	This is a stripped down version of TCCHK that only checks 	/M244
/	the dead key and does the skip return stuff			/M244


TCCHR,	XX
	CLL CLA			/ DEAD KEY ALREADY DETECTED BY CALLING ROUTINE
	JMS	EFADPT		/ CHECK IF NEXT CHARACTER IS A SPACE
	  NOP
	  CDFEDT
	DCA I	(PUTSC6)	/ STORE HERE
	TAD I	(PUTSC6)	/ GET CHARACTER BACK
	CDFMYF
	AND	P177		/ MASK OUT ATTRIBIUTE BITS
	TAD	(-ECSPC)	/ CHECK FOR SPACE
	SZA CLA
	JMP	TCEX0		/ NORMAL DEAD KEY SEQUENCE

	JMS	EFADPT		/ CHECK NEXT CHARACTER
	NOP
	DCA	TCTEMP		/ IF TC STORE GRAPHICS SET INDICATOR
	TAD	TCTEMP		/ IF THIS CHARACTER IS A SPACE THEN EXIT
	AND	P177		/ JUST TO BE SURE BUT SHOULD NOT NEED IT
	TAD	(-ECSPC)	/ IS SECOND CHARACTER A SPACE
	SNA CLA
	JMP	TCEX1		/ YES, WE HAVE A REAL REQUIRED SPACE EXIT
IFNDEF	CONDOR	< JMP	TCEX0 >	/ NO, EXIT IF DM1 - IT HAS NO TEC. CHARS

	JMS	EFADPT		/ GET NEXT CHARACTER
	 NOP			/ WHICH IS THE TECHNICAL CHARACTER
	DCA	TCTMP1		/ AND STORE IT

	JMS	EFADPT		/ TEST FOR END DEAD INDICATOR TO MAKE
	 NOP			/ SURE THE USER IS NOT PLAYING GAMES WITH
	TAD	(-ECNDOV)	/ US.  THAT IS A TC IS NOT DEADED WITH A
	SZA CLA			/ NORMAL CHARACTER.  BAD TECHNICAL CHARACTER
	JMP	TCEX0		/ OUTPUT A HASH CHARACTER

TCEX2,	ISZ	TCCHR		/ RETURN + 2 = TECHNICAL CHAR SET	/M244
TCEX1,	ISZ	TCCHR		/ RETURN + 1 = REQUIRED SPACE		/M244
				/ RETURN + 0 = NORMAL DEAD KEY
TCEX0,	JMS	TCBKUP		/ Backup to start dead			/M244
/d244	CDIEDT
	CDFEDT			/ Map to Edit field			/M244
	JMP I	TCCHR		/ RETURN TO CALLER			/M244

TCTEMP,	0			/ HOLDS GRAPHICS SELECTION CHARACTER
TCTMP1, 0			/ HOLDS TECHNICAL CHARACTER


/
/	This is a cross field callable version of TCCHR from Editor
/

TCCHX,	XX								/A244
	JMS	TCCHR		/ Call TCCHX to scan dead		/A244
	  JMP	TCRDED		/ Normal dead				/A244
	  JMP	TCRREQ		/ required space			/A244
	ISZ	TCCHX		/ Bump return for tech			/A244
TCRREQ,	ISZ	TCCHX		/					/A244
TCRDED,	CIFEDT			/ Back to Editor			/A244
	JMP I	TCCHX		/ And return				/A244

/
/	This routine is a refugee from the CHKMR2 code since there is	/A244
/	no rrom there							/A244
/	It checks for hyphenation on a tech dead to allow hyphenation	/A244
/	on 8 bit							/A244


CHKTCC,	TAD	(ECTAB-ECSTOV)	/ Is it a start dead ?			/A244
	SZA CLA			/ 					/A244
	 JMP	CHKMR7		/ No.. so rejoin code			/A244
	JMS	TCCHR		/ Scan for tech dead			/A244
	 JMP	CHKMR7		/ no .. ordinary			/A244
	 JMP	CHKMR7		/ Required space			/A244
	TAD	TCTMP1		/ Get char				/A244
	AND	(2000)		/ Is it hyphenated ?			/A244
	SNA CLA			/					/A244
	JMP	CHKMR7		/ No					/A244
	JMP	CHKM2A		/ Yes					/A244

	X=.
/--------------

	PAGE

EFCNTR,	CDFEDT								/A217
	TAD I	(LINE23)						/A217
	DCA I	(CURPTR)		/ FIND CURRENT INDENT		/A217
	DCA	LNECHA							/A217
	JMS	EFLDCH							/A217
	NOP			/ BY COUNTING JUSTIFY SPACES		/A217
LNECH2,	TAD	(-ECJSPC)						/A217
	SZA CLA								/A217
	JMP	LNECH6							/A217
	ISZ	LNECHA							/A217
	JMS	EFADPT							/A217
	NOP								/A217
	JMP	LNECH2							/A217
LNECH6,	CDFEDT								/A217
	TAD I	(CENMAR)						/A217
	CIA								/A217
	TAD I	(CURSOR)		/ COMPUTE -#SPACES		/A217
	TAD	LNECHA							/A217
	SMA								/A217
	JMP	LNECH3		/ JUMP IF NONE				/A217
	CLL CML RAR							/A217
	DCA	LNECHA							/A217
	TAD	LNECHA							/A217
	TAD I	(RGTMAR)						/A217
	CIA								/A217
	TAD I	(CURSOR)						/A217
	SPA SNA								/A217
	JMP	LNECH4							/A217
	TAD	LNECHA							/A217
	SMA								/A217
	JMP	LNECH3							/A217
	DCA	LNECHA							/A217
LNECH4,	CLA								/A217
	TAD	(ECJSPC)						/A217
	JMS	EFINSR							/A217
	ISZ	LNECHA							/A217
	JMP	.-3		/ DO SPACES				/A217
LNECH3,	CLA								/A217
	CIFEDT								/A217
	CDFBUF								/A217
	JMP 	CNTREX							/A217

LNECHA,	.-.								/A217

/
/ CALPSH (CALLAR PUSH)		/ Edit number 227 for whole routine	/A227
/
/	This routine takes the address and data field of the routine
/	who called CALLAR, and pushes the values onto the stack.
/
/	Note: If the stack overflows the routine will halt with AC = 0
/

CALPSH,	0			/ Push CALL A ROUTINE ADDRESS ONTO THE STACK
	ISZ	CALPTR		/ Update stack pointer
	TAD I	CALPTR		/ Have we exceed the stack table length
	SNA CLA
	 JMP	CALERR		/ YES!! Hit a stack boundry CRASH SOFTWARE
	CDFEDT			/ No
	TAD I	(CALLAR)	/ Get calling routines address
	CDFMYF
	DCA I	CALPTR		/ And push it onto the stack
	ISZ	CALPTR		/ Update stack pointer
	CDFEDT
	TAD I	(CALFLD)	/ Get INSTRUCTION field of calling routine
	CDFMYF
	DCA I	CALPTR		/ And push it onto the stack
	CDIEDT
	JMP I	CALPSH		/ Return

/
/ CALPOP (CALLAR POP)		/ Edit number 227 for whole routine	/A227
/
/	This routine will restore CALLAR's return with the last
/	CDI and ADDRESS on the stack.
/
/	Note: If a return is attemped without an address
/	      the routine will halt with AC = 1.
/

CALPOP,	0			/ POP A CALL A ROUTINE ADDRESS OFF OF THE STACK
	TAD I	CALPTR		/ Do we have an address to pop
	SNA
	 JMP	CALERR+1	/ NO!! Crash the software
	CDFEDT			/ Yes
	DCA I	(CALFLD)	/ Store return field
	CDFMYF
	CLA CMA			/ Backup stack pointer
	TAD	CALPTR
	DCA	CALPTR
	TAD I	CALPTR		/ Get return address
	CDFEDT
	TAD I	(CALSKP)	/ Add skip return offset
	DCA I	(CALLAR)	/ Store return address
	CLA CMA			/ Back stack pointer
	TAD	CALPTR
	DCA	CALPTR
	CDIEDT
	JMP I	CALPOP		/ Return

CALERR,	SKP CLA			/ Exceeded end of stack boundry
	AC0001			/ Exceeded top of stack boundry
	 HLT			/ STOP - Don't let the user go any further
	JMP	.-1		/ Just in case they try to proceede

CALPTR,	CALSTK			/ Pointer into stack
CALSTK,	0000			/ Top of stack boundry
	7777;7777		/ A stack for ten cross field calls
	7777;7777		/ Any non zero value will do.
	7777;7777
	7777;7777
	7777;7777
	7777;7777
	7777;7777
	7777;7777
	7777;7777
	7777;7777
	0000			/ End of stack boundry

/
/	This routine belongs to TCCHK etc. but.. there's no room there	/M244
/	Backing up pointer to start dead was made a routine 		/M244
/


TCBKUP,	XX			
TCBKLP,	JMS	EFBKPT		/ LEAVE POINTER AT BEGINNING OF DEAD KEY SEQUENCE
	 NOP
	TAD	(-ECSTOV)
	SZA CLA
	JMP	TCBKLP
	JMP I	TCBKUP

	X=.
/--------------

	PAGE


NWRUL,	ZBLOCK	HAFRUL		/ Allocate workspace
	0000			/ buffer terminator

/ THE FOLLOWING LOCATIONS WITH THE EXCEPTION OF NWDT, HOLD THE POSITION
/ NUMBER WITHIN THE RULER OF THE SETTINGS SPECIFIED.  FOR EXAMPLE, A
/ RULER OF L1, R5 WOULD SET NMLMAR = 1 AND NWRMAR = 5.  AFTER RULER
/ MODIFICATION THESE PARAMETERS ARE TRANSFERED ALONG WITH NWRUL TO CURUL.

RLSTOR,
NWLMAR,	0			/ NEW LEFT MARGIN MARKER
NWRMAR,	0			/ NEW RIGHT MARGIN MARKER
NWWMAR,	0			/ NEW WORD WRAP INDENT MARKER
NWPMAR,	0			/ NEW PARAGRAPH INDENT MARKER
NWCMAR,	0			/ NEW CENTERING POINT MARKER
NWHMAR,	0			/ NEW HYPHENATION ZONE MARKER
NWDT,	0			/ NEW DECIMAL TABS - NUMBER OF DECIMAL TABS
				/ IN THE RULER.
NWRLND=.			/ End of ruler marker

	PAGE
SWPEND,				/ DEFINE END OF SWAP AREA CODE SO
				/ THAT REMANING AREA CAN BE CLEARED

	RELOC			/ RESET RELOCATION MECHANISM OF ASSEMBLER


/***************************************************************************
/****		PAGE ZERO DEFINITIONS FOR MAIN EDITOR IN FIELD 3	****
/***************************************************************************

	FIELD 1			/ EDITOR LOADS HERE BUT RUNS IN FIELD THREE

	*100

CDFMYF=	CDFEDT			/ DEFINE CDF INSTRUCTION FOR EDIT FIELD

ZZCASE=	JMS I	.		/ CASE STYLE COMPARISONS (SIMILAR TO
	GDCASE			/ SWITCH IN "C" )

HLTTST=	JMS I	.		/ TEST HALT FLAG SET BY GOLD HALT
	USHLTS

GETINP=	JMS I	.		/ CALL SYS TO GET CHARACTER FROM KEYBOARD
	EDICHR

PUTOUT=	JMS I	.		/ PUT CHARACTER TO DISPLAY
	EDOCHR

MODSET=	JMS I	.		/ SET OR CLEAR EDIT MODES
	ESMODE

INSCHR=	JMS I	.		/ INSERT CHARACTER INTO TEXT BUFFER
	ESICHR							/M241	/m239

ADVPTR=	JMS I	.		/ ADVANCE CURPTR TO NEXT NON-NULL CHAR IN FILE
	ESAPTR

BKPPTR=	JMS I	.		/ BACKUP CURPTR TO NEXT NON-NULL CHAR IN FILE
	ESBPTR

CHKPTR=	JMS I	.		/ CHECK CHARACTER IN TEXT BUFFER FOR:
	ESATST			/ 	NULL - ETX - STX  STATUS

TSTSLT=	JMS I	.		/ TEST FOR SELECT MODE ACTIVE
	ESLCTS

ADVCHR=	JMS I	.		/ ADVANCE CURPTR A SPECIFIED COUNT OF NON-NULL
	ESACHR			/ 	CHARACTERS IN TEXT BUFFER
				/	(NEVERS SCROLLS TO/FROM DISK)

CURMOV=	JMS I	.		/ MOVE CURSOR FORWARD OF BACKWARD FOR A
	ESMVCR			/ 	SPECIFIED NUMBER OF CHARACTERS

SLNMOD=	JMS I	.		/ SET LINE MODIFIED FLAGS (NOT IN BUFFER)
	SETLMD

PUTESC=	JMS I	.		/ SEND ESCAPE SEQUENCES TO DISPLAY
	ESPTES

XLTUPR=	JMS I	.		/ TRANSLATE LOWER CASE TO UPPER CASE
	ESXLUP

ADVSPC=	JMS I	.		/ ADVANCE CURPTR A SCREEN CHARACTER WIDTH
	ESASPC

BKPSPC=	JMS I	.		/ BACKUP CURPTR A SCREEN CHARACTER WIDTH
	ESBSPC

PUTETX=	JMS I	.		/ PUT CHARACTER TO DISK AT END OF FILE
	ESPUTE

PUTSTX=	JMS I	.		/ PUT CHARACTER TO DISK AT START OF FILE
	ESPUTS

OVLJMP=	JMS I	.		/ CALL IN OVERLAY CODE AND EXECUTE
	OVJUMP


SINZRO,				/ START OF INITED-TO-ZERO CONTROL WORDS
RLRMOD,	0			/ RULER MOD FLAG
GETTRM,	0			/ INPUT TERMINATOR
RLPOSN=	GETTRM			/ CURRENT RULER POSITION
GETLEN,	0			/ INPUT LENGTH
SLCTDR,	0			/ SELECT DIRECTION
PSTBLK,	0			/ CURRENT PASTE BLOCK
PSTPTR,	0			/ CURRENT PASTE BUFFER PTR
BASKCT,	0			/ CURRENT WASTEBASKET COUNT
EDMODE,	0			/ CURRENT EDIT MODES -
				/ 0 =	ADVANCE UNIT
				/ 1 =	BACKUP UNIT
				/ 2 =	BOLD UNIT
				/ 3 =	UNDERLINE UNIT
				/ 4 =	REMOVE BOLD UNIT
				/ 5 =	REMOVE UNDERLINE UNIT
				/ 6 =	CASE UNIT (UPPER/LOWER CASE)
				/ 10 =	SEARCH MODE
				/ 20 =	SELECT MODE
GRAMUN,	0			/ CURRENT GRAMMATICAL UNIT
				/	0 = CHARACTER, 1 = LINE, 2 = WORD,
				/	3 = SENTENCE, 4 = TAB POSITION,
				/	5 = PARAGRAPH, 6 = PAGE
CURPTR,	0			/ CURRENT LOC IN TEXT BUFFER
CURSOR,	0			/ CURRENT SCREEN COLUMN
SCRLCT,	0			/ SCREEN LAG - NUMBER OF LINES LEFT TO SCROLL
SCRNFL,	0			/ "WHOLE SCREEN" SCROLL FLAG
				/	0 = NO NEED TO SCROLL WHOLE SCREEN,
				/	2000 = SCROLL WHOLE SCREEN
SCRLFL,	0			/ SCROLL FLAG FOR BKP/ADV
PCTLFL,	0			/ PRINT CONTROL FLAG
				/	0 = NOT IN START CONTROL BLOCK,
				/	-1 = IN START CONTROL BLOCK
SPACNG,	0			/ CURRENT HALF-SPACING (2-4)
CURLIN,	0			/ CURRENT SETCUR LINE (REL TO BOTTOM OF SCREEN)
SCRLCU,	0			/ NON-ZERO IF SCREEN NEEDS MODIFICATION
SCRLIN,	0			/ EARLIEST LINE OF SCREEN NEEDING MODIFICATION
REJCNT,	0			/ USED TO COUNT MODS TIL REJUST TIME
REJFLG,	0			/ SET TO -1 IF REJUST NEEDED
LINMOD,	0			/ "LINE MODIFIED" FLAG WORD
ECHFLG,	0			/ "ALWAYS ECHO" FLAG
SRCDIR,	0			/ SEARCH DIRECTION, ALSO USED BY GO-TO-PAGE
MRGRSF,	0			/ MERGE RESYNC FLAG
CPYFNO=	MRGRSF			/  IS CHARACTER AT LEAST A "0" ?
CASBIT= CPYFNO			/ BIT SET FOR UP/LOW/BOLD/UNDL
GETPSF= CASBIT			/ GET PST EOF FLG
MRGPT1,	0			/ MERGE TEMP PTR
GLDPSF= MRGPT1			/ "EXACT PASTE FLAG"
RLDIRN= MRGPT1			/ GOLD RULER DIRECTION (0-FORW; -1 REV)
MRGPT2,	0			/ MERGE TEMP PTR
NINZRO= .-SINZRO		/ LENGTH OF INITED TO ZERO CTL WORDS
/D226	SPLTFL, 0		/ -1= SCREEN NEEDS TO BE SPLIT
/D226				/ 0 = SCREEN DOES NOT NEED TO BE SPLIT (WIDE)
/D226				/ 1 = SCREEN IS SPLIT (WIDE)

/----------
/
/	O R D E R   I M P O R T A N T
/
/ These next 5 words have been moved beyond the page 0
/  locations that are cleared during initialization.
/
/----------

LFTMAR,	0			/ CURRENT LEFT MARGIN
RGTMAR,	0			/ CURRENT RIGHT MARGIN
WRPMAR,	0			/ CURRENT WORD WRAP MARGIN
PGFMAR,	0			/ CURRENT PARAGRAPH INDENT MARGIN
CENMAR,	0			/ CURRENT CENTER, *2

/----------
/
/	E N D   O R D E R   I M P O R T A N T
/
/----------

BUFBEG,	0			/ PTR TO START OF EDIT BUFFER
BUFSIZ,	0			/ SIZE OF EDIT BUFFER
FORMNO,	0			/ MERGE FORM FILE NUMBER
FILENO,	0			/ EDIT FILE NUMBER
FILOPT,	0			/ EDIT OPTION (-1 RPLAC, 0 NORMAL)
LINE23,	0			/ LINE23 PTR
SPCCHK,	0			/ -# BLKS MIN BEFORE COMPLAINT
GSRF,	0			/ GLOBAL SEARCH AND REPLACE FLAG
CURTMP,	0			/ TEMP CURSOR STORAGE FOR VIEW MODE
CHRATR, 0			/ ATTRIBUTE OF CHAR GOING THRU BLKBOX

SCRNLN,	0			/ NUMBER OF LINES IN SCROLL AREA
WIDNAR,	WIDTH-COLM81		/ 0 = WIDE, 64 (52 DEC) = NARROW SCREEN	/A226

	IFDEF	FORIN	<
POINT1,	0			/ POINTER FOR TABLE SCAN FOR FOREIGN CHARACTERS
POINT2=	X3			/ TEMP STORAGE
CHAR1=	X4			/ ALSO TEMP STORAGE
			>	/ END IFDEF FORIN

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------
	PAGE

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED


/***************************************************************************
/****			START OF MAIN EDITOR CODE			****
/***************************************************************************

EDITOR,	XX
	JMP	EDIOP1

EDMERG,	XX			/ MERGE ENTRY
/D221	RDF			/ GENERATE RETURN CIF CDF INSTRUCTION
/D221	TAD	CIDF0
/D221	DCA	EDEXI3

	CDFMYF			/ CHANGE DATA FIELD TO THIS FIELD	/A221
	DCA I	EDITOV		/ CLEAR OVERLAY NUMBER TO FORCE LOAD	/A221
	OVLJMP;OVMRG1		/ FIRST OVERLAY

EDITOV,	OVLAY1			/ LOCATION OF OVERLAY AREA		/A221

EDIOP1,	CDFMYF			/ CHANGE DATA FIELD TO THIS FIELD	/A221
	CLA			/ DUMMY INSTRUCTION TO TAKE UP ROOM	/A221
	DCA I	EDITOV		/ CLEAR OVERLAY NUMBER TO FORCE LOAD	/A221

/D221	RDF			/ GENERATE RETURN CIF CDF INSTRUCTION
/D221	TAD	CIDF0
/D221	DCA	EDEXI3

	OVLJMP;OVINI1		/ INIT FOR NORMAL EDIT

REEDIT,	OVLJMP;OVINIT		/ DO INIT OVERLAY
	JMP	EINEXA		/ CONTINUE 'NORMAL' EDIT		/M204

EIFILE,	OVLJMP;OVXITF		/ DO EXIT OVERLAY
	JMP	EDEXI3		/ NORMAL EXIT

/ MUST BE HERE BECAUSE OF A CALL FROM MN1 UPON FINISHING USING THE SYSTEM
EDCLPB,	XX			/ CLEAR CUT/PASTE BUFFER
/D221	RDF
/D221	TAD	CIDF0
/D221	DCA	EDEXI4

	CDFMYF			/ CHANGE DATA FIELD TO THIS FIELD	/A221
	CLA			/ DUMMY INSTRUCTION TO TAKE UP ROOM	/A221
	DCA I	EDITOV		/ CLEAR OVERLAY NUMBER TO FORCE LOAD	/A221

	OVLJMP;OVCLPB

EDEXI4,	CDIMNU			/ SET DATA & INSTRUCTION FIELDS TO MENU	/M221
	JMP I	EDCLPB		/ RETURN TO MAIN MENU

EDEXI3,	CDIMNU			/ SET DATA & INSTRUCTION FIELDS TO MENU	/M221
	JMP I	EDITOR		/ RETURN TO MAIN MENU

OLDHR,	0			/ HOURS AT START OF EDIT
OLDMIN,	0			/ MINUTES AT START OF EDIT

EITOP,	OVLJMP;OVEXIT		/ CLOSE THE DOCUMENT

	JMP	REEDIT		/ NOW RESUME 'NORMAL' EDIT FROM TOP

LINDNT,	XX			/ INDENT TO LEFT MARGIN
	CIFMNU
	CDFEDT
	JMS I	(CALSWA)
		EFLDNT
		CDFEDT
	JMP I	LINDNT


/
/++
/		CALLAROUTINE	CALL_A_ROUTINE
/
/FUNCTIONAL DESCRIPTION: CALLAROUTINE
/
/ This routine can be used to call any subroutine in the editor from any
/ field in the system as long as the editor subroutine makes only a normal
/ or skip return.
/
/CALLING SEQUENCE:	CIFEDT (DF = CALLER FIELD)
/			JMS	CALLAR
/			    Rouitne in field 3 to be called
/			    Data field to set for called routine
/
/INPUT PARAMETERS:	LINK, AC, MQ can equal any value that may be required
/			by the routine being called
/
/			MQ = value (if any) needed for called routine
/		
/IMPLICIT INPUT:	CIDF0, CALLA1, T1, CALLAROUTINE
/
/OUTPUT PARAMETERS:	LINK, AC, MQ = Output values set by called routine
/			Data and Instruction field = Calling field
/
/IMPLICIT OUTPUT:	CALLA1, T1, CALLA2
/
/

FMSWAP,				/ Rewrite of CALL_A_ROUTINE		/M227
CALLAR,	XX			/ CALL_A_ROUTINE
	DCA	CALSAC		/ Store value of AC
	RDF			/ Get field of calling routine
	TAD	CIDF0		/ and build a CIF CDF return
	DCA	CALFLD		/ Store the return field call
	TAD I	CALLAR		/ Get address of routine to be called
	DCA	CALADD		/ store it
	ISZ	CALLAR
	TAD I	CALLAR		/ Get data field to set
	DCA	CALCDF		/ store it
	ISZ	CALLAR		/ Set up return address
	DCA	CALSKP		/ Init skip return pointer
	CDFMNU			/ Set field to menu swap area		/A233
	TAD I	(CALLN1+2)	/ This is a test to see if CALPSH, 	/A233
	TAD	(-NOP)		/ CALPOP rouitines are indeed in memory /A233
	SZA CLA			/					/A233
	JMP	.+3							/A233
	  HLT			/ CALPSH, CALPOP are not loaded		/A233
	  JMP	.-1		/ crash system!!!			/A233
	CDIMNU
	JMS I	(CALPSH)	/ Push the information onto the stack
	TAD	CALSAC		/ Restore the AC
CALCDF, XX			/ CDF for routine being called
	JMS I	CALADD		/ Call the routine
	 SKP
	 ISZ	CALSKP
	DCA	CALSAC		/ Store value of AC
	CDIMNU
	JMS I	(CALPOP)
	DCA	CALSKP		/ Clear flag for next return		/A231
	TAD	CALSAC		/ Restore AC
CALFLD,	XX			/ CAlling field CID return
	JMP I	CALLAR		/ Return to routine

CALADD,	0			/ CALLING ADD OF FIELD 3 ROUTINE
CALSKP,	0			/ ZERO = RETURN AT CALL+1, 1=CALL +2
CALSAC,	0			/ STORE AC TEMP REG


/ This routine origionally was set up to refresh only what needed to be
/ refreshed. due to the high number of exception cases & the lack of space
/ to test for each exception, the entire line will be repainted whenever a
/ tab character is seen.
/
TBJUST,	XX			/ JUSTIFY NEXT TAB STOP			/A208
	CDFEDT								/A208
	CIFMNU								/A208
	JMS I	(CALSWA)						/A208
		EFTJST							/A208
		CDFEDT							/A208
	JMP I	TBJUST							/A208


BEEPER,	XX
	JMS	BUZZER
	CIFSYS			/ CLEAR UDK STACK
	UDKOPS
	JMP I	BEEPER

BUZZER,	XX
	AC0006
	IAC			/ SET AC TO 7 (saves 1 location)
	PUTOUT
	JMP I	BUZZER

BLDBIT=	CASBIT
BLDUNT,	TAD	(200)		/ SET...
NBDUNT,	DCA	BLDBIT		/ ...OR CLEAR BOLDING
	OVLJMP;OVBOLD

CHKMAR,	XX			/ CHK RIGHT MARGIN			/A207
	CDFEDT			/ CALL IN MENU FIELD			/A207
	CIFMNU								/A207
	JMS I	(CALSWA)						/A207
		EFCKMR							/A207
		CDFEDT							/A207
	SKP			/ NON-SKIP RETURN			/A207
	ISZ	CHKMAR		/ SKIP RETURN				/A207
	CDFBUF
	JMP I	CHKMAR							/A207

EDOCHR,	XX
	CDFMYF

	DCA	HLDCHR		/ SAVE CHAR TO BE OUTPUT
	TAD	HLDCHR		/ RESTORE CHAR
	AND	(3600)		/ MASK OFF ATTRIBUTE BITS
	DCA	CHRATR		/ AND SAVE FOR FUTURE REFERENCE
	TAD	HLDCHR		/ RESTORE CHAR TO CONTINUE

/ BLKBOX WHICH HANDLES CHARACTERS TO BE DISPLAYED ON THE VT100 RESIDES
/ IN FIELD 1.  GO THERE TO DISPLAY THIS CHARACTER.

	CIFPRT			/ "BLACKBOX" IN PRINTER FIELD (1)
	JMS I	(BLKBOX)
	JMP I	EDOCHR

HLDCHR,	0			/ TEMP STORAGE FOR BLKBOX ROUTINE

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------
	PAGE

/**********************	)/ RESTORE CHAR TO CONTINUE

/ BLKBOX WHICH HANDLE
/****			START OF RESIDENT OVERLAY AREA			****
/****	     THIS AREA IS OVERLAYED BY LIST PROCESSING AND SPELL	****
/***************************************************************************

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED

OVLAYM,				/ THIS SYMBOL IS USED BY L.P. AND SPELL

/	*** ENTRY POINTS FOR UNIMPLEMENTED OPERATIONS ***

/d215 EITABC,				/ ** NOT IMPLEMENTED YET **

EIBAD,	JMS	BEEPER 		/ NOTIFY USER OF ERROR

EIFXT2,									/A168
EIFIX,	CLA			/ MAKE SURE WE ARE ON A LEGAL CHARACTER
EIFIX1,	CURMOV
	NOP			/ IGNORE TOP OR BOTTOM OF DOCUMENT
	MODSET								/M168
	EDTMOD 			/ RESET MODES

EINEXT,				/ GET INPUT CHARACTER
	CDFMYF			/ CHANGE BACK TO MY DATA FIELD
	CLA
	DCA	ECHFLG 		/ CLEAR ECHO MODE

GSKILN,	CIFSYS			/ REPLACED WITH A "SKIP" BY G.S.R. CODE
	XLTIN

	IFDEF	DEMO	<
	*.-2
	NOP
	NOP
			>	/ END 'IFDEF DEMO'

EINEXA,	SKP CLA			/ XLTIN RETURN WITH NO CHARACTER	/M168
	JMP	EINEXB		/ XLTIN RETURN WITH CHARACTER IN AC
	DCA	ECHFLG 		/ CLEAR ECHO MODE			/A168
	CURMOV
	NOP
	JMS	TSTLIM
	JMS	FXSCRL

	CDFMYF			/ NEEDED WHEN BACKING UP INTO A LONG LINE /A236
	CIFMNU			/ CHANGE TO MENU FIELD FOR STATUS CHECK
	JMS I	(CALLN5)	/ GO CHECK IF STATUS VALUES HAVE CHANGED /C235
	GETINP 			/ GO WAIT FOR USER TO ENTER A CHARACTER

	IFNDEF	FORIN	<
EINEXB,	SMA
	JMP	OVSCHK							/M254
			>	/ END IFNDEF FORIN

	IFDEF	FORIN	<
EINEXB,	DCA	CHAR1
	OVLJMP
	ACCENT
EINEXC,			>	/ END IFDEF FORIN

/***************************************************************************
/****			CAUTION - RESIDENT OVERLAY AREA			****
/****	     THIS AREA IS OVERLAYED BY LIST PROCESSING AND SPELL	****
/***************************************************************************


EINEXD,	MQL			/ TUCK THE CHAR
	ACL
	TAD	(-EDUPAR)	/ CHECK FOR UP AND DOWN ARROW
	SNA
	JMP	EINEXM
	TAD	(EDUPAR-EDDNAR)
	SNA CLA
	JMP	EINEXM
	AC7777
	DCA	REMCUR		/ NEITHER, SET "REMCUR" TO -1

EINEXM,	ACL			/ GET CHARACTER BACK
	CMA
	TAD	(-EDXVLN) 	/ TEST FOR OK
	SMA
	JMP	EIBAD

	TAD	(EDXVEC+EDXVLN) / MAKE POINTER TO TRANSFER VECTOR TABLE
	DCA	T1 		/ STORE FOR INDIRECT PICKUP
	CDFLP			/ CHANGE TO FIELD WHERE TABLE LOCATED
	TAD I	T1 		/ PICK UP ROUTINE ADDRESS
	CDFMYF			/ CHANGE BACK TO THIS FIELD
	DCA	T1 		/ STORE FOR INDIRECT JUMP TO ROUTINE
	JMP I	T1		/ TRANSFER TO ROUTINEE REQUESTED


/***************************************************************************
/****			CAUTION - RESIDENT OVERLAY AREA			****
/****	     THIS AREA IS OVERLAYED BY LIST PROCESSING AND SPELL	****
/***************************************************************************

/ GOTO PAGE entrance for emulating ADVANCE PAGE....

RPGETUNT,XX			/ ADVANCE A PAGE
	CLA			/ CHAR. PASSED BY LODCHR
	TAD	RPGETUNT	/ RETURN (A) AND ARG. PTR.
	DCA	GETUNT		/ FOR NORMAL PROCESS
	JMP	GETRPT		/ FOR NON-CONTINUOUS ECHO

/===========================================================================
/====		   THIS IS A CO-ROUTINE TYPE SUBROUTINE			====
/===========================================================================

GETUNT,	XX			/ CO-ROUTINE ENTRY POINT
	AC0001			/ SET FOR CONTINUOUS ECHO
GETRPT,	DCA	ECHFLG 		/ GOTO PAGE NON-CONTINUOUS ECHO
	DCA	OVSFLG 		/ CLEAR OVERSTRIKE FLAG (DEAD KEY)

	JMS	LODCHR		/ LOAD FIRST AVAILABLE CHARACTER
	JMP	GETUNZ		/ END OF FILE - AC=0

	JMS	CHKUNT		/ AC = CHARACTER OR BUFFER CODE
GETUNX,	XX			/ CHKUNT CO-ROUTINE RETURN POINT
	SMA SZA			/ CHECK FOR VALID CHARACTER
	JMP	GETUNY		/ YES, GO HANDLE IT

GETUNQ,	SMA CLA			/ WAS THIS A SPECIAL CHARACTER
	TAD I	CURPTR		/ YES, NOT DONE, GET CHARACTER BACK

GETUNZ,	JMS I	GETUNT		/ GETUNT CO-ROUTINE RETURN POINT
	SZA			/ IS A CHARACTER BEING RETURNED ?
	DCA I	CURPTR		/ YES, STORE IT IN THE BUFFER

	TAD	OVSFLG		/ GET THE OVERSTRIKE FLAG (DEAD KEY)
	SZA			/ IS IT SET ?
	JMP	GETUNO		/ YES, GO HANDLE DEAD KEY SEQUENCE
	TAD I	CURPTR		/ NO, GET THE CURRENT CHARACTER
	TAD	(-ECSTOV)	/ COMBINE THIS WITH START OF DEAD KEY CODE
	SNA CLA			/ IS THIS THE START OF DEAD KEY SEQUENCE ?
	JMP	GETUNP		/ YES, GO HANDLE IT

GETUNY,	AC0001			/ NO, SET UP TO MOVE TO NEXT CHARACTER
	CURMOV			/ GO DO THE MOVE
	JMP	GETUNZ		/ END OF FILE, GO HANDLE IT

	JMS	LODCHR		/ PICK UP THE NEXT AVAILABLE CHARACTER
	JMP	GETUNZ		/ END OF FILE, GO HANDLE IT
	JMP I	GETUNX		/ RETURN TO CHKUNT

/***************************************************************************
/****			CAUTION - RESIDENT OVERLAY AREA			****
/****	     THIS AREA IS OVERLAYED BY LIST PROCESSING AND SPELL	****
/***************************************************************************


GETUNP,	ISZ	OVSFLG 		/ SET OVERSTRIKE FLAG (DEAD KEY)
GETUNO,	SPA CLA			/ CHECK VALUE OF FLAG
	JMP	GETUNR 		/ JUMP IF END OF OVERSTRIKE

	ADVPTR			/ ADVANCE TO NEXT BUFFER CHARACTER
	JMP	GETUNZ		/ END OF FILE, GO HANDLE IT

	TAD	(-ECNDOV)	/ COMBINE WITH END OF DEAD KEY CODE
	SZA CLA			/ IS THIS THE END OF THE DEAD KEY SEQUENCE ?
	JMP	GETUNQ 		/ NO, GO AND GET THE CHARACTER BACK

	AC7777			/ YES, THIS IS THE END OF THE DEAD KEY
	DCA	OVSFLG 		/ SET END FLAG
	JMP	GETUNQ		/ GO AND GET THE CHARACTER BACK

GETUNR,	DCA	OVSFLG 		/ SHOW OVERSTRIKE DONE (DEAD KEY)
	ADVPTR			/ MOVE TO NEXT BUFFER CHARACTER
	NOP 			/ GET PAST END CODE
	BKPSPC
	NOP 			/ BACK UP TO BEGINNING
	JMP	GETUNY 		/ NOW REALLY ADVANCE OVER IT

OVSFLG,	.-.



/***************************************************************************
/****			CAUTION - RESIDENT OVERLAY AREA			****
/****	     THIS AREA IS OVERLAYED BY LIST PROCESSING AND SPELL	****
/***************************************************************************


/
/ A REQUEST FOR V2 GOTO-PAGE, GOLD:BOTTOM, OR GOTO-RULER
/ IS BEING PROCESSED.
/
/ NOTE: 'OVEXIT' AND 'OVINIT' ARE CALLED AS SUBROUTINES, AND SO
/ MUST NOT USE ANY ADDITIONAL OVERLAYS (I.E., MUST NOT USE 'OVLJMP')
/
RPTOP,	OVLJMP;OVEXIT		/ AC => 0, GO CLOSE DOC AND RETURN HERE
	OVLJMP;OVINIT		/ REOPEN DOCUMENT, THEREBY FILLING THE
				/ APPROPIATE BUFFERS WITH THE DOCUMENT
				/ HEADER BLOCK AND RPPGDS BLOCK

				/ PREVENT DISPLAY OF DOCUMENT HDR INFO
				/ WHEN REPAINTING SCREEN
	CDFFIO			/ CHANGE TO FILE SYSTEM FIELD
	TAD I	(SCFSPC)	/ GET NUMBER OF BLOCKS LEFT ON DISK
	CDFMYF			/ BACK TO THIS FIELD
	JMS	MNUPUT		/ STORE VALUE FOR USE BY STATUS LINE
	LINFRE-MUBUF		/ LOCATION IN FIELD 2 FOR BLOCKS FREE

	OVLJMP;OVRRP2		/ GO PERFORM THE GOTO-PAGE, GOLD:BOTTOM,
				/ OR GOTO-RULER REQUEST

EIHELP,	OVLJMP;OVHELP		/ HELP COMMANDS
EIINTB,	OVLJMP;OVGLTB		/ GOLD:TAB (INDENT TABS)		/A215
	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------------
	PAGE
/***************************************************************************
/****			  END OF RESIDENT OVERLAY AREA			****
/****	   PREVIOUS AREA IS OVERLAYED BY LIST PROCESSING AND SPELL	****
/***************************************************************************


	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED

EIRBSE,	IAC			/ RUB OUT SENTENCE
EIRBWD,	IAC			/ RUB OUT WORD
EIRBLN,	IAC			/ RUB OUT LINE
EIRBCH,				/ RUB OUT CHARACTER
	DCA	GRAMUN		/ SET UNIT TYPE
	TAD	(ECTMRK)	/ INSERT MARKER
	JMS	INSERT
	JMS	BACKUN		/ BACK UP ONE UNIT
	JMS	BEEPER
	TAD	(CNTMOD)
	JMP	DELUNT		/ USE DELETE CODE

CNTUN1,	JMS	CHKUNR
CNTUNT,	TAD	(-ECTMRK)
	SZA CLA
	JMP	CNTUN1
	DCA I	CURPTR
	JMS	SCRNMD		/ SHOW SCREEN MODIFIED
	JMP	LSTUNT		/ QUIT WUEN MARK FOUND

GOTMRK,	IAC
SLXMOD,	IAC
EIENTR,	IAC
EIPAGE,	IAC
EIPARA,	IAC
EITABP,	IAC
EISENT,	IAC
EIWORD,	IAC
EILINE,	IAC
EICHAR,	DCA	GRAMUN		/ SET UNIT TYPE
	JMS	SETUNT
	TAD	EDMODE		/ GET CURRENT MODE
	AND	(MVMASK)
	TAD	(JMP I MVJTAB)	/ GET JUMP TO RIGHT ROUTINE
	DCA	.+1
	JMP I	.-.

MVJTAB,	ADVUNT			/ ADVANCE
BKPMOD=	.-MVJTAB
	BKPUNT			/ BACK UP
BLDMOD=	.-MVJTAB
	BLDUNT			/ BOLD
UDLMOD=	.-MVJTAB
	UDLUNT			/ UNDER LINE
NBDMOD=	.-MVJTAB
	NBDUNT			/ REMOVE BOLD
NUDMOD=	.-MVJTAB
	NUDUNT			/ REMOVE UNDER LINE
CASMOD=	.-MVJTAB
	CASUNT			/ UPPER/LOWER CASE
MVMASK=	7

SETUNT,	XX			/ SET UNIT
	TAD	GRAMUN
	TAD	(JMP I MVCTAB)	/ MAKE JUMP OUT OF UNIT CODE
	DCA	MVCODE		/ AND STORE IT
	DCA	SCRLFL		/ CLEAR SCROLL FLAG
	JMP I	SETUNT

CHKUNR,	XX			/ USED FOR OFF-PAGE CALLS
	JMS I	CHKUNT
	JMP I	CHKUNR

CHKUNH,	XX			/ SAME AS CHKUNR, BUT TEST HALT FLAG
	HLTTST
	AC7777			/ RETURN "DONE" IF SET
	CDFBUF
	JMS I	CHKUNT
	JMP I	CHKUNH

CHKUNT,	XX
MVCODE,	JMP I	.-.

SETBNT,	XX			/ SET FOR BACKUP
	TAD	(MVBTAB-MVCTAB)
	JMS	SETUNT
	JMP I	SETBNT

MVBTAB,	CHRBNT
	LINBNT
	WRDBNT
	SNTBNT
	TABBNT
	PARUNT
	PAGBNT
	FLDBNT

MVCTAB,	CHRUNT
	LINUNT
	WRDUNT
	SNTUNT
	TABUNT
	PARUNT
	PAGUNT
	FLDUNT
SLCTMD=	.-MVCTAB		/ "SELECT" TYPE CODE
	SLTUNT
CNTMOD=	.-MVCTAB		/ "COUNT" TYPE CODE
	CNTUNT

ECFIEL=	76			/ CODE FOR FIELD DELIMITER (RIGHT ANGLE)

FLDBN1,	JMS	CHKUNR
FLDBNT,	AND	P177
	TAD	(-ECFIEL)
	SNA CLA
	JMP	FLDBN1
FLDBN2,	JMS	CHKUNH
FLDUNT, AND	P177
	TAD	(-ECFIEL)
	SZA CLA
	JMP	FLDBN2
FLDUN3,	AC0001
	JMS	CHKUNH
	AND	P177
	TAD	(-ECFIEL)
	SNA CLA
	JMP	FLDUN3
	JMP	LSTUNT

LINUN1,	JMS	CHKUNR
LINUNT,
LINBNT,	CLA
	TAD	SCRLFL
	SNA
	JMP	LINUN1
LINUN2,	SMA
	JMP	LSTUNT
CHRUNT,	SPA CLA
TABUN2,	AC0001
	JMS	CHKUNR		/ RETURN CODE TO CO-ROUTINE CALLER
LSTUNT,
CHRBNT,	AC7777			/ SET DONE CODE
	JMP	LSTUNT-1	/ GO RETURN CODE TO CALLER

SLTUN1,	JMS	CHKUNR		/ MAKE CALL TO CHKUNT
SLTUNT,	JMS	ESLCTD		/ CHECK FOR SELECT MARK AND DELETE IT
	JMP	SLTUN1		/ NOT FOUND, GO CHECK NEXT CHARACTER
	DCA	EDMODE		/ FOUND, CLEAR THE EDIT MODE FLAG
	JMP	LSTUNT		/ GO RETURN DONE CODE TO CALLER

RPCUBK,	0			/ Rapid Paging CUrrent BlocK id #

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------
	PAGE

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED


WRDUN1,	JMS	CHKUNR
WRDBNT,	JMS	WRDTST
	SNA CLA
	JMP	WRDUN1
WRDUN2,	JMS	CHKUNR
WRDUNT,	JMS	WRDTST
	SZA CLA
	JMP	WRDUN2
WRDUN3,	AC0001
	JMS	CHKUNR
	JMS	WRDTST
	SNA CLA
	JMP	WRDUN3
	JMP	LSTUNT

WRDTST,	XX
	JMS	PARCHK
	SZA
	TAD	(ECNWPG-40)
	SZA
	TAD	(40-ECTAB)
	JMP I	WRDTST

SNTUNX,	XX
	SKP
SNTUN1,	JMS	CHKUNR
	JMS	WRDTST
	SNA CLA
	JMP	SNTUN1
SNTUN3,	JMS	CHKUNH
	JMS	PARCHK
	SZA
	TAD	(ECNWPG-".+200)
	SZA
	TAD	(".-"!)
	SZA
	TAD	("!-"?)
	SZA CLA
	JMP	SNTUN3
	JMP I	SNTUNX

SNTBNT,	JMS	SNTUNX
	JMP	WRDUN3

SNTUNT,	JMS	SNTUNX
	JMP	WRDUN3+1

TABUNT,	AND	P177		/ MASK OFF ATTRIBUTES
	TAD	(-ECTAB)
	SNA CLA
	JMP	TABUN2
	TAD	SCRLFL
	SZA
	JMP	LINUN2
TABBNT,	CLA
	JMS	CHKUNR
	JMP	TABUNT

PARUN0,	JMS	CHKUNR
PARUNT,	JMS	PARCHK
	SNA CLA
	JMP	PARUN0
PARUN1,	JMS	CHKUNH
	MQL
	MQA
	TAD	(-ECPGRF)
	SNA CLA
	JMP	PARUN2		/ STOP QUICK ON GRAF MARKER
	MQA
	JMS	PARCHK
	SZA CLA
	JMP	PARUN1
	JMS	CHKUNR
	JMS	PARCHK
	SZA CLA
	JMP	PARUN1
PARUN2,	AC0001
	JMS	CHKUNR
	JMS	PARCHK
	SNA CLA
	JMP	PARUN2
	JMP	LSTUNT

PARCHK,	XX
	AND	P177
	TAD	(-ECNWLN)
	SZA
	TAD	(ECNWLN-ECNWPG)
	JMP I	PARCHK

PAGBN1,	JMS	CHKUNR
PAGBNT,	JMS	WRDTST
	SNA CLA
	JMP	PAGBN1
PAGUN1,	JMS	CHKUNH
PAGUNT,	TAD	(-ECNWPG)
	SZA
	TAD	(ECNWPG-ECPMRK)
	SZA CLA
	JMP	PAGUN1
	JMP	WRDUN3

/ IF AC= SELECT POINT
/ THEN	BUMP RETURN ADDRESS
/	SET THE LINE MODIFIED FLAG
/	DELETE SELECT POINT FROM BUFFER
/	DELETE ALL CHARACTERS FOLLOWING IT UNTIL THE NEXT CHARACTER WHICH
/	 IS NOT A JUSTIFIED SPACE OR A LINE MODIFIED CHARACTER OR A RULER
/	 MODIFIED CHARACTER.
/	IF A RULER MODIFIED CHARACTER IS FOUND SET THE RULER MODIFIED FLAG

ESLCTD,	XX
	TAD	(-ECSLPT)	/ IF AC=SELECT POINT
	SZA CLA			/
	JMP I	ESLCTD		/
	ISZ	ESLCTD		/ THEN	BUMP RETURN ADDRESS
	SLNMOD			/ 	SET LINE MODIFIED FLAG
SLTUN2,	DCA I	CURPTR		/	LOOP,	DELETE CHAR
SLTUN4,	JMS LODCHR		/		GET_CHAR (FROM EDIT BUFFER)
	JMP I	ESLCTD		/	EXIT IF END OF FILE
	TAD	(-ECJSPC)	/	EXIT IF CHAR .NE. (JUSTIFIED SPACE
	SNA CLA			/
	JMP	SLTUN2		/
	JMS	CHKLMD		/		OR RULER MOD OR LINE MOD)
	JMP I	ESLCTD		/ (RETURNS HERE IF NOT A 'MODIFIED' CHAR)
	JMP	SLTUN4		/	END_LOOP

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------
	PAGE

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED


ESMODE,	XX			/ SET EDIT MODE
	CDFMYF
	AC7777
	TAD I	ESMODE		/ GET ARG PTR
	DCA	X0
	TAD	EDMODE		/ GET MODE
	AND I	X0		/ CLEAR SOME,...
	TAD I	X0		/ ...AND SET SOME
	DCA	EDMODE
	ISZ	ESMODE		/ BUMP TO RTN ADR
	JMP I	ESMODE		/ AND RETURN


/	ESAPTR	ADVANCE CURPTR 1 CHARACTER
/
/	THIS ROUTINE WILL ADVANCE TO THE NEXT NON-NULL CHARACTER AFTER
/	THE CURRENT POSITION.  IT UPDATES CURPTR TO POINT TO THIS
/	CHARACTER.  IF THE CURRENT CHAR POINTED TO IS A NULL THEN THE
/	FIRST NON-NULL CHARACTER IS RETURNED.  IF THE CHAR CURRENTLY
/	POINTED TO IS NOT NULL THEN THE NEXT NON-NULL CHAR IS RETURNED.
/
/	CALL:
/
/	ADVPTR			/ CALLED THROUGH PAGE ZERO
/	<RETURN HERE ON END OF TEXT>
/	<RETURN HERE WITH CHARACTER IN AC>
/
ESAPTR,	XX			/ ENTRY POINT TO ESAPTR
	CLA			/ GET CHARACTER AT CURRENT POSITION
	CHKPTR			/ RETURN  AC < 0 IF ETX IN BUFFER
				/	  AC = 0 IF NULL CHAR
				/	  AC > 0 IF OK CHARACTER
	SPA			/ ETX IN BUFFER?
	JMP	ESAPT2		/ YES, GO GET CHAR FROM DISK
	SZA CLA			/ NULL?
	AC0001			/ NOT NULL ADVANCE 1 CHAR
	ADVCHR			/ ADVANCE TO NEXT NON-NULL CHARACTER
	SPA			/ REAL CHARACTER (NOT ETX)?
	JMP	ESAPT2		/ ETX FOUND, GO EXPAND
ESAPT1,	ISZ	ESAPTR		/ INCREMENT FOR SKIP RETURN
	SKP			/ SKIP OVER CLEAR FOR NON-SKIP RETURN
ESAPT4,	CLA			/ NON-SKIP RETURN SO CLEAR AC
	JMP I	ESAPTR		/ BYE-BYE
ESAPT2,	JMS	ESGETE		/ GET NEXT CHARACTER FROM DISK
	SPA SNA			/ LEGAL CHARACTER?
	JMP	ESAPT4		/ NO TAKE NON-SKIP RETURN.  ETX IN FILE!
	DCA I	CURPTR		/ PLACE CHARACTER IN BUFFER. OVERWRITING
				/ ETX MARK
	AC0001			/ MOVE FORWARD ONE CHARACTER
	CHKPTR			/ RETURN AC <= 0 THEN OK TO INSERT ETX MARK
				/	AC > 0 THEN MUST SAVE CHAR FIRST
	SPA SNA CLA		/ OK TO OVERWRITE?
	JMP	ESAPT3		/ YES, GO SHOVE IT IN.
	TAD I	CURPTR		/ GET CHARACTER TO WRITE TO DISK
	PUTSTX			/ PUT CHARACTER OUT TO DISK
ESAPT3,	TAD	(ECETX)		/ RESTORE OVERWRITTEN ETX MARKER
	DCA I	CURPTR
	AC7777			/ BACKUP TO CHARACTER RETRIEVED FROM DISK
	CHKPTR
	JMP	ESAPT1		/ AND TAKE SKIP RETURN

/	ESBPTR	BACKUP CURPTR 1 CHARACTER
/
/	THIS ROUTINE WILL BACKUP TO THE NEXT NON-NULL CHARACTER BEFORE
/	THE CURRENT POSITION.  IT UPDATES CURPTR TO POINT CHARACTER.
/	IF THE CURRENT CHARACTER POINTED TO IS A NULL THEN THE FIRST
/	NON-NULL CHARACTER BEFORE THE CURRENT POSITION IS RETURNED.
/
/	CALL:
/
/	BKPPTR			/ CALL THROUGH PAGE ZERO LINK
/	<RETURN HERE ON START OF TEXT IN FILE AC := 0>
/	<RETURN HERE ON SUCCESS AC := CHAR POINTED TO>
/
ESBPTR,	XX			/ ENTRY POINT
ESBPT1,	AC7777			/ BACKUP ONE CHARACTER
	CHKPTR			/ RETURN  AC < 0 IF STX IN BUFFER
				/	  AC = 0 IF NULL
				/	  AC > 0 IF LEGAL CHAR
	SMA SZA			/ LEGAL CHARACTER?
	JMP	ESBPT3		/ YES GO TAKE SUCCESSFUL EXIT
	SMA CLA			/ STX IN BUFFER?
	JMP	ESBPT1		/ NO, NULL SO LOOP TILL NON-NULL
	JMS	ESGETS		/ GET CHARACTER FROM DISK
	SPA SNA			/ LEGAL CHAR?
	JMP	ESBPT4		/ STX IN FILE GO EXIT
	DCA I	CURPTR		/ PUT CHARACTER IN TEXT BUFFER
	AC7777			/ BACKUP A CHARACTER
	CHKPTR			/ RETURN  AC <= 0 THEN OK TO INSERT STX
				/	  AC > 0 THEN PUT CHAR TO DISK
	SPA SNA CLA		/ MUST SAVE CHARACTER?
	JMP	ESBPT2		/ NO CAN OVERWRITE
	TAD I	CURPTR		/ GET CHARACTER FROM BUFFER AND
	PUTETX			/ WRITE TO DISK
ESBPT2,	TAD	(ECETX)		/ INSERT START OF TEXT MARK
	DCA I	CURPTR		/ INTO BUFFER
	AC0001			/ REPOSITION OVER CHARACTER BACKED UP TO
	CHKPTR
ESBPT3,	ISZ	ESBPTR		/ SUCCEEDED SO SKIP RETURN
	JMP I	ESBPTR		/ BYE BYE
ESBPT4,	AC0001			/ REPOSITION OVER FIRST CHARACTER IN FILE
	CHKPTR
	CLA			/ CLEAR AC SINCE NOT FOUND
	JMP I	ESBPTR		/ AND TAKE FAILURE RETURN

EIPGRF,	TAD	(ECPGRF-ECNWLN)	/ Paragraph marker.
EINWLN,	TAD	(ECNWLN-ECENLN)	/ Offset to GOLD:CENTER
	DCA	T2		/ save for overlay.
	OVLJMP;OVNWLN		/ Process new-line (check for CENTERED).
	TAD	T2		/ Get return code.
EICENT,	TAD	(ECENLN-ECTAB)
EITAB,	TAD	(ECTAB-ECPHYP)
EIHYP1,	TAD	(ECPHYP)
EINSRT,
EIFXT1,	JMS	CHKSPC		/ CHECK FOR SPACE BEFORE INSERTING ANYTHING
	CDFBUF			/ LET'S PUT THIS IN THE RIGHT FIELD, NOW
	JMS	ESIMCH		/ INSERT IT				/M241
	JMP	EIFXT2

SWTHMA,	XX			/ "MA" SWTHMA ROUTINE
	CDFMNU			/ CHANGE TO MENU DATA FIELD
	SNA CLA			/ WANT TO SAVE THE "MA" SWITCH?
	JMP	SWTHM1		/  NO: THEN RESTORE "MA" ORIGINAL STATE
	TAD I (MUBUF+MNMATH)	/  YES: THEN GET THE "MA" PRESENT SETTING
	DCA STORMA		/ SAVE IT FOR AFTER G-T-P OR GOLD-BOT DONE
	DCA I (MUBUF+MNMATH)	/ SHUT SWITCH TO DEACTIVATE MATH FOR NOW
	JMP SWTHM2		/ GO SET UP TO RETURN TO CALLER
SWTHM1,	TAD STORMA		/ GET BACK THE ORIGINAL "MA" SETTING
	DCA I (MUBUF+MNMATH)	/ RESTORE THE "MA" SWITCH SETTING
SWTHM2,	CDIEDT			/ CHANGE BACK TO EDITOR DATA FIELD
	JMP I	SWTHMA		/ RETURN TO CALLER

STORMA,	0			/ HOLDS ORIGINAL SETTING OF MA SWITCH

HDRPUT,	XX			/ JMS HDRPUT - HDROFST (AC=VALUE)
	CDFMYF
	MQL
	AC7776
	TAD I	HDRPUT
	ISZ	HDRPUT
	CIFFIO
	FILEIO
	XHDRPT
	JMP I	HDRPUT


/	SVSLCR	SAVE SELECT CURSOR POSITION				/A209
/									/A209
/	THIS ROUTINE IS USED FOR RECTANGULAR CUT AND PASTE TO GIVE 	/A209
/	ONE OF THE COLUMN DELIMITER BOUNDARIES				/A209
/									/A209
/	CALL:								/A209
/									/A209
/	JMS	SVSLCR							/A209
/	<RETURN>							/A209
/									/A209
/				N O T E ! ! !				/A209
/				-------------				/A209
/									/A209
/		THE LOCATION SLCRPT MUST REMAIN ON THE 			/A209
/		SAME PAGE AS THE SVSLCR CODE.  IF IT IS			/A209
/		MOVED TO A DIFFERENT PAGE (OTHER THAN ZERO)		/A209
/		THIS ROUTINE WILL NOT WORK!!!!				/A209
/									/A209
/									/A209
SVSLCR,	XX			/ENTRY POINT				/A209
	TAD	CURSOR		/GET CURRENT CURSOR POSITION		/A209
	DCA	SLCRPT		/SAVE SELECT CURSOR POSITION		/A209
	JMP I	SVSLCR		/RETURN					/A209
SLCRPT,	ZBLOCK	1		/SELECT CURSOR POSITION SAVE LOCATION	/A209

CTB009,	ECSLPT; SCRTM1		/ SELECT POINT
	ECPCT2; SCRTM2		/ END CONTROL
	ECPCT1; SCRTM4		/ START CONTROL
	0			/ INDICATE END OF TABLE


	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------
	PAGE

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED


IFDEF	CONDOR	< DM1ADJ=   0 >	/ SCREEN LINE ADJUSTMENT FOR DECMATE 2	/A226
IFNDEF	CONDOR	< DM1ADJ= -12 >	/ SCREEN LINE ADJUSTMENT FOR DECMATE 1	/A226

/ REPOSITION CURSOR BY SENDING ESCAPE SEQUENCE:
/	<ESC> [ CURLIN ; CURSOR H

PCUR,	XX
	DCA	CURPOS		/ SAVE THE AC

/ PUT OUT THE CONTROL STRING INTRODUCER.

	PUTESC			/ OUTPUT AN ESCAPE CHARACTER TO SCREEN
	"[-200			/ FOLLOWED BY THE "[" CHARACTER

/ PUT OUT THE FIRST DIGIT STRING.

	TAD	WIDNAR		/ GET THE WIDE-NARROW FLAG		/C226
	SNA CLA			/ IN SPLIT SCREEN MODE ?		/C226
	TAD	(DM1ADJ)	/ YES, MAKE SCREEN ADJUSTMENT FOR DMI	/C226
	TAD	CURLIN		/ NO, COMBINE WITH CURRENT LINE COUNT
	TAD	SCRNLN		/ ADD SIZE OF SCROLL AREA
	CIFMNU			/ INVOKE THE OUTDIG ROUTINE TO OUTPUT THE
	JMS	OUTDIG		/ LINE POSITION IN BASE 10 ARGUMENTS.

	TAD	(";-200)   	/ INSERT A SEMI-COLON BETWEEN ARGUMENTS
	PUTOUT

/ PUT OUT THE SECOND DIGIT STRING.

	TAD	CURPOS		/ GET THE CURSOR POSITION
	SPA			/ IF DESIRED POSITION IS LEFT OF SCREEN
	CLA			/ THEN DO COLUMN 1

/ FOR SOME REASON, THIS ARGUMENT IS ONE TOO SMALL.  HENCE,
/ IN VT-278 MODE WE INCREMENT BEFORE CALLING OUTDIG
	IAC			/ INCREMENT THE COLUMN NUMBER

	CIFMNU			/ INVOKE THE OUTDIG ROUTINE TO OUTPUT THE
	JMS	OUTDIG		/ COLUMN POSITION IN BASE 10 ARGUMENTS.

	TAD	("H-200)	/ PUT OUT THE ENDING H
	PUTOUT
	JMP I	PCUR		/ RETURN

/ TEST LIMITS FOR 132 COLUMN MODE OF VT100
TSTLIM,	XX
/D226	TAD	SPLTFL		/ IN SPLIT SCREEN MODE?
/D226	SNA CLA			/ SKIP IF YES.
/D226	 JMP	TSTLMB		/ JMP TO RETAIN/SET 80 COL MODE.
	TAD	WIDNAR		/ GET OFFSET FOR WIDE/NARROW (0 OR 52)	/A223
	TAD	(-WIDTH)	/ ADD NEGATIVE SCREEN WIDTH = -132 OR -80
	DCA	SCNSZ		/ STORE FOR SCREEN SIZE CHECK		/A223
	TAD	WIDNAR		/ GET OFFSET AGAIN (0 OR 52)		/A223
	SZA			/					/A223
	 TAD	(4)		/ FIX MARGIN TEST OFFSET (0 OR 56) 	/A223
	TAD  (-COLLIM-2+WIDTH)	/-242+132=-110 (+0 OR 56 = -110 OR -54)	/M223
	DCA	MARG		/ STORE AS MARGIN CHECKER		/A223
	TAD	CURSOR		/
	TAD 	MARG		/					/A223
	SPA SNA CLA		/ IS CURSOR IN LEFTMOST PART OF SCREEN?	
	 JMP	TSTLMA		/ JMP IF YES. SET LOWLIM.
TSTLMD,	TAD	CURSOR							/A223
	TAD 	SCNSZ							/A223
	SPA			/ IS CURSOR IN RIGHT PART OF SCREEN?	/M223
	 JMP	TSTLME		/ NO,					/M226
	TAD	LOWLIM		/ YES; WITHIN BOUNDS OF THIS SCREEN?	/A223
	SPA CLA								/A223
	 JMP	TSTLME		/ MAYBE					/A223
	TAD	MARG		/ NO, ADJUST LOW LIMIT BY SCREEN MARGIN	/A223
TSTLMF,	TAD	LOWLIM							/A223
	DCA	LOWLIM							/A223
	JMS	CLSSET		/ INITIALIZE SCROLL POINTERS FOR STATUS
	JMP	TSTLMD		/ RE-CHECK FOR NEXT SCREEN		/A223
TSTLME,	CLA								/A226
	TAD	CURSOR		/ DID WE BACKUP PAST LOW LIMIT OF SCREEN?/A223
	TAD	LOWLIM		/					/A223
	SMA CLA								/A223
	 JMP	TSTLMX		/ NO					/A223
	TAD	MARG		/ YES, ADJUST LOW LIMIT DOWN BY MARGIN	/A223
	CIA
	JMP	TSTLMF		/					/A223

TSTLMA,	TAD	LOWLIM		/ YES.					/A223
	SZA CLA			/ IS LOWLIM SET TO LEFT?		/A223
	JMS	CLSSET		/ NO, INIT SCROLL POINTERS FOR STATUS	/A223
TSTLMB,	DCA	LOWLIM		/ RESET LOWLIM FOR 80 COL RESET.
TSTLMX,	JMP I	TSTLIM

SCNSZ,	-COLM81			/ SCREEN SIZE (-132 OR -80), INIT:NARROW/A223

CENTER,	XX			/ CENTER LINE
	CIFMNU			/ CALL IN MENU FIELD			/M217
	JMP	EFCNTR							/M217
CNTREX,	JMP I	CENTER		/ RETURN				/M217

/KEEP NEXT TWO LINES TOGETHER!!!					/A223
MARG,				/ MARGIN CHECK SIZE FOR WIDE/NARROW	/A223
LNECHT,	XX			/ ECHO HYPHEN OR SELECT POINT
	TAD	(-ECHYLN)	/ compare with hyphen character
	SNA			/ Is it a hyphen?
	JMP	LNECH1		/ yes, so print hyphen character
	TAD	(ECHYLN-ECSLPT) / no, is it a select point?
	SZA CLA
	JMP I	LNECHT    	/ no, return to caller

/ Here if character is a select point
	JMS	PUTSPC    	/ yes, display select point in
	EXGSLC          	/ special graphics mode then return
	JMP I	LNECHT		/

/ Here if character is a hyphen
LNECH1,	TAD	CHRATR		/ GET ATTRIBUTE OF PREVIOUS CHAR TO
				/ APPEND W/HYPHEN
	TAD	(55)
	PUTOUT			/ DO HYPHEN
	JMP I	LNECHT

SCRLTX,	XX			/ REFRESH CURRENT CURSOR LINE
	TAD	(PTRBLK+NPTRS-1)
	DCA	SCRLT1
	TAD	CURPTR
	DCA	SCRLT2		/ SAVE CURPTR
	TAD	CURSOR
	DCA	SCRLT3		/ AND CURSOR
	DCA	CURPOS		/ RESET CHAR COUNTER TO START OF LINE.
	TAD I	SCRLT1		/ GET LINE PTR
	SNA
	JMP	SCRLTY		/ CHECK FOR STX MSG IF 0
	DCA	CURPTR
	JMS	PUTLIN
	TAD	SCRLT2
	DCA	CURPTR		/ RESTORE
	TAD	SCRLT3
	DCA	CURSOR
	JMP	SCRLTZ		/ AND RETURN
SCRLTY,	ISZ	SCRLT1
	TAD I	SCRLT1		/ TEST ONE AFTER THE NULL
	SZA CLA
	TAD	(STXMSG)
	JMS	PGMSG		/ OUTPUT --TOP-- OR BLANKS
SCRLTZ,	JMP I	SCRLTX		/ AND RETURN

SCRLT1,	0
SCRLT2,	0
SCRLT3,	0

EISUBS,	AC7776

EISUPS,	DCA	CASBIT
	OVLJMP;OVSUPS

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------
	PAGE

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED


EIDLTW,	AC0002			/ SET GRAMMATICAL UNIT FOR WORD DELETION
EIDLTC,				/ SET GRAMMATICAL UNIT FOR CHARACTER DELETION
DELUNT,	DCA	GRAMUN
	OVLJMP;OVDLTE		/ JUMP TO DELETE OVERLAY

CHKRPC,	XX			/ CHECK FOR	ECSTRL (START OF RULER),
				/		ECPCT1 (START CONTROL),
				/		ECPCT2 (END CONTROL)
				/ RTN 1 IF ECSTRL
				/ RTN 2, AC=0 IF REDUNDANT PCTL
				/ RTN 2, AC=INPUT IF OK
	MQL
	MQA

/D206	TAD	(-ECSTRL)
/D206	SZA
/D206	ISZ	CHKRPC		/ BUMP RTN ADDR IF NOT RLR START
/D206	TAD	(ECSTRL-ECPCT2)
/D206	SNA
/D206	JMP	CHKRP2		/ JUMP IF END PRINT CNTRL
/D206	TAD	(ECPCT2-ECPCT1)
/D206	SZA

	ZZCASE								/A206
	CTB015-1							/A206

/	ECSTRL;	CHKRP1		/ START RULER				/A206
/	ECPCT2;	CHKRP2		/ END CONTROL				/A206
/	ECPCT1;	CHKRP3		/ START CONTROL				/A206
/	0								/A206

	ISZ	CHKRPC							/A206
	JMP	CHKRP1		/ JUMP IF NOT PRINT CNTRL
CHKRP3,	AC0001			/ CHECK FOR REDUNDANT CONTROL		/M206
CHKRP2,	ISZ	CHKRPC		/ SET TO SKIP RETURN			/A206
	TAD	PCTLFL
	SZA			/ SKIP IF REDUNDANT
CHKRP1,	CLA MQA			/ ELSE RETURN INPUT
	JMP I	CHKRPC

CTB015,	ECSTRL;	CHKRP1		/ START RULER				/A206
	ECPCT2;	CHKRP2		/ END CONTROL				/A206
	ECPCT1;	CHKRP3		/ START CONTROL				/A206
	0								/A206

PTDASH,	XX			/ OUTPUT ARG2 A TOTAL OF ARG1 TIMES
	CDFMYF
	TAD I	PTDASH
	DCA	PTDSH1
PTDSHA,	TAD	("-&177)
	PUTOUT
	ISZ	PTDSH1
	JMP	PTDSHA
	ISZ	PTDASH
	JMP I	PTDASH
PTDSH1,	.-.

MNUGET,	XX			/ JMS MNUGET - MNOFST - RETURNS VALUE IN AC
	CDFMYF
	TAD I	MNUGET		/ GET OFFSET
	ISZ	MNUGET
	TAD	MNUCAL+1	/ ADD BASE
	DCA	T1
	CDFMNU
	TAD I	T1		/ GET VALUE
	CDFMYF
	JMP I	MNUGET		/ AND RETURN

MNUPUT,	XX			/ JMS MNUPUT - MNOFST
				/ EXPECTS VALUE IN AC
	DCA	T2		/ SAVE VALUE
	CDFMYF
	TAD I	MNUPUT		/ GET OFFSET
	ISZ	MNUPUT
	TAD	MNUCAL+1	/ ADD BASE
	DCA	T1
	CDFMNU
	TAD	T2
	DCA I	T1		/ STORE VALUE
	CDFMYF
	JMP I	MNUPUT		/ AND RETURN

SCRLPX,	XX			/ SET UP AUTO-INDEX REGISTERS FOR SCRLUP
	TAD	(PTRBLK)	/ GET POINTER TO POINTER BLOCK
	DCA	X0		/ STORE IN AUTO-INDEX REGISTER
	TAD	(PTRBLK-1)	/ GET POINTER TO POINTER BLOCK -1
	DCA	X1		/ STORE IN AUTO-INDEX REGISTER
	TAD	(-NPTRS+1)	/ PICK UP ONE LESS LINE COUNT
	DCA	X2		/ STORE VALUE IN COUNTER
	JMP I	SCRLPX		/ RETURN BACK TO SCRLUP	ROUTINE

/ THIS ROUTINE WILL BACK UP TO THE NEXT CHARACTER. IF THE CHARACTER IS
/ AN END DEAD KEY SEQUENCE CODE THEN IT WILL BACK UP UNTIL IF FINDS THE
/ START DEAD KEY SEQUENCE AND RETURN THAT CHARACTER.
/ IT TAKES A SKIP RETURN UNLESS IT FINDS THE START_OF_TEXT IN WHICH CASE
/ IT TAKES A REGULAR RETURN
/ DATA FIELD MUST BE SET TO BUFFER FIELD (CDFBUF)
ESBSPC,	XX			/ BACK UP CHARACTER (BKPSPC)
ESBSP3,	BKPPTR
	JMP I	ESBSPC		/ BACK UP TO FIRST NON_NULL CHARACTER
	TAD	(-ECNDOV)	/ IF CHAR = END_DEAD_KEY_SEQUENCE
	SZA CLA			/ THEN
	JMP	ESBSP2		/    REPEAT
ESBSP1,	BKPPTR
	JMP I	ESBSPC		/ BACK UP TO FIRST NON_NULL
	TAD 	(-ECSTOV)	/
	SZA CLA			/
	JMP	ESBSP1		/ UNTIL CHAR = START_DEAD_KEY_SEQUENCE
ESBSP2,	TAD I	CURPTR		/ GET CHAR AGAIN
	ISZ	ESBSPC		/ BUMP RETURN ADDRESS
	JMP I	ESBSPC		/ RETURN

/ THIS ROUTINE ADVANCES TO THE NEXT CHARACTER WHICH TAKES A SPACE ON THE SCREEN
/ THEREFOR IT WILL RETURN THE FIRST CHARACTER OF A DEAD KEY SEQUENCE BUT NOT
/ ANY CHARACTER FOLLOWING IN THAT SEQUENCE.
ESASPC,	XX			/ ADVANCE SPACE (ADVSPC)
	CLA			/ CLEAR AC
	CHKPTR			/ GET CURRENT CHARACTER
	SMA
	JMP	ESASP1		/ USE LODCHR ONLY IF MIGHT BE ETX
	ADVPTR			/ ETX IN BUFFER GET NEXT CHAR FROM FILE
	JMP I	ESASPC		/
ESASP1,	TAD	(-ECSTOV)	/ IF LAST CHARACTER RETURNED FROM THIS ROUTINE
				/   WAS START OF DEAD KEY SEQUENCE
	SZA CLA			/ THEN SKIP OVER ALL REMAIN CHARS IN SEQUENCE
	JMP	ESASP3		/
				/      REPEAT
ESASP2,	ADVPTR
	JMP I	ESASPC		/ GET PART OF COMPOSITE CHARACTER
	TAD	(-ECNDOV)	/
	SZA CLA			/
	JMP	ESASP2		/ UNTIL CHAR = END OF DEAD KEY SEQUENCE
				/ REPEAT
ESASP3,	ADVPTR
	JMP I	ESASPC		/ GET CHARACTER
	ISZ	ESASPC		/ BUMP RETURN ADDRESS
	JMP I	ESASPC		/ RETURN TO CALLER WITH CHAR IN AC

SCHMOD=	10			/ SEARCH MODE FLAG
SLTMOD=	20			/ SELECT MODE FLAG

EDTMOD,	SCHMOD!SLTMOD		/ CLEAR SEARCH AND SELECT MODE BITS
	0			/ DON'T SET ANY MODE BITS

SETCUR,	XX
	TAD	LOWLIM
	TAD	CURSOR
	JMS	PCUR
	JMP I	SETCUR

/ THE FOLLOWING IS USED BY V2 GOTO PAGE OVERLAYS...

CURPG1,	1			/ EDIT BUFFER PAGE # (UNITS,TENS,HUNDREDS)

/ THE FOLLOWING ROUTINE IS CALLED BY BOTH SCRLUP AND SCRLDN.  IT
/ COUNTS THE NUMBER OF LINES SCROLLED (CNSCRL) FOR THE PREV/NEXT
/ SCREEN ROUTINES (DOES NOT ADJUST PAST 0)
/ ENTER:  AC = SCROLL DIRECTION (+=UP, -=DOWN)
/
/ WHEN IT IS DONE COUNTING, THE ROUTINE GETS THE SCROLL DIRECTION
/ BACK AND CALLS ROUTINE SCRADJ  (NOTE THAT CALLS TO THIS ROUTINE
/ REPLACED CALLS TO ROUTINE SCRADJ IN THE TWO SCROLLING MODULES)

SCRAD0,	XX
	DCA	T1		/ SAVE THE SCROLL DIRECTION
	TAD	CNSCRL		/ GET THE COUNTER
	SZA			/ IF IT'S 0, KEEP IT THERE
	TAD	T1		/ INCREMENT OR DECREMENT
	DCA	CNSCRL		/ AND STORE IT BACK
	TAD	T1		/ GET SCROLL DIRECTION BACK
	JMS	SCRADJ		/ GO WHERE WE HEADED IN THE 1ST PLACE
	JMP I	SCRAD0		/ AND THEN BACK TO WHERE WE CAME FROM

CNSCRL,	.-.			/ THE COUNTER


/
/ GOTO-RULER VARIABLE
/
RRDIR,	.-.			/ DIRECTION WE ARE MOVING TO RULER:
				/ 1 = ADVANCING
				/ -1 = BACKING UP
				/ 0 = NOT DOING GOTO-RULER


EIGADV,	OVLJMP;OVGADV		/ GOLD ADVANCE

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------
	PAGE

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED


INSERT,	XX			/ INSERT (AC) IN BUFFER
	DCA	ESICH1		/ SAVE CHAR
	TAD	CURPTR
	DCA	ESICH2		/ AND CURPTR
	DCA	ESICH3		/ INIT CNTR
ESICHA,	CHKPTR			/ CHECK CURPTR
	SNA SPA CLA
	JMP	ESICHX		/ JUMP ON ETX OR NULL
	TAD	ESICH1
	MQL			/ GET INSERT
	TAD I	CURPTR		/ GET CURRENT CHAR
ESICHE,	SWP			/ SWAP THEM
	DCA I	CURPTR		/ STORE INSERT
	ISZ	ESICH3		/ BUMP CNTR
	ISZ	CURPTR		/ AND CURRENT PTR
	TAD I	CURPTR		/ GET NEXT CHAR
	SMA SZA
	JMP	ESICHE		/ LOOP IF NOT SPECIAL
	CLA MQA
	DCA	ESICH1		/ SAVE NEXT INSERT
	JMP	ESICHA		/ AND LOOP

ESICHX,	TAD I	CURPTR		/ NULL?
	SNA CLA
	JMP	ESICHB		/ JUMP IF SO
	CLA CLL
	TAD	(-400)
	TAD	ESICH3
	SZL CLA
	JMP	ESICHZ		/ JUMP IF NEAR STX
	TAD	ESICH1		/ GET INSERT
ESICHK,	DCA I	CURPTR		/ STORE OVER ETX
	AC0001
	CHKPTR			/ ADVANCE CURPTR
	SPA SNA CLA
	JMP	ESICHY		/ JUMP ON NULL OR ETX
	TAD I	CURPTR		/ ELSE OUTPUT IT
	PUTSTX
ESICHY,	TAD	(ECETX)
	JMP	ESICHC
ESICHZ,	TAD	(-100)
	DCA	ESICH3		/ SET LOOP COUNT
	TAD	CURPTR
	DCA	ESICH4		/ SAVE ETX CURPTR
	TAD	ESICH1		/ GET INSERT
ESICHF,	PUTETX			/ PUT IT OUT
	AC7777
	CHKPTR			/ BACKUP
	CLA
	TAD I	CURPTR		/ GET CAR TO CPY
	ISZ	ESICH3
	JMP	ESICHF		/ PUT IT OUT TIL COUNT DONE
ESICHG,	MQL			/ ELSE SAVE
	TAD	CURPTR
	DCA	ESICH1		/ WHILE WE SWAP CURPTRS
	TAD	ESICH4
	DCA	CURPTR
ESICHJ,	AC7777
	CHKPTR
	CLA MQA
	DCA I	CURPTR		/ THEN MOVE IT
	TAD	ESICH1
	CIA
	TAD	ESICH2		/ DONE WITH COPY?
	SNA CLA
	JMP	ESICHH		/ JUMP IF SO
	TAD	CURPTR
	DCA	ESICH4		/ ELSE SWAP CURPTRS AGAIN
	TAD	ESICH1
	DCA	CURPTR
	AC7777
	CHKPTR
	CLA
	TAD I	CURPTR		/ GET NEXT FOR COPY
	JMP	ESICHG		/ AND LOOP

ESICHH,	CLA MQL			/ SET ZERO FOR CLEAR LOOP
	TAD	CURPTR
	CIA
	TAD	ESICH2		/ MORE TO CLEAR?
	SZA CLA
	JMP	ESICHJ		/ JUMP IF SO
	ADVCHR
	CLA			/ ELSE FIX @CURPTR
	JMP	ESICHI		/ AND RETURN

ESICHB,	TAD	ESICH1		/ GET INSERT
ESICHC,	DCA I	CURPTR		/ STORE IT
ESICHD,	TAD	ESICH2
	DCA	CURPTR		/ RESTORE CURPTR
ESICHI,	JMP I	INSERT		/ AND RETURN

ESICH1,	0
ESICH2,	0
ESICH3,	0
ESICH4,	0

CLSCRN,	XX			/ CLEAR SCREEN
	CIFMNU			/ CHANGE TO MENU FIELD
	JMS I	(CALLN1)	/ GO PUT UP STATUS LINE DISPLAY
	JMS	CLSSET		/ INITIALIZE SCROLL VALUES
	JMP I	CLSCRN		/ RETURN TO CALLER

CLSSET,	XX			/ INITIALIZE SCROLL VALUES
	AC2000
	DCA	SCRNFL		/ SET SCREEN FLAG
	AC2000
	DCA	SCRLCT		/ AND BIG COUNT
	JMP I	CLSSET		/ RETURN TO CALLER

/ PUTSPC PSEUDO CODE
/
/	set terminal to special graphics mode
/	get character at call+1
/	display character
/	reset terminal to USASCII mode
/	return to caller

PUTSPC,	XX			/ OUTPUT ARG IN GRAPHIC MODE
	PUTESC
	"(+3600
	"0-200
	TAD I PUTSPC
	PUTOUT

	JMS	MNUGET		/ PICK UP CURRENT LANGUAGE WORD		/A224
	MNLANG			/ LOCATION FOR LANGUAGE WORD		/A224
	SMA			/ SKIP IF A NUMBER CODE			/A224
	IAC			/ CONVERT TO UPPER CASE ASCII		/A224
	BSW			/ PUT BITS INTO PROPER ORDER		/A224
	DCA	PUTLNG		/ STORE IN LINE FOR PUTESC ROUTINE	/A224

	PUTESC
	"(+3600
PUTLNG,	"0			/ OVERLAYED WITH LANGUAGE CODE VALUE	/A224


/D224	IFDEF 	ENGLSH	<
/D224	IFNDEF	ENGCAN	<
/D224	"B-200
/D224			>	/ END IFNDEF ENGCAN
/D224	IFDEF	ENGCAN	<
/D224	"3-200
/D224			>	/ END IFDEF ENGCAN
/D224			>	/ END IFDEF ENGLSH
/D224	IFDEF	CANADA	<
/D224	"3-200
/D224			>	/ END IFDEF CANADA
/D224	IFDEF	FRENCH	<
/D224	"R-200
/D224			>	/ END IFDEF FRENCH
/D224	IFDEF	DUTCH	<
/D224	"4-200
/D224			>	/ END IFDEF DUTCH

	ISZ	PUTSPC
	JMP I	PUTSPC

	IFDEF	FORIN	<
/ SUBROUTINE GETENT GETS THE ENTRY EN TABLE1 OR TABLE2 POINTED AT BY
/ POINT1 INTO THE AC
GETENT,	XX
	CDFPRT			/ CHANGE TO PRINTER FIELD
	TAD I	POINT1		/ GET TABLE ENTRY
	CDFMYF			/ RETURN TO THIS FIELD
	JMP I	GETENT		/ RETURN TO CALLER

			>	/ END IFDEF FORIN

EIDICT,	OVLJMP;OVABRV		/ ENTRY POINT FOR "GOLD-ABBRV"


	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------
	PAGE

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED


BKPUNT,	JMS	BACKUN		/ BACK UP A UNIT
	JMP	EIBAD		/ ERROR, CAN'T BACKUP PAST TOP OF FILE
	JMP	EINEXT		/ FIX UP SCREEN AND GET NEXT CHARACTER

BACKUN,	XX
	JMS	SAVLMD		/ SAVE MOD FLAGS
	AC7777
	CURMOV
	JMP	BKPUNV		/ ERROR IF AT STX
	ISZ	BACKUN
	JMS	SETBNT		/ SET BACKUP MODE
	TAD I	CURPTR		/ GET CHAR
	JMS	CHKUNT		/ CHECK FOR END OF UNIT
BKPUNZ,	.-.
	SZA
	JMP	BKPUNX		/ JUMP IF LAST
	AC7777
	CURMOV
	JMP	BKPUNV		/ BACKUP, JUMP IF AT STX
BKPUNW,	TAD I	CURPTR		/ RE-GET CHARACTER
	JMP I	BKPUNZ		/ AND LOOP

BKPUNX,	SPA CLA
BKPUNY,	JMP I	BACKUN		/ JUMP IF FINAL
	AC0001
	CURMOV
	JMP	BKPUNY		/ DO AN ADVANCE
	JMP	BKPUNW		/ AND LOOP

BKPUNV,	CURMOV
	NOP
	JMP	BKPUNY		/ FIX CURSOR AT STX, AND RETURN

ADVUNT,	JMS	LODCHR		/ ADVANCE UNIT
	JMP	EIBAD
	JMS	GETUNT		/ CHECK FOR END OF UNIT
ADVUNW,	.-.
	SZA CLA
	JMP I	ADVUNW
	JMP	EINEXT

SAVLMD,	XX			/ SAVE LINE MODIFIED
	TAD	LINMOD
	SNA
	JMP I	SAVLMD		/ JUST RETURN IF NO FLAG NEEDED
	JMS	INSERT		/ ELSE INSERT FLAG
	DCA	LINMOD		/ CLEAR LINE MODIFIED FLAG
	DCA	RLRMOD		/ CLEAR RULER MODIFIED FLAG
	DCA	REJFLG		/ CLEAR REJUSTIFIED FLAG
	JMP I	SAVLMD		/ RETURN

SETLMD,	XX			/ SET "LINE MODIFIED" FLAG
	CLA
	TAD	RLRMOD
	SNA
	TAD	(ECMDFL)	/ GET "LINE_MODIFIED_FLAG"
	DCA	LINMOD
	AC7777
	DCA	REJFLG		/ SET REJUSTIFY FLAG
	JMS	SCRNMD		/ SET SCREEN MODIFIED FLAG
	JMP I	SETLMD

SCRNMD,	XX			/ SET SCREEN MODIFIED FLAG
	TAD	SCRLCT
	CIA
	TAD	SCRLIN
	SNA
	JMP	SETLME
	SPA CLA
	JMP I	SCRNMD
	TAD	SCRLCT
	DCA	SCRLIN
	JMP	SETLMF
SETLME,	TAD	SCRLCU
	SNA
	JMP	SETLMF
	TAD	CURSOR
	SMA CLA
	JMP I	SCRNMD
SETLMF,	TAD	CURSOR
	CMA
	DCA	SCRLCU
	JMP I	SCRNMD


SCRADJ,	XX
	DCA	SCRLFL		/ SET SCROLL FLAG
	CDFMYF
	CIFSYS
	JSWAP			/ DON'T HOG CPU
	TAD	SCRNFL
	SZA CLA
	JMP I	SCRADJ		/ JUST RETURN IF SCREEN FLAG SET
	TAD	SCRLFL
	TAD	SCRLCT
	DCA	SCRLCT		/ ELSE ADJUST SCROLL COUNT
	AC2000
	TAD	SCRLCT
	SPA CLA
	AC2000
	DCA	SCRNFL  	/ SET SCREEN FLAG - IF TOO BIG
	JMP I	SCRADJ		/ AND RETURN


SCRNSZ,	XX			/ RETURN SCREEN SIZE
	TAD	SPLTFL		/ PICK UP THE SPLIT-FLAG
	SNA CLA			/ ARE WE IN WIDE SCREEN MODE (132 COL)
	TAD	SCRNLN		/ NO, USE VALUE OF FULL SCROLL REGION
	SNA			/ SKIP IF WE JUST GOT A VALUE
	TAD	WIDSIZ		/ YES, USE VALUE OF SMALLER AREA
	JMP I	SCRNSZ		/ RETURN TO CALLER
WIDSIZ,	10			/ M219 Default 132 col size is 8 lines.
SPLTFL,	0			/ 0 = 24 LINES OF SCREEN; -1 = 8 LINES.	/A226

SCECHO,	XX
	ISZ	CURSOR
	ADVSPC
	NOP
	CLA
	JMP I	SCECHO

CHKREJ,	XX			/ CALL REJUST IF IT'S TIME TO DO SO
	JMS	SCECHO		/ BUMP PTR AND CURSOR
	ISZ	REJCNT
	JMP I	CHKREJ
	JMS	REJUST
	JMP I	CHKREJ

REMCUR,	7777			/ "REMEMBERED" CURSOR POSITION FOR UP
				/ AND DOWN ARROW

EIGCUT,	OVLJMP;OVGCUT		/ CUT OVERLAY
EIPSTE,	OVLJMP;OVPSTE

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------
	PAGE

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED


REJUST,	XX			/ REJUSTIFY IF NECESSARY
	ISZ	REJFLG
	JMP	REJUSZ
	TAD	(ECCMRK)
	JMS	INSERT		/ MARK CURRENT POSITION
	JMS	JCLEAN		/ CLEAR OLD JUSTIFY CODES
REJUSX,	TAD	LINE23
	DCA	CURPTR		/ GET TO BEGINNING OF LINE
	DCA	CURSOR
	DCA	REJCP1		/ CLEAR POSITION FLAG
	JMS	JCLEAN		/ CLEAR OLD JUSTIF CODES
	JMS	CHKLMR		/ ADJUST LEFT MARGIN
	AC7777
	DCA	REJCP3		/ CLEAR TAB FLAG
	JMS	LODCHR
	JMP	REJUSK		/ CHECK NEXT CHAR
REJUSY,	TAD	(-ECCMRK)
	SNA CLA
	JMP	REJUSA		/ FOR MARKER
	TAD I	CURPTR
	AND	P177

	ZZCASE			/ COMPARE AGAINST RULER PAGE NWLN TAB
	CTB005-1		/ TABLE ADDRESS FOR CASE

/	ECSTRL; REJUSC		/ START OF RULER
/	ECNWPG; REJUSC		/ PAGE
/	ECNWLN; REJUSD		/ NEW LINE
/	ECTAB;  REJS99		/ TAB
/	0			/ INDICATE END OF TABLE

	JMP	REJUSQ
REJS99,	DCA	REJCP3		/ SET TAB FLAG
	JMS	TBJUST		/ JUSTIFY IT
REJUSQ,	TAD	CURSOR		/
	CIA
	TAD	RGTMAR
	SMA CLA
	JMP	REJUSF		/ JUMP IF OK
	TAD	REJCP1		/ GOT BACK TO MARKED POSITION YET?
	SZA CLA
	JMP	REJUSK		/ JUMP IF SO
REJUSF,	JMS	CHKMAR
	JMP	REJUSX		/ CHECK MARGIN, JUMP IF WRAPPED
	ISZ	CURSOR		/ NORMAL CHAR, BUMP PTRS
REJUSJ,	ADVSPC
	JMP	REJUSK
	JMP	REJUSY		/ AND LOOP FOR MORE CHECKING

REJUSA,	TAD	CURPTR
	DCA	REJCP1		/ SAVE MARKER POSITION
	TAD	CURSOR
	DCA	REJCP2
	JMP	REJUSJ

REJUSB,	TAD	REJCP1		/ END OF LINE,
	SNA CLA
	JMP	REJUSL		/ SCROLL, OR
REJUSK,	TAD	REJCP1
	DCA	CURPTR		/ QUIT
	TAD	REJCP2
	DCA	CURSOR
	CDFBUF
REJUSM,	DCA I	CURPTR		/ ERASE MARKER
	ADVCHR
	CLA			/ GET OFF NULL WE JUST CREATED
/D206		REJUSZ,	JMS	REJUX2		/ RESET FLAGS
REJUSZ,	DCA	REJFLG		/ CLEAR REJUST FLAG
	TAD	RGTMAR
	CIA
	TAD	CURSOR		/ RESET LIMIT COUNT
	TAD	(12)
	SMA
	CLA
	TAD	(-12)		/ (MIN OF 10.)
	DCA	REJCNT
	JMP I	REJUST		/ AND RETURN

REJUSC,	TAD	CURSOR
	SNA CLA
	JMP	REJUSE		/ JUST SCROLL UP IF AT LEFT EDGE OF SCREEN
	TAD	(ECWWLN)
	JMS	INSERT		/ ELSE INSERT WRAPPER
REJUSE,	TAD	REJCP1		/ PAGE OR RULER
	SZA CLA
	JMP	REJUSK		/ QUIT IF GOT TO MARKER ALREADY
REJUSL,	JMS	SCRLUP		/ START NEW LINE
 	JMP	REJUSX

REJUSD,	TAD I	CURPTR		/ NWLN, CHECK FOR CENTER
	TAD	(-ECENLN)
	SNA CLA			/ JUMP IF NOT.
	ISZ	REJCP3
	JMP	REJUSB		/ JUMP IF WE'VE HAD TABS
	JMS	CENTER		/ ELSE CENTER THE LINE
	TAD	LINE23
	DCA	CURPTR		/ THEN REFIND MARKER (IF PRESENT)
	DCA	CURSOR
	SLNMOD			/ SET LINE (SCREEN) MODIFIED FLAG.
	JMS	LODCHR
	NOP
REJUSN,	TAD	(-ECCMRK)
	SNA
	JMP	REJUSM		/ JUMP IF MARKER
	TAD	(ECCMRK-ECENLN)
	SNA CLA
	JMP	REJUSL		/ JUMP IF END OF LINE
	ISZ	CURSOR
	ADVSPC
	NOP
	JMP	REJUSN		/ LOOP TIL WE FIND ONE OF THEM

REJCP1,	.-.
REJCP2,	.-.
REJCP3,	.-.

EISLCT,	TSTSLT			/ SELECT
	JMP	ESLCT1		/ JUMP IF NOT SELECTED ALREADY

UNSLCT,	MODSET			/ UNSELECT
	EDTMOD			/ SET ADVANCE MODE
	JMP	SLXMOD

/ THE FOLLOWING IS USED BY V2 GOTO PAGE OVERLAYS...

CURPG2,	0			/ EDIT BUFFER PAGE # (THOUSANDS - MAX. 9)

EIFIND,	OVLJMP;XXFIND
EIRQSP,	OVLJMP;OVRQSP		/ GO INSERT "REQUIRED SPACE"

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

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED


CTB005,	ECSTRL; REJUSC		/ START OF RULER
	ECNWPG; REJUSC		/ PAGE
	ECNWLN; REJUSD		/ NEW LINE
	ECTAB;  REJS99		/ TAB
	0			/ INDICATE END OF TABLE

ESMVCR,	XX			/ MOVE CURSOR
				/ ENTER WITH OFFSET IN AC
	SPA
	JMP	ESMVCL		/ JUMP IF MOVE LEFT
	CMA
	DCA	ESMVC1		/ SAVE -COUNT-1
	JMP	ESMVCQ

ESMVCC,	JMS	LODCHR
	JMP	ESMVLZ
	AND	P177		/ STRIP MODE BITS

	ZZCASE			/ COMPARE AGAINST TABLE
	CTB008-1		/ TABLE ADDRESS FOR CASE

/	ECNWPG; ESMVCD		/ NEW PAGE
/	ECNWLN; ESMVCB		/ NEW LINE
/	ECMDFL; ESMVCG		/ LINE MODIFIED
/	ECSTRL; ESMVCZ		/ START RULER
/	0			/ INDICATE END OF TABLE

	JMP	ESMVCU		/ SKIP IF: SO
ESMVCZ,	TAD	CURSOR
	SZA CLA
	JMP	ESMVCE
	JMS	ADVRUL
	JMP	ESMVCA
	BKPPTR			/ CANCEL ADVPTR IN SCRLUP BELOW
	NOP
	SKP CLA			/ MERGE BELOW.
ESMVCK,	TAD	CURSOR		/ Are we at the beginning of the line?
	SNA CLA			/ Skip if no.
	JMP	ESMVCB		/ Yes! handle page character as line ender
	SLNMOD			/ Set line as modified (so REJUST runs)
	JMS	REJUST		/ put soft return infront of page marker
	TAD	RLRMOD		/ reset "line modified" flag for
	DCA	LINMOD		/ justification of line following NEW PAGE.
	JMS	SCRLUP		/ scroll line infrontof page marker up.
ESMVCB,	TAD	RLRMOD
	DCA	LINMOD		/ CLEAR MOD FLAG
ESMVCT,	JMS	SCRLUP
ESMVCQ,	JMS	REJUST
ESMVCA,	JMS	LODCHR
	JMP	ESMVX2
	JMP	ESMVX1

/ MAY HAVE TO MODIFY TO HANDLE REDUNDANT BEGIN MATH AREA OR END MATH AREA
ESMVCD,	TAD I	CURPTR		/ CHECK PRINT CONTROL
	JMS	SCRLTM		/ TEST TO SEE IF CHAR IS SPECIAL CODE
	NOP			/ CHAR WAS NORMAL
	JMP	ESMVCK		/ CHAR WAS SELECT MARKER
				/ CHAR WAS START OR END PRINT CONTROL
				/	+1 IF START, 0 IF END
	CIA			/
	TAD	PCTLFL		/	-1 IF START, 0 IF END
	SZA CLA
	JMP	ESMVCK
	DCA I	CURPTR		/ DELETE CONTROL IF REDUNDANT
	JMS	SCRNMD		/ AND SET SCREEN MOD FLAG
	JMP	ESMVCA

ESMVCE,	TAD	(ECWWLN)
	JMS	INSERT
	JMP	ESMVCT

ESMVCG,	JMS	CHKLMD
	NOP
	JMP	ESMVCQ

ESMVCU,	JMS	CHKMAR
	JMS	REJUST		/ CHECK MARGIN
ESMVCV,	ISZ	CURSOR
	ADVSPC
	JMP	ESMVX2
ESMVX1,	JMS	CHKCHR
	JMP	ESMVCC		/ DON'T LAND ON FUNNY CODE
ESMVX2,	ISZ	ESMVC1
	JMP	ESMVCC
ESMVLX,	ISZ	ESMVCR		/ BUMP FOR OK RETURN
ESMVLZ,	JMP I	ESMVCR		/ AND RETURN
ESMVC1,	0

CTB008,	ECNWPG; ESMVCD		/ NEW PAGE
	ECNWLN; ESMVCB		/ NEW LINE
	ECMDFL; ESMVCG		/ LINE MODIFIED
	ECSTRL; ESMVCZ		/ START RULER
	0			/ INDICATE END OF TABLE

CHKLMR,	XX			/ CHECK FOR LEFT MARGIN
	JMS	LODCHR
	JMP	LMRCH1
	TAD	(-ECCMRK)	/ SKIP JUSTIF MARKER
	SNA CLA
	JMP	LMRCH3
	TAD I	CURPTR
LMRCH4,	AND	P177
	TAD	(-ECSTRL)
	SZA			/ IF NOT AT RULER
	TAD	(ECSTRL-ECNWPG)	/ OR NEW PAGE
	SZA CLA
	JMP	LMRCH1		/ THEN CHECK INDENT
	TAD	LINE23
	DCA	CURPTR		/ ELSE RESTORE CURPTR
	JMP I	CHKLMR		/ AND RETURN

LMRCH1,	JMS	LINDNT		/ DO PROPER INDENT
LMRCH2,	JMP I	CHKLMR		/ RETURN

LMRCH3,	ADVPTR
	JMP	LMRCH1
	JMP	LMRCH4		/ GO BACK TO CHECK FOR PAGE/RULER

EIUDLT,	OVLJMP;OVUDLT		/ UNDELETE OVERLAY
EIHYPL,	OVLJMP;OVHYPL		/ HYPHEN PULL

/ TAKE 1ST RETURN IF SET, 2ND RETURN IF NOT SET
USHLTS,	XX
	CIFLP
	JMS I	(XHLTST)	/ DO HALT TEST IN LP FIELD

RPCUOF,	0			/ Rapid Paging CUrrent descriptor OFfset

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------
	PAGE

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED


/ MOVE CURSOR ROUTINE JUMPS HERE IF MOVING LEFT
ESMVCL,	DCA	ESMVC2		/ ESMVC2 = -NUMBER OF LOCATIONS TO MOVE
ESMVLA,				/ REPEAT
	BKPSPC
	JMP	ESMVLZ		/    GET NEXT CHAR TO LEFT
	AND	P177		/    STRIP MODE BITS
	TAD	(-ECNWPG)
	SZA			/    IF CHAR = NEW_PAGE
	TAD	(ECNWPG-ECNWLN)
	SZA			/	   OR NEW_LINE
	TAD	(ECNWLN-ECNDRL)
	SNA			/	   OR END_RULER
	JMP	ESMVLR		/    THEN SCROLL SCREEN DOWN
ESMVLB,	AC7777			/    ELSE
	TAD	CURSOR		/
	DCA	CURSOR		/       CURSOR := CURSOR - 1
ESMVLC,	TAD I	CURPTR		/    GET CHAR AGAIN
	JMS	CHKCHR
	JMP	ESMVLA		/    IF NOT A SPECIAL CHARACTER
	ISZ	ESMVC2
	JMP	ESMVLA		/    THEN INCREMENT ESMVC2
	JMP	ESMVLX		/ UNTIL  ESMVC2=0
ESMVLR,	JMS	SCRLDN
	JMP	ESMVLC
ESMVC2,	0			/ NUMBER OF CURSOR POSITIONS TO MOVE BACK


/ PSUEDO_CODE FOR SCRLUM
/
/  CASE AC =:
/	START_PRINT_CONTROL:	PCTLFL=-1
/	END_PRINT_CONTROL:	PCTLFL=0
/	SELECT_POINT:		SLCTDR=0
/  AC=0
SCRLUM,	XX			/ CHANGE MODES FOR SCROLL UP
			/*** SCRLUM IS USED AS A VARIABLE (PUTSC6)
			/*** BY PUTSCH BELOW TO SAVE A WORD
	JMS	SCRLTM		/ TEST FOR MODE CHANGE
	JMP I	SCRLUM		/ RETURN IF NONE
	JMP	SCRLU1		/ JUMP IF SELECT POINT
	DCA	PCTLFL		/ HERE IF PRINT CONTROL
	JMP I	SCRLUM		/ RETURN
SCRLU1,	DCA	SLCTDR		/ HERE IF SELECT POINT
	JMS	SVSLCR		/ SAVE CURSOR POSITION			/A209
	JMP I	SCRLUM		/ RETURN

/ PSUEDO_CODE FOR SCRLTM
/
/ CASE AC =:
/	SELECT POINT:		AC=0	INCREMENT RETURN ADDRESS BY 1
/	START_PRINT_CONTROL:	AC=-1   INCREMENT RETURN ADDRESS BY 2
/	END_PRINT_CONTROL:	AC=0 	INCREMENT RETURN ADDRESS BY 2
/	OTHERS:			AC=0
/
SCRLTM,	XX			/ TEST FOR MODE CHANGE CHARACTER

	ZZCASE			/ COMPARE AGAINST SELECT AND CONTROL
	CTB009-1		/ TABLE ADDRESS FOR CASE

/	ECSLPT; SCRTM1		/ SELECT POINT
/	ECPCT2; SCRTM2		/ END CONTROL
/	ECPCT1; SCRTM4		/ START CONTROL
/	0			/ INDICATE END OF TABLE

	JMP	SCRTM3		/ TAKE NORMAL RTN IF NONE OF ABOVE
SCRTM4,	AC7777			/ TAKE 2ND SKIP RTN IF STRT PRINT CONTROL
SCRTM2,	ISZ	SCRLTM
SCRTM1,	ISZ	SCRLTM
SCRTM3,	JMP I	SCRLTM

CLMPLL,	ZBLOCK	1		/ COLUMN MANIPULATION LOWER LIMIT	/A209
CLMPUL,	ZBLOCK	1		/   "          "      UPPER   "		/A209
PSBFOF,	ZBLOCK	1		/ COLUMN MANIP. PASTE BUF. OVFLOW FLAG	/A209
CLCTSW,	ZBLOCK	1		/   "      "    CUT/GOLD CUT SWITCH	/A209

/
/ THE FOLLOWING IS USED BY V2 GOTO PAGE OVERLAYS ...
/
/D223 RPBKID,	0			/ RAPID PAGINATION BLOCK ID #


/
/
/ SUBR PUTSCH -- PUT CHARACTER TO SCREEN
/
/ CHARACTER PASSED TO PUTSCH IN AC
/
/ PSUEDO-CODE FOR PUTSCH:
/
/	SAVE CHAR. IN TEMP. LOCATION;
/	GET CHAR. BACK;
/
/	( CHECK SCREEN LIMITS )
/	IF WIDE SCREEN MODE THEN
/	    IF CURPOS < LEFT MARGIN OR CURPOS > RIGHT MARGIN THEN
/	        EXIT;  ( DON'T DISPLAY "CLIPPED" CHAR )
/
/	( CHECK FOR OVERSTRIKE SEQUENCE )
/	IF CHAR = "START OVERSTRIKE SEQUENCE" THEN
/	    ( CHECK FOR "REQUIRED SPACE" )
/	    GET NEXT CHAR;
/	    BACKUP CURPTR TO "START OVERSTRIKE SEQ" SO CURMOV WILL
/		SKIP REST OF SEQUENCE;
/	    IF NEXT CHAR = SPACE THEN
/		( "OVERSTRIKE SEQUENCE" IS REALLY A "REQUIRED SPACE" )
/		DISPLAY A SPACE WITH PROPER ATTRIBUTES;
/	    ELSE
/		( THIS IS A REAL "OVERSTRIKE SEQUENCE", NOT A "REQ. SPACE" )
/		DISPLAY A GRAPHICS BLOTCH TO STAND FOR THE OVERSTRIKE SEQ.;
/	ELSE  ( NOT OVERSTRIKE )
/	    RESTORE CHAR.;
/	    PUTOUT TO DISPLAY;
/
/	EXIT.  ( RETURN TO CALLER HAVING DISPLAYED CHAR )
/
/
PUTSCH,	XX			/ OUTPUT CHAR
	DCA	PUTSC6		/ SAVE CHARACTER TO RESTORE LATER

/D226	TAD	SPLTFL		/ SPLIT (WIDE) SCREEN MODE?
/D226	SNA CLA
/D226	JMP	PUTPA1		/ NO, JUST DO IT NORMAL

	TAD	CURPOS		/ GET CURRENT CURSOR POSITION
	TAD	LOWLIM		/ COMBINE WITH LOW LIMIT OF SCREEN DISPLAY
	SMA			/ ARE WE BEFORE CURRENT LOW LIMIT	/C237
	JMP	PUTPA1		/ NO, GO CHECK IF WE ARE ABOVE IT	/C237
	CLA CLL			/ YES, CLEAR TRASH FROM THE ACCUMULATOR	/A237
	TAD	PUTSC6		/ GET CURRENT CHARACTER			/A237
	AND	(1600)		/ MASK OFF THE ATTRIBUTE BITS		/A237
	JMP	PUTSC4		/ GO OUTPUT THE CHARACTER ATTRIBUTES	/A237

PUTPA1,	CDFMYF			/ RESET BACK TO THIS FIELD		/C237
	TAD	SCNSZ		/ COMBINE RESULT WITH SCREEN SIZE	/M223
/D237	CDFBUF								/A223
	SMA CLA			/ ARE WE PAST LAST COLUMN ?
	JMP	PUTPA2		/ YES, IGNORE THE CHARACTER

	TAD	PUTSC6		/ GET CHAR BACK				/C237
/D237	SNA			/ SKIP IF CHAR.
/D237	JMP	PUTSC0		/ IGNORE NULLS.
	AND	P177		/ MASK OFF ATTRIBUTES
	TAD	(-ECSTOV)	/ SPECIAL PROCESSING FOR OVERSTRIKE

	IFDEF	FORIN	<
	SNA CLA
	JMP	DEAD		/ FOUND FOREIGN OVERSTRIKE
			>	/ END IFDEF FORIN

	IFNDEF	FORIN	<
	SZA CLA			/ AT OVERSTRIKE SEQUENCE? (DEAD KEY)
	JMP	PUTSC8		/ NO: GO OUTPUT CHARACTER (PUTSC6)
	CDIMNU			/ YES: CHANGE TO MENU FIELD		/A211
	JMS I	(TCCHK)		/ GO CHECK FOR DEAD KEY TYPE		/A211
	 JMP	PUTSC2		/ NORMAL DEAD KEY			/A211
	 JMP	PUTSC8		/ REQUIRED SPACE			/A211
	 JMP	PUTPA2		/ TECHNICAL CHARACTER			/A211

/D211	ADVPTR			/ YES: CHECK FOR "REQUIRED SPACE"
/D211	NOP			/   BAD EDIT BUFFER CONTENTS
/D211	DCA	PUTSC6		/ SAVE POSSIBLE ECSPC WITH ATTRIBUTES
/D211	BKPPTR			/ RESTORE CURPTR TO ECSTOV
/D211	NOP			/   BUG-SHOULD NEVER HAPPEN
/D211	CLA
/D211	TAD	PUTSC6		/ GET 2ND CHAR IN OVERSTRIKE SEQUENCE
/D211	AND	P177		/   (IGNORE ATTRIBUTES)
/D211	TAD	(-ECSPC)	/ IS IT A SPACE?
/D211	SZA CLA
/D211	JMP	PUTSC2		/ NO-NOT A "REQUIRED SPACE": OUTPUT BLOB
			>	/ END IFNDEF FORIN

PUTSC8,	TAD	PUTSC6		/ RESTORE CHAR
PUTSC4,	PUTOUT			/ DISPLAY CHAR ON SCREEN
	JMP	PUTPA2		/ CONTINUE BELOW			/A211

PUTSC2,	JMS PUTSPC
	EXGOVS			/ SPECIAL CODE FOR OVERSTRIKE
/D211	JMP I	PUTSCH

PUTPA2,	CLL CLA
PUTSC0,	CDFMYF
	ISZ	CURPOS
	JMP I	PUTSCH

PUTSC6=	SCRLUM			/ TEMP. CHAR STORAGE FOR PUTSCH
				/ ALSO USED BY OVVWB1 (GOLD:VIEW)
	X=.&7600		/ X=FIRST LOC OF CURRENT PAGE
PUTAER,	IFNZRO SCRLUM&7600-X < ? > / ERROR: PUTSC6 NOT ON CURRENT PAGE


SCRFSH,	XX			/ REFRESH NON-SCROLLED LINES
	TAD	SCRLCU		/ DOES SCREEN NEED MODIFICATION?
	SNA CLA			/ SKIP IF: SO
	JMP I	SCRFSH		/ RETURN
SCRFS1,	TAD	SCRLIN		/ GET EARLIEST LINE NEEDING MODIFICATION
	SMA SZA CLA
	JMP I	SCRFSH
	TAD	SCRLCU		/ Get posn in last line to get refreshed.
	SZA
	CMA			/ If 0 the start-of-line. If < 0 then
	DCA	CURSOR		/  posn is CMA of SCRLCU. refresh from there
	JMS	SCRNSZ		/ GET SCREEN SIZE
	TAD	SCRLIN		/ ADD EARLIEST LINE NEEDING MODIFICATION
	SPA SNA CLA
	JMP	SCRFS2
	TAD	SCRLIN		/ GET EARLIEST LINE NEEDING MODIFICATION
	DCA	CURLIN		/ SET CURRENT LINE
	JMS	SETCUR		/ posn cursor baised by LOWLIM.
	TAD	SCRLCT		/ GET SCREEN LAG
	SPA
	CLA			/ If reverse scroll, then bais to bottom
				/  of screen.
	CIA			/ NEGATE IT
	TAD	SCRLIN		/ ADD EARLIEST LINE NEEDING MODIFICATION
	JMS	SCRLTX

SCRFS2,	ISZ	SCRLIN
	NOP
	DCA	SCRLCU		/ Reset posn within next line to start at.
	DCA	CURSOR		/  (incase SCRLIN now = 1).
	JMP	SCRFS1

EIDEAD,	OVLJMP;OVDEAD		/ GOLD DEAD
EIGBKP,	OVLJMP;OVGBKP		/ GOLD BACKUP
EITC,	OVLJMP ;OVTCHR		/ TECHNICAL CHARACTER			/M234

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------
	PAGE

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED


SCRLDN,	XX			/ SCROLL DOWN

	CDFMYF			/ RESET DATA FIELD TO THIS FIELD
	CIFMNU			/ SET INSTRUCTION FIELD TO MENU FIELD
	JMS	CALLN3		/ HANDLE SCROLL DOWN FOR STATUS LINE

	AC7777
	JMS	SCRAD0		/ ADJUST SCROLL

	TAD	FORMNO		/ IF NOT IN LIST PROCESSING
	SZA CLA			/
	JMP	SCRLD1		/
	CDILP			/ THEN GO FIDDLE WITH THE MATH FLAGS
	JMS	SCRMTH		/

SCRLD1,	TAD	LINE23
	DCA	CURPTR
	JMS	SAVLMD
	CDFMYF
	JMS	SCRNSZ		/ GET SCREEN SIZE (IN LINES)
	CIA
	DCA	X0		/ STORE AS COUNT TO DO
	TAD	X0
	TAD	(PTRBLK-1+NPTRS)
	DCA	T1		/ STORE FIRST PTR-1
	AC0002			/ SET UP FOR AN INCREMENT OF TWO
	TAD	T1		/ COMBINE WITH VALUE OF PTR-1
	DCA	SCRLDF		/ SAVE PTR TO OLD TOP PTR

	MQL			/ FOR MOVING PTRS
SCRLDA,	ISZ	T1
	TAD I	T1		/ SWAP A PAIR
	SWP
	DCA I	T1
	ISZ	X0
	JMP	SCRLDA		/ AND LOOP TIL ALL DONE
	TAD I	T1
	DCA	LINE23

	TAD I	SCRLDF		/ GET OLD TOP PTR
	SZA			/ SKIP W/O A POINTER
	JMP	.+3		/ JUMP WITH A POINTER
	ISZ	SCRLDF		/ ADVANCE TO NEXT ENTRY
	JMP	.-4		/ REPEAT UNTIL POINTER

	DCA	CURPTR		/ ELSE START BACK SEARCH FROM THERE
	BKPSPC
	JMP	SCRLDG		/ JUMP IF NO MORE
	AND	P177
	TAD	(-ECNWPG)
	SNA CLA
	JMP	SCRLDE

SCRLDB,	BKPSPC
	JMP	SCRLDE		/ JUMP IF STX
	AND	P177

	ZZCASE			/ COMPARE AGAINST TABLE
	CTB010-1		/ TABLE ADDRESS FOR CASE

/	ECNWLN; SCRLDC		/ NEW LINE
/	ECNWPG; SCRLDC		/ NEW PAGE
/	ECSTRL; SCRLDE		/ START RULER
/	ECNDRL; SCRLDC		/ END RULER
/	0			/ INDICATE END OF TABLE

	JMP	SCRLDB		/ LOOP IF NOT

SCRLDC,	ADVPTR
	JMP	EIBAD
	CLA
SCRLDE,	CDFMYF
	AC7777
	TAD	SCRLDF
	DCA	SCRLDF		/ SET TOP PTR PTR
	TAD	CURPTR
	DCA I	SCRLDF		/ SET NEW TOP
SCRLDG,	TAD	LINE23
	DCA	CURPTR
	DCA	CURSOR
	CDFBUF
	TAD I	CURPTR		/ GET_CHAR
SCRLDD,	AND	P177		/ LOOP, STRIP MODE BITS

	ZZCASE			/ COMPARE AGAINST TABLE
	CTB011-1		/ TABLE ADDRESS FOR CASE

/	ECNWLN; SCRLDL		/ NEW LINE
/	ECNWPG; SCRLDL		/ NEW PAGE
/	ECSTRL; SCRLDS		/ START RULER
/	0			/ INDICATE END OF TABLE

	ISZ	CURSOR		/     THEN INCREMENT CURSOR
	ADVSPC
	JMP	EIBAD		/     ADVANCE TO NEXT CHARACTER
	JMP	SCRLDD		/ END_LOOP

/ CASE CURRENT_CHARACTER =:
/	SELECT_POINT:		SLCTDR=1
/	START_PRINT_CONTROL:	PCTLFL=0
/	END_PRINT_CONTROL:	PCTLFL=-1

SCRLDL,	TAD I	CURPTR		/ GET CURRENT CHARACTER
	JMS	SCRLTM		/ CHECK AC FOR SPECTIAL CHARACTER
		JMP	SCRLDX	/   NO SPECIAL CHARACTER
		JMP	SCRLDP	/   AC WAS A SELECT POINT
		CMA		/   AC WAS START_CONTROL OR END_CONTROL
				/     -1 = END_CONTROL:   0 = START_CONTROL
	DCA	PCTLFL		/      0 = END_CONTROL:	 -1 = START_CONTROL
	JMP	SCRLDX

SCRLDS,	TAD	CURSOR
	SZA CLA
	JMP	SCRLDX		/ IF THIS IS RULER LINE,
	JMS	SETRUL
	ESADRL			/ RESET TO OLD RULER
	JMS	COPRUL
	CDFBUF
	TAD	LINE23
	DCA	CURPTR		/ RESET CURPTR
	JMP	SCRLDX

SCRLDP,	AC0001			/ CURRENT CHAR WAS SELECT POINT SO SET FLAG
	DCA	SLCTDR		/ INDICATING SELECT POINT IS BELOW US
SCRLDX,	JMP I	SCRLDN		/ RETURN TO CALLER

SCRLDF,	.-.

CTB010,	ECNWLN; SCRLDC		/ NEW LINE
	ECNWPG; SCRLDC		/ NEW PAGE
	ECSTRL; SCRLDE		/ START RULER
	ECNDRL; SCRLDC		/ END RULER
	0			/ INDICATE END OF TABLE

CTB011,	ECNWLN; SCRLDL		/ NEW LINE
	ECNWPG; SCRLDL		/ NEW PAGE
	ECSTRL; SCRLDS		/ START RULER
	0			/ INDICATE END OF TABLE

SETSPT,	XX		/ SET SCREEN-NEEDS-TO-BE-SPLIT FLAG
/D226	TAD	SPLTFL
/D226	SNA
	AC7777
	DCA	SPLTFL
	JMP I	SETSPT

EISCUT,	OVLJMP;OVSCUT		/ ENTRY POINT FOR STRAIGHT CUT

RPMTBK,	0			/ Rapid Paging MaTh BlocK begin offset	/M226


	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------
	PAGE

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED


FXSCRL,	XX			/ UNDO SCREEN LAG
	CDFMYF
	TAD	CURSOR		/ SAVE CURSOR POSN 'TILL LATER.
	DCA	FXSCT1		/  ...
	DCA	CURSOR		/  REINIT TO START OF LINE.
	TAD	WIDEFL		/ TEST NEED TO GO WIDE FLAG		/M226
	SMA CLA
	JMP	FXSCRF		/ JUMP IF NOT SET
	DCA	WIDEFL		/ RESET IT TO NOT NEEDED		/M226
	JMS	SET132		/ MAKE SCREEN WIDER
	TAD	FORMNO
	SNA CLA			/ CAN'T DO WHOLE SCREEN IF MERGING!!
	JMP	FXSCRE		/ AND REFRESH WHOLE SCREEN

FXSCRF,	TAD	SCRNFL
	SZA CLA
	JMP	FXSCRE		/ JUMP IF WHOLE SCREEN NEEDED
	TAD	SCRLCT		/ TEST LAG
	SNA
	JMP	FXSCRK		/ JUST SET CURSOR IF NO LAG
	SPA
	JMP	FXSCRD		/ JUMP IF SCROLL DOWN NEEDED
	CIA
	JMS	FXSCRA		/ TEST FOR TOO MUCH
	JMS	SCRFSH

FXSCRI,	JMS	NWLN
FXSCRJ,	AC0001
	TAD	FXSCT2
	JMS	SCRLTX		/ DO ONE LINE
	ISZ	FXSCT2
	JMP	FXSCRB		/ LOOP FOR ALL
FXSCRC,	DCA	CURLIN
	TAD	FXSCT1		/ Restore cursor posn.
	DCA	CURSOR		/  ...
	TAD	SCRLCT		/ forward scroll?
	SPA CLA			/ skip if yes.
	JMP	FXSCX1		/ If no then do DCA to current posn.
	TAD	CURPOS		/ Get current cursor posn on the screen.
	CIA			/ Compare to
	TAD	CURSOR		/            where we want to be.
	SNA CLA			/ Skip if not there.
	JMP	FXSCX2		/ Already there so ignore.
	TAD	CURSOR		/ Are we aiming for col 1?
	SZA CLA			/ skip if yes.
	JMP	FXSCX1		/ JMP if no to do DCA to correct posn.
	TAD	(CR)		/ to <CR> to get to col 1 of this line.
	PUTOUT			/  ...
	DCA	CURPOS		/ reset cursor posn.
	JMP	FXSCX2		/ merge below to clean up & exit.

FXSCX1,	JMS	SETCUR		/ posn cursor to desired colm.
FXSCX2,	DCA	SCRLCT		/ RESET LAG
	DCA	SCRNFL		/ AND SCREEN FLAG
	DCA	SCRLCU		/ AND REFRESH FLAGS
	DCA	SCRLIN
	JMP I	FXSCRL		/ AND THEN RETURN

FXSCRD,	JMS	FXSCRA		/ CHECK FOR TOO MUCH
	JMS	SCRNSZ		/ SET TO TOP
	CIA
	IAC
	DCA	CURLIN

FXSCRH,	PUTESC
	"[&177+4000
	"H&177			/ Cursor home.
	PUTESC
	"M&177			/ SCROLL DOWN
	TAD	SPLTFL		/ wide screen mode?
	SZA CLA			/ Skip if no. we's already at line.
	JMS	PCUR		/ Reposn to start of current line.
	TAD	FXSCT2
	CMA
	TAD	CURLIN
	JMS	SCRLTX		/ DO ONE LINE
	ISZ	FXSCT2
	JMP	FXSCRH		/ LOOP FOR ALL
	TAD	SCRLCT		/ FIX REFRESH FLAG
	CIA
	TAD	SCRLIN
	DCA	SCRLIN
FXSCRK,	JMS	SCRFSH		/ FIX UP LINES NOT SCROLLED
	JMP	FXSCRC		/ AND FIX CURSOR AND RETURN

FXSCRA,	XX
	DCA	FXSCT2		/ SAVE COUNT
	JMS	SCRNSZ		/ GET SCREEN SIZE
	TAD	FXSCT2		/ -COUNT
	SPA CLA
	JMP	FXSCRE		/ JUMP IF TOO MUCH
	TAD	SCRLCU
	SNA CLA
	JMP I	FXSCRA
	JMS	SCRNSZ
	TAD	SCRLIN
	SMA CLA
	JMP I	FXSCRA		/ RETURN IF OK
FXSCRE,	JMS	CLSCRN		/ FOR WHOLE SCREEN, CLEAR IT
	JMS	SCRNSZ		/ SET FULL COUNT
	CIA
	DCA	FXSCT2
	DCA	SCRLCT		/ USE REAL SCREEN POSITION
FXSCRB,	TAD	SCRLCT
	SZA CLA
	JMP	FXSCRI		/ IF REALLY SCROLLING, USE BOTTOM LINE
	AC0001
	TAD	FXSCT2		/ ELSE USE REAL LINE
	DCA	CURLIN		/ Set line # to refresh.
	JMS	PCUR		/ Posn to physical start of line.
	JMP	FXSCRJ

FXSCT1,	0
FXSCT2,	0

CHKALP,	XX			/ SET MQ AND CHECK FOR OVER 40
	MQL
	MQA
	AND	P177
	TAD	(-40)
	SMA SZA
	ISZ	CHKALP		/ SKIP RETURN IF OK
	CLA MQA			/ RESTORE CODE
	JMP I	CHKALP		/ AND RETURN TO CALLER

WIDEFL,	0			/ FLAG TO KNOW WHEN TO GO TO WIDE SCREEN MODE
				/ -1=NEED TO GO 132 COL., 0=NOT NEEDED	/A226

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------
	PAGE

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED


SCRLUP,	XX			/ SCROLL UP
	CDILP			/ CHANGE CONTROL TO LP FIELD TO CHK ON MATH
	JMS	CKCTRL		/ GO PROCESS LATEST LINE SCROLLED UP

	TAD	SCRLCT
  	SMA CLA			/ IF SCROLLING UP (NOT DOWN)
	TAD	ECHFLG		/ THEN
	SZA CLA			/  IF ECHOING
	JMS	FXSCRL		/  THEN UPDATE SCREEN

SCRLP1,	AC0001
	JMS	SCRAD0		/ INCREMENT SCROLL COUNT

	ADVPTR			/ ADVANCE
	NOP			/  RETURNS HERE IF END OF TEXT FOUND
	CLA			/  NORMALLY RETURNS HERE WITH CHAR IN AC

	CDFMYF			/ CHANGE DATA FIELD BACK TO THIS FIELD
	JMS	SCRLPX		/ GO SET UP AUTO-INDEX REGISTERS

	TAD I	X0
	DCA I	X1
	ISZ	X2
	JMP	.-3
	TAD	CURPTR
	DCA	LINE23
	TAD	LINE23
	DCA I	X1
	BKPPTR
	JMP	SCRLUB		/ BACK UP OVER NEWLINE
	JMS	SCRLUM		/ DO MODE CHANGE, IF NEC.
SCRLUB,	TAD	LINE23
	DCA	CURPTR		/ RESTORE CURPTR
/D203;	TAD	CURSOR		/ SAVE THE CURSOR POS FOR LATER
/D203;	DCA	CURTMP		/ SELECT MIGHT WANT IT!
	DCA	CURSOR
	TAD	LINMOD
	SZA CLA
	SLNMOD			/ RESET MOD FLAG, IF NECESSARY

	CDFMYF			/ RESET DATA FIELD TO THIS FIELD
	CIFMNU			/ SET INSTRUCTION FIELD TO MENU FIELD
	JMS	CALLN4		/ HANDLE SCROLL UP FOR STATUS LINE
	CDFBUF			/ RESET TO BUFFER FIELD

	JMP I	SCRLUP		/ AND THEN RETURN TO CALLER


/ THIS ROUTINE GETS RID OF ALL JUSTIFYING CHARACTERS (JUSTIFIED SPACES WORD
/ WRAPS ETC.) UP TO THE RIGHT MARGIN OR THE FIRST LINE_ENDING CHARACTER,
/ WHICHEVER COMES FIRST (I THINK THATS WHAT IT DOES ANYWAY)
JCLEAN,	XX
	TAD	CURPTR
	DCA	JCLEAY		/ SAVE CURPTR
	TAD	RGTMAR		/ GET THE COLUMN # OF THE RIGHT MARGIN
	TAD	(-COLM80)						/ M219
	SMA CLA			/ IF RIGHT_MARGIN GREATER THAN 79
	TAD	(-COLLIM+COLM81)	/ THEN JCLEAX= -238		/M219
	TAD	(-COLM81)	/ ELSE JCLEAX= -80			/M219
	DCA	JCLEAX		/  (* STORE TO USE AS LOOP COUNTER *)
JCLEA6,	JMS	LODCHR		/ GET CHARACTER
	JMP	JCLEA2		/  RETURNS HERE IF END_OF_TEXT (ETX) FOUND
	JMP	.+3
JCLEA1,	ADVSPC
		JMP	JCLEA2	/ RETURNS HERE IN END_OF_TEXT
	AND	P177		/ ELIMINATE IMPOSSIBLES, FOR SPEED
	TAD	(-40)
	SMA SZA CLA		/ IF CHARACTER IS PRINTABLE
	JMP	JCLEA4		/ THEN GO INCREMENT LOOP COUNTER
	TAD I	CURPTR
	JMS	ESJTST
	SZA
	TAD	JCLGCT		/ CHECK FOR PAGE MARKER IF NOT
				/ GOLD CUTTING
	SNA CLA
	JMP	JCLEA3		/  JUMP IF GOT A JUSTIFYING CODE
	TAD I	CURPTR		/ ELSE CHECK FOR LINE ENDING CHARACTER
	AND	P177
	TAD	(-ECNWLN)
	SZA
	TAD	(ECNWLN-ECNWPG)
	SZA
	TAD	(ECNWPG-ECSTRL)
	SNA
	JMP	JCLEA2		/ JUMP IF A LINE ENDING CHARACTERONE
	SPA CLA
	JMS	CHKLMD		/HECK FOR RULER OR LINE MODIFIED CHAR
	SKP			/  RETURNS HERE IF NONE FOUND
	JMP	JCLEA6		/  RETURNS HERE OF ONE FOUND
JCLEA4,	ISZ	JCLEAX		/ INCREMENT LOOP COUNTER
	JMP	JCLEA1		/ LOOP BACK IF NOT AT RIGHT END OF RULER

/ HERE IF CHAR IS:
/	ECNWLN	0012	NEW LINE
/ OR	ECPGRF	1012	END PARAGRAPH
/ OR	ECENLN	1412	CENTERED LINE
/ OR	ECSLPT	3412	SELECT POINT
/ OR	ECPCT1	1014	START CONTROL
/ OR	ECPCT2	1414	END CONTROL
/ OR	ECLTRL	0016	RULER START
/ OR   IF AT END_OF_TEXT
/ OR   IF AT RIGHTMOST MARGIN (EITHER 80 OR 160)

JCLEA2,	TAD	JCLEAY
	DCA	CURPTR
	JMP I	JCLEAN		/ RETURN

/ HERE IF CHAR IS:
/	ECJSPC	2040	JUSTIFIED SPACE
/ OR	ECWWLN	2012	WRAPPED LINE
/ OR	ECHYLN	2412	WRAPPED LINE WITH HYPHEN
/ OR	ECPMRK	2014	PAGE MARKER

JCLEA3,	DCA I	CURPTR		/ DELETE JUSTIF CODE
	JMP	JCLEA6		/ AND LOOP FOR MORE
JCLEAX,	0			/ LOOP COUNTER INITIALIZED TO -160 FOR
				/ WIDE RULERS OR -80 FOR REGULAR RULERS
JCLEAY,	0
JCLGCT,	JTSTOF-ECPMRK		/ OFFSET FOR DELETING PAGE MARKER
				/ IF NOT IN GOLD CUT MODE


	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED


/ PSUEDO_CODE FOR ESLCTS
/
/ IF ALREADY IN SELECT MODE
/ THEN
/    IF SELECT POINT IS ABOVE US
/    THEN
/	INSERT "ECSLPT" INTO TEXT
/	BACK UP TO SELECT MARK AND DELETE IT
/	SET LINE_MODIFIED FLAG
/
/    INCREMENT RETURN ADDRESS
/
ESLCTS,	XX			/ TEST SELECT MODE
	TAD	ESLMOD+1	/ ALREADY IN SELECT MODE?
	AND	EDMODE
	SNA CLA			/ SKIP IF: SO
	JMP I	ESLCTS		/ JUST RETURN IF NOT IN SELECT
	TAD	SLCTDR		/ TEST DIRECTION
	SZA CLA			/ SKIP IF: FORWARD
	JMP	ESLCT6		/ JMP IF SELECTING BACKWARDS
	TAD	(ECSLPT)
	JMS	INSERT		/ ELSE INSERT OUR STOPPER
	JMS	SVSLCR		/ SAVE CURSOR POSITION			/A209
ESLCT4,	AC7777			/ LOOP
	CURMOV			/   BACKUP  CURSOR
	JMP	UNSLCT		/ EXIT IF START OF DOCUMENT FOUND
	TAD I	CURPTR		/   GET NEXT CHAR
	JMS	ESLCTD		/ IF CHAR NOT EQUAL SELECT POINT
	JMP	ESLCT4		/ THEN GOTO ESLCT4:
				/ ELSE
ESLCT6,	ISZ	ESLCTS		/ TAKE SKIP RETURN
	JMP I	ESLCTS

ESLMOD,	0
	SLTMOD

EINXSC,	OVLJMP;OVNXSC		/ NEXT SCREEN

/ THE FOLLOWING IS USED BY V2 GOTO PAGE OVERLAYS...

RPBOTF,	0			/ V2 GOLD BOTTOM FLAG			/M226
				/ - = V2 GOLD BOTTOM REQUEST
				/ 0 = V2 GOTO PAGE REQUEST

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------
	PAGE

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED


EIPCMD,	TAD	PCTLFL		/ START AND END CONTROL
	SNA CLA
	TAD	(ECPCT1-ECPCT2)	/ INSERT NON-REDUNDANT CONTROL MARKER
	TAD	(ECPCT2-ECNWPG)
EINPAG,	TAD	(ECNWPG-ECPMRK)	/ NEW PAGE
EIPMRK,	TAD	(ECPMRK)	/ PAGE MARKER
	MQL
	DCA	CURSOR
	TAD	LINE23
	DCA	CURPTR
	MQA
	JMP	EIFXT1		/ AND JUMP TO INSERT

ESGETE,	XX			/ GET FROM ETX
	JMS I	ESGETX
MGPTC1,		XGETET		/ OR  XRDFNC  IF FORM
	JMP I	ESGETE

ESGETS,	XX			/ GET FROM STX
MGPTC2,	JMS I	ESGETX		/ OR  SKP CLA  IF FORM
		XGETST
	JMP I	ESGETS

ESPUTE,	XX			/ PUT TO ETX
MGPTC3,	JMS I	ESGETX		/ OR  SKP CLA  IF FORM
		XPUTET
	JMP I	ESPUTE

ESPUTS,	XX			/ PUT TO STX
MGPTC4,	JMS I	ESGETX		/ OR  JMP I ESPUTX  IF NO FILE
		XPUTST
ESPUTY,	JMP I	ESPUTS

ESGETX,	DSKCAL
ESPUTX,	PUTST3


ESICHR,	XX			/ INSERT CHAR AND ECHO
	JMS	INSERT		/ INSERT INTO DOCUMENT
	AC0001
	DCA	ECHFLG		/ SET ECHO MODE
	SLNMOD			/ SET MODIFIED FLAG
	TAD I	CURPTR		/ HANDLE NW PAGE AND NW LINE SPECIALLY
	DCA	ESITMP		/ save character.
	TAD	ESITMP		/ get back.
	AND	P177

	ZZCASE			/ COMPARE AGAINST TABLE
	CTB012-1		/ TABLE ADDRESS FOR CASE

/	ECNWPG; ESINPG		/ NEW PAGE
/	ECNWLN; ESINP2		/ NEW LINE
/	ECSTOV; ESINP1		/ START DEAD KEY
/	ECNDOV; ESINP5		/ END DEAD KEY
/	0			/ INDICATE END OF TABLE

	TAD	ESINOV
	SNA CLA
	JMP	ESINP7
	BKPPTR
	NOP			/ CONTINUE OVERSTRIKE MODE
	TAD	(-ECNDOV)	/ IF POSSIBLE
	SZA CLA
	JMP	ESINP6
	DCA I	CURPTR
	ADVPTR
	NOP
ESINP1,	ADVPTR
	NOP
	CLA
	TAD	(ECNDOV)
	JMS	INSERT		/ START OVERSTRIKE MODE
	ADVPTR
	NOP
	AC0001
	DCA	ESINOV
	JMP I	ESICHR

ESINP2,	JMS	REJUST
	JMP	ESINP4

ESINPG,	TAD	CURSOR		/ INSERT NEW LINE BEFORE NEW PAGE, IF NEC.
	SNA CLA
	JMP	ESINP4

	JMS	REJUST
	TAD	ESITMP		/ soft page marker?
	TAD	(-ECPMRK)	/  ...
	SZA CLA			/ skip if yes. rejust deleted it.
	JMP	ESNP3A		/ Hard PM so all is ok.			/M220
	TAD	(ECPMRK)
	JMS	INSERT		/ Insert soft page marker back!!!
	TAD	(ECWWLN)
	JMS	INSERT		/ INSERT SOFT RETURN JUST PRIOR TO NPM.
	JMP	ESINP3		/ MERGE BELOW TO PROPERLY SCROLL	/A220
ESNP3A,	TAD	CURSOR		/ ARE WE AT START OF LINE NOW ?		/A220
	SZA CLA			/ SKIP IF YES.  MUST HAVE BEEN LM NOT=0 /A220
ESINP3,	JMS	SCRLUP
ESINP4,	JMS	SCRLUP
	JMP I	ESICHR

ESINP5,	DCA I	CURPTR		/ LEAVE OVERSTIKE MODE
	ISZ	CURSOR
	DCA	ESINOV
	JMP I	ESICHR

ESINP6,	DCA	ESINOV		/ CANCEL OVERSTIKE MODE
	ADVPTR
	NOP
	CLA
ESINP7,	JMS	CHKREJ
	JMP I	ESICHR		/ AND RETURN

ESINOV,	.-.
ESITMP,	0

CTB012,	ECNWPG; ESINPG		/ NEW PAGE
	ECNWLN; ESINP2		/ NEW LINE
	ECSTOV; ESINP1		/ START DEAD KEY
	ECNDOV; ESINP5		/ END DEAD KEY
	0			/ INDICATE END OF TABLE

/ ESPTES IS REWRITTEN TO DEAL WITH THE NEW, LONGER ESCAPE SEQUENCES.
/ IF THERE ARE TWO CHARACTERS TO FOLLOW THE ESC, THE FIRST CHARACTER
/ HAS ITS 0 BIT SET. THIS VERSION TESTS FOR THAT AND FOLLOWS THROUGH.

ESPTES,XX			/ PUT ESCAPE SEQUENCE
	TAD	(ESC)
	AND	P3777		/ MASK OUT BIT 0.  DOES NO HARM TO ESC.
	PUTOUT
	TAD I	ESPTES		/ GET THE FIRST ARGUMENT.
	ISZ	ESPTES		/ INCREMENT RETURN LOCATION.
	SPA			/ SKIP IF NOT ANOTHER ARGUMENT.
	JMP	.-5		/ RUN THROUGH THE CYCLE AGAIN IF THERE IS.
	PUTOUT
	JMP I	ESPTES		/ RETURN

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------
	PAGE

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED


/++
/ FUNCTIONAL DESCRIPTION:	CHKSPC
/
/	CHECKS FOR SPACE LEFT ON A DISK AND INFORMS USER IF IT IS LESS
/	THAN THE MINIMUM CUTOFF VALUE (SPECIFIED IN SPCCHK)
/
/   CHKSPC PSEUDO CODE:
/
/	GET NUMBER OF FREE BLOCKS LEFT ON DISK
/	IF (BELOW MINIMUM CUTOFF VALUE)
/	   EXIT - INFORM USER AND WAIT FOR KB INPUT
/	RETURN TO CALLER
/
/ CALLING SEQUENCE:	JMS	CHKSPC
/
/ INPUT PARAMETERS:	NONE
/
/ IMPLICIT INPUTS:	ACSAVE, SCFSPC, SPCCHK
/
/ OUTPUT PARAMETERS:	NONE
/
/ IMPLICIT OUTPUT:	ACSAVE, SPCCHK
/
/ COMPLETION CODE:	NONE
/
/ SIDE EFFECTS:		THIS ROUTINE ONLY INFORMS YOU THAT YOU'RE
/			RUNNING OUT OF SPACE ON THE DISK. IT WILL NOT
/			PREVENT YOU FROM GOING BEYOND THE LIMIT AND
/			POSSIBLY WIPING OUT YOUR DISK.
/
/--
/
CHKSPC,	XX			/ CHECK DISKETTE ROOM
	DCA	ACSAVE		/ SAVE AC IN TEMP LOCATION
	CDFFIO
	TAD I	(SCFSPC)	/ GET NUMBER OF BLOCKS LEFT
	CDFMYF			/ COMPARE WITH CUTOFF POINT VALUE
	DCA	T1
	TAD	T1
	TAD	SPCCHK
	SMA CLA			/ IS THERE ROOM ?
	JMP	ACRSTR		/ YES
/ ????	DCA	SPCCHK		/ CLEAR SPCCHK (ONE WARNING IS ENOUGH)
	TAD	T1		/ CHECK FOR HARD LIMIT
	TAD	(-14)
	SMA SZA CLA
	JMP	DOWTCH
	AC7777
	DCA	BLKALM
	JMP	WARN

DOWTCH,	TAD	BLWTCH		/ WATCH FOR NEXT USE OF A BLOCK
	SNA
	JMP	NEWTCH

	CIA
	TAD	T1
	SMA CLA
	JMP	ACRSTR
NEWTCH,	TAD	T1
	DCA	BLWTCH
WARN,	OVLJMP;OVSPCE		/ PUT OUT MESSAGE AND RETURN TO EINEXT

ACRSTR,	TAD	ACSAVE		/ RESTORE AC
	JMP I	CHKSPC

ACSAVE,	0			/ TEMP SAVE LOCATION FOR AC SAVING
BLWTCH,	0			/ FOR KEEPING TRACK OF BLOCK USAGE
BLKALM,	0			/ ALARM FOR HARD LIMIT


/	LODCHR		GET FIRST AVAILABLE CHARACTER
/
/	THIS ROUTINE RETURNS THE FIRST AVAILABLE CHARACTER AT OR AFTER
/	THE POSITION POINTED TO BY CURPTR.
/
/	CALL:
/
/	JMS	LODCHR
/	<RETURN HERE WITH AC := 0 ON END OF FILE>
/	<RETURN HERE WITH AC := CHAR IF SUCCESSFUL>
/

LODCHR,	XX
	CLA
	CHKPTR
	SZA SMA
	JMP	LODEXI
	ADVPTR
	JMP I	LODCHR		/ TAKE 1ST RET IF ETX FOUND
LODEXI,	ISZ	LODCHR
	JMP I	LODCHR

USCMPR,	XX			/ COMPARE AC&177 WITH MQ,
				/ USING MQ AS U/L MATCH
				/ LEAVES AC 0, MQ UNCHANGED
	AND	P177		/ MASK CHAR
	CIA
	DCA	USCMP1		/ SAVE FOR COMPARE
	MQA
	TAD	USCMP1		/ COMPARE AS IS
	SNA CLA
	JMP	USCMP2		/ JUMP IF EQUAL
	MQA
	XLTUPR			/ MAKE MATCH CHAR UPPER CASE
	TAD	USCMP1		/ COMPARE AGAIN
	SNA CLA
USCMP2,	ISZ	USCMPR		/ BUMP RETURN FOR MATCH
	JMP I	USCMPR		/ NO BUMP FOR NO MATCH
USCMP1=	X0			/ TEMP


ESXLUP,	XX			/ XLAT AC TO UPPER CASE
	TAD	(-173)
	SMA
	JMP	ESXLUA
	TAD	(173-141)
	SMA
	TAD	(-40)
	TAD	(141-173)
ESXLUA,	TAD	(173)
	JMP I	ESXLUP



/ NOW THAT TABLE2 HAS BEEN MOVED TO THE PRINTER, WE HAVE ROOM TO PUT
/ ALL THE FORIN DEAD KEY CODE TOGETHER, RIGHT HERE. SOME MODIFICATIONS
/ WERE MADE TO ACCESS THE TABLES IN THE PRINTER FIELD.

	IFDEF	FORIN	<
/ HERE IF DEAD KEY SEQUENCE
DEAD,	TAD	CURPTR		/ GET CURRENT POINTER
	DCA	POINT2		/ SAVE
	ADVPTR			/ ADVANCE CURSOR AND RETURN CHARACTER
	NOP
				/ CAN'T RETURN HERE
	MQL			/ PUT CHAR IN MQ
	MQA			/ REPLACE INTO AC
	AND	(7600)		/ GET MODE BITS
	DCA	ESXLUP		/ TEMP STORAGE
	SWP			/ SWAP WITH MQ TO GET CHAR BACK
	AND	P177		/ MASK
	DCA	CHAR1		/ SAVE
	TAD	(TABLE1-1)
	JMS	SEARCH		/ SEARCH FOR CHARACTER IN TABLE1
	JMP	NOTACC		/ NOT FOUND, RESTORE CURSOR POINTER

	JMS	GETENT		/ GET FLAG BITS

	DCA	CHAR1		/ SAVE
	ADVPTR			/ ADVANCE POINTER AND RETURN CHARACTER
	NOP			/ CAN'T RETURN HERE
	AND	P177		/ MASK
	TAD	CHAR1		/ COMBINE WITH FLAG BITS
	DCA	CHAR1		/ SAVE
	TAD	(TABLE2-1)
	JMS	SEARCH		/ LOOK FOR COMBINED CHAR. IN TABLE2
	JMP	NOTACC		/ NOT FOUND

	JMS	GETENT

	SPA CLA			/ SPECIAL?
	JMP	DEADSP		/ YES, HANDLE DIFFERENTLY
	TAD	(16)		/ FOUND
	PUTOUT			/ OUTPUT SHIFT OUT

	JMS	GETENT
	TAD	ESXLUP		/ ADD MODE BITS
	PUTOUT			/ OUTPUT THE NEW CHARACTER
DEAD1,	TAD	POINT2
	DCA	CURPTR		/ RESTORE CURSOR POINTER
	TAD	(17)
	JMP	PUTSC4		/ OUTPUT SHIFT IN
DEADSP,	TAD	POINT2
	DCA	CURPTR		/ RESET CURPTR
	JMS	GETENT		/ GET CHARACTER
	JMP	PUTSC4		/ OUTPUT IT
/ HERE WHEN NO MATCH ON FL SPECIAL CHAR
NOTACC,	TAD	POINT2
	DCA	CURPTR		/ RESTORE CURSOR POINTER
	JMP	PUTSC2		/ OUTPUT A BLOB

			>	/ END IFDEF FORIN

RPBIN2,	0			/ BINARY THOUSANDS

CLSBEG,	ZBLOCK	1		/ COLUMN STRIP PARAMETERS
CLSEND,	ZBLOCK	1

EIREPL,	OVLJMP;OVREPL		/ REPLACE
EIUPAR,	OVLJMP;OVUPAR		/ UP ARROW
EIDNAR,	OVLJMP;OVDNAR		/ DOWN ARROW


ESATST,	XX			/ TEST @CURPTR
				/ RETURN 0 IF NULL, -1 IF ETX/STX, + OTHERWISE
				/ ENTER WITH AC = OFFSET
	CDFBUF			/ GET TO CORRECT FIELD
	TAD	CURPTR		/ ADD PTR TO OFFSET
ESATS1,	DCA	CURPTR		/ UPDATE PTR
	TAD I	CURPTR		/ GET CURRENT CHAR
	SMA
	JMP I	ESATST		/ RETURN IF NOT SPECIAL
	IAC
	SNA
	JMP	ESATS2		/ JUMP IF BUFBEG
	IAC
	SNA
	JMP	ESATS3		/ JUMP IF BUFEND
	IAC
	CMA
	JMP I	ESATST		/ RETURN -1 IF STX/ETX, + OTHERWISE
ESATS2,	AC7775
	TAD	BUFSIZ		/ GO TO BUFEND-2
ESATS3,	IAC
	TAD	BUFBEG		/ GO TO BUFBEG+1
	JMP	ESATS1		/ UPDATE PTR AND TRY AGAIN

	/PGECHO is called with AC = page character,
	/ 0014 = new page
	/ 1014 = start print control
	/ 1414 = end print control
	/ 2014 = (soft) page marker

PGECHO,	XX			/ PRINT MESSAGE
/D245	AND	P7700		/ ISOLATE HI BYTE
/D245	BSW			/ MOVE TO LO BYTE
/D245	CLL RTR			/ MAP TO 0,2,3,4
/D245	SNA
/D245	IAC			/ MAP TO 1,2,3,4
/D245	TAD	(PGMTBL-1)	/ INDEX INTO TABLE OF TEXT POINTERS
/D245	DCA	PGTEMP		/ SAVE PTR OF TEXT POINTERS
/D245	CDFMYF			/ MAP OUR FIELD
/D245	TAD I	PGTEMP		/ GET TEXT POINTER
	JMS	BHOOK		/ Call Blaster
	BPGECO			/ 
	JMS	PGMSG		/ PRINT MESSAGE
	JMP I	PGECHO		/ RETURN
/D245PGTEMP=	T3
/D245PGMTBL,	PGMSG1			/ "new page"
/D245	PGMSG3			/ "START PRINT CONTROL
/D245	PGMSG4			/ "END PRINT CONTROL
/D245	PGMSG2			/ "PAGE MARKER"


EIINOV,	OVLJMP			/ Go into Overlay			/A254
	OVINOF			/ To switch Inset-Overstrike On-Off	/A254

/
/	Check if we are in Overstrike mode , if not return to EINSRT	/A254
/	otherwise call the Overstrike Overlay				/A254
/

OVSCHK,	DCA 	INCHTM		/ First save the char			/A254
	TAD 	INSOVF		/ Now check the flag			/A254
	SNA CLA			/ Are we in Overstrike 			/A254
	JMP	OVRSCH		/ No , restore char and insert it	/A254
	OVLJMP			/ Yes,					/A254
	OVINCH			/ So call the overlay			/A254
OVRSCH,	TAD 	INCHTM		/ Get char back				/A254
	JMP	EINSRT		/ and insert it as normal		/A254


INSOVF,	0			/ Insert-Overstrike flag		/A254
INCHTM,	0			/ temp for char just entered		/A254

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------
	PAGE

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED


ESACHR,	XX			/ ADVANCE PTR TO NON-NULL
ADVCL1,	CHKPTR
	SZA
	JMP I	ESACHR		/ JUST RETURN IF THERE ALREADY
	TAD	CURPTR
	DCA	T1		/ ELSE SET OUR SCAN PTRS
	TAD	T1
	DCA	T2
	TAD	(-50)
	DCA	T3		/ AND LIMIT COUNT
	DCA	ADVCLT
ADVCL8,	ISZ	ADVCLT
ADVCL2,	ISZ	T1		/ ADVANCE PEEK PTR
	TAD I	T1
	SNA
	JMP	ADVCL8		/ LOOP TIL NON-NULL
	SMA
	JMP	ADVCL3		/ JUMP IF NORMAL TEXT
	TAD	(3)		/ ELSE CHECK FOR ETX
	SNA
	JMP	ADVCL4		/ JUMP IF ETX
	SPA CLA
	JMP	ADVCL5		/ JUMP IF NOT BUFEND
	TAD	BUFBEG		/ ELSE RESET TO BUFBEG
	DCA	T1
	JMP	ADVCL2		/ AND CONTINUE LOOKING

ADVCL5,	TAD I	T1
ADVCL3,	DCA I	T2
	DCA I	T1
	AC7775
	TAD	ADVCLT
	SPA SNA CLA
	JMP	ADVCL1
ADVCL7,	ISZ	T2		/ BUMP COPY PTR
	TAD I	T2		/ CHECK FOR BUFEND
	SZA CLA
	JMP	ADVCL6		/ JUMP IF SO
	ISZ	T3
	JMP	ADVCL2		/ LOOP IF LIMIT NOT REACHED
	JMP	ADVCL1		/ ELSE RETURN

ADVCL6,	TAD	BUFBEG		/ RESET TO BUFBEG
	DCA	T2
	JMP	ADVCL7		/ AND CONTINUE

ADVCL4,	AC7775
	DCA I	T2		/ COPY ETX
	JMP	ADVCL1		/ AND RETURN

ADVCLT,	.-.

RSTRLN,	XX			/ RESTORE 23RD LINE
	TAD	CURSOR
	DCA	RSTRT2
	DCA	CURSOR
	JMS	SCRNMD
	TAD	RSTRT2
	DCA	CURSOR
	JMP I	RSTRLN		/ THEN RETURN
RSTRT2,	0

PROMPT,	XX			/ CLEAR LINE AND PROMPT
	CLA
	JMS	RSTRLN		/ SET MOD FLAG
	JMS	PCUR		/ RESET TO BEGINNING OF LINE
	CDFMYF
	TAD I	PROMPT
	DCA	PROSTR		/ GET STRING PTR
	ISZ	PROMPT
	TAD	LOWLIM		/ RE-SET CURPOS TO START OF LINE!!!
	CIA			/  SO THAT PROMPT ISN'T TRUNCATED ON
	DCA	CURPOS		/  RIGHT SIDE OF SCREEN.
	JMS	PUTMSG		/ WRITE MESSAGE
PROSTR,		.-.
	JMP I	PROMPT

GETLIN,	XX			/ GET USER INPUT (CR ENDS)
	DCA	PRICNT		/ GET INITIAL FILL COUNT
	JMS		CLREOL	/ Erase to end of line
	TAD I	GETLIN
	DCA	PRISTR		/ SET BUFFER PTR
	ISZ	GETLIN		/ BUMP TO RETURN ADDR
PROMP2,	TAD	PRICNT		/ LOAD FLAG WORD
/D228	SNA
	CMA			/ INSURE IT'S NONZERO
	CIFMNU
	JMS I	INACAL		/ READ A LINE
PRISTR,		EIGES3-1	/ INTO BUFFER
	SKP
	TAD	(EDNWLN)	/ SET TERMINATOR FOR NORMAL RTN
	DCA	GETTRM
	SWP
	DCA	PRICNT		/ SAVE FILL COUNT
	TAD	GETTRM		/ TEST TERMINATOR FOR...

	ZZCASE			/ COMPARE AGAINST TABLE
	CTB013-1		/ TABLE ADDRESS FOR CASE

/	EDRULR; RRGOTO		/ GOLD:RULER KEYS
/	EDPAGE; RPGOTO		/ PAGE KEY
/	EDNWLN;	PRIST1		/ RETURN KEY
/	EDADVN; PRIST1		/ ADVANCE KEY
/	EDBKUP; PRIST1		/ BACKUP KEY
/	EDSRCH; PRIST1		/ SEARCH KEY
/	EDCONT; PRIST1		/ CONTINUE SEARCH KEY
/	0			/ INDICATE END OF TABLE

	JMS	BEEPER		/ ELSE ERROR
	JMP	PROMP2


RRGOTO,	OVLJMP			/ INITIATE GOTO-RULER (RAPID RULER)
	OVGSGR			/   ("GOLD:SEARCH GOLD:RULER" COMMAND)


RPGOTO,	OVLJMP;OVRPPG		/ INITIATE GOTO-PAGE (RAPID PAGING)


PRIST1,	JMP I	GETLIN

CTB013,	EDRULR; RRGOTO		/ GOLD:RULER KEYS
	EDPAGE; RPGOTO		/ PAGE KEY
	EDNWLN;	PRIST1		/ RETURN KEY
	EDADVN; PRIST1		/ ADVANCE KEY
	EDBKUP; PRIST1		/ BACKUP KEY
	EDSRCH; PRIST1		/ SEARCH KEY
	EDCONT; PRIST1		/ CONTINUE SEARCH KEY
	0			/ INDICATE END OF TABLE

PRICNT=	GETLEN

/ Use the New Line escape sequence if in ANSI mode
NWLN,	XX
	PUTESC			/ Put out an escape sequence
	"E-200			/ ESC E
	JMP I	NWLN

CLREOL,	XX
	PUTESC			/ Put out an escape sequence
	"[+4000-200		/ subtract 200 to convert to sixbit ascii
				/ and add 4000 to signify continue
	"K-200
	JMP I	CLREOL

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------
	PAGE

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED


PUTLNZ,	0			/ THE COLUMN THAT THE CURSOR IS IN
PUTLNX,	0			/ TEMP POINTER TO CHARACTER IN DOCUMENT

PUTLIN,	XX			/ PUT LINE ON SCREEN
	TAD	CURPTR
	DCA	PUTLNX		/ SAVE CURPTR
	JMS	LODCHR
	JMP	PUTLNW		/ GET FIRST CHAR
PUTLN2, AND	P177		/ STRIP MODE BITS

	ZZCASE			/ COMPARE AGAINST TABLE
	CTB014-1		/ TABLE ADDRESS FOR CASE

/	ECSTRL; PUTLNR		/ START RULER
/	ECNWPG; PUTLNP		/ NEW PAGE
/	ECNWLN; PUTLNL		/ NEW LINE
/	ECTAB;  PUTLNB		/ TAB
/	ECMDFL; PUTLN1		/ LINE MODIFIED
/	0			/ INDICATE END OF TABLE

	JMP	PUTLN4
PUTLN1,	ADVSPC
	JMP	PUTLNW
	JMP	PUTLN2

PUTLNR,	TAD	CURPOS		/ Ignore unjustified ruler.
	SNA CLA			/  ...
	JMS	DSPRLN		/ display ruler line.
PUTLNU,
PUTLNV,
PUTLN3,	CLA
	TAD	PUTLNX
	DCA	CURPTR		/ RESTORE CURPTR
	JMP I	PUTLIN

PUTLNP,	TAD	CURPOS
	SZA CLA
	JMP	PUTLNU		/ Ignore unjustified page mrkr.
	TAD I	CURPTR
	JMS	PGECHO
	JMP	PUTLN3

PUTLNL,	TAD I	CURPTR
PUTLNW,	JMS	LNECHT		/ Print hyphen or select point if needed
	PUTESC
	"[&177+4000
	"K&177			/ do erase to End Of Line.
	JMP	PUTLNV

PUTLNB,	TAD I	CURPTR		/ RESTORE TAB CHAR
	AND	(3600)		/ TO GET IT'S ATTRIBUTE
MRGSPC,	TAD	(ECSPC)		/ AND MERGE WITH A SPACE
	JMP	PUTLN6

PUTLN4,	TAD I	CURPTR
	TAD	(-ECJSPC)	/ IF CHAR IS NOT A SOFT SPACE
	SZA CLA			/ THEN
	JMP	PUT4		/    RESTORE CHAR TO OUTPUT
				/ ELSE
	TAD	CHRATR		/    GET ATTRIBUTE OF TAB
	JMP	MRGSPC		/    TO MERGE WITH A SPACE

PUT4,	TAD I	CURPTR		/ RESTORE CHAR

PUTLN6,	MQL			/ save char temporarily.
	TAD	CURPOS		/ Get current character posn in line.
	CIA			/ compare to 1st printable posn.
	TAD	CURSOR		/ which is (CURSOR).
	SPA SNA CLA		/ skip if char to the left of "cursor".
	MQA			/ get printable character back.
	JMS	PUTSCH
	TAD	WIDNAR		/ wide screen?				/M226
	SNA CLA			/ skip if narrow.			/M226
	TAD	(-WIDTH+COLM81)	/ M219 compute "-wide" width.
	TAD	(-COLM81)	/ M219 compute "-narrow" width.
	TAD	CURPOS		/ Get current cursor posn.
	TAD	LOWLIM		/ Now see if within screen width.
				/ AC is now >= 0 if outside screen width
	SPA CLA			/ skip if bbeyond threshold.
	JMP	PUTLN1		/ Loop to do more.
	JMP	PUTLN3		/ end of line encountered.
/
/ +++	IN THIS CASE-TABLE THE ENTRY FOR 'START RULER' COULD		/A216
/	DYNAMICALLY BE CHANGED DURING EDITOR EXECUTION.  THE REASON;	/A216
/	TURN RULER DISPLAY ON OR OFF DEPENDING ON EDITOR STATUS WORD	/A216
/	(MNSTAT): 							/A216
/									/A216
/	0 OR 1	RULER DISPLAY ON	GOTO @PUTLNR'			/A216
/	2 OR 3	RULER DISPLAY OFF	GOTO @PUTLN3'			/A216
/									/A216
/	IN PLACE OF THE RULER, THE USER WILL SEE A BLANK LINE, WHICH THE/A216
/	USER CANNOT PLACE THE CURSOR ON.				/A216
/									/A216
/	THIS DYNAMIC CHANGE OCCURS ONLY WHEN THE EDITOR IS LOADED (FIRST/A216
/	TIME) AND WHENEVER THE EDITOR-MENU IS CALLED.			/A216


CTB014,	ECSTRL								/C216
RULOFF,		PUTLNR		/ START RULER				/C216
	ECNWPG; PUTLNP		/ NEW PAGE
	ECNWLN; PUTLNL		/ NEW LINE
	ECTAB;  PUTLNB		/ TAB
	ECMDFL; PUTLN1		/ LINE MODIFIED
	0			/ INDICATE END OF TABLE

PGMSG,	XX			/ ENTER WITH AC = ADDRESS OF MESSAGE
	SNA			/
	JMP	PGMSGB
	DCA	PGMSGX		/ SAVE MESSAGE ADDRESS FOR DISPLAY
	TAD	WIDNAR		/ FORCED NARROW?			/M223
	SNA CLA			/  SKIP IF NARROW.			/M223
	TAD	(-20)		/  XTRA SPACING FOR 132 COL MODE.
	JMS	PTDASH
	-40
	JMS	PUTMSG
PGMSGX,	0			/ ADDRESS OF MESSAGE TO BE DISPLAYED

	CDFMYF								/A223
	TAD	WIDNAR		/ FORCED NARROW?			/M223
	SNA CLA			/  SKIP IF NARROW.			/M223
	TAD	P7700		/ xtra spacing for 132 col mode.
	JMS	PTDASH
	-53
	AC7777			/ reset CURPOS so that FXSCRL will
	DCA	CURPOS		/ reposition the cursor.
PGMSGB,	JMP I	PGMSG

/ PSUEDO_CODE:
/ BEGIN CHKLMD
/   IF CHAR = 'LINE_MODIFIED' OR 'RULER_MODIFIED'
/   THEN
/	IF CHAR = 'RULER_MODIFIED'
/	THEN SET RULER_MODIFIED_FLAG
/
/	DELETE CHAR
/	SET LINE_MODIFIED_FLAG
/	BUMP RETURN ADDRESS
/ END CHKLMD

CHKLMD,	XX			/ CHECK FOR MODIFIED FLAGS
	TAD I	CURPTR		/ GET CHARACTER
	TAD	(-ECMDFL)	/ CHARACTER = "LINE_MODIFIED_FALG"?
	SNA			/ SKIP IF: NOT
	JMP	CHKLMA
	TAD	(ECMDFL-ECRMFL)	/ CHARACTER = "RULER_MODIFIED_FLAG"?
	SZA CLA			/ SKIP IF: SO
	JMP I	CHKLMD		/ RETURN IF NOT MOD FLAG
	TAD	(ECRMFL)	/ SET RULER MODIFIED FLAG
	DCA	RLRMOD
CHKLMA,	DCA I	CURPTR		/ DELETE FLAG
	SLNMOD			/ SET INDICATOR
	ISZ	CHKLMD		/ BUMP RETURN
	JMP I	CHKLMD		/ RETURN



EISRCH,	OVLJMP;OVSRCH		/ SEARCH OVERLAY
CASUNT,	OVLJMP;OVCASE		/ CASE UNIT (UPPER/LOWER CASE)
EIHYPS,	OVLJMP;OVHYPS		/ HYPHEN PUSH OVERLAY


	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------
	PAGE

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED

EDICHR,	XX
	CDFMYF
	JMS	GSRCK		/ SEE IF GLOBAL SEARCH IS ON
	JMP	EDICH1

EDICH2,	CIFSYS
	JWAIT

EDICH1,	CIFPRT
	JMS I	(FLABUZ)	/ SOUND BUZZER AND TOGGLE LED'S
				/ IF THEIR IS A PRINTER ERROR
	CIFSYS
	XLTIN
	JMP	EDICH2
EDICH3,	JMP I	EDICHR


DSKCAL,	XX			/ CALL FIELD 0 DISKIO ROUTINES
	DCA	T1
	CDFMYF
	TAD I	DSKCAL
	DCA	.+4
	TAD	T1
	CIFFIO
	FILEIO
	.-.
	ISZ	DSKCAL
	CDFBUF
	JMP I	DSKCAL

PSTIO,	XX			/ PASTE_I/O - READ & WRITE PASTE BUF.
	DCA	.+4		/ SET FUNCTION CODE
	TAD	PSTBLK
	CDFBUF
	JMS	SYSIO
	.-.
	PSTEBF			/ DO I/O
	JMS	SETPST		/ RESET PTRS
	JMP I	PSTIO		/ AND RETURN

SYSIO,	XX			/ DO SYS IO
	DCA	PSQBLK+RXQBLK	/ SET BLOCK NUMBER
	RDF
	TAD	CDF0		/ GET BUFFER FIELD
	DCA	PSQBLK+RXQBFD	/ STORE IN QBLK
	CDFMYF
	TAD I	SYSIO
	DCA	PSQBLK+RXQFNC	/ AND FUNCTION CODE
	ISZ	SYSIO
	TAD I	SYSIO
	DCA	PSQBLK+RXQBAD	/ AND BUFFER ADDRESS
/D212	TAD	USERNO
/D212	CLL RAL			/ GET DRIVE NUMBER
	DCA	PSQBLK+RXQDRV	/ SET DRIVE NUMBER TO ZERO IN QUEUE BLOCK
	ISZ	SYSIO

	CIFSYS
	ENQUE
	PQBLK			/ QUEUE Q-BLOCK

SYSIO1,	CIFSYS
	JWAIT			/ WAIT FOR EVENT
	TAD	PSQBLK+RXQCOD	/ ARE WE DONE?
	SNA CLA
	JMP	SYSIO1		/ NO
	JMP I	SYSIO		/ AND RETURN

PQBLK,	DSKQUE; 0; 0
PSQBLK,	0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; PSTEBF; CDFBUF; 0; 0





/	OVJUMP	JUMP TO OVERLAY IN OVERLAY AREA 1
/
/

OVJUMP,	XX
	CDFMYF
	TAD I	OVJUMP
	DCA	T1
	TAD	(OVLAY1)
	DCA	OVLOA2
	TAD	(TAD (DLOEDO-1) )
	DCA	OVLOA4
	JMP	OVJMCM

OVJRTN,	ISZ	OVJUMP
	JMP I	OVJUMP


/	OV2JMP	JUMP TO OVERLAY IN OVERLAY AREA 2
/
/

OV2JMP,	XX
	CDFMYF
	TAD I	OV2JMP
	DCA	T1
	TAD	(OVLAY2)
	DCA	OVLOA2
	TAD	(TAD (DLOEDO-1+37) )
	DCA	OVLOA4
	JMP	OVJMCM

OV2JRT,	ISZ	OV2JMP
	JMP I	OV2JMP


OVJMCM,	TAD I	OVLOA2		/ READ LOCATION 7400 FOR OVERLAY NUMBER
	CIA			/ NEGATE THE VALUE
	TAD	T1		/ COMPARE WITH CURRENT REQUEST NUMBER
	AND	(7600)		/ MASK OFF ADDRESS BITS
	SNA CLA			/ IS OVERLAY IN MEMORY ?
	JMP	OVLOA1		/ JUMP IF SAME

OVLOA3,	TAD	T1		/ PICK UP OVERLAY REQUEST NUMBER
	BSW			/ MOVE TO LOW ORDER BITS
	AND	P77		/ MASK OFF OVERLAY NUMBER
	CLL RAR			/ DIVIDE NUMBER BY TWO
OVLOA4,	TAD	(DLOEDO-1)	/ CONVERT TO BLOCK NUMBER
	JMS	SYSIO
		RXERD		/ READ IT IN

OVLOA2,	OVLAY1			/ TO OVERLAY AREA

OVLOA1,	TAD	T1
	AND	P177		/ GET DESIRED ADDRESS
	TAD	OVLOA2		/ RELOCATE IT TO OVERLAY AREA
	DCA	T1		/ STORE FOR CALLER
	JMP I	T1

RPMTRL,	0			/ Rapid Paging MaTh RuLer offset

/ THIS LINE (AND ANY LIKE IT) MAY APPEAR AT THE END OF ANY PAGE
/ THAT THERE IS ROOM (TWO WORDS PER LINE)

EIRULR,	OVLJMP;OVRULR		/ GOLD RULER

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------
	PAGE

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED


RDNXNJ,	XX			/ RDNXCH, NO JUST CODES
	JMS	DSKCAL
	XRDFNC
	SNA SPA
	JMP	RDNXN1		/ JUMP IF ERR OR EOF
	JMS	ESJCHK
	SZA
	TAD	(JCHKOF-ECPMRK)
	SNA
	JMP	RDNXNJ+1
	TAD	(ECPMRK)
	ISZ	RDNXNJ
	JMP I	RDNXNJ
RDNXN1,	CLA			/ TREAT ERR JUST LIKE EOF
	JMP I	RDNXNJ

COPRUL,	XX			/ COPY NWRUL BUFFER TO CURUL BUFFER
	JMS	CPYBUF
		-RULSIZ
		CDFMNU		/ M219
		NWRUL-1
		CDFMYF
		CURUL-1
	CDFMNU			/ A219
	TAD	NWLMAR
	JMS	GETBYT
		NWRUL		/ DETERMINE SPACING
	CLL RAR
	JMS	GETBYT
		XLMAR
	DCA	SPACNG
	CDFMNU			/ A219

/ the following is a blaster call to a panel memory subroutine to	/a238
/ create space in this page for the panel hole blaster (rather 		/a238
/ cannibalistic but there it is anyway)					/a238

	JMS	BHOOK		/ off to the hook			/a238
	BLRUL0			/ subroutines blaster table entry	/a238
				/ contains all the information 		/a238
				/ required to run the folling deleted 	/a238
				/ code from panel memory routines	/a238

/d238	AC7777
/d238	TAD	NWLMAR
/d238	DCA	LFTMAR
/d238	AC7777
/d238	TAD	NWRMAR
/d238	DCA	RGTMAR
/d238	AC7777
/d238	TAD	NWWMAR
/d238	SPA
/d238	TAD	NWLMAR
/d238	DCA	WRPMAR
/d238	AC7777
/d238	TAD	NWPMAR
/d238	SPA
/d238	TAD	NWLMAR
/d238	DCA	PGFMAR
/d238	AC7777
/d238	TAD	NWCMAR
/d238	CLL RAL
/d238	SMA
/d238	JMP	.+4
/d238	AC0001
/d238	TAD	LFTMAR
/d238	TAD	RGTMAR
/d238	DCA	CENMAR
/d238	CDFMNU		Qu. why did we need this anyway??	/ A219

	JMP I	COPRUL

INSRUL,	XX			/ INSTALL RULER
	TAD	(ECSTRL)
	JMS	INSRL1
	JMS	MAKRUL
	CURUL
	INSRL1
	TAD	(ECMDRL)
	JMS	INSRL1
	JMS	MAKRUL
	NWRUL
	INSRL1
	TAD	(ECNDRL)
	JMS	INSRL1
	JMP I	INSRUL

INSRL1,	XX
	JMS	INSERT
	AC0001
	CHKPTR
	CLA
	CDFMYF
	JMP I	INSRL1

RLGETS,	XX			/ TAD RULR - JMS RLGETS
	JMS	RLGETX
	DCA	RLGET1
	JMS	CPYBUF
		-RULSIZ
		CDFBUF
RLGET1,		.-.
		CDFMNU		/ M219
		NWRUL-1
	JMP I	RLGETS

RLGETX,	XX			/ TAD RULR - JMS RLGETX
				/ RETURNS ADDR-1
	CLL RAR
	TAD	(DLRLRE)	/ GET BLOCK
	DCA	PSTBLK
	RTL
	BSW			/ 0 OR 200
	DCA	RLGET1
	TAD	(RXERD)
	JMS	PSTIO		/ READ TO PSTEBF
	CDFMYF
	TAD	RLGET1
	TAD	PSTPTR		/ RETURN ADDR-1
	JMP I	RLGETX

SETPST,	XX			/ RESET PAST BUFFER PTRS
	TAD	(PSTEBF)
	DCA	PSTPTR
	DCA	BASKCT		/ SHOW EMPTY WASTEBASKET
	CDFBUF			/ RESET FIELD
	JMP I	SETPST

/********************************************************************
/ BHOOK      Hook to panel page blaster
/******************************************************************** 	/a238

BHOOK,	0			/ hook return address			/a238
	DCA	BLACSV		/ save accumulator			/a238
	RDF			/ read the data field 			/a238
	TAD	CDF0		/ make a cdf instruction		/a238
	DCA	BHKEXI		/ save for return			/a238
	CDFMYF			/ set to hooks field			/a238
	TAD I	BHOOK		/ get the table entry			/a238
	MQL			/ push into MQ				/a238
 	TAD	BLACSV		/ get the ac				/a238
	ISZ	BHOOK		/ increment the return address		/a238
	CIFMNU			/ blaster is in the menu field		/a238
	IOF			/ turn the interrupts off before.. 	/a238
	JMS I	BLASTH		/ Calling blaster			/a238
	ISZ	BHOOK		/ skip return exit			/a238
BHKEXI,	0			/ CDF instruction			/a238
	JMP I	BHOOK		/ return				/a238
BLASTH,	BLASTR			/ blastr address (get from WPF1)	/a238
BLACSV,	0			/ ac save				/a238


/
/	Moved here on edit 241 for space reasons			/M241
/
EIBOTM,	OVLJMP;OVRBOT		/ V2 "FAST" GOLD BOTTOM
/
/
/	Moved here on edit 245 for space reasons			/M245
UDLBIT=	BLDBIT
UDLUNT,	TAD	(400)		/ SET...
NUDUNT,	DCA	UDLBIT		/ ...OR CLEAR UNDERLINING
	OVLJMP;OVUNDL

EIGPST,	OVLJMP;OVGPST
	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------
	PAGE

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED
/a239  the following two subroutines CMPRUL and CLRRULR now call the BLASTR
/a239  see WPHOLE
/
/ SUBR CMPRUL --
/ COMPARES CURRENT RULER (CURUL) TO NEW RULER (NWRUL).
/ CHECKS FOR RULER CHANGES.
/
/ CALL:
/	CLA			/ AC MUST = 0
/				/ DF DOESN'T MATTER
/	JMS	CMPRUL		/ COMPARE NWRUL TO CURUL
/	JMP	RULSAM		/ RULERS ARE THE SAME, AC=0
/	JMP	RULDIF		/ RULERS ARE DIFFERENT, AC=0
/

CMPRUL,	XX
	JMS	BHOOK		/ call CMPRLH through the BLASTR	/a239
	CMPRLE			/ BLASTR table entry			/a239
	SKP			/ normal return keep it normal		/a239	
	ISZ	CMPRUL		/ skip return from BHOOK and now from here /a239
	JMP I	CMPRUL		/ RETURN				/a239

/d239	TAD	(NWRUL-1)	/ GET PNTR TO NEW RULER
/d239	DCA	X0
/2239	TAD	(CURUL-1)	/ GET PNTR TO OLD RULER
/d239	DCA	X1
/d239	TAD	(-RULSIZ)
/d239	DCA	T1
/d239CMPRL1,	CDFMNU			/ A219
/d239	TAD I	X0
/d239	CIA			/ COMPARE NEW TO OLD
/d239	CDFMYF			/ A219
/d239	TAD I	X1
/d239	SZA CLA
/d239	JMP	CMPRL2
/d239	ISZ	T1
/d239	JMP	CMPRL1		/ NOT SIGNIFICANT, DO NEXT
/d239	SKP
/d239CMPRL2,	ISZ	CMPRUL
/d239	JMP I	CMPRUL

CLRULR,	XX			/ CLEAR RULER				
	JMS	BHOOK		/ Call CLRLRH thru the BLASTR		/a239
	CLRLRE			/ BLASTR table entry			/a239
	JMP I	CLRULR							/a239

/d239	CDFMNU
/d239	TAD	(NWRUL-1)
/d239	DCA	X0
/d239	TAD	(-HAFRUL)
/d239	DCA	T1
/d239	TAD	(101)
/d239	DCA I	X0
/d239	ISZ	T1
/d239	JMP	.-3
/d239	TAD	(-10)
/d239	DCA	T1
/d239	DCA I	X0
/d239	ISZ	T1
/d239	JMP	.-2
/d239	CDFMYF
/d239	JMP I	CLRULR

/a239 THE above two routines removed to WPHOLE

/***********************************************************************/a239
/a239	INSERT CHAR into text buffer allowing for 8 bit data
/***********************************************************************/a239

ESIMCH,	XX			/ subroutine return address		/a239
	DCA	ET1		/ save the char				/a239
	TAD	ET1		/ get it back				/a239
	AND	(200)		/ check for 8 bit data			/a239	
	SNA CLA			/ skip if 8 bit				/a239
	JMP	NEXPC		/ deal with the char normally		/a239
	SLNMOD			/ set line modified flag		/a239
	TAD	(ESTRING-1)	/ get the start of the standard dead str/a239
	DCA	X1		/ save in an index register		/a239
ELOOP,	RDF			/ read the data field			/a239
	TAD	CDF0		/ make a CDF instruction		/a239
	DCA	ESCDF		/ put it where you can use it		/a239
	CDFMYF			/ get this field to access ESTRING	/a239
	TAD I	X1		/ use the index register to get'dead str/a239
ESCDF,	0			/ restore the data field		/a239
	AND	P177		/ dead strings are all 7 bits		/a239
	SNA			/ test for end of string		/a239
	JMP I	ESIMCH		/ RETURN on END of dead string		/a239
	JMS	ESICHR		/ INSERT CHAR INTO TEXT BUFFER		/a239
	JMP	ELOOP		/ get next dead str char		/a239
NEXPC,	TAD	ET1		/ get the char back			/a239
	JMS	ESICHR		/ INSERT CHAR INTO TEXT BUFFER		/a239	
	JMP I	ESIMCH		/ RETURN				/a239

ESTRING,10			/ start of dead				/a239
	" 			/ space					/a239
	"2			/ 2 multinational char precedence	/a239
ET1,	0			/ save char temp and 8 bit char position/a239
	15			/ END OF DEAD				/a239
	0			/ string terminator			/a239
/***********************************************************************/a239

		
MAKRUL,	XX			/ MAKE RULER
				/ JMS MAKRUL - RULR - OUTRTN
				/ GENS ESCS FOR RULR THRU OUTRTN
	CDFMYF
	TAD I	MAKRUL
	DCA	MAKRLA
	ISZ	MAKRUL
	TAD I	MAKRUL
	DCA	MAKRLB		/ SAVE RULR AND OUTRTN PTRS
	ISZ	MAKRUL
	DCA	DSPRL1		/ CLEAR POSITION
MAKRL1,	ISZ	DSPRL1		/ BUMP TO NEXT POSITION
	TAD	DSPRL1
	JMS	GETBYT
MAKRLA,		.-.
	SNA
	JMP I	MAKRUL		/ RETURN WHEN DONE
	TAD	(-1)
	SNA
	JMP	MAKRL1		/ IGNORE NULS
	TAD	(100)
	DCA	MAKRLC		/ SAVE VAL CODE
	TAD	DSPRL1
	RTR
	RTR			/ GEN DSPRL1
	AND	(17)
	SNA
	JMP	.+3
	TAD	(60)
	JMS I	MAKRLB		/ 1ST  HEX DIGIT
	TAD	DSPRL1
	AND	(17)
	TAD	(60)
	JMS I	MAKRLB		/ 2ND HEX DIGIT
	TAD	MAKRLC
	JMS I	MAKRLB		/ VAL CODE
	CDFMYF
	JMP	MAKRL1		/ LOOP FOR MORE
MAKRLB,	.-.
MAKRLC,	.-.

DSPRUL,	XX			/ DISPLAY RULER
	JMS	PCUR		/ POSITION CURSOR
	TAD I	DSPRUL		/ Get agument of which ruler to display./A196
	DCA	DSPRLR		/ Save it.				/A196
	ISZ	DSPRUL		/ Bump to return address.		/A196
DSPRLA,
	AC0001			/ Compute posn into string = cursor posn/A196
	TAD	CURPOS		/  ...					/A196
	JMS	GETBYT
DSPRLR,		NWRUL
	SNA
	 JMP I	DSPRUL

	JMS	GETBYT
		OKSTR		/ XLAT TO REAL CHAR
	BSW
	SMA
	IAC
	BSW			/ CONVERTS SIXBIT TO ASCII
	JMS	PUTSCH
	JMP	DSPRLA		/ RETURN IF NOT

DSPRL1,	.-.

DSPRLN,	XX
	TAD	NORUPD		/ SKIP RULER UPDATE IF IN RULER MODE
	SNA CLA
	JMS	ESNWRL

/D233	DCA	NORUPD
	JMS	DSPRUL
		NWRUL		/ Display the NEW ruler.		/A196
	JMP I	DSPRLN
				/ NORUPD must be on same page as DSPRLN/A196
NORUPD,	0			/ FLAG FOR NO RULER CHANGE IN FXSCRL

DSPCUR,	XX			/ Routine to display CURUL. Called by	/A196
	JMS	DSPRUL		/  status line.				/A196
		CURUL		/    ...				/A196
	CDIMNU			/ SET UP TO RETURN BACK TO MENU FIELD	/A220
	JMP I	DSPCUR		/ Return to caller.			/A196

EIGRAR,	OVLJMP;OVGRAR		/ GOLD RIGHT ARROW
EIGLAR,	OVLJMP;OVGLAR		/ GOLD LEFT ARROW
EISWAP,	OVLJMP;OVSWAP		/ SWAP OVERLAY

	X=.			/ INDICATE FIRST FREE LOCATION ON PAGE
/---------------
	PAGE

	DSKBLK=.%400+DLOEDT	/ DISK BLOCK WHERE PAGE IS LOADED


/ NOTE: THE GOTO-RULER CODE IN 'OVRRGO' RELIES ON THE FACT THAT
/ 'SETRUL' IS CALLED WHENEVER 'CURMOV' ADVANCES OR BACKS UP OVER
/ A RULER.  WHEN 'OVRRSC' SCROLLS TO A RULER, IT CLEARS ENTRY POINT
/ 'SETRUL', THEN CALLS 'CURMOV' UNTIL 'SETRUL' IS NONZERO,
/ INDICATING 'CURMOV' HAS PASSED OVER A RULER.


SETRUL,	XX			/ JMS SETRUL - INRTN
				/ SETS UP NWRUL
	CDFMYF
	TAD I	SETRUL
	DCA	SETRLA
	ISZ	SETRUL
	JMS	CLRULR		/ CLEAR NEW RULER
SETRLB,	DCA	RLPOSN
	JMS I	SETRLA
	AND	P177
	TAD	P7700		/ SAME AS (-100) ONLY ITS ON PAGE 0
	SMA
	JMP	SETRL3		/ CHECK FOR PARMS
	TAD	(100-60)
	SPA
	JMP	SETRL1
	MQL
	TAD	RLPOSN		/ SAVE PRM, GET POSITION
	CLL RTL
	RTL
	MQA			/ RLPOSN*16+PRM
	JMP	SETRLB		/ JUMP TO STORE, GET NEXT

SETRL1,	CLA			/ RETURN TO CALLER W/ ZEROED AC
SETRL3,	SNA
	JMP I	SETRUL		/ JUMP IF NOT VAL
	IAC
	JMS	UPDRUL
	JMP	SETRLB

SETRLA,	.-.



/++
/		UPDRUL	UPDATE_RULER
/
/ FUNCTIONAL DESCRIPTION:	UPDRUL
/
/	UPDATING OF RULER (IN NWRUL), LOCATIONS CONTAINING RULER POSITION
/	VALUES (RLSTOR THRU NWHMAR), AND DECIMAL TAB COUNT BUFFER (NWDT).
/
/  UPDRUL PSEUDO CODE:
/	COMMENTS: 1) RULER_SETTING_TYPE - EACH RULER CHARACTER (L, R, T,
/		     ...ETC.) HAS A UNIQUE TYPE ASSIGNED TO IT. (SEE CHART
/		     AT NWRUL)
/		  2) STORAGE_OFFSET_VALUE - EACH RULER CHARACTER HAS A
/		     STORAGE OFFSET VALUE (SEE XLSTR) ASSOCIATED WITH IT
/		     THAT IS USED FOR OFFSETTING FROM RLSTOR TO STORE THE
/		     POSITION OF THE RULER SETTING IN THE RULER OR IN THE
/		     CASE OF DECIMAL TABS, THE NUMBER OF THEM IN THE RULER.
/ BEGIN
/ SAVE NEW RULER_SETTING_TYPE
/ IF [NEW RULER_SETTING_TYPE IS VALID (1-16)]
/ |  GET STORAGE_OFFSET_VALUE FOR NEW RULER_SETTING_TYPE (XLSTR TABLE)
/ |  SAVE IT
/ |  GET OLD RULER_SETTING_TYPE FOR RULER POSITION WE'RE AT
/ |  GET OLD RULER SETTING STORAGE_OFFSET_VALUE
/ |  IF [OLD RULER SETTING STORAGE_OFFSET_VALUE = DECIMAL TAB STORAGE_OFFSET_VALUE]
/ |  |  SET DECIMAL TAB COUNT = DECIMAL TAB COUNT - 1
/ |  ELSE
/ |     IF [POSITION VALUE STORED FOR OLD RULER SETTING NEEDS CLEARING]
/ |	   CLEAR POSITION VALUE FOR OLD RULER SETTING
/ |
/ |  IF [POSITION VALUE FOR NEW RULER_SETTING_TYPE NEEDS UPDATING]
/ |  |  SET POINTER FOR SAVING POSITION VALUE OF NEW RULER SETTING
/ |  |  IF [NEW RULER_SETTING_TYPE = DECIMAL TAB]
/ |  |  |  SET DECIMAL TAB COUNT = DECIMAL TAB COUNT + 1
/ |  |  ELSE
/ |  |	   IF [OLD RULER_SETTING_TYPE NEEDS MODIFICATION]
/ |  |	      SET POSITION OF OLD RULER SETTING IN RULER TO NO SETTING
/ |  |	      STORE NEW RULER_SETTING_TYPE POSITION
/ |  SET [NEW RULER SETTING IN RULER]
/ |
/ RETURN
/
/ CALLING SEQUENCE:	JMS	UPDRUL
/
/ INPUT PARAMETERS:	RLPOSN = CURRENT POSITION IN RULER
/			AC = NEW RULER_SETTING_TYPE
/
/ IMPLICIT INPUT:	RLTYP, RLNSTR (T3), RLPOSN, NWDT, T2
/
/ OUTPUT PARAMETERS:	NONE
/
/ IMPLICIT OUTPUT:	RLTYP, RLNSTR (T3), NWDT, T2
/
/ COMPLETION CODE:	NONE
/
/ SIDE EFFECTS:		NONE
/
/--

RLNSTR=	T3
UPDRUL,	XX			/ UPDATE RULER
	DCA	RLTYP		/ SAVE NEW RULER_SETTING_TYPE
	CDFMYF
	TAD	RLTYP		/ GET THE TYPE OF SETTING
	TAD	(-17)		/ IS IT A VALID SETTING?
	SMA CLA			/ SKIP IF: SO
	JMP I	UPDRUL		/ IGNORE ILLEGAL SETTING
	TAD	RLTYP		/ GET STORAGE_OFFSET_VALUE FOR NEW
				/ RULER_SETTING_TYPE (XLSTR TABLE)
	JMS	GETBYT
	XLSTR
	DCA	RLNSTR		/ SAVE IT
	TAD	RLPOSN		/ GET OLD RULER_SETTING_TYPE FOR
				/ RULER POSITION WE'RE AT
	JMS	GETBYT
	NWRUL
	JMS	GETBYT
	XLSTR			/ GET OLD RULER SETTING STORAGE_OFFSET_-
				/  VALUE
	TAD	(RLSTOR-1-NWDT)	/ WAS OLD RULER SETTING STORAGE_OFFSET_-
				/  VALUE THAT OF A DECIMAL TAB?
	CDFMNU			/ A219
	SZA			/ SKIP IF: SO
	JMP	UPDRLC		/ CONTINUE ON. NO SPECIAL PROCESSING.
	AC7777			/ SET DECIMAL TAB COUNT = DECIMAL TAB
				/  COUNT - 1
	TAD	NWDT
	DCA	NWDT
	JMP	UPDRLF		/ SKIP OVER CLEARING OLD OFFSET
UPDRLC,	TAD	(NWDT+1-RLSTOR)	/ LOCATION HOLDING POSITION VALUE FOR
				/  OLD RULER SETTING NEED CLEARING?
	SNA			/ SKIP IF: NEED TO CLEAR OLD STORAGE
				/  OFFSET
	JMP	UPDRLF

	TAD	(RLSTOR-1)	/ CLEAR LOCATION HOLDING POSITION VALUE
	DCA	T2		/  FOR OLD RULER SETTING
	DCA I	T2

UPDRLF,	TAD	RLNSTR		/ DOES THE POSITION VALUE FOR THE NEW
				/  RULER_SETTING_TYPE NEED UPDATING?
	SNA			/ SKIP IF: NEED TO UPDATE
	JMP	UPDRLA
	TAD	(RLSTOR-1)	/ SET POINTER FOR SAVING POSITION VALUE
				/  OF NEW RULER SETTING
	DCA	T2
UPDRLD,	AC7776			/ NEW RULER SETTING A DECIMAL TAB?
	TAD	RLTYP
	SZA CLA			/ SKIP IF: SO
	JMP	UPDRLE		/ GO CLEAR OLD POSITION
	ISZ I	T2		/ SET DECIMAL TAB COUNT = DECIMAL TAB
				/  COUNT + 1
	JMP	UPDRLA		/ BYPASS CLEARING OUT OLD POSITION
UPDRLE,	TAD I	T2		/ DOES OLD RULER_SETTING_TYPE NEED
				/   MODIFICATION?

