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 1
◄Contents► ◄Index► ◄Back►
─────────────────────────────────────────────────────────────────────────────
◄Knowledge Base Contents► ◄Knowledge Base Index►
How to Save Color Registers After BSAVE of (PICEM) Graphics, Example 1
Example 1: (SAV7TO12.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
'
' REQUIREMENT: Must have PICEM210.EXE.
' This program uses PICEM210 to display a .PCX, .PIC, or .GIF
' graphics image file onto the screen so that Visual Basic for
' MS-DOS can then BSAVE it. It BSAVEs the picture and the color
' registers for SCREEN 7,8,9, or 12. The values of the
' variables MODE%, Z, TOTAL!, and YOURFILE must be written
' into the code. PICEM210.EXE 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 ConvrtPic()
DIM inregsx AS RegTypeX
DIM outregsx AS RegTypeX
DIM colorbuf(15) AS colortype
SCREEN MODE%
' Where MODE% = 7 for screen 7,
' = 8 for screen 8,
' = 9 for screen 9,
' = 12 for screen 12.
SHELL "PICEM210 /e/v:Z YOURFILE.PCX"
' Where Z = j for screen 7,
' = d for screen 8,
' = g for screen 9(ega),
' = i for screen 9(vga),
' = m for screen 12.
'
' If other options for PICEM210 are desired, refer to PICEM210.DOC for
' alternate choices, where YOURFILE.PCX is the .pcx,.pic,or.gif file
' to be converted.
DEF SEG = &HA000
FOR i% = 0 TO 3
' BSAVing 4 files with .b_0,.b_1,.b_2,.b_3 extensions.
' The 4 files contain the 4 bit planes.
OUT &H3CE, 4
' Makes the port at &H3CE enable the data register at &H3CF.
OUT &H3CF, i%
' Selects next bit plane.
f$ = "YOURFILE" + ".b_" + CHR$(i% + 48)
' Where YOURFILE is the filename to be used for the
' BSAVEd graphics image files after conversion.
BSAVE f$, 0, TOTAL!
' Where TOTAL! = 8000 for screen 7,
' = 16000 for screen 8,
' = 28000 for screen 9,
' = 38400 for screen 12.
NEXT i%
DEF SEG
' ROM BIOS interrupt to get palette registers.
inregsx.ax = &H1017
inregsx.bx = 0
inregsx.cx = 16
inregsx.es = VARSEG(colorbuf(0))
inregsx.dx = VARPTR(colorbuf(0))
CALL INTERRUPTX(&H10, inregsx, outregsx)
' BSAVE palette registers.
DEF SEG = VARSEG(colorbuf(0))
BSAVE "YOURFILE.REG", VARPTR(colorbuf(0)), 48
' Where YOURFILE is the filename to be used for the BSAVEd
' color registers.
DEF SEG
END SUB