作者jiunlin (jiunlin)
看板PangSir
标题课本p.241 IMUL Instruction Example 释疑
时间Wed Dec 8 19:47:25 2004
Example 1:
mov al,48
mov bl,4
imul bl ;AX=00C0h, OF=1
Example 3:
mov ax,48
mov bx,4
imul bx ;DX:AX=000000C0h, OF=0
有同学询问为何一样是48*4,OF却不一样,这是因为课本上的一句话:
IMUL sets the Carry and Overflow flags if the high-order product is not a
sign extension of the low-order product.
所以说在example 1中,AL是11000000b,AH是00000000b,AL的sign是1,所以AH不是
AL的sign extension,所以IMUL sets OF。同理,在example 3中,AX是
0000000011000000b,sign是0,而DX也是0,所以DX是AX的sign extension,因此IMUL
don't sets OF。
TA.
※ 编辑: jiunlin 来自: 140.112.28.97 (12/08 19:58)