	TTL	PRINT, BCD PRINT ROUTINE
* PRINT , BCD PRINT ROUTINE
*
* CALLING SEQUENCE:
*
*	TSX	PRINT,4
*	PZE	,,SPRX
*	PZE	WC,,COL		PRINT CONTROL WORD
*	BCI	WC,TEXT TO BE PRINTED
*
* WC = WORD COUNT OF TEXT
* COL = COLUMN WHERE TEXT IS TO BE PRINTED
* CW = CONTROL WORD ADDRESS
*
* PRINTER CONTROL WORD
* BITS IN THE DECREMENT OF THE TSX SENSE PRINTER
*
*	BIT	SPRX		OPERATION
*	17	1		SKIP TO LINE ON NEXT PAGE
*	16	3		DOUBLE SPACE
*	15	4		OCTAL SPACE RIGHT HALF
*	14	9		RIGHT SIDE 1-48 TO 73-120
*	13	2+7		SPACE AFTER PRINT
*
	EJECT
	ENTRY	PRINT
*
PRINT	EQU	*		STANDARD ENTRY
	SXA	BAK,4		SAVE RETURN ADDRESS
	WPRA			SELECT PRINTER
	LDI	0,4		GET CW IN INDICATORS
	LFT	000001		SKIP?
	SPRA	1		YES, SKIP TO LINE 1
	LFT	000002		DBL SPACE?
	SPRA	3		YES
	LFT	000004		OCTAL SPACE RIGHT?
	SPRA	4		YES
	LNT	000010		PRINT 73-120?
	TRA	*+3		NO
	SPRA	9		PRINT RIGHT HALF
	NOP
	NZT	1,4		CW EQUAL ZERO?
	TRA	BAK		YES, RETURN
	CAL	1,4		GET CW
	SLW	CTLWD		 AND SAVE
	PDX	0,1		SET TYPE WHEEL NUMBER
* SET BIT INDEX TO STARTING WHEEL
	SXA	*+3,1		ALIGN
	AXT	1,3		 DYNAMIC
	CAL	INDXA		  INDEX
	LGR	0,1		   BIT
	TNZ	*+3		    WITH
	STQ	INDEX		     ASSIGNED
	TXI	*+2,2,1		      TYPE
	SLW	INDEX	               WHEEL
* CLEAR IMAGE
	AXT	26,1		CLEAR
	STZ	IMAGE+26,1	 IMAGE
	TIX	*-1,1,1
* FORM IMAGE
	TIX	*+1,4,1
	AXT	6,1		CHARS PER WORD
	LDQ	1,4		GET BCD WORD
LOOP	SXA	LOOPD+6,1	SAVE CURRENT COUNT
	PXD	,0		CLEAR AC
	LGL	2		DBL
	ALS	1		 ZONE
	PAX	,1
	SXA	*+12,1		RESERVE ZONE COUNT
	CLM
	LGL	4		DBL
	ALS	1		 DIGIT
	SLW	IMAGE		RESERVE CHAR
	CAL	INDEX		L COLUMN BIT
	NZT	IMAGE		2S NUMERIC ZERO
	TXH	LOOPE,1,0	YES, IS ZONE ZERO TOO?
	LXA	IMAGE,1		YES, PROCEED
	TXH	LOOPD,1,24	XFER IF ILL CHAR
	TXH	LOOPE2,1,20	XFER IF SPECIAL CHAR
LOOPB	ORS*	ROWAD+6,2	XR PICKS LEFT OR RIGHT
	AXT	0,1		L ZONE AGAIN
	TXL	*+2,1,0		XFER IF ZERO
LOOPC	ORS*	ROWAD+4,2	PLACE ZONE BIT
* COLUMN SET
LOOPD	ARS	1		SET BIT INDEX TO NEXT
	TNZ	*+4		 COLUMN, IF ANY
	TXH	*+10,2,1	XR2 0 AND XR1 1, STOP
	CAL	INDXA		IF NOT, SET TO RIGHT
	TXI	*+1,2,1		 ROW AND PROCEED
	SLW	INDEX		SET FOR NEXT COLUMN
	AXT	0,1		MORE CHARS
	TIX	LOOP,1,1	 TO NEXT COLUMN
	LXA	CTLWD,1		LOOK FOR MORE WORDS
	TNX	*+3,1,1		XFER IF NO MORE
	SXA	CTLWD,1		YES
	TXI	LOOP-3
	RCHA	CHCMD
	LCHA	CHCMD+1
	LNT	000020		SPACE AFTER PRINT?
	TRA	BAK		NO
	SPRA	2		YES, SPACE PRINT
	SPRA	7
BAK	AXT	*-*,4		RETURN ADDRESS
	CLA	1,4		ADJUST
	STA	RTRN		 EXIT
	ARS	18		  ADDRESS
	TNZ	*+2		   FOR
	STA	RTRN		    RETURN
	TIX	*+1,4,2
	SXA	*+1,4
	AXT	*-*,4		RETURN ADDRESS
RTRN	TRA	*-*,4		RETURN
*
LOOPE2  ORS*	ROWAD+2,2	SET SPECIAL
	TIX	LOOPB,1,16	 CHARACTER
LOOPE	TXL	LOOPC,1,4	  ZONE, UNLESS
	TRA	LOOPD		   IT IS A BLANK
*
INDXA	MZE	0
INDEX	PZE	0
CHCMD	IOCT	IMAGE+2,,2
	IOCD	IMAGE+4,,22
CTLWD	PZE	0
ROWAD	PZE	IMAGE+5
	PZE	IMAGE+4
	PZE	IMAGE+27,1
	PZE	IMAGE+26,1
	PZE	IMAGE+21,1
	PZE	IMAGE+20,1
IMAGE	BSS	26
	END
