Assembly 3: Branching

Overview

We discuss branching and save/restore calling conventions in machine code.

Full lecture notes on assemblyTextbook readings

Computer programming as translation

State in programming languages

State in CPUs

Control flow in programming languages

Control flow in CPUs

Why learn about machine code translation?

Unconditional jumps in assembly

Conditional jumps in assembly

Condition flags

ZF

ZF example

Flag-only arithmetic

Other flags

Comparison conditional jumps

How to read a comparison

Yet moar

Control flow: f19.sf24.s

Conditional move instructions

Control flow: f25.sf26.s

Stacks and function-local storage

Stack picture

Saving data on the stack

Calling convention and save/restore

cc06.cc