Re: [cc65] assembler/C stack issue

From: Gábor Lénárt <lgb1lgb.hu>
Date: 2011-02-11 17:34:47
Hi,

On Fri, Feb 04, 2011 at 05:30:39PM +0100, Oliver Schmidt wrote:
> > What other stack
> > issues do I have to watch out for?  Examples of needed function declarations
> > follow:
> >
> > unsigned char __fastcall__ foo1 (char*);
> 
> Assembler funcions with 8-bit return value need to zero the X register on exit.

Hmm, that's interesting, I have some old sources, where I forgot about
zeroing X, but still it seems to work. Now I am not sure it's because X is
zero anyway, but it's interesting: if I have - let's say - $20 in X and in A
too on exit, what the "C code will think", return value is $2020? It's quite
strange, since the return value of the prototype is "char", so for unsigned
it cannot be more than $FF. Maybe it's time for fix my old sources, just in
case anyway :)
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Feb 11 17:34:59 2011

This archive was generated by hypermail 2.1.8 : 2011-02-11 17:35:02 CET