From ae8caf4546ffcff21dd91d2c9ec0b327e8d0bfc4 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 12 Nov 2016 14:08:05 -0600 Subject: [PATCH] Intellivision - set up memory domains service, with a few domains that were easy to do --- .../BizHawk.Emulation.Cores.csproj | 3 ++ .../Intellivision.IMemoryDomains.cs | 45 +++++++++++++++++++ .../Consoles/Intellivision/Intellivision.cs | 2 + 3 files changed, 50 insertions(+) create mode 100644 BizHawk.Emulation.Cores/Consoles/Intellivision/Intellivision.IMemoryDomains.cs diff --git a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj index ee0a4d18ce..a5ec08b7ea 100644 --- a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj +++ b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj @@ -407,6 +407,9 @@ Intellivision.cs + + Intellivision.cs + Intellivision.cs diff --git a/BizHawk.Emulation.Cores/Consoles/Intellivision/Intellivision.IMemoryDomains.cs b/BizHawk.Emulation.Cores/Consoles/Intellivision/Intellivision.IMemoryDomains.cs new file mode 100644 index 0000000000..13ac2d5fd9 --- /dev/null +++ b/BizHawk.Emulation.Cores/Consoles/Intellivision/Intellivision.IMemoryDomains.cs @@ -0,0 +1,45 @@ +using System.Collections.Generic; +using System.Linq; + +using BizHawk.Emulation.Common; + +namespace BizHawk.Emulation.Cores.Intellivision +{ + public sealed partial class Intellivision + { + internal IMemoryDomains MemoryDomains; + + private void SetupMemoryDomains() + { + // TODO: is 8bit for byte arrays and 16bit for ushort correct here? + // If ushort is correct, how about little endian? + var domains = new List + { + new MemoryDomainDelegate( + "Main RAM", + ScratchpadRam.Length, + MemoryDomain.Endian.Little, + addr => ScratchpadRam[addr], + (addr, value) => ScratchpadRam[addr] = value, + 1), + new MemoryDomainDelegate( + "Graphics RAM", + GraphicsRam.Length, + MemoryDomain.Endian.Little, + addr => GraphicsRam[addr], + (addr, value) => GraphicsRam[addr] = value, + 1), + new MemoryDomainDelegate( + "Graphics ROM", + GraphicsRom.Length, + MemoryDomain.Endian.Little, + addr => GraphicsRom[addr], + (addr, value) => GraphicsRom[addr] = value, + 1), + }; + + MemoryDomains = new MemoryDomainList(domains); + (ServiceProvider as BasicServiceProvider).Register(MemoryDomains); + } + } +} diff --git a/BizHawk.Emulation.Cores/Consoles/Intellivision/Intellivision.cs b/BizHawk.Emulation.Cores/Consoles/Intellivision/Intellivision.cs index 742217a718..bc1c4920ae 100644 --- a/BizHawk.Emulation.Cores/Consoles/Intellivision/Intellivision.cs +++ b/BizHawk.Emulation.Cores/Consoles/Intellivision/Intellivision.cs @@ -55,6 +55,8 @@ namespace BizHawk.Emulation.Cores.Intellivision Tracer = new TraceBuffer { Header = _cpu.TraceHeader }; (ServiceProvider as BasicServiceProvider).Register(Tracer); + + SetupMemoryDomains(); } private ITraceable Tracer { get; set; }