MOTHER 3:Extended codes (04)

From Data Crystal
Revision as of 19:46, 6 August 2013 by JeffMan (talk | contribs) (Known codes)
Jump to: navigation, search

Extended codes

[04 00 YY ZZ] = Call extended code ZZYY

The value ZZYY must be between 0 and 0xFF, inclusive. Each code has a fixed number of stack parameters that must be pushed with either [01 XX YY ZZ] or [00 XX YY ZZ] codes before executing the [04] code. The ROM has a table at 0xD2D658 (256 entries, 4 bytes per entry) indicating exactly how many stack parameters each [04] code has.

The ROM has a jump table at 0xD2DA58 (256 entries, 4 bytes per entry), one jump address for each [04] code.

Known codes

(SRAM_BASE is $2004860 in WRAM, $4008/$A008 in SRAM)

  • [04 00 00 00] = Delay parsing
    • 01 = Number of frames to delay
  • [04 00 01 00] =
    • 01 =
  • [04 00 02 00] = UNUSED
  • [04 00 03 00] =
    • 01 =
  • [04 00 04 00] =
  • [04 00 05 00] =
    • 01 =
  • [04 00 06 00] =
    • 01 =
  • [04 00 07 00] =
  • [04 00 08 00] =
  • [04 00 09 00] = UNUSED
  • [04 00 0A 00] = Set event flag
    • 02 = Event flag number. Must be between 0 and 0x7FF, inclusive
    • 01 = Value
  • [04 00 0B 00] = Store byte to (SRAM_BASE + 0x380 + $2)
    • 02 = Must be between 0 and 0x3F, inclusive
    • 01 = Value to store, only lowest 8 bits used
  • [04 00 0C 00] = Store halfword to (SRAM_BASE + 0x3C0 + ($2 * 2))
    • 02 = Must be between 0 and 0x1F, inclusive
    • 01 = Value to store, only lowest 16 bits used
  • [04 00 0D 00] = Push event flag value
    • 01 = Event flag number. Must be between 0 and 0x7FF, inclusive
  • [04 00 0E 00] = Load byte from (SRAM_BASE + 0x380 + $1), push to stack
    • 01 = Must be between 0 and 0x3F, inclusive
  • [04 00 0F 00] = Load halfword from (SRAM_BASE + 0x3C0 + ($1 * 2)), push to stack
    • 01 = Must be between 0 and 0x1F, inclusive
  • [04 00 10 00] = Compare event flag value to $1, push 1 if equal, 0 otherwise
    • 02 = Event flag to check. Must be between 0 and 0x7FF, inclusive
    • 01 = Value to compare with
  • [04 00 11 00] = Compare byte at (SRAM_BASE + 0x380 + $2) to $1, push 1 if equal, 0 otherwise
    • 02 = Must be between 0 and 0x3F, inclusive
    • 01 = Value to compare with
  • [04 00 12 00] = Compare halfword at (SRAM_BASE + 0x3C0 + ($2 * 2)), push 1 if equal, 0 otherwise
    • 02 = Must be between 0 and 0x1F, inclusive
    • 01 = Value to compare with
  • [04 00 13 00] = UNUSED
  • [04 00 14 00] = Map-related
    • 01 = Must be between 0 and 999 (0x3E7), inclusive
  • [04 00 15 00] = Push the current map number
  • [04 00 16 00] = Add to money on hand (capped at 999,999)
    • 01 = Amount to add
  • [04 00 17 00] = Push current money on hand
  • [04 00 18 00] = Set key item value
    • 02 = Item number. Must be between 0 and 0xFF, inclusive
    • 01 = Value to set
  • [04 00 19 00] = Related to key items
    • 01 =
  • [04 00 1A 00] = Push number of characters in party
  • [04 00 1B 00] = Check if character is in current party: push 1 if true, 0 if false
    • 01 = Character to check
  • [04 00 1C 00] = Check if character is in current party: push 0 if true, -1 if false
    • 01 = Character to check
  • [04 00 1D 00] = Related to character stats
    • 01 = Must be between 0 and 3, inclusive
  • [04 00 1E 00] = Add character to party
    • 01 = Character number
  • [04 00 1F 00] = Remove character from party
    • 01 = Character number
  • [04 00 20 00] = Set a flag at 200DEB6:01
    • 01 = Complement of flag value. Must be 0 or 1
  • [04 00 21 00] = Set giftbox flag
    • 02 = Giftbox flag number. Must be between 0 and 0x3FF, inclusive
    • 01 = Value to set (only lowest bit is used)
  • [04 00 22 00] = Push giftbox flag value
    • 01 = Giftbox flag number. Must be between 0 and 0x3FF, inclusive
  • [04 00 23 00] = Restore HP and PP of one character, and clear status ailments
    • 01 = Character number
  • [04 00 24 00] =
    • 01 =
  • [04 00 25 00] = Add to money in bank (capped at 999,999)
    • 01 = Amount to add
  • [04 00 26 00] = Push money in bank
  • [04 00 27 00] =
    • 01 =
  • [04 00 28 00] =
  • [04 00 29 00] =
    • 01 =
  • [04 00 2A 00] =
    • 01 =
  • [04 00 2B 00] = Set character's level and sprite
    • 03 = Character number
    • 02 = Level
    • 01 = Sprite number
  • [04 00 2C 00] = Add an item to a party character's inventory a certain amount of times
    • 03 = Party character number
    • 02 = Item number
    • 01 = Amount of times to add
  • [04 00 2D 00] = Copy party character's HP and PP to stack
    • 05 = Party character number
    • 04 = Stack slot for current HP
    • 03 = Stack slot for max HP
    • 02 = Stack slot for current PP
    • 01 = Stack slot for max PP
  • [04 00 2E 00] = Store word to (SRAM_BASE + 0x744)
    • 01 = Value to store
  • [04 00 2F 00] = Push word from (SRAM_BASE + 0x744)
  • [04 00 30 00] = Change status ailment for a party character
    • 03 = Party character number
    • 02 = Ailment number. Must be between 0 and 8, inclusive. The ailment listing for this is a bit odd:
      • 00 = Poison
      • 01 = Numbness
      • 02 = Sleep (glitchy out of battle)
      • 03 = Strange
      • 04 = Crying (glitchy out of battle)
      • 05 = Forgetful
      • 06 = Nauseated
      • 07 = All ailments
      • 08 = Fleas
    • 01 = Ailment value (should be 0 or 1)
  • [04 00 31 00] = Party related
    • 05 =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 32 00] = Displays text entry from current bank
    • 03 = Speaker (-1 for interacted npc/object, -2 for first party member, etc)
    • 02 = Unused
    • 01 = Text entry
  • [04 00 33 00] = Displays text entry from zero bank
    • 03 = Speaker (-1 for interacted npc/object, -2 for first party member, etc)
    • 02 = Unused
    • 01 = Text entry
  • [04 00 34 00] =
  • [04 00 35 00] =
  • [04 00 36 00] = Push menu selection
  • [04 00 37 00] =
    • 01 =
  • [04 00 38 00] =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 39 00] =
    • 02 =
    • 01 =
  • [04 00 3A 00] =
  • [04 00 3B 00] =
  • [04 00 3C 00] =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 3D 00] =
    • 01 =
  • [04 00 3E 00] =
    • 01 =
  • [04 00 3F 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 40 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 41 00] =
    • 02 =
    • 01 =
  • [04 00 42 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 43 00] =
    • 02 =
    • 01 =
  • [04 00 44 00] =
    • 02 =
    • 01 =
  • [04 00 45 00] =
    • 01 =
  • [04 00 46 00] =
    • 01 =
  • [04 00 47 00] =
    • 02 =
    • 01 =
  • [04 00 48 00] =
    • 08 =
    • 07 =
    • 06 =
    • 05 =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 49 00] =
    • 01 =
  • [04 00 4A 00] =
    • 02 =
    • 01 =
  • [04 00 4B 00] =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 4C 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 4D 00] =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 4E 00] =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 4F 00] =
    • 01 =
  • [04 00 50 00] =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 51 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 52 00] =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 53 00] =
    • 05 =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 54 00] =
    • 05 =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 55 00] =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 56 00] =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 57 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 58 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 59 00] =
  • [04 00 5A 00] =
    • 02 =
    • 01 =
  • [04 00 5B 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 5C 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 5D 00] =
    • 02 =
    • 01 =
  • [04 00 5E 00] =
    • 02 =
    • 01 =
  • [04 00 5F 00] =
    • 01 =
  • [04 00 60 00] =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 61 00] =
    • 01 =
  • [04 00 62 00] =
    • 02 =
    • 01 =
  • [04 00 63 00] =
    • 02 =
    • 01 =
  • [04 00 64 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 65 00] =
    • 02 =
    • 01 =
  • [04 00 66 00] =
    • 02 =
    • 01 =
  • [04 00 67 00] =
  • [04 00 68 00] =
    • 02 =
    • 01 =
  • [04 00 69 00] =
  • [04 00 6A 00] =
  • [04 00 6B 00] =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 6C 00] =
    • 02 =
    • 01 =
  • [04 00 6D 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 6E 00] = Related to screen fades
    • 02 =
    • 01 =
  • [04 00 6F 00] = Related to screen fades
    • 01 =
  • [04 00 70 00] = Related to screen fades
    • 01 =
  • [04 00 71 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 72 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 73 00] =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 74 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 75 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 76 00] =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 77 00] =
  • [04 00 78 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 79 00] =
    • 01 =
  • [04 00 7A 00] =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 7B 00] =
  • [04 00 7C 00] =
  • [04 00 7D 00] =
    • 02 =
    • 01 =
  • [04 00 7E 00] =
    • 01 =
  • [04 00 7F 00] =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 80 00] =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 81 00] =
    • 01 =
  • [04 00 82 00] =
    • 02 =
    • 01 =
  • [04 00 83 00] =
    • 02 =
    • 01 =
  • [04 00 84 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 85 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 86 00] =
    • 01 =
  • [04 00 87 00] =
    • 01 =
  • [04 00 88 00] =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 89 00] =
    • 02 =
    • 01 =
  • [04 00 8A 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 8B 00] =
    • 02 =
    • 01 =
  • [04 00 8C 00] = Start battle
  • [04 00 8D 00] =
  • [04 00 8E 00] =
  • [04 00 8F 00] =
  • [04 00 90 00] =
    • 01 =
  • [04 00 91 00] =
  • [04 00 92 00] =
  • [04 00 93 00] =
    • 01 =
  • [04 00 94 00] = UNUSED
  • [04 00 95 00] = UNUSED
  • [04 00 96 00] =
    • 01 =
  • [04 00 97 00] = UNUSED
  • [04 00 98 00] = UNUSED
  • [04 00 99 00] = UNUSED
  • [04 00 9A 00] = UNUSED
  • [04 00 9B 00] = UNUSED
  • [04 00 9C 00] = UNUSED
  • [04 00 9D 00] = UNUSED
  • [04 00 9E 00] = UNUSED
  • [04 00 9F 00] = UNUSED
  • [04 00 A0 00] =
    • 02 =
    • 01 =
  • [04 00 A1 00] =
  • [04 00 A2 00] =
    • 01 =
  • [04 00 A3 00] =
    • 01 =
  • [04 00 A4 00] =
  • [04 00 A5 00] =
  • [04 00 A6 00] =
  • [04 00 A7 00] = UNUSED
  • [04 00 A8 00] = UNUSED
  • [04 00 A9 00] = UNUSED
  • [04 00 AA 00] =
  • [04 00 AB 00] =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 AC 00] =
    • 01 =
  • [04 00 AD 00] =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 AE 00] =
    • 01 =
  • [04 00 AF 00] =
  • [04 00 B0 00] =
  • [04 00 B1 00] =
  • [04 00 B2 00] = UNUSED
  • [04 00 B3 00] = UNUSED
  • [04 00 B4 00] =
    • 06 =
    • 05 =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 B5 00] =
    • 01 =
  • [04 00 B6 00] =
    • 02 =
    • 01 =
  • [04 00 B7 00] =
  • [04 00 B8 00] =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 B9 00] =
    • 01 =
  • [04 00 BA 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 BB 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 BC 00] =
    • 02 =
    • 01 =
  • [04 00 BD 00] =
    • 01 =
  • [04 00 BE 00] =
    • 05 =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 BF 00] =
  • [04 00 C0 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 C1 00] =
    • 01 =
  • [04 00 C2 00] =
    • 02 =
    • 01 =
  • [04 00 C3 00] =
    • 02 =
    • 01 =
  • [04 00 C4 00] =
    • 02 =
    • 01 =
  • [04 00 C5 00] =
    • 02 =
    • 01 =
  • [04 00 C6 00] =
    • 01 =
  • [04 00 C7 00] =
    • 02 =
    • 01 =
  • [04 00 C8 00] =
  • [04 00 C9 00] =
  • [04 00 CA 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 CB 00] =
    • 02 =
    • 01 =
  • [04 00 CC 00] =
    • 01 =
  • [04 00 CD 00] =
    • 01 =
  • [04 00 CE 00] =
    • 02 =
    • 01 =
  • [04 00 CF 00] =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 D0 00] =
    • 01 =
  • [04 00 D1 00] =
    • 01 =
  • [04 00 D2 00] =
    • 02 =
    • 01 =
  • [04 00 D3 00] =
    • 02 =
    • 01 =
  • [04 00 D4 00] =
    • 02 =
    • 01 =
  • [04 00 D5 00] =
    • 02 =
    • 01 =
  • [04 00 D6 00] =
    • 01 =
  • [04 00 D7 00] =
    • 06 =
    • 05 =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 D8 00] =
  • [04 00 D9 00] =
    • 07 =
    • 06 =
    • 05 =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 DA 00] =
    • 02 =
    • 01 =
  • [04 00 DB 00] =
    • 01 =
  • [04 00 DC 00] =
    • 01 =
  • [04 00 DD 00] =
    • 02 =
    • 01 =
  • [04 00 DE 00] =
    • 01 =
  • [04 00 DF 00] =
    • 02 =
    • 01 =
  • [04 00 E0 00] =
    • 02 =
    • 01 =
  • [04 00 E1 00] =
    • 01 =
  • [04 00 E2 00] =
    • 01 =
  • [04 00 E3 00] =
    • 01 =
  • [04 00 E4 00] =
    • 02 =
    • 01 =
  • [04 00 E5 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 E6 00] =
    • 05 =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 E7 00] =
    • 02 =
    • 01 =
  • [04 00 E8 00] =
    • 01 =
  • [04 00 E9 00] =
    • 01 =
  • [04 00 EA 00] =
    • 05 =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 EB 00] =
    • 01 =
  • [04 00 EC 00] =
    • 01 =
  • [04 00 ED 00] =
    • 02 =
    • 01 =
  • [04 00 EE 00] =
    • 02 =
    • 01 =
  • [04 00 EF 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 F0 00] =
    • 01 =
  • [04 00 F1 00] =
    • 01 =
  • [04 00 F2 00] =
    • 05 =
    • 04 =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 F3 00] =
    • 02 =
    • 01 =
  • [04 00 F4 00] =
    • 03 =
    • 02 =
    • 01 =
  • [04 00 F5 00] =
    • 02 =
    • 01 =
  • [04 00 F6 00] =
  • [04 00 F7 00] =
    • 02 =
    • 01 =
  • [04 00 F8 00] =
  • [04 00 F9 00] =
  • [04 00 FA 00] =
  • [04 00 FB 00] =
  • [04 00 FC 00] =
  • [04 00 FD 00] =
    • 01 =
  • [04 00 FE 00] =
    • 02 =
    • 01 =
  • [04 00 FF 00] =
    • 02 =
    • 01 =