At 07:19 PM 10/27/99 -0200, Luis wrote: >Hallo all! >I am looking for a routine in ASM that make a division of a 16-bit binary >number for 5 . >For example. >015Eh / 05 = 046h > >So my 16-bit binary number will never be larger than 03DEH, with this I will >need only 1 byte for the result. If you only need to divide by five, and you don't want to write a standard division routine, you can do the following: 1. Form y = x/4. (You shift your dividend by 2 bits to the right.) 2. Add y to sum. 2. Form z = y/4. Subtract from sum. 3. Form w = z/4. Add to sum. 4. Form v = w/4. Subtract from sum. (This is sufficient for 3DE or less.) 5. Form u = v/4. Add to sum. 6. Form t = u/4. Add to sum. 7. Form s = u/4. Add to sum. (This is sufficient for FFFF dividend.) For your 3DE or less, you need to add four terms, each of which is shifted 2 bits from the previous value. You can create a macro for this, or a subroutine. ================================================================ Robert A. LaBudde, PhD, PAS, Dpl. ACAFS e-mail: ral@lcfltd.com Least Cost Formulations, Ltd. URL: http://lcfltd.com/ 824 Timberlake Drive Tel: 757-467-0954 Virginia Beach, VA 23464-3239 Fax: 757-467-2947 "Vere scire est per causae scire" ================================================================