bsaving screen 9

 BBS: Inland Empire Archive
Date: 04-08-92 (13:13)             Number: 10
From: MATT HART                    Refer#: NONE
  To: JAMES MINOR                   Recvd: NO  
Subj: bsaving screen 9               Conf: (2) Quik_Bas
 JM> Does anyone know if it is possible to save a screen in screen
 JM> mode 9 using the bsave command? If so, how?

The best way is to GET the screen into an array first:

     DEFINT A-Z
     SCREEN 9
     LINE (0, 0)-(60, 60), 1, BF
     LINE (61, 61)-(120, 120), 4, BF
     LINE (121, 121)-(180, 180), 8, BF
     LINE (181, 181)-(240, 240), 12, BF
     LINE (241, 241)-(300, 300), 15, BF
     X1 = 0 : X2 = 649 : Y1 = 0 : Y2 = 175
     Bits.Per.Pixel.Per.Plane = 1
     NumPlanes = 4                      ' 2 for 64K EGA/4 Color

     ' Must be done in two chunks - BSAVE can only save 64K at a time
     NumBytes = 4+INT(((X2-X1+1)*(BitsPerPixelPerPlane)+_
                7)/8)*NumPlanes*((Y2-Y1)+1)
     NumBytes = NumBytes + NumBytes MOD 2
     DimSize1 = NumBytes \ 2 : DimSize = DimSize1
     File$ = "PICT1.BIN"
     GOSUB SaveIt

     ' Second Chunk
     Y1 = 176 : Y2 = 349
     NumBytes = 4+INT .....
     DimSize2 = ....
     File$ = "PICT2.BIN"
     GOSUB SaveIt

     CLS
     ' Load it back:
     REDIM SaveArray(1 TO DimSize1) AS INTEGER
     DEF SEG = VARSEG(SaveArray(1))
     BLOAD "PICT1.BIN",VARPTR(SaveArray(1))
     DEF SEG : PUT (0,0),SaveArray
     REDIM SaveArray(1 TO DimSize2) AS INTEGER
     DEF SEG = VARSEG(SaveArray(1))
     BLOAD "PICT2.BIN",VARPTR(SaveArray(1))
     DEF SEG : PUT (0,176),SaveArray

SaveIt:
     REDIM SaveArray(1 TO DimSize) AS INTEGER
     GET (X1,Y1)-(X2,Y2),SaveArray
     DEF SEG = VARSEG(SaveArray(1))
     BSAVE "PICT.BIN",VARPTR(SaveArray(1)),NumBytes
     DEF SEG
RETURN

---
 * Origin: Midnight Micro!  V.32/REL  (918)451-3306 (1:170/600)
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