-
Notifications
You must be signed in to change notification settings - Fork 0
Event to String Path
Navigation: Home - Game systems - Event to String Path
flowchart LR
script["event.dat script"] --> op{"opcode"}
op -- OP_01..06 --> evs["Location string bank<br/>A4-$47C8"]
op -- OP_0B --> evs
op -- OP_0E --> hdl["Service handler"]
hdl --> str["str.dat A4-$703e"]
hdl --> exe["Code hunk ASCII"]
How event.dat dialogue reaches the player, and how OP_0E town services
pull text from str.dat or the executable instead. ASM references:
mm2.capstone.asm (handlers below), 07-event-script-opcodes.md,
29-embedded-exe-strings.md, 28-town-services.md.
[TOC]
Mixed model. Tile scripts in event.dat only pass small numeric indices
(string index, OP_0E selector byte, gold amount, etc.). They do not open
str.dat directly.
-
OP_01–OP_06resolve text from the current location’sevent.datstring bank (copied into workspaceA4-$47C8, indexed viaA4-$86AC/A4-$5D3C). -
OP_0Bdoes not display text at all (neitherevent.datnorstr.dat). It loads a signboard.anmsprite:0x15756maps the opcode's first byte through a per-environment sign table to a sign id (NN.anm). The decoders treat its arg0 as a sign index, not a string index — see §2.2 and45-event-graphics-opcodes.md. -
OP_0Epasses one selector byte into a C-like service handler (pub, inn, temple, training, guild, smith, …). That handler loads UI strings fromstr.dat(A4-$703ebase, drawn with-$7BE4) and/or embedded ASCII in the code hunk (PEAPC-relative addresses; see doc 29). -
Numeric shop data (donation gold, spell bytes, rolled stock) comes from
data-hunk master tables and/or RNG at shop-open, not from
event.dat.
Pub vs inn: Food, drinks, and specialties are OP_0E 0x03 → 0x1D208
(tavern). The inn is 0x01 → 0x1A132 (rest, registry, hirelings) and uses
mostly exe-embedded prompts (0x19D00…, doc 29).
| Step | Address | Role |
|---|---|---|
| Tile scan | 0x1754A |
(y,x) triplets → event id → script PC in location record |
| Dispatch loop | 0x1750C |
Fetch opcode byte |
| Opcode table | 0x17494 |
Jump table for 0x00…0x32
|
| Invalid | 0x1748C |
Sets abort A4-$8616
|
OP_0E stub: 0x1734E → jsr 0x160C2 → return to 0x1750C.
| Step | Address | What |
|---|---|---|
Read u8 index |
0x155BE |
Next script byte |
| Resolve string | 0x15884 |
Walk 0xFF-terminated strings in A4-$47C8; save cursor in A4-$5D44
|
| Copy for draw | 0x158C8 |
Copy into A4-$5D3C; @ (0x40) → newline 0x0A
|
Loader (0x92F2 / scanner 0x1754A) sets A4-$86AC to the location’s
string base inside the decoded event work buffer. No str.dat read on this path.
Full pixel-exact draw paths (thunk targets, dest rects, line metrics, prompt
loops, restore behavior) are traced in
44-event-text-rendering.md.
| Op | Handler | Text source | Draw path (thunk → routine) | Dest |
|---|---|---|---|---|
01 |
0x15924 |
event.dat |
-$7EC0 → 0x54F2
|
centered, row 17 (cols 1..38 cleared) + row-18 divider |
02 |
0x15942 |
event.dat |
-$7F62→0x42DC clear, -$7BFC→0x22108 cursor, -$7C62→0x218EA putchar |
block rows 19..22, col 1 |
03 |
0x159CE |
event.dat (via 02) |
-$7F5C→0x43A8 + -$7ED8(2)→0x5312 prep, then 02 base 17 |
block rows 17..22, col 1 |
04 |
0x159F4 |
event.dat |
-$7BE4 → 0x22376 (JAM1) |
door label, row 3, centered on col 14, over 3D view |
05 |
0x15A46 |
event.dat |
-$7C74→0x21624 window + -$7BE4
|
popup cells (4,3)-(24,13), centered, transparent |
06 |
0x15AEE |
event.dat | glyph signpost + post, pen $7A50
|
outdoor sign (7,7)-(19,14) |
0B |
0x15DB0 |
sign .anm (no text; 0x15756 maps arg0→sign id) |
-$7FC2→0x316E sprite + -$7FBC→0x3266 place |
service signboard sprite over viewport |
OP_09 / OP_0A: y/n prompts (0x15D3C, Y → cond A4-$7951); question
text still comes from prior event opcodes, not str.dat. OP_07/08
SPACE-wait (0x15CE6) prints "('Space' to continue)" at (9,23) then redraws
the row-23 rule (-$7F4A → 0x44E0). See doc 44 §3.7.
Reads one u8 selector (0x160C0 / 0x155BE), then chained subtract /
range bins (see 07-event-script-opcodes.md).
| Sel | Decoder name | Call | Notes |
|---|---|---|---|
0x01 |
open_inn_lodging |
0x1A132 |
Inn rest / dismiss; exe + str |
0x02 |
open_training |
-$7CD4 |
Training hall; level-up from XP |
0x03 |
open_tavern_food |
0x1D208 |
Pub menu; A4-$79F2 town index |
0x04 |
open_temple |
-$7D16 |
Temple; str.dat + spell/donation tables |
0x05 |
open_mages_guild |
-$7D10 |
Guild spells; membership check 0x1E410
|
0x06 |
open_blacksmith_shop |
0x1C54A |
Smith; static + RNG stock tables |
0x07–0x08
|
store / arena |
-$7DB8 / -$7DBE
|
General store / Arena Games (0x9D76) |
0x0A |
goblet quest |
-$7DAC → 0xD634
|
Nordon (10,2)/W event 30 — loc 60 str[9] |
0x0E |
default-range |
-$7DFA → loader |
Feldecarb Fountain (15,15) event 17 — loc 60 str[23] (see doc 53) |
0x0D |
enroll_mages_guild |
-$7DA0 |
Sets roster $0B home town (not purchase gate) |
Default path (0x15EDC → -$7DFA): selector binned to category 0x3C–0x46;
temporarily overwrites A4-$79F2 with category byte for the call.
- Does not read
event.datstrings for shop menus. - Does not embed item names in the script; handlers use
str.datand/or rolled pointers built at shop-open.
Global UI base: A4-$703e = loaded str.dat (see 0x7DF6, 0x807A,
0xE63C: move.l -$703e(a4), -(a7) before -$7BE4 text draw).
| Handler | Selector | Primary strings | Secondary |
|---|---|---|---|
Inn 0x1A132
|
0x01 |
Embedded exe (0x19D00…, doc 29) |
Shared gold messages in str |
Training -$7CD4
|
0x02 |
str.dat + exe training prompts |
HP path messages @ 0x9BCA
|
Pub 0x1D208
|
0x03 |
str.dat menus (food A–C, drinks A–F, rumors) |
Pub NPC intros in str; rumor bytecode A4-$119A
|
Temple -$7D16
|
0x04 |
str.dat priest lines + spell menu |
Donation UI; spell names via spell index → str |
Guild -$7D10
|
0x05 |
str.dat + membership error (str ~369) |
Spell list pointers A4-$6AB4
|
Smith 0x1C54A
|
0x06 |
str.dat smith intros (defer path) + category lines |
Category lines from A4-$5AA6; specials from RNG A4-$5A56
|
Remake note (doc 28 §1.4.3): pub/temple show str.dat y/n intros before the
menu; blacksmith opens the buy menu directly when PlayTownServiceUi is bound.
- Town index:
A4-$79F2(map screen 0–4). - Menu strings:
str.datblock (~lines 109–127 in11-str-decoded.txt). - Food/drink effects use engine item/food helpers (
-$7F68modes0x33, etc.); item ids come from handler tables / scripts, not fromevent.dattext indices.
- Spell indices per town:
A4-$66E2/A4-$66CE(runtime bytes). - Display: index → spell name in
str.dat(-$7E90/-$7E8Ahelpers). - Temple open (
0x1D208) fills pointer tables via-$7DE2RNG (same family as smith).
Innkeeper dialogue, some shop chrome, training lines, chests/traps: PEA PC
in code hunk 0. str.dat codec does not apply. Cross-ref category table in
29-embedded-exe-strings.md.
flowchart TD
tile[Tile triplet event.dat]
scan[Scanner 0x1754A]
interp[Interpreter 0x172CA]
evStr[event.dat string bank A4-47C8]
strdat[str.dat A4-703e]
exe[Embedded exe PEA strings]
op01[OP_01..06 / 0B]
op0e[OP_0E selector]
inn[0x1A132 inn]
pub[0x1D208 pub]
temple[-7D16 temple]
smith[0x1C54A smith]
tile --> scan --> interp
interp --> op01 --> evStr
interp --> op0e
op0e --> inn --> exe
op0e --> pub --> strdat
op0e --> temple --> strdat
op0e --> smith --> strdat
smith --> exe
| Tool | Purpose |
|---|---|
tools/decode_event.py |
Opcodes + OP_0E selector names |
tools/mm2_codec.py str-decode |
str.dat → 11-str-decoded.txt
|
tools/dump_shop_tables.py |
Data-hunk master numeric tables (not runtime BSS) |
editor/src/core/EventOps.h |
Opcode mirror |
Note: tools/extract_embedded_strings.py is referenced in doc 29 but may
need to be re-added to the repo; use doc 29 + capstone PEA xrefs meanwhile.
| Topic | Status |
|---|---|
| Event opcode → event.dat strings |
Complete (ASM 0x15884 / 0x155BE) |
OP_0E → handlers |
Complete (0x160C2) |
| Handlers → str.dat / exe | Complete (handler survey) |
| Remake town-service UI |
Partial — see 28-town-services.md §1.4.3 |
| Per-town numeric item/spell tables | See 28-town-services.md §13 + EXTRACTED/shop_tables.json
|
| Page | Why |
|---|---|
| Town Services | OP_0E service handlers |
| event dat Format | Per-location string banks |
| Embedded Exe Strings | PEA PC-relative exe text |
| Event Script Opcodes | OP_01..OP_06, OP_0B |
- Docs Wiki Hub ← full doc index
- Getting Started ← read this first
- Overview
- Workspace Notes
- Open Questions
- Full Analysis
- Game Remake
- Startup and Init
- Runtime Memory Map
- Main Loop and Map
- Exploration Input and Options
- Party and Session
- Game State Struct
- Data Hunk mm2 data 00
- Time Era Calendar
- GFX Loading
- ANM TV Format
- PC DOS graphics
- SNES graphics
- 3D View and Game Screen
- Amiga 3D Render Process
- Scripted Scene Graphics
- Event Graphics Opcodes
- Title Screen Assets
- Title Screen Animation
- Format inventory
- items.dat
- monsters.dat
- roster.dat
- attrib.dat
- map.dat
- spells & item use
- event.dat
- Events by location ← 71 maps
- Events hub (numbered)
- Event Script Opcodes
-
Event Script DSL ←
.mm2evtauthoring - Event Text Rendering
- Event Graphics Opcodes
- Combat Overview
- Combat System
- Encounter Tables
- Spell Cast ASM
- monsters.dat abilities
- Spells and item use
- Town Services
- Spell Sources
- Character Mechanics
- Skills and Hirelings
- Commerce Formulas
- Commerce World Services
- Mount Farview Class Quest
- Class Quest HP Bug
- Event Runtime
- Event to String Path
- Embedded Exe Strings
- Copy Protection
- Time Era Calendar
- Game State Struct
- MM1 Overview ← hub + decode status
- MM1 MAZEDATA format
- MM1 to MM2 outdoor
- MM1 WALLPIX by sector
- MM1 art & graphics
- MM1 items / monsters (status)
- MM1 map walker ↗
- MM1 2D maps gallery
- MM1 WALLPIX gallery