-<!doctype linuxdoc system>
+<!doctype linuxdoc system> <!-- -*- text-mode -*- -->
<article>
<title>cc65 function reference
-<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
-<date>07.11.2002
+<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
+<url url="mailto:greg.king5@verizon.net" name="Greg King">
+<date>2017-09-02
<abstract>
cc65 is a C compiler for 6502 based systems. This function reference describes
available functions together with any limitations.
For an overview about the available libraries, their purpose, and any
-differences to the ISO standard, please have a look at the <htmlurl
+differences to the ISO standard, please have a look at the <url
url="library.html" name="cc65 Library Overview">.
-<bf/Note:/ Standard C functions are listed here, but not described in detail.
+<em/Note:/ Standard C functions are listed here, but not described in detail.
Since these functions behave identical on all standard compliant systems, they
are described in any book covering standard C.
<tag/Declaration/Describes the needed header files and declaration of the
function.
<tag/Description/Description of the function.
-<tag/Limits/Limits.
+<tag/Notes/Notes on the function.
<tag/Availability/The availability of the function.
<tag/See also/Other related functions.
<tag/Example/A piece of actual code using the function.
<!-- <item><ref id="_getcolor" name="_getcolor"> -->
<!-- <item><ref id="_getdefdev" name="_getdefdev"> -->
<!-- <item><ref id="_graphics" name="_graphics"> -->
+<item><ref id="_is_cmdline_dos" name="_is_cmdline_dos">
<!-- <item><ref id="_rest_vecs" name="_rest_vecs"> -->
<!-- <item><ref id="_save_vecs" name="_save_vecs"> -->
<!-- <item><ref id="_scroll" name="_scroll"> -->
<itemize>
<item><ref id="atmos_load" name="atmos_load">
<item><ref id="atmos_save" name="atmos_save">
+<!-- <item><ref id="atmos_explode" name="atmos_explode"> -->
+<!-- <item><ref id="atmos_ping" name="atmos_ping"> -->
+<!-- <item><ref id="atmos_shoot" name="atmos_shoot"> -->
+<!-- <item><ref id="atmos_tick" name="atmos_tick"> -->
+<!-- <item><ref id="atmos_tock" name="atmos_tock"> -->
+<!-- <item><ref id="atmos_zap" name="atmos_zap"> -->
</itemize>
+(incomplete)
+
<sect1><tt/c128.h/<label id="c128.h"><p>
<sect1><tt/cbm.h/<label id="cbm.h"><p>
-<!-- <itemize> -->
-<!-- <item><ref id="cbm_clall" name="cbm_clall"> -->
-<!-- <item><ref id="cbm_close" name="cbm_close"> -->
-<!-- <item><ref id="cbm_closedir" name="cbm_closedir"> -->
-<!-- <item><ref id="cbm_k_basin" name="cbm_k_basin"> -->
-<!-- <item><ref id="cbm_k_bsout" name="cbm_k_bsout"> -->
-<!-- <item><ref id="cbm_k_chkin" name="cbm_k_chkin"> -->
-<!-- <item><ref id="cbm_k_ckout" name="cbm_k_ckout"> -->
-<!-- <item><ref id="cbm_k_close" name="cbm_k_close"> -->
-<!-- <item><ref id="cbm_k_clrch" name="cbm_k_clrch"> -->
-<!-- <item><ref id="cbm_k_getin" name="cbm_k_getin"> -->
-<!-- <item><ref id="cbm_k_load" name="cbm_k_load"> -->
-<!-- <item><ref id="cbm_k_open" name="cbm_k_open"> -->
-<!-- <item><ref id="cbm_k_readst" name="cbm_k_readst"> -->
-<!-- <item><ref id="cbm_k_save" name="cbm_k_save"> -->
-<!-- <item><ref id="cbm_k_setlfs" name="cbm_k_setlfs"> -->
-<!-- <item><ref id="cbm_k_setnam" name="cbm_k_setnam"> -->
+<itemize>
+<item><ref id="cbm_k_acptr" name="cbm_k_acptr">
+<item><ref id="cbm_k_basin" name="cbm_k_basin">
+<item><ref id="cbm_k_bsout" name="cbm_k_bsout">
+<item><ref id="cbm_k_chkin" name="cbm_k_chkin">
+<item><ref id="cbm_k_ciout" name="cbm_k_ciout">
+<item><ref id="cbm_k_ckout" name="cbm_k_ckout">
+<item><ref id="cbm_k_clall" name="cbm_k_clall">
+<item><ref id="cbm_k_close" name="cbm_k_close">
+<item><ref id="cbm_k_clrch" name="cbm_k_clrch">
+<item><ref id="cbm_k_getin" name="cbm_k_getin">
+<item><ref id="cbm_k_iobase" name="cbm_k_iobase">
+<item><ref id="cbm_k_listen" name="cbm_k_listen">
+<item><ref id="cbm_k_load" name="cbm_k_load">
+<item><ref id="cbm_k_open" name="cbm_k_open">
+<item><ref id="cbm_k_readst" name="cbm_k_readst">
+<item><ref id="cbm_k_save" name="cbm_k_save">
+<item><ref id="cbm_k_scnkey" name="cbm_k_scnkey">
+<item><ref id="cbm_k_setlfs" name="cbm_k_setlfs">
+<item><ref id="cbm_k_setnam" name="cbm_k_setnam">
+<item><ref id="cbm_k_talk" name="cbm_k_talk">
+<item><ref id="cbm_k_udtim" name="cbm_k_udtim">
+<item><ref id="cbm_k_unlsn" name="cbm_k_unlsn">
<!-- <item><ref id="cbm_load" name="cbm_load"> -->
<!-- <item><ref id="cbm_open" name="cbm_open"> -->
<!-- <item><ref id="cbm_opendir" name="cbm_opendir"> -->
<!-- <item><ref id="cbm_readdir" name="cbm_readdir"> -->
<!-- <item><ref id="cbm_save" name="cbm_save"> -->
<!-- <item><ref id="cbm_write" name="cbm_write"> -->
-<!-- </itemize> -->
+<!-- <item><ref id="get_tv" name="get_tv"> -->
+<item><ref id="kbrepeat" name="kbrepeat">
+</itemize>
(incomplete)
<sect1><tt/cc65.h/<label id="cc65.h"><p>
-<!-- <itemize> -->
+<itemize>
<!-- <item><ref id="cc65_cos" name="cc65_cos"> -->
<!-- <item><ref id="cc65_idiv32by16r16" name="cc65_idiv32by16r16"> -->
<!-- <item><ref id="cc65_imul16x16r32" name="cc65_imul16x16r32"> -->
<!-- <item><ref id="cc65_umul16x16r32" name="cc65_umul16x16r32"> -->
<!-- <item><ref id="cc65_umul16x8r32" name="cc65_umul16x8r32"> -->
<!-- <item><ref id="cc65_umul8x8r16" name="cc65_umul8x8r16"> -->
-<!-- </itemize> -->
+<item><ref id="doesclrscrafterexit" name="doesclrscrafterexit">
+</itemize>
(incomplete)
<sect1><tt/dio.h/<label id="dio.h"><p>
-<htmlurl url="dio.html" name="dio.html">
-Low-level disk I/O API.
+<url url="dio.html" name="Low-level disk I/O API">.
<sect1><tt/dirent.h/<label id="dirent.h"><p>
-<itemize>
+<itemize>
<item><ref id="_DE_ISDIR" name="_DE_ISDIR">
<item><ref id="_DE_ISLBL" name="_DE_ISLBL">
<item><ref id="_DE_ISLNK" name="_DE_ISLNK">
</itemize>
+<sect1><tt/gamate.h/<label id="gamate.h"><p>
+
+<!-- <itemize> -->
+<!-- <item><ref id="get_tv" name="get_tv"> -->
+<!-- <item><ref id="waitvblank" name="waitvblank"> -->
+<!-- </itemize> -->
+
+(incomplete)
+
+
<sect1><tt/geos.h/<label id="geos.h"><p>
(incomplete)
(incomplete)
+<sect1><tt/lz4.h/<label id="lz4.h"><p>
+
+<itemize>
+<item><ref id="decompress_lz4" name="decompress_lz4">
+</itemize>
+
+
<sect1><tt/modload.h/<label id="modload.h"><p>
<itemize>
<!-- <itemize> -->
<!-- <item><ref id="get_tv" name="get_tv"> -->
-<!-- <item><ref id="waitvblank" name="waitvblank"> -->
+<!-- <item><ref id="waitvsync" name="waitvsync"> -->
<!-- </itemize> -->
(incomplete)
<sect1><tt/o65.h/<label id="o65.h"><p>
The <tt/o65.h/ header file contains structure and constant definitions that
-may be used when dealing with files in <htmlurl
-url="http://www.6502.org/users/andre/o65/fileformat.html" name="o65 format">.
+may be used when dealing with files in <url
+url="http://www.6502.org/users/andre/o65/fileformat.html" name="the o65 format">.
It does not declare any functions.
+<sect1><tt/pce.h/<label id="pce.h"><p>
+
+<!-- <itemize> -->
+<!-- <item><ref id="get_tv" name="get_tv"> -->
+<!-- <item><ref id="waitvblank" name="waitvblank"> -->
+<!-- </itemize> -->
+
+(incomplete)
+
+
<sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
<itemize>
</itemize>
+<sect1><tt/pen.h/<label id="pen.h"><p>
+
+<!-- <itemize> -->
+<!-- <item><ref id="pen_adjust" name="pen_adjust"> -->
+<!-- <item><ref id="pen_calibrate" name="pen_calibrate"> -->
+<!-- </itemize> -->
+
+(incomplete)
+
+
<sect1><tt/pet.h/<label id="pet.h"><p>
(incomplete)
<item><ref id="strncat" name="strncat">
<item><ref id="strncmp" name="strncmp">
<item><ref id="strncpy" name="strncpy">
+<item><ref id="strqtok" name="strqtok">
<item><ref id="strrchr" name="strrchr">
<item><ref id="strspn" name="strspn">
<item><ref id="strstr" name="strstr">
<item><ref id="tgi_clear" name="tgi_clear">
<item><ref id="tgi_done" name="tgi_done">
<item><ref id="tgi_ellipse" name="tgi_ellipse">
+<item><ref id="tgi_free_vectorfont" name="tgi_free_vectorfont">
<item><ref id="tgi_getaspectratio" name="tgi_getaspectratio">
<item><ref id="tgi_getcolor" name="tgi_getcolor">
<item><ref id="tgi_getcolorcount" name="tgi_getcolorcount">
<item><ref id="tgi_getpagecount" name="tgi_getpagecount">
<item><ref id="tgi_getpalette" name="tgi_getpalette">
<item><ref id="tgi_getpixel" name="tgi_getpixel">
+<item><ref id="tgi_gettextheight" name="tgi_gettextheight">
+<item><ref id="tgi_gettextwidth" name="tgi_gettextwidth">
<item><ref id="tgi_getxres" name="tgi_getxres">
<item><ref id="tgi_getyres" name="tgi_getyres">
<item><ref id="tgi_gotoxy" name="tgi_gotoxy">
<item><ref id="tgi_init" name="tgi_init">
<item><ref id="tgi_install" name="tgi_install">
+<item><ref id="tgi_install_vectorfont" name="tgi_install_vectorfont">
<item><ref id="tgi_ioctl" name="tgi_ioctl">
<item><ref id="tgi_line" name="tgi_line">
<item><ref id="tgi_lineto" name="tgi_lineto">
<item><ref id="tgi_load_driver" name="tgi_load_driver">
+<item><ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">
<item><ref id="tgi_outtext" name="tgi_outtext">
<item><ref id="tgi_outtextxy" name="tgi_outtextxy">
<item><ref id="tgi_setaspectratio" name="tgi_setaspectratio">
<item><ref id="tgi_setpalette" name="tgi_setpalette">
<item><ref id="tgi_setpixel" name="tgi_setpixel">
<item><ref id="tgi_setviewpage" name="tgi_setviewpage">
-<item><ref id="tgi_gettextheight" name="tgi_gettextheight">
+<item><ref id="tgi_settextscale" name="tgi_settextscale">
<item><ref id="tgi_settextstyle" name="tgi_settextstyle">
-<item><ref id="tgi_gettextwidth" name="tgi_gettextwidth">
<item><ref id="tgi_uninstall" name="tgi_uninstall">
<item><ref id="tgi_unload" name="tgi_unload">
</itemize>
<tag/Description/The function is called with the type of a directory entry
taken from a <tt/struct dirent/ and returns true if the entry designates
a directory.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The function is actually a macro.
</itemize>
<tag/Availability/cc65
<tag/Description/The function is called with the type of a directory entry
taken from a <tt/struct dirent/ and returns true if the entry designates
a disk label.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The function is actually a macro.
</itemize>
<tag/Availability/cc65
<tag/Description/The function is called with the type of a directory entry
taken from a <tt/struct dirent/ and returns true if the entry designates
a link.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The function is actually a macro.
</itemize>
<tag/Availability/cc65
<tag/Description/The function is called with the type of a directory entry
taken from a <tt/struct dirent/ and returns true if the entry designates
a regular file.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The function is actually a macro.
<item>A "regular file" means anything with data in it. This might still mean
-that special processing is needed, when accessing the file. Relative files of
+that special processing is needed, when accessing the file. Relative files of
the CBM systems are classified as being "regular" files, for example.
</itemize>
<tag/Availability/cc65
<tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
<tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
<tag/Description/The function adds a block of raw memory to the heap.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The minimum blocksize that can be added is 6 bytes; the function will
ignore smaller blocks.
+<item>The function is available only as a fastcall function; so, it may be used
+only in the presence of a prototype.
</itemize>
<tag/Availability/cc65
<tag/See also/
<tag/Description/The function returns the size of a block that must have
previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>Passing a pointer to a block that was is not the result of one of the
allocation functions, or that has been free'd will give unpredicable results.
+<item>The function is available only as a fastcall function; so, it may be used
+only in the presence of a prototype.
</itemize>
<tag/Availability/cc65
<tag/See also/
<descrip>
<tag/Function/Return the total available space on the heap.
<tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
-<tag/Declaration/<tt/size_t __fastcall__ _heapmemavail (void);/
+<tag/Declaration/<tt/size_t _heapmemavail (void);/
<tag/Description/The function returns the total number of bytes available on
the heap.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>This function is of less use than usually assumed, since the returned
heap space may be available but not in one block. So even if this function
says that several times more heap space is available than needed, <ref
</quote>
+<sect1>_is_cmdline_dos<label id="_is_cmdline_dos"><p>
+
+<quote>
+<descrip>
+<tag/Function/Determines whether the underlying DOS supports command line arguments.
+<tag/Header/<tt/<ref id="atari.h" name="atari.h">/
+<tag/Declaration/<tt/unsigned char _is_cmdline_dos (void);/
+<tag/Description/The function returns 0 if the DOS doesn't support command line arguments.
+It returns 1 if it does.
+<tag/Availability/cc65 (<tt/atari/ and <tt/atarixl/ platforms)
+</descrip>
+</quote>
+
+
<sect1>_poserror<label id="_poserror"><p>
<quote>
<tt/_oserror/ are printed followed by a newline. The message output is the
same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
argument of <tt/_oserror/.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>Since operating system specific error code are - you guessed it -
operating system specific, the value in <tt/_oserror/ and the message that is
printed depends on the cc65 target.
<tag/Description/The function initializes the random number generator with
a seed derived from fast changing hardware events, so the seed itself can be
considered random to a certain degree.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The randomness of the seed depends on the machine hardware.
</itemize>
<tag/Availability/cc65
<tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
<tag/Description/<tt/_stroserror/ will return a string describing the given
operating system specific error code.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Since operating system specific error code are - you guessed it -
operating system specific, the parameter and the string returned depend on the
cc65 target.
<tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
<tt/size/ bytes in size.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The memory areas may not overlap, otherwise the results are undefined.
<item>The function is only available as fastcall function, so it may only be
used in presence of a prototype.
registers and the CPU flags are set to the values given in the <tt/regs/
structure. On return from the subroutine, the new values of the registers and
flags are stored back overwriting the old values.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
when calling the subroutine (they are unchanged from their current values).
<item>The function is only available as fastcall function, so it may only be
<tag/Declaration/<tt/void BRK (void);/
<tag/Description/The function will insert a 6502 BRK instruction into the code
which may be used to trigger a debugger.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is actually a macro.
<item>The inserted instruction may lead to unexpected results if no debugger
is present.
<tag/Description/The function will insert a 6502 CLI instruction into the code,
so interrupts are enabled. Enabling interrupts has no effects if they are
already enabled (the default).
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is actually a macro.
<item>Disabling interrupts may lead to unexpected results.
</itemize>
<tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
<tag/Description/The function will read the absolute memory given by <tt/addr/
and return the value read.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is actually a macro.
<item>This function depends highly on the platform and environment.
</itemize>
<tag/Description/The function will read the absolute memory given by <tt/addr/
and return the value read. The byte read from the higher address is the high
byte of the return value.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is actually a macro.
<item>This function depends highly on the platform and environment.
<item>The order in which the two bytes are read is unspecified and may
<tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
<tag/Description/The function writes the value <tt/val/ to the absolute
memory address given by <tt/addr/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is actually a macro.
<item>This function depends highly on the platform and environment.
<item>Careless use will cause the program to act strange or may crash the
<tag/Description/The function writes the value <tt/val/ to the absolute
memory address given by <tt/addr/. The low byte of <tt/val/ is written to
the <tt/addr/, the high byte is written to <tt/addr+1/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is actually a macro.
<item>This function depends highly on the platform and environment.
<item>Careless use will cause the program to act strange or may crash the
<tag/Description/The function will insert a 6502 SEI instruction into the code,
so interrupts are disabled. Note that non maskable interrupts cannot be
disabled.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is actually a macro.
<item>Disabling interrupts may lead to unexpected results.
</itemize>
<tag/Declaration/<tt/int __fastcall__ abs (int v);/
<tag/Description/<tt/abs/ returns the absolute value of the argument passed to
the function.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
<item>The function is only available as fastcall function, so it may only be
used in presence of a prototype.
<tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
statement. If the condition evaluates t zero (false), assert prints a message
on stderr and aborts the program.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is actually a macro.
</itemize>
<tag/Availability/ISO 9899
terminates, they are called in LIFO order (the last function registered is
called first). <tt/atexit/ returns zero on success and a nonzero value on
failure.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>A maximum of 5 exit functions can be registered.
<item>There is no way to unregister an exit function.
<item>The function is only available as fastcall function, so it may only be
<tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
<tag/Declaration/<tt/void __fastcall__ atmos_load(const char* name);/
<tag/Description/<tt/atmos_load/ reads a memory block from tape.
+<tag/Notes/<itemize>
+<item>The function is available only as a fastcall function; so, it may be used
+only in the presence of a prototype.
+</itemize>
<tag/Availability/cc65
<tag/See also/
<ref id="atmos_save" name="atmos_save">
<tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
<tag/Declaration/<tt/void __fastcall__ atmos_save(const char* name, const void* start, const void* end);/
<tag/Description/<tt/atmos_save/ writes a memory block to tape.
+<tag/Notes/<itemize>
+<item>The function is available only as a fastcall function; so, it may be used
+only in the presence of a prototype.
+</itemize>
<tag/Availability/cc65
<tag/See also/
<ref id="atmos_load" name="atmos_load">
<tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
<tag/Description/<tt/atoi/ converts the given string into an integer.
Conversion stops as soon as any invalid character is encountered.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>There is no way to detect any conversion errors.
<item>The function does not check for an numerical overflow when converting.
<item>The function is only available as fastcall function, so it may only be
<tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
<tag/Description/<tt/atol/ converts the given string into a long integer.
Conversion stops as soon as any invalid character is encountered.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>There is no way to detect any conversion errors.
<item>The function does not check for an numerical overflow when converting.
<item>The function is only available as fastcall function, so it may only be
<tag/Description/The function will set a new background color and return the
old (current) one. The background color is valid for the whole text output
area of the screen, not just for new text.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Background colors are system dependent. The function may have no effect
on systems where the background color cannot be changed.
<item>The function is only available as fastcall function, so it may only be
<tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
<tag/Description/The function will set a new border color. It returns the old
(current) border color.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Border colors are system dependent. The function may have no effect
on systems where the border color cannot be changed.
<item>The function is only available as fastcall function, so it may only
<tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
<tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
const void* base, size_t n, size_t size,
-int (*cmp) (const void*, const void*));/
+int __fastcall__ (* cmp) (const void*, const void*));/
<tag/Description/<tt/bsearch/ searches a sorted array for a member that
matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
<tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
the function used to compare the members against the key. The function returns
a pointer to the member found, or <tt/NULL/ if there was no match.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The contents of the array must be sorted in ascending order according to
the compare function given.
<item>If there are multiple members that match the key, the function will
return one of the members.
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
+<item>The function to which <tt/cmp/ points must have the <tt/fastcall/ calling
+convention.
</itemize>
<tag/Availability/ISO 9899
<tag/See also/
<tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
<tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
zero.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The function is non standard and therefore only available in non ANSI
mode. You should use <tt/<ref id="memset" name="memset">/ instead.
<item>The function is only available as fastcall function, so it may only
<tag/Header/<tt/<ref id="c128.h" name="c128.h">/
<tag/Declaration/<tt/void c64mode (void);/
<tag/Description/The function will cause the machine to reboot into C64 mode.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is specific to the C128.
<item>The function will not return to the caller.
</itemize>
of size <tt/size/, clears the whole block with binary zeroes and returns a
pointer to it. On error (not enough memory available), <tt/calloc/ returns
<tt/NULL/.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>Clearing the memory may not have the expected effect on all platforms:
pointers in the block may not be <tt/NULL/ and floating point variables may
not be zero (0.0). In other words: The "clearing" effect of this function
</quote>
+<sect1>cbm_k_acptr<label id="cbm_k_acptr"><p>
+
+<quote>
+<descrip>
+<tag/Function/Input byte from serial bus
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/unsigned char cbm_k_acptr (void);/
+<tag/Description/The function returns a byte of data, which it
+gets from the current TALKer on the serial bus.
+In order to receive the data, the device must have previously been
+sent a command to TALK and a secondary address if it needs one.
+<tag/Notes/<itemize>
+<item>
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_talk" name="cbm_k_talk">,
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>cbm_k_basin<label id="cbm_k_basin"><p>
+
+<quote>
+<descrip>
+<tag/Function/Input a Character from the Current Device
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/unsigned char cbm_k_basin (void);/
+<tag/Description/The function returns a character from the current input device.
+Device must first have been OPENed and then designated as the input channel by the CHKIN routine.
+When this function is called, the next byte of data available from the device is returned.
+Exception is the routine for the keyboard device (which is the default input device).
+<tag/Notes/<itemize>
+<item>
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_open" name="cbm_k_open">,
+<ref id="cbm_k_chkin" name="cbm_k_chkin">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>cbm_k_bsout<label id="cbm_k_bsout"><p>
+
+<quote>
+<descrip>
+<tag/Function/Output a byte
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/void __fastcall__ cbm_k_bsout (unsigned char C);/
+<tag/Description/Function sends the character to the current output device.
+Unless a device has been OPENed and designated as the
+current output channel using the CHKOUT routine, the character is
+printed to the screen, which is the default output device. If the
+cassette is the current device, outputting a byte will only add it to
+the buffer. No actual transmission of data will occur until the
+192-byte buffer is full.
+<tag/Notes/<itemize>
+<item>The function is only available as fastcall function, so it may
+only be used in presence of a prototype.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_open" name="cbm_k_open">,
+<ref id="cbm_k_chkin" name="cbm_k_chkout">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>cbm_k_chkin<label id="cbm_k_chkin"><p>
+
+<quote>
+<descrip>
+<tag/Function/Designate a Logical File As the Current Input Channel
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_chkin (unsigned char FN);/
+<tag/Description/If you wish to
+get data from any device other than the keyboard, this function must be
+called after OPENing the device, before you can get a data byte with
+the cbm_k_basin or cbm_k_getin routine. When called, the routine will designate
+the logical file whose file number was supplied as the
+current file, its device as the current device, and its secondary
+address as the current secondary address. If the device on the
+channel is a serial device, which requires a TALK command and
+sometimes a secondary address, function will send them over the
+serial bus.
+<tag/Notes/<itemize>
+<item>The function is only available as fastcall function, so it may
+only be used in presence of a prototype.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_open" name="cbm_k_open">,
+<ref id="cbm_k_basin" name="cbm_k_basin">,
+<ref id="cbm_k_getin" name="cbm_k_getin">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>cbm_k_ciout<label id="cbm_k_ciout"><p>
+
+<quote>
+<descrip>
+<tag/Function/Transmit a byte over the serial bus
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/void __fastcall__ cbm_k_ciout (unsigned char C);/
+<tag/Description/Purpose of this function is to send a byte of data over
+the serial bus. In order for the data to be received, the serial
+device must have first been commanded to LISTEN and been given a
+secondary address if necessary. This routine always buffers the
+current character, and defers sending it until the next byte is
+buffered. When the UNLISTEN command is sent, the last byte will be
+sent with an End or Identify (EOI).
+<tag/Notes/<itemize>
+<item>The function is only available as fastcall function, so it may
+only be used in presence of a prototype.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_listen" name="cbm_k_listen">,
+<ref id="cbm_k_unlsn" name="cbm_k_unlsn">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>cbm_k_ckout<label id="cbm_k_ckout"><p>
+
+<quote>
+<descrip>
+<tag/Function/Designate a Logical File As the Current Output Channel
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_ckout (unsigned char FN);/
+<tag/Description/If you wish to
+output data to any device other than the screen, this routine must be
+called after OPENing the device, and before you output a data byte
+with the cbm_k_bsout() function. When called, the function will designate the
+logical file whose file number was supplied as the current
+file, its device as the current device, and its secondary address as
+the current secondary address. If the device on the channel uses the
+serial bus, and therefore requires a LISTEN command and possibly a
+secondary address, this information will be sent on the bus.
+<tag/Notes/<itemize>
+<item>The function is only available as fastcall function, so it may
+only be used in presence of a prototype.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_bsout" name="cbm_k_bsout">,
+<ref id="cbm_k_listen" name="cbm_k_listen">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>cbm_k_clall<label id="cbm_k_clall"><p>
+
+<quote>
+<descrip>
+<tag/Function/Close All Logical I/O Files
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/void cbm_k_clall (void);/
+<tag/Description/It closes all
+open files, by resetting the index into open files to
+zero and restores the default I/O devices.
+<tag/Notes/<itemize>
+<item>
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_open" name="cbm_k_open">,
+<ref id="cbm_k_close" name="cbm_k_close">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>cbm_k_close<label id="cbm_k_close"><p>
+
+<quote>
+<descrip>
+<tag/Function/Close a Logical I/O File
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/void __fastcall__ cbm_k_close (unsigned char FN);/
+<tag/Description/It is used to
+close a logical file after all I/O operations involving that file have
+been completed.
+<tag/Notes/<itemize>
+<item>The function is only available as fastcall function, so it may
+only be used in presence of a prototype.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_open" name="cbm_k_open">,
+<ref id="cbm_k_clall" name="cbm_k_clall">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>cbm_k_clrch<label id="cbm_k_clrch"><p>
+
+<quote>
+<descrip>
+<tag/Function/Restore Current Input and Output Devices to the Default Devices
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/void cbm_k_clrch (void);/
+<tag/Description/It sets the
+current input device to the keyboard, and the current output device to
+the screen. Also, if the current input device was formerly a serial
+device, the routine sends it an UNTALK command on the serial bus, and
+if a serial device was formerly the current output device, the routine
+sends it an UNLISTEN command.
+<tag/Notes/<itemize>
+<item>
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_chkin" name="cbm_k_chkin">,
+<ref id="cbm_k_ckout" name="cbm_k_ckout">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>cbm_k_getin<label id="cbm_k_getin"><p>
+
+<quote>
+<descrip>
+<tag/Function/Get One Byte from the Input Device
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/unsigned char cbm_k_getin (void);/
+<tag/Description/Function gets a character from the current input device.
+<tag/Notes/<itemize>
+<item>
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_basin" name="cbm_k_basin">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>cbm_k_iobase<label id="cbm_k_iobase"><p>
+
+<quote>
+<descrip>
+<tag/Function/Return Base Address of Memory-Mapped I/O Devices
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/unsigned cbm_k_iobase (void);/
+<tag/Description/This function returns the address of
+the memory section where the memory mapped I/O devices are located. This
+address can then be used with an offset to access the memory mapped I/O
+devices in the Commodore 64. The offset is the number of locations from
+the beginning of the page on which the I/O register you want is located.
+This function exists to provide compatibility between the Commodore 64,
+VIC-20, and future models of the Commodore 64. If the I/O locations for
+a program are set by a call to this function, they should
+still remain compatible with future versions of the Commodore 64, the
+KERNAL and BASIC.
+<tag/Notes/<itemize>
+<item>
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>cbm_k_listen<label id="cbm_k_listen"><p>
+
+<quote>
+<descrip>
+<tag/Function/Command a device on the serial bus to LISTEN
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/void __fastcall__ cbm_k_listen (unsigned char dev);/
+<tag/Description/This function will command a device on the serial bus to
+receive data. The KERNAL routine will OR the supplied device number bit by bit
+to convert it to a listen address, then transmits this data as a command on
+the serial bus. The specified device will then go into listen mode, and
+be ready to accept information.
+<tag/Notes/<itemize>
+<item>The function is only available as fastcall function, so it may
+only be used in presence of a prototype.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_unlsn" name="cbm_k_unlsn">,
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>cbm_k_load<label id="cbm_k_load"><p>
+
+<quote>
+<descrip>
+<tag/Function/Load RAM from a Device
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/unsigned int __fastcall__ cbm_k_load(unsigned char flag, unsigned addr);/
+<tag/Description/This function LOADs data bytes from any input device directly into the memory.
+It can also be used for a verify operation, comparing data from a device with the data already in
+memory, while leaving the data stored in RAM unchanged.
+The flag must be set to 0 for a LOAD operation, or 1 for a
+verify, If the input device is OPENed with a secondary address (SA) of 0
+the header information from the device is ignored. In this case, the starting address for the load must be supplied.
+If the device is addressed with a secondary address of 1, then the data is
+loaded into memory starting at the location specified by the header.
+Function returns the address of the highest RAM location loaded.
+Before this function can be called, the KERNAL SETLFS, and SETNAM
+routines must be called.
+<tag/Notes/<itemize>
+<item>The function is only available as fastcall function, so it may
+only be used in presence of a prototype.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_save" name="cbm_k_save">,
+<ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
+<ref id="cbm_k_setnam" name="cbm_k_setnam">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>cbm_k_open<label id="cbm_k_open"><p>
+
+<quote>
+<descrip>
+<tag/Function/Open a Logical I/O File
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/unsigned char cbm_k_open (void);/
+<tag/Description/This function assigns a logical file to a device, so that it can be used for
+Input/Output operations. In order to specify the logical file number,
+the device number, and the secondary address if any, the cbm_k_setlfs() function must first be called.
+Likewise, in order to designate the filename, the cbm_k_setnam() function must be used first. After these two
+functions are called, cbm_k_open() is then called.
+<tag/Notes/<itemize>
+<item>
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_close" name="cbm_k_close">,
+<ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
+<ref id="cbm_k_setnam" name="cbm_k_setnam">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>cbm_k_readst<label id="cbm_k_readst"><p>
+
+<quote>
+<descrip>
+<tag/Function/Read status word
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/unsigned char cbm_k_readst (void);/
+<tag/Description/This function returns the current status of the I/O devices. It is usually called after new communication to an I/O device and gives information about device status, or errors that have occurred during the I/O operation.
+<tag/Notes/<itemize>
+<item>
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>cbm_k_save<label id="cbm_k_save"><p>
+
+<quote>
+<descrip>
+<tag/Function/Save RAM to a Device
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_save(unsigned int start, unsigned int end)/
+<tag/Description/This function saves a section of memory. The cbm_k_setlfs() and cbm_k_setnam() functions must be
+used before calling this function. However, a file name is not required to
+SAVE to device 1 (the Datassette(TM) recorder). Any attempt to save to
+other devices without using a file name results in an error. NOTE: Device 0 (the keyboard), device 2 (RS-232), and device 3 (the screen) cannot be SAVEd to. If the attempt is made, an error occurs, and the SAVE is stopped.
+<tag/Notes/<itemize>
+<item>The function is only available as fastcall function, so it may
+only be used in presence of a prototype.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_load" name="cbm_k_load">,
+<ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
+<ref id="cbm_k_setnam" name="cbm_k_setnam">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>cbm_k_scnkey<label id="cbm_k_scnkey"><p>
+
+<quote>
+<descrip>
+<tag/Function/Scan the keyboard matrix.
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/void cbm_k_scnkey (void);/
+<tag/Description/This function looks at the switches in the keyboard, to see
+if any of them are being pressed. If they are, then code numbers for them are
+stored in RAM. Other functions use those numbers to input text. Normally,
+the keyboard is scanned by the Kernal's Interrupt Service Routine. But, if
+you divert the "Jiffy interrupt" to a C-code ISR, then that ISR must call this
+function, in order to provide input from the keyboard.
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_getin" name="cbm_k_getin">,
+<ref id="cbm_k_udtim" name="cbm_k_udtim">,
+<ref id="cgetc" name="cgetc">,
+<!-- <ref id="getc" name="getc"> -->
+<!-- <ref id="getchar" name="getchar"> -->
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>cbm_k_setlfs<label id="cbm_k_setlfs"><p>
+
+<quote>
+<descrip>
+<tag/Function/Set up a logical file
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/void __fastcall__ cbm_k_setlfs (unsigned char LFN, unsigned char DEV, unsigned char SA);/
+<tag/Description/This functions sets up the logical file by setting its number, device address,
+and secondary address.
+<tag/Notes/<itemize>
+<item>The function is only available as fastcall function, so it may
+only be used in presence of a prototype.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_setnam" name="cbm_k_setnam">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>cbm_k_setnam<label id="cbm_k_setnam"><p>
+
+<quote>
+<descrip>
+<tag/Function/Set Filename Parameters
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/void __fastcall__ cbm_k_setnam (const char* Name);/
+<tag/Description/This function is used to set up the file name for the OPEN,
+SAVE, or LOAD operations.
+<tag/Notes/<itemize>
+<item>The function is only available as fastcall function, so it may
+only be used in presence of a prototype.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_open" name="cbm_k_open">,
+<ref id="cbm_k_load" name="cbm_k_load">,
+<ref id="cbm_k_save" name="cbm_k_save">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>cbm_k_talk<label id="cbm_k_talk"><p>
+
+<quote>
+<descrip>
+<tag/Function/Commands device to TALK
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/void __fastcall__ cbm_k_talk (unsigned char dev);/
+<tag/Description/When called, it ORs the device number with the TALK code (64, $40) and sends it on the serial
+bus. This commands the device to TALK.
+<tag/Notes/<itemize>
+<item>The function is only available as fastcall function, so it may
+only be used in presence of a prototype.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_acptr" name="cbm_k_acptr">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>cbm_k_udtim<label id="cbm_k_udtim"><p>
+
+<quote>
+<descrip>
+<tag/Function/Update the Jiffy clock.
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/void cbm_k_udtim (void);/
+<tag/Description/This function adds one count to the Jiffy clock. That clock
+counts sixtieths of a second. It is used by the library's <tt/clock()/
+function. Normally, the Jiffy clock is updated by the Kernal's Interrupt
+Service Routine. But, if you divert the "Jiffy interrupt" to a C-code ISR,
+then that ISR must call this function, in order to keep the clock valid.
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
+<ref id="clock" name="clock">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>cbm_k_unlsn<label id="cbm_k_unlsn"><p>
+
+<quote>
+<descrip>
+<tag/Function/Send an UNLISTEN command
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/void cbm_k_unlsn (void);/
+<tag/Description/This function commands all devices on the serial bus to
+stop receiving data from the host computer (i.e., UNLISTEN). Calling this
+function results in an UNLISTEN command being transmitted on the serial
+bus. Only devices previously commanded to LISTEN are affected. This
+function is normally used after the host computer is finished sending data
+to external devices. Sending the UNLISTEN commands the listening devices
+to get off the serial bus so it can be used for other purposes.
+<tag/Notes/<itemize>
+<item>
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_listen" name="cbm_k_listen">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
<sect1>cclear<label id="cclear"><p>
<quote>
<tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
<tag/Description/The function clears part of a line by writing <tt/length/
spaces in the current text color.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may
only be used in presence of a prototype.
</itemize>
<tag/Description/The function moves the cursor to a specific position, and
will then clear part of the line by writing <tt/length/ spaces in the current
text color.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may
only be used in presence of a prototype.
</itemize>
<tag/Header/<tt/<ref id="conio.h" name="conio.h">/
<tag/Declaration/<tt/char cgetc (void);/
<tag/Description/The function reads a character from the keyboard. If there is
-no character available, <tt/cgetc/ waits until the user presses a key. If the
+no character available, <tt/cgetc()/ waits until the user presses a key. If the
cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
displayed while waiting.
-<tag/Limits/<itemize>
-<item>If the system supports a keyboard buffer, <tt/cgetc/ will fetch a key
-from this buffer and wait only if the buffer is empty.
+<tag/Notes/<itemize>
+<item>If the system supports a keyboard buffer, <tt/cgetc()/ will fetch a key
+from that buffer; and, wait only if the buffer is empty.
+<item>The keyboard must be scanned periodically, in order for this function to
+see anything that you type. (See the description of <tt/cbm_k_scnkey()/.)
</itemize>
<tag/Availability/cc65
<tag/See also/
+<ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
<ref id="cursor" name="cursor">,
<ref id="kbhit" name="kbhit">
<tag/Example/None.
<tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
<tag/Description/The function outputs a horizontal line with the given length
starting at the current cursor position.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The character used to draw the horizontal line is system dependent.
If available, a line drawing character is used. Drawing a line that is partially
off screen leads to undefined behaviour.
<tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
<tag/Description/The function outputs a horizontal line with the given length
starting at a given position.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The character used to draw the horizontal line is system dependent.
If available, a line drawing character is used. Drawing a line that is partially
off screen leads to undefined behaviour.
<tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
<tag/Description/<tt/clearerr/ clears the error and end-of-file status
indicators for the stream <tt/f/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only be
used in presence of a prototype.
</itemize>
<tag/Header/<tt/<ref id="time.h" name="time.h">/
<tag/Declaration/<tt/clock_t clock (void);/
<tag/Description/The <tt/clock/ function returns an approximaton of processor
-time used by the program. The time is returned in implementation defined
+time used by the program. The time is returned in implementation-defined
units. It can be converted to seconds by dividing by the value of the macro
<tt/CLOCKS_PER_SEC/.
-<tag/Limits/<itemize>
-<item>Since the machines, cc65 generated programs run on, cannot run multiple
-processes, the function will actually return the time since some
-implementation defined point in the past.
+<tag/Notes/<itemize>
+<item>Since the machines that cc65-generated programs run on cannot run multiple
+processes, the function actually will return the time since some
+implementation-defined point in the past.
+<item>The Jiffy clock must be "running", in order for this function to return
+changing values. (See the description of <tt/cbm_k_udtim()/.)
</itemize>
<tag/Availability/ISO 9899
<tag/See also/
+<ref id="cbm_k_udtim" name="cbm_k_udtim">,
<ref id="time" name="time">
<tag/Example/None.
</descrip>
<tag/Description/The function closes the given file descriptor. It returns zero
on success and -1 on error. If an error occurs, the cause can be determined by
reading the <tt/errno/ variable.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Description/The function closes the given directory descriptor. It returns
zero on success and -1 on error. If an error occurs, the cause can be determined
by reading the <tt/errno/ variable.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Description/<tt/creat/ creates a new file and returns the file descriptor
associated with it. On error, -1 is returned and an error code is stored in
<tt/errno/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
<tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
<item>The function is only available as fastcall function, so it may only
formatted according to the format string given. The resulting string is output
to the console. <tt/cprintf/ supports the same format specifiers as
<tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
between <tt/\r/ and <tt/\n/.
</itemize>
<tag/Declaration/<tt/void __fastcall__ cputc (char c);/
<tag/Description/Output one character to the console at the current cursor
position.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
between <tt/\r/ and <tt/\n/.
<item>The function is only available as fastcall function, so it may only
<tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
<tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
the screen and outputs one character.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
between <tt/\r/ and <tt/\n/.
<item>The function is only available as fastcall function, so it may only
<tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
<tag/Description/The function outputs the given string on the console at the
current cursor position.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
between <tt/\r/ and <tt/\n/.
<item>The function is only available as fastcall function, so it may only
<tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
<tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
and outputs the string <tt/s/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
between <tt/\r/ and <tt/\n/.
<item>The function is only available as fastcall function, so it may only
<tag/Description/If the argument to the function is non zero, a blinking cursor
will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
<tag/Description/The function outputs a vertical line with the given length
starting at the current cursor position.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The character used to draw the vertical line is system dependent.
If available, a line drawing character is used. Drawing a line that is partially
off screen leads to undefined behaviour.
<tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
<tag/Description/The function outputs a vertical line with the given length
starting at a given position.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The character used to draw the vertical line is system dependent.
If available, a line drawing character is used. Drawing a line that is partially
off screen leads to undefined behaviour.
</quote>
+<sect1>decompress_lz4<label id="decompress_lz4"><p>
+
+<quote>
+<descrip>
+<tag/Function/Uncompress a LZ4-compressed buffer.
+<tag/Header/<tt/<ref id="lz4.h" name="lz4.h">/
+<tag/Declaration/<tt/void decompress_lz4 (const unsigned char* src, unsigned char* const dst, const unsigned short uncompressed_size);/
+<tag/Description/<tt/decompress_lz4/ uncompresses a LZ4-compressed buffer.
+<tag/Notes/<itemize>
+<item>Use LZ4_compress_HC with compression level 16 for best compression.
+</itemize>
+<tag/Availability/cc65
+<tag/Example/None.
+</descrip>
+</quote>
+
+
<sect1>div<label id="div"><p>
<quote>
<tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
<tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
quotient and remainder in a <tt/div_t/ structure.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
</quote>
+<sect1>doesclrscrafterexit<label id="doesclrscrafterexit"><p>
+
+<quote>
+<descrip>
+<tag/Function/Determines whether the screen is going to be cleared after program exit.
+<tag/Header/<tt/<ref id="cc65.h" name="cc65.h">/
+<tag/Declaration/<tt/unsigned char doesclrscrafterexit (void);/
+<tag/Description/The function returns zero if the screen won't be cleared immediately after
+program termination. It returns a non-zero value if it will.
+<tag/Notes/<itemize>
+<item>Some systems, maybe depending on configuration, immediately clear the screen
+after a program exits. Therefore it might be difficult to read
+the last messages printed by the program prior to its exit. This function can be used
+to decide if a delay or wait for a key press should be executed when then program
+exits.
+</itemize>
+<tag/Availability/cc65
+<tag/Example/<verb>
+/* Hello World */
+#include <stdio.h>
+#include <unistd.h>
+#include <cc65.h>
+int main(void)
+{
+ printf("Hello World\n");
+ if (doesclrscrafterexit())
+ sleep(5);
+ return 0;
+}
+</verb>
+</descrip>
+</quote>
+
+
<sect1>em_commit<label id="em_commit"><p>
<quote>
if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
<tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
name="em_copyto">/ are called without calling <tt/em_commit/ first.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Calling <tt/em_commit/ does not necessarily mean that changes to the
memory window are discarded, it does just mean that the drivers is allowed
to discard it.
<tag/Description/Copy data from extended memory into linear memory. Source and
target addresses as well as the number of bytes to transfer are specified in
the <tt/em_copy/ structure that is passed as a parameter.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
made any changes to the data in the window, call <tt/<ref id="em_commit"
name="em_commit">/ first, or the changes are lost.
<tag/Description/Copy data from linear into extended memory. Source and
target addresses as well as the number of bytes to transfer are specified in
the <tt/em_copy/ structure that is passed as a parameter.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
made any changes to the data in the window, call <tt/<ref id="em_commit"
name="em_commit">/ first, or the changes are lost.
<tag/Description/The function installs an already loaded extended memory driver
and returns an error code. The function may be used to install a driver linked
statically to the program.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Not all drivers are able to detect if the supported hardware is really
present.
<item>The function is only available as fastcall function, so it may only be
<tag/Description/Load an extended memory driver into memory and initialize
it. The function returns an error code that tells if all this has been
successful.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Not all drivers are able to detect if the supported hardware is really
present.
<item>The function is only available as fastcall function, so it may only be
because you're going to overwrite it completely), it is better to call
<tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
data if it is possible to avoid that.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Calling <tt/em_map/ will invalidate the memory window, so if you
made any changes to the data in the window, call <tt/<ref id="em_commit"
name="em_commit">/ first, or the changes are lost.
<tag/Declaration/<tt/unsigned em_pagecount (void);/
<tag/Description/The function returns the size of the extended memory supported
by the driver in 256 byte pages.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function returns zero if no extended memory driver is loaded.
<item>The function may return zero if the supported hardware was not detected.
</itemize>
<tag/Declaration/<tt/unsigned char em_uninstall (void);/
<tag/Description/The function uninstalls an already loaded extended memory
driver but doesn't remove it from memory.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>If the driver has been loaded using <tt/<ref id="em_load_driver"
name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
should be used instead of <tt/em_uninstall/ so the driver is also removed
<tag/Declaration/<tt/unsigned char em_unload (void);/
<tag/Description/The function unloads a loaded extended memory driver and
frees all memory allocated for the driver.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function does nothing if no driver is loaded.
</itemize>
<tag/Availability/cc65
<tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
actual memory window in the assumption that the existing data is wrong or
will get overwritten.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Calling <tt/em_use/ will invalidate the memory window, so if you
made any changes to the data in the window, call <tt/<ref id="em_commit"
name="em_commit">/ first, or the changes are lost.
name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
<tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
name="stdlib.h">/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>It depends on the host machine if the program return code can be
a <tt/NULL/ pointer may be passed as second parameter.
On success, the function does not return. On failure, -1 is returned and
<tt/errno/ contains an error code.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>On most platforms, the function needs to copy a small stub loader to
<tag/Declaration/<tt/void fast (void);/
<tag/Description/The function will switch the clock of the C128 to 2MHz. This
will nearly double the speed compared to slow mode.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is specific to the C128.
<item>2MHz clock will not work in 40 column mode.
</itemize>
<tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
<tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
<tt/f/, and returns a non zero value if it is set.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The indicator is set only after a read past the end of a file is
attempted.
<item>The function is only available as fastcall function, so it may only be
<tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
<tag/Description/<tt/ferror/ tests the error indicator of the stream
<tt/f/, and returns a non zero value if it is set.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only be
used in presence of a prototype.
</itemize>
<tag/Description/The <tt/fileno/ function returns the file handle used
internally by a C stream. This file handle (an integer) can be used as a
handle for the POSIX input/output functions.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only be
used in presence of a prototype.
<item>Mixing C file I/O functions and POSIX file I/O functions for the same
<tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
pointer is <tt/NULL/, no action is performed.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>Passing an already free'd block to <tt/free/ again will cause undefined
behaviour and may crash your program.
<item>The function is only available as fastcall function, so it may only
all supported targets. If it exists, it returns a number that identifies the
operating system or machine type, the program runs on. The machine dependent
header files define constants that can be used to check the return code.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function does not exist on all platforms.
<item>The return codes are platform dependent.
</itemize>
<item><tt/CPU_65C02/
<item><tt/CPU_65816/
</itemize>
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Other, more exotic CPU types are not disinguished.
</itemize>
<tag/Availability/cc65
matches <tt/name/ and returns its value. The environment consists of a list
of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
returns <tt/NULL/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>What exactly is stored in the environment depends on the machine the
program is running on.
<item>The function is only available as fastcall function, so it may only
found on the command line and <tt/EOF/ (-1) if there is no other option. An
option argument is placed in <tt/optarg/, the index of the next element on the
command line to be processed is placed in <tt/optind/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The implementation will not reorder options. A non option on the command
line will terminate option processing. All remaining arguments are not
recognized as options, even if the start with a '-' character.
<tag/Description/The function moves the text mode cursor to the specified X
position while leaving the Y position untouched. The leftmost position on the
screen has the coordinate 0.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may
only be used in presence of a prototype.
<item>Invalid values for the X position (out of screen coordinates) may
<tag/Description/The function moves the text mode cursor to the specified
position. The leftmost position on the screen has the X coordinate 0, the
topmost line has the Y coordinate 0.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only be
used in presence of a prototype.
<item>Invalid values for any of both coordinates (out of screen positions) may
<tag/Description/The function moves the text mode cursor to the specified Y
position while leaving the X position untouched. The uppermost position on the
screen has the coordinate 0.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may
only be used in presence of a prototype.
<item>Invalid values for the Y position (out of screen coordinates) may lead
<tag/Description/The function returns a non zero value if the given argument
is a letter or digit. The return value is zero if the character is anything
else.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>When compiling with <tt/-Os/ the function is actually a macro. The
inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
+outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
this range. The non inline function may be accessed by <tt/#undef/'ing
the macro.
<item>When compiling without <tt/-Os/, the function is only available as
<tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
<tag/Description/The function returns a non zero value if the given argument
is a letter. The return value is zero if the character is anything else.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>When compiling with <tt/-Os/ the function is actually a macro. The
inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
+outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
this range. The non inline function may be accessed by <tt/#undef/'ing the
macro.
<item>When compiling without <tt/-Os/, the function is only available as
<tag/Declaration/<tt/int __fastcall__ isascii (int c);/
<tag/Description/The function returns a non zero value if the given argument
is in the range 0..127 (the range of valid ASCII characters) and zero if not.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>When compiling with <tt/-Os/ the function is actually a macro. The
inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
+outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
this range. The non inline function may be accessed by <tt/#undef/'ing the
macro.
<item>When compiling without <tt/-Os/, the function is only available as
<tag/Description/The function returns a non zero value if the given argument
is a space or tab character. The return value is zero if the character is
anything else.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>When compiling with <tt/-Os/ the function is actually a macro. The
inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
+outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
this range. The non inline function may be accessed by <tt/#undef/'ing the
macro.
<item>When compiling without <tt/-Os/, the function is only available as
fastcall function, so it may only be used in presence of a prototype.
</itemize>
-<tag/Availability/cc65
+<tag/Availability/ISO 9899
<tag/See also/
<ref id="isalnum" name="isalnum">,
<ref id="isalpha" name="isalpha">,
<tag/Description/The function returns a non zero value if the given argument
is a control character. The return value is zero if the character is anything
else.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>When compiling with <tt/-Os/ the function is actually a macro. The
inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
+outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
this range. The non inline function may be accessed by <tt/#undef/'ing the
macro.
<item>When compiling without <tt/-Os/, the function is only available as
<tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
<tag/Description/The function returns a non zero value if the given argument
is a digit. The return value is zero if the character is anything else.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>When compiling with <tt/-Os/ the function is actually a macro. The
inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
+outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
this range. The non inline function may be accessed by <tt/#undef/'ing the
macro.
<item>When compiling without <tt/-Os/, the function is only available as
<tag/Description/The function returns a non zero value if the given argument
is a printable character with the exception of space. The return value is zero
if the character is anything else.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>When compiling with <tt/-Os/ the function is actually a macro. The
inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
+outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
this range. The non inline function may be accessed by <tt/#undef/'ing the
macro.
<item>When compiling without <tt/-Os/, the function is only available as
<tag/Description/The function returns a non zero value if the given argument
is a lower case letter. The return value is zero if the character is anything
else.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>When compiling with <tt/-Os/ the function is actually a macro. The
inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
+outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
this range. The non inline function may be accessed by <tt/#undef/'ing the
macro.
<item>When compiling without <tt/-Os/, the function is only available as
<tag/Description/The function returns a non zero value if the given argument
is a printable character (this includes the space character). The return value
is zero if the character is anything else.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>When compiling with <tt/-Os/ the function is actually a macro. The
inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
+outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
this range. The non inline function may be accessed by <tt/#undef/'ing the
macro.
<item>When compiling without <tt/-Os/, the function is only available as
<tag/Description/The function returns a non zero value if the given argument
is a printable character, but not a space or anything alphanumeric. The return
value is zero if the character is anything else.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>When compiling with <tt/-Os/ the function is actually a macro. The
inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
+outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
this range. The non inline function may be accessed by <tt/#undef/'ing the
macro.
<item>When compiling without <tt/-Os/, the function is only available as
<quote>
<descrip>
-<tag/Function/Check if a given character is a a white-space character.
+<tag/Function/Check if a given character is a white-space character.
<tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
<tag/Declaration/<tt/int __fastcall__ isspace (int c);/
<tag/Description/The function returns a non zero value if the given argument
anything else. The standard white space characters are: space, formfeed ('\f'),
newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
('\v').
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>When compiling with <tt/-Os/ the function is actually a macro. The
inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
+outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
this range. The non inline function may be accessed by <tt/#undef/'ing the
macro.
<item>When compiling without <tt/-Os/, the function is only available as
<tag/Description/The function returns a non zero value if the given argument
is an upper case letter. The return value is zero if the character is anything
else.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>When compiling with <tt/-Os/ the function is actually a macro. The
inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
+outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
this range. The non inline function may be accessed by <tt/#undef/'ing the
macro.
<item>When compiling without <tt/-Os/, the function is only available as
<tag/Description/The function returns a non zero value if the given argument
is a hexadecimal digit (0..9, a..f and A..F). The return value is zero if the
character is anything else.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>When compiling with <tt/-Os/ the function is actually a macro. The
inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
+outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
this range. The non inline function may be accessed by <tt/#undef/'ing the
macro.
<item>When compiling without <tt/-Os/, the function is only available as
<tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
<tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
<tt/radix/ as the base.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>There are no provisions to prevent a buffer overflow.
<item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
<item>The function is non standard, so it is not available in strict ANSI mode.
<tag/Declaration/<tt/unsigned char joy_count (void);/
<tag/Description/The function returns a the number of joysticks supported
by the current joystick driver.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>A joystick driver must be loaded using <ref id="joy_load_driver"
name="joy_load_driver"> before calling this function.
<item>The function returns the number of joysticks supported by the driver.
<tag/Description/The function installs a driver that was already loaded into
memory (or linked statically to the program). It returns an error code
(<tt/JOY_ERR_OK/ in case of success).
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only be
used in presence of a prototype.
</itemize>
<tag/Description/The function loads a driver with the given name from disk
and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
driver was successfully loaded and installed.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only be
used in presence of a prototype.
</itemize>
<tag/Description/The function reads the status bits for a joystick. The number
of the joystick is passed as parameter. The result may be examined by using one
of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>A joystick driver must be loaded using <ref id="joy_load_driver"
name="joy_load_driver"> before calling this function.
<item>The function is only available as fastcall function, so it may only be
<tag/Description/The function uninstalls the currently installed joystick
driver. It does not remove the driver from memory. The function returns an
error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>A joystick driver must be installed using <ref id="joy_install"
name="joy_install"> before calling this function.
</itemize>
<tag/Description/The function uninstalls the currently installed joystick
driver and removes it from memory. An error code is returned, which is
<tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>A joystick driver must be loaded using <ref id="joy_load_driver"
name="joy_load_driver"> before calling this function.
</itemize>
<tag/Declaration/<tt/unsigned char kbhit (void);/
<tag/Description/The function returns a value of zero if there is no character
waiting to be read from the keyboard. It returns non zero otherwise.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>If the system does not support a keyboard buffer (most systems
do), the function is rather useless.
</itemize>
</quote>
+<sect1>kbrepeat<label id="kbrepeat"><p>
+
+<quote>
+<descrip>
+<tag/Function/Set the keyboard repeat mode.
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/unsigned char __fastcall__ kbrepeat (unsigned char mode);/
+<tag/Description/This function changes which keys have automatic repeat when
+being held down for a certain time. Possible values are <tt/KBREPEAT_CURSOR/
+(repeat only cursor-related keys), <tt/KBREPEAT_NONE/ (no repeat for any
+keys), and <tt/KBREPEAT_ALL/ (repeat all keys). The old mode is returned, so
+it can be restored later.
+<tag/Notes/<itemize>
+<item>The function is available only as a fastcall function; so, it may be used
+only in the presence of a prototype.
+</itemize>
+<tag/Availability/cc65
+<tag/Example/None.
+</descrip>
+</quote>
+
+
<sect1>labs<label id="labs"><p>
<quote>
<tag/Declaration/<tt/long __fastcall__ labs (long v);/
<tag/Description/<tt/labs/ returns the absolute value of the argument passed to
the function.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
<item>The function is only available as fastcall function, so it may only be
used in presence of a prototype.
<tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
<tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
using <tt/radix/ as the base.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>There are no provisions to prevent a buffer overflow.
<item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
<item>The function is non standard, so it is not available in strict ANSI mode.
<tag/Declaration/<tt/struct lconv* localeconv (void);/
<tag/Description/<tt/localeconv/ returns a pointer to the current locale
structure.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>cc65 supports only the "C" locale, so even after setting a new locale
using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
always be the same.
<tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
<tt/retval/.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>If the parameter <tt/retval/ is zero, the function will behave as if it
was called with a value of one.
<item>The function is only available as fastcall function, so it may only
<tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
pointer to the allocated memory block. On error (not enough memory available),
<tt/malloc/ returns <tt/NULL/.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
(converted to a char) in the block of raw memory string pointed to by <tt/mem/
that is of size <tt/count/. Upon completion, the function returns a pointer to
the character found, or a null pointer if the character was not found.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
pointed to by <tt/p1/ into the memory area pointed to by <tt/p2/. It returns a value that is less than
zero if <tt/p1/ is less than <tt/p2/, zero if <tt/p1/ is the same as <tt/p2/,
and a value greater than zero if <tt/p1/ is greater than <tt/p2/.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
<tt/dest/.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The result is undefined if the memory areas do overlap. Use
<tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
<item>The function is only available as fastcall function, so it may only
<tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
<tt/dest/.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>While <tt/memmove/ allows the memory areas to overlap, it has some
additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
<item>The function is only available as fastcall function, so it may only
<tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
<tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
the value <tt/val/. The function returns <tt/p/.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
<tag/Description/The function will free a module loaded into memory by use of
the <tt/<ref id="mod_load" name="mod_load">/ function.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The pointer passed as parameter is the pointer to the module memory,
not the pointer to the control structure.
+<item>The function is available only as a fastcall function; so, it may be used
+only in the presence of a prototype.
</itemize>
<tag/Availability/cc65
<tag/See also/
<descrip>
<tag/Function/Load a relocatable module.
<tag/Header/<tt/<ref id="modload.h" name="modload.h">/
-<tag/Declaration/<tt/unsigned char mod_load (struct mod_ctrl* ctrl);/
+<tag/Declaration/<tt/unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl);/
<tag/Description/The function will load a code module into memory and relocate
it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
<item><tt/MLOAD_ERR_FMT/ - Data format error
<item><tt/MLOAD_ERR_MEM/ - Not enough memory
</itemize>
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
relocatable o65 modules for use with this function.
+<item>The function is available only as a fastcall function; so, it may be used
+only in the presence of a prototype.
</itemize>
<tag/Availability/cc65
<tag/See also/
<tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
<tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
<tag/Description/The function allows to set a bounding box for mouse movement.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function does not check if the mouse cursor is currently within the
given rectangle. Placing the mouse cursor within the bounding box is the
responsibility of the programmer.
<tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
<tag/Description/The function queries the current bounding box for mouse
movement.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only be
used in presence of a prototype.
</itemize>
code);/
<tag/Description/The function returns an error message (in english) for the
error code passed parameter.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function will return "Unknown error" for invalid error codes.
<item>The function is only available as fastcall function, so it may only be
used in presence of a prototype.
<tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
<tag/Description/The function returns the state of the mouse buttons and the
position of the mouse in the <tt/mouse_info/ structure passed as parameter.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
so if you just need the mouse position, call <tt/<ref id="mouse_pos"
name="mouse_pos">/ instead.
can live with these defaults (which are platform specific), just pass a
pointer to <tt/mouse_def_callbacks/. The function may be used to install a
driver linked statically to the program.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Not all drivers are able to detect if the supported hardware is really
present.
<item>After installing a driver, the mouse cursor is hidden.
function returns an error code. The purpose of this function is to allow
for driver specific extensions. See the documentation for a specific mouse
driver for supported ioctl calls.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Calling this function is non portable, because each driver may
implement different ioctl calls (or none at all).
<item>The function is only available as fastcall function, so it may only be
routines needed to move or hide/show the mouse pointer. Defaults for these
routines are supplied by the library, so if you can live with these defaults
(which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The driver is loaded by name, so currently you must know the type of
mouse that should be supported. There is no autodetect capability.
<item>Not all drivers are able to detect if the supported hardware is really
<tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
<tag/Description/The function updates the mouse position. If the mouse cursor
is visible, it is shown at the new position.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function does not check if the new position is within the bounding
box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
<item>The function is only available as fastcall function, so it may only be
<tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
<tag/Description/The function returns the position of the mouse in the
<tt/mouse_pos/ structure passed as parameter.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
name="mouse_info">/ instead.
<tag/Declaration/<tt/unsigned char mouse_uninstall (void);/
<tag/Description/The function uninstalls an already loaded mouse driver but
don't removes it from memory.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
should be used instead of <tt/mouse_uninstall/ so the driver is also removed
<descrip>
<tag/Function/Unload a mouse driver.
<tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
-<tag/Declaration/<tt/unsigned char __fastcall__ mouse_unload (void);/
+<tag/Declaration/<tt/unsigned char mouse_unload (void);/
<tag/Description/The function unloads a loaded mouse driver and frees all
memory allocated for the driver.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function does nothing if no driver is loaded.
</itemize>
<tag/Availability/cc65
<tag/Declaration/<tt/size_t offsetof (type, member);/
<tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
or <tt/union/ member.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is actually a macro.
</itemize>
<tag/Availability/ISO 9899
<tag/Description/<tt/open/ opens a file and returns the file descriptor
associated with it. On error, -1 is returned and an error code is stored in
<tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>POSIX specifies an additional <tt/mode/ argument that may be passed to
open, which is used as the permission mask when a new file is created. While
cc65 allows to pass this argument, it is ignored.
<tag/Description/<tt/opendir/ opens a directory and returns the direcory
descriptor associated with it. On error, NULL is returned and an error code is
stored in <tt/errno/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
<tag/Description/<tt/peekbsys/ reads one byte from the given address in the
system bank (bank 15) of the CBM PET-II machines and returns it.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>This function may be a macro depending on the compiler options. The
system bank (bank 15) of the CBM PET-II machines and returns it. Following
the usual 6502 conventions, the low byte is read from <tt/addr/, and the
high byte is read from <tt/addr+1/.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>The order in which the two bytes are read is undefined.
a blank. Then the error message for the current contents of <tt/errno/ is
printed followed by a newline. The message output is the same as returned by
<tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
<tag/Description/<tt/pokebsys/ writes one byte to the given address in the
system bank (bank 15) of the CBM PET-II machines.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
high byte is written to <tt/addr+1/.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>The order in which the two bytes are written is undefined.
<tag/Function/Sort an array.
<tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
<tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
-size_t size, int (*compare) (const void*, const void*));/
+size_t size, int __fastcall__ (* compare) (const void*, const void*));/
<tag/Description/<tt/qsort/ sorts an array according to a given compare
function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
is the number of elements, <tt/size/ the size of an element and <tt/compare/
the function used to compare the members.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>If there are multiple members with the same key, the order after calling
the function is undefined.
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
+<item>The function to which <tt/compare/ points must have the <tt/fastcall/
+calling convention.
</itemize>
<tag/Availability/ISO 9899
<tag/See also/
will be executed. If no handler has been installed, the default action for
the raised signal will be taken. The function returns zero on success,
nonzero otherwise.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Declaration/<tt/int rand (void);/
<tag/Description/The function returns a pseudo random number
between 0 and <tt/RAND_MAX/ (exclusive).
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
flow of numbers is generated.
<item>On startup, the function behaves as if <ref id="srand" name="srand">
and returns a pointer to it. If the end of directory is reached, or an error
occurs, NULL is returned. In case of errors, an error code is stored into
<tt/errno/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>The returned pointer may point to a statically allocated instance of
<tt/struct dirent/, so it may get overwritten by subsequent calls to
<tt/readdir/.
+<item>On several platforms, namely the CBMs and the Atari, the disk drives get
+confused when opening/closing files between directory reads. So for example a
+program that reads the list of files on a disk, and after each call to
+<tt/readdir/, opens the file to process it, will fail.<newline>
+Possible solutions are reading the directory into memory before processing the
+file list, or to reset the directory by seeking to the correct position after
+opening/closing a file:
+<verb>
+ seekdir (DIR, telldir (DIR));
+</verb>
+Platforms known to work without problems are: Apple.
</itemize>
<tag/Availability/POSIX 1003.1
<tag/See also/
behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
behaves as if <tt/free/ had been called. On error (not enough memory
available), <tt/realloc/ returns <tt/NULL/.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The part of the memory block that is returned will have its contents
unchanged.
<item>This function is somewhat dangerous to use. Be careful to save the
<tag/Description/<tt/remove/ deletes the file with the given name. On success,
zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
code describing the reason for the failure.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>This function is not available on all cc65 targets (depends on the
availability of file I/O).
<item>The function is only available as fastcall function, so it may only
<tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
code describing the reason for the failure.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>This function is not available on all cc65 targets (depends on the
capabilities of the storage devices).
<item>The function is only available as fastcall function, so it may only
<tag/Declaration/<tt/void reset_brk (void);/
<tag/Description/<tt/reset_brk/ resets the break vector to the value it had
before a call to <tt/set_brk/.
-<tag/Limits/
-<itemize>
-<item>Since <tt/<ref id="set_brk" name="set_brk">/ installs an exit handler,
-it is not strictly necessary to call this function as part of the cleanup when
-the program ends.
+<tag/Notes/<itemize>
+<item>The break vector is reset on program termination, so it's not strictly
+necessary to call this function as a part of your clean-up when exitting the program.
</itemize>
<tag/Availability/cc65
<tag/See also/
<tag/Header/<tt/<ref id="6502.h" name="6502.h">/
<tag/Declaration/<tt/void reset_irq (void);/
<tag/Description/<tt/reset_irq/ resets the C level interrupt request vector.
-<tag/Limits/
-<itemize>
-<item>The original IRQ vector is restored on program termination even without
-calling this function.
+<tag/Notes/<itemize>
+<item>The interrupt vector is reset on program termination, so it's not strictly
+necessary to call this function as a part of your clean-up when exitting the program.
</itemize>
<tag/Availability/cc65
<tag/See also/
<tag/Description/If the argument is non zero, the function enables reverse
character display. If the argument is zero, reverse character display is
switched off. The old value of the setting is returned.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function may not be supported by the hardware, in which case
the call is ignored.
<item>The function is only available as fastcall function, so it may only
<tag/Declaration/<tt/void __fastcall__ rewinddir (DIR* dir);/
<tag/Description/<tt/rewinddir/ sets the position of the directory stream
pointed to by <tt/dir/ to the start of the directory.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Header/<tt/<ref id="conio.h" name="conio.h">/
<tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
<tag/Description/The function returns the dimensions of the text mode screen.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Description/<tt/seekdir/ sets the position of the directory stream
pointed to by <tt/dir/ to the value given in <tt/offset/, which should be a
value returned by <tt/<ref id="telldir" name="telldir">/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<verb>
#include <serial.h>
-extern char comlynx[];
-
static void initialize(){
struct ser_params params = {
SER_BAUD_9600,
SER_PAR_MARK,
SER_HS_NONE
};
- ser_install(&comlynx); // This will activate the ComLynx
+ ser_install(lynx_comlynx); // This will activate the ComLynx
CLI();
ser_open(&params);
}
<tag/Description/Get a character from the serial port. If no characters are
available, the function will return SER_ERR_NO_DATA, so this is not a fatal
error.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Description/The function installs a driver that was already loaded into
memory (or linked statically to the program). It returns an error code
(<tt/SER_ERR_OK/ in case of success).
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only be
used in presence of a prototype.
</itemize>
<ref id="ser_uninstall" name="ser_uninstall">,
<ref id="ser_unload" name="ser_unload">
<tag/Example/<verb>
-extern char lynxser[]; //Include the driver statically instead of loading it.
-
-ser_install(&lynxser);
+ser_install(lynx_comlynx); //Include the driver statically instead of loading it.
</verb>
</descrip>
</quote>
<tag/Description/Some platforms have extra serial functions that are not
supported by standard serial driver functions. You can extend the driver to support
this extra functionality bt using ser_ioctl functions.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>These functions are not easily portable to other cc65 platforms.
<tag/Declaration/<tt/unsigned char __fastcall__ ser_load_driver (const char *name);/
<tag/Description/Load and install the driver by name.
Will just load the driver and check if loading was successful.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Header/<tt/<ref id="serial.h" name="serial.h">/
<tag/Declaration/<tt/unsigned char __fastcall__ ser_open (const struct ser_params* params);/
<tag/Description/Open the port by setting the port parameters and enable interrupts.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<verb>
#include <serial.h>
-extern char comlynx[];
-
static void initialize(){
struct ser_params params = {
SER_BAUD_9600,
SER_PAR_MARK,
SER_HS_NONE
};
- ser_install(&comlynx); // This will activate the ComLynx
+ ser_install(lynx_comlynx); // This will activate the ComLynx
CLI();
ser_open(&params);
}
<tag/Description/Send a character via the serial port. There is a transmit
buffer, but transmitting is not done via interrupt. The function returns
SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Header/<tt/<ref id="serial.h" name="serial.h">/
<tag/Declaration/<tt/unsigned char __fastcall__ ser_status (unsigned char* status);/
<tag/Description/Return the serial port status.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
program code by letting the vector point to a user written C function. The
runtime library installs a small stub that saves the registers into global
variables that may be accessed (and changed) by the break handler.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>The stub saves the zero page registers used by the C runtime and switches
<item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
the continue with the interrupted code, you have to adjust <tt/brk_pc/,
otherwise the <tt/BRK/ instruction will get executed over and over again.
-<item>Since <tt/set_brk/ installs an exit handler, it is not strictly necessary
-to call <tt/<ref id="reset_brk" name="reset_brk">/ as part of the cleanup when
-the program terminates.
+<item>The break vector is reset on program termination, so it's not strictly
+necessary to call <tt/<ref id="reset_brk" name="reset_brk">/ as a part of your
+clean-up when exitting the program.
</itemize>
<tag/Availability/cc65
<tag/See also/
return the value <tt/IRQ_HANDLED/ if and only if it has verified that the current
interrupt request actually stems from that source. In all other cases it must return
the value <tt/IRQ_NOT_HANDLED/.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>The stub saves the registers and zero page locations used by the C runtime
was interrupted. Be careful however not to call C library functions, and do not
enable stack checks for the handler function or any other function called from
it.
-<item>The interrupt vector is reset on function termination, so it's not
-strictly necessary to call <tt/<ref id="reset_irq" name="reset_irq">/ as part
-of the cleanup when the program terminates.
+<item>The interrupt vector is reset on program termination, so it's not strictly
+necessary to call <tt/<ref id="reset_irq" name="reset_irq">/ as a part of your
+clean-up when exitting the program.
</itemize>
<tag/Availability/cc65
<tag/See also/
<tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
returns zero.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item><tt/setjmp/ is actually a macro as required by the ISO standard.
<tag/Header/<tt/<ref id="locale.h" name="locale.h">/
<tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
<tag/Description/<tt/setlocale/ sets or queries the program's locale.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>cc65 supports only the "C" locale, so calling this function to set a
signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
previous value if the signal , or the special function vector SIG_ERR in
case of an error.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
<tag/Description/The function will return after the specified number of
seconds have elapsed.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Declaration/<tt/void slow (void);/
<tag/Description/The function will switch the clock of the C128 to 1MHz. This
will halve the speed compared to fast mode.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is specific to the C128.
</itemize>
<tag/Availability/C128
<tag/Description/The function initializes the random number generator using
the given seed. On program startup, the generator behaves as if <tt/srand/ has
been called with an argument of 1.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
as parameters without case sensitivity. It returns a value that is less than
zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>The function is not available in strict ANSI mode.
pointed to by s2 (including the terminating null byte) to the end of the
string pointed to by s1. The initial byte of s2 overwrites the null byte at
the end of s1.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>If copying takes place between objects that overlap, the behaviour
(converted to a char) in the string pointed to by <tt/s/. The terminating null
byte is considered to be part of the string. Upon completion, the function
returns a pointer to the byte, or a null pointer if the byte was not found.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
parameters. It returns a value that is less than zero if <tt/s1/ is less than
<tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
if <tt/s1/ is greater than <tt/s2/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
than zero if <tt/s1/ is greater than <tt/s2/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Description/The <tt/strcpy/ function copies the string pointed to by
<tt/s2/ (including the terminating null byte) into the array pointed to by
<tt/s1/. The function will always return <tt/s1/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>If copying takes place between objects that overlap, the behaviour
<tag/Description/The <tt/strcspn/ function computes and returns the length of
the substring pointed to by <tt/s/ which does <em>not</em> consist of
characters contained in the string <tt/set/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Availability/ISO 9899
<tag/See also/
+<ref id="strqtok" name="strqtok">,
<ref id="strspn" name="strspn">,
<ref id="strstr" name="strstr">,
<ref id="strtok" name="strtok">
to hold a copy of <tt/s/ including the terminating zero. If the allocation
fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
memory block, and a pointer to the block is returned.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>It is up to the caller to free the allocated memory block.
given error code. If an invalid error code is passed, the string "Unknown
error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
<tt/errno/ is left untouched.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>While the return type of the function is a <tt/char*/, the returned
parameters without case sensitivity. It returns a value that is less than zero
if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
value greater than zero if <tt/s1/ is greater than <tt/s2/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>The function is not available in strict ANSI mode.
<tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
<tag/Description/The <tt/strlen/ function computes the number of bytes in the
string to which s points, not including the terminating null byte.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>When compiling with <tt/-Os/ (inline known standard functions), the
<tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
<tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
function to each character of a string. The function will always return <tt/s/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>The function prototype is unavailable when compiling in strict ANSI mode.
of the string pointed to by s2 to the end of the string pointed to by s1. The
terminating null character at the end of s1 is overwritten. A terminating null
character is appended to the result, even if not all of s2 is appended to s1.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>If copying takes place between objects that overlap, the behaviour
less than zero if the first <tt/count/ characters of <tt/s1/ are less than
<tt/s2/, zero if they are identical, and a value greater than zero they are
greater.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<descrip>
<tag/Function/Copy part of a string.
<tag/Header/<tt/<ref id="string.h" name="string.h">/
-<tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2, size_t n);/
-<tag/Description/The <tt/strncpy/ function copies not more than n bytes from
+<tag/Declaration/<tt/char* __fastcall__ strncpy (char* s1, const char* s2, size_t n);/
+<tag/Description/The <tt/strncpy/ function copies not more than <tt/n/ bytes from
the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
-pointed to by <tt/s2/ is a string that is shorter than n bytes, null bytes are
+pointed to by <tt/s2/ is a string that is shorter than <tt/n/ bytes, null bytes are
appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
-written. The function will always return <tt/s1/.
-<tag/Limits/<itemize>
-<item>The function is only available as fastcall function, so it may only
-be used in presence of a prototype. If there is no null byte in the first <tt/n/
-bytes of the array pointed to by <tt/s2/, the result is not null-terminated.
+written. The function always will return <tt/s1/.
+<tag/Notes/<itemize>
+<item>The function is available only as a fastcall function; so, it may be used
+only in the presence of a prototype.
+<item>If there is no null byte in the first <tt/n/ bytes of the array pointed
+to by <tt/s2/, the result is <em/not/ null-terminated!
<item>If copying takes place between objects that overlap, the behaviour is
undefined.
</itemize>
<tag/Availability/ISO 9899
<tag/See also/
+<ref id="memcpy" name="memcpy">,
<ref id="strcat" name="strcat">,
<ref id="strcpy" name="strcpy">,
<ref id="strncat" name="strncat">
static char hello[6];
-strcpy (hello, "Hello world!\n", sizeof (hello) - 1);
-hello[5] = '\0';
+strncpy (hello, "Hello world!\n", sizeof hello - 1)[5] = '\0';
</verb>
</descrip>
</quote>
+<sect1>strqtok<label id="strqtok"><p>
+
+<quote>
+<descrip>
+<tag/Function/Break a string into tokens.
+<tag/Header/<tt/<ref id="string.h" name="string.h">/
+<tag/Declaration/<tt/char* __fastcall__ strqtok (char* s1, const char* s2);/
+<tag/Description/<tt/strqtok()/ will break the string <tt/s1/ into a sequence of
+tokens, which are delimited by either quotation marks or characters from the
+string <tt/s2/. Tokens inside quotation marks may contain characters from <tt/s2/
+(they aren't delimiters there). The first call to <tt/strqtok()/ will return a
+pointer to the first token in the string <tt/s1/. The following calls must pass
+a <tt/NULL/ pointer as <tt/s1/, in order to get the next token in the string.
+Different sets of delimiters may be used for the subsequent calls to <tt/strqtok()/.
+<tag/Notes/<itemize>
+<item>The function is available only as a fastcall function; so, it may be used
+only in the presence of a prototype.
+<item><tt/strqtok()/ will modify the string <tt/s1/.
+<item>The function will forget where it is in the <tt/s1/ string if it is given
+a second <tt/s1/ string before it finishes the first one.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="strcspn" name="strcspn">,
+<!-- <ref id="strpbrk" name="strpbrk">, -->
+<ref id="strspn" name="strspn">,
+<ref id="strtok" name="strtok">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
<sect1>strrchr<label id="strrchr"><p>
<quote>
(converted to a char) in the string pointed to by <tt/s/. The terminating null
byte is considered to be part of the string. Upon completion, the function
returns a pointer to the byte, or a null pointer if the byte was not found.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Description/The <tt/strspn/ function computes and returns the length of
the substring pointed to by <tt/s/ which does consist only of characters
contained in the string <tt/set/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Description/<tt/strstr/ searches for the first occurance of the string
<tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
otherwise it returns <tt/NULL/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Function/Break a string into tokens.
<tag/Header/<tt/<ref id="string.h" name="string.h">/
<tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
-<tag/Description/<tt/strtok/ will break the string s1 into a sequence of
-tokens, which are delimited by characters from the string s2. The first call
-to <tt/strtok/ will return a pointer to the first token in the string s1.
-Following calls must pass a <tt/NULL/ pointer as s1 in order to get the next
-token in the string. Different sets of delimiters may be used for the
-subsequent calls to <tt/strtok/.
-<tag/Limits/<itemize>
+<tag/Description/<tt/strtok()/ will break the string <tt/s1/ into a sequence of
+tokens, which are delimited by characters from the string <tt/s2/. The first call
+to <tt/strtok()/ will return a pointer to the first token in the string <tt/s1/.
+The following calls must pass a <tt/NULL/ pointer as <tt/s1/, in order to get
+the next token in the string. Different sets of delimiters may be used for the
+subsequent calls to <tt/strtok()/.
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
-<item><tt/strtok/ will modify the string s1.
+<item><tt/strtok()/ will modify the string <tt/s1/.
+<item>The function will forget where it is in the <tt/s1/ string if it is given
+a second <tt/s1/ string before it finishes the first one.
</itemize>
<tag/Availability/ISO 9899
<tag/See also/
<ref id="strcspn" name="strcspn">,
-<!-- <ref id="strpbrk" name="strpbrk"> -->
+<!-- <ref id="strpbrk" name="strpbrk">, -->
+<ref id="strqtok" name="strqtok">,
+<ref id="strspn" name="strspn">
<tag/Example/None.
</descrip>
</quote>
zero, corresponding to the result of the <tt/strcoll/ function applied to the
same two original strings. No more than n characters are placed into the
resulting array pointed to by s1, including the terminating null character.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
the behaviour is undefined.
<item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
<tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
<tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
function to each character of a string. The function will always return <tt/s/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>The function prototype is unavailable when compiling in strict ANSI mode.
<tag/Description/<tt/telldir/ returns the current position of a directory
stream. The return value may be used in subsequent calls to
<tt/<ref id="seekdir" name="seekdir">/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Description/The function will set a new text color. It returns the old
(current) text color. Text output using any <tt/conio.h/ function will use
the color set by this function.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Text colors are system dependent. The function may have no effect
on systems where the text color cannot be changed.
<item>The function is only available as fastcall function, so it may only
radii rx/ry using the current drawing color. The arc covers the angle
between sa and ea (startangle and endangle), which must be in the range
0..360.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>The function behaves unexpectedly or may crash if the angles are out
<tag/Declaration/<tt/void __fastcall__ tgi_bar (int x1, int y1, int x2, int y2);/
<tag/Description/The function fills a rectangle on the drawpage with the current
color.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
<tag/Declaration/<tt/void __fastcall__ tgi_circle (int x, int y, unsigned char radius);/
<tag/Description/The function draws a circle in the current color.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Declaration/<tt/void __fastcall__ tgi_ellipse (int x, int y, unsigned char rx, unsigned char ry);/
<tag/Description/The function draws an ellipse at position x/y with radii
rx and ry, using the current drawing color.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
</quote>
+<sect1>tgi_free_vectorfont<label id="tgi_free_vectorfont"><p>
+
+<quote>
+<descrip>
+<tag/Function/Free a vector font that was previously loaded into memory.
+<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
+<tag/Declaration/<tt/void __fastcall__ tgi_free_vectorfont (const tgi_vectorfont* font);/
+<tag/Description/Free a vector font that was previously loaded into memory.
+<tag/Notes/<itemize>
+<item>The function is only available as fastcall function, so it may only
+be used in presence of a prototype.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">,
+<ref id="tgi_install_vectorfont" name="tgi_install_vectorfont">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
<sect1>tgi_getaspectratio<label id="tgi_getaspectratio"><p>
<quote> <descrip> <tag/Function/Return the pixel aspect ratio.
geometric shapes so they look correct on the display. As an example, a circle
with a radius of 100 pixels may look elliptic on some driver/display
combinations if the aspect ratio is not 1.00.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The aspect ratio is encoded in the TGI driver which assumes a "standard"
monitor for the given platform. The aspect ratio may be wrong if another
monitor is used.
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
<tag/Declaration/<tt/const char* __fastcall__ tgi_geterrormsg (unsigned char code);/
<tag/Description/Get an error message describing the error.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
<tag/Declaration/<tt/unsigned char __fastcall__ tgi_getpixel (int x, int y);/
<tag/Description/Get the color of a pixel from the viewpage.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
<tag/Declaration/<tt/void __fastcall__ tgi_gotoxy (int x, int y);/
<tag/Description/Set graphics cursor at x, y.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Declaration/<tt/void tgi_init (void);/
<tag/Description/The tgi_init function will set the default palette to the
hardware.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item><tt/tgi_init/ will not clear the screen. This allows switching between
text and graphics mode on platforms that have separate memory areas for the
screens. If you want the screen cleared, call <tt/<ref id="tgi_clear"
<tag/Availability/cc65
<tag/See also/Other tgi functions.
<tag/Example/<verb>
-extern char lynxtgi[]; //Include the driver statically instead of loading it.
-tgi_install(&lynxtgi);
+tgi_install(tgi_static_stddrv); //Include the driver statically instead of loading it.
tgi_init(); //Set up the default palette and clear the screen.
</verb>
</descrip>
<tag/Description/The function installs a driver that was already loaded into
memory (or linked statically to the program). It returns an error code
(<tt/TGI_ERR_OK/ in case of success).
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only be
used in presence of a prototype.
</itemize>
<ref id="tgi_uninstall" name="tgi_uninstall">,
<ref id="tgi_unload" name="tgi_unload">
<tag/Example/<verb>
-extern char lynxtgi[]; //Include the driver statically instead of loading it.
-
-tgi_install(&lynxtgi);
+tgi_install(tgi_static_stddrv); //Include the driver statically instead of loading it.
tgi_init(); //Set up the default palette and clear the screen.
</verb>
</descrip>
</quote>
+<sect1>tgi_install_vectorfont<label id="tgi_install_vectorfont"><p>
+
+<quote>
+<descrip>
+<tag/Function/Install an already loaded driver and return an error code.
+<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
+<tag/Declaration/<tt/void __fastcall__ tgi_install_vectorfont (const tgi_vectorfont* font);/
+<tag/Description/
+Install a vector font for use. More than one vector font can be loaded,
+but only one can be active. This function is used to tell which one. Call
+with a NULL pointer to uninstall the currently installed font.
+<tag/Notes/<itemize>
+<item>The function is only available as fastcall function, so it may only be
+used in presence of a prototype.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="tgi_load_vectorfont" name="tgi_load_vectorfont">,
+<ref id="tgi_free_vectorfont" name="tgi_free_vectorfont">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
<sect1>tgi_ioctl<label id="tgi_ioctl"><p>
<quote>
<tag/Description/Some platforms have extra display hardware that is not
supported by standard tgi functions. You can extend the driver to support
this extra hardware using tgi_ioctl functions.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>These functions are not easily portable to other cc65 platforms.
<tag/Declaration/<tt/void __fastcall__ tgi_line (int x1, int y1, int x2, int y2);/
<tag/Description/Draw a line in the current drawing color.
The graphics cursor will be set to x2/y2 by this call.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Declaration/<tt/void __fastcall__ tgi_lineto (int x2, int y2);/
<tag/Description/Draw a line in the current drawing color from the graphics
cursor to the new end point. The graphics cursor will be updated to x2/y2.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Description/Load and install the driver by name.
Will just load the driver and check if loading was successful.
Will not switch to graphics mode.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
</quote>
+<sect1>tgi_load_vectorfont<label id="tgi_load_vectorfont"><p>
+
+<quote>
+<descrip>
+<tag/Function/Load the given vector font.
+<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
+<tag/Declaration/<tt/const tgi_vectorfont* __fastcall__ tgi_load_vectorfont (const char* name);/
+<tag/Description/
+Load a vector font into memory and return it. In case of errors, NULL is
+returned and an error is set, which can be retrieved using tgi_geterror.
+To use the font, it has to be installed using tgi_install_vectorfont.
+<tag/Notes/<itemize>
+<item>The function is only available as fastcall function, so it may only
+be used in presence of a prototype.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="tgi_install_vectorfont" name="tgi_install_vectorfont">,
+<ref id="tgi_free_vectorfont" name="tgi_free_vectorfont">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
<sect1>tgi_outtext<label id="tgi_outtext"><p>
<quote>
<tag/Declaration/<tt/void __fastcall__ tgi_outtext (const char* s);/
<tag/Description/Output text at the current graphics cursor position.
The graphics cursor is moved to the end of the text.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Declaration/<tt/void __fastcall__ tgi_outtextxy (int x, int y, const char* s);/
<tag/Description/Output text at the given cursor position.
The graphics cursor is moved to the end of the text.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
and radii rx/ry using the current drawing color. The pie slice covers the angle
between sa and ea (startangle and endangle), which must be in the range
0..360.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
<item>The function behaves unexpectedly or may crash if the angles are out
may be used to correct geometric shapes so they look correct on a given
display. As an example, a circle with a radius of 100 pixels may look elliptic
on some driver/display combinations if the aspect ratio is not 1.00.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The aspect ratio is encoded in the TGI driver which assumes a "standard"
monitor for the given platform. The aspect ratio may be wrong if another
monitor is used.
name="tgi_init">, so if a driver is linked statically to an application,
switching into and out of graphics mode will not restore the original aspect
ratio.
+<item>The function is available only as a fastcall function; so, it may be used
+only in the presence of a prototype.
</itemize>
<tag/Availability/cc65
<tag/See also/
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
<tag/Declaration/<tt/void __fastcall__ tgi_setcolor (unsigned char color);/
<tag/Description/Set color to be used in future draw operations.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
is seen immediately as it is drawn. For double buffered games you can set the
drawpage to a different page than the viewpage. This lets you draw the next
screen in the background and when the screen is ready you display it.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Declaration/<tt/void __fastcall__ tgi_setpalette (const unsigned char* palette);/
<tag/Description/Set the palette (not available with all drivers/hardware).
Palette is a pointer to as many entries as there are colors.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
<tag/Declaration/<tt/void __fastcall__ tgi_setpixel (int x, int y);/
<tag/Description/Plot a pixel on the drawpage with the current color.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
is seen immediately as it is drawn. For double buffered games you can set the
drawpage to a different page than the viewpage. This lets you draw the next
screen in the background and when the screen is ready you display it.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextheight (const char* s);/
<tag/Description/Calculate the height of the text in pixels according to
the current text style.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
</descrip>
</quote>
+<sect1>tgi_settextscale<label id="tgi_settextscale"><p>
+
+<quote>
+<descrip>
+<tag/Function/Set the scaling for text output.
+<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
+<tag/Declaration/<tt/void __fastcall__ tgi_settextscale (unsigned width, unsigned height);/
+<tag/Description/
+Set the scaling for text output. The scaling factors for width and height
+are 8.8 fixed point values. This means that $100 = 1 $200 = 2 etc.
+<tag/Notes/<itemize>
+<item>The function is only available as fastcall function, so it may only
+be used in presence of a prototype.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="tgi_settextstyle" name="tgi_settextstyle">
+<tag/Example/None.
+</descrip>
+</quote>
+
<sect1>tgi_settextstyle<label id="tgi_settextstyle"><p>
<quote>
<descrip>
<tag/Function/Set the style for text output.
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
-<tag/Declaration/<tt/void __fastcall__ tgi_settextstyle (unsigned char magx, unsigned char magy, unsigned char dir);/
+<tag/Declaration/<tt/void __fastcall__ tgi_settextstyle (unsigned char magx, unsigned char magy, unsigned char dir, unsigned char font);/
<tag/Description/Set the style for text output.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
<tag/Availability/cc65
-<tag/See also/Other tgi functions.
+<tag/See also/
+<ref id="tgi_settextscale" name="tgi_settextscale">
<tag/Example/None.
</descrip>
</quote>
<tag/Function/Calculate the width of the text in pixels according to the current text style.
<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
<tag/Declaration/<tt/unsigned __fastcall__ tgi_gettextwidth (const char* s);/
-<tag/Function/Calculate the width of the text in pixels according to the current text style.
-<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
<tag/Description/Calculate the width of the text in pixels according to the current text style.
-<tag/Header/<tt/<ref id="tgi.h" name="tgi.h">/
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may only
be used in presence of a prototype.
</itemize>
measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
result will also be stored there. If no time is available, <tt/(time_t)-1/ is
returned and <tt/errno/ is set to <tt/ENOSYS/.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may
only be used in presence of a prototype.
<item>Many platforms supported by cc65 do not have a realtime clock, so the
<tag/Description/Toggle between 40 and 80 column mode. The settings for the
old mode (cursor position, color and so on) are saved and restored together
with the mode.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is specific to the C128.
<item>This function is deprecated. Please use <ref id="videomode"
name="videomode"> instead!
<tag/Declaration/<tt/int __fastcall__ tolower (int c);/
<tag/Description/The function returns the given character converted to lower
case. If the given character is not a letter, it is returned unchanged.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may
only be used in presence of a prototype.
</itemize>
<tag/Declaration/<tt/int __fastcall__ toupper (int c);/
<tag/Description/The function returns the given character converted to upper
case. If the given character is not a letter, it is returned unchanged.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is only available as fastcall function, so it may
only be used in presence of a prototype.
</itemize>
<tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
<tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
string using <tt/radix/ as the base.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>There are no provisions to prevent a buffer overflow.
<item>The function is non standard, so it is not available in strict ANSI mode.
You should probably use <tt/sprintf/ instead.
<tag/Description/<tt/unlink/ deletes the file with the given name. On success,
zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
code describing the reason for the failure.
-<tag/Limits/
-<itemize>
+<tag/Notes/<itemize>
<item>The use of this function is discouraged. Please use <tt/<ref id="remove"
name="remove">/ instead, which is a native ANSI C function and does the same.
<item>This function is not available on all cc65 targets (depends on the
<tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
<tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
using <tt/radix/ as the base.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>There are no provisions to prevent a buffer overflow.
<item>The function is non standard, so it is not available in strict ANSI mode.
You should probably use <tt/sprintf/ instead.
text where necessary and formatted according to the format string given. The
resulting string is output to the console. <tt/vcprintf/ supports the same
format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
between <tt/\r/ and <tt/\n/.
<item>The function is only available as fastcall function, so it may only be
<tag/Description/Switch to 40 or 80 column mode depending on the argument. If
the requested mode is already active, nothing happens. The old mode is returned
from the call.
-<tag/Limits/<itemize>
+<tag/Notes/<itemize>
<item>The function is specific to the C128 and enhanced Apple //e.
<item>This function replaces <ref id="toggle_videomode"
name="toggle_videomode">.