AOB

VAX11

 

AOB       ADD ONE AND BRANCH

 

Purpose

increment integer loop count and loop

Format

opcode limit.rl, index.ml, displ.bb

Operation

index ß index + 1;

if index LSS limit                                                           AOBLSS

then PC ß PC + SEXT (displ);

if index LEQ limit                                                          AOBLEQ

then PC ß PC + SEXT (displ);

Condition codes

N ß index LSS 0;

Z ß index equal 0;

C ß {integer overflow};

C ß C;

Exceptions

integer overflow

Opcodes

F2 AOBLSS                Add One and Branch Less Than

F3 AOBLEQ               Add One and Branch Less Than or Equal

Description

One is added to the index operand and the index operand is replaced by the result. The index operand is compared with the limit operand. On AOBLSS, if it is less than, the branch is taken. On AOBLEQ, if it is less than or equal, the branch is taken. If the branch is taken, the sign extended branch displacement is added to the PC and the PC is replaced by the result.

Notes

1. Integer overflow occurs if the index operand before addition is the largest positive integer. On overflow, the index operand is replaced by the largest negative integer, and thus (unless the limit operand is the largest negative integer on AOBLSS) the branch is taken.

2. The C-bit is unaffected.

 

 

Example 1

 

The following prints the number 1 to 9 on the screen:

 

.text

 

main: .word 0

      movl $1, r1

 

forLoop:

      pushl r1

      pushal format

      calls $2, .printf

      aoblss $10, r1, forLoop

 

      pushl $0

      calls $1, .exit

.data

format: .asciz "%d "