Instructions II
Explore the behavior of conditional jumps like JNZ and JZ and their relationship with CPU flags. Understand how 64-bit registers are structured into smaller parts and how function return values are handled via registers. Learn about byte register operations and the use of MOVZX for managing different operand sizes in assembly. This lesson enhances your ability to read and write assembly code in the context of debugging and disassembly.
We'll cover the following...
Conditional jumps
Consider these two C/C++ code fragments:
CPU fetches instructions sequentially, so we must tell the CPU that we want to skip some instructions if some condition is met (or not met)—for example, if a != 0.
The JNZ (jump if not zero) and JZ (jump if zero) instructions test the ZF flag and change %RIP if the ZF bit is cleared for JZN ...