9763b5530d
git-svn-id: svn://svn.compuextreme.de/Viitor/V961/Viitor_cc65@4236 504e572c-2e33-0410-9681-be2bf7408885
124 lines
4.4 KiB
HTML
124 lines
4.4 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
|
<TITLE>grc -- GEOS Resource Compiler: Building a GEOS sequential application</TITLE>
|
|
<LINK HREF="grc-5.html" REL=next>
|
|
<LINK HREF="grc-3.html" REL=previous>
|
|
<LINK HREF="grc.html#toc4" REL=contents>
|
|
</HEAD>
|
|
<BODY>
|
|
<A HREF="grc-5.html">Next</A>
|
|
<A HREF="grc-3.html">Previous</A>
|
|
<A HREF="grc.html#toc4">Contents</A>
|
|
<HR>
|
|
<H2><A NAME="building-seq"></A> <A NAME="s4">4.</A> <A HREF="grc.html#toc4">Building a GEOS sequential application</A></H2>
|
|
|
|
<P>Before proceeding, please read the
|
|
<A HREF="cc65.html">compiler</A>,
|
|
<A HREF="ca65.html">assembler</A>, and
|
|
<A HREF="ld65.html">linker</A>
|
|
documentation, and find the appropriate sections about building programs, in
|
|
general.</P>
|
|
<P>GEOS support in cc65 is based on the <EM>Convert v2.5</EM> format, well-known in
|
|
the GEOS world. It means that each file built with the cc65 package has to be
|
|
deconverted, in GEOS, before it can be run. You can read a step-by-step
|
|
description of that in the GEOS section of the
|
|
<A HREF="intro.html">cc65 Compiler Intro</A>.</P>
|
|
<P>Each project consists of four parts, two are provided by cc65. Those parts
|
|
are:
|
|
<OL>
|
|
<LI>application header</LI>
|
|
<LI>start-up object</LI>
|
|
<LI>application objects</LI>
|
|
<LI>system library</LI>
|
|
</OL>
|
|
|
|
<B>2.</B> and <B>4.</B> are with cc65; you have to write the application,
|
|
yourself. ;-)</P>
|
|
<P>The application header is defined in the <CODE>HEADER</CODE> section of the <CODE>.grc</CODE>
|
|
file, and processed into an assembly <CODE>.s</CODE> file. You must assemble it, with
|
|
<B>ca65</B>, into the object <CODE>.o</CODE> format.</P>
|
|
|
|
|
|
<H2><A NAME="ss4.1">4.1</A> <A HREF="grc.html#toc4.1">Building a GEOS application without cl65</A>
|
|
</H2>
|
|
|
|
<P>Assume that there are three input files: "<CODE>test.c</CODE>" (a C
|
|
source), "<CODE>test.h</CODE>" (a header file), and
|
|
"<CODE>resource.grc</CODE>" (with menu and header definitions). Note the
|
|
fact that I <EM>don't recommend</EM> naming that file "<CODE>test.grc</CODE>",
|
|
because you will have to be very careful with names (<B>grc</B> will make
|
|
"<CODE>test.s</CODE>" and "<CODE>test.h</CODE>" out of
|
|
"<CODE>test.grc</CODE>", by default; and, you don't want that because
|
|
"<CODE>test.s</CODE>" is compiled from "<CODE>test.c</CODE>", and
|
|
"<CODE>test.h</CODE>" is something completely different)!</P>
|
|
<P><B>One important thing</B> -- the top of "<CODE>test.c</CODE>" looks like:
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
#include <geos.h>
|
|
#include "resource.h"
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
|
|
There are no other includes.</P>
|
|
|
|
<H3>First step -- compiling the resources</H3>
|
|
|
|
<P>
|
|
<PRE>
|
|
$ grc resource.grc
|
|
</PRE>
|
|
|
|
will produce two output files: "<CODE>resource.h</CODE>" and
|
|
"<CODE>resource.s</CODE>".</P>
|
|
<P>Note that "<CODE>resource.h</CODE>" is included at the top of
|
|
"<CODE>test.c</CODE>". So, resource compiling <EM>must be</EM> the first step.</P>
|
|
|
|
<H3>Second step -- assembling the application header</H3>
|
|
|
|
<P>
|
|
<PRE>
|
|
$ ca65 -t geos resource.s
|
|
</PRE>
|
|
|
|
And, voilá -- "<CODE>resource.o</CODE>" is ready.</P>
|
|
|
|
<H3>Third step -- compiling the code</H3>
|
|
|
|
<P>
|
|
<PRE>
|
|
$ cc65 -t geos -O test.c
|
|
$ ca65 -t geos test.s
|
|
</PRE>
|
|
|
|
That way, you have a "<CODE>test.o</CODE>" object file which
|
|
contains all of the executable code.</P>
|
|
|
|
<H3>Fourth and last step -- linking it together</H3>
|
|
|
|
<P>
|
|
<PRE>
|
|
$ ld65 -t geos -o test.cvt resource.o geos.o test.o geos.lib
|
|
</PRE>
|
|
|
|
"<CODE>resource.o</CODE>" comes first because it contains the
|
|
header. The next one is "<CODE>geos.o</CODE>", a required starter-code
|
|
file; then, the actual application code in "<CODE>test.o</CODE>", and the
|
|
last is the GEOS system library.</P>
|
|
<P>The resulting file "<CODE>test.cvt</CODE>" is an executable that's
|
|
contained in the well-known GEOS <EM>Convert</EM> format. Note that it's name
|
|
(<CODE>test</CODE>) isn't important; the real name, after deconverting, is the DOS name
|
|
that was given in the header definition.</P>
|
|
<P>At each step, a <CODE>-t geos</CODE> was present on the command-line. That switch is
|
|
required for the correct process of GEOS sequential app. building.</P>
|
|
|
|
|
|
|
|
<HR>
|
|
<A HREF="grc-5.html">Next</A>
|
|
<A HREF="grc-3.html">Previous</A>
|
|
<A HREF="grc.html#toc4">Contents</A>
|
|
</BODY>
|
|
</HTML>
|