A collection of register machines in different states of configuration.
py_register_machine2.machines.small: a collection of small ready to use register machines
py_register_machine2.machines.gym_bav_16
A register machine compatible to the schedule of the bavarian gymnasium.
Differences:
rX
instead of X
(i.e. r5
instead of 5
);
instead of --
. (see this)Examples
Old style:
0: DLOAD 1 -- load stuff
1: STORE 1 -- store stuff
2: DLOAD 5
3: SUB 1
4: HALT
New style:
DLOAD 1 ; load stuff
; comments can take a complete line
; store stuff
STORE r1
DLOAD 5
SUB r1
HALT
Note:
You are able to change the commentstart strings using the argument commentstarts
:
asm = Assembler(processor, stream, commentstarts = ["--"])
Generate a register machine using
from py_register_machine2.machines.gym_bav_16 import machine
processor, rom, ram, flash = machine()
Note:
This machine does not provide a RAM or Flash device by default.
You can change the number of registers and the size of the ROM by
passing the attributes to the function machine(romsize = 200, numregister = 15)