BBS: Inland Empire Archive Date: 12-22-92 (12:50) Number: 329 From: CORIDON HENSHAW Refer#: NONE To: SCOTT WUNSCH Recvd: NO Subj: Programming Conf: (2) Quik_Bas
Hello Scott!
In a msg of <20 Dec 92>, Scott Wunsch writes to Chansak Sam:
SW> SUB VGAPal (Attr%, Red%, Green%, Blue%)
SW> PALETTE Attr%, (Red%) + (Green% * 256) + (Blue% * 65536)
SW> END SUB
Ugh, that's SLOW. PALETTE takes forever, not to mention
all that integer math... Use this:
===Chop===
DECLARE SUB ReadPalette (Attr%, Red%, Green%, Blue%)
DECLARE SUB SetPalette (Attr%, Red%, Green%, Blue%)
DEFINT A-Z
SUB ReadPalette (Attr%, Red%, Green%, Blue%)
OUT &H3C7, Att%
Red% = INP(&H3C9)
Green% = INP(&H3C9)
Blue% = INP(&H3C9)
END SUB
SUB SetPalette (Attr%, Red%, Green%, Blue%)
OUT &H3C7, Attr%
OUT &H3C8, Attr%
OUT &H3C9, Red%
OUT &H3C9, Green%
OUT &H3C9, Blue%
END SUB
===Chop===
ReadPalette is for reading the color values of a attribute,
and SetPalette sets them. All using direct access to the
VGA controller, so they are very fast. If I wanted to, I
could re-code them in ASM for more speed, but I don't quite
need them THAT fast ;)
Coridon Henshaw
Sirrus| /
--*--
/ |Software
...Gotta run, the cat's caught in the printer.
--- GEcho 1.00
* Origin: TCS Concordia - Mail Only - Toronto, Ontario (1:250/820)

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