nesdev.com
http://forums.nesdev.com/

Difference (Unl) shakes in my emulator
http://forums.nesdev.com/viewtopic.php?f=3&t=15484
Page 1 of 6

Author:  zeroone [ Thu Feb 02, 2017 8:00 pm ]
Post subject:  Difference (Unl) shakes in my emulator

GoodNES3.23b includes an unlicensed ROM called Difference. It's an MMC3 ROM and, as you can see in the animated GIF below, the green bar at the bottom shakes.

Image

This does not appear to happen in any other emulator. I never noticed issues with other MMC3 ROMs. Any suggestions for how to track down the source of this problem?

Author:  Zepper [ Fri Feb 03, 2017 6:44 pm ]
Post subject:  Re: Difference (Unl) shakes in my emulator

It's a race condition between $2006 and the Y-increment at PPU scanline cycle 256. If the $2006 write occurs a bit before cycle 256 (here after 254th), the Y-increment should NOT occur.

Author:  zeroone [ Fri Feb 03, 2017 8:08 pm ]
Post subject:  Re: Difference (Unl) shakes in my emulator

Zepper wrote:
It's a race condition between $2006 and the Y-increment at PPU scanline cycle 256. If the $2006 write occurs a bit before cycle 256 (here after 254th), the Y-increment should NOT occur.


Interesting. What about if it coincides with an X-increment? Do you have a link to more information about this race condition?

Edit: Also, a $2006 write might not affect the v register. What if it only updates the t register?

Author:  Zepper [ Sat Feb 04, 2017 4:34 am ]
Post subject:  Re: Difference (Unl) shakes in my emulator

The only information is in this discussion, here.

Author:  Alyosha_TAS [ Sat Feb 04, 2017 7:50 am ]
Post subject:  Re: Difference (Unl) shakes in my emulator

Interesting, I'm not getting any shaking with or without accounting for the $2006 race condition.
Are you sure it's not an IRQ timing issue?

Author:  Zepper [ Sat Feb 04, 2017 8:05 am ]
Post subject:  Re: Difference (Unl) shakes in my emulator

Alyosha_TAS wrote:
Interesting, I'm not getting any shaking with or without accounting for the $2006 race condition.
Are you sure it's not an IRQ timing issue?

Unless the MMC3 test ROMs are not enough... My emulator passes in all tests.

Author:  zeroone [ Sat Feb 04, 2017 9:54 am ]
Post subject:  Re: Difference (Unl) shakes in my emulator

It does not shake in Nintendulator 970. Here is the write $2006 code for that version:

Code:
static   void   __fastcall   Write6 (int Val)
{
   if (HVTog)
   {
      IntReg &= 0x00FF;
      IntReg |= (Val & 0x3F) << 8;
   }
   else
   {
      IntReg &= 0x7F00;
      IntReg |= Val;
      VRAMAddr = IntReg;
   }
   HVTog = !HVTog;
}


It updates the v register (VRAMAddr), the t register (IntReg) and the w register (HVTog) immediately. There is no indication of write suppression that I can see.

I will carefullly read through your thread. I see it mentions Kick Master title screen issues, but I never noticed any.

Author:  Zepper [ Sat Feb 04, 2017 11:16 am ]
Post subject:  Re: Difference (Unl) shakes in my emulator

zeroone wrote:
There is no indication of write suppression that I can see.

Who said "write suppression"? I said that a write to $2006 may occur a few PPU cycles before the Y-increment at PPU cycle 256. If such write was done, the Y-increment should NOT occur. Otherwise, we'll have $2006 scroll value PLUS 1.

Author:  zeroone [ Sat Feb 04, 2017 11:43 am ]
Post subject:  Re: Difference (Unl) shakes in my emulator

Zepper wrote:
Who said "write suppression"? I said that a write to $2006 may occur a few PPU cycles before the Y-increment at PPU cycle 256. If such write was done, the Y-increment should NOT occur. Otherwise, we'll have $2006 scroll value PLUS 1.


Here's the Nintendulator 970 code for the Y-increment:

Code:
         if ((VRAMAddr & 0x7000) == 0x7000)
            {
               register int YScroll = VRAMAddr & 0x3E0;
               VRAMAddr &= 0xFFF;
               if (YScroll == 0x3A0)
                  VRAMAddr ^= 0xBA0;
               else if (YScroll == 0x3E0)
                  VRAMAddr ^= 0x3E0;
               else   VRAMAddr += 0x20;
            }
            else   VRAMAddr += 0x1000;


There is no check to see if a $2006 write occurred shortly before or after.

Author:  Zepper [ Sat Feb 04, 2017 12:06 pm ]
Post subject:  Re: Difference (Unl) shakes in my emulator

I didn't take such thing from Nintendulator. You're looking for something NULL. Don't be boring.
I already told you what's the issue regarding the score shaking. Probably it's an hack. Feel free to analyze a Nintendulator CPU log and compare it with yours... or ask Q directly.

Author:  zeroone [ Sat Feb 04, 2017 12:17 pm ]
Post subject:  Re: Difference (Unl) shakes in my emulator

Zepper wrote:
I didn't take such thing from Nintendulator. You're looking for something NULL. Don't be boring.
I already told you what's the issue regarding the score shaking. Probably it's an hack. Feel free to analyze a Nintendulator CPU log and compare it with yours... or ask Q directly.


The green bar does not shake in Nintendulator. If it is a race condition, I would expect a similar check required in the Nintendulator code.

I prefer not to add in hacks to make specific games function. Even if the test ROMs pass, it may break some other games.

Author:  Alyosha_TAS [ Sat Feb 04, 2017 12:36 pm ]
Post subject:  Re: Difference (Unl) shakes in my emulator

I'm not logging any $2006 race condition cases from Difference.
The log shows plenty from Kick Master so I'm pretty sure I'm logging and emualting it correctly.

I've never quite been confident in MMC3 IRQs so to me this is an interesting new test case. I'll try to see if there is any combination of things I can do to reproduce this shaking.

Author:  Zepper [ Sat Feb 04, 2017 12:38 pm ]
Post subject:  Re: Difference (Unl) shakes in my emulator

zeroone wrote:
I prefer not to add in hacks to make specific games function. Even if the test ROMs pass, it may break some other games.

You're misunderstanding the things again. It's unrelated with the MMC3 IRQ test ROMs!

Author:  zeroone [ Sat Feb 04, 2017 1:50 pm ]
Post subject:  Re: Difference (Unl) shakes in my emulator

This game does not appear to run correctly in NO$NES. The green bar does not render properly.

Author:  fred [ Sat Feb 04, 2017 7:11 pm ]
Post subject:  Re: Difference (Unl) shakes in my emulator

I very briefly tested writes to 0x2006 a while back in visual nes. It did seem like setting vramaddr_v to vramaddr_t in the second write was delayed a few ticks (~3?). I don't know the inner workings of the ppu enough to tell for certain.

The status bar in bart vs the space mutants that relies on a 6-5-5-6 series of writes stops shaking in my emulator if i delay the v = t effect for 3 ppu ticks. My cpu-ppu sync is not good enough to prove anything though, as evident by battletoads stage 2 crashing even faster with this change.

Page 1 of 6 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/