Softcore 6502 written in Verilog and validated against SingleStep test vectors
Find a file
2026-02-19 15:40:46 +00:00
.gitignore import from private bzone repo 2026-02-17 11:46:19 +00:00
m6502.v define DEBUG to 0 if not defined 2026-02-19 14:08:41 +00:00
Makefile Makefile: move things into Makefile.icestorm 2026-02-19 15:40:46 +00:00
Makefile.icestorm Makefile: move things into Makefile.icestorm 2026-02-19 15:40:46 +00:00
pack-tests pack-tests: only skip SBC in BCD mode 2026-02-18 18:02:52 +00:00
README.md some quick docs on testing 2026-02-18 18:12:30 +00:00
test-m6502.v test-m6502: silence success unless DEBUG 2026-02-19 14:06:42 +00:00

Verilog 6502 softcore

This is a fairly small 6502 softcore for the ice40 sized FPGAs. The intended purpose is for emulating classic Atari vector games like Battle Zone, although it could be used for other systems that had the same CPU.

There are several quirks in the original 6502 related to zero page addressing and this implements them in order to pass the test. Some were fixed in later chips, so be careful if your emulation target depends on a specific version.

Tests

It passes all of the non-BCD test vectors from https://github.com/SingleStepTests/65x02 for the 6502's register state and RAM (bus cycles are not tested), with the exception of a self modifying JSR that has a stack pointer that points to the middle of the instruction, leading to a overwrite of the next byte in the instruction (and that does not occur in practice).

The BCD tests for ADC pass, with the exception of the N and V flags. According to http://www.6502.org/tutorials/vflag.html these are undefined for the 6502, so the test harness masks them off in the BCD tests.

SBC does not pass BCD tests; it's not clear from http://www.6502.org/tutorials/decimal_mode.html exactly what the results are supposed to be when given values that are not within range. Perhaps it could be fixed up.