BBS: Inland Empire Archive Date: 11-04-92 (08:52) Number: 362 From: RICH GELDREICH Refer#: NONE To: SUNNY HUGHES Recvd: NO Subj: Palette Registers Conf: (2) Quik_Bas
> Myself and a few others were wondering(mostly me) if you had any > code around for your original gif decoder/loader to save the palette > registers to a file and an example of how to load a Bsaved version of > the original Gif with the correct pallete registers? This should get you started: '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 That's all! Tell me how it works out. Rich --- MsgToss 2.0b * Origin: Computer Co-Op - Voorhees, NJ | Ted Hare (1:266/29)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET