Core Dump - Work In Progress
November 7, 1997 : The scrolling routines (part I)
A short note on the scrolling routines
The scrolling routines in Core Dump actually use very few "unknown" tricks. Basically, every screen is constructed out of 8x8 pixel blocks using VDP copy commands. As the VDP is not very quick, speedy scroll is achieved mainly by cutting down on the number of copy commands required. Every game of this type uses a buffer, to store which blocks are where on the last frame. When constructing a new frame, blocks that are already in the right place are not copied again.
Where the Core Dump routines differ most from other games, is in the way that each block is scanned for pixels of colour zero when they are loaded from disk. When using a multi-layer scroll, some blocks have "see-through" bits. A block with at least one zero-pixel is called a "see-through" block, all others are called "solid" blocks.
The VDP has two main types of copy: a "logical" copy, that allows logical operations on pixel copies, such as TIMP, and "high-speed" bye copies, on which no operations can be performed. In practice, logical copies are much slower. Because all information about the blocks is known after scanning, "see-through" blocks are copied using logical copies (slow, but necessary), and all other "solid" blocks are copied using high-speed copies. This greatly improves the overall performance.
But this information about the blocks can be used in more ways to improve the speed. For example, when a sprite is composed entirely out of solid blocks, there is no need to construct any background behind it, which is exactly what happens in Core Dump. Also, sprite blocks aren't constructed at all when they appear behind solid front-layer blocks. These decisions are all made by the scrolling routine, thereby reducing the number of copies needed to construct a frame.
Next time I will explain more about this "see-through" information. Because (you could see this coming, couldn't you?) the Z80 is in fact slower than the VDP, some nifty coding is required to actually apply the decision procedures sketched above. For one thing, a new "pseudo-instruction" had to be invented, and the sprites had to be constructed before the rest of the background in each frame...