16bit/8bit assembly routine needed

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hello:
Does anyone have a good divider routine (assembly) to divide a 16bit number by an 8 bit?
I know atmel has AVR200 which includes a 16/16 divide. The code is rather complex & lengthy, so I'm hoping it would be much shorter & less complex to do a 16/8. Also this might save a few registers, run faster, etc. I'm running outta registers at this point!

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It should be failly simple to take the AVR200 code and cut it down to a 16/8 division (just consider what happens i fthe high byte is always 0 and remove all code associated with this). There should be 2 veriosn of the code, one speed optimized (no loops) and one size optimized (loop based) so do remember to pick the one that suits your needs the best.
The complexity of a 16/8 is in between a 16/16 and a 8/8 (both are present in the AVR200 so check them out). I don't believe you will be able to make it any simpler than this unless you are willing to restrict allowable input values.

Regards