On Fri, Feb 11, 2011 at 10:54 AM, Oliver Schmidt <ol.sc@web.de> wrote: > Hi Gábor, > > >> Assembler funcions with 8-bit return value need to zero the X register > on exit. > > > [...] 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. [...] > > As far as I know it isn't important as long as you i.e. directly > assign the return value to an 8-bit variable. If you however use the > return value in an expression then according to the type promotion > rules all values in the expression are promoted to an 16-bit value. This explains why I sometimes have to put a result into an unsigned char before testing it instead of using it in an expression directly, which sometimes results in a random result that is indecipherable because when you put the result in a temp variable to output it then it's displayed correctly. :) Time to go double-check some assembler functions. -- Payton Byrd <http://www.paytonbyrd.com> <http://it.toolbox.com/blogs/paytonbyrd> ---------------------------------------------------------------------- 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 18:27:33 2011
This archive was generated by hypermail 2.1.8 : 2011-02-11 18:27:37 CET