flat assembler
Message board for the users of flat assembler.
Index
> Windows > Win32 calls. Register usage? Goto page Previous 1, 2, 3, 4, 5, 6 ... 9, 10, 11 Next |
Author |
|
Azu 08 Jun 2009, 08:03
The reason being that HLLs suck, bad.
|
|||
08 Jun 2009, 08:03 |
|
Azu 08 Jun 2009, 12:17
f0dder wrote:
f0dder wrote:
|
|||
08 Jun 2009, 12:17 |
|
revolution 08 Jun 2009, 12:24
Azu wrote: It's called "cdecl", and it does cause a noticeable gain in executable size. |
|||
08 Jun 2009, 12:24 |
|
Azu 08 Jun 2009, 12:30
revolution wrote:
On that note, how about we just remove opcodes like lea and prefixes like repne? They aren't NECCASARY.. sure they help make code a little faster but it does WORK without them so let's just toss them... Who needs cars when you can just walk everywhere? Maybe they are a bit faster, but it's the same result in the end so who cares huh??? The philosophy behind this HLL crap truly makes me sick. And drawing some line at some arbitrary point as to where it ends is just ignoring the problem. |
|||
08 Jun 2009, 12:30 |
|
LocoDelAssembly 08 Jun 2009, 13:52
Quote:
Something you have accepted to be true even though the function is defined differently. BTW, this is also valid: Code: proc printTest cinvoke wsprintf, .fmt ret .fmt db "OldEBP = %X; RetAddr = %X;", 0 endp Code: printTest: push ebp mov ebp, esp push .fmt call wsprintf leave ret .fmt db "OldEBP = %X; RetAddr = %X;", 0 ; Ups, no add esp, 4 was needed. ; Ups number 2, how lucky we are wsprintf isn't stdcall, that would forced us to make a copy first to avoid stack corruption. Not sure if it is supposed to be valid in and HLL or if it is just hacky, but since HLL are crap then I don't care, I know in Assembly is just valid to do what I did above. |
|||
08 Jun 2009, 13:52 |
|
Azu 08 Jun 2009, 14:20
LocoDelAssembly wrote:
Since it already has this information (from the format string), it then follows that there is no need to pass it as another arg... unless there is some really weird limitation in HLLs that I don't know about, it should be able to count the %s and do an add esp at the end, or better yet just pop off the args as it parses the format string like in my example.. |
|||
08 Jun 2009, 14:20 |
|
revolution 08 Jun 2009, 14:24
Azu wrote: Since it already has this information (from the format string), ... |
|||
08 Jun 2009, 14:24 |
|
Azu 08 Jun 2009, 14:28
revolution wrote:
The function knows how many args are passed to it in his example, btw. There are two % so it takes 2 args (not counting first arg).. You can call it wrong all you want, it is extremely simple logic and very easy to see. Do I actually need to explain to you why it is possible for it to count how many % are in the string, even though it obviously does (based on its behavior)? You are being facetious! Last edited by Azu on 08 Jun 2009, 14:32; edited 1 time in total |
|||
08 Jun 2009, 14:28 |
|
arigity 08 Jun 2009, 14:30
i would like to point out that the difference between stdcall and cdecl is exactly 1 byte i size unless the function has more then 30ish arguments. also in some circumstances it can produce smaller exe files for example
push 1 push 2 push 3 call cdeclx push 4 push 4 push 4 call cdecly push 3215321 push 32532 push 211 push fish call cdeclz add esp, 28h ; no need to do it for each function. just do it the end in this case your exe would be 3 bytes smaller than if it had used stdcall |
|||
08 Jun 2009, 14:30 |
|
revolution 08 Jun 2009, 14:30
Azu wrote: The function knows how many args are passed to it in his example, btw. There are two % so it takes 2 args (not counting first arg).. |
|||
08 Jun 2009, 14:30 |
|
Azu 08 Jun 2009, 14:33
revolution wrote:
arigity wrote: i would like to point out that the difference between stdcall and cdecl is exactly 1 byte i size unless the function has more then 30ish arguments. also in some circumstances it can produce smaller exe files for example |
|||
08 Jun 2009, 14:33 |
|
LocoDelAssembly 08 Jun 2009, 14:35
Quote:
I've used cdecl in all the examples. |
|||
08 Jun 2009, 14:35 |
|
Azu 08 Jun 2009, 14:37
LocoDelAssembly wrote:
Code: push ebp
mov ebp, esp
push .fmt
call wsprintf
leave
ret Are you sure? I don't believe this! There is no way they are that smart. Last edited by Azu on 08 Jun 2009, 14:38; edited 1 time in total |
|||
08 Jun 2009, 14:37 |
|
LocoDelAssembly 08 Jun 2009, 14:38
Quote:
Either it will use "add esp, xx" after call or preallocate space on stack (via "sub esp, xx") and later use "mov [esp+xx], argX" for every argument that needs to be passed. |
|||
08 Jun 2009, 14:38 |
|
revolution 08 Jun 2009, 14:39
Azu wrote: What is your point? He isn't using any known calling standard, and there is no way any HLL will make code like that. |
|||
08 Jun 2009, 14:39 |
|
Azu 08 Jun 2009, 14:39
LocoDelAssembly wrote:
|
|||
08 Jun 2009, 14:39 |
|
Azu 08 Jun 2009, 14:40
revolution wrote:
P.S. also tell me what to compile it using.. |
|||
08 Jun 2009, 14:40 |
|
arigity 08 Jun 2009, 14:42
Azu wrote:
yes they do. you cannot ALWAYS do something like this (such as in a loop) but the compiler is usually spot-on when finding places where you can optimize code in this way. |
|||
08 Jun 2009, 14:42 |
|
Azu 08 Jun 2009, 14:43
arigity wrote:
|
|||
08 Jun 2009, 14:43 |
|
Goto page Previous 1, 2, 3, 4, 5, 6 ... 9, 10, 11 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.