flat assembler
Message board for the users of flat assembler.
Index
> Main > varargs with stdcall Goto page Previous 1, 2 |
Author |
|
vid 19 Jan 2007, 06:22
r22: and don't forget i also support MASM, NASM and YASM, maybe more in future. nice !pure assembly usage! is my goal
|
|||
19 Jan 2007, 06:22 |
|
Kain 19 Jan 2007, 06:30
Isn't something like this best done at compile time via macros? I believe all the assemblers mentioned have capable macro processors.
|
|||
19 Jan 2007, 06:30 |
|
vid 19 Jan 2007, 22:17
Kain: i don't want to force users to use macros, which they may be unfamiliar with. I am doing library for assembly language, not for assembly language customized with macros. It's matter of opinion.
|
|||
19 Jan 2007, 22:17 |
|
vid 23 Jan 2007, 23:51
i realized that in this specific case (printf-like), i don't need return value, so i can trash return value in EAX. So epiloque code simplified to something like this:
Code: .r: lea eax, [edx-4] ;eax = pointer to last argument pop edi esi edx ;restore regs pop ebp ;restore ebp pop dword [eax] ;copy return address to place of last argument mov esp, eax ;move stack pointer there retn ;and return problem is just in case of error, in the middle of function, when you don't already know number if arguments. you have to find all non-escaped "%" in format string and skip appropriate number of dwords... but what wouldn't i do for FASMLIB users. EDIT: realized this works only in case without error. when error is returned, EAX is used also, it's pretty hard to return in some error case, i am doing my best, but if you mess up format string too much, then it's same as calling function with wrong number of arguments - unbalanced stack. |
|||
23 Jan 2007, 23:51 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.