From a6a6cfec9dbe4a703172b5b28807371d014ed932 Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Sat, 24 Jul 2004 23:56:32 +0000 Subject: [PATCH] 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 --- kernel/ludivmul.inc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/ludivmul.inc b/kernel/ludivmul.inc index decf779..1b2a80d 100644 --- a/kernel/ludivmul.inc +++ b/kernel/ludivmul.inc @@ -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