Hi! I mean: > + jcxz %%div3216 ; cx=0 -> divisor < 2^16 [ALL this code is NEVER reached in KERNEL now] [So you can add some "panic" here, e.g. deliberately divide by zero...] [...and then you have only he following left:] > +%%div3216: > + cmp dx,bx ; xh < y ? > + jb %%one_div ; yes, one division sufficient > + > + xchg cx,ax ; ax=0, cx=xl > + xchg ax,dx ; dx:ax=0:xh, cx=xl > + div bx ; ax=xh/y, dx=xh%y, cx=xl > + xchg ax,cx ; dx:ax=xh%y*w+xl=xt, cx=xh/y > + > +%%one_div: > + div bx ; ax=xt/y, dx=xt%d=x%d, cx=xh/y > + mov bx,dx ; bx=x%d > + mov dx,cx ; dx:ax=xh/y*w+xt/y=x/y > + xor cx,cx ; cx:bx=x%d > ret
Pretty short, huh? This only affects the 8086 version of the code, the 386 division/modulo code already trivially handles 32=64/32bit with a single "div" command anyway (as visible in the patch by Arkady). which is more than the 8086 16=32/16 bit can do. But TWO steps with 16=32/16 bit each are enough to get 32=32/16 bit results! This means that we can remove the complicated 8086 32=32/32 bit code. The code for 386 is not changed. http://www.coli.uni-sb.de/~eric/kernelmodulo.txt Eric ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click _______________________________________________ Freedos-kernel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-kernel
