diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/Mappers/MapperSGE.cs b/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/Mappers/MapperSGE.cs index 8c8e1ff37e..c125318fcb 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/Mappers/MapperSGE.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/Mappers/MapperSGE.cs @@ -58,10 +58,14 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk int temp_addr = addr - 0x8000; return Core._rom[temp_addr + (bank + 1) * 0x4000]; } + else if (Core.is_pokey) + { + return Core.pokey.ReadReg(addr & 0xF); + } else { - // return the 16k extra ROM (located at beginning of file) - int temp_addr = addr - 0x4000; + // return the 16k extra ROM (located at beginning of file) + int temp_addr = addr - 0x4000; return Core._rom[temp_addr]; } } @@ -105,6 +109,10 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk { bank = (byte)(value & 0x7); } + else if (Core.is_pokey) + { + Core.pokey.WriteReg(addr & 0xF, value); + } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/Pokey.cs b/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/Pokey.cs index ab50908041..e0182a89f3 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/Pokey.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/Pokey.cs @@ -152,10 +152,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk { if (clock_ch[0]) { - if ((ch_div[0] + 1) >= (Regs[0 * 2] + 1)) - { - clock_ch[1] = true; - } + clock_ch[1] = true; } } else @@ -176,10 +173,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk { if (clock_ch[2]) { - if ((ch_div[2] + 1) >= (Regs[2 * 2] + 1)) - { - clock_ch[3] = true; - } + clock_ch[3] = true; } } else @@ -205,7 +199,19 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk { ch_div[i]++; - if (ch_div[i] >= (Regs[i * 2] + 1)) + int test = (Regs[i * 2] + 1); + + if ((i == 1) && Regs[8].Bit(4)) + { + test = Regs[i * 2] * 256 + Regs[0] + 1; + } + + if ((i == 3) && Regs[8].Bit(3)) + { + test = Regs[i * 2] * 256 + Regs[2] + 1; + } + + if (ch_div[i] >= test) { ch_div[i] = 0;