mirror of
https://github.com/felipecsl/6502Android.git
synced 2024-06-07 15:48:23 +00:00
18 lines
482 B
Kotlin
18 lines
482 B
Kotlin
|
package android.emu6502.instructions.impl
|
||
|
|
||
|
import android.emu6502.CPU
|
||
|
import android.emu6502.instructions.BaseInstruction
|
||
|
import android.emu6502.instructions.Instruction
|
||
|
|
||
|
/** Jump to SubRoutine */
|
||
|
class JSR(private val cpu: CPU) : BaseInstruction(Instruction.JSR, cpu.instructionList) {
|
||
|
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
|
||
|
}
|
||
|
}
|
||
|
|