EarthBound/Text parser call stack

From Data Crystal
< EarthBound
Revision as of 03:11, 20 July 2009 by Rufus (talk | contribs) (Explains the text parser and its call stack)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The text parser uses a call stack, with the current text parser location usually stored at $7E:96C5, but if a [08] reference jump or similar control code is used, the stack pointer ($7E:97B8) is incremented, and a new "text parser" object is pushed onto the parser's call stack.

Here is a view of the RAM beginning at $7E:96C5 dumped, giving a visual explanation of how it works.

Offset(h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A

00000000 06 00 F2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000001B 86 00 F2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000036 96 00 F2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000051 A6 00 F2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000006C B1 00 F2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000087 C1 00 F2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000000A2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000000BD 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000000D8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000000F3 05 00 B0 00 F2 00 00 00 00 00 00 00 00 ...

From this, we can tell that there has already been 5 calls, with the original text block starting at $F2:0006 (06 00 F2) We can also see the stack pointer (05 00) denoting how many calls have occured already, and the beginning of the control code arguments (B0 00 F2 ...)