mirror of
https://github.com/FDOS/kernel.git
synced 2025-07-25 23:04:57 +02:00
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:
parent
7d0a83c800
commit
a6a6cfec9d
@ -88,10 +88,12 @@
|
|||||||
pop bx ; get dividend lo-word
|
pop bx ; get dividend lo-word
|
||||||
mov cx, ax ; save quotient
|
mov cx, ax ; save quotient
|
||||||
mul di ; quotient * divisor hi-word (low only)
|
mul di ; quotient * divisor hi-word (low only)
|
||||||
|
push di ; save divisor hi-word
|
||||||
xchg ax, di ; save in di
|
xchg ax, di ; save in di
|
||||||
mov ax, cx ; ax=quotient
|
mov ax, cx ; ax=quotient
|
||||||
mul si ; quotient * divisor lo-word
|
mul si ; quotient * divisor lo-word
|
||||||
add dx, di ; dx:ax = quotient * divisor
|
add dx, di ; dx:ax = quotient * divisor
|
||||||
|
pop di ; restore divisor hi-word
|
||||||
sub bx, ax ; dividend-lo - (quot.*divisor)-lo
|
sub bx, ax ; dividend-lo - (quot.*divisor)-lo
|
||||||
mov ax, cx ; get quotient
|
mov ax, cx ; get quotient
|
||||||
pop cx ; restore dividend hi-word
|
pop cx ; restore dividend hi-word
|
||||||
|
Loading…
x
Reference in New Issue
Block a user