Files
Digital-Research-Source-Code/ASSEMBLY & COMPILE TOOLS/PLM VAX COMPILER/util86/bit.mar
Sepp J Morris 31738079c4 Upload
Digital Research
2020-11-06 18:50:37 +01:00

47 lines
2.0 KiB
Plaintext

.TITLE BIT. (UTIL-VAX Library Routine BIT)
;-----------------------------------------------------------------------
;
; D I S C L A I M E R N O T I C E
; ------------------- -----------
;
; This document and/or portions of the material and data furnished
; herewith, was developed under sponsorship of the U. S. Government.
; Neither the U.S. nor the U.S.D.O.E., nor the Leland Stanford Junior
; University, nor their employees, nor their respective contractors,
; subcontractors, or their employees, makes any warranty, express or
; implied, or assumes any liability or responsibility for accuracy,
; completeness or usefulness of any information, apparatus, product
; or process disclosed, or represents that its use will not infringe
; privately-owned rights. Mention of any product, its manufacturer,
; or suppliers shall not, nor is it intended to, imply approval, dis-
; approval, or fitness for any particular use. The U. S. and the
; University at all times retain the right to use and disseminate same
; for any purpose whatsoever. Such distribution shall be made by the
; National Energy Software Center at the Argonne National Laboratory
; and only subject to the distributee furnishing satisfactory proof
; that he has a valid license from the Intel Corporation in effect.
;
;-----------------------------------------------------------------------
.PSECT UTIL_CODE,RD,NOWRT,EXE,GBL,CON,LONG
; BIT: PROCEDURE (NUMBER,PRTX) BYTE PUBLIC;
; DECLARE NUMBER BYTE, PTRX ADDRESS;
; END BIT;
;
; Beware that bits in this routine are numbered 0-7, where 0 is
; the high order bit in a byte, and 7 is the low order bit!!!!
.ENTRY BIT,^M<>
MOVZBL 4(AP),R0 ; R0 <- number.
MOVL 8(AP),R1 ; R1 -> array.
CMPB R0,(R1) ; Check for number > max.
BLEQU ITS_OK
CLRL R0 ; Return FALSE if number > max.
RET
ITS_OK: XORB2 #7,R0 ; Reverse sense of bit # within byte.
EXTV R0,#1,1(R1),R0 ; Extract selected bit and extend sign.
RET ; Return TRUE or FALSE.
.END