Video Memory Segment

 BBS: Inland Empire Archive
Date: 05-19-92 (11:57)             Number: 117
From: DON KROUSE                   Refer#: NONE
  To: JOHN GALLAS                   Recvd: NO  
Subj: Video Memory Segment           Conf: (2) Quik_Bas
JG>   Is there a way that I can determine wether to use &HB000 or &HB800 when
JG>doing stuff with the screen?  And also, how do I save and load screens with

Hi John,

Below is an example of how to do what you asked. If you need further info
please ask.


DEF SEG = &H40 '---- BIOS data area

'---- PEEK offsets in the BIOS segment for display info
Monitor% = PEEK(&H49)
ScrnCols% = PEEK(&H4A) + (PEEK(&H4B) * 256)
ScrnBytes% = PEEK(&H4C) + (PEEK(&H4D) * 256)

'---- Calculate screen rows
ScrnRows% = ScrnBytes% \ (ScrnCols% * 2)

DEF SEG '---- reset to default segment
IF Monitor% = 7 THEN
   MonitorSeg% = &HB000  '---- mono
   PRINT "This is a mono monitor"
   MonitorSeg% = &HB800  '---- color
    PRINT "This is a color monitor"

PRINT "Columns "; ScrnCols%
PRINT "Rows "; ScrnRows%
PRINT "Screen Bytes "; ScrnBytes%
LOCATE 12, 22: PRINT "Press any key to continue"

'---- Make a test screen to BSAVE
FOR i = 1 TO 25
   PRINT ; STRING$(80, "X");

LOCATE 12, 22: PRINT "   Press any key to save the screen   "

DEF SEG = MonitorSeg% '---- Define the video segment

'---- BSAVE the correct number of bytes starting at offset 0 of
'     the video segment.
BSAVE "scrn1.dat", 0, ScrnBytes%

DEF SEG '---- Reset to the default segment
LOCATE 12, 22: PRINT "   Press any key to restore the screen   "

'---- Reload the saved screen to where it was saved from
BLOAD "scrn1.dat"

COLOR 0, 7
LOCATE 20, 13: PRINT "   You should Delete scrn1.dat from
your default drive   "
COLOR 7, 0
 * Origin: Silver Lake Systems * Bothell, WA (1:343/58)
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