.MCALL .MODULE .MODULE JSUB,,VERSION=04,COMMENT=,IDENT=NO,LIB=YES ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; This software is furnished under a license for use only on a ; single computer system and may be copied only with the ; inclusion of the above copyright notice. This software, or ; any other copies thereof, may not be provided or otherwise ; made available to any other person except for use on such ; system and to one who agrees to these license terms. Title ; to and ownership of the software shall at all times remain ; in Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. .SBTTL Module Declaration .NLIST .ENABL LC .DSABL GBL .NLIST CND .LIST ; ++ ; FACILITY: ; ; RT-11 System Subroutine Library ; ; CALLABLE ENTRIES: ; ; JSUB ; ; ENVIRONMENT: ; ; This routine can be used by any job running in a single-job or ; multi-job environment . It uses "TRAP" to provide error processing. ; ; INCLUDE FILES: ; ; SYSMAC.SML ; RT-11 system macro library. ; ; EXTERNAL REFERENCES: ; .GLOBL $SYSLB ; Include system library work area. .GLOBL $NXVAL ; Entry point to next value routine. .GLOBL $SETR0 ; Entry point to SET R0 routine .WEAK $MSARG ; Trap code for missing argument .SBTTL JSUB - Fortran-callable Routine ; ; ++ ; FUNCTIONAL DESCRIPTION: ; ; The JSUB function computes the difference between two INTEGER*4 ; values. ; ; CALLING SEQUENCE: ; ; i = JSUB (jopr1,jopr2,res) ; ; INPUT PARAMETERS: ; ; R5 - address of JSUB's argument block ; ; 0(R5) - argument count of JSUB call ; 2(R5) - address of an INTEGER*4 variable that is the minuend of the ; operation ; 4(R5) - address of an INTEGER*4 variable that is the subtrahend of ; the operation ; ; RETURNED FUNCTION VALUE: ; ; i = -1 normal return; the result is negative ; = 0 normal return; the result is zero ; = 1 normal return; the result is positive ; = -2 an overflow occured while computing the result ;-- .SBTTL JSUB - Fortran-callable Routine .PSECT SYS$I JSUB:: CLR R0 ; initialize for normal exit TST (R5)+ ; skip count arg MOV (R5)+,R4 ; addr of operand 1 MOV (R5)+,R3 ; addr of operand 2 MOV (R5)+,R1 ; addr of result MOV (R4)+,R2 ; get low order op 1 SUB (R3)+,R2 ; subtract low order op 2 MOV @R4,R5 ; get high order result SBC R5 ; subtract carry BVS 10$ SUB @R3,R5 ; subtract high order op 2 BVC 20$ 10$: CLR R2 ; set result to 0 CLR R5 MOV #-2,R0 ; indicate overflow 20$: MOV R2,(R1)+ ; store result MOV R5,@R1 CALLR $SETR0 ; exit via setr0 routine .END