mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 23:52:26 +00:00
Adds additional 65816 tests, some failing; seeks to improve carry behaviour in ASL and ROL.
This commit is contained in:
parent
a02f88fe7c
commit
536c4d45c1
@ -10,226 +10,264 @@ import XCTest
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
class WolfgangLorenzTests: XCTestCase, CSTestMachineTrapHandler {
|
class WolfgangLorenzTests: XCTestCase, CSTestMachineTrapHandler {
|
||||||
func testWolfgangLorenzTransfers(processor: CSTestMachine6502Processor) {
|
|
||||||
self.runWolfgangLorenzTest("taxn", processor: processor)
|
|
||||||
self.runWolfgangLorenzTest("tayn", processor: processor)
|
|
||||||
self.runWolfgangLorenzTest("txan", processor: processor)
|
|
||||||
self.runWolfgangLorenzTest("tyan", processor: processor)
|
|
||||||
self.runWolfgangLorenzTest("tsxn", processor: processor)
|
|
||||||
self.runWolfgangLorenzTest("txsn", processor: processor)
|
|
||||||
}
|
|
||||||
func testStack(processor: CSTestMachine6502Processor) {
|
|
||||||
self.runWolfgangLorenzTest("phan", processor: processor)
|
|
||||||
self.runWolfgangLorenzTest("plan", processor: processor)
|
|
||||||
self.runWolfgangLorenzTest("phpn", processor: processor)
|
|
||||||
self.runWolfgangLorenzTest("plpn", processor: processor)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// MARK: - 6502 Tests
|
||||||
|
|
||||||
func testWolfgangLorenzStart65816() {
|
func testStart() {
|
||||||
runWolfgangLorenzTest(" start", processor: .processor65816)
|
runTest(" start", processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzLDA65816() {
|
func testLDA() {
|
||||||
runWolfgangLorenzTest("lda", suffixes: ["b", "z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor65816)
|
runTest("lda", suffixes: ["b", "z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzSTA65816() {
|
func testSTA() {
|
||||||
runWolfgangLorenzTest("sta", suffixes: ["z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor65816)
|
runTest("sta", suffixes: ["z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzLDX65816() {
|
func testLDX() {
|
||||||
runWolfgangLorenzTest("ldx", suffixes: ["b", "z", "zy", "a", "ay"], processor: .processor65816)
|
runTest("ldx", suffixes: ["b", "z", "zy", "a", "ay"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzSTX65816() {
|
func testSTX() {
|
||||||
runWolfgangLorenzTest("stx", suffixes: ["z", "zy", "a"], processor: .processor65816)
|
runTest("stx", suffixes: ["z", "zy", "a"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzLDY65816() {
|
func testLDY() {
|
||||||
runWolfgangLorenzTest("ldy", suffixes: ["b", "z", "zx", "a", "ax"], processor: .processor65816)
|
runTest("ldy", suffixes: ["b", "z", "zx", "a", "ax"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzSTY65816() {
|
func testSTY() {
|
||||||
runWolfgangLorenzTest("sty", suffixes: ["z", "zx", "a"], processor: .processor65816)
|
runTest("sty", suffixes: ["z", "zx", "a"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzTransfers65816() {
|
func testTransfers() {
|
||||||
testWolfgangLorenzTransfers(processor: .processor65816)
|
testTransfers(processor: .processor6502)
|
||||||
}
|
|
||||||
func testStack65816() {
|
|
||||||
testStack(processor: .processor65816)
|
|
||||||
}
|
|
||||||
|
|
||||||
func testWolfgangLorenzStart() {
|
|
||||||
runWolfgangLorenzTest(" start", processor: .processor6502)
|
|
||||||
}
|
|
||||||
func testWolfgangLorenzLDA() {
|
|
||||||
runWolfgangLorenzTest("lda", suffixes: ["b", "z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
|
||||||
}
|
|
||||||
func testWolfgangLorenzSTA() {
|
|
||||||
runWolfgangLorenzTest("sta", suffixes: ["z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
|
||||||
}
|
|
||||||
func testWolfgangLorenzLDX() {
|
|
||||||
runWolfgangLorenzTest("ldx", suffixes: ["b", "z", "zy", "a", "ay"], processor: .processor6502)
|
|
||||||
}
|
|
||||||
func testWolfgangLorenzSTX() {
|
|
||||||
runWolfgangLorenzTest("stx", suffixes: ["z", "zy", "a"], processor: .processor6502)
|
|
||||||
}
|
|
||||||
func testWolfgangLorenzLDY() {
|
|
||||||
runWolfgangLorenzTest("ldy", suffixes: ["b", "z", "zx", "a", "ax"], processor: .processor6502)
|
|
||||||
}
|
|
||||||
func testWolfgangLorenzSTY() {
|
|
||||||
runWolfgangLorenzTest("sty", suffixes: ["z", "zx", "a"], processor: .processor6502)
|
|
||||||
}
|
|
||||||
func testWolfgangLorenzTransfers() {
|
|
||||||
testWolfgangLorenzTransfers(processor: .processor6502)
|
|
||||||
}
|
}
|
||||||
func testStack() {
|
func testStack() {
|
||||||
testStack(processor: .processor6502)
|
testStack(processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzIncsAndDecs() {
|
func testIncsAndDecs() {
|
||||||
self.runWolfgangLorenzTest("inxn", processor: .processor6502)
|
testIncsAndDecs(processor: .processor6502)
|
||||||
self.runWolfgangLorenzTest("inyn", processor: .processor6502)
|
|
||||||
self.runWolfgangLorenzTest("dexn", processor: .processor6502)
|
|
||||||
self.runWolfgangLorenzTest("deyn", processor: .processor6502)
|
|
||||||
self.runWolfgangLorenzTest("incz", processor: .processor6502)
|
|
||||||
self.runWolfgangLorenzTest("inczx", processor: .processor6502)
|
|
||||||
self.runWolfgangLorenzTest("inca", processor: .processor6502)
|
|
||||||
self.runWolfgangLorenzTest("incax", processor: .processor6502)
|
|
||||||
self.runWolfgangLorenzTest("decz", processor: .processor6502)
|
|
||||||
self.runWolfgangLorenzTest("deczx", processor: .processor6502)
|
|
||||||
self.runWolfgangLorenzTest("deca", processor: .processor6502)
|
|
||||||
self.runWolfgangLorenzTest("decax", processor: .processor6502)
|
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzASL() {
|
func testASL() {
|
||||||
self.runWolfgangLorenzTest("asl", suffixes: ["n", "z", "zx", "a", "ax"], processor: .processor6502)
|
self.runTest("asl", suffixes: ["n", "z", "zx", "a", "ax"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzLSR() {
|
func testLSR() {
|
||||||
self.runWolfgangLorenzTest("lsr", suffixes: ["n", "z", "zx", "a", "ax"], processor: .processor6502)
|
self.runTest("lsr", suffixes: ["n", "z", "zx", "a", "ax"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzROL() {
|
func testROL() {
|
||||||
self.runWolfgangLorenzTest("rol", suffixes: ["n", "z", "zx", "a", "ax"], processor: .processor6502)
|
self.runTest("rol", suffixes: ["n", "z", "zx", "a", "ax"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzROR() {
|
func testROR() {
|
||||||
self.runWolfgangLorenzTest("ror", suffixes: ["n", "z", "zx", "a", "ax"], processor: .processor6502)
|
self.runTest("ror", suffixes: ["n", "z", "zx", "a", "ax"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzAND() {
|
func testAND() {
|
||||||
self.runWolfgangLorenzTest("and", suffixes: ["b", "z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
self.runTest("and", suffixes: ["b", "z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzORA() {
|
func testORA() {
|
||||||
self.runWolfgangLorenzTest("ora", suffixes: ["b", "z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
self.runTest("ora", suffixes: ["b", "z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzEOR() {
|
func testEOR() {
|
||||||
self.runWolfgangLorenzTest("eor", suffixes: ["b", "z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
self.runTest("eor", suffixes: ["b", "z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzFlagManipulation() {
|
func testFlagManipulation() {
|
||||||
self.runWolfgangLorenzTest("clcn", processor: .processor6502)
|
self.runTest("clcn", processor: .processor6502)
|
||||||
self.runWolfgangLorenzTest("secn", processor: .processor6502)
|
self.runTest("secn", processor: .processor6502)
|
||||||
self.runWolfgangLorenzTest("cldn", processor: .processor6502)
|
self.runTest("cldn", processor: .processor6502)
|
||||||
self.runWolfgangLorenzTest("sedn", processor: .processor6502)
|
self.runTest("sedn", processor: .processor6502)
|
||||||
self.runWolfgangLorenzTest("clin", processor: .processor6502)
|
self.runTest("clin", processor: .processor6502)
|
||||||
self.runWolfgangLorenzTest("sein", processor: .processor6502)
|
self.runTest("sein", processor: .processor6502)
|
||||||
self.runWolfgangLorenzTest("clvn", processor: .processor6502)
|
self.runTest("clvn", processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzADC() {
|
func testADC() {
|
||||||
self.runWolfgangLorenzTest("adc", suffixes: ["b", "z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
self.runTest("adc", suffixes: ["b", "z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzSBC() {
|
func testSBC() {
|
||||||
self.runWolfgangLorenzTest("sbc", suffixes: ["b", "z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
self.runTest("sbc", suffixes: ["b", "z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzCompare() {
|
func testCompare() {
|
||||||
self.runWolfgangLorenzTest("cmp", suffixes: ["b", "z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
self.runTest("cmp", suffixes: ["b", "z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
||||||
self.runWolfgangLorenzTest("cpx", suffixes: ["b", "z", "a"], processor: .processor6502)
|
self.runTest("cpx", suffixes: ["b", "z", "a"], processor: .processor6502)
|
||||||
self.runWolfgangLorenzTest("cpy", suffixes: ["b", "z", "a"], processor: .processor6502)
|
self.runTest("cpy", suffixes: ["b", "z", "a"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzBIT() {
|
func testBIT() {
|
||||||
self.runWolfgangLorenzTest("bit", suffixes: ["z", "a"], processor: .processor6502)
|
self.runTest("bit", suffixes: ["z", "a"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzFlow() {
|
func testFlow() {
|
||||||
self.runWolfgangLorenzTest("brkn", processor: .processor6502)
|
self.runTest("brkn", processor: .processor6502)
|
||||||
self.runWolfgangLorenzTest("rtin", processor: .processor6502)
|
self.runTest("rtin", processor: .processor6502)
|
||||||
self.runWolfgangLorenzTest("jsrw", processor: .processor6502)
|
self.runTest("jsrw", processor: .processor6502)
|
||||||
self.runWolfgangLorenzTest("rtsn", processor: .processor6502)
|
self.runTest("rtsn", processor: .processor6502)
|
||||||
self.runWolfgangLorenzTest("jmpw", processor: .processor6502)
|
self.runTest("jmpw", processor: .processor6502)
|
||||||
self.runWolfgangLorenzTest("jmpi", processor: .processor6502)
|
self.runTest("jmpi", processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzBranch() {
|
func testBranch() {
|
||||||
self.runWolfgangLorenzTest("beqr", processor: .processor6502)
|
self.runTest("beqr", processor: .processor6502)
|
||||||
self.runWolfgangLorenzTest("bner", processor: .processor6502)
|
self.runTest("bner", processor: .processor6502)
|
||||||
self.runWolfgangLorenzTest("bmir", processor: .processor6502)
|
self.runTest("bmir", processor: .processor6502)
|
||||||
self.runWolfgangLorenzTest("bplr", processor: .processor6502)
|
self.runTest("bplr", processor: .processor6502)
|
||||||
self.runWolfgangLorenzTest("bcsr", processor: .processor6502)
|
self.runTest("bcsr", processor: .processor6502)
|
||||||
self.runWolfgangLorenzTest("bccr", processor: .processor6502)
|
self.runTest("bccr", processor: .processor6502)
|
||||||
self.runWolfgangLorenzTest("bvsr", processor: .processor6502)
|
self.runTest("bvsr", processor: .processor6502)
|
||||||
self.runWolfgangLorenzTest("bvcr", processor: .processor6502)
|
self.runTest("bvcr", processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzNOP() {
|
func testNOP() {
|
||||||
self.runWolfgangLorenzTest("nop", suffixes: ["n", "b", "z", "zx", "a", "ax"], processor: .processor6502)
|
self.runTest("nop", suffixes: ["n", "b", "z", "zx", "a", "ax"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzASO() {
|
func testASO() {
|
||||||
self.runWolfgangLorenzTest("aso", suffixes: ["z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
self.runTest("aso", suffixes: ["z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzRLA() {
|
func testRLA() {
|
||||||
self.runWolfgangLorenzTest("rla", suffixes: ["z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
self.runTest("rla", suffixes: ["z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzLSE() {
|
func testLSE() {
|
||||||
self.runWolfgangLorenzTest("lse", suffixes: ["z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
self.runTest("lse", suffixes: ["z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzRRA() {
|
func testRRA() {
|
||||||
self.runWolfgangLorenzTest("rra", suffixes: ["z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
self.runTest("rra", suffixes: ["z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzDCM() {
|
func testDCM() {
|
||||||
self.runWolfgangLorenzTest("dcm", suffixes: ["z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
self.runTest("dcm", suffixes: ["z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzINS() {
|
func testINS() {
|
||||||
self.runWolfgangLorenzTest("ins", suffixes: ["z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
self.runTest("ins", suffixes: ["z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzLAX() {
|
func testLAX() {
|
||||||
self.runWolfgangLorenzTest("lax", suffixes: ["z", "zy", "a", "ay", "ix", "iy"], processor: .processor6502)
|
self.runTest("lax", suffixes: ["z", "zy", "a", "ay", "ix", "iy"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzAXS() {
|
func testAXS() {
|
||||||
self.runWolfgangLorenzTest("axs", suffixes: ["z", "zy", "a", "ix"], processor: .processor6502)
|
self.runTest("axs", suffixes: ["z", "zy", "a", "ix"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzALR() {
|
func testALR() {
|
||||||
self.runWolfgangLorenzTest("alrb", processor: .processor6502)
|
self.runTest("alrb", processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzARR() {
|
func testARR() {
|
||||||
self.runWolfgangLorenzTest("arrb", processor: .processor6502)
|
self.runTest("arrb", processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzSBX() {
|
func testSBX() {
|
||||||
self.runWolfgangLorenzTest("sbxb", processor: .processor6502)
|
self.runTest("sbxb", processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzSHA() {
|
func testSHA() {
|
||||||
self.runWolfgangLorenzTest("sha", suffixes: ["ay", "iy"], processor: .processor6502)
|
self.runTest("sha", suffixes: ["ay", "iy"], processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzSHX() {
|
func testSHX() {
|
||||||
self.runWolfgangLorenzTest("shxay", processor: .processor6502)
|
self.runTest("shxay", processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzSHY() {
|
func testSHY() {
|
||||||
self.runWolfgangLorenzTest("shyax", processor: .processor6502)
|
self.runTest("shyax", processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzSHS() {
|
func testSHS() {
|
||||||
self.runWolfgangLorenzTest("shsay", processor: .processor6502)
|
self.runTest("shsay", processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzLXA() {
|
func testLXA() {
|
||||||
self.runWolfgangLorenzTest("lxab", processor: .processor6502)
|
self.runTest("lxab", processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzANE() {
|
func testANE() {
|
||||||
self.runWolfgangLorenzTest("aneb", processor: .processor6502)
|
self.runTest("aneb", processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzANC() {
|
func testANC() {
|
||||||
self.runWolfgangLorenzTest("ancb", processor: .processor6502)
|
self.runTest("ancb", processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzLAS() {
|
func testLAS() {
|
||||||
self.runWolfgangLorenzTest("lasay", processor: .processor6502)
|
self.runTest("lasay", processor: .processor6502)
|
||||||
}
|
}
|
||||||
func testWolfgangLorenzSBCB() {
|
func testSBCB() {
|
||||||
self.runWolfgangLorenzTest("sbcb(eb)", processor: .processor6502)
|
self.runTest("sbcb(eb)", processor: .processor6502)
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func runWolfgangLorenzTest(_ name: String, suffixes: [String], processor: CSTestMachine6502Processor) {
|
|
||||||
|
// MARK: - 65816 Tests
|
||||||
|
|
||||||
|
func testStart65816() {
|
||||||
|
runTest(" start", processor: .processor65816)
|
||||||
|
}
|
||||||
|
func testLDA65816() {
|
||||||
|
runTest("lda", suffixes: ["b", "z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor65816)
|
||||||
|
}
|
||||||
|
func testSTA65816() {
|
||||||
|
runTest("sta", suffixes: ["z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor65816)
|
||||||
|
}
|
||||||
|
func testLDX65816() {
|
||||||
|
runTest("ldx", suffixes: ["b", "z", "zy", "a", "ay"], processor: .processor65816)
|
||||||
|
}
|
||||||
|
func testSTX65816() {
|
||||||
|
runTest("stx", suffixes: ["z", "zy", "a"], processor: .processor65816)
|
||||||
|
}
|
||||||
|
func testLDY65816() {
|
||||||
|
runTest("ldy", suffixes: ["b", "z", "zx", "a", "ax"], processor: .processor65816)
|
||||||
|
}
|
||||||
|
func testSTY65816() {
|
||||||
|
runTest("sty", suffixes: ["z", "zx", "a"], processor: .processor65816)
|
||||||
|
}
|
||||||
|
func testTransfers65816() {
|
||||||
|
testTransfers(processor: .processor65816)
|
||||||
|
}
|
||||||
|
func testStack65816() {
|
||||||
|
testStack(processor: .processor65816)
|
||||||
|
}
|
||||||
|
func testIncsAndDecs65816() {
|
||||||
|
testIncsAndDecs(processor: .processor65816)
|
||||||
|
}
|
||||||
|
func testASL65816() {
|
||||||
|
self.runTest("asl", suffixes: ["n", "z", "zx", "a", "ax"], processor: .processor65816)
|
||||||
|
}
|
||||||
|
func testLSR65816() {
|
||||||
|
self.runTest("lsr", suffixes: ["n", "z", "zx", "a", "ax"], processor: .processor65816)
|
||||||
|
}
|
||||||
|
func testROL65816() {
|
||||||
|
self.runTest("rol", suffixes: ["n", "z", "zx", "a", "ax"], processor: .processor65816)
|
||||||
|
}
|
||||||
|
func testROR65816() {
|
||||||
|
self.runTest("ror", suffixes: ["n", "z", "zx", "a", "ax"], processor: .processor65816)
|
||||||
|
}
|
||||||
|
func testAND65816() {
|
||||||
|
self.runTest("and", suffixes: ["b", "z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor65816)
|
||||||
|
}
|
||||||
|
func testORA65816() {
|
||||||
|
self.runTest("ora", suffixes: ["b", "z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor65816)
|
||||||
|
}
|
||||||
|
func testEOR65816() {
|
||||||
|
self.runTest("eor", suffixes: ["b", "z", "zx", "a", "ax", "ay", "ix", "iy"], processor: .processor65816)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// MARK: - Collections
|
||||||
|
|
||||||
|
func testTransfers(processor: CSTestMachine6502Processor) {
|
||||||
|
self.runTest("taxn", processor: processor)
|
||||||
|
self.runTest("tayn", processor: processor)
|
||||||
|
self.runTest("txan", processor: processor)
|
||||||
|
self.runTest("tyan", processor: processor)
|
||||||
|
self.runTest("tsxn", processor: processor)
|
||||||
|
self.runTest("txsn", processor: processor)
|
||||||
|
}
|
||||||
|
func testStack(processor: CSTestMachine6502Processor) {
|
||||||
|
self.runTest("phan", processor: processor)
|
||||||
|
self.runTest("plan", processor: processor)
|
||||||
|
self.runTest("phpn", processor: processor)
|
||||||
|
self.runTest("plpn", processor: processor)
|
||||||
|
}
|
||||||
|
func testIncsAndDecs(processor: CSTestMachine6502Processor) {
|
||||||
|
self.runTest("inxn", processor: processor)
|
||||||
|
self.runTest("inyn", processor: processor)
|
||||||
|
self.runTest("dexn", processor: processor)
|
||||||
|
self.runTest("deyn", processor: processor)
|
||||||
|
self.runTest("incz", processor: processor)
|
||||||
|
self.runTest("inczx", processor: processor)
|
||||||
|
self.runTest("inca", processor: processor)
|
||||||
|
self.runTest("incax", processor: processor)
|
||||||
|
self.runTest("decz", processor: processor)
|
||||||
|
self.runTest("deczx", processor: processor)
|
||||||
|
self.runTest("deca", processor: processor)
|
||||||
|
self.runTest("decax", processor: processor)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// MARK: - Test Running
|
||||||
|
|
||||||
|
fileprivate func runTest(_ name: String, suffixes: [String], processor: CSTestMachine6502Processor) {
|
||||||
for suffix in suffixes {
|
for suffix in suffixes {
|
||||||
let testName = name + suffix
|
let testName = name + suffix
|
||||||
self.runWolfgangLorenzTest(testName, processor: processor)
|
self.runTest(testName, processor: processor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate var output: String = ""
|
fileprivate var output: String = ""
|
||||||
fileprivate func runWolfgangLorenzTest(_ name: String, processor: CSTestMachine6502Processor) {
|
fileprivate func runTest(_ name: String, processor: CSTestMachine6502Processor) {
|
||||||
var machine: CSTestMachine6502!
|
var machine: CSTestMachine6502!
|
||||||
|
|
||||||
if let filename = Bundle(for: type(of: self)).path(forResource: name, ofType: nil) {
|
if let filename = Bundle(for: type(of: self)).path(forResource: name, ofType: nil) {
|
||||||
|
@ -674,7 +674,7 @@ template <typename BusHandler> void Processor<BusHandler>::run_for(const Cycles
|
|||||||
//
|
//
|
||||||
|
|
||||||
case ASL:
|
case ASL:
|
||||||
flags_.carry = data_buffer_.value >> (7 + m_shift_);
|
flags_.carry = (data_buffer_.value >> (7 + m_shift_)) & 1;
|
||||||
data_buffer_.value <<= 1;
|
data_buffer_.value <<= 1;
|
||||||
flags_.set_nz(data_buffer_.value, m_shift_);
|
flags_.set_nz(data_buffer_.value, m_shift_);
|
||||||
break;
|
break;
|
||||||
@ -687,7 +687,7 @@ template <typename BusHandler> void Processor<BusHandler>::run_for(const Cycles
|
|||||||
|
|
||||||
case ROL:
|
case ROL:
|
||||||
data_buffer_.value = (data_buffer_.value << 1) | flags_.carry;
|
data_buffer_.value = (data_buffer_.value << 1) | flags_.carry;
|
||||||
flags_.carry = data_buffer_.value >> (7 + m_shift_);
|
flags_.carry = (data_buffer_.value >> (7 + m_shift_)) & 1;
|
||||||
flags_.set_nz(data_buffer_.value, m_shift_);
|
flags_.set_nz(data_buffer_.value, m_shift_);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user