Yahoo Groups archive

AVR-Chat

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

Message

Re: [AVR-Chat] Reading from flash in Assembly

2004-12-06 by Paul Maddox

Dave,

> Doesn't look entirely sane to me..

me neither, but does what I want, fetchs a BYTE from a lookuptable in memory
(on a page boundry I should add).

> Not sure what step is, but we are now pointing at high(Array*2)+Step

yep, Start of my table (array) and a certain number of bytes into it (step)

> Ok, adding offset, but this assumes that Step + num will never be > 255.

Huh?
The 'num' represents the table, there are 16 tables, each of 256 bytes.
so what I have is a value from -

(High(Array*2)+num)*256)+step

don't forget I add the tabel number to the 'upper byte'.

> What I would do, is this:
>
> ldi     zl,low(Array*2) ;Point at the array
> ldi     zh,high(Array*2)
>
> clr     TEMP2 ;or any suitable register
> add     zl,step         ;16 bit op
> adc     zh,TEMP2
>
> add     zl,num          ;16 bit op
> adc     zh,TEMP2

What that gives me is ;- (high(Array*2)*256)+step+num
errr, thats not going to do what I need, 'num' is a table number, as I say,
each table is 256 bytes long.

and you're right 'num' will never be more than 255, and neither will 'step'.

Paul

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.