Path: ns-mx!hobbes.physics.uiowa.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!destroyer!sharkey!mudos!grex!power From: power@grex.ann-arbor.mi.us (Russ Woodroofe) Newsgroups: comp.sys.apple2 Subject: Re: need fast way to do run time division Message-ID: <1992May28.050520.29568@grex.ann-arbor.mi.us> Date: 28 May 92 05:05:20 GMT References: <1992May25.033856.17544@msuinfo.cl.msu.edu> <35cX03iT03IJ00@amdahl.uts.amdahl.com> Organization: Cyberspace Communications/GREX Public Access Unix +1 313 761 3000 Lines: 38 Here is an 8 bit routine in assembly to do division. This is based on the algorithm in SAM's Apple Programmer's Handbook (I think that's the title, anyway).... ;======================= ; Divide word by byte ;======================= ; a=WordL, y=WordH, x=byte RDiv sta RDWord sty RDWord+1 stx RDByte ldx #16 lda #0 sta RDRemain clc RDiv1 rol RDWord rol RDWord+1 rol RDRemain dex bmi RDiv2 lda RDRemain sec sbc RDByte bcc RDiv1 sta RDRemain bcs RDiv1 ; carry always set RDiv2 clc ror RDRemain rts RDWord dw 0 RDRemain db 0 RDByte db 0 Hope that helps... The Power