mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2025-01-24 06:29:58 +00:00
add missing files
This commit is contained in:
parent
92af2e7d8a
commit
b0e40b3e36
@ -0,0 +1,36 @@
|
||||
package com.htmlism.mos6502.dsl
|
||||
package snake
|
||||
|
||||
import cats.data.NonEmptyList
|
||||
|
||||
object AsciiValue {
|
||||
implicit val asciiValueMapping: Mapping[AsciiValue] =
|
||||
new Mapping[AsciiValue] {
|
||||
def comment: String =
|
||||
"foo as a mapping"
|
||||
|
||||
def all: NonEmptyList[AsciiValue] =
|
||||
NonEmptyList.of(AsciiW, AsciiA, AsciiS, AsciiD)
|
||||
|
||||
def value(x: AsciiValue): Int =
|
||||
x match {
|
||||
case AsciiW => 0x77
|
||||
case AsciiA => 0x61
|
||||
case AsciiS => 0x73
|
||||
case AsciiD => 0x64
|
||||
}
|
||||
|
||||
def label(x: AsciiValue): String =
|
||||
x.toString.toLowerCase
|
||||
|
||||
def comment(x: AsciiValue): String =
|
||||
x.toString
|
||||
}
|
||||
}
|
||||
|
||||
sealed trait AsciiValue
|
||||
|
||||
case object AsciiW extends AsciiValue
|
||||
case object AsciiA extends AsciiValue
|
||||
case object AsciiS extends AsciiValue
|
||||
case object AsciiD extends AsciiValue
|
28
src/test/scala/com/htmlism/mos6502/dsl/snake/Direction.scala
Normal file
28
src/test/scala/com/htmlism/mos6502/dsl/snake/Direction.scala
Normal file
@ -0,0 +1,28 @@
|
||||
package com.htmlism.mos6502.dsl
|
||||
package snake
|
||||
|
||||
import cats.data.NonEmptyList
|
||||
|
||||
object Direction {
|
||||
implicit val directionBitField: BitField[Direction] =
|
||||
new BitField[Direction] {
|
||||
def comment: String =
|
||||
"foo as bit field"
|
||||
|
||||
def all: NonEmptyList[Direction] =
|
||||
NonEmptyList.of(Up, Down, Left, Right)
|
||||
|
||||
def label(x: Direction): String =
|
||||
"moving" + x.toString
|
||||
|
||||
def comment(x: Direction): String =
|
||||
x.toString
|
||||
}
|
||||
}
|
||||
|
||||
sealed trait Direction
|
||||
|
||||
case object Up extends Direction
|
||||
case object Down extends Direction
|
||||
case object Left extends Direction
|
||||
case object Right extends Direction
|
Loading…
x
Reference in New Issue
Block a user