Imaginary Computer Machine Version 04.3.04 ------------------------------------------------------- The Imaginary Computer Instructions: 8 bits wide: Left-most 3 bits (***-----) = Operation Code (opcode) Right-most 5 bits (---#####) = Operand [opcode ] [ operand] --------- --------------- [*][*][*] [#][#][#][#][#] The Imaginary Computer Instruction Set: 000 HLT Halt execution of the program. 001 LOD Load a copy of the value in the referenced memory location in the accumulator. 010 LDC Load the constant value of the operand in the accumulator. Note: limited to 5 bits (-16 to +15) 011 STO Store a copy of the contents of the accumulator in the referenced memory location. Note: the value in the accumulator does not change 100 ADD Add the value in the referenced memory location to the value in the accumulator; store result in the accumulator. 101 SUB Subtract the value in the referenced memory location from the value in the accumulator; store result in the accumulator. 110 JMP Jump to the referenced memory location if the value of the accumulator is a positive number (equal or greater than 0). 111 JMZ Jump to the referenced memory location if the value of the accumulator is 0. Binary (base 2) machine instructions and data can be entered directly in the main memory cells. Assembly instructions can be entered in the Assembly Code window and assembled; binary machine instructions will be produced in the Machine Code window where it can be loaded into main memory. Program execution begins at memory address 0. Data can be directly entered in main memory or assigned using the assembler DEF directive. (see the examples) The accumulator and memory cells *should* simulate an 8- bit "word"; numbers are represented as 8-bit signed (two's compliment) integers. (Technical Note: internally the accumulator and memory space are JavaScript 32-bit integers, truncated and sign-extended to simulate 8-bit integers) ------------------------------------------------------- Change log: 04.3.01 26 MAR 2004 initial release posted 04.3.02 27 MAR 2004 added tool-tips to buttons, URLs 04.3.03 11 OCT 2005 fixed Machine Code Load command 04.3.04 21 OCT 2005 fixed Machine Code Load again :-( ------------------------------------------------------- Author: Mike Huffman Portland Community College, Portland, OR mhuffman aracnet.com mike mhuffman.com http://www.mhuffman.com/ -------------------- Revised: 21 OCT 2005 --------------------