I am backing up Proton system variables to an array. The number of system variables varies depending upon the Basic commands used. I would like to tailor the size of the array to suit the number of system variables.

At the moment I
$define D_SysSaveSize 50
Dim D_SysSave[D_SysSaveSize] As Byte
I have a variable, D_Data which is declared "as Byte System" and thus points to the last Proton system variable, so Addressof(D_Data) is the size of the array I need (Proton system variables start from 0) but obviously it is a compile time thing.

I thought perhaps assembler directives but I know nothing about that. Suggestions? or some other way to determine the number of system variables at compile time.