It depends whether or not you want to just scroll the screen as you are printing, or you want to be able to manually scroll back up to see what has disappeared off the top of the screen.
Below is my function for screen scrolling in a box positioned anywhere on the screen, but it doesn't include any ability to look at lines which have scrolled off the top. Shouldn't be too difficult to add that though. (Will take a look at that aspect later and add it to the Code Hints section on my web site).
DBC code, but AFAIK does not contain anything to prevent it working in DBP...
Basically, you provide it with the X and Y position on the screen you want to print, the width of the scroll box, the string you want to print and finally, how many lines of text fit into the box before it starts scrolling.
Dim Display$(25): Rem Array required for function
Dim LineCount(0): Rem Array required for function
Sync On: CLS 0
Sync Rate 0
XPos=100: Rem X position of scroll box on screen
YPos=10: Rem Y position of scroll box on screen
Numlines=8: Rem Number of lines to print before scrolling takes place
ScrollBoxWidth = 150: Rem Set this to required width to take max width string
Repeat
Inc A
NewLine$="Example Line "+Str$(A)
ScrollPrint(XPos,YPos,ScrollBoxWidth,NewLine$,NumLines): Rem call this instead of Print
Sleep 500
Until Inkey$()<>""
End
Function ScrollPrint(XPos,YPos,ScrollBoxWidth,NewLine$,Numlines)
ScrollBoxHeight = Numlines*16
Inc Numlines
If NewLine$ <> ""
If LineCount(0) < Numlines
LineCount(0) = LineCount(0)+1
If LineCount(0) > Numlines Then LineCount(0) = Numlines
Endif
ActLine = LineCount(0)
If ActLine < Numlines
Rem Free Array Slots Available
Display$(ActLine) = NewLine$
Else
Rem Array Full
For Q = 1 To Numlines-2
Display$(Q) = Display$(Q+1)
Next Q
Display$(Numlines-1) = NewLine$
Endif
Ink RGB(0,0,0),0: Rem Set to background colour of your screen
Box XPos,YPos,XPos+ScrollBoxWidth,YPos+ScrollBoxHeight
Ink RGB(255,255,255),0
For Y = 0 To NumLines-1
Text XPos,Y*16+YPos,Display$(Y+1)
Next Y
Sync
Endif
EndFunction
TDK_Man