From 49797782d78df8a8e4c0a8442c1784bd34f1f4fc Mon Sep 17 00:00:00 2001 From: Ignacio Sanchez Gines <863613+drhelius@users.noreply.github.com> Date: Mon, 1 Jul 2024 19:41:52 +0200 Subject: [PATCH] CMP opcode --- src/huc6280_opcodes.cpp | 28 ++++++++++++++++++---------- src/huc6280_timing.h | 6 +++--- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/huc6280_opcodes.cpp b/src/huc6280_opcodes.cpp index b8876b9..547efae 100644 --- a/src/huc6280_opcodes.cpp +++ b/src/huc6280_opcodes.cpp @@ -1307,7 +1307,8 @@ void HuC6280::OPCode0xC0() void HuC6280::OPCode0xC1() { - // CMP $(nn,X) + // OK + // CMP (ZZ,X) OPCodes_CMP(&m_A, m_memory->Read(IndexedIndirectAddressing())); } @@ -1334,7 +1335,8 @@ void HuC6280::OPCode0xC4() void HuC6280::OPCode0xC5() { - // CMP $n + // OK + // CMP ZZ OPCodes_CMP(&m_A, m_memory->Read(ZeroPageAddressing())); } @@ -1359,7 +1361,8 @@ void HuC6280::OPCode0xC8() void HuC6280::OPCode0xC9() { - // CMP #$n + // OK + // CMP #nn OPCodes_CMP(&m_A, ImmediateAddressing()); } @@ -1384,7 +1387,8 @@ void HuC6280::OPCode0xCC() void HuC6280::OPCode0xCD() { - // CMP $nn + // OK + // CMP hhll OPCodes_CMP(&m_A, m_memory->Read(AbsoluteAddressing())); } @@ -1410,15 +1414,16 @@ void HuC6280::OPCode0xD0() void HuC6280::OPCode0xD1() { - // CMP ($n),Y + // OK + // CMP (ZZ),Y OPCodes_CMP(&m_A, m_memory->Read(IndirectIndexedAddressing())); } void HuC6280::OPCode0xD2() { - // UNOFFICIAL - // KILL - UnofficialOPCode(); + // OK + // CMP (ZZ) + OPCodes_CMP(&m_A, m_memory->Read(ZeroPageIndirectAddressing())); } void HuC6280::OPCode0xD3() @@ -1437,7 +1442,8 @@ void HuC6280::OPCode0xD4() void HuC6280::OPCode0xD5() { - // CMP $n,X + // OK + // CMP ZZ,X OPCodes_CMP(&m_A, m_memory->Read(ZeroPageAddressing(&m_X))); } @@ -1463,6 +1469,7 @@ void HuC6280::OPCode0xD8() void HuC6280::OPCode0xD9() { + // OK // CMP $nn,Y OPCodes_CMP(&m_A, m_memory->Read(AbsoluteAddressing(&m_Y))); } @@ -1490,7 +1497,8 @@ void HuC6280::OPCode0xDC() void HuC6280::OPCode0xDD() { - // CMP $nn,X + // OK + // CMP hhll,X OPCodes_CMP(&m_A, m_memory->Read(AbsoluteAddressing(&m_X))); } diff --git a/src/huc6280_timing.h b/src/huc6280_timing.h index 8875162..ffe25dc 100644 --- a/src/huc6280_timing.h +++ b/src/huc6280_timing.h @@ -37,8 +37,8 @@ const u8 k_opcode_tstates[256] = /* 0x90 */ 2, 6, 2, 6, 4, 4, 4, 4, 2, 5, 2, 5, 5, 5, 5, 6, /* 0xA0 */ 2, 6, 2, 6, 3, 3, 3, 3, 2, 2, 2, 2, 4, 4, 4, 6, /* 0xB0 */ 2, 5, 2, 5, 4, 4, 4, 4, 2, 4, 2, 4, 4, 4, 4, 6, -/* 0xC0 */ 2, 6, 2, 8, 3, 3, 5, 5, 2, 2, 2, 2, 4, 4, 6, 6, -/* 0xD0 */ 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 6, +/* 0xC0 */ 2, 7, 2, 8, 3, 4, 5, 5, 2, 2, 2, 2, 4, 5, 6, 6, +/* 0xD0 */ 2, 7, 7, 8, 4, 4, 6, 6, 2, 5, 2, 7, 4, 5, 7, 6, /* 0xE0 */ 2, 6, 2, 8, 3, 3, 5, 5, 2, 2, 2, 2, 4, 4, 6, 6, /* 0xF0 */ 2, 5, 2, 8, 4, 4, 6, 6, 2, 4, 2, 7, 4, 4, 7, 6 }; @@ -59,7 +59,7 @@ const u8 k_opcode_sizes[256] = /* 0xA0 */ 2, 2, 2, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 3, /* 0xB0 */ 2, 2, 0, 0, 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