diff --git a/BizHawk.Emulation/Consoles/Coleco/ColecoVision.cs b/BizHawk.Emulation/Consoles/Coleco/ColecoVision.cs index 409419ec8c..2b43994f25 100644 --- a/BizHawk.Emulation/Consoles/Coleco/ColecoVision.cs +++ b/BizHawk.Emulation/Consoles/Coleco/ColecoVision.cs @@ -41,10 +41,33 @@ namespace BizHawk.Emulation.Consoles.Coleco LoadRom(rom); this.game = game; - + SetupMemoryDomains(); Reset(); } + public IList MemoryDomains { get { return memoryDomains; } } + public MemoryDomain MainMemory { get { return memoryDomains[0]; } } + IList memoryDomains; + const ushort RamSizeMask = 0x03FF; + void SetupMemoryDomains() + { + var domains = new List(3); + var MainMemoryDomain = new MemoryDomain("Main RAM", Ram.Length, Endian.Little, + addr => Ram[addr & RamSizeMask], + (addr, value) => Ram[addr & RamSizeMask] = value); + var VRamDomain = new MemoryDomain("Video RAM", VDP.VRAM.Length, Endian.Little, + addr => VDP.VRAM[addr & 0x3FFF], + (addr, value) => VDP.VRAM[addr & 0x3FFF] = value); + var SystemBusDomain = new MemoryDomain("System Bus", 0x10000, Endian.Little, + addr => Cpu.ReadMemory((ushort)addr), + (addr, value) => Cpu.WriteMemory((ushort)addr, value)); + + domains.Add(MainMemoryDomain); + domains.Add(VRamDomain); + domains.Add(SystemBusDomain); + memoryDomains = domains.AsReadOnly(); + } + public void FrameAdvance(bool render, bool renderSound) { Frame++; @@ -159,8 +182,5 @@ namespace BizHawk.Emulation.Consoles.Coleco public ISyncSoundProvider SyncSoundProvider { get { return null; } } public bool StartAsyncSound() { return true; } public void EndAsyncSound() { } - - public IList MemoryDomains { get { return null; } } - public MemoryDomain MainMemory { get { return null; } } } } diff --git a/BizHawk.Emulation/Consoles/Coleco/TMS9918A.cs b/BizHawk.Emulation/Consoles/Coleco/TMS9918A.cs index 5d6147c47d..19ee8d1abb 100644 --- a/BizHawk.Emulation/Consoles/Coleco/TMS9918A.cs +++ b/BizHawk.Emulation/Consoles/Coleco/TMS9918A.cs @@ -5,7 +5,7 @@ namespace BizHawk.Emulation.Consoles.Coleco { public sealed class TMS9918A : IVideoProvider { - byte[] VRAM = new byte[0x4000]; + public byte[] VRAM = new byte[0x4000]; byte[] Registers = new byte[8]; byte StatusByte;