mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2024-06-26 01:29:31 +00:00
make instructions more obvious
This commit is contained in:
parent
6199265f26
commit
556c60eccc
|
@ -0,0 +1,11 @@
|
|||
package com.htmlism
|
||||
|
||||
package object scratchpad:
|
||||
type A =
|
||||
Register.A
|
||||
|
||||
type X =
|
||||
Register.X
|
||||
|
||||
type Y =
|
||||
Register.Y
|
|
@ -7,4 +7,10 @@ package object syntax:
|
|||
|
||||
class PartiallyAppliedWrite[A: Loadable](reg: WriteAddress, x: A):
|
||||
def apply[B: Register]: String =
|
||||
reg.addr.n.toString + summon[Loadable[A]].show(x) + summon[Register[B]].self
|
||||
val first =
|
||||
"LD" + summon[Register[B]].self + " " + summon[Loadable[A]].show(x)
|
||||
|
||||
val second =
|
||||
"ST" + summon[Register[B]].self + " " + reg.addr.n.toString
|
||||
|
||||
first + " " + second
|
||||
|
|
|
@ -8,21 +8,21 @@ import com.htmlism.scratchpad.syntax._
|
|||
class FeatureSpec extends AnyFunSuite with Matchers:
|
||||
test("zero page address as write only supports writing") {
|
||||
WriteOnlyAddress(Address.zero(0x01))
|
||||
.write(2)[Register.A] shouldBe "12A"
|
||||
.write(2)[A] shouldBe "LDA 2 STA 1"
|
||||
}
|
||||
|
||||
test("zero page address as read/write supports writing") {
|
||||
ReadWriteAddress(Address.zero(0x01))
|
||||
.write(2)[Register.A] shouldBe "12A"
|
||||
.write(2)[A] shouldBe "LDA 2 STA 1"
|
||||
}
|
||||
|
||||
test("writing to an address can use A, X, and Y registers for bouncing ") {
|
||||
ReadWriteAddress(Address.zero(0x01))
|
||||
.write(2)[Register.A] shouldBe "12A"
|
||||
.write(2)[A] shouldBe "LDA 2 STA 1"
|
||||
|
||||
ReadWriteAddress(Address.zero(0x01))
|
||||
.write(2)[Register.X] shouldBe "12X"
|
||||
.write(2)[X] shouldBe "LDX 2 STX 1"
|
||||
|
||||
ReadWriteAddress(Address.zero(0x01))
|
||||
.write(2)[Register.Y] shouldBe "12Y"
|
||||
.write(2)[Y] shouldBe "LDY 2 STY 1"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user