Skip to content

Commit

Permalink
fix ppu not rendering when not using tracing (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
cornelk authored Dec 11, 2024
1 parent 6b1af36 commit 0b9d3f2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/nes/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,14 @@ func (sys *System) runEmulatorSteps(stopAt int) error {
return nil
}

cycles := sys.CPU.Cycles()
if sys.opts.tracing {
state.A = sys.CPU.A
state.X = sys.CPU.X
state.Y = sys.CPU.Y
state.SP = sys.CPU.SP
state.Flags = sys.CPU.GetFlags()
state.Cycles = sys.CPU.Cycles()
state.Cycles = cycles
}

if !sys.CPU.CheckInterrupts() {
Expand All @@ -106,7 +107,7 @@ func (sys *System) runEmulatorSteps(stopAt int) error {
}
}

cpuCycles := sys.CPU.Cycles() - state.Cycles
cpuCycles := sys.CPU.Cycles() - cycles
ppuCycles := cpuCycles * 3
sys.Bus.PPU.Step(int(ppuCycles))
}
Expand Down

0 comments on commit 0b9d3f2

Please sign in to comment.