NES - remove a bit more partial class as namespace abuse
This commit is contained in:
parent
40bfe91238
commit
3b2c00cf39
File diff suppressed because it is too large
Load Diff
|
@ -333,50 +333,50 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
return board;
|
return board;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string BoardName { get { return board.GetType().Name; } }
|
public string BoardName { get { return Board.GetType().Name; } }
|
||||||
|
|
||||||
void BoardSystemHardReset()
|
void BoardSystemHardReset()
|
||||||
{
|
{
|
||||||
INESBoard newboard;
|
INESBoard newboard;
|
||||||
// fds has a unique activation setup
|
// fds has a unique activation setup
|
||||||
if (board is FDS)
|
if (Board is FDS)
|
||||||
{
|
{
|
||||||
var newfds = new FDS();
|
var newfds = new FDS();
|
||||||
var oldfds = board as FDS;
|
var oldfds = Board as FDS;
|
||||||
newfds.biosrom = oldfds.biosrom;
|
newfds.biosrom = oldfds.biosrom;
|
||||||
newfds.SetDiskImage(oldfds.GetDiskImage());
|
newfds.SetDiskImage(oldfds.GetDiskImage());
|
||||||
newboard = newfds;
|
newboard = newfds;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newboard = CreateBoardInstance(board.GetType());
|
newboard = CreateBoardInstance(Board.GetType());
|
||||||
}
|
}
|
||||||
newboard.Create(this);
|
newboard.Create(this);
|
||||||
// i suppose the old board could have changed its initial register values, although it really shouldn't
|
// i suppose the old board could have changed its initial register values, although it really shouldn't
|
||||||
// you can't use SyncSettings.BoardProperties here because they very well might be different than before
|
// you can't use SyncSettings.BoardProperties here because they very well might be different than before
|
||||||
// in case the user actually changed something in the UI
|
// in case the user actually changed something in the UI
|
||||||
newboard.InitialRegisterValues = board.InitialRegisterValues;
|
newboard.InitialRegisterValues = Board.InitialRegisterValues;
|
||||||
newboard.Configure(origin);
|
newboard.Configure(origin);
|
||||||
newboard.ROM = board.ROM;
|
newboard.ROM = Board.ROM;
|
||||||
newboard.VROM = board.VROM;
|
newboard.VROM = Board.VROM;
|
||||||
if (board.WRAM != null)
|
if (Board.WRAM != null)
|
||||||
newboard.WRAM = new byte[board.WRAM.Length];
|
newboard.WRAM = new byte[Board.WRAM.Length];
|
||||||
if (board.VRAM != null)
|
if (Board.VRAM != null)
|
||||||
newboard.VRAM = new byte[board.VRAM.Length];
|
newboard.VRAM = new byte[Board.VRAM.Length];
|
||||||
newboard.PostConfigure();
|
newboard.PostConfigure();
|
||||||
// the old board's sram must be restored
|
// the old board's sram must be restored
|
||||||
if (newboard is FDS)
|
if (newboard is FDS)
|
||||||
{
|
{
|
||||||
var newfds = newboard as FDS;
|
var newfds = newboard as FDS;
|
||||||
var oldfds = board as FDS;
|
var oldfds = Board as FDS;
|
||||||
newfds.StoreSaveRam(oldfds.ReadSaveRam());
|
newfds.StoreSaveRam(oldfds.ReadSaveRam());
|
||||||
}
|
}
|
||||||
else if (board.SaveRam != null)
|
else if (Board.SaveRam != null)
|
||||||
{
|
{
|
||||||
Buffer.BlockCopy(board.SaveRam, 0, newboard.SaveRam, 0, board.SaveRam.Length);
|
Buffer.BlockCopy(Board.SaveRam, 0, newboard.SaveRam, 0, Board.SaveRam.Length);
|
||||||
}
|
}
|
||||||
board.Dispose();
|
Board.Dispose();
|
||||||
board = newboard;
|
Board = newboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
public byte[] CIRAM; //AKA nametables
|
public byte[] CIRAM; //AKA nametables
|
||||||
string game_name = string.Empty; //friendly name exposed to user and used as filename base
|
string game_name = string.Empty; //friendly name exposed to user and used as filename base
|
||||||
CartInfo cart; //the current cart prototype. should be moved into the board, perhaps
|
CartInfo cart; //the current cart prototype. should be moved into the board, perhaps
|
||||||
INESBoard board; //the board hardware that is currently driving things
|
internal INESBoard Board; //the board hardware that is currently driving things
|
||||||
EDetectionOrigin origin = EDetectionOrigin.None;
|
EDetectionOrigin origin = EDetectionOrigin.None;
|
||||||
int sprdma_countdown;
|
int sprdma_countdown;
|
||||||
bool _irq_apu; //various irq signals that get merged to the cpu irq pin
|
bool _irq_apu; //various irq signals that get merged to the cpu irq pin
|
||||||
|
@ -56,7 +56,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public INESBoard GetBoard()
|
public INESBoard GetBoard()
|
||||||
{
|
{
|
||||||
return board;
|
return Board;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
@ -106,7 +106,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
samples[i + 1] = samples[i];
|
samples[i + 1] = samples[i];
|
||||||
|
|
||||||
//mix in the cart's extra sound circuit
|
//mix in the cart's extra sound circuit
|
||||||
nes.board.ApplyCustomAudio(samples);
|
nes.Board.ApplyCustomAudio(samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GetSamples(out short[] samples, out int nsamp)
|
public void GetSamples(out short[] samples, out int nsamp)
|
||||||
|
@ -126,7 +126,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
for (int i = 0; i < nsamp * 2; i += 2)
|
for (int i = 0; i < nsamp * 2; i += 2)
|
||||||
samples[i + 1] = samples[i];
|
samples[i + 1] = samples[i];
|
||||||
|
|
||||||
nes.board.ApplyCustomAudio(samples);
|
nes.Board.ApplyCustomAudio(samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DiscardSamples()
|
public void DiscardSamples()
|
||||||
|
@ -170,9 +170,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
// controls other than the deck
|
// controls other than the deck
|
||||||
ControllerDefinition.BoolButtons.Add("Power");
|
ControllerDefinition.BoolButtons.Add("Power");
|
||||||
ControllerDefinition.BoolButtons.Add("Reset");
|
ControllerDefinition.BoolButtons.Add("Reset");
|
||||||
if (board is FDS)
|
if (Board is FDS)
|
||||||
{
|
{
|
||||||
var b = board as FDS;
|
var b = Board as FDS;
|
||||||
ControllerDefinition.BoolButtons.Add("FDS Eject");
|
ControllerDefinition.BoolButtons.Add("FDS Eject");
|
||||||
for (int i = 0; i < b.NumSides; i++)
|
for (int i = 0; i < b.NumSides; i++)
|
||||||
ControllerDefinition.BoolButtons.Add("FDS Insert " + i);
|
ControllerDefinition.BoolButtons.Add("FDS Insert " + i);
|
||||||
|
@ -244,7 +244,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
lagged = true;
|
lagged = true;
|
||||||
if (resetSignal)
|
if (resetSignal)
|
||||||
{
|
{
|
||||||
board.NESSoftReset();
|
Board.NESSoftReset();
|
||||||
cpu.NESSoftReset();
|
cpu.NESSoftReset();
|
||||||
apu.NESSoftReset();
|
apu.NESSoftReset();
|
||||||
ppu.NESSoftReset();
|
ppu.NESSoftReset();
|
||||||
|
@ -261,9 +261,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
resetSignal = Controller["Reset"];
|
resetSignal = Controller["Reset"];
|
||||||
hardResetSignal = Controller["Power"];
|
hardResetSignal = Controller["Power"];
|
||||||
|
|
||||||
if (board is FDS)
|
if (Board is FDS)
|
||||||
{
|
{
|
||||||
var b = board as FDS;
|
var b = Board as FDS;
|
||||||
if (Controller["FDS Eject"])
|
if (Controller["FDS Eject"])
|
||||||
b.Eject();
|
b.Eject();
|
||||||
for (int i = 0; i < b.NumSides; i++)
|
for (int i = 0; i < b.NumSides; i++)
|
||||||
|
@ -320,12 +320,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
cpu_deadcounter--;
|
cpu_deadcounter--;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cpu.IRQ = _irq_apu || board.IRQSignal;
|
cpu.IRQ = _irq_apu || Board.IRQSignal;
|
||||||
cpu.ExecuteOne();
|
cpu.ExecuteOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
apu.RunOne();
|
apu.RunOne();
|
||||||
board.ClockCPU();
|
Board.ClockCPU();
|
||||||
ppu.PostCpuInstructionOne();
|
ppu.PostCpuInstructionOne();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -493,7 +493,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
|
|
||||||
if (addr >= 0x4020)
|
if (addr >= 0x4020)
|
||||||
{
|
{
|
||||||
ret = board.PeekCart(addr); //easy optimization, since rom reads are so common, move this up (reordering the rest of these elseifs is not easy)
|
ret = Board.PeekCart(addr); //easy optimization, since rom reads are so common, move this up (reordering the rest of these elseifs is not easy)
|
||||||
}
|
}
|
||||||
else if (addr < 0x0800)
|
else if (addr < 0x0800)
|
||||||
{
|
{
|
||||||
|
@ -534,7 +534,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
|
|
||||||
if (addr >= 0x8000)
|
if (addr >= 0x8000)
|
||||||
{
|
{
|
||||||
ret = board.ReadPRG(addr - 0x8000); //easy optimization, since rom reads are so common, move this up (reordering the rest of these elseifs is not easy)
|
ret = Board.ReadPRG(addr - 0x8000); //easy optimization, since rom reads are so common, move this up (reordering the rest of these elseifs is not easy)
|
||||||
}
|
}
|
||||||
else if (addr < 0x0800)
|
else if (addr < 0x0800)
|
||||||
{
|
{
|
||||||
|
@ -554,11 +554,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
}
|
}
|
||||||
else if (addr < 0x6000)
|
else if (addr < 0x6000)
|
||||||
{
|
{
|
||||||
ret = board.ReadEXP(addr - 0x4000);
|
ret = Board.ReadEXP(addr - 0x4000);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = board.ReadWRAM(addr - 0x6000);
|
ret = Board.ReadWRAM(addr - 0x6000);
|
||||||
}
|
}
|
||||||
|
|
||||||
//handle breakpoints and stuff.
|
//handle breakpoints and stuff.
|
||||||
|
@ -613,15 +613,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
}
|
}
|
||||||
else if (addr < 0x6000)
|
else if (addr < 0x6000)
|
||||||
{
|
{
|
||||||
board.WriteEXP(addr - 0x4000, value);
|
Board.WriteEXP(addr - 0x4000, value);
|
||||||
}
|
}
|
||||||
else if (addr < 0x8000)
|
else if (addr < 0x8000)
|
||||||
{
|
{
|
||||||
board.WriteWRAM(addr - 0x6000, value);
|
Board.WriteWRAM(addr - 0x6000, value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
board.WritePRG(addr - 0x8000, value);
|
Board.WritePRG(addr - 0x8000, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryCallbacks.CallWrites(addr);
|
MemoryCallbacks.CallWrites(addr);
|
||||||
|
|
|
@ -30,46 +30,46 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
domains.Add(CIRAMdomain);
|
domains.Add(CIRAMdomain);
|
||||||
domains.Add(OAMdoman);
|
domains.Add(OAMdoman);
|
||||||
|
|
||||||
if (!(board is FDS) && board.SaveRam != null)
|
if (!(Board is FDS) && Board.SaveRam != null)
|
||||||
{
|
{
|
||||||
var BatteryRam = new MemoryDomain("Battery RAM", board.SaveRam.Length, MemoryDomain.Endian.Little,
|
var BatteryRam = new MemoryDomain("Battery RAM", Board.SaveRam.Length, MemoryDomain.Endian.Little,
|
||||||
addr => board.SaveRam[addr], (addr, value) => board.SaveRam[addr] = value);
|
addr => Board.SaveRam[addr], (addr, value) => Board.SaveRam[addr] = value);
|
||||||
domains.Add(BatteryRam);
|
domains.Add(BatteryRam);
|
||||||
}
|
}
|
||||||
|
|
||||||
var PRGROM = new MemoryDomain("PRG ROM", cart.prg_size * 1024, MemoryDomain.Endian.Little,
|
var PRGROM = new MemoryDomain("PRG ROM", cart.prg_size * 1024, MemoryDomain.Endian.Little,
|
||||||
addr => board.ROM[addr], (addr, value) => board.ROM[addr] = value);
|
addr => Board.ROM[addr], (addr, value) => Board.ROM[addr] = value);
|
||||||
domains.Add(PRGROM);
|
domains.Add(PRGROM);
|
||||||
|
|
||||||
if (board.VROM != null)
|
if (Board.VROM != null)
|
||||||
{
|
{
|
||||||
var CHRROM = new MemoryDomain("CHR VROM", cart.chr_size * 1024, MemoryDomain.Endian.Little,
|
var CHRROM = new MemoryDomain("CHR VROM", cart.chr_size * 1024, MemoryDomain.Endian.Little,
|
||||||
addr => board.VROM[addr], (addr, value) => board.VROM[addr] = value);
|
addr => Board.VROM[addr], (addr, value) => Board.VROM[addr] = value);
|
||||||
domains.Add(CHRROM);
|
domains.Add(CHRROM);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (board.VRAM != null)
|
if (Board.VRAM != null)
|
||||||
{
|
{
|
||||||
var VRAM = new MemoryDomain("VRAM", board.VRAM.Length, MemoryDomain.Endian.Little,
|
var VRAM = new MemoryDomain("VRAM", Board.VRAM.Length, MemoryDomain.Endian.Little,
|
||||||
addr => board.VRAM[addr], (addr, value) => board.VRAM[addr] = value);
|
addr => Board.VRAM[addr], (addr, value) => Board.VRAM[addr] = value);
|
||||||
domains.Add(VRAM);
|
domains.Add(VRAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (board.WRAM != null)
|
if (Board.WRAM != null)
|
||||||
{
|
{
|
||||||
var WRAM = new MemoryDomain("WRAM", board.WRAM.Length, MemoryDomain.Endian.Little,
|
var WRAM = new MemoryDomain("WRAM", Board.WRAM.Length, MemoryDomain.Endian.Little,
|
||||||
addr => board.WRAM[addr], (addr, value) => board.WRAM[addr] = value);
|
addr => Board.WRAM[addr], (addr, value) => Board.WRAM[addr] = value);
|
||||||
domains.Add(WRAM);
|
domains.Add(WRAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if there were more boards with special ram sets, we'd want to do something more general
|
// if there were more boards with special ram sets, we'd want to do something more general
|
||||||
if (board is FDS)
|
if (Board is FDS)
|
||||||
{
|
{
|
||||||
domains.Add((board as FDS).GetDiskPeeker());
|
domains.Add((Board as FDS).GetDiskPeeker());
|
||||||
}
|
}
|
||||||
else if (board is ExROM)
|
else if (Board is ExROM)
|
||||||
{
|
{
|
||||||
domains.Add((board as ExROM).GetExRAM());
|
domains.Add((Board as ExROM).GetExRAM());
|
||||||
}
|
}
|
||||||
|
|
||||||
_memoryDomains = new MemoryDomainList(domains);
|
_memoryDomains = new MemoryDomainList(domains);
|
||||||
|
|
|
@ -50,14 +50,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
|
|
||||||
public byte PeekPPU(int addr)
|
public byte PeekPPU(int addr)
|
||||||
{
|
{
|
||||||
return board.PeekPPU(addr);
|
return Board.PeekPPU(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] GetExTiles()
|
public byte[] GetExTiles()
|
||||||
{
|
{
|
||||||
if (board is ExROM)
|
if (Board is ExROM)
|
||||||
{
|
{
|
||||||
return board.VROM ?? board.VRAM;
|
return Board.VROM ?? Board.VRAM;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -67,14 +67,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
|
|
||||||
public bool ExActive
|
public bool ExActive
|
||||||
{
|
{
|
||||||
get { return board is ExROM && (board as ExROM).ExAttrActive; }
|
get { return Board is ExROM && (Board as ExROM).ExAttrActive; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] GetExRam()
|
public byte[] GetExRam()
|
||||||
{
|
{
|
||||||
if (board is ExROM)
|
if (Board is ExROM)
|
||||||
{
|
{
|
||||||
return (board as ExROM).GetExRAMArray();
|
return (Board as ExROM).GetExRAMArray();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,34 +12,34 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (board == null) return false;
|
if (Board == null) return false;
|
||||||
if (board is FDS) return true;
|
if (Board is FDS) return true;
|
||||||
if (board.SaveRam == null) return false;
|
if (Board.SaveRam == null) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] CloneSaveRam()
|
public byte[] CloneSaveRam()
|
||||||
{
|
{
|
||||||
if (board is FDS)
|
if (Board is FDS)
|
||||||
return (board as FDS).ReadSaveRam();
|
return (Board as FDS).ReadSaveRam();
|
||||||
|
|
||||||
if (board == null || board.SaveRam == null)
|
if (Board == null || Board.SaveRam == null)
|
||||||
return null;
|
return null;
|
||||||
return (byte[])board.SaveRam.Clone();
|
return (byte[])Board.SaveRam.Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StoreSaveRam(byte[] data)
|
public void StoreSaveRam(byte[] data)
|
||||||
{
|
{
|
||||||
if (board is FDS)
|
if (Board is FDS)
|
||||||
{
|
{
|
||||||
(board as FDS).StoreSaveRam(data);
|
(Board as FDS).StoreSaveRam(data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (board == null || board.SaveRam == null)
|
if (Board == null || Board.SaveRam == null)
|
||||||
return;
|
return;
|
||||||
Array.Copy(data, board.SaveRam, data.Length);
|
Array.Copy(data, Board.SaveRam, data.Length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,8 +62,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
ser.Sync("cpu_stepcounter", ref cpu_stepcounter);
|
ser.Sync("cpu_stepcounter", ref cpu_stepcounter);
|
||||||
ser.Sync("cpu_deadcounter", ref cpu_deadcounter);
|
ser.Sync("cpu_deadcounter", ref cpu_deadcounter);
|
||||||
ser.BeginSection("Board");
|
ser.BeginSection("Board");
|
||||||
board.SyncState(ser);
|
Board.SyncState(ser);
|
||||||
if (board is NESBoardBase && !((NESBoardBase)board).SyncStateFlag)
|
if (Board is NESBoardBase && !((NESBoardBase)Board).SyncStateFlag)
|
||||||
throw new InvalidOperationException("the current NES mapper didnt call base.SyncState");
|
throw new InvalidOperationException("the current NES mapper didnt call base.SyncState");
|
||||||
ser.EndSection();
|
ser.EndSection();
|
||||||
ppu.SyncState(ser);
|
ppu.SyncState(ser);
|
||||||
|
|
|
@ -46,10 +46,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
BootGodDB.Initialize();
|
BootGodDB.Initialize();
|
||||||
videoProvider = new MyVideoProvider(this);
|
videoProvider = new MyVideoProvider(this);
|
||||||
Init(game, rom, fdsbios);
|
Init(game, rom, fdsbios);
|
||||||
if (board is FDS)
|
if (Board is FDS)
|
||||||
{
|
{
|
||||||
DriveLightEnabled = true;
|
DriveLightEnabled = true;
|
||||||
(board as FDS).SetDriveLightCallback((val) => DriveLightOn = val);
|
(Board as FDS).SetDriveLightCallback((val) => DriveLightOn = val);
|
||||||
}
|
}
|
||||||
PutSettings((NESSettings)Settings ?? new NESSettings());
|
PutSettings((NESSettings)Settings ?? new NESSettings());
|
||||||
|
|
||||||
|
@ -60,9 +60,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
ser.Register<ITraceable>(Tracer);
|
ser.Register<ITraceable>(Tracer);
|
||||||
ser.Register<IVideoProvider>(videoProvider);
|
ser.Register<IVideoProvider>(videoProvider);
|
||||||
|
|
||||||
if (board is BANDAI_FCG_1)
|
if (Board is BANDAI_FCG_1)
|
||||||
{
|
{
|
||||||
var reader = (board as BANDAI_FCG_1).reader;
|
var reader = (Board as BANDAI_FCG_1).reader;
|
||||||
// not all BANDAI FCG 1 boards have a barcode reader
|
// not all BANDAI FCG 1 boards have a barcode reader
|
||||||
if (reader != null)
|
if (reader != null)
|
||||||
ser.Register<DatachBarcode>(reader);
|
ser.Register<DatachBarcode>(reader);
|
||||||
|
@ -426,15 +426,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
fdsboard.InitialRegisterValues = InitialMapperRegisterValues;
|
fdsboard.InitialRegisterValues = InitialMapperRegisterValues;
|
||||||
fdsboard.Configure(origin);
|
fdsboard.Configure(origin);
|
||||||
|
|
||||||
board = fdsboard;
|
Board = fdsboard;
|
||||||
|
|
||||||
//create the vram and wram if necessary
|
//create the vram and wram if necessary
|
||||||
if (cart.wram_size != 0)
|
if (cart.wram_size != 0)
|
||||||
board.WRAM = new byte[cart.wram_size * 1024];
|
Board.WRAM = new byte[cart.wram_size * 1024];
|
||||||
if (cart.vram_size != 0)
|
if (cart.vram_size != 0)
|
||||||
board.VRAM = new byte[cart.vram_size * 1024];
|
Board.VRAM = new byte[cart.vram_size * 1024];
|
||||||
|
|
||||||
board.PostConfigure();
|
Board.PostConfigure();
|
||||||
|
|
||||||
Console.WriteLine("Using NTSC display type for FDS disk image");
|
Console.WriteLine("Using NTSC display type for FDS disk image");
|
||||||
_display_type = Common.DisplayType.NTSC;
|
_display_type = Common.DisplayType.NTSC;
|
||||||
|
@ -608,12 +608,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
LoadWriteLine("END NES rom analysis");
|
LoadWriteLine("END NES rom analysis");
|
||||||
LoadWriteLine("------");
|
LoadWriteLine("------");
|
||||||
|
|
||||||
board = CreateBoardInstance(boardType);
|
Board = CreateBoardInstance(boardType);
|
||||||
|
|
||||||
cart = choice;
|
cart = choice;
|
||||||
board.Create(this);
|
Board.Create(this);
|
||||||
board.InitialRegisterValues = InitialMapperRegisterValues;
|
Board.InitialRegisterValues = InitialMapperRegisterValues;
|
||||||
board.Configure(origin);
|
Board.Configure(origin);
|
||||||
|
|
||||||
if (origin == EDetectionOrigin.BootGodDB)
|
if (origin == EDetectionOrigin.BootGodDB)
|
||||||
{
|
{
|
||||||
|
@ -647,26 +647,26 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
if (iNesHeaderInfo != null)
|
if (iNesHeaderInfo != null)
|
||||||
{
|
{
|
||||||
//pluck the necessary bytes out of the file
|
//pluck the necessary bytes out of the file
|
||||||
board.ROM = new byte[choice.prg_size * 1024];
|
Board.ROM = new byte[choice.prg_size * 1024];
|
||||||
Array.Copy(file, 16, board.ROM, 0, board.ROM.Length);
|
Array.Copy(file, 16, Board.ROM, 0, Board.ROM.Length);
|
||||||
if (choice.chr_size > 0)
|
if (choice.chr_size > 0)
|
||||||
{
|
{
|
||||||
board.VROM = new byte[choice.chr_size * 1024];
|
Board.VROM = new byte[choice.chr_size * 1024];
|
||||||
int vrom_offset = iNesHeaderInfo.prg_size * 1024;
|
int vrom_offset = iNesHeaderInfo.prg_size * 1024;
|
||||||
|
|
||||||
// if file isn't long enough for VROM, truncate
|
// if file isn't long enough for VROM, truncate
|
||||||
int vrom_copy_size = Math.Min(board.VROM.Length, file.Length - 16 - vrom_offset);
|
int vrom_copy_size = Math.Min(Board.VROM.Length, file.Length - 16 - vrom_offset);
|
||||||
Array.Copy(file, 16 + vrom_offset, board.VROM, 0, vrom_copy_size);
|
Array.Copy(file, 16 + vrom_offset, Board.VROM, 0, vrom_copy_size);
|
||||||
if (vrom_copy_size < board.VROM.Length)
|
if (vrom_copy_size < Board.VROM.Length)
|
||||||
LoadWriteLine("Less than the expected VROM was found in the file: {0} < {1}", vrom_copy_size, board.VROM.Length);
|
LoadWriteLine("Less than the expected VROM was found in the file: {0} < {1}", vrom_copy_size, Board.VROM.Length);
|
||||||
}
|
}
|
||||||
if (choice.prg_size != iNesHeaderInfo.prg_size || choice.chr_size != iNesHeaderInfo.chr_size)
|
if (choice.prg_size != iNesHeaderInfo.prg_size || choice.chr_size != iNesHeaderInfo.chr_size)
|
||||||
LoadWriteLine("Warning: Detected choice has different filesizes than the INES header!");
|
LoadWriteLine("Warning: Detected choice has different filesizes than the INES header!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
board.ROM = unif.PRG;
|
Board.ROM = unif.PRG;
|
||||||
board.VROM = unif.CHR;
|
Board.VROM = unif.CHR;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadReport.Flush();
|
LoadReport.Flush();
|
||||||
|
@ -676,11 +676,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
|
|
||||||
//create the vram and wram if necessary
|
//create the vram and wram if necessary
|
||||||
if (cart.wram_size != 0)
|
if (cart.wram_size != 0)
|
||||||
board.WRAM = new byte[cart.wram_size * 1024];
|
Board.WRAM = new byte[cart.wram_size * 1024];
|
||||||
if (cart.vram_size != 0)
|
if (cart.vram_size != 0)
|
||||||
board.VRAM = new byte[cart.vram_size * 1024];
|
Board.VRAM = new byte[cart.vram_size * 1024];
|
||||||
|
|
||||||
board.PostConfigure();
|
Board.PostConfigure();
|
||||||
|
|
||||||
// set up display type
|
// set up display type
|
||||||
|
|
||||||
|
|
|
@ -81,8 +81,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
//when the ppu issues a write it goes through here and into the game board
|
//when the ppu issues a write it goes through here and into the game board
|
||||||
public void ppubus_write(int addr, byte value)
|
public void ppubus_write(int addr, byte value)
|
||||||
{
|
{
|
||||||
nes.board.AddressPPU(addr);
|
nes.Board.AddressPPU(addr);
|
||||||
nes.board.WritePPU(addr, value);
|
nes.Board.WritePPU(addr, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//when the ppu issues a read it goes through here and into the game board
|
//when the ppu issues a read it goes through here and into the game board
|
||||||
|
@ -92,14 +92,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
if (!reg_2001.PPUON && ppu)
|
if (!reg_2001.PPUON && ppu)
|
||||||
return 0xFF;
|
return 0xFF;
|
||||||
|
|
||||||
nes.board.AddressPPU(addr);
|
nes.Board.AddressPPU(addr);
|
||||||
return nes.board.ReadPPU(addr);
|
return nes.Board.ReadPPU(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
//debug tools peek into the ppu through this
|
//debug tools peek into the ppu through this
|
||||||
public byte ppubus_peek(int addr)
|
public byte ppubus_peek(int addr)
|
||||||
{
|
{
|
||||||
return nes.board.PeekPPU(addr);
|
return nes.Board.PeekPPU(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PPUPHASE
|
public enum PPUPHASE
|
||||||
|
@ -229,7 +229,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
Reg2002_vblank_clear_pending = false;
|
Reg2002_vblank_clear_pending = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
nes.board.ClockPPU();
|
nes.Board.ClockPPU();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -443,7 +443,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
//normally the address isnt observed by the board till it gets clocked by a read or write.
|
//normally the address isnt observed by the board till it gets clocked by a read or write.
|
||||||
//but maybe thats just because a ppu read/write shoves it on the address bus
|
//but maybe thats just because a ppu read/write shoves it on the address bus
|
||||||
//apparently this shoves it on the address bus, too, or else blargg's mmc3 tests dont pass
|
//apparently this shoves it on the address bus, too, or else blargg's mmc3 tests dont pass
|
||||||
nes.board.AddressPPU(ppur.get_2007access());
|
nes.Board.AddressPPU(ppur.get_2007access());
|
||||||
}
|
}
|
||||||
|
|
||||||
vtoggle ^= true;
|
vtoggle ^= true;
|
||||||
|
@ -480,7 +480,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
ppur.increment2007(ppur.status.rendering && reg_2001.PPUON, reg_2000.vram_incr32 != 0);
|
ppur.increment2007(ppur.status.rendering && reg_2001.PPUON, reg_2000.vram_incr32 != 0);
|
||||||
|
|
||||||
//see comments in $2006
|
//see comments in $2006
|
||||||
nes.board.AddressPPU(ppur.get_2007access());
|
nes.Board.AddressPPU(ppur.get_2007access());
|
||||||
}
|
}
|
||||||
byte read_2007()
|
byte read_2007()
|
||||||
{
|
{
|
||||||
|
@ -502,7 +502,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
ppur.increment2007(ppur.status.rendering && reg_2001.PPUON, reg_2000.vram_incr32 != 0);
|
ppur.increment2007(ppur.status.rendering && reg_2001.PPUON, reg_2000.vram_incr32 != 0);
|
||||||
|
|
||||||
//see comments in $2006
|
//see comments in $2006
|
||||||
nes.board.AddressPPU(ppur.get_2007access());
|
nes.Board.AddressPPU(ppur.get_2007access());
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue