The Tilemap

🚧

This chapter is a placeholder. The full text is being written.

Synopsis

The tilemap layer is the Next’s cheap, fast way to draw text and tiled backgrounds. You define a small library of 8Γ—8 (or 16Γ—16) tile patterns once, then build the screen by writing tile indices into a map. Hardware does the rest β€” every frame, on the fly, with no CPU cost. Want to scroll? Change one register. Want to swap themes? Change one palette.

Topics:

  • What the tilemap is. Two layouts β€” 40Γ—32 tiles (matches the ULA character grid) and 80Γ—32 tiles (denser). 8Γ—8 or 16Γ—16 pixel tiles. Each map cell is two bytes: tile index and attribute (palette offset, X-flip, Y-flip, ULA-over-tilemap bit).
  • Memory layout. Tile patterns and the map both live in Bank 5 by default β€” NextReg $6E controls the tilemap base, $6F the patterns base.
  • Enabling and configuring. NextReg $6B (control: enable, layout, tile size), $6C (default attribute), $4C (transparency colour for tilemap pixels).
  • Scrolling. NextRegs $2F/$30 (X-scroll, including the 9th bit for 80-column mode) and $31 (Y-scroll). Pixel-perfect, hardware-driven.
  • The clipping window. NextRegs $1C–$1F.
  • ULA-over-tilemap and tilemap-over-ULA. Per-cell priority bit and the global priority mode in NextReg $68.
  • The tilemap palette. Eight 4-bit sub-palettes selected per cell, plus the full 256-entry mode.

What you should know first

Planned exercises

  • Text console. Define a 96-character font as 8Γ—8 tiles, then use the tilemap as a fast text terminal β€” no ULA involved.
  • Side-scroller backdrop. A 80Γ—32 map of pre-painted scenery tiles that scrolls horizontally by writing one register per frame.
  • Animated water. Cycle the colours of a few palette entries to make tile-based water animate without redrawing the map.