# Is the motorola 68hc08 really 8bit? - Page 2

#### Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

•  Subject
• Author
• Posted on
Re: Is the motorola 68hc08 really 8bit?

The most efficient way to do a 16 * 16 -> 32bit multiply is often
with two applications of an 8 * 16 -> 24 bits and an addition.
This certainly applied to the 8080/z80 years ago.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article.  Click on
We've slightly trimmed the long signature. Click to see the full one.
Re: Is the motorola 68hc08 really 8bit?
Op Thu, 03 Feb 2005 01:54:10 GMT schreef CBFalconer:

Why do that, an unsigned 16 * 16 -> 32 bit multiply amounts
only to about 30 to 40 bytes code. I used that in my Forth for
the ZX Spectrum around 1986.

And the division 32 / 16 --> 16 bit quotient and 16 bit remainder
doesn't take much more space, either.
--
Coos

Re: Is the motorola 68hc08 really 8bit?

In the 8080 it can all be done in registers, and takes much less
code.  From a very old listing (1980) (21 bytes of code):

;
; 8 bit by 16 bit unsigned multiplication
; (ahl) := (a) * (bc)
; (d) := (e) := 0
; a,f,d,e,h,l
bmult:  lxi  d,8;      d := 0; e := bit counter
mov  h,d
mov  l,d;      clear hl
add  a;        1st multiplier bit to cy
jnc  bmult2;   0 bit
adc  d;        with cy to (a) rh bit
bmult2: dcr  e
rz;            done
adc  a;        into (a), next mul bit to cy
jc   bmult1;   bit is 1
jmp  bmult2;   bit is 0

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article.  Click on
We've slightly trimmed the long signature. Click to see the full one.
Re: Is the motorola 68hc08 really 8bit?
Op Thu, 03 Feb 2005 18:32:39 GMT schreef CBFalconer:

Ha, you won! I needed the EXX instruction and assume
the alternative registers were free, as is the case
in the Spectrum. In other computers that might
be disruptive. Maybe I trusted the excellent code
in the Z80 book that Rodney Zaks wrote a bit to much ;-(

--
Coos

Re: Is the motorola 68hc08 really 8bit?

Now extend it to do 16x1632% on that processor (or even
8x1624%).

Re: Is the motorola 68hc08 really 8bit?

It IS doing 8x1624%.  The 16x16 involves two calls to this, one
with each byte of one operand, a 16 bit addition, and a carry into
the high order byte.  The result is about twice the speed of a
straight forward 16x16 multiply routine.

I remember making some choices in that routine so that the timing
would be as independant as possible of the multiplier bit pattern.

BTW, my notes credit the idea to Jerry L. Goodrich, of Pennsylvania
State University.  The implementation was mine.  The net result was
a slight increase in the total code size for 16x16 multiplication.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article.  Click on
We've slightly trimmed the long signature. Click to see the full one.
Re: Is the motorola 68hc08 really 8bit?

Nobody said that the algorithms have to be (re)invented.
Then there's a question as to whether the vendor has
support libraries and legal issues of incorporating their
work in another product.  And the details vary from one
processor to another.  All in all, not a fun thing to do.

Re: Is the motorola 68hc08 really 8bit?

algorithm,
a

I can't believe this much handwringing over a simple little multiply
routine. Some people might even consider it fun.
--Toby

Re: Is the motorola 68hc08 really 8bit?

numerical statistics to do with pins, dip packages, number of
angels, dancing on.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article.  Click on
We've slightly trimmed the long signature. Click to see the full one.
Re: Is the motorola 68hc08 really 8bit?

This is getting silly. If there IS a definition of 8 bit/16 bit/32 bit
etc. etc. it's quite simple: an N bit processor is one in which the
internal data bus is N bits wide. That covers microcontrollers with no
external bus, as well as processors that are N bit internally but
(usually transparently) N/2 (4,8 etc) bits to the external bus.

The question of how addresses are dealt with is quite separate, and a
whole generation of programming effort has been lost to a lunatic
address paging scheme, but that's life.

Paul Burke