1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-09-29 16:55:59 +00:00

Corrects memptr behaviour of OTIR/OTDR and INIR/INDR.

This seemingly perfects memptr.
This commit is contained in:
Thomas Harte 2020-02-27 20:55:43 -05:00
parent 26de5be07c
commit 01faffd5bf
2 changed files with 14 additions and 7 deletions

View File

@ -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) {

View File

@ -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