Board index » delphi » Smooth Scrolling Text ?

Smooth Scrolling Text ?

I am tryiing to make a smooth scrolling lister, which should list text-files
longer than 100 lines. But my Problem is, that the videoram only can take up
to 50 lines per page. So I tryed making virtual-pages (like in mode
13h). Now the lister can scroll DOWN, but if I want that it should scroll
up, the screen starts to flicker, even if I wait for/after retrace ...

It would be nice, if someone could help me with a nice source/hint...

regards,   Nusi
--
Our Project should be  | A Salam Aleikum |     /   |  _     \ |        | |
to rescue the whole    |                 |  _o_\_,_;_(_  '_o_\;__,_,_,_; |
World          {NUSI}  |                 | (    ..       (

 

Re:Smooth Scrolling Text ?


On 4 Sep 1995, Nusret Tasci wrote:

Quote
> I am tryiing to make a smooth scrolling lister, which should list text-files
> longer than 100 lines. But my Problem is, that the videoram only can take up
> to 50 lines per page. So I tryed making virtual-pages (like in mode
> 13h). Now the lister can scroll DOWN, but if I want that it should scroll
> up, the screen starts to flicker, even if I wait for/after retrace ...

Break up your texts into 25-line chunks.  I'll assume you're using the
variable names position for position and chunk[0..maxchunk] of the chunks
of text, and vidmem[0..49, 0..79] can be your video memory.  Anyway, for
each frame:

var
  startline : word; { The starting line of text }
  c1, c2 : word;    { The chunk numbers to use }

begin
  retrace; {i.e. wait for it}
  startline := position div 16; { 16 pixels vertically per line... change
this for qhatever font size you're using }
  c1 := startline mod 25;
  c2 := c1 + 1;
  move (chunk[c1], vidmem[0], sizeof(chunk));
  move (chunk[c2], vidmem[25], sizeof(chunk));
  SetVerticalScroll (position);
end.

Now obviously you can optimize this a little bit and reduce any flicker
which may come up by doing two things:

1. Convert your move()s from byte-size to word-size
2. Only call the last three lines when c1 doesn't equal what c1 was last time

As a final note, this doesn't check for the end of the file or anything,
as I am assuming that you're not letting the position scroll that far. :)

-----------------\------------------------------------------------------------
Quantum Porcupine \-\  People kept on telling me to get on with it and write
a.k.a. Joshua Shagam > my damn .sig file.  Well I finally got around to it
jsha...@nmsu.edu /--/  since I finally got SIG of it all.
----------------/-------------------------------------------------------------
  Missing Link / Puuttuva Lenkki

Other Threads