6502Android/app/src/main/kotlin/android/emu6502/instructions/impl/JSR.kt

18 lines
466 B
Kotlin
Raw Normal View History

2015-06-22 01:06:44 +00:00
package android.emu6502.instructions.impl
import android.emu6502.CPU
import android.emu6502.instructions.BaseInstruction
import android.emu6502.instructions.Instruction
/** Jump to SubRoutine */
2015-06-30 07:35:06 +00:00
class JSR(private val cpu: CPU) : BaseInstruction(Instruction.JSR, cpu) {
2015-06-22 01:06:44 +00:00
override fun absolute() {
val addr = cpu.popWord()
val currAddr = cpu.PC - 1
cpu.stackPush(currAddr.shr(8).and(0xff))
cpu.stackPush(currAddr.and(0xff))
cpu.PC = addr
}
}