Re: [cc65] cc65 calling conventions

From: Sidney Cadot <sidney1jigsaw.nl>
Date: 2004-09-02 14:36:44
Hi Per,

> SC> Is there documentation regarding the calling conventions used by
> SC> CC65? I need to mix C and assembly and I like to play by the
> SC> rules.
>
> Since Uz is out of town:
>
>   Arguments are pushed on the stack in left to right order. If you're
>   using __fastcall__ the last argument is instead put in A (lo) and X
>   (hi). You can access args with lda (sp),y. When returning, you must
>   have pulled everything off (jsr incspX, where X is the number of
>   bytes you want to increase the pointer with), and pushed your return
>   value. If you're using __fastcall__ the return value is instead
>   returned in A/X, as above.

Ok, thanks for the rundown. Does this mean that I am free to alter the 
A,X,Y, and P registers within the subroutine (unless I return a value 
in A/X of course)? Also, with __fastcall__, if the the value is a 
1-byte type, is X undefined at entry (and don't-care, at exit)?

Best regards,

   Sidney

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Sep 2 14:36:30 2004

This archive was generated by hypermail 2.1.8 : 2004-09-02 14:36:39 CEST