diff --git a/scratchpad/src/main/scala/com/htmlism/scratchpad/Register.scala b/scratchpad/src/main/scala/com/htmlism/scratchpad/Register.scala
index 0001497..648c4be 100644
--- a/scratchpad/src/main/scala/com/htmlism/scratchpad/Register.scala
+++ b/scratchpad/src/main/scala/com/htmlism/scratchpad/Register.scala
@@ -1,47 +1,25 @@
package com.htmlism.scratchpad
+// on the 6502, every register of this kind can store and load; so that capability was not parceled out into traits
+// (unlike read/write leases)
sealed trait Register[A]:
def name: String
object Register:
- given registerA: Register[A] with
- def name: String = "A"
-
- given registerX: Register[X] with
- def name: String = "X"
-
- given registerY: Register[Y] with
- def name: String = "Y"
-
object A:
- given loadA: Load[A] with
- def instruction: String =
- "LDA"
-
- given storeA: Store[A] with
- def instruction: String =
- "STA"
+ given registerA: Register[A] with
+ def name: String = "A"
class A
object X:
- given loadX: Load[X] with
- def instruction: String =
- "LDX"
-
- given storeX: Store[X] with
- def instruction: String =
- "STX"
+ given registerX: Register[X] with
+ def name: String = "X"
class X
object Y:
- given loadY: Load[Y] with
- def instruction: String =
- "LDY"
-
- given storeY: Store[Y] with
- def instruction: String =
- "STY"
+ given registerY: Register[Y] with
+ def name: String = "Y"
class Y
diff --git a/scratchpad/src/main/scala/com/htmlism/scratchpad/Store.scala b/scratchpad/src/main/scala/com/htmlism/scratchpad/Store.scala
deleted file mode 100644
index 435c169..0000000
--- a/scratchpad/src/main/scala/com/htmlism/scratchpad/Store.scala
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.htmlism.scratchpad
-
-trait Store[A]:
- def instruction: String
-
-object Store:
- def apply[A: Store]: Store[A] =
- summon[Store[A]]
diff --git a/scratchpad/src/main/scala/com/htmlism/scratchpad/Load.scala b/scratchpad/src/main/scala/com/htmlism/scratchpad/asm.scala
similarity index 70%
rename from scratchpad/src/main/scala/com/htmlism/scratchpad/Load.scala
rename to scratchpad/src/main/scala/com/htmlism/scratchpad/asm.scala
index 7c1d21a..9f2dc81 100644
--- a/scratchpad/src/main/scala/com/htmlism/scratchpad/Load.scala
+++ b/scratchpad/src/main/scala/com/htmlism/scratchpad/asm.scala
@@ -1,21 +1,5 @@
package com.htmlism.scratchpad
-trait Load[A]:
- // TODO genericize to take in encoder
- // from constant
- def instruction: String
-
- def const: Asm1Instructions[A] =
- Asm1Instructions(List(instruction))
-
- // from register
- def from[B <: Address: ReadByteAddress]: Asm2Instructions[A, B] =
- Asm2Instructions(List(instruction))
-
-object Load:
- def apply[A: Load]: Load[A] =
- summon[Load[A]]
-
trait Asm1[A]:
def xs: List[String]
@@ -51,12 +35,12 @@ case class Asm3Instructions[A, B, C](xs: List[String]) extends Asm3[A, B, C]
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]:
+case class StoreTo[A: Register, B]() extends Asm2[A, B]:
// TODO
def xs: List[String] =
Nil
-case class LoadImmediate[R: Load, A: ImmediateValue]() extends Asm1[R]:
+case class LoadImmediate[R: Register, A: ImmediateValue]() extends Asm1[R]:
// TODO
def xs: List[String] =
Nil
diff --git a/scratchpad/src/main/scala/com/htmlism/scratchpad/syntax/package.scala b/scratchpad/src/main/scala/com/htmlism/scratchpad/syntax/package.scala
index e22c06c..01e5a24 100644
--- a/scratchpad/src/main/scala/com/htmlism/scratchpad/syntax/package.scala
+++ b/scratchpad/src/main/scala/com/htmlism/scratchpad/syntax/package.scala
@@ -5,11 +5,11 @@ package object syntax:
def writeConst[A: Loadable](x: A): syntax.PartiallyAppliedWrite[A, Addr] =
new syntax.PartiallyAppliedWrite(reg, x)
- def writeFrom[R: Store]: Asm2[R, Addr] =
+ def writeFrom[R: Register]: Asm2[R, Addr] =
StoreTo[R, Addr]()
class PartiallyAppliedWrite[Addr: Loadable, A](reg: WriteByteAddress[A], x: Addr):
- def apply[R: Load: Store: Register]: String =
+ def apply[R: Register]: String =
val literal =
summon[Loadable[Addr]].show(x)
@@ -17,10 +17,10 @@ package object syntax:
summon[Register[R]].name
val loadInstruction =
- Load[R].instruction // TODO load action needs to interact with encoder
+ "LD" + register // TODO load action needs to interact with encoder
val storeInstruction =
- Store[R].instruction // TODO store action needs to interact with encoder
+ "ST" + register // TODO store action needs to interact with encoder
val first =
s"$loadInstruction $literal"