论文部分内容阅读
Z80中的DAA指令,是十进制调整指令,用于把BCD数算术运算的结果(存于累加器A中)调整为BCD数。调整是根据运算结果及标志寄存器的状态来进行的。具体地说,当低四位结果≥10D,或半进位位H=1时要进行调整;当(高四位结果+H)≥10D或进位位C_Y=1时要进行调整。当减标志位N=0时,进行加调整(+6);N=1时,进行减调整(-6)。使用DAA指令时应注意以下问题: 1.DAA必须紧跟在八位数算术运算指令之后,即要放在ADD ADC(加法),SUB SBC(减法)NEG(求补)和INC A(增量)、DEC(减量)这些指令的后面,不能用于十六位数运算指令之后,也不能单独使用。
The DAA instruction in Z80 is a decimal adjustment instruction that adjusts the result of BCD arithmetic operation (stored in accumulator A) to the BCD number. The adjustment is based on the result of the operation and the status of the flag register. Specifically, the adjustment is performed when the low four bit result is ≥10D or the half bit bit H = 1, and when (high four bit result + H) ≥10D or carry bit C_Y = 1. When minus flag bit N = 0, add adjustment (+6); when N = 1, decrease adjustment (-6). The following issues should be observed when working with DAA instructions: 1. DAA must be immediately followed by an eight-bit arithmetic instruction, ADD ADD, SUB SBC and INC A, ), DEC (decrement) These instructions can not be used after a 16-digit arithmetic instruction, nor can they be used alone.