SNES graphics use 5 bits per color channel (i.e. 0..31); emulator authors can choose how they want to expand that to 6 bits per channel (DOS emulators with
VGA screen modes), 8 bits per channel (SVGA) or 10 bits per channel (
Deep Color). The fastest way is to fill the extra bits with zeroes, and the 'correct' way (using the full color range) is to fill the extra space with a copy of the top bit (VGA) / 3 bits (SVGA) / 5 bits (DC).
Removing 3 bits is as easy as dividing each color channel by 8 and then multiplying it again with 8, or applying a bitmask.
const
Bits_per_channel__SNES = 5;
Bits_per_channel__PC = 8;
delta_bpc = Bits_per_channel__PC - Bits_per_channel__SNES;
Mask_bpc = (%11111111 SHR delta_bpc) SHL delta_bpc;
// version 1
R := (R SHR delta_bpc) SHL delta_bpc;
G := (G SHR delta_bpc) SHL delta_bpc;
B := (B SHR delta_bpc) SHL delta_bpc;
// version 2
R := R AND Mask_bpc;
G := G AND Mask_bpc;
B := B AND Mask_bpc;
The SNES screen can show
more than 256 colors per frame, thanks to raster effects (one or several colors and/or the brightness register can be changed between lines) and/or color addition/subtraction. So you should be careful when using the emulator's main graphics output.