Quick links
Latest articles
Internship
Members
New...
Algorithms
Discrete Mathematics
Big data
Languages
C
C++
C++ STL
Java
Data Structure
C#.Net
Android
Kotlin
SQL
Web
PHP
Python
JavaScript
CSS
Ajax
Node.js
Web prog.
Programs
C
C++
DS
Java
C#
Python
Aptitude
C
C++
Java
DBMS
Interview
C
Embedded C
Java
SEO
HR
CS Subjects
CS Basics
O.S.
Networks
DBMS
Embedded Systems
Cloud Computing
Machine learning
CS Organizations
Linux
DOS
More...
Articles
Puzzles
News/Updates

Home » Embedded Systems

Flag registers of 8085 Microprocessor



Here, we are going learn about the different types of flag registers of 8085 Microprocessor.
Submitted by Akash Kumar, on November 08, 2018

The Flag register is basically a special type of register or we can also say that they are Special Purpose Register. And based upon the value of result after any type of arithmetic and logical operation the value of flag bits become either set (1) or reset (0). In 8085 microprocessor, flag register basically consists of 8 bits and from these 8 bit, only 5 of them are useful.

These 5 flags are:

1) Sign Flag

Represented by the symbol S. After any type of arithmetic operation or logical operation if the value of D7 becomes 1 it basically shows that the number is negative and the sign flag is now set, if the value of D7 becomes is 0, it basically shows that the number is positive and the sign flag is now reset.

Example:

    MVI A 40 (load the value40H in register A)
    MVI B 30 (load the value 30H in register B)
    SUB B (A = A – B)

These set of instructions willbasically reset the sign flag to 0 as 40 – 30 is always apositive number.

2) Zero Flag (Z)

After any type of arithmetical or logical operation if the output becomes 0 (00)H, then zero flag is said to be set with value 1, if not it becomes reset with the value 0.

Example:

    MVI A 40 (load the value of40H in register A)
    SUB A 

These set of instructions will basically set the zero flag to the value 1 as 40H – 40H is always gives result as 00H.

3) Auxiliary Cary Flag (AC)

This type of flag is basically used in the BCD number system(0-9). If after any type of arithmetic or logical operation D3 generates any carry and passes on to D4 this flag becomes set with value 1, otherwise, it will become reset with value 0. This is the only flag register which is not used or accessed by the programmer.

Example:

    MOV A 2C (load the value 2CH in register A)
    MOV B 38 (load the value 38H in register B)
    ADD B (A = A + B)

These set of instructions will set the auxiliary carry flag and set the value to 1, as on adding 2C and 38, addition of these lower order will generate a carry.

4) Parity Flag (P)

After any type of arithmetic or logical operation if the result is even parity, means it has even number of 1 bit, the parity register becomes set with value 1, otherwise, it becomes reset with value 0.

Example:

    MVI A 06 (load 06H value in register A)

This instruction will set the value of parity flag to 1 as the BCD code of 06H is 00000110, which contains even number of ones here the no of 1s is 2.

5) Carry Flag (CY)

Carry is generated only when while performing n bit operations if it will lead to a result which has more than n bits, then this flag becomes set with value 1, otherwise it becomes reset with value 0.

Example:

    MVI A 40 (load 40H value in register A)
    MVI B 60 (load 60H value in register B)
    SUB B (A = A – B)

These set of instructions will set the carry flag with value 1 as 40 – 60 generates answer with borrow.






Quick links:
C FAQ(s) C Advance programs C/C++ Tips & Tricks Puzzles JavaScript CSS Python Linux Commands PHP Android Articles More...

Featured post:
Introduction to Linux (Its modes, Safety, Most popular Applications)
Linux Best Distribution Software (Distros) of 2018

Was this page helpful? Please share with your friends...

Are you a blogger? Join our Blogging forum.

Comments and Discussions



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates



© https://www.includehelp.com (2015-2018), Some rights reserved.