1 <!doctype linuxdoc system>
4 <title>cc65 function reference
5 <author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
9 cc65 is a C compiler for 6502 based systems. This function reference describes
10 the C functions available in the standard library.
13 <!-- Table of contents -->
16 <!-- Begin the document -->
20 cc65 is a C compiler for 6502 based systems. It implements a subset of the ISO
21 C standard plus additional functions specially crafted for 6502 systems or
22 just some of the supported machines. This function refrence describes the
23 available functions together with any limitations.
25 For an overview about the available libraries, their purpose, and any
26 differences to the ISO standard, please have a look at the <htmlurl
27 url="library.html" name="cc65 Library Overview">.
29 <bf/Note:/ Standard C functions are listed here, but not described in detail.
30 Since these functions behave identical on all standard compliant systems, they
31 are described in any book covering standard C.
33 Each entry for a function contains a detailed description
37 <tag/Function/Summary of what <bf/function/ does.
38 <tag/Header/The header file that contains the declaration.
39 <tag/Declaration/Describes the needed header files and declaration of the
41 <tag/Description/Description of the function.
43 <tag/Availability/The availability of the function.
44 <tag/See also/Other related functions.
45 <tag/Example/A piece of actual code using the function.
50 <sect>Functions by header file<p>
52 <sect1><tt/6502.h/<label id="6502.h"><p>
55 <item><ref id="BRK" name="BRK">
56 <item><ref id="CLI" name="CLI">
57 <item><ref id="SEI" name="SEI">
58 <item><ref id="_sys" name="_sys">
59 <item><ref id="getcpu" name="getcpu">
60 <item><ref id="reset_brk" name="reset_brk">
61 <item><ref id="set_brk" name="set_brk">
65 <sect1><tt/apple2.h/<label id="apple2.h"><p>
69 <item><ref id="get_ostype" name="get_ostype">
73 <sect1><tt/apple2enh.h/<label id="apple2enh.h"><p>
79 <item><ref id="get_ostype" name="get_ostype">
83 <sect1><tt/assert.h/<label id="assert.h"><p>
86 <item><ref id="assert" name="assert">
90 <sect1><tt/atari.h/<label id="atari.h"><p>
93 <item><ref id="get_ostype" name="get_ostype">
99 <sect1><tt/atmos.h/<label id="atmos.h"><p>
104 <sect1><tt/c128.h/<label id="c128.h"><p>
107 <item><ref id="c64mode" name="c64mode">
108 <item><ref id="fast" name="fast">
109 <item><ref id="toggle_videomode" name="toggle_videomode">
110 <item><ref id="slow" name="slow">
114 <sect1><tt/c16.h/<label id="c16.h"><p>
119 <sect1><tt/c64.h/<label id="c64.h"><p>
122 <item><ref id="get_ostype" name="get_ostype">
126 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
129 <item><ref id="peekbsys" name="peekbsys">
130 <item><ref id="peekwsys" name="peekwsys">
131 <item><ref id="pokebsys" name="pokebsys">
132 <item><ref id="pokewsys" name="pokewsys">
136 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
139 <item><ref id="peekbsys" name="peekbsys">
140 <item><ref id="peekwsys" name="peekwsys">
141 <item><ref id="pokebsys" name="pokebsys">
142 <item><ref id="pokewsys" name="pokewsys">
146 <sect1><tt/conio.h/<label id="conio.h"><p>
149 <item><ref id="bgcolor" name="bgcolor">
150 <item><ref id="bordercolor" name="bordercolor">
151 <item><ref id="cclear" name="cclear">
152 <item><ref id="cclearxy" name="cclearxy">
153 <item><ref id="cgetc" name="cgetc">
154 <item><ref id="chline" name="chline">
155 <item><ref id="chlinexy" name="chlinexy">
156 <item><ref id="clrscr" name="clrscr">
157 <item><ref id="cprintf" name="cprintf">
158 <item><ref id="cputc" name="cputc">
159 <item><ref id="cputcxy" name="cputcxy">
160 <item><ref id="cputs" name="cputs">
161 <item><ref id="cputsxy" name="cputsxy">
162 <item><ref id="cursor" name="cursor">
163 <item><ref id="cvline" name="cvline">
164 <item><ref id="cvlinexy" name="cvlinexy">
165 <item><ref id="gotox" name="gotox">
166 <item><ref id="gotoxy" name="gotoxy">
167 <item><ref id="gotoy" name="gotoy">
168 <item><ref id="kbhit" name="kbhit">
169 <item><ref id="revers" name="revers">
170 <item><ref id="screensize" name="screensize">
171 <item><ref id="textcolor" name="textcolor">
172 <item><ref id="vcprintf" name="vcprintf">
173 <item><ref id="wherex" name="wherex">
174 <item><ref id="wherey" name="wherey">
178 <sect1><tt/ctype.h/<label id="ctype.h"><p>
181 <item><ref id="isalnum" name="isalnum">
182 <item><ref id="isalpha" name="isalpha">
183 <item><ref id="isascii" name="isascii">
184 <item><ref id="isblank" name="isblank">
185 <item><ref id="iscntrl" name="iscntrl">
186 <item><ref id="isdigit" name="isdigit">
187 <item><ref id="isgraph" name="isgraph">
188 <item><ref id="islower" name="islower">
189 <item><ref id="isprint" name="isprint">
190 <item><ref id="ispunct" name="ispunct">
191 <item><ref id="isspace" name="isspace">
192 <item><ref id="isupper" name="isupper">
193 <item><ref id="isxdigit" name="isxdigit">
194 <item><ref id="tolower" name="tolower">
195 <item><ref id="toupper" name="toupper">
199 <sect1><tt/dbg.h/<label id="dbg.h"><p>
204 <sect1><tt/dio.h/<label id="dio.h"><p>
209 <sect1><tt/em.h/<label id="em.h"><p>
212 <item><ref id="em_commit" name="em_commit">
213 <item><ref id="em_copyfrom" name="em_copyfrom">
214 <item><ref id="em_copyto" name="em_copyto">
215 <item><ref id="em_install" name="em_install">
216 <item><ref id="em_load_driver" name="em_load_driver">
217 <item><ref id="em_map" name="em_map">
218 <item><ref id="em_pagecount" name="em_pagecount">
219 <item><ref id="em_uninstall" name="em_uninstall">
220 <item><ref id="em_unload" name="em_unload">
221 <item><ref id="em_use" name="em_use">
225 <sect1><tt/errno.h/<label id="errno.h"><p>
230 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
233 <item><ref id="close" name="close">
234 <item><ref id="creat" name="creat">
235 <item><ref id="open" name="open">
239 <sect1><tt/geos.h/<label id="geos.h"><p>
244 <sect1><tt/joystick.h/<label id="joystick.h"><p>
247 <item><ref id="joy_count" name="joy_count">
248 <item><ref id="joy_install" name="joy_install">
249 <item><ref id="joy_load_driver" name="joy_load_driver">
250 <item><ref id="joy_read" name="joy_read">
251 <item><ref id="joy_uninstall" name="joy_uninstall">
252 <item><ref id="joy_unload" name="joy_unload">
256 <sect1><tt/locale.h/<label id="locale.h"><p>
259 <item><ref id="localeconv" name="localeconv">
260 <item><ref id="setlocale" name="setlocale">
264 <sect1><tt/modload.h/<label id="modload.h"><p>
267 <item><ref id="mod_load" name="mod_load">
268 <item><ref id="mod_free" name="mod_free">
272 <sect1><tt/mouse.h/<label id="mouse.h"><p>
275 <item><ref id="mouse_load_driver" name="mouse_load_driver">
276 <item><ref id="mouse_unload" name="mouse_unload">
277 <item><ref id="mouse_install" name="mouse_install">
278 <item><ref id="mouse_uninstall" name="mouse_uninstall">
279 <item><ref id="mouse_hide" name="mouse_hide">
280 <item><ref id="mouse_show" name="mouse_show">
281 <item><ref id="mouse_box" name="mouse_box">
282 <item><ref id="mouse_move" name="mouse_move">
283 <item><ref id="mouse_buttons" name="mouse_buttons">
284 <item><ref id="mouse_pos" name="mouse_pos">
285 <item><ref id="mouse_info" name="mouse_info">
286 <item><ref id="mouse_ioctl" name="mouse_ioctl">
292 <sect1><tt/nes.h/<label id="nes.h"><p>
297 <sect1><tt/o65.h/<label id="o65.h"><p>
299 The <tt/o65.h/ header file contains structure and constant definitions that
300 may be used when dealing with files in <htmlurl
301 url="http://www.6502.org/users/andre/o65/fileformat.html" name="o65 format">.
302 It does not declare any functions.
305 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
308 <item><ref id="PEEK" name="PEEK">
309 <item><ref id="PEEKW" name="PEEKW">
310 <item><ref id="POKE" name="POKE">
311 <item><ref id="POKEW" name="POKEW">
315 <sect1><tt/pet.h/<label id="pet.h"><p>
320 <sect1><tt/plus4.h/<label id="plus4.h"><p>
325 <sect1><tt/serial.h/<label id="serial.h"><p>
329 <item><ref id="ser_load_driver" name="ser_load_driver">
330 <item><ref id="ser_unload" name="ser_unload">
331 <item><ref id="ser_install" name="ser_install">
332 <item><ref id="ser_uninstall" name="ser_uninstall">
333 <item><ref id="ser_open" name="ser_open">
334 <item><ref id="ser_close" name="ser_close">
335 <item><ref id="ser_get" name="ser_get">
336 <item><ref id="ser_put" name="ser_put">
337 <item><ref id="ser_status" name="ser_status">
338 <item><ref id="ser_ioctl" name="ser_ioctl">
345 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
348 <item><ref id="setjmp" name="setjmp">
349 <item><ref id="longjmp" name="longjmp">
353 <sect1><tt/signal.h/<label id="signal.h"><p>
356 <item><ref id="raise" name="raise">
357 <item><ref id="signal" name="signal">
361 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
366 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
371 <sect1><tt/stddef.h/<label id="stddef.h"><p>
374 <item><ref id="offsetof" name="offsetof">
378 <sect1><tt/stdio.h/<label id="stdio.h"><p>
381 <item><ref id="clearerr" name="clearerr">
382 <!-- <item><ref id="fclose" name="fclose"> -->
383 <!-- <item><ref id="fdopen" name="fdopen"> -->
384 <item><ref id="feof" name="feof">
385 <item><ref id="ferror" name="ferror">
386 <!-- <item><ref id="fflush" name="fflush"> -->
387 <!-- <item><ref id="fgetc" name="fgetc"> -->
388 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
389 <!-- <item><ref id="fgets" name="fgets"> -->
390 <item><ref id="fileno" name="fileno">
391 <!-- <item><ref id="flushall" name="flushall"> -->
392 <!-- <item><ref id="fopen" name="fopen"> -->
393 <!-- <item><ref id="fprintf" name="fprintf"> -->
394 <!-- <item><ref id="fputc" name="fputc"> -->
395 <!-- <item><ref id="fputs" name="fputs"> -->
396 <!-- <item><ref id="fread" name="fread"> -->
397 <!-- <item><ref id="freopen" name="freopen"> -->
398 <!-- <item><ref id="fscanf" name="fscanf"> -->
399 <!-- <item><ref id="fseek" name="fseek"> -->
400 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
401 <!-- <item><ref id="ftell" name="ftell"> -->
402 <!-- <item><ref id="fwrite" name="fwrite"> -->
403 <!-- <item><ref id="getc" name="getc"> -->
404 <!-- <item><ref id="getchar" name="getchar"> -->
405 <!-- <item><ref id="gets" name="gets"> -->
406 <!-- <item><ref id="printf" name="printf"> -->
407 <!-- <item><ref id="putc" name="putc"> -->
408 <!-- <item><ref id="putchar" name="putchar"> -->
409 <!-- <item><ref id="puts" name="puts"> -->
410 <!-- <item><ref id="rename" name="rename"> -->
411 <!-- <item><ref id="rewind" name="rewind"> -->
412 <!-- <item><ref id="scanf" name="scanf"> -->
413 <!-- <item><ref id="sprintf" name="sprintf"> -->
414 <!-- <item><ref id="sscanf" name="sscanf"> -->
415 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
416 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
417 <!-- <item><ref id="vprintf" name="vprintf"> -->
418 <!-- <item><ref id="vscanf" name="vscanf"> -->
419 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
420 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
426 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
429 <item><ref id="_heapadd" name="_heapadd">
430 <item><ref id="_heapblocksize" name="_heapblocksize">
431 <item><ref id="_heapmaxavail" name="_heapmaxavail">
432 <item><ref id="_heapmemavail" name="_heapmemavail">
433 <item><ref id="_poserror" name="_poserror">
434 <item><ref id="_randomize" name="_randomize">
435 <item><ref id="_swap" name="_swap">
436 <item><ref id="abort" name="abort">
437 <item><ref id="abs" name="abs">
438 <item><ref id="atexit" name="atexit">
439 <item><ref id="atoi" name="atoi">
440 <item><ref id="atol" name="atol">
441 <item><ref id="bsearch" name="bsearch">
442 <item><ref id="calloc" name="calloc">
443 <item><ref id="div" name="div">
444 <item><ref id="exit" name="exit">
445 <item><ref id="free" name="free">
446 <item><ref id="getenv" name="getenv">
447 <item><ref id="itoa" name="itoa">
448 <item><ref id="labs" name="labs">
449 <item><ref id="ltoa" name="ltoa">
450 <item><ref id="malloc" name="malloc">
451 <item><ref id="perror" name="perror">
452 <item><ref id="qsort" name="qsort">
453 <item><ref id="rand" name="rand">
454 <item><ref id="realloc" name="realloc">
455 <item><ref id="remove" name="remove">
456 <item><ref id="srand" name="srand">
457 <item><ref id="ultoa" name="ultoa">
458 <item><ref id="utoa" name="utoa">
462 <sect1><tt/string.h/<label id="string.h"><p>
465 <item><ref id="_stroserror" name="_stroserror">
466 <item><ref id="bzero" name="bzero">
467 <item><ref id="memchr" name="memchr">
468 <item><ref id="memcpy" name="memcpy">
469 <item><ref id="memmove" name="memmove">
470 <item><ref id="memset" name="memset">
471 <item><ref id="strcasecmp" name="strcasecmp">
472 <item><ref id="strcat" name="strcat">
473 <item><ref id="strchr" name="strchr">
474 <item><ref id="strcmp" name="strcmp">
475 <item><ref id="strcoll" name="strcoll">
476 <item><ref id="strcpy" name="strcpy">
477 <item><ref id="strcspn" name="strcspn">
478 <item><ref id="strdup" name="strdup">
479 <item><ref id="strerror" name="strerror">
480 <item><ref id="stricmp" name="stricmp">
481 <item><ref id="strlen" name="strlen">
482 <item><ref id="strlower" name="strlower">
483 <item><ref id="strlwr" name="strlwr">
484 <item><ref id="strncat" name="strncat">
485 <item><ref id="strncmp" name="strncmp">
486 <item><ref id="strncpy" name="strncpy">
487 <item><ref id="strrchr" name="strrchr">
488 <item><ref id="strspn" name="strspn">
489 <item><ref id="strstr" name="strstr">
490 <item><ref id="strtok" name="strtok">
491 <!-- <item><ref id="strxfrm" name="strxfrm"> -->
492 <item><ref id="strupper" name="strupper">
493 <item><ref id="strupr" name="strupr">
499 <sect1><tt/tgi.h/<label id="tgi.h"><p>
504 <sect1><tt/time.h/<label id="time.h"><p>
507 <!-- <item><ref id="_systime" name="_systime"> -->
508 <!-- <item><ref id="asctime" name="asctime"> -->
509 <!-- <item><ref id="clock" name="clock"> -->
510 <!-- <item><ref id="ctime" name="ctime"> -->
511 <!-- <item><ref id="gmtime" name="gmtime"> -->
512 <!-- <item><ref id="localtime" name="localtime"> -->
513 <!-- <item><ref id="mktime" name="mktime"> -->
514 <!-- <item><ref id="strftime" name="strftime"> -->
515 <item><ref id="time" name="time">
521 <sect1><tt/unistd.h/<label id="unistd.h"><p>
524 <!-- <item><ref id="chdir" name="chdir"> -->
525 <!-- <item><ref id="getcwd" name="getcwd"> -->
526 <!-- <item><ref id="lseek" name="lseek"> -->
527 <!-- <item><ref id="mkdir" name="mkdir"> -->
528 <!-- <item><ref id="read" name="read"> -->
529 <!-- <item><ref id="rmdir" name="rmdir"> -->
530 <item><ref id="sleep" name="sleep">
531 <item><ref id="unlink" name="unlink">
532 <!-- <item><ref id="write" name="write"> -->
538 <sect1><tt/vic20.h/<label id="vic20.h"><p>
543 <sect1><tt/zlib.h/<label id="zlib.h"><p>
548 <sect>Alphabetical function reference<p>
550 <sect1>_heapadd<label id="_heapadd"><p>
554 <tag/Function/Add a block to the heap.
555 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
556 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
557 <tag/Description/The function adds a block of raw memory to the heap.
560 <item>The minimum blocksize that can be added is 6 bytes; the function will
561 ignore smaller blocks.
563 <tag/Availability/cc65
565 <ref id="_heapblocksize" name="_heapblocksize">,
566 <ref id="_heapmaxavail" name="_heapmaxavail">,
567 <ref id="_heapmemavail" name="_heapmemavail">,
568 <ref id="calloc" name="calloc">,
569 <ref id="free" name="free">,
570 <ref id="malloc" name="malloc">,
571 <ref id="realloc" name="realloc">
577 <sect1>_heapblocksize<label id="_heapblocksize"><p>
581 <tag/Function/Return the size of an allocated block.
582 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
583 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
584 <tag/Description/The function returns the size of a block that must have
585 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
586 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
589 <item>Passing a pointer to a block that was is not the result of one of the
590 allocation functions, or that has been free'd will give unpredicable results.
592 <tag/Availability/cc65
594 <ref id="_heapadd" name="_heapadd">,
595 <ref id="_heapmaxavail" name="_heapmaxavail">,
596 <ref id="_heapmemavail" name="_heapmemavail">,
597 <ref id="calloc" name="calloc">,
598 <ref id="free" name="free">,
599 <ref id="malloc" name="malloc">,
600 <ref id="realloc" name="realloc">
606 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
610 <tag/Function/Return the largest block that is available on the heap.
611 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
612 <tag/Declaration/<tt/size_t __fastcall__ _heapmaxavail (void);/
613 <tag/Description/The function returns the size of the largest block that may
614 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
615 <tag/Availability/cc65
617 <ref id="_heapadd" name="_heapadd">,
618 <ref id="_heapblocksize" name="_heapblocksize">,
619 <ref id="_heapmemavail" name="_heapmemavail">,
620 <ref id="calloc" name="calloc">,
621 <ref id="free" name="free">,
622 <ref id="malloc" name="malloc">,
623 <ref id="realloc" name="realloc">
629 <sect1>_heapmemavail<label id="_heapmemavail"><p>
633 <tag/Function/Return the total available space on the heap.
634 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
635 <tag/Declaration/<tt/size_t __fastcall__ _heapmemavail (void);/
636 <tag/Description/The function returns the total number of bytes available on
640 <item>This function is of less use than usually assumed, since the returned
641 heap space may be available but not in one block. So even if this function
642 says that several times more heap space is available than needed, <ref
643 id="malloc" name="malloc"> may still return <tt/NULL/.
645 <tag/Availability/cc65
647 <ref id="_heapadd" name="_heapadd">,
648 <ref id="_heapblocksize" name="_heapblocksize">,
649 <ref id="_heapmaxavail" name="_heapmaxavail">,
650 <ref id="calloc" name="calloc">,
651 <ref id="free" name="free">,
652 <ref id="malloc" name="malloc">,
653 <ref id="realloc" name="realloc">
659 <sect1>_poserror<label id="_poserror"><p>
663 <tag/Function/Print an error message for the error in <tt/_oserrno/.
664 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
665 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
666 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
667 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
668 a colon and a blank. Then the error message for the current contents of
669 <tt/_oserrno/ are printed followed by a newline. The message output is the
670 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
671 argument of <tt/_oserrno/.
674 <item>Since operating system specific error code are - you guessed it -
675 operating system specific, the value in <tt/_oserror/ and the message that is
676 printed depend on the cc65 target.
677 <item>The function is only available as fastcall function, so it may only
678 be used in presence of a prototype.
680 <tag/Availability/cc65
682 <ref id="_stroserror" name="_stroserror">,
683 <ref id="perror" name="perror">
689 <sect1>_randomize<label id="_randomize"><p>
693 <tag/Function/Initialize the pseudo random number generator.
694 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
695 <tag/Declaration/<tt/void _randomize (void);/
696 <tag/Description/The function initializes the random number generator with
697 a seed derived from fast changing hardware events, so the seed itself can be
698 considered random to a certain degree.
699 <tag/Limits/<itemize>
700 <item>The randomness of the seed depends on the machine hardware.
702 <tag/Availability/cc65
704 <ref id="rand" name="rand">,
705 <ref id="srand" name="srand">
711 <sect1>_stroserror<label id="_stroserror"><p>
715 <tag/Function/Return a string describing an OS specific error code.
716 <tag/Header/<tt/<ref id="string.h" name="string.h">/
717 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
718 <tag/Description/<tt/_stroserror/ will return a string describing the given
719 operating system specific error code.
720 <tag/Limits/<itemize>
721 <item>Since operating system specific error code are - you guessed it -
722 operating system specific, the parameter and the string returned depend on the
724 <item>The function is only available as fastcall function, so it may only be
725 used in presence of a prototype.
727 <tag/Availability/cc65
729 <ref id="strerror" name="strerror">
735 <sect1>_swap<label id="_swap"><p>
739 <tag/Function/Swap the contents of memory areas.
740 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
741 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
742 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
743 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
744 <tt/size/ bytes in size.
745 <tag/Limits/<itemize>
746 <item>The memory areas may not overlap, otherwise the results are undefined.
747 <item>The function is only available as fastcall function, so it may only be
748 used in presence of a prototype.
750 <tag/Availability/cc65
752 <ref id="memcpy" name="memcpy">,
753 <ref id="memmove" name="memmove">
759 <sect1>_sys<label id="_sys"><p>
763 <tag/Function/Call a subroutine passing register values.
764 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
765 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
766 <tag/Description/The function will call the subroutine at the address
767 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
768 registers and the CPU flags are set to the values given in the <tt/regs/
769 structure. On return from the subroutine, the new values of the registers and
770 flags are stored back overwriting the old values.
771 <tag/Limits/<itemize>
772 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
773 when calling the subroutine (they are unchanged from their current values).
774 <item>The function is only available as fastcall function, so it may only be
775 used in presence of a prototype.
777 <tag/Availability/cc65
783 <sect1>BRK<label id="BRK"><p>
787 <tag/Function/Insert a 6502 BRK instrunction into the code.
788 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
789 <tag/Declaration/<tt/void BRK (void);/
790 <tag/Description/The function will insert a 6502 BRK instruction into the code
791 which may be used to trigger a debugger.
792 <tag/Limits/<itemize>
793 <item>The function is actually a macro.
794 <item>The inserted instruction may lead to unexpected results if no debugger
797 <tag/Availability/cc65
799 <ref id="CLI" name="CLI">,
800 <ref id="SEI" name="SEI">
806 <sect1>CLI<label id="CLI"><p>
810 <tag/Function/Insert a 6502 CLI instrunction into the code.
811 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
812 <tag/Declaration/<tt/void CLI (void);/
813 <tag/Description/The function will insert a 6502 CLI instruction into the code,
814 so interrupts are enabled. Enabling interrupts has no effects if they are
815 already enabled (the default).
816 <tag/Limits/<itemize>
817 <item>The function is actually a macro.
818 <item>Disabling interrupts may lead to unexpected results.
820 <tag/Availability/cc65
822 <ref id="BRK" name="BRK">,
823 <ref id="SEI" name="SEI">
829 <sect1>PEEK<label id="PEEK"><p>
833 <tag/Function/Read a byte from memory.
834 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
835 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
836 <tag/Description/The function will read the absolute memory given by <tt/addr/
837 and return the value read.
838 <tag/Limits/<itemize>
839 <item>The function is actually a macro.
840 <item>This function depends highly on the platform and environment.
842 <tag/Availability/cc65
844 <ref id="PEEKW" name="PEEKW">,
845 <ref id="POKE" name="POKE">
851 <sect1>PEEKW<label id="PEEKW"><p>
855 <tag/Function/Read a word (two bytes) from memory.
856 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
857 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
858 <tag/Description/The function will read the absolute memory given by <tt/addr/
859 and return the value read. The byte read from the higher address is the high
860 byte of the return value.
861 <tag/Limits/<itemize>
862 <item>The function is actually a macro.
863 <item>This function depends highly on the platform and environment.
864 <item>The order in which the two bytes are read is unspecified and may
865 depend of the address expression used.
867 <tag/Availability/cc65
869 <ref id="PEEK" name="PEEK">,
870 <ref id="POKE" name="POKE">
876 <sect1>POKE<label id="POKE"><p>
880 <tag/Function/Write a byte to memory.
881 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
882 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
883 <tag/Description/The function writes the value <tt/val/ to the absolute
884 memory address given by <tt/addr/.
885 <tag/Limits/<itemize>
886 <item>The function is actually a macro.
887 <item>This function depends highly on the platform and environment.
888 <item>Careless use will cause the program to act strange or may crash the
891 <tag/Availability/cc65
893 <ref id="PEEK" name="PEEK">,
894 <ref id="POKEW" name="POKEW">
900 <sect1>POKEW<label id="POKEW"><p>
904 <tag/Function/Write a word (two bytes) to memory.
905 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
906 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
907 <tag/Description/The function writes the value <tt/val/ to the absolute
908 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
909 the <tt/addr/, the high byte is written to <tt/addr+1/.
910 <tag/Limits/<itemize>
911 <item>The function is actually a macro.
912 <item>This function depends highly on the platform and environment.
913 <item>Careless use will cause the program to act strange or may crash the
915 <item>The order in which the two bytes are written is unspecified and may
916 depend of the address expression used.
918 <tag/Availability/cc65
920 <ref id="PEEK" name="PEEK">,
921 <ref id="POKE" name="POKE">
927 <sect1>SEI<label id="SEI"><p>
931 <tag/Function/Insert a 6502 SEI instrunction into the code.
932 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
933 <tag/Declaration/<tt/void SEI (void);/
934 <tag/Description/The function will insert a 6502 SEI instruction into the code,
935 so interrupts are disabled. Note that non maskable interrupts cannot be
937 <tag/Limits/<itemize>
938 <item>The function is actually a macro.
939 <item>Disabling interrupts may lead to unexpected results.
941 <tag/Availability/cc65
943 <ref id="BRK" name="BRK">,
944 <ref id="CLI" name="CLI">
950 <sect1>abort<label id="abort"><p>
954 <tag/Function/Terminates a program abnormally.
955 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
956 <tag/Declaration/<tt/void abort (void);/
957 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
958 on stderr, then terminates the program with an exit code of 3.
959 <tag/Availability/ISO 9899
961 <ref id="assert" name="assert">,
962 <ref id="exit" name="exit">,
963 <ref id="raise" name="raise">
969 <sect1>abs<label id="abs"><p>
973 <tag/Function/Returns the absolute value of an integer.
974 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
975 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
976 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
978 <tag/Limits/<itemize>
979 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
980 <item>The function is only available as fastcall function, so it may only be
981 used in presence of a prototype.
983 <tag/Availability/ISO 9899
985 <ref id="labs" name="labs">
991 <sect1>assert<label id="assert"><p>
995 <tag/Function/Test a condition and possibly abort.
996 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
997 <tag/Declaration/<tt/void assert (int cond);/
998 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
999 statement. If the condition evaluates t zero (false), assert prints a message
1000 on stderr and aborts the program.
1001 <tag/Limits/<itemize>
1002 <item>The function is actually a macro.
1004 <tag/Availability/ISO 9899
1006 <ref id="abort" name="abort">,
1007 <ref id="exit" name="exit">
1013 <sect1>atexit<label id="atexit"><p>
1017 <tag/Function/Register an exit function.
1018 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1019 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1020 <tag/Description/<tt/atexit/ registers the function pointed to by
1021 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1022 terminates, they are called in LIFO order (the last function registered is
1023 called first). <tt/atexit/ returns zero on success and a nonzero value on
1025 <tag/Limits/<itemize>
1026 <item>A maximum of 5 exit functions can be registered.
1027 <item>There is no way to unregister an exit function.
1028 <item>The function is only available as fastcall function, so it may only be
1029 used in presence of a prototype.
1031 <tag/Availability/ISO 9899
1033 <ref id="abort" name="abort">,
1034 <ref id="exit" name="exit">
1040 <sect1>atoi<label id="atoi"><p>
1044 <tag/Function/Convert a string to an integer.
1045 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1046 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1047 <tag/Description/<tt/atoi/ converts the given string into an integer.
1048 Conversion stops as soon as any invalid character is encountered.
1049 <tag/Limits/<itemize>
1050 <item>There is no way to detect any conversion errors.
1051 <item>The function does not check for an numerical overflow when converting.
1052 <item>The function is only available as fastcall function, so it may only be
1053 used in presence of a prototype.
1055 <tag/Availability/ISO 9899
1057 <ref id="atol" name="atol">,
1058 <ref id="itoa" name="itoa">,
1059 <ref id="ltoa" name="ltoa">,
1060 <ref id="ultoa" name="ultoa">,
1061 <ref id="utoa" name="utoa">
1067 <sect1>atol<label id="atol"><p>
1071 <tag/Function/Convert a string to a long integer.
1072 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1073 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1074 <tag/Description/<tt/atol/ converts the given string into a long integer.
1075 Conversion stops as soon as any invalid character is encountered.
1076 <tag/Limits/<itemize>
1077 <item>There is no way to detect any conversion errors.
1078 <item>The function does not check for an numerical overflow when converting.
1079 <item>The function is only available as fastcall function, so it may only be
1080 used in presence of a prototype.
1082 <tag/Availability/ISO 9899
1084 <ref id="atoi" name="atoi">,
1085 <ref id="itoa" name="itoa">,
1086 <ref id="ltoa" name="ltoa">,
1087 <ref id="ultoa" name="ultoa">,
1088 <ref id="utoa" name="utoa">
1094 <sect1>bgcolor<label id="bgcolor"><p>
1098 <tag/Function/Set the background text color.
1099 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1100 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1101 <tag/Description/The function will set a new background color and return the
1102 old (current) one. The background color is valid for the whole text output
1103 area of the screen, not just for new text.
1104 <tag/Limits/<itemize>
1105 <item>Background colors are system dependent. The function may have no effect
1106 on systems where the background color cannot be changed.
1107 <item>The function is only available as fastcall function, so it may only be
1108 used in presence of a prototype.
1110 <tag/Availability/cc65
1112 <ref id="bordercolor" name="bordercolor">,
1113 <ref id="textcolor" name="textcolor">
1119 <sect1>bordercolor<label id="bordercolor"><p>
1123 <tag/Function/Set the border (frame) color.
1124 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1125 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1126 <tag/Description/The function will set a new border color. It returns the old
1127 (current) border color.
1128 <tag/Limits/<itemize>
1129 <item>Border colors are system dependent. The function may have no effect
1130 on systems where the border color cannot be changed.
1131 <item>The function is only available as fastcall function, so it may only
1132 be used in presence of a prototype.
1134 <tag/Availability/cc65
1136 <ref id="bgcolor" name="bgcolor">,
1137 <ref id="textcolor" name="textcolor">
1143 <sect1>bsearch<label id="bsearch"><p>
1147 <tag/Function/Do a binary search in a sorted array.
1148 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1149 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1150 const void* base, size_t n, size_t size,
1151 int (*cmp) (const void*, const void*));/
1152 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1153 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1154 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1155 the function used to compare the members against the key. The function returns
1156 a pointer to the member found, or <tt/NULL/ if there was no match.
1159 <item>The contents of the array must be sorted in ascending order according to
1160 the compare function given.
1161 <item>If there are multiple members that match the key, the function will
1162 return one of the members.
1163 <item>The function is only available as fastcall function, so it may only
1164 be used in presence of a prototype.
1166 <tag/Availability/ISO 9899
1168 <ref id="qsort" name="qsort">
1174 <sect1>bzero<label id="bzero"><p>
1178 <tag/Function/Fill a memory area with zeroes.
1179 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1180 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1181 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1185 <item>The function is non standard and therefore only available in non ANSI
1186 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1187 <item>The function is only available as fastcall function, so it may only
1188 be used in presence of a prototype.
1190 <tag/Availability/cc65
1192 <ref id="_swap" name="_swap">,
1193 <ref id="memcpy" name="memcpy">,
1194 <ref id="memmove" name="memmove">,
1195 <ref id="memset" name="memset">,
1201 <sect1>c64mode<label id="c64mode"><p>
1205 <tag/Function/Switch the C128 into C64 compatible mode.
1206 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1207 <tag/Declaration/<tt/void c64mode (void);/
1208 <tag/Description/The function will cause the machine to reboot into C64 mode.
1209 <tag/Limits/<itemize>
1210 <item>The function is specific to the C128.
1211 <item>The function will not return to the caller.
1213 <tag/Availability/C128
1219 <sect1>calloc<label id="calloc"><p>
1223 <tag/Function/Allocate and clear memory.
1224 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1225 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1226 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1227 of size <tt/size/, clears the whole block with binary zeroes and returns a
1228 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1232 <item>Clearing the memory may not have the expected effect on all platforms:
1233 pointers in the block may not be <tt/NULL/ and floating point variables may
1234 not be zero (0.0). In other words: The "clearing" effect of this function
1235 should be used with care for portable programs.
1236 <item>The function is only available as fastcall function, so it may only
1237 be used in presence of a prototype.
1239 <tag/Availability/ISO 9899
1241 <ref id="_heapadd" name="_heapadd">,
1242 <ref id="_heapblocksize" name="_heapblocksize">,
1243 <ref id="_heapmaxavail" name="_heapmaxavail">,
1244 <ref id="_heapmemavail" name="_heapmemavail">,
1245 <ref id="free" name="free">,
1246 <ref id="malloc" name="malloc">,
1247 <ref id="realloc" name="realloc">
1253 <sect1>cclear<label id="cclear"><p>
1257 <tag/Function/Clear part of a line (write a given number of spaces).
1258 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1259 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
1260 <tag/Description/The function clears part of a line by writing <tt/length/
1261 spaces in the current text color.
1262 <tag/Limits/<itemize>
1263 <item>The function is only available as fastcall function, so it may
1264 only be used in presence of a prototype.
1266 <tag/Availability/cc65
1268 <ref id="cclearxy" name="cclearxy">,
1269 <ref id="clrscr" name="clrscr">
1275 <sect1>cclearxy<label id="cclearxy"><p>
1279 <tag/Function/Clear part of a line (write a given number of spaces) starting
1280 at a specific screen position.
1281 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1282 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
1283 <tag/Description/The function moves the cursor to a specific position, and
1284 will then clear part of the line by writing <tt/length/ spaces in the current
1286 <tag/Limits/<itemize>
1287 <item>The function is only available as fastcall function, so it may
1288 only be used in presence of a prototype.
1290 <tag/Availability/cc65
1292 <ref id="cclear" name="cclear">,
1293 <ref id="clrscr" name="clrscr">
1299 <sect1>cgetc<label id="cgetc"><p>
1303 <tag/Function/Read a character from the keyboard.
1304 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1305 <tag/Declaration/<tt/char cgetc (void);/
1306 <tag/Description/The function reads a character from the keyboard. If there is
1307 no character available, <tt/cgetc/ waits until the user presses a key. If the
1308 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
1309 displayed while waiting.
1310 <tag/Limits/<itemize>
1311 <item>If the system supports a keyboard buffer, <tt/cgetc/ will fetch a key
1312 from this buffer and wait only if the buffer is empty.
1314 <tag/Availability/cc65
1316 <ref id="cursor" name="cursor">,
1317 <ref id="kbhit" name="kbhit">
1323 <sect1>chline<label id="chline"><p>
1327 <tag/Function/Output a horizontal line in text mode.
1328 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1329 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
1330 <tag/Description/The function outputs a horizontal line with the given length
1331 starting at the current cursor position.
1332 <tag/Limits/<itemize>
1333 <item>The character used to draw the horizontal line is system dependent.
1334 If available, a line drawing character is used. Drawing a line that is partially
1335 off screen leads to undefined behaviour.
1336 <item>The function is only available as fastcall function, so it may only be
1337 used in presence of a prototype.
1339 <tag/Availability/cc65
1341 <ref id="chlinexy" name="chlinexy">,
1342 <ref id="cvline" name="cvline">,
1343 <ref id="cvlinexy" name="cvlinexy">
1349 <sect1>chlinexy<label id="chlinexy"><p>
1353 <tag/Function/Output a horizontal line at a given position in text mode.
1354 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1355 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
1356 <tag/Description/The function outputs a horizontal line with the given length
1357 starting at a given position.
1358 <tag/Limits/<itemize>
1359 <item>The character used to draw the horizontal line is system dependent.
1360 If available, a line drawing character is used. Drawing a line that is partially
1361 off screen leads to undefined behaviour.
1362 <item>The function is only available as fastcall function, so it may only be
1363 used in presence of a prototype.
1365 <tag/Availability/cc65
1367 <ref id="chline" name="chline">,
1368 <ref id="cvline" name="cvline">,
1369 <ref id="cvlinexy" name="cvlinexy">
1375 <sect1>clearerr<label id="clearerr"><p>
1379 <tag/Function/Clear error and end-of-file status of a stream.
1380 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1381 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
1382 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
1383 indicators for the stream <tt/f/.
1384 <tag/Limits/<itemize>
1385 <item>The function is only available as fastcall function, so it may only be
1386 used in presence of a prototype.
1388 <tag/Availability/ISO 9899
1390 <ref id="feof" name="feof">,
1391 <ref id="ferror" name="ferror">
1397 <sect1>clrscr<label id="clrscr"><p>
1401 <tag/Function/Clear the text screen.
1402 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1403 <tag/Declaration/<tt/void clrscr (void);/
1404 <tag/Description/The function clears the text screen and moves the cursor to
1405 the upper left corner.
1406 <tag/Availability/cc65
1408 <ref id="cclear" name="cclear">,
1409 <ref id="cclearxy" name="cclearxy">
1415 <sect1>close<label id="close"><p>
1419 <tag/Function/Close a file descriptor.
1420 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1421 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
1422 <tag/Description/The function closes the given file descriptor. It returns zero
1423 on success and -1 on error. If an error occurs, the cause can be determined by
1424 reading the <tt/errno/ variable.
1425 <tag/Limits/<itemize>
1426 <item>The function is only available as fastcall function, so it may only
1427 be used in presence of a prototype.
1429 <tag/Availability/POSIX 1003.1
1431 <ref id="creat" name="creat">,
1432 <ref id="open" name="open">
1438 <sect1>creat<label id="creat"><p>
1442 <tag/Function/Create a file.
1443 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1444 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
1445 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
1446 associated with it. On error, -1 is returned and an error code is stored in
1448 <tag/Limits/<itemize>
1449 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
1450 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
1451 <item>The function is only available as fastcall function, so it may only
1452 be used in presence of a prototype.
1454 <tag/Availability/POSIX 1003.1
1456 <ref id="close" name="close">,
1457 <ref id="open" name="open">
1463 <sect1>cprintf<label id="cprintf"><p>
1467 <tag/Function/Formatted output to the console.
1468 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1469 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
1470 <tag/Description/The arguments are converted to text where necessary and
1471 formatted according to the format string given. The resulting string is output
1472 to the console. <tt/cprintf/ supports the same format specifiers as
1473 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
1474 <tag/Limits/<itemize>
1475 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
1476 between <tt/\r/ and <tt/\n/.
1478 <tag/Availability/cc65
1480 <ref id="cputc" name="cputc">,
1481 <ref id="cputcxy" name="cputcxy">,
1482 <ref id="cputs" name="cputs">,
1483 <ref id="cputsxy" name="cputsxy">,
1484 <ref id="vcprintf" name="vcprintf">
1490 <sect1>cputc<label id="cputc"><p>
1494 <tag/Function/Output a character directly to the console.
1495 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1496 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
1497 <tag/Description/Output one character to the console at the current cursor
1499 <tag/Limits/<itemize>
1500 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
1501 between <tt/\r/ and <tt/\n/.
1502 <item>The function is only available as fastcall function, so it may only
1503 be used in presence of a prototype.
1505 <tag/Availability/cc65
1507 <ref id="cprintf" name="cprintf">,
1508 <ref id="cputcxy" name="cputcxy">,
1509 <ref id="cputs" name="cputs">,
1510 <ref id="cputsxy" name="cputsxy">,
1511 <ref id="vcprintf" name="vcprintf">
1517 <sect1>cputcxy<label id="cputcxy"><p>
1521 <tag/Function/Output a character at a specific screen position.
1522 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1523 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
1524 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
1525 the screen and outputs one character.
1526 <tag/Limits/<itemize>
1527 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
1528 between <tt/\r/ and <tt/\n/.
1529 <item>The function is only available as fastcall function, so it may only
1530 be used in presence of a prototype.
1532 <tag/Availability/cc65
1534 <ref id="cprintf" name="cprintf">,
1535 <ref id="cputc" name="cputc">,
1536 <ref id="cputs" name="cputs">,
1537 <ref id="cputsxy" name="cputsxy">,
1538 <ref id="vcprintf" name="vcprintf">
1544 <sect1>cputs<label id="cputs"><p>
1548 <tag/Function/Output a string directly to the console.
1549 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1550 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
1551 <tag/Description/The function outputs the given string on the console at the
1552 current cursor position.
1553 <tag/Limits/<itemize>
1554 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
1555 between <tt/\r/ and <tt/\n/.
1556 <item>The function is only available as fastcall function, so it may only
1557 be used in presence of a prototype.
1559 <tag/Availability/cc65
1561 <ref id="cprintf" name="cprintf">,
1562 <ref id="cputc" name="cputc">,
1563 <ref id="cputcxy" name="cputcxy">,
1564 <ref id="cputsxy" name="cputsxy">,
1565 <ref id="vcprintf" name="vcprintf">
1571 <sect1>cputsxy<label id="cputsxy"><p>
1575 <tag/Function/Output a string to the console at a given position.
1576 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1577 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
1578 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
1579 and outputs the string <tt/s/.
1580 <tag/Limits/<itemize>
1581 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
1582 between <tt/\r/ and <tt/\n/.
1583 <item>The function is only available as fastcall function, so it may only
1584 be used in presence of a prototype.
1586 <tag/Availability/cc65
1588 <ref id="cprintf" name="cprintf">,
1589 <ref id="cputc" name="cputc">,
1590 <ref id="cputcxy" name="cputcxy">,
1591 <ref id="cputs" name="cputs">,
1592 <ref id="vcprintf" name="vcprintf">
1598 <sect1>cursor<label id="cursor"><p>
1602 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
1603 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1604 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
1605 <tag/Description/If the argument to the function is non zero, a blinking cursor
1606 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
1607 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
1608 <tag/Limits/<itemize>
1609 <item>The function is only available as fastcall function, so it may only
1610 be used in presence of a prototype.
1612 <tag/Availability/cc65
1614 <ref id="cgetc" name="cgetc">,
1615 <ref id="kbhit" name="kbhit">
1621 <sect1>cvline<label id="cvline"><p>
1625 <tag/Function/Output a vertical line in text mode.
1626 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1627 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
1628 <tag/Description/The function outputs a vertical line with the given length
1629 starting at the current cursor position.
1630 <tag/Limits/<itemize>
1631 <item>The character used to draw the vertical line is system dependent.
1632 If available, a line drawing character is used. Drawing a line that is partially
1633 off screen leads to undefined behaviour.
1634 <item>The function is only available as fastcall function, so it may only be
1635 used in presence of a prototype.
1637 <tag/Availability/cc65
1639 <ref id="chline" name="chline">,
1640 <ref id="chlinexy" name="chlinexy">,
1641 <ref id="cvlinexy" name="cvlinexy">
1647 <sect1>cvlinexy<label id="cvlinexy"><p>
1651 <tag/Function/Output a vertical line at a given position in text mode.
1652 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1653 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
1654 <tag/Description/The function outputs a vertical line with the given length
1655 starting at a given position.
1656 <tag/Limits/<itemize>
1657 <item>The character used to draw the vertical line is system dependent.
1658 If available, a line drawing character is used. Drawing a line that is partially
1659 off screen leads to undefined behaviour.
1660 <item>The function is only available as fastcall function, so it may only be
1661 used in presence of a prototype.
1663 <tag/Availability/cc65
1665 <ref id="chline" name="chline">,
1666 <ref id="chlinexy" name="chlinexy">,
1667 <ref id="cvline" name="cvline">
1673 <sect1>div<label id="div"><p>
1677 <tag/Function/Divide two ints and return quotient and remainder.
1678 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1679 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
1680 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
1681 quotient and remainder in a <tt/div_t/ structure.
1684 <item>The function is only available as fastcall function, so it may only
1685 be used in presence of a prototype.
1687 <tag/Availability/ISO 9899
1695 <sect1>em_commit<label id="em_commit"><p>
1699 <tag/Function/Commit changes into extended memory.
1700 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1701 <tag/Declaration/<tt/void __fastcall__ em_commit (void);/
1702 <tag/Description/Commit changes in the memory window to extended storage. If
1703 the contents of the memory window have been changed, these changes may be lost
1704 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
1705 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
1706 name="em_copyto">/ are called without calling <tt/em_commit/ first.
1707 <tag/Limits/<itemize>
1708 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
1709 memory window are discarded, it does just mean that the drivers is allowed
1711 <item>The function is only available as fastcall function, so it may only be
1712 used in presence of a prototype.
1713 <item>The function produces undefined results if no extended memory driver is
1716 <tag/Availability/cc65
1718 <ref id="em_load_driver" name="em_load_driver">,
1719 <ref id="em_map" name="em_map">,
1720 <ref id="em_use" name="em_use">
1726 <sect1>em_copyfrom<label id="em_copyfrom"><p>
1730 <tag/Function/Copy from extended into normal memory.
1731 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1732 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
1733 <tag/Description/Copy data from extended memory into linear memory. Source and
1734 target addresses as well as the number of bytes to transfer are specified in
1735 the <tt/em_copy/ structure that is passed as a parameter.
1736 <tag/Limits/<itemize>
1737 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
1738 made any changes to the data in the window, call <tt/<ref id="em_commit"
1739 name="em_commit">/ first, or the changes are lost.
1740 <item>The function is only available as fastcall function, so it may only be
1741 used in presence of a prototype.
1742 <item>The function produces undefined results if no extended memory driver is
1745 <tag/Availability/cc65
1747 <ref id="em_commit" name="em_commit">,
1748 <ref id="em_copyto" name="em_copyto">,
1749 <ref id="em_load_driver" name="em_load_driver">
1755 <sect1>em_copyto<label id="em_copyto"><p>
1759 <tag/Function/Copy from normal into extended memory.
1760 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1761 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
1762 <tag/Description/Copy data from linear into extended memory. Source and
1763 target addresses as well as the number of bytes to transfer are specified in
1764 the <tt/em_copy/ structure that is passed as a parameter.
1765 <tag/Limits/<itemize>
1766 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
1767 made any changes to the data in the window, call <tt/<ref id="em_commit"
1768 name="em_commit">/ first, or the changes are lost.
1769 <item>The function is only available as fastcall function, so it may only be
1770 used in presence of a prototype.
1771 <item>The function produces undefined results if no extended memory driver is
1774 <tag/Availability/cc65
1776 <ref id="em_commit" name="em_commit">,
1777 <ref id="em_copyfrom" name="em_copyfrom">,
1778 <ref id="em_load_driver" name="em_load_driver">
1784 <sect1>em_install<label id="em_install"><p>
1788 <tag/Function/Install an already loaded extended memory driver.
1789 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1790 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
1791 <tag/Description/The function installs an already loaded extended memory driver
1792 and returns an error code. The function may be used to install a driver linked
1793 statically to the program.
1794 <tag/Limits/<itemize>
1795 <item>Not all drivers are able to detect if the supported hardware is really
1797 <item>The function is only available as fastcall function, so it may only be
1798 used in presence of a prototype.
1800 <tag/Availability/cc65
1802 <ref id="em_load_driver" name="em_load_driver">,
1803 <ref id="em_uninstall" name="em_uninstall">,
1804 <ref id="em_unload" name="em_unload">
1810 <sect1>em_load_driver<label id="em_load_driver"><p>
1814 <tag/Function/Load and initialize an extended memory driver.
1815 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1816 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
1817 <tag/Description/Load an extended memory driver into memory and initialize
1818 it. The function returns an error code that tells if all this has been
1820 <tag/Limits/<itemize>
1821 <item>Not all drivers are able to detect if the supported hardware is really
1823 <item>The function is only available as fastcall function, so it may only be
1824 used in presence of a prototype.
1825 <item>The driver is loaded by name, so currently you must know the type of
1826 extended memory that should be supported. There is no autodetect capability.
1828 <tag/Availability/cc65
1830 <ref id="em_unload" name="em_unload">
1836 <sect1>em_map<label id="em_map"><p>
1840 <tag/Function/Make a page of extended memory accessible.
1841 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1842 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
1843 <tag/Description/The function maps one page of extended memory into linear
1844 memory and returns a pointer to the page frame. Depending on the hardware
1845 and driver, the data is either mapped into the address space or transfered
1846 into a buffer. If you don't need the actual contents of the page (for example
1847 because you're going to overwrite it completely, it is better to call
1848 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
1849 data if it is possible to avoid that.
1850 <tag/Limits/<itemize>
1851 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
1852 made any changes to the data in the window, call <tt/<ref id="em_commit"
1853 name="em_commit">/ first, or the changes are lost.
1854 <item>The function is only available as fastcall function, so it may only be
1855 used in presence of a prototype.
1856 <item>The function produces undefined results if no extended memory driver is
1859 <tag/Availability/cc65
1861 <ref id="em_commit" name="em_commit">,
1862 <ref id="em_load_driver" name="em_load_driver">,
1863 <ref id="em_use" name="em_use">
1869 <sect1>em_pagecount<label id="em_pagecount"><p>
1873 <tag/Function/Return the number of available extended memory pages.
1874 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1875 <tag/Declaration/<tt/unsigned __fastcall__ em_pagecount (void);/
1876 <tag/Description/The function returns the size of the extended memory supported
1877 by the driver in 256 byte pages.
1878 <tag/Limits/<itemize>
1879 <item>The function returns zero if no extended memory driver is loaded.
1880 <item>The function may return zero if the supported hardware was not detected.
1882 <tag/Availability/cc65
1884 <ref id="em_load_driver" name="em_load_driver">
1890 <sect1>em_uninstall<label id="em_uninstall"><p>
1894 <tag/Function/Uninstall an already loaded extended memory driver.
1895 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1896 <tag/Declaration/<tt/unsigned char __fastcall__ em_install (void);/
1897 <tag/Description/The function uninstalls an already loaded extended memory
1898 driver but doesn't remove it from memory.
1899 <tag/Limits/<itemize>
1900 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
1901 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
1902 should be used instead of <tt/em_uninstall/ so the driver is also removed
1904 <item>The function is only available as fastcall function, so it may only be
1905 used in presence of a prototype.
1907 <tag/Availability/cc65
1909 <ref id="em_install" name="em_install">,
1910 <ref id="em_load_driver" name="em_load_driver">,
1911 <ref id="em_unload" name="em_unload">
1917 <sect1>em_unload<label id="em_unload"><p>
1921 <tag/Function/Unload an extended memory driver.
1922 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1923 <tag/Declaration/<tt/unsigned char __fastcall__ em_unload (void);/
1924 <tag/Description/The function unloads a loaded extended memory driver and
1925 frees all memory allocated for the driver.
1926 <tag/Limits/<itemize>
1927 <item>The function does nothing if no driver is loaded.
1929 <tag/Availability/cc65
1931 <ref id="em_load_driver" name="em_load_driver">
1937 <sect1>em_use<label id="em_use"><p>
1941 <tag/Function/Prepare an extended memory page for use.
1942 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1943 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
1944 <tag/Description/The function maps one page of extended memory into linear
1945 memory and returns a pointer to the page frame. This function is similar to
1946 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
1947 actual memory window in the assumption that the existing data is wrong or
1948 will get overwritten.
1949 <tag/Limits/<itemize>
1950 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
1951 made any changes to the data in the window, call <tt/<ref id="em_commit"
1952 name="em_commit">/ first, or the changes are lost.
1953 <item>The function is only available as fastcall function, so it may only be
1954 used in presence of a prototype.
1955 <item>The function produces undefined results if no extended memory driver is
1958 <tag/Availability/cc65
1960 <ref id="em_commit" name="em_commit">,
1961 <ref id="em_load_driver" name="em_load_driver">,
1962 <ref id="em_map" name="em_map">
1968 <sect1>exit<label id="exit"><p>
1972 <tag/Function/Terminate the program.
1973 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1974 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
1975 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
1976 return code of the program. Before termination, all files are closed, buffered
1977 output is written and any functions registered with <tt/<ref id="atexit"
1978 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
1979 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
1981 <tag/Limits/<itemize>
1982 <item>The function is only available as fastcall function, so it may only
1983 be used in presence of a prototype.
1984 <item>It depends on the host machine if the program return code can be
1985 evaluated or is ignored.
1987 <tag/Availability/ISO 9899
1989 <ref id="abort" name="abort">,
1990 <ref id="exit" name="exit">
1996 <sect1>fast<label id="fast"><p>
2000 <tag/Function/Switch the C128 into 2MHz mode.
2001 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
2002 <tag/Declaration/<tt/void fast (void);/
2003 <tag/Description/The function will switch the clock of the C128 to 2MHz. This
2004 will nearly double the speed compared to slow mode.
2005 <tag/Limits/<itemize>
2006 <item>The function is specific to the C128.
2007 <item>2MHz clock will not work in 40 column mode.
2009 <tag/Availability/C128
2011 <ref id="slow" name="slow">,
2012 <ref id="toggle_videomode" name="toggle_videomode">
2018 <sect1>feof<label id="feof"><p>
2022 <tag/Function/Return the end-of-file indicator of a stream.
2023 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2024 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
2025 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
2026 <tt/f/, and returns a non zero value if it is set.
2027 <tag/Limits/<itemize>
2028 <item>The indicator is set only after a read past the end of a file is
2030 <item>The function is only available as fastcall function, so it may only be
2031 used in presence of a prototype.
2033 <tag/Availability/ISO 9899
2035 <ref id="feof" name="clearerr">,
2036 <ref id="ferror" name="ferror">
2042 <sect1>ferror<label id="ferror"><p>
2046 <tag/Function/Return the error indicator of a stream.
2047 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2048 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
2049 <tag/Description/<tt/ferror/ tests the error indicator of the stream
2050 <tt/f/, and returns a non zero value if it is set.
2051 <tag/Limits/<itemize>
2052 <item>The function is only available as fastcall function, so it may only be
2053 used in presence of a prototype.
2055 <tag/Availability/ISO 9899
2057 <ref id="feof" name="clearerr">,
2058 <ref id="ferror" name="feof">
2064 <sect1>fileno<label id="fileno"><p>
2068 <tag/Function/Return the file handle used by a stream.
2069 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2070 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
2071 <tag/Description/The <tt/fileno/ function returns the file handle used
2072 internally by a C stream. This file handle (an integer) can be used as a
2073 handle for the POSIX input/output functions.
2074 <tag/Limits/<itemize>
2075 <item>The function is only available as fastcall function, so it may only be
2076 used in presence of a prototype.
2077 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
2078 file may have unpredictable results.
2080 <tag/Availability/POSIX 1003.1
2082 <ref id="creat" name="creat">,
2083 <ref id="open" name="open"> <!-- , -->
2084 <!-- <ref id="read" name="read">, -->
2085 <!-- <ref id="write" name="write"> -->
2091 <sect1>free<label id="free"><p>
2095 <tag/Function/Free a block of dynamic memory.
2096 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2097 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
2098 <tag/Description/Free a block of dynamic memory previously allocated with
2099 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
2100 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
2101 pointer is <tt/NULL/, no action is performed.
2104 <item>Passing an already free'd block to <tt/free/ again will cause undefined
2105 behaviour and may crash your program.
2106 <item>The function is only available as fastcall function, so it may only
2107 be used in presence of a prototype.
2109 <tag/Availability/ISO 9899
2111 <ref id="_heapadd" name="_heapadd">,
2112 <ref id="_heapblocksize" name="_heapblocksize">,
2113 <ref id="_heapmaxavail" name="_heapmaxavail">,
2114 <ref id="_heapmemavail" name="_heapmemavail">,
2115 <ref id="calloc" name="calloc">,
2116 <ref id="malloc" name="malloc">,
2117 <ref id="realloc" name="realloc">
2123 <sect1>get_ostype<label id="get_ostype"><p>
2127 <tag/Function/The function returns the operating system, the program runs on.
2128 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
2129 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
2130 <tag/Declaration/<tt/unsigned char get_ostype (void);/
2131 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
2132 all supported targets. If it exists, it returns a number that identifies the
2133 operating system or machine type, the program runs on. The machine dependent
2134 header files define constants that can be used to check the return code.
2135 <tag/Limits/<itemize>
2136 <item>The function does not exist on all platforms.
2137 <item>The return codes are platform dependent.
2139 <tag/Availability/cc65 (not all platforms)
2145 <sect1>getenv<label id="getenv"><p>
2149 <tag/Function/Return a value from the environment.
2150 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2151 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
2152 <tag/Description/The function searches the environment for an entry that
2153 matches <tt/name/ and returns its value. The environment consists of a list
2154 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
2156 <tag/Limits/<itemize>
2157 <item>What exactly is stored in the environment depends on the machine the
2158 program is running on.
2159 <item>The function is only available as fastcall function, so it may only
2160 be used in presence of a prototype.
2162 <tag/Availability/ISO 9899
2168 <sect1>getcpu<label id="getcpu"><p>
2172 <tag/Function/Determine on which CPU the program is running.
2173 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
2174 <tag/Declaration/<tt/unsigned char getcpu (void);/
2175 <tag/Description/The function checks on which CPU the code is running. It
2176 returns one of the constants<itemize>
2178 <item><tt/CPU_65C02/
2179 <item><tt/CPU_65816/
2181 <tag/Limits/<itemize>
2182 <item>Other, more exotic CPU types are not disinguished.
2184 <tag/Availability/cc65
2190 <sect1>gotox<label id="gotox"><p>
2194 <tag/Function/Move the text mode cursor to a new X position.
2195 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2196 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
2197 <tag/Description/The function moves the text mode cursor to the specified X
2198 position while leaving the Y position untouched. The leftmost position on the
2199 screen has the coordinate 0.
2200 <tag/Limits/<itemize>
2201 <item>The function is only available as fastcall function, so it may
2202 only be used in presence of a prototype.
2203 <item>Invalid values for the X position (out of screen coordinates) may
2204 lead to undefined behaviour.
2206 <tag/Availability/cc65
2208 <ref id="gotoy" name="gotoy">,
2209 <ref id="gotoxy" name="gotoxy">,
2210 <ref id="wherex" name="wherex">,
2211 <ref id="wherey" name="wherey">
2217 <sect1>gotoxy<label id="gotoxy"><p>
2221 <tag/Function/Move the text mode cursor to a new position.
2222 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2223 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
2224 <tag/Description/The function moves the text mode cursor to the specified
2225 position. The leftmost position on the screen has the X coordinate 0, the
2226 topmost line has the Y coordinate 0.
2227 <tag/Limits/<itemize>
2228 <item>The function is only available as fastcall function, so it may only be
2229 used in presence of a prototype.
2230 <item>Invalid values for any of both coordinates (out of screen positions) may
2231 lead to undefined behaviour.
2233 <tag/Availability/cc65
2235 <ref id="gotox" name="gotox">,
2236 <ref id="gotoy" name="gotoy">,
2237 <ref id="wherex" name="wherex">,
2238 <ref id="wherey" name="wherey">
2244 <sect1>gotoy<label id="gotoy"><p>
2248 <tag/Function/Move the text mode cursor to a new Y position.
2249 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2250 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
2251 <tag/Description/The function moves the text mode cursor to the specified Y
2252 position while leaving the X position untouched. The uppermost position on the
2253 screen has the coordinate 0.
2254 <tag/Limits/<itemize>
2255 <item>The function is only available as fastcall function, so it may
2256 only be used in presence of a prototype.
2257 <item>Invalid values for the Y position (out of screen coordinates) may lead
2258 to undefined behaviour.
2260 <tag/Availability/cc65
2262 <ref id="gotox" name="gotox">,
2263 <ref id="gotoxy" name="gotoxy">,
2264 <ref id="wherex" name="wherex">,
2265 <ref id="wherey" name="wherey">
2271 <sect1>isalnum<label id="isalnum"><p>
2275 <tag/Function/Check if a given character is a letter or digit.
2276 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2277 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
2278 <tag/Description/The function returns a value of zero if the given argument
2279 is a letter or digit. The return value is non zero if the character
2281 <tag/Limits/<itemize>
2282 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2283 inline sequence generated by the macro will not work correctly for values
2284 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2285 this range. The non inline function may be accessed by <tt/#undef/'ing
2287 <item>When compiling without <tt/-Os/, the function is only available as
2288 fastcall function, so it may only be used in presence of a prototype.
2290 <tag/Availability/ISO 9899
2292 <ref id="isalpha" name="isalpha">,
2293 <ref id="isascii" name="isascii">,
2294 <ref id="isblank" name="isblank">,
2295 <ref id="iscntrl" name="iscntrl">,
2296 <ref id="isdigit" name="isdigit">,
2297 <ref id="isgraph" name="isgraph">,
2298 <ref id="islower" name="islower">,
2299 <ref id="isprint" name="isprint">,
2300 <ref id="ispunct" name="ispunct">,
2301 <ref id="isspace" name="isspace">,
2302 <ref id="isupper" name="isupper">,
2303 <ref id="isxdigit" name="isxdigit">
2309 <sect1>isalpha<label id="isalpha"><p>
2313 <tag/Function/Check if a given character is a letter.
2314 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2315 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
2316 <tag/Description/The function returns a value of zero if the given argument
2317 is a letter. The return value is non zero if the character is anything else.
2318 <tag/Limits/<itemize>
2319 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2320 inline sequence generated by the macro will not work correctly for values
2321 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2322 this range. The non inline function may be accessed by <tt/#undef/'ing the
2324 <item>When compiling without <tt/-Os/, the function is only available as
2325 fastcall function, so it may only be used in presence of a prototype.
2327 <tag/Availability/ISO 9899
2329 <ref id="isalnum" name="isalnum">,
2330 <ref id="isascii" name="isascii">,
2331 <ref id="isblank" name="isblank">,
2332 <ref id="iscntrl" name="iscntrl">,
2333 <ref id="isdigit" name="isdigit">,
2334 <ref id="isgraph" name="isgraph">,
2335 <ref id="islower" name="islower">,
2336 <ref id="isprint" name="isprint">,
2337 <ref id="ispunct" name="ispunct">,
2338 <ref id="isspace" name="isspace">,
2339 <ref id="isupper" name="isupper">,
2340 <ref id="isxdigit" name="isxdigit">
2346 <sect1>isascii<label id="isascii"><p>
2350 <tag/Function/Check if a given character is in the ASCII (0..127) range.
2351 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2352 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
2353 <tag/Description/The function returns a value of zero if the given argument
2354 is in the range 0..127 (the range of valid ASCII characters) and a non zero
2356 <tag/Limits/<itemize>
2357 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2358 inline sequence generated by the macro will not work correctly for values
2359 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2360 this range. The non inline function may be accessed by <tt/#undef/'ing the
2362 <item>When compiling without <tt/-Os/, the function is only available as
2363 fastcall function, so it may only be used in presence of a prototype.
2365 <tag/Availability/ISO 9899
2367 <ref id="isalnum" name="isalnum">,
2368 <ref id="isalpha" name="isalpha">,
2369 <ref id="isblank" name="isblank">,
2370 <ref id="iscntrl" name="iscntrl">,
2371 <ref id="isdigit" name="isdigit">,
2372 <ref id="isgraph" name="isgraph">,
2373 <ref id="islower" name="islower">,
2374 <ref id="isprint" name="isprint">,
2375 <ref id="ispunct" name="ispunct">,
2376 <ref id="isspace" name="isspace">,
2377 <ref id="isupper" name="isupper">,
2378 <ref id="isxdigit" name="isxdigit">
2384 <sect1>isblank<label id="isblank"><p>
2388 <tag/Function/Check if a given character is a space or tab.
2389 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2390 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
2391 <tag/Description/The function returns a value of zero if the given argument
2392 is a space or tab character. The return value is non zero if the character
2394 <tag/Limits/<itemize>
2395 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2396 inline sequence generated by the macro will not work correctly for values
2397 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2398 this range. The non inline function may be accessed by <tt/#undef/'ing the
2400 <item>When compiling without <tt/-Os/, the function is only available as
2401 fastcall function, so it may only be used in presence of a prototype.
2403 <tag/Availability/cc65
2405 <ref id="isalnum" name="isalnum">,
2406 <ref id="isalpha" name="isalpha">,
2407 <ref id="isascii" name="isascii">,
2408 <ref id="iscntrl" name="iscntrl">,
2409 <ref id="isdigit" name="isdigit">,
2410 <ref id="isgraph" name="isgraph">,
2411 <ref id="islower" name="islower">,
2412 <ref id="isprint" name="isprint">,
2413 <ref id="ispunct" name="ispunct">,
2414 <ref id="isspace" name="isspace">,
2415 <ref id="isupper" name="isupper">,
2416 <ref id="isxdigit" name="isxdigit">
2422 <sect1>iscntrl<label id="iscntrl"><p>
2426 <tag/Function/Check if a given character is a control character.
2427 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2428 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
2429 <tag/Description/The function returns a value of zero if the given argument
2430 is a control character. The return value is non zero if the character
2432 <tag/Limits/<itemize>
2433 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2434 inline sequence generated by the macro will not work correctly for values
2435 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2436 this range. The non inline function may be accessed by <tt/#undef/'ing the
2438 <item>When compiling without <tt/-Os/, the function is only available as
2439 fastcall function, so it may only be used in presence of a prototype.
2441 <tag/Availability/ISO 9899
2443 <ref id="isalnum" name="isalnum">,
2444 <ref id="isalpha" name="isalpha">,
2445 <ref id="isascii" name="isascii">,
2446 <ref id="isblank" name="isblank">,
2447 <ref id="isdigit" name="isdigit">,
2448 <ref id="isgraph" name="isgraph">,
2449 <ref id="islower" name="islower">,
2450 <ref id="isprint" name="isprint">,
2451 <ref id="ispunct" name="ispunct">,
2452 <ref id="isspace" name="isspace">,
2453 <ref id="isupper" name="isupper">,
2454 <ref id="isxdigit" name="isxdigit">
2460 <sect1>isdigit<label id="isdigit"><p>
2464 <tag/Function/Check if a given character is a digit.
2465 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2466 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
2467 <tag/Description/The function returns a value of zero if the given argument
2468 is a digit. The return value is non zero if the character is anything else.
2469 <tag/Limits/<itemize>
2470 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2471 inline sequence generated by the macro will not work correctly for values
2472 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2473 this range. The non inline function may be accessed by <tt/#undef/'ing the
2475 <item>When compiling without <tt/-Os/, the function is only available as
2476 fastcall function, so it may only be used in presence of a prototype.
2478 <tag/Availability/ISO 9899
2480 <ref id="isalnum" name="isalnum">,
2481 <ref id="isalpha" name="isalpha">,
2482 <ref id="isascii" name="isascii">,
2483 <ref id="isblank" name="isblank">,
2484 <ref id="iscntrl" name="iscntrl">,
2485 <ref id="isgraph" name="isgraph">,
2486 <ref id="islower" name="islower">,
2487 <ref id="isprint" name="isprint">,
2488 <ref id="ispunct" name="ispunct">,
2489 <ref id="isspace" name="isspace">,
2490 <ref id="isupper" name="isupper">,
2491 <ref id="isxdigit" name="isxdigit">
2497 <sect1>isgraph<label id="isgraph"><p>
2501 <tag/Function/Check if a given character is a printable character (except
2503 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2504 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
2505 <tag/Description/The function returns a value of zero if the given argument
2506 is a printable character with the exception of space. The return value is non
2507 zero if the character is anything else.
2508 <tag/Limits/<itemize>
2509 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2510 inline sequence generated by the macro will not work correctly for values
2511 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2512 this range. The non inline function may be accessed by <tt/#undef/'ing the
2514 <item>When compiling without <tt/-Os/, the function is only available as
2515 fastcall function, so it may only be used in presence of a prototype.
2517 <tag/Availability/ISO 9899
2519 <ref id="isalnum" name="isalnum">,
2520 <ref id="isalpha" name="isalpha">,
2521 <ref id="isascii" name="isascii">,
2522 <ref id="isblank" name="isblank">,
2523 <ref id="iscntrl" name="iscntrl">,
2524 <ref id="isdigit" name="isdigit">,
2525 <ref id="islower" name="islower">,
2526 <ref id="isprint" name="isprint">,
2527 <ref id="ispunct" name="ispunct">,
2528 <ref id="isspace" name="isspace">,
2529 <ref id="isupper" name="isupper">,
2530 <ref id="isxdigit" name="isxdigit">
2536 <sect1>islower<label id="islower"><p>
2540 <tag/Function/Check if a given character is a lower case letter.
2541 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2542 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
2543 <tag/Description/The function returns a value of zero if the given argument
2544 is a lower case letter. The return value is non zero if the character is
2546 <tag/Limits/<itemize>
2547 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2548 inline sequence generated by the macro will not work correctly for values
2549 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2550 this range. The non inline function may be accessed by <tt/#undef/'ing the
2552 <item>When compiling without <tt/-Os/, the function is only available as
2553 fastcall function, so it may only be used in presence of a prototype.
2555 <tag/Availability/ISO 9899
2557 <ref id="isalnum" name="isalnum">,
2558 <ref id="isalpha" name="isalpha">,
2559 <ref id="isascii" name="isascii">,
2560 <ref id="isblank" name="isblank">,
2561 <ref id="iscntrl" name="iscntrl">,
2562 <ref id="isdigit" name="isdigit">,
2563 <ref id="isgraph" name="isgraph">,
2564 <ref id="isprint" name="isprint">,
2565 <ref id="ispunct" name="ispunct">,
2566 <ref id="isspace" name="isspace">,
2567 <ref id="isupper" name="isupper">,
2568 <ref id="isxdigit" name="isxdigit">
2574 <sect1>isprint<label id="isprint"><p>
2578 <tag/Function/Check if a given character is a printable character.
2579 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2580 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
2581 <tag/Description/The function returns a value of zero if the given argument
2582 is a printable character (this includes the space character). The return value
2583 is non zero if the character is anything else.
2584 <tag/Limits/<itemize>
2585 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2586 inline sequence generated by the macro will not work correctly for values
2587 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2588 this range. The non inline function may be accessed by <tt/#undef/'ing the
2590 <item>When compiling without <tt/-Os/, the function is only available as
2591 fastcall function, so it may only be used in presence of a prototype.
2593 <tag/Availability/ISO 9899
2595 <ref id="isalnum" name="isalnum">,
2596 <ref id="isalpha" name="isalpha">,
2597 <ref id="isascii" name="isascii">,
2598 <ref id="isblank" name="isblank">,
2599 <ref id="iscntrl" name="iscntrl">,
2600 <ref id="isdigit" name="isdigit">,
2601 <ref id="isgraph" name="isgraph">,
2602 <ref id="islower" name="islower">,
2603 <ref id="ispunct" name="ispunct">,
2604 <ref id="isspace" name="isspace">,
2605 <ref id="isupper" name="isupper">,
2606 <ref id="isxdigit" name="isxdigit">
2612 <sect1>ispunct<label id="ispunct"><p>
2616 <tag/Function/Check if a given character is a printable character but not a
2617 space or an alphanumeric character.
2618 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2619 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
2620 <tag/Description/The function returns a value of zero if the given argument
2621 is a printable character, but not a space or anything alphanumeric. The return
2622 value is non zero if the character is anything else.
2623 <tag/Limits/<itemize>
2624 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2625 inline sequence generated by the macro will not work correctly for values
2626 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2627 this range. The non inline function may be accessed by <tt/#undef/'ing the
2629 <item>When compiling without <tt/-Os/, the function is only available as
2630 fastcall function, so it may only be used in presence of a prototype.
2632 <tag/Availability/ISO 9899
2634 <ref id="isalnum" name="isalnum">,
2635 <ref id="isalpha" name="isalpha">,
2636 <ref id="isascii" name="isascii">,
2637 <ref id="isblank" name="isblank">,
2638 <ref id="iscntrl" name="iscntrl">,
2639 <ref id="isdigit" name="isdigit">,
2640 <ref id="isgraph" name="isgraph">,
2641 <ref id="islower" name="islower">,
2642 <ref id="isprint" name="isprint">,
2643 <ref id="isspace" name="isspace">,
2644 <ref id="isupper" name="isupper">,
2645 <ref id="isxdigit" name="isxdigit">
2651 <sect1>isspace<label id="isspace"><p>
2655 <tag/Function/Check if a given character is a a white-space character.
2656 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2657 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
2658 <tag/Description/The function returns a value of zero if the given argument
2659 is a white space character. The return value is non zero if the character is
2660 anything else. The standard white space characters are: space, formfeed ('\f'),
2661 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
2663 <tag/Limits/<itemize>
2664 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2665 inline sequence generated by the macro will not work correctly for values
2666 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2667 this range. The non inline function may be accessed by <tt/#undef/'ing the
2669 <item>When compiling without <tt/-Os/, the function is only available as
2670 fastcall function, so it may only be used in presence of a prototype.
2672 <tag/Availability/ISO 9899
2674 <ref id="isalnum" name="isalnum">,
2675 <ref id="isalpha" name="isalpha">,
2676 <ref id="isascii" name="isascii">,
2677 <ref id="isblank" name="isblank">,
2678 <ref id="iscntrl" name="iscntrl">,
2679 <ref id="isdigit" name="isdigit">,
2680 <ref id="isgraph" name="isgraph">,
2681 <ref id="islower" name="islower">,
2682 <ref id="isprint" name="isprint">,
2683 <ref id="ispunct" name="ispunct">,
2684 <ref id="isupper" name="isupper">,
2685 <ref id="isxdigit" name="isxdigit">
2691 <sect1>isupper<label id="isupper"><p>
2695 <tag/Function/Check if a given character is an upper case letter.
2696 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2697 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
2698 <tag/Description/The function returns a value of zero if the given argument
2699 is an upper case letter. The return value is non zero if the character is
2701 <tag/Limits/<itemize>
2702 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2703 inline sequence generated by the macro will not work correctly for values
2704 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2705 this range. The non inline function may be accessed by <tt/#undef/'ing the
2707 <item>When compiling without <tt/-Os/, the function is only available as
2708 fastcall function, so it may only be used in presence of a prototype.
2710 <tag/Availability/ISO 9899
2712 <ref id="isalnum" name="isalnum">,
2713 <ref id="isalpha" name="isalpha">,
2714 <ref id="isascii" name="isascii">,
2715 <ref id="isblank" name="isblank">,
2716 <ref id="iscntrl" name="iscntrl">,
2717 <ref id="isdigit" name="isdigit">,
2718 <ref id="isgraph" name="isgraph">,
2719 <ref id="islower" name="islower">,
2720 <ref id="isprint" name="isprint">,
2721 <ref id="ispunct" name="ispunct">,
2722 <ref id="isspace" name="isspace">,
2723 <ref id="isxdigit" name="isxdigit">
2729 <sect1>isxdigit<label id="isxdigit"><p>
2733 <tag/Function/Check if a given character is a hexadecimal digit.
2734 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2735 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
2736 <tag/Description/The function returns a value of zero if the given argument
2737 is a hexadecimal digit (0..9, a..f and A..F). The return value is non zero
2738 if the character is anything else.
2739 <tag/Limits/<itemize>
2740 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2741 inline sequence generated by the macro will not work correctly for values
2742 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2743 this range. The non inline function may be accessed by <tt/#undef/'ing the
2745 <item>When compiling without <tt/-Os/, the function is only available as
2746 fastcall function, so it may only be used in presence of a prototype.
2748 <tag/Availability/ISO 9899
2750 <ref id="isalnum" name="isalnum">,
2751 <ref id="isalpha" name="isalpha">,
2752 <ref id="isascii" name="isascii">,
2753 <ref id="isblank" name="isblank">,
2754 <ref id="iscntrl" name="iscntrl">,
2755 <ref id="isdigit" name="isdigit">,
2756 <ref id="isgraph" name="isgraph">,
2757 <ref id="islower" name="islower">,
2758 <ref id="isprint" name="isprint">,
2759 <ref id="ispunct" name="ispunct">,
2760 <ref id="isspace" name="isspace">,
2761 <ref id="isupper" name="isupper">
2767 <sect1>itoa<label id="itoa"><p>
2771 <tag/Function/Convert an integer into a string.
2772 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2773 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
2774 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
2775 <tt/radix/ as the base.
2776 <tag/Limits/<itemize>
2777 <item>There are no provisions to prevent a buffer overflow.
2778 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
2779 <item>The function is non standard, so it is not available in strict ANSI mode.
2780 You should probably use <tt/sprintf/ instead.
2781 <item>The function is only available as fastcall function, so it may only be
2782 used in presence of a prototype.
2784 <tag/Availability/cc65
2786 <ref id="atoi" name="atoi">,
2787 <ref id="atol" name="atol">,
2788 <ref id="ltoa" name="ltoa">,
2789 <ref id="ultoa" name="ultoa">,
2790 <ref id="utoa" name="utoa">
2796 <sect1>joy_count<label id="joy_count"><p>
2800 <tag/Function/Return the number of joysticks supported by the current driver.
2801 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2802 <tag/Declaration/<tt/unsigned char __fastcall__ joy_count (void);/
2803 <tag/Description/The function returns a the number of joysticks supported
2804 by the current joystick driver.
2805 <tag/Limits/<itemize>
2806 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
2807 name="joy_load_driver"> before calling this function.
2808 <item>The function returns the number of joysticks supported by the driver.
2809 There's no way to check for the number of actually connected joysticks.
2810 <item>The function is only available as fastcall function, so it may only be
2811 used in presence of a prototype.
2813 <tag/Availability/cc65
2815 <ref id="joy_load_driver" name="joy_load_driver">,
2816 <ref id="joy_read" name="joy_read">
2822 <sect1>joy_install<label id="joy_install"><p>
2826 <tag/Function/Install an already loaded driver and return an error code.
2827 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2828 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
2829 <tag/Description/The function installs a driver that was already loaded into
2830 memory (or linked statically to the program). It returns an error code
2831 (<tt/JOY_ERR_OK/ in case of success).
2832 <tag/Limits/<itemize>
2833 <item>The function is only available as fastcall function, so it may only be
2834 used in presence of a prototype.
2836 <tag/Availability/cc65
2838 <ref id="joy_load_driver" name="joy_load_driver">,
2839 <ref id="joy_uninstall" name="joy_uninstall">,
2840 <ref id="joy_unload" name="joy_unload">
2846 <sect1>joy_load_driver<label id="joy_load_driver"><p>
2850 <tag/Function/Load a driver from disk and install it.
2851 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2852 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
2853 <tag/Description/The function loads a driver with the given name from disk
2854 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
2855 driver was successfully loaded and installed.
2856 <tag/Limits/<itemize>
2857 <item>The function is only available as fastcall function, so it may only be
2858 used in presence of a prototype.
2860 <tag/Availability/cc65
2862 <ref id="joy_install" name="joy_install">,
2863 <ref id="joy_uninstall" name="joy_uninstall">,
2864 <ref id="joy_unload" name="joy_unload">
2870 <sect1>joy_read<label id="joy_read"><p>
2874 <tag/Function/Read the status of a joystick.
2875 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2876 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
2877 <tag/Description/The function reads the status bits for a joystick. The number
2878 of the joystick is passed as parameter. The result may be examined by using one
2879 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
2880 <tag/Limits/<itemize>
2881 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
2882 name="joy_load_driver"> before calling this function.
2883 <item>The function is only available as fastcall function, so it may only be
2884 used in presence of a prototype.
2886 <tag/Availability/cc65
2888 <ref id="joy_count" name="joy_count">,
2889 <ref id="joy_load_driver" name="joy_load_driver">,
2890 <ref id="joy_unload" name="joy_unload">
2896 <sect1>joy_uninstall<label id="joy_uninstall"><p>
2900 <tag/Function/Uninstall the current joystick driver.
2901 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2902 <tag/Declaration/<tt/unsigned char __fastcall__ joy_uninstall (void);/
2903 <tag/Description/The function uninstalls the currently installed joystick
2904 driver. It does not remove the driver from memory. The function returns an
2905 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
2906 <tag/Limits/<itemize>
2907 <item>A joystick driver must be installed using <ref id="joy_install"
2908 name="joy_install"> before calling this function.
2909 <item>The function is only available as fastcall function, so it may only be
2910 used in presence of a prototype.
2912 <tag/Availability/cc65
2914 <ref id="joy_install" name="joy_install">,
2915 <ref id="joy_load_driver" name="joy_load_driver">,
2916 <ref id="joy_unload" name="joy_unload">
2922 <sect1>joy_unload<label id="joy_unload"><p>
2926 <tag/Function/Uninstall, then unload the current joystick driver.
2927 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2928 <tag/Declaration/<tt/unsigned char __fastcall__ joy_unload (void);/
2929 <tag/Description/The function uninstalls the currently installed joystick
2930 driver and removes it from memory. An error code is returned, which is
2931 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
2932 <tag/Limits/<itemize>
2933 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
2934 name="joy_load_driver"> before calling this function.
2935 <item>The function is only available as fastcall function, so it may only be
2936 used in presence of a prototype.
2938 <tag/Availability/cc65
2940 <ref id="joy_load_driver" name="joy_load_driver">
2946 <sect1>kbhit<label id="kbhit"><p>
2950 <tag/Function/Check if there's a key waiting in the keyboard buffer.
2951 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2952 <tag/Declaration/<tt/unsigned char kbhit (void);/
2953 <tag/Description/The function returns a value of zero if there is no character
2954 waiting to be read from the keyboard. It returns non zero otherwise.
2955 <tag/Limits/<itemize>
2956 <item>If the system does not support a keyboard buffer (most systems
2957 do), the function is rather useless.
2959 <tag/Availability/cc65
2961 <ref id="cgetc" name="cgetc">,
2962 <ref id="cursor" name="cursor">
2968 <sect1>labs<label id="labs"><p>
2972 <tag/Function/Returns the absolute value of a long integer.
2973 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2974 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
2975 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
2977 <tag/Limits/<itemize>
2978 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
2979 <item>The function is only available as fastcall function, so it may only be
2980 used in presence of a prototype.
2982 <tag/Availability/ISO 9899
2984 <ref id="abs" name="abs">
2990 <sect1>ltoa<label id="ltoa"><p>
2994 <tag/Function/Convert a long integer into a string.
2995 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2996 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
2997 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
2998 using <tt/radix/ as the base.
2999 <tag/Limits/<itemize>
3000 <item>There are no provisions to prevent a buffer overflow.
3001 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
3002 <item>The function is non standard, so it is not available in strict ANSI mode.
3003 You should probably use <tt/sprintf/ instead.
3004 <item>The function is only available as fastcall function, so it may only be
3005 used in presence of a prototype.
3007 <tag/Availability/cc65
3009 <ref id="atoi" name="atoi">,
3010 <ref id="atol" name="atol">,
3011 <ref id="itoa" name="itoa">,
3012 <ref id="ultoa" name="ultoa">,
3013 <ref id="utoa" name="utoa">
3019 <sect1>localeconv<label id="localeconv"><p>
3023 <tag/Function/Returns a pointer to the current locale structure.
3024 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
3025 <tag/Declaration/<tt/struct lconv* localeconv (void);/
3026 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
3028 <tag/Limits/<itemize>
3029 <item>cc65 supports only the "C" locale, so even after setting a new locale
3030 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
3033 <tag/Availability/ISO 9899
3035 <ref id="setlocale" name="setlocale">
3041 <sect1>longjmp<label id="longjmp"><p>
3045 <tag/Function/Non local goto.
3046 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
3047 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
3048 <tag/Description/The <tt/longjmp/ function restores a program context from the
3049 data in <tt/buf/, which must have been set by a preceeding call to
3050 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
3051 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
3055 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
3056 was called with a value of one.
3057 <item>The function is only available as fastcall function, so it may only
3058 be used in presence of a prototype.
3060 <tag/Availability/ISO 9899
3062 <ref id="setjmp" name="setjmp">
3068 <sect1>malloc<label id="malloc"><p>
3072 <tag/Function/Allocate dynamic memory.
3073 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3074 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
3075 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
3076 pointer to the allocated memory block. On error (not enough memory available),
3077 <tt/malloc/ returns <tt/NULL/.
3080 <item>The function is only available as fastcall function, so it may only
3081 be used in presence of a prototype.
3083 <tag/Availability/ISO 9899
3085 <ref id="_heapadd" name="_heapadd">,
3086 <ref id="_heapblocksize" name="_heapblocksize">,
3087 <ref id="_heapmaxavail" name="_heapmaxavail">,
3088 <ref id="_heapmemavail" name="_heapmemavail">,
3089 <ref id="calloc" name="calloc">,
3090 <ref id="free" name="free">,
3091 <ref id="realloc" name="realloc">,
3092 <ref id="strdup" name="strdup">
3098 <sect1>memchr<label id="memchr"><p>
3102 <tag/Function/Search for a character in a block of raw memory.
3103 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3104 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
3105 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
3106 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
3107 that is of size <tt/count/. Upon completion, the function returns a pointer to
3108 the character found, or a null pointer if the character was not found.
3109 <tag/Limits/<itemize>
3110 <item>The function is only available as fastcall function, so it may only
3111 be used in presence of a prototype.
3113 <tag/Availability/ISO 9899
3115 <ref id="strchr" name="strchr">
3121 <sect1>memcpy<label id="memcpy"><p>
3125 <tag/Function/Copy a memory area.
3126 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3127 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
3128 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
3129 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
3133 <item>The result is undefined if the memory areas do overlap. Use
3134 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
3135 <item>The function is only available as fastcall function, so it may only
3136 be used in presence of a prototype.
3138 <tag/Availability/ISO 9899
3140 <ref id="_swap" name="_swap">,
3141 <ref id="memmove" name="memmove">,
3142 <ref id="memset" name="memset">
3148 <sect1>memmove<label id="memmove"><p>
3152 <tag/Function/Copy a memory area.
3153 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3154 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
3155 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
3156 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
3160 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
3161 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
3162 <item>The function is only available as fastcall function, so it may only
3163 be used in presence of a prototype.
3165 <tag/Availability/ISO 9899
3167 <ref id="_swap" name="_swap">,
3168 <ref id="memcpy" name="memcpy">,
3169 <ref id="memset" name="memset">
3175 <sect1>memset<label id="memset"><p>
3179 <tag/Function/Fill a memory area.
3180 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3181 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
3182 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
3183 the value <tt/val/. The function returns <tt/p/.
3186 <item>The function is only available as fastcall function, so it may only
3187 be used in presence of a prototype.
3189 <tag/Availability/ISO 9899
3191 <ref id="_swap" name="_swap">,
3192 <ref id="bzero" name="bzero">,
3193 <ref id="memcpy" name="memcpy">,
3194 <ref id="memmove" name="memmove">
3200 <sect1>mod_free<label id="mod_free"><p>
3204 <tag/Function/Free a relocatable module.
3205 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
3206 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
3207 <tag/Description/The function will free a module loaded into memory by use of
3208 the <tt/<ref id="mod_load" name="mod_load">/ function.
3209 <tag/Limits/<itemize>
3210 <item>The pointer passed as parameter is the pointer to the module memory,
3211 not the pointer to the control structure.
3213 <tag/Availability/cc65
3215 <ref id="mod_load" name="mod_load">
3221 <sect1>mod_load<label id="mod_load"><p>
3225 <tag/Function/Load a relocatable module.
3226 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
3227 <tag/Declaration/<tt/unsigned char mod_load (struct mod_ctrl* ctrl);/
3228 <tag/Description/The function will load a code module into memory and relocate
3229 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
3230 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
3231 the module just loaded. Possible error codes are:
3233 <item><tt/MLOAD_OK/ - Module load successful
3234 <item><tt/MLOAD_ERR_READ/ - Read error
3235 <item><tt/MLOAD_ERR_HDR/ - Header error
3236 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
3237 <item><tt/MLOAD_ERR_FMT/ - Data format error
3238 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
3240 <tag/Limits/<itemize>
3241 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
3242 relocatable o65 modules for use with this function.
3244 <tag/Availability/cc65
3246 <ref id="mod_free" name="mod_free">
3252 <sect1>mouse_box<label id="mouse_box"><p>
3256 <tag/Function/Specify a bounding box for the mouse cursor.
3257 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3258 <tag/Declaration/<tt/void __fastcall__ mouse_box (int minx, int miny,
3259 int maxx, int maxy);/
3260 <tag/Description/The function allows to set a bounding box for mouse movement.
3261 <tag/Limits/<itemize>
3262 <item>The function does not check if the mouse cursor is currently within the
3263 given rectangle. Placing the mouse cursor within the bounding box is the
3264 responsibility of the programmer.
3265 <item>While the bounding box may be larger than the actual screen size, the
3266 standard mouse cursor draw routines may fail to set the cursor to coordinates
3267 outside of the screen area. Depending on the platform, you may have to supply
3268 your own mouse cursor routines.
3269 <item>The function is only available as fastcall function, so it may only be
3270 used in presence of a prototype.
3272 <tag/Availability/cc65
3274 <ref id="mouse_move" name="mouse_move">
3280 <sect1>mouse_buttons<label id="mouse_buttons"><p>
3284 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
3285 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3286 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_buttons (void);/
3287 <tag/Description/The function returns a bit mask that encodes the state of the
3288 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
3290 <tag/Limits/<itemize>
3291 <item>The function is only available as fastcall function, so it may only be
3292 used in presence of a prototype.
3294 <tag/Availability/cc65
3296 <ref id="mouse_info" name="mouse_info">,
3297 <ref id="mouse_pos" name="mouse_pos">
3303 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
3307 <tag/Function/Return a readable error message for an error code.
3308 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3309 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
3311 <tag/Description/The function returns an error message (in english) for the
3312 error code passed parameter.
3313 <tag/Limits/<itemize>
3314 <item>The function will return "Unknown error" for invalid error codes.
3315 <item>The function is only available as fastcall function, so it may only be
3316 used in presence of a prototype.
3318 <tag/Availability/cc65
3320 <ref id="mouse_load_driver" name="mouse_load_driver">,
3321 <ref id="mouse_uninstall" name="mouse_uninstall">,
3322 <ref id="mouse_unload" name="mouse_unload">
3328 <sect1>mouse_hide<label id="mouse_hide"><p>
3332 <tag/Function/Hide the mouse pointer.
3333 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3334 <tag/Declaration/<tt/void __fastcall__ mouse_hide (void);/
3335 <tag/Description/The function hides the mouse pointer. It manages a counter
3336 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
3337 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
3338 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
3340 <tag/Limits/<itemize>
3341 <item>The function is only available as fastcall function, so it may only be
3342 used in presence of a prototype.
3344 <tag/Availability/cc65
3346 <ref id="mouse_show" name="mouse_show">
3352 <sect1>mouse_info<label id="mouse_info"><p>
3356 <tag/Function/Return the state of the mouse buttons and the position of the
3358 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3359 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
3360 <tag/Description/The function returns the state of the mouse buttons and the
3361 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
3362 <tag/Limits/<itemize>
3363 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
3364 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
3365 name="mouse_pos">/ instead.
3366 <item>The function is only available as fastcall function, so it may only be
3367 used in presence of a prototype.
3369 <tag/Availability/cc65
3371 <ref id="mouse_buttons" name="mouse_buttons">,
3372 <ref id="mouse_pos" name="mouse_pos">
3378 <sect1>mouse_install<label id="mouse_install"><p>
3382 <tag/Function/Install an already loaded mouse driver.
3383 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3384 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
3385 mouse_callbacks* c, void* driver);/
3386 <tag/Description/The function installs an already loaded mouse driver and
3387 returns an error code. The <tt/mouse_callbacks/ structure passed as first
3388 parameter contains pointers to routines needed to move or hide/show the mouse
3389 pointer. Defaults for these routines are supplied by the library, so if you
3390 can live with these defaults (which are platform specific), just pass a
3391 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
3392 driver linked statically to the program.
3393 <tag/Limits/<itemize>
3394 <item>Not all drivers are able to detect if the supported hardware is really
3396 <item>After installing a driver, the mouse cursor is hidden.
3397 <item>The function is only available as fastcall function, so it may only be
3398 used in presence of a prototype.
3400 <tag/Availability/cc65
3402 <ref id="mouse_load_driver" name="mouse_load_driver">,
3403 <ref id="mouse_uninstall" name="mouse_uninstall">,
3404 <ref id="mouse_unload" name="mouse_unload">
3410 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
3414 <tag/Function/Call the driver specific ioctl function.
3415 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3416 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
3417 <tag/Description/The function calls the IOCTL entry in the mouse driver,
3418 which is driver specific. The <tt/code/ parameter will choose between
3419 different IOCTL functions, and the <tt/data/ depends on code. The
3420 function returns an error code. The purpose of this function is to allow
3421 for driver specific extensions. See the documentation for a specific mouse
3422 driver for supported ioctl calls.
3423 <tag/Limits/<itemize>
3424 <item>Calling this function is non portable, because each driver may
3425 implement different ioctl calls (or none at all).
3426 <item>The function is only available as fastcall function, so it may only be
3427 used in presence of a prototype.
3429 <tag/Availability/cc65
3435 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
3439 <tag/Function/Load and initialize a mouse driver.
3440 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3441 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
3442 mouse_callbacks* c, const char* driver);/
3443 <tag/Description/Load a mouse driver into memory and initialize it. The
3444 function returns an error code that tells if the call has been successful. The
3445 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
3446 routines needed to move or hide/show the mouse pointer. Defaults for these
3447 routines are supplied by the library, so if you can live with these defaults
3448 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
3449 <tag/Limits/<itemize>
3450 <item>The driver is loaded by name, so currently you must know the type of
3451 mouse that should be supported. There is no autodetect capability.
3452 <item>Not all drivers are able to detect if the supported hardware is really
3454 <item>After installing a driver, the mouse cursor is hidden.
3455 <item>The function is only available as fastcall function, so it may only be
3456 used in presence of a prototype.
3458 <tag/Availability/cc65
3460 <ref id="mouse_install" name="mouse_install">,
3461 <ref id="mouse_uninstall" name="mouse_uninstall">,
3462 <ref id="mouse_unload" name="mouse_unload">
3468 <sect1>mouse_move<label id="mouse_move"><p>
3472 <tag/Function/Move the mouse cursor to a specific position.
3473 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3474 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
3475 <tag/Description/The function updates the mouse position. If the mouse cursor
3476 is visible, it is shown at the new position.
3477 <tag/Limits/<itemize>
3478 <item>The function does not check if the new position is within the bounding
3479 box specified with <tt/<ref id="mouse_box" name="mouse_box">/.
3480 <item>The function is only available as fastcall function, so it may only be
3481 used in presence of a prototype.
3483 <tag/Availability/cc65
3485 <ref id="mouse_box" name="mouse_box">
3491 <sect1>mouse_pos<label id="mouse_pos"><p>
3495 <tag/Function/Return the position of the mouse.
3496 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3497 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
3498 <tag/Description/The function returns the position of the mouse in the
3499 <tt/mouse_pos/ structure passed as parameter.
3500 <tag/Limits/<itemize>
3501 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
3502 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
3503 name="mouse_info">/ instead.
3504 <item>The function is only available as fastcall function, so it may only be
3505 used in presence of a prototype.
3507 <tag/Availability/cc65
3509 <ref id="mouse_buttons" name="mouse_buttons">,
3510 <ref id="mouse_info" name="mouse_info">
3516 <sect1>mouse_show<label id="mouse_show"><p>
3520 <tag/Function/Show the mouse pointer.
3521 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3522 <tag/Declaration/<tt/void __fastcall__ mouse_show (void);/
3523 <tag/Description/The function shows the mouse pointer. It manages a counter
3524 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
3525 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
3526 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
3527 <tag/Limits/<itemize>
3528 <item>The function is only available as fastcall function, so it may only be
3529 used in presence of a prototype.
3531 <tag/Availability/cc65
3533 <ref id="mouse_hide" name="mouse_hide">
3539 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
3543 <tag/Function/Uninstall an already loaded mouse driver.
3544 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3545 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (void);/
3546 <tag/Description/The function uninstalls an already loaded mouse driver but
3547 don't removes it from memory.
3548 <tag/Limits/<itemize>
3549 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
3550 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
3551 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
3553 <item>The function is only available as fastcall function, so it may only be
3554 used in presence of a prototype.
3556 <tag/Availability/cc65
3558 <ref id="mouse_install" name="mouse_install">,
3559 <ref id="mouse_load_driver" name="mouse_load_driver">,
3560 <ref id="mouse_unload" name="mouse_unload">
3566 <sect1>mouse_unload<label id="mouse_unload"><p>
3570 <tag/Function/Unload a mouse driver.
3571 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3572 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_unload (void);/
3573 <tag/Description/The function unloads a loaded mouse driver and frees all
3574 memory allocated for the driver.
3575 <tag/Limits/<itemize>
3576 <item>The function does nothing if no driver is loaded.
3578 <tag/Availability/cc65
3580 <ref id="mouse_install" name="mouse_install">,
3581 <ref id="mouse_load_driver" name="mouse_load_driver">,
3582 <ref id="mouse_uninstall" name="mouse_uninstall">
3588 <sect1>offsetof<label id="offsetof"><p>
3592 <tag/Function/Calculate the offset of a struct or union member.
3593 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
3594 <tag/Declaration/<tt/size_t offsetof (type, member);/
3595 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
3596 or <tt/union/ member.
3597 <tag/Limits/<itemize>
3598 <item>The function is actually a macro.
3600 <tag/Availability/ISO 9899
3606 <sect1>open<label id="open"><p>
3610 <tag/Function/Open and possibly create a file.
3611 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
3612 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
3613 <tag/Description/<tt/open/ opens a file and returns the file descriptor
3614 associated with it. On error, -1 is returned and an error code is stored in
3615 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
3616 <tag/Limits/<itemize>
3617 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
3618 open, which is used as the permission mask when a new file is created. While
3619 cc65 allows to pass this argument, it is ignored.
3621 <tag/Availability/POSIX 1003.1
3623 <ref id="close" name="close">,
3624 <ref id="creat" name="creat">
3630 <sect1>peekbsys<label id="peekbsys"><p>
3634 <tag/Function/Read one byte from a location in the system bank.
3635 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3636 <tt/<ref id="cbm510.h" name="cbm510.h">/
3637 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
3638 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
3639 system bank (bank 15) of the CBM PET-II machines and returns it.
3642 <item>The function is only available as fastcall function, so it may only
3643 be used in presence of a prototype.
3644 <item>This function may be a macro depending on the compiler options. The
3645 actual function is accessible by #undef'ing the macro.
3647 <tag/Availability/cc65
3649 <ref id="PEEK" name="PEEK">,
3650 <ref id="PEEKW" name="PEEKW">,
3651 <ref id="peekwsys" name="peekwsys">,
3652 <ref id="pokebsys" name="pokebsys">,
3653 <ref id="pokewsys" name="pokewsys">
3659 <sect1>peekwsys<label id="peekwsys"><p>
3663 <tag/Function/Read one word from a location in the system bank.
3664 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3665 <tt/<ref id="cbm510.h" name="cbm510.h">/
3666 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
3667 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
3668 system bank (bank 15) of the CBM PET-II machines and returns it. Following
3669 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
3670 high byte is read from <tt/addr+1/.
3673 <item>The function is only available as fastcall function, so it may only
3674 be used in presence of a prototype.
3675 <item>The order in which the two bytes are read is undefined.
3677 <tag/Availability/cc65
3679 <ref id="PEEK" name="PEEK">,
3680 <ref id="PEEKW" name="PEEKW">,
3681 <ref id="peekbsys" name="peekbsys">,
3682 <ref id="pokebsys" name="pokebsys">,
3683 <ref id="pokewsys" name="pokewsys">
3689 <sect1>perror<label id="perror"><p>
3693 <tag/Function/Print an error message for the error in <tt/errno/.
3694 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3695 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
3696 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
3697 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
3698 a blank. Then the error message for the current contents of <tt/errno/ is
3699 printed followed by a newline. The message output is the same as returned by
3700 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
3703 <item>The function is only available as fastcall function, so it may only
3704 be used in presence of a prototype.
3706 <tag/Availability/ISO 9899
3708 <ref id="_poserror" name="_poserror">,
3709 <ref id="strerror" name="strerror">
3715 <sect1>pokebsys<label id="pokebsys"><p>
3719 <tag/Function/Write one byte to a location in the system bank.
3720 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3721 <tt/<ref id="cbm510.h" name="cbm510.h">/
3722 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
3723 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
3724 system bank (bank 15) of the CBM PET-II machines.
3727 <item>The function is only available as fastcall function, so it may only
3728 be used in presence of a prototype.
3730 <tag/Availability/cc65
3732 <ref id="POKE" name="POKE">,
3733 <ref id="POKEW" name="POKEW">,
3734 <ref id="peekbsys" name="peekbsys">,
3735 <ref id="peekwsys" name="peekwsys">,
3736 <ref id="pokewsys" name="pokewsys">
3742 <sect1>pokewsys<label id="pokewsys"><p>
3746 <tag/Function/Write one word to a location in the system bank.
3747 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3748 <tt/<ref id="cbm510.h" name="cbm510.h">/
3749 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
3750 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
3751 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
3752 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
3753 high byte is written to <tt/addr+1/.
3756 <item>The function is only available as fastcall function, so it may only
3757 be used in presence of a prototype.
3758 <item>The order in which the two bytes are written is undefined.
3760 <tag/Availability/cc65
3762 <ref id="POKE" name="POKE">,
3763 <ref id="POKEW" name="POKEW">,
3764 <ref id="peekbsys" name="peekbsys">,
3765 <ref id="peekwsys" name="peekwsys">,
3766 <ref id="pokebsys" name="pokebsys">
3772 <sect1>qsort<label id="qsort"><p>
3776 <tag/Function/Sort an array.
3777 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3778 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
3779 size_t size, int (*compare) (const void*, const void*));/
3780 <tag/Description/<tt/qsort/ sorts an array according to a given compare
3781 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
3782 is the number of elements, <tt/size/ the size of an element and <tt/compare/
3783 the function used to compare the members.
3786 <item>If there are multiple members with the same key, the order after calling
3787 the function is undefined.
3788 <item>The function is only available as fastcall function, so it may only
3789 be used in presence of a prototype.
3791 <tag/Availability/ISO 9899
3793 <ref id="bsearch" name="bsearch">
3799 <sect1>raise<label id="raise"><p>
3803 <tag/Function/Send a signal to the executing program.
3804 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
3805 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
3806 <tag/Description/<tt/raise/ sends the given signal to the program. If the
3807 program has installed a signal handler for the signal, this signal handler
3808 will be executed. If no handler has been installed, the default action for
3809 the raised signal will be taken. The function returns zero on success,
3811 <tag/Limits/<itemize>
3812 <item>The function is only available as fastcall function, so it may only
3813 be used in presence of a prototype.
3815 <tag/Availability/ISO 9899
3817 <ref id="abort" name="abort">,
3818 <ref id="signal" name="signal">
3824 <sect1>rand<label id="rand"><p>
3828 <tag/Function/Return a pseudo random number.
3829 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3830 <tag/Declaration/<tt/int rand (void);/
3831 <tag/Description/The function returns a pseudo random number
3832 between 0 and <tt/RAND_MAX/ (exclusive).
3833 <tag/Limits/<itemize>
3834 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
3835 flow of numbers is generated.
3836 <item>On startup, the function behaves as if <ref id="srand" name="srand">
3837 had been used with an argument of 1.
3839 <tag/Availability/ISO 9899
3841 <ref id="_randomize" name="_randomize">,
3842 <ref id="srand" name="srand">
3848 <sect1>realloc<label id="realloc"><p>
3852 <tag/Function/Change the size of an allocated memory block.
3853 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3854 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
3855 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
3856 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
3857 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
3858 behaves as if <tt/free/ had been called. On error (not enough memory
3859 available), <tt/realloc/ returns <tt/NULL/.
3862 <item>The part of the memory block that is returned will have its contents
3864 <item>This function is somewhat dangerous to use. Be careful to save the
3865 pointer you're passing somewhere else, otherwise
3867 ptr = realloc (ptr, size);
3869 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
3870 <item>The function is only available as fastcall function, so it may only
3871 be used in presence of a prototype.
3873 <tag/Availability/ISO 9899
3875 <ref id="_heapadd" name="_heapadd">,
3876 <ref id="_heapblocksize" name="_heapblocksize">,
3877 <ref id="_heapmaxavail" name="_heapmaxavail">,
3878 <ref id="_heapmemavail" name="_heapmemavail">,
3879 <ref id="calloc" name="calloc">,
3880 <ref id="free" name="free">,
3881 <ref id="realloc" name="realloc">
3887 <sect1>remove<label id="remove"><p>
3891 <tag/Function/Delete a file.
3892 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3893 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
3894 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
3895 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
3896 code describing the reason for the failure.
3899 <item>This function is not available on all cc65 targets (depends on the
3900 availability of file I/O).
3901 <item>The function is only available as fastcall function, so it may only
3902 be used in presence of a prototype.
3904 <tag/Availability/ISO 9899
3906 <ref id="unlink" name="unlink">
3908 #include <stdio.h>
3910 #define FILENAME "helloworld"
3912 if (remove (FILENAME) == 0) {
3913 printf ("We deleted %s successfully\n", FILENAME);
3915 printf ("There was a problem deleting %s\n", FILENAME);
3921 <sect1>reset_brk<label id="reset_brk"><p>
3925 <tag/Function/Resets the break vector to its original value.
3926 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3927 <tag/Declaration/<tt/void __fastcall__ reset_brk (void);/
3928 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
3929 before a call to <tt/set_brk/.
3932 <item>Since <tt/<ref id="set_brk" name="set_brk">/ installs an exit handler,
3933 it is not strictly necessary to call this function as part of the cleanup when
3936 <tag/Availability/cc65
3938 <ref id="set_brk" name="set_brk">
3944 <sect1>revers<label id="revers"><p>
3948 <tag/Function/Control revers character display.
3949 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3950 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
3951 <tag/Description/If the argument is non zero, the function enables reverse
3952 character display. If the argument is zero, reverse character display is
3953 switched off. The old value of the setting is returned.
3954 <tag/Limits/<itemize>
3955 <item>The function may not be supported by the hardware, in which case
3956 the call is ignored.
3957 <item>The function is only available as fastcall function, so it may only
3958 be used in presence of a prototype.
3960 <tag/Availability/cc65
3962 <ref id="textcolor" name="textcolor">
3968 <sect1>screensize<label id="screensize"><p>
3972 <tag/Function/Return the dimensions of the text mode screen.
3973 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3974 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
3975 <tag/Description/The function returns the dimensions of the text mode screen.
3976 <tag/Limits/<itemize>
3977 <item>The function is only available as fastcall function, so it may only
3978 be used in presence of a prototype.
3980 <tag/Availability/cc65
3982 <ref id="gotox" name="gotox">,
3983 <ref id="gotoxy" name="gotoxy">,
3984 <ref id="gotoy" name="gotoy">,
3985 <ref id="wherex" name="wherex">,
3986 <ref id="wherey" name="wherey">
3992 <sect1>set_brk<label id="set_brk"><p>
3996 <tag/Function/Set the break vector to a user function.
3997 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3998 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
3999 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
4000 program code by letting the vector point to a user written C function. The
4001 runtime library installs a small stub that saves the registers into global
4002 variables that may be accessed (and changed) by the break handler.
4005 <item>The function is only available as fastcall function, so it may only
4006 be used in presence of a prototype.
4007 <item>The stub saves the zero page registers used by the C runtime and switches
4008 to a small break handler stack. This means that it is safe to execute C code,
4009 even if C code was interrupted. Be careful however not to use too many local
4010 variables, and do not enable stack checks for the handler function or any other
4011 function called from it.
4012 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
4013 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
4014 otherwise the <tt/BRK/ instruction will get executed over and over again.
4015 <item>Since <tt/set_brk/ installs an exit handler, it is not strictly necessary
4016 to call <tt/<ref id="reset_brk" name="reset_brk">/ as part of the cleanup when
4017 the program terminates.
4019 <tag/Availability/cc65
4021 <ref id="reset_brk" name="reset_brk">
4027 <sect1>setjmp<label id="setjmp"><p>
4031 <tag/Function/Save the context for use with <tt/longjmp/.
4032 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4033 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
4034 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
4035 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
4039 <item>The function is only available as fastcall function, so it may only
4040 be used in presence of a prototype.
4041 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
4042 <item><tt/setjmp/ will not save the signal context.
4044 <tag/Availability/ISO 9899
4046 <ref id="longjmp" name="longjmp">
4052 <sect1>setlocale<label id="setlocale"><p>
4056 <tag/Function/Selects a locale.
4057 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4058 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
4059 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
4062 <item>The function is only available as fastcall function, so it may only
4063 be used in presence of a prototype.
4064 <item>cc65 supports only the "C" locale, so calling this function to set a
4065 different locale has no effect.
4067 <tag/Availability/ISO 9899
4069 <ref id="localeconv" name="localeconv">,
4070 <ref id="strcoll" name="strcoll">
4076 <sect1>signal<label id="signal"><p>
4080 <tag/Function/Install a signal handler.
4081 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
4082 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
4083 <tag/Description/<tt/signal/ installs a handler for the given signal. The
4084 handler may either be a user supplied function, or one of the predefined
4085 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
4086 previous value if the signal , or the special function vector SIG_ERR in
4088 <tag/Limits/<itemize>
4089 <item>The function is only available as fastcall function, so it may only
4090 be used in presence of a prototype.
4092 <tag/Availability/ISO 9899
4094 <ref id="abort" name="abort">,
4095 <ref id="raise" name="raise">
4101 <sect1>sleep<label id="sleep"><p>
4105 <tag/Function/Sleep for a specified amount of time.
4106 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
4107 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
4108 <tag/Description/The function will return after the specified number of
4109 seconds have elapsed.
4110 <tag/Limits/<itemize>
4111 <item>The function is only available as fastcall function, so it may only
4112 be used in presence of a prototype.
4114 <tag/Availability/POSIX 1003.1
4120 <sect1>slow<label id="slow"><p>
4124 <tag/Function/Switch the C128 into 1MHz mode.
4125 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
4126 <tag/Declaration/<tt/void slow (void);/
4127 <tag/Description/The function will switch the clock of the C128 to 1MHz. This
4128 will halve the speed compared to fast mode.
4129 <tag/Limits/<itemize>
4130 <item>The function is specific to the C128.
4132 <tag/Availability/C128
4134 <ref id="fast" name="fast">,
4135 <ref id="toggle_videomode" name="toggle_videomode">
4141 <sect1>srand<label id="srand"><p>
4145 <tag/Function/Initialize the pseudo random number generator.
4146 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4147 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
4148 <tag/Description/The function initializes the random number generator using
4149 the given seed. On program startup, the generator behaves as if <tt/srand/ has
4150 been called with an argument of 1.
4151 <tag/Limits/<itemize>
4152 <item>The function is only available as fastcall function, so it may only
4153 be used in presence of a prototype.
4155 <tag/Availability/ISO 9899
4157 <ref id="_randomize" name="_randomize">,
4158 <ref id="rand" name="rand">
4164 <sect1>strcasecmp<label id="strcasecmp"><p>
4168 <tag/Function/Compare two strings case insensitive.
4169 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4170 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
4171 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
4172 as parameters without case sensitivity. It returns a value that is less than
4173 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
4174 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
4175 <tag/Limits/<itemize>
4176 <item>The function is only available as fastcall function, so it may only
4177 be used in presence of a prototype.
4178 <item>The function is not available in strict ANSI mode.
4180 <tag/Availability/cc65
4182 <ref id="strcmp" name="strcmp">,
4183 <ref id="strcoll" name="strcoll">,
4184 <ref id="stricmp" name="stricmp">,
4185 <ref id="strncmp" name="strncmp">
4191 <sect1>strcat<label id="strcat"><p>
4195 <tag/Function/Concatentate two strings.
4196 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4197 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
4198 <tag/Description/The <tt/strcat/ function appends a copy of the string
4199 pointed to by s2 (including the terminating null byte) to the end of the
4200 string pointed to by s1. The initial byte of s2 overwrites the null byte at
4202 <tag/Limits/<itemize>
4203 <item>The function is only available as fastcall function, so it may only
4204 be used in presence of a prototype.
4205 <item>If copying takes place between objects that overlap, the behaviour
4208 <tag/Availability/ISO 9899
4210 <ref id="strcpy" name="strcpy">,
4211 <ref id="strncat" name="strncat">,
4212 <ref id="strncpy" name="strncpy">
4218 <sect1>strchr<label id="strchr"><p>
4222 <tag/Function/Search for a character in a string.
4223 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4224 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
4225 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
4226 (converted to a char) in the string pointed to by <tt/s/. The terminating null
4227 byte is considered to be part of the string. Upon completion, the function
4228 returns a pointer to the byte, or a null pointer if the byte was not found.
4229 <tag/Limits/<itemize>
4230 <item>The function is only available as fastcall function, so it may only
4231 be used in presence of a prototype.
4233 <tag/Availability/ISO 9899
4235 <ref id="memchr" name="memchr">,
4236 <ref id="strrchr" name="strrchr">
4242 <sect1>strcmp<label id="strcmp"><p>
4246 <tag/Function/Compare two strings.
4247 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4248 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
4249 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
4250 parameters. It returns a value that is less than zero if <tt/s1/ is less than
4251 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
4252 if <tt/s1/ is greater than <tt/s2/.
4253 <tag/Limits/<itemize>
4254 <item>The function is only available as fastcall function, so it may only
4255 be used in presence of a prototype.
4257 <tag/Availability/ISO 9899
4259 <ref id="strcasecmp" name="strcasecmp">,
4260 <ref id="strcoll" name="strcoll">,
4261 <ref id="stricmp" name="stricmp">,
4262 <ref id="strncmp" name="strncmp">
4268 <sect1>strcoll<label id="strcoll"><p>
4272 <tag/Function/Compare two strings.
4273 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4274 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
4275 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
4276 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
4277 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
4278 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
4279 than zero if <tt/s1/ is greater than <tt/s2/.
4280 <tag/Limits/<itemize>
4281 <item>The function is only available as fastcall function, so it may only
4282 be used in presence of a prototype.
4284 <tag/Availability/ISO 9899
4286 <ref id="setlocale" name="setlocale">,
4287 <ref id="strcasecmp" name="strcasecmp">,
4288 <ref id="strcmp" name="strcmp">,
4289 <ref id="stricmp" name="stricmp">,
4290 <ref id="strncmp" name="strncmp">
4296 <sect1>strcpy<label id="strcpy"><p>
4300 <tag/Function/Copy a string.
4301 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4302 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
4303 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
4304 <tt/s2/ (including the terminating null byte) into the array pointed to by
4305 <tt/s1/. The function will always return <tt/s1/.
4306 <tag/Limits/<itemize>
4307 <item>The function is only available as fastcall function, so it may only
4308 be used in presence of a prototype.
4309 <item>If copying takes place between objects that overlap, the behaviour
4312 <tag/Availability/ISO 9899
4314 <ref id="strcat" name="strcat">,
4315 <ref id="strncat" name="strncat">,
4316 <ref id="strncpy" name="strncpy">
4319 #include <string.h>
4321 static char hello[14];
4323 strcpy (hello, "Hello world!\n");
4329 <sect1>strcspn<label id="strcspn"><p>
4333 <tag/Function/Compute the length of a substring.
4334 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4335 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
4336 <tag/Description/The <tt/strcspn/ function computes and returns the length of
4337 the substring pointed to by <tt/s/ which does <em>not</em> consist of
4338 characters contained in the string <tt/set/.
4339 <tag/Limits/<itemize>
4340 <item>The function is only available as fastcall function, so it may only
4341 be used in presence of a prototype.
4343 <tag/Availability/ISO 9899
4345 <ref id="strspn" name="strspn">,
4346 <ref id="strstr" name="strstr">,
4347 <ref id="strtok" name="strtok">
4353 <sect1>strdup<label id="strdup"><p>
4357 <tag/Function/Allocate a copy of a string on the heap.
4358 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4359 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
4360 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
4361 to hold a copy of <tt/s/ including the terminating zero. If the allocation
4362 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
4363 memory block, and a pointer to the block is returned.
4364 <tag/Limits/<itemize>
4365 <item>The function is only available as fastcall function, so it may only
4366 be used in presence of a prototype.
4367 <item>It is up to the caller to free the allocated memory block.
4369 <tag/Availability/ISO 9899
4371 <ref id="free" name="free">,
4372 <ref id="malloc" name="malloc">
4378 <sect1>strerror<label id="strerror"><p>
4382 <tag/Function/Return a string describing an error code.
4383 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4384 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
4385 <tag/Description/The <tt/strerror/ function returns a string describing the
4386 given error code. If an invalid error code is passed, the string "Unknown
4387 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
4388 <tt/errno/ is left untouched.
4389 <tag/Limits/<itemize>
4390 <item>The function is only available as fastcall function, so it may only
4391 be used in presence of a prototype.
4392 <item>While the return type of the function is a <tt/char*/, the returned
4393 string must not be modified by the caller!
4395 <tag/Availability/ISO 9899
4397 <ref id="_stroserror" name="_stroserror">
4403 <sect1>stricmp<label id="stricmp"><p>
4407 <tag/Function/Compare two strings case insensitive.
4408 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4409 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
4410 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
4411 parameters without case sensitivity. It returns a value that is less than zero
4412 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
4413 value greater than zero if <tt/s1/ is greater than <tt/s2/.
4414 <tag/Limits/<itemize>
4415 <item>The function is only available as fastcall function, so it may only
4416 be used in presence of a prototype.
4417 <item>The function is not available in strict ANSI mode.
4419 <tag/Availability/cc65
4421 <ref id="strcasecmp" name="strcasecmp">,
4422 <ref id="strcmp" name="strcmp">,
4423 <ref id="strcoll" name="strcoll">,
4424 <ref id="strncmp" name="strncmp">
4430 <sect1>strlen<label id="strlen"><p>
4434 <tag/Function/Return the length of a string.
4435 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4436 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
4437 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
4438 string to which s points, not including the terminating null byte.
4439 <tag/Limits/<itemize>
4440 <item>The function is only available as fastcall function, so it may only
4441 be used in presence of a prototype.
4442 <item>When compiling with <tt/-Os/ (inline known standard functions), the
4443 function does not work correctly for strings with more than 255 characters.
4445 <tag/Availability/ISO 9899
4447 <ref id="strcpy" name="strcpy">
4453 <sect1>strlower<label id="strlower"><p>
4457 <tag/Function/Make a string lower case.
4458 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4459 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
4460 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
4461 function to each character of a string. The function will always return <tt/s/.
4462 <tag/Limits/<itemize>
4463 <item>The function is only available as fastcall function, so it may only
4464 be used in presence of a prototype.
4465 <item>The function prototype is unavailable when compiling in strict ANSI mode.
4466 <item>An alias name for this function is <tt/strlwr/.
4468 <tag/Availability/cc65
4470 <ref id="strupper" name="strupper">,
4471 <ref id="tolower" name="tolower">
4477 <sect1>strlwr<label id="strlwr"><p>
4484 <sect1>strncat<label id="strncat"><p>
4488 <tag/Function/Concatentate two strings.
4489 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4490 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
4491 <tag/Description/The <tt/strncat/ function appends not more than n characters
4492 of the string pointed to by s2 to the end of the string pointed to by s1. The
4493 terminating null character at the end of s1 is overwritten. A terminating null
4494 character is appended to the result, even if not all of s2 is appended to s1.
4495 <tag/Limits/<itemize>
4496 <item>The function is only available as fastcall function, so it may only
4497 be used in presence of a prototype.
4498 <item>If copying takes place between objects that overlap, the behaviour
4501 <tag/Availability/ISO 9899
4503 <ref id="strcpy" name="strcpy">,
4504 <ref id="strncat" name="strncat">,
4505 <ref id="strncpy" name="strncpy">
4511 <sect1>strncmp<label id="strncmp"><p>
4515 <tag/Function/Compare two strings.
4516 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4517 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
4518 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
4519 characters of the two strings passed as parameters. It returns a value that is
4520 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
4521 <tt/s2/, zero if they are identical, and a value greater than zero they are
4523 <tag/Limits/<itemize>
4524 <item>The function is only available as fastcall function, so it may only
4525 be used in presence of a prototype.
4527 <tag/Availability/ISO 9899
4529 <ref id="strcasecmp" name="strcasecmp">,
4530 <ref id="strcmp" name="strcmp">,
4531 <ref id="strcoll" name="strcoll">,
4532 <ref id="stricmp" name="stricmp">
4538 <sect1>strncpy<label id="strncpy"><p>
4542 <tag/Function/Copy part of a string.
4543 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4544 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2, size_t n);/
4545 <tag/Description/The <tt/strncpy/ function copies not more than n bytes from
4546 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
4547 pointed to by <tt/s2/ is a string that is shorter than n bytes, null bytes are
4548 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
4549 written. The function will always return <tt/s1/.
4550 <tag/Limits/<itemize>
4551 <item>The function is only available as fastcall function, so it may only
4552 be used in presence of a prototype. If there is no null byte in the first <tt/n/
4553 bytes of the array pointed to by <tt/s2/, the result is not null-terminated.
4554 <item>If copying takes place between objects that overlap, the behaviour is
4557 <tag/Availability/ISO 9899
4559 <ref id="strcat" name="strcat">,
4560 <ref id="strcpy" name="strcpy">,
4561 <ref id="strncat" name="strncat">
4566 static char hello[6];
4568 strcpy (hello, "Hello world!\n", sizeof (hello) - 1);
4575 <sect1>strrchr<label id="strrchr"><p>
4579 <tag/Function/Search for a character in a string.
4580 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4581 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
4582 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
4583 (converted to a char) in the string pointed to by <tt/s/. The terminating null
4584 byte is considered to be part of the string. Upon completion, the function
4585 returns a pointer to the byte, or a null pointer if the byte was not found.
4586 <tag/Limits/<itemize>
4587 <item>The function is only available as fastcall function, so it may only
4588 be used in presence of a prototype.
4590 <tag/Availability/ISO 9899
4592 <ref id="strchr" name="strchr">
4598 <sect1>strspn<label id="strspn"><p>
4602 <tag/Function/Compute the length of a substring.
4603 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4604 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
4605 <tag/Description/The <tt/strspn/ function computes and returns the length of
4606 the substring pointed to by <tt/s/ which does consist only of characters
4607 contained in the string <tt/set/.
4608 <tag/Limits/<itemize>
4609 <item>The function is only available as fastcall function, so it may only
4610 be used in presence of a prototype.
4612 <tag/Availability/ISO 9899
4614 <ref id="strcspn" name="strcspn">,
4615 <ref id="strstr" name="strstr">
4621 <sect1>strstr<label id="strstr"><p>
4625 <tag/Function/Find a substring.
4626 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4627 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
4628 <tag/Description/<tt/strstr/ searches for the first occurance of the string
4629 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
4630 otherwise it returns <tt/NULL/.
4631 <tag/Limits/<itemize>
4632 <item>The function is only available as fastcall function, so it may only
4633 be used in presence of a prototype.
4635 <tag/Availability/ISO 9899
4637 <ref id="strcspn" name="strcspn">,
4638 <ref id="strspn" name="strspn">
4644 <sect1>strtok<label id="strtok"><p>
4648 <tag/Function/Break a string into tokens.
4649 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4650 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
4651 <tag/Description/<tt/strtok/ will break the string s1 into a sequence of
4652 tokens, which are delimited by characters from the string s2. The first call
4653 to <tt/strtok/ will return a pointer to the first token in the string s1.
4654 Following calls must pass a <tt/NULL/ pointer as s1 in order to get the next
4655 token in the string. Different sets of delimiters may be used for the
4656 subsequent calls to <tt/strtok/.
4657 <tag/Limits/<itemize>
4658 <item>The function is only available as fastcall function, so it may only
4659 be used in presence of a prototype.
4660 <item><tt/strtok/ will modify the string s1.
4662 <tag/Availability/ISO 9899
4664 <ref id="strcspn" name="strcspn">,
4665 <!-- <ref id="strpbrk" name="strpbrk"> -->
4671 <sect1>strupper<label id="strupper"><p>
4675 <tag/Function/Make a string upper case.
4676 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4677 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
4678 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
4679 function to each character of a string. The function will always return <tt/s/.
4680 <tag/Limits/<itemize>
4681 <item>The function is only available as fastcall function, so it may only
4682 be used in presence of a prototype.
4683 <item>The function prototype is unavailable when compiling in strict ANSI mode.
4684 <item>An alias name for this function is <tt/strupr/.
4686 <tag/Availability/cc65
4688 <ref id="strlower" name="strlower">
4689 <ref id="toupper" name="toupper">
4695 <sect1>strupr<label id="strupr"><p>
4702 <sect1>textcolor<label id="textcolor"><p>
4706 <tag/Function/Set the text color.
4707 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4708 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
4709 <tag/Description/The function will set a new text color. It returns the old
4710 (current) text color. Text output using any <tt/conio.h/ function will use
4711 the color set by this function.
4712 <tag/Limits/<itemize>
4713 <item>Text colors are system dependent. The function may have no effect
4714 on systems where the text color cannot be changed.
4715 <item>The function is only available as fastcall function, so it may only
4716 be used in presence of a prototype.
4718 <tag/Availability/cc65
4720 <ref id="bgcolor" name="bgcolor">,
4721 <ref id="bordercolor" name="bordercolor">
4727 <sect1>time<label id="time"><p>
4731 <tag/Function/Get the time.
4732 <tag/Header/<tt/<ref id="time.h" name="time.h">/
4733 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
4734 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
4735 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
4736 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
4737 returned and <tt/errno/ is set to <tt/ENOSYS/.
4738 <tag/Limits/<itemize>
4739 <item>The function is only available as fastcall function, so it may
4740 only be used in presence of a prototype.
4741 <item>Many platforms supported by cc65 do not have a realtime clock, so the
4742 returned value may not be valid.
4744 <tag/Availability/ISO 9899
4750 <sect1>toggle_videomode<label id="toggle_videomode"><p>
4754 <tag/Function/Toggle between 40 and 80 column mode.
4755 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
4756 <tag/Declaration/<tt/void toggle_videomode (void);/
4757 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
4758 old mode (cursor position, color and so on) are saved and restored together
4760 <tag/Limits/<itemize>
4761 <item>The function is specific to the C128.
4763 <tag/Availability/C128
4765 <ref id="fast" name="fast">,
4766 <ref id="slow" name="slow">
4772 <sect1>tolower<label id="tolower"><p>
4776 <tag/Function/Convert a character into its lower case representation.
4777 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4778 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
4779 <tag/Description/The function returns the given character converted to lower
4780 case. If the given character is not a letter, it is returned unchanged.
4781 <tag/Limits/<itemize>
4782 <item>The function is only available as fastcall function, so it may
4783 only be used in presence of a prototype.
4785 <tag/Availability/ISO 9899
4787 <ref id="islower" name="islower">,
4788 <ref id="isupper" name="isupper">,
4789 <ref id="toupper" name="toupper">
4795 <sect1>toupper<label id="toupper"><p>
4799 <tag/Function/Convert a character into its upper case representation.
4800 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4801 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
4802 <tag/Description/The function returns the given character converted to upper
4803 case. If the given character is not a letter, it is returned unchanged.
4804 <tag/Limits/<itemize>
4805 <item>The function is only available as fastcall function, so it may
4806 only be used in presence of a prototype.
4808 <tag/Availability/ISO 9899
4810 <ref id="islower" name="islower">,
4811 <ref id="isupper" name="isupper">,
4812 <ref id="tolower" name="tolower">
4818 <sect1>ultoa<label id="ultoa"><p>
4822 <tag/Function/Convert an unsigned long integer into a string.
4823 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4824 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
4825 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
4826 string using <tt/radix/ as the base.
4827 <tag/Limits/<itemize>
4828 <item>There are no provisions to prevent a buffer overflow.
4829 <item>The function is non standard, so it is not available in strict ANSI mode.
4830 You should probably use <tt/sprintf/ instead.
4831 <item>The function is only available as fastcall function, so it may only be
4832 used in presence of a prototype.
4834 <tag/Availability/cc65
4836 <ref id="atoi" name="atoi">,
4837 <ref id="atol" name="atol">,
4838 <ref id="itoa" name="itoa">,
4839 <ref id="ltoa" name="ltoa">,
4840 <ref id="utoa" name="utoa">
4846 <sect1>unlink<label id="unlink"><p>
4850 <tag/Function/Delete a file.
4851 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
4852 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
4853 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
4854 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
4855 code describing the reason for the failure.
4858 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
4859 name="remove">/ instead, which is a native ANSI C function and does the same.
4860 <item>This function is not available on all cc65 targets (depends on the
4861 availability of file I/O).
4862 <item>The function is only available as fastcall function, so it may only
4863 be used in presence of a prototype.
4864 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
4865 used, which has the same semantics, but is more portable, because it conforms
4866 to the ISO C standard.
4868 <tag/Availability/POSIX 1003.1
4870 <ref id="remove" name="remove">
4872 #include <stdio.h>
4873 #include <unistd.h>
4875 #define FILENAME "helloworld"
4877 if (unlink (FILENAME) == 0) {
4878 printf ("We deleted %s successfully\n", FILENAME);
4880 printf ("There was a problem deleting %s\n", FILENAME);
4886 <sect1>utoa<label id="utoa"><p>
4890 <tag/Function/Convert an unsigned integer into a string.
4891 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4892 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
4893 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
4894 using <tt/radix/ as the base.
4895 <tag/Limits/<itemize>
4896 <item>There are no provisions to prevent a buffer overflow.
4897 <item>The function is non standard, so it is not available in strict ANSI mode.
4898 You should probably use <tt/sprintf/ instead.
4899 <item>The function is only available as fastcall function, so it may only be
4900 used in presence of a prototype.
4902 <tag/Availability/cc65
4904 <ref id="atoi" name="atoi">,
4905 <ref id="atol" name="atol">,
4906 <ref id="itoa" name="itoa">,
4907 <ref id="ltoa" name="ltoa">,
4908 <ref id="ultoa" name="ultoa">
4914 <sect1>vcprintf<label id="vcprintf"><p>
4918 <tag/Function/Formatted output to the console.
4919 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4920 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
4921 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
4922 text where necessary and formatted according to the format string given. The
4923 resulting string is output to the console. <tt/vcprintf/ supports the same
4924 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
4925 <tag/Limits/<itemize>
4926 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
4927 between <tt/\r/ and <tt/\n/.
4928 <item>The function is only available as fastcall function, so it may only be
4929 used in presence of a prototype.
4931 <tag/Availability/cc65
4933 <ref id="cprintf" name="cprintf">,
4934 <ref id="cputc" name="cputc">,
4935 <ref id="cputcxy" name="cputcxy">,
4936 <ref id="cputs" name="cputs">,
4937 <ref id="cputsxy" name="cputsxy">
4943 <sect1>wherex<label id="wherex"><p>
4947 <tag/Function/Return the current X position of the text mode cursor.
4948 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4949 <tag/Declaration/<tt/unsigned char wherex (void);/
4950 <tag/Description/The function returns the current X position of the text mode
4951 cursor. Zero is returned for the leftmost screen position.
4952 <tag/Availability/cc65
4954 <ref id="gotox" name="gotox">,
4955 <ref id="gotoy" name="gotoy">,
4956 <ref id="gotoxy" name="gotoxy">,
4957 <ref id="wherey" name="wherey">
4963 <sect1>wherey<label id="wherey"><p>
4967 <tag/Function/Return the current Y position of the text mode cursor.
4968 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4969 <tag/Declaration/<tt/unsigned char wherey (void);/
4970 <tag/Description/The function returns the current Y position of the text mode
4971 cursor. Zero is returned for the uppermost screen position.
4972 <tag/Availability/cc65
4974 <ref id="gotox" name="gotox">,
4975 <ref id="gotoy" name="gotoy">,
4976 <ref id="gotoxy" name="gotoxy">,
4977 <ref id="wherex" name="wherex">