TMS9918A Emulator for Parallax Propeller-2

Written April 21st, 2021 by

A few weeks ago I purchased a P2 Edge card equipped with the new Parallax Propeller-2 microcontroller. To practice and familiarize myself with the new features, I ported the emulator for the TMS9918A chip from Texas Instruments that I made for the Propeller-1.

Like the previous P1, also this new microcontroller, named P2X8C4M64P, is equipped with 8 independent cores, but the similarities ends there because the characteristics are significantly different: we have 512 KByte of RAM (hub) memory, a clock frequency that can reach up to 250 MHz and 64 “smart” GPIO pins able to perform some advanced functions almost completely independently. Furthermore, the internal architecture has been improved so much that it can execute almost every instruction in 2 clock cycles (instead of 4 like the previous one) and access the shared hub (main memory) much more quickly.

P2-Edge Module (from Parallax web site)

P2-Edge Module (from Parallax web site)

All these advanced features allowed me to build a complete TMS9918A chip emulator with full support for text, graphics 1 and 2 and multicolor modes, including sprite, collision handling and fifth sprite indication. It also integrates support for viewing on composite or s-video TVs and VGA monitors. All using a single COG (core). In practice it could be used to create an emulator for MSX computers or Colecovision consoles.

The following screenshots were obtained using the new debug function of the Propeller Tool development environment.

TMS9918A Modo Testo

TMS9918A Text Mode

TMS9918A Modo Grafico

TMS9918A Graphic Mode 2 with Sprites

It should be noted that this is not a 100% perfect emulation, in particular the timings may not correspond with those of the original chip and some “tricks” used to create special effects or circumvent the limitations may not work correctly.

The source is available on GitHub under the MIT license.