Skip to content

Commit

Permalink
TAX TAY TSX TXA TXS TYA opcodes
Browse files Browse the repository at this point in the history
  • Loading branch information
drhelius committed Jul 2, 2024
1 parent 370ea06 commit 3b75a81
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/huc6280.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class HuC6280
void OPCodes_Store(EightBitRegister* reg, u16 address);
void OPCodes_STZ(u16 address);
void OPCodes_Swap(EightBitRegister* reg1, EightBitRegister* reg2);
void OPCodes_Transfer(EightBitRegister* reg, EightBitRegister* target);
void OPCodes_Transfer(EightBitRegister* source, EightBitRegister* dest);

void InitOPCodeFunctors();

Expand Down
6 changes: 6 additions & 0 deletions src/huc6280_opcodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,7 @@ void HuC6280::OPCode0x89()

void HuC6280::OPCode0x8A()
{
// OK
// TXA
OPCodes_Transfer(&m_X, &m_A);
}
Expand Down Expand Up @@ -1114,6 +1115,7 @@ void HuC6280::OPCode0x97()

void HuC6280::OPCode0x98()
{
// OK
// TYA
OPCodes_Transfer(&m_Y, &m_A);
}
Expand All @@ -1127,6 +1129,7 @@ void HuC6280::OPCode0x99()

void HuC6280::OPCode0x9A()
{
// OK
// TXS
OPCodes_Transfer(&m_X, &m_S);
}
Expand Down Expand Up @@ -1224,6 +1227,7 @@ void HuC6280::OPCode0xA7()

void HuC6280::OPCode0xA8()
{
// OK
// TAY
OPCodes_Transfer(&m_A, &m_Y);
}
Expand All @@ -1237,6 +1241,7 @@ void HuC6280::OPCode0xA9()

void HuC6280::OPCode0xAA()
{
// OK
// TAX
OPCodes_Transfer(&m_A, &m_X);
}
Expand Down Expand Up @@ -1348,6 +1353,7 @@ void HuC6280::OPCode0xB9()

void HuC6280::OPCode0xBA()
{
// OK
// TSX
OPCodes_Transfer(&m_S, &m_X);
}
Expand Down
6 changes: 3 additions & 3 deletions src/huc6280_opcodes_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,11 +469,11 @@ inline void HuC6280::OPCodes_Swap(EightBitRegister* reg1, EightBitRegister* reg2
reg2->SetValue(temp);
}

inline void HuC6280::OPCodes_Transfer(EightBitRegister* reg, EightBitRegister* target)
inline void HuC6280::OPCodes_Transfer(EightBitRegister* source, EightBitRegister* dest)
{
ClearFlag(FLAG_MEMORY);
u8 value = reg->GetValue();
target->SetValue(value);
u8 value = source->GetValue();
dest->SetValue(value);
SetZeroFlagFromResult(value);
SetNegativeFlagFromResult(value);
}
Expand Down

0 comments on commit 3b75a81

Please sign in to comment.