Tue Oct 4 20:01:55 EDT 2005

Toy Machine Simulator -- Single-step version

(You must have Javascript enabled.) Type your program in the left window. Labels must start in the first column and operators like "get" or "add" must start anywhere but the first column. The simulator does not distinguish upper case from lower case.

Push RUN to run your program. Output will appear in the right window. Push RESTART to restart, then STEP to single-step your program; the next instruction to be executed will be displayed.

               Accumulator:

          Next instruction:

Syntax reminder

get      get a number from keyboard into accumulator
print    print contents of accumulator
load M   load accumulator with contents of location M (M unchanged)
store M  store contents of accumulator into location M (accumulator unchanged)
add M    add contents of location M to contents of accumulator (M unchanged)
sub M    subtract contents of location M from contents of accumulator (M unchanged)
goto L   go to instruction labeled L
ifpos L  go to instruction labeled L if accumulator is greater than zero
ifzero L go to instruction labeled L if accumulator is zero
stop     stop running
init V   initialize this memory location to value V (once, before program runs)