mirror of
https://github.com/irmen/ksim65.git
synced 2024-06-14 13:29:35 +00:00
cleanups
This commit is contained in:
parent
e13e86f33f
commit
19de88be4c
|
@ -4,8 +4,6 @@ import razorvine.ksim65.components.MemoryComponent
|
|||
import java.awt.*
|
||||
import java.awt.image.BufferedImage
|
||||
import java.awt.event.*
|
||||
import java.awt.image.ByteLookupTable
|
||||
import java.awt.image.LookupOp
|
||||
import java.io.CharConversionException
|
||||
import java.util.*
|
||||
import javax.swing.*
|
||||
|
@ -108,18 +106,18 @@ private class BitmapScreenPanel(val chargenData: ByteArray, val ram: MemoryCompo
|
|||
private fun drawColoredChar(x: Int, y: Int, char: Int, color: Int) {
|
||||
var cached = coloredCharacters[Pair(char, color)]
|
||||
if(cached==null) {
|
||||
cached = normalCharacters.get(char)
|
||||
cached = normalCharacters[char]
|
||||
val colored = g2d.deviceConfiguration.createCompatibleImage(8, 8, BufferedImage.BITMASK)
|
||||
val sourceRaster = cached.raster
|
||||
val coloredRaster = colored.raster
|
||||
val pixelArray = IntArray(4)
|
||||
val javaColor = ScreenDefs.colorPalette[color]
|
||||
val coloredPixel = listOf(javaColor.red, javaColor.green, javaColor.blue, javaColor.alpha).toIntArray()
|
||||
for(y in 0..7) {
|
||||
for(x in 0..7) {
|
||||
val source = sourceRaster.getPixel(x, y, pixelArray)
|
||||
for(pixelY in 0..7) {
|
||||
for(pixelX in 0..7) {
|
||||
val source = sourceRaster.getPixel(pixelX, pixelY, pixelArray)
|
||||
if(source[0]!=0) {
|
||||
coloredRaster.setPixel(x, y, coloredPixel)
|
||||
coloredRaster.setPixel(pixelX, pixelY, coloredPixel)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +130,7 @@ private class BitmapScreenPanel(val chargenData: ByteArray, val ram: MemoryCompo
|
|||
|
||||
class MainWindow(title: String, chargenData: ByteArray, val ram: MemoryComponent) : JFrame(title), KeyListener {
|
||||
private val canvas = BitmapScreenPanel(chargenData, ram)
|
||||
val keyboardBuffer = ArrayDeque<Char>()
|
||||
private val keyboardBuffer = ArrayDeque<Char>()
|
||||
private var borderTop: JPanel
|
||||
private var borderBottom: JPanel
|
||||
private var borderLeft: JPanel
|
||||
|
@ -212,19 +210,15 @@ class MainWindow(title: String, chargenData: ByteArray, val ram: MemoryComponent
|
|||
var kbbLen = ram[0xc6]
|
||||
while(kbbLen<=10 && keyboardBuffer.isNotEmpty()) {
|
||||
try {
|
||||
val char = keyboardBuffer.pop()
|
||||
// print("CHAR: '$char' ${char.toShort()} -> ")
|
||||
val petscii = when(char) {
|
||||
val petscii = when(val char = keyboardBuffer.pop()) {
|
||||
'\n' -> 13 // enter
|
||||
'\b' -> 20 // backspace ('delete')
|
||||
else -> Petscii.encodePetscii(char.toString(), true)[0]
|
||||
}
|
||||
// println("$petscii")
|
||||
ram[0x277 + kbbLen] = petscii
|
||||
kbbLen++
|
||||
} catch(ccx: CharConversionException) {
|
||||
// ignore character
|
||||
// println("ignored")
|
||||
}
|
||||
}
|
||||
ram[0xc6] = kbbLen
|
||||
|
|
|
@ -525,529 +525,9 @@ object Petscii {
|
|||
'\u03c0' // π 0xFF -> GREEK SMALL LETTER PI
|
||||
)
|
||||
|
||||
private val decodingScreencodeLowercase = arrayOf(
|
||||
'@' , // @ 0x00 -> COMMERCIAL AT
|
||||
'a' , // a 0x01 -> LATIN SMALL LETTER A
|
||||
'b' , // b 0x02 -> LATIN SMALL LETTER B
|
||||
'c' , // c 0x03 -> LATIN SMALL LETTER C
|
||||
'd' , // d 0x04 -> LATIN SMALL LETTER D
|
||||
'e' , // e 0x05 -> LATIN SMALL LETTER E
|
||||
'f' , // f 0x06 -> LATIN SMALL LETTER F
|
||||
'g' , // g 0x07 -> LATIN SMALL LETTER G
|
||||
'h' , // h 0x08 -> LATIN SMALL LETTER H
|
||||
'i' , // i 0x09 -> LATIN SMALL LETTER I
|
||||
'j' , // j 0x0A -> LATIN SMALL LETTER J
|
||||
'k' , // k 0x0B -> LATIN SMALL LETTER K
|
||||
'l' , // l 0x0C -> LATIN SMALL LETTER L
|
||||
'm' , // m 0x0D -> LATIN SMALL LETTER M
|
||||
'n' , // n 0x0E -> LATIN SMALL LETTER N
|
||||
'o' , // o 0x0F -> LATIN SMALL LETTER O
|
||||
'p' , // p 0x10 -> LATIN SMALL LETTER P
|
||||
'q' , // q 0x11 -> LATIN SMALL LETTER Q
|
||||
'r' , // r 0x12 -> LATIN SMALL LETTER R
|
||||
's' , // s 0x13 -> LATIN SMALL LETTER S
|
||||
't' , // t 0x14 -> LATIN SMALL LETTER T
|
||||
'u' , // u 0x15 -> LATIN SMALL LETTER U
|
||||
'v' , // v 0x16 -> LATIN SMALL LETTER V
|
||||
'w' , // w 0x17 -> LATIN SMALL LETTER W
|
||||
'x' , // x 0x18 -> LATIN SMALL LETTER X
|
||||
'y' , // y 0x19 -> LATIN SMALL LETTER Y
|
||||
'z' , // z 0x1A -> LATIN SMALL LETTER Z
|
||||
'[' , // [ 0x1B -> LEFT SQUARE BRACKET
|
||||
'\u00a3', // £ 0x1C -> POUND SIGN
|
||||
']' , // ] 0x1D -> RIGHT SQUARE BRACKET
|
||||
'\u2191', // ↑ 0x1E -> UPWARDS ARROW
|
||||
'\u2190', // ← 0x1F -> LEFTWARDS ARROW
|
||||
' ' , // 0x20 -> SPACE
|
||||
'!' , // ! 0x21 -> EXCLAMATION MARK
|
||||
'"' , // " 0x22 -> QUOTATION MARK
|
||||
'#' , // # 0x23 -> NUMBER SIGN
|
||||
'$' , // $ 0x24 -> DOLLAR SIGN
|
||||
'%' , // % 0x25 -> PERCENT SIGN
|
||||
'&' , // & 0x26 -> AMPERSAND
|
||||
'\'' , // ' 0x27 -> APOSTROPHE
|
||||
'(' , // ( 0x28 -> LEFT PARENTHESIS
|
||||
')' , // ) 0x29 -> RIGHT PARENTHESIS
|
||||
'*' , // * 0x2A -> ASTERISK
|
||||
'+' , // + 0x2B -> PLUS SIGN
|
||||
',' , // , 0x2C -> COMMA
|
||||
'-' , // - 0x2D -> HYPHEN-MINUS
|
||||
'.' , // . 0x2E -> FULL STOP
|
||||
'/' , // / 0x2F -> SOLIDUS
|
||||
'0' , // 0 0x30 -> DIGIT ZERO
|
||||
'1' , // 1 0x31 -> DIGIT ONE
|
||||
'2' , // 2 0x32 -> DIGIT TWO
|
||||
'3' , // 3 0x33 -> DIGIT THREE
|
||||
'4' , // 4 0x34 -> DIGIT FOUR
|
||||
'5' , // 5 0x35 -> DIGIT FIVE
|
||||
'6' , // 6 0x36 -> DIGIT SIX
|
||||
'7' , // 7 0x37 -> DIGIT SEVEN
|
||||
'8' , // 8 0x38 -> DIGIT EIGHT
|
||||
'9' , // 9 0x39 -> DIGIT NINE
|
||||
':' , // : 0x3A -> COLON
|
||||
';' , // ; 0x3B -> SEMICOLON
|
||||
'<' , // < 0x3C -> LESS-THAN SIGN
|
||||
'=' , // = 0x3D -> EQUALS SIGN
|
||||
'>' , // > 0x3E -> GREATER-THAN SIGN
|
||||
'?' , // ? 0x3F -> QUESTION MARK
|
||||
'\u2500', // ─ 0x40 -> BOX DRAWINGS LIGHT HORIZONTAL
|
||||
'A' , // A 0x41 -> LATIN CAPITAL LETTER A
|
||||
'B' , // B 0x42 -> LATIN CAPITAL LETTER B
|
||||
'C' , // C 0x43 -> LATIN CAPITAL LETTER C
|
||||
'D' , // D 0x44 -> LATIN CAPITAL LETTER D
|
||||
'E' , // E 0x45 -> LATIN CAPITAL LETTER E
|
||||
'F' , // F 0x46 -> LATIN CAPITAL LETTER F
|
||||
'G' , // G 0x47 -> LATIN CAPITAL LETTER G
|
||||
'H' , // H 0x48 -> LATIN CAPITAL LETTER H
|
||||
'I' , // I 0x49 -> LATIN CAPITAL LETTER I
|
||||
'J' , // J 0x4A -> LATIN CAPITAL LETTER J
|
||||
'K' , // K 0x4B -> LATIN CAPITAL LETTER K
|
||||
'L' , // L 0x4C -> LATIN CAPITAL LETTER L
|
||||
'M' , // M 0x4D -> LATIN CAPITAL LETTER M
|
||||
'N' , // N 0x4E -> LATIN CAPITAL LETTER N
|
||||
'O' , // O 0x4F -> LATIN CAPITAL LETTER O
|
||||
'P' , // P 0x50 -> LATIN CAPITAL LETTER P
|
||||
'Q' , // Q 0x51 -> LATIN CAPITAL LETTER Q
|
||||
'R' , // R 0x52 -> LATIN CAPITAL LETTER R
|
||||
'S' , // S 0x53 -> LATIN CAPITAL LETTER S
|
||||
'T' , // T 0x54 -> LATIN CAPITAL LETTER T
|
||||
'U' , // U 0x55 -> LATIN CAPITAL LETTER U
|
||||
'V' , // V 0x56 -> LATIN CAPITAL LETTER V
|
||||
'W' , // W 0x57 -> LATIN CAPITAL LETTER W
|
||||
'X' , // X 0x58 -> LATIN CAPITAL LETTER X
|
||||
'Y' , // Y 0x59 -> LATIN CAPITAL LETTER Y
|
||||
'Z' , // Z 0x5A -> LATIN CAPITAL LETTER Z
|
||||
'\u253c', // ┼ 0x5B -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
|
||||
'\uf12e', // 0x5C -> LEFT HALF BLOCK MEDIUM SHADE (CUS)
|
||||
'\u2502', // │ 0x5D -> BOX DRAWINGS LIGHT VERTICAL
|
||||
'\u2592', // ▒ 0x5E -> MEDIUM SHADE
|
||||
'\uf139', // 0x5F -> MEDIUM SHADE SLASHED LEFT (CUS)
|
||||
'\u00a0', // 0x60 -> NO-BREAK SPACE
|
||||
'\u258c', // ▌ 0x61 -> LEFT HALF BLOCK
|
||||
'\u2584', // ▄ 0x62 -> LOWER HALF BLOCK
|
||||
'\u2594', // ▔ 0x63 -> UPPER ONE EIGHTH BLOCK
|
||||
'\u2581', // ▁ 0x64 -> LOWER ONE EIGHTH BLOCK
|
||||
'\u258f', // ▏ 0x65 -> LEFT ONE EIGHTH BLOCK
|
||||
'\u2592', // ▒ 0x66 -> MEDIUM SHADE
|
||||
'\u2595', // ▕ 0x67 -> RIGHT ONE EIGHTH BLOCK
|
||||
'\uf12f', // 0x68 -> LOWER HALF BLOCK MEDIUM SHADE (CUS)
|
||||
'\uf13a', // 0x69 -> MEDIUM SHADE SLASHED RIGHT (CUS)
|
||||
'\uf130', // 0x6A -> RIGHT ONE QUARTER BLOCK (CUS)
|
||||
'\u251c', // ├ 0x6B -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
|
||||
'\u2597', // ▗ 0x6C -> QUADRANT LOWER RIGHT
|
||||
'\u2514', // └ 0x6D -> BOX DRAWINGS LIGHT UP AND RIGHT
|
||||
'\u2510', // ┐ 0x6E -> BOX DRAWINGS LIGHT DOWN AND LEFT
|
||||
'\u2582', // ▂ 0x6F -> LOWER ONE QUARTER BLOCK
|
||||
'\u250c', // ┌ 0x70 -> BOX DRAWINGS LIGHT DOWN AND RIGHT
|
||||
'\u2534', // ┴ 0x71 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
|
||||
'\u252c', // ┬ 0x72 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
|
||||
'\u2524', // ┤ 0x73 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
|
||||
'\u258e', // ▎ 0x74 -> LEFT ONE QUARTER BLOCK
|
||||
'\u258d', // ▍ 0x75 -> LEFT THREE EIGTHS BLOCK
|
||||
'\uf131', // 0x76 -> RIGHT THREE EIGHTHS BLOCK (CUS)
|
||||
'\uf132', // 0x77 -> UPPER ONE QUARTER BLOCK (CUS)
|
||||
'\uf133', // 0x78 -> UPPER THREE EIGHTS BLOCK (CUS)
|
||||
'\u2583', // ▃ 0x79 -> LOWER THREE EIGHTHS BLOCK
|
||||
'\u2713', // ✓ 0x7A -> CHECK MARK
|
||||
'\u2596', // ▖ 0x7B -> QUADRANT LOWER LEFT
|
||||
'\u259d', // ▝ 0x7C -> QUADRANT UPPER RIGHT
|
||||
'\u2518', // ┘ 0x7D -> BOX DRAWINGS LIGHT UP AND LEFT
|
||||
'\u2598', // ▘ 0x7E -> QUADRANT UPPER LEFT
|
||||
'\u259a', // ▚ 0x7F -> QUADRANT UPPER LEFT AND LOWER RIGHT
|
||||
'\ufffe', // 0x80 -> UNDEFINED
|
||||
'\ufffe', // 0x81 -> UNDEFINED
|
||||
'\ufffe', // 0x82 -> UNDEFINED
|
||||
'\ufffe', // 0x83 -> UNDEFINED
|
||||
'\ufffe', // 0x84 -> UNDEFINED
|
||||
'\ufffe', // 0x85 -> UNDEFINED
|
||||
'\ufffe', // 0x86 -> UNDEFINED
|
||||
'\ufffe', // 0x87 -> UNDEFINED
|
||||
'\ufffe', // 0x88 -> UNDEFINED
|
||||
'\ufffe', // 0x89 -> UNDEFINED
|
||||
'\ufffe', // 0x8A -> UNDEFINED
|
||||
'\ufffe', // 0x8B -> UNDEFINED
|
||||
'\ufffe', // 0x8C -> UNDEFINED
|
||||
'\ufffe', // 0x8D -> UNDEFINED
|
||||
'\ufffe', // 0x8E -> UNDEFINED
|
||||
'\ufffe', // 0x8F -> UNDEFINED
|
||||
'\ufffe', // 0x90 -> UNDEFINED
|
||||
'\ufffe', // 0x91 -> UNDEFINED
|
||||
'\ufffe', // 0x92 -> UNDEFINED
|
||||
'\ufffe', // 0x93 -> UNDEFINED
|
||||
'\ufffe', // 0x94 -> UNDEFINED
|
||||
'\ufffe', // 0x95 -> UNDEFINED
|
||||
'\ufffe', // 0x96 -> UNDEFINED
|
||||
'\ufffe', // 0x97 -> UNDEFINED
|
||||
'\ufffe', // 0x98 -> UNDEFINED
|
||||
'\ufffe', // 0x99 -> UNDEFINED
|
||||
'\ufffe', // 0x9A -> UNDEFINED
|
||||
'\ufffe', // 0x9B -> UNDEFINED
|
||||
'\ufffe', // 0x9C -> UNDEFINED
|
||||
'\ufffe', // 0x9D -> UNDEFINED
|
||||
'\ufffe', // 0x9E -> UNDEFINED
|
||||
'\ufffe', // 0x9F -> UNDEFINED
|
||||
'\ufffe', // 0xA0 -> UNDEFINED
|
||||
'\ufffe', // 0xA1 -> UNDEFINED
|
||||
'\ufffe', // 0xA2 -> UNDEFINED
|
||||
'\ufffe', // 0xA3 -> UNDEFINED
|
||||
'\ufffe', // 0xA4 -> UNDEFINED
|
||||
'\ufffe', // 0xA5 -> UNDEFINED
|
||||
'\ufffe', // 0xA6 -> UNDEFINED
|
||||
'\ufffe', // 0xA7 -> UNDEFINED
|
||||
'\ufffe', // 0xA8 -> UNDEFINED
|
||||
'\ufffe', // 0xA9 -> UNDEFINED
|
||||
'\ufffe', // 0xAA -> UNDEFINED
|
||||
'\ufffe', // 0xAB -> UNDEFINED
|
||||
'\ufffe', // 0xAC -> UNDEFINED
|
||||
'\ufffe', // 0xAD -> UNDEFINED
|
||||
'\ufffe', // 0xAE -> UNDEFINED
|
||||
'\ufffe', // 0xAF -> UNDEFINED
|
||||
'\ufffe', // 0xB0 -> UNDEFINED
|
||||
'\ufffe', // 0xB1 -> UNDEFINED
|
||||
'\ufffe', // 0xB2 -> UNDEFINED
|
||||
'\ufffe', // 0xB3 -> UNDEFINED
|
||||
'\ufffe', // 0xB4 -> UNDEFINED
|
||||
'\ufffe', // 0xB5 -> UNDEFINED
|
||||
'\ufffe', // 0xB6 -> UNDEFINED
|
||||
'\ufffe', // 0xB7 -> UNDEFINED
|
||||
'\ufffe', // 0xB8 -> UNDEFINED
|
||||
'\ufffe', // 0xB9 -> UNDEFINED
|
||||
'\ufffe', // 0xBA -> UNDEFINED
|
||||
'\ufffe', // 0xBB -> UNDEFINED
|
||||
'\ufffe', // 0xBC -> UNDEFINED
|
||||
'\ufffe', // 0xBD -> UNDEFINED
|
||||
'\ufffe', // 0xBE -> UNDEFINED
|
||||
'\ufffe', // 0xBF -> UNDEFINED
|
||||
'\ufffe', // 0xC0 -> UNDEFINED
|
||||
'\ufffe', // 0xC1 -> UNDEFINED
|
||||
'\ufffe', // 0xC2 -> UNDEFINED
|
||||
'\ufffe', // 0xC3 -> UNDEFINED
|
||||
'\ufffe', // 0xC4 -> UNDEFINED
|
||||
'\ufffe', // 0xC5 -> UNDEFINED
|
||||
'\ufffe', // 0xC6 -> UNDEFINED
|
||||
'\ufffe', // 0xC7 -> UNDEFINED
|
||||
'\ufffe', // 0xC8 -> UNDEFINED
|
||||
'\ufffe', // 0xC9 -> UNDEFINED
|
||||
'\ufffe', // 0xCA -> UNDEFINED
|
||||
'\ufffe', // 0xCB -> UNDEFINED
|
||||
'\ufffe', // 0xCC -> UNDEFINED
|
||||
'\ufffe', // 0xCD -> UNDEFINED
|
||||
'\ufffe', // 0xCE -> UNDEFINED
|
||||
'\ufffe', // 0xCF -> UNDEFINED
|
||||
'\ufffe', // 0xD0 -> UNDEFINED
|
||||
'\ufffe', // 0xD1 -> UNDEFINED
|
||||
'\ufffe', // 0xD2 -> UNDEFINED
|
||||
'\ufffe', // 0xD3 -> UNDEFINED
|
||||
'\ufffe', // 0xD4 -> UNDEFINED
|
||||
'\ufffe', // 0xD5 -> UNDEFINED
|
||||
'\ufffe', // 0xD6 -> UNDEFINED
|
||||
'\ufffe', // 0xD7 -> UNDEFINED
|
||||
'\ufffe', // 0xD8 -> UNDEFINED
|
||||
'\ufffe', // 0xD9 -> UNDEFINED
|
||||
'\ufffe', // 0xDA -> UNDEFINED
|
||||
'\ufffe', // 0xDB -> UNDEFINED
|
||||
'\ufffe', // 0xDC -> UNDEFINED
|
||||
'\ufffe', // 0xDD -> UNDEFINED
|
||||
'\ufffe', // 0xDE -> UNDEFINED
|
||||
'\ufffe', // 0xDF -> UNDEFINED
|
||||
'\ufffe', // 0xE0 -> UNDEFINED
|
||||
'\ufffe', // 0xE1 -> UNDEFINED
|
||||
'\ufffe', // 0xE2 -> UNDEFINED
|
||||
'\ufffe', // 0xE3 -> UNDEFINED
|
||||
'\ufffe', // 0xE4 -> UNDEFINED
|
||||
'\ufffe', // 0xE5 -> UNDEFINED
|
||||
'\ufffe', // 0xE6 -> UNDEFINED
|
||||
'\ufffe', // 0xE7 -> UNDEFINED
|
||||
'\ufffe', // 0xE8 -> UNDEFINED
|
||||
'\ufffe', // 0xE9 -> UNDEFINED
|
||||
'\ufffe', // 0xEA -> UNDEFINED
|
||||
'\ufffe', // 0xEB -> UNDEFINED
|
||||
'\ufffe', // 0xEC -> UNDEFINED
|
||||
'\ufffe', // 0xED -> UNDEFINED
|
||||
'\ufffe', // 0xEE -> UNDEFINED
|
||||
'\ufffe', // 0xEF -> UNDEFINED
|
||||
'\ufffe', // 0xF0 -> UNDEFINED
|
||||
'\ufffe', // 0xF1 -> UNDEFINED
|
||||
'\ufffe', // 0xF2 -> UNDEFINED
|
||||
'\ufffe', // 0xF3 -> UNDEFINED
|
||||
'\ufffe', // 0xF4 -> UNDEFINED
|
||||
'\ufffe', // 0xF5 -> UNDEFINED
|
||||
'\ufffe', // 0xF6 -> UNDEFINED
|
||||
'\ufffe', // 0xF7 -> UNDEFINED
|
||||
'\ufffe', // 0xF8 -> UNDEFINED
|
||||
'\ufffe', // 0xF9 -> UNDEFINED
|
||||
'\ufffe', // 0xFA -> UNDEFINED
|
||||
'\ufffe', // 0xFB -> UNDEFINED
|
||||
'\ufffe', // 0xFC -> UNDEFINED
|
||||
'\ufffe', // 0xFD -> UNDEFINED
|
||||
'\ufffe', // 0xFE -> UNDEFINED
|
||||
'\ufffe' // 0xFF -> UNDEFINED
|
||||
)
|
||||
|
||||
private val decodingScreencodeUppercase = arrayOf(
|
||||
'@' , // @ 0x00 -> COMMERCIAL AT
|
||||
'A' , // A 0x01 -> LATIN CAPITAL LETTER A
|
||||
'B' , // B 0x02 -> LATIN CAPITAL LETTER B
|
||||
'C' , // C 0x03 -> LATIN CAPITAL LETTER C
|
||||
'D' , // D 0x04 -> LATIN CAPITAL LETTER D
|
||||
'E' , // E 0x05 -> LATIN CAPITAL LETTER E
|
||||
'F' , // F 0x06 -> LATIN CAPITAL LETTER F
|
||||
'G' , // G 0x07 -> LATIN CAPITAL LETTER G
|
||||
'H' , // H 0x08 -> LATIN CAPITAL LETTER H
|
||||
'I' , // I 0x09 -> LATIN CAPITAL LETTER I
|
||||
'J' , // J 0x0A -> LATIN CAPITAL LETTER J
|
||||
'K' , // K 0x0B -> LATIN CAPITAL LETTER K
|
||||
'L' , // L 0x0C -> LATIN CAPITAL LETTER L
|
||||
'M' , // M 0x0D -> LATIN CAPITAL LETTER M
|
||||
'N' , // N 0x0E -> LATIN CAPITAL LETTER N
|
||||
'O' , // O 0x0F -> LATIN CAPITAL LETTER O
|
||||
'P' , // P 0x10 -> LATIN CAPITAL LETTER P
|
||||
'Q' , // Q 0x11 -> LATIN CAPITAL LETTER Q
|
||||
'R' , // R 0x12 -> LATIN CAPITAL LETTER R
|
||||
'S' , // S 0x13 -> LATIN CAPITAL LETTER S
|
||||
'T' , // T 0x14 -> LATIN CAPITAL LETTER T
|
||||
'U' , // U 0x15 -> LATIN CAPITAL LETTER U
|
||||
'V' , // V 0x16 -> LATIN CAPITAL LETTER V
|
||||
'W' , // W 0x17 -> LATIN CAPITAL LETTER W
|
||||
'X' , // X 0x18 -> LATIN CAPITAL LETTER X
|
||||
'Y' , // Y 0x19 -> LATIN CAPITAL LETTER Y
|
||||
'Z' , // Z 0x1A -> LATIN CAPITAL LETTER Z
|
||||
'[' , // [ 0x1B -> LEFT SQUARE BRACKET
|
||||
'\u00a3', // £ 0x1C -> POUND SIGN
|
||||
']' , // ] 0x1D -> RIGHT SQUARE BRACKET
|
||||
'\u2191', // ↑ 0x1E -> UPWARDS ARROW
|
||||
'\u2190', // ← 0x1F -> LEFTWARDS ARROW
|
||||
' ' , // 0x20 -> SPACE
|
||||
'!' , // ! 0x21 -> EXCLAMATION MARK
|
||||
'"' , // " 0x22 -> QUOTATION MARK
|
||||
'#' , // # 0x23 -> NUMBER SIGN
|
||||
'$' , // $ 0x24 -> DOLLAR SIGN
|
||||
'%' , // % 0x25 -> PERCENT SIGN
|
||||
'&' , // & 0x26 -> AMPERSAND
|
||||
'\'' , // ' 0x27 -> APOSTROPHE
|
||||
'(' , // ( 0x28 -> LEFT PARENTHESIS
|
||||
')' , // ) 0x29 -> RIGHT PARENTHESIS
|
||||
'*' , // * 0x2A -> ASTERISK
|
||||
'+' , // + 0x2B -> PLUS SIGN
|
||||
',' , // , 0x2C -> COMMA
|
||||
'-' , // - 0x2D -> HYPHEN-MINUS
|
||||
'.' , // . 0x2E -> FULL STOP
|
||||
'/' , // / 0x2F -> SOLIDUS
|
||||
'0' , // 0 0x30 -> DIGIT ZERO
|
||||
'1' , // 1 0x31 -> DIGIT ONE
|
||||
'2' , // 2 0x32 -> DIGIT TWO
|
||||
'3' , // 3 0x33 -> DIGIT THREE
|
||||
'4' , // 4 0x34 -> DIGIT FOUR
|
||||
'5' , // 5 0x35 -> DIGIT FIVE
|
||||
'6' , // 6 0x36 -> DIGIT SIX
|
||||
'7' , // 7 0x37 -> DIGIT SEVEN
|
||||
'8' , // 8 0x38 -> DIGIT EIGHT
|
||||
'9' , // 9 0x39 -> DIGIT NINE
|
||||
':' , // : 0x3A -> COLON
|
||||
';' , // ; 0x3B -> SEMICOLON
|
||||
'<' , // < 0x3C -> LESS-THAN SIGN
|
||||
'=' , // = 0x3D -> EQUALS SIGN
|
||||
'>' , // > 0x3E -> GREATER-THAN SIGN
|
||||
'?' , // ? 0x3F -> QUESTION MARK
|
||||
'\u2500', // ─ 0x40 -> BOX DRAWINGS LIGHT HORIZONTAL
|
||||
'\u2660', // ♠ 0x41 -> BLACK SPADE SUIT
|
||||
'\u2502', // │ 0x42 -> BOX DRAWINGS LIGHT VERTICAL
|
||||
'\u2500', // ─ 0x43 -> BOX DRAWINGS LIGHT HORIZONTAL
|
||||
'\uf122', // 0x44 -> BOX DRAWINGS LIGHT HORIZONTAL ONE QUARTER UP (CUS)
|
||||
'\uf123', // 0x45 -> BOX DRAWINGS LIGHT HORIZONTAL TWO QUARTERS UP (CUS)
|
||||
'\uf124', // 0x46 -> BOX DRAWINGS LIGHT HORIZONTAL ONE QUARTER DOWN (CUS)
|
||||
'\uf126', // 0x47 -> BOX DRAWINGS LIGHT VERTICAL ONE QUARTER LEFT (CUS)
|
||||
'\uf128', // 0x48 -> BOX DRAWINGS LIGHT VERTICAL ONE QUARTER RIGHT (CUS)
|
||||
'\u256e', // ╮ 0x49 -> BOX DRAWINGS LIGHT ARC DOWN AND LEFT
|
||||
'\u2570', // ╰ 0x4A -> BOX DRAWINGS LIGHT ARC UP AND RIGHT
|
||||
'\u256f', // ╯ 0x4B -> BOX DRAWINGS LIGHT ARC UP AND LEFT
|
||||
'\uf12a', // 0x4C -> ONE EIGHTH BLOCK UP AND RIGHT (CUS)
|
||||
'\u2572', // ╲ 0x4D -> BOX DRAWINGS LIGHT DIAGONAL UPPER LEFT TO LOWER RIGHT
|
||||
'\u2571', // ╱ 0x4E -> BOX DRAWINGS LIGHT DIAGONAL UPPER RIGHT TO LOWER LEFT
|
||||
'\uf12b', // 0x4F -> ONE EIGHTH BLOCK DOWN AND RIGHT (CUS)
|
||||
'\uf12c', // 0x50 -> ONE EIGHTH BLOCK DOWN AND LEFT (CUS)
|
||||
'\u25cf', // ● 0x51 -> BLACK CIRCLE
|
||||
'\uf125', // 0x52 -> BOX DRAWINGS LIGHT HORIZONTAL TWO QUARTERS DOWN (CUS)
|
||||
'\u2665', // ♥ 0x53 -> BLACK HEART SUIT
|
||||
'\uf127', // 0x54 -> BOX DRAWINGS LIGHT VERTICAL TWO QUARTERS LEFT (CUS)
|
||||
'\u256d', // ╭ 0x55 -> BOX DRAWINGS LIGHT ARC DOWN AND RIGHT
|
||||
'\u2573', // ╳ 0x56 -> BOX DRAWINGS LIGHT DIAGONAL CROSS
|
||||
'\u25cb', // ○ 0x57 -> WHITE CIRCLE
|
||||
'\u2663', // ♣ 0x58 -> BLACK CLUB SUIT
|
||||
'\uf129', // 0x59 -> BOX DRAWINGS LIGHT VERTICAL TWO QUARTERS RIGHT (CUS)
|
||||
'\u2666', // ♦ 0x5A -> BLACK DIAMOND SUIT
|
||||
'\u253c', // ┼ 0x5B -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
|
||||
'\uf12e', // 0x5C -> LEFT HALF BLOCK MEDIUM SHADE (CUS)
|
||||
'\u2502', // │ 0x5D -> BOX DRAWINGS LIGHT VERTICAL
|
||||
'\u03c0', // π 0x5E -> GREEK SMALL LETTER PI
|
||||
'\u25e5', // ◥ 0x5F -> BLACK UPPER RIGHT TRIANGLE
|
||||
'\u00a0', // 0x60 -> NO-BREAK SPACE
|
||||
'\u258c', // ▌ 0x61 -> LEFT HALF BLOCK
|
||||
'\u2584', // ▄ 0x62 -> LOWER HALF BLOCK
|
||||
'\u2594', // ▔ 0x63 -> UPPER ONE EIGHTH BLOCK
|
||||
'\u2581', // ▁ 0x64 -> LOWER ONE EIGHTH BLOCK
|
||||
'\u258f', // ▏ 0x65 -> LEFT ONE EIGHTH BLOCK
|
||||
'\u2592', // ▒ 0x66 -> MEDIUM SHADE
|
||||
'\u2595', // ▕ 0x67 -> RIGHT ONE EIGHTH BLOCK
|
||||
'\uf12f', // 0x68 -> LOWER HALF BLOCK MEDIUM SHADE (CUS)
|
||||
'\u25e4', // ◤ 0x69 -> BLACK UPPER LEFT TRIANGLE
|
||||
'\uf130', // 0x6A -> RIGHT ONE QUARTER BLOCK (CUS)
|
||||
'\u251c', // ├ 0x6B -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
|
||||
'\u2597', // ▗ 0x6C -> QUADRANT LOWER RIGHT
|
||||
'\u2514', // └ 0x6D -> BOX DRAWINGS LIGHT UP AND RIGHT
|
||||
'\u2510', // ┐ 0x6E -> BOX DRAWINGS LIGHT DOWN AND LEFT
|
||||
'\u2582', // ▂ 0x6F -> LOWER ONE QUARTER BLOCK
|
||||
'\u250c', // ┌ 0x70 -> BOX DRAWINGS LIGHT DOWN AND RIGHT
|
||||
'\u2534', // ┴ 0x71 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
|
||||
'\u252c', // ┬ 0x72 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
|
||||
'\u2524', // ┤ 0x73 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
|
||||
'\u258e', // ▎ 0x74 -> LEFT ONE QUARTER BLOCK
|
||||
'\u258d', // ▍ 0x75 -> LEFT THREE EIGTHS BLOCK
|
||||
'\uf131', // 0x76 -> RIGHT THREE EIGHTHS BLOCK (CUS)
|
||||
'\uf132', // 0x77 -> UPPER ONE QUARTER BLOCK (CUS)
|
||||
'\uf133', // 0x78 -> UPPER THREE EIGHTS BLOCK (CUS)
|
||||
'\u2583', // ▃ 0x79 -> LOWER THREE EIGHTHS BLOCK
|
||||
'\uf12d', // 0x7A -> ONE EIGHTH BLOCK UP AND LEFT (CUS)
|
||||
'\u2596', // ▖ 0x7B -> QUADRANT LOWER LEFT
|
||||
'\u259d', // ▝ 0x7C -> QUADRANT UPPER RIGHT
|
||||
'\u2518', // ┘ 0x7D -> BOX DRAWINGS LIGHT UP AND LEFT
|
||||
'\u2598', // ▘ 0x7E -> QUADRANT UPPER LEFT
|
||||
'\u259a', // ▚ 0x7F -> QUADRANT UPPER LEFT AND LOWER RIGHT
|
||||
'\ufffe', // 0x80 -> UNDEFINED
|
||||
'\ufffe', // 0x81 -> UNDEFINED
|
||||
'\ufffe', // 0x82 -> UNDEFINED
|
||||
'\ufffe', // 0x83 -> UNDEFINED
|
||||
'\ufffe', // 0x84 -> UNDEFINED
|
||||
'\ufffe', // 0x85 -> UNDEFINED
|
||||
'\ufffe', // 0x86 -> UNDEFINED
|
||||
'\ufffe', // 0x87 -> UNDEFINED
|
||||
'\ufffe', // 0x88 -> UNDEFINED
|
||||
'\ufffe', // 0x89 -> UNDEFINED
|
||||
'\ufffe', // 0x8A -> UNDEFINED
|
||||
'\ufffe', // 0x8B -> UNDEFINED
|
||||
'\ufffe', // 0x8C -> UNDEFINED
|
||||
'\ufffe', // 0x8D -> UNDEFINED
|
||||
'\ufffe', // 0x8E -> UNDEFINED
|
||||
'\ufffe', // 0x8F -> UNDEFINED
|
||||
'\ufffe', // 0x90 -> UNDEFINED
|
||||
'\ufffe', // 0x91 -> UNDEFINED
|
||||
'\ufffe', // 0x92 -> UNDEFINED
|
||||
'\ufffe', // 0x93 -> UNDEFINED
|
||||
'\ufffe', // 0x94 -> UNDEFINED
|
||||
'\ufffe', // 0x95 -> UNDEFINED
|
||||
'\ufffe', // 0x96 -> UNDEFINED
|
||||
'\ufffe', // 0x97 -> UNDEFINED
|
||||
'\ufffe', // 0x98 -> UNDEFINED
|
||||
'\ufffe', // 0x99 -> UNDEFINED
|
||||
'\ufffe', // 0x9A -> UNDEFINED
|
||||
'\ufffe', // 0x9B -> UNDEFINED
|
||||
'\ufffe', // 0x9C -> UNDEFINED
|
||||
'\ufffe', // 0x9D -> UNDEFINED
|
||||
'\ufffe', // 0x9E -> UNDEFINED
|
||||
'\ufffe', // 0x9F -> UNDEFINED
|
||||
'\ufffe', // 0xA0 -> UNDEFINED
|
||||
'\ufffe', // 0xA1 -> UNDEFINED
|
||||
'\ufffe', // 0xA2 -> UNDEFINED
|
||||
'\ufffe', // 0xA3 -> UNDEFINED
|
||||
'\ufffe', // 0xA4 -> UNDEFINED
|
||||
'\ufffe', // 0xA5 -> UNDEFINED
|
||||
'\ufffe', // 0xA6 -> UNDEFINED
|
||||
'\ufffe', // 0xA7 -> UNDEFINED
|
||||
'\ufffe', // 0xA8 -> UNDEFINED
|
||||
'\ufffe', // 0xA9 -> UNDEFINED
|
||||
'\ufffe', // 0xAA -> UNDEFINED
|
||||
'\ufffe', // 0xAB -> UNDEFINED
|
||||
'\ufffe', // 0xAC -> UNDEFINED
|
||||
'\ufffe', // 0xAD -> UNDEFINED
|
||||
'\ufffe', // 0xAE -> UNDEFINED
|
||||
'\ufffe', // 0xAF -> UNDEFINED
|
||||
'\ufffe', // 0xB0 -> UNDEFINED
|
||||
'\ufffe', // 0xB1 -> UNDEFINED
|
||||
'\ufffe', // 0xB2 -> UNDEFINED
|
||||
'\ufffe', // 0xB3 -> UNDEFINED
|
||||
'\ufffe', // 0xB4 -> UNDEFINED
|
||||
'\ufffe', // 0xB5 -> UNDEFINED
|
||||
'\ufffe', // 0xB6 -> UNDEFINED
|
||||
'\ufffe', // 0xB7 -> UNDEFINED
|
||||
'\ufffe', // 0xB8 -> UNDEFINED
|
||||
'\ufffe', // 0xB9 -> UNDEFINED
|
||||
'\ufffe', // 0xBA -> UNDEFINED
|
||||
'\ufffe', // 0xBB -> UNDEFINED
|
||||
'\ufffe', // 0xBC -> UNDEFINED
|
||||
'\ufffe', // 0xBD -> UNDEFINED
|
||||
'\ufffe', // 0xBE -> UNDEFINED
|
||||
'\ufffe', // 0xBF -> UNDEFINED
|
||||
'\ufffe', // 0xC0 -> UNDEFINED
|
||||
'\ufffe', // 0xC1 -> UNDEFINED
|
||||
'\ufffe', // 0xC2 -> UNDEFINED
|
||||
'\ufffe', // 0xC3 -> UNDEFINED
|
||||
'\ufffe', // 0xC4 -> UNDEFINED
|
||||
'\ufffe', // 0xC5 -> UNDEFINED
|
||||
'\ufffe', // 0xC6 -> UNDEFINED
|
||||
'\ufffe', // 0xC7 -> UNDEFINED
|
||||
'\ufffe', // 0xC8 -> UNDEFINED
|
||||
'\ufffe', // 0xC9 -> UNDEFINED
|
||||
'\ufffe', // 0xCA -> UNDEFINED
|
||||
'\ufffe', // 0xCB -> UNDEFINED
|
||||
'\ufffe', // 0xCC -> UNDEFINED
|
||||
'\ufffe', // 0xCD -> UNDEFINED
|
||||
'\ufffe', // 0xCE -> UNDEFINED
|
||||
'\ufffe', // 0xCF -> UNDEFINED
|
||||
'\ufffe', // 0xD0 -> UNDEFINED
|
||||
'\ufffe', // 0xD1 -> UNDEFINED
|
||||
'\ufffe', // 0xD2 -> UNDEFINED
|
||||
'\ufffe', // 0xD3 -> UNDEFINED
|
||||
'\ufffe', // 0xD4 -> UNDEFINED
|
||||
'\ufffe', // 0xD5 -> UNDEFINED
|
||||
'\ufffe', // 0xD6 -> UNDEFINED
|
||||
'\ufffe', // 0xD7 -> UNDEFINED
|
||||
'\ufffe', // 0xD8 -> UNDEFINED
|
||||
'\ufffe', // 0xD9 -> UNDEFINED
|
||||
'\ufffe', // 0xDA -> UNDEFINED
|
||||
'\ufffe', // 0xDB -> UNDEFINED
|
||||
'\ufffe', // 0xDC -> UNDEFINED
|
||||
'\ufffe', // 0xDD -> UNDEFINED
|
||||
'\ufffe', // 0xDE -> UNDEFINED
|
||||
'\ufffe', // 0xDF -> UNDEFINED
|
||||
'\ufffe', // 0xE0 -> UNDEFINED
|
||||
'\ufffe', // 0xE1 -> UNDEFINED
|
||||
'\ufffe', // 0xE2 -> UNDEFINED
|
||||
'\ufffe', // 0xE3 -> UNDEFINED
|
||||
'\ufffe', // 0xE4 -> UNDEFINED
|
||||
'\ufffe', // 0xE5 -> UNDEFINED
|
||||
'\ufffe', // 0xE6 -> UNDEFINED
|
||||
'\ufffe', // 0xE7 -> UNDEFINED
|
||||
'\ufffe', // 0xE8 -> UNDEFINED
|
||||
'\ufffe', // 0xE9 -> UNDEFINED
|
||||
'\ufffe', // 0xEA -> UNDEFINED
|
||||
'\ufffe', // 0xEB -> UNDEFINED
|
||||
'\ufffe', // 0xEC -> UNDEFINED
|
||||
'\ufffe', // 0xED -> UNDEFINED
|
||||
'\ufffe', // 0xEE -> UNDEFINED
|
||||
'\ufffe', // 0xEF -> UNDEFINED
|
||||
'\ufffe', // 0xF0 -> UNDEFINED
|
||||
'\ufffe', // 0xF1 -> UNDEFINED
|
||||
'\ufffe', // 0xF2 -> UNDEFINED
|
||||
'\ufffe', // 0xF3 -> UNDEFINED
|
||||
'\ufffe', // 0xF4 -> UNDEFINED
|
||||
'\ufffe', // 0xF5 -> UNDEFINED
|
||||
'\ufffe', // 0xF6 -> UNDEFINED
|
||||
'\ufffe', // 0xF7 -> UNDEFINED
|
||||
'\ufffe', // 0xF8 -> UNDEFINED
|
||||
'\ufffe', // 0xF9 -> UNDEFINED
|
||||
'\ufffe', // 0xFA -> UNDEFINED
|
||||
'\ufffe', // 0xFB -> UNDEFINED
|
||||
'\ufffe', // 0xFC -> UNDEFINED
|
||||
'\ufffe', // 0xFD -> UNDEFINED
|
||||
'\ufffe', // 0xFE -> UNDEFINED
|
||||
'\ufffe' // 0xFF -> UNDEFINED
|
||||
)
|
||||
|
||||
// encoding: from unicode to Petscii/Screencodes (0-255)
|
||||
private val encodingPetsciiLowercase = decodingPetsciiLowercase.withIndex().associate{it.value to it.index}
|
||||
private val encodingPetsciiUppercase = decodingPetsciiUppercase.withIndex().associate{it.value to it.index}
|
||||
private val encodingScreencodeLowercase = decodingScreencodeLowercase.withIndex().associate{it.value to it.index}
|
||||
private val encodingScreencodeUppercase = decodingScreencodeUppercase.withIndex().associate{it.value to it.index}
|
||||
|
||||
|
||||
fun encodePetscii(text: String, lowercase: Boolean = false): List<Short> {
|
||||
|
@ -1062,60 +542,4 @@ object Petscii {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun decodePetscii(petscii: Iterable<Short>, lowercase: Boolean = false): String {
|
||||
val decodeTable = if(lowercase) decodingPetsciiLowercase else decodingPetsciiUppercase
|
||||
return petscii.map { decodeTable[it.toInt()] }.joinToString("")
|
||||
}
|
||||
|
||||
fun encodeScreencode(text: String, lowercase: Boolean = false): List<Short> {
|
||||
val lookup = if(lowercase) encodingScreencodeLowercase else encodingScreencodeUppercase
|
||||
return text.map{
|
||||
val screencode = lookup[it]
|
||||
screencode?.toShort() ?: if(it=='\u0000')
|
||||
0.toShort()
|
||||
else {
|
||||
val case = if (lowercase) "lower" else "upper"
|
||||
throw CharConversionException("no ${case}Screencode character for '$it'")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun decodeScreencode(screencode: Iterable<Short>, lowercase: Boolean = false): String {
|
||||
val decodeTable = if(lowercase) decodingScreencodeLowercase else decodingScreencodeUppercase
|
||||
return screencode.map { decodeTable[it.toInt()] }.joinToString("")
|
||||
}
|
||||
|
||||
fun petscii2scr(petscii_code: Short, inverseVideo: Boolean): Short {
|
||||
val code = when {
|
||||
petscii_code <= 0x1f -> petscii_code + 128
|
||||
petscii_code <= 0x3f -> petscii_code.toInt()
|
||||
petscii_code <= 0x5f -> petscii_code - 64
|
||||
petscii_code <= 0x7f -> petscii_code - 32
|
||||
petscii_code <= 0x9f -> petscii_code + 64
|
||||
petscii_code <= 0xbf -> petscii_code - 64
|
||||
petscii_code <= 0xfe -> petscii_code - 128
|
||||
petscii_code == 255.toShort() -> 95
|
||||
else -> throw CharConversionException("petscii code out of range")
|
||||
}
|
||||
if(inverseVideo)
|
||||
return (code or 0x80).toShort()
|
||||
return code.toShort()
|
||||
}
|
||||
|
||||
fun scr2petscii(screencode: Short): Short {
|
||||
val petscii = when {
|
||||
screencode <= 0x1f -> screencode + 64
|
||||
screencode <= 0x3f -> screencode.toInt()
|
||||
screencode <= 0x5d -> screencode +123
|
||||
screencode == 0x5e.toShort() -> 255
|
||||
screencode == 0x5f.toShort() -> 223
|
||||
screencode <= 0x7f -> screencode + 64
|
||||
screencode <= 0xbf -> screencode - 128
|
||||
screencode <= 0xfe -> screencode - 64
|
||||
screencode == 255.toShort() -> 191
|
||||
else -> throw CharConversionException("screencode out of range")
|
||||
}
|
||||
return petscii.toShort()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,12 +33,9 @@ class VicII(startAddress: Address, endAddress: Address): MemMappedComponent(star
|
|||
}
|
||||
|
||||
override fun get(address: Address): UByte {
|
||||
val register = (address - startAddress) and 63
|
||||
// println("VIC GET ${register.toString(16)}")
|
||||
return when(register) {
|
||||
return when(val register = (address - startAddress) and 63) {
|
||||
0x11 -> (0b00011011 or ((currentRasterLine and 0b100000000) ushr 1)).toShort()
|
||||
0x12 -> {
|
||||
// println(" read raster: $currentRasterLine")
|
||||
(currentRasterLine and 255).toShort()
|
||||
}
|
||||
0x19 -> interruptStatusRegisterD019.toShort()
|
||||
|
|
|
@ -17,9 +17,9 @@ import javax.swing.ImageIcon
|
|||
class C64Machine(title: String) : IVirtualMachine {
|
||||
|
||||
private val romsPath = Paths.get(expandUser("~/.vice/C64"))
|
||||
val chargenData = romsPath.resolve("chargen").toFile().readBytes()
|
||||
val basicData = romsPath.resolve("basic").toFile().readBytes()
|
||||
val kernalData = romsPath.resolve("kernal").toFile().readBytes()
|
||||
private val chargenData = romsPath.resolve("chargen").toFile().readBytes()
|
||||
private val basicData = romsPath.resolve("basic").toFile().readBytes()
|
||||
private val kernalData = romsPath.resolve("kernal").toFile().readBytes()
|
||||
|
||||
override val bus = Bus()
|
||||
override val cpu = Cpu6502(false)
|
||||
|
@ -50,7 +50,7 @@ class C64Machine(title: String) : IVirtualMachine {
|
|||
|
||||
private fun expandUser(path: String): String {
|
||||
if(path.startsWith("~" + File.separator)) {
|
||||
return System.getProperty("user.home") + path.substring(1);
|
||||
return System.getProperty("user.home") + path.substring(1)
|
||||
} else {
|
||||
throw UnsupportedOperationException("home dir expansion not implemented for other users")
|
||||
}
|
||||
|
|
|
@ -147,16 +147,16 @@ private class BitmapScreenPanel : JPanel() {
|
|||
}
|
||||
}
|
||||
|
||||
class DebugWindow(val vm: IVirtualMachine) : JFrame("debugger"), ActionListener {
|
||||
val cyclesTf = JTextField("00000000000000")
|
||||
val speedKhzTf = JTextField("0000000")
|
||||
val regAtf = JTextField("000")
|
||||
val regXtf = JTextField("000")
|
||||
val regYtf = JTextField("000")
|
||||
val regPCtf = JTextField("00000")
|
||||
val regSPtf = JTextField("000")
|
||||
val regPtf = JTextArea("NV-BDIZC\n000000000")
|
||||
val disassemTf = JTextField("00 00 00 lda (fffff),x")
|
||||
class DebugWindow(private val vm: IVirtualMachine) : JFrame("debugger"), ActionListener {
|
||||
private val cyclesTf = JTextField("00000000000000")
|
||||
internal val speedKhzTf = JTextField("0000000")
|
||||
private val regAtf = JTextField("000")
|
||||
private val regXtf = JTextField("000")
|
||||
private val regYtf = JTextField("000")
|
||||
private val regPCtf = JTextField("00000")
|
||||
private val regSPtf = JTextField("000")
|
||||
private val regPtf = JTextArea("NV-BDIZC\n000000000")
|
||||
private val disassemTf = JTextField("00 00 00 lda (fffff),x")
|
||||
private val pauseBt = JButton("Pause").also { it.actionCommand = "pause" }
|
||||
|
||||
init {
|
||||
|
|
|
@ -3,6 +3,7 @@ package razorvine.examplemachine
|
|||
import kotlin.concurrent.scheduleAtFixedRate
|
||||
import razorvine.ksim65.Bus
|
||||
import razorvine.ksim65.Cpu6502
|
||||
import razorvine.ksim65.IVirtualMachine
|
||||
import razorvine.ksim65.Version
|
||||
import razorvine.ksim65.components.*
|
||||
import javax.swing.ImageIcon
|
||||
|
@ -11,9 +12,9 @@ import javax.swing.ImageIcon
|
|||
* A virtual computer constructed from the various virtual components,
|
||||
* running the 6502 Enhanced Basic ROM.
|
||||
*/
|
||||
class EhBasicMachine(title: String) {
|
||||
val bus = Bus()
|
||||
val cpu = Cpu6502(false)
|
||||
class EhBasicMachine(title: String): IVirtualMachine {
|
||||
override val bus = Bus()
|
||||
override val cpu = Cpu6502(false)
|
||||
val ram = Ram(0x0000, 0xbfff)
|
||||
val rom = Rom(0xc000, 0xffff).also { it.load(javaClass.getResourceAsStream("/ehbasic_C000.bin").readAllBytes()) }
|
||||
|
||||
|
@ -37,9 +38,9 @@ class EhBasicMachine(title: String) {
|
|||
hostDisplay.start()
|
||||
}
|
||||
|
||||
var paused = false
|
||||
override var paused = false
|
||||
|
||||
fun stepInstruction() {
|
||||
override fun stepInstruction() {
|
||||
while (cpu.instrCycles > 0) bus.clock()
|
||||
bus.clock()
|
||||
while (cpu.instrCycles > 0) bus.clock()
|
||||
|
|
|
@ -48,7 +48,7 @@ class Display(
|
|||
private var charposY = 0
|
||||
private var pixelX = 0
|
||||
private var pixelY = 0
|
||||
private val charMatrix = Array<ShortArray>(charHeight) { ShortArray(charWidth) } // matrix[y][x] to access
|
||||
private val charMatrix = Array(charHeight) { ShortArray(charWidth) } // matrix[y][x] to access
|
||||
|
||||
override fun clock() {
|
||||
// if the system clock is synced to the display refresh,
|
||||
|
|
|
@ -2,7 +2,6 @@ package razorvine.ksim65.components
|
|||
|
||||
import java.io.File
|
||||
import java.io.InputStream
|
||||
import java.net.URL
|
||||
|
||||
/**
|
||||
* A RAM chip with read/write memory.
|
||||
|
|
Loading…
Reference in New Issue
Block a user