6502-opcodes/nescant/src/main/scala/com/htmlism/nescant/VolatileDevice.scala
2023-06-19 05:33:43 -04:00

23 lines
680 B
Scala

package com.htmlism.nescant
//import com.htmlism.mos6502.model._
/**
* For a memory-mapped device that may return different values across multiple reads (e.g. a random number generator)
*
* @param name
* A name for this device, used to alias its address
*
* @tparam A
* The output type of the read
*/
case class VolatileDevice[A](name: String, address: ZeroPageAddress)
object VolatileDevice:
given sourceForVolatileDevice[A]: ByteSource[VolatileDevice[A]] =
new ByteSource[VolatileDevice[A]] {}
given operandForVolatileDevice[A]: Operand[VolatileDevice[A]] =
new Operand[VolatileDevice[A]]:
def encode(x: VolatileDevice[A]): String = ""