Chaning bits individually? or merging registers x86

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
iansjack
Member
Member
Posts: 4711
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Chaning bits individually? or merging registers x86

Post by iansjack »

For that matter, you can do it even without those instructions. add ax, 0x80 would set bit 7, and sub ax, 0x80 would clear it. That is elementary, and, if you haven't got that far, it will be a long time before you are ready for osdev.
Nice attempt to move the goalposts but the simple fact is that the above statement was patently false. One is tempted to say if you believe it then it will be a long time before you are ready for osdev.

Now, I have no intention of getting drawn into a silly argument. The answer to the OP's original question is that there are single instructions in the 80386 and newer processors to set and clear individual bits; as a bonus they also indicate the previous state of the bit. No need for add, sub, and, or to do the job. And, as the erroneous answers given indicate, it was an interesting and valid question to ask so let's all stop being so superior about "required knowledge".
Locked