The SNES has hardware multiply / divide (with remainders).
4204 wl++++ WRDIVL - Dividend C low byte
4205 wh++++ WRDIVH - Dividend C high byte
4206 wb++++ WRDIVB - Divisor B
Write $4204/5, then $4206. 16 "machine cycles" (probably 96 master
cycles) after $4206 is set, the quotient may be read from $4214/5, and
the remainder from $4216/7. Presumably, $4204/5 are not altered by this
process, much like $4202.
The division is unsigned. Division by 0 gives a quotient of $FFFF and a
remainder of C.
I guess you'll be making use of the remainder there.