Misc tiny changes

This commit is contained in:
2023-09-20 23:43:31 +02:00
parent 3f85ee0603
commit be1bf406a4
3 changed files with 8 additions and 3 deletions

View File

@@ -1,7 +1,9 @@
import ch.qos.logback.classic.LoggerContext
import com.thequux.mcpdp.core.CPU import com.thequux.mcpdp.core.CPU
import com.thequux.mcpdp.loadAbs import com.thequux.mcpdp.loadAbs
import com.thequux.mcpdp.peripheral.DL11 import com.thequux.mcpdp.peripheral.DL11
import com.thequux.mcpdp.peripheral.MemBus import com.thequux.mcpdp.peripheral.MemBus
import org.slf4j.LoggerFactory
import java.io.File import java.io.File
fun main(args: Array<String>) { fun main(args: Array<String>) {
@@ -19,7 +21,7 @@ fun main(args: Array<String>) {
cpu.runState = CPU.RunState.RUNNING cpu.runState = CPU.RunState.RUNNING
cpu.pc = 0x80u cpu.pc = 0x80u
val start = System.nanoTime() val start = System.nanoTime()
val ninsn = cpu.run(600000000) val ninsn = cpu.run(200000000)
val end = System.nanoTime() val end = System.nanoTime()
System.err.println("Halted at 0${cpu.pc.toString(8)}") System.err.println("Halted at 0${cpu.pc.toString(8)}")
@@ -29,5 +31,7 @@ fun main(args: Array<String>) {
println("Exiting") println("Exiting")
console.stop() console.stop()
} }
val loggerContext = LoggerFactory.getILoggerFactory() as LoggerContext
loggerContext.stop()
System.exit(0) System.exit(0)
} }

View File

@@ -865,6 +865,7 @@ class CPU(val mbus: MemBus) {
} else { } else {
val pirqLvl = pirq.toInt() shr 1 and 7; val pirqLvl = pirq.toInt() shr 1 and 7;
if (pirqLvl > psw_priority) { if (pirqLvl > psw_priority) {
logger.debug("PIRQ{} trap to 0xA0", pirqLvl)
trap(0xA0u) trap(0xA0u)
} }
} }
@@ -906,7 +907,7 @@ class CPU(val mbus: MemBus) {
} }
fun trap(vector: UShort) { fun trap(vector: UShort) {
// logger.debug("Trap to {}", vector.toString(8)) logger.info("Trap to {}", vector.toString(8))
val old_psw = psw val old_psw = psw
// update PSW first so that this gets pushed to the // update PSW first so that this gets pushed to the
psw = core.getw((vector + 2u).toUShort()) psw = core.getw((vector + 2u).toUShort())

View File

@@ -108,7 +108,7 @@ class Disassembler(val core: VAddressSpace) {
0x0000 -> when (opcode) { 0x0000 -> when (opcode) {
0x0000 -> fmt("HALT") // HALT 0x0000 -> fmt("HALT") // HALT
0x0001 -> fmt("WAIT") 0x0001 -> fmt("WAIT")
0x0002 -> fmt("WTI") 0x0002 -> fmt("RTI")
0x0003 -> fmt("BPT") 0x0003 -> fmt("BPT")
0x0004 -> fmt("IOT") 0x0004 -> fmt("IOT")
0x0005 -> fmt("RESET") 0x0005 -> fmt("RESET")