Compare commits
2 Commits
d90304b5fd
...
b512f1a42f
| Author | SHA1 | Date | |
|---|---|---|---|
| b512f1a42f | |||
| ef5d8d73c7 |
16
doc/diagnostics.md
Normal file
16
doc/diagnostics.md
Normal 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
|
||||||
|
```
|
||||||
@@ -65,13 +65,13 @@ fun CPU.loadAbs(infile: File) {
|
|||||||
if (cksum != 0) {
|
if (cksum != 0) {
|
||||||
throw Exception("Incorrect checksum: 0x${cksum.toString(16)}")
|
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) {
|
if (len == 0) {
|
||||||
// end of file
|
// end of file
|
||||||
logger.debug("Tape ended at ${pos+len+7}")
|
logger.trace("Tape ended at ${pos+len+7}")
|
||||||
if (!(addr bit 0)){
|
if (!(addr bit 0)){
|
||||||
this.pc = addr
|
this.pc = addr
|
||||||
logger.debug("Ready to run at ${addr.toString(8)}")
|
logger.trace("Ready to run at ${addr.toString(8)}")
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ class CPU(val mbus: MemBus, var tracer: ITracer = NullTracer()) {
|
|||||||
registers[reg] = stack_pop()
|
registers[reg] = stack_pop()
|
||||||
} // RTS
|
} // RTS
|
||||||
in 0x98..0x9F -> {
|
in 0x98..0x9F -> {
|
||||||
if (cur_mode == 0) psw_priority = opcode and 0x7
|
if (cur_mode == 0) psw_priority_next = opcode and 0x7
|
||||||
} // SPL
|
} // SPL
|
||||||
in 0xA0..0xBF -> {
|
in 0xA0..0xBF -> {
|
||||||
val flag = opcode bit 4
|
val flag = opcode bit 4
|
||||||
@@ -325,10 +325,10 @@ class CPU(val mbus: MemBus, var tracer: ITracer = NullTracer()) {
|
|||||||
val src = opc_src(opcode)
|
val src = opc_src(opcode)
|
||||||
val dst = opc_dst(opcode)
|
val dst = opc_dst(opcode)
|
||||||
op_loadw(src).also {
|
op_loadw(src).also {
|
||||||
op_storw(dst, it)
|
|
||||||
N = it bit 15
|
N = it bit 15
|
||||||
Z = it == 0.toUShort()
|
Z = it == 0.toUShort()
|
||||||
V = false
|
V = false
|
||||||
|
op_storw(dst, it)
|
||||||
}
|
}
|
||||||
} // MOV
|
} // MOV
|
||||||
for (i in 0x20..0x2F) insnTable[i] = { opcode -> // CMP
|
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
|
registerSet = newpsw shr 11 and 1
|
||||||
cur_mode = newpsw shr 14
|
cur_mode = newpsw shr 14
|
||||||
prv_mode = newpsw shr 12 and 3
|
prv_mode = newpsw shr 12 and 3
|
||||||
psw_priority = newpsw shr 5 and 7
|
psw_priority_next = newpsw shr 5 and 7
|
||||||
} else {
|
} else {
|
||||||
registerSet = registerSet or (newpsw shr 11 and 1)
|
registerSet = registerSet or (newpsw shr 11 and 1)
|
||||||
cur_mode = cur_mode or (newpsw shr 14 and 3)
|
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 prv_mode: Int = 0
|
||||||
private var psw_priority: Int = 0
|
private var psw_priority: Int = 0
|
||||||
|
private var psw_priority_next: Int = 0
|
||||||
var pc: UShort
|
var pc: UShort
|
||||||
get() = registers[7]
|
get() = registers[7]
|
||||||
set(value) {
|
set(value) {
|
||||||
@@ -1122,8 +1123,10 @@ class CPU(val mbus: MemBus, var tracer: ITracer = NullTracer()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (runState == RunState.WAIT_FOR_INTERRUPT) {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
psw_priority = psw_priority_next
|
||||||
|
|
||||||
// Proceed to handling instruction
|
// Proceed to handling instruction
|
||||||
try {
|
try {
|
||||||
@@ -1188,6 +1191,7 @@ class CPU(val mbus: MemBus, var tracer: ITracer = NullTracer()) {
|
|||||||
val old_psw = psw
|
val old_psw = psw
|
||||||
val newPSW = core.getSpace(0).getw((vector + 2u).toUShort()) and 0xCFFFu or (cur_mode shl 12).toUShort()
|
val newPSW = core.getSpace(0).getw((vector + 2u).toUShort()) and 0xCFFFu or (cur_mode shl 12).toUShort()
|
||||||
setPSW(newPSW, true)
|
setPSW(newPSW, true)
|
||||||
|
psw_priority = psw_priority_next // calling a vector sets priority immediately
|
||||||
stack_push(old_psw)
|
stack_push(old_psw)
|
||||||
stack_push(pc)
|
stack_push(pc)
|
||||||
pc = core.getw(vector)
|
pc = core.getw(vector)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class DL11(private var istr: InputStream, private val ostr: OutputStream, val re
|
|||||||
override fun reset() {
|
override fun reset() {
|
||||||
rcsr = 0x0u
|
rcsr = 0x0u
|
||||||
rcsr = 0x0u
|
rcsr = 0x0u
|
||||||
// xcsr = 0x80u
|
xcsr = 0x80u
|
||||||
|
|
||||||
intrRcv.level = false
|
intrRcv.level = false
|
||||||
intrXmit.level = false
|
intrXmit.level = false
|
||||||
|
|||||||
Reference in New Issue
Block a user