From 4d1f0114c4afa5363b74d3b66e23b59e1e603f03 Mon Sep 17 00:00:00 2001 From: brandman211 Date: Fri, 27 Jul 2012 04:07:06 +0000 Subject: [PATCH] R4-R7 now auto-increment for all of the indirect opcodes. My documentation is inconsistent on whether R6 increments or decrements on right, but in any case, my output now matches my source until the DECR, which hasn't been implemented yet. --- BizHawk.Emulation/CPUs/CP1610/Execute.cs | 27 ++++++++---------------- 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/BizHawk.Emulation/CPUs/CP1610/Execute.cs b/BizHawk.Emulation/CPUs/CP1610/Execute.cs index 066c5da10b..836e23ec67 100644 --- a/BizHawk.Emulation/CPUs/CP1610/Execute.cs +++ b/BizHawk.Emulation/CPUs/CP1610/Execute.cs @@ -1081,12 +1081,9 @@ namespace BizHawk.Emulation.CPUs.CP1610 mem = (byte)((opcode >> 3) & 0x7); src = (byte)(opcode & 0x7); WriteMemory(Register[mem], Register[src]); - // Stack mode. - if (mem == 0x6) - RegisterSP++; - // Immediate mode. - if (mem == 0x7) - RegisterPC++; + // Auto-increment. + if (mem >= 0x4) + Register[mem]++; PendingCycles -= 9; TotalExecutedCycles += 9; break; // MVI @@ -1177,12 +1174,9 @@ namespace BizHawk.Emulation.CPUs.CP1610 Register[dest] |= (ushort)(ReadMemory(Register[mem]) & 0xFF); PendingCycles -= 10; TotalExecutedCycles += 10; } - // Stack mode. - if (mem == 0x6) - RegisterSP++; - // Immediate mode. - if (mem == 0x7) - RegisterPC++; + // Auto-increment. + if (mem >= 0x4) + Register[mem]++; break; // ADD case 0x2C0: @@ -1272,12 +1266,9 @@ namespace BizHawk.Emulation.CPUs.CP1610 mem_read |= (ushort)(ReadMemory(Register[mem]) & 0xFF); PendingCycles -= 10; TotalExecutedCycles += 10; } - // Stack mode. - if (mem == 0x6) - RegisterSP++; - // Immediate mode. - if (mem == 0x7) - RegisterPC++; + // Auto-increment. + if (mem >= 0x4) + Register[mem]++; dest_value = Register[dest]; result = mem_read + dest_value; Calc_FlagC(result);