Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read the flags registers in x86 processor [duplicate]

Tags:

x86

assembly

Are there any assembly instructions to let us directly read or write the overflow flag in Intel's 80386 16-bit Flags register ? If not, what pseudo code should we use?

like image 721
user2003619 Avatar asked Jan 14 '23 23:01

user2003619


1 Answers

To read only the overflow flag:

SETO AL
; AL now contains 1 if the overflow flag was set, and 0 if it wasn't


To invert the overflow flag:

PUSHF
POP    AX
XOR    AX,800h  ; The overflow flag is in bit 11
PUSH   AX
POPF
like image 174
Michael Avatar answered Jan 17 '23 16:01

Michael



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!