![kueller](/assets/img/avatar_default.png)
git-svn-id: svn://svn.compuextreme.de/Viitor/V961/Viitor_cc65@4236 504e572c-2e33-0410-9681-be2bf7408885
82 lines
4.5 KiB
HTML
82 lines
4.5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
|
<TITLE>GEOSLib docs: What have you got and what to do with it?</TITLE>
|
|
<LINK HREF="geos-3.html" REL=next>
|
|
<LINK HREF="geos-1.html" REL=previous>
|
|
<LINK HREF="geos.html#toc2" REL=contents>
|
|
</HEAD>
|
|
<BODY>
|
|
<A HREF="geos-3.html">Next</A>
|
|
<A HREF="geos-1.html">Previous</A>
|
|
<A HREF="geos.html#toc2">Contents</A>
|
|
<HR>
|
|
<H2><A NAME="s2">2.</A> <A HREF="geos.html#toc2">What have you got and what to do with it?</A></H2>
|
|
|
|
<P>This chapter describes some rules you ought to obey, and how to use GEOSLib.</P>
|
|
|
|
<H2><A NAME="ss2.1">2.1</A> <A HREF="geos.html#toc2.1">Usage</A>
|
|
</H2>
|
|
|
|
<P>Apart from this file, which merely describes only standard GEOS library functions, you should read
|
|
<CODE>grc</CODE> (GEOS resource compiler) documentation. There are informations about necessary resource
|
|
files (each GEOS application needs at least one) and the building process - what should be done
|
|
and in what order. Please also read cc65's documentation on how to compile C, assembler and link
|
|
everything together.</P>
|
|
<P>All in all, you just need to place
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
#include <geos.h>
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
|
|
on top of your source.</P>
|
|
<P>As a general rule read the sources of example programs and read the headers. These are the most
|
|
reliable sources of knowledge ;). You will also find there many C macros representing various
|
|
arguments passed to functions. Please use them. You will find your sources easier to understand,
|
|
and it will be easier to find bugs.</P>
|
|
<P>All types used in GEOSLib are <CODE>unsigned</CODE>.</P>
|
|
<P>Screen coordinates are given in pixels unless stated differently.</P>
|
|
|
|
<H2><A NAME="ss2.2">2.2</A> <A HREF="geos.html#toc2.2">Notes on style</A>
|
|
</H2>
|
|
|
|
<P>Contrary to typical GEOS assembly program which has a main function called after loading that
|
|
setups the screen, menus, icons etc. exiting from <CODE>main</CODE> function in C is equivalent to
|
|
calling <CODE>exit()</CODE>. These two are the only safe methods of terminating applications. DO NOT
|
|
USE <CODE>EnterDeskTop</CODE>! Your data may be lost as library destructors and functions registered
|
|
with <CODE>atexit</CODE> will not be called.</P>
|
|
<P>For GEOS GUI applications the recommended program structure is to have everything initialized
|
|
in <CODE>main</CODE> function and at the end of it a call to <CODE>MainLoop()</CODE> function. WARNING! This
|
|
function never returns, any code between <CODE>MainLoop();</CODE> and the end of <CODE>main</CODE> will not
|
|
be executed. You have to call <CODE>exit()</CODE> explicitly somewhere in your code (e.g. in a menu
|
|
handler or via DialogBox action).</P>
|
|
<P>Whenever possible use definitions from <CODE>gsym.h</CODE>. The resulting code is translated by cc65 into
|
|
series of <CODE>lda</CODE> and <CODE>sta</CODE>, so you can't do it better :-).</P>
|
|
<P>Don't hesitate to use library functions. Everything was written with size and speed in mind. In
|
|
fact many calls are just redirections to GEOS kernal which results in simple <CODE>jsr</CODE>.</P>
|
|
<P>The <CODE>main</CODE> function receives the standard <CODE>argc</CODE> and <CODE>argv</CODE> parameters. There are
|
|
always either 1 or 3 parameters. DOS application name is always set as <CODE>argv[0]</CODE>.
|
|
If present, <CODE>argv[1]</CODE> and <CODE>argv[2]</CODE> will be set to data filename and data diskname (it only
|
|
works if user double-clicks on data file associated with your application). Note that it is up
|
|
to your application to determine which of the available (up to four) disk drives has the disk
|
|
with given diskname inside. If this fails your program should ask to insert the proper disk into
|
|
one of available drives.</P>
|
|
<P>You might wonder why I have chosen sometimes weird order of arguments in functions. I just
|
|
wanted to avoid unnecessary pushing and popping arguments from stack because cc65 can pass single
|
|
<CODE>unsigned int</CODE> through CPU registers.</P>
|
|
<P>Do not try to compile in strict ANSI mode. Library uses cc65 extensions which are not available in
|
|
ANSI.</P>
|
|
<P>It is possible to use dynamically loaded modules, three such modules are provided:
|
|
GEOS TGI driver, GEOS EMD driver (for VDC extended memory) and GEOS JOY driver.
|
|
Just make sure that their filenames appear UPPERCASE in DeskTop. There are no more special
|
|
recommendations, read cc65 documentation about modules and demo programs source code.</P>
|
|
|
|
<HR>
|
|
<A HREF="geos-3.html">Next</A>
|
|
<A HREF="geos-1.html">Previous</A>
|
|
<A HREF="geos.html#toc2">Contents</A>
|
|
</BODY>
|
|
</HTML>
|