tholm@uvicctr.UUCP (Terrence W. Holm) (07/13/88)
[I have been asked to repost this.]
EFTH Minix report #3 - May 1988 - rmi4.s & rmu4.s
There are problems in the MINIX long remainder functions
which are called by the C compiler.
To test your current system try, (do a "sync" first),
main() {
long int a = 200000L;
long int b = 100001L;
printf( "%D\n", a % b );
}
If you find that this does not work, then install the
following in libc.a,
echo x - rmi4.s
gres '^X' '' > rmi4.s << '/'
X.define .rmi4
X
X| Fixed erroneous jump 1988-Apr-18 efth
X
Xyl=2
Xyh=4
Xxl=6
Xxh=8
X
X.rmi4:
Xmov si,sp
Xmov bx,yl(si)
Xmov ax,yh(si)
Xcwd
Xcmp dx,ax
Xjne L7
Xand dx,dx
Xjge L1
Xneg bx
Xje L7
XL1:
Xxor dx,dx
Xmov cx,xl(si)
Xmov ax,xh(si)
Xand ax,ax
Xjge L2
Xneg ax
Xneg cx
Xsbb ax,dx
XL2:
Xdiv bx
Xxchg ax,cx
Xdiv bx
Xxor bx,bx
XL9:
Xcmp xh(si),#0
Xjge L1a
Xneg bx
Xneg dx
Xsbb bx,#0
XL1a:
X
X
Xret 8
X
XL7:
Xmov di,ax
Xxor bx,bx
Xand di,di
Xjge L1b
Xneg di
Xneg yl(si)
Xsbb di,bx
XL1b:
Xmov ax,xl(si)
Xmov dx,xh(si)
Xand dx,dx
Xjge L1c
Xneg dx
Xneg ax
Xsbb dx,bx
XL1c:
Xmov cx,#16
XL1d:
Xshl ax,#1
Xrcl dx,#1
Xrcl bx,#1
Xcmp di,bx
Xja L3
Xjb L2a | Changed from "jb L2"
Xcmp yl(si),dx
Xjbe L2a
XL3:
Xloop L1d
X
Xjmp L9
XL2a:
Xsub dx,yl(si)
Xsbb bx,di
Xinc ax
Xloop L1d
XL1e:
X
Xjmp L9
/
echo x - rmu4.s
gres '^X' '' > rmu4.s << '/'
X.define .rmu4
X
X| Fixed erroneous jump 1988-Apr-18 efth
X
Xyl=2
Xyh=4
Xxl=6
Xxh=8
X
X.rmu4:
Xmov si,sp
Xmov bx,yl(si)
Xmov ax,yh(si)
Xor ax,ax
Xjne L7
XL1:
Xxor dx,dx
Xmov cx,xl(si)
Xmov ax,xh(si)
XL2:
Xdiv bx
Xxchg ax,cx
Xdiv bx
Xxor bx,bx
XL9:
X
X
Xret 8
X
XL7:
Xmov di,ax
Xxor bx,bx
Xmov ax,xl(si)
Xmov dx,xh(si)
Xmov cx,#16
XL1a:
Xshl ax,#1
Xrcl dx,#1
Xrcl bx,#1
Xcmp di,bx
Xja L3
Xjb L2a | Changed from "jb L2"
Xcmp yl(si),dx
Xjbe L2a | Changed from "jbe L2"
XL3:
Xloop L1a
X
Xjmp L9
XL2a:
Xsub dx,yl(si)
Xsbb bx,di
Xinc ax
Xloop L1a
XL1c:
X
Xjmp L9
/
--------------------------------------------------------------------
Edwin L. Froese
uw-beaver!ubc-cs!mprg!handel!froese
Terrence W. Holm
uw-beaver!ubc-cs!uvicctr!sirius!tholm