Anim Scripts
3 messages in this thread
Dear Keith Doyle,
I wrote you a lengthy note several days ago, including two segments of
sample script in which I was setting up to play non-looping anims as
randomly chosen subroutines. The question concerned why I was getting
"garbage" in my images.
Since I worte that, I generated another anim. It produced even worse
garbage! A careful review of my scripts and some detective work finally
isolated the problem. It seems I left the PAUSE command out just before
issuing the anim command. The pause below with <> around it is the one
which was missing:
102 rem title of subroutine
copy 3
display
copy
<pause 1>
/topn:
anim 6, done
pause 1
display
if done=0 then goto topn
return
As soon as that pause was added, everything worked fine.
The D2 manual, on p.7-7, shows this PAUSE in a script for the first time,
but it isn't mentioned in the narrative nor is its purpose explained. Could
you tell me what's going on at that point in the script and why I get
garbage when that PAUSE is left out? Thanks, Keith. Best George Roland
That's right, I remember now. The COPY command is occuring simultaneously
with your first ANIM command if you don't use the extra PAUSE. What
happens, is that when the blitter is setup for the last bitplane of the
COPY the blitter is told to go ahead and the CPU doesn't wait for its
completion, so that you can go on to process other things at the same time.
If another blitter operation is attempted, it will wait for completion, but
if a nonblitter operation (such as ANIM which is entirely a CPU process),
it may overlap. This can cause the ANIM command to get ahead of the
blitter and so the blit operation overwrites part of the ANIM causing a
glitch. The PAUSE command avoids this problem. Another approach might be
to do a very simple BLIT operation (1×1 pixel or something) which will have
the effect of waiting for the blitter to become available. I usually use
PAUSE because it does the trick and isn't quite so obscure (and may even be
more efficient). The behavior of COPY is documented I think, but it was
done that way for speed.
Keith
Keith,
Thanks for you response to my postings. The first issue is to get
the *%&$# thing working, but it's more satisfying to have a conceptual
grasp of why– sometimes it helps when something similar happens again. I'm
not a programmer so your not-too-technical reply was just right. Appreciate
it.
George