Advertisements
Advertisements
Questions
Explain any four flags of 8085, giving examples.
Enlist different flags provided by 8085 Micro-processor and explain with suitable examples.
Explain any two flags, with examples.
Explain
Advertisements
Solution
8085 has five flags. Sign flag, zero flag, Auxiliary carry flag, Parity flag and Carry flag. A 8-bit register is used to represent five flags as shown in following figure.
Where S - Sign flag, Z- Zero flag, Ac- Auxiliary carry flag, P - Parity flag, Cy- Carry flag.
1. Sign flag (S):
- It is set according to the MSB (D7) of the result.
- If MSB = 1, the result is negative and S = 1.
- Example:
Result = 80H (10000000₂) → S = 1
2. Zero flag (Z):
- It is set to 1 if the result of an operation is zero.
- Example:
A = 05H,SUB 05H→ Result = 00H, Z = 1
3. Auxiliary carry flag (Ac):
- It is set if there is a carry from bit D3 to D4.
- Used mainly in BCD arithmetic.
- Example:
A = 0FH,ADD 01H→ AC = 1
4. Parity flag (P):
- It is set to 1 if the result contains an even number of 1s.
- Example:
Result = 03H (00000011₂ has two 1s) → P = 1
5. Carry Flag (Cy):
- It is set to 1 if the result contains an even number of 1s.
- Example:
Result = 03H (00000011₂ has two 1s) → P = 1
shaalaa.com
Notes
Students should refer to the answer according to their question and preferred marks.
Is there an error in this question or solution?
