.MCALL .MODULE .MODULE ERRPM0,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 $ERRM0 - convert any error code to a negative number ; ; $ERRM0 is a service routine for other SYSLIB (SYSLBC) routines. ; It tests for Carry set (after an EMT request). If carry is not ; set, it exits with R0=0. If carry is set, it copies the error ; byte into R0. If the value of the error byte is positive (including ; 0) it complements it, converting it to -(error byte)+1. If the ; value n the error byte is negative, it subtracts an additional ; 128 (decimal) from its value and returns it is R0. ; ; This means that errors are always returned as negative values. ; It also means that the negative codes from .SERRs trapped errors ; are return as negative values (offset by -128. to avoid clashing ; with the converted positive error codes). ; ;JFW ;+ .PSECT SYS$I ERRBYT =: 52 SERR$1 ==: -129. $ERRM0:: BIC R0,R0 ;*C* Clear R0 BCC 10$ ;no error, return R0=0 MOVB @#ERRBYT,R0 ;load the error byte BMI 20$ ;negative means an .SERR code COM R0 ;convert 0->-1, 1->-2 ... 10$: RETURN ;done 20$: ADD #SERR$1+1,R0 ;convert -1->-129., -2->-130. ... RETURN ;done .SBTTL $ERRP0 - convert any error code to a positive number ;++ ; $ERRP0 is a service routine for other SYSLIB routines. ; It tests for Carry set (after an EMT request). If carry is not ; set, it exits with R0=0. If carry is set, it copies the error ; byte into R0. If the value of the error byte is positive (including ; 0) it adds 1 to it. If the value in the error byte is negative, it ; subtracts an additional 128 (decimal) from its value, takes the ; negative of that value, and returns it in R0. ; ; This means that errors are always returned as positive values greater ; than 0. It also means that the negative codes from .SERRs trapped ; errors are return as positive values (offset by +128. to avoid ; clashing with the originally positive error codes). ;-- $ERRP0:: CALL $ERRM0 ;do the neg processing NEG R0 ;convert 0->0, -1->1 ... RETURN .END