diff --git a/BizHawk.Emulation/Consoles/Atari/2600/M6532.cs b/BizHawk.Emulation/Consoles/Atari/2600/M6532.cs index b5f65258ae..8561b88214 100644 --- a/BizHawk.Emulation/Consoles/Atari/2600/M6532.cs +++ b/BizHawk.Emulation/Consoles/Atari/2600/M6532.cs @@ -13,6 +13,10 @@ namespace BizHawk.Emulation.Consoles.Atari public int timerStartValue; public int timerFinishedCycles; public int timerShift; + + bool interruptEnabled = false; + bool interruptTriggered = false; + Atari2600 core; @@ -47,6 +51,8 @@ namespace BizHawk.Emulation.Consoles.Atari // Calculate the current value on the timer int timerCurrentValue = timerFinishedCycles - Cpu.TotalExecutedCycles; + interruptTriggered = false; + // If the timer has not finished, shift the value down for the game if (Cpu.TotalExecutedCycles < timerFinishedCycles) { @@ -55,6 +61,7 @@ namespace BizHawk.Emulation.Consoles.Atari // Other wise, return the last 8 bits from how long ago it triggered else { + interruptTriggered = true; return (byte)(timerCurrentValue & 0xFF); } } @@ -78,6 +85,17 @@ namespace BizHawk.Emulation.Consoles.Atari { } + else if (maskedAddr == 0x05) // interrupt + { + if ((timerFinishedCycles - Cpu.TotalExecutedCycles >= 0)|| (interruptEnabled && interruptTriggered)) + { + return 0x00; + } + else + { + return 0x80; + } + } } } @@ -109,6 +127,8 @@ namespace BizHawk.Emulation.Consoles.Atari timerFinishedCycles = timerStartValue + Cpu.TotalExecutedCycles; Console.WriteLine("6532 timer write: " + maskedAddr.ToString("x")); + + interruptEnabled = ((addr & 0x08) != 0); } else { diff --git a/BizHawk.Emulation/Consoles/Atari/2600/TIA.cs b/BizHawk.Emulation/Consoles/Atari/2600/TIA.cs index 67ee21ff22..67de4f1196 100644 --- a/BizHawk.Emulation/Consoles/Atari/2600/TIA.cs +++ b/BizHawk.Emulation/Consoles/Atari/2600/TIA.cs @@ -445,6 +445,11 @@ namespace BizHawk.Emulation.Consoles.Atari player0copy1 = 16; player0copy2 = 32; break; + case 0x06: + player0copies = 2; + player0copy1 = 32; + player0copy2 = 64; + break; } } else if (maskedAddr == 0x05) // NUSIZ1 @@ -468,6 +473,11 @@ namespace BizHawk.Emulation.Consoles.Atari player1copy1 = 16; player1copy2 = 32; break; + case 0x06: + player1copies = 2; + player1copy1 = 32; + player1copy2 = 64; + break; } } else if (maskedAddr == 0x06) // COLUP0