Compiling an emulator for enhanced Megadrive

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Huge
Very interested
Posts: 197
Joined: Sat Dec 13, 2008 11:50 pm

Re: Compiling an emulator for enhanced Megadrive

Post by Huge » Tue Apr 09, 2019 7:55 pm

How does the C2 have 15bit colour? I thought it just had the external palette hooked up to double the entries from four to eight.

Sik
Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Compiling an emulator for enhanced Megadrive

Post by Sik » Wed Apr 10, 2019 2:17 am

The colors in the palettes are 15-bit (5-bit per compoent). For comparison, Mega Drive's colors are 9-bit (3-bit per compoent).

EDIT: also System C2's external CRAM has way more than 8 palettes, but they work through bank switching (it exists mainly to thwart quick attempts at bootlegs). Without doing the bank switching, yeah it's limited to 8 palettes (4 for background and 4 for sprites), though the bank switching is probably useful for raster effects.
Sik is pronounced as "seek", not as "sick".

hotrodx
Very interested
Posts: 50
Joined: Thu Mar 21, 2019 1:23 pm

Re: Compiling an emulator for enhanced Megadrive

Post by hotrodx » Wed Apr 10, 2019 3:43 am

It is interesting to write something new for C2, as it is an improvement over a stock Genesis. My only reservation is that the hardware is not available to the general public. So binaries made for these would usually end up being run only on emulators and virtual machines.

Wouldn't a Genesis + 32X + SegaCD combo be much more appropriate base machine for a "souped up" Genesis? At least it would be feasible for public consumers to have an actual machine (though it will be difficult and niche to have them all together). Plus, the Polymega would be a modern SKU that can fit this specification (if it releases at all, and if the emulation is faithful to the hardware).

tryphon
Very interested
Posts: 316
Joined: Sat Aug 17, 2013 9:38 pm
Location: France

Re: Compiling an emulator for enhanced Megadrive

Post by tryphon » Wed Apr 10, 2019 7:32 am

Is there a known MD emulator handling System C2, and can we find documentation about those extra abilities ?

Also, is the system C2 backward compatible with MD ? (will a MD rom load and run normally ?)

cero
Very interested
Posts: 338
Joined: Mon Nov 30, 2015 1:55 pm

Re: Compiling an emulator for enhanced Megadrive

Post by cero » Wed Apr 10, 2019 7:36 am

There's little point to the "Tower of power" when a Saturn is better for all practical purposes.

hotrodx
Very interested
Posts: 50
Joined: Thu Mar 21, 2019 1:23 pm

Re: Compiling an emulator for enhanced Megadrive

Post by hotrodx » Wed Apr 10, 2019 8:38 am

cero wrote:
Wed Apr 10, 2019 7:36 am
There's little point to the "Tower of power" when a Saturn is better for all practical purposes.
Still being a Genesis is part of the constraint.

hotrodx
Very interested
Posts: 50
Joined: Thu Mar 21, 2019 1:23 pm

Re: Compiling an emulator for enhanced Megadrive

Post by hotrodx » Wed Apr 10, 2019 8:56 am

tryphon wrote:
Wed Apr 10, 2019 7:32 am
Also, is the system C2 backward compatible with MD ? (will a MD rom load and run normally ?)
More likely not, since it lacks some of the Genesis components like the Z80, and it being arcade only (so not cartridge based?). It's more within the lineage of the SEGA System 16 arcade boards (which the Genesis is partly based on), so you can think of them as a same family,, but not compatible with one another (my guess).

Perhaps a close analogy is with the Dreamcast, then you have the Naomi Arcade board. Then you have later arcade revisions like the Hikaru and Naomi 2. All of these family of systems can be emulated by Demul.

tryphon
Very interested
Posts: 316
Joined: Sat Aug 17, 2013 9:38 pm
Location: France

Re: Compiling an emulator for enhanced Megadrive

Post by tryphon » Wed Apr 10, 2019 10:01 am

There are much more analogies between the C2 and the Megadrive, than between both of them and the System16 (the idea that MD hardware comes from System16 is likely a bad interpretation, or a "commercial" claim). But indeed, if there's no Z80, retrocompatibility is doomed...

So... compiling GenesisPlus is a pain in the neck : it relies on old libraries, old gcc... I'm trying to compile Musashi now, even if I don't really understand if the executable I'll get must be part of the project or mustn't...

Sik
Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Compiling an emulator for enhanced Megadrive

Post by Sik » Wed Apr 10, 2019 12:11 pm

Yeah, System C2 isn't compatible in any form. Not only there's no Z80, the YM2612 is at a different address, I/O is completely different, there's a watchdog, CRAM is 68000 mapped, it uses the VDP's own EDClk instead of the external one the Mega Drive uses, it uses the VDP's DRAM mode (which is an instant crash on Mega Drive as it fights with the bus arbitrer for control over refresh), etc. Not to mention the ADPCM chip (the SegaSonic Bros port works around that one by having the Z80 take its job).

