top of page
Writer's picturerehsd

My Frankensteined 6502 - Five Months In

Updated: Feb 11, 2022


Over the past five months, I have built a few 6502 computers, starting with Ben Eater's 6502 kit. See My 6502+... a little background. Along the way, I have been incrementally adding functionality to my 6502 systems. Most recently, I added a Field-Programmable Gate Array (FPGA)-based Video Graphics Array (VGA) circuit and have started developing a basic game.


In this post, I'll walk through the current state of my 6502 system.


I hope this is of some value to those of you building 6502-based systems, or minimally, of some entertainment value. :) I have thoroughly enjoyed working on this project over the months!



Learning Experience

First off, this has been a tremendous learning experience. In the past five months, I have been able to learn about:

  • Transistor–Transistor Logic (TTL)

  • Complementary-symmetry Metal–Oxide–Semiconductor (CMOS)

  • Electronic circuit design

  • Printed Circuit Board (PCB) design

  • VGA

  • 6502 assembly programming

  • Serial Peripheral Interface (SPI)

  • Programmable Sound Generators (PSGs)

  • FPGA

  • VHSIC (Very High-Speed Integrated Circuits) Hardware Description Language (VHDL)

  • Arduino

  • C programming

  • C#

  • ...and more


Current System Configuration
Current System Configuration

Systems Details

  • Core 6502 PCB

    • W65C02 8-bit microprocessor (started with Ben Eater's 6502 design) running at 5 MHz. 5-volt system.

    • 32k word x 8 bit SRAM.

    • 32k word x 8 bit ROM.

    • Two-line LCD.

    • PS/2 keyboard.

    • VGA with 100x64 resolution (based on Ben Eeater's World's Worst Video Card). Currently disabled.

    • W65C22 Versatile Interface Adapter (VIA), quantity 5.

  • Power distribution circuit

  • Improved reset circuit

  • Sound card

    • Four AY-3-8910 programmable sound generators, each supporting three audio channels (total of 6x2 stereo output).

    • 16k word x 8 bit ROM.

    • Joystick port. Can support two joysticks, currently using a single joystick. Alternatively, can support a secondary ROM.

    • Sound level display to left and right channels (i.e., bar graphs).

    • Integrated analog amplifier.

    • 2 MHz clock.

  • SPI expansion card

    • 8+ SPI ports for easy expansion to SPI devices.

    • External (from VIA) shift registers.

    • Three onboard Arduino Nanos for additional expansion. Currently unused.

  • USB mouse

    • Implemented on an Arduino Mega 2560 with a USB host shield.

    • The Arduino is connected to the 6502 core through a VIA.

  • High-speed 6502-to-PC bi-directional bridge

    • Arduino Due using Native port for Due-to-PC communication, running at full USB speed.

    • SPI through SPI expansion card for 6502-to-Due communication.

    • Dual OLED displays to display communication status.

    • 5 V to 3.3 V level shifter (Due runs at 3.3 V).

  • Arduino Mega 2560 expansion

    • Additional Arduino available for expansion. Currently unused.

  • FPGA VGA smart display

    • Currently running 800x600 at 60 Hz. Capable of 1920x1080 at 60 Hz (possibly higher).

    • VGA circuit implemented in VHDL.

    • Leverages a Digilent Arty A7-100T FPGA.

    • Running soft microprocessor core for smart display management (e.g., sprite management and drawing commands).

    • 5 V to 3.3 V level shifters (FPGA runs at 3.3 V).

  • Supporting utilities

    • Font builder.

    • Sound editor.

    • Sprite importer.

  • Programming

    • 6502 assembly and data on 6502 core ROM.

    • Data on sound card ROM.

    • C code for mouse support - on Arduino Mega 2560.

    • C code for 6502-to-PC bridge - on Arduino Due.

    • VHDL on FPGA.

    • C code for soft microprocessor on FPGA.

    • C# for supporting utilities listed above.


Video Walkthrough

Here's a video walkthrough of the current high-level design.


Supporting Utilities

Along the way, I developed a few supporting utilities that sped up the development process of the overall 6502 system.


Font Builder

In my solution, I chose to build the fonts from the ground up, both in early 6502 assembly and later in FPGA C. This simple utility allows quick drawing of font characters and then creates assembly or C code to represent the drawn font.

Font Builder
Font Builder

Sound Editor

The AY-3-8910 PSGs offer many configuration options that affect the sound output. This utility allows easy manipulation and live testing of the PSG configuration options through runtime communication to the 6502 system through the high-speed 6502-to-PC bi-directional bridge. The utility also supports creating sequences and capture MIDI data from a USB MIDI keyboard, converting the data to sequences that can be played on the PSGs.

Sound Editor
Sound Editor

Sprite Importer

This simple utility extracts ARGB data from images and formats the data into raw ROM data or C array format.

Sprite Importer
Sprite Importer

Additional Details

If you're interested in additional details, below are some links to previous, related posts.


Source Designs and Code

I have posted the current sources for this project on my GitHub. Much of this can be significantly improved, and while it may not always be the most elegant solution, I hope it can be helpful.


Source Application / Format


Questions or Suggestions?

If you have questions or suggestions, please drop me a note. Thanks!


My Next Project

I have ordered initial parts to (attempt to) build a W65C816S-based system (breadboard). This seems like a natural extension to what I have been learning on the 8-bit W65C02.


The WDC W65C816S is a fully static CMOS 16-bit microprocessor featuring software compatibility with the 8-bit NMOS and CMOS 6500-series predecessors. The W65C816S extends addressing to a full 16 megabytes. --WDC


On order: W65C816S8P-14 microprocessor, AS7C1024B-15TJC SRAM (and a DIP breakout board), and SST39SF040-70-4C-PHE flash memory.

745 views9 comments

Recent Posts

See All

9 Comments


Joe Plocki
Joe Plocki
Jan 01, 2022

Holy crap, that's awesome!

Like

Joe Plocki
Joe Plocki
Dec 31, 2021

Most definitely - I'm toying with the idea right now to have a VIC-compatibility mode in my FPGA VGA, and having copies of the C64 ROM's stored away on the massive SST39SF010A EEPROM I'm using. But... at 12-20MHz (20? Oh I hope I can do it!), I'm not sure that there's much benefit there... everything would run too fast, and there's no way I'd even try to get all the edge-case abuses that people did for performance and undocumented features. But... if I implement the documented stuff, I would have access to a great deal of existing software that would (could?) just work? Dunno. I've got to regroup when my new 6502 boards get here next week, settle in…

Like

Joe Plocki
Joe Plocki
Dec 30, 2021

So your project is helping me get back "on task", and now that I think I've got VGA figured out, I'm starting to think about sound... any tips on learning how to make sounds that sound like anything on the sound chips? Every retro system I owned when they were "current", I could produce sound, but other than very pure-tone musical notes that sounded better when disconnected from a speaker, I'm not there now, and I never was. Any tips or resources you can share?

Like
rehsd
rehsd
Dec 31, 2021
Replying to

If you're interested, I have the intro to my game music started. This was recorded from the output on my 6502 system -- once with my phone and once from the PC (with lots of noise in the recording).


Game Music Intro - YouTube


Bonus points if you can name the song. ;)

Like
bottom of page