	.TITLE	%DVM
/
/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
/
	.GLOBL %BCDB,%DVM
/
%DVM	XX
	JMS WAIT
	IOT3
	JMP .-1
	CDVM
	JMS WAIT
	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
WAIT	0
	LAC (-3500	/SET FAIL-SAFE=
	DAC FAIL		/50 MILLISECONDS
LOOP	IOT3
	JMP .-1
	RSW		/READ STATUS WORD
	AND (000004
	SNA
	JMP OUT		/DVM NOT BUSY
	JMS FAULT 	/DVM BUSY
	ISZ FAIL
	JMP LOOP
	LAC (4		/HARD. MALFUNCTION
	JMP* %DVM
OUT	JMS FAULT 	/CHECK FAULT WORD
	JMP* WAIT
FAIL
NUMBER
IOT3=703003
RSW=703613
CDVM=703626
RDVM=705113
RFW=705313
	.END
