Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

About call convention

Started by felipe, April 13, 2018, 04:34:54 AM

Previous topic - Next topic



The reason why you write in assembler, you are not at the mercy of compiler assumptions.  :P


Another article from another guy who doesn't see the light at the end of the tunnel but feels comfortable enough to criticize whatever he does not understand.
"Even the inline function calls (the DirectXMath library) have an undocumented parameter ... sometimes. It all depends on the function. Typically (but not always), functions returning an XMMATRIX structure require a pointer to the output matrix destination in RCX when the call is made"
I have converted the whole DirectXMath library to ASM and did not notice any  undocumented parameter, it is fully documented what RCX must contain. And of course if a function is inlined it is not function on the ASM code. What a mess.

From MSDN documentation, about returning custom data types over 8 bytes, including structures:
" the caller assumes the responsibility of allocating memory and passing a pointer for the return value as the first argument. Subsequent arguments are then shifted one argument to the right. The same pointer must be returned by the callee in RAX"