Here comes another post that's required reading to understand the Faxanadu level structure. Today I'm going to explain how scrolling between screens is implemented in Faxanadu, at least in so far as it's relevant to understand the level structure of the game. Vagla's document already explains one of the three different ways of scrolling in Faxanadu, this update will also contain the other two ways.
For reasons of completeness allow me to briefly recap the first way as described in Vagla's document. Each of the 8 levels contains one block of scrolling data that's used for regular scrolling. How to locate and use this block can be found in Vagla's document.
The scrolling code that uses these blocks of information has three defining characteristics which separates it from the other two ways of scrolling:
- The palette of the screen that was entered is the same as the palette of the room that was left.
- The horizontal position of the player does not change when scrolling vertically. The vertical position of the player does not change when scrolling horizontally.
- The screen that was entered is in the same level as the screen that was left.
As promised there are two other ways. The first one is only used in two screens in the entire game (in the screen you can see in the screenshot that accompanies this update and in the screen right above that one). This way of scrolling allows for the following:
- Changing the palette (which is never used in the original game)
- Changing the position of the player (which is used in the two screens mentioned)
There's a table which describes where this kind of scrolling is used. It's located at offset 0x3EA47 and contains eight word entries. These entries are pointers to the actual scrolling data for each of the eight levels. Seven of these pointers directly point to a byte of value 0xFF which is used to signal the end of a scrolling data table, these seven levels therefore don't use this scrolling technique. Only the scrolling data table of the first world is non-empty.
Non-empty scrolling tables contain 4 bytes long entries. The first byte is the screen ID of the screen where this scrolling technique is used. The second byte is the screen ID of the new screen. The third byte is the palette ID of the new screen. The fourth byte is the position of the player in the new screen.
The scrolling data table for the first world contains only two entries.
0003EA57 0C16 B306 160C 2D06 FF ......-..
The third and last scrolling technique allows everything the second technique allows and more. Here it's possible to change the level when scrolling between screens. This is primarily used for entering towns and leaving buildings.
The meta-data table for the necessary scrolling data of this technique begins at offset 0x3EAAC. Like the first table of the 2nd technique this table contains word entries which serve as pointers to the actual scrolling data for each level. Because of the additional information necessary to switch between levels the size of the entries of these scrolling-data tables is 5 bytes. The meaning of the five bytes are:
- ID of current screen.
- ID of new level.
- ID of new room.
- Player's new position
- New palette.
What hasn't been covered yet are the situations when the last two ways of scrolling are used. This will be further discussed in a future update because it depends on another feature (block properties) which have not yet been explained. Briefly speaking blocks can have certain properties that lead to an invokation of the last two scrolling techniques. For those of you who are interested in finding out more about the relationship of scrolling and block properties check the code starting at offset 0xE9C0 in the last ROM bank. The interesting part goes from there until offset 0xEB2E which is the end of the last table used in the third scrolling technique. The actual executable part of code ends at offset 0xEA9B.