-
Notifications
You must be signed in to change notification settings - Fork 3
Scripts
black-sliver edited this page Oct 18, 2024
·
7 revisions
SoE uses scripts with custom instructions (byte code) for things like opening chests, dialog, etc.
Active scripts are stored in $7e28fc onward with 0x4f bytes per script "slot".
- Bytes
+0..+2are script's current instruction address (as 24bit bus address). - Byte
+3defines the script's status (e.g. filled/active).
Scripts are being added to the list through code at $8ccf18 (JSL there).
- Address (
+0..+2) is set from$26..$28 + #$920000excluding lower half banks by shifting#$8000bit[^1]. - Status (
+3) is set to 2. - Script arguments (and caller?) are copied from
$7e0e80..93to+0x0f..0x22.
Added scripts have to be "activated" by writing their 16bit address (in X after executing $8ccf18) to the list in $7e2f28.
The offset to the next free slot in that list is stored in $86, which has to be incremented afterwards.
See patches/multiworld.txt for an example
[^1]: basically 000bbbbb baaaaaaa aaaaaaaa becomes #$920000 + 00bbbbbb 1aaaaaaa aaaaaaaa
This is due to how continuous rom addressing in hirom works.
For example $000000 becomes $928000, $008000 becomes $938000.
- Mammoth graveyard viper 1-4 death scripts are identical. We change 1-3 to use 4, freeing up
- 17d3: currently unused
- 17d6: currently unused
- 17d9: currently unused
17dc: viper 1-4