A Simple Computer Simulator

This computer demonstrates the workings of a simple computer. It has 100 memory locations in a 10 by 10 grid with addresses 0 to 99 numbered from the top left row by row. The computer has a program counter which is stored in register PC and an accumulator AX. You may single step through a program or run it in one sequence. You may also specify the delay speed to observe the actions of the machine. Memory cells that are referenced become green for one instruction, those that are changed become red. This demonstrates some of the aspects of machine and assembly language programming.

This simulator was originally written as a Java applet by Barry G. Adams of Laurentian University. Several features were added by Curt Hill of Valley City State University. Cay Horstmann reimplemented the simulator in JavaScript.

The following table shows the instructions that are available for this computer:

Mnemonic Code (1st word) Code (2nd word) Description
STORE 160 n Store the contents of AX in memory location n
LOAD 161 n Load AX with the contents of location n
ADDI 44 n Add n to AX (add immediate)
SUBI 45 n Subtract n from AX (subtract immediate)
ADD 50 n Add the contents of location n to AX
SUB 51 n Subtract the contents of location n from AX
MUL 52 n Multiply the contents AX by the contents of location n
DIV 53 n Divide the contents of AX by the contents of location n
JPOS 127 n Jump to the instruction in location n if AX > 0
JZERO 128 n Jump to the instruction in location n if AX = 0
HALT 0 Halt the execution

Registers: PC AX
Delay