flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > [FASM1] generating parameters for `struc` within a macro

Author
Thread Post new topic Reply to topic
nicebyte



Joined: 03 Jun 2022
Posts: 2
nicebyte
I would like to write a macro that generates a `struc`. The actual macro is larger and more complex, but the "problem area" boils down to the following:

Code:
macro define_a_struc name, [params] {
common
  struc name

forward
  params,  ; I am getting an error "unexpected characters" here when I try to use the macro.

common
  \{

forward
  dd params

common
  \}
}
    


As you can see in the code above I am trying to generate a list of parameters for `struc` from the macro arguments. Initially I thought the trailing comma was the problem, but even removing it and limiting to just one single parameter still results in a compile error. Clearly there's something I'm missing here. Any ideas what could be wrong?
Post 03 Jun 2022, 07:01
View user's profile Send private message Visit poster's website Reply with quote
nicebyte



Joined: 03 Jun 2022
Posts: 2
nicebyte
I should have mentioned that simply doing

Code:
...
common
struc name params \{
...
    


doesn't work for what i'm trying to do. i need to do some additional stuff to each param within that `forward` block.
Post 03 Jun 2022, 07:28
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 652
Location: Russia
macomics
Code:
macro define_a_struc name* { struc name \{
  match title par,name \\{ irp arg, par \\\{ dd arg \\\} \\}
 \} }

define_a_struc  <test2 abc, def, ghi, jkl>
label2          test2  123, 456, 789,  0

; $ fasm -m 1024 testmacro.asm
; flat assembler  version 1.73.30  (1024 kilobytes memory)
; 1 passes, 16 bytes.    
Post 03 Jun 2022, 08:01
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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.