Tue Sep 26 13:09:41 EDT 2006

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.


          Next instruction:

Syntax reminder

get       get a number from keyboard into accumulator
print     print contents of accumulator
load Val  load accumulator with Val (Val unchanged)
store M   store contents of accumulator into memory location M (accumulator unchanged)
add Val   add Val to contents of accumulator (Val unchanged)
sub Val   subtract Val from contents of accumulator (Val 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)