0x00 BCD 运算
在 BCD 中,使用4位值作为操作数,但由于只表示 0 到 9 的数字,因此只使用 0000 到 1001 的二进制数,而不使用 1010 到 1111 的二进制数(don't care)。
因此,不能使用常规的 2'complement 运算来计算,需要额外的处理:如果 4 位二进制数的运算结果在 1010 到 1111 的范围内,需要将 6 (即 0110),添加到运算结果中。
BCD 运算例子 |
在 BCD 中,使用4位值作为操作数,但由于只表示 0 到 9 的数字,因此只使用 0000 到 1001 的二进制数,而不使用 1010 到 1111 的二进制数(don't care)。
因此,不能使用常规的 2'complement 运算来计算,需要额外的处理:如果 4 位二进制数的运算结果在 1010 到 1111 的范围内,需要将 6 (即 0110),添加到运算结果中。
BCD 运算例子 |