The 6502 CPU Powered a Whole Generation!
Summary
TLDRThis episode delves into the revolutionary 6502 microprocessor, a cornerstone of 1980s technology that powered iconic home computers, game consoles, and even arcade machines. Originating from MOS Technology, the 6502's affordability and versatility made it ubiquitous, from the Commodore PET to the Nintendo Entertainment System. We explore its standard and variant forms, its influence extending into toys, medical devices, and even space technology. Highlights include a technical breakdown of its operation, comparisons with contemporary CPUs, and its enduring legacy in modern computing. The video culminates with insights from Bill Mensch, a key figure behind the 6502, revealing its ongoing relevance in various sectors.
Takeaways
- đŸ The 6502 microprocessor, created by MOS Technology, powered many 1980s computers, arcade machines, and game consoles, making it a pivotal component in the era's technology.
- đčïž Iconic devices like the Commodore PET, VIC-20, Apple II, and Atari 400/800 utilized the standard 6502, showcasing its widespread adoption and versatility.
- đź Beyond computers, the 6502 found its way into game consoles such as the Atari 2600 and Nintendo's NES, underlining its ubiquity in entertainment technology.
- đ Variants of the 6502, designed with modifications for cost reduction or feature addition, powered computers like the Commodore 64 and Apple IIgs, as well as in toys and medical devices.
- đ Despite its 8-bit architecture, the 6502's efficient design allowed it to compete effectively with higher clocked CPUs, demonstrating that MHz isn't the sole factor in computing performance.
- đČ The 6502's simplicity facilitated a direct communication path with other chips via the data bus and chip select lines, making it an efficient and straightforward processor for its time.
- âïž Unique for its time, the 6502 could perform operations on both the rising and falling edges of the clock pulse, doubling its work rate per cycle compared to many contemporaries.
- đ ïž The advent of the 65c816, a 16-bit successor to the 6502, introduced extended capabilities like a larger address bus and 16-bit internal math, expanding the potential for more complex computing tasks.
- đ The 6502's legacy extends into modern applications, with variants still in production for hobbyist markets and embedded systems, proving its enduring influence on computing.
- đšâđŹ A discussion with Bill Mensch, a co-creator of the 6502, revealed the processor's ongoing relevance, including its role in life-support systems and the decision-making behind not pursuing a 32-bit variant.
Q & A
What was the 6502 microprocessor used in during the 1980s?
-The 6502 microprocessor was used in a variety of devices during the 1980s, including affordable home computers, arcade machines, video game consoles, and even some toys and medical devices like pacemakers.
How did the 6502 microprocessor impact the home computer market in the 1980s?
-The 6502 microprocessor played a significant role in the home computer market by making computers more affordable and accessible. It powered popular home computers such as the Commodore PET, VIC-20, Apple II, and Atari 400 and 800.
What is a variant of the 6502 microprocessor, and how does it differ from the standard 6502?
-A variant of the 6502 microprocessor is a version that may have added extra features or removed certain features to make the chip smaller or cheaper. While these variants run the same machine code as the original 6502, they may not be pin-compatible, meaning they cannot be directly swapped between different systems.
How did the 6502 microprocessor enable the gaming industry in the 1980s?
-The 6502 microprocessor was widely used in arcade machines and video game consoles, including the Atari 2600, 5200, 7800, and the Lynx handheld, as well as the Nintendo NES and SNES. Its ubiquity and affordability contributed to the rapid growth of the gaming industry during this period.
What are some unique applications of the 6502 microprocessor outside of computers and gaming?
-The 6502 microprocessor has been used in a variety of non-traditional applications, including toys like Furbies and Tamagotchis, implanted medical devices such as pacemakers, and even satellites orbiting the planet.
What made the 6502 microprocessor so popular and successful during its time?
-The 6502 microprocessor was popular due to its affordability, versatility, and the fact that it was used in many successful home computers and gaming consoles of the era. Its simple design and wide compatibility with various systems also contributed to its success.
How does the 6502 microprocessor communicate with other chips on a motherboard?
-The 6502 microprocessor communicates with other chips through a data bus, a read/write line, and a chip select (CS) or enable line. The data bus allows for 8-bit communication, while the read/write line determines the direction of data flow. The CS line allows the CPU to selectively communicate with different chips on the bus.
What is the significance of the 6502's 8-bit data bus and 16-bit address bus?
-The 8-bit data bus of the 6502 allows for data transfer in 8-bit chunks, while the 16-bit address bus enables the CPU to address up to 64 kilobytes of memory. This combination of data and address bus widths was a key factor in the 6502's success and its ability to support a wide range of applications.
How did the 6502 microprocessor's performance compare to other CPUs of the era, such as the Z80?
-Despite having a lower clock speed, the 6502 was able to compete well with other CPUs like the Z80 due to its efficient use of clock cycles and its ability to perform work on both the rising and falling edges of the clock pulse, effectively doing twice as much work per cycle.
What is the difference between the 6502 and its 16-bit variant, the 65816?
-The 65816, also known as the 65c816, is an extension of the 6502 that operates in 16-bit mode, allowing for larger data operations and a larger addressable memory space of up to 16 MB. It also includes additional instructions and features that improve performance and functionality.
Why did the 6502 architecture not persist much beyond the 16-bit era?
-The 6502 architecture did not persist much beyond the 16-bit era primarily due to the industry shift towards MS-DOS compatible systems and the rise of more advanced 32-bit architectures like ARM, which offered greater performance and capabilities for evolving software and hardware needs.
What are some modern applications and customers for the 6502 microprocessor?
-Today, the 6502 microprocessor is still used in niche markets such as the hobbyist and retro computing communities, as well as in life-support systems, where its reliability and simplicity make it a critical component in devices like pacemakers.
Outlines
đș Introduction to the 6502 Microprocessor
The video begins with an introduction to the 6502 microprocessor, highlighting its widespread use in various devices during the 1980s, including home computers, arcade machines, and video game consoles. The narrator expresses intent to discuss the 6502's role in these systems and its variants, as well as an interview with Bill Mensch, one of the creators of the 6502. The 1980s technological landscape is briefly painted, emphasizing the era's reliance on the 6502 processor.
đĄ How the 6502 Processor Works
This paragraph delves into the technical aspects of the 6502 processor, explaining how it communicates with other chips via an 8-bit data bus and a read/write line. The concept of Chip Select (CS) and the address bus are introduced, illustrating how multiple chips can communicate over the same data bus without interference. The explanation extends to the binary addressing system and why memory modules increase in size by doubling in capacity. The 6502's efficiency and performance are compared to other CPUs of the era, such as the Z80, highlighting the 6502's ability to perform more work per clock cycle and complete instructions faster.
đź The 6502 in Gaming Consoles and Computers
The narrative shifts to focus on the 6502's application in gaming consoles and home computers, detailing the specific clock speeds at which various systems like the Atari 2600, Apple III, BBC Micro, and Super Nintendo operated. The discussion includes the challenges of attributing game performance to the CPU versus other system components, such as graphics co-processors. The Apple IIgs is presented as an example of a system primarily reliant on the CPU for its operations, and the impact of overclocking the 6502 is demonstrated through the gaming example of Wolfenstein 3D.
đą Mathematical Operations on the 6502
The paragraph explores how the 6502 handles mathematical operations, particularly with 8-bit numbers. It explains the process of adding 16-bit numbers by carrying out multiple instructions and the absence of direct multiply and divide instructions in the 6502's repertoire. The alternative methods for multiplication and division, including bit shifting and lookup tables, are discussed, along with a personal anecdote from the narrator about the efficiency of these methods over built-in multiply and divide commands on other processors.
đ ïž Variants of the 6502 Processor
This section provides an overview of various 6502 processor variants, including the 6507 used in the Atari 2600, the 6502C (Sally chip), and the 6510 found in the Commodore 64. The differences in pin arrangements and functionalities, such as memory banking and the addition of general-purpose I/O pins, are highlighted. The Western Design Center 65c02, the only variant still in production, is introduced, along with its new opcodes and compatibility with older code. The challenges and potential of using the 65c02 in older systems are discussed, with a practical demonstration of its integration into a Commodore VIC-20.
đ The 65c816: A 16-bit Evolution of the 6502
The evolution of the 6502 into the 65c816, a 16-bit processor, is detailed. Despite having an 8-bit data bus, the 65c816 is capable of 16-bit math internally and has a larger address bus, allowing for up to 16 MB of RAM. The transition from 8-bit to 16-bit mode is explained, along with the pin differences and the need for an adapter board for installation in older systems. The 65c816's compatibility with the 65c02 opcodes and its use in the Apple IIgs and Super Nintendo are highlighted. The section concludes with a discussion on the 6502's longevity and modern applications, including its role in life-support systems.
đŁïž Conversation with Bill Mensch, Co-Creator of the 6502
The video concludes with an interview segment featuring Bill Mensch, one of the original creators of the 6502 and the 65c816 processors. Bill shares insights into the current market for the 6502, including its popularity in the hobbyist community and its critical role in life-support systems. He also discusses the transition in processor architecture beyond the 16-bit era, mentioning his recommendation of ARM architecture to licensees. The conversation provides a personal perspective on the legacy and ongoing relevance of the 6502 processor.
Mindmap
Keywords
đĄ6502 microprocessor
đĄvariants
đĄdata bus
đĄread/write line
đĄChip Select (CS) line
đĄaddress bus
đĄclock speed
đĄbinary addressing
đĄmath operations
đĄ65c02
đĄ65c816
Highlights
The 6502 microprocessor was a key component in many home computers, arcade machines, and video game consoles from the 1980s.
The 6502 was created by MOS Technology and was known for its affordability and efficiency.
The standard 6502 was used in iconic computers such as the Commodore PET, VIC-20, Apple II, and Atari 400 and 800.
A dozen or so variants of the 6502 existed, some with added or removed features, but not all were pin-compatible.
The 6502's ubiquity extended to dozens of arcade games, including classics like Asteroids and Centipede.
The 6502's influence can be found in unexpected places, such as toys, pacemakers, and even satellites.
The 6502 was introduced in 1975, a time of significant technological advancements and societal changes.
The 6502's low cost of $25 per unit at launch made it accessible for a wide range of applications.
The 6502's 8-bit data bus allowed for efficient communication between the CPU and other chips.
The 6502's clock pulse efficiency allowed it to perform more work per cycle compared to other CPUs of the era.
The 6502 required fewer clock cycles on average to complete an instruction, contributing to its performance.
The 6502's lack of built-in multiply and divide instructions led to innovative methods for these operations, such as bit shifting and lookup tables.
The 65c02 variant added new opcodes, enhancing the programming experience and execution speed.
The 65c816, a 16-bit variant of the 6502, was capable of addressing up to 16 MB of RAM and offered significant performance improvements.
The 6502's legacy continues in the modern day, with applications in hobbyist computing and life-support systems.
The 6502's simplicity and efficiency made it a favorite among programmers and a driving force in the personal computing revolution.
Transcripts
I have made countless videos about old computers from the 1980s, but in this episode we're going Â
to have a look at the processor that powered them all, or at least most of them. And then Â
at the end of the video we're going to have a quick chat with Bill Mensch, one of the Â
original creators of the 6502 microprocessor The 1980s brought us affordable home computers Â
for the first time ever, arcade machines, and of course video game Â
consoles. There was one microprocessor that seemed to be ubiquitous. One processor that Â
seemingly powered an entire generation. And that processor was the 6502 by MOS Technology.Â
I want to start with the standard 6502. There were at least a dozen variants of it that were Â
more or less compatible, but might not be pin-compatible, and we'll come back Â
to those later. So, let's start by having a look at some of the computers that used the official, Â
standard 6502. These would be the Commodore PET, and the VIC-20 The original Apple II and II+. Also Â
the Atari 400 and 800 home computers, the Oric Atmos, most of the Acorn computers like the Atom Â
and Electron series, and of course the BBC micro. There were also dozens of arcade machines that Â
used the 6502, more than I want to cover here. But if you've ever played Asteroids, Centipede, Â
Missile Command, Tempest, crystal castles, or ever really stepped into an arcade of any sort, Â
you've probably played some machines that ran on the 6502.Â
All of these systems used a standard 6502 processor. And what I mean by that is, Â
you can take the CPU out of say a VIC-20, stick it in a very different kind of computer, Â
such as an Apple II, and it will just work. You can even pull the 6502 out of a Commdore Â
disk drive and stick it in an Atari 400, and it would work just fine. It's strange today to think Â
of all of these different incompatible computers running the same exact chip.Â
However, the scope of the 6502 reaches far beyond these. When you start looking Â
at the variants, the list becomes huge. So, what is a variant exactly? Well, these Â
are other versions of the 6502 that have either added some extra features, or in some cases even Â
removed features in order to make the chip either smaller or cheaper. They all run the same machine Â
code as the original, but they aren't necessarily pin compatible, meaning you can't pull one out Â
of one type of machine and then stick it in a different kind of machine and expect it to work.Â
Computers that used variants would be the Commodore 64 and 128, and the Plus/4. Also Â
Apple used variants in the Apple III and IIgs. Atari used them in the XL and XE series of home Â
computers, and even inside their disk drives. Another popular use of the 6502 was of course, Â
in game consoles. This would include the Atari 2600, 5200, 7800, and the Lynx handheld. More Â
importantly Nintendo used a variant in the NES, as well as the Super Nintendo, and the TurboGrafx 16.Â
But what might surprise you would be some of the not so obvious places you can find 6502 Â
processors. Ever played with a Furby, yeah, those run on a 6502. How about a Tamagotchi, surprise, Â
those run on a 6502. In fact, there are countless toys that have a 6502 core, but they are really Â
hard to catalog for you because they are usually embedded into an epoxy blob these days, making it Â
really hard to tell just by opening up a toy. Here's one that may surprise you. If you have Â
a pacemaker or any sort of implanted technology in your body, it is very likely running a 6502 Â
inside. There are even 6502 processors orbiting the planet inside satellites, Â
and I believe they were used in few minor systems on the space shuttle and international Â
space station, although I don't know if there are still any in use there today.Â
And apparently the terminators of the future also run on 6502 as the computer code seen on Â
screen is 6502 assembly instructions, and if Futurama is to be believed, Â
then a thousand years from now, robots like Bender will be operating on 6502 processors.Â
The point is, unless you have been living under a rock your whole life, everyone on the planet Â
has at some point interacted with this processor. But, let's go back in time to the beginning. Back Â
to 1975. Many notable things were happening. Gerald Ford was President of the USA. Disco Â
music was at its peak. The Rubiks cube went on sale. The movie Jaws just came out. And, Â
the Vietnam war was coming to an end. Oh, and The 8-Bit Guy was born, that's me.Â
But in the world of technolgy, there were also many exciting things happening that Â
year. Video Cassette Recorders for home users entered the market. The Altrair home computer Â
kit was introduced. A little software company called Microsoft was started. And of course, Â
more importantly for the purposes of this video, the 6502 Microprocessor went on sale.Â
For the first year, it was being sold for $25 a unit, which was crazy cheap compared to its Â
nearest competitor, the Motorola 6800, which sold for $175 a unit. At this time it was mostly Â
being used in hobby and enginering projects like the KIM-1 computer, and later in Steve Â
Wozniak's little computer, the Apple 1. But, let's skip forward to 1977, a year Â
mostly remembered for the debut of the Star Wars franchise, was also the year the 6502 really took Â
off. Computers like the Apple II and Commodore PET entered the market. Two of the big-3 home Â
computers of that year used the 6502. But the real volume would come, not from a home computer, Â
but from the Atari 2600 video game console. Atari would sell nearly 400,000 units of the Â
2600 in 1977 alone, and eventually over 30Â million of them over the life of the product.Â
Needless to say, this was just the tip of the iceberg. but now let's have a look at some of the Â
features of this chip, and see how it worked. I want to start by talking about how the CPUÂ Â
communicates with other chips. 8 of the pins on the CPU represent the data bus. Each of these Â
can be either on or off, which represent a 1 or zero. Hence, this is an an 8-bit data bus. So, Â
for illustration we'll connect this to the data bus of a RAM chip. This way the CPU and Â
the RAM chip can send and receive 8-bit numbers. But there's another important line that the CPUÂ Â
controls. This is the read/write line. If the line is on, its means to read and thus Â
the data is expected to travel this direction. If the line is off, then it means write, and Â
the data will travel in this direction instead. And so this line also has to connect to the RAMÂ Â
chip so both the CPU and the RAM chip understand the direction data is flowing at any given time. Â
OK, hopefully all of this makes sense so far. Of course, most any motherboard is going to be far Â
more complicated than this, because there will be a lot more chips like I/O chips, video chips, Â
etc. And they all connect to the same data bus. So the question is, how do they all talk over Â
the same data bus at the same time without signals colliding with each other? Well, Â
they don't. They are all allowed to listen to the bus, but only allowed to talk on the Â
bus when the CPU wants to talk to them. So how does that work? Well, each chip on the bus has Â
a CS line. It stands for Chip Select. Sometimes it may be called an Enable line. Either way, Â
it does the same thing. When this line is activated, that means the chip is allowed Â
to talk on the bus. That chip could be a RAMÂ chip, ROM chip, I/O chip, video chip, whatever.Â
So the next question is, what determines when that chip is activated? OK, we have the data bus, Â
and the read/write line. But we also have something called the address bus, Â
which on the 6502 is 16 bits. So, while the data bus can communicate in numbers between 0 and 255, Â
the address bus can represent numbers between 0Â and 65,535, or another way of saying that is 64Â Â
Kilobytes. The size of the address bus determins the maximum memory of the computer, not counting Â
banking schemes, which we can get into later. Have you ever wondered why memory modules, Â
when they increase to the next size, are always double the previous size? They increase in powers Â
of two. Well, the reason for that has to do with binary addressing. So, imagine you have a RAM chip Â
that is 16 megabytes in size. It would need 24 address lines to be able to access all of that Â
RAM. And that means a minimum address of zero, or a maximum address of, well, a bunch of ones. So, Â
if you wanted to make the chip bigger, there's no way to really add fractional amounts of RAM. Â
You would have to add an additional address line. In doing so, you've also added another Â
number to your binary number, which will always result in multiplying the max value by two.Â
So, back to our CPU address bus. The way this works is it goes into a bunch of decoding logic, Â
which I'm not going to get into here, but that logic will take the address and Â
determine which of the chips will be selected, whether it is RAM, ROM, or a video chip, etc.Â
Now, much of what I've shown here could be applied to most any CPU. But now I want to tell you a few Â
things that sets the 6502 apart. So, let's compare with the Z80 , another popular CPU of the era. It Â
was quite common for 6502 systems to run at 1 Mhz, and Z80 systems to run at 4 mhz. Now, Â
you might be tempted to think the Z80 would be 4 times faster. But it's not. Why is that?Â
Well, for one thing let's look at the clock pulse. Imagine this is your 1 mhz clock pulse. Most CPUs Â
would only be doing work at the top of the clock pulse like this. However, the 6502 also does work Â
on the bottom of the clock pulse like this, essentially doing twice as much work per clock Â
cycle than a typical CPU. But that isn't the only thing that makes a difference. Most instructions Â
require more than one clock pulse to complete and the 6502 requires fewer cycles on average than Â
other CPUs of the era to complete an instruction. The Z80 was especially inefficient because, Â
despite being an 8-bit CPU, it's ALU, or "Arithmetic Logic Unit" is only 4 bit, Â
and thus most calculations require extra clock cyclces to complete any 8-bit math.Â
So, let's compare 4 common CPUs from the 1980s at their most common clock frequencies. If you Â
look at raw performance, the 6502 actually competes well against the other CPUs even Â
at its much lower clock speed of 1 Mhz. The moment you double it to even 2 Mhz, Â
it suddenly outperforms just about everything except the 68000. Most systems ran at 1 Mhz, Â
but there were some that ran just a bit faster. Atari 2600 ran at 1.19 MhzÂ
Basically all subsequent Atari computers and game consoles ran at 1.79 Mhz.Â
interestingly enough, the original Nintendo also ran at 1.79 MhzÂ
Apple III ran even faster at 1.8 Mhz The BBC Micro ran at 2.0 MhzÂ
as did the Commodore 128, but only in 80 columns mode.Â
The Apple IIgs ran at 2.8 Mhz The Super Nintendo 3.58 MhzÂ
And the fastest machines from the time period that I know of are the Apple IIc Plus and some Â
clones like Laser 128 ex2, which ran at 4 Mhz. I know 4 Mhz doesn't sound like a lot, Â
but that was some serious speed. unfortunaetly, there was little to no software that really took Â
advantage of that. So the best examples we really have of what could be done at the Â
time would be to look at the Super Nintendo. The problem is, it's hard to say exactly what Â
aspects of these games you can really credit the CPU, versus some of the advanced graphics Â
co-processors that were also in the system. In fact, some of these games, like starfox, even used Â
a 3D coprocessor located in the cartridge itself. The Apple IIgs might be a better system to look Â
at since it had much less in terms of graphics acceleration, thus relying primarily on the CPU Â
for most of the work. of course, another problem is the Super Nintendo and Apple Â
IIgs are technically running 65816 CPUs, which is the 16-bit version of the 6502, Â
which we're going to come back to here in a little bit. That being said, one interesting comparison Â
is Wolfenstein 3D. This is the SNES version. And while there is some amount of graphics Â
acceleration on the SNES, the CPU is really doing the heavy lifting of rendering this game.Â
Now let's look at the Apple IIgs version. It uses the exact same processor, but lacks most of the Â
accelerated graphics features. That's why the game is scaled down to the center of the screen, Â
even though technically the level of detail is exactly the same as the SNES version. And Â
you may notice it runs a little slower, which makes sense because the CPU in the Apple IIgs Â
is slower. But now check this out. This is the same version but here the Apple IIgs has an 8 Mhz Â
accellerator in it. So, same type of processor, just running almost 3 times faster. In fact, Â
with this CPU you can expand the rest of the screen out and it still plays relatively decently.Â
Modern versions of the 6502, made by WDC are actually rated to run at 14 Mhz, Â
and I've heard of people overclocking them to run even faster. The commander X16 runs at 8 Mhz, and Â
thus might be a good example of what can be done. Planet X16, which is a real-time-strategy game IÂ Â
wrote for the Commander X16, is a somewhat interesting example. Believe it or not, Â
it runs just about perfectly, even if I jumper the computer down to 4 Mhz. And that's why we're also Â
working on a port for the Super Nintendo which is close enough to that speed. I hope to show Â
you more of this in a later episode, but I think it will be a very interesting game for the SNES.Â
A better example might be the KG3D demo on the Commander X16, running a bog standard Â
8-bit 6502 at 8 mhz. As you can see, this 3D environment runs very smoothly at 8 Mhz. Now, Â
for those that grew up with IBM PCs, imagine trying to run something like this on a turbo-XT Â
at 8 mhz. It's just not going to happen. And so, I hope this better illustrates that CPU Â
megahertz isn't a good method for comparing speed between different types of CPUs.Â
Let's switch gears for a moment and talk about some technical details, specifically math. So, Â
a lot of people might ask the question, "if the processor can only deal with 8 bit numbers as in Â
numbers from 0 to 255 how can it possibly do math operations on numbers larger than that?"Â
Imagine you have two 16-bit numbers you need to add together. Well, it can't do it all at once. Â
So, as a programmer you'll need to add the least significant bytes together and get the result. But Â
adding these two values exceeds 255, so that will set the carry bit. So the next addition you do, Â
over here will take that into account and there you go, you'll get your 16 bit result.Â
So really, the only downside to working with larger numbers on the 8bit CPU is that it Â
does require more instructions, which makes the code longer and more cycle counts than Â
performing the same operation on, say a 16bit CPU. Well, one thing you may find particularly Â
interesting is the 6502 actually has no instructions for multiply or divide. But, Â
I'm sure you've guessed, there is a way to accomplish that. Actually, more than one way.Â
The easiest way to multiply is with bit shifting. There is an instruction to shift all of the Â
bits to the left or right. So, take this binary number, which is equal to 26 in decimal. If you Â
shift everything to the left by one bit, then you essentially multiplied the number by two. You can Â
do it again, and now you've multiplied by 4, and again and now you've multiplied by 8. Likewise, Â
you can shift a number to the right, and you can divide by 2, divide by 4, divide by 8, or here Â
even divide by 16. So, multiplying or dividing by powers of 2 is very easy to do, and very fast.Â
But let's take the original number and let's say you need to multiply it by a number that is not a Â
power of 2, such as the number 6. Well, you can accomplish that by shifting twice to the left, Â
that gets you multiply by 4. Then you take the original number and shift it just once Â
to the left, that multiplies by 2, and then you can add those together, and you have Â
your result. This method is also fairly fast. And of course, the last method is by simply Â
using a chart. You just store all of the results in RAM as part of your code. And then let's say Â
you need to multiply 5 times 9, you can just look up the answer in the table, and there you have it.Â
So, you might think these methods are overly complicated or slow. But, here's a little Â
interesting anecdote for you. When I started coding Planet X3 on the 8088 microprocessor, at Â
first I was really excited that I finally had use of built-in commands for multiply and divide. But, Â
one of the things I realized once I started trying to optimize the game for speed is that using bit Â
shifts or lookup tables was actually significantly faster than using the built-in multiply and divide Â
commands. So, I ended up actually stripping out all of those multiply and divide commands Â
and replacing them with the same techniques I had been using all along on the 6502. So, Â
it turns out um those multiply and divide commands really aren't all that useful after all.Â
Let's take a look at how the regular 6502 compares to some of the variants. The Atari 2600 used a Â
processor known as the 6507, which as you can see is a smaller package having fewer pins. I'd Â
like to draw your attention to the address bus. As you can see there are only zero through 12, Â
instead of 0 through 15. That reduces the addressable memory down to 8 kilobytes Â
instead of the usual 64. That is also why Atari 2600 cartridges are typically limited to 8 KB, Â
unless clever banking schemes are used. Now let's look at the 6502C, otherwise Â
called the Sally chip. This chip was used in Later Atari computers like the XL and XE series, Â
and game consoles like the 7800. It's basically the same as a regular 6502. These 4 pins over Â
here are re-arranged. The main reason for this is that they wanted to add the HALT signal so Â
that the CPU could temporarily be halted so that the video circuits could use DMA.Â
Now let's look at the 6510, which was used in the Commodore 64. As you can see, basically every pin Â
is in a different place. But the main difference is these P0 through P5. These are essentially Â
general purpose IO pins. In the Commodore 64 they are used for memory banking. This was essentially Â
a cost saving measure to add this into the CPUÂ as it eliminated extra circuits on the board.Â
OK, so I'm not going to cover every variant as that would take forever. You can see here Â
on Wikipedia a list of all of the variations of the CPU. But I just wanted to give you an Â
idea of the ways in which most of them differ. But, I do want to take a look at the Western Â
Design Center 65c02. This launched in 1983 and it's the only variant to my knowledge that is Â
still in production today. This CPU was used in the Apple IIe, and IIc, Laser 128, and the Atari Â
Lynx, among others. One of the big differences is the instruction set. This is the standard 6502 Â
instruction set. There are some undocumented opcodes, but we won't get into that. The Â
65c02 added these new opcodes. Most of these are designed to make life easier on the programmer, Â
as well as make execution a little faster. Older code will still run on this CPU, it just won't be Â
making use of any of these new instructions. In fact, I want to show you something a lot Â
of people don't know about. This is an ordinary Commodore VIC-20, and I'm going to remove it's Â
CPU. It's just a standard 6502, which is to be expected. And here we have a brand new 65c02 Â
from Western Design Center. And what I'm going to do is insert this into the VIC-20, and power Â
it on. And well, if you thought it was going to work, then I guess you'll be disappointed.Â
The reason it doesn't work has nothing to do with the new opcodes, but rather the pin arrangement. Â
If you compare the two processors, you'll see they are almost identical pin arrangements. In fact, Â
only these 3 pins are different. I'm not going to go into great detail on what these do. But, Â
let's see if we can make this work in the VIC-20. I'll start by bending Â
up two of those pins that were different. I'm just going to leave one disconnected, Â
and the other I'm going to use a resistor and tie it to 5V, pulling it high. I know, Â
it doesn't look terribly elegant. But let's stick it back into the VIC-20 now and see what happens.Â
Check it out, it works. At this point the VIC-20 now has additional instructions available to it if Â
you wanted to write code to support it. And even though this CPU can run at 14 mhz, it is obviously Â
only going to run at the clock speed the VIC-20 gives it, which is still 1 mhz. So there isn't a Â
huge advantage to using this. I run a number of games and didn't have any compatibility issues, Â
although I'm sure there's probably at least one or two out there that were using some undocumented Â
opcodes that might fail with this CPU inside. OK, now let's take a look at the 65c816. This Â
chip debuted in 1985, and it is a significant upgrade to the 6502. This chip is 16-bit, Â
sort of. You see, there's no standard way to define how many bits a CPU is. Some people Â
judge it based on how wide the data-bus is. In this case, the data-bus is still 8-bit, just like Â
the 6502. But internally, it can do 16-bit math. It also has a ton of other new features. In fact, Â
here are those opcodes we looked at earlier for the 65c02. Well, Â
the 816 supports all of these opcodes. In fact, when it boots up, it starts in 8-bit mode, Â
thus essentially operating exactly like the 65c02. There are a few small differencees, I'm sure some Â
of the keyboard warriors will want to point out. For example, Some 65C02s made by rockwell and WDC, Â
had these extra instructions here. I didn't show them earlier because not all varients supported Â
these, and they aren't used very often. But the 816 definitely doesn't support these and instead Â
adds all of these when operating in 16-bit mode. When performing 16-bit math, that means instead Â
of requing 6 or 7 instructions to handle problems like this one half at a time, Â
it can do the whole thing in a single instruction. This sort of thing can really Â
speed up execution for certain types of software. But, perhaps a more important aspect of the chip Â
is the larger address bus, let me show you how that works. The pin arrangement on the 816 is very Â
similar to the 6502, but it's a little bit more complicated to get to work in an older computer Â
because as you can see there are now 9 pins that are different from the original. but you may be Â
counting up the address lines and seeing that there are still only 0 through 15. So how can Â
it access more than 64K, you might ask? Well, when you put the chip into the correct mode, Â
the data-bus pins will pull double duty. So when the clock cycle is high, Â
they are data lines like usual. but when the clock is low, they are become address lines 16 Â
through 23. Thus giving it a 24-bit address, capable of addressing up to 16 MB of RAM, a Â
massive amount more than a typical 8-bit computer. So, can you install one of these into something Â
like a VIC-20? Well, sort of. You're going to need a ltitle adapter board like this one, Â
which are remarkably hard to find at the moment. But in theory you can pop this into your VIC-20 Â
or other 8-bit system and instantly have a 16-bit capable computer, except that Â
you won't have access to the extra RAM. Perhaps a better example, something I can Â
actually show, is the Commander X16. By default it comes with a 65c02, but it actually supports Â
the 816. I keep one around for testing and I have a big label on it so I don't get it Â
confused with my other CPUs. But yeah, the X16 runs just fine with the 816 installed, Â
and in theory if people wanted to write code that made use of the 16-bit aspect of it, they could.Â
I think the 816 was a really great processor, but it only ever saw widespread use in Â
the Apple IIgs and the Super Nintendo. So, the last thing I have for you guys is, Â
I finally man managed to sit down and have a conversation with Bill Mensch, Â
one of the original creators of the 6502 and the 816 processor, and I had a few questions for him.Â
So, Bill, tell me who are the current, modern-day customers of the 6502. OK, so we have a lot of Â
interest in your world, meaning the hobby world. And so we sell boards into that. and we sell chips Â
into that. And as you know, you and Ben Eater, Ben Eater has been especially active in that Â
world. And then we have some others, Stefany I think you know. But in any event. I find it hard Â
to believe that just the retro market keeps the whole 6502 business alive. There's got to be more Â
other modern customers. And the other thing that we still get royalties off of is life-support. so, Â
we keep millions of people alive one heartbeat at a time, with the 65c02. Really?Â
Why do you feel like the 6502 architecture didn't last much beyond the 16-bit era with like the Â
Apple IIgs and Super Nintendo? Is it just because everyone was going to MS-DOS compatibility, Â
or was there some other reason? Well, I specifically was recommending ARM. OK. So when Â
my licensees asked what I was doing at 32-bit, I said, "Well, I have some specifications for Â
32 bit. I'm happy to share them with you. But, I don't think that's what you want."Â
Well, if you've made it this far then you've probably learned more about the 6502 than you Â
probably ever wanted to know. But, hopefully at least you have a little bit of understanding of Â
the significant role that the CPU has played over the last 40 years and also why it is my Â
favorite CPU. But, that's all I have for now, so as always thanks for watching!
5.0 / 5 (0 votes)
Tilting, taking turns, and winning free games: the many tricks inside old pinball machines
I Canât Believe How Much I Paid For ThisâŠ
Breaking: Giant Sunspot AR3664 Could Unleash Catastrophic Solar Storms!
The Holosun Thermal/Red Dot Hybrid | A Revolutionary Optic?
I Was Never Meant to Have This Prototype CPU
The future of Virtual Reality with Hugo Barra