BIT

VAX11

 

BIT       BIT TEST

 

Purpose

test a set of bits for all zero

Format

opcode mask.rx, src.rx

Operation

tmp ß src AND mask;

Condition codes

N ß tmp LSS 0;

Z ß tmp EQL 0;

V ß 0;

C ß C;

Exceptions

None

Opcodes

93        BITB    Bit Test Byte

B3        BITW  Bit Test Word

D3       BITL    Bit Test Long

Description

The mask operand is ANDed with the source operand. Both operands are unaffected. The only action is to affect condition codes.

Notes

                                    

 

 

Example 1

 

The program displays message on the screen, which effected from the result of BITL command.

 

 

.text

 

main: .word 0

 

      movl $0xFF, r2

      movl $0xFF, r3

 

      # first case - should be True

      bitl r2, r3

      bneq eq1

      calls $0, prn_false

      jmp next_stage

eq1:  calls $0, prn_true

 

      # second case - should be False

next_stage:

      movl $0x0F, r2

      movl $0xF0, r3

 

      bitl r2, r3

      bneq eq2

      calls $0, prn_false

      jmp end_prog

eq2:  calls $0, prn_true

 

end_prog:

      pushl $0

      calls $1, .exit

 

prn_false: .word 0

      pushal lbl_false

      pushal format

      calls $2, .printf

      ret

prn_true: .word 0

      pushal lbl_true

      pushal format

      calls $2, .printf

      ret

 

.data

 

lbl_true:   .asciz "True"

lbl_false: .asciz "False"

format:     .asciz "%s\n"