Question

I've run across an example my professor made which made me question my understanding of the bset and bclr assembly commands.

If I do this:

bset BITS,80

am I performing an AND or an OR operation between the two? My reference guide says that bset does this:

M <= M + mask

Is + an OR or an AND operator? bclr is the same command but performs the operation with the complement of the mask.

Was it helpful?

Solution

Bit setting and clearing implies ORing and ANDing, bitwise, respectively. BSET should be doing OR, and BCLR should be doing effectively AND.

It may be that BCLR simply does AND with the bit vector you give it, or BCLR does AND with the complement of the bit vector (my guess), depending on how nice the designers of the instruction set are.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top