Sorry, but i need to put an end to my doubt.
PPU scanline cycles: 1st,2nd,3rd... 340th,341th.
PPU scanline "dots": 0,1,2... 339,340.
Is this correct? I did confusion when reading the wiki, a few articles... about "VBlank being set at dot 1".
I've heard people saying "cycle 0" before, so I don't think there's a established convention. Being a programmer, I guess I prefer numbering things from 0, but I would appreciate if people bothered to explain the numbering they're using.
My understanding is there are 341 cycles/dots per line (one is skipped on odd frames on one particular line). So you either do 1 to 341 or 0 to 340. Whichever you prefer.
http://wiki.nesdev.com/w/index.php/File:Ntsc_timing.png
I'm guessing there's an internal X position counter where the logic for x=0 runs at step 1 of the counter, the logic for x=1 runs at step 2, etc.
I want to be sure about reading a statement like "occurs at dot 1 of scanline X", if "dot 1" means the FIRST cycle (1-based) or the SECOND (0-based). This info isn't clear on the wiki articles!
Zepper wrote:
I want to be sure about reading a statement like "occurs at dot 1 of scanline X", if "dot 1" means the FIRST cycle (1-based) or the SECOND (0-based). This info isn't clear on the wiki articles!
I always mean dot 1 as the second dot at least. I put in "(the second dot)" in a few places to avoid confusion like this. Please tell me if you think it's needed in other places too.
Edit: Oh, and I'd personally prefer if both dots and scanlines were always zero-based by convention. Having one be one-based and the other not is especially confusing.
tepples wrote:
I'm guessing there's an internal X position counter where the logic for x=0 runs at step 1 of the counter, the logic for x=1 runs at step 2, etc.
Yup - there's a scanline counter (counts 0-261) and a dot counter (counts 0-340) in the PPU. Their values are fed into decoding logic that generates control signals based on the current position.
The decoding logic is at
http://www.qmtpro.com/~nes/chipimages/v ... 2&zoom=7.4 btw; clicking on some of the vertical lines in the decoders should be illuminating (check the node name in the upper-right corner).
One succint convention that should be reasonably clear is 1st, 2nd, 3rd... and dot +0, dot +1, dot +2, etc. The + implies an offset, and naturally offset 0 is the beginning.
blargg wrote:
One succint convention that should be reasonably clear is 1st, 2nd, 3rd... and dot +0, dot +1, dot +2, etc. The + implies an offset, and naturally offset 0 is the beginning.
One drawback is that e.g. dot +6 might look like an offset relative to something else rather than an absolute position within a line. It's not obvious (to me anyway) that it's relative to the start of the line, and if you have to explain it, then you might as well just say whether you're using zero- or one-based indices (in cases where it might be unclear).