[COFF] Pointers for maths routines in "assembly"

Warren Toomey wkt at tuhs.org
Mon May 25 14:27:26 AEST 2020


Hi all, I have a strange question and I'm looking for pointers.

Assume that you can multiply two 8-bit values in hardware and get a 16-bit
result (e.g. ROM lookup table). It's straightforward to use this to multiply
two 16-bit values:

        AABB *
        CCDD
        ----
        PPPP = BB*DD
      QQQQ00 = BB*CC
      RRRR00 = AA*DD
    SSSS0000 = AA*CC
    --------
 32-bit result

But if the hardware can only provide the low eight bits of the 8-bit by
8-bit multiply, is it still possible to do a 16-bit by 16-bit multiply?

Next question, is it possible to do 16-bit division when the hardware
can only do 8-bit divided by 8-bit. Ditto 16-bit modulo with only 8-bit
modulo?

Yes, I could sit down and nut it all out from scratch, but I assume that
somewhere this has already been done and I could use the results.

Thanks in advance for any pointers.
	Warren

** Back story. I'm designing an 8-bit TTL CPU which has 8-bit multiply, divide
and modulo in a ROM table. I'd like to write subroutines to do 16-bit and
32-bit integer maths.


More information about the COFF mailing list