psx.wiki

Final Fantasy VII Field Script Debugger: Difference between revisions

Revision as of 00:33, 2 November 2026
RemmyLee
(Final Fantasy VII: both pages rewritten in the Sony manual voice (connected paragraphs, the reason with each fact, no signposts); SYSTEM.CNF defaults cited to the OS manual)
Revision as of 00:54, 2 November 2026
RemmyLee
(Final Fantasy VII: every finding checked against the discs and the StationX runs)
Line 10:Line 10:
## Overview## Overview
−The field module of [Final Fantasy VII](/games/final-fantasy-vii/), FIELD/FIELD.BIN, contains the event debugger that Square used to follow the scripts of a room while they run. The debugger draws text windows over the field screen that show the script author and the name of the room, the Go, Stop and Step commands, the current actor and its position, and the script command being executed. In the retail game the code and its text remain in the module; however, the windows are never drawn.[^d1][^bench]+The field module of [Final Fantasy VII](/games/final-fantasy-vii/), FIELD/FIELD.BIN, contains the event debugger that Square used to follow the scripts of a room while they run. The debugger draws text windows over the field screen that show the script author and the name of the room, the Go, Stop and Step commands, the current actor and its position, and the script command being executed. In the retail game the code and its text remain in the module; however, the windows are never drawn.[^d1]
−Every script command handler calls a trace routine, which reports the internal name of the command and its argument bytes. The internal names are short words such as mes, mjump and kawai. The module also holds the labels and error messages of the debugger, among them "Authr", "Word:", "Actor:", "RqLv", "Actor OFF", "Bad Event code!" and "Bad Event arg!".[^d1][^bench]+Every script command handler calls a trace routine, which reports the internal name of the command and its argument bytes. The internal names are short words such as mes, mjump and kawai. The module also holds the labels and error messages of the debugger, among them "Authr", "Word:", "Actor:", "RqLv", "Actor OFF", "Bad Event code!" and "Bad Event arg!".[^d1]
## Windows## Windows
Line 22:Line 22:
| Window | Contents || Window | Contents |
| --- | --- || --- | --- |
−| 1 | Controller rows ("ctrl:"); no retail call fills it |+| 1 | CTRL: and the party leader, with the actor rows of the leader and the B-R, R-G, G-B, OFFSET, SF and DP rows |
−| 3 | "Word:" and the script command being executed |+| 3 | WORD: and the script command being executed, with its argument bytes |
−| 4 | "Actor:", the entity, RqLv, its script line and its position |+| 4 | ACTOR: and the entity, with its RqLv, TG, script line and position rows |
−| 5 | "Authr:" and the script author, "Event:" and the room name, Go, Stop, Step, Actor OFF, Info OFF |+| 5 | AUTHR: and the script author, EVENT: and the room name, and the GO, STOP, STEP, ACTOR OFF and INFO OFF rows |
+The routine at 800BC9FCh fills both window 1 and window 4. Its only call, at 800BB888h, passes window number 4, and window 1 therefore stays empty in the retail program.[^d1]
+
## Switches## Switches
−The retail program disables the debugger in three ways. The enable flags at 8009D820h and 80071E24h are written only by the room setup routine, which stores 0 to them at 800D8160h and 800D8158h. The window draw routine at 800D85FCh is never called, since no jal instruction, pointer or address load in FIELD.BIN or SCUS_941.63 refers to it. Finally, the room setup routine hides each window that it opens.[^d1][^bench]+The retail program disables the debugger in three ways. The enable flags at 8009D820h and 80071E24h are written only by the room setup routine, which stores 0 to them at 800D8160h and 800D8158h. The window draw routine at 800D85FCh is never called, since no jal instruction, pointer or address load in FIELD.BIN or SCUS_941.63 refers to it. Finally, the room setup routine hides each window that it opens.[^d1]
−A state byte at 80099FFCh controls script execution: 3 means that the scripts run and 4 means that they are stopped. A value of 5 selects step mode, in which one script command is executed per frame; however, the retail program stores only 3 and 4 to this byte, so step mode is never entered.[^bench]+A state byte at 80099FFCh controls script execution: 3 means that the scripts run and 4 means that they are stopped. A value of 5 selects step mode, in which a script command runs only when 80070788h is set; however, the retail program stores only 3 and 4 to this byte, so step mode is never entered.[^bench]
## Operation## Operation
Line 37:Line 39:
The debugger can be shown by making three changes in memory while the field module runs. The per-frame call at 800BA7A8h is changed from jal 800BC438h to jal 800D85FCh so that the windows are drawn every frame, the enable flags at 8009D820h and 80071E24h are set to 1, and the hide bytes of windows 1, 3, 4 and 5 (800E0A3Ah, 800E0D2Eh, 800E0EA8h and 800E1022h) are set to 0. Because each room load hides the windows again, and each return from battle reloads FIELD.BIN with the original call, the changes must be repeated after either event.[^d1][^bench]The debugger can be shown by making three changes in memory while the field module runs. The per-frame call at 800BA7A8h is changed from jal 800BC438h to jal 800D85FCh so that the windows are drawn every frame, the enable flags at 8009D820h and 80071E24h are set to 1, and the hide bytes of windows 1, 3, 4 and 5 (800E0A3Ah, 800E0D2Eh, 800E0EA8h and 800E1022h) are set to 0. Because each room load hides the windows again, and each return from battle reloads FIELD.BIN with the original call, the changes must be repeated after either event.[^d1][^bench]
−These changes were made on a SCPH-5501 on 31 October 2026 in room MDS5_3. The screen then showed AUTHR:AKIYAMA and EVENT:MDS5_3 in window 5 with the GO, STOP, STEP, ACTOR OFF and INFO OFF rows below them. Window 4 showed ACTOR:FURYOB with its RQLV, MAN, DIR and position rows (X FE32, Y FF34), and window 3 showed WORD:RET.[^run]+These changes were made on a SCPH-5501 on 31 October 2026 in room MDS5_3. The screen then showed AUTHR:AKIYAMA and EVENT:MDS5_3 in window 5 with the GO, STOP, STEP, ACTOR OFF and INFO OFF rows below them. Window 4 showed ACTOR:FURYOB with its RQLV, MAN, DIR and position rows (X FE32, Y FF34), and window 3 showed WORD:RET.[^run1]
−The text draw routine at 800D9C04h draws at most 344 character sprites in one frame, whereas the four windows together need about 400. Consequently, when all four windows are open, the text is cut off: in the StationX emulator, window 5 stopped partway through its author line. When the sprite buffer was extended into the unused field pointer code, all four windows were drawn in full with 357 sprites.[^bench]
+The text draw routine at 800D9C04h draws at most 344 character sprites in one frame, whereas the four windows together need about 400. Consequently, when window 1 is filled as well, the text is cut off: in the StationX emulator, window 5 stopped partway through its author line. A routine placed in the unused field pointer code at 800BC4D4h fills window 1 for the party leader, and a second one at 800BC538h skips spaces and extends the sprite buffers, so that the four windows need only 357 sprites. With both routines in place, a SCPH-5501 showed all four windows on 1 November 2026 in room MDS5_2, and window 1 read CTRL:CLOUD.[^bench][^run2]
+
+
+## GameShark Codes
+
+The list below makes the same changes as a GameShark code. Its first line enables the list only while FIELD.BIN is in memory, and the remaining lines apply the changes every frame. The buttons that the list reads at 8009AC5Ch are shown below. The list is entered as one cheat.[^bench]
+
+Table: Debugger buttons
+
+| Buttons | Action |
+| --- | --- |
+| Select + L2 | Show the windows |
+| Select + R2 | Hide the windows |
+| Select + L1 | Step mode (80099FFCh = 5) |
+| Select + R1 | Run the scripts again (80099FFCh = 3) |
+| R2 | One script command in step mode |
+
+In the StationX emulator on 1 November 2026, with the list run by the bench cart's cheat engine, Select + L2 showed the windows in room MDS5_2. In step mode each R2 advanced the actor window, from ACTOR:SAVEL0 to ACTOR:DIRECTR and then to ACTOR:CLOUD, and Select + R2 hid the windows again. The state byte read 5 after Select + L1 and 3 after Select + R1.[^sx]
+
+```
+C00D85FE 3C02
+800BA7AA 0C03
+800BA7A8 617F
+3009D820 0001
+30071E24 0001
+3009D824 0001
+D009AC5C 0101
+300E1022 0000
+D009AC5C 0102
+300E1022 0002
+C20E1022 0001
+800E0A3A 0000
+C20E1022 0001
+800E0D2E 0000
+C20E1022 0001
+800E0EA8 0000
+D009AC5C 0104
+30099FFC 0005
+D009AC5C 0108
+30099FFC 0003
+D009AC64 0002
+30070788 0001
+```
+
## References## References
[^d1]: Final Fantasy VII (USA) disc 1, SCUS-94163, read 1 November 2026: FIELD/FIELD.BIN unpacked to 800A0000h, and SCUS_941.63.[^d1]: Final Fantasy VII (USA) disc 1, SCUS-94163, read 1 November 2026: FIELD/FIELD.BIN unpacked to 800A0000h, and SCUS_941.63.
[^bench]: psx.wiki bench notes, Final Fantasy VII field module, 31 October and 1 November 2026.[^bench]: psx.wiki bench notes, Final Fantasy VII field module, 31 October and 1 November 2026.
−[^run]: psx.wiki bench, SCPH-5501, 31 October 2026, 16:26, room MDS5_3: photograph of the debugger windows on screen.+[^run1]: psx.wiki bench, SCPH-5501, 31 October 2026, 16:26, room MDS5_3: photograph of the debugger windows on screen.
+[^run2]: psx.wiki bench, SCPH-5501, 1 November 2026, 17:57, room MDS5_2: photograph of the four debugger windows on screen.
+[^sx]: StationX emulator run, 1 November 2026: the list through the bench cart's cheat engine, with screen captures and memory dumps.