'=========================================================================== ' Subject: FAST PALETTE Date: 12-22-92 (12:50) ' Author: Coridon Henshaw Code: QB, QBasic, PDS ' Origin: FidoNet QUIK_BAS Echo Packet: GRAPHICS.ABC '=========================================================================== ' > SUB VGAPal (Attr%, Red%, Green%, Blue%) ' > PALETTE Attr%, (Red%) + (Green% * 256) + (Blue% * 65536) ' > END SUB 'Ugh, that's SLOW. PALETTE takes forever, not to mention all that 'integer math... Use this: 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 '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 ;)