diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt index 8b5e2df..c197c39 100644 --- a/src/main/kotlin/Main.kt +++ b/src/main/kotlin/Main.kt @@ -1,7 +1,9 @@ +import ch.qos.logback.classic.LoggerContext import com.thequux.mcpdp.core.CPU import com.thequux.mcpdp.loadAbs import com.thequux.mcpdp.peripheral.DL11 import com.thequux.mcpdp.peripheral.MemBus +import org.slf4j.LoggerFactory import java.io.File fun main(args: Array) { @@ -19,7 +21,7 @@ fun main(args: Array) { cpu.runState = CPU.RunState.RUNNING cpu.pc = 0x80u val start = System.nanoTime() - val ninsn = cpu.run(600000000) + val ninsn = cpu.run(200000000) val end = System.nanoTime() System.err.println("Halted at 0${cpu.pc.toString(8)}") @@ -29,5 +31,7 @@ fun main(args: Array) { println("Exiting") console.stop() } + val loggerContext = LoggerFactory.getILoggerFactory() as LoggerContext + loggerContext.stop() System.exit(0) } diff --git a/src/main/kotlin/com/thequux/mcpdp/core/CPU.kt b/src/main/kotlin/com/thequux/mcpdp/core/CPU.kt index 46e8540..8ff021e 100644 --- a/src/main/kotlin/com/thequux/mcpdp/core/CPU.kt +++ b/src/main/kotlin/com/thequux/mcpdp/core/CPU.kt @@ -865,6 +865,7 @@ class CPU(val mbus: MemBus) { } else { val pirqLvl = pirq.toInt() shr 1 and 7; if (pirqLvl > psw_priority) { + logger.debug("PIRQ{} trap to 0xA0", pirqLvl) trap(0xA0u) } } @@ -906,7 +907,7 @@ class CPU(val mbus: MemBus) { } fun trap(vector: UShort) { -// logger.debug("Trap to {}", vector.toString(8)) + logger.info("Trap to {}", vector.toString(8)) val old_psw = psw // update PSW first so that this gets pushed to the psw = core.getw((vector + 2u).toUShort()) diff --git a/src/main/kotlin/com/thequux/mcpdp/util/DebugTools.kt b/src/main/kotlin/com/thequux/mcpdp/util/DebugTools.kt index 5949ee7..bebeb85 100644 --- a/src/main/kotlin/com/thequux/mcpdp/util/DebugTools.kt +++ b/src/main/kotlin/com/thequux/mcpdp/util/DebugTools.kt @@ -108,7 +108,7 @@ class Disassembler(val core: VAddressSpace) { 0x0000 -> when (opcode) { 0x0000 -> fmt("HALT") // HALT 0x0001 -> fmt("WAIT") - 0x0002 -> fmt("WTI") + 0x0002 -> fmt("RTI") 0x0003 -> fmt("BPT") 0x0004 -> fmt("IOT") 0x0005 -> fmt("RESET")