[PCE] DMA handling improvements. Fixes sprite flicker issues on some games (ex: Dragon Curse), and several games that didn't boot or froze (ex: Magical Chase)

This commit is contained in:
beirich 2011-02-27 08:06:21 +00:00
parent d381be67a6
commit 303d276ac7
3 changed files with 37 additions and 11 deletions

View File

@ -16,7 +16,6 @@ Chouzetsu Rinjin - Doesnt boot
Cyber Dodge - Minor gfx issues
Davis Cup Tennis - uh lets just say it doesnt work in creative ways
Dead Moon - Minor gfx issues
Dragon Curse - Terribly annoying sprite flicker - presumably timing related
Dragon Egg - Doesn't boot
Fighting Run - Corruption issues
Final Solider - Graphics corruption issues
@ -25,24 +24,25 @@ Gunboat - Crash / CPU Break (Needs BRAM)
Hisou Kihei Serd - Doesn't boot
Idol Hanafuda Fan Club - Doesn't boot
Impossamole - Gfx issues
Legendary Axe - Doesn't boot
Legendary Axe II - Corruption, freezes in opening sequence
Legendary Axe - Boots with bad gfx corruption - needs a T-flag opcode update
Legendary Axe II - Some gfx issues, but playable now
Madoo Granzort - Graphics issues because VPC renderer is not using new frame timing
Magical Chase - Freezes when starting 1st level - waiting for DMA completion IRQ?
MML Demo - Echo channels are too loud (equal volume!)
Naxat Open - Crashes when you start new game
New Adventure Island - Minor gfx issues
Night Creatures - Some gfx glitches
Outrun - 'Sea Wind' sample when selecting music is not playing ...... raster issues, now more annoying than before
Outrun - 'Sea Wind' sample when selecting music is not playing, raster issues, music slows when paused
Populous - Game freezes on starting new game - *** NEEDS BATTERY SAVERAM ***
Power Drift - Timing glitch... starting new game runs slower than it should
R-Type - Funky corruption after killing final boss in Stage 8
Raiden - Sprites and BG get out of sync with current timing
Side Arms - Video timing issue - bottom arms display shouldn't be visible
Sinistron - Raster effect errors
Soldier Blade - Freezes about 5 minutes in. Always in the same spot, fortunately. I have a savestate.
Strip Fighter - Minor gfx glitches (status area)
Thunder Blade - After beating the 1st 3d area, game semi-freezes
Turrican - Playable, issues with opening sequence
Valkyrie No Densetsu - Freezes in title sequence
Valkyrie No Densetsu - Boots now, but with pretty severe issues
Stuff I Fixed That's Not In Other Docs:
@ -55,4 +55,6 @@ Stuff I Fixed That's Not In Other Docs:
Cross Wiber, Jackie Chan, Jigoku Meguri, New Adventure Island, World Beach volley
- Actually, I'm not at all convinced there's always a 1-instruction delay on the I-flag.
But this fixes several games; clearly there are delays in some scenarios. But it's not clear
to me that this delay is ALWAYS present.
to me that this delay is ALWAYS present.
+ Writing to the SATB location register of the VDC requests a VRAM->SAT DMA even if the SAT DMA
bit is disabled in the DCR.

View File

@ -88,6 +88,9 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
cpu.Execute(455-hblankCycles);
if (InActiveDisplay == false && DmaRequested)
RunDmaForScanline();
ScanLine++;
ActiveLine++;
RCRCount++;
@ -107,12 +110,20 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
public void UpdateSpriteAttributeTable()
{
if (/*(Registers[DCR] & 0x10) != 0 &&*/ Registers[SATB] <= 0x7F00)
if ((SatDmaRequested || (Registers[DCR] & 0x10) != 0) && Registers[SATB] <= 0x7F00)
{
SatDmaRequested = false;
for (int i = 0; i < 256; i++)
{
SpriteAttributeTable[i] = VRAM[Registers[SATB] + i];
}
if ((Registers[DCR] & 1) > 0)
{
Console.WriteLine("FIRING SATB DMA COMPLETION IRQ");
StatusByte |= StatusVramSatDmaComplete;
cpu.IRQ1Assert = true;
}
}
}
@ -158,7 +169,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
}
}
private static byte[] heightTable = { 16, 32, 64, 64 };
private byte[] heightTable = { 16, 32, 64, 64 };
public void RenderSpritesScanline()
{

View File

@ -17,6 +17,8 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
public ushort[] Registers = new ushort[0x20];
public ushort ReadBuffer;
public byte StatusByte;
private bool DmaRequested;
private bool SatDmaRequested;
public ushort IncrementWidth
{
@ -160,7 +162,10 @@ break;
Console.WriteLine("VCR / END POSITION: "+(Registers[VCR] & 0xFF));
break;
case LENR: // Initiate DMA transfer
InitiateDMA();
DmaRequested = true;
break;
case SATB:
SatDmaRequested = true;
break;
}
}
@ -192,9 +197,10 @@ break;
return 0;
}
private void InitiateDMA()
private void RunDmaForScanline()
{
Console.WriteLine("DOING DMA ********************************************* ");
DmaRequested = false;
int advanceSource = (Registers[DCR] & 4) == 0 ? +1 : -1;
int advanceDest = (Registers[DCR] & 8) == 0 ? +1 : -1;
@ -206,6 +212,13 @@ break;
Registers[DESR] = (ushort)(Registers[DESR] + advanceDest);
Registers[SOUR] = (ushort)(Registers[SOUR] + advanceSource);
}
if ((Registers[DCR] & 2) > 0)
{
Console.WriteLine("FIRE VRAM-VRAM DMA COMPLETE IRQ");
StatusByte |= StatusVramVramDmaComplete;
cpu.IRQ1Assert = true;
}
}
public void UpdatePatternData(ushort addr)