/SELECT ANALOG COMPONENT ADDRESS
/     -INTERNAL SUBROUTINE
/EXECUTION TIME: DEVICE  LIMITED
/CALLING SEQUENCE: JMS* %SACO
/     COMPONENT TYPE IN AC
/     COMPONENT ADDRESS IN MQ
/EXIT:  AC=0: NO ERROR
/        AC=1: ILL. TYPE OR ADDRESS REQ.
/        AC=2: TYPE AND/OR ADDRESS
/              FAILED TO SET PROPERLY
/        AC=4: HARDWARE MALFUNCTION
/        AC=7: KEYBOARD INTERFERENCE
/              %SACO CANNOT PROCEED
	.TITLE %SACO
	.GLOBL %BBCD,%SACO
%SACO	0
	CLL!RAR
	RTR
	RTR
	DAC ADRESS  /SAVE COMPONENT TYPE
	AND (437777
	SZA
	JMP ERROR1  /TYPE<0 OR TYPE>7
	LACQ
	SPA
	JMP ERROR1  /ADDRESS<0
	.DEC
	TAD (-120
	.OCT
	SMA
	JMP ERROR1  /ADDRESS>119
	LACQ
	JMS* %BBCD  /CONVERT PATCHBOARD
	            /ADDRESS TO BCD
	TAD ADRESS
	DAC ADRESS  /SAVE FULL COMPONENT
	            /ADDRESS
	IOT3
	JMP .-1
	RSW         /READ STATUS WORD
	AND (10
	SZA
	JMP ERROR7  /POT SET BUSY
	LAC ADRESS
	IOT3
	JMP .-1
	SAA         /SELECT ANALOG
	            /COMPONENT ADDRESS
	.DEC
	LAC	(-10000
	.OCT
	DAC FAIL    /SET FAIL-SAFE=
	            /100.352 MILLISECONDS
LOOP	IOT3
	JMP .-1
	RSW         /READ STATUS WORD
	AND (100
	SNA
	JMP .+5     /ADDRESS SET
	ISZ FAIL    /ADDRESS STILL BUSY
	JMP LOOP
	LAC (4      /HARD. MALFUNCTION
	JMP* %SACO
	IOT3
	JMP .-1
	RAA         /READ ANALOG
	            /COMPONENT ADDRESS
	SAD ADRESS
	JMP .+3     /NO ERRORS
	LAC (2      /NOT SET PROPERLY
	JMP* %SACO
	CLA
	JMP* %SACO
ERROR1	LAC (1      /ILLEGAL TYPE OR
	            /ADDRESS REQUESTED
	JMP* %SACO
ERROR7	LAC (7      /KEYBOARD
		/INTERFERENCE
	JMP* %SACO
ADRESS
FAIL
IOT3=703003
RSW=703613
SAA=703406
RAA=703413
	.END
