flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > submacro problem

Author
Thread Post new topic Reply to topic
Lion17



Joined: 30 May 2006
Posts: 5
Lion17
if I write code:
Code:
struc S1 {
.W1 Dw ?
.W2 Dw ?
} 

V1 S1
    


I got:
Code:
V1.W1 Dw ?
V1.W2 Dw ?
    


But if I write next:
Code:
macro M1 {
.W2 Dw ?
}

struc S1 {
.W1 Dw ?
M1
} 

V1 S1
    


I produce these:
Code:
.W1 Dw ?
.W1.W2 Dw ?
    


Why? Confused
And how I can make first code using macro for structure members?
Post 30 May 2006, 05:48
View user's profile Send private message ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7802
Location: Kraków, Poland
Tomasz Grysztar
STRUC is just another kind of macro and "M1" here is among the lines emitted by that macro, which are later processed independently. If you need a macro for a structure members, you can do it like:
Code:
struc M1 {
times 0 . ; Put . in some way here to prevent redefining of main label
.W2 Dw ?
}

struc S1 {
.:
.W1 Dw ?
. M1
} 

V1 S1    

which does the same thing as:
Code:
macro M1 name {
name#.W2 Dw ?
}

struc S1 {
.:
.W1 Dw ?
M1 .
} 

V1 S1    

Look also here: http://board.flatassembler.net/topic.php?p=39105#39105
for some more details on STRUC tricks.
Post 30 May 2006, 08:42
View user's profile Send private message Visit poster's website 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.