INDEX Instruction

Purpose:Index calculation of arrays of fixed length data, bit fields and strings.
Format:opcode subscript.rl, low.rl, high.rl, size.rl, indexin.rl, indexout.wl
Operation:
indexout <- {indexin + subscript} * size;
if { subscript LSS low} or {subscript GTR high} then
{subscipt range trap};
Condition
Codes:
N <- indexout LSS 0;
Z <- indexout EQL 0;
V <- 0;
C <- 0;
Exceptions:Subscript Range Trap
Opcodes:
0AINDEXIndex
Description: The indexin operand is added to the subscript operand and the sum multiplied by the size operand. The indexout operand is replaced by the result. If the subscript operand is less than the low operand or greater than the high operand, a subscript range trap is taken.
Notes:
1.
No arithmetic exception other than subscript range can result from this instruction. Thus no indication is given if overflow occurs in either the add or multiply steps. If overflow occurs on the add step the sum is the low order 32 bits of the true result. If overflow occurs on the multiply step the index operand is replaced by the low order 32 bits of the true product of the sum and the size operand. IN the normal use of this instruction, overflow cannot occur without a subscript range trap occurring.