home *** CD-ROM | disk | FTP | other *** search
- 'This sample code is for QuickBASIC or other compiled BASIC programmers who
- 'would like to use SPLOTCH to generate Memory Image files for VGA
- 'pictures for use in their programs. It first loads SPLOTCH's palette from
- 'the file SPLOTCH.PLT. You are welcome to include that file with your
- 'programs, and rename it if you wish, but I would recommend
- 'programmers hard code the palette into the executable.
-
- SCREEN 13 'Initiates VGA/MCGA mode 13h (19 decimal)
-
- DIM PData AS LONG 'Declares PData as a long integer
-
- OPEN "SPLOTCH.PLT" FOR BINARY AS #1 'Opens SPLOTCH.PLT, a binary file containing the palette information
-
-
- FOR x% = -1 TO 255
-
- GET #1, , Red$ 'Reads a set of RGB values from SPLOTCH.PLT
- GET #1, , Green$
- GET #1, , Blue$
-
- IF Red$ = "" THEN Red$ = CHR$(1) 'If the value of R, G or B is null it is changed to 1 for the equation below
- IF Green$ = "" THEN Green$ = CHR$(1) 'If you do not do this you will recieve an Illegal Function Call error
- IF Blue$ = "" THEN Blue$ = CHR$(1) 'when it attempts to make the ASCII conversion
-
- PData = 65536 * ASC(Blue$) + 256 * ASC(Green$) + ASC(Red$) 'Calculates the color number from the RGB values
- PALETTE x%, PData 'Changes the next color number to the RGB attributes from the above equation
- NEXT x%
- CLOSE #1 'Close file
-
-
- DEF SEG = &HA000 'Defines segment for VGA/MCGA video memory
- BLOAD "SAMPLE.BLD", 0 'BLOADs the file SAMPLE.BLD
-
- WHILE INKEY$ = "": WEND
-
-
-