Preserving di in ludivmul.inc: fixes problem with the modulo when

divisor > 0xffff.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1005 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2004-07-24 23:56:32 +00:00
parent 7d0a83c800
commit a6a6cfec9d

View File

@ -88,10 +88,12 @@
pop bx ; get dividend lo-word
mov cx, ax ; save quotient
mul di ; quotient * divisor hi-word (low only)
push di ; save divisor hi-word
xchg ax, di ; save in di
mov ax, cx ; ax=quotient
mul si ; quotient * divisor lo-word
add dx, di ; dx:ax = quotient * divisor
pop di ; restore divisor hi-word
sub bx, ax ; dividend-lo - (quot.*divisor)-lo
mov ax, cx ; get quotient
pop cx ; restore dividend hi-word