From 6274071e3857c1640cc5aef804cb86509ab312f9 Mon Sep 17 00:00:00 2001 From: Peter Fors Date: Thu, 3 Apr 2025 20:02:00 +0200 Subject: Move to glfw --- memory.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'memory.c') diff --git a/memory.c b/memory.c index baf10e9..35c1d41 100644 --- a/memory.c +++ b/memory.c @@ -2,7 +2,7 @@ static uint8_t memory_read(struct nes_state *restrict state, uint32_t offset) { - state->cycle++; + state->cycles++; ppu_tick(state); ppu_tick(state); ppu_tick(state); if(offset > 0xffff) { @@ -30,17 +30,13 @@ static uint8_t memory_read(struct nes_state *restrict state, uint32_t offset) { } static void memory_write(struct nes_state *restrict state, uint32_t offset, uint8_t value) { - state->cycle++; + state->cycles++; ppu_tick(state); ppu_tick(state); ppu_tick(state); if(offset > 0xffff) { printf("%x\n", offset); } -// if(offset == 0x0300) { -// printf("WRITE $0300 = %02x @ PC=%04x\n", value, state->cpu.pc); -// } - if(offset < 0x2000) { state->ram[offset & 0x07ff] = value; } else if(offset < 0x4000) { @@ -81,7 +77,7 @@ static uint8_t memory_read_dma(struct nes_state *restrict state, uint32_t offset } static uint8_t memory_read_dummy(struct nes_state *restrict state, uint32_t offset) { - state->cycle++; + state->cycles++; ppu_tick(state); ppu_tick(state); ppu_tick(state); if(offset < 0x2000) { -- cgit v1.2.3