From cf8216ac461bd57d8e8d5dc2a0f2e823c0b0420f Mon Sep 17 00:00:00 2001 From: beirich Date: Wed, 28 Sep 2011 05:03:22 +0000 Subject: [PATCH] pce-cd: basically working pretty okay! (fixed bug causing issues with extended ADPCM playback sequences) --- BizHawk.Emulation/CPUs/HuC6280/Execute.cs | 5 ----- BizHawk.Emulation/Consoles/PC Engine/ADPCM.cs | 9 +++----- .../Consoles/PC Engine/Compat.txt | 10 --------- .../Consoles/PC Engine/ScsiCDBus.cs | 3 --- .../Consoles/PC Engine/TurboCD.cs | 21 ++----------------- 5 files changed, 5 insertions(+), 43 deletions(-) diff --git a/BizHawk.Emulation/CPUs/HuC6280/Execute.cs b/BizHawk.Emulation/CPUs/HuC6280/Execute.cs index fbd0e44f04..a26d2a93fa 100644 --- a/BizHawk.Emulation/CPUs/HuC6280/Execute.cs +++ b/BizHawk.Emulation/CPUs/HuC6280/Execute.cs @@ -44,11 +44,6 @@ namespace BizHawk.Emulation.CPUs.H6280 if (IRQ2Assert && FlagI == false && LagIFlag == false && (IRQControlByte & IRQ2Selector) == 0 && InBlockTransfer == false) { - Console.WriteLine("============================================================"); - Console.WriteLine(" ENTERING IRQ2"); - Console.WriteLine(" 1802: {0:X2}, 1803: {1:X2}, && {2:X2}",PCEngine.CdIoPorts[2], PCEngine.CdIoPorts[3], PCEngine.CdIoPorts[2] & PCEngine.CdIoPorts[3]); - Console.WriteLine("============================================================"); - WriteMemory((ushort)(S-- + 0x2100), (byte)(PC >> 8)); WriteMemory((ushort)(S-- + 0x2100), (byte)PC); WriteMemory((ushort)(S-- + 0x2100), (byte)(P & (~0x10))); diff --git a/BizHawk.Emulation/Consoles/PC Engine/ADPCM.cs b/BizHawk.Emulation/Consoles/PC Engine/ADPCM.cs index 914af7f531..07084b6fbb 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/ADPCM.cs +++ b/BizHawk.Emulation/Consoles/PC Engine/ADPCM.cs @@ -100,18 +100,16 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx { AdpcmLength = IOAddress; EndReached = false; - //Console.WriteLine("SET LENGTH={0:X4}", adpcm_length); } if (AdpcmIsPlaying && (value & 0x20) == 0) - AdpcmIsPlaying = false; // only plays as long as this bit is set + AdpcmIsPlaying = false; // clearing this bit stops playback if (AdpcmIsPlaying == false && (value & 0x20) != 0) { if ((value & 0x40) == 0) Console.WriteLine("a thing thats normally set is not set"); - //Console.WriteLine("Start playing! READ {0:X4} LENGTH {1:X4}", ReadAddress, AdpcmLength); AdpcmIsPlaying = true; playingSample = 2048; magnitude = 0; @@ -143,6 +141,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx { EndReached = true; HalfReached = false; + //Port180D &= 0x9F; } } @@ -161,6 +160,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx { byte dmaByte = SCSI.DataBits; RAM[WriteAddress++] = dmaByte; + AdpcmLength++; SCSI.ACK = false; SCSI.REQ = false; @@ -168,10 +168,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx } if (SCSI.DataTransferInProgress == false) - { Port180B = 0; - //Console.WriteLine(" ADPCM DMA COMPLETED"); - } } pce.IntADPCM = HalfReached; diff --git a/BizHawk.Emulation/Consoles/PC Engine/Compat.txt b/BizHawk.Emulation/Consoles/PC Engine/Compat.txt index 8fde642ea8..340fca4a9a 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/Compat.txt +++ b/BizHawk.Emulation/Consoles/PC Engine/Compat.txt @@ -1,14 +1,6 @@ ****************************************************** * Turbo CD Issues * ****************************************************** -- General, issues where ADPCM cuts out after a few seconds - - Bakuretsu Hunter - - Download II - - Dracula X when you rescue Maria - - Dragon Slayer - - Dungeon Explorer II - - Magicoal - - Ys IV - Graphics corruption: - Camp California, check seagull during opening @@ -18,11 +10,9 @@ Still some lesser issues with cancelling a fadeout. Otherwise CDDA is working now... - Develo Magazine demo game -Arcade Card games: - JANSHIN DENSETSU sets the T flag prior to an LDA instruction; MANY TIMES (ie it doesnt seem to be an accident). Unclear if T flag actually affects LDA instruction. - Ryuuko no Ken is all messed up, and I don't super care :| - - Record of Lodoss War wont start game from title screen - Valis: Screen is black during entire intro section diff --git a/BizHawk.Emulation/Consoles/PC Engine/ScsiCDBus.cs b/BizHawk.Emulation/Consoles/PC Engine/ScsiCDBus.cs index b44306aace..bd7fdfa227 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/ScsiCDBus.cs +++ b/BizHawk.Emulation/Consoles/PC Engine/ScsiCDBus.cs @@ -167,7 +167,6 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx { if (DataIn.Count == 0) { - //Console.WriteLine("Sector available to read!!!"); // read in a sector and shove it in the queue disc.ReadLBA_2048(CurrentReadingSector, DataIn.GetBuffer(), 0); DataIn.SignalBufferFilled(2048); @@ -279,7 +278,6 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx pce.IntDataTransferReady = false; if (DataTransferWasDone) { - Console.WriteLine("DATA TRANSFER FINISHED!"); DataTransferInProgress = false; DataTransferWasDone = false; pce.IntDataTransferComplete = true; @@ -393,7 +391,6 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx if (CommandBuffer[4] == 0) SectorsLeftToRead = 256; - Console.WriteLine("STARTED READ: {0} SECTORS FROM {1}",SectorsLeftToRead, CurrentReadingSector); DataReadWaitTimer = pce.Cpu.TotalExecutedCycles + 5000; // figure out proper read delay later pce.CDAudio.Stop(); } diff --git a/BizHawk.Emulation/Consoles/PC Engine/TurboCD.cs b/BizHawk.Emulation/Consoles/PC Engine/TurboCD.cs index 8eebdc3c40..294582ef47 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/TurboCD.cs +++ b/BizHawk.Emulation/Consoles/PC Engine/TurboCD.cs @@ -4,7 +4,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx { public partial class PCEngine { - public static byte[] CdIoPorts = new byte[16]; + public byte[] CdIoPorts = new byte[16]; public bool IntADPCM // INTA { @@ -36,7 +36,6 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx { CDAudio.CallbackAction = () => { - Console.WriteLine("FIRING CD-AUDIO STOP IRQ MAYBE!"); IntDataTransferReady = false; IntDataTransferComplete = true; }; @@ -64,14 +63,6 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx CdIoPorts[2] = value; SCSI.ACK = ((value & 0x80) != 0); - if ((CdIoPorts[2] & 0x04) != 0) Log.Error("CD", "INTA enable"); - if ((CdIoPorts[2] & 0x08) != 0) Log.Error("CD", "INTSTOP enable"); - if ((CdIoPorts[2] & 0x10) != 0) Log.Error("CD", "INTSUB enable"); - if ((CdIoPorts[2] & 0x20) != 0) Log.Error("CD", "INTM enable"); - if ((CdIoPorts[2] & 0x40) != 0) Log.Error("CD", "INTD enable"); - if ((Cpu.IRQControlByte & 0x01) == 0 && - (CdIoPorts[2] & 0x7C) != 0) Log.Error("CD", "BTW, IRQ2 is not masked"); - SCSI.Think(); RefreshIRQ2(); break; @@ -89,7 +80,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx case 0x1805: case 0x1806: - // Latch CDDA data... no action needed for us + // Latch CDDA data... no action needed for us (because we cheat) break; case 0x1807: // BRAM Unlock @@ -101,20 +92,14 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx ADPCM.IOAddress &= 0xFF00; ADPCM.IOAddress |= value; if ((CdIoPorts[0x0D] & 0x10) != 0) - { Console.WriteLine("doing silly thing"); - ADPCM.AdpcmLength = ADPCM.IOAddress; - } break; case 0x1809: // ADPCM address MSB ADPCM.IOAddress &= 0x00FF; ADPCM.IOAddress |= (ushort)(value << 8); if ((CdIoPorts[0x0D] & 0x10) != 0) - { Console.WriteLine("doing silly thing"); - ADPCM.AdpcmLength = ADPCM.IOAddress; - } break; case 0x180A: // ADPCM Memory Read/Write Port @@ -123,8 +108,6 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx case 0x180B: // ADPCM DMA Control ADPCM.Port180B = value; - if (ADPCM.AdpcmCdDmaRequested) - Console.WriteLine(" ADPCM DMA REQUESTED"); break; case 0x180D: // ADPCM Address Control