gbhawk CDL - all the mappers. not tested very thoroughly.

This commit is contained in:
zeromus 2018-11-14 21:27:13 -05:00
parent 7143b2c83f
commit 6dd6314c87
16 changed files with 468 additions and 1 deletions

View File

@ -2,6 +2,8 @@
using BizHawk.Common.NumberExtensions;
using System;
using BizHawk.Emulation.Common.Components.LR35902;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
// Default mapper with no bank switching
@ -31,6 +33,25 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
}
public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags)
{
if (addr < 0x8000)
{
SetCDLROM(flags, addr);
}
else
{
if (Core.cart_RAM != null)
{
SetCDLRAM(flags, addr - 0xA000);
}
else
{
return;
}
}
}
public override byte PeekMemory(ushort addr)
{
return ReadMemory(addr);

View File

@ -2,6 +2,8 @@
using BizHawk.Common.NumberExtensions;
using System;
using BizHawk.Emulation.Common.Components.LR35902;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
// Default mapper with no bank switching
@ -31,6 +33,25 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
}
public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags)
{
if (addr < 0x8000)
{
SetCDLROM(flags, addr);
}
else
{
if (Core.cart_RAM != null)
{
SetCDLRAM(flags, addr - 0xA000);
}
else
{
return;
}
}
}
public override byte PeekMemory(ushort addr)
{
return ReadMemory(addr);

View File

@ -2,6 +2,8 @@
using BizHawk.Common.NumberExtensions;
using System;
using BizHawk.Emulation.Common.Components.LR35902;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
// hudson mapper used in ex Daikaijuu monogatari
@ -75,6 +77,47 @@ 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 ((addr >= 0xA000) && (addr < 0xC000))
{
if (RAM_enable)
{
if (Core.cart_RAM != null)
{
if (((addr - 0xA000) + RAM_bank * 0x2000) < Core.cart_RAM.Length)
{
SetCDLRAM(flags, (addr - 0xA000) + RAM_bank * 0x2000);
}
else
{
return;
}
}
else
{
return;
}
}
else
{
return;
}
}
else
{
return;
}
}
public override byte PeekMemory(ushort addr)
{
return ReadMemory(addr);

View File

@ -2,6 +2,8 @@
using BizHawk.Common.NumberExtensions;
using System;
using BizHawk.Emulation.Common.Components.LR35902;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
// Default mapper with no bank switching
@ -31,6 +33,25 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
}
public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags)
{
if (addr < 0x8000)
{
SetCDLROM(flags, addr);
}
else
{
if (Core.cart_RAM != null)
{
SetCDLRAM(flags, addr - 0xA000);
}
else
{
return;
}
}
}
public override byte PeekMemory(ushort addr)
{
return ReadMemory(addr);

View File

@ -2,6 +2,8 @@
using BizHawk.Common.NumberExtensions;
using System;
using BizHawk.Emulation.Common.Components.LR35902;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
// MBC1 with bank switching and RAM
@ -72,6 +74,45 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
}
public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags)
{
if (addr < 0x4000)
{
// lowest bank is fixed, but is still effected by mode
if (sel_mode)
{
SetCDLROM(flags, (ROM_bank & 0x60) * 0x4000 + addr);
}
else
{
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);

View File

@ -2,6 +2,8 @@
using BizHawk.Common.NumberExtensions;
using System;
using BizHawk.Emulation.Common.Components.LR35902;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
// MBC1 with bank switching and RAM
@ -68,6 +70,45 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
}
public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags)
{
if (addr < 0x4000)
{
// lowest bank is fixed, but is still effected by mode
if (sel_mode)
{
SetCDLROM(flags, ((ROM_bank & 0x60) >> 1) * 0x4000 + addr);
}
else
{
SetCDLROM(flags, addr);
}
}
else if (addr < 0x8000)
{
SetCDLROM(flags, (addr - 0x4000) + (((ROM_bank & 0x60) >> 1) | (ROM_bank & 0xF)) * 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);

View File

@ -2,6 +2,8 @@
using BizHawk.Common.NumberExtensions;
using System;
using BizHawk.Emulation.Common.Components.LR35902;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
// MBC2 with bank switching and RAM
@ -44,6 +46,30 @@ 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 ((addr >= 0xA000) && (addr < 0xA200))
{
if (RAM_enable)
{
SetCDLRAM(flags, addr - 0xA000);
}
return;
}
else
{
return;
}
}
public override byte PeekMemory(ushort addr)
{
return ReadMemory(addr);

View File

@ -2,6 +2,8 @@
using BizHawk.Common.NumberExtensions;
using System;
using BizHawk.Emulation.Common.Components.LR35902;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
// MBC3 mapper with Real Time Clock
@ -79,7 +81,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
return 0xFF;
}
}
}
else
{
return 0xFF;
@ -87,6 +89,48 @@ 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 (RAM_enable)
{
if ((Core.cart_RAM != null) && (RAM_bank < 3))
{
if (((addr - 0xA000) + RAM_bank * 0x2000) < Core.cart_RAM.Length)
{
SetCDLRAM(flags, (addr - 0xA000) + RAM_bank * 0x2000);
}
else
{
return;
}
}
if ((RAM_bank >= 8) && (RAM_bank < 0xC))
{
return;
}
else
{
return;
}
}
else
{
return;
}
}
}
public override byte PeekMemory(ushort addr)
{
return ReadMemory(addr);

View File

@ -2,6 +2,8 @@
using BizHawk.Common.NumberExtensions;
using System;
using BizHawk.Emulation.Common.Components.LR35902;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
// Default mapper with no bank switching
@ -31,6 +33,25 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
}
public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags)
{
if (addr < 0x8000)
{
SetCDLROM(flags, addr);
}
else
{
if (Core.cart_RAM != null)
{
SetCDLRAM(flags, addr - 0xA000);
}
else
{
return;
}
}
}
public override byte PeekMemory(ushort addr)
{
return ReadMemory(addr);

View File

@ -2,6 +2,8 @@
using BizHawk.Common.NumberExtensions;
using System;
using BizHawk.Emulation.Common.Components.LR35902;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
// Mapper with built in EEPROM, also used with Kirby's tilt 'n tumble
@ -81,6 +83,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 (addr < 0xA000)
{
return;
}
else if (addr < 0xB000)
{
if (RAM_enable_1 && RAM_enable_2)
{
return;
}
else
{
return;
}
}
else
{
return;
}
}
public override byte PeekMemory(ushort addr)
{
return ReadMemory(addr);

View File

@ -2,6 +2,8 @@
using BizHawk.Common.NumberExtensions;
using System;
using BizHawk.Emulation.Common.Components.LR35902;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
// Default mapper with no bank switching
@ -31,6 +33,25 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
}
public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags)
{
if (addr < 0x8000)
{
SetCDLROM(flags, addr);
}
else
{
if (Core.cart_RAM != null)
{
SetCDLRAM(flags, addr - 0xA000);
}
else
{
return;
}
}
}
public override byte PeekMemory(ushort addr)
{
return ReadMemory(addr);

View File

@ -2,6 +2,8 @@
using BizHawk.Common.NumberExtensions;
using System;
using BizHawk.Emulation.Common.Components.LR35902;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
// RockMan 8, just some simple bankswitching
@ -37,6 +39,24 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
}
public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags)
{
if (addr < 0x4000)
{
// lowest bank is fixed
SetCDLROM(flags, addr);
}
else if (addr < 0x8000)
{
SetCDLROM(flags, (addr - 0x4000) + ROM_bank * 0x4000);
}
else
{
return;
}
}
public override byte PeekMemory(ushort addr)
{
return ReadMemory(addr);

View File

@ -2,6 +2,8 @@
using BizHawk.Common.NumberExtensions;
using System;
using BizHawk.Emulation.Common.Components.LR35902;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
// Sachen Bootleg Mapper
@ -69,6 +71,43 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
}
public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags)
{
if (addr < 0x4000)
{
if (locked)
{
// header is scrambled
if ((addr >= 0x100) && (addr < 0x200))
{
int temp0 = (addr & 1);
int temp1 = (addr & 2);
int temp4 = (addr & 0x10);
int temp6 = (addr & 0x40);
temp0 = temp0 << 6;
temp1 = temp1 << 3;
temp4 = temp4 >> 3;
temp6 = temp6 >> 6;
addr &= 0x1AC;
addr |= (ushort)(temp0 | temp1 | temp4 | temp6);
}
addr |= 0x80;
}
SetCDLROM(flags, addr + BASE_ROM_Bank * 0x4000);
}
else if (addr < 0x8000)
{
SetCDLROM(flags, (addr - 0x4000) + ROM_bank * 0x4000);
}
else
{
return;
}
}
public override byte PeekMemory(ushort addr)
{
return ReadMemory(addr);

View File

@ -2,6 +2,8 @@
using BizHawk.Common.NumberExtensions;
using System;
using BizHawk.Emulation.Common.Components.LR35902;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
// Sachen Bootleg Mapper
@ -72,6 +74,44 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
}
public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags)
{
if (addr < 0x4000)
{
// header is scrambled
if ((addr >= 0x100) && (addr < 0x200))
{
int temp0 = (addr & 1);
int temp1 = (addr & 2);
int temp4 = (addr & 0x10);
int temp6 = (addr & 0x40);
temp0 = temp0 << 6;
temp1 = temp1 << 3;
temp4 = temp4 >> 3;
temp6 = temp6 >> 6;
addr &= 0x1AC;
addr |= (ushort)(temp0 | temp1 | temp4 | temp6);
}
if (locked_GBC) { addr |= 0x80; }
SetCDLROM(flags, addr + BASE_ROM_Bank * 0x4000);
}
else if (addr < 0x8000)
{
int temp_bank = (ROM_bank & ~ROM_bank_mask) | (ROM_bank_mask & BASE_ROM_Bank);
temp_bank &= ROM_mask;
SetCDLROM(flags, (addr - 0x4000) + temp_bank * 0x4000);
}
else
{
return;
}
}
public override byte PeekMemory(ushort addr)
{
return ReadMemory(addr);

View File

@ -2,6 +2,8 @@
using BizHawk.Common.NumberExtensions;
using System;
using BizHawk.Emulation.Common.Components.LR35902;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
// Default mapper with no bank switching
@ -31,6 +33,25 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
}
public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags)
{
if (addr < 0x8000)
{
SetCDLROM(flags, addr);
}
else
{
if (Core.cart_RAM != null)
{
SetCDLRAM(flags, addr - 0xA000);
}
else
{
return;
}
}
}
public override byte PeekMemory(ushort addr)
{
return ReadMemory(addr);

View File

@ -2,6 +2,8 @@
using BizHawk.Common.NumberExtensions;
using System;
using BizHawk.Emulation.Common.Components.LR35902;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
// Wisdom tree mapper (32K bank switching)
@ -32,6 +34,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
}
public override void MapCDL(ushort addr, LR35902.eCDLog_Flags flags)
{
if (addr < 0x8000)
{
SetCDLROM(flags, ROM_bank * 0x8000 + addr);
}
else
{
return;
}
}
public override byte PeekMemory(ushort addr)
{
return ReadMemory(addr);