Opcode catalog

DS game only γ¨γ‚“γŒγ‚Šγƒœγ‚¦γ‚·γ¨γŠγ—γ‚ƒγ‚Œγͺまほう぀かい The field guide documents the DS game's internals.

All 88 inline-CMD opcodes observed in the message corpus, with hex value, arg count, dispatch verification, and frequency.

Opcodes appear inside INLINE_CMD tokens as the second u16: 0x0024 (opcode | 0x8000) [0x0027 (arg | 0x8000)]* 0x003B [data... 0x0000]. The op column is the opcode value (word & 0x7FFF); the wire column is the literal u16 you find in the file. 330,769 CMDs counted across 50,196 non-empty entries in 1,328 message files.

Verification levels

Categories

CodeNameMeaning
FFormattingColor, font, inline style
SSubstitutionInserts runtime data (player name, NPC name, item, etc.)
DDialogTextbox layout, speaker portrait, expression β€” header-like config
MMenuChoice list structure
CFlowBranching, conditional, line-flag mode select
XScriptEngine script call / marker
PDisplayRenderer-side display control (close box, wait, separator)
UUnknownFunction not yet identified

Width budgets (text substitution)

For length-fitting EN translations, the substitution opcodes carry a character-width budget when the engine inlines their output:

Tag formOpcodeWidth (chars)Source
[PLAYER_NAME]0x01F410Save slot, user input
[SCHOOL_NAME]0x01F810Save data
[NAME:<id>]0x01F7≀12 (longest canon NPC)NpcDataOfs[id]
[ITEM:<id>]0x01FB≀24itemname.ofs[id]
[PARTICLE:<slot>]0x01FF≀6NpcDataOfs +0x5C+(slot*0x10)
[NPC_DAT:0]0x0202≀6 (pronoun)NpcDataOfs +0x20
[NPC_DAT:1]0x0202standalone phraseNpcDataOfs +0x2C
[CHOICES:99]0x020520Runtime context (object/item)
[GUEST:<n>]0x01F510Guest slot (0..3)

Full opcode table

Sorted by hex value:

