diff --git a/README.md b/README.md index 0493556..b62a9c1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # nestur -Nestur is an NES emulator and a work in progress. There are still some minor bugs and the audio is kind of scratchy. I've mostly tested on Donkey Kong, Super Mario Bros., and Zelda so far. There are plenty of full-featured emulators out there; this is primarily an educational project but I do want it to run well. SDL2 is the only dependency, it's NTSC timing, and contains no `unsafe` code. +Nestur is an NES emulator and a work in progress. There are likely still several bugs, and MMC3 support is not great. There are plenty of full-featured emulators out there; this is primarily an educational project but I do want it to run well. +- SDL2 is the only dependency +- no use of `unsafe` +- NTSC timing +- may only implement mappers 0-4 as these cover ~85% of games according to http://tuxnes.sourceforge.net/nesmapper.txt @@ -34,7 +38,7 @@ The code aims to follow the explanations from the [NES dev wiki](https://wiki.ne ## To do: -- More mappers (only mappers 0 (NROM) and 1 (MMC1) implemented so far) +- Find any bugs with mappers 0-4 and improve mapper 5 (MMC3) - DMC audio channel, high- and low-pass filters diff --git a/src/apu/mod.rs b/src/apu/mod.rs index fe1fe53..0d77a35 100644 --- a/src/apu/mod.rs +++ b/src/apu/mod.rs @@ -147,7 +147,7 @@ impl Apu { self.trigger_irq = true; } // advance counter - self.frame_counter += 1; + self.frame_counter = self.frame_counter.wrapping_add(1); if self.frame_counter == self.frame_sequence { self.frame_counter = 0; } diff --git a/src/apu/square.rs b/src/apu/square.rs index 8742ca1..5592379 100644 --- a/src/apu/square.rs +++ b/src/apu/square.rs @@ -113,7 +113,7 @@ impl Square { // which produces different results when each channel's change amount is made negative: // Pulse 1 adds the ones' complement (-c - 1). Making 20 negative produces a change amount of -21. // Pulse 2 adds the two's complement (-c). Making 20 negative produces a change amount of -20. - if self.first_channel { + if self.first_channel && self.target_period >= 1 { self.target_period -= 1; } } else {