Page 2 of 2

Re: Noah's Ark (E) on PowerPak

Posted: Fri Dec 18, 2015 8:44 am
by 2600
thefox wrote:Just to follow up on this, here's one scenario from Visual 2C02 simulation. I simply added write to $2007 at the end of the default "program" (it enables rendering at the end). This is what happens (read from bottom to top):

Code: Select all

cycle   hpos    vpos    ab      ale     rd      wr
348     057     105     1009    1       1       1 
348     057     105     1009    1       1       1 
347     056     105     1000    0       0       1 
347     056     105     1000    0       0       1 
346     056     105     1000    0       0       1 
346     056     105     1000    0       0       1 
345     056     105     1000    0       0       0 
345     056     105     1000    0       0       0 
344     056     105     1000    0       0       0 
344     056     105     1000    0       0       0 <= /RD is asserted, overlapping with /WR
343     055     105     1000    1       1       0 
343     055     105     1000    1       1       0 
342     055     105     1000    1       1       0 
342     055     105     1000    1       1       0 <= /WR is asserted
341     055     105     1000    1       1       1 
341     055     105     1000    1       1       1 
340     055     105     1000    1       1       1 
340     055     105     1000    1       1       1 <= ALE is asserted continuously for 8 clocks (normally 4)
339     054     105     2369    0       0       1 
339     054     105     2369    0       0       1 
So, ALE is still kept asserted at the same time when /WR starts to be asserted. And then /RD comes in to overlap the /WR assertion. Normally ALE would be asserted, then deasserted, then only one of /RD or /WR should get asserted.

NOTE: This is just one possible scenario, but shows that the behavior of $2007 writes while rendering can be quite funky.

Based on this, I think I was able to fix the problem. My earlier logic (based on the assumption that PPU /RD and /WR are mutually exclusive) was:

Code: Select all

ce <= ppu_read or (ppu_write and chr_ram_enable)
New logic:

Code: Select all

ce <= (ppu_read and not ppu_write) or (ppu_write and chr_ram_enable)
This seems to have fixed all the games that I know of which had the problem.

Here's how to reproduce the problem for each game:
- Perfect Fit (U) (CNROM): Select level 1, press B to start level, then select to exit the level, then go back to level
- Addams Family, The - Pugsley's Scavenger Hunt (U) (MMC1): Go to password screen, enter code, go back to title screen
- Krusty's Fun House (U) (MMC3): Simply run the game, the screen with text "hiiiiii kids" is corrupted.
- Noah's Ark (E) (MMC3): Go to first level, background is corrupted.
- Baseball Stars II (U) (MMC3): Press start, then A several times, eventually a corrupted screen will appear.
- Bigfoot (U) (MMC1): Title screen is corrupted

I'll release a new version of PowerMappers at some point with the fix.
Nice, thanks for the detailed follow up.