6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Sep 28, 2024 3:18 am

All times are UTC




Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: A modern 6502 processor
PostPosted: Tue Apr 11, 2017 2:10 pm 
Offline

Joined: Tue Apr 11, 2017 1:50 pm
Posts: 7
Location: UK
The 6502 is an odd chip - everyone seems to love it. Clearly that has to be for good reasons.
(Sorry granny I know you know how to suck eggs....)

I was wondering what a modern chip built with the 6502 philosophy and "feeling"
would look like today.

Would it have 32bit data bus and registers, would it clock at 4Ghz, would it have a built
in FP processor or an external one. a flat memory space.
Would it make any sense at all?

What do you think?
if you had to design a 6502ish processor today what would you do?


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 11, 2017 2:48 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
That depends on what part you consider the "6502 philosophy"...


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 11, 2017 3:17 pm 
Offline

Joined: Tue Apr 11, 2017 1:50 pm
Posts: 7
Location: UK
Whatever the reason is that this forum exists?
You don't generate this sort of enthusiasm without doing something right - but what is it?


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 11, 2017 3:20 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1948
Location: Sacramento, CA, USA
viewtopic.php?f=1&t=4216

viewtopic.php?f=1&t=784

Mike B.


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 11, 2017 3:33 pm 
Offline
User avatar

Joined: Tue Nov 16, 2010 8:00 am
Posts: 2353
Location: Gouda, The Netherlands
jazz wrote:
Whatever the reason is that this forum exists?
You don't generate this sort of enthusiasm without doing something right - but what is it?

For me, it's mainly nostalgia, because the 6502 was my first CPU. But there's much better stuff now.


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 11, 2017 4:08 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8403
Location: Midwestern USA
jazz wrote:
The 6502 is an odd chip - everyone seems to love it.

What's so odd about it?

Quote:
I was wondering what a modern chip built with the 6502 philosophy and "feeling" would look like today.

Probably like a 65C816, but with smaller geometry so it can be run faster.

Quote:
Would it have 32bit data bus and registers, would it clock at 4Ghz, would it have a built in FP processor or an external one. a flat memory space.

Doesn't sound like a 6502 to me.

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


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 11, 2017 8:48 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
The RISC-V architecture is a clean and new design, worth looking into if you like that sort of thing.

The crucial feature of the 6502 is that it was cheap, and one reason it was cheap was that it is fairly simple and fairly regular. The ease of learning to use it has helped it to stay popular. It was made by a small team in a small company. The spiritual descendent of that is the RISC approach, and the ARM, designed and made initially by Acorn, a very appropriate example. Although ARM isn't a purist's RISC, it was made to be simple and cheap. (The reason it is low power is that to be cheap it needed to be in a plastic package and therefore had to run cool.) As you may know, ARM was designed on 6502 systems by 6502 experts.

But today ARM has become rather complex, and RISC-V is a likely successor. Unlike ARM, it's free and open source.


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 11, 2017 11:17 pm 
Offline

Joined: Tue Jul 24, 2012 2:27 am
Posts: 674
In my opinion, the biggest design difference between the 6502 and modern cpus is that it has single-cycle access to all memory. Bulk memory doesn't really work like that anymore, and once you start dumping cache layers on the 6502, you lose a lot of its simplicity and coding style.

_________________
WFDis Interactive 6502 Disassembler
AcheronVM: A Reconfigurable 16-bit Virtual CPU for the 6502 Microprocessor


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 12, 2017 1:54 am 
Offline

Joined: Thu Mar 10, 2016 4:33 am
Posts: 180
The 6502 was a good architecture for it's time, but now times have changed.

Modern processors are designed for executing high-level language code, specifically C like languages. There's a lot of code out there now that you wouldn't want to throw away, so any worthwhile modern processor will most likely run compiled C like code. If that is the case then the character of the processor is not really important.

The 6502 was designed when memory was faster than processors, so many decisions were made because of this. Today it is the opposite and that is why we have caches and large register files. So a modern processor would need these too, further moving it away from the character of the 6502.

