6502 can be faster than 68k :-)

Programming the 6502 microprocessor and its relatives in assembly and other languages.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: 6502 can be faster than 68k :-)

Post by GARTHWILSON »

Aslak3 wrote:
First, shouldn't this be in he Hardware sub-forum? ;)
Many discussions will span more than one sub-forum's area, and/or will migrate. Speed has a lot to do with software, so I think it's ok.
Quote:
Secondly, isn't this like comparing a bus (yes one with wheels!) with a sports car? Both will get you where you want to go, but both have pros and cons. Saying something is "faster" tells you nearly nothing.
True, the sports car will get two people from L.A. to Vegas faster (I understand there's a whopping number of speeding tickets written each year for people going well over 100mph on that road), but if you have a lot of people to move, the sports car will have to make a lot of trips and end up taking a lot more time and fuel.
Quote:
Thirdly, and not trying to start a flame war here; this is a well intended question that I'd like to hear the answer for... I'm curious why the 6502 has endured but (say) the 6809 has not? I have only written code on the 6809 (except for a bit of Z80 back in the day), but I think I would really struggle without 16bit index registers and the (relatively sophisticated) addressing modes. Not to mention the 16bit (dual) stack pointers and relocatable direct page. For the programmer at least it seems clear which one is more pleasant to work with?
Not all applications have any use for those; but if you do need them, the 65816 is a better upgrade (even before counting the fact that its maximum bus speed is something like seven times as fast as that of the 6809), and yes, the '816 is easier to write code for if you're constantly needing the 16-bit quantities.
Quote:
I do use MOS peripheral ICs in my 8bit computer though, and consider them to be nice parts. Eg. the 6522 trounces the 6821 in every meaningful way.
Yes, it has more to offer. WDC's CMOS 65c22 also has much stronger output drivers than the old NMOS 6522's and true high-impedance inputs (not LSTTL imitators), and is of course much faster. I have a lot of applications for the '22 on my circuit potpourri page.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Aslak3
Posts: 258
Joined: 05 Aug 2013
Location: Southampton, UK
Contact:

Re: 6502 can be faster than 68k :-)

Post by Aslak3 »

BigEd wrote:
I think it's often imprinting - The first CPU you get to know well is the one you fixate on. Probably the C64 and the Beeb, the Apple II and the PET have a lot to do with it. Captured in our teens or 20's, we're still here in our ... middle years.

(And the Atari, the NES, ...)
I defiantly think that must be a part of it. I can't name a common computer that used the 6809, but I know loads that used the 6502, Z80.....
8 bit fun and games: https://www.aslak.net/
User avatar
barrym95838
Posts: 2056
Joined: 30 Jun 2013
Location: Sacramento, CA, USA

Re: 6502 can be faster than 68k :-)

Post by barrym95838 »

Aslak3 wrote:
... I'm curious why the 6502 has endured but (say) the 6809 has not? I have only written code on the 6809 (except for a bit of Z80 back in the day), but I think I would really struggle without 16bit index registers and the (relatively sophisticated) addressing modes. Not to mention the 16bit (dual) stack pointers and relocatable direct page. For the programmer at least it seems clear which one is more pleasant to work with? ...
I agree with BigEd about the imprinting. Also, I'm curious about what you mean by 'endured'. There are plenty of fans of both families right now, even though neither NMOS version is still being manufactured (to the best of my knowledge). As processor families, 65xx and 68xx have modern versions that are being used in embedded applications 30 years after the first offering, so I wouldn't call either family dead. Individual members of each family are born and then die off, but the families remain strong. A similar story goes for the 68K and Z-80 families, right?

Mike
User avatar
BigDumbDinosaur
Posts: 9426
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: 6502 can be faster than 68k :-)

Post by BigDumbDinosaur »

