Hello Arcadaw,
I don't know if you already figured out this, but you can do this by using indirect address, but you may probably need to store this data in to a DB instead of a memory M location, if you are not familiar with indirect addressing, you can do this with a counter, and a positive edge logic, see example
A 1second_pulse
FP Temp_bool
= Temp_bool2
JNB exit_1
L 0
L counter
==I
JNB Next_memory
L IW 10
T MW2204
JU exit_a
Next_memory: nop 0
L 1
L counter
==I
JNB Next_memory2
L IW 10
T MW2206
JU exit_a
.. copy code for number of data memories
exit_a: nop 0
L 1
L counter
+I
T counter
L counter
L maximum_number_of data_reached
==I
L 0
T counter
exit_1: nop 0