diff --git a/OSBindings/Mac/Clock SignalTests/PatrikRakTests.swift b/OSBindings/Mac/Clock SignalTests/PatrikRakTests.swift index 381022223..0328d23eb 100644 --- a/OSBindings/Mac/Clock SignalTests/PatrikRakTests.swift +++ b/OSBindings/Mac/Clock SignalTests/PatrikRakTests.swift @@ -85,15 +85,16 @@ class PatrikRakTests: XCTestCase, CSTestMachineTrapHandler { runTest("z80docflags") } + func testFlags() { + runTest("z80flags") + } + func testFull() { runTest("z80full") - // Current status: 002 of 152 tests failed. - // Specifically: BIT N,(HL) and BIT N,[R,(HL)], i.e. MEMPTR by proxy. } func testMemptr() { runTest("z80memptr") - // Current status: 2 of 152 tests failed. } func testMachine(_ testMachine: CSTestMachine, didTrapAtAddress address: UInt16) { diff --git a/Processors/Z80/Implementation/Z80Implementation.hpp b/Processors/Z80/Implementation/Z80Implementation.hpp index dc2b6582c..ef2fca726 100644 --- a/Processors/Z80/Implementation/Z80Implementation.hpp +++ b/Processors/Z80/Implementation/Z80Implementation.hpp @@ -553,7 +553,16 @@ template < class T, #undef CPxR_STEP +#undef REPEAT +#define REPEAT(test) \ + if(test) { \ + pc_.full -= 2; \ + } else { \ + advance_operation(); \ + } + #define INxR_STEP(dir) \ + memptr_.full = uint16_t(bc_.full + dir); \ bc_.halves.high--; \ hl_.full += dir; \ \ @@ -586,12 +595,10 @@ template < class T, } break; case MicroOp::IND: { - memptr_.full = bc_.full - 1; INxR_STEP(-1); } break; case MicroOp::INI: { - memptr_.full = bc_.full + 1; INxR_STEP(1); } break; @@ -599,6 +606,7 @@ template < class T, #define OUTxR_STEP(dir) \ bc_.halves.high--; \ + memptr_.full = uint16_t(bc_.full + dir); \ hl_.full += dir; \ \ sign_result_ = zero_result_ = bit53_result_ = bc_.halves.high; \ @@ -622,12 +630,10 @@ template < class T, case MicroOp::OUTD: { OUTxR_STEP(-1); - memptr_.full = bc_.full - 1; } break; case MicroOp::OUTI: { OUTxR_STEP(1); - memptr_.full = bc_.full + 1; } break; #undef OUTxR_STEP