문제

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