PICO9918: A drop-in replacement for a TMS9918A (with source)

Let's talk about anything related to the 6502 microprocessor.
User avatar
visrealm
Posts: 72
Joined: 18 Aug 2021
Location: South Australia
Contact:

PICO9918: A drop-in replacement for a TMS9918A (with source)

Post by visrealm »

Hi all,

I know a number of you are using (or planning to use) TMS9918A VDP in your homebrew projects (including myself). Thought I should share my new project: A drop-in replacement for the TMS9918A using a $4 Raspberry Pi Pico.

Here's a couple of videos showing it in action:

The hardware supports 12-bit VGA rather than Composite or YPrPb. Currently, I'm only implementing the original TMS9918A/TMS9929A, though I could certainly look into implementing some of the awesome F18A features in the future.

The PICO9918 is much easier to hook up than a TMS9918A since the VRAM and Clock is all handled in-house. I'm at an early stage hardware-wise where I'm using an off-the-shelf Pi Pico. I plan to incorporate the RP2040 directly in a future revision, further shrinking the package.

I've shared all the source code on GitHub: https://github.com/visrealm/pico9918
Cheers
Troy

[My introduction]
barnacle
Posts: 1831
Joined: 19 Jan 2004
Location: Potsdam, DE
Contact:

Re: PICO9918: A drop-in replacement for a TMS9918A (with sou

Post by barnacle »

Interesting, Troy.

Though I was unable to view the videos on Youtube; instead I got unskippable video game spam, and get-rich-quick spam in German, and nothing else. I had to use FreeTube to view the actual videos (which appear impressive though I'm not familiar with the capabilities of the chip itself).

Neil
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: PICO9918: A drop-in replacement for a TMS9918A (with sou

Post by BigEd »

(Just to note, the youtube videos work for me)

Nice work Troy! The Pico is a great thing very suitable for retro projects.
User avatar
visrealm
Posts: 72
Joined: 18 Aug 2021
Location: South Australia
Contact:

Re: PICO9918: A drop-in replacement for a TMS9918A (with sou

Post by visrealm »

barnacle wrote:
Though I was unable to view the videos on Youtube; instead I got unskippable video game spam, and get-rich-quick spam in German, and nothing else.
That's a shame (and completely out of my control).

They're genuine YouTube links - I don't get any ad money, or anything else from YouTube. If YT places unskippable ads on them, I can't change that unfortunately. :(

Glad you persisted though :)
BigEd wrote:
(Just to note, the youtube videos work for me)
Good to know. Thanks, Ed.
Cheers
Troy

[My introduction]
barnacle
Posts: 1831
Joined: 19 Jan 2004
Location: Potsdam, DE
Contact:

Re: PICO9918: A drop-in replacement for a TMS9918A (with sou

Post by barnacle »

Thanks Troy; not sure what happened there. It looked like YT replaced your videos entirely with spam videos instead... odd, because I have adblockers active when I use YT exactly to avoid that.

What I need to do now is find a convenient guide to bit tickling with the RP2040...

Neil
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: PICO9918: A drop-in replacement for a TMS9918A (with sou

Post by BigEd »

There's an enormous datasheet but it's well written and well organised. It has a whole chapter on the PIO engines and twenty pages of examples
https://datasheets.raspberrypi.com/rp20 ... f#page=344
Edit: also a chapter in the SDK docs
https://datasheets.raspberrypi.com/pico ... df#page=31

There's the code for this project, of course
https://github.com/visrealm/pico9918

There are also other existing open source projects which interface with 8 bit busses, for example
https://github.com/oliverschmidt/a2pico
https://github.com/dp111/PicoTube
https://github.com/hoglet67/pico_bus6502
https://github.com/hoglet67/pico-swram

Dive into the code and have a look around at what's been done...
barnacle
Posts: 1831
Joined: 19 Jan 2004
Location: Potsdam, DE
Contact:

Re: PICO9918: A drop-in replacement for a TMS9918A (with sou

Post by barnacle »

Thanks, ploughing through the 'getting started' docs.

I may be some time...

Neil :mrgreen:
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Re: PICO9918: A drop-in replacement for a TMS9918A (with sou

Post by BigEd »

Oh, for those who like videos, here's a playlist, seems sensible and well-paced:
User avatar
visrealm
Posts: 72
Joined: 18 Aug 2021
Location: South Australia
Contact:

Re: PICO9918: A drop-in replacement for a TMS9918A (with sou

Post by visrealm »

Had a number of people asking about 80 column mode too. So, I added that this evening:

https://www.youtube.com/watch?v=qdCapu0CVJ8
Cheers
Troy

[My introduction]
barnacle
Posts: 1831
Joined: 19 Jan 2004
Location: Potsdam, DE
Contact:

Re: PICO9918: A drop-in replacement for a TMS9918A (with sou

Post by barnacle »

That PIO is looking very interesting... I think I need to get one of these. Or indeed, more than one, since I'm bound to break some.

But I fancy a graphics co-processor; spitting out 16-level greyscale at 640x480 VGA would appear to be easily within the bounds of possibility. Add a side order of 6800 bus and serial and PS/2 all in one part - there's a lot to recommend it.

Neil
rwiker
Posts: 294
Joined: 03 Mar 2011

Re: PICO9918: A drop-in replacement for a TMS9918A (with sou

Post by rwiker »

Awesomer and awesomer!

The RP2040 really seems to be a versatile part (in the right hands... I have on two RPI picos, but haven't done anything with them).
User avatar
visrealm
Posts: 72
Joined: 18 Aug 2021
Location: South Australia
Contact:

Re: PICO9918: A drop-in replacement for a TMS9918A (with sou

Post by visrealm »

barnacle wrote:
That PIO is looking very interesting... I think I need to get one of these. Or indeed, more than one, since I'm bound to break some.
PIOs are great!

I'm using them for the VGA output, combined with DMA, so that's fairly hands-off (or CPUs-off perhaps?) once you set it going. Just need to provide it with a scanline of RGB data via an interrupt/callback whenever the PIO requests it.

I'm also using PIOs to generate the GROMCLK and CPUCLK output signals. These are just square waves at a set frequencies (~470KHz and ~3.4MHz). Once again, set up the PIO, tell it what to do and off it goes - set and forget.

I'm not using PIOs for BUS interactions. Here, I'm using a GPIO interrupt handler which is triggered when the READ or WRITE signals change. It (very quickly ~32 clock cycles max for a 4MHz bus) handles the request.

There are two CPU cores. One is pretty much twiddling its thumbs, waiting for interrupts from the VGA PIOs. The other is frantically generating scanlines.
rwiker wrote:
Awesomer and awesomer!

The RP2040 really seems to be a versatile part (in the right hands... I have on two RPI picos, but haven't done anything with them).
Thanks!

100%
Cheers
Troy

[My introduction]
barnacle
Posts: 1831
Joined: 19 Jan 2004
Location: Potsdam, DE
Contact:

Re: PICO9918: A drop-in replacement for a TMS9918A (with sou

Post by barnacle »

Pretty much the same as I had in mind. I'll order a couple up when I get back from this trip to Italy (take a 30-year old car from the UK to Turin via Berlin and meet up with some old friends)
okwatts
Posts: 110
Joined: 11 Nov 2020
Location: Kelowna Canada

Re: PICO9918: A drop-in replacement for a TMS9918A (with sou

Post by okwatts »

Looking forward to seeing if this migrates to the Pico-56 (at least the software side) not sure if that is possible or in the plans. For those looking at the Pico there is active development using MMBasic (https://geoffg.net/picomitevga.html) that is fun in its own right as well as exposing the hardware interface (I2C,SPI, etc) to basic makes quick and easy interfaces without Python or C required.
User avatar
cbmeeks
Posts: 1254
Joined: 17 Aug 2005
Location: Soddy-Daisy, TN USA
Contact:

Re: PICO9918: A drop-in replacement for a TMS9918A (with sou

Post by cbmeeks »

visrealm wrote:
Hi all,

I know a number of you are using (or planning to use) TMS9918A VDP in your homebrew projects (including myself). Thought I should share my new project: A drop-in replacement for the TMS9918A using a $4 Raspberry Pi Pico.

Here's a couple of videos showing it in action:

The hardware supports 12-bit VGA rather than Composite or YPrPb. Currently, I'm only implementing the original TMS9918A/TMS9929A, though I could certainly look into implementing some of the awesome F18A features in the future.

The PICO9918 is much easier to hook up than a TMS9918A since the VRAM and Clock is all handled in-house. I'm at an early stage hardware-wise where I'm using an off-the-shelf Pi Pico. I plan to incorporate the RP2040 directly in a future revision, further shrinking the package.

I've shared all the source code on GitHub: https://github.com/visrealm/pico9918
You sir, just made my decade. I've been doing a lot of VGA work with the Pico lately (well, been a few months).

https://github.com/cbmeeks/VgaPico

The primary goal for my VgaPico project was to have some sort of "drop in" video chip for homebrew computers. I always wanted it to lean towards the TMS9918 as that is a passion project of mine (https://github.com/cbmeeks/TMS9918).

Once I learned about the Pico and saw what it could do, I was convinced it's what I wanted to use. FPGA is just too hard for me and other micro-controllers seem to have too many hurdles (at least for me).

Thanks!

I will be watching this very closely.
Cat; the other white meat.
Post Reply