IAND (0x7E)


The IAND instruction pops the top two elements from the stack, performs a bitwise AND on them, and pushes the result onto 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.

0x07e  SP=MAR=SP-1; rd; goto 0x7
...
0x007  H=TOS; goto 0x8
0x008  TOS=MDR=H AND MDR; wr; goto 0x2

Example Program

//---------------------------------------------
// Demonstrate the IAND 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  6  // Push 0110 onto the stack
    bipush 10  // Push 1010 onto the stack
    iand       // Replace top two values with
               // 0110 & 1010 = 0010 (decimal 2)
    halt
.end-main