Direct page is hard to work with in a multitasking operating system, so it's benefits largely disappear.

It is interesting to look at the x86 architecture evolution as this gives us an example of a 70's design that has evolved. In the end though I'd think that very little of the character of the 8080 or 8088 still exists in the modern chips.

As a hobby CPU though we could look at it differently. What could be done to increase the performance of the 6502 to a level that it could be more useful, while still being a 6502. That is probably a more interesting question. The 65C816 takes one step in that direction, but it's interesting to see that it does not get all that much attention compared to the 65C02, many people prefer the nostalgia of using an original 6502 to the benefits of the 65C816. In my opinion I think that the 65C816 is a more interesting chip to use today than older 6502's. It definitely has some advantages for targeting high level languages. One interesting thing when implementing a compiler for the 65C816 is that there is almost no need for register allocation algorithms (because there's basically no registers :-)), and that makes a compiler easier to implement.


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 12, 2017 2:56 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8403
Location: Midwestern USA
jds wrote:
Direct page is hard to work with in a multitasking operating system, so it's benefits largely disappear.

Not so with the 65C816 in native mode. Each function in the kernel can have an ephemeral direct page if needed, as can each task. So the benefits of using direct page are certainly attainable in a multitasking operating environment.

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


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 12, 2017 3:07 am 
Offline

Joined: Wed May 20, 2009 1:06 pm
Posts: 491
jazz wrote:
The 6502 is an odd chip - everyone seems to love it. Clearly that has to be for good reasons.
(Sorry granny I know you know how to suck eggs....)

I was wondering what a modern chip built with the 6502 philosophy and "feeling"
would look like today.


It is called "ARM".
They started on 6502 but wanted something faster.

https://www.theregister.co.uk/2012/05/0 ... ve_furber/

https://news.ycombinator.com/item?id=8549467

Quote:
Of modern CPUs, the closest assembly to the 6502 would be ARM.
ARM has many similarities to the 6502 as far as mnemonics go, but there are also some very clear differences between the 6502 and ARM.
For example, if you take a look at the jump/branch instructions, the 6502 has mnemonics for each condition and ARM has a generic jump followed by the condition and address in the operand field.
ARM further simplifies mnemonics (opcodes) and moves differences to the operand field to reduce the number of instructions and simplify decoding.

FWIW, in spite of their similarities, I'm not sure you can truly attribute ARM assembly strictly to the 6502.
If you look at the PDP series of computers, I'm sure you'll find they heavily influenced most CPUs in those days.

http://atariage.com/forums/topic/201370 ... from-6502/


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 12, 2017 4:28 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8520
Location: Southern California
It is important to remember that the '02 was originally intended for embedded-control applications, not the desktop computers where its low price made it popular for a decade or more. It is however still doing well in embedded-control, even today. Newcomers may be surprised to learn that it's still selling in volumes of over a hundred million (100,000,000) units a year, much greater than in the 1980's—it's just that what the 65c02 is going into today is a lot less visible, being at the heart of custom ICs going into automotive, toy, appliance, and other applications, even life support.

Desktop and laptop PCs, and tablets and smartphones, where there's the demand now for hi-res color graphics and video, have taken up more-modern processors. And that's ok. There are still many applications today that have no need for that. Yet Bill Mensch, the designer of the 65c02, said in an interview two years ago that he estimated that if it were made in the most modern deep-submicron geometry, it would do 10GHz. Now two years later, I'm sure that number is even higher. (Obviously it would require the memory and I/O to be on the same IC, not outboard.) If something required a very simple, high-performance processor on minimal silicon real estate, it could fill the need. No one will make the investment though without the appropriate level of sales promised.

Quote:
Modern processors are designed for executing high-level language code, specifically C-like languages. There's a lot of code out there now that you wouldn't want to throw away, so any worthwhile modern processor will most likely run compiled C like code. If that is the case then the character of the processor is not really important.

There is the cc65 compiler, but it produces very inefficient code. I'm sure a better C compiler could be written (or maybe there is one) [*]; but C compilation truly is an area that the '02 is not a good match for. OTOH, processors that are suited for it are usually much harder to program in assembly language. The '02 seems to do fairly well in Forth though (considering it's only an 8-bitter). There's a lot of spacecraft programmed in Forth. This page, under "3.1 The Forth Interest Group," tells of Bill Ragsdale becoming aware of the value of Forth and wanting it to use in his successful bay-area security-system manufacturing company, and his writing a 6502 Forth kernel, exploiting zero page and stack-implicit addressing architectural features in the 6502. He and six others formed the Forth Interest Group, and later added kernels for other processors.

