> > Here's where the in-line assembler pays off:
> >
> >     link        a6,#0
> >     move.l      d3,-(sp)
> >     move.b      8(a6),d1
> >     moveq       #0,d0
> >     moveq       #7,d3
> > 1$  lsr.b       d1
> >     lsl.b       d0
> >     dbra.b      d3,1$
> >     move.l      (sp)+,d3
> >     unlk        a6
> >     rts
> >
> > The lsr, lsl, and dbra instructions all fit into the instruction fetch
> > registers, and so once they fetched from memory the first time, the
> > remainder of the loop runs with NO memory cycles!
> 
> D2 is also a scratch register.  Use it instead of D3, and you don't have to save
> or restore D3.  And as long as you're using inline assembly, you might as well
> get rid of those LINK and UNLK statements.

True. I left those in because I didn't want to bother with 
recalculating the stack references in my head, just for the sake of the 
example.

> Not that any program would be better for these changes... :-)

Maybe not better from a performance or maintenance point of view, but 
it sure is prettier :-)

--
Roger Chaplin
<[EMAIL PROTECTED]>

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to