flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > get last label?

Author
Thread Post new topic Reply to topic
edfed



Joined: 20 Feb 2006
Posts: 4353
Location: Now
edfed 17 Oct 2024, 13:59
get the last label to compose a new label.

for example:


Code:
macro localthing {
local .a
append do1:
             add eax,[var]
             jmp .a
append do2:
             mov eax,2
             jmp do1
append var dd ?
.a:         
             ret
}

stuff:
         localthing
         mov ebx,eax
.local: 
         localthing
 
.verylocal:
         add eax,[.localvar]
         localthing
 

tryit:
       call stuffdo1
       call stuff.localdo2
       mov ecx,[stuff.verylocalvar]
       ret
    


the goal is to create local label implicitlly, then you can compose labels with a syntax automatically
Post 17 Oct 2024, 13:59
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1833
Roman 17 Oct 2024, 20:57
Did fasmw have append ?


Last edited by Roman on 29 Oct 2024, 20:48; edited 1 time in total
Post 17 Oct 2024, 20:57
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4353
Location: Now
edfed 29 Oct 2024, 18:38
fasm don't have append keyword.
you can append equates.
and later use the final equate as a string of stuff added one by one.

but here, the idea have nothing to do with values of labels, but names of labels.

i don't get where in the manual are the stuff related to labels in fasm1.

i don't use fasmg at all because i'm a dinosaur and like fasmw too much to go to fasmg.

then, be able to compose labels inside my code can help to do OO stuff
Post 29 Oct 2024, 18:38
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8357
Location: Kraków, Poland
Tomasz Grysztar 29 Oct 2024, 19:04
edfed wrote:
i don't use fasmg at all because i'm a dinosaur and like fasmw too much to go to fasmg.
If that's the only reason, you really should try out fasmgw that comes with fasm2 release.
Post 29 Oct 2024, 19:04
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1017
Location: Russia
macomics 29 Oct 2024, 19:04
Code:
macro localthing {
local .a
.do1:
             add eax,[.var]
             jmp .a
.do2:
             mov eax,2
             jmp .do1
.var dd ?
.a:         
             ret
}

stuff:
         localthing
         mov ebx,eax
stuff.local: 
         localthing
 
stuff.verylocal:
         add eax,[.localvar]
         localthing
.localvar dd 0
 

tryit:
       call stuff.do1
       call stuff.local.do2
       mov ecx,[stuff.verylocal.var]
       ret
    
Post 29 Oct 2024, 19:04
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.