flat assembler
Message board for the users of flat assembler.

Index > Main > restore label

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



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 23 Aug 2020, 09:22
Hi
How to get it work?
Code:
SomeLabel:
...
restore SomeLabel
...
jmp SomeLabel
...
SomeLabel:    ;jump needed to here    

It seems to work but it's not.
Post 23 Aug 2020, 09:22
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: 20451
Location: In your JS exploiting you and your system
revolution 23 Aug 2020, 09:24
You can't undo assembler labels.

Either use a new name (perhaps with local), or use anonymous labels @@, @b, @f.
Post 23 Aug 2020, 09:24
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1848
Roman 23 Aug 2020, 10:07
Maybe this will help.
Use Tab for jump.
Code:
mov esi,TabJump
mov [esi],SomeLabel
jmp dword [esi]
add esi,4
mov [esi],SomeLabel
jmp dword [esi]
;restore 
sub esi,4
jmp dword [esi]
    


TabJump dd 400 dup (0)


Last edited by Roman on 23 Aug 2020, 10:12; edited 2 times in total
Post 23 Aug 2020, 10:07
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1848
Roman 23 Aug 2020, 10:09
Or change sources Fasmw and write you own Fasmw version.
Post 23 Aug 2020, 10:09
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20451
Location: In your JS exploiting you and your system
revolution 23 Aug 2020, 10:12
Roman wrote:
Or change sources Fasmw and write you own Fasmw version.
If you want to change it, then it would be better to change the core preprocessor/assembler then both fasm and fasmw are updated together from the same code.
Post 23 Aug 2020, 10:12
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1848
Roman 23 Aug 2020, 10:14
It be nice if this done Tomas Smile

I am about this
Code:
SomeLabel:
...
restore SomeLabel
...
jmp SomeLabel
...
SomeLabel: 
    


And this:
Code:
;introduce more symbols for @f\@@. For example % or &
%0: inc dword [ParamsA]
jmp %1
 ParamsA: dd 0,0,0,0
%1:
cmp dword [ParamsA],10
jbe %0
%0:
dec dword [ParamsA]
cmp dword [ParamsA],1
ja %0
    

Or this label without ':':
Code:
jmp 1%
1%
jmp 2%
2%
Or
jmp %1
%1
jmp %2
%2
    


Last edited by Roman on 23 Aug 2020, 11:20; edited 4 times in total
Post 23 Aug 2020, 10:14
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 23 Aug 2020, 10:18
I want to jump to unknown label as @F by macro. As It works fine when label declared later seems I have to numerate them. Actually I just thinking about possibility to change @@ @F to different names. I mean completely rewrite macros for all jump instructions with universal labels. That idea I have after Roman's thread where he cannot use @ symbols. Without "restore" it will be harder, but I see it possible.
For own use it can be new ability like @F2 @F3...@Fn It will shorter result code and jumps quantity. I'll think about it...
Code:
jmp @F2
...
@@:
...
@@: ; destination Smile
    


Last edited by Overclick on 23 Aug 2020, 10:22; edited 2 times in total
Post 23 Aug 2020, 10:18
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1848
Roman 23 Aug 2020, 10:21
Good but some time symbol @@ using macro or code:

Code:
;in this case some part(other) code may jump incorrectly @@ !
macro UnMacro { 
cmp eax,19
jbe @f
mov eax,1
@@:
}
jmp @f
UnMacro
Datas dd 10,20,30
@@:
 mov ecx,10
 loop @b
    


Or i want jump second @@
Code:
jmp @f
Datas dd 10,20,30
@@:
 mov ecx,10
 loop @b
@@:
    


Last edited by Roman on 23 Aug 2020, 10:29; edited 2 times in total
Post 23 Aug 2020, 10:21
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 23 Aug 2020, 10:25
Roman look at previous message )
Post 23 Aug 2020, 10:25
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: 20451
Location: In your JS exploiting you and your system
revolution 23 Aug 2020, 10:28
Post 23 Aug 2020, 10:28
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1848
Roman 23 Aug 2020, 10:30
revolution
Quote:
Deja vu

No ! Smile
People want more good features in Fasm !

Overclick
Quote:
look at previous post

No ! Look at my post Smile


Last edited by Roman on 23 Aug 2020, 10:33; edited 2 times in total
Post 23 Aug 2020, 10:30
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 23 Aug 2020, 10:32
Quote:

Deja vu

Hmm, did you made it then?
Post 23 Aug 2020, 10:32
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 23 Aug 2020, 10:34
I almost done this macro for Romans thread but 'restore' changed my dreams ))
Have to rewrite with calculator of labels...


Last edited by Overclick on 23 Aug 2020, 10:35; edited 1 time in total
Post 23 Aug 2020, 10:34
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1848
Roman 23 Aug 2020, 10:35
Thanks man Smile
Post 23 Aug 2020, 10:35
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 23 Aug 2020, 10:52
Code:
macro New@@ {
   purge @@
   macro @@ \{
      calc=calc+1
      Last#calc=$ \}
   purge jmp
   macro jmp [param] \{
      if `param='@F' 
         dest=calc+1
         jmp Last#dest
      elseif `param='@F2'
         dest=calc+2
         jmp Last#dest
      ...

      else
         jmp param
...    

Just for example
ps. Using match scaring me ))
Post 23 Aug 2020, 10:52
View user's profile Send private message Visit poster's website Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 1228
Location: Belarus
DimonSoft 23 Aug 2020, 11:14
If the there’s another anonymous label between the target one and the jump source, it’s absolutely natural that there’s a perfectly valid meaningful name for at least one of the labels. local allows to reuse the same name in multiple places for macro-generated code by appending a unique sequence of characters. This solution makes code pieces fully movable between parts of a program without the need to fix anything. Why decrease code readability and maintainability in a language that is already hard enough by its nature?
Post 23 Aug 2020, 11:14
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 23 Aug 2020, 11:24
It is just example. Final version can have some difficult name as local actually does. In this case you cannot use local as you don't know what name will be generated next time. Make difficult key-part of the label name by yourself.
Post 23 Aug 2020, 11:24
View user's profile Send private message Visit poster's website Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 1228
Location: Belarus
DimonSoft 24 Aug 2020, 08:50
Easily solvable by storing the information in a symbolic constant and retrieving it later. 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.
Post 24 Aug 2020, 08:50
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1848
Roman 24 Aug 2020, 09:14
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 
    


Last edited by Roman on 24 Aug 2020, 09:34; edited 3 times in total
Post 24 Aug 2020, 09:14
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1848
Roman 24 Aug 2020, 09:26
My proposition create special fasm list of labels !
a b c this is a usual fasm macro.
Its look like this:
Code:
llabels (%1\a 1,2\%2\b 4,%2\%3\c)
    

Its generate this:
Code:
%1:
a 1,2
%2:
b 4,%2
%3:
c
cmp eax,10 ;this i write
jbe %1
    
Post 24 Aug 2020, 09:26
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

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

Website powered by rwasa.