On 4 Nov 2013, at 22:49, Martyn Hill wrote: > On an entirely different topic, and perhaps naively, can I ask how to query a > window in SBASIC to discover the current Paper/Strip and Ink settings - > specifically after using the COLOUR_PAL command in QPC2? > > My aim is to (arbitrarily) manipulate the colours on a window that's passed > to my SBASIC routine and to then reset the colours back to what they were on > entry, before returning. > > When using the default QL (8 colour) palette, the current Paper etc, could be > found in the window's channel definition block at offsets 68 - 70 (decimal). > Old-school, but effective, seeing as there doesn't appear to be a trap or > vectored routine to officially query such properties of a window. > > Once the 256 colour palette is selected, the values at these offsets appear > to get hammered (or at least reset to zero, regardless of what is set through > the PAPER/STRIP and INK commands.) > > Am I missing something really obvious?
The colour words for paper and strip are at positions $66 and $68 in the channel block for a particular CON/SCR. The address of the channel block for channel number n (system channel number NOT BASIC channel number) is in the nth long word from the start of the channel base ($2BC60). If you are using QPC2 and GD2 colours and the default palette, the colour word for mustard, number 16 is $9480. Suppose you set COLOUR_PAL and then PAPER 16 then when you look at the positions $66 and $68 of the channel block you will see $8094 because of the byte reversal. If you now set STRIP 2, you will see $00F8 in position $68, since $F800 is the word for red and palette number 2 is, normally, red. George _______________________________________________ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm