How can I reference C parameters from assembly language?
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