2024-07-23 18:31:59 +08:00
|
|
|
|
namespace VirtualNes.Core
|
|
|
|
|
{
|
|
|
|
|
public class APU_INTERNAL : APU_INTERFACE
|
|
|
|
|
{
|
|
|
|
|
private NES nes;
|
2024-07-25 11:03:58 +08:00
|
|
|
|
private int FrameCycle;
|
|
|
|
|
private byte FrameIRQoccur;
|
2024-07-23 18:31:59 +08:00
|
|
|
|
|
|
|
|
|
public void SetParent(NES parent)
|
|
|
|
|
{
|
|
|
|
|
nes = parent;
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-25 11:03:58 +08:00
|
|
|
|
public override bool Sync(int cycles)
|
|
|
|
|
{
|
|
|
|
|
FrameCycle -= cycles * 2;
|
|
|
|
|
if (FrameCycle <= 0)
|
|
|
|
|
{
|
|
|
|
|
FrameCycle += 14915;
|
|
|
|
|
|
|
|
|
|
UpdateFrame();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var result = FrameIRQoccur | (SyncUpdateDPCM(cycles) ? 1 : 0);
|
|
|
|
|
return result != 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool SyncUpdateDPCM(int cycles)
|
|
|
|
|
{
|
|
|
|
|
//TODO : ʵ<><CAB5>
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void UpdateFrame()
|
|
|
|
|
{
|
|
|
|
|
//TODO : ʵ<><CAB5>
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-23 18:31:59 +08:00
|
|
|
|
public override void Reset(float fClock, int nRate)
|
|
|
|
|
{
|
|
|
|
|
throw new System.NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Setup(float fClock, int nRate)
|
|
|
|
|
{
|
|
|
|
|
throw new System.NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Write(ushort addr, byte data)
|
|
|
|
|
{
|
|
|
|
|
throw new System.NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override int Process(int channel)
|
|
|
|
|
{
|
|
|
|
|
throw new System.NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|