MOS 6502
termKept in this browser · My desk
MOS Technology's low-cost 8-bit microprocessor of 1975, a variant of the Motorola 6800 architecture; the processor of the Apple II, the Commodore PET, VIC-20 and (as the 6510) the Commodore 64, the Atari 400 and 800 and the BBC Micro.
Chuck Peddle's small team of former Motorola engineers introduced the 6502 at a San Francisco conference for 25 dollars, so far below Intel's and Motorola's prices that some thought it a hoax, the Computer History Museum records. It became the processor of the home computer and of game consoles, and in Brazil of the Apple II clones such as Unitron's AP II.
What it is. The 6502 is MOS Technology's 8-bit microprocessor of 1975, which the Computer History Museum (CHM) describes as 'a low-cost variant on the 6800 architecture' that 'enabled personal computers and games from Apple, Atari, Commodore and others'. Its 16 address lines reach 64 kilobytes (64 KB), its data bus is 8 bits wide, and it ran at 1 MHz in the Commodore PET and the Brazilian AP II, at 1.79 MHz in the Atari 400 and 800, and as a 6502A at 2 MHz in the BBC Micro. Commodore's own guide describes the registers 'inside the 6510', the variant in the Commodore 64.
Origin. The CHM's timeline for 1975 records that Chuck Peddle led a small team of former Motorola employees to build a low-cost microprocessor and introduced it at a conference in San Francisco for 25 dollars, so far below Intel's and Motorola's prices that some attendees thought it a hoax. IEEE Spectrum's Chip Hall of Fame tells the scene from Peddle's side: two glass jars of chips at a trade show, his wife selling them, and, as he admitted in 2016, only the top layers working; the 8080 and the 6800 were fetching nearly 200 dollars. Bill Mensch, who created the 6502 with Peddle, credits a minimal instruction set and a fabrication process that yielded ten times as many good chips as the competition. MOS's KIM-1 board of 1976, sold assembled with keyboard and display for 245 dollars, was meant to let engineers try the chip and found fans among hobbyists; Peddle then convinced Commodore's president, Jack Tramiel, to turn the KIM-1 design into the PET, which grew out of that board and reached the market in 1977 with 4 or 8 KB on a 6502 at 1 MHz.
How it works. The programmer sees an 8-bit accumulator (A), two 8-bit index registers (X and Y), an 8-bit stack pointer (S), an 8-bit processor status register (P) and a 16-bit program counter. The status register holds the carry, zero, overflow and negative flags, which the conditional branches test, and the decimal and interrupt-disable bits, which change how the processor works. The stack is fixed in page one, 256 bytes from 0100 to 01FF hexadecimal, filled downwards from 01FF, with the stack pointer at the next free byte. Three vectors at the top of memory hold the addresses of the handlers: the non-maskable interrupt at FFFA and FFFB, reset at FFFC and FFFD, and the maskable interrupt and the BRK instruction at FFFE and FFFF. After a reset the processor waits six clock cycles, sets the interrupt mask and loads the program counter from FFFC and FFFD.
Addressing. The 6502's speed with so few registers comes from page zero, the first 256 bytes. Zero-page instructions fetch a single address byte and assume a high byte of zero, so they are shorter and faster, and the indirect modes keep their pointers there: indexed indirect, written (Indirect,X), adds X to a zero-page address and reads a 16-bit pointer from it, and indirect indexed, written (Indirect),Y, reads a pointer from page zero and adds Y to it. Absolute addressing puts the low-order byte of the address in the second byte of the instruction and the high-order byte in the third, the little-endian order; relative branches reach from 128 bytes back to 127 forward; absolute indirect is used only by JMP. The 6510 of the Commodore 64 adds a six-pin input and output port, with its data direction register at address 0000 and its output register at 0001.
Where it showed up. IEEE Spectrum names the Apple I, on which Steve Wozniak first ran it, the Apple II, the Commodore PET and 64, the BBC Micro, the Nintendo Entertainment System and the Atari 2600 among the machines built on the 6502 or its variants. The Atari's technical notes show how tightly it was tied to the television: 114 machine cycles per line at 1.79 MHz, with the ANTIC display chip stealing cycles from the processor to read memory. In Brazil, Micro Sistemas no. 16, January 1983, listed the 6502 at 1 MHz in the Apple II compatibles, such as Unitron's AP II, beside a large majority of Z80 machines.
What goes wrong. The Western Design Center (WDC), which sells the complementary metal-oxide-semiconductor (CMOS) successor, publishes a table of the original n-channel MOS (NMOS) 6502's behaviour that its chip changed, and it is the best list of the traps. An indirect jump through a pointer whose address ends in FF does not increment the page: the NMOS chip takes the high byte from the start of the same page instead of the next one, so JMP through a vector at 10FF reads 10FF and 1000. Invalid opcodes have undefined results, and some stop the processor until a reset. The decimal flag is indeterminate after reset and the negative, overflow and zero flags are invalid after a decimal operation. Indexed addressing that crosses a page boundary makes an extra read of an invalid address, which can upset a memory-mapped input or output register, and costs one more cycle. BRK is in effect a two-byte instruction, so the return lands after a signature byte; and an interrupt arriving just after BRK is fetched loads the interrupt vector and the BRK is lost.
Status. The NMOS part is long gone, but the architecture is not. WDC's data sheet for the W65C02S, dated 8 April 2022, describes a fully static CMOS chip with the same 8-bit data bus and 16-bit address bus for 65,536 bytes, 70 instructions, 16 addressing modes and 212 opcodes, new WAI (wait for interrupt) and STP (stop) instructions, operation from 1.8 to 5 volts and up to 14 MHz, and a Verilog model for chip designers; on the W65C02S the indirect-jump bug is fixed at the cost of one cycle, decimal mode is cleared on reset and interrupts, and every unused opcode is a no-operation. IEEE Spectrum notes that a revised version is still made and used in embedded systems and by hobbyists. The Visual 6502 project decapped a single chip in the summer of 2009, photographed the die, modelled about 20,000 components as polygons and built a transistor-level simulation that runs classic programs, including Atari games; it was shown at SIGGRAPH on 27 July 2010.
Neighbours. The Motorola 6800 is its architectural parent and the Zilog Z80 its rival; the 6510 and the 6502A are variants, and the 65C02 its CMOS successor. Machine code and assembly language are how it was programmed, the KIM-1 and the Apple I were single-board computers built on it, and the home computers and game consoles of 1977 to the late 1980s are where most people met it.
Also known as: 6502, MOS Technology 6502, 6510, 6502A
Sources
- Computer History Museum, Timeline of Computer History, 1975 (read 2026-11-23): Chuck Peddle's team of former Motorola employees; introduced at a conference in San Francisco at US$25; used in the Apple II, Commodore PET and the Nintendo Entertainment System
- Computer History Museum, The Silicon Engine, 1971 (read 2026-11-23): 'a low-cost variant on the 6800 architecture by MOS Technology (6502) enabled personal computers and games from Apple, Atari, Commodore and others'
- Commodore, Commodore 64 Programmer's Reference Guide, 1982 (read 2026-11-23): the registers inside the 6510 microprocessor
- Centre for Computing History, Acorn BBC Micro Model B (read 2026-11-23): a 6502A at 2 MHz
- Micro Sistemas no. 16, January 1983 (read 2026-11-23): the Unitron AP II, compatible with the Apple II, on the 6502 at 1 MHz
- IEEE Spectrum, Chip Hall of Fame: MOS Technology 6502 Microprocessor, 30 June 2017, updated 4 December 2023 (read 2026-11-23): introduced at a 1975 trade show from two glass jars, mostly of non-working chips by Peddle's 2016 admission; US$25 against nearly US$200 for the 8080 and the 6800; Bill Mensch credits a minimal instruction set and a process yielding ten times as many good chips; the Apple I and II, PET, Commodore 64, BBC Micro, NES and Atari 2600; a revised version still in production
- Western Design Center, W65C02S 8-bit Microprocessor data sheet, 8 April 2022 (read 2026-11-23): 8-bit data bus and 16-bit address bus for 65,536 bytes; A, X, Y, S and P registers and a 16-bit program counter; 70 instructions, 16 addressing modes, 212 opcodes; vectors at FFFA, FFFC and FFFE; stack from 0100 to 01FF; up to 14 MHz; a table of NMOS 6502 behaviour changed in the W65C02S, including the indirect jump through an address ending in FF, invalid opcodes and the decimal flag
- Visual6502.org, home page, last updated 8 January 2012 (read 2026-11-23): a single 6502 decapped in the summer of 2009; about 20,000 components modelled from die photographs into a transistor-level simulation that runs classic programs, including Atari games; shown at SIGGRAPH on 27 July 2010
- Commodore, VIC-20 Programmer's Reference Guide, Internet Archive text layer (read 2026-11-23): the 6502 stack is 256 bytes in page one, from 0100 to 01FF, filled from 01FF downwards, with the stack pointer at the next free location
- Atari, Atari 400/800 Technical Reference Notes, Internet Archive text layer (read 2026-11-23): the 6502 runs at 1.79 MHz, 114 machine cycles per television line; the ANTIC chip steals cycles from the 6502 to access memory
- Computer History Museum, Revolution, Personal Computers, panel 296 (read 2026-11-23): the KIM-1 was designed so engineers could experiment with the 6502 and found fans among hobbyists; fully assembled with keyboard and display for US$245
- Computer History Museum, Revolution, Personal Computers, panel 298 (read 2026-11-23): Chuck Peddle convinced Commodore's president Jack Tramiel to turn his KIM-1 design into the Commodore PET
- Computer History Museum, Timeline of Computer History, 1977 (read 2026-11-23): the PET, fully assembled with 4 or 8 KB of memory, on a MOS 6502 running at 1 MHz