diff --git a/src/main/scala/com/htmlism/mos6502/dsl/AsmDocumentContext.scala b/src/main/scala/com/htmlism/mos6502/dsl/AsmDocumentContext.scala
index 6667880..a195112 100644
--- a/src/main/scala/com/htmlism/mos6502/dsl/AsmDocumentContext.scala
+++ b/src/main/scala/com/htmlism/mos6502/dsl/AsmDocumentContext.scala
@@ -25,7 +25,7 @@ class AsmDocumentContext {
def toDoc: AsmDocument = {
val asmFragmentsAndSubroutines =
- xs.toList ::: jumps.toList ++ jumps.flatMap(_.jumpRegistry).toList
+ xs.toList ::: jumps.toList ++ jumps.flatMap(_.jumpRegistry).toList
AsmDocument(asmFragmentsAndSubroutines)
}
@@ -40,7 +40,8 @@ case class AsmFragment(xs: List[Statement]) extends TopLevelAsmDocumentFragment
xs.map(_.toAsm).mkString("\n")
}
-case class Subroutine(name: String, fragment: AsmFragment, jumpRegistry: ListSet[Subroutine]) extends TopLevelAsmDocumentFragment {
+case class Subroutine(name: String, fragment: AsmFragment, jumpRegistry: ListSet[Subroutine])
+ extends TopLevelAsmDocumentFragment {
def toAsm: String =
name + ":" + "\n" + fragment.toAsm
}
diff --git a/src/main/scala/com/htmlism/mos6502/dsl/RangeSpec.scala b/src/main/scala/com/htmlism/mos6502/dsl/RangeSpec.scala
index ca95c1a..0ad9184 100644
--- a/src/main/scala/com/htmlism/mos6502/dsl/RangeSpec.scala
+++ b/src/main/scala/com/htmlism/mos6502/dsl/RangeSpec.scala
@@ -8,4 +8,4 @@ sealed trait RangeSpec {
case class Incrementing(from: Int, to: Int) extends RangeSpec
-case class Decrementing(from: Int, to: Int) extends RangeSpec
\ No newline at end of file
+case class Decrementing(from: Int, to: Int) extends RangeSpec
diff --git a/src/test/scala/com/htmlism/mos6502/dsl/DslSpec.scala b/src/test/scala/com/htmlism/mos6502/dsl/DslSpec.scala
index 63f27dc..f25095d 100644
--- a/src/test/scala/com/htmlism/mos6502/dsl/DslSpec.scala
+++ b/src/test/scala/com/htmlism/mos6502/dsl/DslSpec.scala
@@ -88,7 +88,7 @@ class DslSpec extends AnyFlatSpec with should.Matchers {
"bit field" should "compile" in {
val doc =
asmDoc { implicit ctx =>
- bitField[Direction]
+ bitField[TestDirection]
}
doc shouldEqual AsmDocument(
@@ -109,7 +109,7 @@ class DslSpec extends AnyFlatSpec with should.Matchers {
"mapping" should "compile" in {
val doc =
asmDoc { implicit ctx =>
- mapping[Direction]
+ mapping[TestDirection]
}
doc shouldEqual AsmDocument(
@@ -170,38 +170,38 @@ object Triforce {
}
}
-sealed trait Direction
+sealed trait TestDirection
-case object Up extends Direction
-case object Down extends Direction
-case object Left extends Direction
-case object Right extends Direction
+case object Up extends TestDirection
+case object Down extends TestDirection
+case object Left extends TestDirection
+case object Right extends TestDirection
-object Direction {
- implicit val bitFieldDirection: BitField[Direction] =
- new BitField[Direction] {
+object TestDirection {
+ implicit val bitFieldDirection: BitField[TestDirection] =
+ new BitField[TestDirection] {
def comment: String =
"foo as bit field"
- def all: NonEmptyList[Direction] =
+ def all: NonEmptyList[TestDirection] =
NonEmptyList.of(Up, Down, Left, Right)
- def label(x: Direction): String =
+ def label(x: TestDirection): String =
x.toString.toLowerCase
- def comment(x: Direction): String =
+ def comment(x: TestDirection): String =
x.toString
}
- implicit val mappingDirection: Mapping[Direction] =
- new Mapping[Direction] {
+ implicit val mappingDirection: Mapping[TestDirection] =
+ new Mapping[TestDirection] {
def comment: String =
"foo as a mapping"
- def all: NonEmptyList[Direction] =
+ def all: NonEmptyList[TestDirection] =
NonEmptyList.of(Up, Down, Left, Right)
- def value(x: Direction): Int =
+ def value(x: TestDirection): Int =
x match {
case Up => 0x77
case Down => 0x61
@@ -209,10 +209,10 @@ object Direction {
case Right => 0x64
}
- def label(x: Direction): String =
+ def label(x: TestDirection): String =
x.toString.toLowerCase
- def comment(x: Direction): String =
+ def comment(x: TestDirection): String =
x.toString
}
}
diff --git a/src/test/scala/com/htmlism/mos6502/dsl/Easy6502Spec.scala b/src/test/scala/com/htmlism/mos6502/dsl/snake/Easy6502Spec.scala
similarity index 97%
rename from src/test/scala/com/htmlism/mos6502/dsl/Easy6502Spec.scala
rename to src/test/scala/com/htmlism/mos6502/dsl/snake/Easy6502Spec.scala
index 2ab110c..1acbe37 100644
--- a/src/test/scala/com/htmlism/mos6502/dsl/Easy6502Spec.scala
+++ b/src/test/scala/com/htmlism/mos6502/dsl/snake/Easy6502Spec.scala
@@ -1,4 +1,5 @@
package com.htmlism.mos6502.dsl
+package snake
import cats.implicits._
import org.scalatest.flatspec._
@@ -125,6 +126,9 @@ class Easy6502Spec extends AnyFlatSpec with should.Matchers {
val doc =
asmDoc { implicit ctx =>
+ bitField[Direction]
+ mapping[AsciiValue]
+
asm { implicit a =>
jump(init)
jump(loop)