Microsoft KB Archive/81082

= How to Scroll Up in Text Screen with BLOAD/BSAVE in Basic =

Article ID: 81082

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft QuickBasic 4.0
 * Microsoft QuickBASIC 4.0b
 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Compiler 6.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 7.1

-



This article was previously published under Q81082



SUMMARY
BLOAD and BSAVE statements can be used to scroll text on a text mode (SCREEN 0) screen to avoid having to store the text information in an array and PRINT the entire screen. The drawback to this approach is that you need to create files on the drive for each screen you need to scroll. The code example below shows the screen scrolling up and down using BLOAD and BSAVE.

This information applies to Microsoft QuickBasic versions 1.0, 1.01, 1.02, 2.0, 2.01, 3.0, 4.0, 4.0b, and 4.5 for MS-DOS; Microsoft Basic Compiler versions 6.0 and 6.0b for MS-DOS; and Microsoft Basic Professional Development System (PDS) versions 7.0 and 7.1 for MS-DOS.



MORE INFORMATION
If you have only a few lines to scroll, this method is fairly efficient. However, the overhead of all the files needed to store the screen information may be unacceptable for larger amounts of data. The speed of the scrolling is increased by doing the BSAVEing and BLOADing directly to video memory as noted in the comments below in the example.

Code Example
' MAIN.BAS: The following main program scrolls the screen ' up and down. ' n% = 15 ni% = 7

' PRINT statements scroll the screen down and BLOAD ' statements scroll it back up. The DEF SEG to &amp;HB800 is the ' beginning of text video memory for CGA, EGA, and VGA ' adapters. By putting 4000 bytes out to the file,the entire ' page is stored.

FOR i% = 1 TO ni% PRINT &quot;Willie, Willie : &quot;; i%       FOR j% = 1 TO n%                PRINT j%                DEF SEG = &HB800 BSAVE &quot;pearljam&quot; + MID$(STR$(j%), 2), 0, 4000 DEF SEG NEXT j%       FOR j% = n% TO 1 STEP -1 DEF SEG = &HB800 BLOAD &quot;pearljam&quot; + MID$(STR$(j%), 2), 0 DEF SEG NEXT j% NEXT i%

Additional query words: QuickBas BasicCom 1.00 1.01 1.02 2.00 2.01 3.00 4.00 4.00b 4.50 6.00 6.00b 7.00 7.10

Keywords: KB81082

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.