2000-08-01 19:57:01 +00:00
|
|
|
<!doctype linuxdoc system>
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<article>
|
|
|
|
<title>cl65 Users Guide
|
2000-09-03 16:49:38 +00:00
|
|
|
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
|
2001-10-02 19:02:50 +00:00
|
|
|
<date>01.08.2000, 27.11.2000, 02.10.2001
|
2000-09-03 16:49:38 +00:00
|
|
|
|
|
|
|
<abstract>
|
2000-11-29 19:12:20 +00:00
|
|
|
cl65 is the compile & link utility for cc65, the 6502 C compiler. It was
|
2003-02-12 21:03:09 +00:00
|
|
|
designed as a smart frontend for the C compiler (cc65), the assembler (ca65),
|
|
|
|
the object file converter (co65), and the linker (ld65).
|
2000-08-01 19:57:01 +00:00
|
|
|
</abstract>
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<!-- Table of contents -->
|
|
|
|
<toc>
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<!-- Begin the document -->
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<sect>Overview<p>
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2003-02-12 21:03:09 +00:00
|
|
|
cl65 is a frontend for cc65, ca65, co65 and ld65. While you may not use the
|
|
|
|
full power of the tools when calling them through cl65, most features are
|
2000-05-28 13:40:48 +00:00
|
|
|
available, and the use of cl65 is much simpler.
|
|
|
|
|
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<sect>Basic Usage<p>
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2003-02-12 21:03:09 +00:00
|
|
|
The cl65 compile and link utility may be used to convert, compile, assemble
|
|
|
|
and link files. While the separate tools do just one step, cl65 knows how to
|
|
|
|
build object files from C files (by calling the compiler, then the assembler)
|
|
|
|
and other things.
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<tscreen><verb>
|
2000-06-22 12:06:30 +00:00
|
|
|
---------------------------------------------------------------------------
|
2003-02-12 21:03:09 +00:00
|
|
|
Usage: cl65 [options] file [...]
|
2000-06-22 12:06:30 +00:00
|
|
|
Short options:
|
2003-02-12 21:03:09 +00:00
|
|
|
-c Compile and assemble but don't link
|
|
|
|
-d Debug mode
|
|
|
|
-g Add debug info
|
|
|
|
-h Help (this text)
|
|
|
|
-l Create an assembler listing
|
|
|
|
-m name Create a map file
|
|
|
|
-o name Name the output file
|
|
|
|
-r Enable register variables
|
|
|
|
-t sys Set the target system
|
|
|
|
-v Verbose mode
|
|
|
|
-vm Verbose map file
|
|
|
|
-A Strict ANSI mode
|
|
|
|
-C name Use linker config file
|
|
|
|
-Cl Make local variables static
|
|
|
|
-D sym[=defn] Define a preprocessor symbol
|
|
|
|
-I dir Set a compiler include directory path
|
|
|
|
-Ln name Create a VICE label file
|
|
|
|
-O Optimize code
|
|
|
|
-Oi Optimize code, inline functions
|
|
|
|
-Or Optimize code, honour the register keyword
|
|
|
|
-Os Optimize code, inline known C funtions
|
|
|
|
-S Compile but don't assemble and link
|
|
|
|
-T Include source as comment
|
|
|
|
-V Print the version number
|
|
|
|
-W Suppress warnings
|
2000-06-22 12:06:30 +00:00
|
|
|
|
|
|
|
Long options:
|
2003-02-12 21:03:09 +00:00
|
|
|
--add-source Include source as comment
|
|
|
|
--ansi Strict ANSI mode
|
|
|
|
--asm-include-dir dir Set an assembler include directory
|
|
|
|
--bss-label name Define and export a BSS segment label
|
|
|
|
--bss-name seg Set the name of the BSS segment
|
|
|
|
--check-stack Generate stack overflow checks
|
|
|
|
--code-label name Define and export a CODE segment label
|
|
|
|
--code-name seg Set the name of the CODE segment
|
|
|
|
--codesize x Accept larger code by factor x
|
|
|
|
--cpu type Set cpu type
|
|
|
|
--create-dep Create a make dependency file
|
|
|
|
--data-label name Define and export a DATA segment label
|
|
|
|
--data-name seg Set the name of the DATA segment
|
|
|
|
--debug Debug mode
|
|
|
|
--debug-info Add debug info
|
|
|
|
--feature name Set an emulation feature
|
|
|
|
--help Help (this text)
|
|
|
|
--include-dir dir Set a compiler include directory path
|
|
|
|
--listing Create an assembler listing
|
|
|
|
--mapfile name Create a map file
|
|
|
|
--module Link as a module
|
|
|
|
--module-id id Specify a module id for the linker
|
|
|
|
--o65-model model Override the o65 model
|
|
|
|
--register-space b Set space available for register variables
|
|
|
|
--register-vars Enable register variables
|
|
|
|
--rodata-name seg Set the name of the RODATA segment
|
|
|
|
--signed-chars Default characters are signed
|
|
|
|
--start-addr addr Set the default start address
|
|
|
|
--static-locals Make local variables static
|
|
|
|
--target sys Set the target system
|
|
|
|
--version Print the version number
|
|
|
|
--verbose Verbose mode
|
|
|
|
--zeropage-label name Define and export a ZEROPAGE segment label
|
|
|
|
--zeropage-name seg Set the name of the ZEROPAGE segment
|
2000-06-22 12:06:30 +00:00
|
|
|
---------------------------------------------------------------------------
|
2000-08-01 19:57:01 +00:00
|
|
|
</verb></tscreen>
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
Most of the options have the same meaning than the corresponding compiler,
|
2000-06-22 12:06:30 +00:00
|
|
|
assembler or linker option. See the documentation for these tools for an
|
|
|
|
explanation. If an option is available for more than one of the tools, it
|
2000-08-01 19:57:01 +00:00
|
|
|
is set for all tools, where it is available. One example for this is <tt/-v/:
|
|
|
|
The compiler, the assembler and the linker are all called with the <tt/-v/
|
2000-06-22 12:06:30 +00:00
|
|
|
switch.
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
There are a few remaining options that control the behaviour of cl65:
|
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<descrip>
|
|
|
|
|
|
|
|
<tag><tt>-S</tt></tag>
|
2000-06-22 12:06:30 +00:00
|
|
|
|
|
|
|
This option forces cl65 to stop after the assembly step. This means that
|
|
|
|
C files are translated into assembler files, but nothing more is done.
|
|
|
|
Assembler files, object files and libraries given on the command line
|
|
|
|
are ignored.
|
|
|
|
|
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<tag><tt>-c</tt></tag>
|
2000-06-22 12:06:30 +00:00
|
|
|
|
|
|
|
This options forces cl65 to stop after the assembly step. This means
|
|
|
|
that C and assembler files given on the command line are translated into
|
|
|
|
object files, but there is no link step, and object files and libraries
|
|
|
|
given on the command line are ignored.
|
|
|
|
|
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<tag><tt>-o name</tt></tag>
|
2000-06-22 12:06:30 +00:00
|
|
|
|
|
|
|
The -o option is used for the target name in the final step. This causes
|
|
|
|
problems, if the linker will not be called, and there are several input
|
|
|
|
files on the command line. In this case, the name given with -o will be
|
|
|
|
used for all of them, which makes the option pretty useless. You
|
|
|
|
shouldn't use -o when more than one output file is created.
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<tag><tt>-t sys, --target sys</tt></tag>
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2000-08-23 14:22:12 +00:00
|
|
|
The default for this option is different from the compiler and linker in the
|
|
|
|
case that the option is missing: While the other tools (compiler, assembler
|
|
|
|
and linker) will use the "none" system settings by default, cl65 will use
|
|
|
|
the C64 as a target system by default. This was choosen since most people
|
|
|
|
seem to use cc65 to develop for the C64.
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
</descrip>
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<sect>More usage<p>
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
Since cl65 was created to simplify the use of the cc65 development
|
|
|
|
package, it tries to be smart about several things.
|
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<itemize>
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<item> If you don't give a target system on the command line, cl65
|
|
|
|
defaults to the C64.
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<item> When linking, cl65 will supply the names of the startup file and
|
|
|
|
library for the target system to the linker, so you don't have to do
|
|
|
|
that.
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<item> If the final step is the linker, and the name of the output file was
|
|
|
|
not explicitly given, cl65 will use the name of the first input file
|
|
|
|
without the extension, provided that the name of this file has an
|
|
|
|
extension. So you don't need to name the executable name in most
|
|
|
|
cases, just give the name of your "main" file as first input file.
|
|
|
|
</itemize>
|
2003-02-12 21:03:09 +00:00
|
|
|
|
|
|
|
The type of an input file is derived from its extension:
|
|
|
|
|
|
|
|
<itemize>
|
|
|
|
<item>C files: <tt/.c/
|
|
|
|
<item>Assembler files: <tt/.s/, <tt/.asm/, <tt/.a65/
|
|
|
|
<item>Object files: <tt/.o/ <tt/.obj/
|
|
|
|
<item>Libraries: <tt/.a/, <tt/.lib/
|
|
|
|
<item>GEOS resource files: <tt/.grc/
|
|
|
|
<item>o65 files: <tt/.o65/, <tt/.emd/, <tt/.joy/, <tt/.tgi/
|
|
|
|
</itemize>
|
|
|
|
|
|
|
|
Please note that the program cannot handle input files with unknown file
|
|
|
|
extensions.
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<sect>Examples<p>
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
The morse trainer software, which consists of one C file (morse.c) and one
|
|
|
|
assembler file (irq.s) will need the following separate steps to compile
|
|
|
|
into an executable named morse:
|
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<tscreen><verb>
|
2000-05-28 13:40:48 +00:00
|
|
|
cc65 -g -Oi -t c64 morse.c
|
|
|
|
ca65 -g morse.s
|
|
|
|
ca65 -g irq.s
|
|
|
|
ld65 -t c64 -o morse c64.o morse.o irq.o c64.lib
|
2000-08-01 19:57:01 +00:00
|
|
|
</verb></tscreen>
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
When using cl65, this is simplified to
|
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<tscreen><verb>
|
2000-05-28 13:40:48 +00:00
|
|
|
cl65 -g -Oi morse.c irq.s
|
2000-08-01 19:57:01 +00:00
|
|
|
</verb></tscreen>
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
As a general rule, you may use cl65 instead of cc65 at most times,
|
|
|
|
especially in makefiles to build object files directly from C files. Use
|
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<tscreen><verb>
|
2000-05-28 13:40:48 +00:00
|
|
|
.c.o:
|
2000-06-22 12:06:30 +00:00
|
|
|
cl65 -g -Oi $<
|
2000-08-01 19:57:01 +00:00
|
|
|
</verb></tscreen>
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
to do this.
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<sect>Bugs/Feedback<p>
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
If you have problems using the utility, if you find any bugs, or if you're
|
2000-08-01 19:57:01 +00:00
|
|
|
doing something interesting with it, I would be glad to hear from you. Feel
|
2000-08-02 07:41:56 +00:00
|
|
|
free to contact me by email (<htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">).
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<sect>Copyright<p>
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
cl65 (and all cc65 binutils) are (C) Copyright 1998-2000 Ullrich von
|
|
|
|
Bassewitz. For usage of the binaries and/or sources the following
|
|
|
|
conditions do apply:
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
This software is provided 'as-is', without any expressed or implied
|
|
|
|
warranty. In no event will the authors be held liable for any damages
|
|
|
|
arising from the use of this software.
|
|
|
|
|
|
|
|
Permission is granted to anyone to use this software for any purpose,
|
|
|
|
including commercial applications, and to alter it and redistribute it
|
|
|
|
freely, subject to the following restrictions:
|
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
<enum>
|
|
|
|
<item> The origin of this software must not be misrepresented; you must not
|
|
|
|
claim that you wrote the original software. If you use this software
|
|
|
|
in a product, an acknowledgment in the product documentation would be
|
|
|
|
appreciated but is not required.
|
|
|
|
<item> Altered source versions must be plainly marked as such, and must not
|
|
|
|
be misrepresented as being the original software.
|
|
|
|
<item> This notice may not be removed or altered from any source
|
|
|
|
distribution.
|
|
|
|
</enum>
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
2000-08-01 19:57:01 +00:00
|
|
|
</article>
|
2000-05-28 13:40:48 +00:00
|
|
|
|