flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
wisepenguin
my mistake, i cant use % because there is no repeat.
does anyone know how to achieve what im trying to do without % ? |
|||
![]() |
|
chris
I think all you need is a variable inside this macro which increases with the number of arguments. You can define this variable in the 'common'
block, and inc it in the forward block. Like this one: Code: macro test [arg] { common argn = 0 forward display `arg display argn + '0',' ' argn = argn + 1 } test arg,arg,arg |
|||
![]() |
|
wisepenguin
thanks chris.
i tried your way and it worked. the several ways i tried were obviously wrong ![]() here is the code that works, and sample usage Code: ; ----- ----- ----- ----- ; .function ; declares a function, and parameters is has ; ----- ----- ----- ----- macro .function funcname, [args] { common count = 8 funcname: push ebp mov ebp, esp push ebx push edi push esi forward virtual at ebp+count args dd ? end virtual count = count + 4 } ; sample usage .function my_func, param1, second_param cmp [param1], 12 je .SOME_LABEL ; rest of function etc. .. ; restore stack etc.... thanks again |
|||
![]() |
|
chris
well, I think Tomasz has defined a macro 'proc' with this purpose and as well as a set of fully featured procedure macros(in PROC32.INC). You can look it up in the fasm manual if you don't want to do everything from scratch. And actually the count/argn is better preceeded with 'local', sorry for that. I just switched to fasm a couple of weeks ago, so mistakes are expected
![]() |
|||
![]() |
|
wisepenguin
oh i know about the macros provided, they are good!
i was just doing this as an exercise to try and improve my macro skills. i like fasm ![]() |
|||
![]() |
|
Borsuc
wisepenguin wrote: i like fasm I like Fasm because of it's powerful macro preprocessor and assembler, and also because of it's clear syntax (like you said). ![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.