[NES] clean up UxROM gamedb parameters
This commit is contained in:
parent
7919bb8647
commit
e9622b1f60
|
@ -12,13 +12,13 @@ namespace BizHawk.Emulation.Consoles.Nintendo.Boards
|
||||||
//Duck Tales
|
//Duck Tales
|
||||||
//Metal Gear
|
//Metal Gear
|
||||||
|
|
||||||
//TODO - simplify logic and handle fewer (known) cases (e.g. no IsPowerOfTwo, but rather hardcoded cases)
|
//TODO - look for a mirror=H UNROM--maybe there are none? this may be fixed to the board type.
|
||||||
|
|
||||||
public class UxROM : NES.NESBoardBase
|
public class UxROM : NES.NESBoardBase
|
||||||
{
|
{
|
||||||
//configuration
|
//configuration
|
||||||
string type;
|
string type;
|
||||||
int pagemask;
|
int prg_mask;
|
||||||
int cram_mask;
|
int cram_mask;
|
||||||
|
|
||||||
//state
|
//state
|
||||||
|
@ -32,29 +32,32 @@ namespace BizHawk.Emulation.Consoles.Nintendo.Boards
|
||||||
public override void Initialize(NES.RomInfo romInfo, NES nes)
|
public override void Initialize(NES.RomInfo romInfo, NES nes)
|
||||||
{
|
{
|
||||||
base.Initialize(romInfo, nes);
|
base.Initialize(romInfo, nes);
|
||||||
Debug.Assert(Util.IsPowerOfTwo(RomInfo.PRG_Size));
|
Debug.Assert(RomInfo.PRG_Size == 8 || RomInfo.PRG_Size == 16);
|
||||||
|
Debug.Assert(RomInfo.CRAM_Size == -1, "don't specify in gamedb, it is redundant");
|
||||||
|
|
||||||
if (type == "UNROM") pagemask = 7;
|
if (type == "UNROM") prg_mask = 7;
|
||||||
else if (type == "UOROM") pagemask = 15;
|
else if (type == "UOROM") prg_mask = 15;
|
||||||
else throw new InvalidOperationException("Invalid UxROM type");
|
else throw new InvalidOperationException("Invalid UxROM type");
|
||||||
|
|
||||||
//guess CRAM size (this is a very confident guess!)
|
//regardless of what the board is equipped to handle, reduce the mask to how much ROM is actually present
|
||||||
//(should these guesses be here?) (is this a guess? maybe all these boards have cram)
|
int rom_prg_mask = (RomInfo.PRG_Size - 1);
|
||||||
if (RomInfo.CRAM_Size == -1) RomInfo.CRAM_Size = 8;
|
if (rom_prg_mask < prg_mask) prg_mask = rom_prg_mask;
|
||||||
|
|
||||||
|
//these boards always have 8KB of CRAM
|
||||||
|
RomInfo.CRAM_Size = 8;
|
||||||
cram = new byte[RomInfo.CRAM_Size * 1024];
|
cram = new byte[RomInfo.CRAM_Size * 1024];
|
||||||
cram_mask = cram.Length - 1;
|
cram_mask = cram.Length - 1;
|
||||||
}
|
}
|
||||||
public override byte ReadPRG(int addr)
|
public override byte ReadPRG(int addr)
|
||||||
{
|
{
|
||||||
int block = addr >> 14;
|
int block = addr >> 14;
|
||||||
int page = block == 1 ? pagemask : prg;
|
int page = block == 1 ? prg_mask : prg;
|
||||||
int ofs = addr & 0x3FFF;
|
int ofs = addr & 0x3FFF;
|
||||||
return RomInfo.ROM[(page << 14) | ofs];
|
return RomInfo.ROM[(page << 14) | ofs];
|
||||||
}
|
}
|
||||||
public override void WritePRG(int addr, byte value)
|
public override void WritePRG(int addr, byte value)
|
||||||
{
|
{
|
||||||
prg = value & pagemask;
|
prg = value & prg_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override byte ReadPPU(int addr)
|
public override byte ReadPPU(int addr)
|
||||||
|
|
|
@ -2343,14 +2343,14 @@ E12F3FD85F96F9A61FE38626A1B5CEFA Spot (J) NES board=SNROM;PRG=8
|
||||||
;UNROM
|
;UNROM
|
||||||
29E5E1A5F8B400773EF9D959044456B2 3-D Battles of World Running (U) NES board=UNROM;mirror=V;PRG=8
|
29E5E1A5F8B400773EF9D959044456B2 3-D Battles of World Running (U) NES board=UNROM;mirror=V;PRG=8
|
||||||
CE4D5BDA746A72E02FCFD547492551BC JJ - Tobidase Daisakusen Part 2 (J) NES board=UNROM;mirror=V;PRG=8
|
CE4D5BDA746A72E02FCFD547492551BC JJ - Tobidase Daisakusen Part 2 (J) NES board=UNROM;mirror=V;PRG=8
|
||||||
4DE82CFCEADBF1A5E693B669B1221107 Mega Man (U) NES board=UNROM;mirror=V;PRG=8;CHR=0;CRAM=8
|
4DE82CFCEADBF1A5E693B669B1221107 Mega Man (U) NES board=UNROM;mirror=V;PRG=8
|
||||||
756170BA1E06FA26C60D10114DC6A5AE Castlevania (Rev 0) (U) NES board=UNROM;mirror=V;PRG=8;CHR=0;CRAM=8
|
756170BA1E06FA26C60D10114DC6A5AE Castlevania (Rev 0) (U) NES board=UNROM;mirror=V;PRG=8
|
||||||
728E05F245AB8B7FE61083F6919DC485 Castlevania (Rev 1) (U) NES board=UNROM;mirror=V;PRG=8;CHR=0;CRAM=8
|
728E05F245AB8B7FE61083F6919DC485 Castlevania (Rev 1) (U) NES board=UNROM;mirror=V;PRG=8
|
||||||
5A5C2F4F1CAFB1F55A8DC0D5AD4550E5 Contra (U) NES board=UNROM;mirror=V;PRG=8;CHR=0;CRAM=8
|
5A5C2F4F1CAFB1F55A8DC0D5AD4550E5 Contra (U) NES board=UNROM;mirror=V;PRG=8
|
||||||
B480855FFF883B20BA403A2009A7F13C Duck Tales (U) NES board=UNROM;mirror=V;PRG=8;CHR=0;CRAM=8
|
B480855FFF883B20BA403A2009A7F13C Duck Tales (U) NES board=UNROM;mirror=V;PRG=8
|
||||||
|
|
||||||
;UOROM
|
;UOROM
|
||||||
C0C74CC78E6CD34775A83CC21A0C75B5 Paperboy 2 (U) NES board=UOROM;mirror=H;PRG=16;CHR=0;CRAM=8
|
C0C74CC78E6CD34775A83CC21A0C75B5 Paperboy 2 (U) NES board=UOROM;mirror=H;PRG=16;CRAM=8
|
||||||
|
|
||||||
;mapper66? mhrom? wtf??
|
;mapper66? mhrom? wtf??
|
||||||
;27100B746D50E6AE6FBAE2C794173240 Metal Gear (U) NES board=UXROM;mirror=H;PRG=8;CHR=0;CRAM=8;bug=1
|
;27100B746D50E6AE6FBAE2C794173240 Metal Gear (U) NES board=UXROM;mirror=H;PRG=8;CHR=0;CRAM=8;bug=1
|
||||||
|
|
Loading…
Reference in New Issue