GBHawk CDL - hook up mappers, test with MBC5

This commit is contained in:
zeromus 2018-11-14 21:10:01 -05:00
parent a8db56d8b2
commit 7143b2c83f
3 changed files with 55 additions and 12 deletions

View File

@ -62,8 +62,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
else
{
//return; mapper.ReadMemory(addr);
//TODO
mapper.MapCDL(addr, flags);
return;
}
}
@ -101,8 +100,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
else
{
//return mapper.ReadMemory(addr);
//TODO
mapper.MapCDL(addr, flags);
return;
}
}
@ -115,22 +113,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
else
{
//return mapper.ReadMemory(addr);
//TODO
mapper.MapCDL(addr, flags);
return;
}
}
else
{
//return mapper.ReadMemory(addr);
//TODO
mapper.MapCDL(addr, flags);
return;
}
}
else if (addr < 0x8000)
{
//return mapper.ReadMemory(addr);
//TODO
mapper.MapCDL(addr, flags);
return;
}
else if (addr < 0xA000)
@ -139,8 +134,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
else if (addr < 0xC000)
{
//return mapper.ReadMemory(addr);
//TODO
mapper.MapCDL(addr, flags);
return;
}
else if (addr < 0xD000)

View File

@ -1,6 +1,8 @@
using BizHawk.Common;
using System;
using BizHawk.Emulation.Common.Components.LR35902;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
public class MapperBase
@ -44,5 +46,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
public virtual void RTC_Get(byte value, int index)
{
}
public virtual void MapCDL(ushort addr, LR35902.eCDLog_Flags flags)
{
}
protected void SetCDLROM(LR35902.eCDLog_Flags flags, int cdladdr)
{
Core.DoCDL2(flags, "ROM", cdladdr);
}
protected void SetCDLRAM(LR35902.eCDLog_Flags flags, int cdladdr)
{
Core.DoCDL2(flags, "CartRAM", cdladdr);
}
}
}

View File

@ -2,6 +2,8 @@
using BizHawk.Common.NumberExtensions;
using System;
using BizHawk.Emulation.Common.Components.LR35902;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
// MBC5, common mapper for GBC games
@ -63,6 +65,37 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
}
public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags)
{
if (addr < 0x4000)
{
SetCDLROM(flags, addr);
}
else if (addr < 0x8000)
{
SetCDLROM(flags, (addr - 0x4000) + ROM_bank * 0x4000);
}
else
{
if (Core.cart_RAM != null)
{
if (RAM_enable && (((addr - 0xA000) + RAM_bank * 0x2000) < Core.cart_RAM.Length))
{
SetCDLRAM(flags, (addr - 0xA000) + RAM_bank * 0x2000);
}
else
{
return;
}
}
else
{
return;
}
}
}
public override byte PeekMemory(ushort addr)
{
return ReadMemory(addr);