Download text file
$if 0
Hi,

  Qbasic has a command to copy the contents of one video page into
another page, if the screen supports more than one page. This file
shows two different ways to do this in FirstBASIC and PowerBASIC
for VGA color screens.

  There are a total of 8 pages for text mode (25rows x 80columns).
You can access these pages either as Active or Visual or both using
the SCREEN Statement. The third parameter you pass sets the Active page.
This means that all out put (PRINT) goes to this page. The forth
parameter sets the Visual page. This is the one you see on your screen.

  So, this all means that you can write to the Apage while viewing the
Vpage then, when you've got the data on the Apage ready you can either
set the Vpage to match the Apage or copy the contents from the Apage
to the Vpage. This makes for smooth window popping. You copy your Apage
to one of the other pages, build your window, print the data THEN pop
it onto the Vpage.

  Another tricky thing you can do is save the data from the Vpage to
one of the other pages, pop a window, then copy the stored data back
to the Apage when you close the window! There are seven extra pages
and not too many programs get 7 windows deep. Because you're using
memory that is already allocated you are also not using any available
RAM or disk space to store the image of your Apage.

  One thing you'll want to think about before you embark on any of these
tricks is to assign pages numbers for particular tasks then stick to the
plan! Say, page 0 is your Vpage at all times. You use page 7 to do your
window work and pages 1 thru 6 to store the images. It will look some-
thing like this:

  LastUsedPage% = 0
  LastUsedPage% = LastUsedPage% + 1
  Copy page 0 to LastUsedPage%              >>--\
  Copy page 0 to page 7                         |
  Draw your window box and put in the data      |
  Copy page 7 to page 0                         |
    Do whatever is necessary with the window    |
  Copy LastUsedPage% to page 0              <<--/
  LastUsedPage% = LastUsedPage% - 1

Enjoy,

Don
d83@ath.forthnet.gr

$endif

'==========================================================================
'====== test code for TPageCopy
'==========================================================================

%DoYouHavePB32 = -1                           ' make this 0 if not
                                              '
'--------------------------------------------------------------------------
                                              ' set-up test conditions
CLS                                           ' for both systems
PRINT "Hello World"                           ' print test string to page 0
SCREEN ,,1,0                                  ' set active page to #1
CLS                                           ' clear active page
PRINT STRING$(1990,65);                       ' print to active page
SCREEN ,,0,0                                  ' set active page to #0
DELAY 1                                       ' dramatic pause
                                              '
'-------------------------------------------------------------------------
                                              '
$if %DoYouHavePB32                            ' using pointers with PB32
                                              '
  DIM VP_ptr(7) AS STRING PTR * 4000          ' one pointer for each page
  VP_ptr(0) = pbvScrnBuff                     ' page 0 at SEGMENT &h0800
  FOR P% = 1 TO 7                             ' lay in values for other
    VP_ptr(P%) = VP_ptr(P%-1) + &h01000000    '  pages
  NEXT                                        '
                                              '
  @VP_ptr(0) = @VP_ptr(1)                     ' This is all you need do!
                                              '
$else '-------------------------------------------------------------------
                                              '
CALL TPageCopy( 1, 0 )                        ' call the SUB routine
                                              '
SUB TPageCopy( FromPage%, ToPage% ) PUBLIC    ' copy text pages
  LOCAL Scrn$                                 '
                                              '
  DEF SEG = &hB800 + ( FromPage% * &h0100 )   ' SEGment for from page
  Scrn$   = PEEK$( 0, 4000 )                  ' read the data
  DEF SEG = &hB800 + ( ToPage% * &h0100 )     ' SEGment for to page
  POKE$ 0, Scrn$                              ' write the data
  DEF SEG                                     ' restore data segment
                                              '
END SUB                                       '
                                              '
$endif '------------------------------------------------------------------