Skip to content

Area formats

Every area archive BIN/WORLDnn/AREAnnn.EMI loads the same fixed set of data blocks and one program to the same RAM addresses, and the address, not the archive, identifies each format. A type-0 entry’s load argument is its RAM destination, so the next area’s blocks load over the previous ones, and no payload names its area. This page describes each block of that working set. Areas and the field covers how the engine uses them; the EMI page lists which slot holds which block. An area is a town, dungeon, world map or battlefield.

Address Entry size Role
0x80010000 145-21,547 area message table (text)
0x80032000 5,000 packed 4-bit cell grid
0x80033800 512 palette arena offset 0
0x80033A00 512 CLUT block, arena +0x200
0x80033C00 512 CLUT block, arena +0x400
0x80033E00 512-6,144 CLUT block, arena +0x600
0x80035800 1,024-3,584 CLUT block, arena +0x2000
0x800D3800 1,236-65,236 area script table
0x800E3800 36-412 scene/step table
0x800E4000 1,160 encounters plus enemy records
0x80104000 6,872-84,584 map bundle
0x80117000 1,444-5,964 auxiliary module window (9 archives)
0x801F2C00 92-16,324 area program code arena

0x800F0800 is the battle script table, which holds 3,692 bytes in 42 BATTLE and BOSS archives and has the same format as the area script table. 0x801F2C00 is code, not a data format. Two areas load their program elsewhere: world00/area030/04 at 0x801D0C00 (75,285 bytes) and world00/area030/05 at 0x800F5000 (8,784 bytes).

The area’s dialogue: a little-endian u16 slot array, then the records.

+0x0000 u16 slot[0] ; byte size of the array = offset of the first record
+0x0002 u16 slot[1..N-1] ; byte offsets; N = slot[0]/2
+slot[0] .. end ; records, delimited by consecutive distinct slots

A message is addressed by its slot index. Two slots may share one record, and unused slots point at the end of the payload; 185 of the 200 payloads have at least one such slot, 182 have two or more. All 200 area entries load at this address. 197 are message tables and 165 of those are text tables (see text kinds): 162 at entry 11, 2 at entry 7, 1 at entry 12. The other 35 payloads are the 32 non-text tables at entry 11 and the 3 fishing payloads at entry 18, which are not tables. Game text defines both terms and the record bytes and control codes.

The code at @0x801514D0 forms D_80010000[g_MessageRequest] + 0x80010000; @0x8014F800 is the text draw entry.

5,000 bytes, 10,000 cells of 4 bits. 100 by 100 is the buffer capacity, not a per-area shape. The extent is width x height from the map bundle header, and the rest is zero. Nine of the 200 entries are all zero (reserve); 191 carry data. Nibble values in the used region are 0 to 13, mostly 0 (free).

The only known reader is emi/etc/game/00@0x801C6FD4:

index = x + width * y
addr = 0x80032000 + (index >> 1)
nibble = (index & 1) ? low 4 bits : high 4 bits

The nibble order follows the parity of the linear index, not of x. A read outside the header’s width and height returns 0. No payload stores to the grid, so it is archive data. Example: with width = 7, cell (x = 2, y = 1) has index 9, the low nibble of byte 4.

The sprite animation scripts of the area’s actors, in a two-level index: a directory of section offsets, then sections that each open with a table of record offsets. Each record is one animation script (script record). All 200 payloads fit.

table
+0x00 u32 dir_bytes ; == 4*L, the directory's own size
+0x04 u32 section_off[L-1] ; block-relative, strictly increasing
section (table + section_off[i])
+0x00 u16 table_bytes ; == 2*M; also record_off[0]
+0x02 u16 record_off[M-1] ; remaining offsets, relative to the section base
record
one animation script (byte-addressed, no fixed stride)

