home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 14 / CDACTUAL.iso / cdactual / demobin / share / program / Basic / SPLCHV2.ZIP / SPLOTCH.BAS < prev    next >
Encoding:
BASIC Source File  |  1992-02-22  |  1.8 KB  |  37 lines

  1. 'This sample code is for QuickBASIC or other compiled BASIC programmers who
  2. 'would like to use SPLOTCH to generate Memory Image files for VGA
  3. 'pictures for use in their programs.  It first loads SPLOTCH's palette from
  4. 'the file SPLOTCH.PLT.  You are welcome to include that file with your
  5. 'programs, and rename it if you wish, but I would recommend
  6. 'programmers hard code the palette into the executable.
  7.  
  8. SCREEN 13                                                     'Initiates VGA/MCGA mode 13h (19 decimal)
  9.  
  10. DIM PData AS LONG                                             'Declares PData as a long integer
  11.  
  12. OPEN "SPLOTCH.PLT" FOR BINARY AS #1                            'Opens SPLOTCH.PLT, a binary file containing the palette information
  13.  
  14.  
  15. FOR x% = -1 TO 255
  16.  
  17. GET #1, , Red$                                                'Reads a set of RGB values from SPLOTCH.PLT
  18. GET #1, , Green$
  19. GET #1, , Blue$
  20.  
  21. 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
  22. IF Green$ = "" THEN Green$ = CHR$(1)                          'If you do not do this you will recieve an Illegal Function Call error
  23. IF Blue$ = "" THEN Blue$ = CHR$(1)                            'when it attempts to make the ASCII conversion
  24.  
  25. PData = 65536 * ASC(Blue$) + 256 * ASC(Green$) + ASC(Red$)    'Calculates the color number from the RGB values
  26. PALETTE x%, PData                                             'Changes the next color number to the RGB attributes from the above equation
  27. NEXT x%
  28. CLOSE #1                                                      'Close file
  29.  
  30.  
  31. DEF SEG = &HA000                                              'Defines segment for VGA/MCGA video memory
  32. BLOAD "SAMPLE.BLD", 0                                         'BLOADs the file SAMPLE.BLD
  33.  
  34. WHILE INKEY$ = "": WEND
  35.  
  36.  
  37.