PPU: impl NMI interrupt

This commit is contained in:
Andrew Glaze
2024-08-19 22:05:08 -04:00
parent 05927d8e91
commit 830bc5f65a
6 changed files with 180 additions and 38 deletions

View File

@@ -2,6 +2,7 @@ class Bus {
var cpuVram: [UInt8] = .init(repeating: 0, count: 2048)
var prgRom: [UInt8]
var ppu: NesPPU
var cycles: Int = 0
fileprivate let RAM : UInt16 = 0x0000
fileprivate let RAM_MIRRORS_END: UInt16 = 0x1FFF
@@ -14,6 +15,15 @@ class Bus {
ppu = NesPPU(rom.character, rom.screenMirror)
self.prgRom = rom.program
}
func tick(_ cycles: UInt8) {
self.cycles += Int(cycles)
self.ppu.tick(cycles * 3)
}
func pollNMI() -> UInt8? {
ppu.nmiInterrupt
}
}