Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Name: Encinada, Keish Einstein

Microprocessors – BSCpE 601


02 Homework 1
Instructions: Do a research about the following status flags (Description/Function).

1. Zero (ZF for Zero Flags)


 The zero flag is a single bit flag that is a central feature on most
conventional CPU architectures (including x86, ARM, PDP-11, 68000,
6502, and numerous others). It is often stored in a dedicated register,
typically called status register or flag register, along with other flags.
The zero flag is typically abbreviated Z or ZF or similar in most
documentation and assembly languages.
 Along with a carry flag, a sign flag and an overflow flag, the zero flag is
used to check the result of an arithmetic operation, including bitwise
logical instructions. It is set to 1, or true, if an arithmetic result is zero,
and reset otherwise. This includes results which are not stored, as most
traditional instruction sets implement the compare instruction as a
subtract where the result is discarded. It is also common that processors
have a bitwise AND-instruction that does not store the result.

2. Sign (SF for Sign Flag)


 In a computer processor the sign flag also called negative flag is a single
bit in a system status register used to indicate whether the result of the
last mathematical operation produced a value in which the most
significant bit was set. In a two’s complement interpretation of the
result, the negative flag is set if the result was negative.
 For example, in an 8-bit signed number system, -37 will be represented
as 1101 1011 in binary (the most significant bit, or sign, is 1), while +37
will be represented as 0010 0101 (the most significant bit is 0).

3. Logical Parity (PF for Parity Flag)


 The parity flag indicates if the numbers of set bits is odd or even in the
binary representation of the result of the last operation. It is normally a
single bit in a processor status register.
 For example, assume a machine where a set parity flag indicates even
parity. If the result of the last operation were 26 (11010 in binary), the
parity flag would be 0 since the number of set bits is odd. Similarly, if
the result were 10 (1010 in binary) then the parity flag would be 1.

4. Carry (CF for Carry Flag) and half-carry flag


 In computer processors the carry flag is a single bit in a system status
register/flag register used to indicate when an arithmetic carry or borrow
has been generated out of the most significant arithmetic logic unit
(ALU) bit position. The carry flag enables numbers larger than a single
ALU width to be.

5. Auxiliary Flag (AF or auxiliary carry flag) or digit carry (DC indicators)
 It is a condition flag bit in the status register of many CPU families,
such as the Intel 8080, Zilog Z80, the x86, and the Atmel AVR series,
among others. It indicates when a carry or borrow has been generated
out of the least significant four bits of the accumulator register
following the execution of an arithmetic instruction. It is primarily used
in decimal (BCD) arithmetic instructions.
 The Auxiliary Carry Flag in x86
 The Auxiliary Carry Flag (AF) is a CPU flag in the FLAGS register of
all x86-compatible CPUs,[2] and the preceding 8080-family. It has
occasionally been called the Adjust Flag by Intel.[3] The flag bit is
located at position 4 in the CPU flag register. It indicates when an
arithmetic carry or borrow has been generated out of the four least
significant bits, or lower nibble. It is primarily used to support binary-
coded decimal (BCD) arithmetic.

6. Arithmetic overflow (OF for Overflow Flag or VF for oVerflow Flag)


 In computer processors, the overflow is usually a single bit in a system
status register used to indicate when an arithmetic overflow has
occurred in an operation, indicating that the signed two’s-complement
result would not fit in the number of bits used for the result. The
overflow flag is thus set when the most significant bit is changed by
adding two numbers with the same sign (or subtracting two number with
the opposite signs).

You might also like