mirror of
https://github.com/KarolS/millfork.git
synced 2026-04-20 03:16:45 +00:00
Add 8080-to-8086 translation
This commit is contained in:
@@ -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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output [4000] @$c000
|
||||
| array input = [
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class AlignmentSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Alignment") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output [5] @$c000
|
||||
| void main () {
|
||||
|
||||
@@ -28,7 +28,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
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 =>
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src) { m =>
|
||||
m.readByte(0xc000) should equal(5)
|
||||
m.readByte(0xc001) should equal(6)
|
||||
m.readByte(0xc002) should equal(7)
|
||||
@@ -53,7 +53,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
m.readByte(0xc002) should equal(1)
|
||||
m.readByte(0xc007) should equal(6)
|
||||
}
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(src) { m =>
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src) { m =>
|
||||
m.readByte(0xc002) should equal(1)
|
||||
m.readByte(0xc007) should equal(6)
|
||||
}
|
||||
@@ -78,7 +78,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Array assignment through a pointer") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output [3] @$c000
|
||||
| pointer p
|
||||
@@ -98,7 +98,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Array in place math") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output [4] @$c000
|
||||
| void main () {
|
||||
@@ -112,7 +112,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Array simple read") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| array a[7]
|
||||
@@ -126,7 +126,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Array simple read 2") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| array a[7]
|
||||
@@ -144,7 +144,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Pointers") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output
|
||||
| pointer a
|
||||
@@ -169,7 +169,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Pointer indexing test") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output [4] @$c000
|
||||
| pointer a
|
||||
@@ -186,7 +186,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Syntax") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array a = [1, 2, 3]
|
||||
| array b = "text" ascii
|
||||
@@ -198,7 +198,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Negative subindex") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
|
|
||||
| array output [$fff] @$c000
|
||||
@@ -237,7 +237,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Word subindex 2") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
|
|
||||
| array output [$fff] @$c000
|
||||
@@ -259,7 +259,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Array filters") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array x = @word [$1144]
|
||||
| byte output @$c000
|
||||
@@ -272,7 +272,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Array filters 2") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array x = @long [$1144]
|
||||
| byte output @$c000
|
||||
@@ -285,7 +285,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Const arrays") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| const array square = [0, 1, 4, 9, 16, 25, 36, 49, 64]
|
||||
| byte five() = 5
|
||||
@@ -312,7 +312,7 @@ class ArraySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Struct array initializers") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| struct p { byte x, byte y }
|
||||
| struct line { p from, p to }
|
||||
|
||||
@@ -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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$C000
|
||||
| void main () {
|
||||
@@ -302,7 +302,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Adding a nonet") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| word output @$C000
|
||||
| byte source @$C002
|
||||
@@ -321,7 +321,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Common indexing subexpression elimination") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output [55] @$C000
|
||||
| array input = [0,1,2,3,4,5,6,7,8,9,10]
|
||||
@@ -340,7 +340,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Effectively const variable") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
|byte output @$c000
|
||||
|void main() {
|
||||
@@ -408,7 +408,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Constant pointers") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
|byte output0 @$c000
|
||||
|byte output1 @$c001
|
||||
@@ -428,7 +428,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Low bit") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main() {
|
||||
@@ -447,7 +447,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Low bit 2") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main() {
|
||||
@@ -466,7 +466,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Low bit 3") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main() {
|
||||
@@ -488,7 +488,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Low bit 4") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main() {
|
||||
@@ -528,7 +528,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Shift and increase") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main() {
|
||||
@@ -544,7 +544,7 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Add one bit") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main() {
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
*/
|
||||
class BasicSymonTest extends FunSuite with Matchers {
|
||||
test("Empty test") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| void main () {
|
||||
|
|
||||
@@ -80,13 +80,13 @@ class BasicSymonTest extends FunSuite with Matchers {
|
||||
output += 1
|
||||
}
|
||||
"""
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(src){m =>
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src){m =>
|
||||
m.readByte(0xc000) should equal(src.count(_ == '+'))
|
||||
}
|
||||
}
|
||||
|
||||
test("Byte assignment") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@@ -98,7 +98,7 @@ class BasicSymonTest extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Preallocated variables") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output [2] @$c000
|
||||
| byte number = 4
|
||||
@@ -114,7 +114,7 @@ class BasicSymonTest extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Preallocated variables 2") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| word number = 344
|
||||
@@ -127,7 +127,7 @@ class BasicSymonTest extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Else if") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@@ -145,7 +145,7 @@ class BasicSymonTest extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Segment syntax") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| segment(default)byte output @$c000
|
||||
| segment(default)array x[3]
|
||||
@@ -155,7 +155,7 @@ class BasicSymonTest extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Alias test") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| alias small = byte
|
||||
| alias big = word
|
||||
@@ -174,7 +174,7 @@ class BasicSymonTest extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Deep alias test") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| alias a = output
|
||||
|
||||
@@ -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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| 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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| 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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| 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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
| output = 5
|
||||
|
||||
@@ -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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| array output[8]
|
||||
| word output_addr @$c000
|
||||
| void main () {
|
||||
@@ -60,7 +60,7 @@ class BitPackingSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Unpack bits from a word") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| array output[16]
|
||||
| word output_addr @$c000
|
||||
| void main () {
|
||||
@@ -97,7 +97,7 @@ class BitPackingSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Pack bits into byte") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| byte output @$C000
|
||||
| array input = [$F0, 1, 0, $41, $10, 1, $61, 0]
|
||||
| void main () {
|
||||
@@ -114,7 +114,7 @@ class BitPackingSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Pack bits into word") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$C000
|
||||
| array input = [$F0, 1, 0, $41, $10, 1, $61, 0,
|
||||
| 1, 1, 0, 0, 0, 0, 1, 1]
|
||||
@@ -132,7 +132,7 @@ class BitPackingSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Pack bits into byte using plus") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| byte output @$C000
|
||||
| array input = [$F0, 1, 0, $41, $10, 1, $61, 0]
|
||||
| void main () {
|
||||
@@ -149,7 +149,7 @@ class BitPackingSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Reverse byte") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output_addr @$C000
|
||||
| void main () {
|
||||
| byte i
|
||||
@@ -171,7 +171,7 @@ class BitPackingSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Reverse byte 2") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| byte output_real @$C000
|
||||
| void main () {
|
||||
| byte i
|
||||
@@ -192,7 +192,7 @@ class BitPackingSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Reverse word") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output_addr @$C000
|
||||
| void main () {
|
||||
| byte i
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package millfork.test
|
||||
|
||||
import millfork.Cpu
|
||||
import millfork.test.emu.EmuCrossPlatformBenchmarkRun
|
||||
import millfork.test.emu.{EmuCrossPlatformBenchmarkRun, EmuUnoptimizedCrossPlatformRun}
|
||||
import org.scalatest.{FunSuite, Matchers}
|
||||
|
||||
/**
|
||||
@@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class BooleanSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Not") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| array input = [5,6,7]
|
||||
@@ -87,6 +87,6 @@ class BooleanSuite extends FunSuite with Matchers {
|
||||
| inline void pass() { output += 1 }
|
||||
| noinline void fail() { outside[0] = 0 }
|
||||
""".stripMargin
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(code)(_.readByte(0xc000) should equal(code.sliding(4).count(_ == "pass")))
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(code)(_.readByte(0xc000) should equal(code.sliding(4).count(_ == "pass")))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| byte counter @$c001
|
||||
|
||||
@@ -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, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| byte a
|
||||
@@ -62,7 +62,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Decimal byte subtraction") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| byte a
|
||||
@@ -74,7 +74,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("In-place decimal byte addition") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output[3] @$c000
|
||||
| byte a
|
||||
@@ -88,7 +88,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("In-place decimal byte addition 2") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output[3] @$c000
|
||||
| void main () {
|
||||
@@ -108,7 +108,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("In-place decimal byte subtraction") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| byte a
|
||||
@@ -120,7 +120,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Decimal word addition") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
@@ -136,7 +136,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Decimal word subtraction") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
@@ -152,7 +152,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("In-place decimal word subtraction") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| word a
|
||||
@@ -166,7 +166,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("In-place decimal long subtraction") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| long output @$c000
|
||||
| word a
|
||||
@@ -181,7 +181,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Flag switching test") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@@ -192,7 +192,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Flag switching test 2") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@@ -203,7 +203,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Flag switching test 3") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@@ -214,7 +214,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Decimal left shift test") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@@ -229,7 +229,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Decimal left shift test 2") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@@ -243,7 +243,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Decimal left shift test 3") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
@@ -257,7 +257,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Decimal left shift test 4") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| long output @$c000
|
||||
| void main () {
|
||||
@@ -271,7 +271,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Decimal right shift test") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@@ -286,7 +286,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Decimal right shift test 2") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@@ -300,7 +300,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Decimal right shift test 3") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
@@ -335,7 +335,7 @@ class ByteDecimalMathSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Decimal word right-shift comprehensive suite") {
|
||||
for (i <- List(0, 1, 10, 100, 1000, 2000, 500, 200, 280, 300, 5234, 7723, 7344, 9, 16, 605, 1111, 2222, 3333, 9999, 8888, 8100)) {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
@@ -351,7 +351,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, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@@ -369,7 +369,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, Cpu.Sharp, Cpu.Ricoh)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Ricoh, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.scalatest.{AppendedClues, FunSuite, Matchers}
|
||||
class ByteMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
|
||||
test("Complex expression") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@@ -23,7 +23,7 @@ class ByteMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Complex expression 2") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@@ -41,7 +41,7 @@ class ByteMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Byte addition") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| byte a
|
||||
@@ -53,7 +53,7 @@ class ByteMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Byte addition 2") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| byte a
|
||||
@@ -65,7 +65,7 @@ class ByteMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("In-place byte addition") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output[3] @$c000
|
||||
| byte a
|
||||
@@ -79,7 +79,7 @@ class ByteMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("LHS evaluation during in-place byte addition") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output[1] @$c000
|
||||
| byte call_count @$c001
|
||||
@@ -99,7 +99,7 @@ class ByteMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Parameter order") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| array arr[6]
|
||||
@@ -119,7 +119,7 @@ class ByteMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("In-place byte addition 2") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output[3] @$c000
|
||||
| void main () {
|
||||
@@ -155,7 +155,7 @@ class ByteMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
private def multiplyCase1(x: Int, y: Int): Unit = {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
s"""
|
||||
| byte output @$$c000
|
||||
| void main () {
|
||||
@@ -183,7 +183,7 @@ class ByteMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
private def multiplyCase2(x: Int, y: Int): Unit = {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
s"""
|
||||
| byte output @$$c000
|
||||
| void main () {
|
||||
@@ -242,6 +242,10 @@ class ByteMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
| if output1 != 20 { asm { ld a,($bfff) }}
|
||||
| if output2 != 27 { asm { ld a,($bfff) }}
|
||||
| if output3 != 15 { asm { ld a,($bfff) }}
|
||||
| #elseif ARCH_X86
|
||||
| if output1 != 20 { asm { ld a,($bfff) }}
|
||||
| if output2 != 27 { asm { ld a,($bfff) }}
|
||||
| if output3 != 15 { asm { ld a,($bfff) }}
|
||||
| #else
|
||||
| #error unsupported architecture
|
||||
| #endif
|
||||
@@ -270,7 +274,7 @@ class ByteMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
private def multiplyCase3(x: Int, y: Int): Unit = {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
s"""
|
||||
| import zp_reg
|
||||
| byte output @$$c000
|
||||
|
||||
@@ -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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@@ -28,7 +28,7 @@ class ComparisonSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Less") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(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, Cpu.Sharp)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(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, Cpu.Sharp)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(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, Cpu.Sharp)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(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, Cpu.Sharp)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(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, Cpu.Sharp)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
|
||||
}
|
||||
|
||||
test("Signed comparison >=") {
|
||||
@@ -229,7 +229,7 @@ class ComparisonSuite extends FunSuite with Matchers {
|
||||
| if a >= 0 { output += 1 }
|
||||
| }
|
||||
""".stripMargin
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
|
||||
}
|
||||
|
||||
test("Signed comparison with overflow") {
|
||||
@@ -263,7 +263,7 @@ class ComparisonSuite extends FunSuite with Matchers {
|
||||
| if c > -1 { output += 1 }
|
||||
| }
|
||||
""".stripMargin
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
|
||||
}
|
||||
|
||||
test("Signed comparison < and <=") {
|
||||
@@ -295,11 +295,11 @@ class ComparisonSuite extends FunSuite with Matchers {
|
||||
| if c <= -1 { output -= 7 }
|
||||
| }
|
||||
""".stripMargin
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
|
||||
}
|
||||
|
||||
test("Multiple params for equality") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@@ -315,7 +315,7 @@ class ComparisonSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Multiple params for inequality") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@@ -331,7 +331,7 @@ class ComparisonSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Warnings") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@@ -373,7 +373,7 @@ class ComparisonSuite extends FunSuite with Matchers {
|
||||
| if c > 335444 { output += 1 }
|
||||
| }
|
||||
""".stripMargin
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src)(_.readByte(0xc000) should equal(src.count(_ == '+')))
|
||||
}
|
||||
|
||||
test("Mixed type comparison") {
|
||||
@@ -391,7 +391,7 @@ class ComparisonSuite extends FunSuite with Matchers {
|
||||
| if x < z { output += 1 }
|
||||
| }
|
||||
""".stripMargin
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(src)(_.readByte(0xc000) should equal(1))
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src)(_.readByte(0xc000) should equal(1))
|
||||
}
|
||||
|
||||
test("Compare beyond 2.2") {
|
||||
@@ -419,7 +419,7 @@ class ComparisonSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Compare to $ffff") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main() {
|
||||
@@ -439,7 +439,7 @@ class ComparisonSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Compare to 0") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main() {
|
||||
@@ -459,7 +459,7 @@ class ComparisonSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Signed compare to 0") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main() {
|
||||
@@ -477,7 +477,7 @@ class ComparisonSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Signed compare to 1") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main() {
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class ConstantSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Constants should fold") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| array Sieve[4]
|
||||
| array __screen[4]
|
||||
|
||||
@@ -31,7 +31,7 @@ class DeduplicationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Subroutine extraction") {
|
||||
EmuSizeOptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
|
||||
EmuSizeOptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Intel8086)(
|
||||
"""
|
||||
| int24 output @$c000
|
||||
| void main() {
|
||||
@@ -71,7 +71,7 @@ class DeduplicationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Loop subroutine extraction") {
|
||||
EmuSizeOptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
|
||||
EmuSizeOptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output [8] @$c000
|
||||
| void main() {
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
*/
|
||||
class DerefSuite extends FunSuite with Matchers {
|
||||
test("Basic deref test") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
|
|
||||
| byte output @$c000
|
||||
@@ -33,7 +33,7 @@ class DerefSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Byte arithmetic deref test") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
|
|
||||
| byte output1 @$c000
|
||||
@@ -59,7 +59,7 @@ class DerefSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Word arithmetic deref test") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
|
|
||||
| word output1 @$c000
|
||||
|
||||
@@ -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, Cpu.Sharp)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| enum ugly {
|
||||
| a
|
||||
@@ -40,7 +40,7 @@ class EnumSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Enum arrays") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| enum ugly {
|
||||
| a
|
||||
@@ -67,7 +67,7 @@ class EnumSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Loops over enums") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| enum ugly {
|
||||
| a
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class ErasthotenesSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Erasthotenes") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| const pointer sieve = $C000
|
||||
| const byte sqrt = 128
|
||||
|
||||
@@ -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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| farword output0 @$c000
|
||||
| farword output1 @$c004
|
||||
|
||||
@@ -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, Cpu.Sharp)(src) { m =>
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(src) { m =>
|
||||
m.readByte(0xc000) should equal(18)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class ForLoopSuite extends FunSuite with Matchers {
|
||||
|
||||
test("For-to") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
@@ -25,7 +25,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("For-to 2") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| byte five
|
||||
@@ -44,7 +44,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("For-downto") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
@@ -58,7 +58,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("For-downto 2") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output [55] @$c000
|
||||
| void main () {
|
||||
@@ -78,7 +78,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("For-downto 3") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output [55] @$c000
|
||||
| void main () {
|
||||
@@ -102,7 +102,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("For-until") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
@@ -116,7 +116,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("For-parallelto") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
@@ -130,7 +130,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("For-paralleluntil") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
@@ -144,7 +144,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Various loops") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| void init() {
|
||||
| zero = 0
|
||||
@@ -183,7 +183,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Memcpy") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output[5]@$c001
|
||||
| array input = [0,1,4,9,16,25,36,49]
|
||||
@@ -201,7 +201,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Memset with index") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output[5]@$c001
|
||||
| void main () {
|
||||
@@ -218,7 +218,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Memset with pointer") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output[5]@$c001
|
||||
| void main () {
|
||||
@@ -235,7 +235,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Screen fill") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output[$400]@$c000
|
||||
| void main () {
|
||||
@@ -253,7 +253,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Various bulk operations") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output0[5]@$c000
|
||||
| array output1[5]@$c010
|
||||
@@ -288,7 +288,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Edge cases - positive") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| void main() {
|
||||
| byte i
|
||||
| for i,0,until,256 { f() }
|
||||
@@ -343,7 +343,7 @@ class ForLoopSuite extends FunSuite with Matchers {
|
||||
|
||||
|
||||
test("For each") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output[$400]@$c000
|
||||
| void main () {
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class InliningSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Should inline square") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| import zp_reg
|
||||
| byte output @$c000
|
||||
@@ -24,7 +24,7 @@ class InliningSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Should inline <<") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| word output2 @$c006
|
||||
@@ -46,7 +46,7 @@ class InliningSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Should inline this weird thing") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| inline word square(word x) {
|
||||
@@ -61,7 +61,7 @@ class InliningSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Should inline this even weirder thing") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output@$c000
|
||||
| inline word square(word x) {
|
||||
|
||||
@@ -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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| long output @$c000
|
||||
| void main () {
|
||||
@@ -86,7 +86,7 @@ class LongTest extends FunSuite with Matchers {
|
||||
}
|
||||
}
|
||||
test("Long addition 3") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| long output @$c000
|
||||
| void main () {
|
||||
@@ -103,7 +103,7 @@ class LongTest extends FunSuite with Matchers {
|
||||
}
|
||||
}
|
||||
test("Extralong addition") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| int128 output @$c000
|
||||
| void main () {
|
||||
@@ -120,7 +120,7 @@ class LongTest extends FunSuite with Matchers {
|
||||
}
|
||||
}
|
||||
test("Long subtraction") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| long output @$c000
|
||||
| void main () {
|
||||
@@ -140,7 +140,7 @@ class LongTest extends FunSuite with Matchers {
|
||||
}
|
||||
}
|
||||
test("Long subtraction 2") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| long output @$c000
|
||||
| void main () {
|
||||
@@ -154,7 +154,7 @@ class LongTest extends FunSuite with Matchers {
|
||||
}
|
||||
}
|
||||
test("Long subtraction 3") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| long output @$c000
|
||||
| void main () {
|
||||
@@ -174,7 +174,7 @@ class LongTest extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Long AND") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| long output @$c000
|
||||
| void main () {
|
||||
@@ -194,7 +194,7 @@ class LongTest extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Long INC/DEC") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| long output0 @$c000
|
||||
| long output1 @$c004
|
||||
@@ -234,7 +234,7 @@ class LongTest extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Returning long") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| long output @$c000
|
||||
| void main () {
|
||||
@@ -249,7 +249,7 @@ class LongTest extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Various combinations involving promotions") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| long output0 @$c000
|
||||
| long output1 @$c004
|
||||
@@ -311,7 +311,7 @@ class LongTest extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Larger than long") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| int64 output0 @$c000
|
||||
| int64 output1 @$c008
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class MacroSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Most basic test") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| macro void run(byte x) {
|
||||
| output = x
|
||||
|
||||
@@ -29,7 +29,7 @@ class MemsetSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
def memsetCase(size: Int): Unit = {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Intel8080, Cpu.Z80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Intel8080, Cpu.Z80, Cpu.Intel8086)(
|
||||
"const word SIZE = " + size + """
|
||||
| array output [SIZE] @$c000
|
||||
| void main () {
|
||||
|
||||
@@ -32,7 +32,7 @@ class NodeOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Returning one variable") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| int64 output @$c000
|
||||
| void main () {
|
||||
|
||||
@@ -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, Cpu.Sharp)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output [5] @$c000
|
||||
| void main () {
|
||||
@@ -30,7 +30,7 @@ class NonetSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Nonet operations on bytes") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
|
|
||||
@@ -45,7 +45,7 @@ class NonetSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Nonet left shift") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| word output0 @$c000
|
||||
| word output1 @$c002
|
||||
@@ -119,7 +119,7 @@ class NonetSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Nonet shift right") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output0 @$c000
|
||||
| byte output1 @$c002
|
||||
@@ -141,7 +141,7 @@ class NonetSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Nonet shift right 2") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output0 @$c000
|
||||
| byte output1 @$c002
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.scalatest.{AppendedClues, FunSuite, Matchers}
|
||||
class PointerSuite extends FunSuite with Matchers with AppendedClues {
|
||||
|
||||
test("Pointers outside zeropage") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Sixteen, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Sixteen, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| pointer p @$c004
|
||||
| array output[2] @$c000
|
||||
@@ -25,7 +25,7 @@ class PointerSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Pointers on stack") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Sixteen, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Sixteen, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output[2] @$c000
|
||||
| void main() {
|
||||
@@ -40,7 +40,7 @@ class PointerSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Typed byte-targeting pointers") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Sixteen, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Sixteen, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| enum e {}
|
||||
| array(e) output [3] @$c000
|
||||
@@ -57,7 +57,7 @@ class PointerSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Typed word-targeting pointers") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Sixteen, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Sixteen, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| word output @$c000
|
||||
| void main() {
|
||||
@@ -73,7 +73,7 @@ class PointerSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Struct pointers") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| struct point { word x, word y }
|
||||
| struct pointlist { point head, pointer.pointlist tail }
|
||||
@@ -130,7 +130,7 @@ class PointerSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Pointer optimization") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| struct s { word a, byte b }
|
||||
|
|
||||
@@ -154,7 +154,7 @@ class PointerSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("nullptr") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| void main() {
|
||||
| pointer.word pw
|
||||
@@ -171,7 +171,7 @@ class PointerSuite extends FunSuite with Matchers with AppendedClues {
|
||||
|
||||
test("Complex pointers") {
|
||||
// TODO: optimize it when inlined
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output[3] @$c000
|
||||
| struct s {
|
||||
@@ -193,7 +193,7 @@ class PointerSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Indexing returned pointers") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output[10] @$c000
|
||||
| pointer get() = output.addr
|
||||
|
||||
@@ -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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output [200] @$c000
|
||||
| sbyte param
|
||||
@@ -74,7 +74,7 @@ class ReturnDispatchSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Enum test") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| enum ugly {
|
||||
|
||||
@@ -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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| 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, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| const byte start = 5
|
||||
@@ -105,7 +105,7 @@ class SecondAssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Conditional variable initialization") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output [16] @$c000
|
||||
| void main () {
|
||||
|
||||
@@ -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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| 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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| 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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| 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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| 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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| 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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| array high [16] @$c000
|
||||
| array low [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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| 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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| byte h
|
||||
|
||||
@@ -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, Cpu.Sharp)("""
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| 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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| 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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| 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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| 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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| 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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| 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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output0 @$c000
|
||||
| word output2 @$c002
|
||||
| byte output4 @$c004
|
||||
@@ -104,7 +104,7 @@ class ShiftSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Zero shifting") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| byte output0 @$c000
|
||||
| byte output1 @$c001
|
||||
| noinline byte sl(byte input, byte amount) {
|
||||
|
||||
@@ -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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| 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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| 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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| 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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| array output [10] @$c000
|
||||
| word w
|
||||
| void main () {
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class StackVarSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Basic stack assignment") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.StrictMos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.StrictMos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
| stack byte a
|
||||
@@ -24,7 +24,7 @@ class StackVarSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Stack byte addition") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.StrictMos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.StrictMos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| 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)") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
| stack byte a
|
||||
@@ -70,7 +70,7 @@ class StackVarSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Stack byte subtraction") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Intel8086)(
|
||||
"""
|
||||
| byte output @$c000
|
||||
| void main () {
|
||||
@@ -91,7 +91,7 @@ class StackVarSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Stack word addition") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.StrictMos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.StrictMos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| stack word a
|
||||
@@ -109,7 +109,7 @@ class StackVarSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Recursion") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.StrictMos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.StrictMos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| array output [6] @$c000
|
||||
| byte fails @$c010
|
||||
| void main () {
|
||||
@@ -145,7 +145,7 @@ class StackVarSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Recursion 2") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.StrictMos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.StrictMos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| array output [6] @$c000
|
||||
| byte fails @$c010
|
||||
| void main () {
|
||||
@@ -177,7 +177,7 @@ class StackVarSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Complex stack-related stuff") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.StrictMos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.StrictMos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| byte output @$c000
|
||||
| array id = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||
| void main() {
|
||||
@@ -195,7 +195,7 @@ class StackVarSuite extends FunSuite with Matchers {
|
||||
|
||||
|
||||
test("Indexing") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.StrictMos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.StrictMos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| array output [200] @$c000
|
||||
| void main () {
|
||||
| stack byte a
|
||||
@@ -208,7 +208,7 @@ class StackVarSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Double array with stack variables") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.StrictMos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.StrictMos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output[5]@$c001
|
||||
| array input = [0,1,4,9,16,25,36,49]
|
||||
@@ -226,7 +226,7 @@ class StackVarSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Complex large stacks") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.StrictMos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.StrictMos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
// val m = EmuUnoptimizedZ80Run(
|
||||
"""
|
||||
| array output[5]@$c000
|
||||
@@ -255,7 +255,7 @@ class StackVarSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Large stack storage") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| int32 output @$c000
|
||||
| void main () {
|
||||
@@ -272,7 +272,7 @@ class StackVarSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Large stack-to-stack transfer") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| int32 output @$c000
|
||||
| void main () {
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class StatementOptimizationSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Statement optimization 1") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| array output[10] @$c000
|
||||
| void main() {
|
||||
@@ -58,7 +58,7 @@ class StatementOptimizationSuite extends FunSuite with Matchers {
|
||||
|
||||
|
||||
test("Stdlib optimization 1") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Intel8080, Cpu.Sharp)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)(
|
||||
"""
|
||||
| import stdio
|
||||
| byte output @$c000
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class StructSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Basic struct support") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080)("""
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Intel8086)("""
|
||||
| struct point {
|
||||
| byte x
|
||||
| byte y
|
||||
@@ -40,7 +40,7 @@ class StructSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Nested structs") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Intel8080)("""
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Intel8080, Cpu.Intel8086)("""
|
||||
| struct inner { word x, word y }
|
||||
| struct s {
|
||||
| word w
|
||||
@@ -69,7 +69,7 @@ class StructSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Basic union support") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Intel8080)("""
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Mos, Cpu.Intel8080, Cpu.Intel8086)("""
|
||||
| struct point { byte x, byte y }
|
||||
| union point_or_word { point p, word w }
|
||||
| word output @$c000
|
||||
@@ -85,7 +85,7 @@ class StructSuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Optimize struct modifications") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)("""
|
||||
| struct point { byte x, byte y }
|
||||
| enum direction { none, right }
|
||||
| direction last_direction @$c400
|
||||
|
||||
@@ -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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| output = word(0x203)
|
||||
|
||||
@@ -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, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| output = random()
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.scalatest.{FunSuite, Matchers}
|
||||
class VolatileSuite extends FunSuite with Matchers {
|
||||
|
||||
test("Basic volatile test") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
"""
|
||||
| word addr @$c000
|
||||
| volatile byte output @$c0ea
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.scalatest.{AppendedClues, FunSuite, Matchers}
|
||||
class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
|
||||
test("Word addition") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| word a
|
||||
| void main () {
|
||||
@@ -21,7 +21,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Cast word addition") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| byte output @$c000
|
||||
| word a
|
||||
| void main () {
|
||||
@@ -34,7 +34,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Word subtraction") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| word a
|
||||
| void main () {
|
||||
@@ -46,7 +46,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Word subtraction 2") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| word a
|
||||
| void main () {
|
||||
@@ -58,7 +58,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Word subtraction 3") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Cmos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| word a
|
||||
| void main () {
|
||||
@@ -73,7 +73,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Byte-to-word addition") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| word pair
|
||||
| void main () {
|
||||
@@ -86,7 +86,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Literal addition") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| output = 640
|
||||
@@ -96,7 +96,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Array element addition") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| word pair
|
||||
| array b[2]
|
||||
@@ -113,7 +113,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("nesdev.com example") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| byte output @$c000
|
||||
| byte tile @$C3A6
|
||||
| array map [256] @$c300
|
||||
@@ -135,7 +135,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("nesdev.com example 2") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| byte output @$c000
|
||||
| byte tile @$C3A6
|
||||
| array map [256] @$c300
|
||||
@@ -153,7 +153,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("hi()/lo()") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| array output [7] @$c000
|
||||
| void main () {
|
||||
| output[0] = lo(33)
|
||||
@@ -185,7 +185,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Word addition 2") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| word v
|
||||
@@ -201,7 +201,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Word addition 3") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| byte c
|
||||
@@ -217,7 +217,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Word addition 4") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| word v
|
||||
@@ -237,7 +237,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Word bit ops 2") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| word v
|
||||
@@ -253,7 +253,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Word shift") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| word v
|
||||
@@ -271,7 +271,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Word shift 2") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| output = five()
|
||||
@@ -286,7 +286,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Word shift 3") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| output = five()
|
||||
@@ -301,7 +301,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Word shift 4") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| output = five()
|
||||
@@ -316,7 +316,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Word shift 5") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| output = five()
|
||||
@@ -332,7 +332,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Word multiplication 5") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| output = alot()
|
||||
@@ -351,7 +351,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
test("Word multiplication optimization") {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Intel8080, Cpu.Sharp)("""
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Intel8080, Cpu.Sharp, Cpu.Intel8086)("""
|
||||
| word output @$c000
|
||||
| void main () {
|
||||
| output = alot()
|
||||
@@ -392,7 +392,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
private def multiplyCase1(x: Int, y: Int): Unit = {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Sixteen, Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
s"""
|
||||
| import zp_reg
|
||||
| word output @$$c000
|
||||
@@ -427,7 +427,7 @@ class WordMathSuite extends FunSuite with Matchers with AppendedClues {
|
||||
}
|
||||
|
||||
private def multiplyCase2(x: Int, y: Int): Unit = {
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80)(
|
||||
EmuCrossPlatformBenchmarkRun(Cpu.Mos, Cpu.Z80, Cpu.Intel8086)(
|
||||
s"""
|
||||
| import zp_reg
|
||||
| word output1 @$$c000
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package millfork.test
|
||||
|
||||
import millfork.test.emu.{EmuUnoptimizedIntel8080Run, EmuUnoptimizedSharpRun, EmuUnoptimizedZ80Run}
|
||||
import millfork.Cpu
|
||||
import millfork.test.emu.{EmuUnoptimizedCrossPlatformRun, EmuUnoptimizedIntel8080Run, EmuUnoptimizedSharpRun, EmuUnoptimizedZ80Run}
|
||||
import org.scalatest.{FunSuite, Matchers}
|
||||
|
||||
/**
|
||||
@@ -274,8 +275,8 @@ class Z80AssemblySuite extends FunSuite with Matchers {
|
||||
| }
|
||||
""".stripMargin)
|
||||
}
|
||||
test("Common I80 instructions (Intel syntax)") {
|
||||
EmuUnoptimizedIntel8080Run(
|
||||
test("Common I80 instructions (without RST, Intel syntax)") {
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Intel8080, Cpu.Intel8086)(
|
||||
"""
|
||||
| #pragma intel_syntax
|
||||
| asm void main () {
|
||||
@@ -491,7 +492,6 @@ class Z80AssemblySuite extends FunSuite with Matchers {
|
||||
| cnz main
|
||||
| push b
|
||||
| adi 1
|
||||
| rst 0
|
||||
|
|
||||
| rz
|
||||
| ret
|
||||
@@ -499,7 +499,6 @@ class Z80AssemblySuite extends FunSuite with Matchers {
|
||||
| cz main
|
||||
| call main
|
||||
| aci 1
|
||||
| rst 1
|
||||
|
|
||||
| rnc
|
||||
| pop d
|
||||
@@ -507,38 +506,32 @@ class Z80AssemblySuite extends FunSuite with Matchers {
|
||||
| cnc main
|
||||
| push d
|
||||
| sui 1
|
||||
| rst 2
|
||||
|
|
||||
| rc
|
||||
| jc main
|
||||
| cc main
|
||||
| sbi 1
|
||||
| rst 3
|
||||
|
|
||||
| pop h
|
||||
| xthl
|
||||
| push h
|
||||
| ani 1
|
||||
| rst 4
|
||||
|
|
||||
| pchl
|
||||
| xri 1
|
||||
| rst 5
|
||||
|
|
||||
| pop psw
|
||||
| di
|
||||
| push psw
|
||||
| ori 1
|
||||
| rst 6
|
||||
|
|
||||
| sphl
|
||||
| ei
|
||||
| cpi 1
|
||||
| rst 7
|
||||
|
|
||||
| ret
|
||||
| }
|
||||
""".stripMargin)
|
||||
""".stripMargin){ m => }
|
||||
}
|
||||
|
||||
test("Intel 8080 instructions (Zilog syntax)") {
|
||||
@@ -571,7 +564,7 @@ class Z80AssemblySuite extends FunSuite with Matchers {
|
||||
}
|
||||
|
||||
test("Intel 8080 instructions (Intel syntax)") {
|
||||
EmuUnoptimizedIntel8080Run(
|
||||
EmuUnoptimizedCrossPlatformRun(Cpu.Intel8080, Cpu.Intel8086)(
|
||||
"""
|
||||
| #pragma intel_syntax
|
||||
| asm void main () {
|
||||
@@ -596,6 +589,26 @@ class Z80AssemblySuite extends FunSuite with Matchers {
|
||||
|
|
||||
| ret
|
||||
| }
|
||||
""".stripMargin){ m => }
|
||||
}
|
||||
|
||||
test("Intel 8080 RST instructions (Intel syntax)") {
|
||||
EmuUnoptimizedIntel8080Run(
|
||||
"""
|
||||
| #pragma intel_syntax
|
||||
| asm void main () {
|
||||
| ret
|
||||
| rst 0
|
||||
| rst 1
|
||||
| rst 2
|
||||
| rst 3
|
||||
| rst 4
|
||||
| rst 5
|
||||
| rst 6
|
||||
| rst 7
|
||||
|
|
||||
| ret
|
||||
| }
|
||||
""".stripMargin)
|
||||
}
|
||||
|
||||
|
||||
@@ -106,6 +106,25 @@ object EmuSharpBenchmarkRun {
|
||||
}
|
||||
}
|
||||
|
||||
object EmuIntel8086BenchmarkRun {
|
||||
def apply(source: String)(verifier: MemoryBank => Unit): Unit = {
|
||||
val (Timings(t0, _), m0) = EmuUnoptimizedIntel8086Run.apply2(source)
|
||||
val (Timings(t1, _), m1) = EmuOptimizedIntel8086Run.apply2(source)
|
||||
val (Timings(t2, _), m2) = EmuOptimizedInlinedIntel8086Run.apply2(source)
|
||||
println(f"Before optimization: $t0%7d")
|
||||
println(f"After optimization: $t1%7d")
|
||||
println(f"After inlining: $t2%7d")
|
||||
println(f"Gain: ${(100L * (t0 - t1) / t0.toDouble).round}%7d%%")
|
||||
println(f"Gain with inlining: ${(100L * (t0 - t2) / t0.toDouble).round}%7d%%")
|
||||
println(f"Running 8086 unoptimized")
|
||||
verifier(m0)
|
||||
println(f"Running 8086 optimized")
|
||||
verifier(m1)
|
||||
println(f"Running 8086 optimized inlined")
|
||||
verifier(m2)
|
||||
}
|
||||
}
|
||||
|
||||
object EmuCrossPlatformBenchmarkRun {
|
||||
def apply(platforms: millfork.Cpu.Value*)(source: String)(verifier: MemoryBank => Unit): Unit = {
|
||||
if (platforms.isEmpty) {
|
||||
@@ -123,7 +142,7 @@ object EmuCrossPlatformBenchmarkRun {
|
||||
if (platforms.contains(millfork.Cpu.Cmos)) {
|
||||
EmuCmosBenchmarkRun.apply(source)(verifier)
|
||||
}
|
||||
if (platforms.contains(millfork.Cpu.Sixteen)) {
|
||||
if (Settings.enableWdc85816Tests && platforms.contains(millfork.Cpu.Sixteen)) {
|
||||
EmuNative65816BenchmarkRun.apply(source)(verifier)
|
||||
}
|
||||
if (platforms.contains(millfork.Cpu.Z80)) {
|
||||
@@ -135,5 +154,8 @@ object EmuCrossPlatformBenchmarkRun {
|
||||
if (platforms.contains(millfork.Cpu.Sharp)) {
|
||||
EmuSharpBenchmarkRun.apply(source)(verifier)
|
||||
}
|
||||
if (Settings.enableIntel8086Tests && platforms.contains(millfork.Cpu.Intel8086)) {
|
||||
EmuIntel8086BenchmarkRun.apply(source)(verifier)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
package millfork.test.emu
|
||||
|
||||
import java.nio.charset.StandardCharsets
|
||||
import java.nio.file.{Files, Paths}
|
||||
|
||||
import com.codingrodent.microprocessor.Z80.Z80Core
|
||||
import fastparse.core.Parsed.{Failure, Success}
|
||||
import fr.neatmonster.ibmpc.{IBMCGA, Intel8086}
|
||||
import javax.swing.SwingUtilities
|
||||
import millfork._
|
||||
import millfork.assembly.AssemblyOptimization
|
||||
import millfork.assembly.z80.ZLine
|
||||
import millfork.compiler.z80.Z80Compiler
|
||||
import millfork.compiler.{CompilationContext, LabelGenerator}
|
||||
import millfork.env.{Environment, InitializedArray, InitializedMemoryVariable, NormalFunction}
|
||||
import millfork.node.opt.NodeOptimization
|
||||
import millfork.node.{Program, StandardCallGraph}
|
||||
import millfork.output.{MemoryBank, Z80ToX86Crossassembler}
|
||||
import millfork.parser.{PreprocessingResult, Preprocessor, Z80Parser}
|
||||
import org.scalatest.Matchers
|
||||
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.collection.mutable
|
||||
|
||||
/**
|
||||
* @author Karol Stasiak
|
||||
*/
|
||||
object EmuI86Run {
|
||||
|
||||
private def preload(filename: String): Option[Program] = {
|
||||
TestErrorReporting.log.info(s"Loading $filename for Intel8086")
|
||||
val source = Files.readAllLines(Paths.get(filename), StandardCharsets.US_ASCII).asScala.mkString("\n")
|
||||
val options = CompilationOptions(EmuPlatform.get(millfork.Cpu.Intel8086), Map(
|
||||
CompilationFlag.LenientTextEncoding -> true
|
||||
), None, 0, Map(), JobContext(TestErrorReporting.log, new LabelGenerator))
|
||||
val PreprocessingResult(preprocessedSource, features, _) = Preprocessor.preprocessForTest(options, source)
|
||||
TestErrorReporting.log.debug(s"Features: $features")
|
||||
TestErrorReporting.log.info(s"Parsing $filename")
|
||||
val parser = Z80Parser(filename, preprocessedSource, "", options, features, useIntelSyntax = false)
|
||||
parser.toAst match {
|
||||
case Success(x, _) => Some(x)
|
||||
case f: Failure[_, _] =>
|
||||
TestErrorReporting.log.error(f.toString)
|
||||
TestErrorReporting.log.error(f.extra.toString)
|
||||
TestErrorReporting.log.error(f.lastParser.toString)
|
||||
TestErrorReporting.log.error("Syntax error", Some(parser.lastPosition))
|
||||
TestErrorReporting.log.error("Parsing error")
|
||||
???
|
||||
}
|
||||
}
|
||||
|
||||
private lazy val cache: mutable.Map[String, Option[Program]] = mutable.Map[String, Option[Program]]()
|
||||
private def get(path: String): Program =
|
||||
synchronized { cache.getOrElseUpdate(path, preload(path)).getOrElse(throw new IllegalStateException()) }
|
||||
|
||||
def cachedMath(): Program = get("include/i80_math.mfk") // TODO
|
||||
def cachedStdio(): Program = get("src/test/resources/include/dummy_stdio.mfk")
|
||||
}
|
||||
|
||||
class EmuI86Run(nodeOptimizations: List[NodeOptimization], assemblyOptimizations: List[AssemblyOptimization[ZLine]]) extends Matchers {
|
||||
def inline: Boolean = false
|
||||
|
||||
def optimizeForSize: Boolean = false
|
||||
|
||||
private val TooManyCycles: Long = 1500000
|
||||
|
||||
def apply(source: String): MemoryBank = {
|
||||
apply2(source)._2
|
||||
}
|
||||
|
||||
def apply2(source: String): (Timings, MemoryBank) = {
|
||||
if (!Settings.enableIntel8086Tests) return Timings(-1, -1) -> new MemoryBank()
|
||||
Console.out.flush()
|
||||
Console.err.flush()
|
||||
val log = TestErrorReporting.log
|
||||
println(source)
|
||||
val platform = EmuPlatform.get(millfork.Cpu.Intel8086)
|
||||
val extraFlags = Map(
|
||||
CompilationFlag.EnableInternalTestSyntax -> true,
|
||||
CompilationFlag.InlineFunctions -> this.inline,
|
||||
CompilationFlag.OptimizeStdlib -> this.inline,
|
||||
CompilationFlag.OptimizeForSize -> this.optimizeForSize,
|
||||
CompilationFlag.SubroutineExtraction -> optimizeForSize,
|
||||
CompilationFlag.LenientTextEncoding -> true)
|
||||
val options = CompilationOptions(platform, millfork.Cpu.defaultFlags(millfork.Cpu.Intel8086).map(_ -> true).toMap ++ extraFlags, None, 0, Map(), JobContext(log, new LabelGenerator))
|
||||
log.hasErrors = false
|
||||
log.verbosity = 999
|
||||
var effectiveSource = source
|
||||
if (!source.contains("_panic")) effectiveSource += "\n void _panic(){while(true){}}"
|
||||
log.setSource(Some(effectiveSource.lines.toIndexedSeq))
|
||||
val PreprocessingResult(preprocessedSource, features, pragmas) = Preprocessor.preprocessForTest(options, effectiveSource)
|
||||
// tests use Intel syntax only when forced to:
|
||||
val parserF = Z80Parser("", preprocessedSource, "", options, features, pragmas.contains("intel_syntax"))
|
||||
parserF.toAst match {
|
||||
case Success(unoptimized, _) =>
|
||||
log.assertNoErrors("Parse failed")
|
||||
|
||||
|
||||
// prepare
|
||||
val withLibraries = {
|
||||
var tmp = unoptimized
|
||||
tmp += EmuI86Run.cachedMath()
|
||||
if (source.contains("import stdio")) {
|
||||
tmp += EmuI86Run.cachedStdio()
|
||||
}
|
||||
tmp
|
||||
}
|
||||
val program = nodeOptimizations.foldLeft(withLibraries.applyImportantAliases)((p, opt) => p.applyNodeOptimization(opt, options))
|
||||
val callGraph = new StandardCallGraph(program, log)
|
||||
val env = new Environment(None, "", CpuFamily.I80, options)
|
||||
env.collectDeclarations(program, options)
|
||||
|
||||
val hasOptimizations = assemblyOptimizations.nonEmpty
|
||||
var unoptimizedSize = 0L
|
||||
// print unoptimized asm
|
||||
env.allPreallocatables.foreach {
|
||||
case f: NormalFunction =>
|
||||
val unoptimized = Z80Compiler.compile(CompilationContext(f.environment, f, 0, options, Set()))
|
||||
unoptimizedSize += unoptimized.map(_.sizeInBytes).sum
|
||||
case d: InitializedArray =>
|
||||
unoptimizedSize += d.contents.length
|
||||
case d: InitializedMemoryVariable =>
|
||||
unoptimizedSize += d.typ.size
|
||||
}
|
||||
|
||||
log.assertNoErrors("Compile failed")
|
||||
|
||||
|
||||
// compile
|
||||
val env2 = new Environment(None, "", CpuFamily.I80, options)
|
||||
env2.collectDeclarations(program, options)
|
||||
val assembler = new Z80ToX86Crossassembler(program, env2, platform)
|
||||
val output = assembler.assemble(callGraph, assemblyOptimizations, options)
|
||||
println(";;; compiled: -----------------")
|
||||
output.asm.takeWhile(s => !(s.startsWith(".") && s.contains("= $"))).filterNot(_.contains("////; DISCARD_")).foreach(println)
|
||||
println(";;; ---------------------------")
|
||||
assembler.labelMap.foreach { case (l, addr) => println(f"$l%-15s $$$addr%04x") }
|
||||
|
||||
val optimizedSize = assembler.mem.banks("default").initialized.count(identity).toLong
|
||||
if (unoptimizedSize == optimizedSize) {
|
||||
println(f"Size: $unoptimizedSize%5d B")
|
||||
} else {
|
||||
println(f"Unoptimized size: $unoptimizedSize%5d B")
|
||||
println(f"Optimized size: $optimizedSize%5d B")
|
||||
println(f"Gain: ${(100L * (unoptimizedSize - optimizedSize) / unoptimizedSize.toDouble).round}%5d%%")
|
||||
}
|
||||
|
||||
if (log.hasErrors) {
|
||||
fail("Code generation failed")
|
||||
}
|
||||
|
||||
val memoryBank = assembler.mem.banks("default")
|
||||
(0xff00 to 0xffff).foreach{i =>
|
||||
memoryBank.readable(i) = true
|
||||
memoryBank.writeable(i) = true
|
||||
}
|
||||
|
||||
(0x100 until 0x2000).takeWhile(memoryBank.occupied(_)).map(memoryBank.output).grouped(16).map(_.map(i => f"$i%02x").mkString(" ")).foreach(log.debug(_))
|
||||
val resetN = source.contains("-'") && !options.flag(CompilationFlag.EmitExtended80Opcodes)
|
||||
val resetNMethod = {
|
||||
val clazz = classOf[Z80Core]
|
||||
val method = clazz.getDeclaredMethod("resetN")
|
||||
method.setAccessible(true)
|
||||
method
|
||||
}
|
||||
val timings = {
|
||||
val cpu = new Intel8086()
|
||||
cpu.reset()
|
||||
val memory = sniffField[Array[Int]](cpu, "memory")
|
||||
0x100.until(1<<16).foreach(i => memory(i) = memoryBank.output(i) & 0xff)
|
||||
// far jmp 0:0
|
||||
"ea:0000:0000".filter(Character.isJavaIdentifierPart).grouped(2).zipWithIndex.foreach{case (c, ix) => memory(0xFFFF0+ix) = Integer.parseInt(c, 16)}
|
||||
// xor ax,ax / mov ds,ax / mov ss,ax / mov sp,0xfffe / near call 0x0100 / hlt
|
||||
"31c0/8ed8/8ed0/bc:feff/e8:f400/f4".filter(Character.isJavaIdentifierPart).grouped(2).zipWithIndex.foreach{case (c, ix) => memory(ix) = Integer.parseInt(c, 16)}
|
||||
var clocks = 0L
|
||||
do {
|
||||
// print(f"CS:IP=${sniffField[Int](cpu, "cs")}%04x:${sniffField[Int](cpu, "ip")}%04x")
|
||||
// print(f" AX=${sniffField[Int](cpu, "ah")}%02x${sniffField[Int](cpu, "al")}%02x")
|
||||
// print(f" BX=${sniffField[Int](cpu, "bh")}%02x${sniffField[Int](cpu, "bl")}%02x")
|
||||
// print(f" CX=${sniffField[Int](cpu, "ch")}%02x${sniffField[Int](cpu, "cl")}%02x")
|
||||
// print(f" DX=${sniffField[Int](cpu, "dh")}%02x${sniffField[Int](cpu, "dl")}%02x")
|
||||
// println()
|
||||
clocks = sniffField[Long](cpu, "clocks")
|
||||
} while(clocks < 100000 && sniffMethod[Boolean](cpu, "tick"))
|
||||
SwingUtilities.getWindowAncestor(sniffField[IBMCGA](cpu, "cga")).setVisible(false)
|
||||
if (clocks >= 100000) throw new RuntimeException("Timeout")
|
||||
0x100.until(1<<16).foreach(i => memoryBank.output(i) = memory(i).toByte)
|
||||
Timings(-1, -1) -> memoryBank
|
||||
}
|
||||
log.clearErrors()
|
||||
timings
|
||||
case f: Failure[_, _] =>
|
||||
println(f)
|
||||
println(f.extra.toString)
|
||||
println(f.lastParser.toString)
|
||||
log.error("Syntax error", Some(parserF.lastPosition))
|
||||
fail("Parsing error")
|
||||
}
|
||||
}
|
||||
|
||||
def sniffField[T](intel8086: Intel8086, fieldName: String): T = {
|
||||
val f = intel8086.getClass.getDeclaredField(fieldName)
|
||||
f.setAccessible(true)
|
||||
f.get(intel8086).asInstanceOf[T]
|
||||
}
|
||||
|
||||
def sniffMethod[T](intel8086: Intel8086, fieldName: String): T = {
|
||||
val m = intel8086.getClass.getDeclaredMethod(fieldName)
|
||||
m.setAccessible(true)
|
||||
m.invoke(intel8086).asInstanceOf[T]
|
||||
}
|
||||
|
||||
}
|
||||
@@ -41,6 +41,10 @@ object EmuOptimizedInlinedIntel8080Run extends EmuZ80Run(Cpu.Intel8080, Optimiza
|
||||
override def inline: Boolean = true
|
||||
}
|
||||
|
||||
object EmuOptimizedInlinedIntel8086Run extends EmuI86Run(OptimizationPresets.NodeOpt, Z80OptimizationPresets.GoodForIntel8080) {
|
||||
override def inline: Boolean = true
|
||||
}
|
||||
|
||||
object EmuOptimizedInlinedSharpRun extends EmuZ80Run(Cpu.Sharp, OptimizationPresets.NodeOpt, Z80OptimizationPresets.GoodForSharp) {
|
||||
override def inline: Boolean = true
|
||||
}
|
||||
|
||||
@@ -71,6 +71,8 @@ object EmuSizeOptimizedZ80Run extends EmuZ80Run(Cpu.Z80, OptimizationPresets.Nod
|
||||
|
||||
object EmuOptimizedIntel8080Run extends EmuZ80Run(Cpu.Intel8080, OptimizationPresets.NodeOpt, Z80OptimizationPresets.GoodForIntel8080)
|
||||
|
||||
object EmuOptimizedIntel8086Run extends EmuI86Run(OptimizationPresets.NodeOpt, Z80OptimizationPresets.GoodForIntel8080)
|
||||
|
||||
object EmuSizeOptimizedIntel8080Run extends EmuZ80Run(Cpu.Intel8080, OptimizationPresets.NodeOpt, Z80OptimizationPresets.GoodForIntel8080) {
|
||||
override def optimizeForSize = true
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ object EmuPlatform {
|
||||
TextCodec.Ascii,
|
||||
Platform.builtInCpuFeatures(cpu),
|
||||
CurrentBankFragmentOutput(0, 0xffff),
|
||||
Map("default" -> new UpwardByteAllocator(0x200, 0xb000)),
|
||||
Map("default" -> (if (cpu == Cpu.Intel8086) new UpwardByteAllocator(0x100, 0xb000) else new UpwardByteAllocator(0x200, 0xb000))),
|
||||
Map("default" -> new VariableAllocator(
|
||||
if (CpuFamily.forType(cpu) == CpuFamily.M6502) pointers else Nil,
|
||||
new AfterCodeByteAllocator(0xff00))),
|
||||
|
||||
@@ -14,6 +14,7 @@ object EmuUnoptimizedCrossPlatformRun {
|
||||
val (_, mz) = if (platforms.contains(Cpu.Z80)) EmuUnoptimizedZ80Run.apply2(source) else Timings(-1, -1) -> null
|
||||
val (_, mi) = if (platforms.contains(Cpu.Intel8080)) EmuUnoptimizedIntel8080Run.apply2(source) else Timings(-1, -1) -> null
|
||||
val (_, ms) = if (platforms.contains(Cpu.Sharp)) EmuUnoptimizedSharpRun.apply2(source) else Timings(-1, -1) -> null
|
||||
val (_, mx) = if (Settings.enableIntel8086Tests && platforms.contains(Cpu.Intel8086)) EmuUnoptimizedIntel8086Run.apply2(source) else Timings(-1, -1) -> null
|
||||
if (platforms.contains(Cpu.Mos)) {
|
||||
println(f"Running 6502")
|
||||
verifier(mm)
|
||||
@@ -38,5 +39,9 @@ object EmuUnoptimizedCrossPlatformRun {
|
||||
println(f"Running LR35902")
|
||||
verifier(ms)
|
||||
}
|
||||
if (Settings.enableIntel8086Tests && platforms.contains(Cpu.Intel8086)) {
|
||||
println(f"Running 8086")
|
||||
verifier(mx)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,4 +20,6 @@ object EmuUnoptimizedZ80Run extends EmuZ80Run(Cpu.Z80, Nil, Nil)
|
||||
|
||||
object EmuUnoptimizedIntel8080Run extends EmuZ80Run(Cpu.Intel8080, Nil, Nil)
|
||||
|
||||
object EmuUnoptimizedIntel8086Run extends EmuI86Run(Nil, Nil)
|
||||
|
||||
object EmuUnoptimizedSharpRun extends EmuZ80Run(Cpu.Sharp, Nil, Nil)
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package millfork.test.emu
|
||||
|
||||
/**
|
||||
* @author Karol Stasiak
|
||||
*/
|
||||
object Settings {
|
||||
|
||||
/**
|
||||
* Should the Intel 8086 tests be enabled?
|
||||
* Intel 8086 tests:
|
||||
* - are slow
|
||||
* - don't work on headless JRE's
|
||||
* – open annoying windows on graphical JRE's
|
||||
* – test only the 8080-to-8086 translation
|
||||
* – are of low priority
|
||||
* so they are disabled by default
|
||||
*/
|
||||
val enableIntel8086Tests: Boolean = false
|
||||
|
||||
/**
|
||||
* Should the WDC65816 tests be enabled?
|
||||
* WDC65816 tests:
|
||||
* - are slow
|
||||
* - require Nashorn
|
||||
* – are of low priority
|
||||
* so they are disabled by default
|
||||
*/
|
||||
val enableWdc85816Tests: Boolean = false
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user