Compare commits

...

2 Commits

4 changed files with 27 additions and 7 deletions

16
doc/diagnostics.md Normal file
View File

@@ -0,0 +1,16 @@
# Running ekba
This will run for a total of 541450515 instructions. To just run the first pass (132198 insns), break at 10742.
```
# Start address of 0200, no switch settings, break at end of second pass.
jdp11 -l diag/ekba.pt -g 200 -b 10722
```
# Running ekbb
This will run for around 1144728 instructions.
```
# Start address of 0200, switch set to 161 to disable unibus trap tests, break at 36170, which is the end of the test
jdp11 -l diag/ekbb.pt -g 200 -s 161 -b 36170
```

View File

@@ -65,13 +65,13 @@ fun CPU.loadAbs(infile: File) {
if (cksum != 0) {
throw Exception("Incorrect checksum: 0x${cksum.toString(16)}")
}
logger.debug("Loading 0x${len.toString(16)} bytes at 0x${addr.toString(16)}")
logger.trace("Loading 0x${len.toString(16)} bytes at 0x${addr.toString(16)}")
if (len == 0) {
// end of file
logger.debug("Tape ended at ${pos+len+7}")
logger.trace("Tape ended at ${pos+len+7}")
if (!(addr bit 0)){
this.pc = addr
logger.debug("Ready to run at ${addr.toString(8)}")
logger.trace("Ready to run at ${addr.toString(8)}")
}
return
} else {

View File

@@ -111,7 +111,7 @@ class CPU(val mbus: MemBus, var tracer: ITracer = NullTracer()) {
registers[reg] = stack_pop()
} // RTS
in 0x98..0x9F -> {
if (cur_mode == 0) psw_priority = opcode and 0x7
if (cur_mode == 0) psw_priority_next = opcode and 0x7
} // SPL
in 0xA0..0xBF -> {
val flag = opcode bit 4
@@ -325,10 +325,10 @@ class CPU(val mbus: MemBus, var tracer: ITracer = NullTracer()) {
val src = opc_src(opcode)
val dst = opc_dst(opcode)
op_loadw(src).also {
op_storw(dst, it)
N = it bit 15
Z = it == 0.toUShort()
V = false
op_storw(dst, it)
}
} // MOV
for (i in 0x20..0x2F) insnTable[i] = { opcode -> // CMP
@@ -796,7 +796,7 @@ class CPU(val mbus: MemBus, var tracer: ITracer = NullTracer()) {
registerSet = newpsw shr 11 and 1
cur_mode = newpsw shr 14
prv_mode = newpsw shr 12 and 3
psw_priority = newpsw shr 5 and 7
psw_priority_next = newpsw shr 5 and 7
} else {
registerSet = registerSet or (newpsw shr 11 and 1)
cur_mode = cur_mode or (newpsw shr 14 and 3)
@@ -814,6 +814,7 @@ class CPU(val mbus: MemBus, var tracer: ITracer = NullTracer()) {
}
private var prv_mode: Int = 0
private var psw_priority: Int = 0
private var psw_priority_next: Int = 0
var pc: UShort
get() = registers[7]
set(value) {
@@ -1122,8 +1123,10 @@ class CPU(val mbus: MemBus, var tracer: ITracer = NullTracer()) {
}
if (runState == RunState.WAIT_FOR_INTERRUPT) {
// Note that it is impossible to have a pending priority change at the same time as a WAIT insn
return
}
psw_priority = psw_priority_next
// Proceed to handling instruction
try {
@@ -1188,6 +1191,7 @@ class CPU(val mbus: MemBus, var tracer: ITracer = NullTracer()) {
val old_psw = psw
val newPSW = core.getSpace(0).getw((vector + 2u).toUShort()) and 0xCFFFu or (cur_mode shl 12).toUShort()
setPSW(newPSW, true)
psw_priority = psw_priority_next // calling a vector sets priority immediately
stack_push(old_psw)
stack_push(pc)
pc = core.getw(vector)

View File

@@ -42,7 +42,7 @@ class DL11(private var istr: InputStream, private val ostr: OutputStream, val re
override fun reset() {
rcsr = 0x0u
rcsr = 0x0u
// xcsr = 0x80u
xcsr = 0x80u
intrRcv.level = false
intrXmit.level = false