Kick master title screen wobbling

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Zelex
Posts: 268
Joined: Fri Apr 29, 2011 9:44 pm

Kick master title screen wobbling

Post by Zelex » Tue Apr 09, 2013 4:11 am

EMUya is my first cycle accurate emulator, as in it runs 3 pixels for each CPU clock precisely when it should in the CPU. As well as the PPU is implemented very precisely. However, surprisingly EMUya emulates the most inaccurately in comparison to my other emulators with regards to a couple MMC3 games & the scanline counter irq.

Specifically, the title screen on Kick Master wobbles a bit. The fact that the wobbling is different on every frame implies that they don't synchronize with the IRQ at all and that they instruction time it, or it could mean that each IRQ occurs at slightly different times due to the fact that IRQs can only occur in between 2 instructions, and not in the middle of a single instruction. However, the MMC3 IRQ does go off at regular intervals down the screen (haven't checked if its masked yet) - about once every 8 scanlines starting at scanline 4 IIRC. The wobbling goes away if I do the IRQ at dot 240 instead of 260 (but that messes up other games). That implies that there isn't enough time in between the IRQ trigger and when rendering starts for them to be able to execute instructions. Any ideas as to the cause? I was thinking because the difference is 20 dots or so (about the cycles of a IRQ), maybe my IRQ timing is off (however I pass all the tests).

User avatar
infiniteneslives
Posts: 2102
Joined: Mon Apr 04, 2011 11:49 am
Location: WhereverIparkIt, USA
Contact:

Re: Kick master title screen wobbling

Post by infiniteneslives » Tue Apr 09, 2013 8:02 am

Not sure if it helps or not, but it's at least relevant. In creating my own MMC3 in hardware I had similar issues until I got the CHR A12 filtering correct. IIRC, I found not allowing 2 scanline clocks within ~5CPU cycles to be accurate and remove 'wobbling' from all titles I tested.
If you're gonna play the Game Boy, you gotta learn to play it right. -Kenny Rogers

User avatar
Zepper
Formerly Fx3
Posts: 3223
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: Kick master title screen wobbling

Post by Zepper » Tue Apr 09, 2013 11:22 am

I have the same problem with Kick Master.

Zelex
Posts: 268
Joined: Fri Apr 29, 2011 9:44 pm

Re: Kick master title screen wobbling

Post by Zelex » Tue Apr 09, 2013 9:17 pm

infiniteneslives wrote:Not sure if it helps or not, but it's at least relevant. In creating my own MMC3 in hardware I had similar issues until I got the CHR A12 filtering correct. IIRC, I found not allowing 2 scanline clocks within ~5CPU cycles to be accurate and remove 'wobbling' from all titles I tested.
I thought that might be the issue, so I hacked it to only occur on dot 260 to eliminate any possibilities there, still wobbles. =/

Zelex
Posts: 268
Joined: Fri Apr 29, 2011 9:44 pm

Re: Kick master title screen wobbling

Post by Zelex » Tue Apr 09, 2013 9:18 pm

Well anyway. I'm going to spend a bunch of time looking at trace logs trying to figure out precisely what the code is trying to do, which should help me figure out what is wrong. I'll report back with my findings.

Zelex
Posts: 268
Joined: Fri Apr 29, 2011 9:44 pm

Re: Kick master title screen wobbling

Post by Zelex » Tue Apr 09, 2013 9:43 pm

FCEUX jumps 30 dots on an IRQ.

It also looks their IRQ is delayed by 1 or 2 instructions.

x0000
Posts: 43
Joined: Thu Feb 28, 2013 11:14 am
Contact:

Re: Kick master title screen wobbling

Post by x0000 » Wed Apr 10, 2013 6:46 am

Can you add some screenshots to the post? I don't quite understand the issue.

Zelex
Posts: 268
Joined: Fri Apr 29, 2011 9:44 pm

Re: Kick master title screen wobbling

Post by Zelex » Wed Apr 10, 2013 8:54 am

So, I'm not 100% sure why, but doing the MMC3 interrupt at dot 270 fixes all problems with every game I've tested thus far. The reason it works is It brings the timing in line with FCEUX. I'm still unsure why FCEUX has this additional delay in there.

x0000
Posts: 43
Joined: Thu Feb 28, 2013 11:14 am
Contact:

Re: Kick master title screen wobbling

Post by x0000 » Wed Apr 10, 2013 12:17 pm

I've never experienced the problem you have even tho my emulator generates IRQ at 260 pixel. So I think something wrong with CPU's IRQ processing or PPU's timings are not right. Does your emulator pass all blargg's cpu interrupt tests?

Zelex
Posts: 268
Joined: Fri Apr 29, 2011 9:44 pm

Re: Kick master title screen wobbling

Post by Zelex » Wed Apr 10, 2013 12:19 pm

x0000 wrote:I've never experienced the problem you have even tho my emulator generates IRQ at 260 pixel. So I think something wrong with CPU's IRQ processing or PPU's timings are not right. Does your emulator pass all blargg's cpu interrupt tests?
Last time I checked, yup. I'll check again.

Zelex
Posts: 268
Joined: Fri Apr 29, 2011 9:44 pm

Re: Kick master title screen wobbling

Post by Zelex » Wed Apr 10, 2013 8:56 pm

I pass all CLI/instruction timing tests. I do not pass all of the VBL/NMI timing tests. However, I think the CLI tests would be the most important ones here in terms of what needs to be correct. So my question still stands on why does FCEUX have this additional delay that games expect.

beannaich
Posts: 207
Joined: Wed Mar 31, 2010 12:40 pm

Re: Kick master title screen wobbling

Post by beannaich » Wed Apr 10, 2013 9:14 pm

I don't implement any kind of delay, aside from emulating the irq flag polling accurately. And this game does not shake or wobble at all.

Zelex
Posts: 268
Joined: Fri Apr 29, 2011 9:44 pm

Re: Kick master title screen wobbling

Post by Zelex » Wed Apr 10, 2013 9:34 pm

beannaich wrote:I don't implement any kind of delay, aside from emulating the irq flag polling accurately. And this game does not shake or wobble at all.
oh I agree, its probably a problem with my emulator somehow, just not sure exactly what, and why FCEUX has a 10 dot delay.

beannaich
Posts: 207
Joined: Wed Mar 31, 2010 12:40 pm

Re: Kick master title screen wobbling

Post by beannaich » Wed Apr 10, 2013 10:13 pm

Zelex wrote:oh I agree, its probably a problem with my emulator somehow, just not sure exactly what, and why FCEUX has a 10 dot delay.
Since when is FCEUX the gold standard for accuracy? I thought it was the "Speed at all costs" emulator.

User avatar
infiniteneslives
Posts: 2102
Joined: Mon Apr 04, 2011 11:49 am
Location: WhereverIparkIt, USA
Contact:

Re: Kick master title screen wobbling

Post by infiniteneslives » Wed Apr 10, 2013 11:34 pm

Zelex wrote:I pass all CLI/instruction timing tests. I do not pass all of the VBL/NMI timing tests. However, I think the CLI tests would be the most important ones here in terms of what needs to be correct. So my question still stands on why does FCEUX have this additional delay that games expect.
What about blargg's MMC3 IRQ test? That's really what your having issues with...
If you're gonna play the Game Boy, you gotta learn to play it right. -Kenny Rogers

Post Reply