flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Stop macro and continue.

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1847
Roman 19 Mar 2023, 07:14
Fasmw 1.73
How do this?
Code:
Macro ee {} 
ee Tom, 1,2,3,\\ ;mean stop macro ee
  db  'Tom address',0,\ 
  db 10 dup(5,3),\\ ;mean continue macro ee
   5,4,1

    

Or only way is using two macros ee and ee2?
Code:
ee Tom, 1,2,3
   db  'Tom address',0
   db 10 dup(5,3)
ee2  5,4,1
    


Last edited by Roman on 21 Mar 2023, 10:13; edited 2 times in total
Post 19 Mar 2023, 07:14
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 21 Mar 2023, 06:09
It is not clear what exactly you want.
If you want to insert some string into middle of macro-body then you can do it by a lot of different ways:
equ, macro, .stream(multisection)
Post 21 Mar 2023, 06:09
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1847
Roman 21 Mar 2023, 10:14
Not only string.
Any asm commands or any macros.
Post 21 Mar 2023, 10:14
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 21 Mar 2023, 20:58
Quote:

Any asm commands or any macros.

So why not?
Code:
macro ee ...
{   ...
     inject
     ...   }

.data
...
macro inject
{   db  'Tom address',0
     db 10 dup(5,3)   }
ee ...

         

Code:
macro ee ...
{   ...
     inject1
     inject2
     inject3
     inject4
     inject5
     ...   }
     inject1 equ
     inject2 equ
     inject3 equ
     inject4 equ
     inject5 equ

.data
...
inject1 equ db  'Tom address',0
inject2 equ db 10 dup(5,3)
ee ...
    

.stream solution is better when you need to combine peaces into the block from different parts of project
Code:
macro ee ...
{   ...
     .stream Inject
     ...   }
.data
  ...
.frame Inject
   db  'Tom address',0
   db 10 dup(5,3)
.data
   ee ...
    
Post 21 Mar 2023, 20:58
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1847
Roman 22 Mar 2023, 02:23
Quote:

macro inject
{ db 'Tom address',0
db 10 dup(5,3) }


For any other case I needed write another inject macro.
Not handful.
Easy have macro ee and ee_
Post 22 Mar 2023, 02:23
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 24 Mar 2023, 14:57
Redefine "continue" then
Code:
macro ee
{
   msg  db 'One '

    purge continue
    macro continue
    \{  db 'Three '  \}
}

ee
        db 'Two '
continue
        db 'Four',0
    
Post 24 Mar 2023, 14:57
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1847
Roman 25 Mar 2023, 06:59
Any macro must redefined continue.
Post 25 Mar 2023, 06:59
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 25 Mar 2023, 07:16
Yes. That means universal directive for your purpose to continue the job ee-like macros begins. Exactly the solution you asked at first post
Post 25 Mar 2023, 07:16
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1040
Location: Russia
macomics 25 Mar 2023, 07:17
That's better
Code:
macro continue { }
macro ee
{   msg  db 'One '
    macro continue
    \{  db 'Three '
    \purge continue \}
}

continue
ee
        db 'Two '
continue
        db 'Four',0
continue
continue
continue
; 'One Two Three Four', 0    
You can continue this way only once, even if you call continue 10 times
Post 25 Mar 2023, 07:17
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.