A new PPU timing quirk (?)

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

User avatar
thefox
Posts: 3139
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

A new PPU timing quirk (?)

Post by thefox »

...
Last edited by thefox on Sat Nov 17, 2012 5:37 pm, edited 2 times in total.
User avatar
Dwedit
Posts: 4470
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Post by Dwedit »

I bet Blargg will flip out.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Post by Bregalad »

I'm not sure what you are talking about. What does exacly means "a master cycle is skipped" ?
Also does anything "bad" happens when you poll $2002 ?
Useless, lumbering half-wits don't scare us.
User avatar
cpow
NESICIDE developer
Posts: 1097
Joined: Mon Oct 13, 2008 7:55 pm
Location: Minneapolis, MN
Contact:

Re: A new PPU timing quirk

Post by cpow »

thefox wrote:The quirk happens consistently (on some PPU-CPU synchronizations) for example in cases where a program polls $2002 for vblank or sprite 0 hit. Programs that don't read the registers during rendering are also consistently stable, so I doubt my test rig is faulty.
Doesn't this actually *shift* the PPU-CPU synchronization if the PPU delays for one master-clock cycle when this happens?
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

Let me see if I got this right: when you read from PPU registers during rendering it slightly screws up the frame's timing? Weeeeeeird...

How could we possibly use this to our advantage? Does it change the color blending or dot crawl in any way?
User avatar
thefox
Posts: 3139
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Post by thefox »

...
Last edited by thefox on Sat Nov 17, 2012 5:37 pm, edited 1 time in total.
User avatar
cpow
NESICIDE developer
Posts: 1097
Joined: Mon Oct 13, 2008 7:55 pm
Location: Minneapolis, MN
Contact:

Post by cpow »

thefox wrote:HSync takes care of syncing every scanline so the slight differences in timing aren't really visible. Maybe in some extreme case with very carefully placed reads a scanline could be shifted/stretched a little bit horizontally...
I was hoping HSync would come into the discussion because I was having a hard time figuring out how the thing works at all with this quirk and the [probably massive] proportion of games that spin-lock on sprite-0 hits.
ReaperSMS
Posts: 174
Joined: Sun Sep 19, 2004 11:07 pm

Post by ReaperSMS »

This is with signaltap clocked from the 21MHz master?

I was going to say that it could just be clock jitter, or a side effect of synchronizing the signal, though that shouldn't manage to shift the scanline timing, short of causing the python script to miss a line here or there.

For my purposes, I'm going to go with a "oh hell no" approach for emulating this. The monitor I'm hooked up to rejects any jitter at all in the hsync rate.
User avatar
thefox
Posts: 3139
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Post by thefox »

...
Last edited by thefox on Sat Nov 17, 2012 5:37 pm, edited 1 time in total.
User avatar
thefox
Posts: 3139
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Post by thefox »

...
Last edited by thefox on Sat Nov 17, 2012 5:37 pm, edited 1 time in total.
User avatar
MottZilla
Posts: 2835
Joined: Wed Dec 06, 2006 8:18 pm

Post by MottZilla »

I'll give it a try.

Update: Sorry, there is no visible difference, even up close. I use a Sony PVM CRT with standard composite video from a standard US Front Loading / Toaster NES.

Do you think the revision of CPU or PPU chips is related to this effect?
User avatar
Dwedit
Posts: 4470
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Post by Dwedit »

Should make it triggered by pressing A, not swapping roms. That would make it easier to see any differences.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
MottZilla
Posts: 2835
Joined: Wed Dec 06, 2006 8:18 pm

Post by MottZilla »

I agree, but I'm still pretty certain I saw no difference. And no effect as suggested that occurs.
User avatar
thefox
Posts: 3139
Joined: Mon Jan 03, 2005 10:36 am
Location: Tampere, Finland
Contact:

Post by thefox »

...
Last edited by thefox on Sat Nov 17, 2012 5:37 pm, edited 1 time in total.
User avatar
bigjt_2
Posts: 82
Joined: Wed Feb 10, 2010 4:00 pm
Location: Indianapolis, IN

Post by bigjt_2 »

Okay so this thread's timely. I was just about to post a thread asking about an unnerving problem I discovered last night on my project where NMI is seemingly interrupting itself!

I've produced two log files from Nintendulator, both showing an instance where the NMI interrupt seems to happen at scanline 250, cycle 233. That's right, in both instances where I captured this bug it even happened in the same cycle. My NMI handler had not completed by this scanline and was still about a dozen or so lines away from RTI. This didn't happen in the same exact part of the code, however (the second time I captured it, it happened several frames after the first time I captured it) but when it did happen both times it was right at SL 250, CYC 233.

My code does read $2002 to wait for vblank A BUNCH - mostly when initializing new stages and loading new palettes, etc. Am I understanding what thefox is talking about here and is this the same kind of situation?
Post Reply