store w instruction

This commit is contained in:
Mark Canlas 2022-10-19 12:53:55 -07:00
parent 021fb3b2e8
commit 159fd422fc
4 changed files with 14 additions and 5 deletions

View File

@ -47,5 +47,14 @@ case class R[A]()
// TODO needs evidence that it is a storable target of one thing
case class StoreTo[A: Store, B]() extends Asm2[A, B]:
// TODO
def xs: List[String] =
Nil
case class LoadImmediate[R: Load, A: ImmediateValue]() extends Asm1[R]:
// TODO
def xs: List[String] =
Nil
trait ImmediateValue[A]:
def toByte(x: A): Int

View File

@ -19,7 +19,7 @@ object Register:
"LDA"
given storeA: Store[A] with
def to: String =
def instruction: String =
"STA"
class A
@ -30,7 +30,7 @@ object Register:
"LDX"
given storeX: Store[X] with
def to: String =
def instruction: String =
"STX"
class X
@ -41,7 +41,7 @@ object Register:
"LDY"
given storeY: Store[Y] with
def to: String =
def instruction: String =
"STY"
class Y

View File

@ -1,7 +1,7 @@
package com.htmlism.scratchpad
trait Store[A]:
def to: String
def instruction: String
object Store:
def apply[A: Store]: Store[A] =

View File

@ -20,7 +20,7 @@ package object syntax:
Load[R].instruction // TODO load action needs to interact with encoder
val storeInstruction =
Store[R].to // TODO store action needs to interact with encoder
Store[R].instruction // TODO store action needs to interact with encoder
val first =
s"$loadInstruction $literal"