Close
0%
0%

Homebrew 6502 on a backplane

Troy's HBC-56
A homebrew 8-bit computer with a backplane. Initially with a 6502 CPU card, a TMS9918A VDP and dual AY-3-8910 audio.

Public Chat
Similar projects worth following
A custom 8-bit backplane build initially running a 6502 CPU and includes a TMS9918 VDU.

Introduction

After building a breadboard CPU and getting it to run Snake, I decided to do something different. 

I'd done some coding for the Commander X16, so was interested in starting out with a 6502-based homebrew computer. My childhood machine was a TI-99/4A, so wanted to try out a TMS9918 for video output.

All source code, schematics and tools I've built for the project are available on GitHub: github.com/visrealm/hbc-56


Hardware

I've always wanted to do a backplane build and also wanted to try my have at PCBs, so started by designing a custom backplane and custom proto cards for it. The backplane consists of a 56-pin bus, hence the name: HBC-56 (HomeBrew Computer 56)

So far, I've built up 7 cards on the proto boards:

  • Three-way clock module heavily inspired by James Sharman's design. 
  • 6502 CPU card
  • RAM/ROM card with 32KB of each.
  • LCD card (with support for graphics LCD)
  • TMS9918 display card
  • Dual AY-3-8910 sound card
  • PS/2 keyboard and dual NES controller card

Software

I have written an initial Kernel to bootstrap the machine and help with interfacing with the various hardware modules. It is also possible to run the machine raw (without the kernel)

The project includes a number of example programs to test out the various hardware modules. It also includes a port of EhBASIC and an Invaders clone (WIP).

All of the software is available on GitHub: github.com/visrealm/hbc-56


Emulator

To aid in software development, I have also build an Emulator for this machine. 

The emulator includes support for all of the hardware modules, including the TMS9918, the LCD card (in character LCD or graphics LCD mode), input and audio. It also includes an integrated debugger which allows you to step through disassembled code with labels.

You can try the emulator in your browser here: https://visrealm.github.io/hbc-56/emulator/wasm

Full details on the emulator here: github.com/visrealm/hbc-56/emulator


Videos

tms9918a_vdp_v0_1_sch.pdf

TMS9918 card schematic

Adobe Portable Document Format - 174.45 kB - 12/08/2021 at 00:31

Preview
Download

ramrom_v0_1_sch.pdf

RAM/ROM card schematic

Adobe Portable Document Format - 149.01 kB - 12/08/2021 at 00:31

Preview
Download

lcd_v0_1_sch.pdf

LCD card schematic

Adobe Portable Document Format - 100.02 kB - 12/08/2021 at 00:31

Preview
Download

clock_v0_1_sch.pdf

Clock card schematic

Adobe Portable Document Format - 111.30 kB - 12/08/2021 at 00:31

Preview
Download

6502_v0_1_sch.pdf

6502 CPU card schematic

Adobe Portable Document Format - 116.27 kB - 12/08/2021 at 00:30

Preview
Download

View all 10 files

  • PS/2 Keyboard and dual NES controller card

    Troy Schrapel4 days ago 0 comments

    I've finally gotten around to building out a card to hold my PS/2 keyboard controller and dual NES controller ports. This circuit has been hanging off the front of my build on breadboards for months!

  • BASIC for my 6502

    Troy Schrapel12/12/2021 at 00:24 0 comments

    So, now I have a keyboard, I decided to do something to make use of it. BASIC seems appropriate, so I "ported" EhBASIC to my system, including TMS9918, character LCD and 128x64 graphics LCD drivers.

    In doing so, I discovered a bug in my emulator. The BIT opcode in the 6502 library I was using didn't set the processor flags correctly. So, I tracked that down and fixed it.

    All the code is available and you can follow along using my HBC-56 emulator (also in the GitHub repo).

    If you've been thinking about BASIC for your 6502 build, it's not too hard to do.

  • A spin 'round my 6502 backplane and various cards.

    Troy Schrapel12/05/2021 at 04:29 0 comments

    I've had a number of people asking for a better look at the backplane and cards. Here's a quick spin around Troy's HBC-56. A quick tour...

  • Added a Keyboard to my 6502 using a PIC MCU

    Troy Schrapel11/29/2021 at 12:32 0 comments

    My build has had input in the form of a NES controller for a while now, but that's a bit limiting. Time for a keyboard. 

    After watching Ben Eater's PS/2 videos, I decided to add support for PS/2, but to expand on my skillset, I decided to implement the PS/2 controller using a PIC microcontroller. Something I've never user before.

    I ordered a bunch of PIC16F627A's from AliExpress and got to work. There was a bit of a learning curve for PIC assembly, but once I got my head around the instruction set, it was fairly straight-forward. 

    My keyboard controller contains a 16 byte circular buffer and outputs the head of the queue in parallel using an interrupt pin.

    I cover the process in some detail in the above video.

    More improvements are planned to the keyboard controller and the rest of the build.

    Stay tuned :)

  • An emulator for my 6502 + TMS9918A build

    Troy Schrapel09/09/2021 at 03:39 0 comments

    I've started work on an emulator for my 6502-on-a-backplane with a TMS9918.

    I started out by writing a TMS9918A emulator in C. Created that in a separate repo since others might find it useful: https://github.com/visrealm/vrEmuTms9918

    Then I found existing code to emulate the 6502 and the AY-3-8910. Cobbled it together with rubber bands and sticky tape to produce a working emulator for my machine. I've updated the 6502 code to include instruction timing information which allows me to run the emulator at the same speed as my real machine (currently 4MHz).

    I've started building out an embedded debugger/disassembler for it which can be docked to the right-side of the display window. Making use of the label map files produced by ACME assembler, I can step through the code with (most) labels. Very handy.

    I've also added some other debugging regions to see the contents of RAM, the state of the TMS9918 registers and VRAM contents.

    All source code and schematics: https://github.com/visrealm/hbc-56

  • First Game!

    Troy Schrapel08/19/2021 at 04:30 0 comments

    Started work on an Invaders clone in 6502 assembly. Heavily inspired by the classic TI Invaders. Fitting since it uses the same VDP (TMS9918A).

    My 6502 is currently running at 4MHz which leaves plenty of time in the VSYNC blanking area to update the display. Responding the the sync interrupt of the TMS9918A.

    Running in the VDP's Graphics I mode. Everything on the screen except for the player ships and the bullets are text glyphs. The player ships and bullets are hardware sprites. The reason being the TMS9918A only supports 4 sprites on a scanline. Because of this, I can't use the hardware sprite collision detection, so will need to roll my own.  Currently only tile-level collisions are implemented, but I will get to adding pixel-level collisions soon.

    Work remaining:

    • Pixel-level collisions (mentioned above)
    • Aliens able to shoot back ;)
    • More invaders - level progression
    • The UFO bonus

    All source code for the game in its current state is available: https://github.com/visrealm/hbc-56

View all 6 project logs

Enjoy this project?

Share

Discussions

bradley.bell wrote 09/30/2021 at 09:25 point

Looks nice, I'm starting something similar, and i may borrow some of these concepts

  Are you sure? yes | no

Troy Schrapel wrote 10/05/2021 at 03:55 point

Thanks, Bradley. All the best with your build.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates