1
0
mirror of https://github.com/irmen/ksim65.git synced 2024-06-06 22:29:33 +00:00

optimizing screen rendering a bit again

This commit is contained in:
Irmen de Jong 2019-10-05 15:14:26 +02:00
parent 708fc865a1
commit dd3bfa49e9
6 changed files with 12 additions and 17 deletions

View File

@ -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<UByte>(endAddress - startAddress + 1) { 0 }

View File

@ -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() {

View File

@ -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
}

View File

@ -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() {

View File

@ -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)
}

View File

@ -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)