I just tried the "slightly optimized version" and it works fine with your numbers. Change the default radix to decimal or change the ... MOVLW 24 ... to ... MOVLW d'24' ... and that should fix it. Djula >I'm trying to divide >6666666 >by 444 >the result is int(15015) > >Perhaps I'm doing something wrong but I can't figured it out what it is. > >He stands that: > >; Dividend - AARGB0:AARGB1:AARGB2 (0 - most significant!) >; Divisor - BARGB0:BARGB1 >;Temporary: >; Counter - LOOPCOUNT >; Remainder- REMB0:REMB1 >;Output: >; Quotient - AARGB0:AARGB1:AARGB2 > >Well, when AARGB0:AARGB1:AARGB2 is loaded with 65:B9:AA (dec '6666666') >and BARGB0:BARGB1 with 01:BC (dec '444') >the quotient should be 00:3A:A7 but it throws AA:70:37 >and 9d in REMB1. > >What is wrong? Should I have to re-order the bytes? > >The routine is in the archives: PICList >..\techref\microchip\math\div\24by16.htm -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads