Close

Project log the second: multicolour mode aka screen 3

A project log for Emulated TMS9918A using RP2040/DVI

An attempt to make an RC2014 module that emulates the TMS chip, with crisp DVI output and some additional RC2014 functionality

shiela-dixonShiela Dixon 07/12/2023 at 09:220 Comments

This is a little-used screen mode. Each pixel can be any of the chip's 16 colours but the trade-off is that resolution is reduced to 64 x 48. The 'pixels' are bloxels that are 4x4 of the original pixels. 

Here's a piece of artwork that uses this mode, it's called koi-boi by Spritus

(I have added koiboi.sc3 and my sc3view.com  to my repository of files for RC2014+TMS9918A)

That's being displayed by my emulator. It took a little while to get here because of the complicated order that the bytes are displayed (a pattern is 2 bloxels wide by 8 deep, represented by 8 bytes in the pattern table. The pattern table is referred to by a byte in the name table. I'm still not sure that I've got this all correct but it works with the way that the name table is conventionally filled, which is 6 sections of 4 rows of 32 bytes, each group of 4 rows being identical.)

With that implemented, heres the Nyan Cat demo, running perfectly and looking very sharp.

I was extremely pleased to see that multicolour mode was working fine, and even more pleased to see that the emulator runs this demo without missing a beat, which is pretty intense in the amount of data it's sending to the TMS's video ram,  

Then I had a 'hang on.....' moment. This shouldn't have run, or perhaps should have run at a faster speed, because the animation relies on being able to read the TMS chip's status register (a bit indicates the vertical blank) which my emulator doesn't yet supply. Then I noticed that as well as my emulator, I also had the real TMS module plugged into my RC2014 backplane! The two were working happily in parallel, both generating their video signal and the real chip providing valid data for the the status register.

Indeed, with the real TMS module pulled, this demo ran much more quickly. (and still appeared to run fine.)

[edit: after watching that video over and over, I think I can see tearing. It's not very obvious because the cat isn't moving very much, but this is as expected with the emulator not generating its own vblank signal. Once I've implemented that, any tearing should be gone.]

Here's another demo of my emulator in action, this time with my Life program which also uses the TMS mode 3. It's is perfectly suited to this program because there's obviously a trade-off between the number of cells and the speed that you can run. In fact the screen mode allows for colour, so I plan to add some colour to this program.

Sprites next.

Over and out for now.

Discussions