gen: Implement CRAM read, VSRAM read. Correct sprite coordinate masking, fixing games several games where sprites were missing.

This commit is contained in:
beirich 2012-09-04 01:07:03 +00:00
parent 2de8e3c346
commit ff8a58a9b7
3 changed files with 33 additions and 14 deletions

View File

@ -28,13 +28,12 @@ Castle of Illusion - doesn't boot
Cheese Cat-astrophe - crashes renderer!! Cheese Cat-astrophe - crashes renderer!!
Chester Cheetah - freezes when starting new game Chester Cheetah - freezes when starting new game
Chuck Rock - Music messed up Chuck Rock - Music messed up
Contra Hard Corps: Scrolling is messed up in level 1... used to work. Window seemed to mess things up. Contra Hard Corps: Scrolling is messed up in level 1... used to work.
Crusader of Centy- Text boxes messed up Crusader of Centy- Text boxes messed up
Dashin' Desperados .. bottom screen messed up Dashin' Desperados .. bottom screen messed up
Death Duel crashes my renderer... (!) Death Duel crashes my renderer... (!)
Decap Attack - Item select screen messed up Decap Attack - Item select screen messed up
Double Dragon doesn't boot Double Dragon doesn't boot
Dragon's Revenge.... ball sprite seems missing? of all the sprites to not show up...
Devilish/Bad Omen - intro messed up.... interesting debug target Devilish/Bad Omen - intro messed up.... interesting debug target
Dune... freezes in intro Dune... freezes in intro
Eternal Champions... GFX issues, immediately Eternal Champions... GFX issues, immediately
@ -43,11 +42,9 @@ Exo Squad - Doesn't boot at all
F1 World Championship... Gfx issue at bottom of screen... quite cool working game though! F1 World Championship... Gfx issue at bottom of screen... quite cool working game though!
Fatal Rewind - appears to do a read.w on FFFFFF... that would be an address error. read.l messes up too. Ergo: basically doesnt work. Fatal Rewind - appears to do a read.w on FFFFFF... that would be an address error. read.l messes up too. Ergo: basically doesnt work.
Final Blow - Music messed up Final Blow - Music messed up
Fire Shark - Messed up sound & Sprites dont render... VERY similar to Truxton. Same engine? Fire Shark - Messed up sound
Flavio's DMA test... DMAs when it shouldnt!!
Flavio's Raster FX Test.. doesnt work Flavio's Raster FX Test.. doesnt work
Foreman for Real doent boot Foreman for Real doent boot
Fun-n-Games fails its fadeouts. I think its because its trying to read CRAM, but failing. Maybe?
Garfield... immediate gfx corruption. debug target. Garfield... immediate gfx corruption. debug target.
Gargoyles... gameplay is nonfunctional Gargoyles... gameplay is nonfunctional
Gauntlet 4 .. title screen messed. gfx corruption. immediately - debug target. Gauntlet 4 .. title screen messed. gfx corruption. immediately - debug target.
@ -78,7 +75,6 @@ Shining in the Darkness: Gfx glitches, pretty severe
Skitchin doesnt boot Skitchin doesnt boot
Sonic 2: Aside from lack of interlace mode, the shadows in the special stage are white....? Sonic 2: Aside from lack of interlace mode, the shadows in the special stage are white....?
Sonic 3 serious gfx glitches Sonic 3 serious gfx glitches
Sonic Spinball executes a VSRAM read (unimplemented)
Star Control - Shit gets crazy Star Control - Shit gets crazy
Steel Empire - controls messed up. probably gfx issues also. Steel Empire - controls messed up. probably gfx issues also.
Sub-Terrania some gfx issues in intro Sub-Terrania some gfx issues in intro
@ -86,11 +82,11 @@ Super Fantasy Zone: Sound totally boned, missing graphics
TaleSpin - gfx glitches TaleSpin - gfx glitches
The Humans The Humans
The Immortal The Immortal
Truxton - Sprites do not appear to be rendering. which is awesome. Truxton - Sound is jaaaacked.
Verytex - gfx issues Verytex - gfx issues
World of Illusion doesnt boot World of Illusion doesnt boot
Zero Tolerance - gfx bugs that didnt used to happen :( Zero Tolerance - gfx bugs that didnt used to happen :(
Zero Wing - Sprites arent rendering.......
Zombies At My Neighbors: doesnt boot really Zombies At My Neighbors: doesnt boot really
Zoop doesnt boot Zoop doesnt boot
@ -99,7 +95,23 @@ Things that read from VRAM work like 50%-90%, but not 100%. It's frustrating. Ki
Some games flicker in the rightmost columns. Is this caused by mid-frame mode shifting(32/40 col modes?) Alisia Dragoon is one example. Some games flicker in the rightmost columns. Is this caused by mid-frame mode shifting(32/40 col modes?) Alisia Dragoon is one example.
--- Havent seen an example of this in a long time. Maybe it's a non-issue. --- Havent seen an example of this in a long time. Maybe it's a non-issue.
======================================================
Fixed Issues: (listed for regression testing purposes)
======================================================
(Sprites X/Y are 10-bit, but must be masked to 9-bit)
- Dragon's Revenge.... ball sprite seems missing? of all the sprites to not show up...
- Fire Shark - Sprites dont render... VERY similar to Truxton. Same engine?
- Truxton - Sprites do not appear to be rendering.
- Zero Wing - Sprites arent rendering.......
Flavio's DMA test... DMAs when it shouldnt!! - Masking off too much of the VDP command code
Fun-n-Games fails its fadeouts. -- Fixed CRAM reads. I failed math.
Sonic Spinball executes a VSRAM read -- Implemented VSRAM reads.
======================================================
TODO: non-instant DMA emulation TODO: non-instant DMA emulation
TODO: Add 68000/VDP interrupt enable delay (one instruction, similar to After Burner/PCE) TODO: Add 68000/VDP interrupt enable delay (one instruction, similar to After Burner/PCE)

View File

@ -307,9 +307,12 @@ namespace BizHawk.Emulation.Consoles.Sega
void FetchSprite(int spriteNo) void FetchSprite(int spriteNo)
{ {
// Note - X/Y coordinates are 10-bits (3FF) but must be masked to 9-bits (1FF)
// In interlace mode this behavior should change
int SatBase = SpriteAttributeTableAddr + (spriteNo*8); int SatBase = SpriteAttributeTableAddr + (spriteNo*8);
sprite.Y = (VRAM[SatBase + 0] | (VRAM[SatBase + 1] << 8) & 0x3FF) - 128; sprite.Y = (VRAM[SatBase + 0] | (VRAM[SatBase + 1] << 8) & 0x1FF) - 128;
sprite.X = (VRAM[SatBase + 6] | (VRAM[SatBase + 7] << 8) & 0x3FF) - 128; sprite.X = (VRAM[SatBase + 6] | (VRAM[SatBase + 7] << 8) & 0x1FF) - 128;
sprite.WidthPixels = SpriteSizeTable[(VRAM[SatBase + 3] >> 2) & 3]; sprite.WidthPixels = SpriteSizeTable[(VRAM[SatBase + 3] >> 2) & 3];
sprite.HeightPixels = SpriteSizeTable[VRAM[SatBase + 3] & 3]; sprite.HeightPixels = SpriteSizeTable[VRAM[SatBase + 3] & 3];
sprite.WidthCells = ((VRAM[SatBase + 3] >> 2) & 3) + 1; sprite.WidthCells = ((VRAM[SatBase + 3] >> 2) & 3) + 1;

View File

@ -47,7 +47,7 @@ namespace BizHawk.Emulation.Consoles.Sega
const int CommandCramWrite = 3; const int CommandCramWrite = 3;
const int CommandVsramRead = 4; const int CommandVsramRead = 4;
const int CommandVsramWrite = 5; const int CommandVsramWrite = 5;
const int CommandCramRead = 7; const int CommandCramRead = 8;
public ushort VdpStatusWord = 0x3400; public ushort VdpStatusWord = 0x3400;
public const int StatusHorizBlanking = 0x04; public const int StatusHorizBlanking = 0x04;
@ -229,11 +229,15 @@ int orig_addr = VdpDataAddr;
VdpDataAddr += Registers[0x0F]; VdpDataAddr += Registers[0x0F];
break; break;
case CommandVsramRead: case CommandVsramRead:
throw new Exception("VSRAM read"); retval = VSRAM[(VdpDataAddr / 2) % 40];
VdpDataAddr += Registers[0x0F];
return retval;
case CommandCramRead: case CommandCramRead:
throw new Exception("CRAM read"); retval = CRAM[(VdpDataAddr / 2) % 64];
VdpDataAddr += Registers[0x0F];
return retval;
default: default:
throw new Exception("VRAM read with unexpected code!!!"); throw new Exception("VRAM read with unexpected code!!! " + (VdpDataCode & 0x0F));
} }
Log.Note("VDP","VDP Data Read from {0:X4} returning {1:X4}", orig_addr, retval); Log.Note("VDP","VDP Data Read from {0:X4} returning {1:X4}", orig_addr, retval);