7

I'm currently studying assembly language.

In Microsoft visual studio 2017, I wanted to check the current status of the register flags.

enter image description here

I wanted to know what each register flag abbreviation stands for, so I checkout the wiki page on x86 register flags.

enter image description here

But as you can see, the register flag abbreviations shown in Visual studio do not match the abbreviations in the wiki page.

For the register flags in the visual studio, how can I find out what they stand for?

Fifoernik
  • 9,779
  • 1
  • 21
  • 27
Thor
  • 9,638
  • 15
  • 62
  • 137
  • 3
    From Microsoft: https://msdn.microsoft.com/en-us/library/kwydd1t7(v=vs.80).aspx – Sami Kuhmonen Aug 23 '17 at 06:35
  • @SamiKuhmonen, thank you so much for the link! It is exactly what I'm looking for. But at the top of the page, it says `This documentation is archived and is not being maintained.` And clicking on the `recommended version` produces a `content retired` page. So I was wondering, if there is an newer version of the documentation? – Thor Aug 23 '17 at 06:39
  • 1
    I noticed the same. Not sure if there is a current version since this came up with searches first and has all the regs shown – Sami Kuhmonen Aug 23 '17 at 06:41
  • @SamiKuhmonen thank you very much for helping out! I will update the post if I do find a newer version of the documentation :) – Thor Aug 23 '17 at 06:44
  • BTW, the order in VS is going from top most bits down to the last CF, skipping few of them (TF and reserved and system), so you can sort of guess the mapping from the two screens you posted. – Ped7g Aug 23 '17 at 08:45
  • 2
    And I can guess source some of them: OVerflow, Enable Interrupt, ZeRo, Aux..Carry, Parity Even (1=true), CarrY. | On contrary: UP = no idea, if it's like "up", then it's going up when UP=0, which makes as much sense as many other MS things. The PL is another mystery to me, again if it is PLus, then PL=0 is non-negative value, so ... /me left scratching head. – Ped7g Aug 23 '17 at 08:50
  • @Ped7g I completely agree with you, some of the abbreviations seem like total mystery. Making it hard to remember the function of each register flag :( – Thor Aug 23 '17 at 12:25
  • 1
    GDB uses the same 2-letter codes as Intel's documentation. e.g. `ZF`, `SF`. (See the bottom of the [x86 tag wiki](https://stackoverflow.com/tags/x86/info) for tips on using GDB for asm.) – Peter Cordes Aug 23 '17 at 23:05

2 Answers2

9

Microsoft seems to use slightly different abbreviations for the flags, they can be found in older Visual Studio documentation:

OV: Overflow
UP: Direction
EI: Interrupt
PL: Sign
ZR: Zero
AC: Auxiliary carry
PE: Parity
CY: Carry

Sami Kuhmonen
  • 30,146
  • 9
  • 61
  • 74
2

Overflow flag(OV): Set to 1, when given instruction is for e.g of 32bit and resultant value is of 33bit.

Direction flag(UP): Used for operations on strings like lodsb. If set to 1, the acess is from higher memory location to lower memory location else the acess is from loower memory location to higher memory location.

Interrupt flag(EI): Help cpu to identify external interrupt. If set to 1 then microprocessor will recognize interupt request. Else it will ignore the interupt request.

Sign(PL): Set to 1, when most significient bit is 1.

Zero(ZR): set to 1, if result is zero after instruction excuetion.

Auxiliary carry(AE): Bocome 1, if 4th bit generate carry.

Parity(PE): Become 1, if number of 1 bits in the low byte of the result is even.

Carry (CY): set to 1, if carry is generated after a operation.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • If you're going to post a 2nd answer to this already-answered question, it would make sense to decode the 2-letter acronyms like [this comment does](https://stackoverflow.com/questions/45832211/x86-register-flag-abbreviations#comment78626956_45832211), like PE = Parity Even. Also note that PE is only set based on the low byte of the result, even for wider operand-size like `inc eax`. And PL is probably "Plus", even though SF-set means negative. "UP" is also backwards, string ops go upward when it's clear. – Peter Cordes Sep 29 '20 at 20:35
  • IF (EI) enables or blocks external interrupts. You're describing TF, the single-step flag. – Peter Cordes Sep 29 '20 at 20:36
  • Ok, that's fine, but at least [edit] it to fix the wrong description of IF. – Peter Cordes Oct 01 '20 at 03:10
  • Thanks for identifying wrong discription of IF @Peter Corder. – Anas Hameed Oct 02 '20 at 06:58
  • Since you missed it in my first comment, I also fixed the inaccurate description of PF. – Peter Cordes Oct 02 '20 at 07:00