	.TITLE ADRMAP - AD15 RANDOM INPUT STATUS MAP.
/ 
/ 
/                   FIRST PRINTING, FEBRUARY 1974
/ 
/ THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO 
/ CHANGE WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED
/ AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION.
/ DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPON-
/ SIBILITY FOR ANY ERRORS THAT MAY APPEAR IN THIS
/ DOCUMENT.
/ 
/ THE SOFTWARE DESCRIBED IN THIS DOCUMENT IS FUR-
/ NISHED TO THE PURCHASER UNDER A LICENSE FOR USE ON
/ A SINGLE COMPUTER SYSTEM AND CAN BE COPIED (WITH
/ INCLUSION OF DIGITAL'S COPYRIGHT NOTICE) ONLY FOR 
/ USE IN SUCH SYSTEM, EXCEPT AS MAY OTHERWISE BE PRO-
/ VIDED IN WRITING BY DIGITAL.
/ 
/ DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY
/ FOR THE USE OR RELIABILITY OF ITS SOFTWARE ON EQUIP-
/ MENT THAT IS NOT SUPPLIED BY DIGITAL.
/ 
/ COPYRIGHT (C) 1974, BY DIGITAL EQUIPMENT CORPORATION
/ 
/ 
        .EJECT
/COPYRIGHT 1971, DIGITAL EQUIPMENT CORP.,MAYNARD, MASS.
/W.A. DESIMONE
/EDIT 002  11-18-71
/
/CALLING SEQUENCE:	CALL ADRMAP(ISTE,IG,ICH,IERR,IATM,IESYN,IMOV)
/	JMS* ADRMAP
/	JMP .+10
/	ADDR OF INPUT STATUS
/	ADDR OF GAIN		/1,2,4,OR 8 (10)
/	ADDR OF CHANNEL #	/1 - 128(10)
/	ADDR OF ERROR PARAMETER	/-1 RETURNED IF ERROR(BAD CHL OR GAIN).
/				/0 RETURNED IF NO ERROR.
/	ADDR OF ADD-TO-MEM. PARAM.	/SET = NON-ZERO
/	ADDR OF EXT. SYNC. PARAM.	/SET = NON-ZERO
/	ADDR OF MEM. OVFL. PARAM.	/SET = ZERO.
/	NEXT INSTRUCTION.
/
/LAST THREE ARGUMENTS ARE OPTIONAL AND ASSUMED 0 IF NOT SPEC.
/
/ADRMAP(ISTE,IG,ICH,IERR,IATM,IESYN,IMOV) - MAP AD15 I/O PARAMETERS
/INTO AD15 INPUT STATUS BIT ASSIGNMENTS AND RETURN AS ISTE.  IF IERR
/IS RETURNED NEG., ERROR IN IG OR ICH SPECIFIED.  IATM,IESYN AND
/IMOV ARGUMENTS ARE ASSUMED 0 IF NOT SPECIFIED.
/
	.EJECT
	.GLOBL ADRMAP,.DA
/
ADRMAP	0		/SUBR. ENTRY.
	JMS*	.DA
	JMP	ARGEND
STE	0		/ADDR OF INPUT STATUS ELEMENT.
G	0		/ADDR. OF GAIN (1,2,4,OR 8)
CH	0		/ADDR. OF CHANNEL # (1- 128)
ERR	0		/ADDR. OF ERROR VAR. (NEG OF ERROR)
ATM	0		/ADDR. OF ADD-TO-MEM. PARAM. (OPTIONAL)
ESYN	0		/ADDR. OF EXT. SYNC. PARAM. (OPTIONAL)
MOV	0		/ADDR. OF MEM. OVF. PARAM. (OPTIONAL)
ARGEND	LAC*	G	/CHECK GAIN FOR 1,2,4,OR 8.  RETURN NEG
	SAD	(1)	/ERR VAL IF NOT ONE OF THESE.
	JMP	G0
	SAD	(2)
	JMP	G1
	SAD	(4)
	JMP	G2
	SAD	(10)
	JMP	G3
ADERR	CLC
	DAC*	ERR	/SET USERS ERROR VAR. NEG.
EXIT	DZM	ATM	/INIT OPTIONAL ARGUMENTS
	DZM	ESYN
	DZM	MOV
	LAC	(6000)	/BITS 6,7 SET FOR DEFAULT(6=MEM. OVFL.,7=DCH MODE)
	DAC	ISB	
	JMP*	ADRMAP	/EXIT.
/GAIN TABLE.
GTB	0		/GAIN=1
	200000		/GAIN=2
	400000		/GAIN=4
	600000		/GAIN=8
/
/TEMP. STORAGE.
GBP	GTB		/GAIN TABLE POINTER.
TCH	0		/TEMP. FOR CHANNEL NO.
ISB	6000		/TEMP. FOR INPUT STATUS BUILD.
/
G3	ISZ	GBP	/8 TO 3 MAPPING.
G2	ISZ	GBP	/4 TO 2 MAPPING.
G1	ISZ	GBP	/2 TO 1 MAPPING
G0	LAC*	GBP	/1 TO 0 MAPPING.
	XOR	ISB
	DAC	ISB	/BUILD INPUT STATUS
	LAC	(GTB)	/REINIT. POINTER TO GAIN TABLE.
	DAC	GBP
	LAC*	CH	/GET CHANNEL # AND CHECK TO SEE IF VALID.
	AAC	-1	/MINUS 1 FOR AD15 HARDWARE.
	DAC	TCH	/SAVE IN CASE OK.
	AND	(776000)
	SZA		/IF ZERO OK.  (0-177(8)).
	JMP	ADERR	/ERROR.
/GET PARAMETERS AND SET STE APPROP. FOR RETURN.
	LAC	ATM		/ADD TO MEM PARAM.?
	SNA
	JMP	NP1		/NO.  ASSUME OFF.  GET NXT PARAM.
	LAC*	ATM		/YES.  IF NON-ZERO, SET BIT 9.
	SZA
	LAC	(400)		/BIT 9.
	XOR	ISB		/BUILD INPUT STATUS AS WE GO.
	DAC	ISB
NP1	LAC	ESYN		/EXT. SYNC PARAM.?
	SNA			
	JMP	NP2		/NO.  ASSUME OFF.  GET NXT. PARAM.
	LAC*	ESYN		/YES. IF NON-ZERO,SET EXTERNAL.
	SZA
	LAC	(1000)		/BIT 8.
	XOR	ISB
	DAC	ISB
NP2	LAC	MOV		/MEM. OVFL. PARAM.?
	SNA
	JMP	NP3		/IF NOT SPEC.,ASSUME ENABLED.
	LAC*	MOV		/YES.  IF NON-ZERO,DISABLE.
	SZA
	LAC	(4000)		/OR OFF BIT 6
NP3	XOR	ISB
	XOR	TCH	/CHANNEL NO.
	DAC	ISB
	DAC*	STE	/TO USER.
	JMP	EXIT
	.END
