The IINC instruction increments a local variable. This instruction has two operands: a 1-byte unsigned offset and a 1-byte signed integer value. The offset is added to the value in the LV register to determine the location of the variable that is to be incremented. The signed integer is added to the value of that variable: Mem[LV + offset] = Mem[LV + offset] + value.
If the IINC instruction is preceded by the WIDE instruction, the first operand is a 2-byte offset. This larger offset makes it possible to address more than 256 variables.
When writing assembly code, the first operand must be a variable or parameter identifier defined within the method containing the IINC instruction. The second operand is a decimal integer in the range -128 to 127.
The microinstructions are listed in the order in which they are executed; not the order in which they are stored in the control store.
0x084 H=LV; goto 0x2a ... 0x02a MAR=H+MBRU; rd; goto 0x2b 0x02b PC=PC+1; fetch; goto 0x2c 0x02c H=MDR; goto 0x2d 0x02d PC=PC+1; fetch; goto 0x2e 0x02e MDR=H+MBR; wr; goto 0x2
//--------------------------------------------- // Demonstrate the IINC instruction. // // 1. Clear Memory // 2. Assemble this program. // 3. Reset the computer. // 4. Click the "Display Words" radio button // below the memory display. // 5. Click the "Run" button. // // The LV register points to address 8192. This // is the address of 'value'. The final value // of 'value' is 15. //--------------------------------------------- .main .var value .end-var bipush 10 istore value // value = 10 iinc value 10 // value = value + 10 iinc value -5 // value = value + (-5) halt .end-main