[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);
|
||||
chr_mask = (RomInfo.CHR_Size*2) - 1;
|
||||
}
|
||||
|
||||
SetMirrorType(mmc1.mirror);
|
||||
}
|
||||
|
||||
public override void WritePRG(int addr, byte value)
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
int block = (addr >> 10) & 3;
|
||||
block = mirroring[block];
|
||||
int ofs = addr & 0x3FF;
|
||||
return (block << 10) | ofs | 0x2000;
|
||||
return (block << 10) | ofs;
|
||||
}
|
||||
|
||||
protected byte HandleNormalPRGConflict(int addr, byte value)
|
||||
|
@ -132,7 +132,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
}
|
||||
else
|
||||
{
|
||||
NES.ppu.ppu_defaultWrite(ApplyMirroring(addr), value);
|
||||
NES.NTARAM[ApplyMirroring(addr)] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
}
|
||||
else
|
||||
{
|
||||
return NES.ppu.ppu_defaultRead(ApplyMirroring(addr));
|
||||
return NES.NTARAM[ApplyMirroring(addr)];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,6 +158,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
INESBoard board;
|
||||
public PPU ppu;
|
||||
byte[] ram;
|
||||
protected byte[] NTARAM;
|
||||
int cpu_accumulate;
|
||||
|
||||
//user configuration
|
||||
|
@ -400,6 +401,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
cpu.WriteMemory = WriteMemory;
|
||||
ppu = new PPU(this);
|
||||
ram = new byte[0x800];
|
||||
NTARAM = new byte[0x800];
|
||||
ports = new IPortDevice[2];
|
||||
ports[0] = new JoypadPortDevice(this);
|
||||
ports[1] = new NullPortDevice();
|
||||
|
@ -725,7 +727,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
sw.Flush();
|
||||
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);
|
||||
board.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))))
|
||||
cpu.LoadStateText(sr);
|
||||
ram = Util.ReadByteBuffer(br, false);
|
||||
NTARAM = Util.ReadByteBuffer(br, false);
|
||||
cpu_accumulate = br.ReadInt32();
|
||||
board.LoadStateBinary(br);
|
||||
ppu.LoadStateBinary(br);
|
||||
|
|
|
@ -25,20 +25,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
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 {
|
||||
VBL, BG, OBJ
|
||||
};
|
||||
|
@ -68,7 +54,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
bw.Write(reg_2003);
|
||||
Util.WriteByteBuffer(bw, OAM);
|
||||
Util.WriteByteBuffer(bw, PALRAM);
|
||||
Util.WriteByteBuffer(bw, NTARAM);
|
||||
bw.Write(vtoggle);
|
||||
bw.Write(VRAMBuffer);
|
||||
ppur.SaveStateBinary(bw);
|
||||
|
@ -88,7 +73,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
reg_2003 = br.ReadByte();
|
||||
OAM = Util.ReadByteBuffer(br,false);
|
||||
PALRAM = Util.ReadByteBuffer(br, false);
|
||||
NTARAM = Util.ReadByteBuffer(br, false);
|
||||
vtoggle = br.ReadBoolean();
|
||||
VRAMBuffer = br.ReadByte();
|
||||
ppur.LoadStateBinary(br);
|
||||
|
|
|
@ -289,7 +289,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
byte reg_2003;
|
||||
byte[] OAM;
|
||||
byte[] PALRAM;
|
||||
public byte[] NTARAM;
|
||||
bool vtoggle;
|
||||
byte VRAMBuffer;
|
||||
void regs_reset()
|
||||
|
@ -305,7 +304,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
reg_2003 = 0;
|
||||
OAM = new byte[0x100];
|
||||
PALRAM = new byte[0x20];
|
||||
NTARAM = new byte[0x800];
|
||||
vtoggle = false;
|
||||
VRAMBuffer = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue