永发信息网

谢谢你的回答,请问汇编中BCD调整指令如何计算,比如AAD

答案:4  悬赏:50  手机版
解决时间 2021-02-01 18:28
  • 提问者网友:謫仙
  • 2021-01-31 20:52
MOV AX,0906H
MOV DL,06H
AAD
DIV DL
MOV DL,AH
AAM
结果:
AX=0106H如何计算?能写出详细过程么?非常感谢你!
最佳答案
  • 五星知识达人网友:几近狂妄
  • 2021-01-31 21:19
你这个AX=0106H答案是错的 AX应该是 0060H
因为 ADD这个指令是在做除法前调整 AH, AL寄存器的值,它是把两个数的BCD值组成一个十进制值,组成的公式 AL =AH*10 +AL =9*10+6=96 ;AH=00
96的16进制60H
所以此时AX应该说是 0060H
全部回答
  • 1楼网友:我住北渡口
  • 2021-02-01 01:17
AAD: Adjusts two unpacked BCD digits (the least-significant digit in the AL register and the most-significant digit in the AH register) so that a division operation performed on the result will yield a correct unpacked BCD value. The AAD instruction is only useful when it precedes a DIV instruction that divides (binary division) the adjusted value in the AX register by an unpacked BCD value The AAD instruction sets the value in the AL register to (AL + (10 * AH)), and then clears the AH register to 00H. The value in the AX register is then equal to the binary equivalent of the original unpacked two-digit (base 10) number in registers AH and AL. The generalized version of this instruction allows adjustment of two unpacked digits of any number base (see the 揙peration?section below), by setting the imm8 byte to the selected number base (for example, 08H for octal, 0AH for decimal, or 0CH for base 12 numbers). The AAD mnemonic is interpreted by all assemblers to mean adjust ASCIi (base 10) values. To adjust values in another number base, the instruction must be hand coded in machine code (D5 imm8). AAM: Adjusts the result of the multiplication of two unpacked BCD values to create a pair of unpacked (base 10) BCD values. The AX register is the implied source and destination operand for this instruction. The AAM instruction is only useful when it follows an MUL instruction that multiplies (binary multiplication) two unpacked BCD values and stores a word result in the AX register. The AAM instruction then adjusts the contents of the AX register to contain the correct 2-digit unpacked (base 10) BCD result. The generalized version of this instruction allows adjustment of the contents of the AX to create two unpacked digits of any number base (see the 揙peration?section below). Here, the imm8 byte is set to the selected number base (for example, 08H for octal, 0AH for decimal, or 0CH for base 12 numbers). The AAM mnemonic is interpreted by all assemblers to mean adjust to ASCIi (base 10) values. To adjust to values in another number base, the instruction must be hand coded in machine code (D4 imm8).
  • 2楼网友:轻雾山林
  • 2021-01-31 23:42
0906看成是96,96/6=16,再转换成非压缩型BCD数就是0106
  • 3楼网友:青尢
  • 2021-01-31 22:48
AAD: Adjusts two unpacked BCD digits (the least-significant digit in the AL register and the most-significant digit in the AH register) so that a division operation performed on the result will yield a correct unpacked BCD value. The AAD instruction is only useful when it precedes a DIV instruction that divides (binary division) the adjusted value in the AX register by an unpacked BCD value The AAD instruction sets the value in the AL register to (AL + (10 * AH)), and then clears the AH register to 00H. The value in the AX register is then equal to the binary equivalent of the original unpacked two-digit (base 10) number in registers AH and AL. The generalized version of this instruction allows adjustment of two unpacked digits of any number base (see the 揙peration?
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