diff --git a/bin/run_failing_test_roms.sh b/bin/run_failing_test_roms.sh index 80e51e70..6b7b06e3 100755 --- a/bin/run_failing_test_roms.sh +++ b/bin/run_failing_test_roms.sh @@ -29,10 +29,7 @@ tests/ppu/sprdma_and_dmc_dma_512.nes # Supposed to print a table and instead jus tests/ppu/sprite_hit/09-timing.nes # Flag set too soon for upper-right corner #5 tests/ppu/sprite_overflow/3.Timing.nes # Failed #5 tests/ppu/sprite_overflow/4.Obscure.nes # Failed #2 - -## MAPPERS ======================================================================================== -# tests/mapper/mmc3/5.MMC3_rev_A.nes # Can only pass rev_A or rev_B at the same time. Passes rev_B - +tests/ppu/vbl_nmi/10-even_odd_timing.nes # Failed #3 ) trap ctrl_c INT diff --git a/bin/run_passing_test_roms.sh b/bin/run_passing_test_roms.sh index b12f9f33..4b622cb3 100755 --- a/bin/run_passing_test_roms.sh +++ b/bin/run_passing_test_roms.sh @@ -74,6 +74,7 @@ tests/apu/test_6.nes ## PPU ============================================================================================ tests/ppu/oam_read.nes tests/ppu/oam_stress.nes +tests/ppu/oamtest3.nes # Not really sure what this tests tests/ppu/open_bus.nes tests/ppu/palette.nes tests/ppu/palette_ram.nes @@ -99,6 +100,7 @@ tests/ppu/vbl_nmi/03-vbl_clear_time.nes tests/ppu/vbl_nmi/04-nmi_control.nes tests/ppu/vbl_nmi/05-nmi_timing.nes tests/ppu/vbl_nmi/06-suppression.nes +tests/ppu/vbl_nmi/07-nmi_on_timing.nes tests/ppu/vbl_nmi/08-nmi_off_timing.nes tests/ppu/vbl_nmi/09-even_odd_frames.nes tests/ppu/vbl_nmi_timing/1.frame_basics.nes @@ -110,11 +112,11 @@ tests/ppu/vbl_nmi_timing/6.nmi_disable.nes tests/ppu/vbl_nmi_timing/7.nmi_timing.nes tests/ppu/vram_access.nes -# Video - Skip for now -# tests/ppu/240pee.nes -# tests/ppu/color.nes -# tests/ppu/ntsc_torture.nes -# tests/ppu/tv.nes +# Video +tests/ppu/240pee.nes +tests/ppu/color.nes +tests/ppu/ntsc_torture.nes +tests/ppu/tv.nes ## MAPPERS ======================================================================================== tests/mapper/mmc3/1.Clocking.nes @@ -122,6 +124,7 @@ tests/mapper/mmc3/2.Details.nes tests/mapper/mmc3/3.A12_clocking.nes tests/mapper/mmc3/4.Scanline_timing.nes tests/mapper/mmc3/6.MMC3_rev_B.nes +# tests/mapper/mmc3/5.MMC3_rev_A.nes # Can only pass rev_A or rev_B at the same time. Passes rev_ tests/mapper/mmc3/mmc3bigchrram.nes ) diff --git a/src/cpu.rs b/src/cpu.rs index d84749eb..4215eb53 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -213,6 +213,8 @@ impl Cpu { self.push_stackb((self.status | U as u8) & !(B as u8)); self.set_flag(I, true); self.pc = self.readw(NMI_ADDR); + self.nmi_pending = false; + self.bus.ppu.nmi_pending = false; } fn run_cycle(&mut self) { @@ -572,8 +574,6 @@ impl Clocked for Cpu { if self.has_irq(Irq::Reset) { self.irq(); } else if self.last_nmi { - self.nmi_pending = false; - self.bus.ppu.nmi_pending = false; self.nmi(); } else if self.last_irq { self.irq(); @@ -685,7 +685,7 @@ impl Clocked for Cpu { ANC => self.anc(), // AND #imm SLO => self.slo(), // ASL & ORA XXX => self.xxx(), // Unimplemented opcode - }; + } self.step += 1; self.cycle_count - start_cycles diff --git a/src/mapper/m004_txrom.rs b/src/mapper/m004_txrom.rs index a44c8ca4..027f5671 100644 --- a/src/mapper/m004_txrom.rs +++ b/src/mapper/m004_txrom.rs @@ -128,8 +128,8 @@ impl Txrom { has_chr_ram, mirroring, irq_pending: false, - mmc3_revb: true, // TODO compare to known games - mmc_acc: false, // TODO - compare to known games + mmc3_revb: false, // TODO compare to known games + mmc_acc: false, // TODO - compare to known games battery_backed: cart.battery_backed(), prg_rom_bank_idx: [0, 1, prg_len - 2, prg_len - 1], chr_bank_idx: [0, 1, 2, 3, 4, 5, 6, 7], diff --git a/src/ppu/frame.rs b/src/ppu/frame.rs index a10693a5..bded19ac 100644 --- a/src/ppu/frame.rs +++ b/src/ppu/frame.rs @@ -68,12 +68,12 @@ impl Frame { pub(super) fn put_ntsc_pixel(&mut self, x: u32, y: u32, pixel: u32, ppu_cycle: u32) { // Store the RGB color into the frame buffer. let color = - self.palette[ppu_cycle as usize][(self.prev_pixel % 64) as usize][pixel as usize]; + self.palette[ppu_cycle as usize][pixel as usize][(self.prev_pixel % 64) as usize]; + self.prev_pixel = pixel; let red = (color >> 16 & 0xFF) as u8; let green = (color >> 8 & 0xFF) as u8; let blue = (color & 0xFF) as u8; self.put_pixel(x, y, red, green, blue); - self.prev_pixel = pixel; } // NOTE: There's lot's to clean up here -- too many magic numbers and duplication but