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
JG>BSAVE and BLOAD?

Hi John,

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

Don

CLS
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"
ELSE
   MonitorSeg% = &HB800  '---- color
    PRINT "This is a color monitor"
END IF

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

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

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

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
CLS
LOCATE 12, 22: PRINT "   Press any key to restore the screen   "
SLEEP

'---- 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