Re: [stella] VBLANK or VSYNC first?

Subject: Re: [stella] VBLANK or VSYNC first?
From: ben <ben@xxxxxxxx>
Date: Tue, 23 Oct 2001 10:14:19 +1000
At 11:30 AM 10/22/2001 -0400, you wrote:
>I think you may be confusing RSYNC with VSYNC.  The *ONLY* thing RSYNC does
>is reset the horizontal counters.  That's it.

Sorry, I meant VSYNC everywhere - I ignore RSYNC which I hoped was ok  :)

>The above is correct.  VBLANK just blanks the video output.  The sync line
>is still active.  VBLANK is a lazy way to get a black screen.  In this case,
>they are using VBLANK to create the 3 lines of equalization pulses before
>VSYNC.  Then they do 3 lines of VSYNC.  You don't mention when they turn off
>VBLANK, and I don't have the code in front of me.  But it's perfectly
>acceptable to do the following:
>turn on VBLANK
>turn on VSYNC
>turn off SYNC
>turn off VBLANK

When VSYNC is started, I assume the programmer writes to this register to
ensure that the hardware is effectively going to reset the beam to the top
left without executing instructions?  Is this true?  In the code above, I
guess the screen is black when VBLANK is on, and outputs normal colors when
turned off?  And this can be done anywhere anytime?  Does 'VSYNC on'
syncronise the microprocessor with the top left of the screen?  As in, if
VSYNC happens mid-screen, will the next thing happen at the top of the
screen instruction-wise?

Here is a sample of what I am interpreting:

TIA_w - WSYNC - HowizPos is 132
Background Color set to 0
TIA_w - WSYNC - HowizPos is 24
TIA_w - WSYNC - HowizPos is 29
TIA_w - WSYNC - HowizPos is 83
TIA_w - VBLANK Start - Scanline is 30
TIA_w - WSYNC - HowizPos is 17
TIA_w - WSYNC - HowizPos is 8
TIA_w - WSYNC - HowizPos is 8
TIA_w - VSYNC Start Scanline = 33 HorizPos = 8
   Note: I resync to top now - is this correct?
ScreenUpdate - Resynced with VSYNC!
   Note: So now we are at scanline 0!
TIA_w - WSYNC - HowizPos is 9
TIA_w - WSYNC - HowizPos is 9
TIA_w - WSYNC - HowizPos is 15
TIA_w - VSYNC Stop Scanline = 3 HorizPos = 9
Background Color set to 234
TIA_w - WSYNC - HowizPos is 143
TIA_w - WSYNC - HowizPos is 38
TIA_w - VBLANK Stop - Scanline is 137
TIA_w - WSYNC - HowizPos is 65

So when I see VSYNC, I resync with the screen updates, and then always see
3 lines to VSYNC thanks to the combat code itself, but VBLANK is mangled in
there too (the value 137 is a re-synced value due to start VSYNC at
scanline 0).  What is actually happening in hardware when VSYNC is started
and stopped?   Does it affect the sync with the TIA and CPU at all like
WSYNC does?   I am now assumeing all VBLANK does is blank the screen, but
does not affect timing/sync :)

>The start of the frame is set by when you turn off VSYNC.  VBLANK can come at
>any has no effect whatsoever on timing.  You can change VSYNC at
>time too, for that matter.   That's why you must wait for WSYNC (or count
>cycles) to toggle VSYNC.  It has no knowledge of the horizontal counter.
>Internally, VSYNC is just XORed with the regular sync signal that is
>by the horizontal counters.

Yes, I see that now in the docs - thanks.  I guess I dont understand what
happens when you "VSYNC at any time" in terms of cycles executed, where the
beam ends up, and effect on the CPU/TIA sync.

emulation fun ;)  


Archives (includes files) at
Unsub & more at

Current Thread