Jump to content
IGNORED

Introducing the PICO9918 - a TMS9918A drop-in replacement powered by a Pi Pico


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.

 

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!

 

 

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:

 

 

Edited by visrealm
  • Like 19
  • Thanks 6
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

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 2
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 5
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 4
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...