I'm very sorry to waste your time, but I just can't seem to figure this out. I'd like to define two constants and one empty space with labels in memory (RAM), then copy the two constants into two registers, add them, and write the result to the reserved space. Thus far I have conceived the code:
.include "m169def.inc" .org 0x0000 rjmp RESET RESET: .dseg VarX: .DB 6 VarY: .DB 2 VarZ: .BYTE 1 .cseg LD r16,VarX LD r17,VarY ADD r16,r17 ST VarZ,r16 RET
But obviously this does not work. It seems as if I can't read directly from the memory by calling a labeled value (variable?). So I'm assuming the memory access method is not by Relative Address Specification but rather Direct Address Specification, and thusly requires a pointer specified in register space holding a memory address to be called. The examples in the AVR documentation say how to use this pointer, but:
LDI r26,low(VarX) LDI r27,high(VarX) LD r16,X
does not seem to work.
So, can I copy a value from memory to a register without using a pointer? If not, how can I properly set the pointers in the code above?
Thanks, and sorry if this is in the wrong forum. I looked but couldn't really find similar coding questions in any other forum so I'm assuming this is where to ask, yes?