Jump instructions now relative

Got back up to speed on the project recently after some time away (pandemic), and picked up where I left off.

I’d meant to make the jmp instructions PC-relative originally, but ended up implementing them as absolute temporarily until I got the rest of the architecture a bit further along, then go back. I finally went back and did that, and all jump instructions (conditional and unconditional) are now relative to PC.

An immediate operand of 0 means “skip nothing, continue with next instruction), 1 means “skip one byte then continue”, etc. Negative operands skip backwards, and you need to wind backwards through the jmp instruction itself first. This is kind of annoying but the way most other architectures seem to work, and there’s no way around it that wouldn’t mean a lot more cycles to execute it. As it is switching to relative means one extra cycle on each jump, but it’s a lot more flexible so I think it’s worth the extra ~40ns per jump.

Next up is probably going back to the toolchain for a bit, as work on that may mean realizing I need to modify other aspects of the architecture to work better with it.