Welcome to Pete Brown's 10rem.net

First time here? If you are a developer or are interested in Microsoft tools and technology, please consider subscribing to the latest posts.

You may also be interested in my blog archives, the articles section, or some of my lab projects such as the C64 emulator written in Silverlight.

(hide this)

The 6502 Processor Today

Pete Brown - 24 February 2012

Over the past year or so, I've really gotten interested in alternative processors. It started as simple .NET Micro Framework devices and them moved to C++ directly on Micro Controllers, and is now expanding to include those interesting processors that sit in between the bests that run our desktops and the tiny ones that run hobby boards.

Most processor discussions these days are around x86-compatible (including x64) processors, or ARM licensee processors and microcontrollers. Back in the 70s and 80s, before the industry had settled around just one or two primary processors, there existed quite a huge field of different cores companies could use to build their new devices.

One of the more popular microprocessors back then was the 6502. In fact, it's considered one of the most influential microprocessors of all time. I'm familiar with this family mostly due to Commodore's use of it and its descendants in the PET, VIC-20, C64 (MOS 6510) and C128 (MOS 8502) computers. However, Apple also used it in the Apple I and Apple II line, Nintendo used it in their first VCS, and many others used them in their computers as well.

Oh, and:

image

Which reminded me that the Terminator used a 6502 controlled as well :)

image image

It's a processor that has the hearts and minds of retro geeks everywhere.

image

This processor originally started off as a microprocessor for use in various embedded devices. Remember, at the time, computers were typically big fridge-sized devices with CPUs (or parts of CPUs) that took up the space today allocated to an entire motherboard. It wasn't until some pioneering hardware folks said "you know, we can make a whole computer out of this" that it was used for what we'd today call a personal computer.

Here's one of my donor C64s. SID chip was removed, but you can see the 6510, a 6502 descendant with more IO.

image

The dust in there is old enough to carbon date.

UPDATE

Jameco has a great page on the 6502 from Western Design Center. Be sure to check it out when you're done here.

It's Still in Production

Did you know that descendants of the 6502 are still in production? The Western Design Center, Inc, founded by Bill Mensch of Motorola and MOS fame, sells modern versions of the 6502 in both the classic 40 pin DIP package (appears to be pin-compatible with the original), as well as more modern surface mount packages. These are being used in all sorts of commercial devices, including external sound interfaces from companies like MOTU, medical devices and scanners, hand-held games and more. Bill Mensch is one of the holders of the 6502 patent, so who better to work on it today than him.

The W65C02S is closest to the original 8 bit 6502. There are also additional versions that are 8/16 bit hybrids and can therefore address more memory, and should be compatible with the Nintendo and Apple IIgs versions of the chip.

image

In fact, two just arrived in a box of other goodies from Mouser. I'm not sure what I'll do with them just yet, but they were out of stock forever, so I ordered them as soon as they popped back in.

image image

These are the true 8 bit versions with 16 bit extended addressing, like the original 6502/6510. The 16 bit versions are even more capable.

So, what exactly could I do with them?

What could you do with a 6502 Today?

Well, first of all, it's a usable microprocessor, so you can build just about anything you want. For those of us into retro geekware and who know just enough electronics to be dangerous, perhaps a modern implementation of a Commodore 64 or Apple II would be in order? The Propeddle is one such project, using a Propeller to handle much of the non-CPU work. Unlike most of the microcontrollers we play with, this has address lines and supports external memory.

Although they wouldn't necessarily be 100% compatible with the originals, you could run the new 6502 up at its full speed and create new versions of the old computers. Perhaps you could even provide a more functional video controller that could do more colors than the old VIC chip used by Commodore (and replace also whatever Apple used in their builds). With those changes, you could see just what the computers could have been. The challenges would be speed (running at 1Mhz for the C64 would negate this problem), and both the additional IO lines and the undocumented opcodes that the MOS 6502/6510 implemented.

You can do all of that with hardware or software emulation of course, built a real 8-bit computer, using a descendant of the original chips, could be a fun and rewarding challenge.

           
posted by Pete Brown on Friday, February 24, 2012
filed under:            

