CODE
ROM:06005ED8; if a command does not specify that it takes a byte argument then a byte 0 must follow the command byte and preceed a offset/word argument
ROM:06005ED8 off_6005ED8: .data.w sub_6005E84 - loc_6005E72; DATA XREF: sub_6005E4E+1Co
ROM:06005ED8 ; 0 byte offset - nextpos += offset; r13[byte].w = somefunction()
ROM:06005EDA .data.w sub_6005E90 - loc_6005E72; 2 - stop
ROM:06005EDC .data.w sub_6005E9C - loc_6005E72; 4 offset - gosub (nextpos + offset)
ROM:06005EDE .data.w sub_6005EA8 - loc_6005E72; 6 offset - nextpos += offset
ROM:06005EE0 .data.w sub_6005EB0 - loc_6005E72; 8 byte offset - r13[byte].w--; if (r13[byte].w != 0) nextpos += offset
ROM:06005EE2 .data.w sub_6005EC0 - loc_6005E72; $A byte word - r13[byte].w = word
ROM:06005EE4 .data.w sub_6005EC8 - loc_6005E72; $C byte word - r13[byte].b = (word & 0xFF)
ROM:06005EE6 .data.w sub_6005ED0 - loc_6005E72; $E byte - r13[5].b = byte (TODO)
So apparently Chaotix has some sort of bytecode for special stage events. Here's an example:
CODE
ROM:06006ABC SS_GoalChain: .data.b 4 ; DATA XREF: ROM:06005018o
ROM:06006ABC ; ROM:off_6005028o
ROM:06006ABC ; DONE
ROM:06006ABC ; loc_6005E68
ROM:06006ABC ; so begins the end of stage tests
ROM:06006ABC ; this will do the check and reroute the engine if the check fails
ROM:06006ABD .data.b 0
ROM:06006ABE .data.w sub_6006AE8 - byte_6006AC0; DONE
ROM:06006AC0 byte_6006AC0: .data.b 4 ; DATA XREF: ROM:06006ABEo
ROM:06006AC0 ; if it succeeds, the engine will fall here
ROM:06006AC1 .data.b 0
ROM:06006AC2 .data.w sub_6006CEA - byte_6006AC4; DONE
ROM:06006AC4 byte_6006AC4: .data.b 4 ; DATA XREF: ROM:06006AC2o
ROM:06006AC5 .data.b 0
ROM:06006AC6 .data.w sub_6006B3C - byte_6006AC8; DONE
ROM:06006AC8 byte_6006AC8: .data.b 4 ; DATA XREF: ROM:06006AC6o
ROM:06006AC9 .data.b 0
ROM:06006ACA .data.w sub_6006B20 - byte_6006ACC; DONE
ROM:06006ACC byte_6006ACC: .data.b 4 ; DATA XREF: LoadSpecialStageStuff+116o
ROM:06006ACC ; ROM:off_6005E20o ...
ROM:06006ACC ; DONE
ROM:06006ACD .data.b 0
ROM:06006ACE .data.w sub_6006BC8 - byte_6006AD0; DONE
ROM:06006AD0 byte_6006AD0: .data.b 4 ; DATA XREF: ROM:06006ACEo
ROM:06006AD1 .data.b 0
ROM:06006AD2 .data.w sub_6006B3C - byte_6006AD4; DONE
ROM:06006AD4 byte_6006AD4: .data.b 4 ; DATA XREF: ROM:06006AD2o
ROM:06006AD5 .data.b 0
ROM:06006AD6 .data.w sub_6006C4A - byte_6006AD8; DONE
ROM:06006AD8 byte_6006AD8: .data.b 2 ; DATA XREF: ROM:06006AD6o
ROM:06006AD9 .data.b 0
All the bytecode programs are static in ROM, so I read through them all (there are chains of them) and now there should be only very specific cases in which I wouldn't be able to find a routine that accesses the special stage layout chunk, which is copied and rebased to a piece of SDRAM because it contains one pointer that points to a list of variables (ok why?).
EDIT
FFFFFFFFFFFFFFFFFF Turns out I now need to hunt down those cases because I still can't find the accesses I need
This post has been edited by Andlabs: 21 July 2010 - 08:57 PM