⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intro-1.html

📁 cc65 的编译器文档
💻 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: Overview</TITLE> <LINK HREF="intro-2.html" REL=next> <LINK HREF="intro.html#toc1" REL=contents></HEAD><BODY><A HREF="intro-2.html">Next</A>Previous<A HREF="intro.html#toc1">Contents</A><HR><H2><A NAME="s1">1.</A> <A HREF="intro.html#toc1">Overview</A></H2><P>This is a short intro of how to use the compiler and the binutils. It contains astep-by-step example of how to build a complete application from one C and oneassembler module. This file does <EM>not</EM> contain a complete reference for thetools used in the process. There are separate files describing these tools indetail.</P><P>You are assumed to have downloaded and extracted the executables and thetarget specific files. For example, for Windows users targeting C64, you needcc65-win32-2.8.0.zip and cc65-c64-2.8.0.zip (or whatever the current cc65version is) extracted to the same directory. If you received the files as abzip2 archive (extension *.bz2), you will need to get the <A HREF="http://sources.redhat.com/bzip2/#bzip2-latest">bzip2 package</A> todecompress it.</P><P><B>Note</B>: There is a much simpler way to compile this example using thecl65 compiler and link utility. However, it makes sense to understand how theseparate steps work. How to do the example with the cl65 utility is described<A HREF="intro-5.html#using-cl65">later</A>.</P><H2><A NAME="ss1.1">1.1</A> <A HREF="intro.html#toc1.1">Before we start</A></H2><P>You will find a copy of the sample modules used in the next section in thesamples/tutorial directory. Windows users will also find a small batch file inthis directory named "cc65setup.bat". Be sure to examine and understand thecommands in this file, then adjust them for your setup, and execute the file.</P><H2><A NAME="ss1.2">1.2</A> <A HREF="intro.html#toc1.2">The sample modules</A></H2><P>To explain the development flow, I will use the following example modules:</P><P>hello.c:</P><P><BLOCKQUOTE><CODE><HR><PRE>        #include &lt;stdio.h>        #include &lt;stdlib.h>        extern const char text[];       /* In text.s */        int main (void)        {            printf ("%s\n", text);            return EXIT_SUCCESS;        }</PRE><HR></CODE></BLOCKQUOTE></P><P>text.s:<BLOCKQUOTE><CODE><HR><PRE>        .export _text        _text:  .asciiz "Hello world!"</PRE><HR></CODE></BLOCKQUOTE></P><H2><A NAME="ss1.3">1.3</A> <A HREF="intro.html#toc1.3">Translation phases</A></H2><P>We assume that the target file should be named "hello", and the target systemis the C64.</P><P><BLOCKQUOTE><CODE><PRE>    +---------+    | hello.c |    +---------+         |        cc65         \/    +---------+       +---------+    | hello.s |       | text.s  |    +---------+       +---------+         |                 |        ca65              ca65         \/                \/    +---------+       +---------+       +----------+       +---------+    | hello.o |       | text.o  |       |  c64.o   |       | c64.lib |    +---------+       +---------+       +----------+       +---------+         |                     \         /                      |         |                      \       /                       |         |                       \     /                        |         +----------------------->ld65&lt;-------------------------+                                   \/                                  hello</PRE></CODE></BLOCKQUOTE></P><P><CODE>c64.o</CODE> (the startup code) and <CODE>c64.lib</CODE> (the c64 version of the runtimeand C library) are provided in binary form in the cc65 package.</P><HR><A HREF="intro-2.html">Next</A>Previous<A HREF="intro.html#toc1">Contents</A></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -