Ok pedja089, so to summarize...


1) Declaring a variable at the same RAM location for BOTH the "bootloader" AND the main program will result in that variable's contents being "preserved" and accessible by the "bootloader".

MySharedVar1 var byte $40 'assigns the byte variable at RAM location $40 - this line would be included in both the bootloader (prior to compiling/copying) and the main program

Setting the RAM location doesn't CLEAR the variable, so when it's subsequently set at the same RAM location (again) when the bootloader is started, the contents remain the same (they're preserved).


2) An ASM level variable (such as BLOCK_SIZE, the value of which is defined in the .INC file for the device) can only be accessed via ASM, but it can be passed to a "preserved" variable like in #1.

BlockSize var byte $40
@ MovLW BLOCK_SIZE
@ MovWF _BlockSize

This loads the assigned value (from the INCLUDE file) into the designated location for the PBP variable "BlockSize".

Anything I'm missing here?