Just a newby asking the 64k question again - Arduino Mega2560

I must admit I skimmed a bit, but I think I can explain something.

The raw assembler commands can, quite efficiently, index into 64 bytes of memory by using X, Y and Z registers which are 16-bit. Bear in mind it is basically an 8-bit processor. :slight_smile:

Thanks to your post I spotted on page 2 of the assembler manual RAMPX, RAMPY and RAMPZ which can increase the addressing range. I presume though, that you have to decide in advance whether you want to access below 64K or above 64K. Reading further, though, that applies to SRAM not PROGMEM.

Further reading reveals ELPM, a variant on LPM (load from program memory) which appears to address 24-bits into program memory.

Presumably, to retrieve data from a large array, in program memory, the ELPM instruction has to be generated at some point.