Re: A86: Multiplying by 10.


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

Re: A86: Multiplying by 10.



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.

Mul_A_10:
 push bc
 add a,a
 ld b,a
 add a,a
 add a,a
 add a,b
 pop bc
 ret

Mul_HL_10:
 push de
 add hl,hl
 ld d,h
 ld e,l
 add hl,hl
 add hl,hl
 add hl,de
 pop de
 ret

Use the first routine if A<26 since else the register would overflow.
And the push/pop are of course not necessary.

-- 
Jimmy Mårdell                "The nice thing about standards is that 
mailto:mja@algonet.se         there are so many of them to choose from."
http://www.algonet.se/~mja    
IRC: Yarin                   "Sanity? I'm sure I have it on tape
somewhere!"


References: