mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2024-09-29 18:57:10 +00:00
Compare commits
3 Commits
71041e8f0d
...
96c544e4d5
Author | SHA1 | Date | |
---|---|---|---|
|
96c544e4d5 | ||
|
42a3df32a4 | ||
|
f6fb9546c7 |
@ -27,5 +27,4 @@ lazy val demo =
|
|||||||
.withResolver("rufio")
|
.withResolver("rufio")
|
||||||
|
|
||||||
lazy val playground =
|
lazy val playground =
|
||||||
module("playground")
|
module("playground").withCats
|
||||||
.withCats
|
|
||||||
|
@ -18,13 +18,15 @@ class FeatureSpec extends AnyFunSuite with Matchers:
|
|||||||
ExampleRegister
|
ExampleRegister
|
||||||
.writeConst(2)[Reg.A] shouldBe "LDA 2 STA 1 ; example = 2, via A"
|
.writeConst(2)[Reg.A] shouldBe "LDA 2 STA 1 ; example = 2, via A"
|
||||||
|
|
||||||
test("writing to an address can use A, X, and Y registers for bouncing"):
|
test("writing to an address can use A registers for bouncing"):
|
||||||
ExampleRegister
|
ExampleRegister
|
||||||
.writeConst(2)[Reg.A] shouldBe "LDA 2 STA 1 ; example = 2, via A"
|
.writeConst(2)[Reg.A] shouldBe "LDA 2 STA 1 ; example = 2, via A"
|
||||||
|
|
||||||
|
test("writing to an address can use X registers for bouncing"):
|
||||||
ExampleRegister
|
ExampleRegister
|
||||||
.writeConst(2)[Reg.X] shouldBe "LDX 2 STX 1 ; example = 2, via X"
|
.writeConst(2)[Reg.X] shouldBe "LDX 2 STX 1 ; example = 2, via X"
|
||||||
|
|
||||||
|
test("writing to an address can use Y registers for bouncing"):
|
||||||
ExampleRegister
|
ExampleRegister
|
||||||
.writeConst(2)[Reg.Y] shouldBe "LDY 2 STY 1 ; example = 2, via Y"
|
.writeConst(2)[Reg.Y] shouldBe "LDY 2 STY 1 ; example = 2, via Y"
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ trait AsmDocSyntax:
|
|||||||
ctx
|
ctx
|
||||||
.push(asmCtx.toFragment)
|
.push(asmCtx.toFragment)
|
||||||
|
|
||||||
def group[A](s: String)(f: DefinitionGroupContext => A)(using ctx: AsmDocumentContext): Unit =
|
def group(s: String)(f: DefinitionGroupContext => Unit)(using ctx: AsmDocumentContext): Unit =
|
||||||
val g: DefinitionGroupContext =
|
val g: DefinitionGroupContext =
|
||||||
new DefinitionGroupContext
|
new DefinitionGroupContext
|
||||||
|
|
||||||
|
@ -11,11 +11,6 @@ trait DefinitionGroupSyntax:
|
|||||||
|
|
||||||
definition
|
definition
|
||||||
|
|
||||||
def constant(name: String, x: Int)(using ctx: DefinitionGroupContext): Definition[Int] =
|
def constant(name: String, x: Int)(using ctx: DefinitionGroupContext): Unit =
|
||||||
val definition =
|
|
||||||
Definition(name, x)
|
|
||||||
|
|
||||||
ctx
|
ctx
|
||||||
.push(Definition(name, x))
|
.push(Definition(name, x))
|
||||||
|
|
||||||
definition
|
|
||||||
|
@ -10,7 +10,8 @@ class DslSpec extends AnyFlatSpec with should.Matchers:
|
|||||||
val doc =
|
val doc =
|
||||||
asmDoc { implicit ctx =>
|
asmDoc { implicit ctx =>
|
||||||
group("constants test") { implicit g =>
|
group("constants test") { implicit g =>
|
||||||
(constant("margin", 16), constant("secret", 42))
|
constant("margin", 16)
|
||||||
|
constant("secret", 42)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@ class Easy6502Spec extends AnyFlatSpec with should.Matchers:
|
|||||||
scr.write(2, Color.Orange)
|
scr.write(2, Color.Orange)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
doc.printOut()
|
||||||
|
|
||||||
doc.triplets shouldEqual List(
|
doc.triplets shouldEqual List(
|
||||||
("LDA", "#white".some, "write White to screen (0)".some),
|
("LDA", "#white".some, "write White to screen (0)".some),
|
||||||
("STA", "$0200".some, "".some),
|
("STA", "$0200".some, "".some),
|
||||||
@ -29,8 +31,6 @@ class Easy6502Spec extends AnyFlatSpec with should.Matchers:
|
|||||||
("STA", "$0202".some, "".some)
|
("STA", "$0202".some, "".some)
|
||||||
)
|
)
|
||||||
|
|
||||||
doc.printOut()
|
|
||||||
|
|
||||||
"define style dsl" should "compile" in:
|
"define style dsl" should "compile" in:
|
||||||
val doc =
|
val doc =
|
||||||
asmDoc { implicit ctx =>
|
asmDoc { implicit ctx =>
|
||||||
|
Loading…
Reference in New Issue
Block a user