Updated: 11 December 1998 |
VAX MACRO and Instruction Set Reference Manual
Previous | Contents | Index |
Add Compare and Branch
opcode limit.rx, add.rx, index.mx, displ.bw
N|| <--- index LSS 0; | |
Z|| <--- index EQL 0; | |
V|| <--- {integer overflow}; | |
C|| <--- C; |
9D | ACBB | Add Compare and Branch Byte |
3D | ACBW | Add Compare and Branch Word |
F1 | ACBL | Add Compare and Branch Long |
4F | ACBF | Add Compare and Branch F_floating |
4FFD | ACBG | Add Compare and Branch G_floating |
6F | ACBD | Add Compare and Branch D_floating |
6FFD | ACBH | Add Compare and Branch H_floating |
The addend operand is added to the index operand and the index operand is replaced by the result. The index operand is compared with the limit operand. If the addend operand is positive (or zero) and the comparison is less than or equal to zero, or if the addend is negative and the comparison is greater than or equal to zero, the sign-extended branch displacement is added to the program counter (PC), and the PC is replaced by the result.
Notes
Add One and Branch Less Than or Equal
opcode limit.rl, index.ml, displ.bb
N|| <--- index LSS 0; | |
Z|| <--- index EQL 0; | |
V|| <--- {integer overflow}; | |
C|| <--- C; |
F3 | AOBLEQ | Add One and Branch Less Than or Equal |
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. If the comparison is less than or equal to zero, the sign-extended branch displacement is added to the program counter (PC), and the PC is replaced by the result.
Notes
Add One and Branch Less Than
opcode limit.rl, index.ml, displ.bb
N|| <--- index LSS 0; | |
Z|| <--- index EQL 0; | |
V|| <--- {integer overflow}; | |
C|| <--- C; |
F2 | AOBLSS | Add One and Branch Less Than |
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. If the comparison result is less than zero, the sign-extended branch displacement is added to the program counter (PC), and the PC is replaced by the result.
Notes
Branch on (condition)
opcode displ.bb
N|| <--- N; | |
Z|| <--- Z; | |
V|| <--- V; | |
C|| <--- C; |
14 | {N OR Z} EQL 0 | BGTR | Branch on Greater Than (signed) |
15 | {N OR Z} EQL 1 | BLEQ | Branch on Less Than or Equal (signed) |
12 | Z EQL 0 | BNEQ, | Branch on Not Equal (signed) |
BNEQU | Branch on Not Equal Unsigned | ||
13 | Z EQL 1 | BEQL, | Branch on Equal (signed) |
BEQLU | Branch on Equal Unsigned | ||
18 | N EQL 0 | BGEQ | Branch on Greater Than or Equal (signed) |
19 | N EQL 1 | BLSS | Branch on Less Than (signed) |
1A | {C OR Z} EQL 0 | BGTRU | Branch on Greater Than Unsigned |
1B | {C OR Z} EQL 1 | BLEQU | Branch Less Than or Equal Unsigned |
1C | V EQL 0 | BVC | Branch on Overflow Clear |
1D | V EQL 1 | BVS | Branch on Overflow Set |
1E | C EQL 0 | BGEQU, | Branch on Greater Than or Equal Unsigned |
BCC | Branch on Carry Clear | ||
1F | C EQL 1 | BLSSU, | Branch on Less Than Unsigned |
BCS | Branch on Carry Set |
The condition codes are tested. If the condition indicated by the instruction is met, the sign-extended branch displacement is added to the program counter (PC), and the PC is replaced by the result.
Notes
The VAX conditional branch instructions permit considerable flexibility in branching but require care in choosing the correct branch instruction. The conditional branch instructions are best seen as three overlapping groups:
BVS | V EQL 1 |
BVC | V EQL 0 |
BCS | C EQL 1 |
BCC | C EQL 0 |
BLSSU | C EQL 1 |
BLEQU | {C OR Z} EQL 1 |
BEQLU | Z EQL 1 |
BNEQU | Z EQL 0 |
BGEQU | C EQL 0 |
BGTRU | {C OR Z} EQL 0 |
BLSS | N EQL 1 |
BLEQ | {N OR Z} EQL 1 |
BEQL | Z EQL 1 |
BNEQ | Z EQL 0 |
BGEQ | N EQL 0 |
BGTR | {N OR Z} EQL 0 |
Branch on Bit
opcode pos.rl, base.vb, displ.bb
N|| <--- N; | |
Z|| <--- Z; | |
V|| <--- V; | |
C|| <--- C; |
E0 | BBS | Branch on Bit Set |
E1 | BBC | Branch on Bit Clear |
The single bit field specified by the position and base operands is tested. If it is in the test state indicated by the instruction, the sign-extended branch displacement is added to the program counter (PC), and the PC is replaced by the result.
Notes
Branch on Bit (and modify without interlock)
opcode pos.rl, base.vb, displ.bb
N|| <--- N; | |
Z|| <--- Z; | |
V|| <--- V; | |
C|| <--- C; |
E2 | BBSS | Branch on Bit Set and Set |
E3 | BBCS | Branch on Bit Clear and Set |
E4 | BBSC | Branch on Bit Set and Clear |
E5 | BBCC | Branch on Bit Clear and Clear |
The single bit field specified by the position and base operands is tested. If it is in the test state indicated by the instruction, the sign-extended branch displacement is added to the program counter (PC), and the PC is replaced by the result. Regardless of whether the branch is taken or not, the tested bit is put in the new state as indicated by the instruction.
Notes
Branch on Bit Interlocked
opcode pos.rl, base.vb, displ.bb
N|| <--- N; | |
Z|| <--- Z; | |
V|| <--- V; | |
C|| <--- C; |
E6 | BBSSI | Branch on Bit Set and Set Interlocked |
E7 | BBCCI | Branch on Bit Clear and Clear Interlocked |
The single bit field specified by the position and base operands is tested. If it is in the test state indicated by the instruction, the sign-extended branch displacement is added to the program counter (PC), and the PC is replaced by the result. Regardless of whether the branch is taken, the tested bit is put in the new state as indicated by the instruction. If the bit is contained in memory, the reading of the state of the bit and the setting of the bit to the new state is an interlocked operation. No other processor or I/O device can do an interlocked access on this bit during the interlocked operation.
Notes
1$: BBSSI bit,base,1$ |
Branch on Low Bit
opcode src.rl, displ.bb
N|| <--- N; | |
Z|| <--- Z; | |
V|| <--- V; | |
C|| <--- C; |
E8 | BLBS | Branch on Low Bit Set |
E9 | BLBC | Branch on Low Bit Clear |
The low bit (bit 0) of the source operand is tested. If it is equal to the test state indicated by the instruction, the sign-extended branch displacement is added to the program counter (PC), and the PC is replaced by the result.
Branch
opcode displ.bx
N|| <--- N; | |
Z|| <--- Z; | |
V|| <--- V; | |
C|| <--- C; |
11 | BRB | Branch with Byte Displacement |
31 | BRW | Branch with Word Displacement |
The sign-extended branch displacement is added to the program counter (PC), and the PC is replaced by the result.
Branch to Subroutine
opcode displ.bx
N|| <--- N; | |
Z|| <--- Z; | |
V|| <--- V; | |
C|| <--- C; |
10 | BSBB | Branch to Subroutine with Byte Displacement |
30 | BSBW | Branch to Subroutine with Word Displacement |
The program counter (PC) is pushed on the stack as a longword. The sign-extended branch displacement is added to the PC, and the PC is replaced by the result.
Case
opcode selector.rx, base.rx, limit.rx,
displ[0].bw,
...,
displ[limit].bw
N|| <--- tmp LSS limit; | |
Z|| <--- tmp EQL limit; | |
V|| <--- 0; | |
C|| <--- tmp LSSU limit; |
8F | CASEB | Case Byte |
AF | CASEW | Case Word |
CF | CASEL | Case Long |
The base operand is subtracted from the selector operand, and the result replaces a temporary operand. The temporary operand is compared with the limit operand; if it is less than or equal unsigned, a branch displacement selected by the temporary value is added to the program counter (PC), and the PC is replaced by the result. Otherwise, twice the sum of the limit operand and 1 is added to the PC, and the PC is replaced by the result. This operation causes the PC to be moved past the array of branch displacements. Regardless of the branch taken, the condition codes are modified as a result of the comparison of the temporary operand with the limit operand.
Notes
In the following example, the CASEB instruction selects one of eight displacements immediately following the instruction. The example is for illustration only. An actual instruction would use run-time variables instead of the assembly-time static values shown. Also, in an actual instruction, the displacements selected by the CASEB instruction would be branches to various routines.
.PSECT CODE, PIC, SHR, WRT, EXE, LONG TABIND: .WORD 4 .ENTRY START,^M<> CLRW R4 CLRW R5 MOVW #0,R4 MOVW #7,R5 CASEB TABIND,R4,R5 TAB: .WORD 1$-TAB .WORD 2$-TAB .WORD 3$-TAB .WORD 4$-TAB .WORD 5$-TAB .WORD 6$-TAB .WORD 7$-TAB BRB 9$ 1$: .ASCII /AT 1/ 2$: .ASCII /AT 2/ 3$: .ASCII /AT 3/ 4$: .ASCII /AT 4/ 5$: .ASCII /AT 5/ 6$: .ASCII /AT 6/ 7$: .ASCII /AT 7/ 8$: .ASCII /AT 8/ 9$: $EXIT_S .END START |
The objective of the CASE instruction is to transfer control to one of many possible locations depending on the value of "selector," or TABIND, as shown in the example. These locations are labeled in the example from 1$: to 8$:.
In the example, the table contains eight branch displacements. In all cases, the limit operand (here shown as R5, which contains a 7) is one less than the number of displacements (8) in the table. The base operand (here shown as R4, which contains a zero) is the lowest permissible value for TABIND.
The CASE instruction subtracts base (contents of R4, a zero) from the value of TABIND to produce a zero-origin index into the table. The limit (contents of R5, a 7) is compared with this index to ensure that the table limit is not exceeded.
After operand evaluation, the program counter (PC) points to TAB:. The locations to which branching occurs are represented in the table as displacements. The displacement in the table selected by TABIND is added to the PC to form a destination address. The destination selected in the example is at location 5$:. In practical usage, this location would contain a branch to a specific routine.
Previous | Next | Contents | Index |
Copyright © Compaq Computer Corporation 1998. All rights reserved. Legal |
4515PRO_019.HTML
|