Repository navigation
Misc fixes - #29
Misc fixes#29
Conversation
We cannot rely on the iNES header to detect whether cartridge has PRG RAM or not, so always allocate PRG RAM for mapper 0. Signed-off-by: Renê de Souza Pinto <rene@renesp.com.br>
Write 0x00 or 0x80 to register $4017 should not affect interrupt flag. This was tested with Blargg's 3-irq_flag test. This commit fixes the logic and now the test passes. Signed-off-by: Renê de Souza Pinto <rene@renesp.com.br>
The DMC output timer tested `++cycles > period`, so a rate whose period is 428 CPU cycles changed the output level every 429. Every one of the 16 rates ran a cycle slow, which stretches the playback rate of every DPCM sample in every game that uses one. Measured with a probe on the sample fetches while running blargg's apu_test 8-dmc_rates at rate 0 (period 428, so one fetch per 8 output cycles = 3424 cycles): before 3432 3432 3432 3432 (8 * 429) after 3424 3424 3424 3424 (8 * 428) https://www.nesdev.org/wiki/APU_DMC This does not make 8-dmc_rates pass on its own. That test also wants the $4015 DMC-active bit to clear when the last byte finishes playing, and rNES clears it when the last byte is *fetched* -- the memory reader refills the sample buffer as soon as it empties, so bytes_remaining reaches zero a full byte ahead of the output unit. Separating the sample buffer from the shift register is a larger change and is not attempted here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Renê de Souza Pinto <rene@renesp.com.br>
/NMI is asserted for as long as (vblank flag AND PPUCTRL bit 7), and the CPU detects its edge. The line is asserted correctly but never released it on a $2000 write, so clearing bit 7 left it asserted. If bit is written again later during the same vblank, the second NMI will be lost. Signed-off-by: Renê de Souza Pinto <rene@renesp.com.br>
This fixes error 2 of Blargg's ppu_open_bus test. Signed-off-by: Renê de Souza Pinto <rene@renesp.com.br>
A $2004 write is ignored on the pre-render line and during rendering, so the rendering must be enabled. Signed-off-by: Renê de Souza Pinto <rene@renesp.com.br>
Rendering must be enabled to ignore writes on OAMDATA during rendering or pre-redering. This commits fixes the logic. Signed-off-by: Renê de Souza Pinto <rene@renesp.com.br>
|
Claude finished @rene's task —— View job Code Review
|
Byte 2 of OAM (Sprite) data are the attributes, where bits 2-4 are reserved bits and should be always read as zeros. Signed-off-by: Renê de Souza Pinto <rene@renesp.com.br>
OAMADDR was forced to 0 on cycles 257-320 of every visible and pre-render scanline, whatever the PPU was doing. That clear is part of loading the sprite tiles, so it only happens while rendering is enabled; with the screen off, OAMADDR keeps whatever the CPU last wrote. Signed-off-by: Renê de Souza Pinto <rene@renesp.com.br>
Sprite evaluation ran on the pre-render line as well, comparing sprite Y coordinates against scanline 261, so hidden sprites were matching the hit condition. They should be evaluated only for visible scanlines. Signed-off-by: Renê de Souza Pinto <rene@renesp.com.br>
|
Claude finished @rene's task —— View job Code Review
|
Several fixes.