flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2, 3, 4, 5, 6 ... 9, 10, 11 Next |
Author |
|
Azu
The reason being that HLLs suck, bad.
![]() |
|||
![]() |
|
Azu
f0dder wrote:
f0dder wrote:
|
|||
![]() |
|
revolution
Azu wrote: It's called "cdecl", and it does cause a noticeable gain in executable size. |
|||
![]() |
|
Azu
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. |
|||
![]() |
|
LocoDelAssembly
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. |
|||
![]() |
|
Azu
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.. |
|||
![]() |
|
revolution
Azu wrote: Since it already has this information (from the format string), ... |
|||
![]() |
|
Azu
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 |
|||
![]() |
|
arigity
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 |
|||
![]() |
|
revolution
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).. |
|||
![]() |
|
Azu
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 |
|||
![]() |
|
LocoDelAssembly
Quote:
I've used cdecl in all the examples. |
|||
![]() |
|
Azu
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 |
|||
![]() |
|
LocoDelAssembly
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. |
|||
![]() |
|
revolution
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. |
|||
![]() |
|
Azu
LocoDelAssembly wrote:
|
|||
![]() |
|
Azu
revolution wrote:
P.S. also tell me what to compile it using.. |
|||
![]() |
|
arigity
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. |
|||
![]() |
|
Azu
arigity wrote:
|
|||
![]() |
|
Goto page Previous 1, 2, 3, 4, 5, 6 ... 9, 10, 11 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.