How the scrolling works


This video illustrates visually how scrolling works. To fully appreciate it, please read the technical details below. Please note that some knowledge of the Amiga hardware is required.

Given that about 80% of the RAM that the standard Amiga 1200 and CD³² are equipped with is allocated for music (which is not standard tracker modules, but conceptually MP3-like as detailed in this article), SkillGrid uses a number of tricks to fit all the rest (code, graphics, and sound effects) in the remaining memory. Some of them are shown in this video.

The background is made of three parallax-scrolling layers:

  • the bottom layer consists of a bitmap that is much taller than the screen;
  • the other two layers are rendered dynamically by blitting graphic tiles as needed - this is necessary to have graphics change all the time and, at the same time, allows virtually endless layers at the small cost of the memory taken by the tiles graphics;
  • the two layers are not buffered, but are just slightly taller than the screen: the incoming tiles are rendered in the out-of-screen areas, thus hiding the drawing process to the eye (with buffering, almost twice the RAM would have been needed, instead);
  • all the layers are wrapped around in real time by the Copper (as explained in the next paragraph); this mechanism allows the layers to occupy exactly the amount of RAM needed by the graphics (i.e. no extra RAM is required for the twin copies otherwise necessary to smoothly restart scrolling when a layer has scrolled entirely).

The layers wrap-around trick is implemented like this:

  • the line that a layer starts to display from at the top of the screen can be any (for exampe, if a layer is 300 lines tall, any line between 0 and 299 can be the line displayed at the very top of the screen); this is obtained by telling the Lisa chip (through the BPLxPT registers) that the bitplanes of the layer start at the addresses corresponding to the chosen line;
  • if/when the bitplanes of the layer are entirely displayed but the screen has not been entirely redrawn yet, the Copper writes on the fly the addresses of line 0 to the BPLxPT registers (for example, if the topmost line was 280, when the 20th visible line of the screen has been drawn the bitplanes bottom has already been reached, but there are still 256-20 = 236 screen lines to draw, so the Copper brings the bitplanes addresses back to the very beginning; the result is that the bottom of the bitplanes is visually followed by their top);
  • therefore, the Copper has to continuously wait for the screen line(s) where it is necessary to reset the BPLxPT registers and then perform the writes; normally only one layer per line needs to be wrapped around, but, depending on the position of the layers, occasionally two or even three layers end on the same line and thus have to be wrapped around at the same time;
  • the Copper code (Copperlist) that performs such operations is generated by the CPU every frame after the screen has been drawn entirely, according to the current scrolling position.

In the first part of the video:

  • the blue layer is the bottom layer (layer 0);
  • the green layer is the middle layer (layer 1);
  • the red layer is the top layer (layer 2);
  • the lines marked with T0/T1/T2 indicate the top of layer 0/1/2;
  • the lines marked with B0/B1/B2 indicate the bottom of layer 0/1/2.

It is worth noting that since the tiles of the top layer are hexagons, they are vertically shifted by half a hexagon every other column. As a consequence, the bottom row tiles in the odd columns actually need to have the upper half blitted at the bottom of the layer, and the bottom half at the top of the layer. Due to the fact that the layer is made of two bitplanes, up to four separate blits might be necessary to render a tile.
In the second part of the video, these tiles are those that are crossed by the horizontal line that marks where the layer wraps around.

Get SkillGrid

Download NowName your own price