質問

I'm very new to assembly language and what I need to do is find the value at a given position in a lookup table. So for example, given the table:

table: .db 1,2,3,4,5,6,7,8,9,10

How would I get the 3rd element of this table and load it into a register, say r16?

Thanks guys!

役に立ちましたか?

解決

Load the base address of the table into register X, add the appropriate offset, then use LD to fetch the entry from data memory. If your table is in program memory, use register Z and the LPM instruction.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top