]> git.sur5r.net Git - cc65/blobdiff - doc/funcref.sgml
Fixed several address size issues
[cc65] / doc / funcref.sgml
index 7a27e41964626c7db4bd5537e5d5ba56b486ef8a..faf27dfbe2c50bc815abedd30669051cdbd9ff65 100644 (file)
@@ -57,11 +57,20 @@ function.
 <item><ref id="SEI" name="SEI">
 <item><ref id="_sys" name="_sys">
 <item><ref id="getcpu" name="getcpu">
-<!-- <item><ref id="reset_brk" name="reset_brk"> -->
-<!-- <item><ref id="set_brk" name="set_brk"> -->
+<item><ref id="reset_brk" name="reset_brk">
+<item><ref id="set_brk" name="set_brk">
 </itemize>
 
 
+<sect1><tt/apple2.h/<label id="apple2.h"><p>
+
+
+<sect1><tt/atari.h/<label id="atari.h"><p>
+
+
+<sect1><tt/atmos.h/<label id="atmos.h"><p>
+
+
 <sect1><tt/assert.h/<label id="assert.h"><p>
 
 <itemize>
@@ -79,6 +88,12 @@ function.
 </itemize>
 
 
+<sect1><tt/c16.h/<label id="c16.h"><p>
+
+
+<sect1><tt/c64.h/<label id="c64.h"><p>
+
+
 <sect1><tt/conio.h/<label id="conio.h"><p>
 
 <itemize>
@@ -132,6 +147,12 @@ function.
 </itemize>
 
 
+<sect1><tt/dbg.h/<label id="dbg.h"><p>
+
+
+<sect1><tt/dio.h/<label id="dio.h"><p>
+
+
 <sect1><tt/em.h/<label id="em.h"><p>
 
 <itemize>
@@ -146,6 +167,9 @@ function.
 </itemize>
 
 
+<sect1><tt/errno.h/<label id="errno.h"><p>
+
+
 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
 
 <itemize>
@@ -155,6 +179,51 @@ function.
 </itemize>
 
 
+<sect1><tt/geos.h/<label id="geos.h"><p>
+
+
+<sect1><tt/joystick.h/<label id="joystick.h"><p>
+
+
+<sect1><tt/locale.h/<label id="locale.h"><p>
+
+<itemize>
+<item><ref id="localeconv" name="localeconv">
+<item><ref id="setlocale" name="setlocale">
+</itemize>
+
+
+<sect1><tt/modload.h/<label id="modload.h"><p>
+
+
+<sect1><tt/nes.h/<label id="nes.h"><p>
+
+
+<sect1><tt/o65.h/<label id="o65.h"><p>
+
+
+<sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
+
+<itemize>
+<item><ref id="PEEK" name="PEEK">
+<item><ref id="PEEKW" name="PEEKW">
+<item><ref id="POKE" name="POKE">
+<item><ref id="POKEW" name="POKEW">
+</itemize>
+
+
+<sect1><tt/pet.h/<label id="pet.h"><p>
+
+
+<sect1><tt/plus4.h/<label id="plus4.h"><p>
+
+
+<sect1><tt/serial.h/<label id="serial.h"><p>
+
+
+<sect1><tt/setjmp.h/<label id="setjmp.h"><p>
+
+
 <sect1><tt/signal.h/<label id="signal.h"><p>
 
 <itemize>
@@ -163,6 +232,22 @@ function.
 </itemize>
 
 
+<sect1><tt/stdarg.h/<label id="stdarg.h"><p>
+
+
+<sect1><tt/stdbool.h/<label id="stdbool.h"><p>
+
+
+<sect1><tt/stddef.h/<label id="stddef.h"><p>
+
+<itemize>
+<item><ref id="offsetof" name="offsetof">
+</itemize>
+
+
+<sect1><tt/stdio.h/<label id="stdio.h"><p>
+
+
 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
 
 <itemize>
