1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-07-05 09:28:54 +00:00

Tests for LR35902

This commit is contained in:
Karol Stasiak 2018-07-27 19:12:28 +02:00
parent 5c25e653bf
commit 3c019b06c1
30 changed files with 299 additions and 264 deletions

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class AlgorithmSuite extends FunSuite with Matchers {
test("RLE decoding") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| array output [4000] @$c000
| array input = [

View File

@ -11,7 +11,7 @@ import org.scalatest.{FunSuite, Matchers}
class ArraySuite extends FunSuite with Matchers {
test("Array assignment") {
val m = EmuSuperOptimizedRun(
val src =
"""
| array output [3] @$c000
| array input = [5,6,7]
@ -23,14 +23,20 @@ class ArraySuite extends FunSuite with Matchers {
| void copyEntry(byte index) {
| output[index] = input[index]
| }
""".stripMargin)
""".stripMargin
val m = EmuSuperOptimizedRun(src)
m.readByte(0xc000) should equal(5)
m.readByte(0xc001) should equal(6)
m.readByte(0xc002) should equal(7)
EmuCrossPlatformBenchmarkRun(Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(src) { m =>
m.readByte(0xc000) should equal(5)
m.readByte(0xc001) should equal(6)
m.readByte(0xc002) should equal(7)
}
}
test("Array assignment with offset") {
EmuUltraBenchmarkRun(
val src =
"""
| array output [8] @$c000
| void main () {
@ -42,7 +48,12 @@ class ArraySuite extends FunSuite with Matchers {
| i += 1
| }
| }
""".stripMargin) { m =>
""".stripMargin
EmuUltraBenchmarkRun(src) { m =>
m.readByte(0xc002) should equal(1)
m.readByte(0xc007) should equal(6)
}
EmuCrossPlatformBenchmarkRun(Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(src) { m =>
m.readByte(0xc002) should equal(1)
m.readByte(0xc007) should equal(6)
}
@ -67,7 +78,7 @@ class ArraySuite extends FunSuite with Matchers {
}
test("Array assignment through a pointer") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| array output [3] @$c000
| pointer p
@ -87,7 +98,7 @@ class ArraySuite extends FunSuite with Matchers {
}
test("Array in place math") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| array output [4] @$c000
| void main () {
@ -101,7 +112,7 @@ class ArraySuite extends FunSuite with Matchers {
}
test("Array simple read") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| array a[7]
@ -115,7 +126,7 @@ class ArraySuite extends FunSuite with Matchers {
}
test("Array simple read 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| word output @$c000
| array a[7]
@ -133,7 +144,7 @@ class ArraySuite extends FunSuite with Matchers {
}
test("Pointers") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output
| pointer a
@ -158,7 +169,7 @@ class ArraySuite extends FunSuite with Matchers {
}
test("Pointer indexing test") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| array output [4] @$c000
| pointer a
@ -175,7 +186,7 @@ class ArraySuite extends FunSuite with Matchers {
}
test("Syntax") {
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| array a = [1, 2, 3]
| array b = "text" ascii
@ -187,7 +198,7 @@ class ArraySuite extends FunSuite with Matchers {
}
test("Negative subindex") {
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
|
| array output [$fff] @$c000
@ -226,7 +237,7 @@ class ArraySuite extends FunSuite with Matchers {
}
test("Word subindex 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
|
| array output [$fff] @$c000
@ -248,7 +259,7 @@ class ArraySuite extends FunSuite with Matchers {
}
test("Array filters") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| array x = @word [$1144]
| byte output @$c000

View File

@ -11,7 +11,7 @@ import org.scalatest.{FunSuite, Matchers}
class AssemblyOptimizationSuite extends FunSuite with Matchers {
test("Duplicate RTS") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| void main () {
| if 1 == 1 {
@ -22,7 +22,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
}
test("Inlining variable") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| array output [5] @$C000
| void main () {
@ -37,7 +37,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
}
test("Inlining variable 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| array output [100] @$C000
| void main () {
@ -52,7 +52,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
}
test("Loading modified variables") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$C000
| void main () {
@ -68,7 +68,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
}
test("Bit ops") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$C000
| void main () {
@ -82,7 +82,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
}
test("Inlining after a while") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| array output [2]@$C000
| void main () {
@ -99,7 +99,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
}
test("Tail call") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$C000
| void main () {
@ -304,7 +304,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
}
test("Adding a nonet") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| word output @$C000
| byte source @$C002
@ -323,7 +323,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
}
test("Common indexing subexpression elimination") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| 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") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
|byte output @$c000
|void main() {
@ -410,7 +410,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
}
test("Constant pointers") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
|byte output0 @$c000
|byte output1 @$c001
@ -430,7 +430,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
}
test("Low bit") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main() {
@ -449,7 +449,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
}
test("Low bit 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main() {
@ -468,7 +468,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
}
test("Low bit 3") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main() {
@ -490,7 +490,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
}
test("Low bit 4") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main() {
@ -530,7 +530,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
}
test("Shift and increase") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main() {
@ -546,7 +546,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
}
test("Add one bit") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main() {

View File

@ -114,7 +114,7 @@ class BasicSymonTest extends FunSuite with Matchers {
}
test("Preallocated variables 2") {
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| word output @$c000
| word number = 344
@ -155,7 +155,7 @@ class BasicSymonTest extends FunSuite with Matchers {
}
test("Alias test") {
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| alias small = byte
| alias big = word

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class BitOpSuite extends FunSuite with Matchers {
test("Word AND") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| void main () {
| byte b
@ -21,7 +21,7 @@ class BitOpSuite extends FunSuite with Matchers {
""".stripMargin)(_.readWord(0xc000) should equal(0x44))
}
test("Long AND and EOR") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| long output @$c000
| void main () {
| byte b
@ -36,7 +36,7 @@ class BitOpSuite extends FunSuite with Matchers {
}
test("Smart bit set/reset") {
EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| byte output @$c000
| void main () {
| output = 5
@ -50,7 +50,7 @@ class BitOpSuite extends FunSuite with Matchers {
}
test("Smart bit set/reset 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| byte output @$c000
| void main () {
| output = 5

View File

@ -11,7 +11,7 @@ import org.scalatest.{FunSuite, Matchers}
class BitPackingSuite extends FunSuite with Matchers {
test("Unpack bits from a byte") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| array output[8]
| word output_addr @$c000
| void main () {
@ -40,7 +40,7 @@ class BitPackingSuite extends FunSuite with Matchers {
}
test("Unpack bits from a word") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| array output[16]
| word output_addr @$c000
| void main () {
@ -77,7 +77,7 @@ class BitPackingSuite extends FunSuite with Matchers {
}
test("Pack bits into byte") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| byte output @$C000
| array input = [$F0, 1, 0, $41, $10, 1, $61, 0]
| void main () {
@ -94,7 +94,7 @@ class BitPackingSuite extends FunSuite with Matchers {
}
test("Pack bits into word") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$C000
| array input = [$F0, 1, 0, $41, $10, 1, $61, 0,
| 1, 1, 0, 0, 0, 0, 1, 1]
@ -112,7 +112,7 @@ class BitPackingSuite extends FunSuite with Matchers {
}
test("Pack bits into byte using plus") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| byte output @$C000
| array input = [$F0, 1, 0, $41, $10, 1, $61, 0]
| void main () {
@ -129,7 +129,7 @@ class BitPackingSuite extends FunSuite with Matchers {
}
test("Reverse byte") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output_addr @$C000
| void main () {
| byte i
@ -151,7 +151,7 @@ class BitPackingSuite extends FunSuite with Matchers {
}
test("Reverse byte 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| byte output_real @$C000
| void main () {
| byte i
@ -172,7 +172,7 @@ class BitPackingSuite extends FunSuite with Matchers {
}
test("Reverse word") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output_addr @$C000
| void main () {
| byte i

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class BooleanSuite extends FunSuite with Matchers {
test("Not") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| array input = [5,6,7]
@ -26,7 +26,7 @@ class BooleanSuite extends FunSuite with Matchers {
test("And") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| array input = [5,6,7]
@ -45,7 +45,7 @@ class BooleanSuite extends FunSuite with Matchers {
test("Or") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| array input = [5,6,7]

View File

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

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class ByteDecimalMathSuite extends FunSuite with Matchers {
test("Decimal byte addition") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| byte a
@ -22,7 +22,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
}
test("Decimal byte addition 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| byte a
@ -34,7 +34,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
}
test("Decimal byte subtraction") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Sharp)(
"""
| byte output @$c000
| byte a
@ -46,7 +46,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
}
test("In-place decimal byte addition") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| array output[3] @$c000
| byte a
@ -60,7 +60,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
}
test("In-place decimal byte addition 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| array output[3] @$c000
| void main () {
@ -80,7 +80,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
}
test("In-place decimal byte subtraction") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Sharp)(
"""
| byte output @$c000
| byte a
@ -92,7 +92,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
}
test("In-place decimal word subtraction") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Sharp)(
"""
| word output @$c000
| word a
@ -106,7 +106,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
}
test("Flag switching test") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main () {
@ -117,7 +117,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
}
test("Flag switching test 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main () {
@ -128,7 +128,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
}
test("Flag switching test 3") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main () {
@ -139,7 +139,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
}
test("Decimal left shift test") {
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main () {
@ -154,7 +154,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
}
test("Decimal left shift test 2") {
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main () {
@ -168,7 +168,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
}
test("Decimal left shift test 3") {
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| word output @$c000
| void main () {
@ -182,7 +182,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
}
test("Decimal left shift test 4") {
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| long output @$c000
| void main () {
@ -272,7 +272,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
test("Decimal byte multiplication comprehensive suite") {
val numbers = List(0, 1, 2, 3, 6, 8, 10, 11, 12, 14, 15, 16, 20, 40, 73, 81, 82, 98, 99)
for (i <- numbers; j <- numbers) {
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main () {
@ -290,7 +290,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
test("Decimal comparison") {
// CMP#0 shouldn't be elided after a decimal operation.
// Currently no emulator used for testing can catch that.
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main () {

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class ByteMathSuite extends FunSuite with Matchers {
test("Complex expression") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main () {
@ -23,7 +23,7 @@ class ByteMathSuite extends FunSuite with Matchers {
}
test("Byte addition") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| byte a
@ -35,7 +35,7 @@ class ByteMathSuite extends FunSuite with Matchers {
}
test("Byte addition 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| byte a
@ -47,7 +47,7 @@ class ByteMathSuite extends FunSuite with Matchers {
}
test("In-place byte addition") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| array output[3] @$c000
| byte a
@ -61,7 +61,7 @@ class ByteMathSuite extends FunSuite with Matchers {
}
test("LHS evaluation during in-place byte addition") {
EmuBenchmarkRun(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| array output[1] @$c000
| byte call_count @$c001
@ -81,7 +81,7 @@ class ByteMathSuite extends FunSuite with Matchers {
}
test("Parameter order") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| array arr[6]
@ -101,7 +101,7 @@ class ByteMathSuite extends FunSuite with Matchers {
}
test("In-place byte addition 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| array output[3] @$c000
| void main () {
@ -137,7 +137,7 @@ class ByteMathSuite extends FunSuite with Matchers {
}
private def multiplyCase1(x: Int, y: Int): Unit = {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
s"""
| byte output @$$c000
| void main () {
@ -165,7 +165,7 @@ class ByteMathSuite extends FunSuite with Matchers {
}
private def multiplyCase2(x: Int, y: Int): Unit = {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
s"""
| byte output @$$c000
| void main () {
@ -178,7 +178,7 @@ class ByteMathSuite extends FunSuite with Matchers {
}
test("Byte multiplication 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| import zp_reg
| byte output1 @$c001
@ -245,7 +245,7 @@ class ByteMathSuite extends FunSuite with Matchers {
}
private def multiplyCase3(x: Int, y: Int): Unit = {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
s"""
| import zp_reg
| byte output @$$c000

View File

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

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class ComparisonSuite extends FunSuite with Matchers {
test("Equality and inequality") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main () {
@ -28,7 +28,7 @@ class ComparisonSuite extends FunSuite with Matchers {
}
test("Less") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main () {
@ -41,7 +41,7 @@ class ComparisonSuite extends FunSuite with Matchers {
}
test("Compare to zero") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main () {
@ -76,7 +76,7 @@ class ComparisonSuite extends FunSuite with Matchers {
}
test("Does it even work") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| word output @$c000
| void main () {
@ -99,7 +99,7 @@ class ComparisonSuite extends FunSuite with Matchers {
| if 2222 == 3333 { output -= 1 }
| }
""".stripMargin
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
}
test("Word comparison == and !=") {
@ -122,7 +122,7 @@ class ComparisonSuite extends FunSuite with Matchers {
| if a != 0 { output += 1 }
| }
""".stripMargin
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
}
test("Word comparison <=") {
@ -143,7 +143,7 @@ class ComparisonSuite extends FunSuite with Matchers {
| if a <= c { output += 1 }
| }
""".stripMargin
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
}
test("Word comparison <") {
val src =
@ -162,7 +162,7 @@ class ComparisonSuite extends FunSuite with Matchers {
| if a < 257 { output += 1 }
| }
""".stripMargin
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
}
@ -183,7 +183,7 @@ class ComparisonSuite extends FunSuite with Matchers {
| if c > 0 { output += 1 }
| }
""".stripMargin
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
}
test("Word comparison >=") {
@ -206,7 +206,7 @@ class ComparisonSuite extends FunSuite with Matchers {
| if a >= 0 { output += 1 }
| }
""".stripMargin
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
}
test("Signed comparison >=") {
@ -265,7 +265,7 @@ class ComparisonSuite extends FunSuite with Matchers {
}
test("Multiple params for equality") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main () {
@ -281,7 +281,7 @@ class ComparisonSuite extends FunSuite with Matchers {
}
test("Multiple params for inequality") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main () {
@ -297,7 +297,7 @@ class ComparisonSuite extends FunSuite with Matchers {
}
test("Warnings") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main () {
@ -339,7 +339,7 @@ class ComparisonSuite extends FunSuite with Matchers {
| if c > 335444 { output += 1 }
| }
""".stripMargin
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
}
test("Mixed type comparison") {
@ -357,6 +357,6 @@ class ComparisonSuite extends FunSuite with Matchers {
| if x < z { output += 1 }
| }
""".stripMargin
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(src)(_.readByte(0xc000) should equal(1))
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(src)(_.readByte(0xc000) should equal(1))
}
}

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class EnumSuite extends FunSuite with Matchers {
test("Enum basic test") {
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| enum ugly {
| a
@ -40,7 +40,7 @@ class EnumSuite extends FunSuite with Matchers {
}
test("Enum arrays") {
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| enum ugly {
| a
@ -67,81 +67,81 @@ class EnumSuite extends FunSuite with Matchers {
}
test("Enum-byte incompatibility test") {
// ShouldNotCompile(
// """
// | enum ugly { a }
// | void main() {
// | byte b
// | ugly u
// | b = u
// | }
// """.stripMargin)
//
// ShouldNotCompile(
// """
// | enum ugly { a }
// | void main() {
// | byte b
// | ugly u
// | u = b
// | }
// """.stripMargin)
//
// ShouldNotCompile(
// """
// | enum ugly { a }
// | byte main() {
// | byte b
// | ugly u
// | return u
// | }
// """.stripMargin)
//
// ShouldNotCompile(
// """
// | enum ugly { a }
// | ugly main() {
// | byte b
// | ugly u
// | return b
// | }
// """.stripMargin)
//
// ShouldNotCompile(
// """
// | enum ugly { a }
// | byte main() {
// | byte b
// | ugly u
// | return b + u
// | }
// """.stripMargin)
//
// ShouldNotCompile(
// """
// | enum ugly { a }
// | void main() {
// | byte b
// | ugly u
// | if b > u {}
// | }
// """.stripMargin)
//
// ShouldNotCompile(
// """
// | enum ugly { a }
// | array arr[ugly] = []
// | void main() {
// | }
// """.stripMargin)
ShouldNotCompile(
"""
| enum ugly { a }
| void main() {
| byte b
| ugly u
| b = u
| }
""".stripMargin)
// ShouldNotCompile(
// """
// | enum ugly { a }
// | array arr[ugly] = [1,2,3]
// | void main() {
// | }
// """.stripMargin)
ShouldNotCompile(
"""
| enum ugly { a }
| void main() {
| byte b
| ugly u
| u = b
| }
""".stripMargin)
ShouldNotCompile(
"""
| enum ugly { a }
| byte main() {
| byte b
| ugly u
| return u
| }
""".stripMargin)
ShouldNotCompile(
"""
| enum ugly { a }
| ugly main() {
| byte b
| ugly u
| return b
| }
""".stripMargin)
ShouldNotCompile(
"""
| enum ugly { a }
| byte main() {
| byte b
| ugly u
| return b + u
| }
""".stripMargin)
ShouldNotCompile(
"""
| enum ugly { a }
| void main() {
| byte b
| ugly u
| if b > u {}
| }
""".stripMargin)
ShouldNotCompile(
"""
| enum ugly { a }
| array arr[ugly] = []
| void main() {
| }
""".stripMargin)
ShouldNotCompile(
"""
| enum ugly { a }
| array arr[ugly] = [1,2,3]
| void main() {
| }
""".stripMargin)
ShouldNotCompile(
"""

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class ErasthotenesSuite extends FunSuite with Matchers {
test("Erasthotenes") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| const pointer sieve = $C000
| const byte sqrt = 128

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class FarwordTest extends FunSuite with Matchers {
test("Farword assignment") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| farword output3 @$c000
| farword output2 @$c004
@ -29,7 +29,7 @@ class FarwordTest extends FunSuite with Matchers {
}
}
test("Farword assignment 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| farword output3 @$c000
| farword output2 @$c004
@ -53,7 +53,7 @@ class FarwordTest extends FunSuite with Matchers {
}
test("Farword assignment 3") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| farword output0 @$c000
| farword output1 @$c003
@ -70,7 +70,7 @@ class FarwordTest extends FunSuite with Matchers {
}
}
test("Farword addition") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| farword output @$c000
| void main () {
@ -90,7 +90,7 @@ class FarwordTest extends FunSuite with Matchers {
}
}
test("Farword addition 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| farword output @$c000
| void main () {
@ -104,7 +104,7 @@ class FarwordTest extends FunSuite with Matchers {
}
}
test("Farword subtraction") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| farword output @$c000
| void main () {
@ -124,7 +124,7 @@ class FarwordTest extends FunSuite with Matchers {
}
}
test("Farword subtraction 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| farword output @$c000
| void main () {
@ -138,7 +138,7 @@ class FarwordTest extends FunSuite with Matchers {
}
}
test("Farword subtraction 3") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| farword output @$c000
| void main () {
@ -158,7 +158,7 @@ class FarwordTest extends FunSuite with Matchers {
}
test("Farword AND") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| farword output @$c000
| void main () {
@ -178,7 +178,7 @@ class FarwordTest extends FunSuite with Matchers {
}
test("Farword INC/DEC") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| farword output0 @$c000
| farword output1 @$c004

View File

@ -39,7 +39,7 @@ class ForArraySuite extends FunSuite with Matchers {
""".stripMargin
val m = EmuSuperOptimizedRun(src)
m.readByte(0xc000) should equal(18)
EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80, Cpu.Intel8080)(src) { m =>
EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(src) { m =>
m.readByte(0xc000) should equal(18)
}
}

View File

@ -11,7 +11,7 @@ import org.scalatest.{FunSuite, Matchers}
class ForLoopSuite extends FunSuite with Matchers {
test("For-to") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| word output @$c000
| void main () {
@ -25,7 +25,7 @@ class ForLoopSuite extends FunSuite with Matchers {
}
test("For-to 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| word output @$c000
| byte five
@ -44,7 +44,7 @@ class ForLoopSuite extends FunSuite with Matchers {
}
test("For-downto") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| word output @$c000
| void main () {
@ -58,7 +58,7 @@ class ForLoopSuite extends FunSuite with Matchers {
}
test("For-downto 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| array output [55] @$c000
| void main () {
@ -78,7 +78,7 @@ class ForLoopSuite extends FunSuite with Matchers {
}
test("For-until") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| word output @$c000
| void main () {
@ -91,7 +91,7 @@ class ForLoopSuite extends FunSuite with Matchers {
""".stripMargin)(_.readByte(0xc000) should equal(15))
}
test("For-parallelto") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| word output @$c000
| void main () {
@ -104,7 +104,7 @@ class ForLoopSuite extends FunSuite with Matchers {
""".stripMargin)(_.readByte(0xc000) should equal(15))
}
test("For-paralleluntil") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| word output @$c000
| void main () {
@ -118,7 +118,7 @@ class ForLoopSuite extends FunSuite with Matchers {
}
test("Various loops") {
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| void init() {
| zero = 0
@ -157,7 +157,7 @@ class ForLoopSuite extends FunSuite with Matchers {
}
test("Memcpy") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| array output[5]@$c001
| array input = [0,1,4,9,16,25,36,49]
@ -175,7 +175,7 @@ class ForLoopSuite extends FunSuite with Matchers {
}
test("Screen fill") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| array output[$400]@$c000
| void main () {
@ -193,7 +193,7 @@ class ForLoopSuite extends FunSuite with Matchers {
}
test("Various bulk operations") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| array output0[5]@$c000
| array output1[5]@$c010
@ -228,7 +228,7 @@ class ForLoopSuite extends FunSuite with Matchers {
}
test("Edge cases - positive") {
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| void main() {
| byte i
| for i,0,until,256 { f() }

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class LongTest extends FunSuite with Matchers {
test("Long assignment") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| long output4 @$c000
| long output2 @$c004
@ -29,7 +29,7 @@ class LongTest extends FunSuite with Matchers {
}
}
test("Long assignment 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| long output4 @$c000
| long output2 @$c004
@ -52,7 +52,7 @@ class LongTest extends FunSuite with Matchers {
}
}
test("Long addition") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| long output @$c000
| void main () {
@ -72,7 +72,7 @@ class LongTest extends FunSuite with Matchers {
}
}
test("Long addition 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| long output @$c000
| void main () {
@ -86,7 +86,7 @@ class LongTest extends FunSuite with Matchers {
}
}
test("Long subtraction") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| long output @$c000
| void main () {
@ -106,7 +106,7 @@ class LongTest extends FunSuite with Matchers {
}
}
test("Long subtraction 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| long output @$c000
| void main () {
@ -120,7 +120,7 @@ class LongTest extends FunSuite with Matchers {
}
}
test("Long subtraction 3") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| long output @$c000
| void main () {
@ -140,7 +140,7 @@ class LongTest extends FunSuite with Matchers {
}
test("Long AND") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| long output @$c000
| void main () {
@ -160,7 +160,7 @@ class LongTest extends FunSuite with Matchers {
}
test("Long INC/DEC") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| long output0 @$c000
| long output1 @$c004

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class NonetSuite extends FunSuite with Matchers {
test("Nonet operations") {
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| array output [5] @$c000
| void main () {
@ -30,7 +30,7 @@ class NonetSuite extends FunSuite with Matchers {
}
test("Nonet left shift") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| word output0 @$c000
| word output1 @$c002

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class ReturnDispatchSuite extends FunSuite with Matchers {
test("Trivial test") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main () {
@ -28,7 +28,7 @@ class ReturnDispatchSuite extends FunSuite with Matchers {
}
}
test("Parameter test") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| array output [200] @$c000
| sbyte param

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class SecondAssemblyOptimizationSuite extends FunSuite with Matchers {
test("Add-shift-add") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main () {
@ -23,7 +23,7 @@ class SecondAssemblyOptimizationSuite extends FunSuite with Matchers {
}
test("And-shift-and") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| void main () {
@ -36,7 +36,7 @@ class SecondAssemblyOptimizationSuite extends FunSuite with Matchers {
}
test("Add with limit") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| byte output @$c000
| const byte start = 5

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class SeparateBytesSuite extends FunSuite with Matchers {
test("Separate assignment 1") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| void main () {
| output = 2:3
@ -19,7 +19,7 @@ class SeparateBytesSuite extends FunSuite with Matchers {
}
test("Separate assignment 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| byte output @$c000
| byte ignore @$c001
| void main () {
@ -31,7 +31,7 @@ class SeparateBytesSuite extends FunSuite with Matchers {
}
test("Separate assignment 3") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| byte output @$c000
| byte ignore @$c001
| void main () {
@ -44,7 +44,7 @@ class SeparateBytesSuite extends FunSuite with Matchers {
}
test("Separate assignment 4") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| array output [5] @$c000
| byte ignore @$c001
| void main () {
@ -59,7 +59,7 @@ class SeparateBytesSuite extends FunSuite with Matchers {
}
test("Separate assignment 5") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| array output [5] @$c000
| byte ignore @$c001
| void main () {
@ -74,7 +74,7 @@ class SeparateBytesSuite extends FunSuite with Matchers {
}
test("Magic split array") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| array hi [16] @$c000
| array lo [16] @$c010
| void main () {
@ -107,7 +107,7 @@ class SeparateBytesSuite extends FunSuite with Matchers {
}
test("Separate addition") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| void main () {
| byte h
@ -121,7 +121,7 @@ class SeparateBytesSuite extends FunSuite with Matchers {
}
test("Separate increase") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| void main () {
| byte h

View File

@ -9,7 +9,7 @@ import org.scalatest.{FunSuite, Matchers}
class ShiftSuite extends FunSuite with Matchers {
test("In-place shifting") {
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| array output [3] @$c000
| void main () {
| output[0] = 1
@ -20,7 +20,7 @@ class ShiftSuite extends FunSuite with Matchers {
}
test("Byte shifting") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| byte output @$c000
| void main () {
| byte a
@ -31,7 +31,7 @@ class ShiftSuite extends FunSuite with Matchers {
}
test("Word shifting") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| void main () {
| byte a
@ -50,7 +50,7 @@ class ShiftSuite extends FunSuite with Matchers {
| output <<= 2
| }
""".stripMargin)(_.readLong(0xc000) should equal(0x4040C04))
EmuCrossPlatformBenchmarkRun(Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| long output @$c000
| void main () {
| output = $1010301
@ -60,7 +60,7 @@ class ShiftSuite extends FunSuite with Matchers {
}
test("Long shifting right") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| long output @$c000
| void main () {
| output = $4040C04
@ -70,7 +70,7 @@ class ShiftSuite extends FunSuite with Matchers {
}
test("Word shifting via pseudoregister") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| void main () {
| output = identity(three() << 7)
@ -81,7 +81,7 @@ class ShiftSuite extends FunSuite with Matchers {
}
test("Variable shifting") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output0 @$c000
| word output2 @$c002
| byte output4 @$c004

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class SignExtensionSuite extends FunSuite with Matchers {
test("Sbyte to Word") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| void main () {
| sbyte b
@ -22,7 +22,7 @@ class SignExtensionSuite extends FunSuite with Matchers {
}
}
test("Sbyte to Word 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| void main () {
| output = b()
@ -33,7 +33,7 @@ class SignExtensionSuite extends FunSuite with Matchers {
""".stripMargin){m => m.readWord(0xc000) should equal(0xffff)}
}
test("Sbyte to Long") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| long output @$c000
| void main () {
| output = 421
@ -46,7 +46,7 @@ class SignExtensionSuite extends FunSuite with Matchers {
}
test("Optimize pointless sign extension") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| array output [10] @$c000
| word w
| void main () {

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class StackVarSuite extends FunSuite with Matchers {
test("Basic stack assignment") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| byte output @$c000
| void main () {
| stack byte a
@ -24,7 +24,7 @@ class StackVarSuite extends FunSuite with Matchers {
}
test("Stack byte addition") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| byte output @$c000
| void main () {
| stack byte a
@ -56,7 +56,7 @@ class StackVarSuite extends FunSuite with Matchers {
}
test("Complex expressions involving stack variables (Z80)") {
EmuZ80BenchmarkRun("""
EmuCrossPlatformBenchmarkRun(Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| byte output @$c000
| void main () {
| stack byte a
@ -89,7 +89,7 @@ class StackVarSuite extends FunSuite with Matchers {
// }
test("Stack word addition") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| void main () {
| stack word a
@ -107,7 +107,7 @@ class StackVarSuite extends FunSuite with Matchers {
}
test("Recursion") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| array output [6] @$c000
| byte fails @$c010
| void main () {
@ -143,7 +143,7 @@ class StackVarSuite extends FunSuite with Matchers {
}
test("Recursion 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| array output [6] @$c000
| byte fails @$c010
| void main () {
@ -175,7 +175,7 @@ class StackVarSuite extends FunSuite with Matchers {
}
test("Complex stack-related stuff") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| byte output @$c000
| array id = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
| void main() {
@ -193,7 +193,7 @@ class StackVarSuite extends FunSuite with Matchers {
test("Indexing") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| array output [200] @$c000
| void main () {
| stack byte a
@ -206,7 +206,7 @@ class StackVarSuite extends FunSuite with Matchers {
}
test("Double array with stack variables") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
"""
| array output[5]@$c001
| array input = [0,1,4,9,16,25,36,49]

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class StatementOptimizationSuite extends FunSuite with Matchers {
test("Statement optimization 1") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Intel8080)(
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Intel8080, Cpu.Sharp)(
"""
| array output[10] @$c000
| void main() {

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class TypeSuite extends FunSuite with Matchers {
test("Word to word") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| void main () {
| output = word(0x203)

View File

@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
class TypeWideningSuite extends FunSuite with Matchers {
test("Word after simple ops") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| void main () {
| output = random()

View File

@ -9,7 +9,7 @@ import org.scalatest.{FunSuite, Matchers}
class WordMathSuite extends FunSuite with Matchers {
test("Word addition") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| word a
| void main () {
@ -21,7 +21,7 @@ class WordMathSuite extends FunSuite with Matchers {
}
test("Word subtraction") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| word a
| void main () {
@ -33,7 +33,7 @@ class WordMathSuite extends FunSuite with Matchers {
}
test("Word subtraction 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| word a
| void main () {
@ -45,7 +45,7 @@ class WordMathSuite extends FunSuite with Matchers {
}
test("Byte-to-word addition") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| word pair
| void main () {
@ -58,7 +58,7 @@ class WordMathSuite extends FunSuite with Matchers {
}
test("Literal addition") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| void main () {
| output = 640
@ -68,7 +68,7 @@ class WordMathSuite extends FunSuite with Matchers {
}
test("Array element addition") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| word pair
| array b[2]
@ -85,7 +85,7 @@ class WordMathSuite extends FunSuite with Matchers {
}
test("nesdev.com example") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| byte output @$c000
| array map [256] @$c300
| array b[2]
@ -103,7 +103,7 @@ class WordMathSuite extends FunSuite with Matchers {
}
test("hi()/lo()") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| array output [7] @$c000
| void main () {
| output[0] = lo(33)
@ -135,7 +135,7 @@ class WordMathSuite extends FunSuite with Matchers {
}
test("Word addition 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| void main () {
| word v
@ -151,7 +151,7 @@ class WordMathSuite extends FunSuite with Matchers {
}
test("Word addition 3") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| void main () {
| byte c
@ -167,7 +167,7 @@ class WordMathSuite extends FunSuite with Matchers {
}
test("Word addition 4") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| void main () {
| word v
@ -187,7 +187,7 @@ class WordMathSuite extends FunSuite with Matchers {
}
test("Word bit ops 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| void main () {
| word v
@ -203,7 +203,7 @@ class WordMathSuite extends FunSuite with Matchers {
}
test("Word shift") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| void main () {
| word v
@ -221,7 +221,7 @@ class WordMathSuite extends FunSuite with Matchers {
}
test("Word shift 2") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| void main () {
| output = five()
@ -236,7 +236,7 @@ class WordMathSuite extends FunSuite with Matchers {
}
test("Word shift 3") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| void main () {
| output = five()
@ -251,7 +251,7 @@ class WordMathSuite extends FunSuite with Matchers {
}
test("Word shift 4") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| void main () {
| output = five()
@ -266,7 +266,7 @@ class WordMathSuite extends FunSuite with Matchers {
}
test("Word shift 5") {
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
| word output @$c000
| void main () {
| output = five()

View File

@ -1,6 +1,6 @@
package millfork.test
import millfork.test.emu.{EmuUnoptimizedIntel8080Run, EmuUnoptimizedZ80Run}
import millfork.test.emu.{EmuUnoptimizedIntel8080Run, EmuUnoptimizedSharpRun, EmuUnoptimizedZ80Run}
import org.scalatest.{FunSuite, Matchers}
/**
@ -562,4 +562,28 @@ class Z80AssemblySuite extends FunSuite with Matchers {
| }
""".stripMargin)
}
test("Gameboy instructions") {
EmuUnoptimizedSharpRun(
"""
| asm void main () {
| ret
| ld (8),sp
| stop
| ld (hli),a
| ld (hld),a
| ld a,(hli)
| ld a,(hld)
| reti
| add sp,3
| ld hl,sp+3
| swap a
| swap b
| swap c
| swap(hl)
|
| ret
| }
""".stripMargin)
}
}