/READ DVM - INTERNAL SUBROUTINE
/EXECUTION TIME: DEVICE LIMITED
/CALLING SEQUENCE: JMS* %DVM
/EXIT: AC=0 NO ERROR
/      AC=4: HARDWARE MALFUNCTION
/      AC=5: DVM OVERRANGE (DVM>1.1799)
/      MQ=UNNORMALIZED INTEGER VALUE 
/         IF AC=0
/      MQ=UNDEFINED IF AC=4 OR 5
	.TITLE %DVM
	.GLOBL %BCDB,%DVM
%DVM	0
	IOT3
	JMP	.-1
	DVMC
	.DEC
	LAC	(-10000
	.OCT
	DAC FAIL    /SET FAIL-SAFE=
	            /36.25 MILLISECONDS
LOOP	IOT3
	JMP .-1
	RSW         /READ STATUS WORD
	AND (000004
	SNA
	JMP .+6     /DVM NOT BUSY
	JMS FAULT   /DVM BUSY
	ISZ FAIL
	JMP LOOP
	LAC (4      /HARD. MALFUNCTION
	JMP* %DVM
OUT	JMS FAULT   /CHECK FAULT WORD
	IOT3
	JMP .-1
	RDVM        /READ DVM DATA
	DAC FAIL    /SAVE BCD SIGN
	RTR
	JMS* %BCDB  /CONVERT TO 
	            /UNSIGNED BINARY
	DAC NUMBER  /SAVE UNSIGNED
	            /BINARY VALUE
	LAC FAIL
	RTR
	LAC NUMBER
	SNL
	JMP .+3
	CMA
	TAD (1      /NEGATIVE SIGN
	            /-COMPLEMENT VALUE
	LMQ         /MQ=OUTPUT VALUE
	CLA
	JMP* %DVM
FAULT	0
	IOT3
	JMP .-1
	RFW         /READ FAULT WORD
	AND (004000
	SNA!CLL
	JMP* FAULT
ERROR5	LAC (5      /DVM OVERRANGE
	JMP* %DVM
FAIL
NUMBER
IOT3=703003
RSW=703613
DVMC=703626
RDVM=705113
RFW=705313
	.END
