RAM segments might contain different things depending on the level. To know what's in it, you need to read the level script in order from the start and then collect the pointers associated with RAM segments (or banks) by looking for commands 0x17, 0x18, 0x00 and 0x01. The two latter commands (0x00 and 0x01) will both load data in a RAM segment and jump to a specific offset in that bank. I could look out for what's in the 0x15 bank for BBB, but it would be better if you could figure out by yourself, as this value shouldn't be hard-coded in your program.
To correctly load a level you have to read level script data in order, starting with the main menu "hub" script. Take a look at this document for some explanations on how it works. The "official" entry point where you should start is at 108A10.
108A10/0000: 1B 04 00 00
108A14/0004: 03 04 00 02
108A18/0008: 34 04 00 00
108A1C/000C: 13 04 00 00
108A20/0010: 00 10 00 14 00 26 9E A0 00 26 A3 A0 14 00 00 00 --Loads Level Script data from 269EA0-26A3A0 into segment 0x14, jumps to offset 0x000000
108A30/0020: 05 08 00 00 10 00 00 00 --Jumps to segment 0x10? What's in segment 0x10?
TT64 though starts reading at 269EA0 at the beginning of bank 0x14 as defined by the 0x00 command found in the little script found at 108A10. The content of bank 0x10 is unknown, but it doesn't matter since the 0x00 command just before will jump to the level script. Bank 0x10 may well be containing the little 108A14 script, so the thing simply loops when you exit the level script (so you get back to the menu).
The 0x0C commands found in bank 0x15 (later if you follow the script) are a conditional jump which will jump according to the current level number. So when reading commands, ignore all 0x0C commands except the one corresponding to the level you want to read.
You should experiment with the TT64 script dumping commands to see how the levels are loaded. Particularly, the "Level script select" category which shows the level as read starting in the menu hub script.
It's important to read/load starting from the menu hub script because some stuff is loaded from there that will be used by the level ( 0x17 and 0x22 commands amongst other things).
The level-specific scripts go back to bank 0x15 using the 0x06 command to read things like 0x22 and 0x21 commands. The thing is, some of these "sub-banks" containing 0x22 and 0x21 commands are shared by multiple levels, so if you change something there, it might have repercussions on other levels, including a possible crash if you change a 0x22 command to refer to a bank that is not used by all levels that depend on this command. TT64 indicates which commands are "shared" with a little "s" in the command list. Those with an "x" are also part of bank 0x15 (or some other bank external to the current level script) but are exclusive to this particular level ie.: they're not shared.
It all reminds me of when I started to comprehend the level script structure a few years ago. As you understand more and more you'll see that complex level manipulations are not that easy to pull off (and from I saw I think you're not even starting to deal with objects (0x42 and 0x43) which are found inside the MIO0 banks).
Edit: I've changed the title of this thread so that it can be used as a more general topic about reading level scripts, and so that newbies (aka n00b) don't think you can create a new thread just for a very specific question that could be asked in an existing thread.
Just a little note: I'm moving tomorrow to a nice new apartment, and my internet connection won't be available until tuesday night.
____________________
|