Skip to content

Beginner Patterns

Foundational patterns for those starting their retro dev journey

41
Patterns
5
Platforms

Commodore 64

6 patterns

Sinclair ZX Spectrum

12 patterns
Sinclair ZX SpectrumAudio

AY Tone

Play a tone on the 128K's AY-3-8912 sound chip — select a register through port $FFFD, write it through $BFFD, and the chip holds the note on its own while the CPU gets on with the game.

Sinclair ZX SpectrumAudio

Sound Beep

Generate a simple beep or tone by toggling the speaker bit. Rising or falling pitch for feedback sounds.

Sinclair ZX SpectrumFramework

Game Loop (HALT)

Frame-synchronised game loop using the HALT instruction. Locks to 50Hz for consistent timing across all Spectrums.

Sinclair ZX SpectrumFramework

Screen Frame (BASIC)

Draw a 1-cell border around the play area with title and footer bars. The standard game screen layout.

Sinclair ZX SpectrumFramework

Text Utilities (BASIC)

Centre text on any row and clear rows — two tiny subroutines used in every BASIC game.

Sinclair ZX SpectrumInput

Keyboard Reading

Read the ZX Spectrum keyboard matrix by polling I/O ports. Simple, efficient, and no ROM routines required.

Sinclair ZX SpectrumPhysics

Grid Movement with Bounds

Move an entity on a grid with boundary checking. Prevents moving outside the play area.

Sinclair ZX SpectrumRendering

Attribute Writing

Write colours directly to attribute memory for fast, flicker-free graphics without touching pixel data.

Sinclair ZX SpectrumRendering

Character Printing

Print ASCII characters to the screen using the ROM character set. Direct display file access for fast text rendering.

Sinclair ZX SpectrumRendering

Numeric Display

Convert a number (0-99) to two ASCII digits and print them. Essential for scores and counters.

Sinclair ZX SpectrumRendering

Progress Bar (BASIC)

Horizontal progress bar with colour thresholds — blue through yellow, red, to white. Useful for health, temperature, or timers.

Sinclair ZX SpectrumRendering

Seven-Segment Digits (BASIC)

Draw large seven-segment display digits using PLOT/DRAW. Cell-aligned with 1px outline. 10 DATA strings define all digits 0-9.

Nintendo Entertainment System

6 patterns

Commodore Amiga

8 patterns

Cross-Platform

9 patterns
Cross-PlatformAudio

Four Ways to Make a Sound

The tune driver is the same on every machine — but what it talks to isn't. Paula streams a sample, the APU synthesises fixed voices, the SID shapes a rich one, and the Spectrum toggles a single bit. Four answers to 'how does a computer make a sound?', and each one shaped the music.

Cross-PlatformFramework

Game State Machine

Organise game flow with distinct states (title, playing, game over). Clean separation of game phases.

Cross-PlatformFramework

The Ending Dwell

Win or lose, the screen holds for a beat before any button is believed. The pause is the punctuation that lets the player read their own ending — and it stops a held button blowing through three screens in three frames.

Cross-PlatformFramework

Three Caps: Counter, Index, Digit

A level counter, a table index, and a HUD digit are three different numbers with three different caps. The counter never stops, the index clamps for safety, the digit caps for display — conflate them and the game lies about one of them.

Cross-PlatformInput

Input Edge Detection

Detect newly-pressed buttons, ignoring held inputs. Essential for menus and single-action triggers.

Cross-PlatformPhysics

AABB Collision Detection

Axis-Aligned Bounding Box collision — fast rectangle overlap test for sprites and objects.

Cross-PlatformPhysics

The Grace Window

A second of invulnerability after every respawn, covering every damage source, made visible by blinking the player. Without it, dying once where a hazard sits can spend every life in as many frames.

Cross-PlatformRendering

Blink on a Clock

PRESS START winks on a 32-frame beat read straight off a frame counter — one AND instruction selects draw or clear. A blink is two renderers taking turns on a clock you already had.

Cross-PlatformRendering

Sprite Animation

Cycle through animation frames with configurable timing. Walk cycles, explosions, idle animations.