Quote:
Direct page is hard to work with in a multitasking operating system, so it's benefits largely disappear.

You can give each task its own directly page on the '816. (It doesn't have to be an entire page, nor does it have to start on a page boundary.) Multitasking OSs aren't easy on the '02, but have been done anyway. Take a look at Jonathan Hallidays' very impressive preemptive multitasking GUI OS for 6502 Atari computers running at 1.7MHz and having 1MB of RAM, at http://atari8.co.uk/gui/ . Be sure to watch the video. He's still not done with it. I talked to him just last week.

Quote:
As a hobby CPU though we could look at it differently. What could be done to increase the performance of the 6502 to a level that it could be more useful, while still being a 6502. That is probably a more interesting question. The 65C816 takes one step in that direction, but it's interesting to see that it does not get all that much attention compared to the 65C02, many people prefer the nostalgia of using an original 6502 to the benefits of the 65C816.

There seems to be a lot of unfounded fear of the '816, a fear of the mode bits (which can be left alone in much of your code), fear of the bank byte (which you don't have to latch, decode, or use if a 64K memory map is enough), fear of added capabilities (as if you were forced to use them right from the start), etc..

[*] Edit, 2/14/21: I just came across this page about benchmarking the various C compilers for the 6502. CC65 produced much slower, more bloated code than the other 6502 C options, although it was more solid.

_________________
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: Wed Apr 12, 2017 5:05 am 
Offline

Joined: Thu Mar 10, 2016 4:33 am
Posts: 180
BigDumbDinosaur wrote:
jds wrote:
Direct page is hard to work with in a multitasking operating system, so it's benefits largely disappear.

Not so with the 65C816 in native mode. Each function in the kernel can have an ephemeral direct page if needed, as can each task. So the benefits of using direct page are certainly attainable in a multitasking operating environment.


Yes, I guess so. I still get a bit hung up on the limitation of bank 0, in that you need to have both the stack and DP fit within 64k. So far this is theoretical as we don't currently have a multi-tasking operating system for the 65C816. I guess I'm also struggling to get used to the smaller resource requirements of these kinds of systems, but even with say a 4k stack you'll only have room for 16 processes. Given that we can now relatively cheaply fill up the address space of the 65C816 it seems that the main limit is on bank 0. This could be fixed with a MMU if someone were inclined to build one, but that may be overcomplicating the system.


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 12, 2017 5:12 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8520
Location: Southern California
There's no need to assign the same amount of stack space for every task; and most tasks have no need for even 256 bytes of stack space. What application did you have in mind that needs so much (4K)?

_________________
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: Wed Apr 12, 2017 5:50 am 
Offline

Joined: Thu Mar 10, 2016 4:33 am
Posts: 180
GARTHWILSON wrote:
There's no need to assign the same amount of stack space for every task; and most tasks have no need for even 256 bytes of stack space. What application did you have in mind that needs so much (4K)?


I would like to have a multitasking system with as few limits as possible. That is generally not possible without a full MMU as you don't have the flexibility of moving memory around as needed.

My end target is a 65C816 C compiler that runs on a 65C816 system. A C compiler (written in C) will require quite a bit of stack space. Since this is for the 65C816 I'm using the stack for local variables. If the stack was limited to being a call stack only then the stack could be quite small, but there are a lot of nice addressing modes on the 65C816 that make use of the stack.

In the end I don't think I know enough about the memory requirements to make any concrete decisions, the only way to find out is to build something and then see where the limitations are. It should be relatively easy to reverse any decisions that turn out to be impractical.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 22 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: