Often paired with the [[NMOS 6522]] versatile interface adapter chip.
# Notability
The 6502 is famous for being the main CPU in many classic computers, consoles, and arcade cabinets.
- [Apple I](https://en.wikipedia.org/wiki/Apple_I), Apple II, Apple II Plus, Apple IIe, Apple III, Apple III Plus
- Acorn Atom, BBC Micro, Electron
- Atari 2600, 400, 800
- Commodore PET, VIC-20, [64](https://en.wikipedia.org/wiki/Commodore_64)[^1]
- [[Nintendo]] Entertainment System, Famicom, Super NES[^1]
# Instruction Set
- [[6502 instructions]]
- [[6502 addressing]]
- [[6502 reference]]
- [[6502 registers]]
# Complexity
- Transistor Count
- https://www.quora.com/How-many-transistors-does-a-6502-have
- Schematics
- http://forum.6502.org/viewtopic.php?t=4332
- Verilog Implementation
- http://www.aholme.co.uk/6502/Main.htm
# Implementations
Aside from the original manufacturing run and the continuations of the design over time, there are many different implementations of this instruction set.
## Gigatron
The [Gigatron](https://gigatron.io/) is a computer built using discrete TTL logic and no single integrated CPU. It uses only 930 logic gates and a microcode layer which can implement a variety of emulated CPUs, including the 6502 with [no additional hardware](https://obsolescenceguaranteed.blogspot.com/2020/05/cloning-6502-apple-1-in-just-930-logic.html).
Due to the emulation layer and some fundamental differences in instruction set, even running at a theoretical 10Mhz, it would still operate at half the performance of the original chip. With the addition of (or just extending) a couple instructions (such as add/subtract with carry) average efficiency per clock cycle could be drastically increased. Combine that with a much higher clock speed in the 50Mhz realm and this would be a much higher performing
## Software Emulation
- Teensy: https://microcorelabs.wordpress.com/2021/09/29/ultimate-apple-ii-accelerator-the-mcl65-fast/
## FPGA Implementations
- https://blog.adafruit.com/2021/10/13/the-100-mhz-6502-microprocessor-fpga-emulation-vintagecomputing/
## Various Homebrew Clones
- https://c74project.com/datasheet/ (20Mhz, goal is to implement a C64)
# Resources
## Ben Eater's 6502-based Broadboard Computer
- https://eater.net/6502
## Compilers
- [[CC65]] compiler for [[C]] targeting the 6502
```cardlink
url: https://youtu.be/SBqbMzPaJeA
title: "Making a New Compiler"
description: "In this video I talk about a project in which I brainstorm and start creating a new compiler for a new language which targets retro 6502/65816 systems."
host: youtu.be
favicon: https://www.youtube.com/s/desktop/b8106bc5/img/favicon_32x32.png
image: https://i.ytimg.com/vi/SBqbMzPaJeA/maxresdefault.jpg
```
# References
- http://6502.org/
- https://en.wikibooks.org/wiki/6502_Assembly
- https://en.wikipedia.org/w/index.php?title=WDC_65C816
- https://cx16.dk/6502/algorithms.html
- https://retro64.altervista.org/blog/an-introduction-to-6502-math-addiction-subtraction-and-more/
# Footnotes
[^1]: Used a variant or direct descendant of the 6502