Goes and consults PRM's.... Presuming what you're doing is getting an RGB value from the palette, then what you need is (unsurprisingly) OS_ReadPalette. R0=logical colour R1=type of colour (16=normal, 24=border, 25=pointer) R2 and R3 will return the different flashing states of the colour, in this format: Bits 0-6 value showing how colour was programmed 7 Supremacy bit 8-15 Red 16-23 Green 24-31 Blue If you're after getting RGB from a GCOL value, then the format of GCOL is: Bits 0-1 Tint bits 0-1 2-3 Red bits 2-3 (Other 2 in tint) 4-5 Green 2-3 6-7 Blue 2-3 If you want to convert a palette entry to GCOL, then use ColourTrans_ReturnGCOL: R0=Palette entry (&BBGGRR00) Returns GCOL in R0 To convert GCOL to palette though it looks like you'll have to do it manually. From BASIC (With g as the GCOL and c as the output) c=((g AND 7)*17*256)+((g AND 3)*17*65536)+((g AND 48)*17*16384*4)+((g AND 3)*17*256*65536)+((g AND 192)*17*16*65536) And from C: c=((g & 7)*17*256)+((g & 3)*17*65536)+((g & 48)*17*16384*4)+((g & 3)*17*256*65536)+((g & 192)*17*16*65536) I haven't tested these though so don't expect them to work.
[Edited by Phlamethrower at 15:33, 11/1/2001] |