Skip to content

Commit

Permalink
CMP opcode
Browse files Browse the repository at this point in the history
  • Loading branch information
drhelius committed Jul 1, 2024
1 parent 28cfddb commit 4979778
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
28 changes: 18 additions & 10 deletions src/huc6280_opcodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}

Expand All @@ -1334,7 +1335,8 @@ void HuC6280::OPCode0xC4()

void HuC6280::OPCode0xC5()
{
// CMP $n
// OK
// CMP ZZ
OPCodes_CMP(&m_A, m_memory->Read(ZeroPageAddressing()));
}

Expand All @@ -1359,7 +1361,8 @@ void HuC6280::OPCode0xC8()

void HuC6280::OPCode0xC9()
{
// CMP #$n
// OK
// CMP #nn
OPCodes_CMP(&m_A, ImmediateAddressing());
}

Expand All @@ -1384,7 +1387,8 @@ void HuC6280::OPCode0xCC()

void HuC6280::OPCode0xCD()
{
// CMP $nn
// OK
// CMP hhll
OPCodes_CMP(&m_A, m_memory->Read(AbsoluteAddressing()));
}

Expand All @@ -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()
Expand All @@ -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)));
}

Expand All @@ -1463,6 +1469,7 @@ void HuC6280::OPCode0xD8()

void HuC6280::OPCode0xD9()
{
// OK
// CMP $nn,Y
OPCodes_CMP(&m_A, m_memory->Read(AbsoluteAddressing(&m_Y)));
}
Expand Down Expand Up @@ -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)));
}

Expand Down
6 changes: 3 additions & 3 deletions src/huc6280_timing.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand All @@ -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, 2, 2, 2, 0, 1, 3, 1, 0, 3, 3, 3, 3,
/* 0xC0 */ 2, 2, 1,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