Hello
For StarCore there is a ABI defining how parameters should be passed to a function.
Please look at {Install}\Help\PDF\MNSC100ABI.pdf chapter "1.6 Function Calling Sequence".
Around allocating space for local variable, you need to reserve some space on the stack.
I would recommend you to check "Keep .sl File" check box in the Compiler panel and to look at how the compiler is managing the local variables.
Alternatively you can write your function in inline assembly. Please refer to {Install}\Help\PDF\StarCore_C_Compiler_User_Guide.pdf chapter "Mixing C, Assembly Code".
I hope this helps.
CrasyCat