1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-08-13 02:28:59 +00:00

More tests for Z80

This commit is contained in:
Karol Stasiak 2018-07-03 01:52:29 +02:00
parent 0da4637036
commit 4acc040813
21 changed files with 140 additions and 125 deletions

View File

@ -1,6 +1,7 @@
package millfork.test package millfork.test
import millfork.test.emu.{EmuBenchmarkRun, EmuUltraBenchmarkRun} import millfork.Cpu
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun, EmuUltraBenchmarkRun}
import org.scalatest.{FunSuite, Matchers} import org.scalatest.{FunSuite, Matchers}
/** /**
@ -9,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class AlgorithmSuite extends FunSuite with Matchers { class AlgorithmSuite extends FunSuite with Matchers {
test("RLE decoding") { test("RLE decoding") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| array output [4000] @$c000 | array output [4000] @$c000
| array input = [ | array input = [

View File

@ -100,7 +100,7 @@ class ArraySuite extends FunSuite with Matchers {
} }
test("Array simple read") { test("Array simple read") {
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$c000 | byte output @$c000
| array a[7] | array a[7]
@ -114,7 +114,7 @@ class ArraySuite extends FunSuite with Matchers {
} }
test("Array simple read 2") { test("Array simple read 2") {
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| word output @$c000 | word output @$c000
| array a[7] | array a[7]
@ -132,7 +132,7 @@ class ArraySuite extends FunSuite with Matchers {
} }
test("Pointers") { test("Pointers") {
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output | byte output
| pointer a | pointer a
@ -157,7 +157,7 @@ class ArraySuite extends FunSuite with Matchers {
} }
test("Pointer indexing test") { test("Pointer indexing test") {
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| array output [4] @$c000 | array output [4] @$c000
| pointer a | pointer a
@ -174,7 +174,7 @@ class ArraySuite extends FunSuite with Matchers {
} }
test("Syntax") { test("Syntax") {
EmuUnoptimizedCrossPlatformRun(CpuFamily.M6502, CpuFamily.I80)( EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
""" """
| array a = [1, 2, 3] | array a = [1, 2, 3]
| array b = "text" ascii | array b = "text" ascii
@ -186,7 +186,7 @@ class ArraySuite extends FunSuite with Matchers {
} }
test("Negative subindex") { test("Negative subindex") {
EmuUnoptimizedCrossPlatformRun(CpuFamily.M6502, CpuFamily.I80)( EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
""" """
| |
| array output [$fff] @$c000 | array output [$fff] @$c000
@ -224,7 +224,7 @@ class ArraySuite extends FunSuite with Matchers {
} }
test("Word subindex 2") { test("Word subindex 2") {
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| |
| array output [$fff] @$c000 | array output [$fff] @$c000
@ -246,7 +246,7 @@ class ArraySuite extends FunSuite with Matchers {
} }
test("Array filters") { test("Array filters") {
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| array x = @word [$1144] | array x = @word [$1144]
| byte output @$c000 | byte output @$c000

View File

@ -2,7 +2,7 @@ package millfork.test
import millfork.{Cpu, OptimizationPresets} import millfork.{Cpu, OptimizationPresets}
import millfork.assembly.mos.opt.{AlwaysGoodOptimizations, LaterOptimizations, VariableToRegisterOptimization} import millfork.assembly.mos.opt.{AlwaysGoodOptimizations, LaterOptimizations, VariableToRegisterOptimization}
import millfork.test.emu.{EmuBenchmarkRun, EmuRun, EmuSuperOptimizedRun, EmuUltraBenchmarkRun} import millfork.test.emu._
import org.scalatest.{FunSuite, Matchers} import org.scalatest.{FunSuite, Matchers}
/** /**
@ -11,7 +11,7 @@ import org.scalatest.{FunSuite, Matchers}
class AssemblyOptimizationSuite extends FunSuite with Matchers { class AssemblyOptimizationSuite extends FunSuite with Matchers {
test("Duplicate RTS") { test("Duplicate RTS") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| void main () { | void main () {
| if 1 == 1 { | if 1 == 1 {
@ -22,7 +22,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
} }
test("Inlining variable") { test("Inlining variable") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| array output [5] @$C000 | array output [5] @$C000
| void main () { | void main () {
@ -37,7 +37,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
} }
test("Inlining variable 2") { test("Inlining variable 2") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| array output [100] @$C000 | array output [100] @$C000
| void main () { | void main () {
@ -52,7 +52,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
} }
test("Loading modified variables") { test("Loading modified variables") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$C000 | byte output @$C000
| void main () { | void main () {
@ -68,7 +68,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
} }
test("Bit ops") { test("Bit ops") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$C000 | byte output @$C000
| void main () { | void main () {
@ -82,7 +82,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
} }
test("Inlining after a while") { test("Inlining after a while") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| array output [2]@$C000 | array output [2]@$C000
| void main () { | void main () {
@ -99,7 +99,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
} }
test("Tail call") { test("Tail call") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$C000 | byte output @$C000
| void main () { | void main () {
@ -304,7 +304,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
} }
test("Adding a nonet") { test("Adding a nonet") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| word output @$C000 | word output @$C000
| byte source @$C002 | byte source @$C002
@ -323,7 +323,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
} }
test("Common indexing subexpression elimination") { test("Common indexing subexpression elimination") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| array output [55] @$C000 | array output [55] @$C000
| array input = [0,1,2,3,4,5,6,7,8,9,10] | array input = [0,1,2,3,4,5,6,7,8,9,10]
@ -342,7 +342,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
} }
test("Effectively const variable") { test("Effectively const variable") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
|byte output @$c000 |byte output @$c000
|void main() { |void main() {
@ -410,7 +410,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
} }
test("Constant pointers") { test("Constant pointers") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
|byte output0 @$c000 |byte output0 @$c000
|byte output1 @$c001 |byte output1 @$c001
@ -430,7 +430,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
} }
test("Low bit") { test("Low bit") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$c000 | byte output @$c000
| void main() { | void main() {
@ -449,7 +449,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
} }
test("Low bit 2") { test("Low bit 2") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$c000 | byte output @$c000
| void main() { | void main() {
@ -468,7 +468,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
} }
test("Low bit 3") { test("Low bit 3") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$c000 | byte output @$c000
| void main() { | void main() {
@ -490,7 +490,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
} }
test("Low bit 4") { test("Low bit 4") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$c000 | byte output @$c000
| void main() { | void main() {
@ -546,7 +546,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
} }
test("Add one bit") { test("Add one bit") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$c000 | byte output @$c000
| void main() { | void main() {

View File

@ -1,6 +1,6 @@
package millfork.test package millfork.test
import millfork.CpuFamily import millfork.Cpu
import millfork.test.emu.{EmuUnoptimizedCrossPlatformRun, EmuUnoptimizedRun} import millfork.test.emu.{EmuUnoptimizedCrossPlatformRun, EmuUnoptimizedRun}
import org.scalatest.{FunSuite, Matchers} import org.scalatest.{FunSuite, Matchers}
@ -9,7 +9,7 @@ import org.scalatest.{FunSuite, Matchers}
*/ */
class BasicSymonTest extends FunSuite with Matchers { class BasicSymonTest extends FunSuite with Matchers {
test("Empty test") { test("Empty test") {
EmuUnoptimizedCrossPlatformRun(CpuFamily.M6502, CpuFamily.I80)( EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
""" """
| void main () { | void main () {
| |
@ -84,7 +84,7 @@ class BasicSymonTest extends FunSuite with Matchers {
} }
test("Byte assignment") { test("Byte assignment") {
EmuUnoptimizedCrossPlatformRun(CpuFamily.M6502, CpuFamily.I80)( EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
@ -111,7 +111,7 @@ class BasicSymonTest extends FunSuite with Matchers {
} }
test("Preallocated variables 2") { test("Preallocated variables 2") {
EmuUnoptimizedCrossPlatformRun(CpuFamily.M6502, CpuFamily.I80)( EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
""" """
| word output @$c000 | word output @$c000
| word number = 344 | word number = 344
@ -141,7 +141,7 @@ class BasicSymonTest extends FunSuite with Matchers {
} }
test("Segment syntax") { test("Segment syntax") {
EmuUnoptimizedCrossPlatformRun(CpuFamily.M6502, CpuFamily.I80)( EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
""" """
| segment(default)byte output @$c000 | segment(default)byte output @$c000
| segment(default)array x[3] | segment(default)array x[3]

View File

@ -1,6 +1,8 @@
package millfork.test package millfork.test
import millfork.test.emu.EmuBenchmarkRun import millfork.Cpu
import millfork.error.ErrorReporting
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun}
import org.scalatest.{FunSuite, Matchers} import org.scalatest.{FunSuite, Matchers}
/** /**
@ -9,7 +11,7 @@ import org.scalatest.{FunSuite, Matchers}
class BitPackingSuite extends FunSuite with Matchers { class BitPackingSuite extends FunSuite with Matchers {
test("Unpack bits from a byte") { test("Unpack bits from a byte") {
EmuBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| array output[8] | array output[8]
| word output_addr @$c000 | word output_addr @$c000
| void main () { | void main () {
@ -38,7 +40,7 @@ class BitPackingSuite extends FunSuite with Matchers {
} }
test("Unpack bits from a word") { test("Unpack bits from a word") {
EmuBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| array output[16] | array output[16]
| word output_addr @$c000 | word output_addr @$c000
| void main () { | void main () {
@ -75,7 +77,7 @@ class BitPackingSuite extends FunSuite with Matchers {
} }
test("Pack bits into byte") { test("Pack bits into byte") {
EmuBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| byte output @$C000 | byte output @$C000
| array input = [$F0, 1, 0, $41, $10, 1, $61, 0] | array input = [$F0, 1, 0, $41, $10, 1, $61, 0]
| void main () { | void main () {
@ -92,7 +94,7 @@ class BitPackingSuite extends FunSuite with Matchers {
} }
test("Pack bits into word") { test("Pack bits into word") {
EmuBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output @$C000 | word output @$C000
| array input = [$F0, 1, 0, $41, $10, 1, $61, 0, | array input = [$F0, 1, 0, $41, $10, 1, $61, 0,
| 1, 1, 0, 0, 0, 0, 1, 1] | 1, 1, 0, 0, 0, 0, 1, 1]
@ -110,7 +112,7 @@ class BitPackingSuite extends FunSuite with Matchers {
} }
test("Pack bits into byte using plus") { test("Pack bits into byte using plus") {
EmuBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| byte output @$C000 | byte output @$C000
| array input = [$F0, 1, 0, $41, $10, 1, $61, 0] | array input = [$F0, 1, 0, $41, $10, 1, $61, 0]
| void main () { | void main () {
@ -127,7 +129,7 @@ class BitPackingSuite extends FunSuite with Matchers {
} }
test("Reverse byte") { test("Reverse byte") {
EmuBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output_addr @$C000 | word output_addr @$C000
| void main () { | void main () {
| byte i | byte i
@ -149,7 +151,7 @@ class BitPackingSuite extends FunSuite with Matchers {
} }
test("Reverse byte 2") { test("Reverse byte 2") {
EmuBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| byte output_real @$C000 | byte output_real @$C000
| void main () { | void main () {
| byte i | byte i
@ -170,7 +172,7 @@ class BitPackingSuite extends FunSuite with Matchers {
} }
test("Reverse word") { test("Reverse word") {
EmuBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output_addr @$C000 | word output_addr @$C000
| void main () { | void main () {
| byte i | byte i

View File

@ -1,6 +1,7 @@
package millfork.test package millfork.test
import millfork.test.emu.{EmuBenchmarkRun, EmuUnoptimizedRun} import millfork.Cpu
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun, EmuUnoptimizedRun}
import org.scalatest.{FunSuite, Matchers} import org.scalatest.{FunSuite, Matchers}
/** /**
@ -9,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") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
@ -23,7 +24,7 @@ class BreakContinueSuite extends FunSuite with Matchers {
} }
test("Break from one-iteration loop 2") { test("Break from one-iteration loop 2") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
@ -38,7 +39,7 @@ class BreakContinueSuite extends FunSuite with Matchers {
} }
test("Break from infinite loop 1") { test("Break from infinite loop 1") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
@ -53,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") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
@ -69,7 +70,7 @@ class BreakContinueSuite extends FunSuite with Matchers {
} }
test("Nested break") { test("Nested break") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
@ -86,7 +87,7 @@ class BreakContinueSuite extends FunSuite with Matchers {
} }
test("Continue in for loop 1") { test("Continue in for loop 1") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$c000 | byte output @$c000
| byte counter @$c001 | byte counter @$c001

View File

@ -1,6 +1,7 @@
package millfork.test package millfork.test
import millfork.test.emu.{EmuBenchmarkRun, EmuUnoptimizedRun} import millfork.Cpu
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun, EmuUnoptimizedRun}
import org.scalatest.{FunSuite, Matchers} import org.scalatest.{FunSuite, Matchers}
/** /**
@ -9,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class ByteDecimalMathSuite extends FunSuite with Matchers { class ByteDecimalMathSuite extends FunSuite with Matchers {
test("Decimal byte addition") { test("Decimal byte addition") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$c000 | byte output @$c000
| byte a | byte a
@ -21,7 +22,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
} }
test("Decimal byte addition 2") { test("Decimal byte addition 2") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$c000 | byte output @$c000
| byte a | byte a
@ -33,7 +34,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
} }
test("In-place decimal byte addition") { test("In-place decimal byte addition") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| array output[3] @$c000 | array output[3] @$c000
| byte a | byte a
@ -47,7 +48,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
} }
test("In-place decimal byte addition 2") { test("In-place decimal byte addition 2") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| array output[3] @$c000 | array output[3] @$c000
| void main () { | void main () {
@ -67,7 +68,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
} }
test("Flag switching test") { test("Flag switching test") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
@ -78,7 +79,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
} }
test("Flag switching test 2") { test("Flag switching test 2") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
@ -89,7 +90,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
} }
test("Flag switching test 3") { test("Flag switching test 3") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$c000 | byte output @$c000
| void main () { | void main () {

View File

@ -1,6 +1,6 @@
package millfork.test package millfork.test
import millfork.CpuFamily import millfork.Cpu
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun, EmuUltraBenchmarkRun} import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun, EmuUltraBenchmarkRun}
import org.scalatest.{FunSuite, Matchers} import org.scalatest.{FunSuite, Matchers}
@ -81,7 +81,7 @@ class ByteMathSuite extends FunSuite with Matchers {
} }
test("Parameter order") { test("Parameter order") {
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$c000 | byte output @$c000
| array arr[6] | array arr[6]

View File

@ -1,6 +1,7 @@
package millfork.test package millfork.test
import millfork.test.emu.EmuCmosBenchmarkRun import millfork.Cpu
import millfork.test.emu.EmuCrossPlatformBenchmarkRun
import org.scalatest.{FunSuite, Matchers} import org.scalatest.{FunSuite, Matchers}
/** /**
@ -9,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") {
EmuCmosBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80)("""
| word output @$c000 | word output @$c000
| void main () { | void main () {
| output = 1 | output = 1
@ -18,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") {
EmuCmosBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80)("""
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
| output = 1 | output = 1

View File

@ -1,6 +1,6 @@
package millfork.test package millfork.test
import millfork.CpuFamily import millfork.Cpu
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun, EmuSuperOptimizedRun, EmuUltraBenchmarkRun} import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun, EmuSuperOptimizedRun, EmuUltraBenchmarkRun}
import org.scalatest.{FunSuite, Matchers} import org.scalatest.{FunSuite, Matchers}
@ -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(CpuFamily.M6502, CpuFamily.I80)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| 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(CpuFamily.M6502, CpuFamily.I80)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| 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(CpuFamily.M6502, CpuFamily.I80)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| byte output @$c000 | byte output @$c000
| void main () { | void main () {

View File

@ -1,6 +1,7 @@
package millfork.test package millfork.test
import millfork.test.emu.EmuBenchmarkRun import millfork.Cpu
import millfork.test.emu.EmuCrossPlatformBenchmarkRun
import org.scalatest.{FunSuite, Matchers} import org.scalatest.{FunSuite, Matchers}
/** /**
@ -9,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class ErasthotenesSuite extends FunSuite with Matchers { class ErasthotenesSuite extends FunSuite with Matchers {
test("Erasthotenes") { test("Erasthotenes") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| const pointer sieve = $C000 | const pointer sieve = $C000
| const byte sqrt = 128 | const byte sqrt = 128

View File

@ -1,8 +1,8 @@
package millfork.test package millfork.test
import millfork.CpuFamily import millfork.Cpu
import millfork.error.ErrorReporting import millfork.error.ErrorReporting
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun, EmuUnoptimizedRun} import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun, EmuUnoptimizedCrossPlatformRun, EmuUnoptimizedRun}
import org.scalatest.{FunSuite, Matchers} import org.scalatest.{FunSuite, Matchers}
/** /**
@ -11,7 +11,7 @@ import org.scalatest.{FunSuite, Matchers}
class ForLoopSuite extends FunSuite with Matchers { class ForLoopSuite extends FunSuite with Matchers {
test("For-to") { test("For-to") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| word output @$c000 | word output @$c000
| void main () { | void main () {
@ -25,7 +25,7 @@ class ForLoopSuite extends FunSuite with Matchers {
} }
test("For-to 2") { test("For-to 2") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| word output @$c000 | word output @$c000
| byte five | byte five
@ -44,7 +44,7 @@ class ForLoopSuite extends FunSuite with Matchers {
} }
test("For-downto") { test("For-downto") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| word output @$c000 | word output @$c000
| void main () { | void main () {
@ -58,7 +58,7 @@ class ForLoopSuite extends FunSuite with Matchers {
} }
test("For-downto 2") { test("For-downto 2") {
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| array output [55] @$c000 | array output [55] @$c000
| void main () { | void main () {
@ -78,7 +78,7 @@ class ForLoopSuite extends FunSuite with Matchers {
} }
test("For-until") { test("For-until") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| word output @$c000 | word output @$c000
| void main () { | void main () {
@ -91,7 +91,7 @@ class ForLoopSuite extends FunSuite with Matchers {
""".stripMargin)(_.readByte(0xc000) should equal(15)) """.stripMargin)(_.readByte(0xc000) should equal(15))
} }
test("For-parallelto") { test("For-parallelto") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| word output @$c000 | word output @$c000
| void main () { | void main () {
@ -104,7 +104,7 @@ class ForLoopSuite extends FunSuite with Matchers {
""".stripMargin)(_.readByte(0xc000) should equal(15)) """.stripMargin)(_.readByte(0xc000) should equal(15))
} }
test("For-paralleluntil") { test("For-paralleluntil") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| word output @$c000 | word output @$c000
| void main () { | void main () {
@ -118,7 +118,7 @@ class ForLoopSuite extends FunSuite with Matchers {
} }
test("Various loops") { test("Various loops") {
EmuUnoptimizedRun( EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
""" """
| void init() { | void init() {
| zero = 0 | zero = 0
@ -151,11 +151,13 @@ class ForLoopSuite extends FunSuite with Matchers {
| flag = 9 | flag = 9
| } | }
| void _panic(){while(true){}} | void _panic(){while(true){}}
""".stripMargin) """.stripMargin){ m=>
}
} }
test("Memcpy") { test("Memcpy") {
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| array output[5]@$c001 | array output[5]@$c001
| array input = [0,1,4,9,16,25,36,49] | array input = [0,1,4,9,16,25,36,49]
@ -173,7 +175,7 @@ class ForLoopSuite extends FunSuite with Matchers {
} }
test("Various bulk operations") { test("Various bulk operations") {
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| array output0[5]@$c000 | array output0[5]@$c000
| array output1[5]@$c010 | array output1[5]@$c010

View File

@ -1,6 +1,6 @@
package millfork.test package millfork.test
import millfork.CpuFamily import millfork.Cpu
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun} import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun}
import org.scalatest.{FunSuite, Matchers} import org.scalatest.{FunSuite, Matchers}
@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class MacroSuite extends FunSuite with Matchers { class MacroSuite extends FunSuite with Matchers {
test("Most basic test") { test("Most basic test") {
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| macro void run(byte x) { | macro void run(byte x) {
| output = x | output = x

View File

@ -1,6 +1,7 @@
package millfork.test package millfork.test
import millfork.test.emu.{EmuBenchmarkRun, EmuUnoptimizedRun} import millfork.Cpu
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun, EmuUnoptimizedRun}
import org.scalatest.{FunSuite, Matchers} import org.scalatest.{FunSuite, Matchers}
/** /**
@ -28,7 +29,7 @@ class NonetSuite extends FunSuite with Matchers {
} }
test("Nonet left shift") { test("Nonet left shift") {
EmuBenchmarkRun( EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
""" """
| word output0 @$c000 | word output0 @$c000
| word output1 @$c002 | word output1 @$c002

View File

@ -1,5 +1,5 @@
package millfork.test package millfork.test
import millfork.CpuFamily import millfork.Cpu
import millfork.test.emu._ import millfork.test.emu._
import org.scalatest.{FunSuite, Matchers} import org.scalatest.{FunSuite, Matchers}
@ -9,7 +9,7 @@ import org.scalatest.{FunSuite, Matchers}
class ShiftSuite extends FunSuite with Matchers { class ShiftSuite extends FunSuite with Matchers {
test("In-place shifting") { test("In-place shifting") {
EmuUnoptimizedCrossPlatformRun(CpuFamily.M6502, CpuFamily.I80)(""" EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)("""
| array output [3] @$c000 | array output [3] @$c000
| void main () { | void main () {
| output[0] = 1 | output[0] = 1
@ -20,7 +20,7 @@ class ShiftSuite extends FunSuite with Matchers {
} }
test("Byte shifting") { test("Byte shifting") {
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| byte output @$c000 | byte output @$c000
| void main () { | void main () {
| byte a | byte a
@ -31,7 +31,7 @@ class ShiftSuite extends FunSuite with Matchers {
} }
test("Word shifting") { test("Word shifting") {
EmuBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output @$c000 | word output @$c000
| void main () { | void main () {
| byte a | byte a
@ -63,7 +63,7 @@ class ShiftSuite extends FunSuite with Matchers {
} }
test("Word shifting via pseudoregister") { test("Word shifting via pseudoregister") {
EmuBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output @$c000 | word output @$c000
| void main () { | void main () {
| output = identity(three() << 7) | output = identity(three() << 7)
@ -74,7 +74,7 @@ class ShiftSuite extends FunSuite with Matchers {
} }
test("Variable shifting") { test("Variable shifting") {
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output0 @$c000 | word output0 @$c000
| word output2 @$c002 | word output2 @$c002
| byte output4 @$c004 | byte output4 @$c004

View File

@ -1,6 +1,6 @@
package millfork.test package millfork.test
import millfork.CpuFamily import millfork.Cpu
import millfork.test.emu.{EmuBenchmarkRun, EmuUnoptimizedCrossPlatformRun, EmuUnoptimizedRun} import millfork.test.emu.{EmuBenchmarkRun, EmuUnoptimizedCrossPlatformRun, EmuUnoptimizedRun}
import org.scalatest.{FunSuite, Matchers} import org.scalatest.{FunSuite, Matchers}
@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class SignExtensionSuite extends FunSuite with Matchers { class SignExtensionSuite extends FunSuite with Matchers {
test("Sbyte to Word") { test("Sbyte to Word") {
EmuUnoptimizedCrossPlatformRun(CpuFamily.M6502, CpuFamily.I80)(""" EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)("""
| word output @$c000 | word output @$c000
| void main () { | void main () {
| sbyte b | sbyte b

View File

@ -1,6 +1,6 @@
package millfork.test package millfork.test
import millfork.CpuFamily import millfork.Cpu
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun} import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun}
import org.scalatest.{FunSuite, Matchers} import org.scalatest.{FunSuite, Matchers}
@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class TypeSuite extends FunSuite with Matchers { class TypeSuite extends FunSuite with Matchers {
test("Word to word") { test("Word to word") {
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output @$c000 | word output @$c000
| void main () { | void main () {
| output = word(0x203) | output = word(0x203)

View File

@ -1,6 +1,7 @@
package millfork.test package millfork.test
import millfork.test.emu.EmuBenchmarkRun import millfork.Cpu
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun}
import org.scalatest.{FunSuite, Matchers} import org.scalatest.{FunSuite, Matchers}
/** /**
@ -9,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class TypeWideningSuite extends FunSuite with Matchers { class TypeWideningSuite extends FunSuite with Matchers {
test("Word after simple ops") { test("Word after simple ops") {
EmuBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output @$c000 | word output @$c000
| void main () { | void main () {
| output = random() | output = random()

View File

@ -1,5 +1,6 @@
package millfork.test package millfork.test
import millfork.test.emu.{EmuBenchmarkRun, EmuCmosBenchmarkRun} import millfork.Cpu
import millfork.test.emu.{EmuBenchmarkRun, EmuCmosBenchmarkRun, EmuCrossPlatformBenchmarkRun}
import org.scalatest.{FunSuite, Matchers} import org.scalatest.{FunSuite, Matchers}
/** /**
@ -8,7 +9,7 @@ import org.scalatest.{FunSuite, Matchers}
class WordMathSuite extends FunSuite with Matchers { class WordMathSuite extends FunSuite with Matchers {
test("Word addition") { test("Word addition") {
EmuCmosBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output @$c000 | word output @$c000
| word a | word a
| void main () { | void main () {
@ -20,7 +21,7 @@ class WordMathSuite extends FunSuite with Matchers {
} }
test("Word subtraction") { test("Word subtraction") {
EmuCmosBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output @$c000 | word output @$c000
| word a | word a
| void main () { | void main () {
@ -32,7 +33,7 @@ class WordMathSuite extends FunSuite with Matchers {
} }
test("Word subtraction 2") { test("Word subtraction 2") {
EmuCmosBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80)("""
| word output @$c000 | word output @$c000
| word a | word a
| void main () { | void main () {
@ -44,7 +45,7 @@ class WordMathSuite extends FunSuite with Matchers {
} }
test("Byte-to-word addition") { test("Byte-to-word addition") {
EmuCmosBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output @$c000 | word output @$c000
| word pair | word pair
| void main () { | void main () {
@ -57,7 +58,7 @@ class WordMathSuite extends FunSuite with Matchers {
} }
test("Literal addition") { test("Literal addition") {
EmuCmosBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output @$c000 | word output @$c000
| void main () { | void main () {
| output = 640 | output = 640
@ -67,7 +68,7 @@ class WordMathSuite extends FunSuite with Matchers {
} }
test("Array element addition") { test("Array element addition") {
EmuCmosBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output @$c000 | word output @$c000
| word pair | word pair
| array b[2] | array b[2]
@ -84,7 +85,7 @@ class WordMathSuite extends FunSuite with Matchers {
} }
test("nesdev.com example") { test("nesdev.com example") {
EmuCmosBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| byte output @$c000 | byte output @$c000
| array map [256] @$c300 | array map [256] @$c300
| array b[2] | array b[2]
@ -102,7 +103,7 @@ class WordMathSuite extends FunSuite with Matchers {
} }
test("hi()/lo()") { test("hi()/lo()") {
EmuCmosBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| array output [7] @$c000 | array output [7] @$c000
| void main () { | void main () {
| output[0] = lo(33) | output[0] = lo(33)
@ -134,7 +135,7 @@ class WordMathSuite extends FunSuite with Matchers {
} }
test("Word addition 2") { test("Word addition 2") {
EmuBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output @$c000 | word output @$c000
| void main () { | void main () {
| word v | word v
@ -150,7 +151,7 @@ class WordMathSuite extends FunSuite with Matchers {
} }
test("Word addition 3") { test("Word addition 3") {
EmuBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output @$c000 | word output @$c000
| void main () { | void main () {
| byte c | byte c
@ -166,7 +167,7 @@ class WordMathSuite extends FunSuite with Matchers {
} }
test("Word addition 4") { test("Word addition 4") {
EmuBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output @$c000 | word output @$c000
| void main () { | void main () {
| word v | word v
@ -186,7 +187,7 @@ class WordMathSuite extends FunSuite with Matchers {
} }
test("Word bit ops 2") { test("Word bit ops 2") {
EmuBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output @$c000 | word output @$c000
| void main () { | void main () {
| word v | word v
@ -202,7 +203,7 @@ class WordMathSuite extends FunSuite with Matchers {
} }
test("Word shift") { test("Word shift") {
EmuBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output @$c000 | word output @$c000
| void main () { | void main () {
| word v | word v
@ -220,7 +221,7 @@ class WordMathSuite extends FunSuite with Matchers {
} }
test("Word shift 2") { test("Word shift 2") {
EmuBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output @$c000 | word output @$c000
| void main () { | void main () {
| output = five() | output = five()
@ -235,7 +236,7 @@ class WordMathSuite extends FunSuite with Matchers {
} }
test("Word shift 3") { test("Word shift 3") {
EmuBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output @$c000 | word output @$c000
| void main () { | void main () {
| output = five() | output = five()
@ -250,7 +251,7 @@ class WordMathSuite extends FunSuite with Matchers {
} }
test("Word shift 4") { test("Word shift 4") {
EmuBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output @$c000 | word output @$c000
| void main () { | void main () {
| output = five() | output = five()
@ -265,7 +266,7 @@ class WordMathSuite extends FunSuite with Matchers {
} }
test("Word shift 5") { test("Word shift 5") {
EmuBenchmarkRun(""" EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
| word output @$c000 | word output @$c000
| void main () { | void main () {
| output = five() | output = five()

View File

@ -25,7 +25,7 @@ object EmuBenchmarkRun {
} }
} }
object EmuI80BenchmarkRun { object EmuZ80BenchmarkRun {
def apply(source: String)(verifier: MemoryBank => Unit) = { def apply(source: String)(verifier: MemoryBank => Unit) = {
val (Timings(t0, _), m0) = EmuUnoptimizedZ80Run.apply2(source) val (Timings(t0, _), m0) = EmuUnoptimizedZ80Run.apply2(source)
val (Timings(t1, _), m1) = EmuOptimizedZ80Run.apply2(source) val (Timings(t1, _), m1) = EmuOptimizedZ80Run.apply2(source)
@ -40,15 +40,18 @@ object EmuI80BenchmarkRun {
} }
object EmuCrossPlatformBenchmarkRun { object EmuCrossPlatformBenchmarkRun {
def apply(platforms: CpuFamily.Value*)(source: String)(verifier: MemoryBank => Unit): Unit = { def apply(platforms: millfork.Cpu.Value*)(source: String)(verifier: MemoryBank => Unit): Unit = {
if (platforms.isEmpty) { if (platforms.isEmpty) {
throw new RuntimeException("Dude, test at least one platform") throw new RuntimeException("Dude, test at least one platform")
} }
if (platforms.contains(CpuFamily.M6502)) { if (platforms.contains(millfork.Cpu.Mos)) {
EmuBenchmarkRun.apply(source)(verifier) EmuBenchmarkRun.apply(source)(verifier)
} }
if (platforms.contains(CpuFamily.I80)) { if (platforms.contains(millfork.Cpu.Cmos)) {
EmuI80BenchmarkRun.apply(source)(verifier) EmuCmosBenchmarkRun.apply(source)(verifier)
}
if (platforms.contains(millfork.Cpu.Z80)) {
EmuZ80BenchmarkRun.apply(source)(verifier)
} }
} }
} }

View File

@ -1,20 +1,20 @@
package millfork.test.emu package millfork.test.emu
import millfork.CpuFamily import millfork.Cpu
import millfork.output.MemoryBank import millfork.output.MemoryBank
/** /**
* @author Karol Stasiak * @author Karol Stasiak
*/ */
object EmuUnoptimizedCrossPlatformRun { object EmuUnoptimizedCrossPlatformRun {
def apply(platforms: CpuFamily.Value*)(source: String)(verifier: MemoryBank => Unit): Unit = { def apply(platforms: Cpu.Value*)(source: String)(verifier: MemoryBank => Unit): Unit = {
val (_, mm) = if (platforms.contains(CpuFamily.M6502)) EmuUnoptimizedRun.apply2(source) else Timings(-1, -1) -> null val (_, mm) = if (platforms.contains(Cpu.Mos)) EmuUnoptimizedRun.apply2(source) else Timings(-1, -1) -> null
val (_, mz) = if (platforms.contains(CpuFamily.I80)) EmuUnoptimizedZ80Run.apply2(source) else Timings(-1, -1) -> null val (_, mz) = if (platforms.contains(Cpu.Z80)) EmuUnoptimizedZ80Run.apply2(source) else Timings(-1, -1) -> null
if (platforms.contains(CpuFamily.M6502)) { if (platforms.contains(Cpu.Mos)) {
println(f"Running MOS") println(f"Running MOS")
verifier(mm) verifier(mm)
} }
if (platforms.contains(CpuFamily.I80)) { if (platforms.contains(Cpu.Z80)) {
println(f"Running Z80") println(f"Running Z80")
verifier(mz) verifier(mz)
} }