All addresses are in hexadecimal.
Address | C definition | Description |
---|---|---|
298 | Related to Random, also incremented on every VIP interrupt (halfword) | |
2A8 | Related to Random (word) | |
2AC | Last read controller status (halfword) | |
2AE | Related to controller; accessed by function 84D2 | |
2B0 | Related to controller; accessed by function 84D2 | |
2B2 | Related to controller; accessed by function 84D2 | |
2B4 | Related to controller; accessed by function 84D2 | |
2B6 | Related to controller; accessed by function 84D2 | |
2B8 | Related to controller; accessed by function 84D2 | |
2BC | Accessed at interrupts, related to OAM? | |
292 | Related to intermission? (halfword) | |
294 | s16 gGameState | Global game state; see main function |
296 | Set to 0 by function 1218A | |
29A | Related to VIP? Accessed by function 8EBE (halfword) | |
23D8 | 5600-byte space zeroed at credits roll | |
2448 | 112-byte space zeroed by code at 118C8 | |
39B8 | gAutoPauseTimer | Time until next automatic pause (in frames times 2?) |
39BC | gAutoPauseOn | Automatic pause setting |
39C0 | char gPassword[4] | Password of last finished level; set to four spaces in main |
39C4 | 0 if the player deserves to get ending A (halfword) | |
39C8 | tyMonster gMonster[6] | Monsters; see below |
3CF0 | s16 gAmmo | Ammo |
3CF2 | s16 gStock | Stock |
3CF4 | s16 gHealth | Health |
3CF6 | Password index of starting level; set at 19C82 and in main function but never read? (halfword) | |
3CF8 | s16 gCurPasswordIndex | Password index of current level |
3CFA | s8 gPlayerX, s8 gPlayerY | Player coordinates (halfword - lower 8 bits X, upper 8 bits Y) |
3CFC | Duplicate of player coordinates (investigation needed) | |
3CFE | s16 gPlayerDirection | Player direction (1 up, 2 down, 3 right, 4 left) |
3D00 | Array of 32 halfwords; accessed by functions 12EE8, 12F7C, A15A | |
3D40 | Array of pairs of halfwords; see 12214 | |
466C | s16 gLayout[24][24] | The current layout; see below |
4AF6 | Incremented by function 12EE8, set to 0 by function 12F7C, accessed by function 17526 (halfword) | |
4AFC | Dynamically generated BGMap for automap? | |
6AFC | s16 gKey | Nonzero if player has key |
6AFE | s16 gWhiteOrb | Nonzero if player has white orb |
6B00 | s16 gBlackOrb | Nonzero if player has black orb |
6B02 | Set to 0 at start of gameplay | |
6B04 | Accessed on VIP interrupts | |
6B0A | Related to time? (set to 0 by function 121E2) | |
6B0C | Related to time? (set to 0 by function 121E2) | |
6B0E | Accessed on VIP interrupts | |
6B10 | Accessed on VIP interrupts | |
6B14 | u32 gFrameTimer | Video frames before timer goes off (times 2? see CalcLevelFrames) |
6B18 | gSecondTimer | Seconds until end of level |
6B1C | s16* gVIPRegs | Always points to 0x5F800 |
6B20 | Accessed by function 17526 (halfword) | |
6B40 | s16 gIntermissionDots[45] | State of dots on intermission map (45 halfwords) |
Note: names of unknown fields end with their hexadecimal offsets.
The whole structure is 56 bytes long.
typedef struct
{
s16 h0; // Affects visibility (but not existence) of monster
s16 Small; // Nonzero if small
s16 Bright; // Nonzero if bright
s16 h6; // Initialized to -1 at start of level
s16 h8; // Checked by function 11D22, ORed with 1 by function F3C4
s16 hA; // Initialized to -1 at start of level
s16 hC; // Explicitly initialized to 0 at start of level (after ZeroMem call)
s16 hE; // Changes _very_ often
s16 h10; // Direction? (initialized to second byte of tyROMMonster)
s16 h12;
s16 h14; // Set to -1 _very_ often
s16 X; // X coordinate shifted left by 16 bits
s16 Y; // Y coordinate shifted left by 16 bits
s16 Health;
s16 h1A; // Starting health used for respawning?
s16 h1E; // Gets changed at F39E
s16 h20; // A counter of some sort
s16 h22;
s16 AttackTimer; // When this is 0, the monster attacks if next to player
s16 h26;
u8 Unknown[16]; // Datatypes of other fields are not known
} tyMonster;
Each tile is a halfword. Bit values:
Bit number | Bit value | Meaning |
---|---|---|
0 to 2 | Same as in ROM | |
3 | 0x0008 | Contains a heart |
4 | 0x0010 | Contains ammo |
5 | 0x0020 | Contains a white orb |
6 | 0x0040 | Contains a black orb |
7 | 0x0080 | Contains a key |
8 to 13 | Unused? | |
14 | 0x4000 | Tile was visited by player |
15 | 0x8000 | Contains a lamp |