The 6502 Rotate Right Myth

preview_player
Показать описание
Many people think that the first revision of the famous 6502 microprocessor had a bug in its rotate right instruction. But is that really true?

The article about undocumented 6502 instructions:

Browse through the Rev A 6502 chip yourself:

The MOnSter 6502:

Catch up with me on Mastodon:

Or on Twitter:

Chapters:
00:00 The Myth
03:25 Shift vs. Rotate
04:09 Smashing a Rare Chip (and the Myth!)
06:59 Adding ROR
08:50 Conclusion: It's a Missing Feature!
Рекомендации по теме
Комментарии
Автор

Some folks are asking about the rotate *left* instruction - wouldn't that have the same problem? I forgot to mention it in the video, but the 6502's rotate left is a little weird. It just adds the number to itself, with the carry coming in and going out just like in a regular add (ADC) operation. A pipeline delay takes care of the rest.

TubeTimeUS
Автор

I'm going to have to use "it's not a bug... It's a missing feature." :) Good to see you on YouTube.

AppliedScience
Автор

Knowing that these first processors, already complex with thousand of transistors, were designed with big sheets by *hand* is mindblowing. Hat's off to those people.

Bob-
Автор

Good explanation - if it were an implementation bug, you'd find defective circuitry, not an absence of any. Nice to get conclusive details.

DavesGarage
Автор

This is what fascinates me about history. Stories come up that dominate the reality of what actually happened. We don't even have a clear idea of what happened 50 years ago let alone 2000 years ago.

wearwolf
Автор

Kudos for talking to one of the designers. And thankful that the original source was still available.

JimLeonard
Автор

0:51 The ubiquitous ARM microprocessor also worked the first time. Designed by a team of 4 at Acorn Risc Machines (ARM) of Cambridge UK in 1985, it took just 1 week from sketchpad to first working silicon. Really impressive.

BritishBeachcomber
Автор

In the MOS manuals that came with my KIM-1, it was documented as not being available until after June 1976. An errata sheet had initially said it would be available in production quantities by May 1976. That said, my KIM doesn't have it. Back then we relied on vendor documentation and as we had no internet, I never heard this rumor.

rdabneyutube
Автор

I'm 65 years old and just happy to see there are still "chip" nerds! Great video!

DonnyHooterHoot
Автор

I imagine the "confusion" is that the majority of the documentation for the 6502 shows the ROR instruction so unless you have the original then you'd think it didn't work. People are very bad at looking at notes on data sheets, and when those data sheets get used in manuals and articles its details like this that get omitted. If you've been told there is a bug in the early version people obviously didn't bother lo look for the correct data sheet to check it out.

IanSlothieRolfe
Автор

Coincidentally, many years ago I wrote a VHDL model of a microprocessor, and it actually did have a bug in the ROR instruction. It took a while to find it, because most of the code written that used the instruction didn't tickle it, but eventually I found what I thought was a bug in the program that turned out to be a bug in the microprocessor itself. I can see why the original designers didn't include it, as most of the code I've written for my own CPU rarely uses ROR in its original form. Instead, I typically force the carry bit clear in order to use the instruction as a right shift, since the instruction set didn't include shift instructions. In fact, I so rarely use ROR with the carry intact that I added a compile-time switch that effectively turns it into a logical shift right.

maurvir
Автор

3:33 No. Joke. I was just reading 6502 Assembly books yesterday. And I found one that had a nice graphic that explained the difference between shift and rotate. It was a big "ah ha" moment for me. It is just funny to me to have it explained well twice within two days!

bald_engineer
Автор

Nice mix of silicon archeology and myth busting!

mrthreeplates
Автор

WOW! That was really cool. I can't believe that I have been working with computers since 1982 and this is the first time I have seen what the circuits look like under a microscope. And I loved the circuit diagram explaining the physical circuit. Thanks so much!

schworak
Автор

Awesome deep dive. I would argue the original run of 6502s behave in an unexpected way when running the ROR instruction which is one of the definitions of a bug. (Even if the underlying reason is that the instruction isn't fully implemented in hardware.) I think this is the age old argument if a missing feature in a released product is a bug or just a "missing feature" and there are many arguments both ways. A thought experiment could be: if MOS has not marked ROR "as not working" on the original datasheet, would this problem then be considered a bug? (Supposedly ROR was listed on the original datasheet but it said it would not work until 1976) Either way, clearly it isn't a flaw in the silicon or design, and that was really cool to see.

adriansdigitalbasement
Автор

If it's true that there were no plans to implement ROR, then why is there a perfect spot in the opcode decodes for ROR, right alongside ASL, LSR, and ROL? It may not be a bug, but it's not a missing feature either. It would be a planned but unimplemented or cancelled feature.

_Bit
Автор

Really fun video. I recall the definition of "Bug" from my youth (the 1970s) - a bug is a feature you don't like. In this case, it's a missing feature. Thanks much for this video!

devcybiko
Автор

Great video! I remember Adrian Black talking about this ROR thing awhile back on his youtube channel, but he didn't really get into the story like you did. Always enjoy seeing one of your projects or on Curious Marc's channel lol

briangoldberg
Автор

When I was 17 I wrote down all the 6502 op codes. That way I found missing assembly instructions that I immediately tried, hanging my cpu quite a lot. Fun times!

CarlosPerezChavez
Автор

This was a very interesting video!

Interestingly, in modern Atari 2600 programming, using unimplemented instructions is actually sometimes used to save ROM space!

Icelink