6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 01, 2024 3:45 am

All times are UTC




Post new topic Reply to topic  [ 27 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Wed Feb 22, 2006 2:42 pm 
Offline

Joined: Wed Feb 22, 2006 2:39 pm
Posts: 1
With the advanced processors, does 6502 have any future. Does it even have a present.
Are contemporary 6502 programmers are just doing it for fun or there is immediate professional benefits that can be derived.

I hope some one will be kind enough to reply.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Feb 22, 2006 3:12 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1745
Location: Sacramento, CA
You might want to read the posts in this topic:
http://www.6502.org/forum/viewtopic.php?t=737

WDC is still producting the 65C02 and its brothers. They would not be doing so if there were no demand.

Daryl


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Feb 22, 2006 7:02 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
In fact, the 6502 and 65816 architectures are finding themselves in an increasing number of embedded environments, often times displacing the ARM processor! In recognition of this, WDC is embarking on another 32-bit processor project, called Terbium, which is intended to compete with the ARM processor on a more equal footing.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Mar 03, 2006 2:35 am 
Offline

Joined: Wed Oct 08, 2003 1:15 am
Posts: 25
Location: Florida
In my opinion, 65x02 will be used for a very long time, as long as WDC will produce it. But, it will be used only on existing designs, where there is a long, complex software. Who would want to convert such software?

But, on new designs, we are using Microchip products. It enormously simplifies the work and reduces the 'real estate' on the circuit board.
Our requirements for a microcontroller are:
1. Single chip, no support chips.
2. Programmable I/O pins.
3. EEPROM.
4. Included must be ADC and Pulse-Width-Modulation, to generate analog voltage outputs.
5. Flash programming.
6. Code protect feature, so the software cannot be copied.

Unfortunately, 65x02 only satisfies item 2.
For example, we have redesigned our smaller products from 65x02 to
Microchip PIC16F877A.
That single 40-pin chip eliminated one 65c02, two 65c22, 8K EPROM, 2K RAM, 4 decode/support chips and one DAC.
However, we have no plans to convert our large products to Microchip, the
software change would be too difficult.
Of course, I look forward to programming Microchip as much as I look forward to root canal. Their logic is hostile, negative - "if something is true, don't do this".
By the way, the reason we use Microchip and not Motorola is due to
Motorola's idiotic marketing policy. Motorola products weren't available
online, until recently. Motorola program instructions are very similar to 65x02, so converting to Motorola would be relatively easy.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Mar 03, 2006 5:01 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
I should point out that the 65xx architectures are currently finding their most successful niche in the embedded range between what the ATmega/PICs can provide and where the ARM processors start to be more attractive. This means that one won't likely find a 65xx processor controlling a single-purpose device anymore, but you will find a 65xx-based environment in a dedicated-purpose, embedded computer. Palm-type devices would have been ideal for the 65816, for example, but alas, they went with the 68K family instead.

To give you a great example of the level of performance a 65816 can give in this type of application, download and install the VICE emulator, along with the GEOS 2.0 operating system for it. Boot into GEOS using the Commodore 128 emulator, configured with a 16MB REU (RAM Expansion Unit -- basically a RAM-disk). Now run the thing at 1MHz. It's slow, but quite usable. Now change the system speed to 400% (although the C128 thinks it's still running at 1MHz, this still gives the approximate perceived performance at 4MHz). Notice that it's about as fast as a Macintosh Classic running at 8MHz. This is with an 8-bit processor (specifically the 8502A). You can pretty much expect the 65816-based system to be more or less 33% to 66% faster than that.

And since you're not going to do any heavy number crunching on a PDA-type device, it seems logical that the reduced hardware interface requirements of the 65816 would (at least in theory) make for a cheaper system.

Ahh, but I'm digressing.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Mar 03, 2006 7:40 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8534
Location: Southern California
kc5tja wrote:
In fact, the 6502 and 65816 architectures are finding themselves in an increasing number of embedded environments, often times displacing the ARM processor!

Last year, I wrote to Bill Mensch asking for good reasons to use the 65-family processors, for an article.  One of the things he said was,

      The 65xx architecture is sold in hundreds of millions of chips per year, and the volume is growing.  We now find engineers porting applications that might have first been market-tested on PCs or ARM processors and finding the 65xx economy (both business and silicon) attractive and well worth the effort to change to the 65xx.

(emphasis added.)


