淘先锋技术网

首页 1 2 3 4 5 6 7

8086标志寄存器

Flag Register is a 16-bit register, but there are only 9 flags available in the 8086 microprocessor. The rest 7 bits are hence left idle.

标志寄存器是一个16位寄存器,但是8086微处理器中只有9个标志可用。 因此其余7位保持空闲状态。

flag register 8086 microprocessor

There are two categories of flag register:

标志寄存器分为两类

  1. Condition flags

    条件标志

  2. Control flags

    控制标志

1)条件标志 (1) Condition flags)

The conditional flags are set or reset after any arithmetic or logical operation is performed on an 8 bit or 16-bit number. This category consists of the following 6 flags:

在对8位或16位数字执行任何算术或逻辑运算之后,将设置或重置条件标志。 此类别包括以下6个标志:

  1. Carry Flag (CF): The carry flag will be set only if a carry is generated from the MSB of the result after doing any operation in 8086 Microprocessor.

    进位标志(CF):仅当在8086微处理器中执行任何操作后,从结果的MSB中产生进位时,才设置进位标志。

  2. Parity Flag (PF): Parity is related to the number of 1’s contained in the binary data. There exist two types of parity:

    奇偶校验标志(PF):奇偶校验与二进制数据中包含的1的数目有关。 存在两种类型的奇偶校验:

    • Even Parity: When the number of 1’s in the binary data are even.偶校验:当二进制数据中的1的数量为偶数时。
    • Odd Parity: When the number of 1’s in the binary data are odd.奇校验:当二进制数据中的1的数目为奇数时。

    For the flag, the PF is set if there exists an even parity in data after the execution of the instruction. Else the flag is reset.

    对于标志,如果在执行指令后数据中存在奇偶校验,则设置PF。 否则,该标志被重置。

  3. Auxiliary-Carry Flag (AF): This flag is set if there is a generation of carrying from a nibble, i.e. 4 bits of data.

    辅助传送标志(AF):如果有四位数据(即4位数据)产生了进位,则设置此标志。

  4. Zero Flag (ZF): If the result after performing the required operation (Arithmetic or Logical) on the instructions is zero, in that case, the zero flags are set to 1. Else, it remains reset.

    零标志(ZF):如果在指令上执行了所需的操作(算术或逻辑)后结果为零,在这种情况下,零标志将设置为1。否则,它将保持复位状态。

  5. Sign Flag (SF): If the result after performing any arithmetic or logic operation in the given instruction is negative, then the sign flag is set to 1. Else, for a positive result, the sign flag remains reset.

    符号标志(SF):如果在给定指令中执行任何算术或逻辑运算后结果为负,则将标志标志设置为1。否则,对于正结果,标志标志保持复位状态。

  6. Overflow Flag (OF): This Flag will be set if the register gets overflowed with data after any arithmetic or logic operation. This happens in cases when the carry is getting in in MSB, but there is no space in the register to store the carried out bit.

    溢出标志(OF):如果在进行任何算术或逻辑运算后寄存器溢出数据,则将设置此标志。 这种情况发生在进位进入MSB,但寄存器中没有空间存储进位的情况下。

2)控制标志 (2) Control flags)

The control flags are used to navigate the microprocessor for certain operations. There are 3 types of control flags:

控制标志用于导航微处理器以进行某些操作。 有3种类型的控制标志:

  1. Trap Flag (TF): This flag is used of we need single-step debugging in our code. If the TF is set, then the execution will be done step by step. Otherwise, the free-running operation will be done.

    陷阱标志(TF):使用此标志是因为我们需要在代码中进行单步调试。 如果设置了TF,则将逐步执行。 否则,将执行自由运行操作。

  2. Interrupt Flag (IF): This flag is used to enable the Interrupt. The microprocessor is capable of handling interrupts only if this flag is in the set mode. Otherwise, any interrupt raised while the execution of the instructions will not be handled by the microprocessor.

    中断标志(IF):该标志用于使能中断。 仅当该标志处于设置模式时,微处理器才能够处理中断。 否则,在执行指令期间引发的任何中断都不会由微处理器处理。

  3. Direction Flag (DF): This flag is used for string operations. If this flag is set, the string will be read from higher-order bits to lower order bits and vice versa.

    方向标志(DF):此标志用于字符串操作。 如果设置了此标志,则将从高阶位到低阶位读取字符串,反之亦然。

翻译自: https://www.includehelp.com/embedded-system/flag-register-in-8086-microprocessor.aspx

8086标志寄存器