1 無符號數(shù)乘法指令 mul
語句格式: mul ops
功能: 若是字節(jié)數(shù)據(jù)相乘,( al )與 ops 相乘得到字?jǐn)?shù)據(jù)存入 ax 中;若是字?jǐn)?shù)據(jù)相乘,則( ax )與 ops 相乘得到雙字?jǐn)?shù)據(jù),高字存入 dx 、低字存入 ax 中。
即字節(jié)乘法:( al ) * ( ops ) → ax ,
字乘法:( ax ) * ( ops ) → dx , ax
【例】無符號數(shù) 0a 3h 與 11h 相乘。
mov al , 0a 3h ;( al ) = 0a 3h
mov bl , 11h ;( bl ) =11h
mul bl ;( ax ) =0ad3h
2 .有符號乘指令 imul 語句
格式: imul ops
功能:字節(jié)乘法:( al ) * ( ops )→ ax ,
字乘法:( ax ) * ( ops )→ dx 、 ax 。
imul 指令除計算對象是帶符號二進(jìn)制數(shù)外,其他都與 mul 一樣,但計算結(jié)果不同。
【例】有符號數(shù) 0b4h 與 11h 相乘。
mov al , 0b4h ;( al ) =b4h
mov bl , 11h ;( bl ) =11h
imul bl ;( ax ) =0faf4h