4-bit virtual CPU
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
889 B

# Mistakes
## Don't design opcodes in your head
You WILL frick up and your binary encodings WILL overlap.
You definitely need some tool to design instruction opcodes
for anything more complicated than just 1-byte instructions.
Turned out this mistake propogates further when implementing
assembler.
## Load/store instructions MUST be able to use register as address
I have no idea how we didn't notice this mistake.
I guess it is not too bad for a CPU with 16 bytes of memory,
but for something bigger it is unacceptable.
## Jump instructions need more love
Jumping 3 instructions back and 7 forward is too limiting.
Seriously, that's stupid.
Also, in my current design, jumping offset of 0 will
move CPU to an infinite loop.
## Implementing assembler with regex is not fancy
It is probably easier to implement than writing proper
lexer/parser, but error reporting can be weird.