mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2025-01-15 09:29:51 +00:00
use semantic store class
This commit is contained in:
parent
167705f625
commit
021fb3b2e8
@ -44,3 +44,8 @@ case class AndThen2[A, B](x: Asm2[A, B], y: Asm2[A, B]) extends Asm2[A, B]:
|
||||
x.xs ++ y.xs
|
||||
|
||||
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]:
|
||||
def xs: List[String] =
|
||||
Nil
|
||||
|
@ -5,16 +5,8 @@ package object syntax:
|
||||
def writeConst[A: Loadable](x: A): syntax.PartiallyAppliedWrite[A, Addr] =
|
||||
new syntax.PartiallyAppliedWrite(reg, x)
|
||||
|
||||
def writeFrom[R: Store]: Asm2Instructions[R, Addr] =
|
||||
val storeInstruction =
|
||||
Store[R].to
|
||||
|
||||
val storeStr =
|
||||
s"$storeInstruction ${reg.n.toString}"
|
||||
|
||||
// TODO encoding now already makes the structures lose semantic meaning
|
||||
// TODO maybe AsmN's should be traits such that semantic structures can just obey the contracts and be AND'ed
|
||||
Asm2Instructions(List(s"$storeInstruction ${reg.n.toString}"))
|
||||
def writeFrom[R: Store]: Asm2[R, Addr] =
|
||||
StoreTo[R, Addr]()
|
||||
|
||||
class PartiallyAppliedWrite[Addr: Loadable, A](reg: WriteAddress[A], x: Addr):
|
||||
def apply[R: Load: Store: Register]: String =
|
||||
|
Loading…
x
Reference in New Issue
Block a user