Skip to content

Commit

Permalink
Merge pull request #843 from TomHarte/MoreDormann
Browse files Browse the repository at this point in the history
Introduces a build of Dormann's 65C02 tests that is 65816 compatible.
  • Loading branch information
TomHarte authored Oct 20, 2020
2 parents 14718b9 + ab07814 commit 3aa47f9
Show file tree
Hide file tree
Showing 7 changed files with 5,572 additions and 5 deletions.
4 changes: 4 additions & 0 deletions OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -1768,6 +1769,7 @@
4BDDBA981EF3451200347E61 /* Z80MachineCycleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Z80MachineCycleTests.swift; sourceTree = "<group>"; };
4BE0A3EC237BB170002AB46F /* ST.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ST.cpp; sourceTree = "<group>"; };
4BE0A3ED237BB170002AB46F /* ST.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ST.hpp; sourceTree = "<group>"; };
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 = "<group>"; };
4BE3231220532443006EF799 /* Target.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Target.hpp; sourceTree = "<group>"; };
4BE32313205327D7006EF799 /* Target.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Target.hpp; sourceTree = "<group>"; };
4BE32314205328FF006EF799 /* Target.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Target.hpp; sourceTree = "<group>"; };
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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 */,
Expand Down
Binary file not shown.
5,538 changes: 5,538 additions & 0 deletions OSBindings/Mac/Clock SignalTests/Klaus Dormann/65C02_no_Rockwell_test.lst

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions OSBindings/Mac/Clock SignalTests/KlausDormannTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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)
Expand Down
9 changes: 5 additions & 4 deletions OSBindings/Mac/Clock SignalTests/WolfgangLorenzTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,14 @@ class WolfgangLorenzTests: XCTestCase, CSTestMachineTrapHandler {
func testBIT65816() {
runTest("bit", suffixes: ["z", "a"], processor: .processor65816)
}
func testFlow65816() {
testFlow(processor: .processor65816)
}
/*
The flow tests don't apply; the 65816 [and 65C02] reset the decimal flag upon a BRK, but the 6502 that Lorenz
tests doesn't do so.
*/
func testBranch65816() {
testBranch(processor: .processor65816)
}
/* The NOP tests also don't apply; the 65816 has only one, well-defined NOP (well, not counting COP or WDM). */
/* The NOP tests also don't apply; the 65816 has only one, well-defined NOP. */


// MARK: - Collections
Expand Down
1 change: 1 addition & 0 deletions Processors/65816/Implementation/65816Implementation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ template <typename BusHandler, bool uses_ready_line> void Processor<BusHandler,
}

registers_.flags.inverse_interrupt = 0;
registers_.flags.decimal = 0;
} continue;

//
Expand Down
2 changes: 1 addition & 1 deletion Processors/65816/Implementation/65816Storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ ProcessorStorage::ProcessorStorage() {
/* 0x11 ORA (d), y */ op(direct_indirect_indexed, ORA);
/* 0x12 ORA (d) */ op(direct_indirect, ORA);
/* 0x13 ORA (d, s), y */ op(stack_relative_indexed_indirect, ORA);
/* 0x14 TRB d */ op(absolute_rmw, TRB);
/* 0x14 TRB d */ op(direct_rmw, TRB);
/* 0x15 ORA d, x */ op(direct_x, ORA);
/* 0x16 ASL d, x */ op(direct_x_rmw, ASL);
/* 0x17 ORA [d], y */ op(direct_indirect_indexed_long, ORA);
Expand Down

0 comments on commit 3aa47f9

Please sign in to comment.