Mon Sep 29 13:57:31 EDT 2008

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 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 >= zero
  ifzero L  go to instruction labeled L if accumulator is zero
  stop      stop running
  Num       initialize this memory location to numeric value Num (once, before program runs)