more definitions

This commit is contained in:
Mark Canlas 2020-08-26 02:24:09 -04:00
parent 87213fd0a4
commit cf9e1f63b0
4 changed files with 8 additions and 6 deletions

View File

@ -53,7 +53,7 @@ case class DefinitionGroup(comment: String, xs: List[Definition[_]]) extends Top
val definitionLines =
xs
.map(d => f"define ${d.name}%-12s${d.value}")
.map(d => f"define ${d.name}%-20s${d.value}")
(commentLine :: definitionLines)
.mkString("\n")

View File

@ -7,7 +7,7 @@ package com.htmlism.mos6502.dsl
*
* @tparam A The input type of the write and the output type of the read
*/
case class ReadWriteLocation[A](name: String, address: Address) {
case class ReadWriteLocation[A](name: String, address: ZeroAddress) {
def read(implicit ctx: AssemblyContext): Unit = {
val _ = ctx
// ctx.push(LDA, ev, s"write ${ev.toShow(x)} to $name ($n)")
@ -24,7 +24,7 @@ object ReadWriteLocation {
new Definable[ReadWriteLocation[A]] {
def toDefinitions(x: ReadWriteLocation[A]): List[Definition[ZeroAddress]] =
List {
Definition(x.name, 0x00.z)
Definition(x.name, x.address)
}
}
}

View File

@ -9,7 +9,7 @@ package com.htmlism.mos6502.dsl
*
* @tparam A The return type of the read
*/
case class VolatileDevice[A](name: String, address: Address) {
case class VolatileDevice[A](name: String, address: ZeroAddress) {
def read(implicit ctx: AssemblyContext): Unit = {
val _ = ctx
// ctx.push(LDA, ev, s"write ${ev.toShow(x)} to $name ($n)")
@ -21,7 +21,7 @@ object VolatileDevice {
new Definable[VolatileDevice[A]] {
def toDefinitions(x: VolatileDevice[A]): List[Definition[ZeroAddress]] =
List {
Definition(x.name, 0x00.z)
Definition(x.name, x.address)
}
}
}

View File

@ -141,7 +141,9 @@ class Easy6502Spec extends AnyFlatSpec with should.Matchers {
}
group("snake") { implicit g =>
val _ = g
g.push(appleLocation)
g.push(snakeDirection)
g.push(snakeLength)
}
bitField[Direction]