diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
index 131e44d..ebd2e7b 100644
--- a/.idea/kotlinc.xml
+++ b/.idea/kotlinc.xml
@@ -1,6 +1,7 @@
-
+
+
\ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
index 7674f7f..bb376dc 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -4,7 +4,7 @@ import kotlin.math.max
plugins {
// Apply the Kotlin JVM plugin to add support for Kotlin on the JVM.
- kotlin("jvm") version "2.1.21"
+ kotlin("jvm") version "2.3.20"
// `maven-publish`
application
java
diff --git a/gradle.properties b/gradle.properties
index da410ff..4c7dce4 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -2,4 +2,5 @@ org.gradle.caching=true
org.gradle.console=rich
org.gradle.parallel=true
org.gradle.daemon=true
+org.gradle.configuration-cache=true
kotlin.code.style=official
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 9bbc975..d997cfc 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 37f853b..dbc3ce4 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/gradlew b/gradlew
index faf9300..f640dbc 100755
--- a/gradlew
+++ b/gradlew
@@ -1,7 +1,7 @@
#!/bin/sh
#
-# Copyright © 2015-2021 the original authors.
+# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
-# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# https://github.com/gradle/gradle/blob//platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -114,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -172,7 +171,6 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
- CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
@@ -212,8 +210,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
- -classpath "$CLASSPATH" \
- org.gradle.wrapper.GradleWrapperMain \
+ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
diff --git a/gradlew.bat b/gradlew.bat
index 9d21a21..c4bdd3a 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -70,11 +70,10 @@ goto fail
:execute
@rem Setup the command line
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
diff --git a/src/main/kotlin/razorvine/c64emu/c64Main.kt b/src/main/kotlin/razorvine/c64emu/c64Main.kt
index 980d275..965d346 100644
--- a/src/main/kotlin/razorvine/c64emu/c64Main.kt
+++ b/src/main/kotlin/razorvine/c64emu/c64Main.kt
@@ -7,7 +7,6 @@ import razorvine.ksim65.components.Ram
import razorvine.ksim65.components.Rom
import razorvine.ksim65.components.UByte
import java.io.File
-import java.io.FileFilter
import java.io.FileNotFoundException
import java.io.IOException
import java.nio.file.Path
@@ -132,7 +131,7 @@ class C64Machine(title: String) : IVirtualMachine {
}
"$" -> {
// load the directory
- val files = File(".").listFiles(FileFilter { it.isFile })!!.associate {
+ val files = File(".").listFiles { it.isFile }!!.associate {
val name = it.nameWithoutExtension.uppercase()
val ext = it.extension.uppercase()
val fileAndSize = Pair(it, it.length())
@@ -146,7 +145,7 @@ class C64Machine(title: String) : IVirtualMachine {
}
else -> {
fun findHostFile(filename: String): String? {
- val file = File(".").listFiles(FileFilter { it.isFile })?.firstOrNull {
+ val file = File(".").listFiles { it.isFile }?.firstOrNull {
it.name.uppercase() == filename
}
return file?.name
diff --git a/src/main/kotlin/razorvine/ksim65/Cpu6502.kt b/src/main/kotlin/razorvine/ksim65/Cpu6502.kt
index 714da9f..6febf5c 100644
--- a/src/main/kotlin/razorvine/ksim65/Cpu6502.kt
+++ b/src/main/kotlin/razorvine/ksim65/Cpu6502.kt
@@ -25,6 +25,7 @@ sealed class Cpu6502Core : BusComponent() {
const val IRQ_VECTOR = 0xfffe
}
+ @Suppress("PropertyName")
class StatusRegister(var C: Boolean = false, var Z: Boolean = false, var I: Boolean = false, var D: Boolean = false,
var B: Boolean = false, var V: Boolean = false, var N: Boolean = false) {
fun asInt(): Int {
@@ -74,6 +75,7 @@ sealed class Cpu6502Core : BusComponent() {
*/
class BreakpointResultAction(val changePC: Address? = null, val changeOpcode: Int? = null, val causeBRK: Boolean = false)
+ @Suppress("PropertyName")
class State(val A: UByte, val X: UByte, val Y: UByte, val SP: Address, val P: StatusRegister, val PC: Address, val cycles: Long) {
override fun toString(): String {
return "cycle:$cycles - pc=${hexW(PC)} "+"A=${hexB(A)} "+"X=${hexB(X)} "+"Y=${hexB(Y)} "+
diff --git a/src/test/kotlin/C64KernalStubs.kt b/src/test/kotlin/C64KernalStubs.kt
index 99a3889..92dc201 100644
--- a/src/test/kotlin/C64KernalStubs.kt
+++ b/src/test/kotlin/C64KernalStubs.kt
@@ -1,6 +1,5 @@
-import razorvine.ksim65.components.Address
-import razorvine.ksim65.Cpu6502
import razorvine.ksim65.Cpu6502Core
+import razorvine.ksim65.components.Address
import razorvine.ksim65.components.Ram
import razorvine.ksim65.hexW
@@ -41,7 +40,7 @@ class C64KernalStubs(private val ram: Ram) {
// cpu.PC = 0x0816 // continue in next module
}
else -> {
- TODO("unhandled kernel stub called \$${hexW(pc)}")
+ TODO("unhandled kernel stub called $${hexW(pc)}")
}
}
diff --git a/src/test/kotlin/FunctionalTestsBase.kt b/src/test/kotlin/FunctionalTestsBase.kt
index 3b41c24..1152346 100644
--- a/src/test/kotlin/FunctionalTestsBase.kt
+++ b/src/test/kotlin/FunctionalTestsBase.kt
@@ -39,11 +39,11 @@ abstract class FunctionalTestsBase {
tya
pha
tsx
- lda ${'$'}0104,x
- and #${'$'}10
+ lda $0104,x
+ and #$10
beq *+5
- jmp (${'$'}0316)
- jmp (${'$'}0314)
+ jmp ($0316)
+ jmp ($0314)
""".lines())
assertTrue(result.success)
@@ -66,9 +66,9 @@ abstract class FunctionalTestsBase {
fail("test hangs: " + cpu.snapshot())
} catch (e: Cpu6502Core.InstructionError) {
println(">>> INSTRUCTION ERROR: ${e.message}")
- } catch (le: KernalLoadNextPart) {
+ } catch (_: KernalLoadNextPart) {
return // test ok
- } catch (ie: KernalInputRequired) {
+ } catch (_: KernalInputRequired) {
fail("test failed")
}
fail("test failed")
diff --git a/src/test/kotlin/Test6502CpuBasics.kt b/src/test/kotlin/Test6502CpuBasics.kt
index acacc44..d2a2074 100644
--- a/src/test/kotlin/Test6502CpuBasics.kt
+++ b/src/test/kotlin/Test6502CpuBasics.kt
@@ -152,7 +152,7 @@ class Test6502CpuBasics {
// bcd test code from https://github.com/hoglet67/AtomSoftwareArchive/tree/master/tests/clark
val bus = Bus()
bus.add(cpu)
- cpu.breakpointForBRK = { _, pc -> fail("brk instruction at \$${hexW(pc)}") }
+ cpu.breakpointForBRK = { _, pc -> fail("brk instruction at $${hexW(pc)}") }
cpu.addBreakpoint(0xffee) { cpu2, pc ->
// OSWRCH write character
print("${cpu2.regA.toChar()}")
@@ -249,7 +249,7 @@ class Test6502CpuBasics {
cpu.step()
- val nesAddressHex = logline.substring(0, 4).toInt(16)
+ val nesAddressHex = logline.take(4).toInt(16)
assertEquals(nesAddressHex, tracingSnapshot.PC)
// println("NES: $logline")
diff --git a/src/test/kotlin/Test6502TestSuiteC64Specific.kt b/src/test/kotlin/Test6502TestSuiteC64Specific.kt
index 70f63c9..aef4648 100644
--- a/src/test/kotlin/Test6502TestSuiteC64Specific.kt
+++ b/src/test/kotlin/Test6502TestSuiteC64Specific.kt
@@ -63,11 +63,11 @@ class Test6502TestSuiteC64Specific {
tya
pha
tsx
- lda ${'$'}0104,x
- and #${'$'}10
+ lda $0104,x
+ and #$10
beq *+5
- jmp (${'$'}0316)
- jmp (${'$'}0314)
+ jmp ($0316)
+ jmp ($0314)
""".lines())
assertTrue(result.success)
@@ -92,9 +92,9 @@ class Test6502TestSuiteC64Specific {
fail("test hangs: " + cpu.snapshot())
} catch (e: Cpu6502Core.InstructionError) {
println(">>> INSTRUCTION ERROR: ${e.message}")
- } catch (le: KernalLoadNextPart) {
+ } catch (_: KernalLoadNextPart) {
return // test ok
- } catch (ie: KernalInputRequired) {
+ } catch (_: KernalInputRequired) {
fail("test failed")
}
fail("test failed")
diff --git a/src/test/kotlin/TestAssembler.kt b/src/test/kotlin/TestAssembler.kt
index 2d33b6f..2d091a2 100644
--- a/src/test/kotlin/TestAssembler.kt
+++ b/src/test/kotlin/TestAssembler.kt
@@ -11,7 +11,7 @@ class TestAssembler {
val ram = Ram(0, 0xffff)
val assembler = Assembler(cpu, ram)
- val result = assembler.assemble("${'$'}c000 jmp ${'$'}ea31")
+ val result = assembler.assemble($$"$c000 jmp $ea31")
assertTrue(result.success)
assertEquals("", result.error)
assertEquals(0xc000, result.startAddress)
@@ -26,10 +26,10 @@ class TestAssembler {
val cpu = Cpu6502()
val ram = Ram(0, 0xffff)
val assembler = Assembler(cpu, ram)
- val result = assembler.assemble("""
-*=${'$'}a2b3
+ val result = assembler.assemble($$"""
+*=$a2b3
nop
- jmp ${'$'}ea31
+ jmp $ea31
bne *-2
""".lines())
assertEquals("", result.error)
diff --git a/src/test/kotlin/TestDisassembler.kt b/src/test/kotlin/TestDisassembler.kt
index e95304c..54b3ac6 100644
--- a/src/test/kotlin/TestDisassembler.kt
+++ b/src/test/kotlin/TestDisassembler.kt
@@ -17,7 +17,7 @@ class TestDisassembler {
val result = disassembler.disassemble(memory.data, 0x1000..0x1221, 0)
assertEquals(256, result.first.size)
assertEquals(0x1222, result.second)
- assertEquals("\$1000 69 01 adc #\$01", result.first[0])
+ assertEquals($$"$1000 69 01 adc #$01", result.first[0])
val reference = javaClass.classLoader.getResource("disassem_ref_output.txt")?.readText()!!.trim().lines()
assertEquals(256, reference.size)
@@ -38,41 +38,41 @@ class TestDisassembler {
val disassem = disassembler.disassemble(memory.data, 0x0200..0x0250, 0)
assertEquals(0x251, disassem.second)
val result = disassem.first.joinToString("\n")
- assertEquals("""${'$'}0200 07 12 rmb0 ${'$'}12
-${'$'}0202 17 12 rmb1 ${'$'}12
-${'$'}0204 27 12 rmb2 ${'$'}12
-${'$'}0206 37 12 rmb3 ${'$'}12
-${'$'}0208 47 12 rmb4 ${'$'}12
-${'$'}020a 57 12 rmb5 ${'$'}12
-${'$'}020c 67 12 rmb6 ${'$'}12
-${'$'}020e 77 12 rmb7 ${'$'}12
-${'$'}0210 87 12 smb0 ${'$'}12
-${'$'}0212 97 12 smb1 ${'$'}12
-${'$'}0214 a7 12 smb2 ${'$'}12
-${'$'}0216 b7 12 smb3 ${'$'}12
-${'$'}0218 c7 12 smb4 ${'$'}12
-${'$'}021a d7 12 smb5 ${'$'}12
-${'$'}021c e7 12 smb6 ${'$'}12
-${'$'}021e f7 12 smb7 ${'$'}12
-${'$'}0220 0f 12 2a bbr0 ${'$'}12, ${'$'}024d
-${'$'}0223 1f 12 27 bbr1 ${'$'}12, ${'$'}024d
-${'$'}0226 2f 12 24 bbr2 ${'$'}12, ${'$'}024d
-${'$'}0229 3f 12 21 bbr3 ${'$'}12, ${'$'}024d
-${'$'}022c 4f 12 1e bbr4 ${'$'}12, ${'$'}024d
-${'$'}022f 5f 12 1b bbr5 ${'$'}12, ${'$'}024d
-${'$'}0232 6f 12 18 bbr6 ${'$'}12, ${'$'}024d
-${'$'}0235 8f 12 15 bbs0 ${'$'}12, ${'$'}024d
-${'$'}0238 9f 12 12 bbs1 ${'$'}12, ${'$'}024d
-${'$'}023b af 12 0f bbs2 ${'$'}12, ${'$'}024d
-${'$'}023e bf 12 0c bbs3 ${'$'}12, ${'$'}024d
-${'$'}0241 cf 12 09 bbs4 ${'$'}12, ${'$'}024d
-${'$'}0244 df 12 06 bbs5 ${'$'}12, ${'$'}024d
-${'$'}0247 ef 12 03 bbs6 ${'$'}12, ${'$'}024d
-${'$'}024a ff 12 00 bbs7 ${'$'}12, ${'$'}024d
-${'$'}024d 00 brk
-${'$'}024e 00 brk
-${'$'}024f 00 brk
-${'$'}0250 00 brk""", result)
+ assertEquals($$"""$0200 07 12 rmb0 $12
+$0202 17 12 rmb1 $12
+$0204 27 12 rmb2 $12
+$0206 37 12 rmb3 $12
+$0208 47 12 rmb4 $12
+$020a 57 12 rmb5 $12
+$020c 67 12 rmb6 $12
+$020e 77 12 rmb7 $12
+$0210 87 12 smb0 $12
+$0212 97 12 smb1 $12
+$0214 a7 12 smb2 $12
+$0216 b7 12 smb3 $12
+$0218 c7 12 smb4 $12
+$021a d7 12 smb5 $12
+$021c e7 12 smb6 $12
+$021e f7 12 smb7 $12
+$0220 0f 12 2a bbr0 $12, $024d
+$0223 1f 12 27 bbr1 $12, $024d
+$0226 2f 12 24 bbr2 $12, $024d
+$0229 3f 12 21 bbr3 $12, $024d
+$022c 4f 12 1e bbr4 $12, $024d
+$022f 5f 12 1b bbr5 $12, $024d
+$0232 6f 12 18 bbr6 $12, $024d
+$0235 8f 12 15 bbs0 $12, $024d
+$0238 9f 12 12 bbs1 $12, $024d
+$023b af 12 0f bbs2 $12, $024d
+$023e bf 12 0c bbs3 $12, $024d
+$0241 cf 12 09 bbs4 $12, $024d
+$0244 df 12 06 bbs5 $12, $024d
+$0247 ef 12 03 bbs6 $12, $024d
+$024a ff 12 00 bbs7 $12, $024d
+$024d 00 brk
+$024e 00 brk
+$024f 00 brk
+$0250 00 brk""", result)
}
@Test
@@ -85,20 +85,20 @@ ${'$'}0250 00 brk""", result)
val disassem = disassembler.disassemble(memory.data, 0x0200..0x0215, 0)
assertEquals(0x216, disassem.second)
val result = disassem.first.joinToString("\n")
- assertEquals("""${'$'}0200 cb wai
-${'$'}0201 db stp
-${'$'}0202 3a dec a
-${'$'}0203 1a inc a
-${'$'}0204 64 12 stz ${'$'}12
-${'$'}0206 14 12 trb ${'$'}12
-${'$'}0208 04 12 tsb ${'$'}12
-${'$'}020a 72 12 adc ${'$'}(12)
-${'$'}020c b2 12 lda ${'$'}(12)
-${'$'}020e 92 12 sta ${'$'}(12)
-${'$'}0210 7c 00 20 jmp ${'$'}(2000,x)
-${'$'}0213 00 brk
-${'$'}0214 00 brk
-${'$'}0215 00 brk""", result)
+ assertEquals($$"""$0200 cb wai
+$0201 db stp
+$0202 3a dec a
+$0203 1a inc a
+$0204 64 12 stz $12
+$0206 14 12 trb $12
+$0208 04 12 tsb $12
+$020a 72 12 adc $(12)
+$020c b2 12 lda $(12)
+$020e 92 12 sta $(12)
+$0210 7c 00 20 jmp $(2000,x)
+$0213 00 brk
+$0214 00 brk
+$0215 00 brk""", result)
}
}