diff --git a/src/main/kotlin/razorvine/c64emu/Cia.kt b/src/main/kotlin/razorvine/c64emu/Cia.kt index b0f9f23..8e4e5eb 100644 --- a/src/main/kotlin/razorvine/c64emu/Cia.kt +++ b/src/main/kotlin/razorvine/c64emu/Cia.kt @@ -9,7 +9,7 @@ import java.awt.event.KeyEvent * Minimal simulation of the MOS 6526 CIA chip. * Depending on what CIA it is (1 or 2), some registers do different things on the C64. * This implementation provides a working keyboard matrix, TOD clock, and the essentials of the timer A and B. - * TODO: timer IRQ triggering, more timer control bits. + * TODO: timer IRQ triggering, more timer control bits. Validate that the timerA/B timing is cycle correct. */ class Cia(val number: Int, startAddress: Address, endAddress: Address) : MemMappedComponent(startAddress, endAddress) { private var ramBuffer = Array(endAddress - startAddress + 1) { 0 } diff --git a/src/main/kotlin/razorvine/c64emu/GUI.kt b/src/main/kotlin/razorvine/c64emu/GUI.kt index 9fbed43..af42c8c 100644 --- a/src/main/kotlin/razorvine/c64emu/GUI.kt +++ b/src/main/kotlin/razorvine/c64emu/GUI.kt @@ -84,8 +84,6 @@ private class BitmapScreenPanel(val chargenData: ByteArray, val ram: MemoryCompo } override fun paint(graphics: Graphics) { - fullscreenG2d.color=Color.RED - fullscreenG2d.drawLine(0,0,ScreenDefs.SCREEN_WIDTH+ScreenDefs.BORDER_SIZE*2, ScreenDefs.SCREEN_HEIGHT+ScreenDefs.BORDER_SIZE*2) // draw the background color fullscreenG2d.background = ScreenDefs.colorPalette[ram[0xd021].toInt() and 15] fullscreenG2d.clearRect(ScreenDefs.BORDER_SIZE, ScreenDefs.BORDER_SIZE, ScreenDefs.SCREEN_WIDTH, ScreenDefs.SCREEN_HEIGHT) @@ -116,6 +114,7 @@ private class BitmapScreenPanel(val chargenData: ByteArray, val ram: MemoryCompo for (y in 0 until height step ScreenDefs.DISPLAY_PIXEL_SCALING.toInt()) { g2d.drawLine(0, y, width, y) } + Toolkit.getDefaultToolkit().sync() } private fun redrawCharacters() { diff --git a/src/main/kotlin/razorvine/c64emu/c64Main.kt b/src/main/kotlin/razorvine/c64emu/c64Main.kt index e780b5a..7d8efcb 100644 --- a/src/main/kotlin/razorvine/c64emu/c64Main.kt +++ b/src/main/kotlin/razorvine/c64emu/c64Main.kt @@ -133,7 +133,7 @@ class C64Machine(title: String) : IVirtualMachine { val ext = it.extension.toUpperCase() val fileAndSize = Pair(it, it.length()) if (name.isEmpty()) - Pair("." + ext, "") to fileAndSize + Pair(".$ext", "") to fileAndSize else Pair(name, ext) to fileAndSize } diff --git a/src/main/kotlin/razorvine/examplemachines/GUI.kt b/src/main/kotlin/razorvine/examplemachines/GUI.kt index 4ab0643..d27d208 100644 --- a/src/main/kotlin/razorvine/examplemachines/GUI.kt +++ b/src/main/kotlin/razorvine/examplemachines/GUI.kt @@ -2,14 +2,14 @@ package razorvine.examplemachines import razorvine.ksim65.* import java.awt.* -import java.awt.image.BufferedImage -import javax.imageio.ImageIO -import javax.swing.event.MouseInputListener import java.awt.event.* +import java.awt.image.BufferedImage import java.io.File import java.lang.Integer.parseInt import java.util.* +import javax.imageio.ImageIO import javax.swing.* +import javax.swing.event.MouseInputListener /** @@ -87,9 +87,7 @@ private class BitmapScreenPanel : JPanel() { override fun paint(graphics: Graphics) { val g2d = graphics as Graphics2D - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF) - g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE) - g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC) + g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR) g2d.drawImage( image, 0, 0, (image.width * ScreenDefs.DISPLAY_PIXEL_SCALING).toInt(), (image.height * ScreenDefs.DISPLAY_PIXEL_SCALING).toInt(), null @@ -103,7 +101,7 @@ private class BitmapScreenPanel : JPanel() { g2d.fillRect(scx, scy, scw, sch) g2d.setPaintMode() } - + Toolkit.getDefaultToolkit().sync() } fun clearScreen() { diff --git a/src/main/kotlin/razorvine/examplemachines/ehBasicMain.kt b/src/main/kotlin/razorvine/examplemachines/ehBasicMain.kt index b73f1d2..526f0e3 100644 --- a/src/main/kotlin/razorvine/examplemachines/ehBasicMain.kt +++ b/src/main/kotlin/razorvine/examplemachines/ehBasicMain.kt @@ -27,8 +27,6 @@ class EhBasicMachine(title: String) { private var paused = false init { - hostDisplay.iconImage = ImageIcon(javaClass.getResource("/icon.png")).image - bus += display bus += keyboard bus += rom @@ -36,6 +34,7 @@ class EhBasicMachine(title: String) { bus += cpu bus.reset() + hostDisplay.iconImage = ImageIcon(javaClass.getResource("/icon.png")).image hostDisplay.isVisible = true hostDisplay.start(30) } diff --git a/src/main/kotlin/razorvine/examplemachines/machineMain.kt b/src/main/kotlin/razorvine/examplemachines/machineMain.kt index 556b53f..4836ae4 100644 --- a/src/main/kotlin/razorvine/examplemachines/machineMain.kt +++ b/src/main/kotlin/razorvine/examplemachines/machineMain.kt @@ -30,10 +30,6 @@ class VirtualMachine(title: String) : IVirtualMachine { private var paused = false init { - hostDisplay.iconImage = ImageIcon(javaClass.getResource("/icon.png")).image - debugWindow.iconImage = hostDisplay.iconImage - debugWindow.setLocation(hostDisplay.location.x + hostDisplay.width, hostDisplay.location.y) - ram[Cpu6502.RESET_vector] = 0x00 ram[Cpu6502.RESET_vector + 1] = 0x10 ram.loadPrg(javaClass.getResourceAsStream("/vmdemo.prg"), null) @@ -47,6 +43,9 @@ class VirtualMachine(title: String) : IVirtualMachine { bus += cpu bus.reset() + hostDisplay.iconImage = ImageIcon(javaClass.getResource("/icon.png")).image + debugWindow.iconImage = hostDisplay.iconImage + debugWindow.setLocation(hostDisplay.location.x + hostDisplay.width, hostDisplay.location.y) debugWindow.isVisible = true hostDisplay.isVisible = true hostDisplay.start(30)