Why vertical sync starts so early

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice. No drama.
Post Reply
gnomeby
Posts: 1
Joined: 15 Aug 2019, 03:19

Why vertical sync starts so early

Post by gnomeby »

Hello.

I've noticed in the gtemu that Vertical Synchronization signal starts in the same time as Horizontal front porch.
Image
Not from beginning of X or from Horizontal sync signal.

Is that correct in general or it does not matter?

Thanks.
User avatar
marcelk
Posts: 488
Joined: 13 May 2018, 08:26

Re: Why vertical sync starts so early

Post by marcelk »

gnomeby wrote: 15 Aug 2019, 03:37
Is that correct in general or it does not matter?
Well spotted! We believe it's correct in general. For VGA, a scanline is:
  1. horizontal front porch
  2. horizontal pulse
  3. horizontal back porch
  4. pixel burst
In that order.

Vertical sync is a whole number of scanlines, so it begins at a horizontal front porch.

Having said that, it's entirely possible that for many screens it doesn't matter... We haven't tested to deviate from this.

[Edit: To complete the answer: gtemu.c thus emits unaligned scanlines because that's simpler: emit a newline at end of horizontal pulse. Hence the jagged vSync in the Terminal window.

Note: In the same way, the scanline numbering that gtemu.c emits is aligned with pixel lines, and not with the vertical front porch. That's simpler when inspecting the output with a program such as 'less' (you can search for 'line 0' to hop back and forth from frame to frame). But in the ROM source code comments, we still start counting scanlines from the vertical front porch.]
Post Reply