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 Q78888, Example 4
                                                 Contents  Index  Back
─────────────────────────────────────────────────────────────────────────────
                           Knowledge Base Contents  Knowledge Base Index
 
 How to Save Color Registers After BSAVE of (PICEM) Graphics, Example 4
 
 Example 4: (LOD13.BAS)
 ----------------------
 
 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.
 
 ' To run this program in the environment, you must invoke the
 ' environment with the /L switch to load the default Quick library:
 ' VBDOS.EXE /L for Visual Basic 1.0 for MS-DOS
 '
 ' This program loads BSAVEd files from disk into video
 ' memory and restores the graphics image's registers
 ' for screen 13. It assumes the picture files were BSAVEd
 ' using code from SAV13.BAS. The value of the variable
 ' YOURFILE must be written into the code. The graphics image
 ' files should be in the default directory.
 
 DECLARE SUB ConvrtPic ()
 TYPE ColorType
         red AS STRING * 1
         green AS STRING * 1
         blue AS STRING * 1
 END TYPE
 
 ' Use the following include file for Visual Basic 1.0 for MS-DOS:
 REM $INCLUDE: 'VBDOS.BI'
 CALL ConvrtPic()
 END
 
 SUB Convrt Pic()
 
 DIM inregx AS RegTypeX
 DIM outregx AS RegTypeX
 DIM colorbuf(255) AS ColorType
 
 SCREEN 13
 CLS
 
 ' If necessary, save the current color registers of the
 ' existing screen using code from SAV13.BAS before changing
 ' colors to the graphics image's palette.
 
 ' BLOAD the picture's palette.
 DEF SEG = VARSEG(colorbuf(0))
 
 BLOAD "YOURFILE.reg", VARPTR(colorbuf(0))
 ' Where YOURFILE is the filename containing the graphics
 ' image's color registers.
 DEF SEG
 
 ' Call interrupt to restore graphics image's palette.
 inregx.ax = &H1012
 inregx.bx = 0
 inregx.cx = 256
 inregx.es = VARSEG(colorbuf(0))
 inregx.dx = VARPTR(colorbuf(0))
 CALL INTERRUPTX(&H10, inregx, outregx)
 
 ' BLOAD picture.
 DEF SEG = &HA000
 BLOAD "YOURFILE.sav", 0
 ' Where YOURFILE is the filename of the converted graphics image.
 DEF SEG
 END SUB