a urm emulator

2012–10–31

Well, my attempt one anyway

why did i bother?

The answer to which is that I got fed up writing out trace tables half-way through unit one and my suspicion is that there was going to be a lot more of this. So I had the thought, “why not write something in JavaScript?”. So here it is my attempt…

the emulator

You are allowed four commands:

  1. Z(x) //zero register x
  2. C(x,y) //copy the contents of register x into register y
  3. S(x) //add 1 to the contents of register x
  4. J(x,y,z) //if the contents of register x equal the contents of register y, then jump to line z of the programme.

From a suggestion, from Robin H, I’ve included a default URM that calculates the square of the first register. Then click the clear button to get started, remembering to look at the registers.

emulator

Separate commands with some kind of whitespace. Case doesn't matter.

The register values should be separated by some kind of whitespace. Remember to include enough so that we don’t get out of our bounds.

Hit clear before you input anything else.

Output