Hey, I am learning how to code in assembly to a AtMega32u4 cpu.
In the example below (from Atmel) the LPM-instruction is demonstrated.
What I don't get is why it is necessary to shift the bits one step left when it loads the address to the Z-registers.
<quote>
ldi ZH, high(Table_1<<1) ; Initialize Z pointer
ldi ZL, low(Table_1<<1)
lpm r16, Z ; Load constant from program
; memory pointed to by Z (r31:r30)
...
Table_1:
.dw 0x5876; 0x76 is addresses when ZLSB = 0
; 0x58 is addresses when ZLSB = 1
...
</quote>
In the example below (from Atmel) the LPM-instruction is demonstrated.
What I don't get is why it is necessary to shift the bits one step left when it loads the address to the Z-registers.
<quote>
ldi ZH, high(Table_1<<1) ; Initialize Z pointer
ldi ZL, low(Table_1<<1)
lpm r16, Z ; Load constant from program
; memory pointed to by Z (r31:r30)
...
Table_1:
.dw 0x5876; 0x76 is addresses when ZLSB = 0
; 0x58 is addresses when ZLSB = 1
...
</quote>