Talk:Pikachu off-screen glitch

From Glitch City Wiki
Jump to navigation Jump to search

Explanation for why sign 04 in Vermilion Fan Club executes arbitrary text command from $D221

Just want to quickly document this here; will probably clean up and move to the article page later. Would be very grateful if anyone else would do this for me.

  • The player probably goes into the Vermilion Fan Club through the Vermilion City. The Vermilion Fan Club map doesn't have any signs, but the Vermilion City map has quite a few, and sign 04 corresponds to text ID 11 (the third number in bg_event 12, 3, 11).
  • When the player goes into the Vermilion Fan Club, wNumSigns is set to 0, but wSignCoords and wSignTextIDs keep their previous values because there are no values to overwrite them with (RAM layout).
  • Pikawalk overwrites wNumSigns with 4, and the relevant bytes in wSignCoords with 1, 1.
  • Now the game recognizes sign 04, and reading it will cause the game to try to display the text with ID 11 in Vermilion Fan Club.
  • Vermilion Fan Club only has text IDs 1–6 defined (0 is hardcoded as the Start menu, and there are some others hardcoded, but 11 is certainly not one of them). The pointer to text ID 11 is out of bound, and falls in the first two bytes of this instruction. FanClubText1.yellowtext is $16:53D2, so this instruction translates to "21 D2 53".
  • Therefore the game starts to display text from $D221. DisplayTextID starts in text command mode, so just a 0x08 byte (text_asm) at $D221 suffices to start ACE from $D222.

--Bbbbbbbbba (talk) 04:06, 15 December 2022 (UTC)Reply[reply]

I have added the explanation to the article page. Keeping this here for now for the record (since I have made significant edits to this description). --Bbbbbbbbba (talk) 08:28, 2 January 2023 (UTC)Reply[reply]