From 6e699d576aeb683037bc1e00cc042768c2c77bb0 Mon Sep 17 00:00:00 2001 From: alyosha-tas Date: Tue, 17 Dec 2019 18:58:20 -0500 Subject: [PATCH] O2Hawk: more bug fixes --- .../CPUs/Intel8048/I8048.cs | 3 ++- .../CPUs/Intel8048/Interrupts.cs | 2 +- .../Consoles/Magnavox/Odyssey2/O2Hawk.cs | 3 ++- .../Consoles/Magnavox/Odyssey2/PPU.cs | 24 +++++++++++++++---- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/BizHawk.Emulation.Cores/CPUs/Intel8048/I8048.cs b/BizHawk.Emulation.Cores/CPUs/Intel8048/I8048.cs index 45c9c5efdb..518f44d4a1 100644 --- a/BizHawk.Emulation.Cores/CPUs/Intel8048/I8048.cs +++ b/BizHawk.Emulation.Cores/CPUs/Intel8048/I8048.cs @@ -358,7 +358,8 @@ namespace BizHawk.Emulation.Common.Components.I8048 Regs[PC] = (ushort)(Regs[(Regs[PSW] & 0x7) * 2 + 8] & 0xFF); Regs[PC] |= (ushort)((Regs[(Regs[PSW] & 0x7) * 2 + 8 + 1] & 0xF) << 8); Regs[PSW] &= 0xF; - Regs[PSW] |= (ushort)(Regs[(Regs[PSW] & 0x7) * 2 + 8 + 1] & 0xF0); + Regs[PSW] |= (ushort)(Regs[(Regs[PSW] & 0x7) * 2 + 8 + 1] & 0xF0); + RB = (ushort)(FlagBS ? 24 : 0); break; case PULL_PC: Regs[PSW] = (ushort)((((Regs[PSW] & 0x7) - 1) & 0x7) | (Regs[PSW] & 0xF8)); diff --git a/BizHawk.Emulation.Cores/CPUs/Intel8048/Interrupts.cs b/BizHawk.Emulation.Cores/CPUs/Intel8048/Interrupts.cs index 43538aa616..cd842febb1 100644 --- a/BizHawk.Emulation.Cores/CPUs/Intel8048/Interrupts.cs +++ b/BizHawk.Emulation.Cores/CPUs/Intel8048/Interrupts.cs @@ -24,7 +24,7 @@ namespace BizHawk.Emulation.Common.Components.I8048 IDLE, PUSH, IDLE, - SET_ADDR, PC, ALU, 0); + TR, PC, ALU); IRQS = 10; } diff --git a/BizHawk.Emulation.Cores/Consoles/Magnavox/Odyssey2/O2Hawk.cs b/BizHawk.Emulation.Cores/Consoles/Magnavox/Odyssey2/O2Hawk.cs index 6d53e3658a..394f7ed3cb 100644 --- a/BizHawk.Emulation.Cores/Consoles/Magnavox/Odyssey2/O2Hawk.cs +++ b/BizHawk.Emulation.Cores/Consoles/Magnavox/Odyssey2/O2Hawk.cs @@ -108,7 +108,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk { cpu.Regs[i] = (byte)i; } - */ + for (int j = 0; j < 0x80; j++) { @@ -119,6 +119,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk { ppu.WriteReg(k, (byte)k); } + */ } public DisplayType Region => DisplayType.NTSC; diff --git a/BizHawk.Emulation.Cores/Consoles/Magnavox/Odyssey2/PPU.cs b/BizHawk.Emulation.Cores/Consoles/Magnavox/Odyssey2/PPU.cs index 8fcbce2edf..df6444dd16 100644 --- a/BizHawk.Emulation.Cores/Consoles/Magnavox/Odyssey2/PPU.cs +++ b/BizHawk.Emulation.Cores/Consoles/Magnavox/Odyssey2/PPU.cs @@ -58,7 +58,15 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk ret = VDC_col_ret; //Console.WriteLine("col: " + ret + " " + Core.cpu.TotalExecutedCycles); } - else if(addr == 0xA3) + else if(addr == 0xA4) + { + ret = (byte)LY; + } + else if (addr == 0xA5) + { + ret = (byte)(cycle - 43); + } + else if (addr == 0xA3) { ret = VDC_color; } @@ -105,7 +113,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk else if (addr == 0xA0) { VDC_ctrl = value; - //Console.WriteLine(value + " " + Core.cpu.TotalExecutedCycles); + //Console.WriteLine("VDC_ctrl: " + value + " " + Core.cpu.TotalExecutedCycles); } else if (addr == 0xA1) { @@ -119,6 +127,14 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk { VDC_color = value; } + else if (addr == 0xA4) + { + // writing has no effect + } + else if (addr == 0xA5) + { + // writing has no effect + } else if (addr <= 0xAA) { AudioWriteReg(addr, value); @@ -559,7 +575,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk case 0xA9: ret = shift_reg_2; break; case 0xAA: ret = aud_ctrl; break; } - + //Console.WriteLine("aud read: " + (addr - 0xA7) + " " + ret + " " + Core.cpu.TotalExecutedCycles); return ret; } @@ -573,7 +589,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk case 0xAA: aud_ctrl = value; break; } - //Console.WriteLine((addr - 0xA7) + " " + value); + //Console.WriteLine("aud write: " + (addr - 0xA7) + " " + value + " " + Core.cpu.TotalExecutedCycles); } public void Audio_tick()