Jump to content
Sign in to follow this  
TheMole

Sega Master System VDP in a TI-99/4A

Recommended Posts

Hi All,

I'm new to the forum, but wanted to share something I've been working on the past few days: integrating the Sega Master System VDP into a TI-99/4A. Before anyone gets too excited (hah!), I'm prototyping everything in an emulator first, so no hardware work has been done yet.

The master system VDP is basically a TMS9918A with an additional mode and some additional register. This new mode, called "mode 4" is roughly identical to graphics 1 mode on the 9918a with the difference that instead of using a color table each pattern can use all 16 available colors for each of it's pixels. Furthermore, the color palette itself can be re-defined by writing to something called CRAM (color RAM) in pretty much the same way as one would write to VRAM but by selecting a different combination of control lines. It also supports hardware scrolling and a dedicated sprite palette, up to 64 sprites, 8 sprites on a single scanline, per-scanline interrupts and some other niceties.

So far, I've implemented the tile & pattern support for mode 4 (meaning, no sprite modifications have been done, and no hardware scrolling has been implemented) in the ti99/sim emulator. I've written a small test program in XB with some ASM subroutines to verify my implementation, you can see the result in the attached clip. Note that the corruption in the lower half of the screen is due to the fact that the tilemap is more than twice as large (2K) as the 786 bytes available in XB and this runs into the pattern generator table. My skills are not good enough to build this entire example in assembly, I had a hard enough time writing the POKEV, POKER (register) and CRAMW (write to CRAM) subroutines for this :).

[media]http://www.youtube.com/watch?v=yLo3tJoUQFg[/media]

Now, I realise the hardware side of things is going to be a bit more complex than this, and I still have a lot of software work ahead of me before I get there, but I thought I'd share what I have... :)
Hey, maybe mode 4 support could be a nice addition to the marvelous F18A? ;) Edited by TheMole

Share this post


Link to post
Share on other sites
[quote name='TheMole' timestamp='1349102478' post='2609926']
Hey, maybe mode 4 support could be a nice addition to the marvelous F18A? ;)
[/quote]

The biggest problem with the VDPs in the consoles is a lack of specific technical documentation. I have found that the custom VDPs (like in the NES which uses a variation of the 9918A) are typically undocumented, which is not good when you are trying to do a hardware reproduction.

To support 16 colors per pixel would require 24K of VRAM, and the F18A only has the original 16K. The F18A currently supports 3-bits per pixel (up to 8 colors), which is the max you can do in 16K.

The last problem, which the F18A also currently has, is a lack of any software for the new features. Until people write software to take advantage of the hardware, it will go underutilized.

I'll be very interested to see if you can get it to work in a physical console. Please post updates as you make progress.

Share this post


Link to post
Share on other sites
I'll keep you posted. The SMS VDP documentation, although obviously reverse engineered, is pretty complete if you start from the TMS9918A docs. But I do get what you're saying, it's probably much nicer to start from a well-written datasheet than someone's interpretation of a working system.

It's worth pointing out that the SMS VDP can also only address 16K of RAM. The 16 colors per tile feature means you have a maximum theoretical pattern table size of 512 entries, not enough to fill the whole screen with unique patterns, especially since the SMS VDP has a buffer for a number of offscreen tiles (the map is actually 32x32). So instead of using 8 bytes to define a tile, the biggest difference is that fact that you actually use 4 bitplanes, so 32 bytes in total to define each tile. Other than the slightly different pattern definition, and ditching the color table, the setup is pretty much identical to a normal 9918a (the first 7 registers are mostly the same, with some additional flags. And it has some extra registers to manage hardware scrolling).

I agree with the software comment, without programs to use them, the added abilities are basically worthless. My hope would be that be relying on an existing chip you'd be able to get a broader development community than when designing a new chip and starting from scratch.

If you're interested, I'm mostly using the following document as my baseline for the emulator implementation: [url="http://www.smspower.org/uploads/Development/msvdp-20021112.txt"]http://www.smspower....dp-20021112.txt[/url] - although as I said before, it's probably good to have the tms9918a datasheet next to you as well, but it can be found on the same site: [url="http://www.smspower.org/Development/Documents#Video"]http://www.smspower....Documents#Video[/url]

Side question: do you still build F18A's, or are they sold out?

Share this post


Link to post
Share on other sites
[quote name='TheMole' timestamp='1349197348' post='2610810']
Side question: do you still build F18A's, or are they sold out?
[/quote]

As of today I don't have any boards ready to ship, but I'm working on about 4 or 6 boards this week. My plan is to try and keep a few stocked and keep up with demand (which has been very low since the pre-orders). I will try to make sure the F18A is always available for anyone who wants to get their hands on one.

Share this post


Link to post
Share on other sites
[quote name='Retrospect' timestamp='1349200124' post='2610840']
Just a quick question, regarding writing software to the F18A hardware, is there a way to address the extra features within a console / emulator ?
[/quote]

As of right now, no. Tursi is planning on adding F18A support to Classic99, but like all of us he is very busy. If I had more time I would write a "reference driver" for the F18A to use in emulators, but first I have to write the F18A documentation, example code, and some sort of demo that exhibits the features. The list never seems to end...

Share this post


Link to post
Share on other sites
[quote name='matthew180' timestamp='1349204989' post='2610907']
As of right now, no. Tursi is planning on adding F18A support to Classic99, but like all of us he is very busy. If I had more time I would write a "reference driver" for the F18A to use in emulators, but first I have to write the F18A documentation, example code, and some sort of demo that exhibits the features. The list never seems to end...
[/quote]

Ha! Welcome to my world. Hunker down and come on in! ;)

http://www.youtube.com/watch?v=ytPQYkpkzsA

Share this post


Link to post
Share on other sites
Alright, I've made some progress the past couple of days. I've implemented the improved sprite engine as well as the hardware scrolling feature (well, at least horizontal scrolling) in the ti99sim emulator and I've created an example application that uses all implemented master system features:
[indent=1]- Room for 512 patterns of 32 bytes each (bulk of 16K VRAM: >0000 - >3800)[/indent]
[indent=1]- 2-byte name table entries (but no support for flipping of tiles yet)[/indent]
[indent=1]- writing to color RAM[/indent]
[indent=1]- separate sprite & background palettes (but no support for the sprite palette flag in the tile engine yet)[/indent]
[indent=1]- Support for up to 128 sprites, of which there can be max 8 per scanline (but, no support for double-sized or magnified sprites yet)[/indent]
[indent=1]- Hardware scrolling[/indent]

So, a TI-99/4A with an SMS VDP in place of the 9918a should be capable of bringing us full-featured arcade type games, side-scrollers, platformers, etc... The following clip shows the example running in the emulator, sorry about the blurriness of the image, my cellphone had some trouble focusing on the laptop screen :).

[media]http://www.youtube.com/watch?v=AGOY3sjD4AM[/media]

Share this post


Link to post
Share on other sites
hehe.. that's very cute! And neat to know it works! Before Matthew started the F18, I was toying with all kinds of replacement VDP ideas. Originally I wanted to use the Genesis VDP, then I found out that mode 0 was removed from it. I considered the SMS VDP since it's a separate chip and should be transplantable, but, just never experimented at all. Now I live vicariously through your experimentation! :) Thanks for posting progress. :)

Share this post


Link to post
Share on other sites
[quote name='matthew180' timestamp='1349204989' post='2610907']
As of right now, no. Tursi is planning on adding F18A support to Classic99, but like all of us he is very busy. If I had more time I would write a "reference driver" for the F18A to use in emulators, but first I have to write the F18A documentation, example code, and some sort of demo that exhibits the features. The list never seems to end...
[/quote]

Any timeline on this Matt?

Share this post


Link to post
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.

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...