2024-08-29 17:20:01 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace VirtualNes.Core
|
2024-07-23 18:31:59 +08:00
|
|
|
|
{
|
2024-08-29 17:20:01 +08:00
|
|
|
|
public abstract class APU_INTERFACE : IStateBufferObject
|
2024-07-23 18:31:59 +08:00
|
|
|
|
{
|
2024-07-26 17:52:33 +08:00
|
|
|
|
public const float APU_CLOCK = 1789772.5f;
|
|
|
|
|
|
|
|
|
|
public virtual void Dispose() { }
|
|
|
|
|
|
2024-07-23 18:31:59 +08:00
|
|
|
|
public abstract void Reset(float fClock, int nRate);
|
|
|
|
|
public abstract void Setup(float fClock, int nRate);
|
|
|
|
|
public abstract void Write(ushort addr, byte data);
|
|
|
|
|
public abstract int Process(int channel);
|
|
|
|
|
public virtual byte Read(ushort addr)
|
|
|
|
|
{
|
|
|
|
|
return (byte)(addr >> 8);
|
|
|
|
|
}
|
|
|
|
|
public virtual void WriteSync(ushort addr, byte data) { }
|
|
|
|
|
public virtual byte ReadSync(ushort addr) { return 0; }
|
|
|
|
|
public virtual void VSync() { }
|
|
|
|
|
public virtual bool Sync(int cycles) { return false; }
|
|
|
|
|
public virtual int GetFreq(int channel) { return 0; }
|
2024-08-29 17:20:01 +08:00
|
|
|
|
public virtual void SaveState(StateBuffer buffer) { }
|
2024-07-23 18:31:59 +08:00
|
|
|
|
public virtual void LoadState(byte[] p) { }
|
2024-08-16 10:20:00 +08:00
|
|
|
|
|
2024-07-26 17:52:33 +08:00
|
|
|
|
public static int INT2FIX(int x)
|
|
|
|
|
{
|
|
|
|
|
return x << 16;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static int FIX2INT(int x)
|
|
|
|
|
{
|
|
|
|
|
return x >> 16;
|
|
|
|
|
}
|
2024-08-29 17:20:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public virtual uint GetSize()
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2024-07-23 18:31:59 +08:00
|
|
|
|
}
|
|
|
|
|
}
|