I've tracked down where it's jumping too, and have labels for those now but is there a way to fix the code so that it's not full of hardcoded numbers? I kinda want to do something like:
; The animated 'Treasure' logo
TreasureScreen_00062892:
MOVE.b Pad1Buttons.w, D0
OR.b Pad2Buttons.w, D0
BTST.l #Pad_Start, D0
BNE.w SkipToTitleScreen_00062B36
MOVE.w CurrentScreenState.w, D0 ; Screens from 0->C in incs of 2
LEA jmpTreasureSubState_000628AE(PC,D0.w), A0
ADDA.w (A0), A0 ; adda src+dest -> dest. word-contents of A0 added to A0, stored in A0.
JMP (A0)
jmpTreasureSubState_000628AE:
@stateA
dc.w TreasureSubA_000633B0-@stateA ; 0
@stateB
dc.w TreasureSubB_000628BC-@stateB ; 2
@stateC
dc.w TreasureSubC_00062902-@stateC ; 4 - offset to TreasureSubC_00062902 - unfold anim
@stateD
dc.w TreasureSubD_00062958-@stateD ; 6 - offset to TreasureSubD_00062958 - unfold anim part 2
@stateE
dc.w TreasureSubE_0006299C-@stateE ; 8 - offset to TreasureSubE_0006299C - single frame state
@stateF
dc.w TreasureSubF_00062A74-@stateF ; A - offset to TreasureSubF_00062A74 - unfold anim part 3
@stateG
dc.w TreasureSubG_00062AE0-@stateG ; C - offset to TreasureSubG_00062AE0 - unfold anim part 4 + detail appear
Feels like a weird way of doing it IMHO, when the regular way of doing jmp tables is much more readable. Any idea why it would be done like this? Performance can't be the reason as this is just the animated 'Treasure' logo at the beginning of the game.
I guess that kinda makes sense - it's a 1Mb rom and only 176 bytes of spare padding at the end so things are pretty tight.
Having said that, there's also a massive 664 entry jump table (that I'm guessing is game object logic) that does things the long way. Nothing's perfect I guess.
Probably worth noting that often the code is just whatever the programmer could think of first at that moment that was decent enough, not necessarily the best solution. No point changing things as long as they work and don't get in the way.