mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2024-06-26 01:29:31 +00:00
as name
This commit is contained in:
parent
0cdfef323f
commit
f2fba577b6
|
@ -1,17 +1,17 @@
|
||||||
package com.htmlism.scratchpad
|
package com.htmlism.scratchpad
|
||||||
|
|
||||||
sealed trait Register[A]:
|
sealed trait Register[A]:
|
||||||
def self: String
|
def name: String
|
||||||
|
|
||||||
object Register:
|
object Register:
|
||||||
given registerA: Register[A] with
|
given registerA: Register[A] with
|
||||||
def self: String = "A"
|
def name: String = "A"
|
||||||
|
|
||||||
given registerX: Register[X] with
|
given registerX: Register[X] with
|
||||||
def self: String = "X"
|
def name: String = "X"
|
||||||
|
|
||||||
given registerY: Register[Y] with
|
given registerY: Register[Y] with
|
||||||
def self: String = "Y"
|
def name: String = "Y"
|
||||||
|
|
||||||
object A:
|
object A:
|
||||||
given loadA: Load[A] with
|
given loadA: Load[A] with
|
||||||
|
|
|
@ -14,7 +14,7 @@ package object syntax:
|
||||||
summon[Loadable[Addr]].show(x)
|
summon[Loadable[Addr]].show(x)
|
||||||
|
|
||||||
val register =
|
val register =
|
||||||
summon[Register[R]].self
|
summon[Register[R]].name
|
||||||
|
|
||||||
val loadInstruction =
|
val loadInstruction =
|
||||||
Load[R].instruction // TODO load action needs to interact with encoder
|
Load[R].instruction // TODO load action needs to interact with encoder
|
||||||
|
|
|
@ -7,13 +7,13 @@ object RegisterSuite extends FunSuite:
|
||||||
ev
|
ev
|
||||||
|
|
||||||
test("the accumulator is a register") {
|
test("the accumulator is a register") {
|
||||||
expect.eql("A", reg[A].self)
|
expect.eql("A", reg[A].name)
|
||||||
}
|
}
|
||||||
|
|
||||||
test("X is a register") {
|
test("X is a register") {
|
||||||
expect.eql("X", reg[X].self)
|
expect.eql("X", reg[X].name)
|
||||||
}
|
}
|
||||||
|
|
||||||
test("Y is a register") {
|
test("Y is a register") {
|
||||||
expect.eql("Y", reg[Y].self)
|
expect.eql("Y", reg[Y].name)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user