Quote:
Can you point me to documentation about correct register saving/restoring procedures.
|
On the Amiga the called function saves all modified registers but not d0/d1/a0/a1/fp0/fp1.
Quote:
And to documentation explaining all the syntax for things like exposing and sharing variables and functions between assembler and C/C++.
|
the doc for inline assembly is there
https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html
Code:
movem.l %%a5,(%%sp)
should be
Code:
movem.l %%a5,-(%%sp)
depending on the used compiler you could also write in C:
Code:
extern int Routine(register short a ASM("d0"), register int b ASM("d1"), register short c ASM("d2"));
otherwise you might use macros to move the asm out of your C code...
... have a look into inline/macros.h to get inspiration.
and simply call that function. Note that the asm function needs an additional leading underscore if you use the C prototype with asm registers.
Code:
.global _Routine
_Routine:
movem.l d2/whatever,-(sp)
...
move.l ...,d0
movem.l (sp)+,d2/whatever