65 Reasons To Celebrate The 6502
The legendary chip from 1975 that helped start the home computer revolution
Hi everyone. Hope you’re having a good weekend. This week we have a tribute to one of my favourite microprocessors, the MOS Technology 6502. It’s also a bit of a homage to Ian Leslie’s ‘64 Reasons to Celebrate Paul McCartney’ which is a great read even if you aren’t a McCartney or Beatles fan.
It’s intended as a fun and rapid overview of this chip and its history. If you’ve got other reasons to celebrate the 6502 then please share them in the comments.
For me the 6502 embodies some great virtues. It has elegance and economy of design. It was also hugely consequential in opening up computing to millions in the 1970s and 1980s. And it’s a fun microprocessor to use even today.
If you’d like a more conventional (and detailed) history of the 6502 then there is an amazing in-depth post from Jason Sachs here.
There is a lot to celebrate. So lets start …
65 Reasons to Celebrate the 6502
A Beginning
Chuck Peddle And The Vision Of A Low-Cost Microprocessor
In 1974 at Motorola, Chuck Peddle wanted to design a simple microprocessor to meet the needs of his customers at a price they could afford. Motorola’s management didn't want to undercut their existing 6800 product. So Peddle and a small number of engineers from the team that had created the 6800 travelled across the US to realise this vision.
John Paivinen and MOS Technology
John Paivinen helped found MOS Technology at Valley Forge in Pennsylvania. Peddle approached Paivinen having been turned down by Mostek and later related that Paivinen ‘immediately got it’.
Paivinen promised to have MOS Technology’s first NMOS production line ready for the 6502. He delivered on his promise, with a line up and running in June 1975.
The Original Microprocessor Startup Design Team
When the engineers joined MOS Technology they may not technically have launched a startup but they certainly acted like a startup inside MOS Technology.
The Best Layout Guy in the World
Bill Mensch laid out the design of the 6502 and it worked first time:
Implausibly, the engineers detected no errors in [Bill] Mensch's layout. “He built seven different chips without ever having an error,” says Peddle with disbelief in his voice. “Almost all done by hand. When I tell people that, they don't believe me, but it's true. This guy is a unique person. He is the best layout guy in the world.”
The $25 Microprocessor
Peddle, Mensch and colleagues succeeded in making a microprocessor that could sell for $25.
It’s hard to overstate how important this was. The 6800 sold for at least $250, the Intel 8080 for a similar amount. Just as Peddle had planned, a $25 microprocessor opened up the use of microprocessors in a much wider range of devices.
The Microprocessor Jar
The 6502 team took their new microprocessor to the WESCON trade show in San Francisco in September 1975. To show it off they wanted to sell the new chips and to show that they had lots of working processors. The only problem was that they only had some that worked and lots of chips that didn’t.
The solution, place the 6502s in large jars with the working ones at the top and the duds at the bottom. When a customer bought one the team took a working 6502 from the top of the jar.
The First 6502 Advertisements
They don’t make technology advertisements like this anymore.
MORE USEFUL ADDRESSING CAPABILITY
TWO REAL INDEX REGISTERS
TWO POWERFUL INDIRECTS
The 6501
The 6502 had a twin. The 6501 had mostly the same DNA as the 6502, but some features that were the same as their cousin, the Motorola 6800. The idea was that the 6501 would be ‘pin compatible’ with the 6800 so it could simply replace the 6800 without having to change the circuit board.
Motorola sued and the 6501 was banished never to be seen again. Some have speculated that the 6501 was created just so MOS Technology could withdraw it in the inevitable lawsuit and then focus on the 6502. If so, then the tactic worked extremely well.
Second Sources
No microprocessor launched in 1975 would be successful without ‘second sources’, other firms who could act as alternative suppliers. The 6502 had not one but two ‘second sources’ in Rockwell and Synertek.
Documentation
The 6502 manuals were famous for being high quality. Why were they so good? Because Paivinen forced Peddle to go home and write them. According to Peddle:
Well I was too busy talking to people on the phone and everything else. So Peter walked into the president, John Paivinen, and he says, if you don't throw Chuck out of here and make him write these manuals, they're never going to get done. So Paivinen calls me in his office with the guard captain and says this guy can't come through the door again until I let him come through the door. And I sat at my house, and Peter would come back and forth, and that's how we wrote those few manuals.
Every Little Thing
3510 Transistors
One reason that the 6502 was so inexpensive was that it needed only 3510 transistors. That’s fewer than the 4100 used in the 6800. It’s less than half the number used in its key competitor the Zilog Z80 which used 8500 for comparable (or sometimes worse) performance.
The Registers
One way that the 6502 managed to keep the transistor count low was its sparing use of registers. It had a single eight-bit accumulator (‘A’), two eight-bit index registers (‘X’ and ‘Y’) an eight-bit stack pointer (‘SP’) and a sixteen-bit program counter (‘PC’).
Compare that with the competing Zilog Z80 with 8 eight-bit registers and 4 sixteen-bit registers. Even more wastefully the Z80 had 8 alternate eight-bit registers which could be switched in to replace the main registers, a feature that wasn’t often used.
Page Zero
How does the 6502 manage to perform well with so few registers? It could quickly access the first 256 bytes of memory (called page zero as the first byte of the two-byte address would be zero) using instructions that only needed one byte to specify the memory location.
Page One
If it was possible to save space by using page zero then why not use the same approach with the ‘stack’? Placing it in 'page one’ meant that only a single byte was needed for the stack pointer.
56(ish) Instructions
The 6502 reduced the 72 instructions seen in the 6800 down to an economical 56.
ROR Bug
In fact, the first version of the 6502 had only 55 instructions. The ROR (rotate right) instruction didn't work. The 6502 manual noted that this instruction was only available in later versions.
Other Quirks (Bugs)
This wasn't the only issue with the 6502 instruction set. Some were uncorrected and the programmer had to work around them. For example from Wikipedia:
The 6502's memory indirect jump instruction,
JMP (<address>)
, is partly broken. If <address> is hex xxFF (i.e., any word ending in FF), the processor will not jump to the address stored in xxFF andxxFF+1
as expected, but rather the one defined by xxFF and xx00 (for example,JMP ($10FF)
would jump to the address stored in 10FF and 1000, instead of the one stored in 10FF and 1100). This defect continued through the entire NMOS line, but was corrected in the CMOS derivatives.
(It may seem odd to celebrate bugs. For me though, these minor issues add to the charm of the 6502!)
Addressing Modes
If the 6502 had few instructions it had lots of addressing modes to compensate. The value loaded into the accumulator could be specified in no less than eight ways.
Strong Performance
The 6502 brought not only simplicity but also good performance when compared to a contemporary competitor such as the Z80.
Pipelining
How did it achieve this performance? One reason was the use of a simple pipelining technique. The 6502 could carry out one instruction whilst at the same time fetching the next instruction from memory.
Clock Speeds
This performance was also achieved with lower clock speeds than the competition.
The 6502 ran at only 1 MegaHertz (one million clock ticks per second) and the 6502A at 2MegaHertz, often half the clock speed of the competing Z80. But this was deceptive as the 6502 could do more per clock tick or ‘cycle’.
From ‘Retro Stack Exchange’:
The Z80's fastest memory fetch — the first half of an operation fetch — takes two cycles. That's always paired with another two cycles for refresh though, so the shortest instructions are four cycles long.
The 6502's memory cycles always last half a cycle. It does only one per cycle, leaving the bus unattended for the other half. But it always fetches at least two bytes per operation: it reads an operand regardless of whether the instruction needs one.
Memory Bandwidth
Another secret of the performance of the 6502 was the rate at which it could read or write data to and from memory - known as its memory bandwidth which was very competitive. For example, a fast 4MHz 6502 had similar bandwidth to the later, and supposedly a lot faster, 8MHz 16-bit Motorola 68000. There is more discussion on the 6502’s memory bandwidth here.
Illegal or Undocumented Opcodes
With so few instructions there were lots of opcodes (the one byte encoding of an instruction) that were unused. If the 6502 encountered one of these then its behaviour wasn’t guaranteed.
Some of these opcodes crashed the microprocessor. Others did interesting and useful things. Just occasionally developers would use these to get better performance.
Today we do have extensive documentation of what these opcodes do.
BCD Arithmetic
Being able to perform Binary Coded Decimal (BCD) arithmetic was an important feature of early microprocessors. BCD treated each byte as two decimal digits and arithmetic calculations would reflect this treatment.
The 6502 had an elegant way of implementing this. If set in BCD mode it would adjust all results to reflect BCD arithmetic.
Hidden Memory Access
From Wikipedia:
Because the chip only accessed memory during certain parts of the clock cycle, and those cycles were indicated by the PHI2-low clock-out pin, other chips in a system could access memory during those times when the 6502 was off the bus. This was sometimes known as "hidden access". This technique was widely used by computer systems; they would use memory capable of access at 2 MHz, and then run the CPU at 1 MHz. This guaranteed that the CPU and video hardware could interleave their accesses, with a total performance matching that of the memory device.
Onboard Clock Generator
The was made even more cost-effective by dispensing with the external clock generator needed in the 6800. From ‘Retro Stack Exchange’:
One improvement over the 6800 was that it includes an on-board clock generator. Thus all it needs is an external oscillator - which can be as simple as a RC-circuit - this saves quite some money. Motorola priced the 6870 in 1976 at 20-30 USD, depending on volume. That the 6502 cost less than that for the CPU including clock generator does make a point
Cheap Video Cookbook
Don Lancaster’s ‘the Cheap Video cookbook’ showed how the 6502 could be used, with some very simple and cheap external circuity, to generate a signal to drive a television display.
Revolution
KIM-1
The first commercial machine made with the 6502 was created by Chuck Peddle. KIM-1 (for ‘Keyboard Input Monitor’) was a simple single-board computer which sold for only $245.
Commodore PET
Peddle’s vision wasn't limited to a simple single-board machine for hobbyists. He wanted to create a machine with wider use. So he used the 6502 in the Commodore PET, an all-in-one computer with keyboard, tape deck for storage and monitor built-in.
Apple I
The Apple I almost used a 6800. In fact the Apple 1’s circuit board could be rewired to use a 6800. But Steve Wozniak saw that a $25 would make the machine much more affordable and so the 6502 became Apple’s microprocessor of choice.
Woz’s Apple 1 Monitor
Wozniak squeezed the code that ran when the Apple I started up (its ‘monitor’) into only 256 bytes of Read Only Memory, helped by the concise nature of 6502 code.
The complete code for the monitor can be read here.
Apple II
Following the initial success of the Apple 1, it was natural that Wozniak and Jobs would choose the 6502 for their next machine.
The importance of the Apple II is hard to overstate. It made Apple successful enough that it could afford to invest in the creation of the Macintosh, which much later would lead to the iPod, iPhone and the iPad.
The Apple II also became the platform of choice for innovative and entrepreneurial software developers. VisiCalc, the first spreadsheet, was created for the Apple II.
Several games had their origins on the Apple II including Prince of Persia, launched in 1989.
SWEET-16
Woz wasn’t an unqualified fan of the 6502 instruction set though. He found it a little limiting and laborious to write for. So he created his own ‘SWEET-16’ 16-bit instruction set built up from simpler 6502 instructions, for use in Integer Basic on the Apple II.
VIC 20
When Commodore wanted a successor to the PET but with colour graphics and sound they created the VIC-20.
The VIC-20 would become the first computer of any kind to sell one million units.
Atari 400 / 800
Atari wanted to enter the home computer market in 1979 and naturally, they chose the 6502 as the microprocessor. The Atari 400 and 800 had impressive colour and sound capabilities.
Over two million units of the 400 and 800 and their successors were sold over the next thirteen years.
BBC Micro
When the British Broadcasting Corporation wanted a home computer to support a planned computer literacy programme, they talked to several British Computer makers, including Clive Sinclair. The only firm that met their requirements was Cambridge-based Acorn Computers with a new design, originally known as the Acorn Proton.
What became the BBC Micro was based around a fast 2MHz 6502. Over 1.5 million BBC Micros were sold over its lifetime.
BBC Basic
The BASIC programming language that came with the BBC Micro (known as BBC Basic) was a fantastic example of what could be achieved with the 6502 in the hands of an exceptional programmer.
Written by Sophie Wilson, BBC Basic was famous for being faster and having more features than competing Basics of the era.
Oric-1
This was a lesser-known British home computer that used the 6502. Developed by Tangerine Computer Systems it sold over 200,000 systems in 1983 and was the best-selling home computer in France that year.
Commodore 64
If the BBC Micro was a hit in the UK then the Commodore 64 was a worldwide hit which went on to sell over 12 million units.
The successor to the VIC-20 it boasted 64k RAM and used the 6510 processor, a version of the 6502 with added input and output capabilities.
Commodore 1540 / 1541
The 6502 was inexpensive enough that it could be used in peripherals such as the Commodore 1540 / 1541 floppy disk drives used with the VIC 20 and the Commodore 64 respectively.
Atari 2600
The Atari 2600 helped to popularise the home games console. Using a 6507, a version of the 6502 in a cheaper 28 pin package, it went on to sell over 30 million units.
Nintendo NES
If the Atari 2600 popularised video game consoles in the home then the Nintendo Entertainment System games console carried the idea forward. It used the Ricoh 2A03 which was a version of the 6502 without BCD arithmetic.
The NES went on to sell over 61 million consoles and gave birth to many famous video game series including ….
Super Mario
It’s impossible to mention the NES without mentioning an Italian Plumber who made his debut in a console game in Super Mario Bros. on the NES.
Atari Lynx
The Atari Lynx provided 6502-based portable gaming. It used the 65SC02 a low-power CMOS variant of the 6502 with some added instructions.
Tamagochi
For even more portability than the Atari Lynx, there is the Tamagotchi which, in some variants, is powered by the 6502 as demonstrated by dedicated Tamagotchi reverse engineers.
Chess Computers
The 6502 powered several dedicated chess computers in the 1980s including the Mephisto Rebell.
6502 Clones
The 6502 might have been designed in the US but it soon travelled around the world. There were clones in many countries including in Japan, Russia and India.
6502 In Space
There are unconfirmed rumours that there were 6502s in the Space Shuttle. More verifiable though is that they did make it into PICOSAT satellites.
The satellite computer is a 6502 system (Rockwell Science Center, Thousand Oaks, CA) with a simple operating system for data collection , system management and the network protocol.
The End
One Hit Wonder
Like all the most legendary groups the 6502 team gave us one hit and then broke up.
There was no disappointing second album!
Western Design Centre
Bill Mensch has continued to give us 6502 variants through his ‘solo’ career at his Western Design Centre (WDC) in Arizona. The WDC continues to develop and sell 6502 variants today.
Still In Production
Largely thanks to the Western Design Centre, almost fifty years after the 6502 was launched, variants of the 6502 are still being made today.
WDC 65C816
Amongst the most advanced variants of the 6502 was the WDC 65C816. From Wikipedia its features include:
In addition to the availability of 16-bit registers, the W65C816S features extended memory addressing to 24 bits, supporting up to 16 megabytes of random-access memory, an enhanced instruction set, and a 16 bit stack pointer, as well as several new electrical signals for improved system hardware management.
Apple IIGS
The 65C816 enabled enhanced versions of older machines to be developed. These included the Apple IIGS (‘GS’ for graphics and sound):
The microcomputer is a radical departure from any previous Apple II, with a 16-bit 65C816 microprocessor, direct access to megabytes of random-access memory (RAM), and bundled mouse. It is the first computer from Apple with a color graphical user interface (color was introduced on the Macintosh II six months later) and Apple Desktop Bus interface for keyboards, mice, and other input devices.
Super Nintendo Entertainment System
The 65C816 didn't just extend the lifespans of home computers, it also helped to support the next generation of game consoles.
The Super Nintendo Entertainment System (SNES) used a Ricoh 5A22, based on the 65C816, and became the best-selling console of its day with over 49 million units sold.
The SNES was the platform that gave rise to such hit games as ‘Super Mario World’ and ‘The Legend of Zelda : A Link To The Past’.
Arm
Steve Furber and Sophie Wilson of Acorn Computers were both fans of the 6502. So when they came to design their own microprocessor they took some of the ideas from the 6502 - especially its simplicity, economy and high memory bandwidth and applied them in the creation of the ARM 1.
Today, over 200 billion units of the Arm and its successors have been made.
Bendable 6502
People are still using the 6502 to innovate. From 2021:
PragmatIC Semiconductor has announced the production of a 6502-compatible processor built on a flexible plastic substrate, rather than a brittle slice of silicon.
The press release referenced here even has a quote from Bill Mensch.
Bender
In the cartoon Futurama:
In the episode, “Fry and the Slurm Factory,” a character named Professor Farnsworth points his F-ray at the head of the show’s famously ill-tempered robot, Bender. It reveals a little rectangle, apparently a chip, labelled “6502.”
Terminator
In the first Terminator movie, when we see the world from the perspective of the Terminator, played by Arnold Schwarzenegger, using his ‘Head Up Display’ then we see 6502 code taken from the Apple II.
Ben Eater
The 6502 was chosen by the awesome Ben Eater for his series showing how to use a microprocessor in practice.
Reverse Engineering
The original designs of the 6502 are long lost. But all we need is some sulphuric acid, a powerful microscope and lots of patience and we can reconstruct it.
Visual 6502
Want to see inside a working 6502? Well we can with the Visual 6502. Based on data from the reverse engineered 6502 it shows the layers of the integrated circuit and how the electrical signals on the chip switch on and off.
Even better there is an enhanced ‘Visual 6502 Remix’ here.
Emulation
The 6502 must be the most popular target for emulation. The small instruction set and its usefulness in emulating actual machines makes it an great project.
There are 6502 emulators that run on the on your computer, on your phone or on the web. Here is a small list of over 25 6502 emulators. There are lots more!
FPGA 6502s
If you want a 6502 working in hardware rather than emulation, for greater accuracy, then it’s possible to use a ‘Field Programmable Gate Array’ or FPGA to recreate it.
MOnSter 6502
And the 6502 is simple enough to implement using individual transistors. That’s what the ‘MOnSter 6502’ does.
That Means a Lot
Computing For All
The last reason may be the most important. The 6502 helped to lower the cost of computing and so gave millions access to a computer for the first time.
So whether you started your computing on an Apple II, a PET, a VIC-20, Atari-800, or Commodore 64, thanks Chuck, Bill and colleagues.
And most of all thank you 6502.
Photo credits.
6502 Photo
CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=91538
Navigating the memory address bug must have been hellish. Did every amateur user have to discover the big and find a solution, or was the chip basically functional and only failed in certain instances? How would you even come across the solution, clubs, hobby periodicals?