From b96e014327d3a67f951ce86f6d19258520af0028 Mon Sep 17 00:00:00 2001 From: brandman211 Date: Tue, 24 Jul 2012 05:29:24 +0000 Subject: [PATCH] -Reverted disassembly printout as it'll now match up with my comparison. -Fixed the branching disassembly; the direction just negates the offset and the second parameter only belongs to BEXT. All of my sources contradict each other, but this seems sensible. --- BizHawk.Emulation/CPUs/CP1610/Disassembler.cs | 11 +++++++---- BizHawk.Emulation/CPUs/CP1610/Execute.cs | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/BizHawk.Emulation/CPUs/CP1610/Disassembler.cs b/BizHawk.Emulation/CPUs/CP1610/Disassembler.cs index b8194bb514..b881d36cb0 100644 --- a/BizHawk.Emulation/CPUs/CP1610/Disassembler.cs +++ b/BizHawk.Emulation/CPUs/CP1610/Disassembler.cs @@ -14,7 +14,7 @@ namespace BizHawk.Emulation.CPUs.CP1610 addrToAdvance = 1; byte dest, src, mem; int decle2, decle3; - int cond; + int cond, ext; ushort addr, offset; string result = ""; int opcode = ReadMemory(pc) & 0x3FF; @@ -717,7 +717,8 @@ namespace BizHawk.Emulation.CPUs.CP1610 case 0x23F: offset = ReadMemory((ushort)(pc + 1)); cond = opcode & 0x15; - if ((opcode & 0x16) != 0) + ext = opcode & 0x16; + if (ext != 0) result = "BEXT"; else { @@ -775,9 +776,11 @@ namespace BizHawk.Emulation.CPUs.CP1610 } if (cond != 0x8) { + if (((opcode >> 5) & 0x1) != 0) + offset = (ushort)-offset; result += string.Format(" ${0:X4}", offset); - if (cond != 0x0) - result += ", " + ((opcode >> 5) & 0x1); + if (ext != 0) + result += string.Format(", ${0:X1}", opcode & 0x8); } addrToAdvance = 2; return result; diff --git a/BizHawk.Emulation/CPUs/CP1610/Execute.cs b/BizHawk.Emulation/CPUs/CP1610/Execute.cs index 042a8d4cac..055e41f6cd 100644 --- a/BizHawk.Emulation/CPUs/CP1610/Execute.cs +++ b/BizHawk.Emulation/CPUs/CP1610/Execute.cs @@ -43,12 +43,12 @@ namespace BizHawk.Emulation.CPUs.CP1610 while (PendingCycles > 0) { int addrToAdvance; - int opcode = ReadMemory(RegisterPC++) & 0x3FF; if (logging) { - log.WriteLine("{0:X3} ({1})", opcode, Disassemble((ushort)(RegisterPC - 1), out addrToAdvance)); + log.WriteLine(Disassemble(RegisterPC, out addrToAdvance)); log.Flush(); } + int opcode = ReadMemory(RegisterPC++) & 0x3FF; switch (opcode) { case 0x000: // HLT