dir_bytes is the directory’s size, not an entry count: L = dir_bytes / 4. Read as a count it overruns the payload (WORLD00/AREA016 slot 4 has u32[0] = 28 and u32[29] = 0x240018 in 2,708 bytes). dir_bytes == 4*L, and the entries are strictly increasing and inside the payload, in 200 of 200 tables. L ranges from 4 to 36, so the tables hold 2,380 sections. The last section runs to the end of the block.

Example: dir_bytes = 0x10, so L = 4 and the directory is 0x10, 0x80, 0x120, 0x1A0. Section 2 starts at table offset 0x120. If its first halfword is 0x08, its table is 8 bytes (M = 4 offsets) and record 0 starts at section offset 0x08. If its table entry 3 is 0x40, record 3 is at section offset 0x40, table offset 0x160.

Actor_BeginScript (exe/slus_004_22@0x8014D6DC) resolves a record through the pointer g_ScriptBank:

section = u32[table + 4 * lhu(work + 0x2C)]
record = table + section + u16[table + section + 2 * lbu(work + 0x4B)]

SYS_StartFrontend (exe/slus_004_22@0x8014EA80) sets the pointer to 0x800D3800. The battle handlers swap in 0x800F0800 around each handler call and restore 0x800D3800 afterwards (func_801E6724 (emi/battle/battle/03@0x801E6724), func_801E6C84 (emi/battle/battle/03@0x801E6C84)). When bit 0 of work +0x24 is set, Actor_BeginScript takes the record from the actor’s character table (work +0x4C) through Actor_SelectScriptBank (exe/slus_004_22@0x8014DC08) instead, and the same step code reads it. No record stores its length; the table offsets are the only record boundaries. Actor_CopyScriptEntry (exe/slus_004_22@0x8014D54C) does not read this table: it selects a record through Actor_SelectScriptBank and copies a byte count its caller passes: 0xA00 from Battle_LoadPartyScripts (emi/etc/game/00@0x801BEE5C) and 0x1800 from Battle_ReloadPartyBank (emi/battle/battle/03@0x801D6F28) and func_801DEFE4 (emi/battle/battle/03@0x801DEFE4).

u16[0] is both the table size and record 0’s offset, so every section describes itself. In all 2,380 sections the distinct offsets of a table increase strictly, and the spans between them tile the section from the table end to its end. 308 of the 2,380 tables contain a descent (51 byte-identical tables, the most used 23 times, across 88 archives) and 225 more contain only equal words. An entry may repeat an earlier offset and then shares that record.

Actor_SeekScript (exe/slus_004_22@0x8014D910) reads byte 1 as the step count, moves the cursor (work +0x50) past the two count bytes and points the frame table (work +0x54) at cursor + 2 * steps. Actor_StageAnimStep (exe/slus_004_22@0x8014DB98) loads one step: it stores the hold byte to work +0x4A and the frame-table entry that the frame byte selects to work +0x5A.

Offset Size Type Meaning
0x00 1 u8 frame count, the number of frame-table entries [inferred]; the step code does not read it
0x01 1 u8 step count; Actor_SeekScript stores it to work +0x49
0x02 2 * steps u8[2][steps] one (hold, frame) pair per step
0x02 + 2 * steps 2 * frames u16[frames] frame offsets, relative to the start of this table
after the table - u8, parts each frame is a u8 part count, then that many 5-byte parts

A step is a hold byte and a frame index. A step function counts the hold down by one per call and loads the next step at zero. A hold of 0x80 or more makes the pair a jump: it moves to the step whose index is the second byte, loads it at once and reports 1. The three step functions differ only at the end of the list.

Step function After the last step
Actor_StepAnimLoop (exe/slus_004_22@0x8014D978) starts again at step 0 and reports 1
Actor_StepAnimOnce (exe/slus_004_22@0x8014DAEC) keeps the last frame and reports 1 on each later call
Actor_StepAnimReverse (exe/slus_004_22@0x8014DA24) walks the steps backward without jumps; after step 0 it starts again at the last step and reports 1

