flat assembler
Message board for the users of flat assembler.

Index > Main > restore label

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
Overclick



Joined: 11 Jul 2020
Posts: 214
Overclick
New unusual names is always getting pain. I don't think you have to worry about malfunction as you don't do anything extraordinary with it. It's simple macros to correct some things and it will work as default when your special parameter is not recognised jmp param.
Look at fasm include files, there is a real headache )) Especially proc which I wish to redesign someday. Especially ret inside that. Actually it have one exception like ret 0 to work as normal ret but your macros inside procedures never know abut that. You can use ZERO extension for all the time of course but I think it needs to be fixed.
Post 24 Aug 2020, 11:32
View user's profile Send private message Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 872
Location: Belarus
DimonSoft
Roman wrote:
Quote:

But I was more concerned about attempts to extend the anonymous labels feature and the consequences for the maintainability of the code that uses such extensions.

For this reason we need old style @f and @@
And new style %0 or %1 or %10000

Old code work fine because used old style @f and @@.
New code work good because used new style %
PS: And all happy Smile

And i test now in fasmw 1.73 this:
Code:
%2:
        jmp %2 
    

Work fine.

But not work if:
Code:
%2:
        jmp %2 
%2:
        jmp %2 
    

But what do you gain? Moving back in the direction of Basic or Focal language with meaningless line numbers? The world has moved 60 years forward from there by now and learned that identifiers serve better.

What would be a more useful thing, IMHO, is to have another kind of labels that allow duplication and are always resolved to the nearest one. In fact, that’s exactly what you suggest but without limiting them to numbers. But:
1) Nearest forward or backward one? (Note that even your example is ambiguous)
2) The same problems within macros as we now have with anonymous labels.
3) I guess, it could break the mechanism used by FASM to resolve the values.

And then there’s the rule of –100 points. How many real world tasks can not be solved with labels we have? And how many real world tasks will get solved if we have something like that implemented?
Post 24 Aug 2020, 21:27
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: 17892
Location: In your JS exploiting you and your system
revolution
I think it all stems from the fact that people are lazy to assign proper names.

So the solution is to stop being lazy, right?
Post 24 Aug 2020, 22:53
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3073
Location: vpcmipstrm
bitRAKE
I'm lazy. So, I enjoy the scoping features that fasmg has available. If I write some function and use common labels like "ok", "done", etc. I can just wrap it in a namespace to eliminate conflict in most cases:
Code:
MyFunc:
namespace MyFunc

ok:

done:

end namespace ; MyFunc    
I don't even need to think about labels - use single letters when I'm really lazy. I can always document in the future and give long_verbose_names - it has to work first. If I engineer an algorithm from the inside-out, or move stuff around names don't often make sense until the end anyway.

_________________
¯\(°_o)/¯ unlicense.org
Post 25 Aug 2020, 05:28
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: 17892
Location: In your JS exploiting you and your system
revolution
bitRAKE wrote:
Code:
MyFunc:
namespace MyFunc

ok:

done:

end namespace ; MyFunc    
In fasm it is even simpler:
Code:
MyFunc:

  .ok:

  .done:    
Use the dots folks.
Post 25 Aug 2020, 05:33
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3073
Location: vpcmipstrm
bitRAKE
revolution wrote:
In fasm it is even simpler
Same in fasmg.
Having both is handy.

_________________
¯\(°_o)/¯ unlicense.org
Post 25 Aug 2020, 05:38
View user's profile Send private message Visit poster's website Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 872
Location: Belarus
DimonSoft
bitRAKE wrote:
I can always document in the future and give long_verbose_names - it has to work first. If I engineer an algorithm from the inside-out, or move stuff around names don't often make sense until the end anyway.

It’s not about long_verbose_names, it’s about MeaningfulNames. And since 1970s people tend to respect structured programming, so it’s highly unlikely any of the names changes significantly when some piece of code moves.

