2012-05-27 04:06:48 +00:00
|
|
|
|
using System;
|
2012-05-28 08:37:52 +00:00
|
|
|
|
using System.Collections.Generic;
|
2012-05-27 04:06:48 +00:00
|
|
|
|
using BizHawk.Emulation.CPUs.Z80GB;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
This Game Boy core was written using Imran Nazar's "GameBoy Emulation in
|
|
|
|
|
Javascript" series (http://imrannazar.com/GameBoy-Emulation-in-JavaScript) and
|
|
|
|
|
contains several comments from the articles.
|
|
|
|
|
*/
|
|
|
|
|
namespace BizHawk.Emulation.Consoles.GB
|
|
|
|
|
{
|
2012-05-28 08:37:52 +00:00
|
|
|
|
public partial class GB : IEmulator, IVideoProvider
|
2012-05-27 04:06:48 +00:00
|
|
|
|
{
|
|
|
|
|
private Z80 CPU;
|
2012-05-28 08:37:52 +00:00
|
|
|
|
private int lagCount = 0;
|
|
|
|
|
private bool isLagFrame = false;
|
2012-06-15 19:21:46 +00:00
|
|
|
|
private IList<MemoryDomain> memoryDomains = new List<MemoryDomain>();
|
2012-05-27 04:06:48 +00:00
|
|
|
|
|
|
|
|
|
public GB(GameInfo game, byte[] rom, bool skipBIOS)
|
|
|
|
|
{
|
|
|
|
|
inBIOS = !skipBIOS;
|
|
|
|
|
HardReset();
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-28 08:37:52 +00:00
|
|
|
|
public int BufferWidth { get { return 160; } }
|
|
|
|
|
public int BufferHeight { get { return 144; } }
|
|
|
|
|
public int BackgroundColor { get { return 0; } }
|
|
|
|
|
public CoreInputComm CoreInputComm { get; set; }
|
|
|
|
|
public CoreOutputComm CoreOutputComm { get; private set; }
|
|
|
|
|
public bool DeterministicEmulation { get; set; }
|
|
|
|
|
public void Dispose() { }
|
|
|
|
|
public int Frame { get; set; }
|
|
|
|
|
|
|
|
|
|
public void FrameAdvance(bool render)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-27 04:06:48 +00:00
|
|
|
|
public void HardReset()
|
|
|
|
|
{
|
|
|
|
|
CPU = new CPUs.Z80GB.Z80();
|
|
|
|
|
CPU.ReadMemory = ReadMemory;
|
|
|
|
|
CPU.WriteMemory = WriteMemory;
|
|
|
|
|
}
|
2012-05-28 08:37:52 +00:00
|
|
|
|
|
|
|
|
|
public int[] GetVideoBuffer()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } }
|
|
|
|
|
public bool IsLagFrame { get { return isLagFrame; } }
|
|
|
|
|
public int LagCount { get { return lagCount; } set { lagCount = value; } }
|
|
|
|
|
public void LoadStateBinary(System.IO.BinaryReader reader)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void LoadStateText(System.IO.TextReader reader)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public MemoryDomain MainMemory { get { return memoryDomains[0]; } }
|
|
|
|
|
|
|
|
|
|
public void ResetFrameCounter()
|
|
|
|
|
{
|
|
|
|
|
Frame = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public byte[] SaveRam { get { throw new NotImplementedException(); } }
|
|
|
|
|
public bool SaveRamModified { get { return false; } set { } }
|
|
|
|
|
|
|
|
|
|
public void SaveStateBinary(System.IO.BinaryWriter writer)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public byte[] SaveStateBinary()
|
|
|
|
|
{
|
|
|
|
|
return new byte[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SaveStateText(System.IO.TextWriter writer)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ISoundProvider SoundProvider { get { return new NullEmulator(); } }
|
|
|
|
|
public string SystemId { get { return "GB"; } }
|
|
|
|
|
public IVideoProvider VideoProvider { get { return this; } }
|
2012-05-27 04:06:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|