Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How can I reference C parameters from assembly language?

0
Posted

How can I reference C parameters from assembly language?

0

The details of accessing parameters differs from one CPU to the next, but usually they are accessed by constant offsets from the stack pointer. Please refer to the section entitled “Assembly Language Interface” in the Micro-C Technical Manual. For examples of accessing parameters in assembly language functions which are written entirely in assembly language (ie: a .ASM source file), please refer to the Micro-C library source code. There are many examples there of assembly language functions accepting various parameters. For examples of accessing parameters from inline assembly language portions of functions written in ‘C’ (including functions which are entirely inline assembly language with only the ‘C’ function “wrapper”), it is best to see how the compiler accesses the parameters. To do so, compile a small function which has the parameters you wish to use in the inline assembly function, and simple reference each parameter once in the main body: myfunc(int p1, char p2, char *p2, unsi

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123