Z26, VSYNC, Timers, somebody HELP ME! (was: Re: [stella] Gunfight Release Candidate(s))

Subject: Z26, VSYNC, Timers, somebody HELP ME! (was: Re: [stella] Gunfight Release Candidate(s))
From: Manuel Polik <cybergoth@xxxxxxxx>
Date: Thu, 08 Nov 2001 17:12:38 +0100
Hi Glenn!

>Manuel, it looks like Gunfight is taking up too much 
calculation time 
>during VBLANK or OVERSCAN because the screen is jerking 
up one or two 
>scanlines during the opening music or when processing 
controller moves or 
>gunshots during gameplay.

Using too many cycles definitely can't be the source 
causing any jerking in Gunfight. Even in a worst case 
scenario there's 10+ pure idle scannlines during VBLANK 
and another 20+ idle scannlines during the Overscan, 
where I'm just waiting for the timer to finish. I think 
I'm very close to generating 262 frames too.

>This may not be visible in PAL or emulators, but it is 
on NTSC on the real 
>thing.

Out of the Z26 log I find this odd looking sequences 
around VSYNC:

Here it seems I'm doing 262 scannlines:

(  5 261  57 103) ( 10 123   8   8  22) nvbdIzc 01 ff 04 
fd  f4a7: ad 84 02 lda  INTIM   
(  5 261  61 115) ( 10 123   8   8  22) nvbdIZc 00 ff 04 
fd  f4aa: d0 fb    bne  f4a7    
(  5 261  63 121) ( 10 123   8   8  22) nvbdIZc 00 ff 04 
fd  f4ac: 60       rts          
(  5 261  69 139) ( 10 123   8   8  22) nvbdIZc 00 ff 04 
ff  f251: 4c 7d f2 jmp  f27d    
(  5 261  72 148) ( 10 123   8   8  22) nvbdIZc 00 ff 04 
ff  f27d: 84 02    sty  WSYNC   
(  5 262   0 -68) ( 10 123   8   8  22) nvbdIZc 00 ff 04 
ff  f27f: a0 02    ldy #02      
(  5 262   2 -62) ( 10 123   8   8  22) nvbdIzc 00 ff 02 
ff  f281: 84 00    sty  VSYNC   
(  6   1   5 -53) ( 10 123   8   8  22) nvbdIzc 00 ff 02 
ff  f283: 84 02    sty  WSYNC   

Here it seems I'm doing 263 scannlines:

(  1 261  60 112) ( 11 123   0   0  22) nvbdIzc 01 ff 14 
fd  f4a7: ad 84 02 lda  INTIM   
(  1 261  64 124) ( 11 123   0   0  22) nvbdIZc 00 ff 14 
fd  f4aa: d0 fb    bne  f4a7    
(  1 261  66 130) ( 11 123   0   0  22) nvbdIZc 00 ff 14 
fd  f4ac: 60       rts          
(  1 261  72 148) ( 11 123   0   0  22) nvbdIZc 00 ff 14 
ff  f251: 4c 7d f2 jmp  f27d    
(  1 261  75 157) ( 11 123   0   0  22) nvbdIZc 00 ff 14 
ff  f27d: 84 02    sty  WSYNC   
(  1 262  76 160) ( 11 123   0   0  22) nvbdIZc 00 ff 14 
ff  f27f: a0 02    ldy #02      
(  1 263   2 -62) ( 11 123   0   0  22) nvbdIzc 00 ff 02 
ff  f281: 84 00    sty  VSYNC   
(  2   1   5 -53) ( 11 123   0   0  22) nvbdIzc 00 ff 02 
ff  f283: 84 02    sty  WSYNC   

It seems that it's possible that I'm already stepping 
onto a new scannline, between moment the counter expires 
and hitting VSYNC.

Since, as Eckhard suggested lately, I'm doing a STA 
WSYNC right before the VSYNC, but this might force me 
onto a wrong scannline.

Now, what should I do?

-Remove the STA WSYNC again?
-Try a smaller timer value?
-Do the LDY #$02 before the STA WSYNC?
-Any other idea to grant a stable picture?

And why is Z26 not jerking?

Greetings,
	Manuel

----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/


Current Thread