Animations "flashing" in BASIC

Basic and Machine Language

Moderator: Moderators

Post Reply
PgrAm
Vic 20 Newbie
Posts: 3
Joined: Fri Oct 14, 2011 1:24 pm

Animations "flashing" in BASIC

Post by PgrAm »

Hi everybody,

I recently acquired a VIC-20 as part of my vintage computer collection. I thought it would be fun to try to program a game so I opened up a book that came with the computer titled "Personal Computing on the VIC=20" (which is basically a tutorial for BASIC on the VIC-20) and got to work. Soon into my endeavor I realized I had a problem, everything on the screen suffered from terrible flickering. It was almost like it was flashing on and off. I am comfortable with many programming languages like c++ and BASIC. So I tried the same code on an IBM type PC and the same flickering occurred.

I stripped my code down to its most basic elements and this is what I got:

Code: Select all

10 PRINT "♥"
20 PRINT "███"
30 GOTO 10
I found the problem Is somewhere in this code I only showed this bit because I didn't want to type out the whole program.
oh and the heart is just a screen clear but the symbol for it doesn't exist on modern computers.

So my question is how do I refresh the screen without it flickering using BASIC?
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

Are you kidding? Of course it's going to flicker if you clear the screen all the time. Try just "home" instead, it will look like an inverted S.
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
PhilRanger
Vic 20 Hobbyist
Posts: 143
Joined: Thu Aug 25, 2011 10:04 am

Post by PhilRanger »

The flicker problem is about the time where the object isn't there. Doing a clear screen is quite long, it is better to just erase what you need, and even then put back the new stuff right after without any delay such as calculations (do all calculations BEFORE you erase). You can mitigate the effect a bit by adding a delay on the "on" time to make the ratio "there"/"not there" better, but nothing beats erasing just before putting back. You may have to split your actions such as:

erase A, put A
erase B, put B
erase C, put C
etc

so each object flickers less

Have fun!
Phil Ranger
-------------
"Don't eat the trees 2" for the VIC 20 : http://www.box.net/shared/u398kj0nr0lkauzm1k67
on line: http://www.mdawson.net/vic20chrome/vic2 ... otrees.prg
Post Reply