RAM map (Boktai 1): Difference between revisions

From Boktai Hacking Wiki
No edit summary
Line 1: Line 1:
This is the RAM map for Boktai 1 (U). <!-- Please create a new page for maps of other languages! For example "RAM map (Boktai 1, J)". -->
This is the RAM map for Boktai 1 (U). [[ROM map (Boktai 1)|Go to ROM map]].
<!-- Please create a new page for maps of other languages! For example "RAM map (Boktai 1, J)". -->


= EWRAM =
= EWRAM =
{| class="wikitable"
|-
! Address || Type || Description
|-
| 0x020011c0 || i32 || [[Solar sensor]]: Calibrated level (0=dark, 140=max brightness. Calibrated level = calibration - raw level, then clamp to 0-140)
|-
| 0x020011c2 || i32 || Solar sensor: Bars. Calculated from calibrated level (0=dark, 8=max brightness)
|-
| 0x0203c800 || u16[1024] || [[Random number generator|RNG table]] (generated by the bootstrap RNG once on power-on)
|-
| 0x0203d800 || byte[?] || [[#Stat struct]]
|-
| 0x0203e000 || byte[?] || Stat struct - backup (created on screen transitions, reloaded on death, saved to save file when saving)
|-
| 0x0203e800 || byte[?] || [[#World struct]]
|-
| 0x0203ec00 || byte[?] || World struct - backup
|-
| 0x0203f000 || byte[?] || [[#Scratch struct]]
|}


== Stat struct ==
== Stat struct ==
Line 7: Line 29:
|-
|-
! Address || Type || Description
! Address || Type || Description
|-
| 0x0203d80a || i16[7] || Grenade amounts
|-
| 0x0203d88c || i16 || Equipped lens
|-
| 0x0203d88e || i16 || Equipped frame
|-
| 0x0203d892 || i16 || Equipped grenades
|-
| 0x0203d892 || i16 || Equipped battery
|-
|-
| 0x0203d8b0 || i32 || Unlock Astro battery (must be set to <code>*(*0x03001c90 + 0x7dc)</code>)
| 0x0203d8b0 || i32 || Unlock Astro battery (must be set to <code>*(*0x03001c90 + 0x7dc)</code>)
|-
|-
| 0x0203d8f0 || i16[3] || Django position
| 0x0203d8f0 || i16[3] || Django position
|-
| 0x0203d91e || i32 || Solar sensor: Calibrated level (see 0x020011c0)
|-
| 0x0203dc18 || i16 || Item inventory size
|-
| 0x0203dc1a || i16[42] || Item inventory IDs
|-
| 0x0203dc6e || i16[42] || Item inventory amounts
|-
| 0x0203dcc4 || i32 || Lens inventory (bitmask, 1 bit per lens and level)
|-
| 0x0203dcc8 || i32 || Frame inventory (bitmask)
|-
| 0x0203dcd0 || i32 || Battery inventory (bitmask)
|-
| 0x0203dcd8 || i16[8] || Lens EXP
|}
== World struct ==
{| class="wikitable"
|-
! Address || Type || Description
|-
| 0x0203e8c5:6 || bit[64] || "Chest opened" flags for current area (resets on area change)
|}
|}


Line 35: Line 91:
! Address || Type || Description
! Address || Type || Description
|-
|-
| 0x03004610 || void** || Pointer to current [[Map file]] descriptor (usually/always 0x02000010)
| 0x03000630 || i32 || Solar sensor interface: State (0=measuring, 1=resetting, 2=idle)
|-
| 0x03000634 || i32 || Solar sensor interface: Counter (0-511, counts half-cycles of the 74LV4040 counter chip)
|-
| 0x0300063c || i32 || Solar sensor interface: shift out (next value to be written to GPIO_DATA)
|-
| 0x03000648 || void* || [[Script directory]]: Script index pointer
|-
| 0x03000648 || void* || Script directory: Script count
|-
| 0x03000108 || treasure_data* || Pointer to this map's [[#Treasure data]] (NULL if map has no treasures)
|-
| 0x03001c2c || i16 || Solar sensor: Bars. See 0x020011c2.
|-
| 0x03001c90 || void* || Pointer to Django's actor data?
|-
| 0x03001cc8 || void* || Pointer to linked list of bat enemies?
|-
| 0x03004478 || i32 || [[Random number generator|Bootstrap RNG seed]]
|-
| + 0x18 || i32 || Current lens level
|-
| + 0x7dc || i32 || Astro battery unlock password
|-
| 0x030044f8 || i32 || Solar sensor interface: Is enabled (true/false)
|-
| 0x030044fc || i32 || Solar sensor interface: Last result (GPIO_DATA & 8)
|-
| 0x03004508 || i32 || Solar sensor interface: Raw level (counter / 2 when GPIO_DATA & 8 becomes nonzero. 0=max brightness, 255=dark)
|-
| 0x03004520 || void* || [[Bytecode]]: Program counter
|-
| 0x03004524 || void* || Bytecode: Return value
|-
| 0x0300450c || i32 || Solar sensor interface: Timer interval (TM3CNT_LO will be set to -this value)
|-
| 0x03004610 || struct* || Pointer to current [[Map file]] descriptor (usually/always 0x02000010)
|-
|-
| + 0x00 || i32 || Number of [[Map file#Zone data|Zones]]
| + 0x00 || i32 || Number of [[Map file#Zone data|Zones]]
Line 54: Line 146:
|-
|-
| 0x03004620 || i32 || [[Random_number_generator|RNG]] index
| 0x03004620 || i32 || [[Random_number_generator|RNG]] index
|-
| 0x030046a8 || struct* || Pointer to [[#Save data header]] (usually/always? 0x03000768)
|-
| 0x030046c4 || struct* || Pointer to [[#Global save data]] (always 0x03000750)
|-
|-
| 0x030046e8 || i16[3] || [[Coordinate systems|Camera]] position
| 0x030046e8 || i16[3] || [[Coordinate systems|Camera]] position
|}
|}
== Save data header ==
{| class="wikitable"
|-
! Offset || Type || Description
|-
| 0x2c || char[?] || Player name
|}
== Global save data ==
{| class="wikitable"
|-
! Offset || Type || Description
|-
| 0x00 || i32 || Global frame counter
|-
| 0x04 || i32 || Solar sensor calibration (<code>raw level - 2</code> at time of calibration)
|}
= Other structs =
== Treasure data ==
<syntaxhighlight lang="c">
// pointer to this struct is at 0x03000108
struct treasure_data {
  /* offset 0x24 */ treasure_node* list_head;
};
struct treasure_node {
  /* offset 0x14 */ treasure_trigger* trigger;
  /* offset 0x28 */ u32 callback_script_id;
  /* offset 0x2c */ u32 callback_args[?];
  /* offset 0xb8 */ treasure_node* list_next;
};
struct treasure_trigger {
  /* offset 0x20 */ i16 position[3];
};
</syntaxhighlight>


= EEPROM =
= EEPROM =
''TODO''


[[Save data checksums]]
{| class="wikitable"
|-
! Byte address || Byte size || Description
|-
| 0x0000 || 0x18 || [[#Global save data]]
|-
| 0x00c0 || 0x28 || Slot 1: [[#Save data header]]
|-
| 0x0200 || 0x28 || Slot 2: [[#Save data header]]
|-
| 0x0340 || 0x400 || Slot 1: [[#World struct]]
|-
| 0x0780 || 0x418 || Slot 1: [[#Stat struct]]
|-
| 0x0dc0 || 0x400 || Slot 2: [[#World struct]]
|-
| 0x1200 || 0x418 || Slot 2: [[#Stat struct]]
|-
| 0x1840 || 0x168 ||
|-
| 0x1a40 || 0x168 ||
|}
 
Each block is followed by its checksum, see [[Save data checksums]].


[[Category:Documentation]]
[[Category:Documentation]]
[[Category:Boktai 1]]
[[Category:Boktai 1]]

Revision as of 19:15, 5 August 2024

This is the RAM map for Boktai 1 (U). Go to ROM map.

EWRAM

Address Type Description
0x020011c0 i32 Solar sensor: Calibrated level (0=dark, 140=max brightness. Calibrated level = calibration - raw level, then clamp to 0-140)
0x020011c2 i32 Solar sensor: Bars. Calculated from calibrated level (0=dark, 8=max brightness)
0x0203c800 u16[1024] RNG table (generated by the bootstrap RNG once on power-on)
0x0203d800 byte[?] #Stat struct
0x0203e000 byte[?] Stat struct - backup (created on screen transitions, reloaded on death, saved to save file when saving)
0x0203e800 byte[?] #World struct
0x0203ec00 byte[?] World struct - backup
0x0203f000 byte[?] #Scratch struct

Stat struct

Address Type Description
0x0203d80a i16[7] Grenade amounts
0x0203d88c i16 Equipped lens
0x0203d88e i16 Equipped frame
0x0203d892 i16 Equipped grenades
0x0203d892 i16 Equipped battery
0x0203d8b0 i32 Unlock Astro battery (must be set to *(*0x03001c90 + 0x7dc))
0x0203d8f0 i16[3] Django position
0x0203d91e i32 Solar sensor: Calibrated level (see 0x020011c0)
0x0203dc18 i16 Item inventory size
0x0203dc1a i16[42] Item inventory IDs
0x0203dc6e i16[42] Item inventory amounts
0x0203dcc4 i32 Lens inventory (bitmask, 1 bit per lens and level)
0x0203dcc8 i32 Frame inventory (bitmask)
0x0203dcd0 i32 Battery inventory (bitmask)
0x0203dcd8 i16[8] Lens EXP

World struct

Address Type Description
0x0203e8c5:6 bit[64] "Chest opened" flags for current area (resets on area change)

Scratch struct

Address Type Description
0x0203f1b4 u8[13] Carmilla: Pattern list - one of 4 hardcoded lists will be chosen at random when starting the fight
0x0203f1c1 u8[3] Carmilla: Pattern pool (indices into pattern list)
0x0203f1c4 u8[3] Carmilla: ???
0x0203f1c7 u8 Carmilla: Next pool value
0x0203f1c8 u8 Carmilla: Pattern index (index into pattern pool) - the (current/next?) pattern is pattern_list[pattern_pool[next_pool_value]]

IWRAM

Address Type Description
0x03000630 i32 Solar sensor interface: State (0=measuring, 1=resetting, 2=idle)
0x03000634 i32 Solar sensor interface: Counter (0-511, counts half-cycles of the 74LV4040 counter chip)
0x0300063c i32 Solar sensor interface: shift out (next value to be written to GPIO_DATA)
0x03000648 void* Script directory: Script index pointer
0x03000648 void* Script directory: Script count
0x03000108 treasure_data* Pointer to this map's #Treasure data (NULL if map has no treasures)
0x03001c2c i16 Solar sensor: Bars. See 0x020011c2.
0x03001c90 void* Pointer to Django's actor data?
0x03001cc8 void* Pointer to linked list of bat enemies?
0x03004478 i32 Bootstrap RNG seed
+ 0x18 i32 Current lens level
+ 0x7dc i32 Astro battery unlock password
0x030044f8 i32 Solar sensor interface: Is enabled (true/false)
0x030044fc i32 Solar sensor interface: Last result (GPIO_DATA & 8)
0x03004508 i32 Solar sensor interface: Raw level (counter / 2 when GPIO_DATA & 8 becomes nonzero. 0=max brightness, 255=dark)
0x03004520 void* Bytecode: Program counter
0x03004524 void* Bytecode: Return value
0x0300450c i32 Solar sensor interface: Timer interval (TM3CNT_LO will be set to -this value)
0x03004610 struct* Pointer to current Map file descriptor (usually/always 0x02000010)
+ 0x00 i32 Number of Zones
+ 0x04 void* Pointer to map file tile data
+ 0x0c void* Pointer to map file zones
+ 0x10 void* Pointer to map file unknown block 1
+ 0x14 void* Pointer to map file unknown block 2
+ 0x24 zone_callback[] List of zone callbacks:
struct zone_callback {
  /* offset 0x08 */ u16 zone_id;
  /* offset 0x24 */ void* bytecode_ptr; // Generally points into a Script
};
0x03004620 i32 RNG index
0x030046a8 struct* Pointer to #Save data header (usually/always? 0x03000768)
0x030046c4 struct* Pointer to #Global save data (always 0x03000750)
0x030046e8 i16[3] Camera position

Save data header

Offset Type Description
0x2c char[?] Player name

Global save data

Offset Type Description
0x00 i32 Global frame counter
0x04 i32 Solar sensor calibration (raw level - 2 at time of calibration)

Other structs

Treasure data

// pointer to this struct is at 0x03000108
struct treasure_data {
  /* offset 0x24 */ treasure_node* list_head;
};

struct treasure_node {
  /* offset 0x14 */ treasure_trigger* trigger;
  /* offset 0x28 */ u32 callback_script_id;
  /* offset 0x2c */ u32 callback_args[?];
  /* offset 0xb8 */ treasure_node* list_next;
};

struct treasure_trigger {
  /* offset 0x20 */ i16 position[3];
};

EEPROM

Byte address Byte size Description
0x0000 0x18 #Global save data
0x00c0 0x28 Slot 1: #Save data header
0x0200 0x28 Slot 2: #Save data header
0x0340 0x400 Slot 1: #World struct
0x0780 0x418 Slot 1: #Stat struct
0x0dc0 0x400 Slot 2: #World struct
0x1200 0x418 Slot 2: #Stat struct
0x1840 0x168
0x1a40 0x168

Each block is followed by its checksum, see Save data checksums.