Editor
  • Asm Editor
  • Control

    Introduction: Loading Numbers

    Welcome to the TomVM virtual computer simulator! To get started, let's learn how to type a program into the Editor window. The default tab is for writing assembly code, which is directly translated into instructions that the machine will execute. The most basic instruction is called Imm, for loading an immediate value. An immediate is just a number! To load the number 17 into the A register, you would write Imm A 17. Each instruction must go a new line.

    There is one more instruction we need before we can run programs. We need to tell our program how to stop. For now, you'll need to take my word about how this works - we use an instruction called System to issue a special command to the virtual computer. In this case, we want to send signal 15, which will tell the virtual computer to halt. We will first use the Imm instruction to load a value, then the System instruction. Type this code into the editor and try running it:

    IMM A 24
    SYSTEM Zero Zero 15

    To pass this first exercise, run the code given above. If you see any errors, read them carefully but don't be scared. This is a virtual computer environment, you can't break anything :) When you think your code is correct, hit the submit button and your submission will be graded. You will see the overall size of your final program, and how many processor cycles it took to complete. Fewer cycles means your code is faster, but don't worry about that yet.

    When you're ready, click next at the top of this page.