From bdbcf689d94028ef50e8bc58eaf8d418aa025115 Mon Sep 17 00:00:00 2001 From: goyuken Date: Mon, 10 Feb 2014 01:21:13 +0000 Subject: [PATCH] PCE: fix Main Memory domain in SGX mode. Add Cart Battery Ram domain (populous). change domain names in CDL to match memory domains. --- .../Consoles/PC Engine/CDLMapping.cs | 12 ++++++------ .../Consoles/PC Engine/PCEngine.cs | 13 +++++++++++-- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/PC Engine/CDLMapping.cs b/BizHawk.Emulation.Cores/Consoles/PC Engine/CDLMapping.cs index 889553e0ce..1963b7e1e8 100644 --- a/BizHawk.Emulation.Cores/Consoles/PC Engine/CDLMapping.cs +++ b/BizHawk.Emulation.Cores/Consoles/PC Engine/CDLMapping.cs @@ -29,22 +29,22 @@ namespace BizHawk.Emulation.Cores.PCEngine CDLMappingApplyRange(mm, "ROM", 0x00, RomLength); if (PopulousRAM != null) - CDLMappingApplyRange(mm, "Populous RAM", 0x40, PopulousRAM.Length); + CDLMappingApplyRange(mm, "Cart Battery RAM",, 0x40, PopulousRAM.Length); if (SuperRam != null) - CDLMappingApplyRange(mm, "Super RAM", 0x68, SuperRam.Length); + CDLMappingApplyRange(mm, "Super System Card RAM", 0x68, SuperRam.Length); if (CDRam != null) - CDLMappingApplyRange(mm, "CD RAM", 0x80, CDRam.Length); + CDLMappingApplyRange(mm, "TurboCD RAM", 0x80, CDRam.Length); if (BRAM != null) - CDLMappingApplyRange(mm, "BRAM", 0xf7, BRAM.Length); + CDLMappingApplyRange(mm, "Battery RAM", 0xf7, BRAM.Length); { - var rammirrors = new HuC6280.MemMapping { Name = "RAM", Offs = 0 }; + var rammirrors = new HuC6280.MemMapping { Name = "Main Memory", Offs = 0 }; mm[0xf9] = mm[0xfa] = mm[0xfb] = rammirrors; } - CDLMappingApplyRange(mm, "RAM", 0xf8, Ram.Length); + CDLMappingApplyRange(mm, "Main Memory", 0xf8, Ram.Length); mm[0xff] = new HuC6280.MemMapping { Name = "MMIO", Offs = 0 }; diff --git a/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs b/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs index 17257fc367..be4229928d 100644 --- a/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs +++ b/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs @@ -556,9 +556,10 @@ namespace BizHawk.Emulation.Cores.PCEngine void SetupMemoryDomains() { var domains = new List(10); + int mainmemorymask = Ram.Length - 1; var MainMemoryDomain = new MemoryDomain("Main Memory", Ram.Length, MemoryDomain.Endian.Little, - addr => Ram[addr & 0x1FFF], - (addr, value) => Ram[addr & 0x1FFF] = value); + addr => Ram[addr & mainmemorymask], + (addr, value) => Ram[addr & mainmemorymask] = value); domains.Add(MainMemoryDomain); var SystemBusDomain = new MemoryDomain("System Bus", 0x200000, MemoryDomain.Endian.Little, @@ -609,6 +610,14 @@ namespace BizHawk.Emulation.Cores.PCEngine domains.Add(ArcadeRamMemoryDomain); } + if (PopulousRAM != null) + { + var PopulusRAMDomain = new MemoryDomain("Cart Battery RAM", PopulousRAM.Length, MemoryDomain.Endian.Little, + addr => PopulousRAM[addr & 0x7fff], + (addr, value) => PopulousRAM[addr & 0x7fff] = value); + domains.Add(PopulusRAMDomain); + } + memoryDomains = new MemoryDomainList(domains); }