Successfully runs EKBA
This commit is contained in:
5
src/main/kotlin/com/thequux/mcpdp/ext/bit/formatting.kt
Normal file
5
src/main/kotlin/com/thequux/mcpdp/ext/bit/formatting.kt
Normal file
@@ -0,0 +1,5 @@
|
||||
package com.thequux.mcpdp.ext.bit
|
||||
|
||||
fun UShort.toOctal(): String = this.toString(8).padStart(6,'0')
|
||||
fun UByte.toOctal(): String = this.toString(8).padStart(3, '0')
|
||||
fun UInt.toOctal(): String = this.toString(8).padStart(11, '0')
|
@@ -8,6 +8,7 @@ import com.thequux.mcpdp.ext.bit.bic
|
||||
import com.thequux.mcpdp.ext.bit.bis
|
||||
import com.thequux.mcpdp.ext.bit.bit
|
||||
import com.thequux.mcpdp.ext.bit.maskSet
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.io.InputStream
|
||||
import java.io.OutputStream
|
||||
import java.io.InterruptedIOException
|
||||
@@ -18,6 +19,7 @@ import kotlin.concurrent.thread
|
||||
|
||||
|
||||
class DL11(private var istr: InputStream, private val ostr: OutputStream, val reg_base: UInt, val vector: UShort, val unibus: Unibus): PAddressSpace, Peripheral {
|
||||
private val logger = LoggerFactory.getLogger(this.javaClass)
|
||||
private var reader: Thread? = null
|
||||
private var rcsr: UShort = 0x0u
|
||||
set(value) {
|
||||
@@ -78,9 +80,9 @@ class DL11(private var istr: InputStream, private val ostr: OutputStream, val re
|
||||
}
|
||||
|
||||
override fun setb(addr: UInt, value: UByte) {
|
||||
when (addr.toInt() and 7) {
|
||||
0 -> setw(0u, value.toUShort()) // high bits are unaffected
|
||||
|
||||
if (!(addr bit 0)) {
|
||||
setw(addr, value.toUShort())
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -4,8 +4,10 @@ import com.thequux.mcpdp.core.BusTimeoutError
|
||||
import com.thequux.mcpdp.core.MemoryError
|
||||
import com.thequux.mcpdp.core.MemoryErrorType
|
||||
import com.thequux.mcpdp.core.PAddressSpace
|
||||
import com.thequux.mcpdp.ext.bit.toOctal
|
||||
import com.thequux.mcpdp.util.ConfigurationError
|
||||
import com.thequux.mcpdp.util.ProgrammerError
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.lang.Integer.min
|
||||
import java.util.Collections
|
||||
import java.util.LinkedList
|
||||
@@ -72,15 +74,28 @@ class Unibus: PAddressSpace, Subregion(12, 6) {
|
||||
/// The view of the unibus from a device
|
||||
var deviceView: PAddressSpace = this
|
||||
internal set
|
||||
private val logger = LoggerFactory.getLogger(this.javaClass)
|
||||
|
||||
private val queue: Array<MutableList<InterruptSource>> = Array(8) { Vector(4) }
|
||||
|
||||
override fun map(address: UInt): PAddressSpace =
|
||||
super.map(address) ?: throw BusTimeoutError(address)
|
||||
override fun getw(addr: UInt): UShort = map(addr).getw(addr)
|
||||
override fun getb(addr: UInt): UByte = map(addr).getb(addr)
|
||||
override fun setw(addr: UInt, value: UShort) = map(addr).setw(addr, value)
|
||||
override fun setb(addr: UInt, value: UByte) = map(addr).setb(addr, value)
|
||||
override fun getw(addr: UInt): UShort {
|
||||
if (logger.isTraceEnabled) logger.trace("DATIW ${addr.toOctal()}")
|
||||
return map(addr).getw(addr)
|
||||
}
|
||||
override fun getb(addr: UInt): UByte {
|
||||
if (logger.isTraceEnabled) logger.trace("DATIB ${addr.toOctal()}")
|
||||
return map(addr).getb(addr)
|
||||
}
|
||||
override fun setw(addr: UInt, value: UShort) {
|
||||
if (logger.isTraceEnabled) logger.trace("DATOW ${addr.toOctal()} <- ${value.toOctal()}")
|
||||
map(addr).setw(addr, value)
|
||||
}
|
||||
override fun setb(addr: UInt, value: UByte) {
|
||||
if (logger.isTraceEnabled) logger.trace("DATOB ${addr.toOctal()} <- ${value.toOctal()}")
|
||||
map(addr).setb(addr, value)
|
||||
}
|
||||
|
||||
/// Request that the processor service an interrupt. When the interrupt is handled, calls getVector() on the device
|
||||
/// to fetch the currently desired interrupt vector
|
||||
|
Reference in New Issue
Block a user