
Register Machine Emulator
The pen, representing the program counter, is positioned at the first line of the program. The instruction on that line is processed by modifying the value of a register, or checking if a register is Zero and then moving to the next instruction. The evaluation stops upon reaching a halt or empty instruction.
CLR(r)
: Set register r to Zero.INC(r)
: Add 1 to the register r.DEC(r)
: Subtract 1 from register r.CPY(a, b)
: Copy the register a in register b.JZ(r, i)
: If register r is Zero, jump to instruction i.JE(a, b, i)
: If the registers a and b are equal, jump to instruction i.
incoming paper rewriting