From cd787486d2b15d6e928aa5cfe5097ff6916ff147 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 7 Apr 2021 22:07:52 -0400 Subject: [PATCH] Tests all of the single-byte, no-access opcodes. --- .../Clock SignalTests/Z80ContentionTests.mm | 52 +++++++++++++++++-- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/OSBindings/Mac/Clock SignalTests/Z80ContentionTests.mm b/OSBindings/Mac/Clock SignalTests/Z80ContentionTests.mm index 12dc0be6a..2da9ad1e3 100644 --- a/OSBindings/Mac/Clock SignalTests/Z80ContentionTests.mm +++ b/OSBindings/Mac/Clock SignalTests/Z80ContentionTests.mm @@ -183,12 +183,54 @@ struct ContentionCheck { // MARK: - Opcode tests. -- (void)testNOP { - CapturingZ80 z80({0x00}); - z80.run_for(4); +- (void)testSimpleSingleBytes { + for(uint8_t opcode : { + 0x00, // NOP - [self validate48Contention:{{initial_pc, 4}} z80:z80]; - [self validatePlus3Contention:{{initial_pc, 4}} z80:z80]; + // LD r, r'. + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x47, + 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4f, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x57, + 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5f, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6f, + + // ALO a, r + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x87, + 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8f, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x97, + 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9f, + 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa7, + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xaf, + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb7, + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbf, + + // INC/DEC r + 0x04, 0x05, 0x0c, 0x0d, + 0x14, 0x15, 0x1c, 0x1d, + 0x24, 0x25, 0x2c, 0x2d, + + 0xd9, // EXX + 0x08, // EX AF, AF' + 0xeb, // EX DE, HL + 0x27, // DAA + 0x2f, // CPL + 0x3f, // CCF + 0x37, // SCF + 0xf3, // DI + 0xfb, // EI + 0x17, // RLA + 0x1f, // RRA + 0x07, // RLCA + 0x0f, // RRCA + 0xe9, // JP (HL) + }) { + CapturingZ80 z80({opcode}); + z80.run_for(4); + + [self validate48Contention:{{initial_pc, 4}} z80:z80]; + [self validatePlus3Contention:{{initial_pc, 4}} z80:z80]; + } } @end