Compare commits

...

2 Commits

Author SHA1 Message Date
Mark Canlas
7120b60ae7 add cpu module 2024-01-03 15:43:19 -05:00
Mark Canlas
2cf829d3eb closer together 2024-01-03 14:34:31 -05:00
2 changed files with 8 additions and 2 deletions

View File

@ -3,7 +3,7 @@ lazy val firepower =
.in(file(".")) .in(file("."))
.withCats .withCats
.withTesting .withTesting
.aggregate(nescant, core, demo) .aggregate(nescant, core, cpu, demo)
lazy val nescant = lazy val nescant =
project.withCats.withTesting project.withCats.withTesting
@ -13,6 +13,11 @@ lazy val core =
.withCats .withCats
.withTesting .withTesting
lazy val cpu =
module("cpu")
.settings(description := "CPU emulation suitable for unit testing")
.withTesting
lazy val demo = lazy val demo =
module("demo") module("demo")
.dependsOn(core) .dependsOn(core)

View File

@ -6,6 +6,7 @@ import cats.syntax.all.*
import com.htmlism.mos6502.model.* import com.htmlism.mos6502.model.*
// sbt "runMain com.htmlism.MatchOpcodes out.html" && open out.html
object MatchOpcodes: object MatchOpcodes:
def paddedBinary(n: Int, width: Int) = def paddedBinary(n: Int, width: Int) =
String.format(s"%${width}s", Integer.toBinaryString(n)).replace(" ", "0") String.format(s"%${width}s", Integer.toBinaryString(n)).replace(" ", "0")
@ -172,8 +173,8 @@ object MatchOpcodes:
val columns = val columns =
for for
y <- 0 to 1 y <- 0 to 1
z <- List(1, 0)
x <- 0 to 1 x <- 0 to 1
z <- 0 to 1
yield (z << 2) + (x << 1) + y yield (z << 2) + (x << 1) + y
val rows = val rows =