Trailing-Edge
-
PDP-10 Archives
-
BB-H506D-SM_1983
-
cobol/source/dpsub.mac
There are 7 other files named dpsub.mac in the archive. Click here to see a list.
; UPD ID= 3550 on 5/14/81 at 1:29 PM by NIXON
TITLE DPSUB FOR LIBOL
SUBTTL DOUBLE-PRECISION INTEGER SUBTRACTION PETE WILSON/ALB/CAM
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
; OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1974, 1981 BY DIGITAL EQUIPMENT CORPORATION
;V10*********
; 5/10/75 /DBT ADD BIS
;*************
SEARCH LBLPRM
%%LBLP==%%LBLP
BIS==:BIS
HISEG
;CALLING SEQUENCE:
; MOVE 16,<Z AC,OPERAND B>
; PUSHJ 17,SUB.12/SUB.21/SUB.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 SUB.12 ;SUB TWO WORDS IN MEMORY FROM ONE WORD IN AC 1.
ENTRY SUB.21 ;SUB ONE WORD IN MEMORY FROM TWO WORDS IN AC'S 0 AND 1.
ENTRY SUB.22 ;SUB TWO WORDS IN MEMORY FROM 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.
IFE BIS,<
SUB.21: SKIPGE 0(PA) ;SUB 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,SUBXX ;THEN ADJUST POINTER AND ENTER MAIN LINE.
SUB.12: LDB RS,[POINT 4,PA,12] ;GET INPUT AC
MOVE TA,0(RS) ;GET OPERAND
MULI TA,1 ;CREATE DOUBLE-PRECISION
SETCM TC,0(PA) ;GET HI-PART OF OTHER OPERAND
JRST SUBXX1
SUB.22: SETCM TC,0(PA) ;SUB DOUBLE TO DOUBLE, GET HIGH-ORDER B WORD.
SUBXX: LDB RS,[POINT 4,PA,12] ;GET OPERAND AC
MOVE TA,0(RS) ;GET OPERAND
MOVE TB,1(RS)
SUBXX1: JFCL 17,.+1 ;CLEAR ARITHMETIC FLAGS.
PUSHJ PP,CHECK ;BE SURE SIGNS AGREE
SUB TB,1(PA) ;SUB LOW-ORDER WORDS.
JCRY1 CARRYS ;IF A CARRY OCCURRED, GO ADJUST HIGH-ORDER WORD.
SUBXX2: ADD TA,TC ;SUB 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.
JFCL 17,SUBXX2 ;CLEAR OVERFLOW AND GO ADD HIGH-ORDER WORDS.
> ;END OF NON-BIS
IFN BIS,<
SUB.12:
LDB TA,PACFL.## ; GET AC NUMBER
MOVE TB,(TA) ;GET THE 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
SUB.22:
;CHANGE PA INTO A DSUB
TLZ PA,777000 ;JUST TO BE SAFE
TLO PA,(DSUB) ;PUT IN OP CODE
XCT PA ;DO IT
POPJ PP, ;DONE
SUB.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,(DSUB) ;SET OP CODE
XCT PA
POPJ PP, ;DONE
> ;END BIS
END