Log in

View Full Version : Questions about registry window in Visual Studio 2010


dbrock178
November 7th, 2010, 00:52
Hello all,

I am experimenting with an example problem shown below in Visual Studio 2010. I am expecting the ZR value to change when eax goes to zero, however, it doesn't change. From what I read in this article (
http://msdn.microsoft.com/en-us/library/kwydd1t7%28VS.80%29.aspx) it sounds like the ZR value in the registry window is the same as ZF registry, is this true?

Thank you,
dbrock


Code:

INCLUDE Irvine32.inc

.data
var BYTE 0FFh
.code

main PROC

mov eax,1
sub eax,1

exit

main ENDP
end main

Kayaker
November 7th, 2010, 16:59
Sheesh, what a document. Intel and everyone else calls the Zero Flag ZF (or Z), not ZR. Similarly, the article uses non-standard designations for almost every other flag:

Carry Flag (CF) it calls - CY
Overflow Flag (OF) - OV
Parity Flag (PF) - PE
Sign Flag (SF) - PL (huh?)
Direction Flag (DF) - UP (oh c'mon, why not up, down, charmed, strange..?)
etc.

Now why would this dude at MS decide to make up his own mnemonics?


Anyway, to answer the question - the ZF is *set to 1* when the result of an instruction was zero, not set to 0. Assemble a few instructions into Ollydbg or other and you will see the effect on ZF and other status register (not "registry" flags. i.e.

mov eax,2
sub eax,1 - ZF = 0
sub eax,1 - ZF = 1
sub eax,1 - ZF = 0

dbrock178
November 7th, 2010, 17:45
Thanks for the reply Kayaker.

A little more playing around with VS found that all the flags I tested (CF,OF,SF) all worked as expected with my example programs, but I still can't get the ZR (ZF) flag to go to zero in the registry window. I found this routine that the author of my book included to display the registry values and it prints out the expected values for the ZF registry. I'm thinking this may be a bug in VS.

evlncrn8
December 5th, 2010, 14:40
think you mean register window instead of registry window....
also ZF is a bitflag in the EFLAGS register...

Code:

|11|10|F|E|D|C|B|A|9|8|7|6|5|4|3|2|1|0|
| | | | | | | | | | | | | | | | | `--- CF Carry Flag
| | | | | | | | | | | | | | | | `--- 1
| | | | | | | | | | | | | | | `--- PF Parity Flag
| | | | | | | | | | | | | | `--- 0
| | | | | | | | | | | | | `--- AF Auxiliary Flag
| | | | | | | | | | | | `--- 0
| | | | | | | | | | | `--- ZF Zero Flag
| | | | | | | | | | `--- SF Sign Flag
| | | | | | | | | `--- TF Trap Flag (Single Step)
| | | | | | | | `--- IF Interrupt Flag
| | | | | | | `--- DF Direction Flag
| | | | | | `--- OF Overflow flag
| | | | `----- IOPL I/O Privilege Level (286+ only)
| | | `----- NT Nested Task Flag (286+ only)
| | `----- 0
| `----- RF Resume Flag (386+ only)
`------ VM Virtual Mode Flag (386+ only)


formatting might mess up but hopefully it will shed some light on things for you...