Difference between revisions of "Map Script Format"
Jump to navigation
Jump to search
Line 58: | Line 58: | ||
| Offset (Unknown) | | Offset (Unknown) | ||
|} | |} | ||
|- | |- | ||
| 0x08 | | 0x08 | ||
| variable | | variable | ||
Line 139: | Line 139: | ||
| Offset of data | | Offset of data | ||
|} | |} | ||
|- | |||
| 0x20 | |||
| 7 | |||
| Load MapTile/Collision data | |||
{| class="wikitable" | |||
|- | |||
! Offset | |||
! Length (Byte) | |||
! Name | |||
|- | |||
| 0 | |||
| 1 | |||
| Unknown | |||
|- | |||
| 1 | |||
| 1 | |||
| Type | |||
{| class="wikitable" | |||
|- | |||
! 0x08 | |||
! 0x40 | |||
|- | |||
| Load collision data | |||
| Load MapTile data | |||
|} | |||
|- | |||
| 2 | |||
| 1 | |||
| Unknown | |||
|- | |||
| 3 | |||
| 1 | |||
| Layer ID | |||
|- | |||
| 4 | |||
| 3 | |||
| Offset | |||
|} | |||
|- | |- |
Revision as of 11:54, 14 April 2012
When the game loads a map it looks at a pointer table at 0x06959C and runs a some kind of script to load the map parts.
There seem to be 1314(check) entries.
For some reason offsets are not directly read but calculated via this code: (don't ask!)
i.e. when loading map id 0 the first offset is 0x83FF05 which after the code is run turns into 0xA5FF83 (0x25FF83 ROM).
u32 Background::GetAddress() { u32 AdrLow = GetBytei(); u16 AdrHigh = GetWordi(); u8 push = AdrHigh & 0x7F; AdrHigh = push ^ AdrHigh; AdrHigh<<= 1; AdrHigh |= 0x80; AdrHigh |= push; AdrHigh += (((ROMOffset|(1<<23)) & 0xFF0000) >> 8); if( (AdrHigh & 0xFF00) >= 0xC000 ) AdrHigh &= 0xFF7F; return (AdrHigh<<8)|AdrLow; }
Commands
Opcode | Argument length (byte) | Function | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0x02 | 5 | Load data
| ||||||||||||||||||||||||||||||||||||
0x08 | variable | run sub command
| ||||||||||||||||||||||||||||||||||||
0x10 | 4 | Load data
| ||||||||||||||||||||||||||||||||||||
0x20 | 7 | Load MapTile/Collision data
| ||||||||||||||||||||||||||||||||||||
0x40 | 6 | Set palette for map
|