Area_DrawObjectSprite (exe/slus_004_22@0x8014C4D4) reads the frame at the frame table plus work +0x5A and draws each part as one textured quad. Bits 4 to 6 of size are not read there.

Offset Size Type Name Meaning
0x00 1 u8 size bits 0 to 3 index the width and height table g_SpriteSizes (0x8017F53C); bit 7 mirrors the part horizontally
0x01 1 s8 x x offset from the actor’s screen position (work +0x2E)
0x02 1 s8 y y offset from the actor’s screen position (work +0x30)
0x03 1 u8 u texture x
0x04 1 u8 v texture y, added to work +0x26
typedef struct SpriteCell {
/* 0x00 */ u8 size;
/* 0x01 */ u8 x;
/* 0x02 */ u8 y;
/* 0x03 */ u8 u;
/* 0x04 */ u8 v;
} SpriteCell;

Source: engine/slus/slus.h

The actors of the area: for each, an id to match and setup bytes, including which script section it runs. It opens with a u32 count equal to (size - 4) / 8 in 200 of 200 payloads (4 to 51), then count 8-byte records. Bytes 1 to 3 of the count are always zero, so the code reads it with lbu. The record array base is published as D_801459F4 = 0x800E3800 + 4.

Offset Size Type Meaning
0x00 2 u16 id; the match key in @0x8014DD3C and @0x80167E00
0x02 2 u16 low byte stored to work+0x27; the u16 is work+0x2C
0x04 1 u8 stored to work+0x25 (4 values)
0x05 1 u8 stored to work+0x26 (31 values)
0x06 1 u8 stored to work+0x28; read by the CLUT and texture code
0x07 1 u8 stored to work+0x2C; the scene’s section in the archive’s script table
typedef struct AreaActorDef {
/* 0x00 */ u16 id;
/* 0x02 */ u16 clut_select;
/* 0x04 */ u8 texture_page;
/* 0x05 */ u8 texture_v;
/* 0x06 */ u8 texture_mode;
/* 0x07 */ u8 script_section;
} AreaActorDef;

Source: include/area/area.h

+0x7 is a section index, not a record ordinal. With L = u32[script_table] / 4, max(+0x7) < L and the values cover 0 to L-1 in 200 of 200 payloads. The special values 9 and 10 belong to the actor member +0x06 (actor members), not this byte: func_80167E00 reads it, 9 gates the draw mode and 10 calls func_8015A944.

Each area carries its own enemies. The block is 1,160 bytes in every area: 8 encounters of 9 bytes and 8 enemy records of 136 bytes (0x48 + 0x440 = 0x488).

Offset Size Type Meaning
0x000 72 Encounter[8] 8 Encounter (9 bytes: enemy_indexes[8], appearance_rate)
0x048 1,088 Enemy[8] 8 Enemy (136 bytes: name[8] first, ai[4] at +0x34)
typedef struct Encounter {
/* 0x00 */ u8 enemy_indexes[ENCOUNTER_ENEMY_COUNT]; /* 8 */
/* 0x08 */ u8 appearance_rate;
} Encounter;

Source: include/game/enemy.h

An encounter lists up to eight indexes into the block’s own enemy records (0xFF is empty) and an appearance rate. Only indexes 0 to 6 occur on the disc. The picker emi/etc/game/00@0x801C6A7C walks the 9-byte records with sum += base[8] until the sum reaches a threshold of 1 to 16 from rand(). Its caller @0x801C60E0 stores the selected 0x800E4000 + 9*idx into D_801CD8CC. A battle setup, @0x800AC218, copies the enemy record into the 280-byte runtime slot D_801EB630 + slot*280, and the byte at D_801EB710 + slot*280 holds the record index. No overlay or resident program stores to the block. Game records owns the enemy record (136 bytes) and its 16-byte action blocks.

