need some help

Discussion in 'Assembly Language Programming (ALP) Forum' started by fmmctg01, May 31, 2011.

  1. fmmctg01

    fmmctg01 New Member

    Joined:
    Mar 31, 2011
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    0
    how can i set bits 6-10 to all 0's and 1's by using Boolean instruction.
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    You can't set a single bit to a 0 and a 1 simultaneously. What exactly do you want to do?
    You can set a bit to zero by ANDing all other bits with 1. To reset bit 4 of an 8-bit int X for instance you would do X &= 11101111b (using the C bitwise and-assign operator; translate according to your CPU).
    You can set a bit to 1 by ORing the bit with 1. To set the same bit as above you would do X |= 00010000b (using the C bitwise or-assign operator).
     
    fmmctg01 likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice