Trailing-Edge
-
PDP-10 Archives
-
BB-H506E-SM
-
cobol/source/dpadd.mac
There are 7 other files named dpadd.mac in the archive. Click here to see a list.
; UPD ID= 3549 on 5/14/81 at 1:29 PM by NIXON
TITLE DPADD FOR LIBOL V12C
SUBTTL DOUBLE-PRECISION INTEGER ADDITION PETE WILSON/ALB/CAM
SEARCH COPYRT
SALL
;COPYRIGHT (C) DIGITAL EQUIPMENT CORPORATION 1974, 1985
;ALL RIGHTS RESERVED.
;
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
;ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;V12B****
;EDIT DATE WHO DESCRIPTION
;
;1107 16-JAN-84 JEH Don't clear overflow flags in ADD.21,
; they're needed to produce 'on size error'
;
;V12*****
; 6-OCT-78 [540] ADD QUAD-WORD ROUNDING FUNCTION
;V10*****
; 5/10/75 /DBT ADD BIS CODE
;***********
SEARCH LBLPRM
%%LBLP==:%%LBLP
BIS==:BIS
HISEG
.COPYRIGHT ;Put COPYRIGHT statement in .REL file.
;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.
IFN BIS,<
ENTRY ADD.4R ;[540] ADD ONE WORD IN ACC 4 TO 4 WORDS IN ACCS 0-3
>
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.
IFE BIS,<
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 2,.+1 ;[1107] ONLY CLEAR CARRY 1 FLAG
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: ADDI TA,1 ;ADD CARRY TO HIGH-ORDER HALF.
PUSHJ PP,CHECK ;THEN GO CHECK FOR SIGN CHANGE IN HIGH HALF.
JRST ADDXX2 ;[1107] GO ADD HIGH-ORDER WORDS.
> ;END OF NON-BIS
IFN BIS,<
ADD.12:
LDB TA,PACFL.## ; GET AC NUMBER
MOVE TB,(TA) ;GET LOW ORDER WORD.
MOVEM TB,1(TA) ;PUT IT WHERE IT SHOULD BE.
SETZM (TA) ;CLEAR HIGH ORDER AC
SKIPGE 1(TA) ;IS LOW ORDER NEGATIVE
SETOM (TA) ;YES - EXTEND SIGN
ADD.22:
;CHANGE PA INTO A DADD
TLZ PA,777000 ;JUST TO BE SAFE
TLO PA,(DADD) ;PUT IN OP CODE
XCT PA ;DO IT
POPJ PP, ;DONE
ADD.21:
MOVE TA,0(PA) ;GET WORD IN MEMORY
ASHC TA,-^D35 ;EXTEND SIGN
HRRI PA,TA ;WE WILL ADD IN TA
TLZ PA,777000 ;JUST TO BE SURE
TLO PA,(DADD) ;SET OP CODE
XCT PA
POPJ PP, ;DONE
;[540] HERE TO DO ROUNDING TO QUAD-WORD VALUE
ADD.4R: ASHC 4,-^D35 ;[540] EXTEND SIGN
JFCL 17,.+1 ;[540] CLEAR FLAGS
DADD 2,4 ;[540] ADD IN ROUNDING CONSTANT
JOV CARRY4 ;[540] OVERFLOW OCCURED
POPJ PP, ;[540] NO, ALL DONE
CARRY4: SKIPL 5,4 ;[540] IF IT WAS NEGATIVE USE -1
MOVEI 5,1 ;[540] NO, SO ADD 1
DADD 0,4 ;[540] ADJUST HIGH WORD
POPJ PP, ;[540] AND RETURN
> ;END BIS
END