text scrolling 
Author Message
 text scrolling

Hi...Sorry if you see one of these once a week, but here it goes:

I need a Text scroller for a message (greater than 255 chars??) .. I have one
that works right now..but I use the getintvec and setintvec with $8 which is
a programmable timer i think..but im afraid that it is slowing down my
computer clock, and its not consistent in its speed..I also need to be doing
other things (scrolling through options with arrow keys) while the scrolling
is going on..

any help would be appreciated .. you can post or reply by email at:




Wed, 18 Jun 1902 08:00:00 GMT  
 text scrolling

Quote:

> Hi...Sorry if you see one of these once a week, but here it goes:
> I need a Text scroller for a message (greater than 255 chars??) .. I have one
> that works right now..but I use the getintvec and setintvec with $8 which is
> a programmable timer i think..but im afraid that it is slowing down my
> computer clock, and its not consistent in its speed..I also need to be doing
> other things (scrolling through options with arrow keys) while the scrolling
> is going on..

> any help would be appreciated .. you can post or reply by email at:



If you need the scrolling to take place in the background then hooking
an interrupt is probably the best solution. The timer interrupt is
suitable for that purpose, but you have to keep some things in mind :

I assume you did NOT reprogram the timer to a higher rate, as 18.2 call per
seconds should be enough for a (readable) text scroller !

If your system clock slows down, your scroller needs more time than 1/18.2 secs.
You have also created the following PSEUDO-Structure

PROCEDURE SCROLL_HANDLER; INTERRUPT;
BEGIN
  SCROLL THAT TEXT
  PUSHF
  CALL OLD INTERRUPT HANDLER
END;

However, it should look like :

VAR INSAFEHANDLER:BOOLEAN;    {I think this must be global}

PROCEDURE SAFE_HANDLER; INTERRUPT;
BEGIN
  PUSHF
  CALL OLD INTERRUPT HANDLER
  IF NOT INSAFEHANDLER THEN
    INSAFEHANDLER:=TRUE
    SCROLL THAT TEXT
    INSAFEHANDLER:=FALSE
  END
END;

That way, the tick gets passed on at every interrupt. However this also means
that and EOI-Signal (End Of Interrupt} is sent to the the Master PIC
(P-something Interrupt Controller), which means that your scroller could
be called again before it is finished, hence the status flag. This
way your procedure is reentrant. Needless to say that INSAFEHANDLER has
to be initialized to FALSE.

I'm not sure about this but I think the EGA/VGA graphic card can generate an
interrupt on a vertical retrace. This might be more suitable for an
graphics routine.

   __/  __/   -  Christian Froeschlin
  /    /
 /     _/     * If you eliminate the impossible, whatever remains, *
___/ _/       * however improbable, must be the BUG !              *



Wed, 18 Jun 1902 08:00:00 GMT  
 text scrolling

|> Hi...Sorry if you see one of these once a week, but here it goes:
|>
|> I need a Text scroller for a message (greater than 255 chars??) .. I have one
|> that works right now..but I use the getintvec and setintvec with $8 which is
|> a programmable timer i think..but im afraid that it is slowing down my
|> computer clock, and its not consistent in its speed..I also need to be doing
|> other things (scrolling through options with arrow keys) while the scrolling
|> is going on..
|>
|> any help would be appreciated .. you can post or reply by email at:
|>

There are a number of ways to go about your problem.  But it depends
on whether you'd like the scrolling to be consistent in its speed or
you don't like to slow down your system by hooking Int 08h or 1Ch.
For a more consistent loop, you would have to use the timer int (08h
or 1Ch).  Or if you could call an "update" routine very often, then
you could do away with the timer int.  If the refresh rate is
relatively slow, you could still use either method - just make sure
that your update routine is somewhat fast.

Anyway, I'll let you decide on which technique to use on providing the
refresh calls.  If you need some more help, just drop me a line.
Below is a sample code that you could probably use for the update:

Uses Crt;

Var CurrIndex  : Word;     { current starting position of string       }
    ScreenLoc  : Pointer;  { location of scroll bar in video memory    }
    ScrollSize : Word;     { size of scroll bar (in columns)           }

Procedure Setup(Col, Row, ScrollSize : Word; Var ScreenLoc : Pointer);
Var Seg1, Ofs1 : Word;
Begin
   { we're assuming an 80 column text mode }
   Ofs1 := (Row-1)*160 + ((Col-1)*2);  

   { determine whether it's mono or colored }
   If (Mem[$40:$49] = 7) then Seg1 := $B000
     else Seg1 := $B800;

   ScreenLoc := Ptr(Seg1,Ofs1);  { I'm not sure about the syntax }
                                 { better check the online help  }
End;

Procedure Update;Assembler;
ASM
   CLD
   LES  DI, ScreenLoc    { ES:DI is where the scroll bar is in memory  }
   MOV  CX, ScrollSize

   MOV  SI, CurrIndex
   OR   SI, SI           { is it our first time to display the string? }


   MOV  AL, ES:[DI+2]    { left... ( we don't care about the attr)     }
   STOSB
   INC  DI               { skip the attribute position                 }

   MOV  AL, CS:[SI]      { see what's the next char to append...       }
   OR   AL, AL           { are we at the end of the string ?           }



   STOSB                 { put new char at tail of scroll bar          }

   INC  SI               { adjust index -- so that we know what's the  }



   MOV  AL, CS:[SI]
   OR   AL, AL

   STOSB                 { put char in video memory                   }
   INC  DI               { skip the attribute part                    }
   INC  SI               { adjust SI to point to next char in message }


   MOV  CurrIndex, SI    { Save index.  We need it again later        }  


   DB   'This is a sample message...'  { put your text message here   }

End;

Var Fedup : Boolean;

Begin
   ScrollSize := 40;  { adjust to your liking }

   { scroll bar at first row, 20th column }
   Setup(20,1,SCrollSize,ScreenLoc);

   CurrIndex := 0;   { initialize index }

   { sample code to test... I hope it works :-) }
   ClrScr;
   Repeat
     Update;
     Delay(100);     { must put some delay or something      }
                     { otherwise, you won't be able to read  }
                     { message... unless you're superman :-) }
     { do some other stuffs }

     Fedup := (KeyPressed) and (ReadKey = #27);
   Until (Fedup);
End.

Note that the example about is not fully tested.  Most of my post here
are made from scratch so I don't know if it would fit your needs.

Also, sorry for the term "scroll bar".  I know it means something else
but I can't think of something short but appropiate term.

Like I said, you have to judge whether to use a timer int or not.  But
if you could put the update routine in a loop that it gets to be executed in
regular intervals, that would be enough.

Happy programming...

YO!
ydeeps
--
Erwin D. Paguio
http://rh.iist.unu.edu/~ep/ydeeps.html
Pascal and ASM Enthusiast



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Smooth Text Scroll Help?

2. Smooth Text Scroll Help?

3. Problems with bottom right screen corner text scrolling.

4. Smooth Text Scrolling and Coppers! -TSCROLL.PAS

5. Text Scrolling

6. Fast text scrolling

7. Scrolling Text in Text Mode - PLEASE HELP!

8. Not in graphics mode scrolling text box?

9. Scrolling text file

10. scrolling in text mode

11. Scrolling text up and down

12. scrolling in text mode

 

 
Powered by phpBB® Forum Software