geos-2.html
来自「cc65 的编译器文档」· HTML 代码 · 共 82 行
HTML
82 行
<!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 resourcefiles (each GEOS application neeeds at least one) and the building process - what should be doneand in what order. Please also read cc65's documentation on how to compile C, assembler and linkeverything 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 mostreliable sources of knowledge ;). You will also find there many C macros representing variousarguments 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 thatsetups the screen, menus, icons etc. exiting from <CODE>main</CODE> function in C is equivalent tocalling <CODE>exit()</CODE>. These two are the only safe methods of terminating applications. DO NOTUSE <CODE>EnterDeskTop</CODE>! Your data may be lost as library destructors and functions registeredwith <CODE>atexit</CODE> will not be called.</P><P>For GEOS GUI applications the recommended program structure is to have everything initializedin <CODE>main</CODE> function and at the end of it a call to <CODE>MainLoop()</CODE> function. WARNING! Thisfunction never returns, any code between <CODE>MainLoop();</CODE> and the end of <CODE>main</CODE> will notbe executed. You have to call <CODE>exit()</CODE> explicitly somewhere in your code (e.g. in a menuhandler or via DialogBox action).</P><P>Whenever possible use definitions from <CODE>gsym.h</CODE>. The resulting code is translated by cc65 intoseries 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. Infact 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 arealways 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 onlyworks if user double-clicks on data file associated with your application). Note that it is upto your application to determine which of the available (up to four) disk drives has the diskwith given diskname inside. If this fails your program should ask to insert the proper disk intoone of available drives.</P><P>You might wonder why I have chosen sometimes weird order of arguments in functions. I justwanted 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 inANSI.</P><P>It is possible to use dynamicaly 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 specialrecommendations, 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>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?