It is feasible to make a game that can be easily built for both Mega Drive and System C2 using a build-time option (all data is easy to reuse, as are graphics operations, and dealing with the YM2612 is mostly a matter of changing addresses, and you can implement ADPCM using the Z80 on the Mega Drive to make up for the lack of the chip), but definitely no universal binaries to be had here.


Also regarding emulators: MAME :​P (though you need to manually add games)
Sik is pronounced as "seek", not as "sick".

slobu
Very interested
Posts: 85
Joined: Tue Apr 03, 2012 6:02 pm

Re: Compiling an emulator for enhanced Megadrive

Post by slobu » Wed Apr 10, 2019 7:01 pm

I am pretty far out of my league on his one. I apologize in advance for being both ignorant and off topic.

From the feature set wanted and "enhanced megadrive" perspective.. doesn't any emulator with 32x support qualify? To me the 32x was for all intents and purposes an enhanced genesis. Technically it's a system sitting on top of the genesis with a video overlay. But, I suppose a hardware hacked genesis would probably take a similar route.

tryphon
Very interested
Posts: 316
Joined: Sat Aug 17, 2013 9:38 pm
Location: France

Re: Compiling an emulator for enhanced Megadrive

Post by tryphon » Fri Apr 12, 2019 4:14 pm

Sik wrote:
Wed Apr 10, 2019 12:11 pm
Yeah, System C2 isn't compatible in any form. Not only there's no Z80, the YM2612 is at a different address, I/O is completely different, there's a watchdog, CRAM is 68000 mapped, it uses the VDP's own EDClk instead of the external one the Mega Drive uses, it uses the VDP's DRAM mode (which is an instant crash on Mega Drive as it fights with the bus arbitrer for control over refresh), etc. Not to mention the ADPCM chip (the SegaSonic Bros port works around that one by having the Z80 take its job).

It is feasible to make a game that can be easily built for both Mega Drive and System C2 using a build-time option (all data is easy to reuse, as are graphics operations, and dealing with the YM2612 is mostly a matter of changing addresses, and you can implement ADPCM using the Z80 on the Mega Drive to make up for the lack of the chip), but definitely no universal binaries to be had here.


Also regarding emulators: MAME :​P (though you need to manually add games)
Thanks for the answer. So no, System C2 is not what I'm looking after :P

@slobu : no, 32X isn't what I'm after at all. To begin with, it's a 32bits console. Its VDP is totally different from the old MD one, and not really designed for fast 2D games (it's a frame buffer, everything you want to display must be done in software, hence the additionnal processors).

I want to see something that would likely have been possibly built and sold in 1988, not much more expansive than the base MD was (after all, the PC Engine had many palettes and the Game Gear had 4096 colors).

hotrodx
Very interested
Posts: 50
Joined: Thu Mar 21, 2019 1:23 pm

Re: Compiling an emulator for enhanced Megadrive

Post by hotrodx » Fri Apr 12, 2019 4:39 pm

I would imagine a souped up Genesis would have been something like a Neogeo ("more of everything"). But if not that or the 32X then perhaps the Megadrive + MegaCD combo, minus the CD? Can the Megadrive access the MegaCD capabilities for non-CD games?

With a MegaCD, you get extra RAM, a faster CPU, a mode 7-like plane, sprite scaling(?), extra sound channels. So basically get them all, but without the CD drive mechanism. I'm not sure if the two 68000 can work in tandem, but that would be cool.

tryphon
Very interested
Posts: 316
Joined: Sat Aug 17, 2013 9:38 pm
Location: France

Re: Compiling an emulator for enhanced Megadrive

Post by tryphon » Fri Apr 12, 2019 7:35 pm

Ni, that's not what I want. MD has enough CPU power for its age and I don't want mode 7.

Just more palettes and more colors, and not so much. Then again something that would have been achievable, at more or less the same price.

Sik
Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Compiling an emulator for enhanced Megadrive

Post by Sik » Sat Apr 13, 2019 12:50 am

The problem is that if you're looking at 1988, huuuh, the price was precisely the issue. The VDP has support for some improvements as it is (more VRAM, more colors, genlock onto other VDP), yet including that would have added to the cost. They also had to cut down some features from the VDP while reducing the die size in order to increase yield (and hence reduce costs), despite being technically doable with the technology of the time. Other stuff like adding more work RAM or a PCM (or ADPCM) chip also have the issue of adding significantly to the cost.

That said, the VDP die decaps do seem to hint that if they had more time to reorganize the circuits it may have been possible to cram in a second set of palettes (so background and sprites could have their own palettes). This is just speculation tho, there's no guarantee that it may have worked out even if given more time.
hotrodx wrote:
Fri Apr 12, 2019 4:39 pm
I would imagine a souped up Genesis would have been something like a Neogeo ("more of everything"). But if not that or the 32X then perhaps the Megadrive + MegaCD combo, minus the CD? Can the Megadrive access the MegaCD capabilities for non-CD games?

