Beginner Patterns
Foundational patterns for those starting their retro dev journey
Commodore 64
5 patternsSID Note Trigger
Play a single note on the SID chip with gate control. The foundation of all SID audio.
SID Voice Setup
Configure a SID voice with frequency, waveform, and ADSR envelope. Foundation for all SID audio programming.
Game Loop (Basic)
Simple frame-synchronised game loop using the raster register. Foundation for all C64 games.
Joystick Reading
Read joystick input from CIA#1 for player control. Simple, reliable, and cycle-efficient.
Sprite Movement with Bounds
Move sprites with joystick input and screen boundary clamping. Handle the VIC-II's 9-bit X coordinate.
Sinclair ZX Spectrum
7 patternsSound Beep
Generate a simple beep or tone by toggling the speaker bit. Rising or falling pitch for feedback sounds.
Game Loop (HALT)
Frame-synchronised game loop using the HALT instruction. Locks to 50Hz for consistent timing across all Spectrums.
Keyboard Reading
Read the ZX Spectrum keyboard matrix by polling I/O ports. Simple, efficient, and no ROM routines required.
Grid Movement with Bounds
Move an entity on a grid with boundary checking. Prevents moving outside the play area.
Attribute Writing
Write colours directly to attribute memory for fast, flicker-free graphics without touching pixel data.
Character Printing
Print ASCII characters to the screen using the ROM character set. Direct display file access for fast text rendering.
Numeric Display
Convert a number (0-99) to two ASCII digits and print them. Essential for scores and counters.
Nintendo Entertainment System
5 patternsNMI Game Loop
Frame-synchronised game loop using the NMI interrupt for VBlank timing and OAM DMA transfer.
Reset Sequence
Standard NES initialisation: disable interrupts, wait for PPU, clear RAM. Required boilerplate for every NES program.
Controller Reading
Read the NES controller by strobing and shifting 8 button bits into a variable. Simple, reliable, standard approach.
Sprite Movement with Bounds
Move sprites with D-pad input and screen boundary clamping. Essential for player-controlled objects.
Palette Loading
Load colour palettes into PPU memory at $3F00. Required setup for any NES graphics.
Commodore Amiga
7 patternsSystem Takeover
Disable AmigaOS interrupts and DMA to take full control of the hardware. Required for bare-metal game programming.
VBlank Game Loop
Frame-synchronised game loop that waits for vertical blank using the VPOSR register. 50Hz timing on PAL systems.
Joystick Edge Detection
Detect newly-pressed joystick directions, ignoring held inputs. Essential for grid-based movement and menu navigation.
Joystick Reading
Read Amiga joystick using the JOY1DAT register with XOR decoding for up/down directions.
Sprite Movement with Bounds
Move sprites with joystick input and play area boundary clamping. Foundation for player control.
Copper List Basics
Build a copper list to set colours and sprite pointers. The foundation of all Amiga graphics programming.
Sprite Control Words
Calculate and update Amiga sprite control words from X/Y coordinates. Position sprites anywhere on screen.
Cross-Platform
4 patternsGame State Machine
Organise game flow with distinct states (title, playing, game over). Clean separation of game phases.
Input Edge Detection
Detect newly-pressed buttons, ignoring held inputs. Essential for menus and single-action triggers.
AABB Collision Detection
Axis-Aligned Bounding Box collision — fast rectangle overlap test for sprites and objects.
Sprite Animation
Cycle through animation frames with configurable timing. Walk cycles, explosions, idle animations.