.TITLE MTH_QUAD_MUL Quadword Integer multiplication routine .IDENT /V03.01/ ;++MTHQMUL.MAR ; ; FACILITY: ; Quadword integer Mathematics subroutines. ; ; ABSTRACT: ; This module contains the routines to multiply two quadword integers ; and to multiply two longword integers and result in a quadword integer. ; ; ENVIRONMENT: ; Called from high-level language (FORTRAN or PASCAL) programs. ; User mode. ; ;-- ; ; MODIFICATION HISTORY: ; ; Gotten from Fall 1980 DECUS VAX/VMS SIG tape. ; ; V01.02 21-Aug-81 FJN Commented and names changed. Added QUAD_EMUL. ; V02.00 08-Jun-82 FJN Names changed yet again. ; V03.00 03-Oct-82 FJN Split package into separate modules. ; V03.01 15-Apr-83 FJN Standardize help comments ; ; Copyright (C) 1979 ; Management Science Associates, Inc. ; 5100 Centre Avenue ; Pittsburgh, Pennsylvania 15232 ; ; This software is distributed without cost, and may be ; reproduced only with the inclusion of this copyright ; statement. Management Science Associates assumes no ; responsibility for the performance of this software. ; ; ; EQUATED SYMBOLS: ; LOW = 0 ;Offset to low-order longword HIGH = 4 ;Offset to high-ordr longword ; ; Argument offsets ; MULTIPLIER = 4 ;Offset to address of multiplier MULTIPLICAND = 8 ;offset to address of multiplicand PRODUCT = 12 ;Offset to address of product quadword ; ; Program section for code ; .PSECT _MTH_CODE,PIC,USR,CON,REL,LCL,SHR,EXE,NOWRT,RD .SHOW BINARY .PAGE .SBTTL MTH_QUAD_MUL Multiply two quadword integers ;+ MTH_QUAD_MUL ; Multiply two quadword integers. ; ; CALL MTH_QUAD_MUL( multr.rq.r, multd.rq.r, prod.wq.r ) ; ; multr quadword with the multiplier. Passed by reference. ; ; multd quadword with the multiplicand. Passed by reference. ; ; prod quadword in which the product is returned. Passed by ; reference. ; ;- ;+0MTH_QUAD_MUL ; ; FUNCTIONAL DESCRIPTION: ; Multiply two quadword integers and return the resulting product ; as a quadword integer. ; ; CALLING SEQUENCE: ; CALL MTH_QUAD_MUL(multiplier,multiplicand,product) ; ; INPUT PARAMETERS: ; multiplier(AP) address of multiplier quadword ; multiplicand(AP) address of multiplicand quadword ; ; OUTPUT PARAMETERS: ; product(AP) address of quadword in which the product of the ; multiplier and multiplicand quadwords is returned. ; ;- .ENTRY MTH_QUAD_MUL ^M MOVL MULTIPLIER(AP),R3 ;address of multiplier MOVL MULTIPLICAND(AP),R4 ;address of multiplicand EMUL LOW(R3),LOW(R4),#0,R0 ;low product EMUL LOW(R3),HIGH(R4),R1,R1 ;first cross term product EMUL HIGH(R3),LOW(R4),R1,R1 ;second cross term product TSTL LOW(R3) ;check sign BGEQ 1$ ;no sign problems ADDL LOW(R4),R1 ;sign compensation 1$: TSTL LOW(R4) ;check other sign BGEQ 2$ ;no sign problems ADDL LOW(R3),R1 ;sign compensation 2$: MOVQ R0,@PRODUCT(AP) ;give the answer RET ;return to caller .PAGE .SBTTL MTH_QUAD_EMUL Multiply two longword integers to quadword result ;+ MTH_QUAD_EMUL ; Multiply two longword integers and return a quadword integer as ; the result. ; ; CALL MTH_QUAD_EMUL( multr.rl.r, multd.rl.r, prod.wq.r ) ; ; multr longword with the multiplier. Passed by reference. ; ; multd longword with the multiplicand. Passed by reference. ; ; prod quadword in which the product is returned. Passed by ; reference. ; ;- ;+0MTH_QUAD_EMUL ; ; FUNCTIONAL DESCRIPTION: ; Multiply two longword integers and return the resulting product ; as a quadword integer. ; ; CALLING SEQUENCE: ; CALL MTH_QUAD_EMUL(multiplier,multiplicand,product) ; ; INPUT PARAMETERS: ; multiplier(AP) address of multiplier longword ; multiplicand(AP) address of multiplicand longword ; ; OUTPUT PARAMETERS: ; product(AP) address of quadword in which the product of the ; multiplier and multiplicand longwords is returned. ; ;- ; ; Argument offsets ; MULTIPLIER = 4 ;Offset to address of multiplier MULTIPLICAND = 8 ;offset to address of multiplicand PRODUCT = 12 ;Offset to address of product quadword .ENTRY MTH_QUAD_EMUL ^M<> EMUL @MULTIPLIER(AP),@MULTIPLICAND(AP),#0,@PRODUCT(AP) RET ;return to caller .END