LDC_W (0x13)


The LDC_W instruction loads a constant onto the stack. Its operand is a two-byte unsigned offset. The offset is added to the value stored in the CPP register to determine the address of the constant value.

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.

0x013  PC=PC+1; fetch; goto 0x27
...
0x027  H=MBRU<<8; goto 0x28
0x028  H=H OR MBRU; goto 0x29
0x029  MAR=H+CPP; rd; goto 0x19
...
0x019  SP=MAR=SP+1; goto 0x1a
0x01a  PC=PC+1; wr; fetch; goto 0x1b
0x01b  TOS=MDR; goto 0x2

Example Program

//---------------------------------------------
// Demonstrate the LDC_W 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
//     15 is stored at address 4097
// and the top of the stack is at 4097.
//---------------------------------------------
.constant
    myConstant 15
.end-constant

.main
    ldc_w myConstant
    halt
.end-main