6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 7:12 am

All times are UTC




Post new topic Reply to topic  [ 88 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next
Author Message
PostPosted: Sun Nov 22, 2015 9:42 pm 
Offline

Joined: Tue Nov 10, 2015 5:46 am
Posts: 230
Location: Kent, UK
I got to know the 6502 in the early 80s with the Atari 800XL, and it's that nostalgia that keeps it special. Since then I've worked with a number of different architectures, including the 32-bit CISC 68000, and the 32-bit RISC ARM and MIPS. Back in the 80s I remember reading magazine listings for multiplication and divide functions for the 6502. How do I display a decimal number (divide by 10)? How do I divide two 8-bit numbers, 16-by-8, or 16-by-16. How can I scrub a few instructions from the subtract and branch loop? I can't say I'm sorry to have left those times behind.

Nowadays you can get 28-pin ARM DIPs from NXP and 28-pin MIPS32 DIPs from Microchip, so whilst I can understand the old school fun to be had with the original 6502 (and to a very slightly lesser extent (from a nostalgia purist) the 65C02), I'm curious to know what draws people to the 16-bit 65c816. It appears to be a 6502 evolved along the vector of instruction set compatibility, whereas I view RISC designs as an evolution along the vector of architectural simplicity. The richness of registers, 32-bit-ness, hardware multiply and divide, barrel shifters, orthogonal instruction set and high level language support bring even more value.

Every chip is interesting, and I hope I don't come across as rude for challenging, but if you've chosen the '816 over ARM or MIPS, I'm curious as to why. What makes the '816 desirable, interesting or even essential in your projects? Is it instruction set familiarity, compatibility with your existing libraries of work, hardware features such as 5V tolerance or bus architecture, other? I'm genuinely interested to hear your stories.


Top
 Profile  
Reply with quote  
PostPosted: Sun Nov 22, 2015 10:26 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8544
Location: Southern California
Many commercial embedded designs have no need for ARM or MIPS performance, and the 65c02's low cost in silicon real estate and royalties keep it going into products today at a rate of over a hundred million units per year, going into automotive, appliance, toy, industrial, and even life-support equipment, inside custom ICs. The fastest 65c02's are running over 200MHz (about 50MIPS).

The 6502/816 put complete understanding of the computer's hardware and software much more within the reach of any one person. This makes it attractive to hobbyists.

Regarding all the registers of the RISCs: Those are helpful for compilers; but those processors are highly impractical to program in assembly language. The 6502's zero page and 816's movable direct page are like 256 bytes of processor registers. Some who have used both ways have commented that the many registers of other processors become cumbersome, and they come to prefer the ARA (addressable-register architecture) of the '02. The article "Assembly Language: Still Relevant Today" is related.

Regarding the math operations: Most of the commercial embedded designs I've done had no use for math operations beyond simple addition and subtraction. It you do though, a software-only way to address the need is that ready-made routines are available on this website, and some of us on the forum can supply routines and methods to do functions beyond the basic multiplication and division. Without going quite to the length of adding a hardware math co-processor (although those are available too), http://wilsonminesco.com/16bitMathTables/ gives downloadable 16-bit tables to be able to look up math functions with no interpolating, accurate to all 16 bits, because they're all pre-calculated. The tables, if you use all of them, fill 2MB of memory altogether, and cover multiplication, 32-bit inverses (primarily for division, to multiply by the inverse), trig and log functions, square root, and others. In some cases it's nearly a thousand times as fast as actually having to calculate the function. The section of the website gives some background, how to use the tables (hardware and software), how they were calculated, the tables themselves (in Intel Hex), and other supporting info.

See also "Why a 6502?" at http://wilsonminesco.com/6502primer/65tutor_intro.html
and the forum topic, "Is there any future of 6502?

_________________
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?


Top
 Profile  
Reply with quote  
PostPosted: Sun Nov 22, 2015 10:59 pm 
Offline

Joined: Tue Nov 10, 2015 5:46 am
Posts: 230
Location: Kent, UK
Thanks for the reply, Garth.

For me, the 6502 programming model is superior to the Z80 and 8086 due to their limited and non-regular registers. When registers are limited in number and must be used in different contexts (non-regular), they're a pain. The 68000 was more usable, but address vs. data registers made you wish for something better. PowerPC, ARM and MIPS did it right - with registers being both numerous and regular.

I don't doubt that assembly language is still relevant. I've worked on a number of commercial systems in assembly language, on anything from 8-pin PIC12 microcontrollers to (more recently) MIPS32 cores embedded in ASICs. My more modern assembly work tends to be hand-holding a core out of reset to the point of establishing a 'C' stack frame, but the environment is bespoke enough to be more interesting than cut-n-paste of what has come before, or buying a pre-baked solution from an ISV. I enjoy working with CPUs at this level, although in my experience few programmers do.

My question wasn't on the 6502, though. They're decades old and have firmly established themselves. Whether for personal projects or commercial projects, the 6502 has a pedigree. A proven track record. I am not a "6502 is dead" kinda guy. This post isn't in that vein at all. It's the 16-bit version that I'm curious about, and I do wonder what the attraction is.


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 23, 2015 1:28 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8544
Location: Southern California
Quote:
It's the 16-bit version that I'm curious about, and I do wonder what the attraction is.

It's a natural step up from the '02 if you're already familiar with the '02 (meaning you can capitalize off the familiarity), and I find it is actually easier to program the '816 than the '02 if you're constantly dealing with 16-bit quantities. I find the criticisms of the '816 are mostly invalid, especially if you're not trying to go back and forth between '02 code and '816 code, ie, in and out of emulation mode. Just put it in native mode and leave it. There are of course a lot of things the '816 can do much more gracefully that the '02 does either poorly or not at all. [Edit, six years later: See my article, "The 65816 microprocessor: Common Misunderstandings, Plus Attractions."]

_________________
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?


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 23, 2015 2:48 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
sark02 wrote:
if you've chosen the '816 over ARM or MIPS, I'm curious as to why.
sark02 wrote:
It's the 16-bit version that I'm curious about, and I do wonder what the attraction is.
Hm, did the question shift? Hope I'm not OT if I make a remark contrasting the 6502 with the 65816.

For me there was a big light bulb that went on when I realized that a TSC instruction followed by a TCD puts your Direct Page on stack. Suddenly Direct Page ceases to be a crowded place! And you get some amazing new address-mode flexibility -- for example being able to use a three-byte indirect pointer that's on-stack.

My admiration for the '816 designers went up several notches. The 256 super-flexible processor registers that Garth mentioned can be a stack frame! Despite certain downsides it's an idea which IMO gives '816 programming a whole new level of sophistication as compared to 6502/65C02.

And, speaking of 3-byte pointers: the "16-bit version" generates 24-bit addresses, so that's a huge step up from what the '02 and 'C02 can do!

-- Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 23, 2015 4:21 am 
Offline
User avatar

Joined: Thu Nov 27, 2014 7:07 pm
Posts: 47
Location: Ocala, Fl, USA
Those are excellent points, Garth and Jeff! :idea: The Stack/Direct Page connection is nifty.
In addition, going back to 816 vs ARM or MIPS, 24-bit addressing is attractive in that it uses 25% less memory to address data than 32-bit addressing, with direct page addressing 75% smaller.

The 65816 makes for very compact code if upgrading from 6502 where you can work with 16-bit data using identical instructions (simple example: adding two 16-bit numbers in Direct Page).


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 23, 2015 4:44 am 
Offline

Joined: Wed Sep 23, 2015 8:14 pm
Posts: 171
Location: Philadelphia, PA
GARTHWILSON wrote:
Many commercial embedded designs have no need for ARM or MIPS performance, and the 65c02's low cost in silicon real estate and royalties keep it going into products today at a rate of over a hundred million units per year, going into automotive, appliance, toy, industrial, and even life-support equipment, inside custom ICs. The fastest 65c02's are running over 200MHz (about 50MIPS).

The fastest 65c02s are running at 14 MHz, not 200 MHz. Sure, you can put a WDC 65c02 core on an FPGA or ASIC and crank it up to 200 MHz if you want, but that's not really a 65c02 now is it? And no matter what, you would still be spending more money and getting less performance than if you used one of the FREE Sparc or MIPS or x86 cores out there, not to mention having a much smaller software base to work from.

IMHO, it is misleading to suggest that technology developed 30-40 years ago will ever be able to compete with modern hardware on any meaningful dimension (not just performance). Complexity notwithstanding, there's also physics at work here.

In case it isn't obvious from my other posts, I have no problem with the 6502 or its derivatives at all, and in fact I'm quite fond of the 6502. But the idea that it represents an optimal choice in terms of cost, performance, or simplicity for any modern hardware application outside of retro or limited educational use is wishful thinking at best.


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 23, 2015 6:45 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8544
Location: Southern California
jmp(FFFA) wrote:
The fastest 65c02s are running at 14 MHz, not 200 MHz.

You're thinking of the fastest ones available off the shelf, which take external memory, external I/O, etc.. [Edit, years later: Forum member "Plasmo" got one running at 40MHz @ 5.3V.] The fastest ones running in custom microcontrollers for dedicated purposes, licensed by WDC, according to WDC themselves, are over 200MHz. That was several years ago. They have the complete 65c02 programmer's model, instruction set, op code table, number of cycles for each instruction, etc.. They're real 65c02's even though they're part of an IC that also contains memory, I/O, and other support.

Quote:
But the idea that it represents an optimal choice in terms of cost, performance, or simplicity for any modern hardware application outside of retro or limited educational use is wishful thinking at best.

From WDC's own website:

    "Through the last 30+ years as one of the most popular microprocessor architectures of all time the 65xx brand is estimated to have over six billion embedded 65xx processors shipped and is growing by hundreds of millions of units per year, provided by WDC and its licensees."

(emphasis mine.) That kind of quantity is not going to hobbyists. WDC's primary business is licensing the IP to other companies that are putting the 65c02 in their products. They had said earlier that one of the attractions to these companies was specifically the silicon real estate and the IP licensing fees (particularly the up-front price which is something like 1/30th of the price to start with ARM; this is separate from the per-piece royalties). For the lower-volume stuff, I understand the 65c02 is the only processor approved for in-body implantable electronics (mainly meaning heart pacers, I suppose). I don't know if that info is up to date; but it would be rather recent.

_________________
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?


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 23, 2015 7:47 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8507
Location: Midwestern USA
sark02 wrote:
Nowadays you can get 28-pin ARM DIPs from NXP and 28-pin MIPS32 DIPs from Microchip...

Yes, and you can also get an automatic transmission in a Corvette. That option is for those who want the car to do most of the driving. Those of us who prefer to really be in control get a manual trans and learn how to power-shift. :D

Quote:
What makes the '816 desirable, interesting or even essential in your projects?

I think Sir Edmund Hillary unwittingly had an answer to that.

Most of us will never build anything with 65xx technology that we will sell in quantity. We're hobbyists and we do this because it's fun and educational, and creates puzzles that invite heavy thinking and planning. The 65C816 is a logical evolution of the 65C02 and represents a significant leap in performance with little increase in "cost." The work I did that led to the construction of my POC unit made me think and plan, think and plan, think and plan...and then build. It was a great feeling when I got the thing to scribble something intelligible on the screen.

As Jeff said when he realized that a two instruction sequence (TSC following by TCD) could open a wormhole to a new way of computing, the light bulb he turned on was in the 1000 watt range. That's what makes the 65C816 desirable and interesting, if not essential. To paraphrase Hillary, we build with the 65C816 because it's there.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 23, 2015 12:55 pm 
Offline

Joined: Wed Sep 23, 2015 8:14 pm
Posts: 171
Location: Philadelphia, PA
GARTHWILSON wrote:
You're thinking of the fastest ones available off the shelf, which take external memory, external I/O, etc.. The fastest ones running in custom microcontrollers for dedicated purposes, licensed by WDC, according to WDC themselves, are over 200MHz.

Please pardon me if I don't take WDC's word for how many cores they have licensed, etc. unless and until the numbers are confirmed by outside sources. They wouldn't be the first company to misrepresent their sales. However, if they are such a successful company (in part due to the sales of "hundreds of millions" of 65c02 cores), then one would also expect them to be more than just a tiny little privately-held company. Finally, even if it were true that they have in fact licensed hundreds of millions of cores, I still stand by my comment that any modern application of their 65c02 technology outside of retro or educational use is suboptimal in comparison to current generation technology in most meaningful ways (cost, performance, efficiency, etc.).


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 23, 2015 3:19 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Bear in mind those cores will license for a few cents, most likely. Hundreds of millions of very low cost cores doesn't make for a big business. I think most of those cores go into toys. We know the early Furbies used one, also some photo keyrings used one. And some of HP's calculators used one.

I don't know why anyone would choose WDC over ARM - cost, development tools, reference designs, and support might be among the reasons. Even if a 32-bit core seems excessive for some task, that's no matter if the price is right and the product gets to market on time.


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 23, 2015 5:31 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
Quote:
Regarding all the registers of the RISCs: Those are helpful for compilers; but those processors are highly impractical to program in assembly language.

Having programmed in assembly for both 6502 and ARM7, I must say that programming for the ARM was a breeze. 16 registers is a perfect amount, and ARM7 syntax is pretty simple (took me about a weekend to learn it). The advantage of the ARM is that you can focus on the problem in a natural way. Each register is big enough to hold an address, and there are plenty of registers to hold various things at the same time. With the 6502, a lot of time and instructions are wasted on simply getting the right data where it needs to be. A general purpose memory read takes setting up two zero page locations, and the Y register.

Of course, for most problems, you don't even need to write in assembly.


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 23, 2015 5:44 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
Quote:
Bear in mind those cores will license for a few cents, most likely.

I would be surprised if they charge that much. Seeing that you can buy a packaged ARM Cortex M0 microcontroller for 35 cents, the ARM royalties can't be more than a few cents. Surely, the 6502 must be a good deal less, especially because they are also competing with free cores on the net, or people just writing their own core.

An ARM core requires a fairly modern process, though, so I can still see people using 6502 cores on a old process, using second hand fab equipment, especially if they also have some old software and/or programmers.


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 23, 2015 6:05 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
Funny fact: a modern ARM Cortex M0 is only slightly bigger than a transistor on an original MOS 6502.


Last edited by Arlet on Mon Nov 23, 2015 7:17 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 23, 2015 6:06 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
That's amazing!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 88 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: