TI Games (Gemini) on the Master System

Feel like posting Off Topic? Do it here.

Moderator: MaxCoderz Staff

Post Reply
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

TI Games (Gemini) on the Master System

Post by benryves »

I had a thought (as you do) that it would be interesting to see how well a TI game would run on the Sega Master System. After all, they share the CPU, albeit at ~3.5MHz on the SMS.

However, there are some other differences...
  • Completely different video hardware.
  • Completely different input hardware.
  • 8KB RAM rather than 32KB RAM.
  • No TIOS.
The first problem was the easiest to conquer. The SMS has a background layer, broken up into 8x8 tiles. If I wrote a 12x8 pattern of tiles onto the SMS background layer, and modified the tile data in my own implementation of _grBufCpy routine, I could simulate the TI's bitmapped LCD display (programs using direct LCD control would not be possible).

You can only dump so much data to the VRAM during the active display - it is much safer to only write to the VRAM outside of the active display period. I can give myself a lot more of this by switching off the display above and below the small 96x64 window I'll be rendering to; it's enough to perform two blocks, the left half of the display in one frame, the right in the next.

As for the input, that's not so bad. Writing my own _getK which returned TI-like codes for the 6 SMS buttons (Up, Down, Left, Right, 1 and 2) was fine, but games that used direct input were a bit stuck. I resolved this by writing an Out1 and In1 function that has to be called and simulates the TI keypad hardware, mapping Up/Down/Left/Right/2nd/Alpha to Up/Down/Left/Right/1/2.

The RAM issue can't be resolved easily. Copying some chunks of code to RAM (for self-modifying reasons) was necessary in some cases. As for the lack of the TIOS, there's no option but to write my own implementation of missing functions or dummy functions that don't do anything.

Even with the above, it's still not perfect. If I leave the object code in Gemini, the graphics are corrupted after a couple of seconds of play. I think the stack is overwriting some of the code I've copied to RAM.

Gemini on the Game Gear

No enemies make it a pretty bad 'game', but I thought it was an entertaining experiment.
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Wow im dumbfounded, that is awesome! The speed is pretty comparable ... the whole idea is just cool!

Im wondering how long you were working on this little project? :).
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

I only worked on it for a few hours. The slowest part to do was writing my own _vputs, including converting the font from the manual and calculating the widths (I gave up when I had enough characters done for Gemini!)
threefingeredguy
Calc King
Posts: 2195
Joined: Sun 27 Mar, 2005 4:06 am
Location: sleeping
Contact:

Post by threefingeredguy »

That's really cool! I believe the Nintendo DS device I own has the capability to play SMS games, maybe I could try emulating an emulation later. :)
Image
necro
Calc King
Posts: 1619
Joined: Sat 26 Mar, 2005 2:45 am
Location: your shadow

Post by necro »

sweet!? Can you write games just like calc assembly (with some call difrences of course)? Or iow, is it reasonably easy/possible to make genisis games?
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

The hardware is rather different, but not actually that difficult to get to grips with. Maxim has a nice guide on his site.

If you really wanted to directly port calculator games on the SMS, I guess you could using a similar method to the one I've used, but the SMS isn't really suitable for fully bitmapped graphics; it's good for scrolling tilemaps and sprites though as it can handle all of that in hardware.

The Mega Drive (or Genesis in North America) has a 68K processor in it, but does also have a Z80 CPU in it (usually used as a sound coprocessor). The VDP (Video Display Processor) is an updated version of the SMS VDP, but still retains the SMS "Mode 4". This is how you can play SMS games on a Mega Drive with the Power Base Converter, which just acts as a pass-through device for the cartridge.
User avatar
Halifax
Sir Posts-A-Lot
Posts: 225
Joined: Mon 01 Jan, 2007 10:39 am
Location: Pennsylvania, US

Post by Halifax »

I have always wondered about programming for the Sega Game Gear because its the only handheld I have :) . But since you put a TI game on Game Gear do you think it would be possible to put a Game Gear game on TI... like NBA JAM.
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Not without a full rewrite. The GG has special video hardware that the TI doesnt have :(.
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
User avatar
Halifax
Sir Posts-A-Lot
Posts: 225
Joined: Mon 01 Jan, 2007 10:39 am
Location: Pennsylvania, US

Post by Halifax »

Oh ok :( but that would be awesome if somehow NBA JAM made it to z80
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Such a game would be possible, i would certainly love to see it! (ive even thought about giving it a shot :)).
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

Heh, NBA JAM is already "Z80". :P

The SMS has a 256x192 (standard resolution, can be extended) video mode, with a tilemapped background layer (tiles can be marked as flipped vertical, horizontal or in front of sprites) and 64 sprite layers. Each tile uses four bits per pixel (16 colours, can be picked from the first 16 or last 16 colours from the 32-colour palette) and is 8x8 pixel. There are 512 of these, giving you 16KB VRAM. There's part of the problem; you'd need to set aside 16KB RAM just for the VRAM, plus 8KB for the work RAM.

(In reality you need some of this 16KB VRAM for the name table - the tilemap, that is - and sprite attribute table).

The Game Gear has the same VDP, but crops the display to a fixed 160x144 window in the middle of the 256x192, and extends the palette to 12-bit colour (rather than the SMS VDP's 6-bit).

It wouldn't seem that workable, but with clever emulation and taking advantage of the SE's extra RAM and higher clock speed you might get away with it.
Post Reply