I'm just starting with low level assembly in an AVR microcontroller. I have allocated variables on SRAM as :
var1: .BYTE 2
var2: .BYTE 2
Afterwards, I'm populating the variables via SPI from a sensor. Using Indirect adressing as:
;set up Z pointer
ldi ZL, low(var1)
ldi ZH, high(var1)
...
;store the result from registers r25 and r26 into RAM
st Z+, r25
st Z+, r26
I have confirmed that var1
and var2
are stored contiguous in memory.
Now my question is, upon recieving the second 2 Bytes of var2
from the sensor, is it acceptable to just increment the Z pointer and store the result, or should I set up the Z pointer again?