From b3ab9fff9be9b512a9d2de3d62285df8223874d0 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 19 Oct 2020 19:27:16 -0400 Subject: [PATCH] Imports a custom-built copy of Klaus Dormann's 65C02 test, with only 65816-compatible parts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thereby fixes another couple of 65816 issues — BRK(, etc) not clearing the decimal flag, and `TRB d` being mismapped. --- .../Clock Signal.xcodeproj/project.pbxproj | 4 +++ .../Klaus Dormann/65C02_no_Rockwell_test.bin | Bin 0 -> 65536 bytes .../Clock SignalTests/KlausDormannTests.swift | 23 ++++++++++++++++++ .../Implementation/65816Implementation.hpp | 1 + .../65816/Implementation/65816Storage.cpp | 2 +- 5 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 OSBindings/Mac/Clock SignalTests/Klaus Dormann/65C02_no_Rockwell_test.bin diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 34ce90551..020da0edc 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -846,6 +846,7 @@ 4BDDBA991EF3451200347E61 /* Z80MachineCycleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BDDBA981EF3451200347E61 /* Z80MachineCycleTests.swift */; }; 4BE0A3EE237BB170002AB46F /* ST.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE0A3EC237BB170002AB46F /* ST.cpp */; }; 4BE0A3EF237BB170002AB46F /* ST.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE0A3EC237BB170002AB46F /* ST.cpp */; }; + 4BE211DE253E4E4800435408 /* 65C02_no_Rockwell_test.bin in Resources */ = {isa = PBXBuildFile; fileRef = 4BE211DD253E4E4800435408 /* 65C02_no_Rockwell_test.bin */; }; 4BE34438238389E10058E78F /* AtariSTVideoTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BE34437238389E10058E78F /* AtariSTVideoTests.mm */; }; 4BE76CF922641ED400ACD6FA /* QLTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BE76CF822641ED300ACD6FA /* QLTests.mm */; }; 4BE90FFD22D5864800FB464D /* MacintoshVideoTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BE90FFC22D5864800FB464D /* MacintoshVideoTests.mm */; }; @@ -1768,6 +1769,7 @@ 4BDDBA981EF3451200347E61 /* Z80MachineCycleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Z80MachineCycleTests.swift; sourceTree = ""; }; 4BE0A3EC237BB170002AB46F /* ST.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ST.cpp; sourceTree = ""; }; 4BE0A3ED237BB170002AB46F /* ST.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ST.hpp; sourceTree = ""; }; + 4BE211DD253E4E4800435408 /* 65C02_no_Rockwell_test.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = 65C02_no_Rockwell_test.bin; path = "Klaus Dormann/65C02_no_Rockwell_test.bin"; sourceTree = ""; }; 4BE3231220532443006EF799 /* Target.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Target.hpp; sourceTree = ""; }; 4BE32313205327D7006EF799 /* Target.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Target.hpp; sourceTree = ""; }; 4BE32314205328FF006EF799 /* Target.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Target.hpp; sourceTree = ""; }; @@ -1994,6 +1996,7 @@ 4B44EBF81DC9898E00A7820C /* BCDTEST_beeb */, 4B98A1CD1FFADEC400ADF63B /* MSX ROMs */, 4B018B88211930DE002A3937 /* 65C02_extended_opcodes_test.bin */, + 4BE211DD253E4E4800435408 /* 65C02_no_Rockwell_test.bin */, 4B44EBF61DC9883B00A7820C /* 6502_functional_test.bin */, 4B44EBF41DC987AE00A7820C /* AllSuiteA.bin */, 4B9F11CB22729B3500701480 /* OPCLOGR2.BIN */, @@ -4230,6 +4233,7 @@ 4BB299961B587D8400A49093 /* nmi in Resources */, 4BB299241B587D8400A49093 /* cia1ta in Resources */, 4BB2990E1B587D8400A49093 /* asoix in Resources */, + 4BE211DE253E4E4800435408 /* 65C02_no_Rockwell_test.bin in Resources */, 4BB299F51B587D8400A49093 /* trap9 in Resources */, 4BB299C81B587D8400A49093 /* sbcb(eb) in Resources */, 4BB299CF1B587D8400A49093 /* sedn in Resources */, diff --git a/OSBindings/Mac/Clock SignalTests/Klaus Dormann/65C02_no_Rockwell_test.bin b/OSBindings/Mac/Clock SignalTests/Klaus Dormann/65C02_no_Rockwell_test.bin new file mode 100644 index 0000000000000000000000000000000000000000..c60b95b8a3a844287ee1a9b208f69a9e3766c404 GIT binary patch literal 65536 zcmeI0U2Ggz6~||;ckQ*kvpegxX@roP2S5|Vg9#BT0ZQV0;BA%^C4@%dfkZOZf{N54 zcp$Blal#fSs#SzkDMkqzt+bWKs!^y4QY%?(VGYd*Z+IY|DN-^_l|e0Y3p9gr*>*5wFjTF)4@qQNI(C)DKcV2WW}i1 zq{l_S7!V0z=wB0)A}1aZ`$S%RUF;XT#BQ-i>=hi*uMg+}UiSfk-s*o(JNk}xR4%@4 zYvS41DeY(R)B3TUo3*zuIrfZh3;Nb{O&2rvj7?jE-rKg&)UBeu_n_9~wwukgM%zc& zntdNo_~@2+wG{l))#ij)6r!eizN^!Fcb?SJq3flE>+kxy=f758^ZetL1-=~e{5Jxr z1)lGek2pt;ywQ!hS3lzU_v&TOf43V`oA-P+ryN(1xwGH~lO^4{o~V;ln5>bH@A$U8{-huGK`Iu}-^#yY8c|W8C$ObAtMIHOubHf4@J$JFK^s zZou*k$*pFk!;I%wPPANNJys$A75kM6EzyeoB5N!5Ij)|}-F~jVZ|Qj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ZrF^atC)exuqPnvkwon zpCB&!Px|A2)34>|gX4bMkn|aI^6aF1>@M)*vQ@Z|TX-T6H*e-IW@$awvTNDbvu6kR zXVl{`dC-$hW$$_qGU2C-)SRf%Nvt0rr%BH*4m~^k z+LF-u38GNj#^;4@PK$xg4<3uYUZc<4ROgGsH_Ah~1#3tCG4`s{eXH^tC7TXfp>|uz zrpF7;rhAneQ?g&+?B2ho{!iaYfIG(iC)G)>=f*y||A<28AOHd&00JNY0w4eaAOHd& z00JNY0w4eaAOHd&00JNY0w4eaAOHd&00JNY0w4eaAOHd&00JNY0w4eaAOHd&00JNY z0w4eaAOHd&00JNY0w4eaAOHd&00JNY0w4eaAOHd&00JNY0w4eaAOHd&00JNY0w4ea zAOHd&00JNY0w4eaAOHd&00JNY0w4eaAOHd&00JNY0w4eaAOHd&00JNY0w4eaAOHd& z00JNY0w4eaAOHd&00JNY0w4eaAOHd&00JNY0w4eaAOHd&00JNY0w4eaAOHd&00JNY z0w4eaAOHd&00JNY0w4eaAOHd&00JNY0w4eaAOHd&00JNY0w4eaAOHd&00JNY0w4ea zAOHd&00JNY0w4eaAOHd&00JNY0w4eaAOHd&00JNY0w4eaAOHd&00JNY0w4eaAOHd& e00JNY0w4eaAOHd&00JNY0`~!d_~`IxcJx2s?=?jL literal 0 HcmV?d00001 diff --git a/OSBindings/Mac/Clock SignalTests/KlausDormannTests.swift b/OSBindings/Mac/Clock SignalTests/KlausDormannTests.swift index 68c4c1642..0467e280f 100644 --- a/OSBindings/Mac/Clock SignalTests/KlausDormannTests.swift +++ b/OSBindings/Mac/Clock SignalTests/KlausDormannTests.swift @@ -118,6 +118,24 @@ class KlausDormannTests: XCTestCase { XCTAssert(error == nil, "Failed with error \(error!)") } + private func runTest65C02NoRockwell(processor: CSTestMachine6502Processor) { + func errorForTrapAddress(_ address: UInt16) -> String? { + switch address { + case 0x11e0: return nil // success! + + case 0x1474: return "BRK didn't clear the decimal flag" + case 0x0e3d: return "TRB set flags incorrectly" + + case 0: return "Didn't find tests" + default: return "Unknown error at \(String(format:"%04x", address))" + } + } + + let destination = runTest(resource: "65C02_no_Rockwell_test", processor: processor) + let error = errorForTrapAddress(destination) + XCTAssert(error == nil, "Failed with error \(error!)") + } + /// Runs Klaus Dormann's 6502 tests. func test6502() { @@ -134,6 +152,11 @@ class KlausDormannTests: XCTestCase { runTest6502(processor: .processor65816) } + /// Runs Klaus Dormann's standard 6502 tests on a 65816. + func test65816AsNonRockwell65C02() { + runTest65C02NoRockwell(processor: .processor65816) + } + /// Runs Klaus Dormann's 65C02 tests. func test65C02() { runTest65C02(processor: .processor65C02) diff --git a/Processors/65816/Implementation/65816Implementation.hpp b/Processors/65816/Implementation/65816Implementation.hpp index 39180736c..c8750a6e0 100644 --- a/Processors/65816/Implementation/65816Implementation.hpp +++ b/Processors/65816/Implementation/65816Implementation.hpp @@ -444,6 +444,7 @@ template void Processor