FLOAT	MACRO M1110  21-AUG-78 22:18

TABLE OF CONTENTS



    32-    3	FLOATING POINT ACCUMULATION ROUTINE

    33-  217	FLOATING POINT DATA GENERATION

FLOAT	MACRO M1110  21-AUG-78 22:18  PAGE 26





      1						.IDENT	\X03.11\

      2					;

      3					; COPYRIGHT (C) 1977, 1978

      4					; DIGITAL EQUIPMENT CORPORATION, MAYNARD MASSACHUSETTS 01754

      5					;

      6					; THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ON A SINGLE

      7					; COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH THE INCLUSION OF THE

      8					; ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE, OR ANY OTHER COPIES THEREOF,

      9					; MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON

     10					; EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO THESE LICENSE

     11					; TERMS.  TITLE TO AND OWNERSHIP OF THE SOFTWARE SHALL AT ALL TIMES

     12					; REMAIN IN DEC.

     13					;

     14					; THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE

     15					; AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT

     16					; CORPORATION.

     17					;

     18					; DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS

     19					; SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.

     20					;

     21

     22					;++

     23					; FACILITY:	VAX-11 MACRO OBJECT MODULE LIBRARY "MAR.OLB"

     24					;

     25					; ABSTRACT:	THIS MODULE IS PART OF THE VAX-11 MACRO ASSEMBLER, ITS DESCRIPTION

     26					;		IS ON THE FOLLOWING PAGE.

     27					;

     28					;

     29					; ENVIRNOMENT:	VAX-11 MACRO RUNS ON ANY VAX-11 WITH COMPATIBILITY MODE, UNDER

     30					;		THE CME (COMPATIBILITY MODE EMULATOR) OF VAX/VMS OR ON A PDP-11

     31					;		WITH EXTENDED INSTRUCTIONS UNDER RSX-11/M.

     32					;

     33					; AUTHOR:	STEVE POULSEN, CREATION DATE:  22-JUL-76

     34					;		DALE A. ROEDGER, 10-JAN-77 - 19-DEC-77

     35					;		DAVE N. CUTLER

     36					;		BENN L. SCHREIBER

     37					;

     38					; MODIFIED BY:

     39					;

     40					;--

     41					.IF NDF $DATA$

FLOAT	MACRO M1110  21-AUG-78 22:18  PAGE 32





      1						.TITLE	FLOAT

      2	000000					.PSECT	FLOAT

      3						.SBTTL	FLOATING POINT ACCUMULATION ROUTINE

      4					;

      5					;

      6					; THESE UGLY ROUTINES ACCUMULATE 64 BIT FLOATING POINT NUMBERS.

      7					; THESE ROUTINES WERE STOLEN FROM THE MACRO-11 ROUTINES FLT4, AND FLT2.

      8					;

      9					;			(UGH!)

     10					;

     11					;

     12						.ENABL	LSB

     13

     14	000000				FLTPNT::				; ACCUMULATE FLOATING POINT NUMBER

     15	000000	012700 	000000G			MOV	#DINTEGER,R0		; MARK AS NUMBER

     16	000004					SAVAL				; SAVE R0 THRU R5

     17	000010	016746 	000000G			MOV	LINEPT,-(SP)	;STACK CURRENT CHARACTER POINTER

     18	000014	012703 	000000G			MOV	#FLTBUF,R3	;CONVENIENT COPY OF POINTERS

     19	000020	012704 	000000G			MOV	#FLTSAV,R4	;  TO BUFFER AND SAVE AREA

     20	000024	010401 				MOV	R4,R1

     21	000026	005041 			1$:	CLR	-(R1)		;INIT VARIABLES

     22	000030	020127 	000000G			CMP	R1,#FLTBEG

     23	000034	101374 				BHI	1$		;LOOP UNTIL DONE

     24	000036	012767 	000101 	000000G		MOV	#65.,FLTBEX	;INIT BINARY EXPONENT

     25	000044	016705 	000000G			MOV	CHAR,R5		; GET CURRENT CHAR

     26	000050	022705 	000053 			CMP	#'+,R5		;  "+"?

     27	000054	001406 				BEQ	10$		;  YES, BYPASS AND IGNORE

     28	000056	022705 	000055 			CMP	#'-,R5		; "-"?

     29	000062	001006 				BNE	11$		;  NO

     30	000064	012767 	100000 	000000G		MOV	#100000,FLTSGN	;YES, SET SIGN AND BYPASS CHAR

     31	000072				10$:	CALL	GETCHR		; GET NEXT CHARACTER

     32	000076	010005 				MOV	R0,R5		; PUT INTO R5

     33	000100	020527 	000060 		11$:	CMP	R5,#'0		; NUMERIC?

     34	000104	103431 				BLO	20$		; NO

     35	000106	020527 	000071 			CMP	R5,#'9		; NUMERIC?

     36	000112	101026 				BHI	20$		; NO

     37	000114	032713 	174000 			BIT	#174000,(R3)	;NUMERIC, ROOM FOR MULTIPLICATION?

     38	000120	001403 				BEQ	12$		;  YES

     39	000122	005267 	000000G			INC	FLTEXP		;NO, COMPENSATE FOR THE SNUB

     40	000126	000413 				BR	13$

     41	000130				12$:	CALL	FLTM50		;MULTIPLY BY 5

     42	000134					CALL	FLTGLS		;CORRECTION, MAKE THAT *10

     43	000140	162705 	000060 			SUB	#'0,R5		;MAKE ABSOLUTE

     44	000144	010402 				MOV	R4,R2		;POINT TO END OF BUFFER

     45	000146	060542 				ADD	R5,-(R2)	;ADD IN

     46	000150	005542 				ADC	-(R2)		;RIPPLE CARRY

     47	000152	005542 				ADC	-(R2)

     48	000154	005542 				ADC	-(R2)

     49	000156	066767 	000000G	000000G	13$:	ADD	FLTDOT,FLTEXP	;DECREMENT IF PROCESSING FRACTION

     50	000164	005016 				CLR	(SP)		;CLEAR INITIAL CHAR POINTER (WE'RE GOOD)

     51	000166	000741 				BR	10$		;TRY FOR MORE

     52	000170	022705 	000056 		20$:	CMP	#'.,R5		;DECIMAL POINT?

     53	000174	001003 				BNE	21$		;  NO

     54	000176	005167 	000000G			COM	FLTDOT		;YES, MARK IT

     55	000202	100733 				BMI	10$		;LOOP IF FIRST TIME AROUND

     56	000204	022705 	000105 		21$:	CMP	#'E,R5		;EXPONENT?

     57	000210	001062 				BNE	FLTG3		;  NO

FLOAT	MACRO M1110  21-AUG-78 22:18  PAGE 32-1

FLOATING POINT ACCUMULATION ROUTINE



     58	000212					CALL	GETCHR		; GET NEXT CHAR

     59	000216					SPNOR			; SKIP BLANKS

     60	000222	016700 	000000G			MOV	CHAR,R0		; GET BACK THE CHAR

     61	000226	005046 				CLR	-(SP)		; ASSUME POSITIVE EXPONENT

     62	000230	020027 	000053 			CMP	R0,#'+		; PLUS?

     63	000234	001003 				BNE	50$		; NO

     64	000236					CALL	GETCHR		; YES, SKIP OVER IT

     65	000242	000406 				BR	51$		; AND CONTINUE

     66	000244	020027 	000055 		50$:	CMP	R0,#'-		; NEGATIVE?

     67	000250	001007 				BNE	52$		; NO

     68	000252	005116 				COM	(SP)		; YES, SET FLAG

     69	000254					CALL	GETCHR		; SKIP OVER CHAR

     70	000260				51$:	SPNOR			; IGNORE BLANKS

     71	000264	016700 	000000G			MOV	CHAR,R0		; GET BACK CHAR

     72	000270				52$:	PUSH	R1		; SAVE REG

     73	000272	020027 	000060 			CMP	R0,#'0		; REALLY NUMBER?

     74	000276	103403 				BLO	60$		; NO

     75	000300	020027 	000071 			CMP	R0,#'9		; UPPER BOUND?

     76	000304	101410 				BLOS	61$		; IS OK

     77	000306				60$:	OUT	#I.ERR,<#ILGFPT,LINEPT>	; BAD SYNTAX

     78	000326				61$:	CALL	DNUMBER		; GET DECIMAL NUMBER

     79	000332					POP	R1		; RESTORE CLOBBERED REG

     80	000334	005726 				TST	(SP)+		; GET SIGN OF EXPONENT

     81	000336	001404 				BEQ	53$		; POSITIVE

     82	000340	166767 	000000G	000000G		SUB	VAL1,FLTEXP	; NEGATIVE

     83	000346	000403 				BR	FLTG3

     84	000350	066767 	000000G	000000G	53$:	ADD	VAL1,FLTEXP	; POSITIVE

     85						.DSABL	LSB

     86	000356	010301 			FLTG3:	MOV	R3,R1

     87	000360	012100 				MOV	(R1)+,R0	;TEST FOR ZERO

     88	000362	052100 				BIS	(R1)+,R0

     89	000364	052100 				BIS	(R1)+,R0

     90	000366	052100 				BIS	(R1)+,R0

     91	000370	001557 				BEQ	FLTGEX		;EXIT IF SO

     92	000372	005767 	000000G		31$:	TST	FLTEXP		;TIME TO SCALE

     93	000376	001461 				BEQ	FLTG5		;FINI IF ZERO

     94	000400	002424 				BLT	41$		;DIVIDE IF .LT. ZERO

     95	000402	021327 	031426 			CMP	(R3),#031426	;MULTIPLY, CAN WE *5?

     96	000406	101005 				BHI	32$		;  NO

     97	000410					CALL	FLTM50		;YES, MULTIPLY BY 5

     98	000414	005267 	000000G			INC	FLTBEX		;  AND BY TWO

     99	000420	000405 				BR	33$

    100	000422				32$:	CALL	FLTM54		;MULTIPLY BY 5/4

    101	000426	062767 	000003 	000000G		ADD	#3.,FLTBEX	;  AND BY 8

    102	000434	005367 	000000G		33$:	DEC	FLTEXP		;  OVER 10

    103	000440	000754 				BR	31$

    104	000442	005367 	000000G		40$:	DEC	FLTBEX		;DIVISION, LEFT JUSTIFY BITS

    105	000446					CALL	FLTGLS

    106	000452	005713 			41$:	TST	(R3)		;SIGN BIT SET?

    107	000454	100372 				BPL	40$		;  NO, LOOP

    108	000456	012746 	000040 			MOV	#16.*2,-(SP)	;16 OUTER, 2 INNER

    109	000462					CALL	FLTGRS		;SHIFT RIGHT

    110	000466					CALL	FLTGSV		;PLACE IN SAVE BUFFER

    111	000472	032716 	000001 		42$:	BIT	#1,(SP)		;ODD LAP?

    112	000476	001004 				BNE	43$		;  YES

    113	000500					CALL	FLTGRS		;MOVE A COUPLE OF BITS RIGHT

    114	000504					CALL	FLTGRS

FLOAT	MACRO M1110  21-AUG-78 22:18  PAGE 32-2

FLOATING POINT ACCUMULATION ROUTINE



    115	000510				43$:	CALL	FLTGRS		;ONCE MORE TO THE RIGHT

    116	000514					CALL	FLTGAD		;ADD IN SAVE BUFFER

    117	000520	005316 				DEC	(SP)		;END OF LOOP?

    118	000522	003363 				BGT	42$		;  NO

    119	000524	005726 				TST	(SP)+		;YES, PRUNE STACK

    120	000526	162767 	000003 	000000G		SUB	#3.,FLTBEX

    121	000534	005267 	000000G			INC	FLTEXP

    122	000540	000714 				BR	31$

    123	000542	005367 	000000G		FLTG5:	DEC	FLTBEX		;LEFT JUSTIFT

    124	000546					CALL	FLTGLS

    125	000552	103373 				BCC	FLTG5		;LOSE ONE BIT

    126	000554	062767 	000200 	000000G		ADD	#200,FLTBEX	;SET EXCESS 128.

    127	000562	003403 				BLE	2$		;BRANCH IF UNDER-FLOW

    128	000564	105767 	000001G			TSTB	FLTBEX+1	;HIGH ORDER ZERO?

    129	000570	001410 				BEQ	3$		;  YES

    130	000572				2$:	OUT	#I.ERR,<#ILGFPT,LINEPT>	; ILLEGAL FLOATING POINT NUMBER

    131	000612	010402 			3$:	MOV	R4,R2		;SET TO SHIFT EIGHT BITS

    132	000614	010201 				MOV	R2,R1

    133	000616	005741 				TST	-(R1)		;R1 IS ONE LOWER THAN R2

    134	000620	024142 			4$:	CMP	-(R1),-(R2)	;DOWN ONE WORD

    135	000622	111112 				MOVB	(R1),(R2)	;MOVE UP A BYTE

    136	000624	000312 				SWAB	(R2)		;BEWARE OF THE INSIDE-OUT PC!!

    137	000626	020203 				CMP	R2,R3		;END?

    138	000630	001373 				BNE	4$

    139	000632					CALL	FLTGRS		;SHIFT ONE PLACE RIGHT

    140	000636	006014 				ROR	(R4)		;SET HIGH CARRY

    141	000640	005767 	000006G			TST	SYMVL2+EN.FPT	; TRUNCATION?

    142	000644	001027 				BNE	7$		;  YES

    143	000646	016702 	000000G			MOV	FLTWDC,R2	;GET SIZE COUNT

    144	000652	006302 				ASL	R2		;DOUBLE

    145	000654	006302 			8$:	ASL	R2		;CONVERT TO BYTES

    146	000656	052762 	077777 	000000G		BIS	#077777,FLTBUF(R2)

    147	000664	000261 				SEC

    148	000666	005562 	000000G		5$:	ADC	FLTBUF(R2)

    149	000672	005302 				DEC	R2

    150	000674	005302 				DEC	R2

    151	000676	002373 				BGE	5$

    152	000700	005713 				TST	(R3)		;TEST SIGN POSITION

    153	000702	100010 				BPL	7$		;OK IF POSITIVE

    154	000704				6$:	OUT	#I.ERR,<#DTATRU,LINEPT>	; DATA TRUNCATION ERROR

    155	000724	066713 	000000G		7$:	ADD	FLTSGN,(R3)	;SET SIGN, IF ANY

    156	000730	012600 			FLTGEX:	MOV	(SP)+,R0	;ORIGIONAL CHAR POINTER

    157	000732	001401 				BEQ	1$		;ZERO (GOOD) IF ANY DIGITS PROCESSED

    158	000734	005003 				CLR	R3		;FLAG AS FALSE

    159	000736	010300 			1$:	MOV	R3,R0		;SET FLAG IN R0

    160	000740	016767 	000000G	000000G		MOV	FLTBUF,VAL1		; FIRST WORD OF RESULT

    161	000746	016767 	000002G	000000G		MOV	FLTBUF+2,VAL2		; SECOND WORD OF RESULT

    162	000754	016767 	000004G	000000G		MOV	FLTBUF+4,VAL3		; THIRD WORD OF RESULT

    163	000762	016767 	000006G	000000G		MOV	FLTBUF+6,VAL4		; FOURTH WORD OF RESULT

    164	000770					RETURN				; RESTORES REGS AND R0 HAS

    165										; "DINTEGER" ON STACK

    166

    167

    168

    169	000772	021327 	146314 		FLTM54:	CMP	(R3),#146314	;ROOM?

    170	000776	103404 				BLO	1$

    171	001000					CALL	FLTGRS

FLOAT	MACRO M1110  21-AUG-78 22:18  PAGE 32-3

FLOATING POINT ACCUMULATION ROUTINE



    172	001004	005267 	000000G			INC	FLTBEX

    173	001010				1$:	CALL	FLTGSV		;SAVE IN BACKUP

    174	001014					CALL	FLTGRS		;SCALE RIGHT

    175	001020					CALL	FLTGRS

    176	001024	000406 				BR	FLTGAD

    177	001026				FLTM50:	CALL	FLTGSV		;*5

    178	001032					CALL	FLTGLS

    179	001036					CALL	FLTGLS

    180	001042	010402 			FLTGAD:	MOV	R4,R2		;POINT TO SAVE AREA

    181	001044	066242 	000006 		1$:	ADD	6(R2),-(R2)	;ADD IN WORD

    182	001050	010201 				MOV	R2,R1		;SET FOR CARRIES

    183	001052	005541 			2$:	ADC	-(R1)		;ADD IN

    184	001054	103776 				BCS	2$		;CONTINUE RIPPLE, IF NECESSARY

    185	001056	020203 				CMP	R2,R3		;THROUGH?

    186	001060	001371 				BNE	1$		;  NO

    187	001062					RETURN

    188

    189

    190	001064	000241 			FLTGRS:	CLC			;RIGHT SHIFT

    191	001066	010301 				MOV	R3,R1		;RIGHT ROTATE

    192	001070	006021 				ROR	(R1)+

    193	001072	006021 				ROR	(R1)+

    194	001074	006021 				ROR	(R1)+

    195	001076	006021 				ROR	(R1)+

    196	001100					RETURN

    197

    198

    199	001102	010402 			FLTGLS:	MOV	R4,R2		;LEFT SHIFT

    200	001104	006342 				ASL	-(R2)

    201	001106	006142 				ROL	-(R2)

    202	001110	006142 				ROL	-(R2)

    203	001112	006142 				ROL	-(R2)

    204	001114					RETURN

    205

    206

    207	001116	010301 			FLTGSV:	MOV	R3,R1		;MOVE FLTBUF TO FLTSAV

    208	001120	010402 				MOV	R4,R2

    209	001122	012122 				MOV	(R1)+,(R2)+	; MOVE 4 WORDS

    210	001124	012122 				MOV	(R1)+,(R2)+

    211	001126	012122 				MOV	(R1)+,(R2)+

    212	001130	012122 				MOV	(R1)+,(R2)+

    213	001132					RETURN

    214

    215

FLOAT	MACRO M1110  21-AUG-78 22:18  PAGE 33

FLOATING POINT DATA GENERATION



    217					.SBTTL	FLOATING POINT DATA GENERATION

    218

    219	001134				FLT2::

    220	001134				FLOAT::			; DATA_STAT = KFLOAT

    221

    222	001134					LET DATRPT	:= FALSE		; MARK AS SINGLE PRECISION

    223	001140					LET FLTWDC	:= #1			; FLOATING SINGLE PRECISION

    224	001146					GOTO	FLTARG				; AND PROCESS ARGS

    225

    226	001150				FLT4::

    227	001150				DOUBLE::		; DATA_STAT = KDOUBLE

    228

    229	001150					LET DATRPT	:= TRUE			; DOUBLE PRECISION

    230	001156					LET FLTWDC	:= #2			; SET DOUBLE FLAG

    231

    232	001164				FLTARG:

    233	001164					REPEAT					; ONCE PER ARG

    234	001164					    SPNOR				; IGNORE BLANKS

    235	001170					    CALL FLTPNT				; PICK UP FLOATING ARG

    236	001174					    OUT #I.STIL,<VAL1,VAL2>		; OUTPUT FIRST WORD

    237	001214					    INCRPC #4				; INCREMENT PC

    238	001226					    IF DATRPT IS TRUE THEN		; DOUBLE PRECISION?

    239	001234						OUT #I.STIL,<VAL3,VAL4>		; YES, SECOND HALF

    240	001254						INCRPC #4			; COUNT SECOND HALF

    241	001266					    END

    242	001266					    SPNOR				; IGNORE BLANKS

    243	001272					    IF CHAR NE #CR THEN			; NOT EOL?

    244	001302						IF CHAR NE #COMMA THEN		; NOT COMMA

    245	001312						    CALL ERORLN,#DIRERR		; SYNTAX ERROR

    246	001322						END

    247	001322						CALL GETCHR			; SKIP OVER CHAR

    248	001326					    END

    249	001326					    SPNOR				; IGNORE BLANKS

    250	001332					UNTIL CHAR EQ #CR			; UNTIL EOL

    251	001342					RETURN

    252

    253		000001 			.END

FLOAT	MACRO M1110  21-AUG-78 22:18  PAGE 33-1

SYMBOL TABLE



BLNK  = 000040   	FLTGLS  001102R     002	LPTLEN= 000074   	SEMI  = 000073   	TYPS0 = 000000

B0      001164R     002	FLTGRS  001064R     002	L0      001266R     002	SKIPSP= ****** GX	TYPS1 = 000000

CHAR  = ****** GX	FLTGSV  001116R     002	L1      001326R     002	SPACE = 000040   	TYPS2 = 000000

CNT   = 000006   	FLTG3   000356R     002	L2      001322R     002	SYMCHR= 000012   	VAL1  = ****** GX

COMMA = 000054   	FLTG5   000542R     002	M.ARGC= 000014   	SYMFLA= 000002   	VAL2  = ****** GX

CR    = 000015   	FLTM50  001026R     002	M.ARGS= 000016   	SYMLEN= 000011   	VAL3  = ****** GX

DATRPT= ****** GX	FLTM54  000772R     002	M.END = 000012   	SYMLIN= 000000   	VAL4  = ****** GX

DINTEG= ****** GX	FLTPNT  000000RG    002	M.GETL= 000004   	SYMMAX= 000017   	$DIDDO= 000000

DIRERR= ****** GX	FLTSAV= ****** GX	M.IFLV= 000006   	SYMSEG= 000010   	$E$   = 000001

DNUMBE= ****** GX	FLTSGN= ****** GX	M.IFVL= 000010   	SYMVL1= 000004   	$F$   = 000000

DOUBLE  001150RG    002	FLTWDC= ****** GX	M.LINK= 000000   	SYMVL2= 000006   	$I$   = 000001

DTATRU= ****** GX	FLT2    001134RG    002	M.NXTL= 000002   	S.ABS = 004000   	$L    = 000001

EN.FPT= ****** GX	FLT4    001150RG    002	OUTERR= ****** GX	S.ASN = 000200   	$LL   = 000000

ERORLN= ****** GX	GETCHR= ****** GX	OUTFRA= ****** GX	S.DBG = 002000   	$L$   = 000000

E0      001342R     002	IIII  = 177777   	PC1   = ****** GX	S.DF  = 100000   	$O$   = 000000

FF    = 000014   	ILGFPT= ****** GX	PC2   = ****** GX	S.EPT = 000100   	$R    = 177777

FLOAT   001134RG    002	I.ERR = ****** GX	PSECCH= 000020   	S.EXTN= 010000   	$T    = 000004

FLTARG  001164R     002	I.STIL= ****** GX	PSECOP= 000016   	S.GLOB= 020000   	$T1   = 000005

FLTBEG= ****** GX	LBLS0 = 000003   	PSECV1= 000012   	S.LOCL= 001000   	$T2   = 000000

FLTBEX= ****** GX	LBLS1 = 000001   	PSECV2= 000014   	S.ODBG= 000040   	$Y$   = 000000

FLTBUF= ****** GX	LBLS2 = 000002   	RGTANG= 000076   	S.REF = 000400   	$Z$   = 000000

FLTDOT= ****** GX	LF    = 000012   	RTNVAL=%000000   	S.TKMS= 000377   	$$T   = 000003

FLTEXP= ****** GX	LFTANG= 000074   	R6    =%000006   	S.WEAK= 040000   	.SAVAL= ****** GX

FLTGAD  001042R     002	LINEPT= ****** GX	R7    =%000007   	TAB   = 000011   	.$T   = 000001

FLTGEX  000730R     002	LOWCAS= 000140



. ABS.	000000	   000

      	000000	   001

FLOAT 	001344	   002

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  11802 WORDS  ( 47 PAGES)

DYNAMIC MEMORY:  13332 WORDS  ( 51 PAGES)

ELAPSED TIME:  00:00:59

OBJ$:FLOAT,LIS$:FLOAT/-SP=SRC$:MD,COMMON,FLOAT

