THE SIMPLEST WAY OF HORIZONTAL TEXTSCROLLING IN GFA-BASIC
(WITHOUT ASSEMBLER) by Mike from M.H.R.
Last time (in ST NEWS 3.4) I showed you how to scroll text or
pictures vertical. Now I want to show you how to scroll text
horizontal. Maybe you know that the ST is not built for
horizontal scrolling (because of this stupid screen-structure).
In assembler you have to rotate a lot of bits to scroll
horizontal (and that takes time). But I don't want to include
My solution is extremely simple and works on every ST (but only
in low resolution).
Now the explanation of the routine (you find the GfA-Basic
listing on the ST NEWS disk):
First you switch off the mouse to prevent flickering. Then you
make sure, that the scroll runs on 50 Hz. I've seen, that more
sentences can be scrolled in 50 Hz mode. Here you can see how
much sentences can be scrolled in which mode:
Mode If you compile the routine With the GfA-Interpreter
50 Hz 17 sentences 9 sentences
60 Hz 13 sentences 5 sentences
Then you write the numbers of the used sentences into the
variable ZEILEN. The speed of the scroll has to be written into
the variable SPEED (-2 is faster than -1). After that you print
the text on the screen and catch each sentence as graphic into a
string-variable (with GET). The last letter of the last sentence
has to be a SPACE, so that the last real letter will be erased at
the end. In the FOR/NEXT loop all sentences will be put into the
screen in distances of 320 pixels. VSYNC takes care that the
scroll is smoothly and without flickering. The loop changes the
horizontal coordinates of the PUT-commands. At the end you have
to switch on the mouse again.
Because the computer only has to draw the part of the text that
is visible, this routine is fast enough, to scroll the text
smoothly and with a constant speed.
That's all. Try the sample-program and experiment a little.
You also can scroll graphics with this routine (but only 7
screen-lines high). The font must not be the system-font (a
letter also can have 16 colors).
I hope you understand all this stuff, because it is not easy for
me, to write all this in perfect English. If you have problems,
questions, some comments or something else, write to:
Now I have to say good bye and I hope you have fun using this