Neo6502- Open Source Hardware Modern Retro Computer Project


I will admit, I have a sentiment for retro computers. This is probably because my career in IT started many years ago with the Bulgarian Apple ][ clone called IMKO2, later renamed to Pravetz 82.

This is also one of the reasons Olimex stepped into the AgonLight production.

AgonLight sparked a lot of enthusiasm and activity, not only here at Olimex. Bernardo Kastrup hit the sweet spot of the Retro Computer maniacs by offering them a small, fast, feature-packed real Z80 machine with plenty of memory. The Facebook group already has close to 1000 members!

There are a lot of posts about why not having a 6502-based machine, and Kyle (mos_8502), Rebecca (RenewedRebecca) and Bernardo (TheByteAttic) are already working on a W65C265 version using the same ESP32 FabGL-based video and audio system.

Two weeks ago, I started thinking, as an engineering challenge, is it possible to build a modern peripheral 6502 computer that is with the lowest possible cost.

Then I put the minimal requirements for my 6502 computer:

  • It must have a real 6502 processor.
  • It must have a minimum of 64KB of RAM.
  • This computer must run as fast as possible. People confirm that the W65C02 from WDC can be overclocked up to 16Mhz. On the other hand, a lot of software depends on instruction execution time for loops, so the possibility to run at a lower 1Mhz clock will ensure backward software compatibility. This can be achieved with a variable clock that can be set by 6502 software.
  • The computer must have a modern video interface like DVI/HDMI so that you can connect it to your home TV or modern monitor.
  • Support for a modern USB keyboard.
  • A sound synthesizer like the popular C64 SID.
  • The power supply should be via a USB-C connector so that you can use any phone charger with a USB-C cable.
  • A UEXT connector with modern interfaces like UART, I2C, SPI.
  • Disk storage for code.
  • The 6502 bus should be available on a slot/connector so that additional hardware can be easily added on.

The final requirement is to design such a system to be at the lowest possible price, making it an easy purchase decision, similar to what the Raspberry Pi did with a price of $25-30.

This is a good hardware engineering challenge!

After some research I have decided to use the Raspberry Pi’s new dual-core Cortex-M0 RP2040 as an emulator for everything except the 6502.

The RP2040 will emulate:

  • The RAM memory. The RP2040 has 264KB of RAM, which is plenty of RAM to hold the emulator code and at least 64KB for the 6502. As the RP2040 runs at 133 MHz, there will be no issue serving the slow 6502 with memory read/write operations. If there is more RAM left, we can implement some kind of bank switching, such as 56KB of continuous RAM from $2000-FFFF and switchable RAM banks for $0000-1FFFF. Alternatively, we can define a pointer and block size somewhere in the upper memory location, which can overlap different RAM segments at any address at any time. After all, what the RP2040 will serve at a given address depends only on the pointer, which will show where this data needs to be fetched from.
  • Initially, I thought of using the Si5153 programmable oscillator, which can clock from 250kHz up to 100MHz, but after checking the RP2040 PWM specs, I found that the RP2040 can also generate a programmable clock for the 6502 from 0 up to 100MHz. This saves us one more IC!
  • There is already a DVI generation project with RP2040 called picoDVI, which supports 640×480 pixel resolution with RGB565 16-bit color depth. This project loads about 60% of one of the cores in RP2040.
  • RP2040 has USB host capability, so there are no issues whatsoever in connecting a USB keyboard to it.
  • There are already RP2040 SID player projects that exist and can be reused for sound generation, such as picoSID.
  • Although the UART, I2C, and SPI are interfaces that the 6502 originally did not have, we can catch memory location read/write exceptions with RP2040 and emulate a classic PIA or ACIA. Alternatively, we can define some API in memory to access I2C and SPI buffers.
  • As for disk storage, RP2040 will have 2MB of external SPI flash to hold the firmware, but there will be a lot of free space. The Apple ][ 5″ floppy was holding the humble 114KB, so around 10 classic floppy discs could fit in a little more than 1MB.

One week ago, I posted my idea on the Homebrew 6502 Facebook group and received more than 100 replies with valuable comments and suggestions.

To summarize all the feedback and prevent redundant discussions, here are the FAQ:

Q: Why not emulate the 6502 with RP2040 as well?
A: Emulating memory or ACIA PIA is simple, but the 6502 is a complex state machine, and an emulator will never be 100% accurate. Even N6502 and W65C02 have differences, and we want to have a REAL processor.

Q: Have you checked the CommanderX16 project? You may get inspiration from it.
A: I have seen this project, but it is over-complicated, expensive, lacks modern peripherals, and is slower compared to what I want to achieve. This is going to be a MODERN 6502 computer. The CommanderX16 has no modern interfaces like USB keyboard, HDMI, SID Sound, or SPI/I2C. Additionally, the CommanderX16 costs $500, while we aim to target a $25-30 board.

Q: Why not make it with VGA? I have one in the basement.
A: We want Neo6502 to be a MODERN computer, and VGA is 40 years old technology.

Q: Why not use W65C265S or W65C816S, etc.?
A: These are not 8-bit and have more address lines to deal with, which will make the design more complex and far from the rock bottom price goal. For those who want a W65C625 computer, Kyle, Becky and Bernardo are already working on Agon X65.

Q: Why not Kickstart it?
A: Although Kickstarter is a great advertising platform, it has its cost. Kickstarter/PayPal combination takes 20-30% of the collected funds. We target rock bottom costs for our customers and count every cent, so we will not inflate the prices with 20-30% to use the platform.

Q: Do you have firmware developers for it?
A: Not yet, so any help and collaboration are welcome. I have already obtained all the parts together and will have a proof of concept on a breadboard this weekend. Then, we will design PCB and some prototypes in a few weeks. If you want to participate in software/firmware development for both RP2040 and 6502, you are welcome to join us! We will have some free early prototypes to send to developers. Send us email to info at olimex dot com.

Tsvetan

36 Comments (+add yours?)

  1. John Gay
    Apr 21, 2023 @ 16:09:26

    Certainly sounds like fun!
    I grew up as a Z-80 fan, which is why I loved the Agon from the start.
    Never really warmed to the 6502 family.
    My next obsession was the 68000 family instead.
    I loved that internally it was a 32 bit design despite the initial 16 external buss. But I was too poor to get any of the great 68k computers of the day.
    Amiga really captured my attention, but by then I was working with either IBM PCs of military computers.

    So I will enjoy watching your project, but I probably won’t jump in on it.
    But if you even decide to try a 68k based machine, we’ll that’s another story!

    Reply

  2. @blagovest@social.petrovs.info (@eniac111)
    Apr 21, 2023 @ 16:26:37

    A custom wooden/plastic box in retro design with screen would be nice for these boards 🙂

    Reply

  3. Amr Khaled
    Apr 21, 2023 @ 21:22:35

    Hi, I am eager to join so can you tell me the procedure to join ? 😄

    Reply

  4. Matej
    Apr 21, 2023 @ 21:27:24

    Love it! I have Atari also Apple2, C64. Yes RPi like 6502 will be amazing! Will post on Atari and Apple forums.

    Reply

  5. Neil
    Apr 21, 2023 @ 23:03:56

    Can you please include stereo output, it’s really disappointing that the Agon is mono (no one one have missed one GPIO on the expansion connector) and filtered at 17Khz.

    Reply

    • OLIMEX Ltd
      Apr 21, 2023 @ 23:12:31

      the RP2040 GPIO ports in this project are very valuable! everything is very tight and I don’t think we have spare pin for stereo sound.If we make stereo we will have to sacrifice UART or I2C or SPI which I find much more useful than stereo sound!
      EDIT: external stereo codec can be connected to UEXT/SPI so stereo would be very much possible but not on-board

      Reply

      • Neil
        Apr 21, 2023 @ 23:33:43

        I totally forgot how few IO’s the RP2040 has so no worries.

        Would it be possible to connect a stereo DAC (something like the PT8211 as it can be driven by SPI or even bitbanged), if so maybe you could sell an optional board this would allow users to get higher quality sound for a few dollars.

      • Matej
        Apr 22, 2023 @ 12:36:54

        For advanced musicians simply use MIDI Wavetable (Sounds like Soundblaster AWE64) UEXT soundcard – MP3 https://www.olimex.com/Products/Modules/MP3/MOD-MP3-X/

        Or in future is possible UEXT – 2xSID socket UEXT – 2xATARI POKEY UEXT – DMA PCM like AMIGA 500 or even
        UEXT – OPL3 FM+DAC etc also soundcard can be with standard 2x ATARI / SEGA 9pin cannon JOYSTICK game ports for example.

  6. Neil
    Apr 21, 2023 @ 23:51:28

    the optional board would plug into the UEXT connector [forgot to say that on the last post]

    Reply

  7. SK
    Apr 22, 2023 @ 00:06:43

    Probably a rookie question, but wouldn’t the DVI/graphics part eat up a lot of RAM (to the point of now RAM left for other meaningful processes)?

    Reply

  8. Dave Gilbert
    Apr 22, 2023 @ 00:54:47

    If you wanted to define an emulation interface you could emulate the BBC Tube ULA and then run the normal Tube ROMs.
    (Now hey I’d say the rest of the hardware is hard to get the emulation right for as the CPU, but there again I wrote a BBC B emulator ~25 years ago )

    Reply

  9. U.P.A.
    Apr 22, 2023 @ 13:20:43

    Reply

    • OLIMEX Ltd
      Apr 22, 2023 @ 13:50:18

      Neo6502 will be small elegant credit card size computer. There will be no space for 10 cm long PTH connector. The bus will be SMT type boxed connector for ribbon cable same as the one used in AgonLight. Then there may be RC2014, Apple][ slot or whatever anyone else standard on small additional board but please do not ask me to put this antic on modern small SMT only components board 🙂

      Reply

  10. Chris Ainsley (@ainslec)
    Apr 22, 2023 @ 16:52:10

    Sounds absolutely ideal. Are you looking at manufacturing these too? Roughly what level of graphics performance would you be looking at from this in terms of sprites / per-scanline effects? NES? SNES?

    Reply

    • OLIMEX Ltd
      Apr 22, 2023 @ 17:00:21

      I think we are far away from manufacturing right now, first there will be prototypes to proof the concept then to model the architecture the APIs between 6502 and RP2040 etc. The firmware have to be developed for both 6502 and RP2040. M anufacturing is the easiest part.

      Reply

  11. Nom
    Apr 22, 2023 @ 22:48:45

    Have you considered using two RP2040, such that one could be dedicated for graphics in order to allow decent resolutions? You mentioned 640×480 from picoDVI, but from what I remember having read about that, it used up most of RP2040’s RAM and required overclocking, so it would be nice to have these concerns separated from the remaining components that shall be emulated. And 640×480 is already very low for a modern computer.

    Reply

    • OLIMEX Ltd
      Apr 23, 2023 @ 00:29:41

      640×480 is not mandatory, lowest cost is the challenge. 6502 computer I worked with had 280×192 8 colors 🙂 we can go to 320×240 256 colors and start from there. adding second chip and sync them together will eat even more GPIOs which are valuable and will bring questionable performance. After all 6502 will run at 8-16Mhz max and with 64KB main memory, what you can put as images in 64KB? Why would you need fancy resoutions for 8 bit machine with limited RAM?

      Reply

      • SK
        Apr 23, 2023 @ 22:44:01

        > adding second chip and sync them together will eat even more GPIOs

        Why do you need to sync them? Clock? If one is dedicated to just video, and the other to audio+RAM+I/O you might actually get more free GPIOs in total.

      • OLIMEX Ltd
        Apr 23, 2023 @ 23:08:51

        “Why do you need to sync them? ” you have 3 processors talking to one bus, how they will talk if not sync-ed?

  12. zoranc
    Apr 24, 2023 @ 13:51:18

    I am thinking of this project a lot lately. Especially the graphic part. It can do really a lot of cool things. Like run a very nice tiled graphics. 8×8 tiles would give it 80×60 text mode out of the box just like with the C64. Add sprites and one can port all NES games to it. With full memory and hardware virtualisation one can simulate most 8bit computers and gaming consoles, and run 95% of their software (baring the differences in their 6502). This is one potential route to go.
    Another is to add couple of ports for gaming controllers and make it a full fledged console. Then one can insert the old school style PCB cartridges.
    Do you intend to add uSD card support? Now many USB port there will be? Case would be really cool to have at a later stage.
    At any rate I find it exciting to have to squeeze the last cycles and bytes from the system and create cool software.

    Reply

    • OLIMEX Ltd
      Apr 24, 2023 @ 16:17:10

      Indeed, everything is virtual beside 6502 so you can actually mimic any retro computer console etc. Just one USB will be provided, to be used with keyboard. SD-card can be easily add on UEXT port. Same for the Game controllers. We will keep the base hardware to the minimum, whoever want to have this or that added can use the UEXT where is I2C SPI and UART, or the 6502 BUS which will be also available on 34 pin ribbon cable connector, so one can add external board connected with ribbon cable to the base board and have Apple][ slot or C64 or RC2014 and whatever he like external bus

      Reply

      • zoranc
        Apr 25, 2023 @ 11:34:48

        I guess it really depends who you target audience is. If its hardware hackers and 6502 fanboys this is perfect device. But there is also huge market for retro nostalgia including myself, and for majority of those people I believe it means “this great game I played when I was younger, and it would be great to try it again”. For me it is keyboard controlled game on Apple ]{ clone, but that’s rather the exception. Most home computers of the era had a joystick for games and consoles usually had only dpads. If it was me I’d put in 3 USB ports and an uSD, but even e single extra USB port will go a long way connecting the modern d-pad, a mouse or even a USB storage device to upgrade the firmware.
        I love the huge amount of accessories you offer for UEXT port and they would cover most of the needs but there is advantage of having it all out of the box.

        Again it’s your project and I highly appreciate and am impressed with your striving for the lowest price especially for the 1. gen devices, and it is very difficult to strike the right balance between the features and the price. In any case I am looking forward to the first prototypes! It is going to be an amazing system for sure!

    • OLIMEX Ltd
      Apr 25, 2023 @ 22:11:03

      “With full memory and hardware virtualisation one can simulate most 8bit computers and gaming consoles, and run 95% of their software (baring the differences in their 6502). This is one potential route to go.”

      Thanks for the good idea! So far I was just thinking to build something from scratch, a new modern computer incompatible with anything else, but your comment made me think in this direction. You are right, we can have software virtualization for any old retro computer by emulating their memory space and peripherals, so we can have different RP2040 firmware which to convert Neo6502 in Apple][ or Commodore or any other 6502 retro machine!

      Reply

  13. Wonderdog
    Apr 25, 2023 @ 02:12:20

    64 or 256 colour 320*240 sounds great, even better if its a programmable pallette.

    You’re right that the firmware will be key here – along with clear out of the box info on how to utilise the video/audio subsystems in 6502 assembly.

    Reply

  14. Salvador Limones
    Apr 25, 2023 @ 18:08:22

    I would leave the RP2040 on-board SRAM for a framebuffer and add a 256kB (or 512kB) SRAM chip for the 6502 to use as general purpose RAM. 64kB is quite limiting even for a 6502 computer. The later revisions of pupular 8-bit computers like the Apple ][, ATARI, Commodore, Spectrum had at least 128kB.
    320x240x8bpp is good enough for games. The amount of RAM and the speed of the computer makes higher resolutions and color depths pointless. It would be nice to have 80×25 text mode, though. And maybe a 640x480x1bpp or 4bpp for “business applications”.
    The PicoMite-VGA project is a good example for a well-ballanced low-cost computer.

    Reply

  15. Ron
    Apr 26, 2023 @ 12:03:08

    All I can say is sweeet

    Reply

  16. Findecanor
    Apr 28, 2023 @ 20:45:48

    Emulating memory-mapped hardware with a powerful microcontroller is what I had thought from the start that the Commander X-16 should have done.
    … but writing the firmware could be a bit of a challenge.

    A few suggestions:
    Hardware scrolling (like NES and SMS). Hardware sprites are less important.
    Provide a programmer-friendly I/O interface: Bitfield for keyboard state.
    If mouse support, provide wrapping X,Y counters like the Amiga chipset did.

    Reply

  17. Pawel
    May 28, 2023 @ 17:24:13

    I want one or two, please 🙂

    Reply

  18. Rien
    Jun 04, 2023 @ 21:39:04

    Intriguing idea. I immediately made myself a POC on a breadboard. However performance is not what I expected. Just under 1Mhz. But no optimization’s in place. The POC runs WOZMON + Apple 1 Basic. Funny!

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: