mirror of
https://github.com/irmen/prog8.git
synced 2026-10-22 05:02:58 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b10115390 | ||
|
|
d2e010c439 | ||
|
|
15867ab423 | ||
|
|
22c9e99fa3 | ||
|
|
ee262f6aad | ||
|
|
af64af2397 | ||
|
|
1feead2260 | ||
|
|
d3dcd24b4d | ||
|
|
fd1e6796ef | ||
|
|
3ea0f0cbaa | ||
|
|
f3e3311598 | ||
|
|
0dc50a93a4 | ||
|
|
fda8e61be4 | ||
|
|
ac1d4b4a7a | ||
|
|
c719e274d5 | ||
|
|
e4990f8ec5 | ||
|
|
62afd3342e | ||
|
|
6e8a89e6f1 | ||
|
|
aa2437cfb8 | ||
|
|
4a710ecdfc | ||
|
|
3ef5bdfeda | ||
|
|
7915dda35f | ||
|
|
9120e16683 |
No files matched your search
Generated
+2
-2
@@ -4,6 +4,6 @@
|
||||
<option name="jvmTarget" value="11" />
|
||||
</component>
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="version" value="1.9.20" />
|
||||
<option name="version" value="1.9.24" />
|
||||
</component>
|
||||
</project>
|
||||
</project>
|
||||
Generated
+10
-10
@@ -1,23 +1,23 @@
|
||||
<component name="libraryTable">
|
||||
<library name="KotlinJavaRuntime" type="repository">
|
||||
<properties maven-id="org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.22" />
|
||||
<properties maven-id="org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.24" />
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.9.22/kotlin-stdlib-jdk8-1.9.22.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.9.22/kotlin-stdlib-1.9.22.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.9.24/kotlin-stdlib-jdk8-1.9.24.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.9.24/kotlin-stdlib-1.9.24.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.9.22/kotlin-stdlib-jdk7-1.9.22.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.9.24/kotlin-stdlib-jdk7-1.9.24.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.9.22/kotlin-stdlib-jdk8-1.9.22-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.9.22/kotlin-stdlib-1.9.22-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.9.24/kotlin-stdlib-jdk8-1.9.24-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.9.24/kotlin-stdlib-1.9.24-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.9.22/kotlin-stdlib-jdk7-1.9.22-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.9.24/kotlin-stdlib-jdk7-1.9.24-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.9.22/kotlin-stdlib-jdk8-1.9.22-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.9.22/kotlin-stdlib-1.9.22-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.9.24/kotlin-stdlib-jdk8-1.9.24-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.9.24/kotlin-stdlib-1.9.24-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.9.22/kotlin-stdlib-jdk7-1.9.22-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.9.24/kotlin-stdlib-jdk7-1.9.24-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
+10
-13
@@ -1,21 +1,18 @@
|
||||
<component name="libraryTable">
|
||||
<library name="io.kotest.assertions.core.jvm" type="repository">
|
||||
<properties maven-id="io.kotest:kotest-assertions-core-jvm:5.8.0" />
|
||||
<properties maven-id="io.kotest:kotest-assertions-core-jvm:5.9.0" />
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-core-jvm/5.8.0/kotest-assertions-core-jvm-5.8.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.8.10/kotlin-stdlib-jdk8-1.8.10.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.8.10/kotlin-stdlib-1.8.10.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.8.10/kotlin-stdlib-jdk7-1.8.10.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-shared-jvm/5.8.0/kotest-assertions-shared-jvm-5.8.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-core-jvm/5.9.0/kotest-assertions-core-jvm-5.9.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-shared-jvm/5.9.0/kotest-assertions-shared-jvm-5.9.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/github/java-diff-utils/java-diff-utils/4.12/java-diff-utils-4.12.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-common/1.8.10/kotlin-stdlib-common-1.8.10.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-jdk8/1.7.0/kotlinx-coroutines-jdk8-1.7.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-reflect/1.8.10/kotlin-reflect-1.8.10.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-common-jvm/5.8.0/kotest-common-jvm-5.8.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-api-jvm/5.8.0/kotest-assertions-api-jvm-5.8.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.7.0/kotlinx-coroutines-core-jvm-1.7.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/23.0.0/annotations-23.0.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.9.23/kotlin-stdlib-1.9.23.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-jdk8/1.8.0/kotlinx-coroutines-jdk8-1.8.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-reflect/1.9.23/kotlin-reflect-1.9.23.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-common-jvm/5.9.0/kotest-common-jvm-5.9.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-api-jvm/5.9.0/kotest-assertions-api-jvm-5.9.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.8.0/kotlinx-coroutines-core-jvm-1.8.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
|
||||
+18
-21
@@ -1,30 +1,30 @@
|
||||
<component name="libraryTable">
|
||||
<library name="io.kotest.runner.junit5.jvm" type="repository">
|
||||
<properties maven-id="io.kotest:kotest-runner-junit5-jvm:5.8.0" />
|
||||
<properties maven-id="io.kotest:kotest-runner-junit5-jvm:5.9.0" />
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-runner-junit5-jvm/5.8.0/kotest-runner-junit5-jvm-5.8.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-framework-api-jvm/5.8.0/kotest-framework-api-jvm-5.8.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-shared-jvm/5.8.0/kotest-assertions-shared-jvm-5.8.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-runner-junit5-jvm/5.9.0/kotest-runner-junit5-jvm-5.9.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-framework-api-jvm/5.9.0/kotest-framework-api-jvm-5.9.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-shared-jvm/5.9.0/kotest-assertions-shared-jvm-5.9.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/github/java-diff-utils/java-diff-utils/4.12/java-diff-utils-4.12.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-test-jvm/1.7.0/kotlinx-coroutines-test-jvm-1.7.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-common-jvm/5.8.0/kotest-common-jvm-5.8.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-framework-engine-jvm/5.8.0/kotest-framework-engine-jvm-5.8.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/github/classgraph/classgraph/4.8.162/classgraph-4.8.162.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-test-jvm/1.8.0/kotlinx-coroutines-test-jvm-1.8.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-common-jvm/5.9.0/kotest-common-jvm-5.9.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-framework-engine-jvm/5.9.0/kotest-framework-engine-jvm-5.9.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/github/classgraph/classgraph/4.8.172/classgraph-4.8.172.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/github/ajalt/mordant/1.2.1/mordant-1.2.1.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/github/ajalt/colormath/1.2.0/colormath-1.2.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-debug/1.7.0/kotlinx-coroutines-debug-1.7.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-debug/1.8.0/kotlinx-coroutines-debug-1.8.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/java/dev/jna/jna/5.9.0/jna-5.9.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/java/dev/jna/jna-platform/5.9.0/jna-platform-5.9.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy/1.10.9/byte-buddy-1.10.9.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/bytebuddy/byte-buddy-agent/1.10.9/byte-buddy-agent-1.10.9.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-framework-discovery-jvm/5.8.0/kotest-framework-discovery-jvm-5.8.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-core-jvm/5.8.0/kotest-assertions-core-jvm-5.8.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-jdk8/1.7.0/kotlinx-coroutines-jdk8-1.7.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-api-jvm/5.8.0/kotest-assertions-api-jvm-5.8.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-extensions-jvm/5.8.0/kotest-extensions-jvm-5.8.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-framework-concurrency-jvm/5.8.0/kotest-framework-concurrency-jvm-5.8.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.7.0/kotlinx-coroutines-core-jvm-1.7.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-framework-discovery-jvm/5.9.0/kotest-framework-discovery-jvm-5.9.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-core-jvm/5.9.0/kotest-assertions-core-jvm-5.9.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-jdk8/1.8.0/kotlinx-coroutines-jdk8-1.8.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-assertions-api-jvm/5.9.0/kotest-assertions-api-jvm-5.9.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-extensions-jvm/5.9.0/kotest-extensions-jvm-5.9.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/io/kotest/kotest-framework-concurrency-jvm/5.9.0/kotest-framework-concurrency-jvm-5.9.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.8.0/kotlinx-coroutines-core-jvm-1.8.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/23.0.0/annotations-23.0.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.8.2/junit-platform-engine-1.8.2.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.8.2/junit-platform-commons-1.8.2.jar!/" />
|
||||
@@ -32,11 +32,8 @@
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-suite-api/1.8.2/junit-platform-suite-api-1.8.2.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-launcher/1.8.2/junit-platform-launcher-1.8.2.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.8.2/junit-jupiter-api-5.8.2.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.8.10/kotlin-stdlib-jdk8-1.8.10.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.8.10/kotlin-stdlib-1.8.10.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.8.10/kotlin-stdlib-jdk7-1.8.10.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-common/1.8.10/kotlin-stdlib-common-1.8.10.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-reflect/1.8.10/kotlin-reflect-1.8.10.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.9.23/kotlin-stdlib-1.9.23.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-reflect/1.9.23/kotlin-reflect-1.9.23.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
<component name="libraryTable">
|
||||
<library name="michael.bull.kotlin.result.jvm" type="repository">
|
||||
<properties maven-id="com.michael-bull.kotlin-result:kotlin-result-jvm:1.1.20" />
|
||||
<properties maven-id="com.michael-bull.kotlin-result:kotlin-result-jvm:2.0.0" />
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/michael-bull/kotlin-result/kotlin-result-jvm/1.1.20/kotlin-result-jvm-1.1.20.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/michael-bull/kotlin-result/kotlin-result-jvm/2.0.0/kotlin-result-jvm-2.0.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.9.22/kotlin-stdlib-1.9.22.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" />
|
||||
</CLASSES>
|
||||
|
||||
Generated
+1
-1
@@ -22,7 +22,7 @@
|
||||
<component name="FrameworkDetectionExcludesConfiguration">
|
||||
<type id="Python" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="openjdk-11" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="openjdk-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -6,9 +6,8 @@ plugins {
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(javaVersion)
|
||||
}
|
||||
targetCompatibility = JavaLanguageVersion.of(javaVersion)
|
||||
sourceCompatibility = JavaLanguageVersion.of(javaVersion)
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
@@ -26,7 +25,7 @@ compileTestKotlin {
|
||||
dependencies {
|
||||
// should have no dependencies to other modules
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||
implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:1.1.20"
|
||||
implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:2.0.0"
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -82,8 +82,7 @@ class SymbolTable(astProgram: PtProgram) : StNode(astProgram.name, StNodeType.GL
|
||||
override fun lookup(scopedName: String) = flat[scopedName]
|
||||
|
||||
fun getLength(name: String): Int? {
|
||||
val node = flat[name]
|
||||
return when(node) {
|
||||
return when(val node = flat[name]) {
|
||||
is StMemVar -> node.length
|
||||
is StMemorySlab -> node.size.toInt()
|
||||
is StStaticVariable -> node.length
|
||||
|
||||
@@ -230,7 +230,7 @@ class PtBool(val value: Boolean, position: Position) : PtExpression(DataType.BOO
|
||||
|
||||
companion object {
|
||||
fun fromNumber(number: Number, position: Position): PtBool =
|
||||
PtBool(if(number==0.0) false else true, position)
|
||||
PtBool(number != 0.0, position)
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = Objects.hash(type, value)
|
||||
|
||||
@@ -63,18 +63,18 @@ fun printAst(root: PtNode, skipLibraries: Boolean, output: (text: String) -> Uni
|
||||
"???"
|
||||
}
|
||||
is PtAsmSub -> {
|
||||
val params = node.parameters.map {
|
||||
val register = it.first.registerOrPair
|
||||
val statusflag = it.first.statusflag
|
||||
"${it.second.type} ${it.second.name} @${register ?: statusflag}"
|
||||
}.joinToString(", ")
|
||||
val params = node.parameters.joinToString(", ") {
|
||||
val register = it.first.registerOrPair
|
||||
val statusflag = it.first.statusflag
|
||||
"${it.second.type} ${it.second.name} @${register ?: statusflag}"
|
||||
}
|
||||
val clobbers = if (node.clobbers.isEmpty()) "" else "clobbers ${node.clobbers}"
|
||||
val returns = if (node.returns.isEmpty()) "" else {
|
||||
"-> ${node.returns.map {
|
||||
val register = it.first.registerOrPair
|
||||
val statusflag = it.first.statusflag
|
||||
"${it.second} @${register ?: statusflag}"}
|
||||
.joinToString(", ")
|
||||
"-> ${node.returns.joinToString(", ") {
|
||||
val register = it.first.registerOrPair
|
||||
val statusflag = it.first.statusflag
|
||||
"${it.second} @${register ?: statusflag}"
|
||||
}
|
||||
}"
|
||||
}
|
||||
val str = if (node.inline) "inline " else ""
|
||||
@@ -108,7 +108,7 @@ fun printAst(root: PtNode, skipLibraries: Boolean, output: (text: String) -> Uni
|
||||
}
|
||||
}
|
||||
is PtSub -> {
|
||||
val params = node.parameters.map { "${it.type} ${it.name}" }.joinToString(", ")
|
||||
val params = node.parameters.joinToString(", ") { "${it.type} ${it.name}" }
|
||||
var str = "sub ${node.name}($params) "
|
||||
if(node.returntype!=null)
|
||||
str += "-> ${node.returntype.name.lowercase()}"
|
||||
|
||||
@@ -78,7 +78,7 @@ enum class RegisterOrPair {
|
||||
R8, R9, R10, R11, R12, R13, R14, R15;
|
||||
|
||||
companion object {
|
||||
val names by lazy { values().map { it.toString()} }
|
||||
val names by lazy { entries.map { it.toString()} }
|
||||
fun fromCpuRegister(cpu: CpuRegister): RegisterOrPair {
|
||||
return when(cpu) {
|
||||
CpuRegister.A -> A
|
||||
@@ -104,7 +104,7 @@ enum class Statusflag {
|
||||
Pn; // don't use
|
||||
|
||||
companion object {
|
||||
val names by lazy { values().map { it.toString()} }
|
||||
val names by lazy { entries.map { it.toString()} }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,13 +21,21 @@ class C64Target: ICompilationTarget, IStringEncoding by Encoder, IMemSizer by Cb
|
||||
}
|
||||
|
||||
|
||||
val CompilationTargets = listOf(
|
||||
C64Target.NAME,
|
||||
C128Target.NAME,
|
||||
Cx16Target.NAME,
|
||||
PETTarget.NAME,
|
||||
AtariTarget.NAME,
|
||||
VMTarget.NAME
|
||||
)
|
||||
|
||||
fun getCompilationTargetByName(name: String) = when(name.lowercase()) {
|
||||
C64Target.NAME -> C64Target()
|
||||
C128Target.NAME -> C128Target()
|
||||
Cx16Target.NAME -> Cx16Target()
|
||||
PETTarget.NAME -> PETTarget()
|
||||
AtariTarget.NAME -> AtariTarget()
|
||||
VMTarget.NAME -> VMTarget()
|
||||
else -> throw IllegalArgumentException("invalid compilation target")
|
||||
}
|
||||
C64Target.NAME -> C64Target()
|
||||
C128Target.NAME -> C128Target()
|
||||
Cx16Target.NAME -> Cx16Target()
|
||||
PETTarget.NAME -> PETTarget()
|
||||
AtariTarget.NAME -> AtariTarget()
|
||||
VMTarget.NAME -> VMTarget()
|
||||
else -> throw IllegalArgumentException("invalid compilation target")
|
||||
}
|
||||
@@ -5,9 +5,8 @@ plugins {
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(javaVersion)
|
||||
}
|
||||
targetCompatibility = JavaLanguageVersion.of(javaVersion)
|
||||
sourceCompatibility = JavaLanguageVersion.of(javaVersion)
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
@@ -26,9 +25,9 @@ dependencies {
|
||||
implementation project(':codeCore')
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||
// implementation "org.jetbrains.kotlin:kotlin-reflect"
|
||||
implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:1.1.20"
|
||||
implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:2.0.0"
|
||||
|
||||
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.8.0'
|
||||
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.9.0'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
|
||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||
}
|
||||
|
||||
@@ -100,8 +100,7 @@ class AsmGen6502(val prefixSymbols: Boolean): ICodeGeneratorBackend {
|
||||
}
|
||||
|
||||
nodesToPrefix.forEach { (parent, index) ->
|
||||
val node = parent.children[index]
|
||||
when(node) {
|
||||
when(val node = parent.children[index]) {
|
||||
is PtIdentifier -> parent.children[index] = node.prefix(parent, st)
|
||||
is PtFunctionCall -> throw AssemblyError("PtFunctionCall should be processed in their own list, last")
|
||||
is PtJump -> parent.children[index] = node.prefix(parent, st)
|
||||
@@ -247,7 +246,7 @@ class AsmGen6502Internal (
|
||||
|
||||
if(errors.noErrors()) {
|
||||
val output = options.outputDir.resolve("${program.name}.asm")
|
||||
val asmLines = assembly.asSequence().flatMapTo(mutableListOf()) { it.split('\n') }
|
||||
val asmLines = assembly.flatMapTo(mutableListOf()) { it.split('\n') }
|
||||
if(options.compTarget.name==Cx16Target.NAME) {
|
||||
scanInvalid65816instructions(asmLines)
|
||||
if(!errors.noErrors()) {
|
||||
@@ -820,17 +819,15 @@ class AsmGen6502Internal (
|
||||
loopEndLabels.pop()
|
||||
}
|
||||
|
||||
private fun repeatWordCount(count: Int, stmt: PtRepeatLoop) {
|
||||
require(count in 257..65535) { "invalid repeat count ${stmt.position}" }
|
||||
private fun repeatWordCount(iterations: Int, stmt: PtRepeatLoop) {
|
||||
require(iterations in 257..65535) { "invalid repeat count ${stmt.position}" }
|
||||
val repeatLabel = makeLabel("repeat")
|
||||
val counterVar = createRepeatCounterVar(DataType.UWORD, isTargetCpu(CpuType.CPU65c02), stmt)
|
||||
// the iny + double dec is microoptimization of the 16 bit loop
|
||||
val loopcount = if(iterations and 0x00ff == 0) iterations else iterations + 0x0100 // so that the loop can simply use a double-dec
|
||||
out("""
|
||||
ldy #>$count
|
||||
lda #<$count
|
||||
beq +
|
||||
iny
|
||||
+ sta $counterVar
|
||||
ldy #>$loopcount
|
||||
lda #<$loopcount
|
||||
sta $counterVar
|
||||
sty $counterVar+1
|
||||
$repeatLabel""")
|
||||
translate(stmt.statements)
|
||||
@@ -883,8 +880,8 @@ $repeatLabel""")
|
||||
}
|
||||
|
||||
private fun repeatCountInY(stmt: PtRepeatLoop, endLabel: String) {
|
||||
// note: Y must just have been loaded with the (variable) number of loops to be performed!
|
||||
val repeatLabel = makeLabel("repeat")
|
||||
out(" cpy #0")
|
||||
if(isTargetCpu(CpuType.CPU65c02)) {
|
||||
val counterVar = createRepeatCounterVar(DataType.UBYTE, true, stmt)
|
||||
out(" beq $endLabel | sty $counterVar")
|
||||
@@ -1320,91 +1317,6 @@ $repeatLabel""")
|
||||
}
|
||||
}
|
||||
|
||||
internal fun popCpuStack(asmsub: PtAsmSub, parameter: PtSubroutineParameter, reg: RegisterOrStatusflag) {
|
||||
val shouldKeepA = asmsub.parameters.any { it.first.registerOrPair==RegisterOrPair.AX || it.first.registerOrPair==RegisterOrPair.AY}
|
||||
if(reg.statusflag!=null) {
|
||||
if(shouldKeepA)
|
||||
out(" sta P8ZP_SCRATCH_REG")
|
||||
out("""
|
||||
clc
|
||||
pla
|
||||
beq +
|
||||
sec
|
||||
+""")
|
||||
if(shouldKeepA)
|
||||
out(" lda P8ZP_SCRATCH_REG")
|
||||
}
|
||||
else {
|
||||
if (parameter.type in ByteDatatypesWithBoolean) {
|
||||
if (isTargetCpu(CpuType.CPU65c02)) {
|
||||
when (reg.registerOrPair) {
|
||||
RegisterOrPair.A -> out(" pla")
|
||||
RegisterOrPair.X -> out(" plx")
|
||||
RegisterOrPair.Y -> out(" ply")
|
||||
in Cx16VirtualRegisters -> out(" pla | sta cx16.${reg.registerOrPair!!.name.lowercase()}")
|
||||
else -> throw AssemblyError("invalid target register ${reg.registerOrPair}")
|
||||
}
|
||||
} else {
|
||||
when (reg.registerOrPair) {
|
||||
RegisterOrPair.A -> out(" pla")
|
||||
RegisterOrPair.X -> {
|
||||
if(shouldKeepA)
|
||||
out(" sta P8ZP_SCRATCH_REG | pla | tax | lda P8ZP_SCRATCH_REG")
|
||||
else
|
||||
out(" pla | tax")
|
||||
}
|
||||
RegisterOrPair.Y -> {
|
||||
if(shouldKeepA)
|
||||
out(" sta P8ZP_SCRATCH_REG | pla | tay | lda P8ZP_SCRATCH_REG")
|
||||
else
|
||||
out(" pla | tay")
|
||||
}
|
||||
in Cx16VirtualRegisters -> out(" pla | sta cx16.${reg.registerOrPair!!.name.lowercase()}")
|
||||
else -> throw AssemblyError("invalid target register ${reg.registerOrPair}")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// word pop
|
||||
if (isTargetCpu(CpuType.CPU65c02))
|
||||
when (reg.registerOrPair) {
|
||||
RegisterOrPair.AX -> out(" plx | pla")
|
||||
RegisterOrPair.AY -> out(" ply | pla")
|
||||
RegisterOrPair.XY -> out(" ply | plx")
|
||||
in Cx16VirtualRegisters -> {
|
||||
val regname = reg.registerOrPair!!.name.lowercase()
|
||||
out(" pla | sta cx16.$regname+1 | pla | sta cx16.$regname")
|
||||
}
|
||||
else -> throw AssemblyError("invalid target register ${reg.registerOrPair}")
|
||||
}
|
||||
else {
|
||||
when (reg.registerOrPair) {
|
||||
RegisterOrPair.AX -> out(" pla | tax | pla")
|
||||
RegisterOrPair.AY -> out(" pla | tay | pla")
|
||||
RegisterOrPair.XY -> out(" pla | tay | pla | tax")
|
||||
in Cx16VirtualRegisters -> {
|
||||
val regname = reg.registerOrPair!!.name.lowercase()
|
||||
out(" pla | sta cx16.$regname+1 | pla | sta cx16.$regname")
|
||||
}
|
||||
else -> throw AssemblyError("invalid target register ${reg.registerOrPair}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal fun popCpuStack(dt: DataType) {
|
||||
if (dt in ByteDatatypesWithBoolean) {
|
||||
out(" pla")
|
||||
} else if (dt in WordDatatypes) {
|
||||
if (isTargetCpu(CpuType.CPU65c02))
|
||||
out(" ply | pla")
|
||||
else
|
||||
out(" pla | tay | pla")
|
||||
} else {
|
||||
throw AssemblyError("can't pop type $dt")
|
||||
}
|
||||
}
|
||||
|
||||
internal fun pushCpuStack(dt: DataType, value: PtExpression) {
|
||||
val signed = value.type.oneOf(DataType.BYTE, DataType.WORD)
|
||||
if(dt in ByteDatatypesWithBoolean) {
|
||||
|
||||
@@ -28,7 +28,7 @@ internal class AssemblyProgram(
|
||||
// add "-Wlong-branch" to see warnings about conversion of branch instructions to jumps (default = do this silently)
|
||||
val command = mutableListOf("64tass", "--ascii", "--case-sensitive", "--long-branch",
|
||||
"-Wall", // "-Wno-strict-bool", "-Werror",
|
||||
"--dump-labels", "--vice-labels", "--labels=$viceMonListFile", "--no-monitor"
|
||||
"--dump-labels", "--vice-labels", "--labels=$viceMonListFile"
|
||||
)
|
||||
|
||||
if(options.warnSymbolShadowing)
|
||||
@@ -39,8 +39,9 @@ internal class AssemblyProgram(
|
||||
if(options.asmQuiet)
|
||||
command.add("--quiet")
|
||||
|
||||
if(options.asmListfile)
|
||||
command.add("--list=$listFile")
|
||||
if(options.asmListfile) {
|
||||
command.addAll(listOf("--list=$listFile", "--no-monitor"))
|
||||
}
|
||||
|
||||
val outFile = when (options.output) {
|
||||
OutputType.PRG -> {
|
||||
|
||||
@@ -82,8 +82,7 @@ internal class BuiltinFunctionsAsmGen(private val program: PtProgram,
|
||||
val source = fcall.args[0] as PtIdentifier
|
||||
val target = fcall.args[1] as PtIdentifier
|
||||
|
||||
val sourceSymbol = asmgen.symbolTable.lookup(source.name)
|
||||
val numElements = when(sourceSymbol) {
|
||||
val numElements = when(val sourceSymbol = asmgen.symbolTable.lookup(source.name)) {
|
||||
is StStaticVariable -> sourceSymbol.length!!
|
||||
is StMemVar -> sourceSymbol.length!!
|
||||
else -> 0
|
||||
@@ -827,8 +826,7 @@ internal class BuiltinFunctionsAsmGen(private val program: PtProgram,
|
||||
|
||||
private fun funcSgn(fcall: PtBuiltinFunctionCall, resultRegister: RegisterOrPair?, scope: IPtSubroutine?) {
|
||||
translateArguments(fcall, scope)
|
||||
val dt = fcall.args.single().type
|
||||
when (dt) {
|
||||
when (val dt = fcall.args.single().type) {
|
||||
DataType.UBYTE -> asmgen.out(" jsr prog8_lib.func_sign_ub_into_A")
|
||||
DataType.BYTE -> asmgen.out(" jsr prog8_lib.func_sign_b_into_A")
|
||||
DataType.UWORD -> asmgen.out(" jsr prog8_lib.func_sign_uw_into_A")
|
||||
@@ -1398,8 +1396,7 @@ internal class BuiltinFunctionsAsmGen(private val program: PtProgram,
|
||||
|
||||
private fun outputAddressAndLengthOfArray(arg: PtIdentifier) {
|
||||
// address goes in P8ZP_SCRATCH_W1, number of elements in A
|
||||
val symbol = asmgen.symbolTable.lookup(arg.name)
|
||||
val numElements = when(symbol) {
|
||||
val numElements = when(val symbol = asmgen.symbolTable.lookup(arg.name)) {
|
||||
is StStaticVariable -> symbol.length!!
|
||||
is StMemVar -> symbol.length!!
|
||||
else -> 0
|
||||
|
||||
@@ -335,8 +335,7 @@ $endLabel""")
|
||||
val endLabel = asmgen.makeLabel("for_end")
|
||||
asmgen.loopEndLabels.push(endLabel)
|
||||
val iterableName = asmgen.asmVariableName(ident)
|
||||
val symbol = asmgen.symbolTable.lookup(ident.name)
|
||||
val numElements = when(symbol) {
|
||||
val numElements = when(val symbol = asmgen.symbolTable.lookup(ident.name)) {
|
||||
is StStaticVariable -> symbol.length!!
|
||||
is StMemVar -> symbol.length!!
|
||||
else -> 0
|
||||
|
||||
@@ -90,7 +90,7 @@ internal class FunctionCallAsmGen(private val program: PtProgram, private val as
|
||||
}
|
||||
|
||||
private fun argumentsViaRegisters(sub: PtAsmSub, call: PtFunctionCall) {
|
||||
val registersUsed = mutableListOf<RegisterOrStatusflag>();
|
||||
val registersUsed = mutableListOf<RegisterOrStatusflag>()
|
||||
|
||||
fun usedA() = registersUsed.any {it.registerOrPair==RegisterOrPair.A || it.registerOrPair==RegisterOrPair.AX || it.registerOrPair==RegisterOrPair.AY}
|
||||
fun usedX() = registersUsed.any {it.registerOrPair==RegisterOrPair.X || it.registerOrPair==RegisterOrPair.AX || it.registerOrPair==RegisterOrPair.XY}
|
||||
|
||||
@@ -616,7 +616,7 @@ _jump jmp ($asmLabel)
|
||||
if(right is PtIdentifier) {
|
||||
asmgen.assignExpressionToRegister(left, RegisterOrPair.AY, signed)
|
||||
val variable = asmgen.asmVariableName(right)
|
||||
return code(variable, variable+"+1")
|
||||
return code(variable, "$variable+1")
|
||||
}
|
||||
|
||||
// TODO optimize for simple array value
|
||||
@@ -737,7 +737,7 @@ _jump jmp ($asmLabel)
|
||||
if(right is PtIdentifier) {
|
||||
asmgen.assignExpressionToRegister(left, RegisterOrPair.AY, signed)
|
||||
val variable = asmgen.asmVariableName(right)
|
||||
return code(variable, variable+"+1")
|
||||
return code(variable, "$variable+1")
|
||||
}
|
||||
|
||||
// TODO optimize for simple array value
|
||||
@@ -1514,7 +1514,7 @@ _jump jmp ($asmLabel)
|
||||
else -> {
|
||||
asmgen.assignExpressionToRegister(right, RegisterOrPair.AY, signed)
|
||||
val varname = asmgen.asmVariableName(left)
|
||||
translateAYNotEquals(varname, varname + "+1")
|
||||
translateAYNotEquals(varname, "$varname+1")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1562,7 +1562,7 @@ _jump jmp ($asmLabel)
|
||||
else -> {
|
||||
asmgen.assignExpressionToRegister(right, RegisterOrPair.AY, signed)
|
||||
val varname = asmgen.asmVariableName(left)
|
||||
translateAYEquals(varname, varname+"+1")
|
||||
translateAYEquals(varname, "$varname+1")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,9 +48,9 @@ internal class VariableAllocator(private val symboltable: SymbolTable,
|
||||
val numberOfAllocatableVariables = allVariables.size
|
||||
val varsRequiringZp = allVariables.filter { it.zpwish == ZeropageWish.REQUIRE_ZEROPAGE }
|
||||
val varsPreferringZp = allVariables.filter { it.zpwish == ZeropageWish.PREFER_ZEROPAGE }
|
||||
val varsNotZp = allVariables.filter { it.zpwish == ZeropageWish.NOT_IN_ZEROPAGE }
|
||||
val varsDontCare = allVariables.filter { it.zpwish == ZeropageWish.DONTCARE }
|
||||
val numberOfExplicitNonZpVariables = allVariables.count { it.zpwish == ZeropageWish.NOT_IN_ZEROPAGE }
|
||||
require(varsDontCare.size + varsRequiringZp.size + varsPreferringZp.size + numberOfExplicitNonZpVariables == numberOfAllocatableVariables)
|
||||
require(varsDontCare.size + varsRequiringZp.size + varsPreferringZp.size + varsNotZp.size == numberOfAllocatableVariables)
|
||||
|
||||
var numVariablesAllocatedInZP = 0
|
||||
var numberOfNonIntegerVariables = 0
|
||||
@@ -86,7 +86,7 @@ internal class VariableAllocator(private val symboltable: SymbolTable,
|
||||
// no need to check for allocation error, if there is one, just allocate in normal system ram.
|
||||
}
|
||||
|
||||
// try to allocate any other interger variables into the zeropage until it is full.
|
||||
// try to allocate the "don't care" interger variables into the zeropage until it is full.
|
||||
// TODO some form of intelligent priorization? most often used variables first? loopcounter vars first? ...?
|
||||
if(errors.noErrors()) {
|
||||
val sortedList = varsDontCare.sortedByDescending { it.scopedName }
|
||||
@@ -110,9 +110,7 @@ internal class VariableAllocator(private val symboltable: SymbolTable,
|
||||
}
|
||||
}
|
||||
|
||||
// println(" number of allocated vars: $numberOfAllocatableVariables")
|
||||
// println(" put into zeropage: $numVariablesAllocatedInZP, non-zp allocatable: ${numberOfNonIntegerVariables+numberOfExplicitNonZpVariables}")
|
||||
// println(" zeropage free space: ${zeropage.free.size} bytes")
|
||||
// note: no zeropage allocation is done at all for the @nozp variables. This means they will always end up outside the zeropage.
|
||||
}
|
||||
|
||||
private fun collectAllVariables(st: SymbolTable): Collection<StStaticVariable> {
|
||||
|
||||
@@ -2323,7 +2323,7 @@ internal class AssignmentAsmGen(private val program: PtProgram,
|
||||
asmgen.out("""
|
||||
clc
|
||||
adc #$constIndex
|
||||
bne +
|
||||
bcc +
|
||||
iny
|
||||
+""")
|
||||
}
|
||||
@@ -2348,7 +2348,7 @@ internal class AssignmentAsmGen(private val program: PtProgram,
|
||||
asmgen.out("""
|
||||
clc
|
||||
adc P8ZP_SCRATCH_REG
|
||||
bne +
|
||||
bcc +
|
||||
iny
|
||||
+""")
|
||||
}
|
||||
@@ -2358,7 +2358,7 @@ internal class AssignmentAsmGen(private val program: PtProgram,
|
||||
ldy #>$sourceName
|
||||
clc
|
||||
adc #<$sourceName
|
||||
bne +
|
||||
bcc +
|
||||
iny
|
||||
+""")
|
||||
}
|
||||
|
||||
@@ -1703,7 +1703,7 @@ $shortcutLabel:""")
|
||||
|
||||
private fun inplacemodificationWordWithLiteralval(name: String, dt: DataType, operator: String, value: Int, block: PtBlock?) {
|
||||
// note: this contains special optimized cases because we know the exact value. Don't replace this with another routine.
|
||||
inplacemodificationSomeWordWithLiteralval(name, name + "+1", dt, operator, value, block)
|
||||
inplacemodificationSomeWordWithLiteralval(name, "$name+1", dt, operator, value, block)
|
||||
}
|
||||
|
||||
private fun inplacemodificationSomeWordWithLiteralval(lsb: String, msb: String, dt: DataType, operator: String, value: Int, block: PtBlock?) {
|
||||
|
||||
@@ -6,9 +6,8 @@ plugins {
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(javaVersion)
|
||||
}
|
||||
targetCompatibility = JavaLanguageVersion.of(javaVersion)
|
||||
sourceCompatibility = JavaLanguageVersion.of(javaVersion)
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
@@ -29,7 +28,7 @@ dependencies {
|
||||
implementation project(':codeGenIntermediate')
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||
// implementation "org.jetbrains.kotlin:kotlin-reflect"
|
||||
implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:1.1.20"
|
||||
implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:2.0.0"
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,8 @@ plugins {
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(javaVersion)
|
||||
}
|
||||
targetCompatibility = JavaLanguageVersion.of(javaVersion)
|
||||
sourceCompatibility = JavaLanguageVersion.of(javaVersion)
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
@@ -28,9 +27,9 @@ dependencies {
|
||||
implementation project(':intermediate')
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||
// implementation "org.jetbrains.kotlin:kotlin-reflect"
|
||||
implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:1.1.20"
|
||||
implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:2.0.0"
|
||||
|
||||
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.8.0'
|
||||
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.9.0'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
|
||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ internal class AssignmentGen(private val codeGen: IRCodeGen, private val express
|
||||
|
||||
internal fun translate(augAssign: PtAugmentedAssign): IRCodeChunks {
|
||||
// augmented assignment always has just a single target
|
||||
if(augAssign.target.children.single() is PtIrRegister)
|
||||
if (augAssign.target.children.single() is PtIrRegister)
|
||||
throw AssemblyError("assigning to a register should be done by just evaluating the expression into resultregister")
|
||||
|
||||
val target = augAssign.target
|
||||
@@ -87,7 +87,8 @@ internal class AssignmentGen(private val codeGen: IRCodeGen, private val express
|
||||
val array = target.array
|
||||
val value = augAssign.value
|
||||
val signed = target.type in SignedDatatypes
|
||||
val result = when(augAssign.operator) {
|
||||
|
||||
val chunks = when (augAssign.operator) {
|
||||
"+=" -> operatorPlusInplace(symbol, array, constAddress, memTarget, targetDt, value)
|
||||
"-=" -> operatorMinusInplace(symbol, array, constAddress, memTarget, targetDt, value)
|
||||
"*=" -> operatorMultiplyInplace(symbol, array, constAddress, memTarget, targetDt, value)
|
||||
@@ -109,9 +110,7 @@ internal class AssignmentGen(private val codeGen: IRCodeGen, private val express
|
||||
in PrefixOperators -> inplacePrefix(augAssign.operator, symbol, array, constAddress, memTarget, targetDt)
|
||||
|
||||
else -> throw AssemblyError("invalid augmented assign operator ${augAssign.operator}")
|
||||
}
|
||||
|
||||
val chunks = if(result!=null) result else fallbackAssign(augAssign)
|
||||
} ?: fallbackAssign(augAssign)
|
||||
chunks.filterIsInstance<IRCodeChunk>().firstOrNull()?.appendSrcPosition(augAssign.position)
|
||||
return chunks
|
||||
}
|
||||
@@ -140,7 +139,7 @@ internal class AssignmentGen(private val codeGen: IRCodeGen, private val express
|
||||
return translateRegularAssign(normalAssign)
|
||||
}
|
||||
|
||||
private fun inplacePrefix(operator: String, symbol: String?, array: PtArrayIndexer?, constAddress: Int?, memory: PtMemoryByte?, vmDt: IRDataType): IRCodeChunks? {
|
||||
private fun inplacePrefix(operator: String, symbol: String?, array: PtArrayIndexer?, constAddress: Int?, memory: PtMemoryByte?, vmDt: IRDataType): IRCodeChunks {
|
||||
if(operator=="+")
|
||||
return emptyList()
|
||||
|
||||
@@ -503,9 +502,7 @@ internal class AssignmentGen(private val codeGen: IRCodeGen, private val express
|
||||
addToResult(result, tr, tr.resultReg, -1)
|
||||
return Pair(result, tr.resultReg)
|
||||
}
|
||||
|
||||
val mult: PtExpression
|
||||
mult = PtBinaryExpression("*", DataType.UBYTE, array.position)
|
||||
val mult: PtExpression = PtBinaryExpression("*", DataType.UBYTE, array.position)
|
||||
mult.children += array.index
|
||||
mult.children += PtNumber(DataType.UBYTE, itemsize.toDouble(), array.position)
|
||||
val tr = expressionEval.translateExpression(mult)
|
||||
|
||||
@@ -786,17 +786,21 @@ internal class ExpressionGen(private val codeGen: IRCodeGen) {
|
||||
val result = mutableListOf<IRCodeChunkBase>()
|
||||
val tr = translateExpression(binExpr.left)
|
||||
addToResult(result, tr, tr.resultReg, -1)
|
||||
return if(binExpr.right is PtNumber) {
|
||||
addInstr(result, IRInstruction(Opcode.XOR, vmDt, reg1 = tr.resultReg, immediate = (binExpr.right as PtNumber).number.toInt()), null)
|
||||
ExpressionCodeResult(result, vmDt, tr.resultReg, -1)
|
||||
} else if(binExpr.right is PtBool) {
|
||||
addInstr(result, IRInstruction(Opcode.XOR, vmDt, reg1 = tr.resultReg, immediate = (binExpr.right as PtBool).asInt()), null)
|
||||
ExpressionCodeResult(result, vmDt, tr.resultReg, -1)
|
||||
} else {
|
||||
val rightTr = translateExpression(binExpr.right)
|
||||
addToResult(result, rightTr, rightTr.resultReg, -1)
|
||||
addInstr(result, IRInstruction(Opcode.XORR, vmDt, reg1 = tr.resultReg, reg2 = rightTr.resultReg), null)
|
||||
ExpressionCodeResult(result, vmDt, tr.resultReg, -1)
|
||||
return when (binExpr.right) {
|
||||
is PtNumber -> {
|
||||
addInstr(result, IRInstruction(Opcode.XOR, vmDt, reg1 = tr.resultReg, immediate = (binExpr.right as PtNumber).number.toInt()), null)
|
||||
ExpressionCodeResult(result, vmDt, tr.resultReg, -1)
|
||||
}
|
||||
is PtBool -> {
|
||||
addInstr(result, IRInstruction(Opcode.XOR, vmDt, reg1 = tr.resultReg, immediate = (binExpr.right as PtBool).asInt()), null)
|
||||
ExpressionCodeResult(result, vmDt, tr.resultReg, -1)
|
||||
}
|
||||
else -> {
|
||||
val rightTr = translateExpression(binExpr.right)
|
||||
addToResult(result, rightTr, rightTr.resultReg, -1)
|
||||
addInstr(result, IRInstruction(Opcode.XORR, vmDt, reg1 = tr.resultReg, reg2 = rightTr.resultReg), null)
|
||||
ExpressionCodeResult(result, vmDt, tr.resultReg, -1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,9 +52,6 @@ class IRCodeGen(
|
||||
optimizer.optimize(options.optimize, errors)
|
||||
irProg.validate()
|
||||
|
||||
val regOptimizer = IRRegisterOptimizer(irProg)
|
||||
regOptimizer.optimize()
|
||||
|
||||
return irProg
|
||||
}
|
||||
|
||||
|
||||
@@ -179,8 +179,7 @@ class IRPeepholeOptimizer(private val irprog: IRProgram) {
|
||||
chunks += sub.chunks[0]
|
||||
for(ix in 1 until sub.chunks.size) {
|
||||
val lastChunk = chunks.last()
|
||||
val candidate = sub.chunks[ix]
|
||||
when(candidate) {
|
||||
when(val candidate = sub.chunks[ix]) {
|
||||
is IRCodeChunk -> {
|
||||
if(mayJoinCodeChunks(lastChunk, candidate)) {
|
||||
lastChunk.instructions += candidate.instructions
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
package prog8.codegen.intermediate
|
||||
|
||||
import prog8.intermediate.IRProgram
|
||||
|
||||
|
||||
class IRRegisterOptimizer(private val irProg: IRProgram) {
|
||||
fun optimize() {
|
||||
// reuseRegisters()
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: this register re-use renumbering isn't going to work like this,
|
||||
because subroutines will be clobbering the registers that the subroutine
|
||||
which is calling them might be using...
|
||||
|
||||
|
||||
private fun reuseRegisters() {
|
||||
|
||||
fun addToUsage(usage: MutableMap<Pair<Int, IRDataType>, MutableSet<IRCodeChunkBase>>,
|
||||
regnum: Int,
|
||||
dt: IRDataType,
|
||||
chunk: IRCodeChunkBase) {
|
||||
val key = regnum to dt
|
||||
val chunks = usage[key] ?: mutableSetOf()
|
||||
chunks.add(chunk)
|
||||
usage[key] = chunks
|
||||
}
|
||||
|
||||
val usage: MutableMap<Pair<Int, IRDataType>, MutableSet<IRCodeChunkBase>> = mutableMapOf()
|
||||
|
||||
irProg.foreachCodeChunk { chunk ->
|
||||
chunk.usedRegisters().regsTypes.forEach { (regNum, types) ->
|
||||
types.forEach { dt ->
|
||||
addToUsage(usage, regNum, dt, chunk)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val registerReplacements = usage.asSequence()
|
||||
.filter { it.value.size==1 }
|
||||
.map { it.key to it.value.iterator().next() }
|
||||
.groupBy({ it.second }, {it.first})
|
||||
.asSequence()
|
||||
.associate { (chunk, registers) ->
|
||||
chunk to registers.withIndex().associate { (index, reg) -> reg to 50000+index }
|
||||
}
|
||||
|
||||
registerReplacements.forEach { replaceRegisters(it.key, it.value) }
|
||||
}
|
||||
|
||||
private fun replaceRegisters(chunk: IRCodeChunkBase, replacements: Map<Pair<Int, IRDataType>, Int>) {
|
||||
val (rF, rI) = replacements.asSequence().partition { it.key.second==IRDataType.FLOAT }
|
||||
val replacementsInt = rI.associate { it.key.first to it.value }
|
||||
val replacementsFloat = rF.associate { it.key.first to it.value }
|
||||
|
||||
fun replaceRegs(fcallArgs: FunctionCallArgs?): FunctionCallArgs? {
|
||||
if(fcallArgs==null)
|
||||
return null
|
||||
val args = if(fcallArgs.arguments.isEmpty()) fcallArgs.arguments else {
|
||||
fcallArgs.arguments.map {
|
||||
FunctionCallArgs.ArgumentSpec(
|
||||
it.name,
|
||||
it.address,
|
||||
FunctionCallArgs.RegSpec(
|
||||
it.reg.dt,
|
||||
if(it.reg.dt==IRDataType.FLOAT)
|
||||
replacementsFloat.getOrDefault(it.reg.registerNum, it.reg.registerNum)
|
||||
else
|
||||
replacementsInt.getOrDefault(it.reg.registerNum, it.reg.registerNum),
|
||||
it.reg.cpuRegister
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
val rt = fcallArgs.returns
|
||||
val returns = if(rt==null) null else {
|
||||
FunctionCallArgs.RegSpec(
|
||||
rt.dt,
|
||||
if(rt.dt==IRDataType.FLOAT)
|
||||
replacementsFloat.getOrDefault(rt.registerNum, rt.registerNum)
|
||||
else
|
||||
replacementsInt.getOrDefault(rt.registerNum, rt.registerNum),
|
||||
rt.cpuRegister
|
||||
)
|
||||
}
|
||||
return FunctionCallArgs(args, returns)
|
||||
}
|
||||
|
||||
fun replaceRegs(instruction: IRInstruction): IRInstruction {
|
||||
val reg1 = replacementsInt.getOrDefault(instruction.reg1, instruction.reg1)
|
||||
val reg2 = replacementsInt.getOrDefault(instruction.reg2, instruction.reg2)
|
||||
val fpReg1 = replacementsFloat.getOrDefault(instruction.fpReg1, instruction.fpReg1)
|
||||
val fpReg2 = replacementsFloat.getOrDefault(instruction.fpReg2, instruction.fpReg2)
|
||||
return instruction.copy(reg1 = reg1, reg2 = reg2, fpReg1 = fpReg1, fpReg2 = fpReg2, fcallArgs = replaceRegs(instruction.fcallArgs))
|
||||
}
|
||||
val newInstructions = chunk.instructions.map {
|
||||
replaceRegs(it)
|
||||
}
|
||||
chunk.instructions.clear()
|
||||
chunk.instructions.addAll(newInstructions)
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -6,9 +6,8 @@ plugins {
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(javaVersion)
|
||||
}
|
||||
targetCompatibility = JavaLanguageVersion.of(javaVersion)
|
||||
sourceCompatibility = JavaLanguageVersion.of(javaVersion)
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
@@ -27,7 +26,7 @@ dependencies {
|
||||
implementation project(':codeCore')
|
||||
implementation project(':compilerAst')
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||
implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:1.1.20"
|
||||
implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:2.0.0"
|
||||
// implementation "org.jetbrains.kotlin:kotlin-reflect"
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,8 @@ plugins {
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(javaVersion)
|
||||
}
|
||||
targetCompatibility = JavaLanguageVersion.of(javaVersion)
|
||||
sourceCompatibility = JavaLanguageVersion.of(javaVersion)
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
@@ -36,11 +35,11 @@ dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||
// implementation "org.jetbrains.kotlin:kotlin-reflect"
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-cli:0.3.6'
|
||||
implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:1.1.20"
|
||||
implementation "com.michael-bull.kotlin-result:kotlin-result-jvm:2.0.0"
|
||||
|
||||
testImplementation project(':codeCore')
|
||||
testImplementation project(':intermediate')
|
||||
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.8.0'
|
||||
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.9.0'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
|
||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||
|
||||
|
||||
@@ -688,7 +688,7 @@ io_error:
|
||||
}
|
||||
|
||||
sub send_command(uword commandptr) {
|
||||
; -- send a dos command to the drive
|
||||
; -- send a dos command to the drive (don't read any response)
|
||||
cbm.SETNAM(string.length(commandptr), commandptr)
|
||||
cbm.SETLFS(15, drivenumber, 15)
|
||||
void cbm.OPEN()
|
||||
@@ -869,7 +869,6 @@ io_error:
|
||||
command[3] = msb(pos_loword)
|
||||
command[4] = lsb(pos_hiword)
|
||||
command[5] = msb(pos_hiword)
|
||||
send_command:
|
||||
cbm.SETNAM(sizeof(command), &command)
|
||||
cbm.SETLFS(15, drivenumber, 15)
|
||||
void cbm.OPEN()
|
||||
@@ -892,4 +891,55 @@ io_error:
|
||||
reset_write_channel() ; back to the write io channel
|
||||
}
|
||||
|
||||
asmsub f_tell() -> uword @R0, uword @R1, uword @R2, uword @R3 {
|
||||
; -- Returns the current read position of the opened read file,
|
||||
; in R0 and R1 (low + high words) and the file size in R2 and R3 (low + high words).
|
||||
; Returns 0 as size if the command is not supported by the DOS implementation/version.
|
||||
%asm {{
|
||||
jmp internal_f_tell
|
||||
}}
|
||||
}
|
||||
|
||||
sub internal_f_tell() {
|
||||
; gets the (32 bits) position + file size of the opened read file channel
|
||||
ubyte[2] command = ['t',0]
|
||||
command[1] = READ_IO_CHANNEL ; f_open uses this secondary address
|
||||
cbm.SETNAM(sizeof(command), &command)
|
||||
cbm.SETLFS(15, drivenumber, 15)
|
||||
void cbm.OPEN()
|
||||
void cbm.CHKIN(15) ; use #15 as input channel
|
||||
bool success=false
|
||||
; valid response starts with "07," followed by hex notations of the position and filesize
|
||||
if cbm.CHRIN()=='0' and cbm.CHRIN()=='7' and cbm.CHRIN()==',' {
|
||||
cx16.r1 = read4hex()
|
||||
cx16.r0 = read4hex() ; position in R1:R0
|
||||
void cbm.CHRIN() ; separator space
|
||||
cx16.r3 = read4hex()
|
||||
cx16.r2 = read4hex() ; filesize in R3:R2
|
||||
success = true
|
||||
}
|
||||
|
||||
while cbm.READST()==0 {
|
||||
cx16.r5L = cbm.CHRIN()
|
||||
if cx16.r5L=='\r' or cx16.r5L=='\n'
|
||||
break
|
||||
}
|
||||
|
||||
cbm.CLOSE(15)
|
||||
reset_read_channel() ; back to the read io channel
|
||||
if success
|
||||
return
|
||||
|
||||
cx16.r0 = cx16.r1 = cx16.r2 = cx16.r3 = 0
|
||||
|
||||
sub read4hex() -> uword {
|
||||
str hex = "0000"
|
||||
hex[0] = cbm.CHRIN()
|
||||
hex[1] = cbm.CHRIN()
|
||||
hex[2] = cbm.CHRIN()
|
||||
hex[3] = cbm.CHRIN()
|
||||
return conv.hex2uword(hex)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -466,7 +466,7 @@ romsub $fec0 = kbdbuf_get_modifiers() -> ubyte @A
|
||||
romsub $fec3 = kbdbuf_put(ubyte key @A) clobbers(X)
|
||||
romsub $fed2 = keymap(uword identifier @XY, bool read @Pc) -> bool @Pc
|
||||
romsub $ff68 = mouse_config(byte shape @A, ubyte resX @X, ubyte resY @Y) clobbers (A, X, Y)
|
||||
romsub $ff6b = mouse_get(ubyte zpdataptr @X) -> ubyte @A ; use mouse_pos() instead
|
||||
romsub $ff6b = mouse_get(ubyte zdataptr @X) -> ubyte @A, byte @X ; use mouse_pos() instead
|
||||
romsub $ff71 = mouse_scan() clobbers(A, X, Y)
|
||||
romsub $ff53 = joystick_scan() clobbers(A, X, Y)
|
||||
romsub $ff56 = joystick_get(ubyte joynr @A) -> uword @AX, bool @Y ; note: everything is inverted
|
||||
@@ -549,6 +549,7 @@ const ubyte EXTAPI_ps2data_raw = $09
|
||||
const ubyte EXTAPI_cursor_blink = $0A
|
||||
const ubyte EXTAPI_led_update = $0B
|
||||
const ubyte EXTAPI_mouse_set_position = $0C
|
||||
const ubyte EXTAPI_scnsiz = $0D ; rom R48+
|
||||
|
||||
; extapi16 call numbers
|
||||
const ubyte EXTAPI16_test = $00
|
||||
@@ -587,9 +588,9 @@ asmsub mouse_config2(byte shape @A) clobbers (A, X, Y) {
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub mouse_pos() clobbers(X) -> ubyte @A, word @R0, word @R1 {
|
||||
asmsub mouse_pos() -> ubyte @A, uword @R0, uword @R1, byte @X {
|
||||
; -- short wrapper around mouse_get() kernal routine:
|
||||
; -- gets the position of the mouse cursor in cx16.r0 and cx16.r1 (x/y coordinate), returns mouse button status in A.
|
||||
; -- gets the position of the mouse cursor in cx16.r0 and cx16.r1 (x/y coordinate), returns mouse button status in A, scroll wheel in X.
|
||||
; Note: mouse pointer needs to be enabled for this to do anything.
|
||||
%asm {{
|
||||
ldx #cx16.r0
|
||||
@@ -642,6 +643,15 @@ asmsub iso_cursor_char(ubyte character @X) clobbers(A,X,Y) {
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub scnsiz(ubyte width @X, ubyte heigth @Y) clobbers(A,X,Y) {
|
||||
; -- sets the screen editor size dimensions (without changing the graphical screen mode itself)
|
||||
; (rom R48+)
|
||||
%asm {{
|
||||
lda #EXTAPI_scnsiz
|
||||
jmp cx16.extapi
|
||||
}}
|
||||
}
|
||||
|
||||
; TODO : implement shims for the remaining extapi calls.
|
||||
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ string {
|
||||
sub find(str st, ubyte character) -> ubyte {
|
||||
; Locates the first position of the given character in the string,
|
||||
; returns Carry set if found + index in A, or Carry clear if not found (and A will be 255, an invalid index).
|
||||
; NOTE: because this isn't an asmsub, there's only a SINGLE return value here. On the c64/cx16 targets etc there are 2 return values.
|
||||
ubyte ix
|
||||
for ix in 0 to length(st)-1 {
|
||||
if st[ix]==character {
|
||||
|
||||
@@ -56,7 +56,7 @@ private fun compileMain(args: Array<String>): Boolean {
|
||||
val printAst1 by cli.option(ArgType.Boolean, fullName = "printast1", description = "print out the compiler AST")
|
||||
val printAst2 by cli.option(ArgType.Boolean, fullName = "printast2", description = "print out the intermediate AST that is used for code generation")
|
||||
val breakpointCpuInstruction by cli.option(ArgType.Choice(listOf("brk", "stp"), { it }), fullName = "breakinstr", description = "the CPU instruction to use as well for %breakpoint")
|
||||
val compilationTarget by cli.option(ArgType.String, fullName = "target", description = "target output of the compiler (one of '${C64Target.NAME}', '${C128Target.NAME}', '${Cx16Target.NAME}', '${AtariTarget.NAME}', '${PETTarget.NAME}', '${VMTarget.NAME}') (required)")
|
||||
val compilationTarget by cli.option(ArgType.String, fullName = "target", description = "target output of the compiler (one of ${CompilationTargets.joinToString(",")}) (required)")
|
||||
val bytes2float by cli.option(ArgType.String, fullName = "bytes2float", description = "convert a comma separated list of bytes from the target system to a float value. NOTE: you need to supply a target option too, and also still have to supply a dummy module file name as well!")
|
||||
val float2bytes by cli.option(ArgType.String, fullName = "float2bytes", description = "convert floating point number to a list of bytes for the target system. NOTE: you need to supply a target option too, and also still have to supply a dummy module file name as well!")
|
||||
val startVm by cli.option(ArgType.Boolean, fullName = "vm", description = "load and run a .p8ir IR source file in the VM")
|
||||
@@ -96,7 +96,7 @@ private fun compileMain(args: Array<String>): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
if (compilationTarget !in setOf(C64Target.NAME, C128Target.NAME, Cx16Target.NAME, AtariTarget.NAME, PETTarget.NAME, VMTarget.NAME)) {
|
||||
if (compilationTarget !in CompilationTargets) {
|
||||
System.err.println("Invalid compilation target: $compilationTarget")
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -570,6 +570,13 @@ internal class AstChecker(private val program: Program,
|
||||
checkType(assignment.target, assignment.value, assignment.isAugmentable)
|
||||
}
|
||||
|
||||
if(assignment.target.void && assignment.target.multi?.isNotEmpty()!=true) {
|
||||
if(assignment.value is IFunctionCall)
|
||||
errors.err("cannot assign to 'void', perhaps a void function call was intended", assignment.position)
|
||||
else
|
||||
errors.err("cannot assign to 'void'", assignment.position)
|
||||
return
|
||||
}
|
||||
|
||||
val fcall = assignment.value as? IFunctionCall
|
||||
val fcallTarget = fcall?.target?.targetSubroutine(program)
|
||||
@@ -837,6 +844,11 @@ internal class AstChecker(private val program: Program,
|
||||
if(compilerOptions.zeropage==ZeropageType.DONTUSE && decl.zeropage == ZeropageWish.REQUIRE_ZEROPAGE)
|
||||
err("zeropage usage has been disabled by options")
|
||||
|
||||
if(decl.splitArray) {
|
||||
if (decl.datatype !in arrayOf(DataType.ARRAY_W, DataType.ARRAY_UW, DataType.ARRAY_W_SPLIT, DataType.ARRAY_UW_SPLIT)) {
|
||||
errors.err("split can only be used on word arrays", decl.position)
|
||||
}
|
||||
}
|
||||
super.visit(decl)
|
||||
}
|
||||
|
||||
@@ -939,7 +951,7 @@ internal class AstChecker(private val program: Program,
|
||||
err("this directive may only occur at module level")
|
||||
val allowedEncodings = Encoding.entries.map {it.prefix}
|
||||
if(directive.args.size!=1 || directive.args[0].name !in allowedEncodings)
|
||||
err("invalid encoding directive, expected one of ${allowedEncodings}")
|
||||
err("invalid encoding directive, expected one of $allowedEncodings")
|
||||
}
|
||||
else -> throw SyntaxError("invalid directive ${directive.directive}", directive.position)
|
||||
}
|
||||
|
||||
@@ -332,8 +332,7 @@ class TypecastsAdder(val program: Program, val options: CompilationOptions, val
|
||||
private fun afterFunctionCallArgs(call: IFunctionCall): Iterable<IAstModification> {
|
||||
// see if a typecast is needed to convert the arguments into the required parameter type
|
||||
val modifications = mutableListOf<IAstModification>()
|
||||
val sub = call.target.targetStatement(program)
|
||||
val params = when(sub) {
|
||||
val params = when(val sub = call.target.targetStatement(program)) {
|
||||
is BuiltinFunctionPlaceholder -> BuiltinFunctions.getValue(sub.name).parameters
|
||||
is Subroutine -> sub.parameters.map { FParam(it.name, listOf(it.type).toTypedArray()) }
|
||||
else -> emptyList()
|
||||
|
||||
@@ -205,18 +205,20 @@ internal class VariousCleanups(val program: Program, val errors: IErrorReporter,
|
||||
}
|
||||
|
||||
fun checkArray(variable: VarDecl): Iterable<IAstModification> {
|
||||
return if(variable.value==null) {
|
||||
val arraySpec = variable.arraysize!!
|
||||
val size = arraySpec.indexExpr.constValue(program)?.number?.toInt() ?: throw FatalAstException("no array size")
|
||||
return if(size==0)
|
||||
replaceWithFalse()
|
||||
else
|
||||
noModifications
|
||||
return when (variable.value) {
|
||||
null -> {
|
||||
val arraySpec = variable.arraysize!!
|
||||
val size = arraySpec.indexExpr.constValue(program)?.number?.toInt() ?: throw FatalAstException("no array size")
|
||||
return if(size==0)
|
||||
replaceWithFalse()
|
||||
else
|
||||
noModifications
|
||||
}
|
||||
is ArrayLiteral -> {
|
||||
checkArray((variable.value as ArrayLiteral).value)
|
||||
}
|
||||
else -> noModifications
|
||||
}
|
||||
else if(variable.value is ArrayLiteral) {
|
||||
checkArray((variable.value as ArrayLiteral).value)
|
||||
}
|
||||
else noModifications
|
||||
}
|
||||
|
||||
fun checkString(stringVal: StringLiteral): Iterable<IAstModification> {
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package prog8tests
|
||||
|
||||
import io.kotest.core.config.AbstractProjectConfig
|
||||
import io.kotest.core.spec.SpecExecutionOrder
|
||||
import io.kotest.core.test.TestCaseOrder
|
||||
|
||||
object ProjectConfig : AbstractProjectConfig() {
|
||||
override val parallelism = kotlin.math.max(1, Runtime.getRuntime().availableProcessors() / 2)
|
||||
override val testCaseOrder = TestCaseOrder.Lexicographic
|
||||
override val specExecutionOrder = SpecExecutionOrder.Lexicographic
|
||||
override val parallelism = kotlin.math.max(1, Runtime.getRuntime().availableProcessors()-1)
|
||||
// override fun listeners() = listOf(SystemOutToNullListener)
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -4,6 +4,7 @@ import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.shouldBe
|
||||
import io.kotest.matchers.shouldNotBe
|
||||
import io.kotest.matchers.string.shouldContain
|
||||
import io.kotest.matchers.string.shouldEndWith
|
||||
import io.kotest.matchers.types.instanceOf
|
||||
import prog8.ast.IFunctionCall
|
||||
import prog8.ast.expressions.*
|
||||
@@ -612,5 +613,30 @@ main {
|
||||
}"""
|
||||
compileText(Cx16Target(), false, src) shouldNotBe null
|
||||
}
|
||||
|
||||
test("void assignment is invalid") {
|
||||
val src="""
|
||||
main {
|
||||
romsub $2000 = multi() -> ubyte @A, ubyte @Y
|
||||
romsub $3000 = single() -> ubyte @A
|
||||
|
||||
sub start() {
|
||||
void, void = multi() ; ok
|
||||
cx16.r0L, void = multi() ; ok
|
||||
void, cx16.r0L = multi() ; ok
|
||||
void multi() ; ok
|
||||
void single() ; ok
|
||||
void = 3333 ; fail!
|
||||
void = single() ; fail!
|
||||
void = multi() ; fail!
|
||||
}
|
||||
}"""
|
||||
val errors = ErrorReporterForTests()
|
||||
compileText(C64Target(), optimize=false, src, writeAssembly=true, errors = errors) shouldBe null
|
||||
errors.errors.size shouldBe 3
|
||||
errors.errors[0] shouldEndWith "cannot assign to 'void'"
|
||||
errors.errors[1] shouldEndWith "cannot assign to 'void', perhaps a void function call was intended"
|
||||
errors.errors[2] shouldEndWith "cannot assign to 'void', perhaps a void function call was intended"
|
||||
}
|
||||
})
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,956 +0,0 @@
|
||||
|
||||
%import textio
|
||||
%import floats
|
||||
%import test_stack
|
||||
%zeropage dontuse
|
||||
%option no_sysinit
|
||||
|
||||
main {
|
||||
ubyte success = 0
|
||||
str datatype = "byte"
|
||||
uword @shared comparison
|
||||
|
||||
sub start() {
|
||||
txt.print("\ngreater-than tests for: ")
|
||||
txt.print(datatype)
|
||||
txt.nl()
|
||||
test_stack.test()
|
||||
txt.print("\n>number: ")
|
||||
test_cmp_number()
|
||||
txt.print("\n>var: ")
|
||||
test_cmp_var()
|
||||
txt.print("\n>array[]: ")
|
||||
test_cmp_array()
|
||||
txt.print("\n>expr: ")
|
||||
test_cmp_expr()
|
||||
test_stack.test()
|
||||
}
|
||||
|
||||
sub verify_success(ubyte expected) {
|
||||
if success==expected {
|
||||
txt.print("ok")
|
||||
} else {
|
||||
txt.print(" **failed** ")
|
||||
txt.print_ub(success)
|
||||
txt.print(" success, expected ")
|
||||
txt.print_ub(expected)
|
||||
}
|
||||
}
|
||||
|
||||
sub fail_byte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_ubyte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_word(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_uword(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_float(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
|
||||
sub test_cmp_number() {
|
||||
byte @shared x
|
||||
success = 0
|
||||
x=-1
|
||||
; direct jump
|
||||
if x>-1
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_byte(1)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>-1
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_byte(2)
|
||||
skip1b:
|
||||
; no else
|
||||
if x>-1
|
||||
fail_byte(3)
|
||||
|
||||
; with else
|
||||
if x>-1
|
||||
fail_byte(4)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x>0
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_byte(5)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>0
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_byte(6)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>0
|
||||
fail_byte(7)
|
||||
|
||||
; with else
|
||||
if x>0
|
||||
fail_byte(8)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x>1
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_byte(9)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>1
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_byte(10)
|
||||
skip3b:
|
||||
; no else
|
||||
if x>1
|
||||
fail_byte(11)
|
||||
|
||||
; with else
|
||||
if x>1
|
||||
fail_byte(12)
|
||||
else
|
||||
success++
|
||||
|
||||
x=0
|
||||
; direct jump
|
||||
if x>-1
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>-1
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x>-1
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>-1
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>0
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: fail_byte(13)
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x>0
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: fail_byte(14)
|
||||
skip5b:
|
||||
; no else
|
||||
if x>0
|
||||
fail_byte(15)
|
||||
|
||||
; with else
|
||||
if x>0
|
||||
fail_byte(16)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x>1
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: fail_byte(17)
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x>1
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: fail_byte(18)
|
||||
skip6b:
|
||||
; no else
|
||||
if x>1
|
||||
fail_byte(19)
|
||||
|
||||
; with else
|
||||
if x>1
|
||||
fail_byte(20)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1
|
||||
; direct jump
|
||||
if x>-1
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: success++
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x>-1
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: success++
|
||||
skip7b:
|
||||
; no else
|
||||
if x>-1
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>-1
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>0
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: success++
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x>0
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: success++
|
||||
skip8b:
|
||||
; no else
|
||||
if x>0
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>0
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>1
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: fail_byte(21)
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x>1
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: fail_byte(22)
|
||||
skip9b:
|
||||
; no else
|
||||
if x>1
|
||||
fail_byte(23)
|
||||
|
||||
; with else
|
||||
if x>1
|
||||
fail_byte(24)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(18)
|
||||
}
|
||||
sub test_cmp_var() {
|
||||
byte @shared x, value
|
||||
success = 0
|
||||
x=-1
|
||||
value=-1
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_byte(25)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_byte(26)
|
||||
skip1b:
|
||||
; no else
|
||||
if x>value
|
||||
fail_byte(27)
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
fail_byte(28)
|
||||
else
|
||||
success++
|
||||
|
||||
value=0
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_byte(29)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_byte(30)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>value
|
||||
fail_byte(31)
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
fail_byte(32)
|
||||
else
|
||||
success++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_byte(33)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_byte(34)
|
||||
skip3b:
|
||||
; no else
|
||||
if x>value
|
||||
fail_byte(35)
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
fail_byte(36)
|
||||
else
|
||||
success++
|
||||
|
||||
x=0
|
||||
value=-1
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x>value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=0
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: fail_byte(37)
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: fail_byte(38)
|
||||
skip5b:
|
||||
; no else
|
||||
if x>value
|
||||
fail_byte(39)
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
fail_byte(40)
|
||||
else
|
||||
success++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: fail_byte(41)
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: fail_byte(42)
|
||||
skip6b:
|
||||
; no else
|
||||
if x>value
|
||||
fail_byte(43)
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
fail_byte(44)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1
|
||||
value=-1
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: success++
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: success++
|
||||
skip7b:
|
||||
; no else
|
||||
if x>value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=0
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: success++
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: success++
|
||||
skip8b:
|
||||
; no else
|
||||
if x>value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: fail_byte(45)
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: fail_byte(46)
|
||||
skip9b:
|
||||
; no else
|
||||
if x>value
|
||||
fail_byte(47)
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
fail_byte(48)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(18)
|
||||
}
|
||||
sub test_cmp_array() {
|
||||
byte @shared x
|
||||
byte[] values = [0, 0]
|
||||
success = 0
|
||||
x=-1
|
||||
values[1]=-1
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_byte(49)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_byte(50)
|
||||
skip1b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_byte(51)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_byte(52)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_byte(53)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_byte(54)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_byte(55)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_byte(56)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_byte(57)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_byte(58)
|
||||
skip3b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_byte(59)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_byte(60)
|
||||
else
|
||||
success++
|
||||
|
||||
x=0
|
||||
values[1]=-1
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: fail_byte(61)
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: fail_byte(62)
|
||||
skip5b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_byte(63)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_byte(64)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: fail_byte(65)
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: fail_byte(66)
|
||||
skip6b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_byte(67)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_byte(68)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1
|
||||
values[1]=-1
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: success++
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: success++
|
||||
skip7b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: success++
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: success++
|
||||
skip8b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: fail_byte(69)
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: fail_byte(70)
|
||||
skip9b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_byte(71)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_byte(72)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(18)
|
||||
}
|
||||
sub test_cmp_expr() {
|
||||
byte @shared x
|
||||
cx16.r4 = 1
|
||||
cx16.r5 = 1
|
||||
float @shared f4 = 1.0
|
||||
float @shared f5 = 1.0
|
||||
success = 0
|
||||
x=-1
|
||||
; direct jump
|
||||
if x>cx16.r4sL+-1-cx16.r5sL
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_byte(73)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>cx16.r4sL+-1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_byte(74)
|
||||
skip1b:
|
||||
; no else
|
||||
if x>cx16.r4sL+-1-cx16.r5sL
|
||||
fail_byte(75)
|
||||
|
||||
; with else
|
||||
if x>cx16.r4sL+-1-cx16.r5sL
|
||||
fail_byte(76)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x>cx16.r4sL+0-cx16.r5sL
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_byte(77)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>cx16.r4sL+0-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_byte(78)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>cx16.r4sL+0-cx16.r5sL
|
||||
fail_byte(79)
|
||||
|
||||
; with else
|
||||
if x>cx16.r4sL+0-cx16.r5sL
|
||||
fail_byte(80)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x>cx16.r4sL+1-cx16.r5sL
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_byte(81)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>cx16.r4sL+1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_byte(82)
|
||||
skip3b:
|
||||
; no else
|
||||
if x>cx16.r4sL+1-cx16.r5sL
|
||||
fail_byte(83)
|
||||
|
||||
; with else
|
||||
if x>cx16.r4sL+1-cx16.r5sL
|
||||
fail_byte(84)
|
||||
else
|
||||
success++
|
||||
|
||||
x=0
|
||||
; direct jump
|
||||
if x>cx16.r4sL+-1-cx16.r5sL
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>cx16.r4sL+-1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x>cx16.r4sL+-1-cx16.r5sL
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>cx16.r4sL+-1-cx16.r5sL
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>cx16.r4sL+0-cx16.r5sL
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: fail_byte(85)
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x>cx16.r4sL+0-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: fail_byte(86)
|
||||
skip5b:
|
||||
; no else
|
||||
if x>cx16.r4sL+0-cx16.r5sL
|
||||
fail_byte(87)
|
||||
|
||||
; with else
|
||||
if x>cx16.r4sL+0-cx16.r5sL
|
||||
fail_byte(88)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x>cx16.r4sL+1-cx16.r5sL
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: fail_byte(89)
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x>cx16.r4sL+1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: fail_byte(90)
|
||||
skip6b:
|
||||
; no else
|
||||
if x>cx16.r4sL+1-cx16.r5sL
|
||||
fail_byte(91)
|
||||
|
||||
; with else
|
||||
if x>cx16.r4sL+1-cx16.r5sL
|
||||
fail_byte(92)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1
|
||||
; direct jump
|
||||
if x>cx16.r4sL+-1-cx16.r5sL
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: success++
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x>cx16.r4sL+-1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: success++
|
||||
skip7b:
|
||||
; no else
|
||||
if x>cx16.r4sL+-1-cx16.r5sL
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>cx16.r4sL+-1-cx16.r5sL
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>cx16.r4sL+0-cx16.r5sL
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: success++
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x>cx16.r4sL+0-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: success++
|
||||
skip8b:
|
||||
; no else
|
||||
if x>cx16.r4sL+0-cx16.r5sL
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>cx16.r4sL+0-cx16.r5sL
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>cx16.r4sL+1-cx16.r5sL
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: fail_byte(93)
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x>cx16.r4sL+1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: fail_byte(94)
|
||||
skip9b:
|
||||
; no else
|
||||
if x>cx16.r4sL+1-cx16.r5sL
|
||||
fail_byte(95)
|
||||
|
||||
; with else
|
||||
if x>cx16.r4sL+1-cx16.r5sL
|
||||
fail_byte(96)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(18)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,956 +0,0 @@
|
||||
|
||||
%import textio
|
||||
%import floats
|
||||
%import test_stack
|
||||
%zeropage dontuse
|
||||
%option no_sysinit
|
||||
|
||||
main {
|
||||
ubyte success = 0
|
||||
str datatype = "byte"
|
||||
uword @shared comparison
|
||||
|
||||
sub start() {
|
||||
txt.print("\ngreater-equal tests for: ")
|
||||
txt.print(datatype)
|
||||
txt.nl()
|
||||
test_stack.test()
|
||||
txt.print("\n>=number: ")
|
||||
test_cmp_number()
|
||||
txt.print("\n>=var: ")
|
||||
test_cmp_var()
|
||||
txt.print("\n>=array[]: ")
|
||||
test_cmp_array()
|
||||
txt.print("\n>=expr: ")
|
||||
test_cmp_expr()
|
||||
test_stack.test()
|
||||
}
|
||||
|
||||
sub verify_success(ubyte expected) {
|
||||
if success==expected {
|
||||
txt.print("ok")
|
||||
} else {
|
||||
txt.print(" **failed** ")
|
||||
txt.print_ub(success)
|
||||
txt.print(" success, expected ")
|
||||
txt.print_ub(expected)
|
||||
}
|
||||
}
|
||||
|
||||
sub fail_byte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_ubyte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_word(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_uword(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_float(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
|
||||
sub test_cmp_number() {
|
||||
byte @shared x
|
||||
success = 0
|
||||
x=-1
|
||||
; direct jump
|
||||
if x>=-1
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>=-1
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x>=-1
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=-1
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=0
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_byte(1)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>=0
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_byte(2)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>=0
|
||||
fail_byte(3)
|
||||
|
||||
; with else
|
||||
if x>=0
|
||||
fail_byte(4)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x>=1
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_byte(5)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>=1
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_byte(6)
|
||||
skip3b:
|
||||
; no else
|
||||
if x>=1
|
||||
fail_byte(7)
|
||||
|
||||
; with else
|
||||
if x>=1
|
||||
fail_byte(8)
|
||||
else
|
||||
success++
|
||||
|
||||
x=0
|
||||
; direct jump
|
||||
if x>=-1
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>=-1
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x>=-1
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=-1
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=0
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: success++
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x>=0
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: success++
|
||||
skip5b:
|
||||
; no else
|
||||
if x>=0
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=0
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=1
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: fail_byte(9)
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x>=1
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: fail_byte(10)
|
||||
skip6b:
|
||||
; no else
|
||||
if x>=1
|
||||
fail_byte(11)
|
||||
|
||||
; with else
|
||||
if x>=1
|
||||
fail_byte(12)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1
|
||||
; direct jump
|
||||
if x>=-1
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: success++
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x>=-1
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: success++
|
||||
skip7b:
|
||||
; no else
|
||||
if x>=-1
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=-1
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=0
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: success++
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x>=0
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: success++
|
||||
skip8b:
|
||||
; no else
|
||||
if x>=0
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=0
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=1
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: success++
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x>=1
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: success++
|
||||
skip9b:
|
||||
; no else
|
||||
if x>=1
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=1
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(27)
|
||||
}
|
||||
sub test_cmp_var() {
|
||||
byte @shared x, value
|
||||
success = 0
|
||||
x=-1
|
||||
value=-1
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x>=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=0
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_byte(13)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_byte(14)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>=value
|
||||
fail_byte(15)
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
fail_byte(16)
|
||||
else
|
||||
success++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_byte(17)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_byte(18)
|
||||
skip3b:
|
||||
; no else
|
||||
if x>=value
|
||||
fail_byte(19)
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
fail_byte(20)
|
||||
else
|
||||
success++
|
||||
|
||||
x=0
|
||||
value=-1
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x>=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=0
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: success++
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: success++
|
||||
skip5b:
|
||||
; no else
|
||||
if x>=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: fail_byte(21)
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: fail_byte(22)
|
||||
skip6b:
|
||||
; no else
|
||||
if x>=value
|
||||
fail_byte(23)
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
fail_byte(24)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1
|
||||
value=-1
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: success++
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: success++
|
||||
skip7b:
|
||||
; no else
|
||||
if x>=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=0
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: success++
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: success++
|
||||
skip8b:
|
||||
; no else
|
||||
if x>=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: success++
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: success++
|
||||
skip9b:
|
||||
; no else
|
||||
if x>=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(27)
|
||||
}
|
||||
sub test_cmp_array() {
|
||||
byte @shared x
|
||||
byte[] values = [0, 0]
|
||||
success = 0
|
||||
x=-1
|
||||
values[1]=-1
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_byte(25)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_byte(26)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
fail_byte(27)
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
fail_byte(28)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_byte(29)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_byte(30)
|
||||
skip3b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
fail_byte(31)
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
fail_byte(32)
|
||||
else
|
||||
success++
|
||||
|
||||
x=0
|
||||
values[1]=-1
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: success++
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: success++
|
||||
skip5b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: fail_byte(33)
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: fail_byte(34)
|
||||
skip6b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
fail_byte(35)
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
fail_byte(36)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1
|
||||
values[1]=-1
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: success++
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: success++
|
||||
skip7b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: success++
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: success++
|
||||
skip8b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: success++
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: success++
|
||||
skip9b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(27)
|
||||
}
|
||||
sub test_cmp_expr() {
|
||||
byte @shared x
|
||||
cx16.r4 = 1
|
||||
cx16.r5 = 1
|
||||
float @shared f4 = 1.0
|
||||
float @shared f5 = 1.0
|
||||
success = 0
|
||||
x=-1
|
||||
; direct jump
|
||||
if x>=cx16.r4sL+-1-cx16.r5sL
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>=cx16.r4sL+-1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x>=cx16.r4sL+-1-cx16.r5sL
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=cx16.r4sL+-1-cx16.r5sL
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=cx16.r4sL+0-cx16.r5sL
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_byte(37)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>=cx16.r4sL+0-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_byte(38)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>=cx16.r4sL+0-cx16.r5sL
|
||||
fail_byte(39)
|
||||
|
||||
; with else
|
||||
if x>=cx16.r4sL+0-cx16.r5sL
|
||||
fail_byte(40)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x>=cx16.r4sL+1-cx16.r5sL
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_byte(41)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>=cx16.r4sL+1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_byte(42)
|
||||
skip3b:
|
||||
; no else
|
||||
if x>=cx16.r4sL+1-cx16.r5sL
|
||||
fail_byte(43)
|
||||
|
||||
; with else
|
||||
if x>=cx16.r4sL+1-cx16.r5sL
|
||||
fail_byte(44)
|
||||
else
|
||||
success++
|
||||
|
||||
x=0
|
||||
; direct jump
|
||||
if x>=cx16.r4sL+-1-cx16.r5sL
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>=cx16.r4sL+-1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x>=cx16.r4sL+-1-cx16.r5sL
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=cx16.r4sL+-1-cx16.r5sL
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=cx16.r4sL+0-cx16.r5sL
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: success++
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x>=cx16.r4sL+0-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: success++
|
||||
skip5b:
|
||||
; no else
|
||||
if x>=cx16.r4sL+0-cx16.r5sL
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=cx16.r4sL+0-cx16.r5sL
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=cx16.r4sL+1-cx16.r5sL
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: fail_byte(45)
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x>=cx16.r4sL+1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: fail_byte(46)
|
||||
skip6b:
|
||||
; no else
|
||||
if x>=cx16.r4sL+1-cx16.r5sL
|
||||
fail_byte(47)
|
||||
|
||||
; with else
|
||||
if x>=cx16.r4sL+1-cx16.r5sL
|
||||
fail_byte(48)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1
|
||||
; direct jump
|
||||
if x>=cx16.r4sL+-1-cx16.r5sL
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: success++
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x>=cx16.r4sL+-1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: success++
|
||||
skip7b:
|
||||
; no else
|
||||
if x>=cx16.r4sL+-1-cx16.r5sL
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=cx16.r4sL+-1-cx16.r5sL
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=cx16.r4sL+0-cx16.r5sL
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: success++
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x>=cx16.r4sL+0-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: success++
|
||||
skip8b:
|
||||
; no else
|
||||
if x>=cx16.r4sL+0-cx16.r5sL
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=cx16.r4sL+0-cx16.r5sL
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=cx16.r4sL+1-cx16.r5sL
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: success++
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x>=cx16.r4sL+1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: success++
|
||||
skip9b:
|
||||
; no else
|
||||
if x>=cx16.r4sL+1-cx16.r5sL
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=cx16.r4sL+1-cx16.r5sL
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(27)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,956 +0,0 @@
|
||||
|
||||
%import textio
|
||||
%import floats
|
||||
%import test_stack
|
||||
%zeropage dontuse
|
||||
%option no_sysinit
|
||||
|
||||
main {
|
||||
ubyte success = 0
|
||||
str datatype = "byte"
|
||||
uword @shared comparison
|
||||
|
||||
sub start() {
|
||||
txt.print("\nless-than tests for: ")
|
||||
txt.print(datatype)
|
||||
txt.nl()
|
||||
test_stack.test()
|
||||
txt.print("\n<number: ")
|
||||
test_cmp_number()
|
||||
txt.print("\n<var: ")
|
||||
test_cmp_var()
|
||||
txt.print("\n<array[]: ")
|
||||
test_cmp_array()
|
||||
txt.print("\n<expr: ")
|
||||
test_cmp_expr()
|
||||
test_stack.test()
|
||||
}
|
||||
|
||||
sub verify_success(ubyte expected) {
|
||||
if success==expected {
|
||||
txt.print("ok")
|
||||
} else {
|
||||
txt.print(" **failed** ")
|
||||
txt.print_ub(success)
|
||||
txt.print(" success, expected ")
|
||||
txt.print_ub(expected)
|
||||
}
|
||||
}
|
||||
|
||||
sub fail_byte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_ubyte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_word(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_uword(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_float(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
|
||||
sub test_cmp_number() {
|
||||
byte @shared x
|
||||
success = 0
|
||||
x=-1
|
||||
; direct jump
|
||||
if x<-1
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_byte(1)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<-1
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_byte(2)
|
||||
skip1b:
|
||||
; no else
|
||||
if x<-1
|
||||
fail_byte(3)
|
||||
|
||||
; with else
|
||||
if x<-1
|
||||
fail_byte(4)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<0
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<0
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<0
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<0
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x<1
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<1
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x<1
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<1
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=0
|
||||
; direct jump
|
||||
if x<-1
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_byte(5)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<-1
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_byte(6)
|
||||
skip4b:
|
||||
; no else
|
||||
if x<-1
|
||||
fail_byte(7)
|
||||
|
||||
; with else
|
||||
if x<-1
|
||||
fail_byte(8)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<0
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: fail_byte(9)
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x<0
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: fail_byte(10)
|
||||
skip5b:
|
||||
; no else
|
||||
if x<0
|
||||
fail_byte(11)
|
||||
|
||||
; with else
|
||||
if x<0
|
||||
fail_byte(12)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<1
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: success++
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x<1
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: success++
|
||||
skip6b:
|
||||
; no else
|
||||
if x<1
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<1
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1
|
||||
; direct jump
|
||||
if x<-1
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: fail_byte(13)
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x<-1
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: fail_byte(14)
|
||||
skip7b:
|
||||
; no else
|
||||
if x<-1
|
||||
fail_byte(15)
|
||||
|
||||
; with else
|
||||
if x<-1
|
||||
fail_byte(16)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<0
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: fail_byte(17)
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x<0
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: fail_byte(18)
|
||||
skip8b:
|
||||
; no else
|
||||
if x<0
|
||||
fail_byte(19)
|
||||
|
||||
; with else
|
||||
if x<0
|
||||
fail_byte(20)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<1
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: fail_byte(21)
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x<1
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: fail_byte(22)
|
||||
skip9b:
|
||||
; no else
|
||||
if x<1
|
||||
fail_byte(23)
|
||||
|
||||
; with else
|
||||
if x<1
|
||||
fail_byte(24)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(18)
|
||||
}
|
||||
sub test_cmp_var() {
|
||||
byte @shared x, value
|
||||
success = 0
|
||||
x=-1
|
||||
value=-1
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_byte(25)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_byte(26)
|
||||
skip1b:
|
||||
; no else
|
||||
if x<value
|
||||
fail_byte(27)
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
fail_byte(28)
|
||||
else
|
||||
success++
|
||||
|
||||
value=0
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x<value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=0
|
||||
value=-1
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_byte(29)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_byte(30)
|
||||
skip4b:
|
||||
; no else
|
||||
if x<value
|
||||
fail_byte(31)
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
fail_byte(32)
|
||||
else
|
||||
success++
|
||||
|
||||
value=0
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: fail_byte(33)
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: fail_byte(34)
|
||||
skip5b:
|
||||
; no else
|
||||
if x<value
|
||||
fail_byte(35)
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
fail_byte(36)
|
||||
else
|
||||
success++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: success++
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: success++
|
||||
skip6b:
|
||||
; no else
|
||||
if x<value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1
|
||||
value=-1
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: fail_byte(37)
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: fail_byte(38)
|
||||
skip7b:
|
||||
; no else
|
||||
if x<value
|
||||
fail_byte(39)
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
fail_byte(40)
|
||||
else
|
||||
success++
|
||||
|
||||
value=0
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: fail_byte(41)
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: fail_byte(42)
|
||||
skip8b:
|
||||
; no else
|
||||
if x<value
|
||||
fail_byte(43)
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
fail_byte(44)
|
||||
else
|
||||
success++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: fail_byte(45)
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: fail_byte(46)
|
||||
skip9b:
|
||||
; no else
|
||||
if x<value
|
||||
fail_byte(47)
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
fail_byte(48)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(18)
|
||||
}
|
||||
sub test_cmp_array() {
|
||||
byte @shared x
|
||||
byte[] values = [0, 0]
|
||||
success = 0
|
||||
x=-1
|
||||
values[1]=-1
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_byte(49)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_byte(50)
|
||||
skip1b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
fail_byte(51)
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
fail_byte(52)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=0
|
||||
values[1]=-1
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_byte(53)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_byte(54)
|
||||
skip4b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
fail_byte(55)
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
fail_byte(56)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: fail_byte(57)
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: fail_byte(58)
|
||||
skip5b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
fail_byte(59)
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
fail_byte(60)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: success++
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: success++
|
||||
skip6b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1
|
||||
values[1]=-1
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: fail_byte(61)
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: fail_byte(62)
|
||||
skip7b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
fail_byte(63)
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
fail_byte(64)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: fail_byte(65)
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: fail_byte(66)
|
||||
skip8b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
fail_byte(67)
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
fail_byte(68)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: fail_byte(69)
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: fail_byte(70)
|
||||
skip9b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
fail_byte(71)
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
fail_byte(72)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(18)
|
||||
}
|
||||
sub test_cmp_expr() {
|
||||
byte @shared x
|
||||
cx16.r4 = 1
|
||||
cx16.r5 = 1
|
||||
float @shared f4 = 1.0
|
||||
float @shared f5 = 1.0
|
||||
success = 0
|
||||
x=-1
|
||||
; direct jump
|
||||
if x<cx16.r4sL+-1-cx16.r5sL
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_byte(73)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<cx16.r4sL+-1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_byte(74)
|
||||
skip1b:
|
||||
; no else
|
||||
if x<cx16.r4sL+-1-cx16.r5sL
|
||||
fail_byte(75)
|
||||
|
||||
; with else
|
||||
if x<cx16.r4sL+-1-cx16.r5sL
|
||||
fail_byte(76)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<cx16.r4sL+0-cx16.r5sL
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<cx16.r4sL+0-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<cx16.r4sL+0-cx16.r5sL
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<cx16.r4sL+0-cx16.r5sL
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x<cx16.r4sL+1-cx16.r5sL
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<cx16.r4sL+1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x<cx16.r4sL+1-cx16.r5sL
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<cx16.r4sL+1-cx16.r5sL
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=0
|
||||
; direct jump
|
||||
if x<cx16.r4sL+-1-cx16.r5sL
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_byte(77)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<cx16.r4sL+-1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_byte(78)
|
||||
skip4b:
|
||||
; no else
|
||||
if x<cx16.r4sL+-1-cx16.r5sL
|
||||
fail_byte(79)
|
||||
|
||||
; with else
|
||||
if x<cx16.r4sL+-1-cx16.r5sL
|
||||
fail_byte(80)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<cx16.r4sL+0-cx16.r5sL
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: fail_byte(81)
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x<cx16.r4sL+0-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: fail_byte(82)
|
||||
skip5b:
|
||||
; no else
|
||||
if x<cx16.r4sL+0-cx16.r5sL
|
||||
fail_byte(83)
|
||||
|
||||
; with else
|
||||
if x<cx16.r4sL+0-cx16.r5sL
|
||||
fail_byte(84)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<cx16.r4sL+1-cx16.r5sL
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: success++
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x<cx16.r4sL+1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: success++
|
||||
skip6b:
|
||||
; no else
|
||||
if x<cx16.r4sL+1-cx16.r5sL
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<cx16.r4sL+1-cx16.r5sL
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1
|
||||
; direct jump
|
||||
if x<cx16.r4sL+-1-cx16.r5sL
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: fail_byte(85)
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x<cx16.r4sL+-1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: fail_byte(86)
|
||||
skip7b:
|
||||
; no else
|
||||
if x<cx16.r4sL+-1-cx16.r5sL
|
||||
fail_byte(87)
|
||||
|
||||
; with else
|
||||
if x<cx16.r4sL+-1-cx16.r5sL
|
||||
fail_byte(88)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<cx16.r4sL+0-cx16.r5sL
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: fail_byte(89)
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x<cx16.r4sL+0-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: fail_byte(90)
|
||||
skip8b:
|
||||
; no else
|
||||
if x<cx16.r4sL+0-cx16.r5sL
|
||||
fail_byte(91)
|
||||
|
||||
; with else
|
||||
if x<cx16.r4sL+0-cx16.r5sL
|
||||
fail_byte(92)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<cx16.r4sL+1-cx16.r5sL
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: fail_byte(93)
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x<cx16.r4sL+1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: fail_byte(94)
|
||||
skip9b:
|
||||
; no else
|
||||
if x<cx16.r4sL+1-cx16.r5sL
|
||||
fail_byte(95)
|
||||
|
||||
; with else
|
||||
if x<cx16.r4sL+1-cx16.r5sL
|
||||
fail_byte(96)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(18)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,956 +0,0 @@
|
||||
|
||||
%import textio
|
||||
%import floats
|
||||
%import test_stack
|
||||
%zeropage dontuse
|
||||
%option no_sysinit
|
||||
|
||||
main {
|
||||
ubyte success = 0
|
||||
str datatype = "byte"
|
||||
uword @shared comparison
|
||||
|
||||
sub start() {
|
||||
txt.print("\nless-equal tests for: ")
|
||||
txt.print(datatype)
|
||||
txt.nl()
|
||||
test_stack.test()
|
||||
txt.print("\n<=number: ")
|
||||
test_cmp_number()
|
||||
txt.print("\n<=var: ")
|
||||
test_cmp_var()
|
||||
txt.print("\n<=array[]: ")
|
||||
test_cmp_array()
|
||||
txt.print("\n<=expr: ")
|
||||
test_cmp_expr()
|
||||
test_stack.test()
|
||||
}
|
||||
|
||||
sub verify_success(ubyte expected) {
|
||||
if success==expected {
|
||||
txt.print("ok")
|
||||
} else {
|
||||
txt.print(" **failed** ")
|
||||
txt.print_ub(success)
|
||||
txt.print(" success, expected ")
|
||||
txt.print_ub(expected)
|
||||
}
|
||||
}
|
||||
|
||||
sub fail_byte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_ubyte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_word(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_uword(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_float(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
|
||||
sub test_cmp_number() {
|
||||
byte @shared x
|
||||
success = 0
|
||||
x=-1
|
||||
; direct jump
|
||||
if x<=-1
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<=-1
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x<=-1
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=-1
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x<=0
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<=0
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<=0
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=0
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x<=1
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<=1
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x<=1
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=1
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=0
|
||||
; direct jump
|
||||
if x<=-1
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_byte(1)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<=-1
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_byte(2)
|
||||
skip4b:
|
||||
; no else
|
||||
if x<=-1
|
||||
fail_byte(3)
|
||||
|
||||
; with else
|
||||
if x<=-1
|
||||
fail_byte(4)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<=0
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: success++
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x<=0
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: success++
|
||||
skip5b:
|
||||
; no else
|
||||
if x<=0
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=0
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x<=1
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: success++
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x<=1
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: success++
|
||||
skip6b:
|
||||
; no else
|
||||
if x<=1
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=1
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1
|
||||
; direct jump
|
||||
if x<=-1
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: fail_byte(5)
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x<=-1
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: fail_byte(6)
|
||||
skip7b:
|
||||
; no else
|
||||
if x<=-1
|
||||
fail_byte(7)
|
||||
|
||||
; with else
|
||||
if x<=-1
|
||||
fail_byte(8)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<=0
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: fail_byte(9)
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x<=0
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: fail_byte(10)
|
||||
skip8b:
|
||||
; no else
|
||||
if x<=0
|
||||
fail_byte(11)
|
||||
|
||||
; with else
|
||||
if x<=0
|
||||
fail_byte(12)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<=1
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: success++
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x<=1
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: success++
|
||||
skip9b:
|
||||
; no else
|
||||
if x<=1
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=1
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(27)
|
||||
}
|
||||
sub test_cmp_var() {
|
||||
byte @shared x, value
|
||||
success = 0
|
||||
x=-1
|
||||
value=-1
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x<=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=0
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x<=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=0
|
||||
value=-1
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_byte(13)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_byte(14)
|
||||
skip4b:
|
||||
; no else
|
||||
if x<=value
|
||||
fail_byte(15)
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
fail_byte(16)
|
||||
else
|
||||
success++
|
||||
|
||||
value=0
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: success++
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: success++
|
||||
skip5b:
|
||||
; no else
|
||||
if x<=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: success++
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: success++
|
||||
skip6b:
|
||||
; no else
|
||||
if x<=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1
|
||||
value=-1
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: fail_byte(17)
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: fail_byte(18)
|
||||
skip7b:
|
||||
; no else
|
||||
if x<=value
|
||||
fail_byte(19)
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
fail_byte(20)
|
||||
else
|
||||
success++
|
||||
|
||||
value=0
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: fail_byte(21)
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: fail_byte(22)
|
||||
skip8b:
|
||||
; no else
|
||||
if x<=value
|
||||
fail_byte(23)
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
fail_byte(24)
|
||||
else
|
||||
success++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: success++
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: success++
|
||||
skip9b:
|
||||
; no else
|
||||
if x<=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(27)
|
||||
}
|
||||
sub test_cmp_array() {
|
||||
byte @shared x
|
||||
byte[] values = [0, 0]
|
||||
success = 0
|
||||
x=-1
|
||||
values[1]=-1
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=0
|
||||
values[1]=-1
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_byte(25)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_byte(26)
|
||||
skip4b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
fail_byte(27)
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
fail_byte(28)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: success++
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: success++
|
||||
skip5b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: success++
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: success++
|
||||
skip6b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1
|
||||
values[1]=-1
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: fail_byte(29)
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: fail_byte(30)
|
||||
skip7b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
fail_byte(31)
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
fail_byte(32)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: fail_byte(33)
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: fail_byte(34)
|
||||
skip8b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
fail_byte(35)
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
fail_byte(36)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: success++
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: success++
|
||||
skip9b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(27)
|
||||
}
|
||||
sub test_cmp_expr() {
|
||||
byte @shared x
|
||||
cx16.r4 = 1
|
||||
cx16.r5 = 1
|
||||
float @shared f4 = 1.0
|
||||
float @shared f5 = 1.0
|
||||
success = 0
|
||||
x=-1
|
||||
; direct jump
|
||||
if x<=cx16.r4sL+-1-cx16.r5sL
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<=cx16.r4sL+-1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x<=cx16.r4sL+-1-cx16.r5sL
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=cx16.r4sL+-1-cx16.r5sL
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x<=cx16.r4sL+0-cx16.r5sL
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<=cx16.r4sL+0-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<=cx16.r4sL+0-cx16.r5sL
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=cx16.r4sL+0-cx16.r5sL
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x<=cx16.r4sL+1-cx16.r5sL
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<=cx16.r4sL+1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x<=cx16.r4sL+1-cx16.r5sL
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=cx16.r4sL+1-cx16.r5sL
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=0
|
||||
; direct jump
|
||||
if x<=cx16.r4sL+-1-cx16.r5sL
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_byte(37)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<=cx16.r4sL+-1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_byte(38)
|
||||
skip4b:
|
||||
; no else
|
||||
if x<=cx16.r4sL+-1-cx16.r5sL
|
||||
fail_byte(39)
|
||||
|
||||
; with else
|
||||
if x<=cx16.r4sL+-1-cx16.r5sL
|
||||
fail_byte(40)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<=cx16.r4sL+0-cx16.r5sL
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: success++
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x<=cx16.r4sL+0-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: success++
|
||||
skip5b:
|
||||
; no else
|
||||
if x<=cx16.r4sL+0-cx16.r5sL
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=cx16.r4sL+0-cx16.r5sL
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x<=cx16.r4sL+1-cx16.r5sL
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: success++
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x<=cx16.r4sL+1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: success++
|
||||
skip6b:
|
||||
; no else
|
||||
if x<=cx16.r4sL+1-cx16.r5sL
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=cx16.r4sL+1-cx16.r5sL
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1
|
||||
; direct jump
|
||||
if x<=cx16.r4sL+-1-cx16.r5sL
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: fail_byte(41)
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x<=cx16.r4sL+-1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: fail_byte(42)
|
||||
skip7b:
|
||||
; no else
|
||||
if x<=cx16.r4sL+-1-cx16.r5sL
|
||||
fail_byte(43)
|
||||
|
||||
; with else
|
||||
if x<=cx16.r4sL+-1-cx16.r5sL
|
||||
fail_byte(44)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<=cx16.r4sL+0-cx16.r5sL
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: fail_byte(45)
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x<=cx16.r4sL+0-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: fail_byte(46)
|
||||
skip8b:
|
||||
; no else
|
||||
if x<=cx16.r4sL+0-cx16.r5sL
|
||||
fail_byte(47)
|
||||
|
||||
; with else
|
||||
if x<=cx16.r4sL+0-cx16.r5sL
|
||||
fail_byte(48)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<=cx16.r4sL+1-cx16.r5sL
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: success++
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x<=cx16.r4sL+1-cx16.r5sL
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: success++
|
||||
skip9b:
|
||||
; no else
|
||||
if x<=cx16.r4sL+1-cx16.r5sL
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=cx16.r4sL+1-cx16.r5sL
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(27)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,745 +0,0 @@
|
||||
|
||||
%import textio
|
||||
%import floats
|
||||
%import test_stack
|
||||
%zeropage dontuse
|
||||
%option no_sysinit
|
||||
|
||||
main {
|
||||
ubyte success = 0
|
||||
str datatype = "float"
|
||||
uword @shared comparison
|
||||
|
||||
sub start() {
|
||||
txt.print("\n(in)equality tests for datatype: ")
|
||||
txt.print(datatype)
|
||||
txt.nl()
|
||||
test_stack.test()
|
||||
txt.print("==0: ")
|
||||
test_is_zero()
|
||||
txt.print("\n!=0: ")
|
||||
test_not_zero()
|
||||
txt.print("\n==number: ")
|
||||
test_is_number()
|
||||
txt.print("\n!=number: ")
|
||||
test_not_number()
|
||||
txt.print("\n==var: ")
|
||||
test_is_var()
|
||||
txt.print("\n!=var: ")
|
||||
test_not_var()
|
||||
txt.print("\n==array[]: ")
|
||||
test_is_array()
|
||||
txt.print("\n!=array[]: ")
|
||||
test_not_array()
|
||||
txt.print("\n==expr: ")
|
||||
test_is_expr()
|
||||
txt.print("\n!=expr: ")
|
||||
test_not_expr()
|
||||
test_stack.test()
|
||||
}
|
||||
|
||||
sub verify_success(ubyte expected) {
|
||||
if success==expected {
|
||||
txt.print("ok")
|
||||
} else {
|
||||
txt.print(" **failed** ")
|
||||
txt.print_ub(success)
|
||||
txt.print(" success, expected ")
|
||||
txt.print_ub(expected)
|
||||
}
|
||||
}
|
||||
|
||||
sub fail_byte(uword idx, byte v1) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.chrout(':')
|
||||
txt.print_b(v1)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_ubyte(uword idx, ubyte v1) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.chrout(':')
|
||||
txt.print_ub(v1)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_word(uword idx, word v1) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.chrout(':')
|
||||
txt.print_w(v1)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_uword(uword idx, uword v1) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.chrout(':')
|
||||
txt.print_uw(v1)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_float(uword idx, float v1) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.chrout(':')
|
||||
floats.print(v1)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub test_is_zero() {
|
||||
float @shared x
|
||||
success = 0
|
||||
|
||||
x=0.0
|
||||
; direct jump
|
||||
if x==0
|
||||
goto lbl1
|
||||
goto skip1
|
||||
lbl1: success++
|
||||
skip1:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2
|
||||
if x==0
|
||||
goto cx16.r3
|
||||
goto skip2
|
||||
lbl2: success++
|
||||
skip2:
|
||||
; no else
|
||||
if x==0
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x==0
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x = 1234.56
|
||||
; direct jump
|
||||
if x==0
|
||||
goto skip3
|
||||
success++
|
||||
skip3:
|
||||
; indirect jump
|
||||
cx16.r3 = &skip4
|
||||
if x==0
|
||||
goto cx16.r3
|
||||
success++
|
||||
skip4:
|
||||
; no else
|
||||
success++
|
||||
if x==0
|
||||
success--
|
||||
|
||||
; with else
|
||||
if x==0
|
||||
cx16.r0L++
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(8)
|
||||
}
|
||||
|
||||
|
||||
sub test_not_zero() {
|
||||
float @shared x
|
||||
success = 0
|
||||
|
||||
x=1234.56
|
||||
; direct jump
|
||||
if x!=0
|
||||
goto lbl1
|
||||
goto skip1
|
||||
lbl1: success++
|
||||
skip1:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2
|
||||
if x!=0
|
||||
goto cx16.r3
|
||||
goto skip2
|
||||
lbl2: success++
|
||||
skip2:
|
||||
; no else
|
||||
if x!=0
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x!=0
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x = 0.0
|
||||
; direct jump
|
||||
if x!=0
|
||||
goto skip3
|
||||
success++
|
||||
skip3:
|
||||
; indirect jump
|
||||
cx16.r3 = &skip4
|
||||
if x!=0
|
||||
goto cx16.r3
|
||||
success++
|
||||
skip4:
|
||||
; no else
|
||||
success++
|
||||
if x!=0
|
||||
success--
|
||||
|
||||
; with else
|
||||
if x!=0
|
||||
cx16.r0L++
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(8)
|
||||
}
|
||||
|
||||
sub test_is_number() {
|
||||
float @shared x
|
||||
success = 0
|
||||
x=0.0
|
||||
; direct jump
|
||||
if x==1234.56
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_float(1,0.0)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x==1234.56
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_float(2,0.0)
|
||||
skip1b:
|
||||
; no else
|
||||
if x==1234.56
|
||||
fail_float(3,0.0)
|
||||
|
||||
; with else
|
||||
if x==1234.56
|
||||
fail_float(4,0.0)
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1234.56
|
||||
; direct jump
|
||||
if x==1234.56
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x==1234.56
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x==1234.56
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x==1234.56
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(4)
|
||||
}
|
||||
sub test_not_number() {
|
||||
float @shared x
|
||||
success = 0
|
||||
x=0.0
|
||||
; direct jump
|
||||
if x!=1234.56
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x!=1234.56
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x!=1234.56
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x!=1234.56
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1234.56
|
||||
; direct jump
|
||||
if x!=1234.56
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_float(5,1234.56)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x!=1234.56
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_float(6,1234.56)
|
||||
skip2b:
|
||||
; no else
|
||||
if x!=1234.56
|
||||
fail_float(7,1234.56)
|
||||
|
||||
; with else
|
||||
if x!=1234.56
|
||||
fail_float(8,1234.56)
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(4)
|
||||
}
|
||||
sub test_is_var() {
|
||||
float @shared x, value
|
||||
success = 0
|
||||
x=0.0
|
||||
value=1234.56
|
||||
; direct jump
|
||||
if x==value
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_float(9,0.0)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x==value
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_float(10,0.0)
|
||||
skip1b:
|
||||
; no else
|
||||
if x==value
|
||||
fail_float(11,0.0)
|
||||
|
||||
; with else
|
||||
if x==value
|
||||
fail_float(12,0.0)
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1234.56
|
||||
value=1234.56
|
||||
; direct jump
|
||||
if x==value
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x==value
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x==value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x==value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(4)
|
||||
}
|
||||
sub test_not_var() {
|
||||
float @shared x, value
|
||||
success = 0
|
||||
x=0.0
|
||||
value=1234.56
|
||||
; direct jump
|
||||
if x!=value
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x!=value
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x!=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x!=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1234.56
|
||||
value=1234.56
|
||||
; direct jump
|
||||
if x!=value
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_float(13,1234.56)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x!=value
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_float(14,1234.56)
|
||||
skip2b:
|
||||
; no else
|
||||
if x!=value
|
||||
fail_float(15,1234.56)
|
||||
|
||||
; with else
|
||||
if x!=value
|
||||
fail_float(16,1234.56)
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(4)
|
||||
}
|
||||
sub test_is_expr() {
|
||||
float @shared x
|
||||
cx16.r4 = 1
|
||||
cx16.r5 = 1
|
||||
float @shared f4 = 1.0
|
||||
float @shared f5 = 1.0
|
||||
success = 0
|
||||
x=0.0
|
||||
; direct jump
|
||||
if x==f4+1234.56-f5
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_float(17,0.0)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x==f4+1234.56-f5
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_float(18,0.0)
|
||||
skip1b:
|
||||
; no else
|
||||
if x==f4+1234.56-f5
|
||||
fail_float(19,0.0)
|
||||
|
||||
; with else
|
||||
if x==f4+1234.56-f5
|
||||
fail_float(20,0.0)
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1234.56
|
||||
; direct jump
|
||||
if x==f4+1234.56-f5
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x==f4+1234.56-f5
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x==f4+1234.56-f5
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x==f4+1234.56-f5
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(4)
|
||||
}
|
||||
sub test_not_expr() {
|
||||
float @shared x
|
||||
cx16.r4 = 1
|
||||
cx16.r5 = 1
|
||||
float @shared f4 = 1.0
|
||||
float @shared f5 = 1.0
|
||||
success = 0
|
||||
x=0.0
|
||||
; direct jump
|
||||
if x!=f4+1234.56-f5
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x!=f4+1234.56-f5
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x!=f4+1234.56-f5
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x!=f4+1234.56-f5
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1234.56
|
||||
; direct jump
|
||||
if x!=f4+1234.56-f5
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_float(21,1234.56)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x!=f4+1234.56-f5
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_float(22,1234.56)
|
||||
skip2b:
|
||||
; no else
|
||||
if x!=f4+1234.56-f5
|
||||
fail_float(23,1234.56)
|
||||
|
||||
; with else
|
||||
if x!=f4+1234.56-f5
|
||||
fail_float(24,1234.56)
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(4)
|
||||
}
|
||||
sub test_is_array() {
|
||||
float @shared x
|
||||
float[] values = [0, 0]
|
||||
float[] sources = [0, 0]
|
||||
success = 0
|
||||
x=0.0
|
||||
sources[1]=0.0
|
||||
values[1]=1234.56
|
||||
; direct jump
|
||||
if x==values[1]
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_float(25,0.0)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x==values[1]
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_float(26,0.0)
|
||||
skip1b:
|
||||
; no else
|
||||
if x==values[1]
|
||||
fail_float(27,0.0)
|
||||
|
||||
; with else
|
||||
if x==values[1]
|
||||
fail_float(28,0.0)
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if sources[1]==values[1]
|
||||
goto lbl1c
|
||||
goto skip1c
|
||||
lbl1c: fail_float(29,0.0)
|
||||
skip1c:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1d
|
||||
if sources[1]==values[1]
|
||||
goto cx16.r3
|
||||
goto skip1d
|
||||
lbl1d: fail_float(30,0.0)
|
||||
skip1d:
|
||||
; no else
|
||||
if sources[1]==values[1]
|
||||
fail_float(31,0.0)
|
||||
|
||||
; with else
|
||||
if sources[1]==values[1]
|
||||
fail_float(32,0.0)
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1234.56
|
||||
sources[1]=1234.56
|
||||
values[1]=1234.56
|
||||
; direct jump
|
||||
if x==values[1]
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x==values[1]
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x==values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x==values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if sources[1]==values[1]
|
||||
goto lbl2c
|
||||
goto skip2c
|
||||
lbl2c: success++
|
||||
skip2c:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2d
|
||||
if sources[1]==values[1]
|
||||
goto cx16.r3
|
||||
goto skip2d
|
||||
lbl2d: success++
|
||||
skip2d:
|
||||
; no else
|
||||
if sources[1]==values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if sources[1]==values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(8)
|
||||
}
|
||||
sub test_not_array() {
|
||||
float @shared x
|
||||
float[] values = [0, 0]
|
||||
float[] sources = [0, 0]
|
||||
success = 0
|
||||
x=0.0
|
||||
sources[1]=0.0
|
||||
values[1]=1234.56
|
||||
; direct jump
|
||||
if x!=values[1]
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x!=values[1]
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x!=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x!=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if sources[1]!=values[1]
|
||||
goto lbl1c
|
||||
goto skip1c
|
||||
lbl1c: success++
|
||||
skip1c:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1d
|
||||
if sources[1]!=values[1]
|
||||
goto cx16.r3
|
||||
goto skip1d
|
||||
lbl1d: success++
|
||||
skip1d:
|
||||
; no else
|
||||
if sources[1]!=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if sources[1]!=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1234.56
|
||||
sources[1]=1234.56
|
||||
values[1]=1234.56
|
||||
; direct jump
|
||||
if x!=values[1]
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_float(33,1234.56)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x!=values[1]
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_float(34,1234.56)
|
||||
skip2b:
|
||||
; no else
|
||||
if x!=values[1]
|
||||
fail_float(35,1234.56)
|
||||
|
||||
; with else
|
||||
if x!=values[1]
|
||||
fail_float(36,1234.56)
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if sources[1]!=values[1]
|
||||
goto lbl2c
|
||||
goto skip2c
|
||||
lbl2c: fail_float(37,1234.56)
|
||||
skip2c:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2d
|
||||
if sources[1]!=values[1]
|
||||
goto cx16.r3
|
||||
goto skip2d
|
||||
lbl2d: fail_float(38,1234.56)
|
||||
skip2d:
|
||||
; no else
|
||||
if sources[1]!=values[1]
|
||||
fail_float(39,1234.56)
|
||||
|
||||
; with else
|
||||
if sources[1]!=values[1]
|
||||
fail_float(40,1234.56)
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(8)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,482 +0,0 @@
|
||||
|
||||
%import textio
|
||||
%import floats
|
||||
%import test_stack
|
||||
%zeropage dontuse
|
||||
%option no_sysinit
|
||||
|
||||
main {
|
||||
ubyte success = 0
|
||||
str datatype = "float"
|
||||
uword @shared comparison
|
||||
|
||||
sub start() {
|
||||
txt.print("\ngreater-than tests for: ")
|
||||
txt.print(datatype)
|
||||
txt.nl()
|
||||
test_stack.test()
|
||||
txt.print("\n>number: ")
|
||||
test_cmp_number()
|
||||
txt.print("\n>var: ")
|
||||
test_cmp_var()
|
||||
txt.print("\n>array[]: ")
|
||||
test_cmp_array()
|
||||
txt.print("\n>expr: ")
|
||||
test_cmp_expr()
|
||||
test_stack.test()
|
||||
}
|
||||
|
||||
sub verify_success(ubyte expected) {
|
||||
if success==expected {
|
||||
txt.print("ok")
|
||||
} else {
|
||||
txt.print(" **failed** ")
|
||||
txt.print_ub(success)
|
||||
txt.print(" success, expected ")
|
||||
txt.print_ub(expected)
|
||||
}
|
||||
}
|
||||
|
||||
sub fail_byte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_ubyte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_word(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_uword(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_float(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
|
||||
sub test_cmp_number() {
|
||||
float @shared x
|
||||
success = 0
|
||||
x=0.0
|
||||
; direct jump
|
||||
if x>0.0
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_float(1)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>0.0
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_float(2)
|
||||
skip1b:
|
||||
; no else
|
||||
if x>0.0
|
||||
fail_float(3)
|
||||
|
||||
; with else
|
||||
if x>0.0
|
||||
fail_float(4)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x>1234.56
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_float(5)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>1234.56
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_float(6)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>1234.56
|
||||
fail_float(7)
|
||||
|
||||
; with else
|
||||
if x>1234.56
|
||||
fail_float(8)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1234.56
|
||||
; direct jump
|
||||
if x>0.0
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>0.0
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x>0.0
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>0.0
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>1234.56
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_float(9)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>1234.56
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_float(10)
|
||||
skip4b:
|
||||
; no else
|
||||
if x>1234.56
|
||||
fail_float(11)
|
||||
|
||||
; with else
|
||||
if x>1234.56
|
||||
fail_float(12)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(7)
|
||||
}
|
||||
sub test_cmp_var() {
|
||||
float @shared x, value
|
||||
success = 0
|
||||
x=0.0
|
||||
value=0.0
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_float(13)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_float(14)
|
||||
skip1b:
|
||||
; no else
|
||||
if x>value
|
||||
fail_float(15)
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
fail_float(16)
|
||||
else
|
||||
success++
|
||||
|
||||
value=1234.56
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_float(17)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_float(18)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>value
|
||||
fail_float(19)
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
fail_float(20)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1234.56
|
||||
value=0.0
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x>value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=1234.56
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_float(21)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_float(22)
|
||||
skip4b:
|
||||
; no else
|
||||
if x>value
|
||||
fail_float(23)
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
fail_float(24)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(7)
|
||||
}
|
||||
sub test_cmp_array() {
|
||||
float @shared x
|
||||
float[] values = [0, 0]
|
||||
success = 0
|
||||
x=0.0
|
||||
values[1]=0.0
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_float(25)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_float(26)
|
||||
skip1b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_float(27)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_float(28)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=1234.56
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_float(29)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_float(30)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_float(31)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_float(32)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1234.56
|
||||
values[1]=0.0
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=1234.56
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_float(33)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_float(34)
|
||||
skip4b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_float(35)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_float(36)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(7)
|
||||
}
|
||||
sub test_cmp_expr() {
|
||||
float @shared x
|
||||
cx16.r4 = 1
|
||||
cx16.r5 = 1
|
||||
float @shared f4 = 1.0
|
||||
float @shared f5 = 1.0
|
||||
success = 0
|
||||
x=0.0
|
||||
; direct jump
|
||||
if x>f4+0.0-f5
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_float(37)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>f4+0.0-f5
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_float(38)
|
||||
skip1b:
|
||||
; no else
|
||||
if x>f4+0.0-f5
|
||||
fail_float(39)
|
||||
|
||||
; with else
|
||||
if x>f4+0.0-f5
|
||||
fail_float(40)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x>f4+1234.56-f5
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_float(41)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>f4+1234.56-f5
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_float(42)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>f4+1234.56-f5
|
||||
fail_float(43)
|
||||
|
||||
; with else
|
||||
if x>f4+1234.56-f5
|
||||
fail_float(44)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1234.56
|
||||
; direct jump
|
||||
if x>f4+0.0-f5
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>f4+0.0-f5
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x>f4+0.0-f5
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>f4+0.0-f5
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>f4+1234.56-f5
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_float(45)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>f4+1234.56-f5
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_float(46)
|
||||
skip4b:
|
||||
; no else
|
||||
if x>f4+1234.56-f5
|
||||
fail_float(47)
|
||||
|
||||
; with else
|
||||
if x>f4+1234.56-f5
|
||||
fail_float(48)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(7)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,482 +0,0 @@
|
||||
|
||||
%import textio
|
||||
%import floats
|
||||
%import test_stack
|
||||
%zeropage dontuse
|
||||
%option no_sysinit
|
||||
|
||||
main {
|
||||
ubyte success = 0
|
||||
str datatype = "float"
|
||||
uword @shared comparison
|
||||
|
||||
sub start() {
|
||||
txt.print("\ngreater-equal tests for: ")
|
||||
txt.print(datatype)
|
||||
txt.nl()
|
||||
test_stack.test()
|
||||
txt.print("\n>=number: ")
|
||||
test_cmp_number()
|
||||
txt.print("\n>=var: ")
|
||||
test_cmp_var()
|
||||
txt.print("\n>=array[]: ")
|
||||
test_cmp_array()
|
||||
txt.print("\n>=expr: ")
|
||||
test_cmp_expr()
|
||||
test_stack.test()
|
||||
}
|
||||
|
||||
sub verify_success(ubyte expected) {
|
||||
if success==expected {
|
||||
txt.print("ok")
|
||||
} else {
|
||||
txt.print(" **failed** ")
|
||||
txt.print_ub(success)
|
||||
txt.print(" success, expected ")
|
||||
txt.print_ub(expected)
|
||||
}
|
||||
}
|
||||
|
||||
sub fail_byte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_ubyte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_word(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_uword(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_float(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
|
||||
sub test_cmp_number() {
|
||||
float @shared x
|
||||
success = 0
|
||||
x=0.0
|
||||
; direct jump
|
||||
if x>=0.0
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>=0.0
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x>=0.0
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=0.0
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=1234.56
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_float(1)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>=1234.56
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_float(2)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>=1234.56
|
||||
fail_float(3)
|
||||
|
||||
; with else
|
||||
if x>=1234.56
|
||||
fail_float(4)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1234.56
|
||||
; direct jump
|
||||
if x>=0.0
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>=0.0
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x>=0.0
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=0.0
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=1234.56
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>=1234.56
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x>=1234.56
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=1234.56
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(13)
|
||||
}
|
||||
sub test_cmp_var() {
|
||||
float @shared x, value
|
||||
success = 0
|
||||
x=0.0
|
||||
value=0.0
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x>=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=1234.56
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_float(5)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_float(6)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>=value
|
||||
fail_float(7)
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
fail_float(8)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1234.56
|
||||
value=0.0
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x>=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=1234.56
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x>=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(13)
|
||||
}
|
||||
sub test_cmp_array() {
|
||||
float @shared x
|
||||
float[] values = [0, 0]
|
||||
success = 0
|
||||
x=0.0
|
||||
values[1]=0.0
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=1234.56
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_float(9)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_float(10)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
fail_float(11)
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
fail_float(12)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1234.56
|
||||
values[1]=0.0
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=1234.56
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(13)
|
||||
}
|
||||
sub test_cmp_expr() {
|
||||
float @shared x
|
||||
cx16.r4 = 1
|
||||
cx16.r5 = 1
|
||||
float @shared f4 = 1.0
|
||||
float @shared f5 = 1.0
|
||||
success = 0
|
||||
x=0.0
|
||||
; direct jump
|
||||
if x>=f4+0.0-f5
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>=f4+0.0-f5
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x>=f4+0.0-f5
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=f4+0.0-f5
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=f4+1234.56-f5
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_float(13)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>=f4+1234.56-f5
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_float(14)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>=f4+1234.56-f5
|
||||
fail_float(15)
|
||||
|
||||
; with else
|
||||
if x>=f4+1234.56-f5
|
||||
fail_float(16)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1234.56
|
||||
; direct jump
|
||||
if x>=f4+0.0-f5
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>=f4+0.0-f5
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x>=f4+0.0-f5
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=f4+0.0-f5
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=f4+1234.56-f5
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>=f4+1234.56-f5
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x>=f4+1234.56-f5
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=f4+1234.56-f5
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(13)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,482 +0,0 @@
|
||||
|
||||
%import textio
|
||||
%import floats
|
||||
%import test_stack
|
||||
%zeropage dontuse
|
||||
%option no_sysinit
|
||||
|
||||
main {
|
||||
ubyte success = 0
|
||||
str datatype = "float"
|
||||
uword @shared comparison
|
||||
|
||||
sub start() {
|
||||
txt.print("\nless-than tests for: ")
|
||||
txt.print(datatype)
|
||||
txt.nl()
|
||||
test_stack.test()
|
||||
txt.print("\n<number: ")
|
||||
test_cmp_number()
|
||||
txt.print("\n<var: ")
|
||||
test_cmp_var()
|
||||
txt.print("\n<array[]: ")
|
||||
test_cmp_array()
|
||||
txt.print("\n<expr: ")
|
||||
test_cmp_expr()
|
||||
test_stack.test()
|
||||
}
|
||||
|
||||
sub verify_success(ubyte expected) {
|
||||
if success==expected {
|
||||
txt.print("ok")
|
||||
} else {
|
||||
txt.print(" **failed** ")
|
||||
txt.print_ub(success)
|
||||
txt.print(" success, expected ")
|
||||
txt.print_ub(expected)
|
||||
}
|
||||
}
|
||||
|
||||
sub fail_byte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_ubyte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_word(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_uword(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_float(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
|
||||
sub test_cmp_number() {
|
||||
float @shared x
|
||||
success = 0
|
||||
x=0.0
|
||||
; direct jump
|
||||
if x<0.0
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_float(1)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<0.0
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_float(2)
|
||||
skip1b:
|
||||
; no else
|
||||
if x<0.0
|
||||
fail_float(3)
|
||||
|
||||
; with else
|
||||
if x<0.0
|
||||
fail_float(4)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<1234.56
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<1234.56
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<1234.56
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<1234.56
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1234.56
|
||||
; direct jump
|
||||
if x<0.0
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_float(5)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<0.0
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_float(6)
|
||||
skip3b:
|
||||
; no else
|
||||
if x<0.0
|
||||
fail_float(7)
|
||||
|
||||
; with else
|
||||
if x<0.0
|
||||
fail_float(8)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<1234.56
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_float(9)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<1234.56
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_float(10)
|
||||
skip4b:
|
||||
; no else
|
||||
if x<1234.56
|
||||
fail_float(11)
|
||||
|
||||
; with else
|
||||
if x<1234.56
|
||||
fail_float(12)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(7)
|
||||
}
|
||||
sub test_cmp_var() {
|
||||
float @shared x, value
|
||||
success = 0
|
||||
x=0.0
|
||||
value=0.0
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_float(13)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_float(14)
|
||||
skip1b:
|
||||
; no else
|
||||
if x<value
|
||||
fail_float(15)
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
fail_float(16)
|
||||
else
|
||||
success++
|
||||
|
||||
value=1234.56
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1234.56
|
||||
value=0.0
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_float(17)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_float(18)
|
||||
skip3b:
|
||||
; no else
|
||||
if x<value
|
||||
fail_float(19)
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
fail_float(20)
|
||||
else
|
||||
success++
|
||||
|
||||
value=1234.56
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_float(21)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_float(22)
|
||||
skip4b:
|
||||
; no else
|
||||
if x<value
|
||||
fail_float(23)
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
fail_float(24)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(7)
|
||||
}
|
||||
sub test_cmp_array() {
|
||||
float @shared x
|
||||
float[] values = [0, 0]
|
||||
success = 0
|
||||
x=0.0
|
||||
values[1]=0.0
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_float(25)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_float(26)
|
||||
skip1b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
fail_float(27)
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
fail_float(28)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=1234.56
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1234.56
|
||||
values[1]=0.0
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_float(29)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_float(30)
|
||||
skip3b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
fail_float(31)
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
fail_float(32)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=1234.56
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_float(33)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_float(34)
|
||||
skip4b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
fail_float(35)
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
fail_float(36)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(7)
|
||||
}
|
||||
sub test_cmp_expr() {
|
||||
float @shared x
|
||||
cx16.r4 = 1
|
||||
cx16.r5 = 1
|
||||
float @shared f4 = 1.0
|
||||
float @shared f5 = 1.0
|
||||
success = 0
|
||||
x=0.0
|
||||
; direct jump
|
||||
if x<f4+0.0-f5
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_float(37)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<f4+0.0-f5
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_float(38)
|
||||
skip1b:
|
||||
; no else
|
||||
if x<f4+0.0-f5
|
||||
fail_float(39)
|
||||
|
||||
; with else
|
||||
if x<f4+0.0-f5
|
||||
fail_float(40)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<f4+1234.56-f5
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<f4+1234.56-f5
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<f4+1234.56-f5
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<f4+1234.56-f5
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1234.56
|
||||
; direct jump
|
||||
if x<f4+0.0-f5
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_float(41)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<f4+0.0-f5
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_float(42)
|
||||
skip3b:
|
||||
; no else
|
||||
if x<f4+0.0-f5
|
||||
fail_float(43)
|
||||
|
||||
; with else
|
||||
if x<f4+0.0-f5
|
||||
fail_float(44)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<f4+1234.56-f5
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_float(45)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<f4+1234.56-f5
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_float(46)
|
||||
skip4b:
|
||||
; no else
|
||||
if x<f4+1234.56-f5
|
||||
fail_float(47)
|
||||
|
||||
; with else
|
||||
if x<f4+1234.56-f5
|
||||
fail_float(48)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(7)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,482 +0,0 @@
|
||||
|
||||
%import textio
|
||||
%import floats
|
||||
%import test_stack
|
||||
%zeropage dontuse
|
||||
%option no_sysinit
|
||||
|
||||
main {
|
||||
ubyte success = 0
|
||||
str datatype = "float"
|
||||
uword @shared comparison
|
||||
|
||||
sub start() {
|
||||
txt.print("\nless-equal tests for: ")
|
||||
txt.print(datatype)
|
||||
txt.nl()
|
||||
test_stack.test()
|
||||
txt.print("\n<=number: ")
|
||||
test_cmp_number()
|
||||
txt.print("\n<=var: ")
|
||||
test_cmp_var()
|
||||
txt.print("\n<=array[]: ")
|
||||
test_cmp_array()
|
||||
txt.print("\n<=expr: ")
|
||||
test_cmp_expr()
|
||||
test_stack.test()
|
||||
}
|
||||
|
||||
sub verify_success(ubyte expected) {
|
||||
if success==expected {
|
||||
txt.print("ok")
|
||||
} else {
|
||||
txt.print(" **failed** ")
|
||||
txt.print_ub(success)
|
||||
txt.print(" success, expected ")
|
||||
txt.print_ub(expected)
|
||||
}
|
||||
}
|
||||
|
||||
sub fail_byte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_ubyte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_word(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_uword(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_float(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
|
||||
sub test_cmp_number() {
|
||||
float @shared x
|
||||
success = 0
|
||||
x=0.0
|
||||
; direct jump
|
||||
if x<=0.0
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<=0.0
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x<=0.0
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=0.0
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x<=1234.56
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<=1234.56
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<=1234.56
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=1234.56
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1234.56
|
||||
; direct jump
|
||||
if x<=0.0
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_float(1)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<=0.0
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_float(2)
|
||||
skip3b:
|
||||
; no else
|
||||
if x<=0.0
|
||||
fail_float(3)
|
||||
|
||||
; with else
|
||||
if x<=0.0
|
||||
fail_float(4)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<=1234.56
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<=1234.56
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x<=1234.56
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=1234.56
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(13)
|
||||
}
|
||||
sub test_cmp_var() {
|
||||
float @shared x, value
|
||||
success = 0
|
||||
x=0.0
|
||||
value=0.0
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x<=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=1234.56
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1234.56
|
||||
value=0.0
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_float(5)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_float(6)
|
||||
skip3b:
|
||||
; no else
|
||||
if x<=value
|
||||
fail_float(7)
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
fail_float(8)
|
||||
else
|
||||
success++
|
||||
|
||||
value=1234.56
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x<=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(13)
|
||||
}
|
||||
sub test_cmp_array() {
|
||||
float @shared x
|
||||
float[] values = [0, 0]
|
||||
success = 0
|
||||
x=0.0
|
||||
values[1]=0.0
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=1234.56
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1234.56
|
||||
values[1]=0.0
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_float(9)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_float(10)
|
||||
skip3b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
fail_float(11)
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
fail_float(12)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=1234.56
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(13)
|
||||
}
|
||||
sub test_cmp_expr() {
|
||||
float @shared x
|
||||
cx16.r4 = 1
|
||||
cx16.r5 = 1
|
||||
float @shared f4 = 1.0
|
||||
float @shared f5 = 1.0
|
||||
success = 0
|
||||
x=0.0
|
||||
; direct jump
|
||||
if x<=f4+0.0-f5
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<=f4+0.0-f5
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x<=f4+0.0-f5
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=f4+0.0-f5
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x<=f4+1234.56-f5
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<=f4+1234.56-f5
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<=f4+1234.56-f5
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=f4+1234.56-f5
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1234.56
|
||||
; direct jump
|
||||
if x<=f4+0.0-f5
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_float(13)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<=f4+0.0-f5
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_float(14)
|
||||
skip3b:
|
||||
; no else
|
||||
if x<=f4+0.0-f5
|
||||
fail_float(15)
|
||||
|
||||
; with else
|
||||
if x<=f4+0.0-f5
|
||||
fail_float(16)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<=f4+1234.56-f5
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<=f4+1234.56-f5
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x<=f4+1234.56-f5
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=f4+1234.56-f5
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(13)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,956 +0,0 @@
|
||||
|
||||
%import textio
|
||||
%import floats
|
||||
%import test_stack
|
||||
%zeropage dontuse
|
||||
%option no_sysinit
|
||||
|
||||
main {
|
||||
ubyte success = 0
|
||||
str datatype = "ubyte"
|
||||
uword @shared comparison
|
||||
|
||||
sub start() {
|
||||
txt.print("\ngreater-than tests for: ")
|
||||
txt.print(datatype)
|
||||
txt.nl()
|
||||
test_stack.test()
|
||||
txt.print("\n>number: ")
|
||||
test_cmp_number()
|
||||
txt.print("\n>var: ")
|
||||
test_cmp_var()
|
||||
txt.print("\n>array[]: ")
|
||||
test_cmp_array()
|
||||
txt.print("\n>expr: ")
|
||||
test_cmp_expr()
|
||||
test_stack.test()
|
||||
}
|
||||
|
||||
sub verify_success(ubyte expected) {
|
||||
if success==expected {
|
||||
txt.print("ok")
|
||||
} else {
|
||||
txt.print(" **failed** ")
|
||||
txt.print_ub(success)
|
||||
txt.print(" success, expected ")
|
||||
txt.print_ub(expected)
|
||||
}
|
||||
}
|
||||
|
||||
sub fail_byte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_ubyte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_word(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_uword(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_float(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
|
||||
sub test_cmp_number() {
|
||||
ubyte @shared x
|
||||
success = 0
|
||||
x=0
|
||||
; direct jump
|
||||
if x>0
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_ubyte(1)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>0
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_ubyte(2)
|
||||
skip1b:
|
||||
; no else
|
||||
if x>0
|
||||
fail_ubyte(3)
|
||||
|
||||
; with else
|
||||
if x>0
|
||||
fail_ubyte(4)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x>1
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_ubyte(5)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>1
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_ubyte(6)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>1
|
||||
fail_ubyte(7)
|
||||
|
||||
; with else
|
||||
if x>1
|
||||
fail_ubyte(8)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x>255
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_ubyte(9)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>255
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_ubyte(10)
|
||||
skip3b:
|
||||
; no else
|
||||
if x>255
|
||||
fail_ubyte(11)
|
||||
|
||||
; with else
|
||||
if x>255
|
||||
fail_ubyte(12)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1
|
||||
; direct jump
|
||||
if x>0
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>0
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x>0
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>0
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>1
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: fail_ubyte(13)
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x>1
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: fail_ubyte(14)
|
||||
skip5b:
|
||||
; no else
|
||||
if x>1
|
||||
fail_ubyte(15)
|
||||
|
||||
; with else
|
||||
if x>1
|
||||
fail_ubyte(16)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x>255
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: fail_ubyte(17)
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x>255
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: fail_ubyte(18)
|
||||
skip6b:
|
||||
; no else
|
||||
if x>255
|
||||
fail_ubyte(19)
|
||||
|
||||
; with else
|
||||
if x>255
|
||||
fail_ubyte(20)
|
||||
else
|
||||
success++
|
||||
|
||||
x=255
|
||||
; direct jump
|
||||
if x>0
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: success++
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x>0
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: success++
|
||||
skip7b:
|
||||
; no else
|
||||
if x>0
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>0
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>1
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: success++
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x>1
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: success++
|
||||
skip8b:
|
||||
; no else
|
||||
if x>1
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>1
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>255
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: fail_ubyte(21)
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x>255
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: fail_ubyte(22)
|
||||
skip9b:
|
||||
; no else
|
||||
if x>255
|
||||
fail_ubyte(23)
|
||||
|
||||
; with else
|
||||
if x>255
|
||||
fail_ubyte(24)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(18)
|
||||
}
|
||||
sub test_cmp_var() {
|
||||
ubyte @shared x, value
|
||||
success = 0
|
||||
x=0
|
||||
value=0
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_ubyte(25)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_ubyte(26)
|
||||
skip1b:
|
||||
; no else
|
||||
if x>value
|
||||
fail_ubyte(27)
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
fail_ubyte(28)
|
||||
else
|
||||
success++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_ubyte(29)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_ubyte(30)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>value
|
||||
fail_ubyte(31)
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
fail_ubyte(32)
|
||||
else
|
||||
success++
|
||||
|
||||
value=255
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_ubyte(33)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_ubyte(34)
|
||||
skip3b:
|
||||
; no else
|
||||
if x>value
|
||||
fail_ubyte(35)
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
fail_ubyte(36)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1
|
||||
value=0
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x>value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: fail_ubyte(37)
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: fail_ubyte(38)
|
||||
skip5b:
|
||||
; no else
|
||||
if x>value
|
||||
fail_ubyte(39)
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
fail_ubyte(40)
|
||||
else
|
||||
success++
|
||||
|
||||
value=255
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: fail_ubyte(41)
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: fail_ubyte(42)
|
||||
skip6b:
|
||||
; no else
|
||||
if x>value
|
||||
fail_ubyte(43)
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
fail_ubyte(44)
|
||||
else
|
||||
success++
|
||||
|
||||
x=255
|
||||
value=0
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: success++
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: success++
|
||||
skip7b:
|
||||
; no else
|
||||
if x>value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: success++
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: success++
|
||||
skip8b:
|
||||
; no else
|
||||
if x>value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=255
|
||||
; direct jump
|
||||
if x>value
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: fail_ubyte(45)
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x>value
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: fail_ubyte(46)
|
||||
skip9b:
|
||||
; no else
|
||||
if x>value
|
||||
fail_ubyte(47)
|
||||
|
||||
; with else
|
||||
if x>value
|
||||
fail_ubyte(48)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(18)
|
||||
}
|
||||
sub test_cmp_array() {
|
||||
ubyte @shared x
|
||||
ubyte[] values = [0, 0]
|
||||
success = 0
|
||||
x=0
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_ubyte(49)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_ubyte(50)
|
||||
skip1b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_ubyte(51)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_ubyte(52)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_ubyte(53)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_ubyte(54)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_ubyte(55)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_ubyte(56)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=255
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_ubyte(57)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_ubyte(58)
|
||||
skip3b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_ubyte(59)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_ubyte(60)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: fail_ubyte(61)
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: fail_ubyte(62)
|
||||
skip5b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_ubyte(63)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_ubyte(64)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=255
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: fail_ubyte(65)
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: fail_ubyte(66)
|
||||
skip6b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_ubyte(67)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_ubyte(68)
|
||||
else
|
||||
success++
|
||||
|
||||
x=255
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: success++
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: success++
|
||||
skip7b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: success++
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: success++
|
||||
skip8b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=255
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: fail_ubyte(69)
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: fail_ubyte(70)
|
||||
skip9b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_ubyte(71)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_ubyte(72)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(18)
|
||||
}
|
||||
sub test_cmp_expr() {
|
||||
ubyte @shared x
|
||||
cx16.r4 = 1
|
||||
cx16.r5 = 1
|
||||
float @shared f4 = 1.0
|
||||
float @shared f5 = 1.0
|
||||
success = 0
|
||||
x=0
|
||||
; direct jump
|
||||
if x>cx16.r4L+0-cx16.r5L
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_ubyte(73)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>cx16.r4L+0-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_ubyte(74)
|
||||
skip1b:
|
||||
; no else
|
||||
if x>cx16.r4L+0-cx16.r5L
|
||||
fail_ubyte(75)
|
||||
|
||||
; with else
|
||||
if x>cx16.r4L+0-cx16.r5L
|
||||
fail_ubyte(76)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x>cx16.r4L+1-cx16.r5L
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_ubyte(77)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>cx16.r4L+1-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_ubyte(78)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>cx16.r4L+1-cx16.r5L
|
||||
fail_ubyte(79)
|
||||
|
||||
; with else
|
||||
if x>cx16.r4L+1-cx16.r5L
|
||||
fail_ubyte(80)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x>cx16.r4L+255-cx16.r5L
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_ubyte(81)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>cx16.r4L+255-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_ubyte(82)
|
||||
skip3b:
|
||||
; no else
|
||||
if x>cx16.r4L+255-cx16.r5L
|
||||
fail_ubyte(83)
|
||||
|
||||
; with else
|
||||
if x>cx16.r4L+255-cx16.r5L
|
||||
fail_ubyte(84)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1
|
||||
; direct jump
|
||||
if x>cx16.r4L+0-cx16.r5L
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>cx16.r4L+0-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x>cx16.r4L+0-cx16.r5L
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>cx16.r4L+0-cx16.r5L
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>cx16.r4L+1-cx16.r5L
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: fail_ubyte(85)
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x>cx16.r4L+1-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: fail_ubyte(86)
|
||||
skip5b:
|
||||
; no else
|
||||
if x>cx16.r4L+1-cx16.r5L
|
||||
fail_ubyte(87)
|
||||
|
||||
; with else
|
||||
if x>cx16.r4L+1-cx16.r5L
|
||||
fail_ubyte(88)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x>cx16.r4L+255-cx16.r5L
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: fail_ubyte(89)
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x>cx16.r4L+255-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: fail_ubyte(90)
|
||||
skip6b:
|
||||
; no else
|
||||
if x>cx16.r4L+255-cx16.r5L
|
||||
fail_ubyte(91)
|
||||
|
||||
; with else
|
||||
if x>cx16.r4L+255-cx16.r5L
|
||||
fail_ubyte(92)
|
||||
else
|
||||
success++
|
||||
|
||||
x=255
|
||||
; direct jump
|
||||
if x>cx16.r4L+0-cx16.r5L
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: success++
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x>cx16.r4L+0-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: success++
|
||||
skip7b:
|
||||
; no else
|
||||
if x>cx16.r4L+0-cx16.r5L
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>cx16.r4L+0-cx16.r5L
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>cx16.r4L+1-cx16.r5L
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: success++
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x>cx16.r4L+1-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: success++
|
||||
skip8b:
|
||||
; no else
|
||||
if x>cx16.r4L+1-cx16.r5L
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>cx16.r4L+1-cx16.r5L
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>cx16.r4L+255-cx16.r5L
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: fail_ubyte(93)
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x>cx16.r4L+255-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: fail_ubyte(94)
|
||||
skip9b:
|
||||
; no else
|
||||
if x>cx16.r4L+255-cx16.r5L
|
||||
fail_ubyte(95)
|
||||
|
||||
; with else
|
||||
if x>cx16.r4L+255-cx16.r5L
|
||||
fail_ubyte(96)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(18)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,956 +0,0 @@
|
||||
|
||||
%import textio
|
||||
%import floats
|
||||
%import test_stack
|
||||
%zeropage dontuse
|
||||
%option no_sysinit
|
||||
|
||||
main {
|
||||
ubyte success = 0
|
||||
str datatype = "ubyte"
|
||||
uword @shared comparison
|
||||
|
||||
sub start() {
|
||||
txt.print("\ngreater-equal tests for: ")
|
||||
txt.print(datatype)
|
||||
txt.nl()
|
||||
test_stack.test()
|
||||
txt.print("\n>=number: ")
|
||||
test_cmp_number()
|
||||
txt.print("\n>=var: ")
|
||||
test_cmp_var()
|
||||
txt.print("\n>=array[]: ")
|
||||
test_cmp_array()
|
||||
txt.print("\n>=expr: ")
|
||||
test_cmp_expr()
|
||||
test_stack.test()
|
||||
}
|
||||
|
||||
sub verify_success(ubyte expected) {
|
||||
if success==expected {
|
||||
txt.print("ok")
|
||||
} else {
|
||||
txt.print(" **failed** ")
|
||||
txt.print_ub(success)
|
||||
txt.print(" success, expected ")
|
||||
txt.print_ub(expected)
|
||||
}
|
||||
}
|
||||
|
||||
sub fail_byte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_ubyte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_word(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_uword(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_float(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
|
||||
sub test_cmp_number() {
|
||||
ubyte @shared x
|
||||
success = 0
|
||||
x=0
|
||||
; direct jump
|
||||
if x>=0
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>=0
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x>=0
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=0
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=1
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_ubyte(1)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>=1
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_ubyte(2)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>=1
|
||||
fail_ubyte(3)
|
||||
|
||||
; with else
|
||||
if x>=1
|
||||
fail_ubyte(4)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x>=255
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_ubyte(5)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>=255
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_ubyte(6)
|
||||
skip3b:
|
||||
; no else
|
||||
if x>=255
|
||||
fail_ubyte(7)
|
||||
|
||||
; with else
|
||||
if x>=255
|
||||
fail_ubyte(8)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1
|
||||
; direct jump
|
||||
if x>=0
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>=0
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x>=0
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=0
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=1
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: success++
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x>=1
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: success++
|
||||
skip5b:
|
||||
; no else
|
||||
if x>=1
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=1
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=255
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: fail_ubyte(9)
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x>=255
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: fail_ubyte(10)
|
||||
skip6b:
|
||||
; no else
|
||||
if x>=255
|
||||
fail_ubyte(11)
|
||||
|
||||
; with else
|
||||
if x>=255
|
||||
fail_ubyte(12)
|
||||
else
|
||||
success++
|
||||
|
||||
x=255
|
||||
; direct jump
|
||||
if x>=0
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: success++
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x>=0
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: success++
|
||||
skip7b:
|
||||
; no else
|
||||
if x>=0
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=0
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=1
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: success++
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x>=1
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: success++
|
||||
skip8b:
|
||||
; no else
|
||||
if x>=1
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=1
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=255
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: success++
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x>=255
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: success++
|
||||
skip9b:
|
||||
; no else
|
||||
if x>=255
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=255
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(27)
|
||||
}
|
||||
sub test_cmp_var() {
|
||||
ubyte @shared x, value
|
||||
success = 0
|
||||
x=0
|
||||
value=0
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x>=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_ubyte(13)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_ubyte(14)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>=value
|
||||
fail_ubyte(15)
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
fail_ubyte(16)
|
||||
else
|
||||
success++
|
||||
|
||||
value=255
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_ubyte(17)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_ubyte(18)
|
||||
skip3b:
|
||||
; no else
|
||||
if x>=value
|
||||
fail_ubyte(19)
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
fail_ubyte(20)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1
|
||||
value=0
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x>=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: success++
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: success++
|
||||
skip5b:
|
||||
; no else
|
||||
if x>=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=255
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: fail_ubyte(21)
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: fail_ubyte(22)
|
||||
skip6b:
|
||||
; no else
|
||||
if x>=value
|
||||
fail_ubyte(23)
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
fail_ubyte(24)
|
||||
else
|
||||
success++
|
||||
|
||||
x=255
|
||||
value=0
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: success++
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: success++
|
||||
skip7b:
|
||||
; no else
|
||||
if x>=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: success++
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: success++
|
||||
skip8b:
|
||||
; no else
|
||||
if x>=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=255
|
||||
; direct jump
|
||||
if x>=value
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: success++
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x>=value
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: success++
|
||||
skip9b:
|
||||
; no else
|
||||
if x>=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(27)
|
||||
}
|
||||
sub test_cmp_array() {
|
||||
ubyte @shared x
|
||||
ubyte[] values = [0, 0]
|
||||
success = 0
|
||||
x=0
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_ubyte(25)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_ubyte(26)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
fail_ubyte(27)
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
fail_ubyte(28)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=255
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_ubyte(29)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_ubyte(30)
|
||||
skip3b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
fail_ubyte(31)
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
fail_ubyte(32)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: success++
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: success++
|
||||
skip5b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=255
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: fail_ubyte(33)
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: fail_ubyte(34)
|
||||
skip6b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
fail_ubyte(35)
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
fail_ubyte(36)
|
||||
else
|
||||
success++
|
||||
|
||||
x=255
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: success++
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: success++
|
||||
skip7b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: success++
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: success++
|
||||
skip8b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=255
|
||||
; direct jump
|
||||
if x>=values[1]
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: success++
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x>=values[1]
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: success++
|
||||
skip9b:
|
||||
; no else
|
||||
if x>=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(27)
|
||||
}
|
||||
sub test_cmp_expr() {
|
||||
ubyte @shared x
|
||||
cx16.r4 = 1
|
||||
cx16.r5 = 1
|
||||
float @shared f4 = 1.0
|
||||
float @shared f5 = 1.0
|
||||
success = 0
|
||||
x=0
|
||||
; direct jump
|
||||
if x>=cx16.r4L+0-cx16.r5L
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>=cx16.r4L+0-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x>=cx16.r4L+0-cx16.r5L
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=cx16.r4L+0-cx16.r5L
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=cx16.r4L+1-cx16.r5L
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_ubyte(37)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>=cx16.r4L+1-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_ubyte(38)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>=cx16.r4L+1-cx16.r5L
|
||||
fail_ubyte(39)
|
||||
|
||||
; with else
|
||||
if x>=cx16.r4L+1-cx16.r5L
|
||||
fail_ubyte(40)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x>=cx16.r4L+255-cx16.r5L
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_ubyte(41)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>=cx16.r4L+255-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_ubyte(42)
|
||||
skip3b:
|
||||
; no else
|
||||
if x>=cx16.r4L+255-cx16.r5L
|
||||
fail_ubyte(43)
|
||||
|
||||
; with else
|
||||
if x>=cx16.r4L+255-cx16.r5L
|
||||
fail_ubyte(44)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1
|
||||
; direct jump
|
||||
if x>=cx16.r4L+0-cx16.r5L
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: success++
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>=cx16.r4L+0-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: success++
|
||||
skip4b:
|
||||
; no else
|
||||
if x>=cx16.r4L+0-cx16.r5L
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=cx16.r4L+0-cx16.r5L
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=cx16.r4L+1-cx16.r5L
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: success++
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x>=cx16.r4L+1-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: success++
|
||||
skip5b:
|
||||
; no else
|
||||
if x>=cx16.r4L+1-cx16.r5L
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=cx16.r4L+1-cx16.r5L
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=cx16.r4L+255-cx16.r5L
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: fail_ubyte(45)
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x>=cx16.r4L+255-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: fail_ubyte(46)
|
||||
skip6b:
|
||||
; no else
|
||||
if x>=cx16.r4L+255-cx16.r5L
|
||||
fail_ubyte(47)
|
||||
|
||||
; with else
|
||||
if x>=cx16.r4L+255-cx16.r5L
|
||||
fail_ubyte(48)
|
||||
else
|
||||
success++
|
||||
|
||||
x=255
|
||||
; direct jump
|
||||
if x>=cx16.r4L+0-cx16.r5L
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: success++
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x>=cx16.r4L+0-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: success++
|
||||
skip7b:
|
||||
; no else
|
||||
if x>=cx16.r4L+0-cx16.r5L
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=cx16.r4L+0-cx16.r5L
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=cx16.r4L+1-cx16.r5L
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: success++
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x>=cx16.r4L+1-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: success++
|
||||
skip8b:
|
||||
; no else
|
||||
if x>=cx16.r4L+1-cx16.r5L
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=cx16.r4L+1-cx16.r5L
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x>=cx16.r4L+255-cx16.r5L
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: success++
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x>=cx16.r4L+255-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: success++
|
||||
skip9b:
|
||||
; no else
|
||||
if x>=cx16.r4L+255-cx16.r5L
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>=cx16.r4L+255-cx16.r5L
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(27)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,956 +0,0 @@
|
||||
|
||||
%import textio
|
||||
%import floats
|
||||
%import test_stack
|
||||
%zeropage dontuse
|
||||
%option no_sysinit
|
||||
|
||||
main {
|
||||
ubyte success = 0
|
||||
str datatype = "ubyte"
|
||||
uword @shared comparison
|
||||
|
||||
sub start() {
|
||||
txt.print("\nless-than tests for: ")
|
||||
txt.print(datatype)
|
||||
txt.nl()
|
||||
test_stack.test()
|
||||
txt.print("\n<number: ")
|
||||
test_cmp_number()
|
||||
txt.print("\n<var: ")
|
||||
test_cmp_var()
|
||||
txt.print("\n<array[]: ")
|
||||
test_cmp_array()
|
||||
txt.print("\n<expr: ")
|
||||
test_cmp_expr()
|
||||
test_stack.test()
|
||||
}
|
||||
|
||||
sub verify_success(ubyte expected) {
|
||||
if success==expected {
|
||||
txt.print("ok")
|
||||
} else {
|
||||
txt.print(" **failed** ")
|
||||
txt.print_ub(success)
|
||||
txt.print(" success, expected ")
|
||||
txt.print_ub(expected)
|
||||
}
|
||||
}
|
||||
|
||||
sub fail_byte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_ubyte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_word(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_uword(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_float(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
|
||||
sub test_cmp_number() {
|
||||
ubyte @shared x
|
||||
success = 0
|
||||
x=0
|
||||
; direct jump
|
||||
if x<0
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_ubyte(1)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<0
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_ubyte(2)
|
||||
skip1b:
|
||||
; no else
|
||||
if x<0
|
||||
fail_ubyte(3)
|
||||
|
||||
; with else
|
||||
if x<0
|
||||
fail_ubyte(4)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<1
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<1
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<1
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<1
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x<255
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<255
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x<255
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<255
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1
|
||||
; direct jump
|
||||
if x<0
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_ubyte(5)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<0
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_ubyte(6)
|
||||
skip4b:
|
||||
; no else
|
||||
if x<0
|
||||
fail_ubyte(7)
|
||||
|
||||
; with else
|
||||
if x<0
|
||||
fail_ubyte(8)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<1
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: fail_ubyte(9)
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x<1
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: fail_ubyte(10)
|
||||
skip5b:
|
||||
; no else
|
||||
if x<1
|
||||
fail_ubyte(11)
|
||||
|
||||
; with else
|
||||
if x<1
|
||||
fail_ubyte(12)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<255
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: success++
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x<255
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: success++
|
||||
skip6b:
|
||||
; no else
|
||||
if x<255
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<255
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=255
|
||||
; direct jump
|
||||
if x<0
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: fail_ubyte(13)
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x<0
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: fail_ubyte(14)
|
||||
skip7b:
|
||||
; no else
|
||||
if x<0
|
||||
fail_ubyte(15)
|
||||
|
||||
; with else
|
||||
if x<0
|
||||
fail_ubyte(16)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<1
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: fail_ubyte(17)
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x<1
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: fail_ubyte(18)
|
||||
skip8b:
|
||||
; no else
|
||||
if x<1
|
||||
fail_ubyte(19)
|
||||
|
||||
; with else
|
||||
if x<1
|
||||
fail_ubyte(20)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<255
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: fail_ubyte(21)
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x<255
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: fail_ubyte(22)
|
||||
skip9b:
|
||||
; no else
|
||||
if x<255
|
||||
fail_ubyte(23)
|
||||
|
||||
; with else
|
||||
if x<255
|
||||
fail_ubyte(24)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(18)
|
||||
}
|
||||
sub test_cmp_var() {
|
||||
ubyte @shared x, value
|
||||
success = 0
|
||||
x=0
|
||||
value=0
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_ubyte(25)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_ubyte(26)
|
||||
skip1b:
|
||||
; no else
|
||||
if x<value
|
||||
fail_ubyte(27)
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
fail_ubyte(28)
|
||||
else
|
||||
success++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=255
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x<value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1
|
||||
value=0
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_ubyte(29)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_ubyte(30)
|
||||
skip4b:
|
||||
; no else
|
||||
if x<value
|
||||
fail_ubyte(31)
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
fail_ubyte(32)
|
||||
else
|
||||
success++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: fail_ubyte(33)
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: fail_ubyte(34)
|
||||
skip5b:
|
||||
; no else
|
||||
if x<value
|
||||
fail_ubyte(35)
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
fail_ubyte(36)
|
||||
else
|
||||
success++
|
||||
|
||||
value=255
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: success++
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: success++
|
||||
skip6b:
|
||||
; no else
|
||||
if x<value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=255
|
||||
value=0
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: fail_ubyte(37)
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: fail_ubyte(38)
|
||||
skip7b:
|
||||
; no else
|
||||
if x<value
|
||||
fail_ubyte(39)
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
fail_ubyte(40)
|
||||
else
|
||||
success++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: fail_ubyte(41)
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: fail_ubyte(42)
|
||||
skip8b:
|
||||
; no else
|
||||
if x<value
|
||||
fail_ubyte(43)
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
fail_ubyte(44)
|
||||
else
|
||||
success++
|
||||
|
||||
value=255
|
||||
; direct jump
|
||||
if x<value
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: fail_ubyte(45)
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x<value
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: fail_ubyte(46)
|
||||
skip9b:
|
||||
; no else
|
||||
if x<value
|
||||
fail_ubyte(47)
|
||||
|
||||
; with else
|
||||
if x<value
|
||||
fail_ubyte(48)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(18)
|
||||
}
|
||||
sub test_cmp_array() {
|
||||
ubyte @shared x
|
||||
ubyte[] values = [0, 0]
|
||||
success = 0
|
||||
x=0
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_ubyte(49)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_ubyte(50)
|
||||
skip1b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
fail_ubyte(51)
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
fail_ubyte(52)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=255
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_ubyte(53)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_ubyte(54)
|
||||
skip4b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
fail_ubyte(55)
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
fail_ubyte(56)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: fail_ubyte(57)
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: fail_ubyte(58)
|
||||
skip5b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
fail_ubyte(59)
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
fail_ubyte(60)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=255
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: success++
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: success++
|
||||
skip6b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=255
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: fail_ubyte(61)
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: fail_ubyte(62)
|
||||
skip7b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
fail_ubyte(63)
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
fail_ubyte(64)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: fail_ubyte(65)
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: fail_ubyte(66)
|
||||
skip8b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
fail_ubyte(67)
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
fail_ubyte(68)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=255
|
||||
; direct jump
|
||||
if x<values[1]
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: fail_ubyte(69)
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x<values[1]
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: fail_ubyte(70)
|
||||
skip9b:
|
||||
; no else
|
||||
if x<values[1]
|
||||
fail_ubyte(71)
|
||||
|
||||
; with else
|
||||
if x<values[1]
|
||||
fail_ubyte(72)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(18)
|
||||
}
|
||||
sub test_cmp_expr() {
|
||||
ubyte @shared x
|
||||
cx16.r4 = 1
|
||||
cx16.r5 = 1
|
||||
float @shared f4 = 1.0
|
||||
float @shared f5 = 1.0
|
||||
success = 0
|
||||
x=0
|
||||
; direct jump
|
||||
if x<cx16.r4L+0-cx16.r5L
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_ubyte(73)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<cx16.r4L+0-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_ubyte(74)
|
||||
skip1b:
|
||||
; no else
|
||||
if x<cx16.r4L+0-cx16.r5L
|
||||
fail_ubyte(75)
|
||||
|
||||
; with else
|
||||
if x<cx16.r4L+0-cx16.r5L
|
||||
fail_ubyte(76)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<cx16.r4L+1-cx16.r5L
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<cx16.r4L+1-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<cx16.r4L+1-cx16.r5L
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<cx16.r4L+1-cx16.r5L
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x<cx16.r4L+255-cx16.r5L
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<cx16.r4L+255-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x<cx16.r4L+255-cx16.r5L
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<cx16.r4L+255-cx16.r5L
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1
|
||||
; direct jump
|
||||
if x<cx16.r4L+0-cx16.r5L
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_ubyte(77)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<cx16.r4L+0-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_ubyte(78)
|
||||
skip4b:
|
||||
; no else
|
||||
if x<cx16.r4L+0-cx16.r5L
|
||||
fail_ubyte(79)
|
||||
|
||||
; with else
|
||||
if x<cx16.r4L+0-cx16.r5L
|
||||
fail_ubyte(80)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<cx16.r4L+1-cx16.r5L
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: fail_ubyte(81)
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x<cx16.r4L+1-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: fail_ubyte(82)
|
||||
skip5b:
|
||||
; no else
|
||||
if x<cx16.r4L+1-cx16.r5L
|
||||
fail_ubyte(83)
|
||||
|
||||
; with else
|
||||
if x<cx16.r4L+1-cx16.r5L
|
||||
fail_ubyte(84)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<cx16.r4L+255-cx16.r5L
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: success++
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x<cx16.r4L+255-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: success++
|
||||
skip6b:
|
||||
; no else
|
||||
if x<cx16.r4L+255-cx16.r5L
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<cx16.r4L+255-cx16.r5L
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=255
|
||||
; direct jump
|
||||
if x<cx16.r4L+0-cx16.r5L
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: fail_ubyte(85)
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x<cx16.r4L+0-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: fail_ubyte(86)
|
||||
skip7b:
|
||||
; no else
|
||||
if x<cx16.r4L+0-cx16.r5L
|
||||
fail_ubyte(87)
|
||||
|
||||
; with else
|
||||
if x<cx16.r4L+0-cx16.r5L
|
||||
fail_ubyte(88)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<cx16.r4L+1-cx16.r5L
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: fail_ubyte(89)
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x<cx16.r4L+1-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: fail_ubyte(90)
|
||||
skip8b:
|
||||
; no else
|
||||
if x<cx16.r4L+1-cx16.r5L
|
||||
fail_ubyte(91)
|
||||
|
||||
; with else
|
||||
if x<cx16.r4L+1-cx16.r5L
|
||||
fail_ubyte(92)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<cx16.r4L+255-cx16.r5L
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: fail_ubyte(93)
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x<cx16.r4L+255-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: fail_ubyte(94)
|
||||
skip9b:
|
||||
; no else
|
||||
if x<cx16.r4L+255-cx16.r5L
|
||||
fail_ubyte(95)
|
||||
|
||||
; with else
|
||||
if x<cx16.r4L+255-cx16.r5L
|
||||
fail_ubyte(96)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(18)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,956 +0,0 @@
|
||||
|
||||
%import textio
|
||||
%import floats
|
||||
%import test_stack
|
||||
%zeropage dontuse
|
||||
%option no_sysinit
|
||||
|
||||
main {
|
||||
ubyte success = 0
|
||||
str datatype = "ubyte"
|
||||
uword @shared comparison
|
||||
|
||||
sub start() {
|
||||
txt.print("\nless-equal tests for: ")
|
||||
txt.print(datatype)
|
||||
txt.nl()
|
||||
test_stack.test()
|
||||
txt.print("\n<=number: ")
|
||||
test_cmp_number()
|
||||
txt.print("\n<=var: ")
|
||||
test_cmp_var()
|
||||
txt.print("\n<=array[]: ")
|
||||
test_cmp_array()
|
||||
txt.print("\n<=expr: ")
|
||||
test_cmp_expr()
|
||||
test_stack.test()
|
||||
}
|
||||
|
||||
sub verify_success(ubyte expected) {
|
||||
if success==expected {
|
||||
txt.print("ok")
|
||||
} else {
|
||||
txt.print(" **failed** ")
|
||||
txt.print_ub(success)
|
||||
txt.print(" success, expected ")
|
||||
txt.print_ub(expected)
|
||||
}
|
||||
}
|
||||
|
||||
sub fail_byte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_ubyte(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_word(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_uword(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_float(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
|
||||
sub test_cmp_number() {
|
||||
ubyte @shared x
|
||||
success = 0
|
||||
x=0
|
||||
; direct jump
|
||||
if x<=0
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<=0
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x<=0
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=0
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x<=1
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<=1
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<=1
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=1
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x<=255
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<=255
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x<=255
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=255
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1
|
||||
; direct jump
|
||||
if x<=0
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_ubyte(1)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<=0
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_ubyte(2)
|
||||
skip4b:
|
||||
; no else
|
||||
if x<=0
|
||||
fail_ubyte(3)
|
||||
|
||||
; with else
|
||||
if x<=0
|
||||
fail_ubyte(4)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<=1
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: success++
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x<=1
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: success++
|
||||
skip5b:
|
||||
; no else
|
||||
if x<=1
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=1
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x<=255
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: success++
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x<=255
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: success++
|
||||
skip6b:
|
||||
; no else
|
||||
if x<=255
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=255
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=255
|
||||
; direct jump
|
||||
if x<=0
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: fail_ubyte(5)
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x<=0
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: fail_ubyte(6)
|
||||
skip7b:
|
||||
; no else
|
||||
if x<=0
|
||||
fail_ubyte(7)
|
||||
|
||||
; with else
|
||||
if x<=0
|
||||
fail_ubyte(8)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<=1
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: fail_ubyte(9)
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x<=1
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: fail_ubyte(10)
|
||||
skip8b:
|
||||
; no else
|
||||
if x<=1
|
||||
fail_ubyte(11)
|
||||
|
||||
; with else
|
||||
if x<=1
|
||||
fail_ubyte(12)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<=255
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: success++
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x<=255
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: success++
|
||||
skip9b:
|
||||
; no else
|
||||
if x<=255
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=255
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(27)
|
||||
}
|
||||
sub test_cmp_var() {
|
||||
ubyte @shared x, value
|
||||
success = 0
|
||||
x=0
|
||||
value=0
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x<=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=255
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x<=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1
|
||||
value=0
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_ubyte(13)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_ubyte(14)
|
||||
skip4b:
|
||||
; no else
|
||||
if x<=value
|
||||
fail_ubyte(15)
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
fail_ubyte(16)
|
||||
else
|
||||
success++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: success++
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: success++
|
||||
skip5b:
|
||||
; no else
|
||||
if x<=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
value=255
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: success++
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: success++
|
||||
skip6b:
|
||||
; no else
|
||||
if x<=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=255
|
||||
value=0
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: fail_ubyte(17)
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: fail_ubyte(18)
|
||||
skip7b:
|
||||
; no else
|
||||
if x<=value
|
||||
fail_ubyte(19)
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
fail_ubyte(20)
|
||||
else
|
||||
success++
|
||||
|
||||
value=1
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: fail_ubyte(21)
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: fail_ubyte(22)
|
||||
skip8b:
|
||||
; no else
|
||||
if x<=value
|
||||
fail_ubyte(23)
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
fail_ubyte(24)
|
||||
else
|
||||
success++
|
||||
|
||||
value=255
|
||||
; direct jump
|
||||
if x<=value
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: success++
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x<=value
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: success++
|
||||
skip9b:
|
||||
; no else
|
||||
if x<=value
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=value
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(27)
|
||||
}
|
||||
sub test_cmp_array() {
|
||||
ubyte @shared x
|
||||
ubyte[] values = [0, 0]
|
||||
success = 0
|
||||
x=0
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=255
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_ubyte(25)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_ubyte(26)
|
||||
skip4b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
fail_ubyte(27)
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
fail_ubyte(28)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: success++
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: success++
|
||||
skip5b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=255
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: success++
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: success++
|
||||
skip6b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=255
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: fail_ubyte(29)
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: fail_ubyte(30)
|
||||
skip7b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
fail_ubyte(31)
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
fail_ubyte(32)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: fail_ubyte(33)
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: fail_ubyte(34)
|
||||
skip8b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
fail_ubyte(35)
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
fail_ubyte(36)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=255
|
||||
; direct jump
|
||||
if x<=values[1]
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: success++
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x<=values[1]
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: success++
|
||||
skip9b:
|
||||
; no else
|
||||
if x<=values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(27)
|
||||
}
|
||||
sub test_cmp_expr() {
|
||||
ubyte @shared x
|
||||
cx16.r4 = 1
|
||||
cx16.r5 = 1
|
||||
float @shared f4 = 1.0
|
||||
float @shared f5 = 1.0
|
||||
success = 0
|
||||
x=0
|
||||
; direct jump
|
||||
if x<=cx16.r4L+0-cx16.r5L
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: success++
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x<=cx16.r4L+0-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: success++
|
||||
skip1b:
|
||||
; no else
|
||||
if x<=cx16.r4L+0-cx16.r5L
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=cx16.r4L+0-cx16.r5L
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x<=cx16.r4L+1-cx16.r5L
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: success++
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x<=cx16.r4L+1-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: success++
|
||||
skip2b:
|
||||
; no else
|
||||
if x<=cx16.r4L+1-cx16.r5L
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=cx16.r4L+1-cx16.r5L
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x<=cx16.r4L+255-cx16.r5L
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: success++
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x<=cx16.r4L+255-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: success++
|
||||
skip3b:
|
||||
; no else
|
||||
if x<=cx16.r4L+255-cx16.r5L
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=cx16.r4L+255-cx16.r5L
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=1
|
||||
; direct jump
|
||||
if x<=cx16.r4L+0-cx16.r5L
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_ubyte(37)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x<=cx16.r4L+0-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_ubyte(38)
|
||||
skip4b:
|
||||
; no else
|
||||
if x<=cx16.r4L+0-cx16.r5L
|
||||
fail_ubyte(39)
|
||||
|
||||
; with else
|
||||
if x<=cx16.r4L+0-cx16.r5L
|
||||
fail_ubyte(40)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<=cx16.r4L+1-cx16.r5L
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: success++
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x<=cx16.r4L+1-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: success++
|
||||
skip5b:
|
||||
; no else
|
||||
if x<=cx16.r4L+1-cx16.r5L
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=cx16.r4L+1-cx16.r5L
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if x<=cx16.r4L+255-cx16.r5L
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: success++
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x<=cx16.r4L+255-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: success++
|
||||
skip6b:
|
||||
; no else
|
||||
if x<=cx16.r4L+255-cx16.r5L
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=cx16.r4L+255-cx16.r5L
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
x=255
|
||||
; direct jump
|
||||
if x<=cx16.r4L+0-cx16.r5L
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: fail_ubyte(41)
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x<=cx16.r4L+0-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: fail_ubyte(42)
|
||||
skip7b:
|
||||
; no else
|
||||
if x<=cx16.r4L+0-cx16.r5L
|
||||
fail_ubyte(43)
|
||||
|
||||
; with else
|
||||
if x<=cx16.r4L+0-cx16.r5L
|
||||
fail_ubyte(44)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<=cx16.r4L+1-cx16.r5L
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: fail_ubyte(45)
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x<=cx16.r4L+1-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: fail_ubyte(46)
|
||||
skip8b:
|
||||
; no else
|
||||
if x<=cx16.r4L+1-cx16.r5L
|
||||
fail_ubyte(47)
|
||||
|
||||
; with else
|
||||
if x<=cx16.r4L+1-cx16.r5L
|
||||
fail_ubyte(48)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if x<=cx16.r4L+255-cx16.r5L
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: success++
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x<=cx16.r4L+255-cx16.r5L
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: success++
|
||||
skip9b:
|
||||
; no else
|
||||
if x<=cx16.r4L+255-cx16.r5L
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x<=cx16.r4L+255-cx16.r5L
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
verify_success(27)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,816 +0,0 @@
|
||||
|
||||
%import textio
|
||||
%import floats
|
||||
%import test_stack
|
||||
%zeropage dontuse
|
||||
%option no_sysinit
|
||||
|
||||
main {
|
||||
uword success = 0
|
||||
str datatype = "uword"
|
||||
uword @shared comparison
|
||||
|
||||
sub start() {
|
||||
txt.print("\ngreater-than split words array tests for: ")
|
||||
txt.print(datatype)
|
||||
txt.nl()
|
||||
test_stack.test()
|
||||
txt.print("\n>array[]: ")
|
||||
test_cmp_array()
|
||||
test_stack.test()
|
||||
}
|
||||
|
||||
sub verify_success(uword expected) {
|
||||
if success==expected {
|
||||
txt.print("ok")
|
||||
} else {
|
||||
txt.print(" **failed** ")
|
||||
txt.print_uw(success)
|
||||
txt.print(" success, expected ")
|
||||
txt.print_uw(expected)
|
||||
}
|
||||
}
|
||||
|
||||
sub fail_word(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
sub fail_uword(uword idx) {
|
||||
txt.print(" **fail#")
|
||||
txt.print_uw(idx)
|
||||
txt.print(" **")
|
||||
}
|
||||
|
||||
|
||||
sub test_cmp_array() {
|
||||
uword @shared x
|
||||
uword[] @split values = [0, 0]
|
||||
uword[] @split sources = [0, 0]
|
||||
success = 0
|
||||
x=0
|
||||
sources[1]=0
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl1a
|
||||
goto skip1a
|
||||
lbl1a: fail_uword(1)
|
||||
skip1a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip1b
|
||||
lbl1b: fail_uword(2)
|
||||
skip1b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_uword(3)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_uword(4)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if sources[1]>values[1]
|
||||
goto lbl1c
|
||||
goto skip1c
|
||||
lbl1c: fail_uword(5)
|
||||
skip1c:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl1d
|
||||
if sources[1]>values[1]
|
||||
goto cx16.r3
|
||||
goto skip1d
|
||||
lbl1d: fail_uword(6)
|
||||
skip1d:
|
||||
; no else
|
||||
if sources[1]>values[1]
|
||||
fail_uword(7)
|
||||
|
||||
; with else
|
||||
if sources[1]>values[1]
|
||||
fail_uword(8)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl2a
|
||||
goto skip2a
|
||||
lbl2a: fail_uword(9)
|
||||
skip2a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip2b
|
||||
lbl2b: fail_uword(10)
|
||||
skip2b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_uword(11)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_uword(12)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if sources[1]>values[1]
|
||||
goto lbl2c
|
||||
goto skip2c
|
||||
lbl2c: fail_uword(13)
|
||||
skip2c:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl2d
|
||||
if sources[1]>values[1]
|
||||
goto cx16.r3
|
||||
goto skip2d
|
||||
lbl2d: fail_uword(14)
|
||||
skip2d:
|
||||
; no else
|
||||
if sources[1]>values[1]
|
||||
fail_uword(15)
|
||||
|
||||
; with else
|
||||
if sources[1]>values[1]
|
||||
fail_uword(16)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=30464
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl3a
|
||||
goto skip3a
|
||||
lbl3a: fail_uword(17)
|
||||
skip3a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip3b
|
||||
lbl3b: fail_uword(18)
|
||||
skip3b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_uword(19)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_uword(20)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if sources[1]>values[1]
|
||||
goto lbl3c
|
||||
goto skip3c
|
||||
lbl3c: fail_uword(21)
|
||||
skip3c:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl3d
|
||||
if sources[1]>values[1]
|
||||
goto cx16.r3
|
||||
goto skip3d
|
||||
lbl3d: fail_uword(22)
|
||||
skip3d:
|
||||
; no else
|
||||
if sources[1]>values[1]
|
||||
fail_uword(23)
|
||||
|
||||
; with else
|
||||
if sources[1]>values[1]
|
||||
fail_uword(24)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=65535
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl4a
|
||||
goto skip4a
|
||||
lbl4a: fail_uword(25)
|
||||
skip4a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip4b
|
||||
lbl4b: fail_uword(26)
|
||||
skip4b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_uword(27)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_uword(28)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if sources[1]>values[1]
|
||||
goto lbl4c
|
||||
goto skip4c
|
||||
lbl4c: fail_uword(29)
|
||||
skip4c:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl4d
|
||||
if sources[1]>values[1]
|
||||
goto cx16.r3
|
||||
goto skip4d
|
||||
lbl4d: fail_uword(30)
|
||||
skip4d:
|
||||
; no else
|
||||
if sources[1]>values[1]
|
||||
fail_uword(31)
|
||||
|
||||
; with else
|
||||
if sources[1]>values[1]
|
||||
fail_uword(32)
|
||||
else
|
||||
success++
|
||||
|
||||
x=1
|
||||
sources[1]=1
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl5a
|
||||
goto skip5a
|
||||
lbl5a: success++
|
||||
skip5a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip5b
|
||||
lbl5b: success++
|
||||
skip5b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if sources[1]>values[1]
|
||||
goto lbl5c
|
||||
goto skip5c
|
||||
lbl5c: success++
|
||||
skip5c:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl5d
|
||||
if sources[1]>values[1]
|
||||
goto cx16.r3
|
||||
goto skip5d
|
||||
lbl5d: success++
|
||||
skip5d:
|
||||
; no else
|
||||
if sources[1]>values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if sources[1]>values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl6a
|
||||
goto skip6a
|
||||
lbl6a: fail_uword(33)
|
||||
skip6a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip6b
|
||||
lbl6b: fail_uword(34)
|
||||
skip6b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_uword(35)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_uword(36)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if sources[1]>values[1]
|
||||
goto lbl6c
|
||||
goto skip6c
|
||||
lbl6c: fail_uword(37)
|
||||
skip6c:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl6d
|
||||
if sources[1]>values[1]
|
||||
goto cx16.r3
|
||||
goto skip6d
|
||||
lbl6d: fail_uword(38)
|
||||
skip6d:
|
||||
; no else
|
||||
if sources[1]>values[1]
|
||||
fail_uword(39)
|
||||
|
||||
; with else
|
||||
if sources[1]>values[1]
|
||||
fail_uword(40)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=30464
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl7a
|
||||
goto skip7a
|
||||
lbl7a: fail_uword(41)
|
||||
skip7a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip7b
|
||||
lbl7b: fail_uword(42)
|
||||
skip7b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_uword(43)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_uword(44)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if sources[1]>values[1]
|
||||
goto lbl7c
|
||||
goto skip7c
|
||||
lbl7c: fail_uword(45)
|
||||
skip7c:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl7d
|
||||
if sources[1]>values[1]
|
||||
goto cx16.r3
|
||||
goto skip7d
|
||||
lbl7d: fail_uword(46)
|
||||
skip7d:
|
||||
; no else
|
||||
if sources[1]>values[1]
|
||||
fail_uword(47)
|
||||
|
||||
; with else
|
||||
if sources[1]>values[1]
|
||||
fail_uword(48)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=65535
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl8a
|
||||
goto skip8a
|
||||
lbl8a: fail_uword(49)
|
||||
skip8a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip8b
|
||||
lbl8b: fail_uword(50)
|
||||
skip8b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_uword(51)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_uword(52)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if sources[1]>values[1]
|
||||
goto lbl8c
|
||||
goto skip8c
|
||||
lbl8c: fail_uword(53)
|
||||
skip8c:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl8d
|
||||
if sources[1]>values[1]
|
||||
goto cx16.r3
|
||||
goto skip8d
|
||||
lbl8d: fail_uword(54)
|
||||
skip8d:
|
||||
; no else
|
||||
if sources[1]>values[1]
|
||||
fail_uword(55)
|
||||
|
||||
; with else
|
||||
if sources[1]>values[1]
|
||||
fail_uword(56)
|
||||
else
|
||||
success++
|
||||
|
||||
x=30464
|
||||
sources[1]=30464
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl9a
|
||||
goto skip9a
|
||||
lbl9a: success++
|
||||
skip9a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip9b
|
||||
lbl9b: success++
|
||||
skip9b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if sources[1]>values[1]
|
||||
goto lbl9c
|
||||
goto skip9c
|
||||
lbl9c: success++
|
||||
skip9c:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl9d
|
||||
if sources[1]>values[1]
|
||||
goto cx16.r3
|
||||
goto skip9d
|
||||
lbl9d: success++
|
||||
skip9d:
|
||||
; no else
|
||||
if sources[1]>values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if sources[1]>values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl10a
|
||||
goto skip10a
|
||||
lbl10a: success++
|
||||
skip10a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl10b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip10b
|
||||
lbl10b: success++
|
||||
skip10b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if sources[1]>values[1]
|
||||
goto lbl10c
|
||||
goto skip10c
|
||||
lbl10c: success++
|
||||
skip10c:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl10d
|
||||
if sources[1]>values[1]
|
||||
goto cx16.r3
|
||||
goto skip10d
|
||||
lbl10d: success++
|
||||
skip10d:
|
||||
; no else
|
||||
if sources[1]>values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if sources[1]>values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=30464
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl11a
|
||||
goto skip11a
|
||||
lbl11a: fail_uword(57)
|
||||
skip11a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl11b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip11b
|
||||
lbl11b: fail_uword(58)
|
||||
skip11b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_uword(59)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_uword(60)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if sources[1]>values[1]
|
||||
goto lbl11c
|
||||
goto skip11c
|
||||
lbl11c: fail_uword(61)
|
||||
skip11c:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl11d
|
||||
if sources[1]>values[1]
|
||||
goto cx16.r3
|
||||
goto skip11d
|
||||
lbl11d: fail_uword(62)
|
||||
skip11d:
|
||||
; no else
|
||||
if sources[1]>values[1]
|
||||
fail_uword(63)
|
||||
|
||||
; with else
|
||||
if sources[1]>values[1]
|
||||
fail_uword(64)
|
||||
else
|
||||
success++
|
||||
|
||||
values[1]=65535
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl12a
|
||||
goto skip12a
|
||||
lbl12a: fail_uword(65)
|
||||
skip12a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl12b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip12b
|
||||
lbl12b: fail_uword(66)
|
||||
skip12b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_uword(67)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_uword(68)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if sources[1]>values[1]
|
||||
goto lbl12c
|
||||
goto skip12c
|
||||
lbl12c: fail_uword(69)
|
||||
skip12c:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl12d
|
||||
if sources[1]>values[1]
|
||||
goto cx16.r3
|
||||
goto skip12d
|
||||
lbl12d: fail_uword(70)
|
||||
skip12d:
|
||||
; no else
|
||||
if sources[1]>values[1]
|
||||
fail_uword(71)
|
||||
|
||||
; with else
|
||||
if sources[1]>values[1]
|
||||
fail_uword(72)
|
||||
else
|
||||
success++
|
||||
|
||||
x=65535
|
||||
sources[1]=65535
|
||||
values[1]=0
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl13a
|
||||
goto skip13a
|
||||
lbl13a: success++
|
||||
skip13a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl13b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip13b
|
||||
lbl13b: success++
|
||||
skip13b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if sources[1]>values[1]
|
||||
goto lbl13c
|
||||
goto skip13c
|
||||
lbl13c: success++
|
||||
skip13c:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl13d
|
||||
if sources[1]>values[1]
|
||||
goto cx16.r3
|
||||
goto skip13d
|
||||
lbl13d: success++
|
||||
skip13d:
|
||||
; no else
|
||||
if sources[1]>values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if sources[1]>values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=1
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl14a
|
||||
goto skip14a
|
||||
lbl14a: success++
|
||||
skip14a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl14b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip14b
|
||||
lbl14b: success++
|
||||
skip14b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if sources[1]>values[1]
|
||||
goto lbl14c
|
||||
goto skip14c
|
||||
lbl14c: success++
|
||||
skip14c:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl14d
|
||||
if sources[1]>values[1]
|
||||
goto cx16.r3
|
||||
goto skip14d
|
||||
lbl14d: success++
|
||||
skip14d:
|
||||
; no else
|
||||
if sources[1]>values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if sources[1]>values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=30464
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl15a
|
||||
goto skip15a
|
||||
lbl15a: success++
|
||||
skip15a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl15b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip15b
|
||||
lbl15b: success++
|
||||
skip15b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
; direct jump
|
||||
if sources[1]>values[1]
|
||||
goto lbl15c
|
||||
goto skip15c
|
||||
lbl15c: success++
|
||||
skip15c:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl15d
|
||||
if sources[1]>values[1]
|
||||
goto cx16.r3
|
||||
goto skip15d
|
||||
lbl15d: success++
|
||||
skip15d:
|
||||
; no else
|
||||
if sources[1]>values[1]
|
||||
success++
|
||||
|
||||
; with else
|
||||
if sources[1]>values[1]
|
||||
success++
|
||||
else
|
||||
cx16.r0L++
|
||||
|
||||
values[1]=65535
|
||||
; direct jump
|
||||
if x>values[1]
|
||||
goto lbl16a
|
||||
goto skip16a
|
||||
lbl16a: fail_uword(73)
|
||||
skip16a:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl16b
|
||||
if x>values[1]
|
||||
goto cx16.r3
|
||||
goto skip16b
|
||||
lbl16b: fail_uword(74)
|
||||
skip16b:
|
||||
; no else
|
||||
if x>values[1]
|
||||
fail_uword(75)
|
||||
|
||||
; with else
|
||||
if x>values[1]
|
||||
fail_uword(76)
|
||||
else
|
||||
success++
|
||||
|
||||
; direct jump
|
||||
if sources[1]>values[1]
|
||||
goto lbl16c
|
||||
goto skip16c
|
||||
lbl16c: fail_uword(77)
|
||||
skip16c:
|
||||
; indirect jump
|
||||
cx16.r3 = &lbl16d
|
||||
if sources[1]>values[1]
|
||||
goto cx16.r3
|
||||
goto skip16d
|
||||
lbl16d: fail_uword(78)
|
||||
skip16d:
|
||||
; no else
|
||||
if sources[1]>values[1]
|
||||
fail_uword(79)
|
||||
|
||||
; with else
|
||||
if sources[1]>values[1]
|
||||
fail_uword(80)
|
||||
else
|
||||
success++
|
||||
|
||||
verify_success(68)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loaded 100 of 155 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user