Member-only story
Learning Assembly Language — A Helpful Guide [Part 2]
From part 1, we have now got a firm grasp of the fundamental elements of assembly. The next step is to develop an understanding of the components that make up assembly language’s program flow.
Assembly Program Flow
How do we control program flow in standard programming languages such as python? We use conditional statements ( if, else), loops ( for, while) as well as function calls.
These things simply don’t exist in assembly, the core program flow is based around jumping & branching.
FLAGS
In order to understand how jumping & branching works, you must understand what flags are. Flags are a way of storing the result from an action. Most importantly, they help store the result when we compare two variables. All the flags are stored in a specific register called EFLAGS — each flag can only have two values, on or off.
The three key flags for you to know about are the following:
Sign Flag
A flag that is set (turned on) when the result from the last operation was negative.
E.g. 4–20 would produce -16, a negative value, meaning the flag is set.
Zero Flag
A flag that is set only when the result from the last operation was exactly zero.
E.g. 7–7