diff --git a/BizHawk.Emulation/Consoles/Atari/2600/Atari2600.Core.cs b/BizHawk.Emulation/Consoles/Atari/2600/Atari2600.Core.cs index dfb9f350bb..46375e5746 100644 --- a/BizHawk.Emulation/Consoles/Atari/2600/Atari2600.Core.cs +++ b/BizHawk.Emulation/Consoles/Atari/2600/Atari2600.Core.cs @@ -13,6 +13,8 @@ namespace BizHawk public M6532 m6532; public TIA tia; + bool resetSignal; + // The Atari 2600 memory mapper looks something like this...usually // N/A Page # @@ -122,6 +124,13 @@ namespace BizHawk public void FrameAdvance(bool render) { Frame++; + if (resetSignal) + { + //cpu.PC = cpu.ReadWord(MOS6507.ResetVector); + m6532.resetOccured = true; + //m6532.swchb &= 0xFE; + //cpu.FlagI = true; + } //cpu.Execute(228); //cpu.Execute(2000); @@ -143,6 +152,7 @@ namespace BizHawk } } + resetSignal = Controller["Reset"]; //clear the framebuffer (hack code) if (render == false) return; /* diff --git a/BizHawk.Emulation/Consoles/Atari/2600/M6532.cs b/BizHawk.Emulation/Consoles/Atari/2600/M6532.cs index 8561b88214..c32c2354f0 100644 --- a/BizHawk.Emulation/Consoles/Atari/2600/M6532.cs +++ b/BizHawk.Emulation/Consoles/Atari/2600/M6532.cs @@ -19,6 +19,10 @@ namespace BizHawk.Emulation.Consoles.Atari Atari2600 core; + public byte swchb = 0x0B; + + public bool resetOccured = false; + public M6532(MOS6507 cpu, byte[] ram, Atari2600 core) { @@ -79,7 +83,9 @@ namespace BizHawk.Emulation.Consoles.Atari } else if (maskedAddr == 0x02) // SWCHB { - return 0x3F; + bool temp = resetOccured; + resetOccured = false; + return (byte)(0x0A | (temp ? 0x00 : 0x01)); } else if (maskedAddr == 0x03) // SWBCNT { @@ -130,6 +136,10 @@ namespace BizHawk.Emulation.Consoles.Atari interruptEnabled = ((addr & 0x08) != 0); } + else if ((addr & 0x04) == 0 && (maskedAddr & 0x03) == 0x02) + { + swchb = value; + } else { Console.WriteLine("6532 register write: " + maskedAddr.ToString("x"));