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

Compare commits

...

14 Commits
v1.9 ... master

Author SHA1 Message Date
Irmen de Jong
3f28ef6cad update gradle 2023-10-30 20:24:14 +01:00
Irmen de Jong
0fda62370e updates 2023-08-30 13:59:16 +02:00
Irmen de Jong
6812ab4b09 updates 2023-08-15 13:30:01 +02:00
Irmen de Jong
67c70abb41 build fixes 2023-05-26 20:14:55 +02:00
Irmen de Jong
5cc3f8fddd kotlin 1.7.10 2022-08-13 21:24:12 +02:00
Irmen de Jong
87c7aad49a update gradle wrapper to 7.4 2022-03-12 23:22:46 +01:00
Irmen de Jong
1ca771840b kotlin 1.6.10 2022-01-09 03:53:50 +01:00
Irmen de Jong
b17b72b6b5 remote broken dokka build target, upgrade to kotlin 1.5.30 2021-09-19 18:27:25 +02:00
Irmen de Jong
61bb920776 ide files 2021-09-19 18:12:35 +02:00
Irmen de Jong
6c73852b5e update kotlin version 2021-07-06 23:37:19 +02:00
Irmen de Jong
6dc433417d updated to Kotlin 1.4.20 and JDK 11 2020-12-19 14:58:48 +01:00
Irmen de Jong
f8b3213b41 update travix 2020-10-23 00:07:26 +02:00
Irmen de Jong
b2b4b0ab83 gradle upgrade 2020-10-22 23:53:59 +02:00
Irmen de Jong
1cbb006577 updated to new kotlin version 2020-10-13 00:06:28 +02:00
28 changed files with 256 additions and 254 deletions

View File

@ -15,8 +15,6 @@
<option value="$PROJECT_DIR$" />
</set>
</option>
<option name="useAutoImport" value="true" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>

View File

@ -26,5 +26,10 @@
<option name="name" value="maven" />
<option name="url" value="https://jitpack.io" />
</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>
</project>

6
.idea/kotlinc.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.9.10" />
</component>
</project>

View File

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4" />

View File

@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="openjdk-11" project-jdk-type="JavaSDK" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="openjdk-11" project-jdk-type="JavaSDK" />
</project>

View File

@ -1,10 +0,0 @@
language: java
sudo: false
# jdk: openjdk8
# dist: xenial
before_install:
- chmod +x gradlew
script:
- gradle test

View File

