At 10:24 PM 12/16/2004, Tony Vandiver wrote: >The real savings if you've got more than one place that this is done is >that you could just initialize the pertinent data in each location : > > > TSM_Curr2Ptr: > > ldi counter,5 ;a register such as r17 > > > > ldi xl,low(TSM_Data_Curr) ;Setup origin > > ldi xl,high(TSM_Data_Curr) > > > > ldi yl,low(TSM_Data_Ptr) ;Setup destination > > ldi yl,high(TSM_Data_Ptr) > >Then jump to the common cleanup to complete the subroutine : I do a number of buffer routines like this. Load pointers, then call the routine to do the operation. Middlin' efficient. Remember in the time it takes us to load two 16 bit pointers, the pic has flipped it's bank select, and loaded a byte into W. :)
Message
Re: [AVR-Chat] More efficient and space saving code
2004-12-17 by Dave VanHorn