flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Anonymous labels

Author
Thread Post new topic Reply to topic
MacroZ



Joined: 12 Oct 2018
Posts: 30
MacroZ 12 Oct 2018, 18:54
I tried to find a subforum for posting suggestions, this forum is the closest I got to. I apologize if this is not the right place.

The frustrating things about named local labels is that as you add more code, you end up adding or taking away older labels or inserting more code in between two or more labels, and I find myself adding more local labels (Maybe not so often) but sometimes and perhaps quite frequently, I also need to rename the local labels.

I've found that this has become routine, and the solution for me is to use anonymous labels, but the problem with them is I can't jump more than one ahead or before.

I would love to see (fasm 1) extended to allow to jump beyond the nearest anonymous label:

Code:
@@: mov eax,0
@@: mov ebx,1
@@: jmp @B2 ; Will jump to mov eax,0
@@: jmp @F2 ; Will jump to mov edx,3
@@: mov ecx,2
@@: mov edx,3    

Alternatively:
Code:
@@: mov eax,0
@@: mov ebx,1
@@: jmp @B,2 ; Will jump to mov eax,0
@@: jmp @F,2 ; Will jump to mov edx,3
@@: mov ecx,2
@@: mov edx,3    

Maybe more readable:
Code:
@@: mov eax,0
@@: mov ebx,1
@@: jmp @B(2) ; Will jump to mov eax,0
@@: jmp @F(2) ; Will jump to mov edx,3
@@: mov ecx,2
@@: mov edx,3    

One of the benefits with this for me, is that the code becomes cleaner overall, less clutter overall, it becomes "narrower" all over the code. Sometimes it is better to have the code as clean as possible, and sometimes you can't get without it and then you can use named local labels.

But there are times when you want to avoid the clutter that comes with local labels, for example when you are developing a very technical piece of code, and you want to avoid local label clutter, in order to see the code better, then anonymous labels can be better.

It is also worth it for me if you would be able to jump back and forth per instruction. I'm sure there can come a time when it would be useful. Having that option, the ability or the luxury is what makes programming so fun. It may not be so useful, but having that luxury adds comfort.
Post 12 Oct 2018, 18:54
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8267
Location: Kraków, Poland
Tomasz Grysztar 26 Oct 2018, 06:52
Possible extensions to @@ mechanism have been discussed since many years ago, but my usual response was to propose macros that would handle this.

Something like the variant you propose has been made as macros for fasmg some time ago, but I believe something similar could be made for fasm 1, too.
Post 26 Oct 2018, 06:52
View user's profile Send private message Visit poster's website Reply with quote
MacroZ



Joined: 12 Oct 2018
Posts: 30
MacroZ 26 Oct 2018, 12:05
Hey, you are alive Smile

This time it is important to keep things organized and not let things go out of hand, especially when you're dealing with two projects.

I see tendencies to that things that sometimes it can be too much work. It is strongly advised to see this time as the right time to keep it organized.

Sometimes when dealing with two projects, it is hard to differentiate between the two and thoughts can move in the wrong directions, confusing fasm1 for fasmg and vice versa.

I once saw a guy using fasm1 terms in fasmg terms, and that was not pretty. Personally, I only want to see improvements, nothing more and nothing less.

_________________
The king auto-generates two things to degrade dangerous artists and intellectuals. The King reserves the right to be king and has made the culprits in advance. Half of the time or more, they are auto-generated.
Post 26 Oct 2018, 12:05
View user's profile Send private message 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


Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.