I have an idea for this:

Shift the denominator right until it's odd. If the shifted denominator is less than 256, use the division registers. Shift the result left by the same amount of bits as the you shifted the denominator.

If the shifted denominator is 256 or larger, use software division. Because the denominator is 256 or larger, the result has to be less than 256, so only 8 bits are needed for the result.

Now that I think about it, I can reduce the number of compares/subtracts by the number of times the denominator is shifted.

tepples wrote:

There probably isn't a way to get

*exact* division by an arbitrary 16-bit number out of the memory controller's divider. So at this point, you may have the

XY problem: you have a goal, you think a step (division by a 16-bit number) is the way to go about that goal, and you ask about the step without

describing the goal. What are you trying to accomplish with this division?

Just for fun, pretty much. I might use it as a go-to division routine if I'm in a hurry to get something done.