Status Register Flags: Z, N, C, V
Exercises each flag one step at a time. sub r4,r4 produces 0 (Z=1, C=1). 0xFFFF + 1 wraps to 0 (Z=1, C=1). 0x7FFF + 1 flips the sign (N=1, V=1, signed overflow).
What to watch as you step
- MOV does not touch flags
- Z sets when the result is 0; N when the MSB is 1
- C signals unsigned overflow or no-borrow on SUB
- V signals signed overflow: result sign disagrees with operands