Questions tagged [eflags]

EFLAGS refers to the flags register of the x86/x64 architecture.

EFLAGS refers to the flags register of the x86/x64 architecture. See https://en.wikipedia.org/wiki/FLAGS_register for details.

100 questions
1
vote
2 answers

does NEG instruction in assembly language sets the Overflow flag

I want to know if the NEG instruction affects the overflow flag too. I know that it negates the value of a variable, but couldn't find out whether it affects the Overflow flag or not.
1
vote
1 answer

ZF not set as a result of MUL instruction in assembly language

I am using masm615 assembler and textpad as an editor. I am writing 32 bit assembly program. In the program I am trying to set zero flag as a result of mul instruction but it is not working. Can anyone tell me why the zero flag is clear while the…
p096035
  • 39
  • 4
1
vote
2 answers

Assembly comparison flags understanding

I am struggling to understand the following code snippet in assembler: if ( EAX >= 5 ) EBX = 1; else EBX = 2;" In assembler this can be written as follows (according to my book), emulating the jge instruction you'd normally use in terms of…
Lukas Arvidsson
  • 467
  • 2
  • 6
  • 13
0
votes
0 answers

Why eflags register need a PF flag to record even or odd ones in the data?

I understand the purpose of the pf flag, which is to indicate whether there are an even or odd number of ones in the resulting data after certain instructions manipulate the register. However, It is certainly not just for programming tricks such as…
0
votes
1 answer

Conditions under which EFLAGS flags are set in x86/x64

I would like to know what are the conditions under which the basic EFLAGS flags (CF, ZF, OF, SF...) are set. I have looked into the Intel x86 instruction manual, and this website that is well done, but without success. I managed to find the…
Katoptriss
  • 107
  • 6
0
votes
2 answers

Why does the Zero Flag exist?

I understand the use of the carry and overflow flags exist for error checking in arithmetic, but why is the zero flag useful to the system/programmer?
0
votes
2 answers

Overflow flag set to 1 after ROL operation even though it should be undefined

I'm learning 8086 assembly using emu8086, I was playing around with some rotate instructions, and as for my question I know that for more than 1 bit shifts/rotations, the behaviour of the overflow flag OF is undefined. But when I tried the following…
blake
  • 107
  • 1
  • 7
0
votes
0 answers

Should Sign Bit be ON for -65535 decimal in Intel 8086 assembly language?

I am currently learning about arithmetic operations for Intel 8086 assembly language. I was trying to figure out manually after the below code what would the status of flat bits specially overflow flag and sign flag bit and why? MOV AX, 0xFFFF …
0
votes
0 answers

What exactly does BitwiseXNOR mean?

In x86 TEST instruction, we have the following operations: Temporary = Source1 & Source2; SF = MSB(Temporary); if(Temporary = 0) ZF = 1; else ZF = 0; PF = BitwiseXNOR(Temporary[0:7]); for(PF = 1, i = 0; i < 8; ++i) PF ^= Temporary[i]; CF = 0; OF =…
Nicholas Humphrey
  • 1,220
  • 1
  • 16
  • 33
0
votes
0 answers

does single step interrupt(01H interrupt) clear TF flag after every instruction?

i want to use single step interrupt and i understand that for make this interrupt work for every instruction the TF flag should be 1 (TF=1). and in my code i see single step interrupt work but after some instructions(maybe after every output) it…
Kaka10
  • 9
  • 3
0
votes
0 answers

Assembly pushf,pop commands, sub changig result?

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…
Ovelion
  • 61
  • 4
0
votes
1 answer

How can x86 arithmetic in 8 bit mode and update the flags?

I want simulate 8051 using the x86 instruction. In 32 bits mode, I have to rotate left to get the carry flag. it is more steps to get the overflow flag. Do you know how to AL, BL, CL, DL, to do arithmetic operation and update the flags.
0
votes
3 answers

In MASM64, is there an instruction for pushing a 16-bit immediate on the stack?

In MASM64, if I write the instruction push 0, it will push a 64-bit immediate on the stack (i.e. RSP = RSP - 8). So if I just want to push a 16-bit immediate to set FLAGS, I have no idea but write the machine code, such as: .code FlagFunction PROC …
0
votes
0 answers

X86 what is the purpose of the direction flag in the FLAGS register?

I'm currently learning about the FLAGS register in x86 based processors. I understand that the DF(Direction Flag) is used for deciding if string operation should occur backwards or forwards. Either way the operation goes, it's still going to end up…
0
votes
2 answers

State of EFLAGS

Over the past few days I've been struggling with a weird behaviour trying to get the states of EFLAGS. To accomplish this I've written this code: #include int flags_state() { int flags = 0; __asm__ __volatile__("pushfq"); __asm__…
Bruno Criado
  • 120
  • 7