mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2025-01-17 21:32:23 +00:00
wip
This commit is contained in:
parent
ffc0039d90
commit
0b7fb76f8a
@ -0,0 +1,8 @@
|
|||||||
|
package com.htmlism.scratchpad
|
||||||
|
|
||||||
|
trait Reg[A]:
|
||||||
|
def hello: Boolean
|
||||||
|
|
||||||
|
given tuple2reg[A, B](using a: Reg[A], b: Reg[B]): Reg[(A, B)] with
|
||||||
|
def hello: Boolean =
|
||||||
|
true
|
@ -17,18 +17,28 @@ object Write:
|
|||||||
implicit val writeLease: Lease[Write] =
|
implicit val writeLease: Lease[Write] =
|
||||||
new Lease { }
|
new Lease { }
|
||||||
|
|
||||||
class Reg[A]
|
|
||||||
|
|
||||||
object ScratchPad:
|
object ScratchPad:
|
||||||
|
def reg[A : Reg]: PartialUsing[A] =
|
||||||
|
new PartialUsing[A]
|
||||||
|
|
||||||
|
class PartialUsing[A](using a: Reg[A]):
|
||||||
|
def use[B](f: Reg[A] => B): B =
|
||||||
|
f(a)
|
||||||
|
|
||||||
|
reg[Accumulator].use { a =>
|
||||||
|
AsmProgram(startA, "")
|
||||||
|
.widen[RegisterX]
|
||||||
|
}
|
||||||
|
|
||||||
trait ReadWrite[A] extends Read[A] with Write[A]
|
trait ReadWrite[A] extends Read[A] with Write[A]
|
||||||
|
|
||||||
val startA =
|
lazy val startA =
|
||||||
??? : StatefulRegister[Accumulator, Unknown]
|
??? : StatefulRegister[Accumulator, Unknown]
|
||||||
|
|
||||||
val startX =
|
lazy val startX =
|
||||||
??? : StatefulRegister[RegisterX, Unknown]
|
??? : StatefulRegister[RegisterX, Unknown]
|
||||||
|
|
||||||
val startY =
|
lazy val startY =
|
||||||
??? : StatefulRegister[RegisterY, Unknown]
|
??? : StatefulRegister[RegisterY, Unknown]
|
||||||
|
|
||||||
(AsmProgram(startA, "") : AsmProgram[Accumulator, Unknown, String])
|
(AsmProgram(startA, "") : AsmProgram[Accumulator, Unknown, String])
|
||||||
@ -45,19 +55,20 @@ object ScratchPad:
|
|||||||
class Accumulator
|
class Accumulator
|
||||||
|
|
||||||
object Accumulator extends Accumulator:
|
object Accumulator extends Accumulator:
|
||||||
implicit val registerA: Reg[Accumulator] =
|
given registerA: Reg[Accumulator] with
|
||||||
new Reg
|
def hello: Boolean =
|
||||||
|
true
|
||||||
|
|
||||||
class RegisterX
|
class RegisterX
|
||||||
|
|
||||||
object RegisterX:
|
object RegisterX:
|
||||||
implicit val registerX: Reg[RegisterX] =
|
given registerX: Reg[RegisterX] with
|
||||||
new Reg
|
def hello: Boolean =
|
||||||
|
true
|
||||||
|
|
||||||
class RegisterY
|
class RegisterY
|
||||||
|
|
||||||
object RegisterY:
|
object RegisterY:
|
||||||
implicit val registerY: Reg[RegisterY] =
|
given registerY: Reg[RegisterY] with
|
||||||
new Reg
|
def hello: Boolean =
|
||||||
|
true
|
||||||
trait StatefulRegister[A : Reg, F <: MutationStatus]
|
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
package com.htmlism.scratchpad
|
||||||
|
|
||||||
|
|
||||||
|
trait StatefulRegister[A : Reg, F <: MutationStatus]
|
Loading…
x
Reference in New Issue
Block a user