	.TITLE RBCD - READ BCD CONTACT SENSE MODULE.
/ 
/ 
/                   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.
/EDIT 002 10-14-71	W.A. DESIMONE.
/CALLING SEQUENCE:	CALL RBCD(LUN,IMN,IMD,IEV)
/	JMS*	RBCD
/	JMP	.+5	/SUBR. RETURN.
/	ADDR OF LUN
/	ADDR OF MODULE NO.	(LOWEST=1)
/	ADDR OF MODULE DATA	(RETURNED IN BCD)
/	ADDR. OF EV.		(OPTIONAL)
/	NEXT INSTRUCTION.
/
/RBCD(LUN,IMN,IMD,IEV) - READ INDICATED CONTACT SENSE MODULE (IMN)
/VIA LOGICAL UNIT #=LUN.  RETURN MODULE DATA IN BCD IN IMD.  EV
/ARGUMENT OPTIONAL.
/
/REGISTER DEFINITIONS*
X10=10			/AUTO-INCR. 10.
/
	.EJECT
	.GLOBL RBCD,.DA
RBCD	0		/SUBR. ENTRY.
	JMS*	.DA
	JMP	ARGEND
LUN	0	/ADDR. OF LUN.
MN	0		/ADDR. OF MODULE NO.
MD	0		/ADDR OF MODULE DATA.
EV	0		/ADDR. OF EV. (OPTIONAL)
ARGEND	LAC*	LUN	/LUN TO CPB.
	DAC	CPB2
	LAC*	MN	/MODULE #-1 TO CPB.
	AAC	-1
	DAC	CPB3
	LAC	(R)	/LOCAL TO MODULE DATA ADDR.
	DAC	CPB4	/TO CPB.
	LAC	EV	/EV ADDR. TO CPB.
	DAC	CPB1
	DAC	CPBWF1	/ALSO TO WAITFOR CPB.
	CAL	RD	/READ CONTACT SENSE AND WAITFOR IN ORDER TO 
	CAL	WF	/PROCESS. (DATA TO BCD).
	.EJECT
	LAC	R	/CONVERT DATA IN BITS 2-17 TO BCD.
	AND	(17)	/MASK LO DIGIT.
	DAC	SUM	/INIT. SUM FOR CONVERSION.
	LAW	-3	/SET CNT.  USE EV.  CNT OVERFLOW WILL INIT. EV.
	DAC	EV
	LAC	(B10-1)	/PTR. TO TABLE OF PLACE VALUES.
	DAC*	(X10)	/TO AUTO-INCR. 10.
LOOP	LAC	R	/GET NEXT DIGIT.
	LRS	+4
	DAC	R	/SAVE FOR NEXT ITER.
	AND	(17)	/MASK.
	DAC	F1	/SET ONE FACTOR IN-LINE FOR MUL.
	LAC*	X10	/GET PLACE VALUE AS OTHER FACTOR.
	CLL		/CLEAR LINK FOR MUL.
	MUL		/MULTIPLY.
F1	XX		/RESULT IN MQ.
	LACQ
	TAD	SUM	/BUILD SUM.
	DAC	SUM	/AAVE FOR NEXT INTER.
	ISZ	EV	/BUMP CNT.
	JMP	LOOP	/NOT DONE.  LOOP.
	DAC*	MD	/TO CALLER.  DONE.
	JMP*	RBCD	/EXIT
	.DEC
B10	10
	100
	1000
	.OCT
/CAL PARAM. BLKS.
/
/READ CONTACT SENSE PARAM. BLK.
RD	7400		/FUNCT. CODE.
CPB1	0		/EV VAR. ADDR.
CPB2	0		/LUN.
CPB3	0		/MODULE # (LOWEST=0)
CPB4	0		/MODULE DATA (BITS 2-17)
/
/WAITFOR CAL PARAM. BLK.
WF	20		/FUNCTION CODE.
CPBWF1	0		/EV ADDR.
/
/TEMPS.
R	0	/FOR MODULE DATA.
SUM	0	/SUM FOR BCD CONVERSION.
	.END
