flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
wisepenguin 23 Jan 2006, 07:53
my mistake, i cant use % because there is no repeat.
does anyone know how to achieve what im trying to do without % ? |
|||
![]() |
|
chris 24 Jan 2006, 03:22
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 24 Jan 2006, 03:44
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 24 Jan 2006, 04:43
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 24 Jan 2006, 07:27
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 25 Jan 2006, 19:01
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-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.