From 83a8712d5d2188506c0c1b135a306bc9d5f664ca Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Sat, 5 Mar 2011 03:03:47 +0000 Subject: [PATCH] Implement main memory domain for NES --- .../Consoles/Nintendo/NES/NES.cs | 33 ++++++++++++------- .../NEStools/NESPPU.Designer.cs | 20 +++++------ BizHawk.MultiClient/NEStools/NESPPU.cs | 8 ++++- 3 files changed, 38 insertions(+), 23 deletions(-) diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs index 930f1eff44..b64305e6ee 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs @@ -443,17 +443,26 @@ namespace BizHawk.Emulation.Consoles.Nintendo set { } } + private IList memoryDomains; + + private void SetupMemoryDomains() + { + var domains = new List(6); + var MainMemoryDomain = new MemoryDomain("Main RAM", ram.Length, Endian.Little, + addr => ram[addr & 0x07FF], (addr, value) => ram[addr & 0x07FF] = value); + //System bus + //PPU 2000-3FFF + //APU 4000-5FFF + //WRAM 6000-7FFF + //PRG RAM 8000-FFFF + + domains.Add(MainMemoryDomain); + memoryDomains = domains.AsReadOnly(); + } + public string SystemId { get { return "NES"; } } - public IList MemoryDomains { get { return new List(); } } - public MemoryDomain MainMemory - { - get - { - return new MemoryDomain("x", 8, Endian.Little, - addr => 0, - (addr, value) => { }); - } - } + public IList MemoryDomains { get { return memoryDomains; } } + public MemoryDomain MainMemory { get { return memoryDomains[0]; } } public object Query(EmulatorQuery query) @@ -716,10 +725,10 @@ namespace BizHawk.Emulation.Consoles.Nintendo romInfo.VROM = new byte[romInfo.CHR_Size * 8 * 1024]; Array.Copy(file, 16 + romInfo.ROM.Length, romInfo.VROM, 0, romInfo.VROM.Length); } - + } - HardReset(); + SetupMemoryDomains(); } public void SaveStateText(TextWriter writer) diff --git a/BizHawk.MultiClient/NEStools/NESPPU.Designer.cs b/BizHawk.MultiClient/NEStools/NESPPU.Designer.cs index c0f4736145..5193308aa6 100644 --- a/BizHawk.MultiClient/NEStools/NESPPU.Designer.cs +++ b/BizHawk.MultiClient/NEStools/NESPPU.Designer.cs @@ -29,7 +29,7 @@ private void InitializeComponent() { this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.PalettesGroups = new System.Windows.Forms.GroupBox(); this.SuspendLayout(); // // groupBox1 @@ -41,21 +41,21 @@ this.groupBox1.TabStop = false; this.groupBox1.Text = "Pattern Tables"; // - // groupBox2 + // PalettesGroups // - this.groupBox2.Location = new System.Drawing.Point(12, 262); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(415, 84); - this.groupBox2.TabIndex = 1; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "Palettes"; + this.PalettesGroups.Location = new System.Drawing.Point(12, 262); + this.PalettesGroups.Name = "PalettesGroups"; + this.PalettesGroups.Size = new System.Drawing.Size(415, 84); + this.PalettesGroups.TabIndex = 1; + this.PalettesGroups.TabStop = false; + this.PalettesGroups.Text = "Palettes"; // // NESPPU // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(443, 359); - this.Controls.Add(this.groupBox2); + this.Controls.Add(this.PalettesGroups); this.Controls.Add(this.groupBox1); this.Name = "NESPPU"; this.Text = "PPU Viewer"; @@ -67,6 +67,6 @@ #endregion private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.GroupBox PalettesGroups; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/NEStools/NESPPU.cs b/BizHawk.MultiClient/NEStools/NESPPU.cs index c0d63f9c5f..d6042cf7d6 100644 --- a/BizHawk.MultiClient/NEStools/NESPPU.cs +++ b/BizHawk.MultiClient/NEStools/NESPPU.cs @@ -6,6 +6,7 @@ using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; +using BizHawk.Emulation.Consoles.Nintendo; namespace BizHawk.MultiClient { @@ -16,9 +17,14 @@ namespace BizHawk.MultiClient InitializeComponent(); } + public void UpdateValues() + { + if (!(Global.Emulator is NES)) return; + } + private void NESPPU_Load(object sender, EventArgs e) { - + } } }