Commit graph

42 commits

Author SHA1 Message Date
Jan Bujak 5a9d4ff5f2 Generate the palette lookup table at compile time 2023-11-27 23:30:02 +09:00
Jan Bujak 33fed82f68 Fix test suite compilation 2023-11-27 23:25:28 +09:00
Jan Bujak fb7c91a1c4 Reduce stack usage in hard_reset 2023-11-27 23:13:03 +09:00
Jan Bujak 1a557db886 Add soft float support 2023-11-03 22:34:47 +09:00
Jan Bujak e02a4b8b37 Support non-nightly no_std builds 2023-10-20 15:12:47 +09:00
Jan Bujak 71fcdf7b39 Get rid of the warnings when compiling without the log feature 2023-10-20 14:57:41 +09:00
Jan Bujak 8ebc612a53 Allow for the state to be const initialized 2023-10-20 14:56:29 +09:00
Jan Bujak 300a3024b9 Support playing back recordings in the devui
This is somewhat inaccurate and will desynch quickly though.
2023-09-30 20:12:00 +09:00
Jan Bujak 08845942ac Update bitflags to 2.4.0 2023-09-01 23:06:08 +09:00
Jan Bujak 82b588a540 Fix warnings 2023-09-01 22:58:28 +09:00
Jan Bujak 8eeacc5b88 Try to build Palette object in-place on the stack 2023-09-01 22:48:09 +09:00
Jan Bujak 59c2a652db Add workspace and #[no_std] support 2023-03-12 01:21:05 +09:00
Jan Bujak 17c51a1e96 Fix AxROM initialization 2018-11-24 23:44:43 +01:00
Jan Bujak 4770dfc393 Add support for AxROM (mapper 7) 2018-11-24 23:28:46 +01:00
Jan Bujak 9a8174a1f8 Add initial (inaccurate) support for emphasis flags 2018-11-24 23:26:25 +01:00
Jan Bujak 77b6fa368f Add support for UNROM 512 (mapper 30) 2018-08-26 00:30:50 +02:00
Jan Bujak 43f68f0b3b Extern the generic mapper 2018-08-26 00:29:04 +02:00
tragicmuffin b5b1e332c0 Fix silencing of noise channel when envelope decay is on
The noise channel is silent any time the envelope decay bit (i.e. bit 4 of $400C) is set to 0.

When bit 4 is 0, the envelope decay is disabled, so `is_manually_controlled` is set to false, and thus the volume of the noise channel gets set to `self.generated_volume` in VolumeGenerator's `volume()` function.
The problem is, `self.generated_volume` is never updated, and so it stays at the default volume of 0, silencing the channel.

As far as I can tell, the noise channel is supposed to work exactly the same as the square channels when it comes to the volume register, so my proposed fix is to duplicate the function used to update the square channels' volume generator, and update the noise channel along with the squares in `clock_sequencer()`.
2018-01-20 00:57:07 +01:00
tragicmuffin 96180c6bd2 Fixed silencing of square 1 channel when sweep is disabled
When the sweep is disabled, but the negate flag is set (%00001000 written to $4001), the `frequency_generator_output()` function shouldn't be called. In fact, because the last 3 bits are set to 0, the `adjust_period_based_on_frequency_generator()` function doesn't end up calling it.

But, it's being called to check if channel should be silenced:
`!self.enabled || self.period < 8 || self.length_counter == 0 || self.frequency_generator_output() >= 0x7FF`

When `frequency_generator_output()` is called here (with the sweep disabled), self.period is shifted by 0 bits, so period_delta = self.period.
Thus `self.period.wrapping_sub( period_delta ).wrapping_sub( 1 )` = (0-1), underflowing to 0xFFFF which is indeed greater than 0x7FF. So the channel is silenced.

Added an additional check to see if the sweep is enabled before checking its state.
2018-01-18 18:15:08 +01:00
Jan Bujak 7eb0b38e6f Export execute_cycle in nes interface 2017-12-31 14:09:20 +01:00
Jan Bujak 1cc4863609 Dynamically allocate the framebuffer to fix the stack overflow on wasm 2017-12-31 14:08:09 +01:00
Jan Bujak 6e3f57cdae Fix DMA tests compilation on new version of Rust 2017-03-24 21:14:11 +01:00
Jan Bujak 675e6fc603 Do not draw sprites on the very first scanline. 2016-11-01 19:17:56 +01:00
Jan Bujak 3e6deb9e2d Properly support VROM-less games in generic mapper. 2016-11-01 19:13:51 +01:00
Jan Bujak dacd8400cc Add UxROM (2) support. 2016-11-01 16:48:10 +01:00
Jan Bujak 75b44ac90a Add a generic mapper; simplify ROM loading and mappers. 2016-11-01 16:43:06 +01:00
Jan Bujak c99a2150cc Do not use hard_reset() for now since it doesn't reset the mapper. 2016-11-01 14:45:10 +01:00
Jan Bujak 590442fb11 Update to newer phantom2c02. 2016-11-01 14:32:18 +01:00
Jan Bujak 38b29f6dde Even more accurate garbage PPU fetches. 2016-11-01 14:30:28 +01:00
Jan Bujak 804079cf96 Fix scrolling.
This fixes *a lot* of games!
2016-11-01 14:19:55 +01:00
Jan Bujak 2be74cb9a6 Move the NROM mapper into a separate file. 2016-10-30 20:18:55 +01:00
Jan Bujak 4016b60e49 Add a new PPU testsuite based on a transistor level simulation of RP2C02. 2016-10-30 00:16:54 +02:00
Jan Bujak a9ef8d50e4 Add initial MMC1 support. 2016-10-30 00:11:14 +02:00
Jan Bujak 1710dcd0cd Add double height sprite support. 2016-10-30 00:09:50 +02:00
Jan Bujak aaf8ecc57f More accurate garbage PPU fetches. 2016-10-29 22:54:20 +02:00
Jan Bujak cce6067a19 Simplify PPU fetching. 2016-10-29 22:52:16 +02:00
Jan Bujak 0294e9888e Print out the loaded ROM. 2016-10-29 17:34:36 +02:00
Jan Bujak ddf1875a71 Start the PPU on the prerender scanline instead of on the first visible one. 2016-10-29 17:26:36 +02:00
Jan Bujak fc01a77d0e Regenerate PPU scheduler. 2016-10-29 17:24:15 +02:00
Jan Bujak 21a2a147e1 Always keep track of the current scanline and dot. 2016-10-29 17:22:38 +02:00
Jan Bujak 705ee82b99 Fix indentation in PPU scheduler's generated code 2016-10-29 17:11:55 +02:00
Jan Bujak f9b6a23ea0 Initial commit 2016-10-23 19:50:32 +02:00