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

56 lines
972 B
Kotlin
Raw Normal View History

2015-06-09 17:21:49 +00:00
package android.emu6502.instructions
import java.util.HashMap
open class BaseInstruction(private val instruction: Instruction,
private val instructionList: HashMap<Int, InstructionTarget>) {
2015-06-09 17:21:49 +00:00
init {
val opcodes: IntArray = Opcodes.MAP[instruction] as IntArray
val methods = arrayOf(::immediate, ::zeroPage, ::zeroPageX, ::zeroPageY, ::absolute,
::absoluteX, ::absoluteY, ::indirect, ::indirectX, ::indirectY, ::single, ::branch)
opcodes.forEachIndexed { i, opcode ->
if (opcode != 0xff) {
instructionList.put(opcodes[i], InstructionTarget(this, methods[i]))
2015-06-09 17:21:49 +00:00
}
}
}
open fun immediate() {
2015-06-09 17:21:49 +00:00
}
open fun zeroPage() {
2015-06-09 17:21:49 +00:00
}
open fun zeroPageX() {
2015-06-09 17:21:49 +00:00
}
open fun zeroPageY() {
2015-06-09 17:21:49 +00:00
}
open fun absolute() {
2015-06-09 17:21:49 +00:00
}
open fun absoluteX() {
2015-06-09 17:21:49 +00:00
}
open fun absoluteY() {
2015-06-09 17:21:49 +00:00
}
open fun indirect() {
2015-06-09 17:21:49 +00:00
}
open fun indirectX() {
2015-06-09 17:21:49 +00:00
}
open fun indirectY() {
2015-06-09 17:21:49 +00:00
}
open fun single() {
2015-06-09 17:21:49 +00:00
}
open fun branch() {
2015-06-09 17:21:49 +00:00
}
}