<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Sun, 25 Oct 2015 01:49:47 +0000
From   : jgh@... (J.G.Harston)
Subject: Reading current colours

On 25-10-2015 00:53, Peter Coghlan wrote:
>> stores in the screen memory. For example, in a 4-colour mode such as
>> MODE 1 OSBYTE 160,87 returns the following:
>> 
>> COLOUR 0  &00
>> COLOUR 1  &0F
>> COLOUR 2  &F0
>> COLOUR 3  &FF
...
> Looks ok for COLOUR 0 and COLOUR 1 but not for COLOUR 2 and COLOUR 3.

I'd got as far as:
  colour%   =FNosword(160,whatever)
  maxColour%=FNosword(160,96)
  IF maxColour%=3:colour%=colour% DIV 8
  colour%=colour% AND maxColour%

or:
  LDX #whatever:JSR osword160:PHA         :\ read colour mask
  LDX #96:JSR osword160:TAX:PLA           :\ read max. colour
  CPX #3:BNE skip:LSR A:LSR A:LSR A:.skip :\ divide by 8 if max=3
  STX temp:AND temp                       :\ AND with max. colour

which works for 2-colour and 4-colour modes, but it looks like 16-colour 
modes is going to end up being a chunk of special-case code. I was 
hoping I could build something that was just arithmetic manipulation, 
not a load of IF cases. But it looks like it will end up being a special 
case for each colour depth.

-- 
J.G.Harston - jgh@...      - mdfs.net/jgh
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>