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.
Assembly: Get the value at a position in a lookup table
-
23-06-2023 - |
문제
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!
해결책
제휴하지 않습니다 StackOverflow