@@ -176,9 +261,9 @@ function.
 <item><ref id="atexit" name="atexit">
 <item><ref id="atoi" name="atoi">
 <item><ref id="atol" name="atol">
-<!-- <item><ref id="bsearch" name="bsearch"> -->
+<item><ref id="bsearch" name="bsearch">
 <item><ref id="calloc" name="calloc">
-<!-- <item><ref id="div" name="div"> -->
+<item><ref id="div" name="div">
 <item><ref id="exit" name="exit">
 <item><ref id="free" name="free">
 <item><ref id="getenv" name="getenv">
@@ -186,7 +271,7 @@ function.
 <item><ref id="labs" name="labs">
 <item><ref id="ltoa" name="ltoa">
 <item><ref id="malloc" name="malloc">
-<!-- <item><ref id="qsort" name="qsort"> -->
+<item><ref id="qsort" name="qsort">
 <item><ref id="rand" name="rand">
 <item><ref id="realloc" name="realloc">
 <item><ref id="srand" name="srand">
@@ -204,16 +289,16 @@ function.
 <item><ref id="memcpy" name="memcpy">
 <item><ref id="memmove" name="memmove">
 <item><ref id="memset" name="memset">
-<!-- <item><ref id="strcasecmp" name="strcasecmp"> -->
+<item><ref id="strcasecmp" name="strcasecmp">
 <item><ref id="strcat" name="strcat">
 <item><ref id="strchr" name="strchr">
-<!-- <item><ref id="strcmp" name="strcmp"> -->
-<!-- <item><ref id="strcoll" name="strcoll"> -->
+<item><ref id="strcmp" name="strcmp">
+<item><ref id="strcoll" name="strcoll">
 <item><ref id="strcpy" name="strcpy">
 <!-- <item><ref id="strcspn" name="strcspn"> -->
 <!-- <item><ref id="strdup" name="strdup"> -->
 <!-- <item><ref id="strerror" name="strerror"> -->
-<!-- <item><ref id="stricmp" name="stricmp"> -->
+<item><ref id="stricmp" name="stricmp">
 <item><ref id="strlen" name="strlen">
 <item><ref id="strlower" name="strlower">
 <item><ref id="strlwr" name="strlwr">
@@ -230,6 +315,26 @@ function.
 </itemize>
 
 
+<sect1><tt/tgi.h/<label id="tgi.h"><p>
+
+
+<sect1><tt/time.h/<label id="time.h"><p>
+
+<!--
+<itemize>
+<item><ref id="_systime" name="_systime">
+<item><ref id="asctime" name="asctime">
+<item><ref id="clock" name="clock">
+<item><ref id="ctime" name="ctime">
+<item><ref id="gmtime" name="gmtime">
+<item><ref id="localtime" name="localtime">
+<item><ref id="mktime" name="mktime">
+<item><ref id="strftime" name="strftime">
+<item><ref id="time" name="time">
+</itemize>
+-->
+
+
 <sect1><tt/unistd.h/<label id="unistd.h"><p>
 
 <itemize>
@@ -245,6 +350,12 @@ function.
 </itemize>
 
 
+<sect1><tt/vic20.h/<label id="vic20.h"><p>
+
+
+<sect1><tt/zlib.h/<label id="zlib.h"><p>
+
+
 
 
 <sect>Alphabetical function reference<p>
@@ -442,6 +553,104 @@ disabled.
 </quote>
 
 
