.MCALL .MODULE .MODULE IJCVT,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: ; ; IJCVT ; ; 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 $SETR0 ; Entry point to SET R0 routine .SBTTL IJCVT - Fortran-callable Routine ; ; ++ ; FUNCTIONAL DESCRIPTION: ; ; IJCVT converts an INTEGER*4 value to INTEGER*2 format and ; returns the result in ires(if specified) or i. ; ; CALLING SEQUENCE: ; ; i = IJCVT( jsrc[,ires])) ; ; INPUT PARAMETERS: ; ; R5 - address of IJCVT's argument block ; ; 0(R5) - argument count of IJCVT call ; 2(R5) - address of INTEGER*4 variable or array element whose value ; is to be converted ; 4(R5) - address of INTEGER*2 entity to receive the conversion result ; ; ; RETURNED FUNCTION VALUE (if ires is specified): ; ; 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 during conversion ; ; i = INTEGER*2 value of jres if ires is not specified : ; ;-- .PSECT SYS$I IJCVT:: MOV (R5)+,R1 ;GET ARG COUNT DECB R1 ;ONLY 1 ARG? BNE 10$ ;BRANCH IF MORE THAN ONE MOV @(R5)+,R0 ;RETURN SINGLE WORD INTEGER RETURN 10$: CMP #-1,@R5 ;IS ARGUMENT PRESENT? BEQ 40$ ;EQ -> NO CLR R0 ;INIT RESULT REG MOV (R5)+,R1 ;ADDR OF OP 1 MOV (R1)+,@(R5)+ ;STORE RESULT BMI 50$ ;ARG WAS NEGATIVE BEQ 20$ ;MUST BE POSITIVE INC R0 ;MAKES R0=1 20$: TST @R1 ;ARG MUST BE 0 30$: BEQ 40$ ;BRANCH SUCCESSFUL COMPLETION MOV #-2,R0 ;SET OVERFLOW CLR @-(R5) ;SET RESULT TO 0 ON OVERFLOW 40$: RETURN 50$: DEC R0 ;SET R0=1 (ASSUMED GOOD RETURN) CMP R0,@R1 ;SHOULD BE -1 TO BE VALID? BR 30$ ;GO EXIT .END