The 65c02 is indeed going into new designs, but in microcontrollers, not separate microprocessors.  These go into all kinds of consumer items like camcorders, and into automotive applications, as well as even life-support equipment.  Most of WDC's business seems to be in licensing the IP, not selling parts.  They do have a couple of off-the-shelf microcontrollers, the 65134 and 65265, but these off-the-shelf ones don't come in a lot of versions like the PICs do.  Unfortunately they're also not programmable on the workbench like the PICs are, but it sounds like that may be changing.  The microcontrollers being made today with 65c02 cores in them and being sold at the rate of hundreds of millions per year are mostly custom ICs.

Like Icy, I have designed Microchip PICs into several products too, and not because I like them—actually I hate the decrepit RISC processor at their heart—but because they're available in so many versions, from lots of stocking distributors, they're easy to program on the workbench, some even have complete onboard fixed-frequency clock oscillators, etc..  A 20MHz 65c02 can do a job a lot faster than a 20MHz PIC16 though, if the PIC can do it at all.  PICs are good for tiny jobs, but otherwise have severe limitations.

I have a lot of code comparisons between 65c02 and PIC16 written down, but in looking at them again I can see why I haven't just taken 15 minutes to compile them clearly for this website.  There's too much there.  I will give a few examples here, and just say that there's more where that came from.

Take the example of a single-byte table look-up, where table might be anywhere in ROM:
Code:
6502: 4-5 clocks        LDA address,X

