	.TITLE	DIGITAL TO ANALOG CONVERSION SUBROUTINE
	.GLOBL	LSDA,LBDA,LTDA,TLDA
/
CHAN=6			/NUMBER OF AVAILABLE CHANNELS
/
/ LOAD SINGLE DAC
/ CALLING SEQUENCE:  CALL LSDA(CHANEL,VALUE,ERROR)
/	CHANEL : 0-5 CHANNEL ADDRESS
/	VALUE  : INTEGER VALUE TO BE LOADED
/	ERROR=0: NO ERROR
/	     =1: ILLEGAL CHANNEL REQUEST
/
LSDA	XX
	JMS	D2AINT
	ISZ	LSDA
	LAC*	LSDA
	DAC	CHANEL
	SPA
	LAC*	CHANEL	/INDIRECT
	DAC	CHANEL	/CHANNEL LOCATION
	ISZ	LSDA
	LAC*	LSDA
	DAC	VALUE
	SPA
	LAC*	VALUE	/INDIRECT
	DAC	VALUE	/VALUE LOCATION
	ISZ	LSDA
	LAC*	LSDA
	DAC	ERROR
	SPA
	LAC*	ERROR	/INDIRECT
	DAC	ERROR	/ERROR LOCATION
	ISZ	LSDA	/BUMP TO EXIT
	LAC*	VALUE
	LRSS	6
	LMQ		/VALUE IN MQ
	LAC*	CHANEL	/CHANNEL IN AC
	JMS	%DAC
	DAC	VALUE
	LAC	(LOSTO
	TAD*	CHANEL
	DAC	CHANEL
	LAC	VALUE	/LOAD CODED VALUE INTO
	DAC*	CHANEL	/DUMMY STATIC BUFFER
	LAC	ERR
	DAC*	ERROR
	JMP*	LSDA
	.EJECT
/
/ LOAD BANK OF DAC'S
/ CALLING SEQUENCE:  CALL LBDA(FIRST,LAST,VALUES(I),ERROR)
/	FIRST  : INITIAL CHANNEL ADDRESS 0-5
/	LAST   : TERMINAL CHANNEL ADDRESS 0-5
/	VALUES : INTEGER ARRAY DIMENSIONED 1-6
/	         VALUES(I)=VALUE TO BE LOADED INTO DAC(I-1)
/	ERROR=0: NO ERROR
/	     =1: ILLEGAL CHANNEL REQUEST
/
LBDA	XX
	JMS	D2AINT
	ISZ	LBDA
	LAC*	LBDA
	DAC	FIRST
	SPA
	LAC*	FIRST	/INDIRECT
	DAC	FIRST	/FIRST LOCATION
	ISZ	LBDA
	LAC*	LBDA
	DAC	LAST
	SPA
	LAC*	LAST	/INDIRECT
	DAC	LAST	/LAST LOCATION
	ISZ	LBDA
	LAC*	LBDA
	DAC	VALUES
	SPA
	LAC*	VALUES	/INDIRECT
	DAC	VALUES	/ARRAY POINTER
	ISZ	LBDA
	LAC*	LBDA
	DAC	ERROR
	SPA
	LAC*	ERROR	/INDIRECT
	DAC	ERROR	/ERROR LOCATION
	ISZ	LBDA	/BUMP TO EXIT
	LAC*	LAST
	SPA
	JMP	ERR1B	/LAST < 0
	TAD	(-CHAN
	SMA
	JMP	ERR1B	/LAST > CHAN-1
	LAC*	FIRST
	SPA
	JMP	ERR1B	/FIRST < 0
	DAC	FIRST	/SAVE FIRST
	TAD	(-CHAN
	SMA
	JMP	ERR1B	/FIRST > CHAN-1
	LAC	(LOSTO
	TAD	FIRST
	DAC	CHANEL	/CHANNEL POINTER
	LAC	FIRST
	TAD*	VALUES
	DAC	BANK	/BANK POINTER
LOOP	LAC*	BANK
	LRSS	6
	LMQ		/VALUES IN MQ
	LAC	FIRST	/CHANNEL IN AC
	JMS	%DAC
	DAC*	CHANEL	/LOAD DUMMY STATIC BUFFER
	LAC	FIRST
	SAD*	LAST	/LAST CHANNEL?
	JMP	EXIT1	/YES
	ISZ	BANK	/NO
	ISZ	CHANEL
	ISZ	FIRST
	LAC	FIRST
	TAD	(-CHAN
	SPA
	JMP	LOOP
	DZM	FIRST	/WRAP AROUND
	JMP	LOOP-6
EXIT1	LAC	ERR
	DAC*	ERROR
	JMP*	LBDA
ERR1B	LAC	(1
	JMP	.-3
	.EJECT
/
/ LOAD AND TRANSFER SINGLE DAC
/ CALLING SEQUENCE:  CALL LTDA(CHANEL,VALUE,ERROR)
/	CHANEL : 0-5 CHANNEL ADDRESS
/	VALUE  : INTEGER VALUE TO BE TRANSFERRED
/	ERROR=0: NO ERROR
/	     =1: ILLEGAL CHANNEL REQUEST
/
LTDA	XX
	ISZ	LTDA
	LAC*	LTDA
	DAC	CHANEL
	SPA
	LAC*	CHANEL	/INDIRECT
	DAC	CHANEL	/CHANNEL LOCATION
	ISZ	LTDA
	LAC*	LTDA
	DAC	VALUE
	SPA
	LAC*	VALUE	/INDIRECT
	DAC	VALUE	/VALUE LOCATION
	ISZ	LTDA
	LAC*	LTDA
	DAC	ERROR
	SPA
	LAC*	ERROR	/INDIRECT
	DAC	ERROR	/ERROR LOCATION
	ISZ	LTDA	/BUMP TO EXIT
	LAC*	VALUE
	LRSS	6
	LMQ		/VALUE IN MQ
	LAC*	CHANEL	/CHANNEL IN AC
	JMS	%DAC
	CLDC		/TRANSFER LOADED DAC
	LAC	ERR
	DAC*	ERROR	/LOAD ERROR
	JMP*	LTDA
CLDC=705403
	.EJECT
/
/ TRANSFER LOADED DAC'S
/ CALLING SEQUENCE:  CALL TLDA
/
TLDA	XX
	LAC	(-CHAN
	DAC	N	/SET UP CHANNEL COUNTER
	LAC	(LOSTO
	DAC	CHANEL	/CHANEL POINTER
AGN	LAC*	CHANEL
	CLDC		/TRANSFER DAC
	ISZ	CHANEL
	ISZ	N
	JMP	AGN
	JMP*	TLDA
CLDC=705403
	.EJECT
/
/ LOAD A DAC
/ CALLING SEQUENCE:  JMS %DAC
/	AC= 0-5 CHANNEL ADDRESS
/	MQ= INTEGER VALUE TO BE LOADED
/ EXIT: AC =CODED ADDRESS AND VALUE
/       ERR=0: NO ERROR
/	 =1: ILLEGAL CHANNEL REQUEST
/
%DAC	XX
	DZM	ERR
	TAD	(-CHAN
	SMA
	JMP	ERR1C	/CHANNEL > CHAN-1
	TAD	(CHAN
	SPA
	JMP	ERR1C	/CHANNEL < 0
	RCR
	RTR		/SHIFT CHANNEL INTO AC0-5
	RTR
	RTR
	DAC	ADDR
	LACQ		/LOAD VALUE
	TAD	(4000	/SCALE FACTOR
	AND	(7777	/WIPE OFF GARBAGE
	XOR	ADDR
	JMP*	%DAC
ERR1C	LAC	(1
	DAC	ERR
	JMP*	%DAC
/
/ INITIALIZE DUMMY STATIC BUFFER
/ CALLING SEQUENCE:  JMS D2AINT
/
D2AINT	XX
REPLCE	LAC	(-CHAN
	DAC	N	/SET UP CHANNEL COUNTER
	LAC	(LOSTO
	DAC	M	/SET M POINTER
	CLQ
	CLA
	DAC	CNTR	/SET CHANNEL INDICATOR
MORE	JMS	%DAC
	DAC*	M
	ISZ	M
	ISZ	CNTR
	LAC	CNTR
	ISZ	N
	JMP	MORE
	LAC	(JMP	.+2
	DAC	REPLCE	/ONLY INITIALIZE ONCE
	JMP*	D2AINT
/
CHANEL;VALUE;ERROR;ERR;FIRST;LAST;VALUES;BANK;N;M;CNTR;ADDR;TEMP
/
LOSTO	.BLOCK	CHAN
/
	.END
