As we all know that the best computers in the world are c64 and c128. They have their GUI too - excellent GEOS. GEOS seems very difficult and cryptic for many people, from programmer's point of view. That's not true. The designers of GEOS created flexible and powerful system, which is easy to use and program.
Coding GEOS in C? That's something new. It is possible now - with Ulrich von Bassewitz's cc65 package and my GEOSLib you are able to create GEOS applications in no-time.
GEOSLib supports a subset of standard cc65 libraries. Whenever possible native Kernal functions
are used (e.g.
memset is an alias for
FillRam), however not all are supported. E.g.
string functions like
strcpy are doubled with native
CopyString because the latter can handle only 256 byte strings. Keep this in mind when
you will write your program. If you don't need long strings simply use functions from Kernal,
resulting code will be smaller.
dio - direct disk access is available, but you might have problems with devices other
than 1541, 1571 or 1581. RAM drives emulating these should work.
conio - simple console input-output is available for command line applications.
This implementation assumes that one character will fit in 8x8 cell, so output with
default BSW font, which is has 9 points, might be a bit messy.
cputs will output characters with fixed width, for proportional spacing use
cpputs but this function does not update cursor. There is no color support in
GEOS 2.0 so color functions are disabled. Both 40 and 80 columns modes are supported
and automatically detected.
tgi - TGI driver for GEOS that supports both 40 and 80 columns modes but mode can not be
joy - JOY driver for GEOS supports only joystick, not current pointing device.
It is safe to use these standard includes and their contents:
assert.h, conio.h, dio.h, errno.h, em.h, geos.h, joystick.h, modload.h, mouse.h, stdlib.h, string.h, tgi.h, time.h
clock() note that the resolution is one second.
It was not tested enough, but functions from these includes might work under GEOS:
Functions from the headers above are either standard C library functions or cc65-specific, in either case they are not GEOS specific and so they are not described here.
I am an assembler programmer and GEOSLib was designed in such way that cc65 could emit the best
available code (well, the best as for machine :). Many of the
void foo (void) functions are
just raw calls to Kernal (assembled just as
jsr _foo), look in
gsym.h, where you
will find many definitions of standard GEOS locations. Access to these addresses is optimized by
cc65 to simple
sta. Don't be afraid to use C syntax.
You will not need c64 or c128 for development. The only hardware requirement is a PC capable of running cc65. You will however need c64 or c128 emulator and GEOS image disks (.d64) to test your programs.
The software needed:
VICE and cc65 are portable - they run on variety of platforms - DOS, Win32 and UNIX. GEOSLib only needs cc65.
Update: starting from v2.5.0 GEOSLib is a part of cc65 package as its GEOS support library.
I want to thank Uz for his cc65 package, Alexander Boyce for his excellent GEOS Programmer's Reference Guide and BSW for GEOS.
GEOSLib is covered by the same license as cc65. You can find the whole text among documentation. I would really appreciate if you would like to send me your comments, suggestions, questions, changes, bug reports etc. I will also appreciate if you will just give me a sign that you are using GEOSLib - not especially something big and important, mail me even if you are just playing with it.
You can send postcards with hellos to:
Maciej Witkowiak, ul. Slowackiego 6/57, 77-400 ZLOTOW