@ -1,7 +1,3 @@
[![saythanks](https://img.shields.io/badge/say-thanks-ff69b4.svg)](https://saythanks.io/to/irmen)
[![Build Status](https://travis-ci.org/irmen/ksim65.svg?branch=master)](https://travis-ci.org/irmen/ksim65)
JCenter: [![Download from Jcenter](https://api.bintray.com/packages/irmen/maven/ksim65/images/download.svg)](https://bintray.com/irmen/maven/ksim65/_latestVersion)
# KSim65 - Kotlin/JVM 6502/65C02 microprocessor simulator
*Written by Irmen de Jong (irmen@razorvine.net)*
@ -30,7 +26,7 @@ Still to be written. For now, use the source ;-)
## Using it as a library in your own project
Ksim65 is available on the [JCenter maven repository](https://bintray.com/irmen/maven/ksim65/_latestVersion).
**TODO move to another repository for published packages.**
You can simply add it as a dependency to your project.
For Maven:
@ -38,13 +34,13 @@ For Maven:
<dependency>
<groupId>net.razorvine</groupId>
<artifactId>ksim65</artifactId>
<version>1.8</version>
<version>1.10</version>
<type>pom</type>
</dependency>
For Gradle:
implementation 'net.razorvine:ksim65:1.8'
implementation 'net.razorvine:ksim65:1.10'
Update the version as required.

View File

@ -1,4 +1,3 @@
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.util.*
import kotlin.math.max
@ -6,34 +5,38 @@ import kotlin.math.max
plugins {
// Apply the Kotlin JVM plugin to add support for Kotlin on the JVM.
kotlin("jvm") version "1.3.70"
kotlin("jvm") version "1.9.10"
`maven-publish`
application
id("org.jetbrains.dokka") version "0.10.0"
id("com.jfrog.bintray") version "1.8.4"
java
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
allprojects {
val versionProps = Properties().also {
it.load(File("$projectDir/src/main/resources/version.properties").inputStream())
}
version = versionProps["version"] as String
group = "net.razorvine"
base.archivesBaseName = "ksim65"
// base.archivesBaseName = "ksim65"
repositories {
// Use jcenter for resolving dependencies.
// You can declare any Maven/Ivy/file repository here.
mavenLocal()
jcenter()
mavenCentral()
maven("https://jitpack.io")
}
}
dependencies {
// Align versions of all Kotlin components
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
implementation("org.jetbrains.kotlin:kotlin-reflect")
// Use the Kotlin JDK 8 standard library.
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
@ -43,11 +46,11 @@ dependencies {
// Use the Kotlin JUnit5 integration.
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.4.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.4.0")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
subprojects.forEach {
archives(it)
implementation(it)
}
}
@ -64,35 +67,27 @@ tasks {
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
named<DokkaTask>("dokka") {
outputFormat = "html"
outputDirectory = "$buildDir/kdoc"
configuration {
skipEmptyPackages = true
}
kotlinOptions.jvmTarget = "11"
}
}
val c64emuScript by tasks.registering(CreateStartScripts::class) {
outputDir = File(project.buildDir, "bin")
outputDir = project.layout.buildDirectory.dir("bin").get().asFile
applicationName = "c64emu"
mainClassName = "razorvine.c64emu.C64MainKt"
mainClass.set("razorvine.c64emu.C64MainKt")
classpath = project.tasks["jar"].outputs.files+project.configurations.runtimeClasspath.get()
}
val ehbasicScript by tasks.registering(CreateStartScripts::class) {
outputDir = File(project.buildDir, "bin")
outputDir = project.layout.buildDirectory.dir("bin").get().asFile
applicationName = "ehbasic"
mainClassName = "razorvine.examplemachines.EhBasicMainKt"
mainClass.set("razorvine.examplemachines.EhBasicMainKt")
classpath = project.tasks["jar"].outputs.files+project.configurations.runtimeClasspath.get()
}
application {
applicationName = "ksim65vm"
mainClassName = "razorvine.examplemachines.MachineMainKt"
mainClass.set("razorvine.examplemachines.MachineMainKt")
applicationDistribution.into("bin") {
from(c64emuScript, ehbasicScript)
fileMode = 493
@ -105,12 +100,6 @@ val sourcesJar by tasks.registering(Jar::class) {
from(sourceSets.main.get().allSource)
}
val dokkaDocs by tasks.registering(Jar::class) {
dependsOn("dokka")
archiveClassifier.set("kdoc")
from(fileTree(File(project.buildDir, "kdoc")))
}
publishing {
repositories {
mavenLocal()
@ -119,28 +108,6 @@ publishing {
register("mavenJava", MavenPublication::class) {
from(components["java"])
artifact(sourcesJar.get())
artifact(dokkaDocs.get())
}
}
}
bintray {
user = System.getenv("BINTRAY_USER")
key = System.getenv("BINTRAY_KEY")
setPublications(* publishing.publications.names.toTypedArray())
// setConfigurations("archives")
pkg = PackageConfig().also {
it.name = "ksim65"
it.repo = "maven"
it.setLicenses("MIT")
it.vcsUrl = "https://github.com/irmen/ksim65.git"
it.setLabels("6502", "retro", "emulation", "c64")
it.githubRepo = it.vcsUrl
it.version = VersionConfig().also {
it.gpg = GpgConfig().also {
it.sign = true
}
}
}
}

View File

@ -2,3 +2,4 @@ org.gradle.caching=true
org.gradle.console=rich
org.gradle.parallel=true
org.gradle.daemon=true
kotlin.code.style=official

Binary file not shown.

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

269
gradlew vendored
View File

@ -1,7 +1,7 @@
#!/usr/bin/env sh
#!/bin/sh
#
# Copyright 2015 the original author or authors.
# Copyright © 2015-2021 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.
@ -17,78 +17,113 @@
#
##############################################################################
##
## Gradle start up script for UN*X
##
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
MAX_FD=maximum
warn () {
echo "$*"
}
} >&2
die () {
echo
echo "$*"
echo
exit 1
}
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@ -97,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
@ -105,79 +140,95 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# 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" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

25
gradlew.bat vendored
View File

@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
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.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute
echo.
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_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@ -61,28 +64,14 @@ echo location of your Java installation.
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
@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 %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
@rem End local scope for the variables with windows NT shell

View File

@ -87,7 +87,7 @@ class C64Machine(title: String) : IVirtualMachine {
val txttab = ram[0x2b]+256*ram[0x2c] // basic load address ($0801 usually)
val fnaddr = ram[0xbb]+256*ram[0xbc] // file name address
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)
if (loadEndAddress != null) {
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 endAddr = cpu.regX+256*cpu.regY
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"
File(filename).outputStream().use {
it.write(fromAddr and 0xff)
@ -133,13 +133,13 @@ class C64Machine(title: String) : IVirtualMachine {
"$" -> {
// load the directory
val files = File(".").listFiles(FileFilter { it.isFile })!!.associate {
val name = it.nameWithoutExtension.toUpperCase()
val ext = it.extension.toUpperCase()
val name = it.nameWithoutExtension.uppercase()
val ext = it.extension.uppercase()
val fileAndSize = Pair(it, it.length())
if (name.isEmpty()) Pair(".$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)
ram.load(dirlisting, basicLoadAddress)
return basicLoadAddress+dirlisting.size-1
@ -147,7 +147,7 @@ class C64Machine(title: String) : IVirtualMachine {
else -> {
fun findHostFile(filename: String): String? {
val file = File(".").listFiles(FileFilter { it.isFile })?.firstOrNull {
it.name.toUpperCase() == filename
it.name.uppercase() == filename
}
return file?.name
}
@ -179,7 +179,7 @@ class C64Machine(title: String) : IVirtualMachine {
listing.add((address ushr 8).toShort())
listing.add((lineNumber and 0xff).toShort())
listing.add((lineNumber ushr 8).toShort())
listing.addAll(line.map { it.toShort() })
listing.addAll(line.map { it.code.toShort() })
listing.add(0)
}
addLine(0, "\u0012\"${dirname.take(16).padEnd(16)}\" 00 2A")

View File

@ -32,7 +32,7 @@ private class BitmapScreenPanel : JPanel() {
private var cursorY: Int = 0
private var cursorState: Boolean = false
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
init {
@ -44,8 +44,8 @@ private class BitmapScreenPanel : JPanel() {
g2d = image.graphics as Graphics2D
screenFontImage = screenFont.convertToImage(g2d, ScreenDefs.FG_COLOR)
val size = Dimension((image.width*PIXEL_SCALING).toInt(),
(image.height*PIXEL_SCALING).toInt())
val size = Dimension((image.width*pixelScaling).toInt(),
(image.height*pixelScaling).toInt())
minimumSize = size
maximumSize = size
preferredSize = size
@ -58,13 +58,13 @@ private class BitmapScreenPanel : JPanel() {
override fun paint(graphics: Graphics) {
val g2d = graphics as Graphics2D
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR)
g2d.drawImage(image, 0, 0, (image.width*PIXEL_SCALING).toInt(),
(image.height*PIXEL_SCALING).toInt(), null)
g2d.drawImage(image, 0, 0, (image.width*pixelScaling).toInt(),
(image.height*pixelScaling).toInt(), null)
if (cursorState) {
val scx = (cursorX*PIXEL_SCALING*screenFont.width).toInt()
val scy = (cursorY*PIXEL_SCALING*screenFont.height).toInt()
val scw = (screenFont.width*PIXEL_SCALING).toInt()
val sch = (screenFont.height*PIXEL_SCALING).toInt()
val scx = (cursorX*pixelScaling*screenFont.width).toInt()
val scy = (cursorY*pixelScaling*screenFont.height).toInt()
val scw = (screenFont.width*pixelScaling).toInt()
val sch = (screenFont.height*pixelScaling).toInt()
g2d.setXORMode(Color.CYAN)
g2d.fillRect(scx, scy, scw, sch)
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 setChar(x: Int, y: Int, character: Char) {
val charnum = character.toInt()
val charnum = character.code
val cx = charnum % (screenFontImage.width/screenFont.width)
val cy = charnum / (screenFontImage.width/screenFont.width)
g2d.clearRect(x*screenFont.width, y*screenFont.height, screenFont.width, screenFont.height)
@ -105,7 +105,7 @@ private class BitmapScreenPanel : JPanel() {
fun mousePixelPosition(): Point? {
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) {

View File

@ -22,7 +22,7 @@ class PsfFont(name: String) {
private val rawBitmaps: List<ByteArray>
init {
var data = ByteArray(0)
val data: ByteArray
val fontsDirectory = "/usr/share/kbd/consolefonts"
var stream = javaClass.getResourceAsStream("/charset/$name.psfu.gz") ?:
javaClass.getResourceAsStream("/charset/$name.psf.gz") ?:

View File

@ -87,7 +87,7 @@ class Assembler(cpu: Cpu6502, val memory: MemMappedComponent, initialStartAddres
}
val instructionSize: Int
val mnemonic = args[0].toLowerCase().trim()
val mnemonic = args[0].lowercase().trim()
when (args.size) {
1 -> {
// implied or acc

View File

@ -188,9 +188,7 @@ open class Cpu6502 : BusComponent() {
regPC++
instrCycles = currentInstruction.cycles
val extraCycleFromAddr = applyAddressingMode(currentInstruction.mode)
val extraCycleFromInstr = dispatchOpcode(currentOpcode)
if(extraCycleFromAddr and extraCycleFromInstr)
if(applyAddressingMode(currentInstruction.mode) and dispatchOpcode(currentOpcode))
instrCycles++
}

View File

@ -34,7 +34,7 @@ class Monitor(val bus: Bus, val cpu: Cpu6502) {
val result = mutableListOf<String>()
for (addr in start until end step 16) {
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()
else "."
})
@ -55,7 +55,7 @@ class Monitor(val bus: Bus, val cpu: Cpu6502) {
val result = mutableListOf<String>()
for (addr in start until end step 64) {
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()
else "."
})

View File

@ -45,7 +45,7 @@ abstract class MemMappedComponent(val startAddress: Address, val endAddress: Add
}
print(" ")
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(""))
}
}

View File

@ -52,7 +52,7 @@ class Display(startAddress: Address, endAddress: Address, private val host: IHos
}
override fun reset() {
charMatrix.forEach { it.fill(' '.toShort()) }
charMatrix.forEach { it.fill(' '.code.toShort()) }
cursorX = 0
cursorY = 0
charposX = 0
@ -94,7 +94,7 @@ class Display(startAddress: Address, endAddress: Address, private val host: IHos
0x02 -> {
if (charposY in 0 until charHeight && charposX in 0 until charWidth) {
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()
@ -121,7 +121,7 @@ class Display(startAddress: Address, endAddress: Address, private val host: IHos
cursorX = charWidth-1
}
}
charMatrix[cursorY][cursorX] = ' '.toShort()
charMatrix[cursorY][cursorX] = ' '.code.toShort()
host.setChar(cursorX, cursorY, ' ')
}
0x09 -> {
@ -142,7 +142,7 @@ class Display(startAddress: Address, endAddress: Address, private val host: IHos
else -> {
// set character on screen
charMatrix[cursorY][cursorX] = data
host.setChar(cursorX, cursorY, data.toChar())
host.setChar(cursorX, cursorY, data.toInt().toChar())
cursorX++
if (cursorX >= charWidth) {
cursorX = 0
@ -164,7 +164,7 @@ class Display(startAddress: Address, endAddress: Address, private val host: IHos
charMatrix[y+1].copyInto(charMatrix[y])
}
for (x in 0 until charWidth) {
charMatrix[charHeight-1][x] = ' '.toShort()
charMatrix[charHeight-1][x] = ' '.code.toShort()
}
cursorY--
host.scrollUp()

View File

@ -25,7 +25,7 @@ class Keyboard(startAddress: Address, endAddress: Address, private val host: IHo
override operator fun get(offset: Int): UByte {
return when (offset) {
0x00 -> host.keyboard()?.toShort() ?: 0
0x00 -> host.keyboard()?.code?.toShort() ?: 0
else -> 0xff
}
}

View File

@ -27,7 +27,7 @@ class ParallelPort(startAddress: Address, endAddress: Address) : MemMappedCompon
if (offset == 0) dataByte = data
else if (offset == 1) {
if ((data.toInt() and 1) == 1) {
val char = dataByte.toChar()
val char = dataByte.toInt().toChar()
println("PARALLEL WRITE: '$char'")
}
}

View File

@ -6,7 +6,7 @@ import java.io.File
* A ROM chip (read-only memory).
*/
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 {
require(endAddress-startAddress+1 == data.size) { "rom address range doesn't match size of data bytes" }

View File

@ -1 +1 @@
version=1.9-dev
version=1.10

View File

@ -148,19 +148,19 @@ 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
val bus = Bus()
bus.add(cpu)
cpu.breakpointForBRK = { _, pc -> fail("brk instruction at \$${hexW(pc)}") }
cpu.addBreakpoint(0xffee) { cpu, pc ->
cpu.addBreakpoint(0xffee) { cpu2, pc ->
// OSWRCH write character
print("${cpu.regA.toChar()}")
print("${cpu2.regA.toChar()}")
Cpu6502.BreakpointResultAction()
}
cpu.addBreakpoint(0xffe0) { cpu, pc ->
cpu.addBreakpoint(0xffe0) { cpu2, pc ->
// OSRDCH read character
cpu.regA = testChoice.toInt()
cpu2.regA = testChoice.code
Cpu6502.BreakpointResultAction()
}
val ram = Ram(0, 0xffff)

View File

@ -281,61 +281,61 @@ class Test6502TestSuiteIllegalInstructions: FunctionalTestsBase() {
}
@Test
@Disabled("this illegal instruction is probablyt not implemented correctly yet")
@Disabled("this illegal instruction is probably not implemented correctly yet")
fun testAlrb() {
runTest("alrb") // TODO fix?
}
@Test
@Disabled("this illegal instruction is probablyt not implemented correctly yet")
@Disabled("this illegal instruction is probably not implemented correctly yet")
fun testAneb() {
runTest("aneb") // TODO fix?
}
@Test
@Disabled("this illegal instruction is probablyt not implemented correctly yet")
@Disabled("this illegal instruction is probably not implemented correctly yet")
fun testArrb() {
runTest("arrb") // TODO fix?
}
@Test
@Disabled("this illegal instruction is probablyt not implemented correctly yet")
@Disabled("this illegal instruction is probably not implemented correctly yet")
fun testLxab() {
runTest("lxab") // TODO fix something?
}
@Test
@Disabled("this illegal instruction is probablyt not implemented correctly yet")
@Disabled("this illegal instruction is probably not implemented correctly yet")
fun testSbxb() {
runTest("sbxb") // TODO fix?
}
@Test
@Disabled("this illegal instruction is probablyt not implemented correctly yet")
@Disabled("this illegal instruction is probably not implemented correctly yet")
fun testShaay() {
runTest("shaay") // TODO fix?
}
@Test
@Disabled("this illegal instruction is probablyt not implemented correctly yet")
@Disabled("this illegal instruction is probably not implemented correctly yet")
fun testShaiy() {
runTest("shaiy") // TODO fix?
}
@Test
@Disabled("this illegal instruction is probablyt not implemented correctly yet")
@Disabled("this illegal instruction is probably not implemented correctly yet")
fun testShsay() {
runTest("shsay") // TODO fix?
}
@Test
@Disabled("this illegal instruction is probablyt not implemented correctly yet")
@Disabled("this illegal instruction is probably not implemented correctly yet")
fun testShxay() {
runTest("shxay") // TODO fix?
}
@Test
@Disabled("this illegal instruction is probablyt not implemented correctly yet")
@Disabled("this illegal instruction is probably not implemented correctly yet")
fun testShyax() {
runTest("shyax") // TODO fix?
}

View File

@ -50,7 +50,7 @@ abstract class TestCommon6502 {
abstract fun createCpu(): Cpu6502
init {
mpu = createCpu()
mpu = this.createCpu()
bus.add(mpu)
bus.add(memory)
memory.fill(0xaa)