With a MegaCD, you get extra RAM, a faster CPU, a mode 7-like plane, sprite scaling(?), extra sound channels. So basically get them all, but without the CD drive mechanism. I'm not sure if the two 68000 can work in tandem, but that would be cool.
That's technically doable (see: booting in mode 1), you can even reclaim back some PRG-RAM when not using the CD drive since the BIOS doesn't need to be present in that case.

The problem is whether anybody is willing to program anything for such a setup, because if you're going to require the Sega CD you may as well use CDs instead of cartridge, and if it's an optional enhancement there isn't much interesting stuff you can do if you want it to degrade in a reasonable way when the Sega CD isn't present (e.g. the kind of stuff the ASIC can push would come up atrocious if attempted by the Mega Drive alone, so in practice that'd be probably a no-go unless it's for a feature not available without the add-on).

I mention that because nobody will bother making a Sega CD clone without CD drive unless there's actually going to be useful stuff that would take advantage of such a thing.
Sik is pronounced as "seek", not as "sick".

hotrodx
Very interested
Posts: 50
Joined: Thu Mar 21, 2019 1:23 pm

Re: Compiling an emulator for enhanced Megadrive

Post by hotrodx » Sat Apr 13, 2019 5:12 am

Sik wrote:
Sat Apr 13, 2019 12:50 am
The problem is that if you're looking at 1988, huuuh, the price was precisely the issue. The VDP has support for some improvements as it is (more VRAM, more colors, genlock onto other VDP), yet including that would have added to the cost. They also had to cut down some features from the VDP while reducing the die size in order to increase yield (and hence reduce costs), despite being technically doable with the technology of the time. Other stuff like adding more work RAM or a PCM (or ADPCM) chip also have the issue of adding significantly to the cost.

That said, the VDP die decaps do seem to hint that if they had more time to reorganize the circuits it may have been possible to cram in a second set of palettes (so background and sprites could have their own palettes). This is just speculation tho, there's no guarantee that it may have worked out even if given more time.
hotrodx wrote:
Fri Apr 12, 2019 4:39 pm
I would imagine a souped up Genesis would have been something like a Neogeo ("more of everything"). But if not that or the 32X then perhaps the Megadrive + MegaCD combo, minus the CD? Can the Megadrive access the MegaCD capabilities for non-CD games?

With a MegaCD, you get extra RAM, a faster CPU, a mode 7-like plane, sprite scaling(?), extra sound channels. So basically get them all, but without the CD drive mechanism. I'm not sure if the two 68000 can work in tandem, but that would be cool.
That's technically doable (see: booting in mode 1), you can even reclaim back some PRG-RAM when not using the CD drive since the BIOS doesn't need to be present in that case.

The problem is whether anybody is willing to program anything for such a setup, because if you're going to require the Sega CD you may as well use CDs instead of cartridge, and if it's an optional enhancement there isn't much interesting stuff you can do if you want it to degrade in a reasonable way when the Sega CD isn't present (e.g. the kind of stuff the ASIC can push would come up atrocious if attempted by the Mega Drive alone, so in practice that'd be probably a no-go unless it's for a feature not available without the add-on).

I mention that because nobody will bother making a Sega CD clone without CD drive unless there's actually going to be useful stuff that would take advantage of such a thing.
I hear you. But the Megadrive+MegaCD combo is something that exists that SEGA themselves created, and in itself has its own set of constraints and restrictions. It's not a hypothetical Megadrive that has arbitrary improvements, which only emphasizes the stock MD's shortcomings.

A present day implementation of a MD+MCD would simply be in emulation, with the ROMs (cart or CD) in a cheaper SDHC or flash memory. But can be confirmed to run on an actual hardware (if you have the MD+MCD setup) without the need of soldering in mods. Plus, it will run on existing emulators, something that an EMD readily does not.

An alternative might be to have something like SVP in the cart. Modern emulators can run these. Running on an actual MD can be tricky, as it might require getting the Virtua Racing cart pcb, strip out the eprom and burn in the new ROM, but theoretically possible (maybe?). It doesn't have the palette improvements tryphon would have wanted, though.

Doing stuff for the stock MD is still great. I think what made the 8088 CGA demo impressive is that it stayed within the original IBM PC's constraints. Will a demo using SVP or MD+MCD be as impressive? Perhaps not in the same level, but it might still be. But a demo on a modded Megadrive (or moreso on a theoretical Megadrive) gets an asterisk (*) from me, as the modifcations themselves are arbitrary. It kinda sounds like a fanboy wishful thinking ("if the Megadrive had extra features, it would've trounced the Super Famicom"). I know it's not, but just felt like that.

Post Reply