6502Android/app/src/main/kotlin/android/emu6502/nes/mappers/Mapper.kt

19 lines
521 B
Kotlin
Raw Normal View History

2017-03-14 06:45:19 +00:00
package android.emu6502.nes.mappers
import android.emu6502.CPU
import android.emu6502.nes.Cartridge
import android.emu6502.nes.PPU
interface Mapper {
fun read(address: Int): Int
fun write(address: Int, value: Int)
fun step()
companion object {
fun newMapper(cartridge: Cartridge, ppu: PPU, cpu: CPU): Mapper =
when (cartridge.mapper.toInt()) {
4 -> MMC3(cartridge, ppu, cpu)
2018-08-11 01:03:19 +00:00
else -> throw NotImplementedError("Mapper ${cartridge.mapper.toInt()} not implemented")
2017-03-14 06:45:19 +00:00
}
}
}