From 2e70b5eb9f1723a261060765247f09a97a592b9a Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 13 Apr 2021 19:45:29 -0400 Subject: [PATCH] Advances to EX (SP), HL, leaving only [LD/CP/IN/OT][I/D]{R}. --- .../Clock SignalTests/Z80ContentionTests.mm | 55 ++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/OSBindings/Mac/Clock SignalTests/Z80ContentionTests.mm b/OSBindings/Mac/Clock SignalTests/Z80ContentionTests.mm index 241783eaa..85b1ed3ed 100644 --- a/OSBindings/Mac/Clock SignalTests/Z80ContentionTests.mm +++ b/OSBindings/Mac/Clock SignalTests/Z80ContentionTests.mm @@ -1147,7 +1147,7 @@ struct ContentionCheck { } } -- (void)testINOUTA { +- (void)testINOUTn { for(const auto &sequence : std::vector>{ {0xdb, 0xef}, // IN A, (n) {0xd3, 0xef}, // OUT (n), A @@ -1168,4 +1168,57 @@ struct ContentionCheck { } } +- (void)testINOUTC { + for(const auto &sequence : std::vector>{ + // IN r, (C) + {0xed, 0x40}, {0xed, 0x48}, {0xed, 0x50}, {0xed, 0x58}, + {0xed, 0x60}, {0xed, 0x68}, {0xed, 0x70}, {0xed, 0x78}, + + // OUT r, (C) + {0xed, 0x41}, {0xed, 0x49}, {0xed, 0x51}, {0xed, 0x59}, + {0xed, 0x61}, {0xed, 0x69}, {0xed, 0x71}, {0xed, 0x79}, + }) { + CapturingZ80 z80(sequence); + z80.run_for(12); + + [self validate48Contention:{ + {initial_pc, 4}, + {initial_pc+1, 4}, + {initial_bc_de_hl, 4, true}, + } z80:z80]; + [self validatePlus3Contention:{ + {initial_pc, 4}, + {initial_pc+1, 4}, + {initial_bc_de_hl, 4, true}, + } z80:z80]; + } +} + +- (void)testEXSPHL { + for(uint8_t opcode : { + 0xe3, + }) { + const std::initializer_list opcodes = {opcode}; + CapturingZ80 z80(opcodes); + z80.run_for(19); + + [self validate48Contention:{ + {initial_pc, 4}, + {initial_sp, 3}, + {initial_sp+1, 3}, + {initial_sp+1, 1}, + {initial_sp+1, 3}, + {initial_sp, 3}, + {initial_sp, 1}, + {initial_sp, 1}, + } z80:z80]; + [self validatePlus3Contention:{ + {initial_pc, 4}, + {initial_sp, 3}, + {initial_sp+1, 4}, + {initial_sp+1, 3}, + {initial_sp, 5}, + } z80:z80]; + }} + @end