Category : BASIC Source Code
Archive   : QB_VGA.ZIP
Filename : VGAPAL.BAS

 
Output of file : VGAPAL.BAS contained in archive : QB_VGA.ZIP
'Code to save and load the VGA palette. Rich Geldreich
'Run this program- your screen shouldn't change colors. If it does,
'tell me, I made a mistake somewhere...
DEFINT A-Z
DECLARE SUB SavePalette (f$, n%)
DECLARE SUB LoadPalette (f$, n%)
SCREEN 13
FOR A = 1 TO 20
x = RND * 320
y = RND * 200
c = RND * 256
CIRCLE (x, y), RND * 50, c
PAINT (x, y), RND * 256, c
NEXT
SavePalette "temp.pal", 256 'Saves palette to TEMP.PAL
LoadPalette "temp.pal", 256 'Reloads palette from TEMP.PAL

SUB LoadPalette (f$, n)
n = n * 3: K = FREEFILE: OPEN f$ FOR BINARY AS K
A$ = SPACE$(n): GET K, 1, A$: CLOSE K
OUT &H3C8, 0: FOR A = 1 TO n: OUT &H3C9, ASC(MID$(A$, A, 1)): NEXT
END SUB

SUB SavePalette (f$, n)
OUT &H3C7,0:FOR A=0 TO n*3-1:A$=A$+CHR$(INP(&H3C9)): NEXT
K = FREEFILE: OPEN f$ FOR BINARY AS K: PUT K, 1, A$: CLOSE K
END SUB



  3 Responses to “Category : BASIC Source Code
Archive   : QB_VGA.ZIP
Filename : VGAPAL.BAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/