Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Assembly Language Programming (ALP) Forum (http://www.go4expert.com/forums/assembly-language-programming-forum/)
-   -   need some help (http://www.go4expert.com/forums/need-some-help-t25956/)

fmmctg01 1Jun2011 03:33

need some help
 
how can i set bits 6-10 to all 0's and 1's by using Boolean instruction.

xpi0t0s 1Jun2011 14:27

Re: need some help
 
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).


All times are GMT +5.5. The time now is 18:43.