HP 0xFFFF appears in 10 of the 448 non-empty enemy records: Worker (two blocks), Operator, Miner, Engineer, Foreman, Gary, Mogu, Nina and Garr (enemy_id 1108, the party-member variant that records lists). It is a sentinel, not a large HP. The battle setup Battle_LoadEnemyBattler (emi/battle/battle/15@0x800AC218) loads the halfword at 0x800E4068 + index x 0x88 (@0x800AC448) and stores it at battler +0xC0 and in the D_801EB6C4 row (@0x800AC450 and @0x800AC45C) without a check. The damage step Battle_ApplyDamage (emi/battle/battle/03@0x801DBB78) then skips the whole enemy HP change when the battler’s HP at +0x94 is 0xFFFF, so the battler takes no damage. Two boss handlers also test it: func_800C1A00 (emi/boss/boss002/16@0x800C1A00) and func_800C1CDC (emi/boss/boss033/16@0x800C1CDC) set the action type to 3 when the current enemy’s HP is 0xFFFF. The other 0xFFFF immediates in the battle overlays are the default-element argument of Battle_CalcDamage (emi/battle/battle/03@0x801DC044). The script that ends these fights is [unknown].

RAM beside the working set is scratch that individual area programs use.

Address Role
0x800E4800 the executable’s EMI CD streaming window: cd_base, sectors DMA to cd_base + slot*0x800; the same bytes are per-scene scratch
0x800E4A00 32-entry position ring in world00/area028/13
0x80147AA8 AreaVertex rows in world00/area024/14

World overlays keep these records in the scratch space:

Record Address Size Count Owner
AreaTrail 0x800E4800 152 3 world00/area027/13 (@0x801F2D5C)
AreaSlotWork 0x800E4800 16 32 world00/area028/13 (@0x801F2F5C)
Vec2us 0x800E4A00 4 32 world00/area028/13 (@0x801F2D3C)
AreaVertex 0x80147AA8 40 - world00/area024/14 (@0x801F3314)

The trail and slot rows are different shapes of one window; each area program reads its own.

AreaTrail, 152 bytes:

Offset Size Type Meaning
0x00 12 Point3DL head anchor position (three s32)
0x0C 4 s32 unknown (s32)
0x10 4 s32 ring radius (s32)
0x14 2 u16 rotation angle (u16)
0x16 2 u16 padding
0x18 128 DVECTOR[32] 32 trail points, two s16 each
typedef struct AreaTrail {
Point3DL pos; /* 0x00 */
s32 unk_0C; /* 0x0C */
s32 radius; /* 0x10 */
u16 angle; /* 0x14 */
u16 pad_16; /* 0x16 */
DVECTOR points[WORLD_TRAIL_MAX]; /* 0x18 */
} AreaTrail;

Source: include/area/area.h

AreaSlotWork, 16 bytes:

Offset Size Type Meaning
0x00 4 u8[4] unknown
0x04 4 Point2D random position offset: x at 0x04, y at 0x06
0x08 2 s16 projection scale (s16)
0x0A 2 s16 unknown (s16)
0x0C 4 UPoint2D projected screen position: x at 0x0C, y at 0x0E
typedef struct AreaSlotWork {
u8 unk_00[4];
Point2D offset; /* 0x04 */
s16 scale; /* 0x08 */
s16 unk_0A; /* 0x0A */
volatile UPoint2D screen; /* 0x0C */
} AreaSlotWork;

Source: include/area/area.h

Vec2us is two u16 halves. AreaVertex, 40 bytes:

Offset Size Type Meaning
0x00 2 u16 unknown (u16)
0x02 24 Point3D[4] four points, three u16 each (x, y, z)
0x1A 14 u8[14] unknown
typedef struct AreaVertex {
u16 unk_00;
Point3D points[4]; /* 0x02, three u16 each */
u8 unk_1A[0x0E];
} AreaVertex;

Source: include/area/area.h

The area’s CLUT entries fill slices of one 16 KiB CLUT arena (256 units of 64 bytes, 8,192 color words). Its working copy at 0x80037800 is uploaded as one rectangle. Arena row r is VRAM row 480 + r. A color word is STP | B5 | G5 | R5 (graphics).

Address Arena offset Loaded by
0x80033800 0 ETC/FIRST#8 (512 B)
0x80033A00, 0x80033C00 +0x200, +0x400 3 WORLD archives (512 B each), BMAGIC/ETC
0x80033E00 +0x600 200 WORLD archives and ETC/START.EMI#6
0x80035800 +0x2000 200 WORLD archives
0x80036E00 +0x3600 BATTLE palettes (shared 512-byte overlay)

GFX_ResetPalette (exe/slus_004_22@0x8014E284) zeroes arena rows 28 to 31 (+0x3800 to +0x3FFF) and copies all 32 rows to the working copy. Its callers are SYS_StartFrontend, etc/game/00 (@0x80196FFC and @0x8019FAA0), etc/game/01 Game_BeginTitle, etc/commu00/00 (@0x801F17A4) and scenario/scena17/00 (@0x801F7750). GFX_UploadPalette (exe/slus_004_22@0x8014E22C) uploads the working copy once per frame while g_GfxPalettePending is nonzero (rendering). Every palette writer raises that flag.

GFX_CopyPalette (exe/slus_004_22@0x8014E3A0) copies one arena row into the same working row. battle/battle/03, battle/battle/15, battle/batl_ovr/00, bmagic/magic057/03, etc/game/00 and scenario/scena17/00 call it. Battle code moves single rows this way:

  • battle/battle/03 @0x801D1228 copies rows 26 and 27, so the +0x3600 battle CLUT block (BATTLE/BATL_RE2.EMI#1) reaches VRAM row 507.
  • battle/battle/15 @0x800AFC54 copies arena row 2 (0x80033C00) into working row 2, and @0x800AFB48 copies CLUT runs inside the working copy into row 2.

Readers take the arena base and index it in 64-byte units. 0x80035800 has no literal reader.

The +0x200 CLUT block (ETC/BATE.EMI#3 and its copies) is also read on the CPU. battle/battle/03 (@0x801D8AE4, @0x801D8DF8, @0x801D9AB4 and @0x801D9C80) and etc/game/00 (@0x801AEBA0) take word 4 of the 16-color CLUT D_80144952 * 2 + shade, at 0x80033A08 + ((D_80144952 * 2 + shade) << 5), as the RGB of a flat panel primitive.

The area’s terrain and layout: a grid of cells with a height for each corner, a tile for each cell, and lists of objects and render records. A fixed 48-byte header of section offsets is followed by the per-cell tables, the tile tables and four record regions.

Width and height are u8 at bytes 0 and 1. Every other header field is a u16 offset in 4-byte units from the bundle start: (payload byte address - 0x80104000) / 4.

Offset Type Name Meaning
0x00 u8 width width in cells
0x01 u8 height height in cells
0x02 u16 grid_off4_02 cell grid; (0x30 + W*H*4 + align4(W*H)) / 4
0x04-0x13 u16[4][2] tile_table_offsets_04[4][2] eight offsets: table A rectangles and table B quads, per selector
0x14 u16 byte_code_off4_14 per-cell byte codes; equals W*H + 12 in 200 of 200
0x16, 0x18 u16 zero_16, zero_18 zero in 200 of 200, no reader
0x1A u16[2] color_1A[2] runtime color words; written by @0x801583BC
0x1E u16 scroll_1E nonzero in 76 of 200 and 0 in the rest; meaning unknown. One measurement gives the range 0xEC00-0xFFA0 and another 0xF300-0xFA90; unresolved
0x20 u16 list_base_20 record list, opcode byte & 0x3F
0x22 u16 list_base_22 record list, opcode byte & 0x7F
0x24 u16 record_region_24 record cells, ids in g_AreaCellGrid
0x26 u16 zero_26 zero in 200 of 200, no reader
0x28 u16 object_list_28 object list, tag plus body size
0x2A u16 height_off4_2A height bytes; u16[+0x2A]*4 == size in 187 bundles and size - W*H in 13
0x2C, 0x2E u16 zero_2C, zero_2E zero in 200 of 200, no reader
typedef struct AreaMapBundle {
u8 width; /* 0x00 */
u8 height; /* 0x01 */
u16 grid_off4_02; /* 0x02 */
u16 tile_table_offsets_04[4][2]; /* 0x04 */
u16 byte_code_off4_14; /* 0x14 */
u16 zero_16; /* 0x16 */
u16 zero_18; /* 0x18 */
u16 color_1A[2]; /* 0x1A */
u16 scroll_1E; /* 0x1E */
u16 list_base_20; /* 0x20 */
u16 list_base_22; /* 0x22 */
u16 record_region_24; /* 0x24 */
u16 zero_26; /* 0x26 */
u16 object_list_28; /* 0x28 */
u16 height_off4_2A; /* 0x2A */
u16 zero_2C; /* 0x2C */
u16 zero_2E; /* 0x2E */
} AreaMapBundle;

Source: include/area/area.h

The sections follow the header in this order:

+0x0030 W*H*4 per-cell records (four s8 corner heights)
+byte_code_off4*4 align4(W*H) per-cell byte codes
+grid_off4*4 2*W*H cell grid (one u16 per cell; 0 is empty)
(next) n*4 tile descriptors: one 4-byte word each, up to the first tile table
+tile_table_offsets[0]*4 n*4 table A rectangles, then the other tile tables
+list_base_20*4 n*4 record list, opcode & 0x3F
+list_base_22*4 n*4 record list, opcode & 0x7F
+object_list*4 n*4 object list
+record_region_24*4 n*4 record cells
+height_off4*4 W*H or 0 height bytes

In all 200 bundles u16[+0x14] == W*H + 12, u16[+0x02]*4 == 0x30 + W*H*4 + align4(W*H), and every offset from the first tile table offset to height_off4 is in region order. The tile descriptor table sits between the cell grid and the first tile table. A grid value indexes it, and the largest grid value is below the descriptor count in all 200 bundles. Descriptor 0 is empty.

func_80155560 (exe/slus_004_22@0x80155560) reads it:

Bits Meaning
31 depth: 0 is 8bpp, 1 is 4bpp
28 to 29 page selector (material page0 to page3)
24 to 27 CLUT index
19 to 23 color (byte 2 masked with 0xF8)
16 to 18 corner-order flags: bit 18 turns the corners a quarter, bit 16 flips across x, bit 17 across z
8 to 11 mode
11 with a nonzero mode: 1 picks table B (quad), 0 picks table A (rectangle)
0 to 7 index of a 16x16 block (mode 0), or of a table A rectangle

Bit 15 is also read, and its meaning is [unknown]. Mode 0 names a 16x16 block from the low byte: the block’s near corner is u = (b & 0x0F) * 16, v = b & 0xF0, and its far texels are 15 from the near corner. Otherwise bit 11 picks rectangle table A (index & 0xFF, entry {dv, du, v, u}) or quad table B (index & 0x7FF, four UV pairs). A table B quad stores its pairs as (v, u) at bytes 2-3, 0-1, 6-7 and 4-5, which read as corners 0 to 3. The function builds four UV pairs in corner order, then applies the corner flags in this order: bit 18 turns the corners (order 2, 0, 3, 1), bit 16 flips them across x (1, 0, 3, 2) and bit 17 flips them across z (2, 3, 0, 1).

Example: the synthetic descriptor 0x20000112 has bit 31 clear (8bpp), page selector 2, CLUT index 0, no corner flag, and mode 1 with bit 11 clear, so it picks rectangle table A, entry 0x12. By the terrain rule in graphics it uses page (320 + 128 * 2, 256) = (576, 256) and CLUT row (0, 483).

The bundle decodes to a terrain mesh (Wavefront OBJ, glTF 2.0 or similar) with one primitive per page material. Each cell is a quad on a unit grid, x the column and z the row.

  • Corners: the mesh builder exe/slus_004_22@0x801530D0 places corner k at the step (0,0), (1,0), (0,1) and (1,1) from the cell’s near corner, and corner k takes record byte k (loads at 0x801535A8 to 0x80153640). The GTE vertex holds -(byte << 4). A mesh uses y = byte * 16, so a larger byte is higher. A face walks the perimeter (corners 0, 2, 3, 1), because the stored order would cross, and that walk gives an upward normal.
  • Height table: 13 of the 200 payloads ship the height-byte table, one signed byte per cell. The mesh builder never reads it. The height query @0x8015477C does. A mesh built from the corners does not use it.
  • Not applied: the CLUT index and color need runtime palette and color words. The object list is not part of a mesh.
  • Textures: the materials carry none. A tile’s page and palette come from the texture-to-palette pairing; all 200 bundles pair their terrain sheet with an 8bpp palette, the 11 world-map areas included.
  • Editing: a corner’s height is its y divided by 16, and each corner must stay at its cell. A mesh carries no tiles, objects or height table, so the stored bundle supplies them. All 200 retail bundles return their stored bytes from a glTF mesh, from an OBJ mesh and from their byte-code, object and height lists.

Over the 200 retail bundles there are 1,263,531 cells, and 688,714 (54.5 percent) have a non-empty tile. Corner heights run from -2048 to 2032 in 244 distinct values. The cells use page0 in 22,890 runs, page1 in 17,204, page2 in 9,032 and page3 in 33.

Readers: @0x80153DE8 (area init, publishes g_AreaCellCodes), @0x80166CB0 (byte code), @0x8015477C (height query, 538 direct call sites: 7 in the executable and 531 across the overlay images), @0x801530D0, @0x8015684C and @0x80157CE4 (mesh), @0x80154438 and @0x80158400 (grid), @0x801576FC, @0x80157F98, @0x801580A4 and @0x80158B24 (record lists), @0x80155560 (tile tables) and @0x80156ED4 (inline colors). emi/etc/game/00 reads the grid at @0x8019C4F0, @0x8019C794 and @0x8019EC20, and writes the byte code at @0x801A4BC0. Writers are limited to the byte-code table, the height table, the runtime color words and the record fields. No loader fixup exists.

The +0x20 and +0x22 lists use a header word whose byte 3 is the dispatcher opcode and byte 2 the size in words. The dispatch tables are D_8017F8F0 (mask 0x3F) and D_8017F8FC (mask 0x7F). The +0x24 cells start with {y, x, size}, and the +0x28 objects start with {tag, body_words}.

Open: the names behind a byte-code value, the operands of the +0x20 and +0x22 records, the renderer fields beyond the descriptor bit map, and scroll. Two kinds of candidate data are located but their loaders are not identified:

  • Battle backgrounds. They are type-3 uploads in BIN/BATTLE/BATL_DRA, BATL_OVR, BATL_RET and BATL_RE2. Each is 32,768 bytes, and BATL_OVR has one of 65,536 bytes. Their descriptors (0x1A080200, 0x1C080200, 0x1E080200, and 0x1A080400 for the BATL_OVR upload) place them at VRAM columns 26, 28 and 30 on the row at y = 256, which are texture pages 13 to 15 (load argument). The same archives hold a shared 512-byte overlay at 0x80036E00 (BATTLE/BATL_RE2.EMI#1). Which upload a battle draws as its background, and its palette, are [unknown].
  • World map. BIN/WORLD00/AREA000 is McNeil, a walked area, not the world map. The world map is the 11 areas whose AreaLoad flag byte at +0x32 has bit 0 set: 016, 033, 045, 065, 087, 088, 104, 115, 121, 151 and 152 (runtime). AREA000 is a 100 by 80 bundle with six objects. Its entries 5 and 7 are uploads of 262,144 bytes each, which is 512 by 256 words at 16 bits. Read as 16bpp they look like indexed data, and their palette is [unknown].

Nine archives ship an extra type-0 entry at 0x80117000. It is slot 13 in all nine, and the area program is then slot 14: AREA049, AREA067 (WORLD01), AREA077, AREA104, AREA108 (WORLD02), AREA121, AREA135, AREA145 (WORLD03) and AREA173 (WORLD04). The sizes are 1,444 to 5,964 bytes.

The destination is a reservation: the executable’s layout names it slot_80117000, and the whole 206,848-byte run holds one nonzero word in the shipped image (0x00000008 at the base). The loader compares the payload’s first u32 with the TOC’s cached first word; the id continues the area-program numbering (52 + area for the 200 programs, 0xFC to 0x104 for these nine). No code forms the address; references are data words in 8-byte-stride tables. Eight payloads are geometry data; AREA049 is code at base+4 with a 13-word pointer table.

Every WORLD archive ships one type-0 area program at 0x801F2C00, and AREA030 also ships two programs at 0x801D0C00 and 0x800F5000. The executable reserves 0x801F2C00 to 0x801F6C00 (16,384 bytes, stamp 0x0000000E), and the largest program is 16,324 bytes. The type-0 handler copies the payload to the load argument and checks the cached first word. The first word of every program is 52 + area (200 of 200), which matches the TOC cache.

The executable calls the program at base+4 only on target-specific paths. exe/slus_004_22@0x801527E4 calls func_801F2C04 when the u16 world id g_GameAreaId is 0xBD (189), which selects WORLD04/AREA189. The dispatcher emi/etc/game/00@0x801A8728 also calls image-local functions, and its 0x4C case calls func_801F2C04. The entry bytes vary by target. AREA189 starts code at base+4. WORLD00/AREA024 stores a zero VECTOR there, which executes as four NOPs before func_801F2C14 at base+0x14. WORLD00/AREA008 stores format strings at base+4.

Nineteen payloads hold no addiu $sp and no jr $ra at any word offset, so they contain no function that can return. They are WORLD00 AREA006, 009, 017, 030 (slot 3) and 031; WORLD01 AREA066 and 070; WORLD02 AREA083, 089 (slot 3) and 101; WORLD03 AREA122, 126, 129 (slot 3), 137 and 138; and WORLD04 AREA159, 190, 194 and 195. The words after the id are data. The two 128-byte slot-3 stubs (WORLD02/AREA089 and WORLD03/AREA129) differ only in the id word, and WORLD04/AREA190 is a table of pointers into its own slot (0x801F2C04 to 0x801F2C18). The entry at base+4 reaches no return in any of them.

Question What would settle it
Names behind byte-code values; operands of the +0x20 and +0x22 record lists the dispatch tables D_8017F8F0 and D_8017F8FC and their handlers
Header word scroll (map bundle +0x1E) the reader of that field, or a map that uses it
Which battle background upload a battle draws, and its palette the battle code that selects a BATL_* upload
The loader and palette of the world-map uploads in AREA000 and the 11 world-map areas the code that reads entries 5 and 7
The script that ends the 10 enemies with HP 0xFFFF a trace of one such fight
Whether any code reads byte 0 of a script record, the frame count a reader of that byte
Bits 4 to 6 of a frame part’s size byte a reader of those bits
  • Confidence: medium. The block formats, script table and map bundle header are checked on all 200 archives, and the script record grammar is read in the step and draw code; the byte-code names, scroll and the battle and world-map graphics are not decoded.
  • Evidence: the 200 area archives, the loader and the area, field and battle functions named above. The script record grammar comes from Actor_BeginScript, Actor_SeekScript, Actor_StageAnimStep, the three step functions and Area_DrawObjectSprite. The frame count at record byte 0 is [inferred] from the layout. The script table holds no opcodes, so the event-script opcodes in the community bof3-script-editor (MIT) do not describe it (sources).