If you are still using the old URL (datacrystal.romhacking.net), please update your bookmarks! The old URL may stop working soon.
The current URL is datacrystal.tcrf.net.
The current URL is datacrystal.tcrf.net.
EarthBound/Text parser call stack: Difference between revisions
Jump to navigation
Jump to search
(Explains the text parser and its call stack) |
m (formatting) |
||
Line 1: | Line 1: | ||
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. | 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. | 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 | <tt> | ||
* 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 | * 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 | * 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 | * 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 | * 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 | * 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 | * 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 | * 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 | * 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 | * 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 | * 000000F3: 05 00 B0 00 F2 00 00 00 00 00 00 00 00 ... | ||
</tt> | |||
From this, we can tell that there has already been 5 calls, with the original text block starting at $F2:0006 (06 00 F2) | 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 ...) | 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 ...) |
Revision as of 03:16, 20 July 2009
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 ...)