mirror of
https://github.com/KarolS/millfork.git
synced 2025-04-22 01:37:23 +00:00
More tests for Z80
This commit is contained in:
parent
0da4637036
commit
4acc040813
src/test/scala/millfork/test
AlgorithmSuite.scalaArraySuite.scalaAssemblyOptimizationSuite.scalaBasicSymonTest.scalaBitPackingSuite.scalaBreakContinueSuite.scalaByteDecimalMathSuite.scalaByteMathSuite.scalaCmosSuite.scalaComparisonSuite.scalaErasthotenesSuite.scalaForLoopSuite.scalaMacroSuite.scalaNonetSuite.scalaShiftSuite.scalaSignExtensionSuite.scalaTypeSuite.scalaTypeWideningSuite.scalaWordMathSuite.scala
emu
@ -1,6 +1,7 @@
|
||||
package millfork.test
|
||||
|
||||
import millfork.test.emu.{EmuBenchmarkRun, EmuUltraBenchmarkRun}
|
||||
import millfork.Cpu
|
||||
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun, EmuUltraBenchmarkRun}
|
||||
import org.scalatest.{FunSuite, Matchers}
|
||||
|
||||
/**
|
||||
@ -9,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class AlgorithmSuite extends FunSuite with Matchers {
|
||||
|
||||
test("RLE decoding") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| array output [4000] @$c000
|
||||
| array input = [
|
||||
|
@ -100,7 +100,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Array simple read") {
|
||||
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| array a[7]
|
||||
@ -114,7 +114,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Array simple read 2") {
|
||||
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| array a[7]
|
||||
@ -132,7 +132,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Pointers") {
|
||||
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output
|
||||
| pointer a
|
||||
@ -157,7 +157,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Pointer indexing test") {
|
||||
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| array output [4] @$c000
|
||||
| pointer a
|
||||
@ -174,7 +174,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Syntax") {
|
||||
EmuUnoptimizedCrossPlatformRun(CpuFamily.M6502, CpuFamily.I80)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| array a = [1, 2, 3]
|
||||
| array b = "text" ascii
|
||||
@ -186,7 +186,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Negative subindex") {
|
||||
EmuUnoptimizedCrossPlatformRun(CpuFamily.M6502, CpuFamily.I80)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
|
|
||||
| array output [$fff] @$c000
|
||||
@ -224,7 +224,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Word subindex 2") {
|
||||
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
|
|
||||
| array output [$fff] @$c000
|
||||
@ -246,7 +246,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Array filters") {
|
||||
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| array x = @word [$1144]
|
||||
| byte output @$c000
|
||||
|
@ -2,7 +2,7 @@ package millfork.test
|
||||
|
||||
import millfork.{Cpu, OptimizationPresets}
|
||||
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}
|
||||
|
||||
/**
|
||||
@ -11,7 +11,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Duplicate RTS") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| void main () {
|
||||
| if 1 == 1 {
|
||||
@ -22,7 +22,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Inlining variable") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| array output [5] @$C000
|
||||
| void main () {
|
||||
@ -37,7 +37,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Inlining variable 2") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| array output [100] @$C000
|
||||
| void main () {
|
||||
@ -52,7 +52,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Loading modified variables") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$C000
|
||||
| void main () {
|
||||
@ -68,7 +68,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Bit ops") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$C000
|
||||
| void main () {
|
||||
@ -82,7 +82,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Inlining after a while") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| array output [2]@$C000
|
||||
| void main () {
|
||||
@ -99,7 +99,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Tail call") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$C000
|
||||
| void main () {
|
||||
@ -304,7 +304,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Adding a nonet") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| word output @$C000
|
||||
| byte source @$C002
|
||||
@ -323,7 +323,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Common indexing subexpression elimination") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| array output [55] @$C000
|
||||
| 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") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
|byte output @$c000
|
||||
|void main() {
|
||||
@ -410,7 +410,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Constant pointers") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
|byte output0 @$c000
|
||||
|byte output1 @$c001
|
||||
@ -430,7 +430,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Low bit") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main() {
|
||||
@ -449,7 +449,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Low bit 2") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main() {
|
||||
@ -468,7 +468,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Low bit 3") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main() {
|
||||
@ -490,7 +490,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Low bit 4") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main() {
|
||||
@ -546,7 +546,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Add one bit") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package millfork.test
|
||||
|
||||
import millfork.CpuFamily
|
||||
import millfork.Cpu
|
||||
import millfork.test.emu.{EmuUnoptimizedCrossPlatformRun, EmuUnoptimizedRun}
|
||||
import org.scalatest.{FunSuite, Matchers}
|
||||
|
||||
@ -9,7 +9,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
*/
|
||||
class BasicSymonTest extends FunSuite with Matchers {
|
||||
test("Empty test") {
|
||||
EmuUnoptimizedCrossPlatformRun(CpuFamily.M6502, CpuFamily.I80)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| void main () {
|
||||
|
|
||||
@ -84,7 +84,7 @@ class BasicSymonTest extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Byte assignment") {
|
||||
EmuUnoptimizedCrossPlatformRun(CpuFamily.M6502, CpuFamily.I80)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@ -111,7 +111,7 @@ class BasicSymonTest extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Preallocated variables 2") {
|
||||
EmuUnoptimizedCrossPlatformRun(CpuFamily.M6502, CpuFamily.I80)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| word number = 344
|
||||
@ -141,7 +141,7 @@ class BasicSymonTest extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Segment syntax") {
|
||||
EmuUnoptimizedCrossPlatformRun(CpuFamily.M6502, CpuFamily.I80)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| segment(default)byte output @$c000
|
||||
| segment(default)array x[3]
|
||||
|
@ -1,6 +1,8 @@
|
||||
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}
|
||||
|
||||
/**
|
||||
@ -9,7 +11,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class BitPackingSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Unpack bits from a byte") {
|
||||
EmuBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| array output[8]
|
||||
| word output_addr @$c000
|
||||
| void main () {
|
||||
@ -38,7 +40,7 @@ class BitPackingSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Unpack bits from a word") {
|
||||
EmuBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| array output[16]
|
||||
| word output_addr @$c000
|
||||
| void main () {
|
||||
@ -75,7 +77,7 @@ class BitPackingSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Pack bits into byte") {
|
||||
EmuBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| byte output @$C000
|
||||
| array input = [$F0, 1, 0, $41, $10, 1, $61, 0]
|
||||
| void main () {
|
||||
@ -92,7 +94,7 @@ class BitPackingSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Pack bits into word") {
|
||||
EmuBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output @$C000
|
||||
| array input = [$F0, 1, 0, $41, $10, 1, $61, 0,
|
||||
| 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") {
|
||||
EmuBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| byte output @$C000
|
||||
| array input = [$F0, 1, 0, $41, $10, 1, $61, 0]
|
||||
| void main () {
|
||||
@ -127,7 +129,7 @@ class BitPackingSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Reverse byte") {
|
||||
EmuBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output_addr @$C000
|
||||
| void main () {
|
||||
| byte i
|
||||
@ -149,7 +151,7 @@ class BitPackingSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Reverse byte 2") {
|
||||
EmuBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| byte output_real @$C000
|
||||
| void main () {
|
||||
| byte i
|
||||
@ -170,7 +172,7 @@ class BitPackingSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Reverse word") {
|
||||
EmuBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output_addr @$C000
|
||||
| void main () {
|
||||
| byte i
|
||||
|
@ -1,6 +1,7 @@
|
||||
package millfork.test
|
||||
|
||||
import millfork.test.emu.{EmuBenchmarkRun, EmuUnoptimizedRun}
|
||||
import millfork.Cpu
|
||||
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun, EmuUnoptimizedRun}
|
||||
import org.scalatest.{FunSuite, Matchers}
|
||||
|
||||
/**
|
||||
@ -9,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class BreakContinueSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Break from one-iteration loop 1") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@ -23,7 +24,7 @@ class BreakContinueSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Break from one-iteration loop 2") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@ -38,7 +39,7 @@ class BreakContinueSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Break from infinite loop 1") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@ -53,7 +54,7 @@ class BreakContinueSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Break and continue from infinite loop 1") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@ -69,7 +70,7 @@ class BreakContinueSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Nested break") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@ -86,7 +87,7 @@ class BreakContinueSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Continue in for loop 1") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| byte counter @$c001
|
||||
|
@ -1,6 +1,7 @@
|
||||
package millfork.test
|
||||
|
||||
import millfork.test.emu.{EmuBenchmarkRun, EmuUnoptimizedRun}
|
||||
import millfork.Cpu
|
||||
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun, EmuUnoptimizedRun}
|
||||
import org.scalatest.{FunSuite, Matchers}
|
||||
|
||||
/**
|
||||
@ -9,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Decimal byte addition") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| byte a
|
||||
@ -21,7 +22,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Decimal byte addition 2") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| byte a
|
||||
@ -33,7 +34,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("In-place decimal byte addition") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| array output[3] @$c000
|
||||
| byte a
|
||||
@ -47,7 +48,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("In-place decimal byte addition 2") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| array output[3] @$c000
|
||||
| void main () {
|
||||
@ -67,7 +68,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Flag switching test") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@ -78,7 +79,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Flag switching test 2") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@ -89,7 +90,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Flag switching test 3") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package millfork.test
|
||||
|
||||
import millfork.CpuFamily
|
||||
import millfork.Cpu
|
||||
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun, EmuUltraBenchmarkRun}
|
||||
import org.scalatest.{FunSuite, Matchers}
|
||||
|
||||
@ -81,7 +81,7 @@ class ByteMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Parameter order") {
|
||||
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| array arr[6]
|
||||
|
@ -1,6 +1,7 @@
|
||||
package millfork.test
|
||||
|
||||
import millfork.test.emu.EmuCmosBenchmarkRun
|
||||
import millfork.Cpu
|
||||
import millfork.test.emu.EmuCrossPlatformBenchmarkRun
|
||||
import org.scalatest.{FunSuite, Matchers}
|
||||
|
||||
/**
|
||||
@ -9,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class CmosSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Zero store 1") {
|
||||
EmuCmosBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| output = 1
|
||||
@ -18,7 +19,7 @@ class CmosSuite extends FunSuite with Matchers {
|
||||
""".stripMargin)(_.readWord(0xc000) should equal(0))
|
||||
}
|
||||
test("Zero store 2") {
|
||||
EmuCmosBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80)("""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
| output = 1
|
||||
|
@ -1,6 +1,6 @@
|
||||
package millfork.test
|
||||
|
||||
import millfork.CpuFamily
|
||||
import millfork.Cpu
|
||||
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun, EmuSuperOptimizedRun, EmuUltraBenchmarkRun}
|
||||
import org.scalatest.{FunSuite, Matchers}
|
||||
|
||||
@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class ComparisonSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Equality and inequality") {
|
||||
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@ -28,7 +28,7 @@ class ComparisonSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Less") {
|
||||
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@ -41,7 +41,7 @@ class ComparisonSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Compare to zero") {
|
||||
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package millfork.test
|
||||
|
||||
import millfork.test.emu.EmuBenchmarkRun
|
||||
import millfork.Cpu
|
||||
import millfork.test.emu.EmuCrossPlatformBenchmarkRun
|
||||
import org.scalatest.{FunSuite, Matchers}
|
||||
|
||||
/**
|
||||
@ -9,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class ErasthotenesSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Erasthotenes") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| const pointer sieve = $C000
|
||||
| const byte sqrt = 128
|
||||
|
@ -1,8 +1,8 @@
|
||||
package millfork.test
|
||||
|
||||
import millfork.CpuFamily
|
||||
import millfork.Cpu
|
||||
import millfork.error.ErrorReporting
|
||||
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun, EmuUnoptimizedRun}
|
||||
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun, EmuUnoptimizedCrossPlatformRun, EmuUnoptimizedRun}
|
||||
import org.scalatest.{FunSuite, Matchers}
|
||||
|
||||
/**
|
||||
@ -11,7 +11,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class ForLoopSuite extends FunSuite with Matchers {
|
||||
|
||||
test("For-to") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
@ -25,7 +25,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("For-to 2") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| byte five
|
||||
@ -44,7 +44,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("For-downto") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
@ -58,7 +58,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("For-downto 2") {
|
||||
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| array output [55] @$c000
|
||||
| void main () {
|
||||
@ -78,7 +78,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("For-until") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
@ -91,7 +91,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
""".stripMargin)(_.readByte(0xc000) should equal(15))
|
||||
}
|
||||
test("For-parallelto") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
@ -104,7 +104,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
""".stripMargin)(_.readByte(0xc000) should equal(15))
|
||||
}
|
||||
test("For-paralleluntil") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
@ -118,7 +118,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Various loops") {
|
||||
EmuUnoptimizedRun(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| void init() {
|
||||
| zero = 0
|
||||
@ -151,11 +151,13 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
| flag = 9
|
||||
| }
|
||||
| void _panic(){while(true){}}
|
||||
""".stripMargin)
|
||||
""".stripMargin){ m=>
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
test("Memcpy") {
|
||||
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| array output[5]@$c001
|
||||
| array input = [0,1,4,9,16,25,36,49]
|
||||
@ -173,7 +175,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Various bulk operations") {
|
||||
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| array output0[5]@$c000
|
||||
| array output1[5]@$c010
|
||||
|
@ -1,6 +1,6 @@
|
||||
package millfork.test
|
||||
|
||||
import millfork.CpuFamily
|
||||
import millfork.Cpu
|
||||
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun}
|
||||
import org.scalatest.{FunSuite, Matchers}
|
||||
|
||||
@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class MacroSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Most basic test") {
|
||||
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| macro void run(byte x) {
|
||||
| output = x
|
||||
|
@ -1,6 +1,7 @@
|
||||
package millfork.test
|
||||
|
||||
import millfork.test.emu.{EmuBenchmarkRun, EmuUnoptimizedRun}
|
||||
import millfork.Cpu
|
||||
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun, EmuUnoptimizedRun}
|
||||
import org.scalatest.{FunSuite, Matchers}
|
||||
|
||||
/**
|
||||
@ -28,7 +29,7 @@ class NonetSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Nonet left shift") {
|
||||
EmuBenchmarkRun(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
"""
|
||||
| word output0 @$c000
|
||||
| word output1 @$c002
|
||||
|
@ -1,5 +1,5 @@
|
||||
package millfork.test
|
||||
import millfork.CpuFamily
|
||||
import millfork.Cpu
|
||||
import millfork.test.emu._
|
||||
import org.scalatest.{FunSuite, Matchers}
|
||||
|
||||
@ -9,7 +9,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class ShiftSuite extends FunSuite with Matchers {
|
||||
|
||||
test("In-place shifting") {
|
||||
EmuUnoptimizedCrossPlatformRun(CpuFamily.M6502, CpuFamily.I80)("""
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| array output [3] @$c000
|
||||
| void main () {
|
||||
| output[0] = 1
|
||||
@ -20,7 +20,7 @@ class ShiftSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Byte shifting") {
|
||||
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
| byte a
|
||||
@ -31,7 +31,7 @@ class ShiftSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Word shifting") {
|
||||
EmuBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| byte a
|
||||
@ -63,7 +63,7 @@ class ShiftSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Word shifting via pseudoregister") {
|
||||
EmuBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| output = identity(three() << 7)
|
||||
@ -74,7 +74,7 @@ class ShiftSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Variable shifting") {
|
||||
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output0 @$c000
|
||||
| word output2 @$c002
|
||||
| byte output4 @$c004
|
||||
|
@ -1,6 +1,6 @@
|
||||
package millfork.test
|
||||
|
||||
import millfork.CpuFamily
|
||||
import millfork.Cpu
|
||||
import millfork.test.emu.{EmuBenchmarkRun, EmuUnoptimizedCrossPlatformRun, EmuUnoptimizedRun}
|
||||
import org.scalatest.{FunSuite, Matchers}
|
||||
|
||||
@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class SignExtensionSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Sbyte to Word") {
|
||||
EmuUnoptimizedCrossPlatformRun(CpuFamily.M6502, CpuFamily.I80)("""
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| sbyte b
|
||||
|
@ -1,6 +1,6 @@
|
||||
package millfork.test
|
||||
|
||||
import millfork.CpuFamily
|
||||
import millfork.Cpu
|
||||
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun}
|
||||
import org.scalatest.{FunSuite, Matchers}
|
||||
|
||||
@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class TypeSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Word to word") {
|
||||
EmuCrossPlatformBenchmarkRun(CpuFamily.M6502, CpuFamily.I80)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| output = word(0x203)
|
||||
|
@ -1,6 +1,7 @@
|
||||
package millfork.test
|
||||
|
||||
import millfork.test.emu.EmuBenchmarkRun
|
||||
import millfork.Cpu
|
||||
import millfork.test.emu.{EmuBenchmarkRun, EmuCrossPlatformBenchmarkRun}
|
||||
import org.scalatest.{FunSuite, Matchers}
|
||||
|
||||
/**
|
||||
@ -9,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class TypeWideningSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Word after simple ops") {
|
||||
EmuBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| output = random()
|
||||
|
@ -1,5 +1,6 @@
|
||||
package millfork.test
|
||||
import millfork.test.emu.{EmuBenchmarkRun, EmuCmosBenchmarkRun}
|
||||
import millfork.Cpu
|
||||
import millfork.test.emu.{EmuBenchmarkRun, EmuCmosBenchmarkRun, EmuCrossPlatformBenchmarkRun}
|
||||
import org.scalatest.{FunSuite, Matchers}
|
||||
|
||||
/**
|
||||
@ -8,7 +9,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class WordMathSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Word addition") {
|
||||
EmuCmosBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output @$c000
|
||||
| word a
|
||||
| void main () {
|
||||
@ -20,7 +21,7 @@ class WordMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Word subtraction") {
|
||||
EmuCmosBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output @$c000
|
||||
| word a
|
||||
| void main () {
|
||||
@ -32,7 +33,7 @@ class WordMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Word subtraction 2") {
|
||||
EmuCmosBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80)("""
|
||||
| word output @$c000
|
||||
| word a
|
||||
| void main () {
|
||||
@ -44,7 +45,7 @@ class WordMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Byte-to-word addition") {
|
||||
EmuCmosBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output @$c000
|
||||
| word pair
|
||||
| void main () {
|
||||
@ -57,7 +58,7 @@ class WordMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Literal addition") {
|
||||
EmuCmosBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| output = 640
|
||||
@ -67,7 +68,7 @@ class WordMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Array element addition") {
|
||||
EmuCmosBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output @$c000
|
||||
| word pair
|
||||
| array b[2]
|
||||
@ -84,7 +85,7 @@ class WordMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("nesdev.com example") {
|
||||
EmuCmosBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| byte output @$c000
|
||||
| array map [256] @$c300
|
||||
| array b[2]
|
||||
@ -102,7 +103,7 @@ class WordMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("hi()/lo()") {
|
||||
EmuCmosBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| array output [7] @$c000
|
||||
| void main () {
|
||||
| output[0] = lo(33)
|
||||
@ -134,7 +135,7 @@ class WordMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Word addition 2") {
|
||||
EmuBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| word v
|
||||
@ -150,7 +151,7 @@ class WordMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Word addition 3") {
|
||||
EmuBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| byte c
|
||||
@ -166,7 +167,7 @@ class WordMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Word addition 4") {
|
||||
EmuBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| word v
|
||||
@ -186,7 +187,7 @@ class WordMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Word bit ops 2") {
|
||||
EmuBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| word v
|
||||
@ -202,7 +203,7 @@ class WordMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Word shift") {
|
||||
EmuBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| word v
|
||||
@ -220,7 +221,7 @@ class WordMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Word shift 2") {
|
||||
EmuBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| output = five()
|
||||
@ -235,7 +236,7 @@ class WordMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Word shift 3") {
|
||||
EmuBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| output = five()
|
||||
@ -250,7 +251,7 @@ class WordMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Word shift 4") {
|
||||
EmuBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| output = five()
|
||||
@ -265,7 +266,7 @@ class WordMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Word shift 5") {
|
||||
EmuBenchmarkRun("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| output = five()
|
||||
|
@ -25,7 +25,7 @@ object EmuBenchmarkRun {
|
||||
}
|
||||
}
|
||||
|
||||
object EmuI80BenchmarkRun {
|
||||
object EmuZ80BenchmarkRun {
|
||||
def apply(source: String)(verifier: MemoryBank => Unit) = {
|
||||
val (Timings(t0, _), m0) = EmuUnoptimizedZ80Run.apply2(source)
|
||||
val (Timings(t1, _), m1) = EmuOptimizedZ80Run.apply2(source)
|
||||
@ -40,15 +40,18 @@ object EmuI80BenchmarkRun {
|
||||
}
|
||||
|
||||
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) {
|
||||
throw new RuntimeException("Dude, test at least one platform")
|
||||
}
|
||||
if (platforms.contains(CpuFamily.M6502)) {
|
||||
if (platforms.contains(millfork.Cpu.Mos)) {
|
||||
EmuBenchmarkRun.apply(source)(verifier)
|
||||
}
|
||||
if (platforms.contains(CpuFamily.I80)) {
|
||||
EmuI80BenchmarkRun.apply(source)(verifier)
|
||||
if (platforms.contains(millfork.Cpu.Cmos)) {
|
||||
EmuCmosBenchmarkRun.apply(source)(verifier)
|
||||
}
|
||||
if (platforms.contains(millfork.Cpu.Z80)) {
|
||||
EmuZ80BenchmarkRun.apply(source)(verifier)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
package millfork.test.emu
|
||||
|
||||
import millfork.CpuFamily
|
||||
import millfork.Cpu
|
||||
import millfork.output.MemoryBank
|
||||
|
||||
/**
|
||||
* @author Karol Stasiak
|
||||
*/
|
||||
object EmuUnoptimizedCrossPlatformRun {
|
||||
def apply(platforms: CpuFamily.Value*)(source: String)(verifier: MemoryBank => Unit): Unit = {
|
||||
val (_, mm) = if (platforms.contains(CpuFamily.M6502)) EmuUnoptimizedRun.apply2(source) else Timings(-1, -1) -> null
|
||||
val (_, mz) = if (platforms.contains(CpuFamily.I80)) EmuUnoptimizedZ80Run.apply2(source) else Timings(-1, -1) -> null
|
||||
if (platforms.contains(CpuFamily.M6502)) {
|
||||
def apply(platforms: Cpu.Value*)(source: String)(verifier: MemoryBank => Unit): Unit = {
|
||||
val (_, mm) = if (platforms.contains(Cpu.Mos)) EmuUnoptimizedRun.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(Cpu.Mos)) {
|
||||
println(f"Running MOS")
|
||||
verifier(mm)
|
||||
}
|
||||
if (platforms.contains(CpuFamily.I80)) {
|
||||
if (platforms.contains(Cpu.Z80)) {
|
||||
println(f"Running Z80")
|
||||
verifier(mz)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user