mirror of
https://github.com/felipecsl/6502Android.git
synced 2024-06-15 20:29:39 +00:00
19 lines
521 B
Kotlin
19 lines
521 B
Kotlin
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)
|
|
else -> throw NotImplementedError("Mapper ${cartridge.mapper.toInt()} not implemented")
|
|
}
|
|
}
|
|
} |