1 <!doctype linuxdoc system>
4 <title>cl65 Users Guide
5 <author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
6 <date>01.08.2000, 27.11.2000, 02.10.2001
9 cl65 is the compile & link utility for cc65, the 6502 C compiler. It was
10 designed as a smart frontend for the C compiler (cc65), the assembler (ca65)
11 and the linker (ld65).
14 <!-- Table of contents -->
17 <!-- Begin the document -->
21 cl65 is a frontend for cc65, ca65 and ld65. While you may not use the full
22 power of the tools when calling them through cl65, most features are
23 available, and the use of cl65 is much simpler.
28 The cl65 compile and link utility may be used to compile, assemble and
29 link files. While the separate tools do just one step, cl65 knows how to
30 build object files from C files (by calling the compiler, then the
31 assembler) and other things.
34 ---------------------------------------------------------------------------
35 Usage: cl65 [options] file
37 -c Compiler and assemble but don't link
41 -l Create an assembler listing
42 -m name Create a map file
43 -o name Name the output file
44 -t sys Set the target system
48 -C name Use linker config file
49 -Cl Make local variables static
50 -D sym[=defn] Define a preprocessor symbol
51 -I dir Set a compiler include directory path
52 -Ln name Create a VICE label file
54 -Oi Optimize code, inline functions
55 -Or Optimize code, honour the register keyword
56 -Os Optimize code, inline known C funtions
57 -S Compile but don't assemble and link
58 -T Include source as comment
59 -V Print the version number
63 --add-source Include source as comment
64 --ansi Strict ANSI mode
65 --asm-include-dir dir Set an assembler include directory
66 --bss-name seg Set the name of the BSS segment
67 --check-stack Generate stack overflow checks
68 --code-name seg Set the name of the CODE segment
69 --codesize x Accept larger code by factor x
70 --cpu type Set cpu type
71 --create-dep Create a make dependency file
72 --data-name seg Set the name of the DATA segment
74 --debug-info Add debug info
75 --feature name Set an emulation feature
76 --help Help (this text)
77 --include-dir dir Set a compiler include directory path
78 --listing Create an assembler listing
79 --mapfile name Create a map file
80 --rodata-name seg Set the name of the RODATA segment
81 --signed-chars Default characters are signed
82 --start-addr addr Set the default start address
83 --static-locals Make local variables static
84 --target sys Set the target system
85 --version Print the version number
86 --verbose Verbose mode
87 ---------------------------------------------------------------------------
90 Most of the options have the same meaning than the corresponding compiler,
91 assembler or linker option. See the documentation for these tools for an
92 explanation. If an option is available for more than one of the tools, it
93 is set for all tools, where it is available. One example for this is <tt/-v/:
94 The compiler, the assembler and the linker are all called with the <tt/-v/
97 There are a few remaining options that control the behaviour of cl65:
101 <tag><tt>-S</tt></tag>
103 This option forces cl65 to stop after the assembly step. This means that
104 C files are translated into assembler files, but nothing more is done.
105 Assembler files, object files and libraries given on the command line
109 <tag><tt>-c</tt></tag>
111 This options forces cl65 to stop after the assembly step. This means
112 that C and assembler files given on the command line are translated into
113 object files, but there is no link step, and object files and libraries
114 given on the command line are ignored.
117 <tag><tt>-o name</tt></tag>
119 The -o option is used for the target name in the final step. This causes
120 problems, if the linker will not be called, and there are several input
121 files on the command line. In this case, the name given with -o will be
122 used for all of them, which makes the option pretty useless. You
123 shouldn't use -o when more than one output file is created.
126 <tag><tt>-t sys, --target sys</tt></tag>
128 The default for this option is different from the compiler and linker in the
129 case that the option is missing: While the other tools (compiler, assembler
130 and linker) will use the "none" system settings by default, cl65 will use
131 the C64 as a target system by default. This was choosen since most people
132 seem to use cc65 to develop for the C64.
140 Since cl65 was created to simplify the use of the cc65 development
141 package, it tries to be smart about several things.
145 <item> If you don't give a target system on the command line, cl65
148 <item> When linking, cl65 will supply the names of the startup file and
149 library for the target system to the linker, so you don't have to do
152 <item> If the final step is the linker, and the name of the output file was
153 not explicitly given, cl65 will use the name of the first input file
154 without the extension, provided that the name of this file has an
155 extension. So you don't need to name the executable name in most
156 cases, just give the name of your "main" file as first input file.
162 The morse trainer software, which consists of one C file (morse.c) and one
163 assembler file (irq.s) will need the following separate steps to compile
164 into an executable named morse:
167 cc65 -g -Oi -t c64 morse.c
170 ld65 -t c64 -o morse c64.o morse.o irq.o c64.lib
173 When using cl65, this is simplified to
176 cl65 -g -Oi morse.c irq.s
179 As a general rule, you may use cl65 instead of cc65 at most times,
180 especially in makefiles to build object files directly from C files. Use
191 <sect>Bugs/Feedback<p>
193 If you have problems using the utility, if you find any bugs, or if you're
194 doing something interesting with it, I would be glad to hear from you. Feel
195 free to contact me by email (<htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">).
201 cl65 (and all cc65 binutils) are (C) Copyright 1998-2000 Ullrich von
202 Bassewitz. For usage of the binaries and/or sources the following
205 This software is provided 'as-is', without any expressed or implied
206 warranty. In no event will the authors be held liable for any damages
207 arising from the use of this software.
209 Permission is granted to anyone to use this software for any purpose,
210 including commercial applications, and to alter it and redistribute it
211 freely, subject to the following restrictions:
214 <item> The origin of this software must not be misrepresented; you must not
215 claim that you wrote the original software. If you use this software
216 in a product, an acknowledgment in the product documentation would be
217 appreciated but is not required.
218 <item> Altered source versions must be plainly marked as such, and must not
219 be misrepresented as being the original software.
220 <item> This notice may not be removed or altered from any source