It is currently Wed Dec 13, 2017 4:18 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Fri Sep 04, 2015 7:55 am 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3076
Location: Brazil
Yup. My emu has the same problem of shaking the scorebar. It's probably related with sprite zero hits (Battletoads misses sprite zero hits, freezing the game).


Top
 Profile  
 
PostPosted: Sun Sep 06, 2015 12:15 pm 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 750
Location: New York, NY
In the latest beta version of Nintendulator, the status bar at the bottom on the screen in The Simpsons - Bart vs. the Space Mutants shakes as well. But, it doesn't in the latest official release.

Edit: Furthermore, the Wookie Hole (stage 2) of Battletoads freezes in the latest beta release. I can't pinpoint the change that broke these 2 games, but I found that delaying the sprite 0 hit flag by 1 PPU cycle prevents the status bar in The Simpsons from shaking. That is, it is almost as if the sprite 0 hit flag has an intermediate latch that delays the PPU register $2002 (PPUSTATUS) update by 1 PPU cycle.

Edit 2: With the intermediate sprite 0 hit flag latch in place that delays the PPUSTATUS register update by 1 PPU, it passes all the sprite 0 hit tests, including the timing related tests.

Edit 3: Battletoads still freezes even with that change.


Top
 Profile  
 
PostPosted: Sun Sep 06, 2015 4:14 pm 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 750
Location: New York, NY
@ Quietust

If you get a chance, please test Battletoads stage 2 and The Simpsons - Bart vs. the Space Mutants in the latest beta of Nintendulator.


Top
 Profile  
 
PostPosted: Sun Sep 06, 2015 8:02 pm 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3076
Location: Brazil
It works, but here these tests have failed - 5. left clipping (#2) and 11. edge timing (#2).


Top
 Profile  
 
PostPosted: Sun Sep 06, 2015 8:32 pm 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 750
Location: New York, NY
I think I found a way to fix both games in the latest Nintendulator beta. The MemGet function is organized like this:

Code:
Handle PCM cycles
Run mapper cycle / Run PPU cycles / Run APU cycle
Read value from memory


I moved the final operation to the top:

Code:
Read value from memory
Handle PCM cycles
Run mapper cycle / Run PPU cycles / Run APU cycle


Here's the actual modified code:

Code:
unsigned char   MemGet (unsigned int Addr)
{
   int buf;

   // avoid a function call if possible - if it's ReadPRG, then run it inline
   if (ReadHandler[(Addr >> 12) & 0xF] == ReadPRG)
   {
      if (Readable[(Addr >> 12) & 0xF])
         buf = PRGPointer[(Addr >> 12) & 0xF][Addr & 0xFFF];
      else   buf = -1;
   }
   else   buf = ReadHandler[(Addr >> 12) & 0xF]((Addr >> 12) & 0xF, Addr & 0xFFF);
   if (buf != -1)
      LastRead = (unsigned char)buf;

   if (PCMCycles)
   {
      // zero out PCMCycles so we don't recurse back into this case during the following fetches
      int _PCMCycles = PCMCycles - 1;
      PCMCycles = 0;
      if (((Addr == 0x4016) || (Addr == 0x4017)))
      {
         // Consecutive controller port reads from this are treated as one
         if (_PCMCycles--)
            MemGet(Addr);
         while (_PCMCycles--)
            RunCycle();
      }
      else
      {
         // but other addresses see multiple reads as expected
         while (_PCMCycles--)
            MemGet(Addr);
      }
      APU::DPCM::Fetch();
   }

   RunCycle();

   return LastRead;
}


I have not been able to freeze Battletoads stage 2 after this change. And, the status bar no longer shakes in The Simpsons - Bart vs. the Space Mutants.

I did not modify SetMem. In fact, if I reorganize SetMem in an analogous way, the freezing problem reappears.

With that change, it passes all the Sprite 0 Hit tests. (@ Zepper: Ignore what I said about the sprite 0 hit latch theory.)

However, Nintendulator still does not pass all of Blargg's NMI tests. But, the prior version never was able to pass all the tests anyway.

Edit: It looks like I spoke too soon. That changes makes Battletoads far more stable. But, after a dozen runs through the Wookie Hole, it finally froze. I wonder if the older version of Nintendulator also has this issue.


Top
 Profile  
 
PostPosted: Wed Sep 09, 2015 4:16 pm 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 750
Location: New York, NY
I continued to play around with the Nintendulator source versions trying to further understand what change made the beta less stable. In the current release (Nintendulator 0.970), the coarse X increments occur every PPU cycle % 3. Whereas, in Nintendulator 0.975 Beta, it was adjusted to PPU cycle % 7, making it more authentic. Perhaps, more significantly, the Y increment was changed from PPU cycle 251 to 255. Both are shifted by 4 PPU cycles. Consequentially, the increments happen at least 1 CPU cycle earlier in the current release.

The Battletoads and The Simpsons issues are both sprite 0 hit related. And, this slight timing difference is the only explanation I can find for why the beta appears less accurate. As noted earlier in the thread, this may have be fudged to some extent since CPU and PPU cycles cannot execute simultaneously.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group