51 lines
1.9 KiB
HTML
51 lines
1.9 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||
|
<HTML>
|
||
|
<HEAD>
|
||
|
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||
|
<TITLE>cc65 Compiler Intro: The compiler</TITLE>
|
||
|
<LINK HREF="intro-3.html" REL=next>
|
||
|
<LINK HREF="intro-1.html" REL=previous>
|
||
|
<LINK HREF="intro.html#toc2" REL=contents>
|
||
|
</HEAD>
|
||
|
<BODY>
|
||
|
<A HREF="intro-3.html">Next</A>
|
||
|
<A HREF="intro-1.html">Previous</A>
|
||
|
<A HREF="intro.html#toc2">Contents</A>
|
||
|
<HR>
|
||
|
<H2><A NAME="s2">2.</A> <A HREF="intro.html#toc2">The compiler</A></H2>
|
||
|
|
||
|
|
||
|
<P>The compiler translates one C source into one assembly source, for each
|
||
|
invocation. It does <EM>not</EM> create object files directly, and it is <EM>not</EM>
|
||
|
able to translate more than one file per run.</P>
|
||
|
<P>In the example above, we would use the following command line, to translate
|
||
|
<CODE>hello.c</CODE> into <CODE>hello.s</CODE>:</P>
|
||
|
<P>
|
||
|
<BLOCKQUOTE><CODE>
|
||
|
<PRE>
|
||
|
cc65 -O -I ../../include -t c64 hello.c
|
||
|
</PRE>
|
||
|
</CODE></BLOCKQUOTE>
|
||
|
</P>
|
||
|
<P>The <CODE>-O</CODE> switch tells the compiler to do an additional optimizer run, which
|
||
|
is usually a good idea, since it makes the code smaller. If you don't care
|
||
|
about the size, but want to have slightly faster code, use <CODE>-Oi</CODE> to inline
|
||
|
some runtime functions.</P>
|
||
|
<P>The <CODE>-I</CODE> switch gives a search path for the include files. You may also set
|
||
|
the environment variable <CODE>CC65_INC</CODE> to the search path.</P>
|
||
|
<P>The <CODE>-t</CODE> switch is followed by the target system name.</P>
|
||
|
<P>If the compiler does not complain about errors in our "hello world" program, we
|
||
|
will have a file named "<CODE>hello.s</CODE>", in our directory, that contains the
|
||
|
assembly source for the <B>hello</B> module.</P>
|
||
|
<P>For more information about the compiler, see
|
||
|
<A HREF="cc65.html">cc65.html</A>.</P>
|
||
|
|
||
|
|
||
|
|
||
|
<HR>
|
||
|
<A HREF="intro-3.html">Next</A>
|
||
|
<A HREF="intro-1.html">Previous</A>
|
||
|
<A HREF="intro.html#toc2">Contents</A>
|
||
|
</BODY>
|
||
|
</HTML>
|