Len ...
The length of a data set is given by LEN reserved word:
There are two different LENs:
Win32 Structures according. Example:
[HeadLen: len value1: 0 value2:W$ 0 value3: B$ 0]
D$HeadLen = 11 (not 7) because in Win 32 Structures, 'SizeOf' is part of the data.
Free use. Example:
[data1_2_3: 1 2 3 Words_data: W$ 1 2 3 Bytes_data: B$ 0
My_data_Length: len]
In this example, memory Dword (len is always a dWord) pointed by My_data_Length contains the value: 19 (19 bytes). Once 'len' has been used, it is zero:
[data1_2_3: 1 2 3 First_Len: len
Words_data: W$ 1 2 3 Second _Len: len
Bytes_data: B$ 0 Third_Length: len]
D$First_Len = 12; D$Second_len = 6; D$Third_Length = 1
Pay attention that these two Ways for using LEN give different results (+/- 4) and that you can't mix them: If you use 'free LEN' after 'header LEN', 'header LEN' would be turned zero ( > error message). You will reserve 'header LEN's for Win32 Structures only and you will certainly prefer 'free LEN' for your own use (much more consistent with assembly programming).
When begining a new set of data (a new open bracket), Len is turned zero. Note that 'len' doesn't gives an equate absolute like '$' in older assemblers; it is true data you can modify at run time... the traditional '$' is a 'little use' feature you can replace in RosAsm with:
[Val1: 1 2 3 Val2: 50 Hand_Made_Len: Hand_Made_Len - Val1]
Of course, it works too (D$Hand_Made_Len = 16).
If you want to set Len to 0 'by hand' (for example for some tests on a data set development), you can simply do:
[Datatest: 0 2 4 len SomeWords: W$ 3 3 Length: len] ; >>> D$length = 4
(First 'len' used for reset).
~~~~~~~