my6502

My6502 - 6502 CPU in SystemVerilog

A cycle-accurate 6502 CPU implementation in SystemVerilog with Verilator, capable of running Tiny BASIC and NES games.

Features

Core Components

6502 CPU Features

Tiny BASIC Support

Quick Start

Prerequisites

brew install verilator

Run Tiny BASIC ⭐

./run_tinybasic_interactive.sh

Interactive BASIC interpreter with commands:

Run NES Games

The Legend of Zelda (Mapper 1 - MMC1)

./scripts/run_zelda.sh

Super Mario Bros 3 (Mapper 4)

./scripts/run_smb.sh

NES Controls

Building

Compile All Runners

cd src/test/rtl
make all

Individual Targets

make interactive   # Tiny BASIC runner
make runner_nrom   # Mapper 0 (NROM)
make runner_mmc1   # Mapper 1 (MMC1)
make runner_mmc3   # Mapper 4 (MMC3)
make smb_gui       # GUI version

Run Tests

cd src/test/unit
make all

Project Structure

my6502/
├── src/
│   ├── main/rtl/          # RTL source files
│   │   ├── cpu_6502.sv    # CPU implementation
│   │   ├── nes_ppu.sv     # PPU implementation
│   │   ├── nes_apu.sv     # APU implementation
│   │   ├── nes_dma.sv     # DMA controller
│   │   ├── nes_system.sv  # Top-level integration
│   │   ├── mapper_mmc3.sv # MMC3 mapper
│   │   └── ...
│   └── test/
│       ├── unit/          # Unit tests
│       └── rtl/           # Integration tests & runners
├── basic/                 # Tiny BASIC programs
├── games/                 # ROM files (not included)
├── docs/                  # Documentation
└── run_tinybasic_interactive.sh  # Quick launcher

Documentation

Testing

Unit Tests (6/6 passing)

cd src/test/unit
make all

Tests include:

Game Tests

Current Status

Completed (80%)

In Progress

Performance

Known Issues

License

Educational project - see source files for details.

Credits