Re: A86: simple math optimization
[Prev][Next][Index][Thread]
Re: A86: simple math optimization
On Mon, 11 May 1998, Matt2000 wrote:
> Yes. This routine works and has no limits, only 59 cycles. Any
> optimizations?
>
Why didn't you count the "sla L" instructions? By my count, it takes 91
t-states.
> ; 59 T Cycles
>
> ;HL = (16 * d) + e
> ; H, L, D, & A registers modified
> ; D or E can be from 0..255 no limits
>
> xor a ; 4T | Clear A and carry flag
> ld h, a ; 4T | Clear H
> ld l, d ; 4T | HL = D
>
> sla l
> rl h ; 8T | 16-bit rotation, HL = HL * 2
> sla l
> rl h ; 8T | * 2
> sla l
> rl h ; 8T | * 2
> sla l
> rl h ; 8T | * 2, So HL = HL * 16
>
> ld d, a ; 4T | Clear D
> add hl, de ; 11T | HL = HL + E
>
--------
Dan Eble (mailto: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: