Trailing-Edge
-
PDP-10 Archives
-
AP-4178E-RM
-
swskit-sources/mr.mac
There is 1 other file named mr.mac in the archive. Click here to see a list.
;<3-MONITOR>MR.MAC.19, 7-Nov-77 13:04:10, EDIT BY KIRSCHEN
;MORE COPYRIGHT UPDATING...
;<3-MONITOR>MR.MAC.18, 12-Oct-77 13:59:51, EDIT BY KIRSCHEN
;UPDATE COPYRIGHT FOR RELEASE 3
;<3-MONITOR>MR.MAC.17, 2-May-77 21:37:55, EDIT BY BOSACK
;<3-MONITOR>MR.MAC.16, 27-Dec-76 17:35:00, EDIT BY HURLEY
;<3-MONITOR>MR.MAC.16, 26-Nov-76 02:24:01, Edit by MCLEAN
;<2-MONITOR>MR.MAC.14, 21-Sep-76 16:02:23, Edit by MCLEAN
; FIXED MISSING SEMICOLON IN COMMENTS FOR PUSHJ P,EDFAD.
;<2MONITOR>MR.MAC.13, 19-JAN-76 12:20:52, EDIT BY MURPHY
;<2MONITOR>MR.MAC.12, 23-DEC-75 12:52:12, EDIT BY LEWINE
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
; OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1976, 1977, 1978 BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
SEARCH PROLOG,MONSYM,MACSYM
TTITLE RITH
SALL
SWAPCD
;DOUBLE PRECISION ARITHMETIC ROUTINES
INTERN EDFAD.,EDFMP.,EDFDV.,EDFSB.,GETEXP,PUTEXP
IFNDEF MONFLG,<MONFLG==1>
AOP1==0
AOP2==1
BKSTK=16
;AC ASSIGNMENTS
A=12 ;AC FOR OPERAND AND RESULT. AND A+1.
B=14 ;=A+2.
C=15
M=10 ;MEMORY OPERAND POINTER AND TEMP. M+1 ALSO USED.
P=17 ;CONTROL PUSHDOWN
;THE MORE GENERAL ROUTINES.
;SLOWER IN REGULAR CASE CAUSE MUST STORE AC OPERAND FOR
;RETRY ON OVERLOW.
;AC OPERAND AND ANSWER IN A&A+1, MOVE POINTS TO MEMORY OPERAND.
;EDFAD IS EXTENDED RANGE DOUBLE PRECISION ADD
;FORMAT OF NUMBER IS STANDARD FOR BINARY EXPONENT WITHIN RANGE
;MAGNITUDE LESS THAN 128 OR DECIMAL EXP<=38 (ABOUT)
;EXTENDED RANGE NUMBERS HAVE SECOND WORD WITH MINUS SIGN BIT
;8 BITS OF EXPONENT ARE HIGH ORDER EXTENSION OF EXPONENT
;ALL EXPONENTS ARE STILL EXCESS 128
;ROUTINE IS CALLED WITH ONE NUMBER IN A,A+1
;OTHER IN 0(M),1(M) ... CALLED WITH
; MOVEI M,LOC ; WHERE MEMORY LOC IS GIVEN
; PUSHJ P,EDFAD.
;ANSWER LEFTIN A,A+1 OTHER AC'S GENERALLY CLOBBERED
EDFAD.:SE1CAL
PUSH P,BKSTK
HRRI BKSTK,1(P)
ADD P,BHC+2
IFG MONFLG,<
EXTERN MSTKOV
JUMPGE P,MSTKOV>
MOVEM A,AOP1(BKSTK) ;SAVE AC OPS
MOVEM A+1,AOP2(BKSTK)
JFOV .+1 ;MAY NOT REALLY BE NEEDED
SKIPGE M+1,1(M) ;TEST FOR EITHER OPERAND EXT RANGE. FREELOAD.
JRST .EXRNG
JUMPL A+1,.EXRNG
DFAD: UFA A+1,M+1 ;STANDARD DP ADD SEE P 2-67 OF SYSTEM MANUAL
FADL A,0(M)
UFA A+1,A+2
FADL A,A+2
JFOV ADSAVE
SUB P,BHC+2
POP P,BKSTK
POPJ P,
ADSAVE: MOVE A,AOP1(BKSTK)
MOVE A+1,AOP2(BKSTK) ;RESTORE AC OPS
;JRST .EXRNG ;.EXRNG IS NEXT
;EXTENDED RANGE ADD:
;RETURN LARGER IF EXPONENTS DIFFER BY TOO MUCH,
;ELSE SHIFT EXPONENTS INTO RANGE, ADD, SHIFT BACK
.EXRNG: MOVE M,(M) ;M!
EXRNG: PUSH P,C
PUSHJ P,GETEXP ;GETS EXP OF A INTO B
MOVE C,B
EXCH A,M ;PUT MEMORY NUM IN A
EXCH A+1,M+1
PUSHJ P,GETEXP ;OTHER EXPONENT
CAML B,C ;COMPARE WITH FIRST EXP
JRST RTORD ;RIGHT ORDER IF LARGER IS IN A
EXCH A,M
EXCH A+1,M+1 ;EXCHANGE BRINGING LARGER NUM TO A
EXCH B,C ;EXCHANGE EXPONENTS TOO
RTORD: SUB B,C ;DIFF OF EXPS
CAILE B,^D54 ;A>>M
JRST REXRNG ;ANSWER IS IN A
PUSH P,C ;SAVE ORIGINAL LOWEST EXP
MOVEI C,^D128 ;HIGH ORDER EXP FOR M
SKIPGE M ;IS MOVE NEGATIVE
SETCA C, ;YES, SO COMPLEMENT EXP
DPB C,[POINT 8,M,8] ;INSERT EXP
MOVEI C,^D101 ;LOW ORDER EXP
DPB C,[POINT 9,M+1,8]
ADD C, B
DPB C,[POINT 9,A+1,8]
ADDI C,^D27 ;HIGH ORDER EXP FOR A
SKIPGE A
SETCA C, ;IF A NEG COMPLEMENT EXP
DPB C,[POINT 8,A,8]
UFA A+1,M+1 ;STD DP ADD
FADL A,M ;..
UFA A+1,A+2 ;..
FADL A,A+2 ;..
POP P,C ;ORIGINAL EXP
JUMPE A,REXRNG ;IF ANSWER IS ZERO
PUSHJ P, GETEXP ;GET EXP IN B
ADD B,C ;ADD EXPONENT TO GET RESULT
SUBI B,^D128 ;SUBTRACT EXCESS EXCESS 200
PUSHJ P,PUTEXP ;PUT IT IN NUMBER
REXRNG: POP P,C
SUB P,BHC+2
POP P,BKSTK
POPJ P,
;GETEXP EXPECTS NUMBER IN A,A+1 AND RETURNS EXPONENT IN B
GETEXP: JUMPE A,EXP0 ;TEST FOR ZERO NUMBER
SE1CAL
LDB B,[POINT 8,A,8]
JUMPGE A,.+2
XORI B,377 ;IF LOW ORDER EXP FROM A SHOULD BE NEGATED DO SO
JUMPGE A+1,GEND ;IF NOT IN EXTENDED RANGE THEN DONE
LSH B,^D20 ;PUT NEXT TO POSITION FOR HIGH ORDER BITS
ROT A+1,^D9 ;PUT EXP IN RIGHT HAND PART OF AC
DPB A+1,[POINT 8,B,7]
ROT A+1,-^D9
ASH B,-^D20
GEND: POPJ P,
EXP0: MOVNI B,77777 ;FOR ZERO RETURN SMALLEST POSSIBLE EXPONENT
RET
;PUTEXP EXPECTS NUMBER IN A,A+1 AND EXP IN B RETURN RESULT IN A,A+1
;PUTS EXPONENT INTO NUMBER , KNOWING ABOUT EXTENDED RANGE
PUTEXP: JUMPE A,PXEND ;ZERO HAS ITS OWN EXP
SE1CAL
DPB B,[POINT 8,A,8]
CAIGE B,400 ;IS NUMBER INSIDE RANGE
CAIGE B,33
JRST PEXT ;NO
MOVEI B,-33(B) ;LO EXPONENT = HI-^D27. LO SIGN BIT=0
PXDPB: DPB B,[POINT 9,A+1,8] ;DEPOSIT LOW ORDER EXP AND SIGN BIT
JUMPGE A,.+2
TLC A,377000 ;ONES COMPL EXPON IF NEG
PXEND: POPJ P,
PEXT: CAILE B,715 ;UPPER LIMIT SHD BE TWICE OFFICIAL FOR COMPARISONS
JFCL ;NUMBER >10^99 CANT HAPPEN, CHECK JRB
CAMGE B,[-310]
JFCL ;NUMBER <10^-99 CANT HAPPEN, CHECK JRB
ASH B,-10
TRO B,400 ;LOW SIGN BIT = 1 TO FLAG EXTENDED RANGE NUMBER
JRST PXDPB ;NOW DEPOSIT EXP EXTENSION
;SB IS SAME AS EDFSB JUST COMPLEMENTS TWICE AND ADDS
EDFSB.: DFN A,A+1 ;NEGATE FIRST OPERAND
SE1CAL
PUSHJ P,EDFAD.
DFN A,A+1
POPJ P, ;-(M-A)=A-M
;EDFDV IS ALMOST IDENTICAL TO EDFMP AND IS GIVEN FIRST
;THE TWO SETS OF INSTRUCTIONS AT MDINS AND ASINS MAKE THE DIFFERENCE
MDINS: PUSHJ P,DFMPX ;ORDINARY DP MULT
PUSHJ P,DFDVX ;ORDINARY DP