With the 16-bit chips 8086 and 8088, the Flag Register was 16 bits long. With the
32-bit version of the chip the Register was expanded to 32 bits and is now
called EFLAGS. But it's not a Register like any of the others. It doesn't hold
a number, it holds a collection of flag bits. The flags are all single bits so
you address the contents of this Register one bit at a time. Extending it to 32
bits didn't really change the size of anything, it just added more flag bits.
Various instructions will affect the flags in different ways and remembering which
flags are set or cleared by which instructions is just not possible. It's one
of the main reasons that you need to have some sort of hardware reference to be
able to write Assembly Language. A single instruction can set a number of these
flags, called Condition Codes, and can clear others, so I can't give you a
coherent list of which instructions set which flags but I can give you a list
of flags so you'll have an idea of what you're dealing with. Each flag has a
two-letter signifier, which is derived from its name. For example, OF is the
Overflow Flag. This flag is set when the result of an operation is too big to
fit the location specified for it. It means some data has been lost and the
answer isn't all it could be. The Assigned Flag is set when the result of an
operation is negative. It only means that in the result the highest order bit
is set to 1. If a result is positive, this flag is cleared. In Assembly
Language you don't have less than or greater than comparisons. You just
subtract the two values and check the Sign Flag. You'll actually use this more
than you think. The Zero Flag is another one you use a lot. It gets set when
the results from an operation is zero. To compare two numbers for being equal
you subtract them and check this flag. If the result isn't zero, meaning the
two are not equal, this flag is cleared. This is everyone's favorite: the Carry
Flag is the most useful one of the bunch. If the results of any arithmetic
operation shift, or whatever, has a leftover carry bit, this flag is set. If
nothing is carried out of the operation then this flag is cleared. This flag is
different. This flag is one that you set to modify the way that certain
instructions behave. Here's a simplified explanation. One instruction can be
used to copy a block of memory from one location to another. With a DF Flag
set, the copy will start at the highest memory location and proceed through to
the lowest. If DF is not set, the same instruction will begin with the lowest
memory location and loop through them all to the highest. You can see how this
wouldn't matter if the two blocks overlap one another, otherwise, who cares?
This flag can be set or cleared by you and it may be set or cleared by the CPU
under certain conditions. If it is set, interrupts are enabled and can occur at
any time. When it's not set, interrupts are ignored. The Trap Flag is something
is something that you will probably never use. With this flag set the CPU will
only execute a single instruction before it calls an Interrupt Routine. This is
used by debuggers to make it possible to step through a program one instruction
at a time. This is pretty advanced stuff and I promise I won't talk about this
flag again. The Auxiliary Carry Flag is used for a special form of arithmetic
that isn't used much any more. It works with BCD, Binary Coded Decimal numbers.
BCD is a way of encoding base-10 digits, two to a byte. But it isn't done much
anymore. It was big with languages like COBAL and RPG. One more: the Parity
Flag. It is set if the number of bits set to 1 in the low-order byte of a
result is odd. If the number of bits set is even, it's cleared. At one time,
Parity Bits were important to data communications, but that's not done much
anymore. There are some other flags, but believe me, you'd care even less about
them than you do about some of these. For instance, there are two flags that
only have meaning for the 80286 CPU. Also, take the descriptions I gave you
with a grain of salt. The only way you can work with these flags is one
instruction at a time. You'll have to check which flags are set and why for the
individual instructions. For example, some instructions that result in zero
will set the ZF Flag while others won't.
Assembly Language Programming
Arthur Griffith
US$ 99.95
5.5 hours - 70 Movies
Win Vista XP 2000,ME. Mac OS X
Ground / 2 day / Next Day
33995
285 In Stock
Apex Web Media ( Hyperteach ) P.O Box 398 Bolton BL7 9YS, United Kingdom. Tel: +44 (0) 1204 592071 Fax: +44 (0) 1204 592092 Email:
Apex Web Media ( Hyperteach ) 600 17th Street, Suite 2800, Denver CO 80202 Tel: Toll free 1866 402 1903 (USA) / 434 878 4158 Fax: 1 207 433 4356 Email: