Intel 8086 microprocessor is a 16 bit microprocessor.It has 16 bit flag register which is divided in to two parts.
1.)status flags
2.)control flags
status flags are 6 in number, they are:-
i.)carry flag
ii.)parity flag
iii.)auxiliary carry flag
iv.)zero flag
v.)sign flag
vi.)overflow flag
control flags are 3 in number, they are:-
i.)direction flag
ii.)interrupt flag
iii.)trap flag
the 8086 flag register comes with an extra flag called overflow flag which is not present on 8085 microprocessor flag register
Carry flag:-
In computer processors the carry flag (usually indicated as the C flag) is a single bit in a system status (flag) register used to indicate when an arithmetic carry or borrow has been generated out of the most significant ALU bit position. The carry flag enables numbers larger than a single ALU width to be added/subtracted by carrying (adding) a binary digit from a partial addition/subtraction to the least significant bit position of a more significant word. It is also used to extend bit shifts and rotates in a similar manner on many processors (sometimes done via a dedicated X flag). For subtractive operations, two (opposite) conventions are employed as most machines sets the carry flag on borrow while some machines (such as the 6502 and the PIC) instead resets the carry flag on borrow (and vice versa).
Parity flag:-
In computer processors the parity flag indicates if the number 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 102 (1100110 in binary) then the parity flag would be 1.
Auxiliary carry flag:-
It is a flag stored in the FLAGS register on all x86 compatible CPUs. It is bit 4. It is used to indicate when an arithmetic carry or borrow has been generated out of the 4 least significant bits. It is primarily used in BCD arithmetics.
Zero flag:-
The Zero Flag is a flag stored in the FLAGS register on all x86 compatible CPUs. It is bit 6. When it is set to 1, it means that the result of an instruction was zero. The Zero Flag is changed by all math instructions and the CMP instruction (a compare instruction works by subtracting the two values).
Sign flag:-
In computer processor the negative flag or sign flag is a single bit in a system status (flag) register used to indicate whether the result of last mathematic operation resulted in a value whose 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 is 1), while +37 will be represented as 0010 0101 (the most significant bit is 0).
Trap flag:-
The Trap Flag is a flag defined in the x86 processor's flags register.
The trap flag's state is used when using the x86's debugging features. When set, the x86 processor will execute only one instruction at a time and then call interrupt 1 (the debug interrupt) to allow an attached debugger to inspect the program as it executes.
The trap flag can also be set by the x86's debug registers.
Interrupt flag:-
IF (Interrupt Flag) is a system flag bit in the x86 architecture's FLAGS register, which determines whether or not the CPU will handle maskable hardware interrupts.
The bit, which is bit 9 of the FLAGS register, may be set or cleared by programs with sufficient privileges, as usually determined by the Operating System. If the flag is set to 1, maskable hardware interrupts will be handled. If cleared (set to 0), such interrupts will be ignored. IF does not affect the handling of non-maskable interrupts or software interrupts generated by the INT instruction.
Direction flag:-
The Direction Flag is a flag that controls the left-to-right or right-to-left direction of string processing stored in the FLAGS register on all x86 compatible CPUs. It is bit 10.
When it is set to 0 (using the clear-direction-flag instruction CLD), it means that instructions that autoincrement the source index and destination index (like movs) will increase both of them. In case it is set to 1 (using the set-direction-flag instruction STD), the instruction will decrease them.
This flag is used to determine the direction (forward or backward) in which several bytes of data will be copied from one place in the memory, to another. The direction is important mainly when the original data position in memory and the target data position overlap.
Overflow flag:-
The overflow flag is set when the Most Significant Bit (MSB) is set or cleared. For example, take the addition of 127 and 127. The 8 bit signed binary number of 127 is represented as 0111 1111. The MSB (the bit to the far left) is 0. When these two 8 bit numbers are added the result is 254, or 1111 1110. Notice now that the MSB is now 1 and not 0. Therefore, the overflow flag has been set. (1111 1110 would be interpreted as a negative number. The Two's complement is -2.)
thats it friends
reference:-wikipedia, A.K.Ray text book for advanced microprocessors and peripherals
plz comment your questions in any case, dont hesitate.........
No comments:
Post a Comment