Wouldn't it be better to use general registers r2..r7 for parameter passing?
The use of dptr/b/a for passing the first parameter seems a bad choice to me, because these registers are used mostly for other purposes in the called functions and therefore will be copied to
general registers or to the stack in the entry code of the function.
For example, the C function
int AddInt(int a, int b)
leads to the following assembler code (with --stack-auto)
Assumed that all 4 parameter bytes were passed in registers the code would look sth. like:
(Also assumed that the return value is in R2/R3)
This concept would also lead to tighter code in the calling function.
Log in to post a comment.