Skip to content
Xuming Zeng edited this page Oct 27, 2016 · 6 revisions

js-y86 is a simulator that compiles and interprets y86 code in the web browser. Currently, it has the following functionality:

  • Compile and run y86 code
  • See registers and status after each instruction using Step
  • Set breakpoints
  • Syntax highlighting
  • See your errors as you type

You should write your code in another code editor and paste it into the simulator in order to avoid loss of work due to browser crashes and the such. The y86 simulator will not save your code between page loads. However, it will warn you if you try to navigate away from the page.

Please report bugs or request features in the issue tracker.

Assembling and running code

To assemble the code in the Source Code panel, click the Assemble button at the top of the page. This will display your assembled object code in the Object Code panel.

To run your code after compilation, click Start. This will run the code until it hits a breakpoint, halts, or runs out of instructions.

Setting breakpoints

To set a breakpoint, put a brkX command in your code, where X can be le, l, e, ne, ge, g, or nothing. An unconditional brk will always pause execution, and a conditional brk, like brke, will only break if the right condition codes are set.

When using your code with other compilers/simulators or turning it in to be graded, you should remove all the brk commands in your code, since it is a non-standard language extension.

Stepping through and using registers

When execution is paused, you can view the content of the registers, condition flags, and the program counter. Here, you may execute a single instruction and go back to the paused state by clicking the Step button, or you may click Continue to continue execution until you hit the next breakpoint or the machine halts.

Further reading

For more information on how to get started with Y86, read the original documentation.