```Computer Old Farts Forum
help / color / mirror / Atom feed```
```From: wkt at tuhs.org (Warren Toomey)
Subject: [COFF] Pointers for maths routines in "assembly"
Date: Mon, 25 May 2020 14:27:26 +1000	[thread overview]
Message-ID: <20200525042726.GA685@minnie.tuhs.org> (raw)

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.

```

```next             reply	other threads:[~2020-05-25  4:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-25  4:27 wkt [this message]
2020-05-25  5:22 ` ralph
2020-05-25  9:12 ` dfawcus+lists-coff
```

```Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,

Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

switches of git-send-email(1):

git send-email \
--to=coff@minnie.tuhs.org \

https://kernel.org/pub/software/scm/git/docs/git-send-email.html

```
Be sure your reply has a Subject: header at the top and a blank line before the message body.
```This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).```