video memory segment

 BBS: Inland Empire Archive
Date: 05-19-92 (08:54)             Number: 174
From: MARK BUTLER                  Refer#: NONE
  To: JOHN GALLAS                   Recvd: NO  
Subj: video memory segment           Conf: (2) Quik_Bas
 On 05-17-92 John Gallas wrote to All...

 JG> Is there a way that I can determine wether to use &HB000 or &HB800
 JG> when doing stuff with the screen?  And also, how do I save and load
 JG> screens with BSAVE and BLOAD?

 This little function will do the trick...

 FUNCTION CRT%
    IF (PEEK(1040) AND 48) = 48 THEN
        CRT = 0  '<-------- monochrome, use &HB000
    ELSE
        CRT = -1 '<-------- color, use &HB800
    END IF
 END FUNCTION

 An example usage of this function might go something like this...

 IF CRT% THEN                  '   if CRT% is non-zero then
     DEF SEG = &HB800          '<--define the segment to this
 ELSE
     DEF SEG = &HB000          '<--else define it to this
 ENDIF

 Assuming we want to save a screen in SCREEN 0 (80x25 color text) we

 might do it like so...

 BSAVE "SCRNFILE.BSV", 0, 4000
                   '   ^  ^^^^
                   '   |    |
                   '   |    `--- Save entire screen contents
                   '   `-------- beginning at offset zero.
 DEF SEG           '   <-------- Restore the default segment.


 Now later if we want to reload our screen we once again check the
 value of CRT%, set the vid seg and...

 BLOAD "SCRNFILE.BSV", 0  '<---- Load the file beginning at offset zero.
 DEF SEG                  '<---- Restore the default segment.


 Hope this helps ya a little


 ----------> MHB :-)

... OFFLINE 1.36 * Open the pod bay doors ...HAL? I said op&#@ NO CARRIER
--- DB B1067/001271
 * Origin: * Bare Bones BBS * (1:105/360)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET