Re: [cc65] parameter and assembly precedures

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-02-08 20:09:30


Hi!

On Sat, Feb 08, 2003 at 06:37:06PM +0100, 3843416 wrote:
> i have declared a prototype of the assembly procedure like this:
>
> void __fastcall__ bla (char par1, char par2, char par3);
>
> in the assembly procedure i tried to get the values by accessing the sp.

If the function is declared __fastcall__, the last parameter (par3) is passed
in the primary register (which is just A in case of a char). Apart from this,
the access code is correct.

> the compiler gives me the error
> that he found the unresolved externals incsp3, decsp3.
>
> i linked c64.o with the file. so the linker should find incsp3, decsp3.

The compiler will never give you this error. It is either the assembler or the
linker. If you get the error from the assembler, the necessary import
statements are missing, since the routines are imported from another module:

        .import         incsp3, decsp3

(why do you need decsp3?)

If you get the error message from the linker, the files are not in any of the
libraries you are linking to the executable. Please note that c64.o is NOT a
library, it is the startup file for the c64. You need to link against c64.lib
to get access to the full set of runtime and C library routines (if you look
at the file size, it should be obvious that c64.o cannot contain the complete
library for the C64).

In many cases you can use the cl65 utility, which will try to do the "right
thing" to your sources, and will automatically link against the correct set of
libraries and object files.
  
For lots of examples for C callable assembler routines, you may want to have a
look at the library sources which come in the source package.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-02-08 20:09:47 CET