mirror of
https://github.com/felipecsl/6502Android.git
synced 2024-06-01 06:41:32 +00:00
21 lines
528 B
Kotlin
21 lines
528 B
Kotlin
|
package android.emu6502.instructions.impl
|
||
|
|
||
|
import android.emu6502.CPU
|
||
|
import android.emu6502.instructions.BaseInstruction
|
||
|
import android.emu6502.instructions.Instruction
|
||
|
|
||
|
/** INCrement memory */
|
||
|
final class INC(private val cpu: CPU) : BaseInstruction(Instruction.INC, cpu.instructionList) {
|
||
|
override fun zeroPage() {
|
||
|
inc(cpu.popByte())
|
||
|
}
|
||
|
|
||
|
private fun inc(addr: Int) {
|
||
|
var value = cpu.memory.get(addr)
|
||
|
value = (value + 1).and(0xff)
|
||
|
cpu.memory.storeByte(addr, value)
|
||
|
cpu.setSVFlagsForValue(value)
|
||
|
}
|
||
|
}
|
||
|
|