Consider the following code portion in AVR assembly for the ATmega16 micro controller:
LDI ZH, high(DATA << 1)
LDI ZL, low(DATA << 1)
LPM R16, Z
.org $ffff
DATA: .db 7
This should load the value stored at DATA
into register R16.
But here's my question. According to the ATmega16 datasheet and appnote, in order to address that byte in question I need to shift the address by one. However when I deposit my data at address $FFFF (at the theoretical very end of flash), I can't shift the address left, otherwise I'd shift out the MSB of the address.
How am I supposed to address anything that is stored after address $7FFF? Or is it just impossible to do so?
In the definition file for the micro controller in question (m16def.inc
), there is a FLASHEND
declaration set to 0x1FFF
, so that would prevent me from putting anything past that, technically. But assuming the flash would go up to word addresses past 0x7FFF
, how would I retrieve data from there? Or is it simply impossible and the theoretical highest word address is 0x7FFF
?