mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2025-04-04 05:30:25 +00:00
but both addresses
This commit is contained in:
parent
812475c07e
commit
405a6d5b5f
@ -1,3 +0,0 @@
|
||||
package com.htmlism.scratchpad
|
||||
|
||||
case class AbsoluteAddress(n: Int)
|
@ -1,3 +0,0 @@
|
||||
package com.htmlism.scratchpad
|
||||
|
||||
case class ZeroPageAddress(n: Int)
|
@ -1,17 +1,22 @@
|
||||
package com.htmlism.scratchpad
|
||||
|
||||
case class ZeroPageAddress(n: Int, alias: String)
|
||||
sealed trait Address:
|
||||
def n: Int
|
||||
|
||||
case class GlobalAddress(n: Int, alias: String)
|
||||
def alias: String
|
||||
|
||||
sealed trait ReadAddress:
|
||||
def addr: ZeroPageAddress
|
||||
case class ZeroPageAddress(n: Int, alias: String) extends Address
|
||||
|
||||
sealed trait WriteAddress:
|
||||
def addr: ZeroPageAddress
|
||||
case class AbsoluteAddress(n: Int, alias: String) extends Address
|
||||
|
||||
case class Volatile(addr: ZeroPageAddress) extends ReadAddress
|
||||
sealed trait ReadAddress[A <: Address]:
|
||||
def addr: A
|
||||
|
||||
case class ReadWriteAddress(addr: ZeroPageAddress) extends ReadAddress with WriteAddress
|
||||
sealed trait WriteAddress[A <: Address]:
|
||||
def addr: A
|
||||
|
||||
case class WriteOnlyAddress(addr: ZeroPageAddress) extends WriteAddress
|
||||
case class Volatile[A <: Address](addr: A) extends ReadAddress[A]
|
||||
|
||||
case class ReadWriteAddress[A <: Address](addr: A) extends ReadAddress[A] with WriteAddress[A]
|
||||
|
||||
case class WriteOnlyAddress[A <: Address](addr: A) extends WriteAddress[A]
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.htmlism.scratchpad
|
||||
|
||||
package object syntax:
|
||||
implicit class WriteRegisterOps(reg: WriteAddress):
|
||||
def write[A: Loadable](x: A): PartiallyAppliedWrite[A] =
|
||||
implicit class WriteRegisterOps[B <: Address](reg: WriteAddress[B]):
|
||||
def write[A: Loadable](x: A): PartiallyAppliedWrite[A, B] =
|
||||
new PartiallyAppliedWrite(reg, x)
|
||||
|
||||
class PartiallyAppliedWrite[A: Loadable](reg: WriteAddress, x: A):
|
||||
class PartiallyAppliedWrite[A: Loadable, B <: Address](reg: WriteAddress[B], x: A):
|
||||
def apply[B: Register]: String =
|
||||
val literal =
|
||||
summon[Loadable[A]].show(x)
|
||||
|
Loading…
x
Reference in New Issue
Block a user