4 ms·
I like how the start of every bank contains a bank switch shim like this: SEI INC $C006 JMP BEGIN Then it goes into a lot of detail about how it does t
by ralferoo 3y ago
I like how the start of every bank contains a bank switch shim like this:
SEI
INC $C006
JMP BEGIN
Then it goes into a lot of detail about how it does this to save space, but it seems to me that the only reason the JMP is even needed is because of the instruction pipeline, which could be flushed with just a NOP. So here's my 2 byte optimisation to this code:
SEI
INC $FFFD ; use the C0 in the instruction vector instead
NOP
- qwery 3y ago> it seems to me that the only reason the JMP is even needed is because of the instruction pipeline It does also make sense to a human -- execution begins in bank 7, so jump to bank 7. Side note: on Game Boy the entry point is in ROM0, a fixed bank (at least on the common MBCs), so you don't have this problem in the first place.
- MarkMoxon 3y agoAlso, the JMP BEGIN approach will still work even if you move the BEGIN routine elsewhere in bank 7, so presumably it's done this way so things won't break during development when you're still trying to work out which bit of code goes where. There are quite a few remnants of code in the NES version that do nothing - I guess with 128K of ROM, the authors didn't need to go hunting for every single optimisation, unlike the BBC Micro version...