NES: support worthless garbage

This commit is contained in:
goyuken 2014-01-31 04:15:18 +00:00
parent 4f65c621e5
commit a9e4baa380
1 changed files with 9 additions and 4 deletions

View File

@ -122,7 +122,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
prg_bank_mask_8k = Cart.prg_size / 8 - 1;
chr_bank_mask_1k = Cart.chr_size - 1;
if (Cart.chr_size > 0)
chr_bank_mask_1k = Cart.chr_size - 1;
else
chr_bank_mask_1k = Cart.vram_size - 1;
wram_bank_mask_8k = Cart.wram_size / 8 - 1;
PoweronState();
@ -225,7 +229,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
if (addr < 0x2000)
{
addr = MapCHR(addr);
return VROM[addr];
return (VROM ?? VRAM)[addr];
}
else
{
@ -258,7 +262,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
}
int nt = (addr >> 10) & 3; // &3 to read from the NT mirrors at 3xxx
int offset = addr & ((1<<10)-1);
int offset = addr & ((1 << 10) - 1);
nt = nt_modes[nt];
switch (nt)
{
@ -281,7 +285,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{
if (addr < 0x2000)
{
// no vram or anything here ever
if (VRAM != null)
VRAM[MapCHR(addr)] = value;
}
else
{