Re: A86: Multiplying by 10.


[Prev][Next][Index][Thread]

Re: A86: Multiplying by 10.



On Thu, 30 Oct 1997, Garcia wrote:

> What is the easiest and fastest way to multiply a sinlge register by 10. 
> I've tried several ways but their no good.
> 
> Andres Garcia
> 

What ways have you tried?  This is what I would do.
Input:  Register A contains a value.
Output: Register A contains 10*value, and B is modified.

	sll	a	; a = 2*original value
	ld	b,a	; b = 2*original value
	sll	a	; a = 4*original value
	sll	a	; a = 8*original value
	add	a,b	; a = 10*original value

There's a routine in the ROM that will do this for you.

--------
Dan Eble <eble@cis.ohio-state.edu>
         (http://www.cis.ohio-state.edu/~eble)

"Behold, how great a matter a little fire kindleth!" - James 3:5


References: