mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2024-06-28 15:29:34 +00:00
do it
This commit is contained in:
parent
7216023708
commit
f221eacd42
|
@ -35,6 +35,13 @@ object DslDemo extends App {
|
||||||
A.add(0xc4)
|
A.add(0xc4)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// first color example
|
||||||
|
withAssemblyContext { implicit ctx =>
|
||||||
|
cpu.A = Color.White : Color
|
||||||
|
cpu.A = Color.Green : Color
|
||||||
|
cpu.A = Color.Orange : Color
|
||||||
|
}
|
||||||
|
|
||||||
def withAssemblyContext(f: AssemblyContext => Unit): Unit = {
|
def withAssemblyContext(f: AssemblyContext => Unit): Unit = {
|
||||||
val ctx: AssemblyContext =
|
val ctx: AssemblyContext =
|
||||||
new AssemblyContext
|
new AssemblyContext
|
||||||
|
@ -92,6 +99,13 @@ class CPU {
|
||||||
ctx.pushAsm(f"LDA #$$$n%h")
|
ctx.pushAsm(f"LDA #$$$n%h")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def A_=[A : EnumAsByte](x: A)(implicit ctx: AssemblyContext): Unit = {
|
||||||
|
val n = implicitly[EnumAsByte[A]].toByte(x)
|
||||||
|
|
||||||
|
ctx.describe(s"set a to value $n")
|
||||||
|
ctx.pushAsm(f"LDA #$$$n%h")
|
||||||
|
}
|
||||||
|
|
||||||
def A_=(reg: registers.DestinationA)(implicit ctx: AssemblyContext): Unit =
|
def A_=(reg: registers.DestinationA)(implicit ctx: AssemblyContext): Unit =
|
||||||
ctx.describe(s"set a to register $reg")
|
ctx.describe(s"set a to register $reg")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user