dx装被除数高位,ax装被除数低位,cx装除数,计算0f4240h除以0ah,用下面公式:
高位/cx的商*65536+[高位/cx的余数*65536+低位]/cx可以实现无溢出除法,
divew段代码看不懂啊,它是怎样实现的啊,它连公式里面的*65536这个都没看到,怎么就实现了呢,
最终结果是dx装商的高位,ax装结果的低位,cx装余数。
assumecs:code,ss:stack
stacksegment
dw8dup(0)
stackends
codesegment
start:
movax,stack
movss,ax
movsp,10h
movax,4240h
movdx,0fh
movcx,0ah
calldivdw
movax,4c00h
int21h
divdw:;子程序定义开始
pushax
movax,dx
movdx,0
divcx
movbx,ax
popax
divcx
movcx,dx
movdx,bx;dx:ax/cx=高位的商*65536+[高位的余数*65536+位]/cxret;子程序定义结束
codeends
endstar
分 -->
|