I'm working on understanding how the level & geometry layout scripts work, but I don't really understand the "RAM segment" stuff and how it relates to ROM banks and other things...
So... as far as I understand it, concerning loading geometry data, first the 0x1b command is called, which starts a RAM loading sequence. Then, either 0x17, 0x18 or 0x1a is called and these take either compressed or uncompressed data to a RAM segment. That's where I'm facing my problems already: Where are the RAM segment IDs and their ranges defined? At what offset in the RAM segment is the data copied to (always at the beginning or at the first unused area, or is there some other fancy command that specifies the RAM segment offset)?
Anyways... The next command should be 0x1d, which ends the RAM loading sequence. Now the geometry data should be ready for being loaded by either 0x21 or 0x22. They assign an ID to either a pointer to a geometry layout script or to a pointer to the polygon data itself ("data" refers to the RSP polygon data commands here, doesn't it?). Anyways, how do I know what offset I need to use now? ...
(Assuming that the 0x17/0x18/0x1a commands always copy the ROM data to the beginning of the RAM segment, I'd guess that the RAM segment offset is the same as the ROM offset (from the ROM offset that marked the start of the 0x17/... commands)...)
Then, to add an object to the current level, the 0x24 command is used. I understand that one pretty well, I just have the same problem concerning the behavior scripts, as they are specified in the same way as the geometry layout script pointers in the 0x22 commands.
So, basically my main questions boil down to:
1. Was the general procedure I described correct?
2. Where are the RAM segment IDs and their ranges defined? - EDIT2: Does RAM segment number X start at 0x0X000000? I'm a bit confused right now, since I though that the whole RAM is mapped to the virtual address 0x80000000 ... Or is the virtual starting address of a RAM segment just 0x8X000000, then?
3. Is ROM data always copied to the beginning of a RAM segment?
4. How do I know which RAM segment offset to use for 0x22 commands? - this question is obsolete if the answer to Q3 is 'yes'.
EDIT: Having thought a bit more about RAM segments, I guess that bascially the whole N64 RAM is divided into x continuous _segments_ of memory with the same size.... If that and Q3 are the case, I just need to know what x is and I'm fine 
____________________
GSoC 2009 - working for the Wine Project this year |