From 17d8e21c2d6a533fadd77d20d1ee568a4013d76a Mon Sep 17 00:00:00 2001 From: goyuken Date: Sun, 16 Dec 2012 18:02:39 +0000 Subject: [PATCH] 7800: memory domains --- .../Consoles/Atari/7800/Atari7800.cs | 82 ++++++++++++++++-- BizHawk.MultiClient/output/dll/EMU7800.dll | Bin 138240 -> 138240 bytes EMU7800/Core/Machine7800.cs | 8 +- 3 files changed, 79 insertions(+), 11 deletions(-) diff --git a/BizHawk.Emulation/Consoles/Atari/7800/Atari7800.cs b/BizHawk.Emulation/Consoles/Atari/7800/Atari7800.cs index 6e390d0195..e3d72a49b1 100644 --- a/BizHawk.Emulation/Consoles/Atari/7800/Atari7800.cs +++ b/BizHawk.Emulation/Consoles/Atari/7800/Atari7800.cs @@ -54,9 +54,9 @@ namespace BizHawk.Emulation public void LoadStateText(TextReader reader) { SyncState(new Serializer(reader)); } public void SaveStateBinary(BinaryWriter bw) { SyncState(new Serializer(bw)); } public void LoadStateBinary(BinaryReader br) { SyncState(new Serializer(br)); } - private IList memoryDomains; - public IList MemoryDomains { get { return null; } } - public MemoryDomain MainMemory { get { return null; } } + private List _MemoryDomains; + public IList MemoryDomains { get; private set; } + public MemoryDomain MainMemory { get { return MemoryDomains[0]; } } /********************/ public int Frame { get { return _frame; } set { _frame = value; } } @@ -179,10 +179,6 @@ namespace BizHawk.Emulation Console.WriteLine("Rom Determiniation from 7800DB:"); Console.WriteLine(GameInfo.ToString()); - //TODO: store both the ntsc bios and the pal bios - var domains = new List(1); - domains.Add(new MemoryDomain("Main RAM", 1, Endian.Little, addr => 0xFF, null)); //TODO - memoryDomains = domains.AsReadOnly(); this.rom = rom; this.game = game; this.hsbios = highscoreBIOS; @@ -216,6 +212,78 @@ namespace BizHawk.Emulation // to sync exactly with audio as this emulator creates and times it, the frame rate should be exactly 60:1 or 50:1 CoreComm.VsyncNum = theMachine.FrameHZ; CoreComm.VsyncDen = 1; + + // reset memory domains + if (_MemoryDomains == null) + { + _MemoryDomains = new List(); + if (theMachine is Machine7800) + { + _MemoryDomains.Add(new MemoryDomain( + "RAM1", 0x800, Endian.Unknown, + delegate(int addr) + { + return ((Machine7800)theMachine).RAM1[(ushort)addr]; + }, + delegate(int addr, byte val) + { + ((Machine7800)theMachine).RAM1[(ushort)addr] = val; + })); + _MemoryDomains.Add(new MemoryDomain( + "RAM2", 0x800, Endian.Unknown, + delegate(int addr) + { + return ((Machine7800)theMachine).RAM2[(ushort)addr]; + }, + delegate(int addr, byte val) + { + ((Machine7800)theMachine).RAM2[(ushort)addr] = val; + })); + _MemoryDomains.Add(new MemoryDomain( + "BIOS ROM", bios.Length, Endian.Unknown, + delegate(int addr) + { + return bios[addr]; + }, + delegate(int addr, byte val) + { + })); + _MemoryDomains.Add(new MemoryDomain( + "HSC ROM", hsbios.Length, Endian.Unknown, + delegate(int addr) + { + return hsbios[addr]; + }, + delegate(int addr, byte val) + { + })); + _MemoryDomains.Add(new MemoryDomain( + "HSC RAM", hsram.Length, Endian.Unknown, + delegate(int addr) + { + return hsram[addr]; + }, + delegate(int addr, byte val) + { + hsram[addr] = val; + })); + _MemoryDomains.Add(new MemoryDomain( + "System Bus", 65536, Endian.Unknown, + delegate(int addr) + { + return theMachine.Mem[(ushort)addr]; + }, + delegate(int addr, byte val) + { + theMachine.Mem[(ushort)addr] = val; + })); + } + else // 2600? + { + } + MemoryDomains = _MemoryDomains.AsReadOnly(); + } + } void SyncState(Serializer ser) //TODO diff --git a/BizHawk.MultiClient/output/dll/EMU7800.dll b/BizHawk.MultiClient/output/dll/EMU7800.dll index 426e9d4104fd22f69fbbc7fa581d810b8b5a621c..aa6123d18bd8e9054751388d09b6d7f0b2e375fd 100644 GIT binary patch delta 131 zcmZqJ!O^gTV?qaW1jo6??ycR7rA~}((;1x^rGbfbwXiVVZuyY$x{5&5GtNpEULmJ86Wyu%*1u@o ZuE56hhYw`aba_!GO-82eo}x_K*#K0DCrJPR delta 131 zcmZqJ!O^gTV?qbB{NJ;U-CMgEOPv^7rZYM-N&_ib2xSSTwud@19+<1*>|$bRZs209 zYvF9@tZQOm;H2wlWMZl7XyE8<=4@bMU} aU4f114;>GGmXnv9IwJw=(evjG6KCMX&J diff --git a/EMU7800/Core/Machine7800.cs b/EMU7800/Core/Machine7800.cs index af20d4af33..2389c6e942 100644 --- a/EMU7800/Core/Machine7800.cs +++ b/EMU7800/Core/Machine7800.cs @@ -13,10 +13,10 @@ namespace EMU7800.Core #region Fields protected Maria Maria { get; set; } - protected RAM6116 RAM1 { get; set; } - protected RAM6116 RAM2 { get; set; } - protected Bios7800 BIOS { get; private set; } - protected HSC7800 HSC { get; private set; } + public RAM6116 RAM1 { get; protected set; } + public RAM6116 RAM2 { get; protected set; } + public Bios7800 BIOS { get; private set; } + public HSC7800 HSC { get; private set; } #endregion