diff options
-rw-r--r-- | src/AddressingModes.scala | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/AddressingModes.scala b/src/AddressingModes.scala index e37bbe2..f511768 100644 --- a/src/AddressingModes.scala +++ b/src/AddressingModes.scala @@ -44,13 +44,15 @@ object OneOpAddressingModes { trait Modes { private val modeMap: Map[Int, AddressingMode] = Map() - def Mode(as: Int, name: String, stringifier: String => String) = AddressingMode(as, name, stringifier).tap(modeMap += as -> _) + case class Mode(as: Int, name: String, stringifier: String => String) extends AddressingMode(as, name, stringifier) { + def Mode(as: Int, name: String, stringifier: String => String) = this(as, name, stringifier).tap(modeMap += as -> _) + } def apply(x: Int): Option[AddressingMode] = modeMap.get(x) } object PCModes extends Modes { - Mode(3, "NextWord", reg => s"@$reg+ (next word)") + Mode(3, "NextWord", reg => s"@PC+ (next word)") } object SRModes extends Modes { Mode(2, "Const4", reg => "#4") |