[cc65] is the following safe, i think not

From: Egan Ford <egan1sense.net>
Date: 2011-11-23 18:53:10
.export         _putchar
.import         popa

ECHO    =       $FFEF           ; print character from A

        jsr     popa
        ORA     $80
        JSR     ECHO

The code works, but when used in a C function, the value passed gets
clobbered, e.g.:

function foo(char bar) {

putchar(blah[bar]);  //works
putchar(blah[bar]); //fails

If do this I can work around the problem:

function foo(char bar) {
char tmp=bar;

putchar(blah[tmp]);  //works
putchar(blah[tmp]); //works too

So I know that my _putchar code is the problem, but what is the fix?

To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Nov 23 18:53:46 2011

This archive was generated by hypermail 2.1.8 : 2011-11-23 18:53:49 CET