diff --git a/src/main/scala/com/htmlism/AddressingMode.scala b/src/main/scala/com/htmlism/AddressingMode.scala index 0033784..e0c79c3 100644 --- a/src/main/scala/com/htmlism/AddressingMode.scala +++ b/src/main/scala/com/htmlism/AddressingMode.scala @@ -10,6 +10,7 @@ case object AbsoluteX extends AddressingMode case object AbsoluteY extends AddressingMode case object IndirectX extends AddressingMode case object IndirectY extends AddressingMode +case object Relative extends AddressingMode case object Accumulator extends AddressingMode case object Implied extends AddressingMode case object NoMode extends AddressingMode diff --git a/src/main/scala/com/htmlism/MatchOpcodes.scala b/src/main/scala/com/htmlism/MatchOpcodes.scala index ed50f8b..da48a92 100644 --- a/src/main/scala/com/htmlism/MatchOpcodes.scala +++ b/src/main/scala/com/htmlism/MatchOpcodes.scala @@ -18,7 +18,7 @@ object MatchOpcodes { .toMap // format: off - def injectedOpcodes: Map[Int, (Instruction, AddressingMode)] = + def injectedOpcodesRelative: Map[Int, (Instruction, AddressingMode)] = Map( 0x10 -> BPL, 0x30 -> BMI, @@ -28,7 +28,10 @@ object MatchOpcodes { 0xB0 -> BCS, 0xD0 -> BNE, 0xF0 -> BEQ, + ).view.mapValues(x => x -> Relative).toMap + def injectedOpcodesImplied: Map[Int, (Instruction, AddressingMode)] = + Map( 0x00 -> BRK, 0x20 -> JSR, 0x40 -> RTI, @@ -62,7 +65,10 @@ object MatchOpcodes { // format: on def doStuff(out: PrintWriter): Unit = { - val lookup = generatedOpcodes ++ injectedOpcodes + val lookup = + generatedOpcodes ++ + injectedOpcodesImplied ++ + injectedOpcodesRelative out.print("