Next Previous Contents

5. The easy way (using the cl65 utility)

The cl65 utility is able to do all of the steps described above in just one call, and it has defaults for some options that are very well suited for our example.

To compile both files into one executable enter

        cl65 -O -I ../include hello.c text.s

(The -I switch is not needed if you are working under Linux with the include files in the default path, or the CC65_INC environment variable is set correctly).

The cl65 utility knows, how to translate C files into object files (it will call the compiler and then the assembler). It does also know how to create object files from assembler files (it will call the assember for that). It knows how to build an executable (it will pass all object files to the linker). And, finally, it has the C64 as a default target and will supply the correct startup file and runtime library names to the linker, so you don't have to care about that.

The one-liner above should give you a C64 executable named "hello" in the current directory.

For more information about the compile & link utility see cl65.html.


Next Previous Contents