Fix bank switching in NesHawk's MMC5 impl. w/ 128 KiB WRAM
This commit is contained in:
parent
f58644cb5a
commit
06bf689e8d
|
@ -1,3 +1,7 @@
|
|||
#if DEBUG
|
||||
using System.Diagnostics;
|
||||
#endif
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Cores.Components;
|
||||
|
@ -169,7 +173,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
// for iNES, we assume 64K wram
|
||||
private int? MaskWRAM(int bank)
|
||||
{
|
||||
bank &= 7;
|
||||
#if DEBUG
|
||||
if (bank < 0 || (Cart.WramSize is 128 ? 0xF : 0x7) < bank) throw new ArgumentOutOfRangeException(paramName: nameof(bank), bank, message: "invalid bank index");
|
||||
#endif
|
||||
switch (Cart.WramSize)
|
||||
{
|
||||
case 0:
|
||||
|
@ -521,7 +527,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
|
||||
|
||||
case 0x1113: //$5113: [.... .PPP] (simplified, but technically inaccurate -- see below)
|
||||
wram_bank = value & 7;
|
||||
wram_bank = value & (Cart.WramSize is 128 ? 0b1111 : 0b0111);
|
||||
break;
|
||||
|
||||
//$5114-5117: [RPPP PPPP] PRG select
|
||||
|
|
Loading…
Reference in New Issue