1
0
mirror of https://github.com/irmen/ksim65.git synced 2024-06-09 11:29:30 +00:00
ksim65/src/main/kotlin/razorvine/ksim65/Utils.kt

18 lines
515 B
Kotlin

package razorvine.ksim65
import razorvine.ksim65.components.Address
fun hexW(number: Int, allowSingleByte: Boolean = false) =
if(allowSingleByte && (number and 0xff00 == 0)) {
number.toString(16).padStart(2, '0')
} else {
number.toString(16).padStart(4, '0')
}
fun hexB(number: Int) = number.toString(16).padStart(2, '0')
fun hexB(number: Short) = hexB(number.toInt())
typealias BreakpointHandler = (cpu: Cpu6502, pc: Address) -> Cpu6502.BreakpointResultAction