View Full Version : Multiplication and division in assemly

glentech

02-03-2007, 01:32 AM

Can someone give a sample routine for multiplication and division in assemly?· I tried the routine in the tv routine with·some modifications. (starting at the div:) with no success.· I just want to divide a cnt number by 8000 for tenths of ms without using too many clock cycles.

Mike Green

02-03-2007, 01:47 AM

Have a look at the Propeller Guts document here: http://forums.parallax.com/showthread.php?p=572669

This includes multiplication and division routines and some discussion of this.

glentech

02-03-2007, 01:51 AM

Thanks mike I didnt know where to look.

Tracy Allen

02-03-2007, 03:27 AM

Also, to multiply times a constant fraction like 1/8000, the calculation can be streamlined for speed.

1/8000 = 0.512 / 4096

0.512 = %0.10000011000100100110 to 20 places

There are tricks like Booth's algorithm where bit sequences like this, 11111, in a multiplier, can be simplified to 100000 minus 1. There was a discussion that when pretty deep into this kind of thing in:

Derivation of Algorithms for Multiplication by a Constant Fraction (http://forums.parallax.com/showthread.php?p=611410)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Tracy Allen

www.emesystems.com (http://www.emesystems.com)