flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 12 Dec 2020, 09:36
At the very least you need something to count which arg you have in the forward loop:
Code: macro vCall cT,[arg] { common arg_index = 0 forward if arg_index = 0 mov rcx,arg else if arg_index = 1 mov rdx,arg else if arg_index = 2 mov r8,arg else if arg_index = 3 mov r9,arg else err "too many args" end if arg_index = arg_index + 1 common Call cT } |
|||
![]() |
|
ProMiNick 12 Dec 2020, 09:53
Code: macro vCall cT,torcx:rcx,tordx:rdx,tor8:r8,tor9:r9,[arg] { forward ; thour original macro does nothing with 5th and later args, so I left only comment here common if ~torcx eq rcx mov rcx,torcx end if if ~tordx eq rdx mov rdx,tordx end if if ~tor8 eq r8 mov r8,tor8 end if if ~tor9 eq r9 mov r9,tor9 end if Call cT} I like to separate stack args from register args because they have different nature. or even so Code: macro invok4 cT,torcx:rcx,tordx:rdx,tor8:r8,tor9:r9 { if torcx eq rcx mov rcx,torcx end if if tordx eq rdx mov rdx,tordx end if if tor8 eq r8 mov r8,tor8 end if if tor9 eq r9 mov r9,tor9 end if Call [cT]} that is then x64 invoke, and less less less (less ...) gready for preprocessor resources(memory & compilation time) in cases of apicalls with 4 and less args. 64bit call is greadyest macro ever written in fasm standart package. |
|||
![]() |
|
Roman 12 Dec 2020, 10:47
Thanks !
|
|||
![]() |
|
DimonSoft 12 Dec 2020, 21:09
I can’t find any notion of the colon-syntax (pun not intended) in the documentation, but it works. Have I missed something about the preprocessor and its treatment of the character?
ProMiNick wrote:
|
|||
![]() |
|
revolution 12 Dec 2020, 22:38
It is a default value if nothing it supplied.
|
|||
![]() |
|
DimonSoft 13 Dec 2020, 12:42
revolution wrote: It is a default value if nothing it supplied. I assumed it could be that but FASM.pdf says it’s = character that is used for default values. I feel I’ve seen a discussion of the feature at the forum some time ago but can’t recall any details. |
|||
![]() |
|
revolution 13 Dec 2020, 12:47
Both work fine:
Code: macro x val=0 { display val+'0' } macro y val:0 { display val+'0' } x x 1 y y 1 ;output: ;0101 ;1 passes, 0 bytes. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.