From 4864aaa2914570702133345393a3a82f81bc9672 Mon Sep 17 00:00:00 2001 From: brandman211 Date: Fri, 27 Jul 2012 04:46:44 +0000 Subject: [PATCH] -Enabled and tested DECR. -Fixed my disassembly of branch; I wasn't thinking in hexadecimal. >_< -Subtracted 1 from the negated offset when branching in reverse. The next op is "BNEQ $FFFC". --- BizHawk.Emulation/CPUs/CP1610/Disassembler.cs | 19 ++++++++++--------- BizHawk.Emulation/CPUs/CP1610/Execute.cs | 1 - 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/BizHawk.Emulation/CPUs/CP1610/Disassembler.cs b/BizHawk.Emulation/CPUs/CP1610/Disassembler.cs index b881d36cb0..17acf9c933 100644 --- a/BizHawk.Emulation/CPUs/CP1610/Disassembler.cs +++ b/BizHawk.Emulation/CPUs/CP1610/Disassembler.cs @@ -716,8 +716,8 @@ namespace BizHawk.Emulation.CPUs.CP1610 case 0x23E: case 0x23F: offset = ReadMemory((ushort)(pc + 1)); - cond = opcode & 0x15; - ext = opcode & 0x16; + cond = opcode & 0xF; + ext = opcode & 0x10; if (ext != 0) result = "BEXT"; else @@ -754,30 +754,31 @@ namespace BizHawk.Emulation.CPUs.CP1610 case 0x9: result = "BNC"; break; - case 0x10: + case 0xA: result = "BNOV"; break; - case 0x11: + case 0xB: result = "BMI"; break; - case 0x12: + case 0xC: result = "BNEQ"; break; - case 0x13: + case 0xD: result = "BGE"; break; - case 0x14: + case 0xE: result = "BGT"; break; - case 0x15: + case 0xF: result = "BESC"; break; } } if (cond != 0x8) { + // Branch in the reverse direction by negating the offset and subtracting 1. if (((opcode >> 5) & 0x1) != 0) - offset = (ushort)-offset; + offset = (ushort)(-offset - 1); result += string.Format(" ${0:X4}", offset); if (ext != 0) result += string.Format(", ${0:X1}", opcode & 0x8); diff --git a/BizHawk.Emulation/CPUs/CP1610/Execute.cs b/BizHawk.Emulation/CPUs/CP1610/Execute.cs index 836e23ec67..973ee9f523 100644 --- a/BizHawk.Emulation/CPUs/CP1610/Execute.cs +++ b/BizHawk.Emulation/CPUs/CP1610/Execute.cs @@ -137,7 +137,6 @@ namespace BizHawk.Emulation.CPUs.CP1610 case 0x015: case 0x016: case 0x017: - throw new NotImplementedException(); dest = (byte)(opcode & 0x7); result = (Register[dest] - 1) & 0xFFFF; Calc_FlagS(result);