mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2024-09-27 06:54:33 +00:00
add testing frameworks
This commit is contained in:
parent
69286c8a86
commit
59c8c06a26
@ -3,7 +3,8 @@ lazy val root =
|
||||
.in(file("."))
|
||||
.settings(
|
||||
initialCommands in console := "import com.htmlism._",
|
||||
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.1" % "test",
|
||||
scalafmtOnCompile := true
|
||||
)
|
||||
.withCats
|
||||
.withTesting
|
||||
.withTestingBeta
|
||||
|
@ -13,6 +13,14 @@ object ProjectPlugin extends AutoPlugin {
|
||||
def withCats: Project =
|
||||
p
|
||||
.settings(libraryDependencies += "org.typelevel" %% "cats-core" % "2.2.0-RC2")
|
||||
|
||||
def withTesting: Project =
|
||||
p.settings(libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.1" % "test")
|
||||
|
||||
def withTestingBeta: Project =
|
||||
p.settings(
|
||||
libraryDependencies += "com.disneystreaming" %% "weaver-framework" % "0.4.2" % Test,
|
||||
testFrameworks += new TestFramework("weaver.framework.TestFramework"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ object MatchOpcodes {
|
||||
|
||||
0x96 -> (STX -> ZeroPageY),
|
||||
0xB6 -> (LDX -> ZeroPageY),
|
||||
0xBE -> (LDX -> AbsoluteY),
|
||||
0xBE -> (LDX -> AbsoluteY)
|
||||
)
|
||||
|
||||
def injectedOpcodesRelative: Map[Int, (Instruction, AddressingMode)] =
|
||||
@ -38,7 +38,7 @@ object MatchOpcodes {
|
||||
0x90 -> BCC,
|
||||
0xB0 -> BCS,
|
||||
0xD0 -> BNE,
|
||||
0xF0 -> BEQ,
|
||||
0xF0 -> BEQ
|
||||
).view.mapValues(x => x -> Relative).toMap
|
||||
|
||||
def injectedOpcodesImplied: Map[Int, (Instruction, AddressingMode)] =
|
||||
|
@ -4,8 +4,7 @@ sealed trait Color
|
||||
|
||||
object Color {
|
||||
implicit val ev: Operand[Color] =
|
||||
Operand
|
||||
.operandInt
|
||||
Operand.operandInt
|
||||
.contra(toByte, _.toString)
|
||||
|
||||
def toByte(x: Color): Int =
|
||||
|
@ -67,7 +67,6 @@ object DslDemo extends App {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
object registers {
|
||||
sealed trait Register
|
||||
|
||||
@ -137,8 +136,7 @@ class AssemblyContext {
|
||||
xs.append(InstructionWithOperand(instruction, x: A, s.some))
|
||||
|
||||
def printOut(): Unit = {
|
||||
xs
|
||||
.map(_.toAsm)
|
||||
xs.map(_.toAsm)
|
||||
.foreach(println)
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,9 @@ case class UnaryInstruction(instruction: Instruction, comment: Option[String]) e
|
||||
}
|
||||
}
|
||||
|
||||
case class InstructionWithOperand[A](instruction: Instruction, operand: A, comment: Option[String])(implicit ev: Operand[A]) extends Statement {
|
||||
case class InstructionWithOperand[A](instruction: Instruction, operand: A, comment: Option[String])(
|
||||
implicit ev: Operand[A]
|
||||
) extends Statement {
|
||||
def toAsm: String = {
|
||||
val left =
|
||||
instruction.toString
|
||||
|
Loading…
Reference in New Issue
Block a user