You can look at the eflags
register in a debugger (like gdb). There is plenty of readily accessible documentation about eflags, but essentially bits in the register are 0 or 1 depending on whether particular status flags are set.
If it is not enough to just see the values in a debugger, and you need to do something with them:
you can push eflags
onto the stack (pushfl
works for me) and then pop the stack to a general purpose register.
You can use the jc
, jz
, jo
, and js
instructions which jump to a specified label if the carry, zero, overflow, or sign flags (respectively) are set.
For example:
clc # clear carry flag (set CF = 0)
addl eax, 0xffffffff # some operation that might change status flags
jc label1 # if the carry flag is set, jump to label
... # instructions to execute if carry not set (CF = 0)
jmp label2
label1:
... # instructions to execute if carry set (CF = 0)
label2:
... # resume execution which does not depend on CF