flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > macro list size,?

Author
Thread Post new topic Reply to topic
edfed



Joined: 20 Feb 2006
Posts: 4353
Location: Now
edfed 08 Nov 2009, 23:49
i don't see how can be made macros or structs with a transparent 'size_of_struct' inside.
a macro like this:
Code:
list1: list,element1,element2,element3
or 
list1   list (elem1,elem2,elem3)  
;size_of_strust will be calculated and puted inside transparentlly
    

that will create this code:

Code:
list1:
dd list      ;list is the function id
dd @f-$-4 ;size of the table in bytes.
dd element1
dd element2
dd element3
@@:
    


thanks for help Smile
Post 08 Nov 2009, 23:49
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: 20430
Location: In your JS exploiting you and your system
revolution 09 Nov 2009, 01:27
Code:
macro edfeds_list lable,[element] {
 common
  local .a
  dd lable
  dd .a-$-4
 forward
  dd element
 common
  .a:
}

list1: edfeds_list list,element1,element2,element3    
Post 09 Nov 2009, 01:27
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4353
Location: Now
edfed 09 Nov 2009, 13:18
super! genial, awesome, merci thanks.
i didn't know it was so easy.
and if i want it on many lines, can i use the / or \ operator?

line1: list,elem1,elem2/
elem3,elem4
edit:
note it's a bit better now:
Code:
macro Gnode x,y,xl,yl,[element] {
 common
  local .a
  dd f.gnode
  dd x,y,xl,yl
  dd .a-$-4
 forward
  dd element
 common
  .a:
}
bureau: Gnode 0,0,320,200,exitor,browser,chronos,clock,calendar
    

but it needs a multiline possibility.
Post 09 Nov 2009, 13:18
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: 20430
Location: In your JS exploiting you and your system
revolution 09 Nov 2009, 13:44
Use backslash for multi line:
Code:
line1: list,elem1,elem2,\
    elem3,elem4    
Post 09 Nov 2009, 13:44
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4353
Location: Now
edfed 09 Nov 2009, 14:55
thanks!

i tryed but without the comma, that's why it didn't work!

now it looks like this,
Code:
bureau: Gnode 0,0,320,200,\
        exitor,\
        browser,\
        chronos,\
        clock,\
        calendar,\
        .box  
.box: Box 0,0,320,200,Silver     
    

i prefer than old style, it is a bit cleaner.

Code:
bureau dd f.gnode, 0,0,320,200,@f-$-4
dd exitor
dd browser
dd chronos
dd clock
dd calendar
dd .box
@@:
.box dd f.box,0,0,320,200,Silver
    


and what can i do to ignore optional parenthesis inside the macro?

line: Box (0,0,320,200,Silver)
Post 09 Nov 2009, 14:55
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: 20430
Location: In your JS exploiting you and your system
revolution 09 Nov 2009, 16:24
edfed wrote:
and what can i do to ignore optional parenthesis inside the macro?

line: Box (0,0,320,200,Silver)
Does your editor have a search&replace function? Wink
Post 09 Nov 2009, 16:24
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4353
Location: Now
edfed 09 Nov 2009, 18:06
of course, it is fasmw. Wink Laughing

but it is not to replace '(' & ')' by ' ', but to permit useage of () for readability.
Post 09 Nov 2009, 18:06
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: 20430
Location: In your JS exploiting you and your system
revolution 10 Nov 2009, 00:01
You could try using a meta-macro to strip the brackets.
Code:
macro bracket_stripper [args] {
  common
  local params
  params equ args
  match =(nonce=),args \{params equ nonce\}
  edfeds_list params
}    
Or, if you are feeling brave, then incorporate it into the main macro code.
Post 10 Nov 2009, 00:01
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.