Trailing-Edge
-
PDP-10 Archives
-
decuslib20-06
-
decus/20-153/dpadd.mac
There are 7 other files named dpadd.mac in the archive. Click here to see a list.
TITLE DPADD FOR RPGLIB %1
SUBTTL DOUBLE-PRECISION INTEGER ADDITION PETE WILSON/ALB/CAM/RBC
;USED TO BE
;COPYRIGHT 1974, DIGITAL EQUIPMENT CORP., MAYNARD, MA.
;BUT CONVERTED TO RPGII VERSION 24-NOV-75, BOB CURRIER
HISEG
;CALLING SEQUENCE:
; MOVE 16,<Z AC,OPERAND B>
; PUSHJ 17,ADD.12/ADD.21/ADD.22
;ENTER WITH FIRST OPERAND (OPERAND A) IN ACCUMULATOR SPECIFIED BY AC-FIELD OF PARAMETER
;SECOND OPERAND (OPERAND B) IS ACCESSED VIA AC 16 (WHERE THE UUO IS).
; IF DOUBLE-PRECISION:
; 0(16) GETS HIGH-ORDER WORD, 1(16) REFERENCES LOW HALF.
; IF SINGLE-PRECISION:
; 0(16) REFERENCES SINGLE WORD.
;EXIT WITH TWO-WORD RESULT IN AC'S SPECIFIED BY AC-FIELD OF PARAMETER
ENTRY ADD.12 ;ADD TWO WORDS IN MEMORY TO ONE WORD IN AC 1.
ENTRY ADD.21 ;ADD ONE WORD IN MEMORY TO TWO WORDS IN AC'S 0 AND 1.
ENTRY ADD.22 ;ADD TWO WORDS IN MEMORY TO TWO WORDS IN AC'S 0 AND 1.
RS=11 ;RESULT AC POINTER
TA=13 ;TEMPORARY
TB=14 ;TEMPORARY
TC=15 ;TEMPORARY
PA=16 ;POINTER TO OPERAND B.
PP=17 ;PUSH-DOWN POINTER.
ADD.21: SKIPL 0(PA) ;ADD SINGLE TO DOUBLE, CHECK SIGN OF LOW B OPERAND.
TDZA TC,TC ;MAKE SIGN OF HIGH-ORDER B OPERAND AGREE
SETO TC, ; WITH LOW-ORDER SIGN.
SOJA PA,ADDXX ;THEN ADJUST POINTER AND ENTER MAIN LINE.
ADD.12: LDB RS,[POINT 4,PA,12] ;GET INPUT AC
MOVE TA,0(RS) ;GET OPERAND
MULI TA,1 ;CREATE DOUBLE-PRECISION
MOVE TC,0(PA) ;GET HI-PART OF OTHER OPERAND
JRST ADDXX1
ADD.22: MOVE TC,0(PA) ;ADD DOUBLE TO DOUBLE, GET HIGH-ORDER B WORD.
ADDXX: LDB RS,[POINT 4,PA,12] ;GET OPERAND AC
MOVE TA,0(RS) ;GET OPERAND
MOVE TB,1(RS)
ADDXX1: JFCL 17,.+1 ;CLEAR ARITHMETIC FLAGS.
PUSHJ PP,CHECK ;BE SURE SIGNS AGREE
ADD TB,1(PA) ;ADD LOW-ORDER WORDS.
JCRY1 CARRYS ;IF A CARRY OCCURRED, GO ADJUST HIGH-ORDER WORD.
ADDXX2: ADD TA,TC ;ADD TWO HIGH-ORDER WORDS.
PUSHJ PP,CHECK ;BE SURE SIGNS AGREE
MOVEM TA,0(RS) ;STASH HI-PART
MOVEM TB,1(RS) ;STASH LOW PART
POPJ PP, ;RETURN
CHECK: TLNE TA,1B18 ;MAKE SIGN OF LOW-ORDER PART
TLOA TB,1B18 ; AGREE WITH SIGN OF
TLZ TB,1B18 ; HIGH-ORDER RESULT.
POPJ PP,
;COME HERE ON CARRY GENERATED IN ADDITION OF LOW-ORDER WORDS.
CARRYS: AOJ TA, ;ADD CARRY TO HIGH-ORDER HALF.
PUSHJ PP,CHECK ;THEN GO CHECK FOR SIGN CHANGE IN HIGH HALF.
JRST ADDXX2 ;AND GO ADD HIGH-ORDER WORDS.
END