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 command line, 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 hello.c text.s

The cl65 utility knows how to translate C files into object files (it will call the compiler, and then the assembler). It does know also how to create object files from assembly files (it will call only the assembler, 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