srctree

Johan parent 754a5e81 7c590ebb 04ee4406
Merge pull request #369 from johnor/ignore-nametable-fetch

Ignore nametable fetches during cycle 337 and 339
core/src/ppu.cpp added: 4, removed: 7, total 0
@@ -1,5 +1,6 @@
#include "ppu.h"
 
#include <tuple>
#include "nes/core/invalid_address.h"
 
namespace {
@@ -370,7 +371,7 @@ void Ppu::fetch() {
// were fetched already in the end of this scanline).
const uint16_t nametable_address =
get_nametable_address(registers_->vram_addr.value());
registers_->name_table_latch = mmu_->read_byte(nametable_address);
std::ignore = mmu_->read_byte(nametable_address);
}
}
 
 
core/test/src/test_ppu.cpp added: 4, removed: 7, total 0
@@ -621,8 +621,6 @@ TEST_F(PpuTest, visible_scanline) {
// Two unused nametable fetches.
expected.scanline = 1;
expected.cycle = 0;
expected.name_table = 0x02;
expected.name_table_latch = 0x02;
EXPECT_CALL(mmu, read_byte(0x2000 + 2)).Times(2).WillRepeatedly(Return(2));
for (int i = 337; i <= 340; ++i) {
const auto pixel = ppu->execute();
@@ -799,8 +797,6 @@ TEST_F(PpuTest, pre_render_scanline) {
expected.scanline = 0;
expected.cycle = 0;
expected.odd_frame = false;
expected.name_table = 0x02;
expected.name_table_latch = 0x02;
EXPECT_CALL(mmu, read_byte(0x2000 + 2)).Times(2).WillRepeatedly(Return(2));
for (int i = 337; i <= 340; ++i) {
const auto pixel = ppu->execute();