Skip to content

Latest commit

 

History

History
125 lines (92 loc) · 4.02 KB

File metadata and controls

125 lines (92 loc) · 4.02 KB

NES Diamond-Chase

A minimal 8-bit NES game written in 6502 assembly (ca65 syntax).

Gameplay

Guide a diamond sprite with the D-pad into the yellow target zone on screen. When the diamond reaches the target:

  • A win chime plays and music stops
  • "YOU WIN!" and "PRESS START" appear on screen

Press Start to reset and play again.

Easter egg: Enter ↑ ↑ ↓ ↓ ← → ← → to trigger a 3-second rainbow colour flash.

Screenshot / Preview

 ┌──────────────────────────────────┐
 │                                  │
 │  ◆                               │
 │      ┌────┐                      │
 │      │    │  ← target zone       │
 │      └────┘                      │
 │                                  │
 │       YOU WIN!                   │
 │         PRESS START              │
 └──────────────────────────────────┘

Controls

Button Action
D-Pad Move diamond
Start Restart (on win)

Technical Details

Property Value
Mapper NROM-256 (mapper 0)
PRG-ROM 2 × 16 KB = 32 KB
CHR-ROM 1 × 8 KB
Mirroring Horizontal
Audio Pulse 1 (melody), Pulse 2 (SFX)
Resolution 256 × 240, 8×8 sprites

Project Structure

nes-game/
├── game.s        Main 6502 assembly source
│                 (reset, NMI, game loop, audio engine, easter egg)
├── game.cfg      ca65/ld65 linker memory map
├── build.bat     Windows build script
├── build.sh      Linux/macOS build script
├── PLAN.md       Original design document
└── README.md     This file

Building

Prerequisites

Install the cc65 toolchain (provides ca65 assembler and ld65 linker):

  • Windows: Download the cc65 snapshot ZIP from https://github.com/cc65/cc65/releases, extract to C:\cc65, and add C:\cc65\bin to your PATH.
  • Ubuntu/Debian: sudo apt install cc65
  • macOS: brew install cc65

Verify: ca65 --version and ld65 --version

Build

Windows:

cd nes-game
build.bat

Linux / macOS:

cd nes-game
chmod +x build.sh
./build.sh

Both scripts produce game.nes (and game.nes.dbg for debugging).

Running

Open game.nes in any NES emulator:

  • Mesen2 (recommended, Windows/Linux/macOS)
  • FCEUX, Nestopia, RetroArch (with Nestopia core) — all work with NROM

VS Code Integration

Install these VS Code extensions for a smoother workflow:

  • tlgkccampbell.code-ca65 — ca65 syntax highlighting
  • alchemic-raker.alchemy65 (optional) — build-and-debug via Mesen2 (press F5 to assemble and launch)

Audio Design

Channel Role Details
Pulse 1 Background melody 10-note C-major loop, 50% duty, vol 8
Pulse 2 Sound effects Move blip (3 frames) + win chime (C5→E5→G5)

Music stops when the player wins; it restarts on game reset.

Verification Checklist

  1. ca65 --version and ld65 --version print version strings
  2. build.bat / build.sh exits with code 0, produces game.nes (40,976 bytes)
  3. Open game.nes in Mesen2 — diamond sprite visible, background music plays
  4. D-pad moves the diamond; a short blip sounds on each new press
  5. Target zone visible as a yellow bordered rectangle
  6. Guide diamond into target — win chime plays, music stops, "YOU WIN!" appears
  7. Press Start — game resets, music restarts, win text clears
  8. Clamping: sprite stops at all four screen edges without wrapping
  9. Easter egg: ↑↑↓↓←→←→ triggers ~3 seconds of flashing background colours