mirror of
https://github.com/felipecsl/6502Android.git
synced 2024-06-03 05:29:29 +00:00
19 lines
469 B
Kotlin
19 lines
469 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()
|
||
|
}
|
||
|
}
|
||
|
}
|