[A89] Re: Setting bit fields


[Prev][Next][Index][Thread]

[A89] Re: Setting bit fields




Why do you need to do an AND and an OR? To set bit 6, you just need:
   ori.b    #%01000000,$600015

To clear bit 6:
   andi.b   #%10111111,$600015

To invert bit 6:
   eori.b   #%01000000,$600015

Right?  Wouldn't ANDing a byte with $BF clear bit 6 and leave the rest
alone?

confused,
jk


On Thu, 28 Feb 2002 15:50:20 -0500 "Scott Noveck" <noveck@pluto.njcc.com>
writes: 
> Yup, you should only need two total instructions -- one AND, one OR. 
>  You
> can AND multiple bits in one instruction by ANDing the entire byte 
> with a
> mask (want to reset all but bit 6?  AND the byte with 0xBF); same 
> thing with
> OR.
> 
>     -Scott
> 
> 
> 
> 
________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
http://dl.www.juno.com/get/web/.



Follow-Ups: