1 Level map in RAM
NovaSquirrel edited this page 2016-07-18 06:54:30 -04:00

Nova the Squirrel stores the level as a 4096 byte array starting at $6000 and ending at $6fff. Each byte corresponds to one block/metatile. The level is stored as a series of 16 block columns, left to right and top to bottom. The address can therefore be viewed as $6XXY, where X is the X position in blocks and Y is the Y position in blocks.

GetLevelColumnPtr is the main level accessing function. It takes a column number in the accumulator and a row number in the Y register, and it constructs a pointer to that column at row 0 and stores it in LevelBlockPtr. The routine also puts the block from the specified row in the accumulator.

GetBlockX reads LevelBlockPtr and stores the column number it corresponds to in the accumulator.

ChangeBlock changes the block at (LevelBlockPtr),y to the block ID specified in the accumulator and updates the screen (block color not updated). Carry set if successful.

DelayChangeBlock does the same thing, but it queues a block change rather than doing the change immediately. The number of frames to wait divided by 4 is passed in address 0.

In addition to the level map, there's an array named ColumnBytes where the per-column information goes, such as the destination of a door or the message on a sign.