Jump to content
IGNORED

PICO9918 - a TMS9918A drop-in replacement powered by a Pi Pico (RP2040)


Recommended Posts

Posted (edited)

Hi all,

 

Very excited to share a quick video showing off my new project. A drop-in replacement for the TMS9918A using a $4 Raspberry Pi Pico. 

 

So chuffed with this, I had to record a quick-and-dirty video (I'm puffing a bit due to the excitement). Here's the (unlisted) video recorded just after the first power-on.

 

 

The hardware supports 12-bit VGA. Although, currently, I'm only implementing the original TMS9918A, I could certainly look into implementing some F18A features in the future. Update: It now supports F18A display modes and GPU.

 

As always, I'll be sharing all source code and details on GitHub soon enough. If you're interested in this, you can follow me there: https://github.com/visrealm

 

Cheers!

 

Compatibile devices (Tested on as at 2024-11-10)

 

 

Homebrews:

 

Incompatibile devices

 

None (so far)

 

Update 2024-06-10

 

GitHub repository for this project is now public: https://github.com/visrealm/pico9918

 

Here's a full run-through of the awesome "Don't mess with Texas" mega demo with the PICO9918 v0.2 prototype in my TI-99/4A.

 

 

Update 2024-06-11

 

Had a number of people asking about 80 column mode support, so I thought I should give that a go:

 

 

Update 2024-06-25

 

I have just released the Gerbers for the PICO9918 PCB v0.3. I've been running tests continuously for a week or so on this revision and it is working great. 

 

I've been thinking about how to go about getting this tested on more machines as I've only tested on two TI-99/4A's (PAL and NTSC) and my HBC-56. I might produce a few of these to send out to those who are willing and able to try it on a wider range of machines. Let me know if you're interested in this.

 

Note: This PCB revision is not representative of the final release which will be a single board without the need to the piggy-backed Pi Pico board. However, v0.3 is fully functional. If you're a tinkerer or early-adopter type, go ahead and give it a go. If not, I suggest waiting.

 

Update 2024-07-12

 

PCBs for v0.4 (the single board RP2040 version) have arrived. Still waiting on parts to assemble the first board. Given these are my first PCB using an RP2040 directly, I won't be too surprised if there are issues. 

 

image.png.af62dc6ad2052d685988f0bdf273b2d0.png

 

In other news, I've been busy working to improve the read response time. My v0.3.0 firmware has a read request response time of ~200ns. This is out of spec for the TMS9918A's published 150ns max response time, but works perfectly fine on a TI-99 due to it using the very slow GROMCLK. I spent a long time trying to get this number down, but couldn't using the GPIO interrupt method I was using. So, decided to change the approach to use PIOs to handle the VDP <-> CPU interface instead. The results are seriously impressive. I've had to run the PIOs are quarter speed to get within spec of the real chip.

 

Update 2024-07-18

 

Forum member @aotta built his own PICO9918 v0.3 from the published Gerbers and tested on his Colecovision.

 

pico9918-1.jpg.abe2ae9a659efccb8c109e9465913601.jpgpico9918-2.jpg.00f122c39ab76598ddc8215374fa7052.jpg

 

Update 2024-07-20

 

PICO9918 v0.4 PCB (single-board with integrated RP2040) tested and working:

 

 

Update 2024-08-19

 

PICO9918 v1.0 boards have arrived! 

image.thumb.jpeg.ef1555f8b6f2af62fb9b79a2ff3097a8.jpeg

image.thumb.png.7c8d46ff979c5dd0388104a60b0b5e42.png

 

image.thumb.jpeg.e52dd2d811eb4a7a867b9354176f522d.jpeg

 

These will be made available for purchase soon.

 

Update 2024-08-23

 

The first batch of PICO9918's are ready for sale. Check them out on Tindie: PICO9918 from Troy Schrapel on Tindie or from Arcade Shopper.

 

PICO9918 v0.4

 

Update 2024-09-08

 

Work on supporting more F18A features is well under way with @JasonACT having written the TMS9900 GPU core in Arm (Thumb) assembly and @visrealm working on the rendering.

 

Here's a short demo video showing the F18A support progress to date.

 

 

Update 2024-10-09

 

Preview F18A compatibility mode firmware now available on GitHub releases: Release v0.4.1-f18a-preview1 · visrealm/pico9918

 

 

 

Edited by visrealm
Supported devices
  • Like 22
  • Thanks 8
Link to comment
Share on other sites

This is awesome, congratulations!  Would you share the hardware description, i.e. how the Pico needs to be wired up?  Did you try doing away without level converters?  The Pico is not officially 5V tolerant, but inofficially said to work just fine with getting 5V inputs.

  • Like 1
Link to comment
Share on other sites

6 minutes ago, Hans23 said:

This is awesome, congratulations!  Would you share the hardware description, i.e. how the Pico needs to be wired up?  Did you try doing away without level converters?  The Pico is not officially 5V tolerant, but inofficially said to work just fine with getting 5V inputs.

Thanks, Hans. 

 

To be on the safe side and ensure compatibility, I am using level shifting logic.

 

For dedicated inputs (CSW, CSR, MODE), I'm just using a 74LVC245 transceiver. These are 3.3V, but have 5V tolerant inputs. For dedicated outputs (INT, GROMCLK and CPUCLK) I'm using a 74HC08 (I needed the and gate for something else anyway) and driving its inputs with the Pico's 3.3V IO signals - that works fine and the outputs are 5V. For I/O lines (CD0-7), I'm using [Pico <-> 74LVC245 <-> 74HC245 <-> the outside world ]. All up, there are 4 ICs.

 

I haven't tried without. I think for the cost of a few 74-series ICs, it's worth doing it right.

  • Like 5
Link to comment
Share on other sites

1 minute ago, artrag said:

How nice! I love this kind of perversions 😁

You could easily emulate the whole TI99/4a in the same board😝

That's actually how this idea started. I used a Pi Pico to emulate my homebrew computer which is a 4MHz 65C02 + TMS9918A + dual AY-3-8910 audio. visrealm/pico-56: The HBC-56 (65C02/TMS9918A/AY-3-8910 retro computer) fully emulated on a Raspberry Pi Pico (github.com)

 

Then I thought... I bet I could just use my TMS9918A library and create a replacement TMS9918A. Sure enough... turns out I could :D

 

  • Like 8
  • Thanks 1
Link to comment
Share on other sites

The Pico is such an awesome piece of kit, I have several running vga output and have wondered at the logistics of making it a 9918 replacement. And boom! Here it is. This is so awesome.

Now, somebody needs to get started on making a keyboard interface with one.

  • Like 6
Link to comment
Share on other sites

Thanks all!

 

Thought I'd give it something decent to chew on. Here's my PICO9918 running the "Don't mess with Texas" mega demo by Desire.

 

 

Very happy with this result.

 

Cheers

 

  • Like 11
  • Thanks 1
Link to comment
Share on other sites

This is awesome. I like that the code is written in C, making it reachable to people without FPGA knowledge. Maybe I could make my own F18A with more RAM? How much of the Pico's internal RAM are you using?

  • Like 3
Link to comment
Share on other sites

39 minutes ago, Asmusr said:

This is awesome. I like that the code is written in C, making it reachable to people without FPGA knowledge. Maybe I could make my own F18A with more RAM? How much of the Pico's internal RAM are you using?

I'll likely add support for F18A-like features soon. Currently using very little RAM. Primarily the 16KB VRAM and 1KB for 2x 16bit scanline buffers. Plus some performance critical code. Bugger all.

  • Like 3
Link to comment
Share on other sites

Posted (edited)

I wonder if possible v9938 features could be done. Is there enough ram for 192k?

 

Could performance be increased if need be by writing more code in assembly?

 

What about using one of the newer Pico that have a HDMI output available, I think it does 320 resolution at least.

 

At least first thing would be nice to add is basic 80 column mode like how the f18a does it. That shouldn't be too hard and still keeps it within the 16kb vram as well and not really any need for added vdp registers either.

 

Finally, have you also added the undocumented 9918 modes that are explained in the Karl technical papers like the half bitmap mode?

Edited by Gary from OPA
  • Like 6
Link to comment
Share on other sites

8 hours ago, Gary from OPA said:

I wonder if possible v9938 features could be done. Is there enough ram for 192k?

 

Could performance be increased if need be by writing more code in assembly?

 

What about using one of the newer Pico that have a HDMI output available, I think it does 320 resolution at least.

 

At least first thing would be nice to add is basic 80 column mode like how the f18a does it. That shouldn't be too hard and still keeps it within the 16kb vram as well and not really any need for added vdp registers either.

 

Finally, have you also added the undocumented 9918 modes that are explained in the Karl technical papers like the half bitmap mode?

The Pi Pico has 264KB of RAM, so I think 192K could be do-able... Just. Depends how much code we need in RAM.

 

Assembly might help, but GCC is pretty darn good at generating ARM assembly for the RP2040. Performance could certainly be improved by making my TMS9918 library more Pi Pico friendly. Currently, it's quite generic and was originally written for my Desktop homebrew computer emulator. Later ported to Web (WASM), then the Pico with very few actual code changes, so wasn't designed with embedded systems in mind.

 

My Pi Pico VGA implementation (written from scratch as well) has been tested up to 1024x768. I find for the TMS9918A, 640x480 works well with doubled pixels - 800x600 also works really well with tripled pixels, resulting in a slightly smaller border. I haven't looked into the DVI/HDMI output options yet.

 

80 column text would certainly be doable. Other F18A features could also be added relatively easily. Not sure about the virtual 9900 "GPU" - I haven't looked into the 9900 that much yet and have so far written all of my emulation libraries myself to gain a deeper understanding of whatever it is I'm emulating.

 

I haven't added support for the undocumented display modes.

  • Like 5
Link to comment
Share on other sites

32 minutes ago, visrealm said:

Hmm. I'm unable to edit the original post...

 

But for anyone interested, here's the initial GitHub repo: visrealm/pico9918: A replacement for a TMS9918/TMS9929 powered by a Raspberry Pi Pico with VGA output (github.com)

If you get a moderator to move this thread into the sub forum for development work then you should be able to edit the first post at any time.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

13 hours ago, Gary from OPA said:

Finally, have you also added the undocumented 9918 modes that are explained in the Karl technical papers like the half bitmap mode?

Half bitmap mode is obtained by address masking, and that seems to work fine on the PICO9918 since the megademo is running. The undocumented modes are bitmap-text mode, bitmap-multicolor mode, and the illegal text-multicolor mode. I haven't seen any software using either of those modes.

  • Like 5
Link to comment
Share on other sites

23 hours ago, Hans23 said:

This is awesome, congratulations!  Would you share the hardware description, i.e. how the Pico needs to be wired up?  Did you try doing away without level converters?  The Pico is not officially 5V tolerant, but inofficially said to work just fine with getting 5V inputs.

The schematic is now available in my repo: pico9918/pcb/schematic_v0_3.png at master · visrealm/pico9918 (github.com)

 

Added here too:

 

schematic_v0_3.png

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

3 minutes ago, Asmusr said:

Half bitmap mode is obtained by address masking, and that seems to work fine on the PICO9918 since the megademo is running. The undocumented modes are bitmap-text mode, bitmap-multicolor mode, and the illegal text-multicolor mode. I haven't seen any software using either of those modes.

Thanks, Rasmus

 

I was actually a little surprised the entire megademo worked. My TMS9918A library hasn't really had much of a workout before that, given I've only ever used it for my homebrew HBC-56 which has relatively basic software.

  • Like 2
Link to comment
Share on other sites

Posted (edited)
7 hours ago, Asmusr said:

Half bitmap mode is obtained by address masking, and that seems to work fine on the PICO9918 since the megademo is running. The undocumented modes are bitmap-text mode, bitmap-multicolor mode, and the illegal text-multicolor mode. I haven't seen any software using either of those modes.

 

TI Forth and all of the fbForths have two bitmap-text modes: SPLIT (bottom third of screen is text—used by the 64-column editor) and SPLIT2 (top sixth of screen is text). [Note: As explained by @Asmusr in a post below, these two modes are manipulations of the bitmap mode rather than using both text and bitmap modes simultaneously.]

 

...lee

Edited by Lee Stewart
correction
  • Like 2
Link to comment
Share on other sites

2 hours ago, Lee Stewart said:

 

TI Forth and all of the fbForths have two bitmap-text modes: SPLIT (bottom third of screen is text—used by the 64-column editor) and SPLIT2 (top sixth of screen is text).

 

...lee

Changing display modes mid-frame is no problem. The megademo shows that.

  • Like 2
Link to comment
Share on other sites

2 hours ago, Lee Stewart said:

 

TI Forth and all of the fbForths have two bitmap-text modes: SPLIT (bottom third of screen is text—used by the 64-column editor) and SPLIT2 (top sixth of screen is text).

 

...lee

Isn't that just bitmap mode where you arrange the name table (screen image table) for drawing bitmap graphics on part of the screen and text on another? The undocumented bitmap-text mode is obtained by enabling bitmap mode and text mode at the same time. You get a mode where you can draw different, monochrome, 6-pixels wide characters anywhere on the screen. This would save some VDP RAM if you want to draw bitmap graphics but don't need the colors, put the calculation of pixel addresses with 6-pixels wide characters is more complicated.

  • Like 3
Link to comment
Share on other sites

1 hour ago, Asmusr said:

Isn't that just bitmap mode where you arrange the name table (screen image table) for drawing bitmap graphics on part of the screen and text on another?

 

Indeed, it is.

 

...lee

  • Like 1
Link to comment
Share on other sites

11 hours ago, Asmusr said:

Half bitmap mode is obtained by address masking, and that seems to work fine on the PICO9918 since the megademo is running. The undocumented modes are bitmap-text mode, bitmap-multicolor mode, and the illegal text-multicolor mode. I haven't seen any software using either of those modes.

https://www.unige.ch/medecine/nouspikel/ti99/tms9918a.htm#Illegal modes 

Link to comment
Share on other sites

On 6/8/2024 at 3:46 PM, Gary from OPA said:

If you get a moderator to move this thread into the sub forum for development work then you should be able to edit the first post at any time.

I think I should do this. How do I find a moderator?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...