Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Challenge

2005-06-16 by Dave VanHorn

At 03:20 AM 6/16/2005, Paul Maddox wrote:
>Dave,
>
> >> >REVERSE:
> >> >     LDI        R31,TABLE_LOC
> >> >     MOV    R30,TEMP
> >> >     LPM TEMP
> >
> > Guess what...
> >
> > Isn't it obvious that this DOES NOT WORK?
>
>It works in my code and as I said in the mail...
>the table needs to be on a page boundry and that TABLE_LOC should be double
>the value of its location.
>Assuming the table doesn't move, we don't need to claculate it each time,
>and assumign speed was an issue and memory was no object (as originally
>stated) then the table could be placed on a page boundry.
>for example if the table is at 0x0200, use .EQU TABLE_LOC = $04

Fine, so ldi R31,high(Table_Loc*2) as above, but what about the low byte?
If the low byte has the MSB set on entry, then that needs to get into 
the LSB of the high byte, no?

Worse, if you're in a M128 and putting the table near the end of the 
code space, because the MSB of the high byte needs to be put in bit 0 
of the RAMPZ register for the ELPM instruction.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.