flat assembler
Message board for the users of flat assembler.
Index
> Windows > do i need to adjust the stack here? |
Author |
|
revolution 06 Nov 2010, 00:42
Well you didn't show all the code so I have to assume you are using c-call functions, right? If so, then all your stack adjustments look fine to me.
And to get a pointer to a function simply: Code: mov eax,some_label |
|||
06 Nov 2010, 00:42 |
|
ishkabible 06 Nov 2010, 03:46
no i don't mean the the function calls in this function but would i have to adjust the stack after calling the function i showed you. i did however figure out that i do need to do that. i was pretty sure that it would leave the arguments on the stack so i checked it by calling printf without passing the argument and it printed the values i had just previously passed. thanks anyway however i have a confident understanding of functions now.
|
|||
06 Nov 2010, 03:46 |
|
ishkabible 06 Nov 2010, 03:53
i do have a question about cdecl calling convection however, i would like everything to follow one single convention but i'm not sure what specifically the cdecl calling convention intells. i looked on Wikipedia but only found conventions dword and floating point. what if the return type is larger than 4 bytes? what then? i always assumed that the best way to get the return value would just be to pop the value to where you want to return it.
|
|||
06 Nov 2010, 03:53 |
|
revolution 06 Nov 2010, 03:59
The difference between them:
stdcall: callee pops arguments off the stack (eg. ret 4) ccall: caller pops arguments off the stack (eg. ret) Other than that everything else is the same. |
|||
06 Nov 2010, 03:59 |
|
revolution 06 Nov 2010, 04:03
ishkabible wrote: no i don't mean the the function calls in this function but would i have to adjust the stack after calling the function i showed you. |
|||
06 Nov 2010, 04:03 |
|
baldr 06 Nov 2010, 09:22
ishkabible,
Agner Fog compiled various sources in one document about calling conventions, you may find it useful (along with optimization manuals there ). |
|||
06 Nov 2010, 09:22 |
|
ishkabible 07 Nov 2010, 01:46
i have a question now again when the function returns ebp is set to a place in the stack that it is not supposed to be, do i need to use another register to store the previous value of ebp and move it back at the end of the function or is there a better way to handle this?
|
|||
07 Nov 2010, 01:46 |
|
revolution 07 Nov 2010, 02:20
Push ebp onto the stack. Use the stack Luke.
|
|||
07 Nov 2010, 02:20 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.