In this episode of 8-Bit Show and Tell, Robin explains how the C64 Truchet Tiles program functions. The focus is on code, not visuals. He begins by mounting a D64 image using Turbo Macro Pro and loading the latest source file: tile 21.
Robin discusses how the BASIC stub enables autostart functionality. He then outlines how the tile patterns are displayed using PETSCII characters, screen memory, and color memory. This breakdown reveals how data structures and drawing routines work together.
How Tiles Are Stored and Reused
The program features 30 patterns of varying sizes. These are stored in memory using a pointer table. Each definition begins with width and height values, followed by tile data. This method supports flexible layout and efficient memory usage.
Robin also explains the use of zero-page pointers. These make drawing routines faster and allow indirect indexing. To repeat tiles across the screen, the program resets pattern pointers once they reach their limit. This looping system supports both small and large tile layouts.
Assembly Code Walkthrough
Robin walks through the code in Turbo Macro Pro. He explains each step clearly. Variables define screen dimensions, memory locations, and drawing states. Screen memory fills in four segments using indexed loops. This approach improves efficiency and fits within the 6502’s 8-bit limits.
The program calculates screen rows by adding 40-character segments. It repeats pattern rows using stored offsets. Each loop draws a tile, checks dimensions, and moves to the next location. Once the full screen is rendered, it waits for a keypress. Pressing a key advances to the next pattern.
Bonus: Minima Reloaded
Robin shares a brief update on his 4K tile-based RPG, Minima Reloaded. It uses similar tile principles with procedural map generation. The game spans nearly 100 C64 screens. Each tile, defined by just one byte, combines four characters for compact storage. This technique creates large maps with minimal memory.