[NES] NTARAM doesnt belong to the ppu. simplifies things a bit this way too.
This commit is contained in:
parent
858824c548
commit
fe3414c380
|
@ -230,6 +230,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo.Boards
|
||||||
Debug.Assert(RomInfo.CHR_Size == 16);
|
Debug.Assert(RomInfo.CHR_Size == 16);
|
||||||
chr_mask = (RomInfo.CHR_Size*2) - 1;
|
chr_mask = (RomInfo.CHR_Size*2) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetMirrorType(mmc1.mirror);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void WritePRG(int addr, byte value)
|
public override void WritePRG(int addr, byte value)
|
||||||
|
|
|
@ -107,7 +107,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
int block = (addr >> 10) & 3;
|
int block = (addr >> 10) & 3;
|
||||||
block = mirroring[block];
|
block = mirroring[block];
|
||||||
int ofs = addr & 0x3FF;
|
int ofs = addr & 0x3FF;
|
||||||
return (block << 10) | ofs | 0x2000;
|
return (block << 10) | ofs;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected byte HandleNormalPRGConflict(int addr, byte value)
|
protected byte HandleNormalPRGConflict(int addr, byte value)
|
||||||
|
@ -132,7 +132,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NES.ppu.ppu_defaultWrite(ApplyMirroring(addr), value);
|
NES.NTARAM[ApplyMirroring(addr)] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return NES.ppu.ppu_defaultRead(ApplyMirroring(addr));
|
return NES.NTARAM[ApplyMirroring(addr)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,6 +158,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
INESBoard board;
|
INESBoard board;
|
||||||
public PPU ppu;
|
public PPU ppu;
|
||||||
byte[] ram;
|
byte[] ram;
|
||||||
|
protected byte[] NTARAM;
|
||||||
int cpu_accumulate;
|
int cpu_accumulate;
|
||||||
|
|
||||||
//user configuration
|
//user configuration
|
||||||
|
@ -400,6 +401,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
cpu.WriteMemory = WriteMemory;
|
cpu.WriteMemory = WriteMemory;
|
||||||
ppu = new PPU(this);
|
ppu = new PPU(this);
|
||||||
ram = new byte[0x800];
|
ram = new byte[0x800];
|
||||||
|
NTARAM = new byte[0x800];
|
||||||
ports = new IPortDevice[2];
|
ports = new IPortDevice[2];
|
||||||
ports[0] = new JoypadPortDevice(this);
|
ports[0] = new JoypadPortDevice(this);
|
||||||
ports[1] = new NullPortDevice();
|
ports[1] = new NullPortDevice();
|
||||||
|
@ -725,7 +727,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
sw.Flush();
|
sw.Flush();
|
||||||
Util.WriteByteBuffer(bw, System.Text.Encoding.ASCII.GetBytes(sw.ToString()));
|
Util.WriteByteBuffer(bw, System.Text.Encoding.ASCII.GetBytes(sw.ToString()));
|
||||||
}
|
}
|
||||||
Util.WriteByteBuffer(bw,ram);
|
Util.WriteByteBuffer(bw, ram);
|
||||||
|
Util.WriteByteBuffer(bw, NTARAM);
|
||||||
bw.Write(cpu_accumulate);
|
bw.Write(cpu_accumulate);
|
||||||
board.SaveStateBinary(bw);
|
board.SaveStateBinary(bw);
|
||||||
ppu.SaveStateBinary(bw);
|
ppu.SaveStateBinary(bw);
|
||||||
|
@ -737,6 +740,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
using (var sr = new StringReader(System.Text.Encoding.ASCII.GetString(Util.ReadByteBuffer(br, false))))
|
using (var sr = new StringReader(System.Text.Encoding.ASCII.GetString(Util.ReadByteBuffer(br, false))))
|
||||||
cpu.LoadStateText(sr);
|
cpu.LoadStateText(sr);
|
||||||
ram = Util.ReadByteBuffer(br, false);
|
ram = Util.ReadByteBuffer(br, false);
|
||||||
|
NTARAM = Util.ReadByteBuffer(br, false);
|
||||||
cpu_accumulate = br.ReadInt32();
|
cpu_accumulate = br.ReadInt32();
|
||||||
board.LoadStateBinary(br);
|
board.LoadStateBinary(br);
|
||||||
ppu.LoadStateBinary(br);
|
ppu.LoadStateBinary(br);
|
||||||
|
|
|
@ -25,20 +25,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
return nes.board.ReadPPU(addr);
|
return nes.board.ReadPPU(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
//boards may not respond to a read, in which case this will get called. please apply mirroring logic beforehand
|
|
||||||
public byte ppu_defaultRead(int addr)
|
|
||||||
{
|
|
||||||
addr &= 0x7FF;
|
|
||||||
return NTARAM[addr];
|
|
||||||
}
|
|
||||||
|
|
||||||
//boards may not respond to a write, in which case this will get called. please apply mirroring logic beforehand
|
|
||||||
public void ppu_defaultWrite(int addr, byte value)
|
|
||||||
{
|
|
||||||
addr &= 0x7FF;
|
|
||||||
NTARAM[addr] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum PPUPHASE {
|
enum PPUPHASE {
|
||||||
VBL, BG, OBJ
|
VBL, BG, OBJ
|
||||||
};
|
};
|
||||||
|
@ -68,7 +54,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
bw.Write(reg_2003);
|
bw.Write(reg_2003);
|
||||||
Util.WriteByteBuffer(bw, OAM);
|
Util.WriteByteBuffer(bw, OAM);
|
||||||
Util.WriteByteBuffer(bw, PALRAM);
|
Util.WriteByteBuffer(bw, PALRAM);
|
||||||
Util.WriteByteBuffer(bw, NTARAM);
|
|
||||||
bw.Write(vtoggle);
|
bw.Write(vtoggle);
|
||||||
bw.Write(VRAMBuffer);
|
bw.Write(VRAMBuffer);
|
||||||
ppur.SaveStateBinary(bw);
|
ppur.SaveStateBinary(bw);
|
||||||
|
@ -88,7 +73,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
reg_2003 = br.ReadByte();
|
reg_2003 = br.ReadByte();
|
||||||
OAM = Util.ReadByteBuffer(br,false);
|
OAM = Util.ReadByteBuffer(br,false);
|
||||||
PALRAM = Util.ReadByteBuffer(br, false);
|
PALRAM = Util.ReadByteBuffer(br, false);
|
||||||
NTARAM = Util.ReadByteBuffer(br, false);
|
|
||||||
vtoggle = br.ReadBoolean();
|
vtoggle = br.ReadBoolean();
|
||||||
VRAMBuffer = br.ReadByte();
|
VRAMBuffer = br.ReadByte();
|
||||||
ppur.LoadStateBinary(br);
|
ppur.LoadStateBinary(br);
|
||||||
|
|
|
@ -289,7 +289,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
byte reg_2003;
|
byte reg_2003;
|
||||||
byte[] OAM;
|
byte[] OAM;
|
||||||
byte[] PALRAM;
|
byte[] PALRAM;
|
||||||
public byte[] NTARAM;
|
|
||||||
bool vtoggle;
|
bool vtoggle;
|
||||||
byte VRAMBuffer;
|
byte VRAMBuffer;
|
||||||
void regs_reset()
|
void regs_reset()
|
||||||
|
@ -305,7 +304,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
reg_2003 = 0;
|
reg_2003 = 0;
|
||||||
OAM = new byte[0x100];
|
OAM = new byte[0x100];
|
||||||
PALRAM = new byte[0x20];
|
PALRAM = new byte[0x20];
|
||||||
NTARAM = new byte[0x800];
|
|
||||||
vtoggle = false;
|
vtoggle = false;
|
||||||
VRAMBuffer = 0;
|
VRAMBuffer = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue