Repository navigation
Monster System
Monsters live in a flat array at $c5c0-$c800: 16 bytes per entry, up to 36 slots
($24 × $10). Confirmed via the periodic animation-update loop (fires every 16 ticks) and
the slot-reset loop (ld hl,$c5c0; ld b,$24; ld de,$0010).
| Offset | Meaning | Confidence |
|---|---|---|
$00 |
The "class" index — doubles as "occupied" (0 = empty slot) and as the direct index into the per-class stat table (see "The stat table, found" below). Not a species/type ID by itself; several different monster types can plausibly share one class entry if their base stats match. |
Confirmed — see below |
$01 |
Monster type ID | Confirmed (compared directly against $c420, the type currently being processed by the per-turn dispatch loop) |
$02 |
Row (Y) position | Confirmed via OAM sprite position cross-check |
$03 |
Column (X) position | Confirmed via OAM sprite position cross-check |
$04 |
Blink/animation toggle — XOR'd with offset $05 every 16 ticks, starts at whatever the class table says (usually 0, but not always). Not a position or combat field (don't confuse with $0f, which has a similar 0/2-oscillation look but is the real direction/RNG field) |
Confirmed |
$05, $07, $08
|
Static per-class attributes, copied from the stat table at spawn - likely attack/defense/lucky-like stats, not yet told apart from each other | Confirmed to come from the stat table; individual meaning still open |
$06 |
Current HP. Decreases with each hit taken; when it reaches 0, the entire slot is zeroed (including offset $00) |
Confirmed — see below |
$09 |
Copied from the stat table at spawn, but not generally equal to $06/current HP - see "The stat table, found" below. The old assumption that this is always "max HP, equal to starting HP" only happened to hold for the one Crab fight tested so far; most class records show a different value here. Possibly a different static stat (attack?) rather than max HP. |
Revised — spawn-time source confirmed, semantic meaning still open |
$0f |
2-3 bit direction/state field, doubles as the pseudo-RNG source — see Combat System | Confirmed |
Traced the full spawn path for a new monster slot:
-
Call_001_4abe(bank 1,$4abe) finds the first empty slot in the$c5c0array. -
Jump_001_4a7f(bank 1,$4a7f) zeroes the whole 16-byte slot, then fills offsets$00-$03from staging variables$c224/$c227/$c225/$c226(class index/type ID/row/col). -
Call_000_1142_LoadMonsterClassStats(bank 0,$1142) copies a 6-byte record from a table at (bank 2)$5ea2, indexed by that same class value ($c224), into struct offsets$04-$09in one shot.
So offset $00 isn't a separate "occupied flag plus mystery tag" at all — it's literally
the index into this stat table, and the table is what the whole monster-system
investigation had been missing. Decoded directly from ROM (class index -> [$04, $05, $06, $07, $08, $09]):
class 0: [ 0, 0, 0, 8, 0, 2] class 1: [ 0, 0, 0, 8, 0, 2]
class 2: [ 0, 2, 9, 5, 6, 4] class 3: [ 0, 1, 6, 4, 4, 3]
class 4: [ 0, 1, 5, 4, 2, 3] class 5: [ 0, 2, 8, 5, 2, 4]
class 6: [ 0, 2, 5, 4, 2, 5] class 7: [ 0, 1, 6, 4, 4, 3]
class 8: [ 0, 1, 4, 3, 2, 3] class 9: [16, 2, 18, 6, 6, 6]
class 10: [ 0, 1, 5, 4, 2, 3] class 11: [ 8, 2, 18, 6, 6, 6]
class 12: [24, 1, 32, 9, 5, 16] class 13: [ 8, 1, 19, 7, 5, 7]
class 14: [24, 2, 23, 7, 6, 7] class 15: [24, 2, 32, 16, 5, 16]
class 16: [28, 2, 32, 16, 5, 16] class 17: [28, 2, 23, 8, 6, 7]
class 18: [16, 1, 8, 6, 2, 5] class 19: [ 0, 1, 7, 4, 2, 3]
class 20: [ 0, 2, 20, 7, 6, 7] class 21: [ 0, 1, 5, 3, 2, 2]
class 22: [ 0, 1, 4, 3, 2, 1] class 23: [ 0, 1, 1, 0, 1,153]
class 24: [ 5, 2, 1, 5, 1,153] class 25: [ 6, 0, 7, 4, 2, 4]
class 26: [16, 2, 18, 5, 6, 4] class 27: [24, 2, 24, 8, 6, 8]
class 28: [24, 2, 5, 12, 9, 2] class 29: [ 0, 29, 10, 8, 17, 0]
class 30: [ 8, 17, 17, 18, 6, 5] class 31: [25, 16, 13, 0, 0, 16]
Important: $09 (the 6th value) is not generally equal to $06 (3rd value, "current
HP") — e.g. class 3 is [0, 1, 6, 4, 4, 3], HP 6 but $09=3. This directly contradicts
the old "offset $09 = max HP, same as starting HP" assumption, confirming the doubts
raised earlier from live monster-array dumps. It only looked that way for the one
confirmed Crab fight. Whether $09 is a different static stat (attack power is the
leading guess) or whether spawned values get scaled by dungeon depth before use (which
could reconcile things) is not confirmed either way.
Searched for a dedicated reader of offset $09 and found none. Every place in bank 0/1
that indexes into the $c5c0 monster array individually (rather than through the bulk
6-byte stat copy at spawn) was checked for a literal offset-9 access
(ld a, $09 immediately followed by rst RST_28, the project's standard struct-offset
idiom): none exist. The confirmed player/monster damage formula
(Call_001_5c47/Call_001_5c75, bank 1 $5c47/$5c75) only ever reads struct offsets $03
and $06, never $09. So either $09 is read through a path not yet located (a generic
loop over offsets $04-$09 wouldn't show up as a literal $09 the way this search
assumes), or it's effectively write-only in the traced code - set at spawn and never
consumed. Still open; a live combat test remains the most promising way to actually observe
its effect, if any.
This also resolves the earlier "non-monster entries" doubt: cross-checking every class
value seen live (4, 3, 19, 5, 18) against this table byte-for-byte (offsets
$05-$09; offset $04 is the runtime blink toggle and legitimately varies) confirms
an exact match in every case, including classes 18/19/22. These are ordinary
monster classes, not a separate decoration system - the "no OAM/movement observed" cases
were just short capture windows, not a different mechanism.
The multi-tile ("big", 4-OAM) monster seen in save_009 is class 18
([16, 1, 8, 6, 2, 5]), confirmed by exact byte match against its live struct. Its
offset $04 = 16 (vs. 0 for every small-monster class) is simply that class's table
value, not evidence of a different struct layout - the 16-byte struct is the same for
every class. Whatever offset $04 is "supposed to be" at rest clearly isn't always 0;
it still gets XOR'd with offset $05 for the blink animation on top of that base value.
How the extra width is actually rendered, confirmed: a "big" monster's 4 OAM sprites
always occupy its recorded (row, col) and the column directly to its right - the
monster-array struct only ever stores one (row, col), not a width. Checked pixel-for-pixel
whether the right half is just the left half mirrored (a cheap, common sprite-reuse trick):
it isn't - every one of Pester's 4 tiles ($b0, $b2, $b4, $b6) has genuinely
different raw pixel data, not a flipped duplicate of another tile in the set. Pester's
left/right symmetry (see Sprite Glossary) is purely an art-design choice,
not an engine-level mirroring mechanism. (This offset-$04-nonzero flag is also what
tools/sprite_atlas.py now uses to decide whether to look one extra column over when
cropping a monster's sprites for the glossary - fixes an earlier version that only grabbed
Pester's left half.)
A 32-entry table at bank 1 $7915, indexed directly by class (not type), decoded from the
ROM:
class 0- 7: 0, 0, 2, 2, 2, 2, 2, 2
class 8-15: 2, 4, 2, 4, 8, 4, 8, 8
class 16-23: 8, 8, 4, 2, 2, 2, 2, 2
class 24-31: 2, 4, 8, 0, 1, 1, 1
Every value is 0, 1, 2, 4, or 8 - a small power-of-2 set, the classic shape of a
size/weight tier rather than an arbitrary stat. It's read in two unrelated places:
-
Jump_000_3960(bank 0$3960): looks up this table for a monster's class and, if the result is nonzero, runs extra animation handling (Call_000_399c) - consistent with "bigger/heavier monsters get an extra rendering step" (the multi-tile class-18 monster fromsave_009fits: table value4, nonzero). - Item
$13's effect (Call_001_4b08, see Item System): subtracts this per-class value from a per-room counter for every matching monster found - i.e. the effect's "cost" or "impact" per monster scales with this same size/weight tier.
Both uses make sense for the same underlying quantity (StrategyWiki's kill list literally shows each monster's weight/height), so this table is most likely a per-class size or weight category, reused by both an animation-gating check and an item-effect scaling factor - not confirmed with a specific unit, but no longer an unexplained mystery table.
There is no single static "type ID -> class index" ROM table. Traced the chain that
actually produces the class value ($c224) at spawn:
-
Call_001_4997(bank 1,$4997) iterates the 9 slots of the shared per-floor placement table at$c300(32-byte stride, same table the item-placement loop reads). Each slot's first byte, if nonzero, is a monster type ID, passed toCall_001_49ad. -
Call_001_49ad(bank 1,$49ad) stages it as$c201and callsCall_000_135d(bank 0,$135d), which does two nested lookups:-
[$c202]indexes a word table at (bank 3)$6a75to find a per-quest/floor 4-byte header, copied to$c441. -
[$c201](the type) indexes a WRAM table at$c448to pick a bucket0-7, which then selects one of 8 four-byte sub-records out of$c441, copied to$c445.
-
-
Call_001_49d0reads$c445[$c220](one byte per compass direction) intoc, then callsCall_001_4a48withb = [$c201](type) still carried along. -
Call_001_4a48writescinto$c224(class) andbinto$c227(type) - two independent fields from the same per-quest/floor encounter descriptor, not one derived from the other.
So type and class are both supplied directly by the room/quest's own encounter data
(itself a ROM template copied into WRAM per floor, the same architecture as the item
pool's quest/level templates - see Item System), rather than one being
looked up from the other via a dedicated mapping table. $c448 is itself WRAM, so it's
presumably refilled per floor too; tracing its exact population wasn't needed to settle
the original question since the final class values already verify byte-for-byte against
every live capture (see above).
Two independent live fights against monster type $01 (real HP, no cheats —
see below for why a naive invincibility hack doesn't work here):
gold_dungeon.state, type $01, pre-fight: offset $06 = 5, offset $09 = 5
Hit 1 (player → monster): offset $06 5 → 3 (damage 2)
Counter-hit (monster → player): wPlayerHP 0x10 → 0x08 (damage 2)
Hit 2: offset $06 3 → 0, offset $00 (slot flag) 6 → 0 (monster defeated)
combat2.state, type $01, pre-fight: offset $06 = 5, offset $09 = 5
Hit 1: offset $06 5 → 2 (damage 3)
Counter-hit: wPlayerHP 0x10 → 0x06 (damage 4)
Hit 2: offset $06 2 → 1 (damage 1)
Counter-hit: wPlayerHP 0x06 → 0x04 (damage 2)
Hit 3: offset $06 1 → 0, offset $00 6 → 0 (monster defeated)
A pitfall worth documenting: setting wPlayerHP to an artificially huge value
(0x99) for invincibility works fine for pure movement exploration, but once a combat
animation starts it triggers a glitch that continuously drains HP every tick (likely a
health-bar-fill animation that never reaches its target because the starting value is far
above wPlayerMaxHP). Combat tests need to use real, in-range HP values.
Monster type $01 was observed moving only horizontally (column oscillates, row stays
fixed) across multiple independent test runs. Combined with its HP of 5, this matches the
StrategyWiki monster table exactly:
Crab: HP 5, moves left and right
High confidence: monster type $01 = Crab, confirmed to use stat class 6
([0, 2, 5, 4, 2, 5]) - the only class whose $05-$09 tuple matches the two live
combat logs above exactly.
-
Monster type
$03= Tarantula. HP6(offset$06), matching the StrategyWiki entry exactly, and matching stat class3([0, 1, 6, 4, 4, 3]) byte-for-byte. Movement, tracked over 40 player turns with no fighting: a large loop tracing almost the entire perimeter of the room, never settling - matches "moves counterclockwise around room" far better than Minotaur's small 4-square loop. Seen consistently across two independent savestates.Can inflict Poison on hit, confirmed live (gearboy-mcp session): a Tarantula melee attack left the player with the poison status condition (see Combat System "Poison status"), curable with Dokukeshi. Not yet confirmed whether this is a guaranteed proc or a chance, or whether other monster classes can inflict it too - only tested against this one.
-
Class
4= Barokusu (rock-like, does not move at all - user-confirmed, from the Sprite Glossary image). Seen under both type$01and type$02- see "Type is not a reliable species indicator" below for what that implies. -
Class
19= Minotaur, and class18= Pester (ペスター), the 2-tile-wide monster - both user-confirmed from the glossary images. Class19was seen under both type$01and type$03; this is the same multi-tile monster previously guessed as "Hydra" (save_009) - that guess was wrong, it's Pester. -
Class
22is not a distinct species at all - it's the darkness/fog-of-war "glowing eyes" placeholder sprite shown for any hidden monster (user-confirmed; see Dungeon Mechanics "Darkness / torch visibility"), not a real monster struct entry with its own identity. Resolves the "non-monster entry" mystery for this specific class value from below.
Barokusu (class 4) was seen under both type $01 and type $02; Minotaur (class 19)
was seen under both type $01 and type $03. Since the same species clearly shows up under
different type bytes, type cannot be a straightforward species ID the way the original
Crab test suggested - it's more likely just a per-encounter/per-room tag from the quest's own
placement data (consistent with "Type -> class resolution" above, which already found type
and class are two independent fields from the same encounter descriptor, not one derived
from the other). Class is the far more reliable species axis. This also resolves the
earlier "unresolved conflict - a second, distinct $01-type creature" (an HP-8 variant under
type $01, differing from Crab's HP-5): it was never a stronger Crab variant, just a
different class entirely reusing the same type byte, exactly as seen here for Barokusu and
Minotaur.
-
Non-monster entries in the same array - update, partially retracted: several slots had
wildly different offset
$00(class) values (19,22) with no matching OAM sprite seen at the time, leading to an earlier guess that they weren't real monsters at all. Class19is now confirmed to be a real monster (Minotaur) - that part of the guess was wrong. Class22genuinely isn't a monster species - it's the fog-of-war eye-pair placeholder, confirmed above. The movement/monster-collision-avoidance code (bank 0Call_000_3d8f, bank 1$57bb/Call_001_57db, found while investigating a movement-blocking puzzle - see Dungeon Mechanics "Movement collision, partially traced") explicitly special-cases both class18(Pester) and class19(Minotaur) occupants as never/conditionally blocking movement - now that both are known to be real, visible monsters, that's more likely a monster-vs-monster AI pathing allowance (e.g. letting a multi-tile monster's own segments or a specific movement type overlap another monster) than evidence of being decorative props, but the exact reason still isn't confirmed.
-
What offset
$09actually is, given it's confirmed to not just duplicate current HP - needs a live combat test on a monster whose class record has$09clearly different from$06, to see if it's attack power, defense, or something else. -
Why the collision-avoidance code exempts class
18/19occupants from blocking movement, now that both are confirmed real monsters rather than decoration - needs tracing the actual callers ofCall_000_3d8fto see whether it's player-movement or monster-AI-movement context. -
The— explained: type isn't a species indicator (see above), so this was just a different class under the same type byte, not a Crab variant. Which specific class it was still isn't pinned down, but the "is this a stronger Crab" framing no longer applies.$01-type HP-8 variant vs. the confirmed HP-5 Crab
See Open Questions for what kind of savestate would help close these gaps.