However, there’re 3 big problems in programming: proper naming and off-by-one errors.
Post 25 Aug 2020, 07:56
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 214
Overclick
I fixed Tomasz's example:
Code:
macro @@@ [t] {
        local anonymous
        label @f1
        @b5 equ @b4
        @b4 equ @b3
        @b3 equ @b2
        @b2 equ @b1
        @b1 equ @f1
        @f1 equ @f2
        @f2 equ @f3
        @f3 equ @f4
        @f4 equ @f5
        @f5 equ anonymous }    

Usage:
Code:
@@@:
  jmp @f2
@@@:
  jmp @f3
@@@:
  jmp @b2
@@@      ;colon is not necessary
@@@:    
Post 01 Oct 2020, 09:51
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3073
Location: vpcmipstrm
bitRAKE
UTF8 is fun too, we can get graphic ...
Code:
macro ↕ T&
        match L,↓
                L T
                ↑. equ ↓
        end match
        local A
        ↓. equ A
end macro
define ↓
↕    

_________________
¯\(°_o)/¯ unlicense.org
Post 02 Oct 2020, 04:31
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3073
Location: vpcmipstrm
bitRAKE
DimonSoft wrote:
And since 1970s people tend to respect structured programming, so it’s highly unlikely any of the names changes significantly when some piece of code moves.
At the ground floor things are a little messier. I've been around since the 70's, and pascal was my second programming language. Structure is good if your trying to sell a bridge - I'm not selling anything. Software comes and goes like weather. Not that structure in software doesn't have a use, processors have become prediction machines - pipeline clearing is expensive. High-level structure is good for explaining things after-the-fact (there are always exceptions left out - unstructured messy details). On the ground it's one foot in front of the other - if that's off by one then sitting isn't bad.

_________________
¯\(°_o)/¯ unlicense.org
Post 02 Oct 2020, 13:57
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 214
Overclick
bitRAKE wrote:
UTF8 is fun too, we can get graphic ...
Code:
macro ↕ T&
        match L,↓
                L T
                ↑. equ ↓
        end match
        local A
        ↓. equ A
end macro
define ↓
↕    


Classical @@ is simple, but how simple is to use such symbols?
Code:
macro ↕ [t] {
        local anonymous
        label ↓
        ↑ equ ↓
        ↓ equ anonymous }    


Updated version of my one:
Code:
macro @@@ t& {
        local anonymous
        @f1=$                        ;prevent mixing global and local labels that used dot
        @b5 equ @b4
        @b4 equ @b3
        @b3 equ @b2
        @b2 equ @b1
        @b1 equ @f1
        @f1 equ @f2
        @f2 equ @f3
        @f3 equ @f4
        @f4 equ @f5
        @f5 equ anonymous
        match =: arg,t \{ arg \} }     ; allow to run instruction next to label in line
    
Post 02 Oct 2020, 17:19
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3073
Location: vpcmipstrm
bitRAKE
Overclick wrote:
Classical @@ is simple, but how simple is to use such symbols?
I see your point, but if your editor is programmable - it is quite easy. Honestly, I mostly just use single letters, but I do like the look of the arrows.

_________________
¯\(°_o)/¯ unlicense.org
Post 02 Oct 2020, 19:23
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 214
Overclick
Every single IDE have some issues. The best for me is RadAsm 3 at the moment. Even if this project is dead for many years already it still doing exactly what I need. Not sure how programmable it is. Of course it is but nobody will tell me how ))
Why RadAsm:
1) Build in resource editor, almost the best one.
2) Compiles everything include resources at same time.
3) Most stable, less annoying bugs.
4) Editable colour scheme, grouping, autocomplete etc.
5) Some useful tools on the board.
...

Back to arrows... Isn't it too small to recognise on the code even if coloured? I was thinking to use single @ for the labels, but classical @@ have a sense on its size as it's the same as the caller's argument. Now I have triple jump to triple labels and it easy to read.
Post 03 Oct 2020, 02:55
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.