• entries
222
606
• views
591274

# ColecoVision and TMS9918 Multicolor

2074 views

One notable gap in my TMS9918 (video) emulation was its "Multicolor" mode. This mode broke the screen down into 4x4 pixel squares, resulting in a 64x48 grid. Each cell could be assigned a unique colour, giving you a crude bitmapped video mode.

No Master System or SG-1000 software used this mode to my knowledge, which reduced the likelihood of it being supported at all (if I could't test it, how could I emulate it?) I was tipped off that some ColecoVision software made use of it, so set about emulating the ColecoVision.

The ColecoVision hardware is very similar to the SG-1000 in terms of what is inside the case - a Z80 CPU, TMS9918 video and SN76489 sound. The memory map (as in, which address ranges map to which memory devices) is different, as is the I/O map (as in, the I/O ports that the various hardware components are connected to). To handle this case, the emulator now has a Family field, which can be set to Sega or ColecoVision. This controls which of the different mappings it uses for memory and hardware I/O.

Another difference is the presence of a BIOS ROM. The Sega Master System and Sega Game Gear consoles had the option of BIOS ROMs, but all these did was very basic initialisation and header/checksum checking. The ColecoVision, however, has an 8KB BIOS ROM that offers a lot of functionality to the programmer, so this must be present to run most ColecoVision games.

The controllers are also quite different. As well as the typical eight-direction joystick and two fire buttons, it added a 12-key keypad (0-9, * and #). This many keys is making my InputManager class look thoroughly idiotic, so that will certainly need a rewrite.

Apart from that, it's pretty simple. RAM is 1KB instead of 8KB; the sound generator uses the standard 15-bit wide shift register (instead of the 16-bit wide one used in the SMS); the video display processor interrupt output is connected to NMI rather than INT.

With those differences applied, it's easy to add the few lines of code to emulate the Multicolor video mode.

Smurf Paint 'n' Play Workshop

ColecoVision emulation has not been tested at all thoroughly, so chances are it doesn't work very well; Multicolor emulation has been tested with precisely one game!

You can download the latest build of Cogwheel from its website, featuring the new ColecoVision emulation.

I still have my ColecoVision. It was a great machine.

I wasn't aware it had such a big ROM -- what's in there, optimized blitting routines?

Quote:
 Original post by Ravuya I wasn't aware it had such a big ROM -- what's in there, optimized blitting routines?
As far as I can tell, the BIOS provides numerous helper functions - for example, copying data to and from VRAM without needing to write to the video chip's registers directly. It also provides entry points to handle input from the controllers, as well as utility functions such as generating random numbers. As it resided in the lower 8KB of memory, it also needed to jump to your game's interrupt handlers for you (as the interrupt handlers are located at addresses $38 and$66). It automatically populated certain values in RAM for you, such as the refresh rate (60Hz or 50Hz).

Apparently some programs for the ColecoVision were developed in Pascal, and the BIOS exposes some entry points designed to support these Pascal-based programs.

The BIOS is also responsible for the title screen and the irritating 12-second delay when booting some games.

Wow, I knew about that crappy mode on the TMS9918, but I didn't think anything actually used. Looks like someone vomited and threw some Smurf toys on top of it.

Yes, it does look rather bad; fortunately it seems to be restricted to drawing programs (where its use does make some sort of sense).

Sega's drawing package, the Terebi Oekaki graphics tablet, used the conventional graphics modes — providing a higher resoltion at the cost of attribute clash.

I think your Smurf screenshot might actually be incorrect a bit. I have the actual cartridge, so I guess I could always fire it up and check for you. Unless they made another Smurf game, I remember the background was way chunkier.

By far the best game on that machine is the criminally underrated Cosmic Avenger.

Anyway, I didn't know it had discrete VRAM either (it's too old for me to feel comfortable taking it apart and probing the motherboard). Very impressive machine for its time. If I find another one at the fleamarket, I'll certainly snap it up for parts.

The fact that the hardware is shared between the SG-1000 and this machine explains the large body of Sega arcade ports.

Quote:
 Original post by Ravuya I think your Smurf screenshot might actually be incorrect a bit. I have the actual cartridge, so I guess I could always fire it up and check for you. Unless they made another Smurf game, I remember the background was way chunkier.
I compared it against blueMSX, and the result is the same (ignoring slightly different hard-coded colour palettes). Some of the ColecoVision programs I've tried don't work at all, and I'm not all that familiar with this platform, so I'd be very grateful if you pointed out any errors in my implementation!

Quote:
 Anyway, I didn't know it had discrete VRAM either (it's too old for me to feel comfortable taking it apart and probing the motherboard). Very impressive machine for its time. If I find another one at the fleamarket, I'll certainly snap it up for parts.
That's one of the more interesting features - that it's made up out of off-the-shelf parts as opposed to custom-designed ones.

The 1KB RAM does seem rather small (especially as some of it is stolen by the BIOS), and a number of SG-1000 cartridges I've tested don't work unless I emulate them as RAM, so I wouldn't be surprised if some ROMs had on-board RAM too. This could also explain some of the cartridges I've tested not booting properly.
Quote:
 The fact that the hardware is shared between the SG-1000 and this machine explains the large body of Sega arcade ports.
The MSX is also quite similar, with its Z80 CPU and TMS9918 video. It does, however, have a different sound chip (AY-3-8910). I'm not sure if I want to start emulating the MSX, as the last time I attempted to emulate a floppy disk drive (viz, the SF-7000) ended in disaster.

## Create an account

Register a new account