[Part 0x5] Bits with Personality
Welcome to part 5 of x86 Assembly Adventures! In this part we learn about two main subjects: Signed operations and Bitwise Operations.
Signed numbers are numbers with a sign: They could be both positive or negative. It turns out that the x86 processor has some instructions that deal specifically with those numbers. Some instructions that we are going to meet are: neg, movzx, movsx, cwde, cdq, imul and idiv.
Next we discuss bitwise operations. So far all the instructions we have encountered treated the contents of registers as numbers. However this special set of instructions thinks about the contents of a register as a map of bits! Some subjects we mention in this chapter:
- Very basic introduction to Boolean Algebra (This is a big name for the arithmetic of bits) through the NOT, AND and NEG operations.
- Interesting rules of life that apply to boolean operations.
- Simplifying Boolean expressions.
- Different x86 instructions that implement bitwise operations: not, and, or and xor.
- A few bit manipulation techniques.
In the end of this part of the series you will gain solid understanding of how to work with single bits. (Eat zeroes and ones for breakfast)