vbdpss.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Article Q66359, Example 2
                                                 Contents  Index  Back
─────────────────────────────────────────────────────────────────────────────
                           Knowledge Base Contents  Knowledge Base Index
 
 PICEM Views .PCX, .PIC, .GIF Files, and Saves in BSAVE Format, Example 2
 
 Method 2
 --------
 
 Listed below is a more complicated way to save a picture in
 BSAVE/BLOAD format (as an alternative in case PICEM does not create
 the correct BSAVE format):
 
 1. Create a .PCX, .PIC, .GIF, or .IMG image file.
 
    For example, make an image in Microsoft Windows PaintBrush version
    3.0, which comes with Microsoft Windows version 3.0. Save the
    image in PCX format (by choosing Save As from the File Menu, then
    clicking the Options button, then clicking PCX). Name the file
    "IMAGE.PCX".
 
 2. Write a Basic program that does the following:
 
    a. Uses the SCREEN statement to invoke a graphics mode that
       matches the video mode specified by PICEM /V (for example,
       SCREEN 13 matches PICEM /V:L, which in turn matches with a
       Windows Paintbrush .PCX file created on a VGA monitor):
 
          SCREEN 13
 
    b. SHELLs to PICEM, which is invoked to match the Basic SCREEN
       mode and to load a graphics file. For example:
 
          SHELL "PICEM /E /V:L  IMAGE.PCX"
 
       (The /E option causes PICEM to leave the screen in graphics mode
       and not clear the screen.)
 
    c. BSAVEs the picture.
 
       For example:
 
          DEF SEG= &HA000
          BSAVE "IMAGE.BSA",0,64000
 
       Then you can later BLOAD as follows:
 
          DEF SEG= &HA000
          BLOAD "IMAGE.BSA",0
 
 If you do not match Basic's screen mode with the mode used by PICEM,
 method 2 above will not work because Basic will reset the screen mode
 after the SHELL if the mode does not match.
 
 Visual Basic for MS-DOS has a limited number of graphics modes. The
 best resolution you can get is 640x480x16 (Basic's SCREEN 12;
 PICEM /V:M) or 320x200x256 (Basic's SCREEN 13; PICEM /V:L). Using
 method 2 above, you cannot BSAVE a 640x480x256 image or the more
 common standard mode 640x400x256. Basic does not know these modes, and
 therefore, will reset the screen contents immediately after the SHELL
 statement.
 
 You can try method 1 (Example 1) if you want to create a BSAVE
 format file from a graphics file that uses a non-Basic screen mode.
    See Example 1
 
 Code Example for Method 2
 -------------------------
 
 ' To try this example in VBDOS.EXE:
 ' 1. From the File menu, choose New Project.
 ' 2. Copy the code example to the Code window.
 ' 3. Press F5 to run the program.
 
 SCREEN 13
 SHELL "PICEM /E /V:L IMAGE.PCX"
 ' Mode 13 is 320x200x(1 byte for 256 colors), thus saves/loads 64000
 ' bytes.
 total! = 64000
 DEF SEG = &HA000   ' Define the segment for VGA graphics.
 ' How to BSAVE the file:
  f$ = "IMAGE.BSA" ' Save VGA memory in a file.
  BSAVE f$, 0, total!        ' Save the visual page, at offset 0.
 ' How to BLOAD the file:
  BLOAD f$, 0            ' 0 is the offset to page 0.