flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
JohnFound 10 Feb 2005, 04:17
Actually it is approximately the same.
When using macroses "stdcall" and "invoke" we have more "compact" source code that is generally more readable. But sometimes using separate push instructions gives us more flexibility and better code. For example, let say we save some register in the stack in order to preserve it for future call of API function: Code: invoke GetDlgItem, [.hwnd], 100 push eax ; preserve eax for the second call of API invoke SomeAPI, eax pop eax invoke OtherAPI, eax The last two rows will generate following pretty bad code: Code: pop eax push eax call [OtherAPI] In similar cases (especially when there are more arguments to the functions) I am using: Code: invoke OtherFunction, arg1, arg2 ;, agument is in the stack Note that good comments are simply mandatory in such using. The main requirement for optimal using of "invoke" type macroses is good understanding what actually happens behind the macro... Regards |
|||
![]() |
|
Razneb 10 Feb 2005, 04:27
So, lets say I am using 'CreateFont'. It would be a complete waste of line space if I manually pushed the 14 arguments?
Thanks for your reply. Razneb- |
|||
![]() |
|
f0dder 10 Feb 2005, 12:44
yes, a waste of line space since there's no runtime advantage. Of course one could argue that if you manually push arguments you can add a comment on what each argument is, but... that's overkill, IMHO.
|
|||
![]() |
|
vid 10 Feb 2005, 13:24
i prefer manual pushing if arguments need comments. And no one is such fool to remember meaning of 14 arguments, so it improves readability of code. Of course not with well known APIs.
|
|||
![]() |
|
r22 11 Feb 2005, 06:06
I use manual pushing and call instead of invoke, mostly because I have a bad habit of using hex instead of constant names so i have to shorthand comment them.
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.