mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2025-01-23 00:32:19 +00:00
colors
This commit is contained in:
parent
fff78a4369
commit
7216023708
45
src/main/scala/com/htmlism/mos6502/dsl/Color.scala
Normal file
45
src/main/scala/com/htmlism/mos6502/dsl/Color.scala
Normal file
@ -0,0 +1,45 @@
|
||||
package com.htmlism.mos6502.dsl
|
||||
|
||||
sealed trait Color
|
||||
|
||||
object Color {
|
||||
implicit val ev: EnumAsByte[Color] =
|
||||
new EnumAsByte[Color] {
|
||||
def toByte(x: Color): Int =
|
||||
x match {
|
||||
case Black => 0x0
|
||||
case White => 0x1
|
||||
case Red => 0x2
|
||||
case Cyan => 0x3
|
||||
case Purple => 0x4
|
||||
case Green => 0x5
|
||||
case Blue => 0x6
|
||||
case Yellow => 0x7
|
||||
case Orange => 0x8
|
||||
case Brown => 0x9
|
||||
case LightRed => 0xA
|
||||
case DarkGrey => 0xB
|
||||
case Grey => 0xC
|
||||
case LightGreen => 0xD
|
||||
case LightBlue => 0xE
|
||||
case LightGrey => 0xF
|
||||
}
|
||||
}
|
||||
|
||||
case object Black extends Color
|
||||
case object White extends Color
|
||||
case object Red extends Color
|
||||
case object Cyan extends Color
|
||||
case object Purple extends Color
|
||||
case object Green extends Color
|
||||
case object Blue extends Color
|
||||
case object Yellow extends Color
|
||||
case object Orange extends Color
|
||||
case object Brown extends Color
|
||||
case object LightRed extends Color
|
||||
case object DarkGrey extends Color
|
||||
case object Grey extends Color
|
||||
case object LightGreen extends Color
|
||||
case object LightBlue extends Color
|
||||
case object LightGrey extends Color
|
||||
}
|
5
src/main/scala/com/htmlism/mos6502/dsl/EnumAsByte.scala
Normal file
5
src/main/scala/com/htmlism/mos6502/dsl/EnumAsByte.scala
Normal file
@ -0,0 +1,5 @@
|
||||
package com.htmlism.mos6502.dsl
|
||||
|
||||
trait EnumAsByte[A] {
|
||||
def toByte(x: A): Int
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user