I finally had time to look at what VL-Tone calls in his doc 'behaviour scripts' but they are nothing more than short assembly language routines so I can tell you exactly what is happening. From his doc he writes:
The 0x0C command calls ASM functions found in RAM.
[0C] [00 00 00] [80 2A CC 3C]
[0]= 0C is the command byte.
[1,2,3]= Always zero, unused?
[4,5,6,7]= Offset in RAM of the ASM function.
I can tell you that 0x0C is the ASM JAL (Jump And Link, a procedure call) and the three bytes [1,2,3] are always zero so that translates to JAL 0x80000000. Because of the delay slot the next instruction is also executed which VL-Tone calls the offset in RAM of the ASM function and that's where I'm confused.
It does look like a pointer to ASM and indeed of the ones I've checked there is coding there but it's actually an instruction that supposedly is the offset in RAM, the instruction loads a byte into a register; the offset is half the address. I'll stop there and not go into any more detail unless you want me to as to be kind to those who are unfamiliar with MIPS ASM.
In a RAM object there seems to be 3 behaviour pointers which is somewhat supported by VL-Tone's doc. Change these values and the object behaves differently but if you swap the behaviour values in the scripts it has a global effect so that, for e.g., all Bob-ombs act like Goombas! I guess you could do the same with a ROM hack which essentially is what Toad's Tool does.
What my finding means is that I can look at any object in the RAM and identify what the behaviour is but that of course means there has to be an object that uses that type of behaviour.
But I now have doubts if it is pure ASM because it doesn't make sense even converted from C. What it seems to do, apart from the call to the behaviour coding, is set the state of certain variables in each RAM object that uses that type of behaviour.
Taken from VL-TONE's doc for the Toad message behaviour:
21CCFC/002EFC 11 01 40 49
The 4049 is copied to the variable in the Toad object that determines how it reacts to Mario.
I hope this is of help and I'd be happy to add more if you want me to.
James S.
____________________
We English do things a little differently...Anyone for a cup of tea while we hack?! |