An assembler and emulator for the subleq OISC from Wikipedia.
I got bored.
There are two programs included.
as is the subleq compiler. It will take an assembly file and assemble it into emu machine code.
Run it as ./as <input file> <output file>
.
You can use any of instructions on Wikipedia, along with:
- NOP: Do nothing
- SUBLEQ: This instruction will be inserted into the output verbatim. If c is not given, it is assumed to be the next instruction.
- HALT: Stop the machine
- DATA: This can take up to three arguments, which will be inserted verbatim. Arguments not given will be assumed zero.
emu is the subleq computer emulator.
Run it as ./emu <machine code file>
The file will be mutated to represent the state of memory after the execution.
Compile everything with make
, or make as
and make emu
. Clean up with make clean
.
not
is not yet implemented, as I haven’t gotten around to converting it from subleq2 to subleq. PR accepted.
More Instructions! PR accepted!