Shiela Dixon's Prototype Add-On Turns a Raspberry Pi RP2040 Into a TMS9918A Video Card with Extras
With 40-column text, low- and high-resolution bitmap graphics, and the makings of USB keyboard support, this could be a great RC2014 board.
Developer and vintage computing enthusiast Shiela Dixon is working on turning a Raspberry Pi RP2040 microcontroller into an emulated Texas Instruments TMS9918A video display processor — complete with very modern DVI-over-HDMI video output.
"I've been using the TMS9918A chip on my RC2014 for a graphic display," Dixon explains, referring to the popular Z80-based microcomputer kit. "I also obviously use it in my MSX2014. I've come to love the chip. However, I'm a little frustrated with the composite video output of the 9918A. I'd also like a module that accepts USB keyboard input and handles the serial output, so that you can use video output from startup and interact with your operating system (eg CP/M) and use programs and utilities with serial output, whilst being able to switch to the TMS screen modes and run TMS games/utilities at any time."
While that may seem like "moon on a stick" territory, that's exactly what Dixon is setting out to build — using a Raspberry Pi RP2040 microcontroller to emulate TI's TMS9918A while adding a few new features of it own, including pixel-perfect DVI output over an HDMI connector for modern displays.
"Getting the 40-column text mode running was pretty simple, it uses two colors and I have plenty of breathing room within a 320×240 display and 8-bit color. The TMS chip's resolution is only 255p×192px, which means we have an empty colored border as per the TMS chip. From here, adding TMS Graphics Mode 1 (aka 'tile mode,' or 'screen 1') was very quick. The characters go to 8 bits wide but only 32 columns. The color is a bit limited, but a bit better than the text mode's two colours on the screen."
The bigger challenge was Graphics Mode 2, also known as 'Screen 2' — a bitmap mode supporting a 16 color palette with two colors selectable per 8×1 block. "This gave me a lot more trouble," Dixon admits. "I've spent hours puzzling over why I couldn't make this work and it turns out that it's something not documented (at least not in the TMS9918A reference documents that I have)."
"Programs that use Graphics Mode 2," Dixon continues, "appeared to send bizarre values for these registers. In this particular mode, registers 3 and 4 work differently and in each case, only a single bit indicates $0000 or $2000. Armed with this information I was able to find confirmation of this online, but only in a document that someone had written relatively recently."
While still in the prototype stage, the resulting module now includes support for text and both graphics modes, and has the makings of a way to connect the output of a USB keyboard to a serial console. "I've already designed a board that puts all of this and the feather onto an RC2014 module (will look very cool in black)," Dixon notes. "With that board I've added more logic and it should be possible to read the TMS status register, which I haven't implemented on this prototype yet but is important for running some of the demos."
Dixon's full write-up is available on the project's Hackaday.io page.