VSYNC = $00
Enable/disable the vertical sync signal
WRITE | Name | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0
|
$00 | VSYNC | VSYNC |
Function
Bit | Function | Values | |||||||
VSYNC D1 | Control Vertical Sync | 0 = Stop vertical sync 1 =Start vertical sync |
A typical NTSC TV frame will consists of 3 vertical sync (VSYNC) lines, 37 vertical blank VBLANK lines, 192 TV picture lines, and 30 overscan lines. Both VSYNC and VBLANK can simply be turned on and off at the appropriate times, freeing the CPU for other activities during their execution.
When the electron beam has scanned 262 lines (NTSC) or 312 lines (PAL), the TV set must be signalled to blank the beam and position it at the top of the screen to start a new frame. This signal is called vertical sync, and the TIA must transmit this
signal for at least 3 scan lines. This is accomplished by writing a 1 in D1 of VSYNC to turn it on, count at least 2 scan lines, then write a 0 to D1 of VSYNC to turn it off.
Standard Macro
The dasm support file "macro.h" provides an efficient macro to perform the vertical sync on your game. Insert a call of the macro VERTICAL_SYNC at the start of your TV frame code, and it will generate the required 3 vertical sync scanlines with appropriate toggling of the D1 bit in VSYNC in just 9 bytes of code.
; ; VERTICAL_SYNC ; revised version by Edwin Blink -- saves bytes! ; Inserts the code required for a proper 3 scanline vertical sync sequence ; Note: Alters the accumulator ; OUT: A = 0 MAC VERTICAL_SYNC lda #%1110 ; each '1' bits generate a VSYNC ON line (bits 1..3) .VSLP1 sta WSYNC ; 1st '0' bit resets VSYNC, 2nd '0' bit exit loop sta VSYNC lsr bne .VSLP1 ; branch until VYSNC has been reset ENDM ;
Related
see TIA
see Television Protocol