diff --git a/src/huc6280.h b/src/huc6280.h index b3df760..fb24249 100644 --- a/src/huc6280.h +++ b/src/huc6280.h @@ -131,6 +131,11 @@ class HuC6280 void OPCodes_TRB(u16 address); void OPCodes_TSB(u16 address); void OPCodes_TST(u8 value, u16 address); + void OPCodes_TAI(); + void OPCodes_TDD(); + void OPCodes_TIA(); + void OPCodes_TII(); + void OPCodes_TIN(); void InitOPCodeFunctors(); diff --git a/src/huc6280_opcodes.cpp b/src/huc6280_opcodes.cpp index 8552b50..a105cfe 100644 --- a/src/huc6280_opcodes.cpp +++ b/src/huc6280_opcodes.cpp @@ -849,9 +849,9 @@ void HuC6280::OPCode0x72() void HuC6280::OPCode0x73() { - // UNOFFICIAL - // RRA ($n),Y - UnofficialOPCode(); + // OK + // TII + OPCodes_TII(); } void HuC6280::OPCode0x74() @@ -1421,9 +1421,9 @@ void HuC6280::OPCode0xC2() void HuC6280::OPCode0xC3() { - // UNOFFICIAL - // DCP $(nn,X) - UnofficialOPCode(); + // OK + // TDD + OPCodes_TDD(); } void HuC6280::OPCode0xC4() @@ -1533,9 +1533,9 @@ void HuC6280::OPCode0xD2() void HuC6280::OPCode0xD3() { - // UNOFFICIAL - // DCP ($n),Y - UnofficialOPCode(); + // OK + // TIN + OPCodes_TIN(); } void HuC6280::OPCode0xD4() @@ -1645,9 +1645,9 @@ void HuC6280::OPCode0xE2() void HuC6280::OPCode0xE3() { - // UNOFFICIAL - // ISC $(nn,X) - UnofficialOPCode(); + // OK + // TIA + OPCodes_TIA(); } void HuC6280::OPCode0xE4() @@ -1751,9 +1751,9 @@ void HuC6280::OPCode0xF2() void HuC6280::OPCode0xF3() { - // UNOFFICIAL - // ISC ($n),Y - UnofficialOPCode(); + // OK + // TAI + OPCodes_TAI(); } void HuC6280::OPCode0xF4() diff --git a/src/huc6280_opcodes_inline.h b/src/huc6280_opcodes_inline.h index 3278bce..baf42c5 100644 --- a/src/huc6280_opcodes_inline.h +++ b/src/huc6280_opcodes_inline.h @@ -554,4 +554,79 @@ inline void HuC6280::OPCodes_TST(u8 value, u16 address) SetOverflowFlagFromResult(result); } +inline void HuC6280::OPCodes_TAI() +{ + // TODO + u16 source = Fetch16(); + u16 dest = Fetch16(); + u16 length = Fetch16(); + + for (u16 i = 0; i < length; i++) + { + u8 value = m_memory->Read(source + i); + m_memory->Write(dest + i, value); + m_t_states += 6; + } +} + +inline void HuC6280::OPCodes_TDD() +{ + // TODO + u16 source = Fetch16(); + u16 dest = Fetch16(); + u16 length = Fetch16(); + + for (u16 i = 0; i < length; i++) + { + u8 value = m_memory->Read(source + i); + m_memory->Write(dest + i, value); + m_t_states += 6; + } +} + +inline void HuC6280::OPCodes_TIA() +{ + // TODO + u16 source = Fetch16(); + u16 dest = Fetch16(); + u16 length = Fetch16(); + + for (u16 i = 0; i < length; i++) + { + u8 value = m_memory->Read(source + i); + m_memory->Write(dest + i, value); + m_t_states += 6; + } +} + +inline void HuC6280::OPCodes_TII() +{ + // TODO + u16 source = Fetch16(); + u16 dest = Fetch16(); + u16 length = Fetch16(); + + for (u16 i = 0; i < length; i++) + { + u8 value = m_memory->Read(source + i); + m_memory->Write(dest + i, value); + m_t_states += 6; + } +} + +inline void HuC6280::OPCodes_TIN() +{ + // TODO + u16 source = Fetch16(); + u16 dest = Fetch16(); + u16 length = Fetch16(); + + for (u16 i = 0; i < length; i++) + { + u8 value = m_memory->Read(source + i); + m_memory->Write(dest + i, value); + m_t_states += 6; + } +} + #endif /* HUC6280_OPCODES_INLINE_H */ \ No newline at end of file diff --git a/src/huc6280_timing.h b/src/huc6280_timing.h index 84bc847..6cdfb83 100644 --- a/src/huc6280_timing.h +++ b/src/huc6280_timing.h @@ -32,15 +32,15 @@ const u8 k_opcode_tstates[256] = /* 0x40 */ 7, 7, 3, 4, 8, 4, 6, 7, 3, 2, 2, 2, 4, 5, 7, 6, /* 0x50 */ 2, 7, 7, 5, 4, 4, 6, 7, 2, 5, 3, 7, 4, 5, 7, 6, /* 0x60 */ 7, 7, 2, 8, 4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