opwirenamecatargs countverifynotes
0x0000 0x8000 COLOR Formatting 1 24,540 corpus only Text color. Args: 1=red, 2=orange, 3=green, 4=blue, 5=yellow, 6=gray, 8=pink, 0=default
0x0001 0x8001 CODE_8001 Formatting 1 4 corpus only Rare formatting code.
0x0004 0x8004 CODE_8004 Formatting 1 30 corpus only Formatting variant.
0x0008 0x8008 CODE_8008 Unknown 1 5 corpus only 3 param variants.
0x0009 0x8009 COND Flow 1-2 305 corpus only Conditional check. 30 unique conditions.
0x000c 0x800c OP_800C Flow 1 82 verified Form-feed equivalent (terminates message entry).
0x0010 0x8010 CTX Flow 2 7 verified Parser sets line.flags=3 (arg-mode 3).
0x0011 0x8011 REF Flow 2 2,758 verified Parser sets line.flags=2.
0x0012 0x8012 LINK Flow 1 4,320 verified Parser sets line.flags=1. Most common arg: 0x01=2675, 0x02=1221.
0x0013 0x8013 MENU Menu 1 5,870 verified Parser clears line.flags low-nibble (arg-mode 0). Menu option terminator/ID.
0x0015 0x8015 CODE_8015 Flow 1 86 corpus only Mostly arg 0x218 (Γ—82).
0x0016 0x8016 EXPR Dialog 2 47,314 corpus only Facial expression. 432 unique IDs. First param always 0x9B72.
0x0017 0x8017 TEXTBOX Dialog 3-4 59,020 corpus only Textbox layout. 154 configs.
0x0018 0x8018 SPEAKER Dialog 2 59,407 corpus only Speaker portrait ID. 129 combos.
0x001a 0x801a CODE_801A Unknown 4 4 corpus only Very rare 4-arg code.
0x001b 0x801b CODE_801B Unknown 4 4 corpus only Very rare 4-arg code.
0x001c 0x801c CODE_801C Unknown 2 2 corpus only Very rare.
0x0020 0x8020 CODE_8020 Flow 0 383 corpus only Flow marker, no params.
0x0021 0x8021 CODE_8021 Flow 0 382 corpus only Flow marker, no params.
0x0022 0x8022 CODE_8022 Menu 1 146 corpus only Menu response handler.
0x0028 0x8028 CODE_8028 Unknown 3 38 corpus only 3-param code, unknown semantics.
0x0029 0x8029 CODE_8029 Unknown 3 5 corpus only 3-param code, unknown semantics.
0x002b 0x802b CODE_802B Unknown 2 75 corpus only Mostly (0,0) Γ—72.
0x002d 0x802d CODE_802D Unknown 3 84 corpus only Unknown 3-param.
0x002e 0x802e CODE_802E Unknown 1 36 corpus only Unknown.
0x002f 0x802f CODE_802F Unknown 0 1 corpus only Single occurrence in corpus.
0x0030 0x8030 CODE_8030 Unknown 2 18 corpus only 17 unique combos.
0x0031 0x8031 CODE_8031 Unknown 1 6 corpus only 6 variants.
0x0037 0x8037 HEADER Dialog 1-2 2,526 verified HEADER opcode β€” only valid as first CMD in entry. Always opens with 0x0024 0x8037; closes with 0x003B 0x0000.
0x003a 0x803a CODE_803A Script 1 62 corpus only 19 param variants.
0x0049 0x8049 SCRIPT_8049 Script 2-3 2,718 corpus only Script call. 485 unique param combos.
0x004a 0x804a CODE_804A Script 0 100 corpus only Script marker, no params.
0x004b 0x804b SCRIPT_804B Script 3 17 corpus only Script call variant.
0x004c 0x804c SCRIPT_804C Script 3 743 verified Parser sub-handler FUN_0206726C: reads 2 typed args, sets line.flags bit 4, stores at line.args[0xA..0xF].
0x004d 0x804d SCRIPT_804D Script 4 15 corpus only Script call variant.
0x004f 0x804f OP_804F Script 0 8,070 corpus only Script/logic marker, no params. Splits dialog into logical phrases.
0x0053 0x8053 OP_8053 Unknown 0 2 corpus only Not in user CSV.
0x0054 0x8054 CODE_8054 Script 0 2 corpus only Rare script marker.
0x0055 0x8055 CODE_8055 Script 0 72 corpus only Script marker, no params.
0x005f 0x805f CODE_805F Script 0 672 corpus only Script marker, no params.
0x0060 0x8060 CODE_8060 Script 1 12 corpus only Always arg 0x8000.
0x0061 0x8061 CODE_8061 Script 1 144 corpus only Args 0x8008 (Γ—84), 0x800B (Γ—60).
0x0064 0x8064 CODE_8064 Script 0-1 216 corpus only No-param (Γ—188), arg 0x8001 (Γ—28).
0x01f4 0x81f4 PLAYER_NAME Substitution 0 10,778 dispatch traced Routed to FUN_02057754 with key 0x1F4 (registry-99 lookup). Substituted with player name. Width budget: 10 chars.
0x01f5 0x81f5 GUEST Substitution 1 8 dispatch traced Routed to FUN_02057754 key 0x1F5. 4 guest slots (args 0..3).
0x01f7 0x81f7 NAME Substitution 1 657 dispatch traced NPC name by ID. FUN_02057754 key 0x1F7. Source: data/npc/NpcDataOfs.ofs[arg].
0x01f8 0x81f8 SCHOOL_NAME Substitution 0 6 dispatch traced FUN_02057754 key 0x1F8. School name from save data.
0x01fb 0x81fb ITEM Substitution 1 610 corpus only Item name by ID. Source: data/item/itemname.ofs[arg].
0x01ff 0x81ff PARTICLE Substitution 1 60,685 corpus only NPC sentence-ender particle. 6 slot variants (args 0..5). Source: NpcDataOfs +0x5C+(arg*0x10). MOST COMMON OPCODE.
0x0202 0x8202 NPC_DAT Substitution 1 21,815 verified arg 0 = PRONOUN (NpcDataOfs +0x20, substituted inline). arg 1 = CATCHPHRASE (NpcDataOfs +0x2C, standalone phrase).
0x0203 0x8203 END Display 0 536 corpus only End dialog sequence.
0x0204 0x8204 DISP_8204 Display 0 168 corpus only Display control.
0x0205 0x8205 CHOICES Substitution 1 497 corpus only Dynamic object/item reference in dialog. Width budget: 20 chars.
0x0206 0x8206 CHOICE Substitution 1 742 corpus only Dynamic object reference. Always arg 0x8083.
0x0208 0x8208 DISP_8208 Display 1 9 corpus only 5 param variants.
0x0212 0x8212 OP_0212 Unknown 1 4,317 corpus only Function not yet identified (uncatalogued).
0x0213 0x8213 CLOSE Display 0 1,454 corpus only Close textbox.
0x0214 0x8214 WAIT_ANIM Display 0 1,260 corpus only Wait for animation.
0x0215 0x8215 SEP Display 0 1,192 corpus only Section separator.
0x0217 0x8217 DISP_8217 Display 1 601 corpus only Args 0x8000 (Γ—384), 0x8001 (Γ—217).
0x0218 0x8218 DISP_8218 Display 0 2 corpus only Rare display.
0x021a 0x821a DISP_821A Display 0 374 corpus only Display control.
0x021c 0x821c DISP_821C Display 1 59 corpus only Always arg 0x8004.
0x021d 0x821d DISP_821D Display 1 59 corpus only Always arg 0x8004.
0x0221 0x8221 PLAYER_NAME2 Substitution 1 86 corpus only Player name variant. Args 0x8000 (Γ—54), 0x8001 (Γ—32).
0x0227 0x8227 DISP_8227 Display 1 52 corpus only 3 param variants.
0x0228 0x8228 DISP_8228 Display 1 53 corpus only 4 param variants.
0x0229 0x8229 TREND_PRODUCT Substitution 1 584 corpus only Trigger/event. Mostly arg 0x8004 (Γ—507). Also references UCC food slots (multi-name).
0x022a 0x822a DISP_822A Display 1 228 corpus only 3 params.
0x022b 0x822b DISP_822B Display 2 745 corpus only Complex display/animation. 19 combos.
0x0230 0x8230 RESET Display 0 1,155 corpus only Reset display state.
0x0231 0x8231 DISP_8231 Display 0 827 corpus only Display control.
0x023a 0x823a DISP_823A Display 1 148 corpus only 13 param variants.
0x023b 0x823b DISP_823B Display 1 274 corpus only Args 0x8002 (Γ—156), 0x8003 (Γ—118).
0x023c 0x823c DISP_823C Display 2 17 corpus only 2 combos.
0x023d 0x823d DISP_823D Display 1 136 corpus only Mostly arg 0x8083.
0x023e 0x823e DISP_823E Display 0 6 corpus only Rare display.
0x023f 0x823f DISP_823F Display 0 2 corpus only Rare.
0x0240 0x8240 DISP_8240 Display 0 2 corpus only Rare.
0x0241 0x8241 DISP_8241 Display 0 35 corpus only Display.
0x0244 0x8244 DISP_8244 Display 2 20 corpus only 15 combos.
0x0245 0x8245 DISP_8245 Display 0 31 corpus only Display.
0x0246 0x8246 DISP_8246 Display 0 30 corpus only Display.
0x0247 0x8247 SYS_MENU Display 0 3 corpus only System menu trigger.
0x0248 0x8248 DISP_8248 Display 0 9 corpus only Display.
0x0249 0x8249 DISP_8249 Display 1 45 corpus only Args 0x8001 (Γ—37), 0x8083 (Γ—8).
0x024a 0x824a DISP_824A Display 1 45 corpus only Args 0x8001 (Γ—38), 0x8083 (Γ—7).
0x024b 0x824b DISP_824B Display 1 5 corpus only 3 params.
0x024e 0x824e DISP_824E Display 2 99 corpus only 22 combos.

Parser-visible opcodes

These six opcodes affect the parser FUN_02066c58 directly (line-flag mutation or sub-handler dispatch). Everything else is forwarded to the renderer.

OpcodeParser effect
0x37HEADER. Only valid as first CMD; reads 1–2 typed args between 0x27 separators.
0x10line.flags = (flags & 0xF0) | 3 (arg-mode 3 β€” name field)
0x11line.flags = (flags & 0xF0) | 2
0x12line.flags = (flags & 0xF0) | 1
0x13line.flags &= 0xF0 (clear low nibble β€” no-arg mode)
0x4CSub-handler FUN_0206726C: reads 2 typed args, stores at line.args[0xA..0xF], OR-sets bit 4 of line.flags.

Sources

  • notes/opcode_master_reference.md β€” full corpus census
  • src/translator/opcode_registry.py β€” tag ↔ opcode mapping used by the encoder
  • arm9_full_plaintext.bin @ 0x02066c58 β€” parser
  • arm9_full_plaintext.bin @ 0x02057754 β€” substitution dispatch (keys 0x1F4–0x1F8)