ISUB (0x64)


The ISUB instruction pops the top two elements from the stack, subtracts them, and pushes the difference back onto the stack. The first value popped from the stack is subtracted from the second value popped from the stack.

Interpreter Microcode

The microinstructions are listed in the order in which they are executed; not the order in which they are stored in the control store.

0x064  SP=MAR=SP-1; rd; goto 0x5
...
0x005  H=TOS; goto 0x6
0x006  TOS=MDR=MDR-H; wr; goto 0x2

Example Program

//---------------------------------------------
// Demonstrate the ISUB 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.
//
// After running this program
//     -2 is stored at address 4097
// and the top of the stack is at 4097.
//---------------------------------------------
.main
    bipush 4  // Push 4 onto the stack
    bipush 6  // Push 6 onto the stack
    isub      // Replace top two values with their difference (4 - 6)
    halt
.end-main