SOB Instruction

Purpose:Decrement integer loop count and loop
Format:opcode index.ml, displ.bb
Operation:
index <- index - 1;
SOBGEQ
if index >= 0 then
PC <- PC + sign-extended displ
SOBGTR
if index > 0 then
PC <- PC + sign-extended displ
Condition
Codes:
N <- index LSS 0;
Z <- index EQL 0;
V <- Integer Overflow;
C <- C;
Exceptions:Integer Oveflow
Opcodes:
F4SOBGEQSubtract One and Branch Greater Than or Equal
F5SOBGTRSubtract One and Branch Greater Than
Description: One is subtracted from the index operand and the index operand is replaced by the result. On SOBGEQ, if the index operand is greater than or equal to 0, the branch is taken. On SOBGTR, if the index operand is greater than 0, the branch is taken. If the branch is taken, the sign-extended displacement operand is added to the PC and the PC is replaced by the result.
Notes:
1.
Integer overflow occurs if the index operand, before the subtraction, is the largest possible negative integer. On integer overflow, the index operand is replaced by the largest positive integer, and thus the branch is taken.
2.
The C-Bit is unaffected.