Re: [cc65] How to prototype an assembler function?

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2010-04-25 10:00:34
On Sat, Apr 24, 2010 at 07:10:58PM -0500, Payton Byrd wrote:
> I've read the CA65 docs and cannot find an example of this.  What I want to
> do is call the following assembler functions from C code.  So I've written
> this code as PlatformSpecific.s and it compiles fine:
[...]

Please try the following: Write separate C module with a small C function that
matches the requirements. Be sure to use the parameters, so the compiler
generates access code for them. Example:

        static char r, v;

        void WriteVDC (unsigned char reg, unsigned char val)
        {
            /* Use the parameters */
            r = reg;
            v = val;
        }

Then compile the source using "-g -T" on the command line. Have a look at the
resulting code. This will show you, how the values are passed and used.

As an alternative, have a look at the assembler functions in the sources of
the library. For example the ones you have already used, like textcolor(),
_sys() or cputs(). There's a lot of valuable information in there.

With this information, you can change your VDC access functions so they're C
callable.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Apr 25 10:00:42 2010

This archive was generated by hypermail 2.1.8 : 2010-04-25 10:00:45 CEST