Aslak3 wrote:
...I think I would really struggle without 16bit index registers and the (relatively sophisticated) addressing modes. Not to mention the 16bit (dual) stack pointers and relocatable direct page.
An analogy to that would be a BASIC programmer would lament about having to not only declare every variable used in a C program (not to mention function prototypes) before actual use, but plan on how much storage that said variables might use, especially in the case of character strings. It all depends on how close to the bare metal you are used to working. As I professionally started with this stuff in 1970, an MPU with eight bit registers doesn't seem to me to be that much of a constriction. It's only in the last four years that I've devoted any significant attention to an 16 bit MPU.

You should consider the 65C816, as it essentially offers everything that was offered by the 6809, plus much higher speeds, much better interrupt performance and the familiarity of the 6502 instruction set. The one thing missing from your wishlist is dual stack pointers, which I mostly see as a liability, not an asset.
Quote:
For the programmer at least it seems clear which one is more pleasant to work with?
I've never found any Motorola MPU all that pleasant to work with, although they are nirvana compared to x86 silicon.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
Justin
Posts: 32
Joined: 20 Sep 2013

Re: 6502 can be faster than 68k :-)

Post by Justin »

Aslak3 wrote:
BigEd wrote:
I think it's often imprinting - The first CPU you get to know well is the one you fixate on. Probably the C64 and the Beeb, the Apple II and the PET have a lot to do with it. Captured in our teens or 20's, we're still here in our ... middle years.

(And the Atari, the NES, ...)
I defiantly think that must be a part of it. I can't name a common computer that used the 6809, but I know loads that used the 6502, Z80.....
Radio Shack Color Computer.
yzoer
Posts: 79
Joined: 11 Nov 2002
Location: Seattle

Re: 6502 can be faster than 68k :-)

Post by yzoer »

Perhaps somewhat of topic but somewhat relevant... Does anyone know of any applications that use WDC's products in any way, shape or form? The fact that they're still alive and kicking seems to indicate they're still actively producing them. Either that or they have a LOT of stock to get rid off. If anyone has recently bought one and can share the date-code, that'd be interesting...

Yvo
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: 6502 can be faster than 68k :-)

Post by GARTHWILSON »

yzoer, WDC's main business is licensing IP, not selling hardware. They apparently keep the hardware to help clients and prospective clients to experiment and see the possibilities and start development before having to spend a lot of money developing custom ICs that have the 65c02 at their heart. These clients however are producing such ICs at a rate of hundreds of millions per year though, with clock rates of over 200MHz in at least one case. You probably have some 65c02's you didn't know about, because they're hidden in your car (under the hood, in the dashboard, etc.), in common consumer electronics like cameras and microwave ovens, and they're in medical equipment.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
yzoer
Posts: 79
Joined: 11 Nov 2002
Location: Seattle

Re: 6502 can be faster than 68k :-)

Post by yzoer »

Ah, that makes sense then :-) Thanks for clearing that up. What's interesting though is that Mouser recently started selling them and had them in stock as a 'new' item.

Yvo
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: 6502 can be faster than 68k :-)

Post by GARTHWILSON »

...new for Mouser, in the sense that Mouser did not previously carry them. But yes, the chips are also new, not new old stock (NOS meaning never used but having collected dust for many years). I don't know how often WDC does another run of them (which they do with an outside foundry), but it's probably every couple of years if not more often. IOW, they're not ones left over from the 1990's!
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
datajerk
Posts: 18
Joined: 10 Sep 2012

Re: 6502 can be faster than 68k :-)

Post by datajerk »

Aslak3 wrote:
I'm curious why the 6502 has endured but (say) the 6809 has not?

...

In short, why has the 6502 lasted?
6502 family and its supporting infrastructure was cheap. That attracted Apple, Atari, and Commodore. And that made the 6502 popular. If Motorola, Intel, and Zilog had more competitive pricing at the right time, well then, history could have been different. MOS was aggressive on price, e.g. they made a cheaper 6502 (6507) for Atari.

History of why Woz picked the 6502: http://apple2history.org/history/ah02/
datajerk
Posts: 18
Joined: 10 Sep 2012

Re: 6502 can be faster than 68k :-)

Post by datajerk »

