Assembly pushf,pop commands, sub changig result?

67 views Asked by At

I have a question about this assembly code:

%include "io.inc"

section .text
global CMAIN
CMAIN:
;write your code here
mov eax, 0FFFFFFFh
mov ebx, 0FFFFFFFh

sub ebx,eax

PUSHF

pop eax

PRINT_HEX 4, eax


xor eax,eax
ret

So the result is 246, but why does the result changes if i delete the code sub ebx,eax?

Because sub ebx,eax only changes the value in ebx? and eax is the same so why adding this code changes the result then?

It is probably pretty simple but couldn't find the answer. Thanks for answering!

0

There are 0 answers