mirror of
https://github.com/irmen/ksim65.git
synced 2024-06-17 16:29:29 +00:00
update kotlin version
This commit is contained in:
parent
6dc433417d
commit
6c73852b5e
|
@ -26,5 +26,10 @@
|
||||||
<option name="name" value="maven" />
|
<option name="name" value="maven" />
|
||||||
<option name="url" value="https://jitpack.io" />
|
<option name="url" value="https://jitpack.io" />
|
||||||
</remote-repository>
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="MavenRepo" />
|
||||||
|
<option name="name" value="MavenRepo" />
|
||||||
|
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
||||||
|
</remote-repository>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -1,2 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module external.linked.project.id="ksim65:main" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="net.razorvine" external.system.module.version="1.9" type="JAVA_MODULE" version="4" />
|
|
|
@ -6,13 +6,20 @@ import kotlin.math.max
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
// Apply the Kotlin JVM plugin to add support for Kotlin on the JVM.
|
// Apply the Kotlin JVM plugin to add support for Kotlin on the JVM.
|
||||||
kotlin("jvm") version "1.4.20"
|
kotlin("jvm") version "1.5.20"
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
application
|
application
|
||||||
id("org.jetbrains.dokka") version "0.10.0"
|
java
|
||||||
|
id("org.jetbrains.dokka") version "0.10.1"
|
||||||
id("com.jfrog.bintray") version "1.8.4"
|
id("com.jfrog.bintray") version "1.8.4"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
val versionProps = Properties().also {
|
val versionProps = Properties().also {
|
||||||
it.load(File("$projectDir/src/main/resources/version.properties").inputStream())
|
it.load(File("$projectDir/src/main/resources/version.properties").inputStream())
|
||||||
|
@ -22,15 +29,13 @@ allprojects {
|
||||||
base.archivesBaseName = "ksim65"
|
base.archivesBaseName = "ksim65"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
// Use jcenter for resolving dependencies.
|
|
||||||
// You can declare any Maven/Ivy/file repository here.
|
// You can declare any Maven/Ivy/file repository here.
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
mavenCentral()
|
||||||
maven("https://jitpack.io")
|
maven("https://jitpack.io")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// Align versions of all Kotlin components
|
// Align versions of all Kotlin components
|
||||||
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
|
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
|
||||||
|
@ -47,7 +52,7 @@ dependencies {
|
||||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.4.0")
|
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.4.0")
|
||||||
|
|
||||||
subprojects.forEach {
|
subprojects.forEach {
|
||||||
archives(it)
|
implementation(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,20 +84,20 @@ tasks {
|
||||||
val c64emuScript by tasks.registering(CreateStartScripts::class) {
|
val c64emuScript by tasks.registering(CreateStartScripts::class) {
|
||||||
outputDir = File(project.buildDir, "bin")
|
outputDir = File(project.buildDir, "bin")
|
||||||
applicationName = "c64emu"
|
applicationName = "c64emu"
|
||||||
mainClassName = "razorvine.c64emu.C64MainKt"
|
mainClass.set("razorvine.c64emu.C64MainKt")
|
||||||
classpath = project.tasks["jar"].outputs.files+project.configurations.runtimeClasspath.get()
|
classpath = project.tasks["jar"].outputs.files+project.configurations.runtimeClasspath.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
val ehbasicScript by tasks.registering(CreateStartScripts::class) {
|
val ehbasicScript by tasks.registering(CreateStartScripts::class) {
|
||||||
outputDir = File(project.buildDir, "bin")
|
outputDir = File(project.buildDir, "bin")
|
||||||
applicationName = "ehbasic"
|
applicationName = "ehbasic"
|
||||||
mainClassName = "razorvine.examplemachines.EhBasicMainKt"
|
mainClass.set("razorvine.examplemachines.EhBasicMainKt")
|
||||||
classpath = project.tasks["jar"].outputs.files+project.configurations.runtimeClasspath.get()
|
classpath = project.tasks["jar"].outputs.files+project.configurations.runtimeClasspath.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
application {
|
application {
|
||||||
applicationName = "ksim65vm"
|
applicationName = "ksim65vm"
|
||||||
mainClassName = "razorvine.examplemachines.MachineMainKt"
|
mainClass.set("razorvine.examplemachines.MachineMainKt")
|
||||||
applicationDistribution.into("bin") {
|
applicationDistribution.into("bin") {
|
||||||
from(c64emuScript, ehbasicScript)
|
from(c64emuScript, ehbasicScript)
|
||||||
fileMode = 493
|
fileMode = 493
|
||||||
|
@ -137,9 +142,9 @@ bintray {
|
||||||
it.vcsUrl = "https://github.com/irmen/ksim65.git"
|
it.vcsUrl = "https://github.com/irmen/ksim65.git"
|
||||||
it.setLabels("6502", "retro", "emulation", "c64")
|
it.setLabels("6502", "retro", "emulation", "c64")
|
||||||
it.githubRepo = it.vcsUrl
|
it.githubRepo = it.vcsUrl
|
||||||
it.version = VersionConfig().also {
|
it.version = VersionConfig().also { vc->
|
||||||
it.gpg = GpgConfig().also {
|
vc.gpg = GpgConfig().also { gpg->
|
||||||
it.sign = true
|
gpg.sign = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,3 +2,4 @@ org.gradle.caching=true
|
||||||
org.gradle.console=rich
|
org.gradle.console=rich
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
|
kotlin.code.style=official
|
||||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
2
gradlew
vendored
2
gradlew
vendored
|
@ -82,6 +82,7 @@ esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
@ -129,6 +130,7 @@ fi
|
||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
|
25
gradlew.bat
vendored
25
gradlew.bat
vendored
|
@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
@ -51,7 +54,7 @@ goto fail
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
@ -61,28 +64,14 @@ echo location of your Java installation.
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:init
|
|
||||||
@rem Get command-line arguments, handling Windows variants
|
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
|
|
||||||
:win9xME_args
|
|
||||||
@rem Slurp the command line arguments.
|
|
||||||
set CMD_LINE_ARGS=
|
|
||||||
set _SKIP=2
|
|
||||||
|
|
||||||
:win9xME_args_slurp
|
|
||||||
if "x%~1" == "x" goto execute
|
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
|
|
@ -87,7 +87,7 @@ class C64Machine(title: String) : IVirtualMachine {
|
||||||
val txttab = ram[0x2b]+256*ram[0x2c] // basic load address ($0801 usually)
|
val txttab = ram[0x2b]+256*ram[0x2c] // basic load address ($0801 usually)
|
||||||
val fnaddr = ram[0xbb]+256*ram[0xbc] // file name address
|
val fnaddr = ram[0xbb]+256*ram[0xbc] // file name address
|
||||||
return if (fnlen > 0) {
|
return if (fnlen > 0) {
|
||||||
val filename = (0 until fnlen).map { ram[fnaddr+it].toChar() }.joinToString("")
|
val filename = (0 until fnlen).map { ram[fnaddr+it].toInt().toChar() }.joinToString("")
|
||||||
val loadEndAddress = searchAndLoadFile(filename, fa, sa, txttab)
|
val loadEndAddress = searchAndLoadFile(filename, fa, sa, txttab)
|
||||||
if (loadEndAddress != null) {
|
if (loadEndAddress != null) {
|
||||||
ram[0x90] = 0 // status OK
|
ram[0x90] = 0 // status OK
|
||||||
|
@ -108,7 +108,7 @@ class C64Machine(title: String) : IVirtualMachine {
|
||||||
val fromAddr = ram[cpu.regA]+256*ram[cpu.regA+1]
|
val fromAddr = ram[cpu.regA]+256*ram[cpu.regA+1]
|
||||||
val endAddr = cpu.regX+256*cpu.regY
|
val endAddr = cpu.regX+256*cpu.regY
|
||||||
val data = (fromAddr..endAddr).map { ram[it].toByte() }.toByteArray()
|
val data = (fromAddr..endAddr).map { ram[it].toByte() }.toByteArray()
|
||||||
var filename = (0 until fnlen).map { ram[fnaddr+it].toChar() }.joinToString("").toLowerCase()
|
var filename = (0 until fnlen).map { ram[fnaddr+it].toInt().toChar() }.joinToString("").lowercase()
|
||||||
if (!filename.endsWith(".prg")) filename += ".prg"
|
if (!filename.endsWith(".prg")) filename += ".prg"
|
||||||
File(filename).outputStream().use {
|
File(filename).outputStream().use {
|
||||||
it.write(fromAddr and 0xff)
|
it.write(fromAddr and 0xff)
|
||||||
|
@ -133,13 +133,13 @@ class C64Machine(title: String) : IVirtualMachine {
|
||||||
"$" -> {
|
"$" -> {
|
||||||
// load the directory
|
// load the directory
|
||||||
val files = File(".").listFiles(FileFilter { it.isFile })!!.associate {
|
val files = File(".").listFiles(FileFilter { it.isFile })!!.associate {
|
||||||
val name = it.nameWithoutExtension.toUpperCase()
|
val name = it.nameWithoutExtension.uppercase()
|
||||||
val ext = it.extension.toUpperCase()
|
val ext = it.extension.uppercase()
|
||||||
val fileAndSize = Pair(it, it.length())
|
val fileAndSize = Pair(it, it.length())
|
||||||
if (name.isEmpty()) Pair(".$ext", "") to fileAndSize
|
if (name.isEmpty()) Pair(".$ext", "") to fileAndSize
|
||||||
else Pair(name, ext) to fileAndSize
|
else Pair(name, ext) to fileAndSize
|
||||||
}
|
}
|
||||||
val dirname = File(".").canonicalPath.substringAfterLast(File.separator).toUpperCase()
|
val dirname = File(".").canonicalPath.substringAfterLast(File.separator).uppercase()
|
||||||
val dirlisting = makeDirListing(dirname, files, basicLoadAddress)
|
val dirlisting = makeDirListing(dirname, files, basicLoadAddress)
|
||||||
ram.load(dirlisting, basicLoadAddress)
|
ram.load(dirlisting, basicLoadAddress)
|
||||||
return basicLoadAddress+dirlisting.size-1
|
return basicLoadAddress+dirlisting.size-1
|
||||||
|
@ -147,7 +147,7 @@ class C64Machine(title: String) : IVirtualMachine {
|
||||||
else -> {
|
else -> {
|
||||||
fun findHostFile(filename: String): String? {
|
fun findHostFile(filename: String): String? {
|
||||||
val file = File(".").listFiles(FileFilter { it.isFile })?.firstOrNull {
|
val file = File(".").listFiles(FileFilter { it.isFile })?.firstOrNull {
|
||||||
it.name.toUpperCase() == filename
|
it.name.uppercase() == filename
|
||||||
}
|
}
|
||||||
return file?.name
|
return file?.name
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ class C64Machine(title: String) : IVirtualMachine {
|
||||||
listing.add((address ushr 8).toShort())
|
listing.add((address ushr 8).toShort())
|
||||||
listing.add((lineNumber and 0xff).toShort())
|
listing.add((lineNumber and 0xff).toShort())
|
||||||
listing.add((lineNumber ushr 8).toShort())
|
listing.add((lineNumber ushr 8).toShort())
|
||||||
listing.addAll(line.map { it.toShort() })
|
listing.addAll(line.map { it.code.toShort() })
|
||||||
listing.add(0)
|
listing.add(0)
|
||||||
}
|
}
|
||||||
addLine(0, "\u0012\"${dirname.take(16).padEnd(16)}\" 00 2A")
|
addLine(0, "\u0012\"${dirname.take(16).padEnd(16)}\" 00 2A")
|
||||||
|
|
|
@ -32,7 +32,7 @@ private class BitmapScreenPanel : JPanel() {
|
||||||
private var cursorY: Int = 0
|
private var cursorY: Int = 0
|
||||||
private var cursorState: Boolean = false
|
private var cursorState: Boolean = false
|
||||||
private val screenFont = PsfFont("spleen-12x24") // nice fonts: sun12x22, iso01-12x22, ter-124b, spleen-12x24, default8x16
|
private val screenFont = PsfFont("spleen-12x24") // nice fonts: sun12x22, iso01-12x22, ter-124b, spleen-12x24, default8x16
|
||||||
private val PIXEL_SCALING: Double = if(screenFont.width <= 8) 1.5 else 1.0
|
private val pixelScaling: Double = if(screenFont.width <= 8) 1.5 else 1.0
|
||||||
private val screenFontImage: BufferedImage
|
private val screenFontImage: BufferedImage
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
@ -44,8 +44,8 @@ private class BitmapScreenPanel : JPanel() {
|
||||||
g2d = image.graphics as Graphics2D
|
g2d = image.graphics as Graphics2D
|
||||||
screenFontImage = screenFont.convertToImage(g2d, ScreenDefs.FG_COLOR)
|
screenFontImage = screenFont.convertToImage(g2d, ScreenDefs.FG_COLOR)
|
||||||
|
|
||||||
val size = Dimension((image.width*PIXEL_SCALING).toInt(),
|
val size = Dimension((image.width*pixelScaling).toInt(),
|
||||||
(image.height*PIXEL_SCALING).toInt())
|
(image.height*pixelScaling).toInt())
|
||||||
minimumSize = size
|
minimumSize = size
|
||||||
maximumSize = size
|
maximumSize = size
|
||||||
preferredSize = size
|
preferredSize = size
|
||||||
|
@ -58,13 +58,13 @@ private class BitmapScreenPanel : JPanel() {
|
||||||
override fun paint(graphics: Graphics) {
|
override fun paint(graphics: Graphics) {
|
||||||
val g2d = graphics as Graphics2D
|
val g2d = graphics as Graphics2D
|
||||||
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR)
|
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR)
|
||||||
g2d.drawImage(image, 0, 0, (image.width*PIXEL_SCALING).toInt(),
|
g2d.drawImage(image, 0, 0, (image.width*pixelScaling).toInt(),
|
||||||
(image.height*PIXEL_SCALING).toInt(), null)
|
(image.height*pixelScaling).toInt(), null)
|
||||||
if (cursorState) {
|
if (cursorState) {
|
||||||
val scx = (cursorX*PIXEL_SCALING*screenFont.width).toInt()
|
val scx = (cursorX*pixelScaling*screenFont.width).toInt()
|
||||||
val scy = (cursorY*PIXEL_SCALING*screenFont.height).toInt()
|
val scy = (cursorY*pixelScaling*screenFont.height).toInt()
|
||||||
val scw = (screenFont.width*PIXEL_SCALING).toInt()
|
val scw = (screenFont.width*pixelScaling).toInt()
|
||||||
val sch = (screenFont.height*PIXEL_SCALING).toInt()
|
val sch = (screenFont.height*pixelScaling).toInt()
|
||||||
g2d.setXORMode(Color.CYAN)
|
g2d.setXORMode(Color.CYAN)
|
||||||
g2d.fillRect(scx, scy, scw, sch)
|
g2d.fillRect(scx, scy, scw, sch)
|
||||||
g2d.setPaintMode()
|
g2d.setPaintMode()
|
||||||
|
@ -86,7 +86,7 @@ private class BitmapScreenPanel : JPanel() {
|
||||||
fun getPixel(x: Int, y: Int) = image.getRGB(x, y) != ScreenDefs.BG_COLOR.rgb
|
fun getPixel(x: Int, y: Int) = image.getRGB(x, y) != ScreenDefs.BG_COLOR.rgb
|
||||||
|
|
||||||
fun setChar(x: Int, y: Int, character: Char) {
|
fun setChar(x: Int, y: Int, character: Char) {
|
||||||
val charnum = character.toInt()
|
val charnum = character.code
|
||||||
val cx = charnum % (screenFontImage.width/screenFont.width)
|
val cx = charnum % (screenFontImage.width/screenFont.width)
|
||||||
val cy = charnum / (screenFontImage.width/screenFont.width)
|
val cy = charnum / (screenFontImage.width/screenFont.width)
|
||||||
g2d.clearRect(x*screenFont.width, y*screenFont.height, screenFont.width, screenFont.height)
|
g2d.clearRect(x*screenFont.width, y*screenFont.height, screenFont.width, screenFont.height)
|
||||||
|
@ -105,7 +105,7 @@ private class BitmapScreenPanel : JPanel() {
|
||||||
|
|
||||||
fun mousePixelPosition(): Point? {
|
fun mousePixelPosition(): Point? {
|
||||||
val pos = mousePosition ?: return null
|
val pos = mousePosition ?: return null
|
||||||
return Point((pos.x/PIXEL_SCALING).toInt(), (pos.y/PIXEL_SCALING).toInt())
|
return Point((pos.x/pixelScaling).toInt(), (pos.y/pixelScaling).toInt())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun cursorPos(x: Int, y: Int) {
|
fun cursorPos(x: Int, y: Int) {
|
||||||
|
|
|
@ -22,7 +22,7 @@ class PsfFont(name: String) {
|
||||||
private val rawBitmaps: List<ByteArray>
|
private val rawBitmaps: List<ByteArray>
|
||||||
|
|
||||||
init {
|
init {
|
||||||
var data = ByteArray(0)
|
val data: ByteArray
|
||||||
val fontsDirectory = "/usr/share/kbd/consolefonts"
|
val fontsDirectory = "/usr/share/kbd/consolefonts"
|
||||||
var stream = javaClass.getResourceAsStream("/charset/$name.psfu.gz") ?:
|
var stream = javaClass.getResourceAsStream("/charset/$name.psfu.gz") ?:
|
||||||
javaClass.getResourceAsStream("/charset/$name.psf.gz") ?:
|
javaClass.getResourceAsStream("/charset/$name.psf.gz") ?:
|
||||||
|
|
|
@ -87,7 +87,7 @@ class Assembler(cpu: Cpu6502, val memory: MemMappedComponent, initialStartAddres
|
||||||
}
|
}
|
||||||
|
|
||||||
val instructionSize: Int
|
val instructionSize: Int
|
||||||
val mnemonic = args[0].toLowerCase().trim()
|
val mnemonic = args[0].lowercase().trim()
|
||||||
when (args.size) {
|
when (args.size) {
|
||||||
1 -> {
|
1 -> {
|
||||||
// implied or acc
|
// implied or acc
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Monitor(val bus: Bus, val cpu: Cpu6502) {
|
||||||
val result = mutableListOf<String>()
|
val result = mutableListOf<String>()
|
||||||
for (addr in start until end step 16) {
|
for (addr in start until end step 16) {
|
||||||
result.add("m$${hexW(addr)} "+(0..15).joinToString(" ") { hexB(bus.read(addr+it)) }+" "+(0..15).joinToString("") {
|
result.add("m$${hexW(addr)} "+(0..15).joinToString(" ") { hexB(bus.read(addr+it)) }+" "+(0..15).joinToString("") {
|
||||||
val chr = bus.read(addr+it).toChar()
|
val chr = bus.read(addr+it).toInt().toChar()
|
||||||
if (chr.isLetterOrDigit()) chr.toString()
|
if (chr.isLetterOrDigit()) chr.toString()
|
||||||
else "."
|
else "."
|
||||||
})
|
})
|
||||||
|
@ -55,7 +55,7 @@ class Monitor(val bus: Bus, val cpu: Cpu6502) {
|
||||||
val result = mutableListOf<String>()
|
val result = mutableListOf<String>()
|
||||||
for (addr in start until end step 64) {
|
for (addr in start until end step 64) {
|
||||||
result.add("i$${hexW(addr)} "+(0..63).joinToString("") {
|
result.add("i$${hexW(addr)} "+(0..63).joinToString("") {
|
||||||
val chr = bus.read(addr+it).toChar()
|
val chr = bus.read(addr+it).toInt().toChar()
|
||||||
if (chr.isLetterOrDigit()) chr.toString()
|
if (chr.isLetterOrDigit()) chr.toString()
|
||||||
else "."
|
else "."
|
||||||
})
|
})
|
||||||
|
|
|
@ -45,7 +45,7 @@ abstract class MemMappedComponent(val startAddress: Address, val endAddress: Add
|
||||||
}
|
}
|
||||||
print(" ")
|
print(" ")
|
||||||
val chars = if (charmapper != null) bytes.map { b -> charmapper(b) }
|
val chars = if (charmapper != null) bytes.map { b -> charmapper(b) }
|
||||||
else bytes.map { b -> if (b in 32..255) b.toChar() else '.' }
|
else bytes.map { b -> if (b in 32..255) b.toInt().toChar() else '.' }
|
||||||
println(chars.joinToString(""))
|
println(chars.joinToString(""))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ class Display(startAddress: Address, endAddress: Address, private val host: IHos
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun reset() {
|
override fun reset() {
|
||||||
charMatrix.forEach { it.fill(' '.toShort()) }
|
charMatrix.forEach { it.fill(' '.code.toShort()) }
|
||||||
cursorX = 0
|
cursorX = 0
|
||||||
cursorY = 0
|
cursorY = 0
|
||||||
charposX = 0
|
charposX = 0
|
||||||
|
@ -94,7 +94,7 @@ class Display(startAddress: Address, endAddress: Address, private val host: IHos
|
||||||
0x02 -> {
|
0x02 -> {
|
||||||
if (charposY in 0 until charHeight && charposX in 0 until charWidth) {
|
if (charposY in 0 until charHeight && charposX in 0 until charWidth) {
|
||||||
charMatrix[charposY][charposX] = data
|
charMatrix[charposY][charposX] = data
|
||||||
host.setChar(charposX, charposY, data.toChar())
|
host.setChar(charposX, charposY, data.toInt().toChar())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
0x03 -> pixelX = (pixelX and 0xff00) or data.toInt()
|
0x03 -> pixelX = (pixelX and 0xff00) or data.toInt()
|
||||||
|
@ -121,7 +121,7 @@ class Display(startAddress: Address, endAddress: Address, private val host: IHos
|
||||||
cursorX = charWidth-1
|
cursorX = charWidth-1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
charMatrix[cursorY][cursorX] = ' '.toShort()
|
charMatrix[cursorY][cursorX] = ' '.code.toShort()
|
||||||
host.setChar(cursorX, cursorY, ' ')
|
host.setChar(cursorX, cursorY, ' ')
|
||||||
}
|
}
|
||||||
0x09 -> {
|
0x09 -> {
|
||||||
|
@ -142,7 +142,7 @@ class Display(startAddress: Address, endAddress: Address, private val host: IHos
|
||||||
else -> {
|
else -> {
|
||||||
// set character on screen
|
// set character on screen
|
||||||
charMatrix[cursorY][cursorX] = data
|
charMatrix[cursorY][cursorX] = data
|
||||||
host.setChar(cursorX, cursorY, data.toChar())
|
host.setChar(cursorX, cursorY, data.toInt().toChar())
|
||||||
cursorX++
|
cursorX++
|
||||||
if (cursorX >= charWidth) {
|
if (cursorX >= charWidth) {
|
||||||
cursorX = 0
|
cursorX = 0
|
||||||
|
@ -164,7 +164,7 @@ class Display(startAddress: Address, endAddress: Address, private val host: IHos
|
||||||
charMatrix[y+1].copyInto(charMatrix[y])
|
charMatrix[y+1].copyInto(charMatrix[y])
|
||||||
}
|
}
|
||||||
for (x in 0 until charWidth) {
|
for (x in 0 until charWidth) {
|
||||||
charMatrix[charHeight-1][x] = ' '.toShort()
|
charMatrix[charHeight-1][x] = ' '.code.toShort()
|
||||||
}
|
}
|
||||||
cursorY--
|
cursorY--
|
||||||
host.scrollUp()
|
host.scrollUp()
|
||||||
|
|
|
@ -25,7 +25,7 @@ class Keyboard(startAddress: Address, endAddress: Address, private val host: IHo
|
||||||
|
|
||||||
override operator fun get(offset: Int): UByte {
|
override operator fun get(offset: Int): UByte {
|
||||||
return when (offset) {
|
return when (offset) {
|
||||||
0x00 -> host.keyboard()?.toShort() ?: 0
|
0x00 -> host.keyboard()?.code?.toShort() ?: 0
|
||||||
else -> 0xff
|
else -> 0xff
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ class ParallelPort(startAddress: Address, endAddress: Address) : MemMappedCompon
|
||||||
if (offset == 0) dataByte = data
|
if (offset == 0) dataByte = data
|
||||||
else if (offset == 1) {
|
else if (offset == 1) {
|
||||||
if ((data.toInt() and 1) == 1) {
|
if ((data.toInt() and 1) == 1) {
|
||||||
val char = dataByte.toChar()
|
val char = dataByte.toInt().toChar()
|
||||||
println("PARALLEL WRITE: '$char'")
|
println("PARALLEL WRITE: '$char'")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import java.io.File
|
||||||
* A ROM chip (read-only memory).
|
* A ROM chip (read-only memory).
|
||||||
*/
|
*/
|
||||||
class Rom(startAddress: Address, endAddress: Address, initialData: Array<UByte>? = null) : MemoryComponent(startAddress, endAddress) {
|
class Rom(startAddress: Address, endAddress: Address, initialData: Array<UByte>? = null) : MemoryComponent(startAddress, endAddress) {
|
||||||
override val data: Array<UByte> = initialData?.copyOf() ?: Array<UByte>(endAddress-startAddress+1) { 0 }
|
override val data: Array<UByte> = initialData?.copyOf() ?: Array(endAddress-startAddress+1) { 0 }
|
||||||
|
|
||||||
init {
|
init {
|
||||||
require(endAddress-startAddress+1 == data.size) { "rom address range doesn't match size of data bytes" }
|
require(endAddress-startAddress+1 == data.size) { "rom address range doesn't match size of data bytes" }
|
||||||
|
|
|
@ -148,7 +148,7 @@ class Test6502CpuBasics {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun runBCDbeebTest(cpu: Cpu6502, testChoice: Char) {
|
private fun runBCDbeebTest(cpu: Cpu6502, testChoice: Char) {
|
||||||
// bcd test code from https://github.com/hoglet67/AtomSoftwareArchive/tree/master/tests/clark
|
// bcd test code from https://github.com/hoglet67/AtomSoftwareArchive/tree/master/tests/clark
|
||||||
val bus = Bus()
|
val bus = Bus()
|
||||||
bus.add(cpu)
|
bus.add(cpu)
|
||||||
|
@ -160,7 +160,7 @@ class Test6502CpuBasics {
|
||||||
}
|
}
|
||||||
cpu.addBreakpoint(0xffe0) { cpu, pc ->
|
cpu.addBreakpoint(0xffe0) { cpu, pc ->
|
||||||
// OSRDCH read character
|
// OSRDCH read character
|
||||||
cpu.regA = testChoice.toInt()
|
cpu.regA = testChoice.code
|
||||||
Cpu6502.BreakpointResultAction()
|
Cpu6502.BreakpointResultAction()
|
||||||
}
|
}
|
||||||
val ram = Ram(0, 0xffff)
|
val ram = Ram(0, 0xffff)
|
||||||
|
|
|
@ -50,7 +50,7 @@ abstract class TestCommon6502 {
|
||||||
abstract fun createCpu(): Cpu6502
|
abstract fun createCpu(): Cpu6502
|
||||||
|
|
||||||
init {
|
init {
|
||||||
mpu = createCpu()
|
mpu = this.createCpu()
|
||||||
bus.add(mpu)
|
bus.add(mpu)
|
||||||
bus.add(memory)
|
bus.add(memory)
|
||||||
memory.fill(0xaa)
|
memory.fill(0xaa)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user