Skip to content

Commit

Permalink
bugfix - change t-cycles counter type to long
Browse files Browse the repository at this point in the history
  • Loading branch information
krzys9876 committed Apr 28, 2023
1 parent d99eb85 commit 1e3dfc5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/scala/org/kr/scala/z80/system/Z80System.scala
Original file line number Diff line number Diff line change
Expand Up @@ -241,16 +241,16 @@ object CyclicInterruptMutable {
}

trait TCycleCounter {
def cycles:Int
def cycles:Long
def add(cyclesToAdd:Int):TCycleCounter
}

case class TCycleCounterImmutable(override val cycles:Int) extends TCycleCounter {
case class TCycleCounterImmutable(override val cycles:Long) extends TCycleCounter {
override def add(cyclesToAdd:Int):TCycleCounter = copy(cycles=cycles+cyclesToAdd)
}

class TCycleCounterMutable(private var c:Int) extends TCycleCounter {
def cycles:Int = c
class TCycleCounterMutable(private var c:Long) extends TCycleCounter {
def cycles:Long = c
override def add(cyclesToAdd:Int):TCycleCounter = {
c+=cyclesToAdd
this
Expand Down

0 comments on commit 1e3dfc5

Please sign in to comment.