[pce] Improve ADPCM flags and interrupt handling
This commit is contained in:
parent
cf580b33df
commit
e8c3da9c1f
|
@ -23,6 +23,8 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
// ***************************************************************************
|
||||
|
||||
public bool AdpcmIsPlaying { get; private set; }
|
||||
public bool HalfReached { get; private set; }
|
||||
public bool EndReached { get; private set; }
|
||||
public bool AdpcmBusyWriting { get { return AdpcmCdDmaRequested; } }
|
||||
public bool AdpcmBusyReading { get { return ReadPending; } }
|
||||
public bool AdpcmCdDmaRequested { get { return (Port180B & 3) != 0; } }
|
||||
|
@ -66,7 +68,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
{
|
||||
pce = pcEngine;
|
||||
SCSI = scsi;
|
||||
MaxVolume = 16384;
|
||||
MaxVolume = 24576;
|
||||
}
|
||||
|
||||
public void AdpcmControlWrite(byte value)
|
||||
|
@ -78,10 +80,12 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
WriteAddress = 0;
|
||||
IOAddress = 0;
|
||||
nibble = false;
|
||||
AdpcmIsPlaying = false;
|
||||
HalfReached = false;
|
||||
EndReached = false;
|
||||
playingSample = 0;
|
||||
Playback44khzTimer = 0;
|
||||
magnitude = 0;
|
||||
AdpcmIsPlaying = false;
|
||||
}
|
||||
|
||||
if ((value & 8) != 0)
|
||||
|
@ -101,6 +105,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
if ((value & 0x10) != 0)
|
||||
{
|
||||
AdpcmLength = IOAddress;
|
||||
EndReached = false;
|
||||
//Console.WriteLine("SET LENGTH={0:X4}", adpcm_length);
|
||||
}
|
||||
|
||||
|
@ -140,6 +145,11 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
ReadPending = false;
|
||||
if (AdpcmLength > ushort.MinValue)
|
||||
AdpcmLength--;
|
||||
else
|
||||
{
|
||||
EndReached = true;
|
||||
HalfReached = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (WritePending && WriteTimer <= 0)
|
||||
|
@ -148,6 +158,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
WritePending = false;
|
||||
if (AdpcmLength < ushort.MaxValue)
|
||||
AdpcmLength++;
|
||||
HalfReached = AdpcmLength < 0x8000;
|
||||
}
|
||||
|
||||
if (AdpcmCdDmaRequested)
|
||||
|
@ -170,7 +181,8 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
}
|
||||
|
||||
pce.IRQ2Monitor &= 0xF3;
|
||||
if (AdpcmIsPlaying == false) pce.IRQ2Monitor |= 0x08;
|
||||
if (HalfReached) pce.IRQ2Monitor |= 0x04;
|
||||
if (EndReached) pce.IRQ2Monitor |= 0x08;
|
||||
pce.RefreshIRQ2();
|
||||
}
|
||||
|
||||
|
@ -289,9 +301,13 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
}
|
||||
nextSampleTimer--;
|
||||
|
||||
HalfReached = AdpcmLength < 0x8000;
|
||||
|
||||
if (AdpcmLength == 0)
|
||||
{
|
||||
AdpcmIsPlaying = false;
|
||||
EndReached = true;
|
||||
HalfReached = false;
|
||||
}
|
||||
|
||||
short adjustedSample = (short)((playingSample - 2048) * MaxVolume / 2048);
|
||||
|
|
|
@ -162,7 +162,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
Cpu.WriteMemory21 = WriteMemoryPopulous;
|
||||
}
|
||||
|
||||
if (game["ForceSpriteLimit"] || game.NotInDatabase || TurboCD)
|
||||
if (game["ForceSpriteLimit"] || game.NotInDatabase)
|
||||
{
|
||||
VDC1.PerformSpriteLimit = true;
|
||||
if (VDC2 != null)
|
||||
|
@ -173,7 +173,8 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
CDAudio.MaxVolume = int.Parse(game.OptionValue("CdVol"));
|
||||
if (game["PsgVol"])
|
||||
PSG.MaxVolume = int.Parse(game.OptionValue("PsgVol"));
|
||||
// TODO ADPCM
|
||||
if (game["AdpcmVol"])
|
||||
ADPCM.MaxVolume = int.Parse(game.OptionValue("AdpcmVol"));
|
||||
|
||||
// Ok, yes, HBlankPeriod's only purpose is game-specific hax.
|
||||
// 1) At least they're not coded directly into the emulator, but instead data-driven.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
|
||||
// IRQ2 interrupts:
|
||||
// 0x04 - INTA - ADPCM interrupt
|
||||
// 0x04 - INTA - ADPCM interrupt / Half Reached
|
||||
// 0x08 - INTSTOP - Fire when end of CD-Audio playback reached when in STOP MODE 2.
|
||||
// 0x10 - INTSUB - something with subchannel
|
||||
// 0x20 - INTM - Fires when data transfer is complete
|
||||
|
@ -258,10 +258,10 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
|
||||
case 0x180C: // ADPCM Status
|
||||
returnValue = 0;
|
||||
if (ADPCM.EndReached)
|
||||
returnValue |= 0x01;
|
||||
if (ADPCM.AdpcmIsPlaying)
|
||||
returnValue |= 0x08;
|
||||
else
|
||||
returnValue |= 0x01;
|
||||
if (ADPCM.AdpcmBusyWriting)
|
||||
returnValue |= 0x04;
|
||||
if (ADPCM.AdpcmBusyReading)
|
||||
|
|
|
@ -13,7 +13,7 @@ AADD9FA50FFB1DE04D8436E3E283F49C Bakuretsu Hunter PCE NeedSuperSysCard
|
|||
392C7E2094D1B5A6A51AD5F64DE6356F Bikini Girls PCE
|
||||
F583C57A1AF7164267E927386C89D2F4 Bishoujo Jyanshi Idol Pai (GECD) PCE
|
||||
BADBE7E4CE0BD917338CAC5DA8451382 Bishoujo Senshi Sailor Moon PCE NeedSuperSysCard
|
||||
3770A9888388B41A10C28841F9EFD15B Black Hole Assault PCE NeedSuperSysCard
|
||||
6A9ECD219DB07F7A6C22DD8557450F16 Black Hole Assault PCE NeedSuperSysCard;ForceSpriteLimit
|
||||
147F46AA1E72C204488035ABB6E8DD37 Blood Gear PCE NeedSuperSysCard
|
||||
067CB059A300BD731E7620803CAE044E Bomberman '94 Special Version PCE NeedSuperSysCard
|
||||
F4BCF27A1407EDD8AAF51C34E3EAF0C3 Bonk 3 PCE NeedSuperSysCard
|
||||
|
@ -60,7 +60,7 @@ C96792AA34C6EA050DEBD1EDA5944046 Hellfire S PCE
|
|||
0CF51518CCE1F807D5CF92ACBB6BEE33 Legion PCE
|
||||
26873893BAE98A25DF06118228B2B470 Lemmings PCE NeedSuperSysCard
|
||||
8C26362AB1C7FA22AE981431500E40DF Loom (U) PCE NeedSuperSysCard
|
||||
4EA3DA589C2A40D7E114B316FEA353A4 Lords of Thunder PCE NeedSuperSysCard
|
||||
0E6F0224D4FC083D281C747799CEA53F Lords of Thunder PCE NeedSuperSysCard
|
||||
FD8166D038239F1AEF641B14AF0F6BC4 Macross 2036 PCE
|
||||
F3C6E4A5BF25C1D0A6219FCCF8933046 Mad Stalker - Full Metal Force PCE NeedSuperSysCard;ArcadeCard
|
||||
52CA7465F10DDA85DC2D17B96A508621 Magical Fantasy Adventure - Popful Mail PCE NeedSuperSysCard;ArcadeCard;
|
||||
|
@ -92,7 +92,7 @@ DEF4EAE3C3565FAA7C1CADCAB61C89A3 Strider Hiryu PCE NeedSuperSysCard;ArcadeCard
|
|||
AE912784A40DEE31133F33ABFAB9522C Super Raiden PCE NeedSuperSysCard
|
||||
ECFD4A849AF8C7C88B8DAD3A9CFD804E Super Schwartzschild PCE NeedSuperSysCard
|
||||
3355BDD8F966E413E31A50412B18A282 Super Schwartzschild II PCE NeedSuperSysCard
|
||||
065F306DD079E506F953251FDCCE2444 Syd Mead's Terraforming PCE
|
||||
0A4AE6A1F3FBB5E7A47BBCD14C2F1999 Syd Mead's Terraforming PCE NeedSuperSysCard
|
||||
9E9BA0A787C06167919857AAC3505E11 Sylphia PCE NeedSuperSysCard
|
||||
BCB0530021FE2E2EAAA258D3C61EF2E4 Valis PCE NeedSuperSysCard
|
||||
05A0213934814E08EC6E7D4112200BD6 Valis II (U) PCE
|
||||
|
|
Loading…
Reference in New Issue