1
0
mirror of https://github.com/KarolS/millfork.git synced 2025-01-11 12:29:46 +00:00

6809: Enable and fix more tests

This commit is contained in:
Karol Stasiak 2019-12-15 23:48:22 +01:00
parent f39fd67a89
commit f8fc001971
8 changed files with 73 additions and 49 deletions

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class BitOpSuite extends FunSuite with Matchers { class BitOpSuite extends FunSuite with Matchers {
test("Word AND") { test("Word AND") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)("""
| word output @$c000 | word output @$c000
| void main () { | void main () {
| byte b | byte b
@ -36,7 +36,7 @@ class BitOpSuite extends FunSuite with Matchers {
} }
test("Smart bit set/reset") { test("Smart bit set/reset") {
EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(""" EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)("""
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
| output = 5 | output = 5
@ -46,21 +46,21 @@ class BitOpSuite extends FunSuite with Matchers {
| output |= 2 | output |= 2
| } | }
| noinline void barrier() { } | noinline void barrier() { }
""".stripMargin)(_.readLong(0xc000) should equal(6)) """.stripMargin)(_.readByte(0xc000) should equal(6))
} }
test("Smart bit set/reset 2") { test("Smart bit set/reset 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(""" EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)("""
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
| output = 5 | output = 5
| output &= 0xfe | output &= 0xfe
| output |= 2 | output |= 2
| } | }
""".stripMargin)(_.readLong(0xc000) should equal(6)) """.stripMargin)(_.readByte(0xc000) should equal(6))
} }
test("Word AND 2") { test("Word AND 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)("""
| word output @$c000 | word output @$c000
| void main () { | void main () {
| word v, w | word v, w
@ -87,11 +87,11 @@ class BitOpSuite extends FunSuite with Matchers {
| } | }
| |
""".stripMargin """.stripMargin
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(code)(_.readByte(0xc000) should equal(2)) EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Motorola6809)(code)(_.readByte(0xc000) should equal(2))
} }
test("Multiple words") { test("Multiple words") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)("""
| word output @$c000 | word output @$c000
| void main () { | void main () {
| word v, w | word v, w

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class BooleanOptimizationSuite extends FunSuite with Matchers { class BooleanOptimizationSuite extends FunSuite with Matchers {
test("Cases") { test("Cases") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Motorola6809)(
""" """
| noinline bool f1(byte a) = a & 1 != 0 | noinline bool f1(byte a) = a & 1 != 0
| noinline bool f2(byte a) = a & 4 != 4 | noinline bool f2(byte a) = a & 4 != 4

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class BreakContinueSuite extends FunSuite with Matchers { class BreakContinueSuite extends FunSuite with Matchers {
test("Break from one-iteration loop 1") { test("Break from one-iteration loop 1") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(
""" """
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
@ -24,7 +24,7 @@ class BreakContinueSuite extends FunSuite with Matchers {
} }
test("Break from one-iteration loop 2") { test("Break from one-iteration loop 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(
""" """
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
@ -39,7 +39,7 @@ class BreakContinueSuite extends FunSuite with Matchers {
} }
test("Break from infinite loop 1") { test("Break from infinite loop 1") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(
""" """
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
@ -54,7 +54,7 @@ class BreakContinueSuite extends FunSuite with Matchers {
} }
test("Break and continue from infinite loop 1") { test("Break and continue from infinite loop 1") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(
""" """
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
@ -70,7 +70,7 @@ class BreakContinueSuite extends FunSuite with Matchers {
} }
test("Nested break") { test("Nested break") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(
""" """
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
@ -87,7 +87,7 @@ class BreakContinueSuite extends FunSuite with Matchers {
} }
test("Continue in for loop 1") { test("Continue in for loop 1") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(
""" """
| byte output @$c000 | byte output @$c000
| byte counter @$c001 | byte counter @$c001

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class CmosSuite extends FunSuite with Matchers { class CmosSuite extends FunSuite with Matchers {
test("Zero store 1") { test("Zero store 1") {
EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(""" EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Motorola6809)("""
| word output @$c000 | word output @$c000
| void main () { | void main () {
| output = 1 | output = 1
@ -19,7 +19,7 @@ class CmosSuite extends FunSuite with Matchers {
""".stripMargin)(_.readWord(0xc000) should equal(0)) """.stripMargin)(_.readWord(0xc000) should equal(0))
} }
test("Zero store 2") { test("Zero store 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(""" EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Motorola6809)("""
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
| output = 1 | output = 1
@ -27,6 +27,6 @@ class CmosSuite extends FunSuite with Matchers {
| output += 1 | output += 1
| output <<= 1 | output <<= 1
| } | }
""".stripMargin)(_.readWord(0xc000) should equal(2)) """.stripMargin)(_.readByte(0xc000) should equal(2))
} }
} }

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class ComparisonSuite extends FunSuite with Matchers { class ComparisonSuite extends FunSuite with Matchers {
test("Equality and inequality") { test("Equality and inequality") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(
""" """
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
@ -28,7 +28,7 @@ class ComparisonSuite extends FunSuite with Matchers {
} }
test("Less") { test("Less") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(
""" """
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
@ -41,7 +41,7 @@ class ComparisonSuite extends FunSuite with Matchers {
} }
test("Compare to zero") { test("Compare to zero") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(
""" """
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
@ -76,7 +76,7 @@ class ComparisonSuite extends FunSuite with Matchers {
} }
test("Does it even work") { test("Does it even work") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(
""" """
| word output @$c000 | word output @$c000
| void main () { | void main () {
@ -99,7 +99,9 @@ class ComparisonSuite extends FunSuite with Matchers {
| if 2222 == 3333 { output -= 1 } | if 2222 == 3333 { output -= 1 }
| } | }
""".stripMargin """.stripMargin
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src)(_.readByte(0xc000) should equal(src.count(_ == '+'))) EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(src) { m =>
m.readByte(0xc000) should equal(src.count(_ == '+'))
}
} }
test("Word comparison == and !=") { test("Word comparison == and !=") {
@ -122,7 +124,9 @@ class ComparisonSuite extends FunSuite with Matchers {
| if a != 0 { output += 1 } | if a != 0 { output += 1 }
| } | }
""".stripMargin """.stripMargin
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src)(_.readByte(0xc000) should equal(src.count(_ == '+'))) EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(src){ m =>
m.readByte(0xc000) should equal(src.count(_ == '+'))
}
} }
test("Word comparison <=") { test("Word comparison <=") {
@ -143,7 +147,9 @@ class ComparisonSuite extends FunSuite with Matchers {
| if a <= c { output += 1 } | if a <= c { output += 1 }
| } | }
""".stripMargin """.stripMargin
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src)(_.readByte(0xc000) should equal(src.count(_ == '+'))) EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(src){m =>
m.readByte(0xc000) should equal(src.count(_ == '+'))
}
} }
test("Word comparison <") { test("Word comparison <") {
val src = val src =
@ -162,7 +168,9 @@ class ComparisonSuite extends FunSuite with Matchers {
| if a < 257 { output += 1 } | if a < 257 { output += 1 }
| } | }
""".stripMargin """.stripMargin
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src)(_.readByte(0xc000) should equal(src.count(_ == '+'))) EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(src){m =>
m.readByte(0xc000) should equal(src.count(_ == '+'))
}
} }
@ -183,7 +191,9 @@ class ComparisonSuite extends FunSuite with Matchers {
| if c > 0 { output += 1 } | if c > 0 { output += 1 }
| } | }
""".stripMargin """.stripMargin
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src)(_.readByte(0xc000) should equal(src.count(_ == '+'))) EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(src){m =>
m.readByte(0xc000) should equal(src.count(_ == '+')) }
} }
test("Word comparison >=") { test("Word comparison >=") {
@ -206,7 +216,9 @@ class ComparisonSuite extends FunSuite with Matchers {
| if a >= 0 { output += 1 } | if a >= 0 { output += 1 }
| } | }
""".stripMargin """.stripMargin
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src)(_.readByte(0xc000) should equal(src.count(_ == '+'))) EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(src){m =>
m.readByte(0xc000) should equal(src.count(_ == '+'))
}
} }
test("Signed comparison >=") { test("Signed comparison >=") {
@ -229,7 +241,9 @@ class ComparisonSuite extends FunSuite with Matchers {
| if a >= 0 { output += 1 } | if a >= 0 { output += 1 }
| } | }
""".stripMargin """.stripMargin
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src)(_.readByte(0xc000) should equal(src.count(_ == '+'))) EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(src){m =>
m.readByte(0xc000) should equal(src.count(_ == '+'))
}
} }
test("Signed comparison with overflow") { test("Signed comparison with overflow") {
@ -263,7 +277,9 @@ class ComparisonSuite extends FunSuite with Matchers {
| if c > -1 { output += 1 } | if c > -1 { output += 1 }
| } | }
""".stripMargin """.stripMargin
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src)(_.readByte(0xc000) should equal(src.count(_ == '+'))) EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(src){m =>
m.readByte(0xc000) should equal(src.count(_ == '+'))
}
} }
test("Signed comparison < and <=") { test("Signed comparison < and <=") {
@ -295,11 +311,13 @@ class ComparisonSuite extends FunSuite with Matchers {
| if c <= -1 { output -= 7 } | if c <= -1 { output -= 7 }
| } | }
""".stripMargin """.stripMargin
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src)(_.readByte(0xc000) should equal(src.count(_ == '+'))) EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(src){m =>
m.readByte(0xc000) should equal(src.count(_ == '+'))
}
} }
test("Multiple params for equality") { test("Multiple params for equality") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(
""" """
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
@ -315,7 +333,7 @@ class ComparisonSuite extends FunSuite with Matchers {
} }
test("Multiple params for inequality") { test("Multiple params for inequality") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(
""" """
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
@ -331,7 +349,7 @@ class ComparisonSuite extends FunSuite with Matchers {
} }
test("Warnings") { test("Warnings") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(
""" """
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
@ -373,7 +391,9 @@ class ComparisonSuite extends FunSuite with Matchers {
| if c > 335444 { output += 1 } | if c > 335444 { output += 1 }
| } | }
""".stripMargin """.stripMargin
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src)(_.readByte(0xc000) should equal(src.count(_ == '+'))) EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src){m =>
m.readByte(0xc000) should equal(src.count(_ == '+'))
}
} }
test("Mixed type comparison") { test("Mixed type comparison") {
@ -391,7 +411,9 @@ class ComparisonSuite extends FunSuite with Matchers {
| if x < z { output += 1 } | if x < z { output += 1 }
| } | }
""".stripMargin """.stripMargin
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src)(_.readByte(0xc000) should equal(1)) EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)(src){m =>
m.readByte(0xc000) should equal(1)
}
} }
test("Compare beyond 2.2") { test("Compare beyond 2.2") {
@ -419,7 +441,7 @@ class ComparisonSuite extends FunSuite with Matchers {
} }
test("Compare to $ffff") { test("Compare to $ffff") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086, Cpu.Motorola6809)(
""" """
| byte output @$c000 | byte output @$c000
| void main() { | void main() {
@ -439,7 +461,7 @@ class ComparisonSuite extends FunSuite with Matchers {
} }
test("Compare to 0") { test("Compare to 0") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086, Cpu.Motorola6809)(
""" """
| byte output @$c000 | byte output @$c000
| void main() { | void main() {
@ -459,7 +481,7 @@ class ComparisonSuite extends FunSuite with Matchers {
} }
test("Signed compare to 0") { test("Signed compare to 0") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086, Cpu.Motorola6809)(
""" """
| byte output @$c000 | byte output @$c000
| void main() { | void main() {
@ -477,7 +499,7 @@ class ComparisonSuite extends FunSuite with Matchers {
} }
test("Signed compare to 1") { test("Signed compare to 1") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086, Cpu.Motorola6809)(
""" """
| byte output @$c000 | byte output @$c000
| void main() { | void main() {
@ -538,7 +560,9 @@ class ComparisonSuite extends FunSuite with Matchers {
| } | }
| noinline word id(word x) = x | noinline word id(word x) = x
|""".stripMargin |""".stripMargin
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Sixteen, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(code) {m => m.readByte(0xc000) should equal (code.count(_ == '↑'))} EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Sixteen, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(code) {m =>
m.readByte(0xc000) should equal (code.count(_ == '↑'))
}
} }
test("Comparison optimization") { test("Comparison optimization") {
@ -576,7 +600,7 @@ class ComparisonSuite extends FunSuite with Matchers {
| if ff() >= 10 { output += 1 } // | if ff() >= 10 { output += 1 } //
| } | }
|""".stripMargin |""".stripMargin
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(code) { m => EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Motorola6809)(code) { m =>
m.readByte(0xc000) should equal(code.count(_ == '↑')) m.readByte(0xc000) should equal(code.count(_ == '↑'))
} }
} }
@ -624,7 +648,7 @@ class ComparisonSuite extends FunSuite with Matchers {
| |
| } | }
|""".stripMargin |""".stripMargin
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(code) { m => EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Motorola6809)(code) { m =>
m.readByte(0xc000) should equal(code.count(_ == '↑')) m.readByte(0xc000) should equal(code.count(_ == '↑'))
} }
} }

View File

@ -11,7 +11,7 @@ import org.scalatest.{FunSuite, Matchers}
class ConstantSuite extends FunSuite with Matchers { class ConstantSuite extends FunSuite with Matchers {
test("Constants should fold") { test("Constants should fold") {
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)( EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086, Cpu.Motorola6809)(
""" """
| array Sieve[4] | array Sieve[4]
| const byte two = 2 | const byte two = 2

View File

@ -9,7 +9,7 @@ import org.scalatest.{FunSuite, Matchers}
*/ */
class DerefSuite extends FunSuite with Matchers { class DerefSuite extends FunSuite with Matchers {
test("Basic deref test") { test("Basic deref test") {
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)( EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086, Cpu.Motorola6809)(
""" """
| |
| byte output @$c000 | byte output @$c000
@ -33,7 +33,7 @@ class DerefSuite extends FunSuite with Matchers {
} }
test("Byte arithmetic deref test") { test("Byte arithmetic deref test") {
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)( EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086, Cpu.Motorola6809)(
""" """
| |
| byte output1 @$c000 | byte output1 @$c000
@ -59,7 +59,7 @@ class DerefSuite extends FunSuite with Matchers {
} }
test("Word arithmetic deref test") { test("Word arithmetic deref test") {
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)( EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086, Cpu.Motorola6809)(
""" """
| |
| word output1 @$c000 | word output1 @$c000

View File

@ -94,7 +94,7 @@ class ShiftSuite extends FunSuite with Matchers {
} }
test("Variable shifting") { test("Variable shifting") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)("""
| word output0 @$c000 | word output0 @$c000
| word output2 @$c002 | word output2 @$c002
| byte output4 @$c004 | byte output4 @$c004
@ -120,7 +120,7 @@ class ShiftSuite extends FunSuite with Matchers {
} }
test("Zero shifting") { test("Zero shifting") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086, Cpu.Motorola6809)("""
| byte output0 @$c000 | byte output0 @$c000
| byte output1 @$c001 | byte output1 @$c001
| noinline byte sl(byte input, byte amount) { | noinline byte sl(byte input, byte amount) {