+<sect1>PEEK<label id="PEEK"><p>
+
+<quote>
+<descrip>
+<tag/Function/Read a byte from memory.
+<tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
+<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>
+<item>The function is actually a macro.
+<item>This function depends highly on the platform and environment.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="PEEKW" name="PEEKW">,
+<ref id="POKE" name="POKE">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>PEEKW<label id="PEEKW"><p>
+
+<quote>
+<descrip>
+<tag/Function/Read a word (two bytes) from memory.
+<tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
+<tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
+<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>
+<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
+depend of the address expression used.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="PEEK" name="PEEK">,
+<ref id="POKE" name="POKE">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>POKE<label id="POKE"><p>
+
+<quote>
+<descrip>
+<tag/Function/Write a byte to memory.
+<tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
+<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>
+<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
+machine.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="PEEK" name="PEEK">,
+<ref id="POKEW" name="POKEW">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>POKEW<label id="POKEW"><p>
+
+<quote>
+<descrip>
+<tag/Function/Write a word (two bytes) to memory.
+<tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
+<tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
+<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>
+<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
+machine.
+<item>The order in which the two bytes are written is unspecified and may
+depend of the address expression used.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="PEEK" name="PEEK">,
+<ref id="POKE" name="POKE">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
 <sect1>SEI<label id="SEI"><p>
 
 <quote>
@@ -656,6 +865,37 @@ be used in presence of a prototype.
 </quote>
 
 
+<sect1>bsearch<label id="bsearch"><p>
+
+<quote>
+<descrip>
+<tag/Function/Do a binary search in a sorted array.
+<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*));/
+<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>
+<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.
+</itemize>
+<tag/Availability/ISO 9899
+<tag/See also/
+<ref id="qsort" name="qsort">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
 <sect1>bzero<label id="bzero"><p>
 
 <quote>
@@ -997,6 +1237,28 @@ used in presence of a prototype.
 </quote>
 
 
+<sect1>div<label id="div"><p>
+
+<quote>
+<descrip>
+<tag/Function/Divide two ints and return quotient and remainder.
+<tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
+<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>
+<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/
+ldiv
+<tag/Example/None.
+</descrip>
+</quote>
+
+
 <sect1>em_commit<label id="em_commit"><p>
 
 <quote>
@@ -1545,7 +1807,7 @@ fastcall function, so it may only be used in presence of a prototype.
 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
 <tag/Description/The function returns a value of zero if the given argument
-is a blank or space character. The return value is non zero if the character
+is a space or tab character. The return value is non zero if the character
 is anything else.
 <tag/Limits/<itemize>
 <item>When compiling with <tt/-Os/ the function is actually a macro. The
@@ -2022,6 +2284,28 @@ used in presence of a prototype.
 </quote>
 
 
+<sect1>localeconv<label id="localeconv"><p>
+
+<quote>
+<descrip>
+<tag/Function/Returns a pointer to the current locale structure.
+<tag/Header/<tt/<ref id="locale.h" name="locale.h">/
+<tag/Declaration/<tt/struct lconv* localeconv (void);/
+<tag/Description/<tt/localeconv/ returns a pointer to the current locale
+structure.
+<tag/Limits/<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.
+</itemize>
+<tag/Availability/ISO 9899
+<tag/See also/
+<ref id="setlocale" name="setlocale">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
 <sect1>malloc<label id="malloc"><p>
 
 <quote>
@@ -2129,6 +2413,24 @@ be used in presence of a prototype.
 </quote>
 
 
+<sect1>offsetof<label id="offsetof"><p>
+
+<quote>
+<descrip>
+<tag/Function/Calculate the offset of a struct or union member.
+<tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
+<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>
+<item>The function is actually a macro.
+</itemize>
+<tag/Availability/ISO 9899
+<tag/Example/None.
+</descrip>
+</quote>
+
+
 <sect1>open<label id="open"><p>
 
 <quote>
@@ -2153,6 +2455,33 @@ cc65 allows to pass this argument, it is ignored.
 </quote>
 
 
+<sect1>qsort<label id="qsort"><p>
+
+<quote>
+<descrip>
+<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*));/
+<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>
+<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.
+</itemize>
+<tag/Availability/ISO 9899
+<tag/See also/
+<ref id="bsearch" name="bsearch">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
 <sect1>raise<label id="raise"><p>
 
 <quote>
@@ -2240,6 +2569,29 @@ be used in presence of a prototype.
 </quote>
 
 