Justin wrote:
Aslak3 wrote:
BigEd wrote:
I think it's often imprinting - The first CPU you get to know well is the one you fixate on. Probably the C64 and the Beeb, the Apple II and the PET have a lot to do with it. Captured in our teens or 20's, we're still here in our ... middle years.

(And the Atari, the NES, ...)
I defiantly think that must be a part of it. I can't name a common computer that used the 6809, but I know loads that used the 6502, Z80.....
Radio Shack Color Computer.
And the Commodore SuperPET. Dunno how *common* that is.
User avatar
BigDumbDinosaur
Posts: 9426
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: 6502 can be faster than 68k :-)

Post by BigDumbDinosaur »

datajerk wrote:
MOS was aggressive on price, e.g. they made a cheaper 6502 (6507) for Atari.
Also, MOS had developed the ability to fix their masks when small defects were discovered. Being able to do so saved days and sometimes weeks of engineering activity that would have otherwise been required to issue a new mask, which had a significant effect on costs. It's important to understand the context...there were no computers back then that could directly assist in the design of a new device.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
Justin
Posts: 32
Joined: 20 Sep 2013

Re: 6502 can be faster than 68k :-)

Post by Justin »

The 6502 might be faster than the 68K at some things, but executing the Dhrystone benchmark is not one of them :-)

Looking at the table at http://www.netlib.org/performance/html/ ... .col0.html, the slowest 68K (Mac) got 0.4 MIPS from 7.8Mhz (0.051 MIPS/MHz). Apple and C-64 ranked dead last with 0.02 MIPS from 1Mhz (0.020 MIPS/Mhz).

Looking at the code for the benchmark, it is doing a lot of 16-bit math and pointer operations. On cc65, that generates quite a bit of code, I would imagine it's the same story for these older C compilers. It might be interesting to write an assembler program that does the same thing to compare results (though that's clearly cheating).
White Flame
Posts: 704
Joined: 24 Jul 2012

Re: 6502 can be faster than 68k :-)

Post by White Flame »

It's not cheating if it's put head-to-head against hand written 68k assembly code.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: 6502 can be faster than 68k :-)

Post by GARTHWILSON »

Justin wrote:
The 6502 might be faster than the 68K at some things, but executing the Dhrystone benchmark is not one of them :-)

Looking at the table at http://www.netlib.org/performance/html/ ... .col0.html, the slowest 68K (Mac) got 0.4 MIPS from 7.8Mhz (0.051 MIPS/MHz). Apple and C-64 ranked dead last with 0.02 MIPS from 1Mhz (0.020 MIPS/Mhz).
So if you scale them to the currently available clock speeds, it puts the Mac at about 0.8 MIPS (I'm going on the possibly erroneous recollection that the 68000 is available in 16MHz), and the 6502 at a minimum of .28 MIPS. WDC's off-the-shelf 65c02 is conservatively rated for 14MHz, and they generally top out at about 25MHz. Enso's CHOCHI 6502 runs at 45MHz, meaning 0.9 MIPS, and I seem to remember Arlet's 6502 core is running more than twice that fast. With the fastest production 6502 core running over 200MHz, that makes for 4.0 MIPS, about eight times as fast as the fastest 68000 in the list.
Quote:
Looking at the code for the benchmark, it is doing a lot of 16-bit math and pointer operations.
When you need this, the 65816 is the logical choice over the 6502. My '816 Forth runs two to three times as fast as my '02 Forth at a given clock speed, so the above numbers could be scaled accordingly, 14MHz results in about 0.7 MIPS, back just about even with the 68K. The Dhrystone benchmark also involves a lot of string-moving, so I wonder if the 816's memory-move instructions would further improve its Dhrystone performance.

These numbers are still dinky compared to the upper 2/3 of that page. Again though, a benchmark that tests abilities you don't need isn't very helpful. I've brought eight commercial embedded systems to market (mostly for private aircraft) and finished other commercial ones that didn't make it to market, and none of them made much use of any functions beyond 8 bits.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Post Reply