diff --git a/src/test/kotlin/FunctionalTestsBase.kt b/src/test/kotlin/FunctionalTestsBase.kt index ff97e75..abb4a37 100644 --- a/src/test/kotlin/FunctionalTestsBase.kt +++ b/src/test/kotlin/FunctionalTestsBase.kt @@ -3,7 +3,10 @@ import razorvine.ksim65.Cpu6502 import razorvine.ksim65.components.Ram import kotlin.test.* - +/* +Wolfgang Lorenz's 6502 test suite +See http://www.softwolves.com/arkiv/cbm-hackers/7/7114.html + */ abstract class FunctionalTestsBase { val cpu: Cpu6502 = Cpu6502() @@ -44,7 +47,7 @@ abstract class FunctionalTestsBase { cpu.regSP = 0xfd cpu.regP.fromInt(0b00100100) try { - while (cpu.totalCycles < 50000000L) { + while (cpu.totalCycles < 40000000L) { bus.clock() } fail("test hangs: " + cpu.snapshot()) @@ -57,4 +60,13 @@ abstract class FunctionalTestsBase { } fail("test failed") } + + protected fun runTestExpectNotImplemented(testprogram: String) { + try { + runTest(testprogram) + fail("expected to crash with NotImplementedError") + } catch(nx: NotImplementedError) { + // okay! + } + } } diff --git a/src/test/kotlin/Test6502TestSuiteC64Specific.kt b/src/test/kotlin/Test6502TestSuiteC64Specific.kt new file mode 100644 index 0000000..911f62e --- /dev/null +++ b/src/test/kotlin/Test6502TestSuiteC64Specific.kt @@ -0,0 +1,131 @@ +import org.junit.jupiter.api.Disabled +import org.junit.jupiter.api.parallel.Execution +import org.junit.jupiter.api.parallel.ExecutionMode +import kotlin.test.* + +// TODO: run these tests by using the C64 machine emulation components + +@Execution(ExecutionMode.CONCURRENT) +@Disabled("test code is not using C64 specific components yet") +class Test6502TestSuiteC64Specific: FunctionalTestsBase() { + + @Test + fun testCia1pb6() { + runTest("cia1pb6") + } + + @Test + fun testCia1pb7() { + runTest("cia1pb7") + } + + @Test + fun testCia1ta() { + runTest("cia1ta") + } + + @Test + fun testCia1tab() { + runTest("cia1tab") + } + + @Test + fun testCia1tb() { + runTest("cia1tb") + } + + @Test + fun testCia1tb123() { + runTest("cia1tb123") + } + + @Test + fun testCia2pb6() { + runTest("cia2pb6") + } + + @Test + fun testCia2pb7() { + runTest("cia2pb7") + } + + @Test + fun testCia2ta() { + runTest("cia2ta") + } + + @Test + fun testCia2tb() { + runTest("cia2tb") + } + + @Test + fun testCia2tb123() { + runTest("cia2tb123") + } + + @Test + fun testCntdef() { + runTest("cntdef") + } + + @Test + fun testCnto2() { + runTest("cnto2") + } + + @Test + fun testCpuport() { + runTest("cpuport") + } + + @Test + fun testCputiming() { + runTest("cputiming") + } + + @Test + fun testFlipos() { + runTest("flipos") + } + + @Test + fun testIcr01() { + runTest("icr01") + } + + @Test + fun testImr() { + runTest("imr") + } + + @Test + fun testIrq() { + runTest("irq") + } + + @Test + fun testLoadth() { + runTest("loadth") + } + + @Test + fun testMmu() { + runTest("mmu") + } + + @Test + fun testMmufetch() { + runTest("mmufetch") + } + + @Test + fun testNmi() { + runTest("nmi") + } + + @Test + fun testOneshot() { + runTest("oneshot") + } +} diff --git a/src/test/kotlin/Test6502TestSuiteIllegalInstructions.kt b/src/test/kotlin/Test6502TestSuiteIllegalInstructions.kt new file mode 100644 index 0000000..d3fffd8 --- /dev/null +++ b/src/test/kotlin/Test6502TestSuiteIllegalInstructions.kt @@ -0,0 +1,329 @@ +import org.junit.jupiter.api.parallel.Execution +import org.junit.jupiter.api.parallel.ExecutionMode +import kotlin.test.* + +// TODO: implement the illegal instructions and replace these tests with the 'real' runTest + +@Execution(ExecutionMode.CONCURRENT) +class Test6502TestSuiteIllegalInstructions: FunctionalTestsBase() { + + @Test + fun testAlrb() { + runTestExpectNotImplemented("alrb") + } + + @Test + fun testAncb() { + runTestExpectNotImplemented("ancb") + } + + @Test + fun testAneb() { + runTestExpectNotImplemented("aneb") + } + + @Test + fun testArrb() { + runTestExpectNotImplemented("arrb") + } + + @Test + fun testAsoa() { + runTestExpectNotImplemented("asoa") + } + + @Test + fun testAsoax() { + runTestExpectNotImplemented("asoax") + } + + @Test + fun testAsoay() { + runTestExpectNotImplemented("asoay") + } + + @Test + fun testAsoix() { + runTestExpectNotImplemented("asoix") + } + + @Test + fun testAsoiy() { + runTestExpectNotImplemented("asoiy") + } + + @Test + fun testAsoz() { + runTestExpectNotImplemented("asoz") + } + + @Test + fun testAsozx() { + runTestExpectNotImplemented("asozx") + } + + @Test + fun testAxsa() { + runTestExpectNotImplemented("axsa") + } + + @Test + fun testAxsix() { + runTestExpectNotImplemented("axsix") + } + + @Test + fun testAxsz() { + runTestExpectNotImplemented("axsz") + } + + @Test + fun testAxszy() { + runTestExpectNotImplemented("axszy") + } + + @Test + fun testDcma() { + runTestExpectNotImplemented("dcma") + } + + @Test + fun testDcmax() { + runTestExpectNotImplemented("dcmax") + } + + @Test + fun testDcmay() { + runTestExpectNotImplemented("dcmay") + } + + @Test + fun testDcmix() { + runTestExpectNotImplemented("dcmix") + } + + @Test + fun testDcmiy() { + runTestExpectNotImplemented("dcmiy") + } + + @Test + fun testDcmz() { + runTestExpectNotImplemented("dcmz") + } + + @Test + fun testDcmzx() { + runTestExpectNotImplemented("dcmzx") + } + + @Test + fun testInsa() { + runTestExpectNotImplemented("insa") + } + + @Test + fun testInsax() { + runTestExpectNotImplemented("insax") + } + + @Test + fun testInsay() { + runTestExpectNotImplemented("insay") + } + + @Test + fun testInsix() { + runTestExpectNotImplemented("insix") + } + + @Test + fun testInsiy() { + runTestExpectNotImplemented("insiy") + } + + @Test + fun testInsz() { + runTestExpectNotImplemented("insz") + } + + @Test + fun testInszx() { + runTestExpectNotImplemented("inszx") + } + + @Test + fun testLasay() { + runTestExpectNotImplemented("lasay") + } + + @Test + fun testLaxa() { + runTestExpectNotImplemented("laxa") + } + + @Test + fun testLaxay() { + runTestExpectNotImplemented("laxay") + } + + @Test + fun testLaxix() { + runTestExpectNotImplemented("laxix") + } + + @Test + fun testLaxiy() { + runTestExpectNotImplemented("laxiy") + } + + @Test + fun testLaxz() { + runTestExpectNotImplemented("laxz") + } + + @Test + fun testLaxzy() { + runTestExpectNotImplemented("laxzy") + } + + @Test + fun testLsea() { + runTestExpectNotImplemented("lsea") + } + + @Test + fun testLseax() { + runTestExpectNotImplemented("lseax") + } + + @Test + fun testLseay() { + runTestExpectNotImplemented("lseay") + } + + @Test + fun testLseix() { + runTestExpectNotImplemented("lseix") + } + + @Test + fun testLseiy() { + runTestExpectNotImplemented("lseiy") + } + + @Test + fun testLsez() { + runTestExpectNotImplemented("lsez") + } + + @Test + fun testLsezx() { + runTestExpectNotImplemented("lsezx") + } + + @Test + fun testLxab() { + runTestExpectNotImplemented("lxab") + } + + @Test + fun testRlaa() { + runTestExpectNotImplemented("rlaa") + } + + @Test + fun testRlaax() { + runTestExpectNotImplemented("rlaax") + } + + @Test + fun testRlaay() { + runTestExpectNotImplemented("rlaay") + } + + @Test + fun testRlaix() { + runTestExpectNotImplemented("rlaix") + } + + @Test + fun testRlaiy() { + runTestExpectNotImplemented("rlaiy") + } + + @Test + fun testRlaz() { + runTestExpectNotImplemented("rlaz") + } + + @Test + fun testRlazx() { + runTestExpectNotImplemented("rlazx") + } + + @Test + fun testRraa() { + runTestExpectNotImplemented("rraa") + } + + @Test + fun testRraax() { + runTestExpectNotImplemented("rraax") + } + + @Test + fun testRraay() { + runTestExpectNotImplemented("rraay") + } + + @Test + fun testRraix() { + runTestExpectNotImplemented("rraix") + } + + @Test + fun testRraiy() { + runTestExpectNotImplemented("rraiy") + } + + @Test + fun testRraz() { + runTestExpectNotImplemented("rraz") + } + + @Test + fun testRrazx() { + runTestExpectNotImplemented("rrazx") + } + + @Test + fun testSbxb() { + runTestExpectNotImplemented("sbxb") + } + + @Test + fun testShaay() { + runTestExpectNotImplemented("shaay") + } + + @Test + fun testShaiy() { + runTestExpectNotImplemented("shaiy") + } + + @Test + fun testShsay() { + runTestExpectNotImplemented("shsay") + } + + @Test + fun testShxay() { + runTestExpectNotImplemented("shxay") + } + + @Test + fun testShyax() { + runTestExpectNotImplemented("shyax") + } +} diff --git a/src/test/kotlin/Test6502TestSuitePart1.kt b/src/test/kotlin/Test6502TestSuitePart1.kt index d54aaae..cf34cc7 100644 --- a/src/test/kotlin/Test6502TestSuitePart1.kt +++ b/src/test/kotlin/Test6502TestSuitePart1.kt @@ -52,18 +52,6 @@ class Test6502TestSuitePart1: FunctionalTestsBase() { runTest("adczx") } - @Test - @Disabled("not yet implemented- illegal instruction") - fun testAlrb() { - runTest("alrb") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testAncb() { - runTest("ancb") - } - @Test fun testAnda() { runTest("anda") @@ -104,18 +92,6 @@ class Test6502TestSuitePart1: FunctionalTestsBase() { runTest("andzx") } - @Test - @Disabled("not yet implemented- illegal instruction") - fun testAneb() { - runTest("aneb") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testArrb() { - runTest("arrb") - } - @Test fun testAsla() { runTest("asla") @@ -141,72 +117,6 @@ class Test6502TestSuitePart1: FunctionalTestsBase() { runTest("aslzx") } - @Test - @Disabled("not yet implemented- illegal instruction") - fun testAsoa() { - runTest("asoa") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testAsoax() { - runTest("asoax") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testAsoay() { - runTest("asoay") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testAsoix() { - runTest("asoix") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testAsoiy() { - runTest("asoiy") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testAsoz() { - runTest("asoz") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testAsozx() { - runTest("asozx") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testAxsa() { - runTest("axsa") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testAxsix() { - runTest("axsix") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testAxsz() { - runTest("axsz") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testAxszy() { - runTest("axszy") - } - @Test fun testBccr() { runTest("bccr") @@ -267,72 +177,6 @@ class Test6502TestSuitePart1: FunctionalTestsBase() { runTest("bvsr") } - @Test - @Disabled("c64 specific component") - fun testCia1pb6() { - runTest("cia1pb6") - } - - @Test - @Disabled("c64 specific component") - fun testCia1pb7() { - runTest("cia1pb7") - } - - @Test - @Disabled("c64 specific component") - fun testCia1ta() { - runTest("cia1ta") - } - - @Test - @Disabled("c64 specific component") - fun testCia1tab() { - runTest("cia1tab") - } - - @Test - @Disabled("c64 specific component") - fun testCia1tb() { - runTest("cia1tb") - } - - @Test - @Disabled("c64 specific component") - fun testCia1tb123() { - runTest("cia1tb123") - } - - @Test - @Disabled("c64 specific component") - fun testCia2pb6() { - runTest("cia2pb6") - } - - @Test - @Disabled("c64 specific component") - fun testCia2pb7() { - runTest("cia2pb7") - } - - @Test - @Disabled("c64 specific component") - fun testCia2ta() { - runTest("cia2ta") - } - - @Test - @Disabled("c64 specific component") - fun testCia2tb() { - runTest("cia2tb") - } - - @Test - @Disabled("c64 specific component") - fun testCia2tb123() { - runTest("cia2tb123") - } - @Test fun testClcn() { runTest("clcn") @@ -393,30 +237,6 @@ class Test6502TestSuitePart1: FunctionalTestsBase() { runTest("cmpzx") } - @Test - @Disabled("c64 6510 specific component") - fun testCntdef() { - runTest("cntdef") - } - - @Test - @Disabled("c64 6510 specific component") - fun testCnto2() { - runTest("cnto2") - } - - @Test - @Disabled("c64 6510 specific component") - fun testCpuport() { - runTest("cpuport") - } - - @Test - @Disabled("todo: get all cycle times right, and uses c64 specific timing hardware") - fun testCputiming() { - runTest("cputiming") - } - @Test fun testCpxa() { runTest("cpxa") @@ -447,48 +267,6 @@ class Test6502TestSuitePart1: FunctionalTestsBase() { runTest("cpyz") } - @Test - @Disabled("not yet implemented- illegal instruction") - fun testDcma() { - runTest("dcma") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testDcmax() { - runTest("dcmax") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testDcmay() { - runTest("dcmay") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testDcmix() { - runTest("dcmix") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testDcmiy() { - runTest("dcmiy") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testDcmz() { - runTest("dcmz") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testDcmzx() { - runTest("dcmzx") - } - @Test fun testDeca() { runTest("deca") @@ -559,24 +337,6 @@ class Test6502TestSuitePart1: FunctionalTestsBase() { runTest("eorzx") } - @Test - @Disabled("c64 specific component") - fun testFlipos() { - runTest("flipos") - } - - @Test - @Disabled("c64 specific component") - fun testIcr01() { - runTest("icr01") - } - - @Test - @Disabled("c64 specific component") - fun testImr() { - runTest("imr") - } - @Test fun testInca() { runTest("inca") @@ -597,48 +357,6 @@ class Test6502TestSuitePart1: FunctionalTestsBase() { runTest("inczx") } - @Test - @Disabled("not yet implemented- illegal instruction") - fun testInsa() { - runTest("insa") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testInsax() { - runTest("insax") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testInsay() { - runTest("insay") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testInsix() { - runTest("insix") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testInsiy() { - runTest("insiy") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testInsz() { - runTest("insz") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testInszx() { - runTest("inszx") - } - @Test fun testInxn() { runTest("inxn") @@ -649,12 +367,6 @@ class Test6502TestSuitePart1: FunctionalTestsBase() { runTest("inyn") } - @Test - @Disabled("c64 specific component") - fun testIrq() { - runTest("irq") - } - @Test fun testJmpi() { runTest("jmpi") diff --git a/src/test/kotlin/Test6502TestSuitePart2.kt b/src/test/kotlin/Test6502TestSuitePart2.kt index bc52af3..7a37fb7 100644 --- a/src/test/kotlin/Test6502TestSuitePart2.kt +++ b/src/test/kotlin/Test6502TestSuitePart2.kt @@ -8,48 +8,6 @@ import kotlin.test.* @Disabled("this test suite is quite intensive and for regular test runs, the other tests are sufficient") class Test6502TestSuitePart2: FunctionalTestsBase() { - @Test - @Disabled("not yet implemented- illegal instruction") - fun testLasay() { - runTest("lasay") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testLaxa() { - runTest("laxa") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testLaxay() { - runTest("laxay") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testLaxix() { - runTest("laxix") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testLaxiy() { - runTest("laxiy") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testLaxz() { - runTest("laxz") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testLaxzy() { - runTest("laxzy") - } - @Test fun testLdaa() { runTest("ldaa") @@ -140,54 +98,6 @@ class Test6502TestSuitePart2: FunctionalTestsBase() { runTest("ldyzx") } - @Test - @Disabled("c64 specific component") - fun testLoadth() { - runTest("loadth") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testLsea() { - runTest("lsea") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testLseax() { - runTest("lseax") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testLseay() { - runTest("lseay") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testLseix() { - runTest("lseix") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testLseiy() { - runTest("lseiy") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testLsez() { - runTest("lsez") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testLsezx() { - runTest("lsezx") - } - @Test fun testLsra() { runTest("lsra") @@ -213,30 +123,6 @@ class Test6502TestSuitePart2: FunctionalTestsBase() { runTest("lsrzx") } - @Test - @Disabled("not yet implemented- illegal instruction") - fun testLxab() { - runTest("lxab") - } - - @Test - @Disabled("c64 6510 specific component") - fun testMmu() { - runTest("mmu") - } - - @Test - @Disabled("c64 6510 specific component") - fun testMmufetch() { - runTest("mmufetch") - } - - @Test - @Disabled("c64 specific component") - fun testNmi() { - runTest("nmi") - } - @Test fun testNopa() { runTest("nopa") @@ -267,12 +153,6 @@ class Test6502TestSuitePart2: FunctionalTestsBase() { runTest("nopzx") } - @Test - @Disabled("c64 specific component") - fun testOneshot() { - runTest("oneshot") - } - @Test fun testOraa() { runTest("oraa") @@ -333,48 +213,6 @@ class Test6502TestSuitePart2: FunctionalTestsBase() { runTest("plpn") } - @Test - @Disabled("not yet implemented- illegal instruction") - fun testRlaa() { - runTest("rlaa") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testRlaax() { - runTest("rlaax") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testRlaay() { - runTest("rlaay") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testRlaix() { - runTest("rlaix") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testRlaiy() { - runTest("rlaiy") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testRlaz() { - runTest("rlaz") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testRlazx() { - runTest("rlazx") - } - @Test fun testRola() { runTest("rola") @@ -425,48 +263,6 @@ class Test6502TestSuitePart2: FunctionalTestsBase() { runTest("rorzx") } - @Test - @Disabled("not yet implemented- illegal instruction") - fun testRraa() { - runTest("rraa") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testRraax() { - runTest("rraax") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testRraay() { - runTest("rraay") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testRraix() { - runTest("rraix") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testRraiy() { - runTest("rraiy") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testRraz() { - runTest("rraz") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testRrazx() { - runTest("rrazx") - } - @Test fun testRtin() { runTest("rtin") @@ -522,12 +318,6 @@ class Test6502TestSuitePart2: FunctionalTestsBase() { runTest("sbczx") } - @Test - @Disabled("not yet implemented- illegal instruction") - fun testSbxb() { - runTest("sbxb") - } - @Test fun testSecn() { runTest("secn") @@ -543,36 +333,6 @@ class Test6502TestSuitePart2: FunctionalTestsBase() { runTest("sein") } - @Test - @Disabled("not yet implemented- illegal instruction sha/ahx") - fun testShaay() { - runTest("shaay") - } - - @Test - @Disabled("not yet implemented- illegal instruction sha/ahx") - fun testShaiy() { - runTest("shaiy") - } - - @Test - @Disabled("not yet implemented- illegal instruction shs/tas") - fun testShsay() { - runTest("shsay") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testShxay() { - runTest("shxay") - } - - @Test - @Disabled("not yet implemented- illegal instruction") - fun testShyax() { - runTest("shyax") - } - @Test fun testStaa() { runTest("staa")