+<sect1>reset_brk<label id="reset_brk"><p>
+
+<quote>
+<descrip>
+<tag/Function/Resets the break vector to its original value.
+<tag/Header/<tt/<ref id="6502.h" name="6502.h">/
+<tag/Declaration/<tt/void __fastcall__ 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.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="set_brk" name="set_brk">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
 <sect1>revers<label id="revers"><p>
 
 <quote>
@@ -2288,6 +2640,65 @@ be used in presence of a prototype.
 </quote>
 
 
+<sect1>set_brk<label id="set_brk"><p>
+
+<quote>
+<descrip>
+<tag/Function/Set the break vector to a user function.
+<tag/Header/<tt/<ref id="6502.h" name="6502.h">/
+<tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
+<tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
+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>
+<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
+to a small break handler stack. This means that it is safe to execute C code,
+even if C code was interrupted. Be careful however not to use too many local
+variables, and do not enable stack checks for the handler function or any other
+function called from it.
+<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.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="reset_brk" name="reset_brk">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>setlocale<label id="setlocale"><p>
+
+<quote>
+<descrip>
+<tag/Function/Selects a locale.
+<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>
+<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
+different locale has no effect.
+</itemize>
+<tag/Availability/ISO 9899
+<tag/See also/
+<ref id="localeconv" name="localeconv">,
+<ref id="strcoll" name="strcoll">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
 <sect1>signal<label id="signal"><p>
 
 <quote>
@@ -2376,6 +2787,32 @@ be used in presence of a prototype.
 </quote>
 
 
+<sect1>strcasecmp<label id="strcasecmp"><p>
+
+<quote>
+<descrip>
+<tag/Function/Compare two strings case insensitive.
+<tag/Header/<tt/<ref id="string.h" name="string.h">/
+<tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
+<tag/Description/The <tt/strcasecmp/ function compares the two strings passed
+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>
+<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.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="strcmp" name="strcmp">,
+<ref id="strcoll" name="strcoll">,
+<ref id="stricmp" name="stricmp">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
 <sect1>strcat<label id="strcat"><p>
 
 <quote>
@@ -2425,6 +2862,58 @@ be used in presence of a prototype.
 </quote>
 
 
+<sect1>strcmp<label id="strcmp"><p>
+
+<quote>
+<descrip>
+<tag/Function/Compare two strings.
+<tag/Header/<tt/<ref id="string.h" name="string.h">/
+<tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
+<tag/Description/The <tt/strcmp/ function compares the two strings passed as
+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>
+<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="strcasecmp" name="strcasecmp">,
+<ref id="strcoll" name="strcoll">,
+<ref id="stricmp" name="stricmp">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
+<sect1>strcoll<label id="strcoll"><p>
+
+<quote>
+<descrip>
+<tag/Function/Compare two strings.
+<tag/Header/<tt/<ref id="string.h" name="string.h">/
+<tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
+<tag/Description/The <tt/strcoll/ function compares the two strings passed as
+parameters, according to the collating sequence set by <tt/<ref id="setlocale"
+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>
+<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="setlocale" name="setlocale">,
+<ref id="strcasecmp" name="strcasecmp">,
+<ref id="strcmp" name="strcmp">,
+<ref id="stricmp" name="stricmp">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
 <sect1>strcpy<label id="strcpy"><p>
 
 <quote>
@@ -2457,6 +2946,32 @@ strcpy (hello, "Hello world!\n");
 </quote>
 
 
+<sect1>stricmp<label id="stricmp"><p>
+
+<quote>
+<descrip>
+<tag/Function/Compare two strings case insensitive.
+<tag/Header/<tt/<ref id="string.h" name="string.h">/
+<tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
+<tag/Description/The <tt/stricmp/ function compares the two strings passed 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>
+<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.
+</itemize>
+<tag/Availability/cc65
+<tag/See also/
+<ref id="strcasecmp" name="strcasecmp">,
+<ref id="strcmp" name="strcmp">,
+<ref id="strcoll" name="strcoll">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
 <sect1>strlen<label id="strlen"><p>
 
 <quote>