(10-04-2016, 08:28 PM)David Wrote: I've got some updates to 4 more commands: 0x02, 0x00, 0x10, and 0x19.
Thanks David. I have updated the
Geo Layout wiki page with your new findings. I have a couple comments about some of them below.
(10-04-2016, 08:28 PM)David Wrote:
Geo Layout CMD 0x02: Branch/Jump to segmented address
02 [AA] 00 00 [SS SS SS SS]
[AA] decides if the command is a branch or a jump.
For 0x02, I would recommend different terminology than 'branch' and 'jump' because they effectively mean the same thing (although branch generally being relative and jump absolute). I'd recommend 'jump' and 'jump and link' since they are absolute addresses and one variant saves the return address.
(10-04-2016, 08:28 PM)David Wrote:
Geo Layout CMD 0x10: Applies translation & rotation to the following node.
10 [AA] [BB BB] [XX XX] [YY YY] [ZZ ZZ] [XR XR] [YR YR] [ZR ZR]
[ 10 00 00 00 00 8E FF CD FF 82 00 16 FF D8 FF 79 ] # a 0x10 cmd used in Mario's Geo Layout
The ASM code of this command branches based on the first digit of the AA byte, but the game crashes if I try to use something other than 0x00. BB seems to be used in the code when AA != 0x00.
I am still trying to figure out what is going with AA in command 10. It looks like the code first masks bits 5-7 (0x70) and compares those bits with 4 different AA cases (0, 1, 2, 3) to determine how the following data is handled.
AA = 0 reads X,Y,Z as s16 and RX,RY,RZ by: (val << 15) / 180
AA = 1 reads X,Y,Z as s16 and RX,RY,RZ as s16 (although using different function)
AA = 2 reads X,Y,Z by: (val << 15) / 180 and RX,RY,RZ as s16
AA = 3 does something different, reading X,Y,Z as s16, then (val << 15) / 180 for one of the values?
I'm still unclear on what the remaining bits in AA do. I see some geo layout 0x10 commands for some enemies have the upper and lower bits (0x81) of AA set.
(10-04-2016, 08:28 PM)David Wrote:
Geo Layout CMD 0x19: Set background image or color.
19 00 [TT TT] [AA AA AA AA]
TT = RGBA5551 background color if AA == 0x00.
otherwise, TT = background ID number? (0 to 9)
This is great info! I have some ideas that I want to try with this, but for now just testing out a nice '19 00 F529 00000000' on castle grounds: