<p>
<tt/joy/ - JOY driver for GEOS supports only joystick, not current pointing device.
<p>
-It is safe to use these standard includes and its contents:
+It is safe to use these standard includes and their contents:
<tt/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/
<p>
It was not tested enough, but functions from these includes might work under GEOS:
<tt/rs232.h, zlib.h/
<p>
+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.
+<p>
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 <tt/void foo (void)/ functions are
just raw calls to Kernal (assembled just as <tt/jsr _foo/), look in <tt/gsym.h/, where you
will find many definitions of standard GEOS locations. Access to these addresses is optimized by
-cc65 to simple <tt/lda/ and <tt/sta/. Don't be afraid to use the power of C.
+cc65 to simple <tt/lda/ and <tt/sta/. Don't be afraid to use C syntax.
<sect1>Requirements
<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 <tt/jsr/.
<p>
-You might wonder why I have chosen sometimes weird order of arguments in functions. It is because
-I wanted to avoid unnecessary pushing and popping arguments from stack. cc65 can pass single <tt/int/
-through CPU registers.
+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
+<tt/unsigned int/ through CPU registers.
<p>
Do not try to compile in strict ANSI mode. Library uses cc65 extensions which are not available in
ANSI.
<sect3>HorizontalLine
<p>
-<tt/void HorizontalLine (char pattern, char y, int xStart, int xEnd)/
+<tt/void HorizontalLine (char pattern, char y, unsigned xStart, unsigned xEnd)/
<p>
This function draws horizontal line using given pattern - here it is a true bit pattern, not
pattern set by <tt/SetPattern/.
<sect3>InvertLine
<p>
-<tt/void InvertLine (char y, int xStart, int xEnd)/
+<tt/void InvertLine (char y, unsigned xStart, unsigned xEnd)/
<p>
There is only horizontal version.
<sect3>RecoverLine
<p>
-<tt/void RecoverLine (char y, int xStart, int xEnd)/
+<tt/void RecoverLine (char y, unsigned xStart, unsigned xEnd)/
<p>
This function recovers only one line. It is utilized by <tt/RecoverRectangle/. See its description
for more details.
<sect3>VerticalLine
<p>
-<tt/void VerticalLine (char pattern, char yStart, char yEnd, int x)/
+<tt/void VerticalLine (char pattern, char yStart, char yEnd, unsigned x)/
<p>
This function draws vertical line using given pattern. Note that <tt/pattern/ is not a pattern
number as set in <tt/SetPattern/ but a true bit pattern.
<sect3>PutString
<p>
-<tt/void PutString (char *myString, char y, int x)/
+<tt/void PutString (char *myString, char y, unsigned x)/
<p>
Same as <tt/PutChar/ except the fact that you can output whole <tt/NULL/-terminated string.
See <tt/ggraph.h/ for list of tokens that you can also place in the string - like <tt/CBOLDON/ or
<sect3>PutDecimal
<p>
-<tt/void PutDecimal (char parameter, int value, char y, int x)/
+<tt/void PutDecimal (char parameter, int value, char y, unsigned x)/
<p>
This function converts <tt/value/ to its decimal representation and outputs it to the screen.
Depending on given <tt/parameter/ the string can be filled with zeroes (string always 5 characters
<sect3>BitmapClip
<p>
-<tt/void BitmapClip (char skipLeft, char skipRight, int skipTop, struct iconpic *myPic)/
+<tt/void BitmapClip (char skipLeft, char skipRight, unsigned skipTop, struct iconpic *myPic)/
<p>
This function acts similar to <tt/BitmapUp/ but you can also define which parts of the bitmap are
to be drawn - you give the number of columns (8-pixel) to skip on the right and left of the bitmap,
<sect3>BitOtherClip
<p>
-<tt/void BitOtherClip (void *proc1, void *proc2, char skipLeft, char skip Right, int skipTop,
+<tt/void BitOtherClip (void *proc1, void *proc2, char skipLeft, char skip Right, unsigned skipTop,
struct iconpic *myPic)/
<p>
Similar to the previous one with some extension. <tt/proc1/ is called before reading a byte (it
<sect3>CalcBlksFree
<p>
-<tt/int CalcBlksFree (void)/
+<tt/unsigned CalcBlksFree (void)/
<p>
This function returns the number of free blocks on current disk. It is counted using data in
<tt/curDirHead/ so you must initialize the disk before calling it.
<sect3>BlkAlloc and NxtBlkAlloc
<p>
-<tt/char BlkAlloc (struct tr_se output[&rsqb, int length)/
+<tt/char BlkAlloc (struct tr_se output[&rsqb, unsigned length)/
<p>
-<tt/char NxtBlkAlloc (struct tr_se *myTrSe, struct tr_se output[&rsqb, int length)/
+<tt/char NxtBlkAlloc (struct tr_se *myTrSe, struct tr_se output[&rsqb, unsigned length)/
<p>
Both functions are allocating enough disk sectors to fit the number of <tt/length/ in them. You
will find output in <tt/output/ which is table of <tt/struct tr_se/. The last entry will have the
This function finds the first free sector starting from given track and sector and allocates it.
It might return the same argument if the given block is not allocated. I wanted it to be type
clean, but it made usage a bit tricky. To assign a value to own <tt/struct tr_se/ you have to
-cast both variables to <tt/int/. E.g.
+cast both variables to <tt/unsigned/. E.g.
<tscreen><verb>
struct tr_se myTrSe;
...
-(int)myTrSe=(int)SetNextFree(&otherTrSe);
+(unsigned)myTrSe=(unsigned)SetNextFree(&otherTrSe);
</verb></tscreen>
<p>
In this example <tt/otherTrSe/ can be replaced by <tt/myTrSe/.
<p>
These two functions are best suited for scanning whole directory for particular files. Note that
returned filehandles describes all file slots in the directory - even those with deleted files.
-The return value can be obtained by casting both sides to <tt/int/ - as in <tt/SetNextFree/
+The return value can be obtained by casting both sides to <tt/unsigned/ - as in <tt/SetNextFree/
function or read directly after call to those two functions from <tt/r5/. Current sector number
is in <tt/r1/ and sector data itself is in <tt/diskBlkBuf/.
<sect3>ReadFile
<p>
-<tt/char ReadFile (struct tr_se *myTrSe, char *buffer, int fLength)/
+<tt/char ReadFile (struct tr_se *myTrSe, char *buffer, unsigned fLength)/
<p>
This function reads at most <tt/fLength/ bytes into <tt/buffer/ from chained sectors starting at
<tt/myTrSe/.
<sect3>ReadRecord and WriteRecord
<p>
-<tt/char ReadRecord (char *buffer, int fLength)/
+<tt/char ReadRecord (char *buffer, unsigned fLength)/
<p>
-<tt/char WriteRecord (char *buffer, int fLength)/
+<tt/char WriteRecord (char *buffer, unsigned fLength)/
<p>
This function will load or save at most <tt/fLength/ bytes from currently pointed record into or from
<tt/buffer/.
<sect2>CRC
<p>
-<tt/int CRC (char *src, int length)/
+<tt/unsigned CRC (char *src, unsigned length)/
<p>
This function calculates the CRC checksum for given memory range. I don't know if it is
compatible with standard CRC routines.
<sect2>FillRam and ClearRam
<p>
-<tt/void FillRam (char *dest, char value, int length)/
+<tt/void FillRam (char *dest, char value, unsigned length)/
<p>
-<tt/void ClearRam (char *dest, int length)/
+<tt/void ClearRam (char *dest, unsigned length)/
<p>
Both functions are filling given memory range. <tt/ClearRam/ fills with <tt/NULLs/, while
<tt/FillRam/ uses given <tt/value/. Be warned that these functions destroy <tt/r0, r1 and
<sect2>MoveData
<p>
-<tt/void MoveData (char *dest, char *src, int length)/
+<tt/void MoveData (char *dest, char *src, unsigned length)/
<p>
This functions copies one memory region to another. There are checks for overlap and the
non-destructive method is chosen. Be warned that this function destroys contents of
<sect2>Stash, Fetch, Swap, and VerifyRAM
<p>
-<tt/void StashRAM (char bank, int length, char *reuAddress, char *cpuAddress)/
+<tt/void StashRAM (char bank, unsigned length, char *reuAddress, char *cpuAddress)/
<p>
-<tt/void FetchRAM (char bank, int length, char *reuAddress, char *cpuAddress)/
+<tt/void FetchRAM (char bank, unsigned length, char *reuAddress, char *cpuAddress)/
<p>
-<tt/void SwapRAM (char bank, int length, char *reuAddress, char *cpuAddress)/
+<tt/void SwapRAM (char bank, unsigned length, char *reuAddress, char *cpuAddress)/
<p>
-<tt/ char VerifyRAM (char bank, int length, char *reuAddress, char *cpuAddress)/
+<tt/ char VerifyRAM (char bank, unsigned length, char *reuAddress, char *cpuAddress)/
<p>
These functions are interface to REU - Ram Expansion Unit. I think that they are self-explanatory.
You can check for REU presence by taking value of <tt/ramExpSize/.
<sect2>Sleep
<p>
-<tt/void Sleep (int jiffies)/
+<tt/void Sleep (unsigned jiffies)/
<p>
This function is multitasking sleep - the program is halted, but it doesn't block other functions.
The only argument here is the number of jiffies to wait until app will wake up.
<sect2>GetSerialNumber
<p>
-<tt/int GetSerialNumber (void)/
+<tt/unsigned GetSerialNumber (void)/
<p>
This function returns the serial number of system. It might be used for copy-protection.
However, please remember that the Free Software is a true power and you are using it
You should declare a table of that type to prepare data for <tt/InitProcesses/. The maximum number
of processes is 20, and the last entry has to be equal to <tt/{NULL,NULL}/, so this table may hold
only 21 entries. The first member of this structure (<tt/pointer/) holds the pointer to called
-function (void returning void), you will probably have to cast that pointer into int. The second
-field <tt/jiffies/ holds the amount of time between calls to that function. On PAL systems there
-are 50 jiffies per second, while NTSC have 60 of them.
+function (void returning void), you will probably have to cast that pointer into <tt/unsigned int/.
+The second field <tt/jiffies/ holds the amount of time between calls to that function.
+On PAL systems there are 50 jiffies per second, while NTSC have 60 of them.
<sect1>Few thing in detail...
<p>
<tscreen><verb>
char text = "foo";
...
- r15=(int)text; // in code just before call to DoDlgBox
+ r15=(unsigned)text; // in code just before call to DoDlgBox
...
DB_VARSTR (TXT_LN_X, TXT_LN_1_Y, &r15),
...
#endif
void __fastcall__ cpputs(char *s);
-void __fastcall__ cpputsxy(int x, int y, char *s);
+void __fastcall__ cpputsxy(unsigned x, unsigned y, char *s);
void __fastcall__ SetPattern(char newpattern);
-void __fastcall__ HorizontalLine(char pattern, char y, int xstart, int xend);
-void __fastcall__ InvertLine(char y, int xstart, int xend);
-void __fastcall__ RecoverLine(char y, int xstart, int xend);
-void __fastcall__ VerticalLine(char pattern, char ystart, char yend, int x);
+void __fastcall__ HorizontalLine(char pattern, char y, unsigned xstart, unsigned xend);
+void __fastcall__ InvertLine(char y, unsigned xstart, unsigned xend);
+void __fastcall__ RecoverLine(char y, unsigned xstart, unsigned xend);
+void __fastcall__ VerticalLine(char pattern, char ystart, char yend, unsigned x);
void __fastcall__ InitDrawWindow(struct window *myRectangle);
void __fastcall__ Rectangle(void);
void __fastcall__ DrawPoint(struct pixel *myPixel);
char __fastcall__ TestPoint(struct pixel *myPixel);
-void __fastcall__ PutChar(char character, char y, int x);
-void __fastcall__ PutString(char *myString, char y, int x);
-void __fastcall__ PutDecimal(char style, int value, char y, int x);
+void __fastcall__ PutChar(char character, char y, unsigned x);
+void __fastcall__ PutString(char *myString, char y, unsigned x);
+void __fastcall__ PutDecimal(char style, int value, char y, unsigned x);
char __fastcall__ GetCharWidth(char character);
void __fastcall__ LoadCharSet(struct fontdesc *myFont);
void __fastcall__ UseSystemFont(void);
void __fastcall__ BitmapUp(struct iconpic *myIcon);
-void __fastcall__ BitmapClip(char skipl, char skipr, int skiptop,
+void __fastcall__ BitmapClip(char skipl, char skipr, unsigned skiptop,
struct iconpic *myIcon);
void __fastcall__ BitOtherClip(void *proc1, void *proc2, char skipl,
- char skipr, int skiptop,
+ char skipr, unsigned skiptop,
struct iconpic *myIcon);
void __fastcall__ GraphicsString(char *myGfxString);
GEOS memory and string functions
ported to small C on 27.10.1999
- by Maciej 'YTM/Alliance' Witkowiak
+ by Maciej 'YTM/Elysium' Witkowiak
+ 04.04.2003 - updates
*/
#ifndef _GMEMORY_H
void __fastcall__ CopyFString(char len, char *dest, const char *source);
char __fastcall__ CmpFString(char len, char *dest, const char *source);
-int __fastcall__ CRC(const char *buffer, int len);
-void __fastcall__ ClearRam(char *dest, int len);
-void __fastcall__ FillRam(char *dest, char what, int len);
+unsigned __fastcall__ CRC(const char *buffer, unsigned len);
+void __fastcall__ ClearRam(char *dest, unsigned len);
+void __fastcall__ FillRam(char *dest, char what, unsigned len);
-void __fastcall__ MoveData(char *dest, const char *source, int len);
+void __fastcall__ MoveData(char *dest, const char *source, unsigned len);
void __fastcall__ InitRam(char *myInitTab);
-void __fastcall__ StashRAM(char REUBank, int len, char *reuaddy, const char *cpuaddy);
-void __fastcall__ FetchRAM(char REUBank, int len, const char *reuaddy, char *cpuaddy);
-void __fastcall__ SwapRAM(char REUBank, int len, char *reuaddy, char *cpuaddy);
-char __fastcall__ VerifyRAM(char REUBank, int len, const char *reuaddy, const char *cpuaddy);
+void __fastcall__ StashRAM(char REUBank, unsigned len, char *reuaddy, const char *cpuaddy);
+void __fastcall__ FetchRAM(char REUBank, unsigned len, const char *reuaddy, char *cpuaddy);
+void __fastcall__ SwapRAM(char REUBank, unsigned len, char *reuaddy, char *cpuaddy);
+char __fastcall__ VerifyRAM(char REUBank, unsigned len, const char *reuaddy, const char *cpuaddy);
#endif