From 62e2f1663a46a8e1f2a28d9abc99c9ad7d40826f Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Tue, 18 Feb 2020 04:27:15 +0100 Subject: [PATCH] test tweak --- src/test/kotlin/C64KernalStubs.kt | 4 ++++ src/test/kotlin/FunctionalTestsBase.kt | 16 +++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/test/kotlin/C64KernalStubs.kt b/src/test/kotlin/C64KernalStubs.kt index 305023d..f8a45d1 100644 --- a/src/test/kotlin/C64KernalStubs.kt +++ b/src/test/kotlin/C64KernalStubs.kt @@ -1,6 +1,7 @@ import razorvine.ksim65.components.Address import razorvine.ksim65.Cpu6502 import razorvine.ksim65.components.Ram +import razorvine.ksim65.hexW class C64KernalStubs(private val ram: Ram) { @@ -38,6 +39,9 @@ class C64KernalStubs(private val ram: Ram) { // cpu.popStackAddr() // cpu.PC = 0x0816 // continue in next module } + else -> { + TODO("unhandled kernel stub called \$${hexW(pc)}") + } } return Cpu6502.BreakpointResultAction(null, null) diff --git a/src/test/kotlin/FunctionalTestsBase.kt b/src/test/kotlin/FunctionalTestsBase.kt index abb4a37..59564e1 100644 --- a/src/test/kotlin/FunctionalTestsBase.kt +++ b/src/test/kotlin/FunctionalTestsBase.kt @@ -19,18 +19,18 @@ abstract class FunctionalTestsBase { cpu.addBreakpoint(0xffd2) { cpu, pc -> kernalStubs.handleBreakpoint(cpu, pc) } cpu.addBreakpoint(0xffe4) { cpu, pc -> kernalStubs.handleBreakpoint(cpu, pc) } cpu.addBreakpoint(0xe16f) { cpu, pc -> kernalStubs.handleBreakpoint(cpu, pc) } - - // setup the irq/brk routine - for(b in listOf(0x48, 0x8A, 0x48, 0x98, 0x48, 0xBA, 0xBD, 0x04, - 0x01, 0x29, 0x10, 0xF0, 0x03, 0x6C, 0x16, 0x03, - 0x6C, 0x14, 0x03).withIndex()) { - ram[0xff48+b.index] = b.value.toShort() - } bus.add(cpu) bus.add(ram) } protected fun runTest(testprogram: String) { + ram.fill(0) + // setup the irq/brk routine TODO is this the right code? + for(b in listOf(0x48, 0x8A, 0x48, 0x98, 0x48, 0xBA, 0xBD, 0x04, + 0x01, 0x29, 0x10, 0xF0, 0x03, 0x6C, 0x16, 0x03, + 0x6C, 0x14, 0x03).withIndex()) { + ram[0xff48+b.index] = b.value.toShort() + } ram.loadPrg("src/test/kotlin/6502testsuite/$testprogram", null) ram[0x02] = 0 ram[0xa002] = 0 @@ -44,8 +44,6 @@ abstract class FunctionalTestsBase { ram[0x8000] = 2 ram[0xa474] = 2 bus.reset() - cpu.regSP = 0xfd - cpu.regP.fromInt(0b00100100) try { while (cpu.totalCycles < 40000000L) { bus.clock()