A Java Applet for 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. When input is needed the execution is suspended, the user may type a number in the input box and click on the Enter Input button.

This demonstrates some of the aspects of machine and assembly language programming.

This applet was originally written by Barry G. Adams of Laurentian University. Several features were added by Curt Hill.

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
INPUT 71 n Enable input button and accept input into location n
OUTPUT 72 n Output 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

The Java source in a zip file.

Return to the simulators page.

Curt's Home Page.

Last time I updated this page: February 17, 2012