/
/ COPYRIGHT (C) 1975
/ DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
/
/ THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY
/ ON A SINGLE COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH
/ THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS
/ SOFTWARE, OR ANY OTHER COPIES THEREOF, MAY NOT BE PRO-
/ VIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON
/ EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO
/ THESE LICENSE TERMS.  TITLE TO AND OWNERSHIP OF THE
/ SOFTWARE SHALL AT ALL TIMES REMAIN IN DEC.
/
/ THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE
/ WITHOUT NOTICE AND SHOULD NOT BE CONSTRUED AS A COM-
/ MITMENT BY DIGITAL EQUIPMENT CORPORATION.
/
/ DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY
/ OF ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY
/ DEC.
/
	.EJECT
/
/ EDIT #1	M. HEBENSTREIT		12/15/75
/
/ GDNUM: READ A DECIMAL INTEGER AND CHECK THAT ITS WITHI
/ LIMITS. THEN PUT IT INTO THE IFLAG VECTOR
/
	.GLOBL	GDNUM,FAC57,SET57
BASE	.CBD	.XX 200
OFF.FI=3
OFF.IF=35
OFF.FL=4
GDNUM	0
READIT	LAW	-6		/INIT CHAR COUNT
	DZM	NUM		/CLEAR OUT OLD RESULTS
	DAC	COUNT
	.READ	13,2,BUFF,6
	.WAIT	13
	JMS*	SET57		/INIT UNPACKING ROUTINE
	BUFF
LOC1	JMS*	FAC57		/GET A CHAR
	DAC	TEMP		/SAVE CHAR
	SAD	(15		/IS IT A TERM?
	JMP	TERM		/YES
	SAD	(175
	JMP	TERM		/YES
	AAC	-60		/NO -- IS IT A DIGIT?
	SPA
	JMP	ERR
	LAC	TEMP
	AAC	-72
	SMA
	JMP	ERR		/NO
	LAC	TEMP		/YES -- GET DIGIT
	AND	(17
	DAC	DIGIT
	LAC	NUM		/GET OLD RESULTS
	CLL
	MUL			/MULTIPLY BY 10
	12
	LACQ
	TAD	DIGIT		/ADD IN DIGIT
	DAC	NUM		/SAVE NEW RESULT
	ISZ	COUNT		/ALL CONE WITH 6 DIGITS?
	JMP	LOC1		/NO -- GET ANOTHER
TERM	LAC	COUNT
	SAD	(-6		/HAS ANY DIGIT BEEN READ?
	JMP	ERR		/NO -- ERROR
	LAC	BASE		/YES -- GET BASE OF COMMON
	AAC	OFF.FI		/GET LIMITS
	DAC	TEMP
	LAC*	TEMP
	LMQ
	CLA
	LLS	6
	DAC	LOLMT
	CLA
	LLS	14
	DAC	HILMT
	LAC	LOLMT
	TCA
	TAD	NUM		/IS NUMBER WITHIN LIMITS?
	SPA!SNA
	JMP	ERR		/NO
	LAC	NUM
	TCA
	TAD	HILMT
	SPA
	JMP	ERR	/NO
	LAC	BASE		/YES
	AAC	OFF.FL
	DAC	TEMP
	LAC*	TEMP
	TAD	BASE
	AAC	OFF.IF
	AAC	-1
	DAC	TEMP
	LAC	NUM
	DAC*	TEMP
	JMP*	GDNUM
/
ERR	.WRITE	12,2,ERRMSG,6
	.WAIT	12
	JMP	READIT
ERRMSG	COUNT-ERRMSG/2*1000+2
	0
	.ASCII "WHAT?"<175>
COUNT	0
TEMP	0
NUM	0
DIGIT	0
LOLMT	0
HILMT	0
BUFF	.BLOCK 20
	.END
