Page 1 of 1

basic : screen scroll left and right ,the picture shakes in the first two zeilen

Posted: Fri Apr 05, 2024 9:54 am
by funkheld
Hi good afternoon.

when I scroll the screen right and left with R/T with basic
then the graphic shakes in the first two zeilen ( not visible in the photo).

How can I eliminate this please?

Is there a sync for that...?

I set it to -mhz 24.

Code: Select all

SCREEN $80

GOSUB SCRFULL

START:
  GET A$ 
  B=ASC(A$)
  IF B=88 THEN GOTO WEITER
  IF B=82 THEN GOSUB SCRLINKS
  IF B=84 THEN GOSUB SCRRECHTS
GOTO START

WEITER:
END

SCRFULL:
 FOR K=0 TO 128*40 STEP 2		
    VPOKE 1,$B000+K,2   
    VPOKE 1,$B000+K-1,0*16+2  
 NEXT K	
RETURN 

SCRRECHTS:
   I=(I-1) AND $FF
   IF I=255 THEN U=(U-1) AND $FF
   POKE $9F38,U
   POKE $9F37,I
RETURN	

SCRLINKS:
   I=(I+1) AND $FF
   IF I=0 THEN U=(U+1) AND $FF
   POKE $9F38,U
   POKE $9F37,I	  
RETURN
Thanks.
greeting

Re: basic : screen scroll left and right ,the picture shakes in the first two zeilen

Posted: Fri Apr 05, 2024 11:17 am
by ahenry3068
funkheld wrote: Fri Apr 05, 2024 9:54 am Hi good afternoon.

when I scroll the screen right and left with R/T with basic
then the graphic shakes in the first two zeilen ( not visible in the photo).

How can I eliminate this please?

Is there a sync for that...?

I set it to -mhz 24.

Code: Select all

SCREEN $80

GOSUB SCRFULL

START:
  GET A$ 
  B=ASC(A$)
  IF B=88 THEN GOTO WEITER
  IF B=82 THEN GOSUB SCRLINKS
  IF B=84 THEN GOSUB SCRRECHTS
GOTO START

WEITER:
END

SCRFULL:
 FOR K=0 TO 128*40 STEP 2		
	VPOKE 1,$B000+K,2   
    VPOKE 1,$B000+K-1,0*16+2  
 NEXT K	
RETURN 

SCRRECHTS:
   I=(I-1) AND $FF
   IF I=255 THEN U=(U-1) AND $FF
   POKE $9F38,U
   POKE $9F37,I
RETURN	

SCRLINKS:
   I=(I+1) AND $FF
   IF I=0 THEN U=(U+1) AND $FF
   POKE $9F38,U
   POKE $9F37,I	  
RETURN
Thanks.
greeting
It's really hard to eliminate screen tearing in BASIC. The timing needed isn't there. To eliminate that you have to make sure you only update the registers during VBlank. The required timing is doable in assembly, Probably possible in Prog8 as Well. BASIC it's very difficult. (Without an assembly SUB).

Re: basic : screen scroll left and right ,the picture shakes in the first two zeilen

Posted: Fri Apr 05, 2024 9:01 pm
by desertfish
if you do SLEEP 1 in basic, I believe it more or less does a wait for the next vsync. You could try to insert that somewhere just before adjusting the scroll values.

Re: basic : screen scroll left and right ,the picture shakes in the first two zeilen

Posted: Fri Apr 05, 2024 9:22 pm
by funkheld
great, works.

With 24 MHz it scrolls in basic without flickering.

---------------------------
SCRRECHTS:
I=(I-1) AND $FF
IF I=255 THEN U=(U-1) AND $FF
SLEEP 1
POKE $9F38,U
POKE $9F37,I
RETURN

SCRLINKS:
I=(I+1) AND $FF
IF I=0 THEN U=(U+1) AND $FF
SLEEP 1
POKE $9F38,U
POKE $9F37,I
RETURN
--------------------------

Thanks.
greeting

Re: basic : screen scroll left and right ,the picture shakes in the first two zeilen

Posted: Sat Apr 06, 2024 3:52 am
by mortarm
funkheld wrote: Fri Apr 05, 2024 9:54 am ...the first two zeilen...
Zeilen?

Re: basic : screen scroll left and right ,the picture shakes in the first two zeilen

Posted: Sat Apr 06, 2024 6:41 am
by funkheld