Data Access ....
Simplified access to label and data (reformed syntax):
When you want to declare data, you first declare a label (any non reserved word followed by a colon.
When you want to access the value at a label you give the size marker.
Two signs are available: '§' (paragraph) and '$' (dollar);
(B$, W$, D$,Q$ // B§, W§, D§, Q§ ), before the label name; That's all.
[My_Value: 0]
mov eax d§ My_Value ; d§ / d$ > Dword, w§ / w$ > Word, b§ / b$ > byte
(Same:
mov eax d§_My_Value
mov D§MyValue, ecx)
I provided 2 different signs '§' and '$' to make it as easy as possible on all national keyboards. Just choose the easiest one for you.
Sizes of data may be specified in data declarations. Default is Dword:
[data1_2_3: 1 2 3 Words_data: w§ 1 2 3 Byte_data: b§ 0]
In this example of three labels, the first three data are Dwords. The next three are Words and the last one is a byte.
In MASM / TASM / A86 syntax, data symbols can be declared either as label, or as value:
> MyFirstDword: DD 24 ; with colon
> MySecondDword DD 25 ; without colon
and can be accessed, in both cases, either as labels or as values:
> mov eax dWord Ptr[MyFirstDword] ; the value
> mov esi MyFirstDword ; the address
> mov eax MySecondDword ; the value
> mov esi ADR MySecondDword ; the address (or OFFSET)
plus, of course:
> lea esi MySecondDword ; the address
The result of these 'powerful features' is nothing but utter confusion between values and addresses at writing time.
RosAsm and NASM are much more consistent: In code reality, values can't be reached anyway out of addresses . So, any data symbol is an address and can be nothing else. The fact that, we more often use values than addresses in our sources, is not a counter-argument.
Any attempt to reverse the good syntax, produces defacto the same results as MASM and A86, because of some particular encoding side-problems (in some cases the assembler can't guess the size, and so, we have to tell it >>> and so on...)
So we have to tell the size at each data evocation. As having to write so many 'Byte Ptr[My_Value]', or even the less difficult 'B[My_Value]', could be boring, I have chosen , to break with the usual convention for 'B§My_Value'. I have implemented '§' and '$' (paragraph / dollar) as size markers in order to make it easy on all national keybords.
For Selectors Override, the syntax is, for example:
> mov GS:W§edx-4 00_1101
For Memory Direct Access, the syntax is, for example:
> mov D$+0401130 35
With the '+' Sign, because this is nothing but a Displacement at the encoding point of view. As this formulation is does not conform to Win32 programming, I did not write a special case Analysis to allow :
> mov D§040110 35
(which should usually be a typing error).
~~~~~~~