nes ppu - have Reg_2000 depend on PPUREGS instead of PPU since that's all it's using

This commit is contained in:
adelikat 2020-03-14 10:32:59 -05:00
parent 4ababf383a
commit 6958ade3a8
1 changed files with 9 additions and 10 deletions

View File

@ -248,10 +248,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public sealed class Reg_2000
{
PPU ppu;
public Reg_2000(PPU ppu)
private readonly PPUREGS _regs;
public Reg_2000(PPUREGS regs)
{
this.ppu = ppu;
_regs = regs;
}
//these bits go straight into PPUR
//(00 = $2000; 01 = $2400; 02 = $2800; 03 = $2c00)
@ -266,11 +266,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public byte Value
{
get => (byte)(ppu.ppur._h | (ppu.ppur._v << 1) | (vram_incr32 << 2) | (obj_pattern_hi << 3) | (bg_pattern_hi << 4) | (obj_size_16 << 5) | (ppu_layer << 6) | (vblank_nmi_gen << 7));
get => (byte)(_regs._h | (_regs._v << 1) | (vram_incr32 << 2) | (obj_pattern_hi << 3) | (bg_pattern_hi << 4) | (obj_size_16 << 5) | (ppu_layer << 6) | (vblank_nmi_gen << 7));
set
{
ppu.ppur._h = value & 1;
ppu.ppur._v = (value >> 1) & 1;
_regs._h = value & 1;
_regs._v = (value >> 1) & 1;
vram_incr32 = (value >> 2) & 1;
obj_pattern_hi = (value >> 3) & 1;
bg_pattern_hi = (value >> 4) & 1;
@ -296,9 +296,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
void regs_reset()
{
//TODO - would like to reconstitute the entire PPU instead of all this..
reg_2000 = new Reg_2000(this);
reg_2001 = new Reg_2001();
ppur = new PPUREGS();
reg_2000 = new Reg_2000(ppur);
reg_2001 = new Reg_2001();
Reg2002_objoverflow = false;
Reg2002_objhit = false;
Reg2002_vblank_active = false;
@ -319,9 +319,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
//if (ppudead != 1)
reg_2000.Value = value;
}
byte read_2000() { return ppu_open_bus; }
byte peek_2000() { return ppu_open_bus; }