Am 06.05.21 um 11:11 schrieb Павел Бельтюков:
> Hi, everybody!
> 
> Although SDCC manual contains some information about stm8 options
> it has no information on working register set and procedure calling
> convention.
> 
> Can anyone explain: what registers are used and for what purpose?
> 
> What are function call prologues and epilogues like?
> 
> What about interrupt ?
> 
> How parameters and return values are placed in registers/stack?
> 
> What is the difference between medium and large memory models with
> regard to previous questions?
> 
> Best regards,
> Paul Beltyukov

Current situation:

* All parameters are passed on the stack.
* The parameters on the stack are cleaned up by the caller (unless the
callee is declared __z88dk_callee, in which case they are cleared up by
the callee).
* 8-Bit return values are passed in register a.
* 16-Bit return values are passed in register x.
* 24-Bit return values are passed in registers yl:x.
* 32-Bit return values are passed in registers y:x.
* For return values bigger than 32 bits, the caller passes an additional
hidden parameter containing a pointer, the callee then writes the return
value where that pointer points to.
* For functions that needs access to more than 255 B of stack space, y
is used as frame pointer.
* Within the function, registers a, x and y (if not used as frame
pointer) are used whichever way the register allocator decides.
* Funktions declared __naked have no prologue or epilogue.
* Functions declared __critical have sim / rim in prologue / epilogeu.
* Function prologue consists of setting up the frame pointer, if necessary.
* Functions usually return by ret (medium model) or retf (large model).
Exceptions apply for some functions using __z88dk_callee.
* Interrupt routines are handled like other functions (but if sdcc
considers it necessary, the function prologue will contain additional
code to work around hardware bug). They return by iret.

Philipp


_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to