25 comments for “The 6502 Processor Today”

  1. Nick Besersays:
    Interesting article. Many years ago I worked in the King of Prussia PA area, down the road from MOS technology. I had the pleasure of meeting Will Mathus who was one of the designers of the 6502. He gave me a chip set to work with, a 6502 and something he called the TIM chip. The TIM chip had a small monitor code, and a I/O support set that would talk to a RS-232 terminal. The two chip set (with minor additional hardware, clock, a few resistors and capacitors, was my first computer. This was just about the time the commodore computer came out. I did not know that the chip was still in production. It is interesting to appreciate our hardware heritage.

    Nick
  2. SeattleC++says:
    The 6502 was a horrible processor, with 8 bit index registers and weird first-page-only addressing modes. It was completely unsuitable as a compiler target so you had to program The Terminator in assembly language. It is not necessary to suffer such pain today. There are modern microcontrollers. Why architectures like 6502 and 8048 persist is a mystery.
  3. Davidsays:
    And its primary competetor (the 8086) was better? With its asinine opcodes and nightmarish overlaping mempry pages? Do you think you could compile a non-trivial C program on it? Sure, you ***could***, but if you had any performance criteria you'd end up rewriting it in assembler, anyway.
  4. Nick Besersays:
    Interesting article. Many years ago I worked in the King of Prussia PA area, down the road from MOS technology. I had the pleasure of meeting Will Mathus who was one of the designers of the 6502. He gave me a chip set to work with, a 6502 and something he called the TIM chip. The TIM chip had a small monitor code, and a I/O support set that would talk to a RS-232 terminal. The two chip set (with minor additional hardware, clock, a few resistors and capacitors, was my first computer. This was just about the time the commodore computer came out. I did not know that the chip was still in production. It is interesting to appreciate our hardware heritage.

    Nick
  5. RC Roedersays:
    I like it two. I remember going up to the MOS TEX suite at WestCon (they announces the chip there) and buying one and the set of books. I remember the chip was $25 and the hardware and software books nother $25. The chips were in a giant brandy sniffer. I stll have my original wirewrapped prototype around.
  6. Derek TPsays:
    I remember the 6502 from building my first kit computer, the UK101. Having been up all night building the thing I was tired and somehow managed to solder the socket for the 6502 onto the wrong side of the motherboard! No problem, just (carefully) bend each pin through 180 degrees - and push the chip in "from underneath". (Couldn't do that with a modern processor!) Confused the hell out of friends who knew the UK101 and could only see bare motherboard where the CPU should have been....

    Although rated at 1Mhz, the chip never complained (nor even got hot enough to need a heatsink) when I hacked my board to drive it at 2Mhz.

    Yes, the instruction set is quirky, but it works. Amazing what you can do with that "first page" addressing mode when you really try! :-)

    Derek TP
  7. Nick Besersays:
    Interesting article. Many years ago I worked in the King of Prussia PA area, down the road from MOS technology. I had the pleasure of meeting Will Mathus who was one of the designers of the 6502. He gave me a chip set to work with, a 6502 and something he called the TIM chip. The TIM chip had a small monitor code, and a I/O support set that would talk to a RS-232 terminal. The two chip set (with minor additional hardware, clock, a few resistors and capacitors, was my first computer. This was just about the time the commodore computer came out. I did not know that the chip was still in production. It is interesting to appreciate our hardware heritage.

    Nick
  8. Andy Simpsonsays:
    In my school days it was the Z80 that was the big rival of the 6502.
    I was writing assembler on the PET, my classmates Z80 assembler on the Sinclair ZX80 and much time was wasted arguing about whether the additional registers on the Z80 made it better.

    I didn't really progress and I'm still happily being paid to program some 30 plus years later whilst they went on to become physics professors and such like. Mark that up as a win for 6502.
  9. Ed LaVellesays:
    After writing tens of thousands of lines of 6502 code in those “good ol” days, I think back on that good old CPU as an early RISC processor. It had far fewer memory instructions than the Z80 or the richest of them all the 6809. (The first Macintosh prototype used a 6809). Each instruction also used very few clock cycles and it was designed without using microcode sequencing which would have helped it to scale had continued to develop to the gigahertz level. The zero-page concept was one of the most brilliant aspects of that CPU; it was almost as if you had 256 registers.

    Wish I could find a job writing code like that again...
  10. Johnner kebabsays:
    I cant believe you called the Nintendo a VCS without even acknowledging Atari. They used 6502 processors in most of their 8-bit stuff and invented the acronym VCS!
  11. Joesays:
    "And its primary competitor (the 8086) was better? With its asinine opcodes and nightmarish overlapping memory pages?"
    (Comment only edited for spelling)

    He he he. Did they teach you that in college? It was probably the same college professor that told my class that "pointers are evil". I don't know anything about the 6502 but there are quite a few compilers for the 8086. Yes that segmented memory address space (pages did not come along until at least the 286) took a little bit of work to understand and work around. So what. This is always the biggest complaint and *exactly* the reason it was so popular. It was backward compatible and so adopters did not have get all new software...

    We despise what we don't understand...
  12. dom rositassays:
    still waiting and longing for the 68000 architecture to make this sort of comeback.

    the supervisory mode which made TRUE multitasking a reality cannot be beat - don't throw me into a laughing fit
    pushing off Gates multitasking as true .... I laugh enough at all the stumbling and hesitation at every boot
    , that's multitasking by pushing up the processor speed to override all the bad coding.
  13. Nick Besersays:
    Interesting article. Many years ago I worked in the King of Prussia PA area, down the road from MOS technology. I had the pleasure of meeting Will Mathus who was one of the designers of the 6502. He gave me a chip set to work with, a 6502 and something he called the TIM chip. The TIM chip had a small monitor code, and a I/O support set that would talk to a RS-232 terminal. The two chip set (with minor additional hardware, clock, a few resistors and capacitors, was my first computer. This was just about the time the commodore computer came out. I did not know that the chip was still in production. It is interesting to appreciate our hardware heritage.

    Nick
  14. Pete Brownsays:
    @Nick

    I'm on a plane with a crappy internet connection so I can't verify, but wasn't the first real Commodore computer called the TIM-0 or something? Or maybe it was MOS? I recall it was a keypad (probably hex) a processor and some tiny amount of memory.

    Pete
  15. Jac Goudsmitsays:
    Pete, you're probably referring to the KIM-1 which was developed by MOS technology as a demonstration board for the 6502. When Commodore acquired MOS, they started working on the PET-2001 but they kept selling the KIM-1 because it was so popular.

    TIM was a chip that was produced by MOS, around the same time as the KIM-1 came out, that you could buy via mail order if you wanted to build a 6502 based computer and you wanted to put a simple operating system on board. All you needed basically was a 6502, the 6530 that had the TIM program in the ROM, some RAM and a Teletype serial terminal and you had a working computer, which, in the time where the only computers were mainframes, was a huge deal.

    You can buy a replica of the KIM-1 online at Brielcomputers.com, it's called the MicroKim. You can put it together as a kit, or you can get it pre-built. KIM-1 boards show up on eBay sometimes and usually sell for a lot of money, especially if it's one of the original MOS (pre-Commodore) ones.

    ===Jac
  16. Georgesays:
    8086 was accompanied by nice development tools from Intel like PLM-86, LINK-86 etc.
    And yes, you could compile complex C/C++ programs on it.
    There were commercial compilers from Watcom or Microsoft.
  17. Petesays:
    Watcom! I forgot all about those guys, holy cow. I remember that their C compiler and SQL Database were a hot thing back then.

    I used to do a bunch with PowerBuilder, which I recall had some integration points there, plus some optimization code from watcom.

    Pete
  18. Stevesays:
    Hi Pete,

    Embedded programming is way more fun than Windows lols but you might be pulling your hair out at times jk!! No debugger on my setup here :) Good luck with this 6502 but I do aggree with some comments here than it might be better to start with a more modern micro such as 8-bit AVRs (RISC 32 registers etc vs that 6502 or PIC). This is designed for a C compilier and you can easy start off with a dev board. As always, its what your use to!!

    68000 are still used today & renamed Coldfire which I & friend use -he wants to emulate the Amiga custom chips with a FPGA :)

    anyway, back to work,
    Steve
    OBD Systems Ltd.
  19. Petesays:
    @Steve

    These aren't my first micros :) I've done some work with AVR and AVR xMega, and will mess around with the few PICs I have sitting on my desk.

    I bought these mostly as a curiosity and to see what could be done with them.

    Thanks

    Pete
  20. Stevesays:
    Hi again, all great fun.
    Well recommend the STM32 ARM -nice dev boards and becoming industry standard (in popularity if nothing else). Will do a blog of my own to promote my website/business with our new website. Feel free to contact me anytime.

    Thanks
    Steve
    PS. Any chance of USB CDC support in metro?? For many small companies this will be missed and cause to stick to .NET/Silverlight for now.
  21. Petesays:
    @Steve

    Not counting my STM-based Netduinos, I have a few STM32 based dev boards. I have the small one from ST themselves, and then I recently picked up the MikroElektronika ARM STM32 dev board and C compiler for some projects. That board has everything you could ever ask for in a dev board. I love their stuff (I've used their AVR stuff in the past)

    USB: right now, the app, driver, and device all need to come from the same manufacturer for custom devices to work.

    Pete

Comment on this Post

Remember me