Master the fundamental concepts of x86 assembly (intel syntax) through this focused micro-challenge.
Arithmetic on x86 sets condition flags in RFLAGS. cmp eax, ebx subtracts for comparison without storing; test ANDs for zero checks. Conditional jumps (jg, jl, ja, jb, ...) read those bits. Spectre-class bugs live in mispredicted branches, so knowing signed vs unsigned jumps matters.
| Flag | Meaning |
|---|---|
| ZF | Result was zero |
| SF | Result negative (MSB set) |
| CF | Unsigned borrow/overflow |
| OF | Signed overflow |
nasmLoading…
Use jl/jg for signed ints; jb/ja for unsigned sizes.
For this exercise, you will implement find_max and absolute_value with conditional jumps only. This task asks you to pick the correct jump family, because mixing signed and unsigned compares is a subtle security and correctness bug in hand-written assembly.
Keep the relevant man page, ABI doc, or Rust reference chapter open while you work. When your output disagrees with the reference implementation on the same machine, the mismatch is usually an alignment rule, an off-by-one terminator, or a register slot you misread in GDB. Skim the official documentation for the tool or ABI named in the exercise; the prose changes, but register roles, syscall numbers, and ownership rules stay stable across releases. Treat each failure as a contract test: the CPU, kernel, and borrow checker enforce rules whether or not the tutorial mentioned them explicitly.
Write assembly code demonstrating conditional branching and comparison operations.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github