Code:
PIC:  48 clocks, to do what the 6502 does in 4 or 5 clocks!  (This code is
from slide 234 of the seminar, and the same as what's in AN556 Example 5.)

       ORG    0x10          ; Page 0
       MOVLW  LOW (Table)   ; Low byte of address     4
       ADDWF  offset,F      ; added to offset.        4
       MOVLW  HIGH (Table)  ; High 5 bits of address  4
       BTFSC  STATUS, C     ;   Page crossed?         4
       ADDLW  1             ; Yes...Inc high address  4
       MOVWF  PCLATH        ; Load high address       4
       MOVF   offset,W                                4
       CALL   Table                                   8

       ORG    H'800'        ; page 1
Table:
       ADDWF  PCL,F         ; Calc table offset       4
       RETLW  'A'                                     8
       RETLW  'B'
       RETLW  'C'
       RETLW  'D'
       etc.

Edit, 1/7/13:  I just learned of another PIC stinker:  If an interrupt hits immediately before the PCL-modifying instruction above, it will misbehave after the return from interrupt, and you'll get the RETLW 'A' even if you wanted a different one; so you have to disable interrupts for the table look-up further lengthening the code and slowing things down and causing a longer interrupt latency.  This is from AN556, bottom of page 3.

The PIC has to use different code if the table is in RAM.  It can't use the same code for ROM and RAM like the 6502 can.  Furthermore, if you index past the end of the table in ROM, you won't just get bad data—you'll crash.

Or consider the disabling of interrupts.  The PIC's problem here is that if an interrupt hits during the instruction to clear the Global Interrupt Enable (GIE) bit, the interrupt will be taken, and if the ISR saves the status, the old status will be restored at the end, along with the GIE bit set.  So, after clearing that bit, you have to check to see if it's really clear, and go back to try again if it's not.
Code:
6502:  SEI                 ; 2 clocks to disable interrupts reliably.

Code:
PIC:                       ; This loop is from the caveat on
loop:  BCF    INTCON,GIE   ; P.2-767 of '95-'96 data book.
       BTFSC  INTCON,GIE   ; 12 clocks minimum, 28 clocks if you
       GOTO   loop         ; have to loop back even once.


On the 6502, no jump or branch, conditional or otherwise (excluding indirects and subroutine calls), ever takes more than 4 clocks, and they usually take 3.  On the PIC however, GOTOs take 8 clocks, but another 8 clocks are required for MOVLW xx and MOVWF PCLATH for longer jumps.  If W must be saved with MOVWF and MOVF xx,W during the latter process, yet another 8 clocks are wasted.  This makes for a total of 24 clocks to do what the 6502 does in 3.

The PIC can't shift, so if you want to shift something, so you have to rotate and then AND-out the bits that should have ended up as 0s.  PIC also can't rotate in W (which is like the 6502's accumulator), so you might have to put the number in a variable.  For the following example, shift right 2 bit positions W (PIC) or A (6502):
Code:
PIC: 16 clocks            6502: 4 clocks

MOVWF  TEMP_W      4
RRF    TEMP_W,F    4      LSR   A      2
RRF    TEMP_W,W    4      LSR   A      2
ANDLW  B'00011111' 4


Edit, 2/4/12:  For a PIC16F project, I just got the code from Microchip's Embedded Control Handbook Update for dividing a 32-bit unsigned number by a 16-bit one, to get a 16-bit quotient and remainder.  It's 237 instructions (obviously I won't list it here), to do what the 6502 does in just 35!!!

The 6502's interrupt sequence is only 7 clocks, including pushing the status register.  Pushing the accumulator (like PIC's W) takes another 3.  The PIC's interrupt sequence is 8 clocks minimum, but if you want to save the status and W, you need about 28 clocks to do what the 6502 does in 11—and then the PIC's is not re-entrant.

PIC16F's 8-level return stack is not enough.  With good programming practices, I overflowed it, and the processor crashed when it unwound its way out.  The 6502's stack is 16 times as deep (128 2-byte addresses), which has proven to be many times what you need for most applications.

When I first started working with PICs, as I went through programming examples in the Microchip books, I wrote 65c02 code next to the PIC code to help myself understand it better.  I soon began to realize that the 65c02 code was consistently shorter and took about half as many clocks to execute as the PIC's code.

PIC's lack of stack access and its shallow stack depth are very limiting.
PIC's page- and bank-switching requirements waste memory and execution time, and make the code more unreadable.
PIC's instruction set is very limited.
PIC's Harvard architecture, separating program from data, makes it harder to work with.
PIC cannot do an indirect or indirect indexed GOTO or CALL.
PIC has no address modes at all with indexing.
PIC's backward subtraction (F-W, instead of W-F) usually lengthens the code, and is quite confusing.

Since, as Icy said, the PIC's logic is backwards and confusing, I start my PIC source code with macro definitions named after 6502 mnemonics to make things more clear, like BEQ.

Edit 12/7/13:  Admittedly PIC16F1's and PIC18's have come in to fix a few of the PIC16 problems above, now many years later.  It took Microchip many years to do this, and what they have is still rather mickey-mouse compared to the 6502.

The 65c02 lends itself to more intuitive programming.  Howard Speegle, the president of Diva Automation, Inc., says he finds it easier to envision a solution with the 65c02 than with the others of the dozen processors he has used, and he can develop the application faster and with less bugs with the 65c02.

I understand one of WDC's licensees is running a 65c02 microprocessor inside a custom IC (ASIC) at 200MHz.  Certainly if the PIC can be so successful today with its comparatively lousy processor core, there is no reason to think the 65c02 has no future or even a present.

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


Last edited by GARTHWILSON on Sat Feb 04, 2012 8:14 pm, edited 3 times in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Mar 04, 2006 3:19 am 
Offline

Joined: Wed Oct 08, 2003 1:15 am
Posts: 25
Location: Florida
Yes, PIC's processor is lousy. 65x02 is wonderful. Programming 65x02 feels like vacation, you cannot get tired doing that. It is natural, logical, it doesn't give you headache.
So, why couldn't someone, like WDC, come up with a single chip microcontroller that is at par with PIC or Motorola? WDC's microcontrollers aren't microcontollers of today. WDC lives in past. Microcontroller of today is a one chip, and nothing else is needed to attach.
All of that core stuff will disappear in a few years. And, so will WDC, unfortunately. Unless they come up with something up to date. Who wants to tell them?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Mar 04, 2006 3:51 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
Icy wrote:
Unless they come up with something up to date. Who wants to tell them?


Both Garth and I have been regularly telling them.

However, they are reporting that sales are up (and this is evidenced by the fact that their website actually has content on it now!), so they are obviously doing something right, even if it isn't directly visible to us.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Mar 04, 2006 8:41 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8534
Location: Southern California
Quote:
So, why couldn't someone, like WDC, come up with a single chip microcontroller that is at par with PIC or Motorola? WDC's microcontrollers aren't microcontollers of today. WDC lives in past. Microcontroller of today is a one chip, and nothing else is needed to attach.

We would all like an array of 6502-based µC's made available as standard products. I don't think WDC lives in the past at all; but again, their primary business as I understand it is not selling hardware, but licensing the intellectual property to other companies that do in fact make their own dedicated custom µC's with everything in one IC and the 6502 at the heart of that IC. I wish WDC would license their IP to Microchip. It would be nice if there were a widely available parallel line of PICs built around the 6502 instead of Microchip's little RISC. Everything would still be in one IC, as it is with the currently available PICs.

I suppose the nature of WDC's business and the lack of standard (as opposed to custom) parts is why it appears to most people that the 6502 got relegated to ancient history by industry's negligence to keep a good thing up to date. Actually the 6502's growth just took a less-visible path than the x86 did with desktop computing or Microchip did with standard-part microcontrollers. Surprisingly, more 6502's per year are being sold today than at any time in history. You probably own 6502's in modern consumer electronics products and didn't even know it.

I personally am convinced that what people get familiar with as hobbyists and students gets carried forward into their jobs later when they get into industry and favor the parts they're familiar with to design into their company's products, and I think that is why WDC would do well to support the little customers better. It seems that they are very slowly moving toward that. That's not to say a hobbyist who buys one IC for $5 has permission to take $100 of WDC's time now and then to get help troubleshooting something; but at least they've dropped the $100 minimum order requirement (which I didn't think was that bad anyway) and put their programming manual online instead of insisting that we pay $60 a copy, and they seem to be starting to look more favorably on this website as a supplier of ap notes and things they've been lacking. They're also starting to talk about flash-based µC's that can be programmed on the workbench.

_________________
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  
 Post subject:
PostPosted: Sat Mar 04, 2006 9:50 pm 
Offline

Joined: Sat Aug 31, 2002 12:33 pm
Posts: 64
Location: USA
Hi Everyone,

Remember... the ST7 from ST micro is a 6502 look alike. It IS a single chip device with Flash, RAM, and IO.

Note, I haven't actually used one of these yet.

Cheers,

Paul


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Mar 04, 2006 11:31 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
Isn't STMicro one of the licensees for WDC's IP?

Also, while I couldn't find any detailed documentation on the ST7, I did find some example code snippets, and its mnemonics are half-68000, half-Z80 (a very interesting combination to say the least). From what I've seen, it does not look anything at all like a 6502. Moreover, I have yet to see them use the Y index register.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Mar 05, 2006 6:21 am 
Offline

Joined: Fri Aug 30, 2002 2:05 pm
Posts: 347
Location: UK
Quote:
while I couldn't find any detailed documentation on the ST7

http://www.st.com/stonline/products/literature/pm/4020.pdf

Quote:
From what I've seen, it does not look anything at all like a 6502. Moreover, I have yet to see them use the Y index register.

It's very like a 6502, accumulator, X an Y index registers, zero page addressing etc.

Of course there are differences, the decimal mode flag had been replaced by a Z80 like HalfCarry, the stack is smaller - only 64 bytes - and it isn't binary compatible, e.g. LDX #nn codes as $AE $nn not $A2 $nn as it does on the 6502.

Lee.


Top
 Profile  
Reply with quote  
 Post subject: SOLUTION !!!!!!!
PostPosted: Mon Mar 06, 2006 3:09 am 
Offline

Joined: Wed Oct 08, 2003 1:15 am
Posts: 25
Location: Florida
Hey, how about this: :idea:
Quote:
I wish WDC would license their IP to Microchip. It would be nice if there were a widely available parallel line of PICs built around the 6502 instead of Microchip's little RISC. Everything would still be in one IC, as it is with the currently available PICs.

This would be ideal situation for WDC. Just think of all that huge market suddenly open for them.
This could blow my mind. No more headaches programming crappy, hostile PIC's RISC!


Top
 Profile  
Reply with quote  
 Post subject: Re: SOLUTION !!!!!!!
PostPosted: Mon Mar 06, 2006 3:20 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
Icy wrote:
This could blow my mind. No more headaches programming crappy, hostile PIC's RISC!


Although still not as convenient as a 6502, I do find AVR microcontrollers to be MUCH better than the PICs from a programming point of view.


Top
 Profile  
Reply with quote  
 Post subject: Re: SOLUTION !!!!!!!
PostPosted: Mon Mar 06, 2006 5:33 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1745
Location: Sacramento, CA
kc5tja wrote:
Although still not as convenient as a 6502, I do find AVR microcontrollers to be MUCH better than the PICs from a programming point of view.


I agree. My video project was my introduction to the AVR family. I found the opcodes to be very similar to the 65C02. The last 6 of the 32 gerneral purpose registers work as three - 16 bit index registers (X,Y,Z). These allow for easy access to SRAM and FLASH memories. The stack is only limited by the available SRAM. They also run at 16 MIPS which is faster than the 14MHz 65C02. The AVR's use dedicated IRQ vectors for a multitude of functions, making IRQ decoding simple. I have not experimented with multiple-IRQ handling, so cannot say they have better response than the 65C02. The biggest plus to me is the onboard I/O (SPI, UART, timers, etc). The biggest minus is the limited SRAM onboard. Some versions do support external SRAM, but access speed to this is cut in half.

My two cents... Daryl


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

All times are UTC


Who is online

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