The OUT instruction pops the top element from the stack, extracts the low-order byte, and writes that byte to the input/output window as character data.
The memory location at word-address 0x3FFD serves as a memory-mapped input/output port. When the microprogram writes to this address, the simulator extracts the low-order byte and sends it to the input/output window. The byte must represent a printable character, a backspace character or a new line character. Other byte values are ignored.
Note: the simulator word address space is 0x0000 to 0x3FFF. The I/O port address, 0x3FFD, corresponds to decimal -3. The microcode that interprets this instruction generates this address by performing the signed arithmetic (-1) + (-1) + (-1).
The microinstructions are listed in the order in which they are executed; not the order in which they are stored in the control store.
0x0fd H=OPC=-1; goto 0x86 ... 0x086 OPC=H+OPC; goto 0x87 0x087 MAR=H+OPC; goto 0x88 0x088 MDR=TOS; wr; goto 0x89 0x089 ALU=0; goto 0x8a 0x08a SP=MAR=SP-1; rd; goto 0x8b 0x08b ALU=0; goto 0x8c 0x08c TOS=MDR; goto 0x2
//--------------------------------------------- // Demonstrate the OUT 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 text "OUT" will be displayed in the // input/output window and the cursor will // be at the beginning of the next line. //--------------------------------------------- .main bipush 'O' out bipush 'U' out bipush 'T' out bipush 10 // new line out halt .end-main