作者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)