flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Main > [fasmg] Operator ":=" can be extended to replace "label"

Author
Thread Post new topic Reply to topic
VEG



Joined: 06 Feb 2013
Posts: 69
Location: Minsk, Belarus
[fasmg] Operator ":=" can be extended to replace "label"
Operator ":=" can be extended to replace "label" completely. It seems that it just lacks the type hint feature. And it can be added, like this:

Code:
labelname := dword $-4

It will be consistent with other situations where we using such type hints before equations (like cmp dword [ebp+5], 0). And it looks simpler than:

Code:
label labelname dword at $-4


So, operator := will be more powerful and it will be able to replace the "label" instruction completely. It even looks like it sets a lable because of the colon after a label name, almost like this:

Code:
labelname: = dword $-4

As the result all equations in standard headers will be able to have a type hint which will allow to use them like this:

Code:
cmp [eax], VK_LBUTTON

Now VK_LBUTTON doesn't have a type hint and we have to specify that it is a dword in the cmp itself.

What do you think?
Post 03 May 2017, 08:12
View user's profile Send private message Visit poster's website Reply with quote
VEG



Joined: 06 Feb 2013
Posts: 69
Location: Minsk, Belarus
Ok, I can see one possible flaw of this suggestion with current syntax of label type/size hint. But it can be addressed like I've written here.


Code:
labelname := dword $-4
labelname := {4$-4


It will be possible if some special syntax for type/size hinting will be introduced, like I've written in the example.
Post 03 May 2017, 11:02
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6588
Location: Kraków, Poland

VEG wrote:
Ok, I can see one possible flaw of this suggestion with current syntax of label type/size hint. But it can be addressed like I've written here.

As you can see, while throwing new ideas for syntactic choices and directives is easy, much more work is required to reconcile various ideas into a single consistent design. As I wrote in my initial announcement of my new assembly engine it took me many years to refine design enough that I could actually start writing some code, because all my earlier attempts were falling apart. Every time I combined various features (but also "compatibilities") I wanted to have in my new assembler I ended up with contradictions. I finally came up with an iteration that worked for me in design and it became the fasmg engine, but even then it had to contain some compromises that I'm not completely happy with. But I am happy enough that I find writing macros for fasmg very satisfying now.
Post 03 May 2017, 19:08
View user's profile Send private message Visit poster's website Reply with quote
VEG



Joined: 06 Feb 2013
Posts: 69
Location: Minsk, Belarus
Ok, maybe the idea with these custom sizes is too audacious. But at least ":=" can work like label with hardcoded set of sizes (byte/word/dword/qword/etc). Actually, I don't know why it can be useful to set a non-standard size of a label. None of the instructions will gain some useful information from such non-standard sizes.

Of course I can write a macro which will translate "lbl := dword $ - 4" into "label lbl:dword at $ - 4". But it seems that it could be a built-in feature also. That's it.

At least keep in mind this idea. Maybe you will like it someday Smile
Post 03 May 2017, 20:00
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6588
Location: Kraków, Poland
In fasm 1 you could write "lbl = dword $" and it meant something else than what you propose. Note that there is a difference in meaning between "dword lbl" and "dword [lbl]".
Post 03 May 2017, 20:25
View user's profile Send private message Visit poster's website Reply with quote
VEG



Joined: 06 Feb 2013
Posts: 69
Location: Minsk, Belarus

Quote:
Note that there is a difference in meaning between "dword lbl" and "dword [lbl]".

Oh, you're right.
Post 03 May 2017, 20:44
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15153
Location: GW170817
Re: [fasmg] Operator ":=" can be extended to replace "label"

VEG wrote:
Operator ":=" can be extended to replace "label" completely.

Yes it can. But is it an improvement? ":=" is more obscure than simply "label" IMO. It takes about the same time to type. The cognitive requirement for the programmer is higher with := because one has to remember that it translates to label.

One of the best features of fasmg for me is the elimination of the curly bracket requirements. And I wouldn't like to see it slowly go back to a series of "special" characters like most websites now want us to put in our passwords.

All IMO of course.
Post 04 May 2017, 08:16
View user's profile Send private message Visit poster's website Reply with quote
VEG



Joined: 06 Feb 2013
Posts: 69
Location: Minsk, Belarus
revolution, syntax with {} was suggested only for internal purposes. Programmer will use "dword" and "word" in code of a program. Exactly as it was before. Only macros need some changes. Explanation is here.
Post 04 May 2017, 10:57
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.