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">
74 <sect1><tt/apple2enh.h/<label id="apple2enh.h"><p>
78 <item><ref id="get_ostype" name="get_ostype">
82 <item><ref id="videomode" name="videomode">
86 <sect1><tt/assert.h/<label id="assert.h"><p>
89 <item><ref id="assert" name="assert">
93 <sect1><tt/atari.h/<label id="atari.h"><p>
96 <item><ref id="get_ostype" name="get_ostype">
102 <sect1><tt/atmos.h/<label id="atmos.h"><p>
107 <sect1><tt/c128.h/<label id="c128.h"><p>
110 <item><ref id="c64mode" name="c64mode">
111 <item><ref id="fast" name="fast">
112 <item><ref id="slow" name="slow">
113 <item><ref id="toggle_videomode" name="toggle_videomode">
114 <item><ref id="videomode" name="videomode">
118 <sect1><tt/c16.h/<label id="c16.h"><p>
123 <sect1><tt/c64.h/<label id="c64.h"><p>
126 <item><ref id="get_ostype" name="get_ostype">
130 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
133 <item><ref id="peekbsys" name="peekbsys">
134 <item><ref id="peekwsys" name="peekwsys">
135 <item><ref id="pokebsys" name="pokebsys">
136 <item><ref id="pokewsys" name="pokewsys">
140 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
143 <item><ref id="peekbsys" name="peekbsys">
144 <item><ref id="peekwsys" name="peekwsys">
145 <item><ref id="pokebsys" name="pokebsys">
146 <item><ref id="pokewsys" name="pokewsys">
150 <sect1><tt/conio.h/<label id="conio.h"><p>
153 <item><ref id="bgcolor" name="bgcolor">
154 <item><ref id="bordercolor" name="bordercolor">
155 <item><ref id="cclear" name="cclear">
156 <item><ref id="cclearxy" name="cclearxy">
157 <item><ref id="cgetc" name="cgetc">
158 <item><ref id="chline" name="chline">
159 <item><ref id="chlinexy" name="chlinexy">
160 <item><ref id="clrscr" name="clrscr">
161 <item><ref id="cprintf" name="cprintf">
162 <item><ref id="cputc" name="cputc">
163 <item><ref id="cputcxy" name="cputcxy">
164 <item><ref id="cputs" name="cputs">
165 <item><ref id="cputsxy" name="cputsxy">
166 <item><ref id="cursor" name="cursor">
167 <item><ref id="cvline" name="cvline">
168 <item><ref id="cvlinexy" name="cvlinexy">
169 <item><ref id="gotox" name="gotox">
170 <item><ref id="gotoxy" name="gotoxy">
171 <item><ref id="gotoy" name="gotoy">
172 <item><ref id="kbhit" name="kbhit">
173 <item><ref id="revers" name="revers">
174 <item><ref id="screensize" name="screensize">
175 <item><ref id="textcolor" name="textcolor">
176 <item><ref id="vcprintf" name="vcprintf">
177 <item><ref id="wherex" name="wherex">
178 <item><ref id="wherey" name="wherey">
182 <sect1><tt/ctype.h/<label id="ctype.h"><p>
185 <item><ref id="isalnum" name="isalnum">
186 <item><ref id="isalpha" name="isalpha">
187 <item><ref id="isascii" name="isascii">
188 <item><ref id="isblank" name="isblank">
189 <item><ref id="iscntrl" name="iscntrl">
190 <item><ref id="isdigit" name="isdigit">
191 <item><ref id="isgraph" name="isgraph">
192 <item><ref id="islower" name="islower">
193 <item><ref id="isprint" name="isprint">
194 <item><ref id="ispunct" name="ispunct">
195 <item><ref id="isspace" name="isspace">
196 <item><ref id="isupper" name="isupper">
197 <item><ref id="isxdigit" name="isxdigit">
198 <item><ref id="tolower" name="tolower">
199 <item><ref id="toupper" name="toupper">
203 <sect1><tt/dbg.h/<label id="dbg.h"><p>
208 <sect1><tt/dio.h/<label id="dio.h"><p>
213 <sect1><tt/em.h/<label id="em.h"><p>
216 <item><ref id="em_commit" name="em_commit">
217 <item><ref id="em_copyfrom" name="em_copyfrom">
218 <item><ref id="em_copyto" name="em_copyto">
219 <item><ref id="em_install" name="em_install">
220 <item><ref id="em_load_driver" name="em_load_driver">
221 <item><ref id="em_map" name="em_map">
222 <item><ref id="em_pagecount" name="em_pagecount">
223 <item><ref id="em_uninstall" name="em_uninstall">
224 <item><ref id="em_unload" name="em_unload">
225 <item><ref id="em_use" name="em_use">
229 <sect1><tt/errno.h/<label id="errno.h"><p>
234 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
237 <item><ref id="close" name="close">
238 <item><ref id="creat" name="creat">
239 <item><ref id="open" name="open">
243 <sect1><tt/geos.h/<label id="geos.h"><p>
248 <sect1><tt/joystick.h/<label id="joystick.h"><p>
251 <item><ref id="joy_count" name="joy_count">
252 <item><ref id="joy_install" name="joy_install">
253 <item><ref id="joy_load_driver" name="joy_load_driver">
254 <item><ref id="joy_read" name="joy_read">
255 <item><ref id="joy_uninstall" name="joy_uninstall">
256 <item><ref id="joy_unload" name="joy_unload">
260 <sect1><tt/locale.h/<label id="locale.h"><p>
263 <item><ref id="localeconv" name="localeconv">
264 <item><ref id="setlocale" name="setlocale">
268 <sect1><tt/modload.h/<label id="modload.h"><p>
271 <item><ref id="mod_load" name="mod_load">
272 <item><ref id="mod_free" name="mod_free">
276 <sect1><tt/mouse.h/<label id="mouse.h"><p>
279 <item><ref id="mouse_load_driver" name="mouse_load_driver">
280 <item><ref id="mouse_unload" name="mouse_unload">
281 <item><ref id="mouse_install" name="mouse_install">
282 <item><ref id="mouse_uninstall" name="mouse_uninstall">
283 <item><ref id="mouse_hide" name="mouse_hide">
284 <item><ref id="mouse_show" name="mouse_show">
285 <item><ref id="mouse_setbox" name="mouse_setbox">
286 <item><ref id="mouse_getbox" name="mouse_getbox">
287 <item><ref id="mouse_move" name="mouse_move">
288 <item><ref id="mouse_buttons" name="mouse_buttons">
289 <item><ref id="mouse_pos" name="mouse_pos">
290 <item><ref id="mouse_info" name="mouse_info">
291 <item><ref id="mouse_ioctl" name="mouse_ioctl">
297 <sect1><tt/nes.h/<label id="nes.h"><p>
302 <sect1><tt/o65.h/<label id="o65.h"><p>
304 The <tt/o65.h/ header file contains structure and constant definitions that
305 may be used when dealing with files in <htmlurl
306 url="http://www.6502.org/users/andre/o65/fileformat.html" name="o65 format">.
307 It does not declare any functions.
310 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
313 <item><ref id="PEEK" name="PEEK">
314 <item><ref id="PEEKW" name="PEEKW">
315 <item><ref id="POKE" name="POKE">
316 <item><ref id="POKEW" name="POKEW">
320 <sect1><tt/pet.h/<label id="pet.h"><p>
325 <sect1><tt/plus4.h/<label id="plus4.h"><p>
330 <sect1><tt/serial.h/<label id="serial.h"><p>
334 <item><ref id="ser_load_driver" name="ser_load_driver">
335 <item><ref id="ser_unload" name="ser_unload">
336 <item><ref id="ser_install" name="ser_install">
337 <item><ref id="ser_uninstall" name="ser_uninstall">
338 <item><ref id="ser_open" name="ser_open">
339 <item><ref id="ser_close" name="ser_close">
340 <item><ref id="ser_get" name="ser_get">
341 <item><ref id="ser_put" name="ser_put">
342 <item><ref id="ser_status" name="ser_status">
343 <item><ref id="ser_ioctl" name="ser_ioctl">
350 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
353 <item><ref id="setjmp" name="setjmp">
354 <item><ref id="longjmp" name="longjmp">
358 <sect1><tt/signal.h/<label id="signal.h"><p>
361 <item><ref id="raise" name="raise">
362 <item><ref id="signal" name="signal">
366 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
371 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
376 <sect1><tt/stddef.h/<label id="stddef.h"><p>
379 <item><ref id="offsetof" name="offsetof">
383 <sect1><tt/stdio.h/<label id="stdio.h"><p>
386 <item><ref id="clearerr" name="clearerr">
387 <!-- <item><ref id="fclose" name="fclose"> -->
388 <!-- <item><ref id="fdopen" name="fdopen"> -->
389 <item><ref id="feof" name="feof">
390 <item><ref id="ferror" name="ferror">
391 <!-- <item><ref id="fflush" name="fflush"> -->
392 <!-- <item><ref id="fgetc" name="fgetc"> -->
393 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
394 <!-- <item><ref id="fgets" name="fgets"> -->
395 <item><ref id="fileno" name="fileno">
396 <!-- <item><ref id="fopen" name="fopen"> -->
397 <!-- <item><ref id="fprintf" name="fprintf"> -->
398 <!-- <item><ref id="fputc" name="fputc"> -->
399 <!-- <item><ref id="fputs" name="fputs"> -->
400 <!-- <item><ref id="fread" name="fread"> -->
401 <!-- <item><ref id="freopen" name="freopen"> -->
402 <!-- <item><ref id="fscanf" name="fscanf"> -->
403 <!-- <item><ref id="fseek" name="fseek"> -->
404 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
405 <!-- <item><ref id="ftell" name="ftell"> -->
406 <!-- <item><ref id="fwrite" name="fwrite"> -->
407 <!-- <item><ref id="getc" name="getc"> -->
408 <!-- <item><ref id="getchar" name="getchar"> -->
409 <!-- <item><ref id="gets" name="gets"> -->
410 <!-- <item><ref id="printf" name="printf"> -->
411 <!-- <item><ref id="putc" name="putc"> -->
412 <!-- <item><ref id="putchar" name="putchar"> -->
413 <!-- <item><ref id="puts" name="puts"> -->
414 <item><ref id="rename" name="rename">
415 <item><ref id="remove" name="remove">
416 <!-- <item><ref id="rewind" name="rewind"> -->
417 <!-- <item><ref id="scanf" name="scanf"> -->
418 <!-- <item><ref id="sprintf" name="sprintf"> -->
419 <!-- <item><ref id="sscanf" name="sscanf"> -->
420 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
421 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
422 <!-- <item><ref id="vprintf" name="vprintf"> -->
423 <!-- <item><ref id="vscanf" name="vscanf"> -->
424 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
425 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
431 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
434 <item><ref id="_heapadd" name="_heapadd">
435 <item><ref id="_heapblocksize" name="_heapblocksize">
436 <item><ref id="_heapmaxavail" name="_heapmaxavail">
437 <item><ref id="_heapmemavail" name="_heapmemavail">
438 <item><ref id="_poserror" name="_poserror">
439 <item><ref id="_randomize" name="_randomize">
440 <item><ref id="_swap" name="_swap">
441 <item><ref id="abort" name="abort">
442 <item><ref id="abs" name="abs">
443 <item><ref id="atexit" name="atexit">
444 <item><ref id="atoi" name="atoi">
445 <item><ref id="atol" name="atol">
446 <item><ref id="bsearch" name="bsearch">
447 <item><ref id="calloc" name="calloc">
448 <item><ref id="div" name="div">
449 <item><ref id="exit" name="exit">
450 <item><ref id="free" name="free">
451 <item><ref id="getenv" name="getenv">
452 <item><ref id="itoa" name="itoa">
453 <item><ref id="labs" name="labs">
454 <item><ref id="ltoa" name="ltoa">
455 <item><ref id="malloc" name="malloc">
456 <item><ref id="perror" name="perror">
457 <item><ref id="qsort" name="qsort">
458 <item><ref id="rand" name="rand">
459 <item><ref id="realloc" name="realloc">
460 <item><ref id="srand" name="srand">
461 <item><ref id="ultoa" name="ultoa">
462 <item><ref id="utoa" name="utoa">
466 <sect1><tt/string.h/<label id="string.h"><p>
469 <item><ref id="_stroserror" name="_stroserror">
470 <item><ref id="bzero" name="bzero">
471 <item><ref id="memchr" name="memchr">
472 <item><ref id="memcpy" name="memcpy">
473 <item><ref id="memmove" name="memmove">
474 <item><ref id="memset" name="memset">
475 <item><ref id="strcasecmp" name="strcasecmp">
476 <item><ref id="strcat" name="strcat">
477 <item><ref id="strchr" name="strchr">
478 <item><ref id="strcmp" name="strcmp">
479 <item><ref id="strcoll" name="strcoll">
480 <item><ref id="strcpy" name="strcpy">
481 <item><ref id="strcspn" name="strcspn">
482 <item><ref id="strdup" name="strdup">
483 <item><ref id="strerror" name="strerror">
484 <item><ref id="stricmp" name="stricmp">
485 <item><ref id="strlen" name="strlen">
486 <item><ref id="strlower" name="strlower">
487 <item><ref id="strlwr" name="strlwr">
488 <item><ref id="strncat" name="strncat">
489 <item><ref id="strncmp" name="strncmp">
490 <item><ref id="strncpy" name="strncpy">
491 <item><ref id="strrchr" name="strrchr">
492 <item><ref id="strspn" name="strspn">
493 <item><ref id="strstr" name="strstr">
494 <item><ref id="strtok" name="strtok">
495 <item><ref id="strxfrm" name="strxfrm">
496 <item><ref id="strupper" name="strupper">
497 <item><ref id="strupr" name="strupr">
503 <sect1><tt/tgi.h/<label id="tgi.h"><p>
508 <sect1><tt/time.h/<label id="time.h"><p>
511 <!-- <item><ref id="_systime" name="_systime"> -->
512 <!-- <item><ref id="asctime" name="asctime"> -->
513 <!-- <item><ref id="clock" name="clock"> -->
514 <!-- <item><ref id="ctime" name="ctime"> -->
515 <!-- <item><ref id="gmtime" name="gmtime"> -->
516 <!-- <item><ref id="localtime" name="localtime"> -->
517 <!-- <item><ref id="mktime" name="mktime"> -->
518 <!-- <item><ref id="strftime" name="strftime"> -->
519 <item><ref id="time" name="time">
525 <sect1><tt/unistd.h/<label id="unistd.h"><p>
528 <!-- <item><ref id="chdir" name="chdir"> -->
529 <!-- <item><ref id="getcwd" name="getcwd"> -->
530 <!-- <item><ref id="lseek" name="lseek"> -->
531 <!-- <item><ref id="mkdir" name="mkdir"> -->
532 <!-- <item><ref id="read" name="read"> -->
533 <!-- <item><ref id="rmdir" name="rmdir"> -->
534 <item><ref id="sleep" name="sleep">
535 <item><ref id="unlink" name="unlink">
536 <!-- <item><ref id="write" name="write"> -->
542 <sect1><tt/vic20.h/<label id="vic20.h"><p>
547 <sect1><tt/zlib.h/<label id="zlib.h"><p>
552 <sect>Alphabetical function reference<p>
554 <sect1>_heapadd<label id="_heapadd"><p>
558 <tag/Function/Add a block to the heap.
559 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
560 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
561 <tag/Description/The function adds a block of raw memory to the heap.
564 <item>The minimum blocksize that can be added is 6 bytes; the function will
565 ignore smaller blocks.
567 <tag/Availability/cc65
569 <ref id="_heapblocksize" name="_heapblocksize">,
570 <ref id="_heapmaxavail" name="_heapmaxavail">,
571 <ref id="_heapmemavail" name="_heapmemavail">,
572 <ref id="calloc" name="calloc">,
573 <ref id="free" name="free">,
574 <ref id="malloc" name="malloc">,
575 <ref id="realloc" name="realloc">
581 <sect1>_heapblocksize<label id="_heapblocksize"><p>
585 <tag/Function/Return the size of an allocated block.
586 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
587 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
588 <tag/Description/The function returns the size of a block that must have
589 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
590 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
593 <item>Passing a pointer to a block that was is not the result of one of the
594 allocation functions, or that has been free'd will give unpredicable results.
596 <tag/Availability/cc65
598 <ref id="_heapadd" name="_heapadd">,
599 <ref id="_heapmaxavail" name="_heapmaxavail">,
600 <ref id="_heapmemavail" name="_heapmemavail">,
601 <ref id="calloc" name="calloc">,
602 <ref id="free" name="free">,
603 <ref id="malloc" name="malloc">,
604 <ref id="realloc" name="realloc">
610 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
614 <tag/Function/Return the largest block that is available on the heap.
615 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
616 <tag/Declaration/<tt/size_t __fastcall__ _heapmaxavail (void);/
617 <tag/Description/The function returns the size of the largest block that may
618 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
619 <tag/Availability/cc65
621 <ref id="_heapadd" name="_heapadd">,
622 <ref id="_heapblocksize" name="_heapblocksize">,
623 <ref id="_heapmemavail" name="_heapmemavail">,
624 <ref id="calloc" name="calloc">,
625 <ref id="free" name="free">,
626 <ref id="malloc" name="malloc">,
627 <ref id="realloc" name="realloc">
633 <sect1>_heapmemavail<label id="_heapmemavail"><p>
637 <tag/Function/Return the total available space on the heap.
638 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
639 <tag/Declaration/<tt/size_t __fastcall__ _heapmemavail (void);/
640 <tag/Description/The function returns the total number of bytes available on
644 <item>This function is of less use than usually assumed, since the returned
645 heap space may be available but not in one block. So even if this function
646 says that several times more heap space is available than needed, <ref
647 id="malloc" name="malloc"> may still return <tt/NULL/.
649 <tag/Availability/cc65
651 <ref id="_heapadd" name="_heapadd">,
652 <ref id="_heapblocksize" name="_heapblocksize">,
653 <ref id="_heapmaxavail" name="_heapmaxavail">,
654 <ref id="calloc" name="calloc">,
655 <ref id="free" name="free">,
656 <ref id="malloc" name="malloc">,
657 <ref id="realloc" name="realloc">
663 <sect1>_poserror<label id="_poserror"><p>
667 <tag/Function/Print an error message for the error in <tt/_oserrno/.
668 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
669 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
670 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
671 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
672 a colon and a blank. Then the error message for the current contents of
673 <tt/_oserrno/ are printed followed by a newline. The message output is the
674 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
675 argument of <tt/_oserrno/.
678 <item>Since operating system specific error code are - you guessed it -
679 operating system specific, the value in <tt/_oserror/ and the message that is
680 printed depend on the cc65 target.
681 <item>The function is only available as fastcall function, so it may only
682 be used in presence of a prototype.
684 <tag/Availability/cc65
686 <ref id="_stroserror" name="_stroserror">,
687 <ref id="perror" name="perror">
693 <sect1>_randomize<label id="_randomize"><p>
697 <tag/Function/Initialize the pseudo random number generator.
698 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
699 <tag/Declaration/<tt/void _randomize (void);/
700 <tag/Description/The function initializes the random number generator with
701 a seed derived from fast changing hardware events, so the seed itself can be
702 considered random to a certain degree.
703 <tag/Limits/<itemize>
704 <item>The randomness of the seed depends on the machine hardware.
706 <tag/Availability/cc65
708 <ref id="rand" name="rand">,
709 <ref id="srand" name="srand">
715 <sect1>_stroserror<label id="_stroserror"><p>
719 <tag/Function/Return a string describing an OS specific error code.
720 <tag/Header/<tt/<ref id="string.h" name="string.h">/
721 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
722 <tag/Description/<tt/_stroserror/ will return a string describing the given
723 operating system specific error code.
724 <tag/Limits/<itemize>
725 <item>Since operating system specific error code are - you guessed it -
726 operating system specific, the parameter and the string returned depend on the
728 <item>The function is only available as fastcall function, so it may only be
729 used in presence of a prototype.
731 <tag/Availability/cc65
733 <ref id="strerror" name="strerror">
739 <sect1>_swap<label id="_swap"><p>
743 <tag/Function/Swap the contents of memory areas.
744 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
745 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
746 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
747 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
748 <tt/size/ bytes in size.
749 <tag/Limits/<itemize>
750 <item>The memory areas may not overlap, otherwise the results are undefined.
751 <item>The function is only available as fastcall function, so it may only be
752 used in presence of a prototype.
754 <tag/Availability/cc65
756 <ref id="memcpy" name="memcpy">,
757 <ref id="memmove" name="memmove">
763 <sect1>_sys<label id="_sys"><p>
767 <tag/Function/Call a subroutine passing register values.
768 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
769 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
770 <tag/Description/The function will call the subroutine at the address
771 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
772 registers and the CPU flags are set to the values given in the <tt/regs/
773 structure. On return from the subroutine, the new values of the registers and
774 flags are stored back overwriting the old values.
775 <tag/Limits/<itemize>
776 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
777 when calling the subroutine (they are unchanged from their current values).
778 <item>The function is only available as fastcall function, so it may only be
779 used in presence of a prototype.
781 <tag/Availability/cc65
787 <sect1>BRK<label id="BRK"><p>
791 <tag/Function/Insert a 6502 BRK instrunction into the code.
792 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
793 <tag/Declaration/<tt/void BRK (void);/
794 <tag/Description/The function will insert a 6502 BRK instruction into the code
795 which may be used to trigger a debugger.
796 <tag/Limits/<itemize>
797 <item>The function is actually a macro.
798 <item>The inserted instruction may lead to unexpected results if no debugger
801 <tag/Availability/cc65
803 <ref id="CLI" name="CLI">,
804 <ref id="SEI" name="SEI">
810 <sect1>CLI<label id="CLI"><p>
814 <tag/Function/Insert a 6502 CLI instrunction into the code.
815 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
816 <tag/Declaration/<tt/void CLI (void);/
817 <tag/Description/The function will insert a 6502 CLI instruction into the code,
818 so interrupts are enabled. Enabling interrupts has no effects if they are
819 already enabled (the default).
820 <tag/Limits/<itemize>
821 <item>The function is actually a macro.
822 <item>Disabling interrupts may lead to unexpected results.
824 <tag/Availability/cc65
826 <ref id="BRK" name="BRK">,
827 <ref id="SEI" name="SEI">
833 <sect1>PEEK<label id="PEEK"><p>
837 <tag/Function/Read a byte from memory.
838 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
839 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
840 <tag/Description/The function will read the absolute memory given by <tt/addr/
841 and return the value read.
842 <tag/Limits/<itemize>
843 <item>The function is actually a macro.
844 <item>This function depends highly on the platform and environment.
846 <tag/Availability/cc65
848 <ref id="PEEKW" name="PEEKW">,
849 <ref id="POKE" name="POKE">
855 <sect1>PEEKW<label id="PEEKW"><p>
859 <tag/Function/Read a word (two bytes) from memory.
860 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
861 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
862 <tag/Description/The function will read the absolute memory given by <tt/addr/
863 and return the value read. The byte read from the higher address is the high
864 byte of the return value.
865 <tag/Limits/<itemize>
866 <item>The function is actually a macro.
867 <item>This function depends highly on the platform and environment.
868 <item>The order in which the two bytes are read is unspecified and may
869 depend of the address expression used.
871 <tag/Availability/cc65
873 <ref id="PEEK" name="PEEK">,
874 <ref id="POKE" name="POKE">
880 <sect1>POKE<label id="POKE"><p>
884 <tag/Function/Write a byte to memory.
885 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
886 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
887 <tag/Description/The function writes the value <tt/val/ to the absolute
888 memory address given by <tt/addr/.
889 <tag/Limits/<itemize>
890 <item>The function is actually a macro.
891 <item>This function depends highly on the platform and environment.
892 <item>Careless use will cause the program to act strange or may crash the
895 <tag/Availability/cc65
897 <ref id="PEEK" name="PEEK">,
898 <ref id="POKEW" name="POKEW">
904 <sect1>POKEW<label id="POKEW"><p>
908 <tag/Function/Write a word (two bytes) to memory.
909 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
910 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
911 <tag/Description/The function writes the value <tt/val/ to the absolute
912 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
913 the <tt/addr/, the high byte is written to <tt/addr+1/.
914 <tag/Limits/<itemize>
915 <item>The function is actually a macro.
916 <item>This function depends highly on the platform and environment.
917 <item>Careless use will cause the program to act strange or may crash the
919 <item>The order in which the two bytes are written is unspecified and may
920 depend of the address expression used.
922 <tag/Availability/cc65
924 <ref id="PEEK" name="PEEK">,
925 <ref id="POKE" name="POKE">
931 <sect1>SEI<label id="SEI"><p>
935 <tag/Function/Insert a 6502 SEI instrunction into the code.
936 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
937 <tag/Declaration/<tt/void SEI (void);/
938 <tag/Description/The function will insert a 6502 SEI instruction into the code,
939 so interrupts are disabled. Note that non maskable interrupts cannot be
941 <tag/Limits/<itemize>
942 <item>The function is actually a macro.
943 <item>Disabling interrupts may lead to unexpected results.
945 <tag/Availability/cc65
947 <ref id="BRK" name="BRK">,
948 <ref id="CLI" name="CLI">
954 <sect1>abort<label id="abort"><p>
958 <tag/Function/Terminates a program abnormally.
959 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
960 <tag/Declaration/<tt/void abort (void);/
961 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
962 on stderr, then terminates the program with an exit code of 3.
963 <tag/Availability/ISO 9899
965 <ref id="assert" name="assert">,
966 <ref id="exit" name="exit">,
967 <ref id="raise" name="raise">
973 <sect1>abs<label id="abs"><p>
977 <tag/Function/Returns the absolute value of an integer.
978 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
979 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
980 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
982 <tag/Limits/<itemize>
983 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
984 <item>The function is only available as fastcall function, so it may only be
985 used in presence of a prototype.
987 <tag/Availability/ISO 9899
989 <ref id="labs" name="labs">
995 <sect1>assert<label id="assert"><p>
999 <tag/Function/Test a condition and possibly abort.
1000 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
1001 <tag/Declaration/<tt/void assert (int cond);/
1002 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
1003 statement. If the condition evaluates t zero (false), assert prints a message
1004 on stderr and aborts the program.
1005 <tag/Limits/<itemize>
1006 <item>The function is actually a macro.
1008 <tag/Availability/ISO 9899
1010 <ref id="abort" name="abort">,
1011 <ref id="exit" name="exit">
1017 <sect1>atexit<label id="atexit"><p>
1021 <tag/Function/Register an exit function.
1022 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1023 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1024 <tag/Description/<tt/atexit/ registers the function pointed to by
1025 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1026 terminates, they are called in LIFO order (the last function registered is
1027 called first). <tt/atexit/ returns zero on success and a nonzero value on
1029 <tag/Limits/<itemize>
1030 <item>A maximum of 5 exit functions can be registered.
1031 <item>There is no way to unregister an exit function.
1032 <item>The function is only available as fastcall function, so it may only be
1033 used in presence of a prototype.
1035 <tag/Availability/ISO 9899
1037 <ref id="abort" name="abort">,
1038 <ref id="exit" name="exit">
1044 <sect1>atoi<label id="atoi"><p>
1048 <tag/Function/Convert a string to an integer.
1049 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1050 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1051 <tag/Description/<tt/atoi/ converts the given string into an integer.
1052 Conversion stops as soon as any invalid character is encountered.
1053 <tag/Limits/<itemize>
1054 <item>There is no way to detect any conversion errors.
1055 <item>The function does not check for an numerical overflow when converting.
1056 <item>The function is only available as fastcall function, so it may only be
1057 used in presence of a prototype.
1059 <tag/Availability/ISO 9899
1061 <ref id="atol" name="atol">,
1062 <ref id="itoa" name="itoa">,
1063 <ref id="ltoa" name="ltoa">,
1064 <ref id="ultoa" name="ultoa">,
1065 <ref id="utoa" name="utoa">
1071 <sect1>atol<label id="atol"><p>
1075 <tag/Function/Convert a string to a long integer.
1076 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1077 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1078 <tag/Description/<tt/atol/ converts the given string into a long integer.
1079 Conversion stops as soon as any invalid character is encountered.
1080 <tag/Limits/<itemize>
1081 <item>There is no way to detect any conversion errors.
1082 <item>The function does not check for an numerical overflow when converting.
1083 <item>The function is only available as fastcall function, so it may only be
1084 used in presence of a prototype.
1086 <tag/Availability/ISO 9899
1088 <ref id="atoi" name="atoi">,
1089 <ref id="itoa" name="itoa">,
1090 <ref id="ltoa" name="ltoa">,
1091 <ref id="ultoa" name="ultoa">,
1092 <ref id="utoa" name="utoa">
1098 <sect1>bgcolor<label id="bgcolor"><p>
1102 <tag/Function/Set the background text color.
1103 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1104 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1105 <tag/Description/The function will set a new background color and return the
1106 old (current) one. The background color is valid for the whole text output
1107 area of the screen, not just for new text.
1108 <tag/Limits/<itemize>
1109 <item>Background colors are system dependent. The function may have no effect
1110 on systems where the background color cannot be changed.
1111 <item>The function is only available as fastcall function, so it may only be
1112 used in presence of a prototype.
1114 <tag/Availability/cc65
1116 <ref id="bordercolor" name="bordercolor">,
1117 <ref id="textcolor" name="textcolor">
1123 <sect1>bordercolor<label id="bordercolor"><p>
1127 <tag/Function/Set the border (frame) color.
1128 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1129 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1130 <tag/Description/The function will set a new border color. It returns the old
1131 (current) border color.
1132 <tag/Limits/<itemize>
1133 <item>Border colors are system dependent. The function may have no effect
1134 on systems where the border color cannot be changed.
1135 <item>The function is only available as fastcall function, so it may only
1136 be used in presence of a prototype.
1138 <tag/Availability/cc65
1140 <ref id="bgcolor" name="bgcolor">,
1141 <ref id="textcolor" name="textcolor">
1147 <sect1>bsearch<label id="bsearch"><p>
1151 <tag/Function/Do a binary search in a sorted array.
1152 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1153 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1154 const void* base, size_t n, size_t size,
1155 int (*cmp) (const void*, const void*));/
1156 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1157 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1158 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1159 the function used to compare the members against the key. The function returns
1160 a pointer to the member found, or <tt/NULL/ if there was no match.
1163 <item>The contents of the array must be sorted in ascending order according to
1164 the compare function given.
1165 <item>If there are multiple members that match the key, the function will
1166 return one of the members.
1167 <item>The function is only available as fastcall function, so it may only
1168 be used in presence of a prototype.
1170 <tag/Availability/ISO 9899
1172 <ref id="qsort" name="qsort">
1178 <sect1>bzero<label id="bzero"><p>
1182 <tag/Function/Fill a memory area with zeroes.
1183 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1184 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1185 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1189 <item>The function is non standard and therefore only available in non ANSI
1190 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1191 <item>The function is only available as fastcall function, so it may only
1192 be used in presence of a prototype.
1194 <tag/Availability/cc65
1196 <ref id="_swap" name="_swap">,
1197 <ref id="memcpy" name="memcpy">,
1198 <ref id="memmove" name="memmove">,
1199 <ref id="memset" name="memset">,
1205 <sect1>c64mode<label id="c64mode"><p>
1209 <tag/Function/Switch the C128 into C64 compatible mode.
1210 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1211 <tag/Declaration/<tt/void c64mode (void);/
1212 <tag/Description/The function will cause the machine to reboot into C64 mode.
1213 <tag/Limits/<itemize>
1214 <item>The function is specific to the C128.
1215 <item>The function will not return to the caller.
1217 <tag/Availability/C128
1223 <sect1>calloc<label id="calloc"><p>
1227 <tag/Function/Allocate and clear memory.
1228 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1229 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1230 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1231 of size <tt/size/, clears the whole block with binary zeroes and returns a
1232 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1236 <item>Clearing the memory may not have the expected effect on all platforms:
1237 pointers in the block may not be <tt/NULL/ and floating point variables may
1238 not be zero (0.0). In other words: The "clearing" effect of this function
1239 should be used with care for portable programs.
1240 <item>The function is only available as fastcall function, so it may only
1241 be used in presence of a prototype.
1243 <tag/Availability/ISO 9899
1245 <ref id="_heapadd" name="_heapadd">,
1246 <ref id="_heapblocksize" name="_heapblocksize">,
1247 <ref id="_heapmaxavail" name="_heapmaxavail">,
1248 <ref id="_heapmemavail" name="_heapmemavail">,
1249 <ref id="free" name="free">,
1250 <ref id="malloc" name="malloc">,
1251 <ref id="realloc" name="realloc">
1257 <sect1>cclear<label id="cclear"><p>
1261 <tag/Function/Clear part of a line (write a given number of spaces).
1262 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1263 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
1264 <tag/Description/The function clears part of a line by writing <tt/length/
1265 spaces in the current text color.
1266 <tag/Limits/<itemize>
1267 <item>The function is only available as fastcall function, so it may
1268 only be used in presence of a prototype.
1270 <tag/Availability/cc65
1272 <ref id="cclearxy" name="cclearxy">,
1273 <ref id="clrscr" name="clrscr">
1279 <sect1>cclearxy<label id="cclearxy"><p>
1283 <tag/Function/Clear part of a line (write a given number of spaces) starting
1284 at a specific screen position.
1285 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1286 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
1287 <tag/Description/The function moves the cursor to a specific position, and
1288 will then clear part of the line by writing <tt/length/ spaces in the current
1290 <tag/Limits/<itemize>
1291 <item>The function is only available as fastcall function, so it may
1292 only be used in presence of a prototype.
1294 <tag/Availability/cc65
1296 <ref id="cclear" name="cclear">,
1297 <ref id="clrscr" name="clrscr">
1303 <sect1>cgetc<label id="cgetc"><p>
1307 <tag/Function/Read a character from the keyboard.
1308 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1309 <tag/Declaration/<tt/char cgetc (void);/
1310 <tag/Description/The function reads a character from the keyboard. If there is
1311 no character available, <tt/cgetc/ waits until the user presses a key. If the
1312 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
1313 displayed while waiting.
1314 <tag/Limits/<itemize>
1315 <item>If the system supports a keyboard buffer, <tt/cgetc/ will fetch a key
1316 from this buffer and wait only if the buffer is empty.
1318 <tag/Availability/cc65
1320 <ref id="cursor" name="cursor">,
1321 <ref id="kbhit" name="kbhit">
1327 <sect1>chline<label id="chline"><p>
1331 <tag/Function/Output a horizontal line in text mode.
1332 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1333 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
1334 <tag/Description/The function outputs a horizontal line with the given length
1335 starting at the current cursor position.
1336 <tag/Limits/<itemize>
1337 <item>The character used to draw the horizontal line is system dependent.
1338 If available, a line drawing character is used. Drawing a line that is partially
1339 off screen leads to undefined behaviour.
1340 <item>The function is only available as fastcall function, so it may only be
1341 used in presence of a prototype.
1343 <tag/Availability/cc65
1345 <ref id="chlinexy" name="chlinexy">,
1346 <ref id="cvline" name="cvline">,
1347 <ref id="cvlinexy" name="cvlinexy">
1353 <sect1>chlinexy<label id="chlinexy"><p>
1357 <tag/Function/Output a horizontal line at a given position in text mode.
1358 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1359 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
1360 <tag/Description/The function outputs a horizontal line with the given length
1361 starting at a given position.
1362 <tag/Limits/<itemize>
1363 <item>The character used to draw the horizontal line is system dependent.
1364 If available, a line drawing character is used. Drawing a line that is partially
1365 off screen leads to undefined behaviour.
1366 <item>The function is only available as fastcall function, so it may only be
1367 used in presence of a prototype.
1369 <tag/Availability/cc65
1371 <ref id="chline" name="chline">,
1372 <ref id="cvline" name="cvline">,
1373 <ref id="cvlinexy" name="cvlinexy">
1379 <sect1>clearerr<label id="clearerr"><p>
1383 <tag/Function/Clear error and end-of-file status of a stream.
1384 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1385 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
1386 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
1387 indicators for the stream <tt/f/.
1388 <tag/Limits/<itemize>
1389 <item>The function is only available as fastcall function, so it may only be
1390 used in presence of a prototype.
1392 <tag/Availability/ISO 9899
1394 <ref id="feof" name="feof">,
1395 <ref id="ferror" name="ferror">
1401 <sect1>clrscr<label id="clrscr"><p>
1405 <tag/Function/Clear the text screen.
1406 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1407 <tag/Declaration/<tt/void clrscr (void);/
1408 <tag/Description/The function clears the text screen and moves the cursor to
1409 the upper left corner.
1410 <tag/Availability/cc65
1412 <ref id="cclear" name="cclear">,
1413 <ref id="cclearxy" name="cclearxy">
1419 <sect1>close<label id="close"><p>
1423 <tag/Function/Close a file descriptor.
1424 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1425 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
1426 <tag/Description/The function closes the given file descriptor. It returns zero
1427 on success and -1 on error. If an error occurs, the cause can be determined by
1428 reading the <tt/errno/ variable.
1429 <tag/Limits/<itemize>
1430 <item>The function is only available as fastcall function, so it may only
1431 be used in presence of a prototype.
1433 <tag/Availability/POSIX 1003.1
1435 <ref id="creat" name="creat">,
1436 <ref id="open" name="open">
1442 <sect1>creat<label id="creat"><p>
1446 <tag/Function/Create a file.
1447 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1448 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
1449 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
1450 associated with it. On error, -1 is returned and an error code is stored in
1452 <tag/Limits/<itemize>
1453 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
1454 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
1455 <item>The function is only available as fastcall function, so it may only
1456 be used in presence of a prototype.
1458 <tag/Availability/POSIX 1003.1
1460 <ref id="close" name="close">,
1461 <ref id="open" name="open">
1467 <sect1>cprintf<label id="cprintf"><p>
1471 <tag/Function/Formatted output to the console.
1472 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1473 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
1474 <tag/Description/The arguments are converted to text where necessary and
1475 formatted according to the format string given. The resulting string is output
1476 to the console. <tt/cprintf/ supports the same format specifiers as
1477 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
1478 <tag/Limits/<itemize>
1479 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
1480 between <tt/\r/ and <tt/\n/.
1482 <tag/Availability/cc65
1484 <ref id="cputc" name="cputc">,
1485 <ref id="cputcxy" name="cputcxy">,
1486 <ref id="cputs" name="cputs">,
1487 <ref id="cputsxy" name="cputsxy">,
1488 <ref id="vcprintf" name="vcprintf">
1494 <sect1>cputc<label id="cputc"><p>
1498 <tag/Function/Output a character directly to the console.
1499 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1500 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
1501 <tag/Description/Output one character to the console at the current cursor
1503 <tag/Limits/<itemize>
1504 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
1505 between <tt/\r/ and <tt/\n/.
1506 <item>The function is only available as fastcall function, so it may only
1507 be used in presence of a prototype.
1509 <tag/Availability/cc65
1511 <ref id="cprintf" name="cprintf">,
1512 <ref id="cputcxy" name="cputcxy">,
1513 <ref id="cputs" name="cputs">,
1514 <ref id="cputsxy" name="cputsxy">,
1515 <ref id="vcprintf" name="vcprintf">
1521 <sect1>cputcxy<label id="cputcxy"><p>
1525 <tag/Function/Output a character at a specific screen position.
1526 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1527 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
1528 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
1529 the screen and outputs one character.
1530 <tag/Limits/<itemize>
1531 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
1532 between <tt/\r/ and <tt/\n/.
1533 <item>The function is only available as fastcall function, so it may only
1534 be used in presence of a prototype.
1536 <tag/Availability/cc65
1538 <ref id="cprintf" name="cprintf">,
1539 <ref id="cputc" name="cputc">,
1540 <ref id="cputs" name="cputs">,
1541 <ref id="cputsxy" name="cputsxy">,
1542 <ref id="vcprintf" name="vcprintf">
1548 <sect1>cputs<label id="cputs"><p>
1552 <tag/Function/Output a string directly to the console.
1553 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1554 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
1555 <tag/Description/The function outputs the given string on the console at the
1556 current cursor position.
1557 <tag/Limits/<itemize>
1558 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
1559 between <tt/\r/ and <tt/\n/.
1560 <item>The function is only available as fastcall function, so it may only
1561 be used in presence of a prototype.
1563 <tag/Availability/cc65
1565 <ref id="cprintf" name="cprintf">,
1566 <ref id="cputc" name="cputc">,
1567 <ref id="cputcxy" name="cputcxy">,
1568 <ref id="cputsxy" name="cputsxy">,
1569 <ref id="vcprintf" name="vcprintf">
1575 <sect1>cputsxy<label id="cputsxy"><p>
1579 <tag/Function/Output a string to the console at a given position.
1580 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1581 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
1582 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
1583 and outputs the string <tt/s/.
1584 <tag/Limits/<itemize>
1585 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
1586 between <tt/\r/ and <tt/\n/.
1587 <item>The function is only available as fastcall function, so it may only
1588 be used in presence of a prototype.
1590 <tag/Availability/cc65
1592 <ref id="cprintf" name="cprintf">,
1593 <ref id="cputc" name="cputc">,
1594 <ref id="cputcxy" name="cputcxy">,
1595 <ref id="cputs" name="cputs">,
1596 <ref id="vcprintf" name="vcprintf">
1602 <sect1>cursor<label id="cursor"><p>
1606 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
1607 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1608 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
1609 <tag/Description/If the argument to the function is non zero, a blinking cursor
1610 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
1611 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
1612 <tag/Limits/<itemize>
1613 <item>The function is only available as fastcall function, so it may only
1614 be used in presence of a prototype.
1616 <tag/Availability/cc65
1618 <ref id="cgetc" name="cgetc">,
1619 <ref id="kbhit" name="kbhit">
1625 <sect1>cvline<label id="cvline"><p>
1629 <tag/Function/Output a vertical line in text mode.
1630 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1631 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
1632 <tag/Description/The function outputs a vertical line with the given length
1633 starting at the current cursor position.
1634 <tag/Limits/<itemize>
1635 <item>The character used to draw the vertical line is system dependent.
1636 If available, a line drawing character is used. Drawing a line that is partially
1637 off screen leads to undefined behaviour.
1638 <item>The function is only available as fastcall function, so it may only be
1639 used in presence of a prototype.
1641 <tag/Availability/cc65
1643 <ref id="chline" name="chline">,
1644 <ref id="chlinexy" name="chlinexy">,
1645 <ref id="cvlinexy" name="cvlinexy">
1651 <sect1>cvlinexy<label id="cvlinexy"><p>
1655 <tag/Function/Output a vertical line at a given position in text mode.
1656 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1657 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
1658 <tag/Description/The function outputs a vertical line with the given length
1659 starting at a given position.
1660 <tag/Limits/<itemize>
1661 <item>The character used to draw the vertical line is system dependent.
1662 If available, a line drawing character is used. Drawing a line that is partially
1663 off screen leads to undefined behaviour.
1664 <item>The function is only available as fastcall function, so it may only be
1665 used in presence of a prototype.
1667 <tag/Availability/cc65
1669 <ref id="chline" name="chline">,
1670 <ref id="chlinexy" name="chlinexy">,
1671 <ref id="cvline" name="cvline">
1677 <sect1>div<label id="div"><p>
1681 <tag/Function/Divide two ints and return quotient and remainder.
1682 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1683 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
1684 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
1685 quotient and remainder in a <tt/div_t/ structure.
1688 <item>The function is only available as fastcall function, so it may only
1689 be used in presence of a prototype.
1691 <tag/Availability/ISO 9899
1699 <sect1>em_commit<label id="em_commit"><p>
1703 <tag/Function/Commit changes into extended memory.
1704 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1705 <tag/Declaration/<tt/void __fastcall__ em_commit (void);/
1706 <tag/Description/Commit changes in the memory window to extended storage. If
1707 the contents of the memory window have been changed, these changes may be lost
1708 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
1709 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
1710 name="em_copyto">/ are called without calling <tt/em_commit/ first.
1711 <tag/Limits/<itemize>
1712 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
1713 memory window are discarded, it does just mean that the drivers is allowed
1715 <item>The function is only available as fastcall function, so it may only be
1716 used in presence of a prototype.
1717 <item>The function produces undefined results if no extended memory driver is
1720 <tag/Availability/cc65
1722 <ref id="em_load_driver" name="em_load_driver">,
1723 <ref id="em_map" name="em_map">,
1724 <ref id="em_use" name="em_use">
1730 <sect1>em_copyfrom<label id="em_copyfrom"><p>
1734 <tag/Function/Copy from extended into normal memory.
1735 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1736 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
1737 <tag/Description/Copy data from extended memory into linear memory. Source and
1738 target addresses as well as the number of bytes to transfer are specified in
1739 the <tt/em_copy/ structure that is passed as a parameter.
1740 <tag/Limits/<itemize>
1741 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
1742 made any changes to the data in the window, call <tt/<ref id="em_commit"
1743 name="em_commit">/ first, or the changes are lost.
1744 <item>The function is only available as fastcall function, so it may only be
1745 used in presence of a prototype.
1746 <item>The function produces undefined results if no extended memory driver is
1749 <tag/Availability/cc65
1751 <ref id="em_commit" name="em_commit">,
1752 <ref id="em_copyto" name="em_copyto">,
1753 <ref id="em_load_driver" name="em_load_driver">
1759 <sect1>em_copyto<label id="em_copyto"><p>
1763 <tag/Function/Copy from normal into extended memory.
1764 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1765 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
1766 <tag/Description/Copy data from linear into extended memory. Source and
1767 target addresses as well as the number of bytes to transfer are specified in
1768 the <tt/em_copy/ structure that is passed as a parameter.
1769 <tag/Limits/<itemize>
1770 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
1771 made any changes to the data in the window, call <tt/<ref id="em_commit"
1772 name="em_commit">/ first, or the changes are lost.
1773 <item>The function is only available as fastcall function, so it may only be
1774 used in presence of a prototype.
1775 <item>The function produces undefined results if no extended memory driver is
1778 <tag/Availability/cc65
1780 <ref id="em_commit" name="em_commit">,
1781 <ref id="em_copyfrom" name="em_copyfrom">,
1782 <ref id="em_load_driver" name="em_load_driver">
1788 <sect1>em_install<label id="em_install"><p>
1792 <tag/Function/Install an already loaded extended memory driver.
1793 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1794 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
1795 <tag/Description/The function installs an already loaded extended memory driver
1796 and returns an error code. The function may be used to install a driver linked
1797 statically to the program.
1798 <tag/Limits/<itemize>
1799 <item>Not all drivers are able to detect if the supported hardware is really
1801 <item>The function is only available as fastcall function, so it may only be
1802 used in presence of a prototype.
1804 <tag/Availability/cc65
1806 <ref id="em_load_driver" name="em_load_driver">,
1807 <ref id="em_uninstall" name="em_uninstall">,
1808 <ref id="em_unload" name="em_unload">
1814 <sect1>em_load_driver<label id="em_load_driver"><p>
1818 <tag/Function/Load and initialize an extended memory driver.
1819 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1820 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
1821 <tag/Description/Load an extended memory driver into memory and initialize
1822 it. The function returns an error code that tells if all this has been
1824 <tag/Limits/<itemize>
1825 <item>Not all drivers are able to detect if the supported hardware is really
1827 <item>The function is only available as fastcall function, so it may only be
1828 used in presence of a prototype.
1829 <item>The driver is loaded by name, so currently you must know the type of
1830 extended memory that should be supported. There is no autodetect capability.
1832 <tag/Availability/cc65
1834 <ref id="em_unload" name="em_unload">
1840 <sect1>em_map<label id="em_map"><p>
1844 <tag/Function/Make a page of extended memory accessible.
1845 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1846 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
1847 <tag/Description/The function maps one page of extended memory into linear
1848 memory and returns a pointer to the page frame. Depending on the hardware
1849 and driver, the data is either mapped into the address space or transfered
1850 into a buffer. If you don't need the actual contents of the page (for example
1851 because you're going to overwrite it completely), it is better to call
1852 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
1853 data if it is possible to avoid that.
1854 <tag/Limits/<itemize>
1855 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
1856 made any changes to the data in the window, call <tt/<ref id="em_commit"
1857 name="em_commit">/ first, or the changes are lost.
1858 <item>The function is only available as fastcall function, so it may only be
1859 used in presence of a prototype.
1860 <item>The function produces undefined results if no extended memory driver is
1863 <tag/Availability/cc65
1865 <ref id="em_commit" name="em_commit">,
1866 <ref id="em_load_driver" name="em_load_driver">,
1867 <ref id="em_use" name="em_use">
1873 <sect1>em_pagecount<label id="em_pagecount"><p>
1877 <tag/Function/Return the number of available extended memory pages.
1878 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1879 <tag/Declaration/<tt/unsigned __fastcall__ em_pagecount (void);/
1880 <tag/Description/The function returns the size of the extended memory supported
1881 by the driver in 256 byte pages.
1882 <tag/Limits/<itemize>
1883 <item>The function returns zero if no extended memory driver is loaded.
1884 <item>The function may return zero if the supported hardware was not detected.
1886 <tag/Availability/cc65
1888 <ref id="em_load_driver" name="em_load_driver">
1894 <sect1>em_uninstall<label id="em_uninstall"><p>
1898 <tag/Function/Uninstall an already loaded extended memory driver.
1899 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1900 <tag/Declaration/<tt/unsigned char __fastcall__ em_install (void);/
1901 <tag/Description/The function uninstalls an already loaded extended memory
1902 driver but doesn't remove it from memory.
1903 <tag/Limits/<itemize>
1904 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
1905 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
1906 should be used instead of <tt/em_uninstall/ so the driver is also removed
1908 <item>The function is only available as fastcall function, so it may only be
1909 used in presence of a prototype.
1911 <tag/Availability/cc65
1913 <ref id="em_install" name="em_install">,
1914 <ref id="em_load_driver" name="em_load_driver">,
1915 <ref id="em_unload" name="em_unload">
1921 <sect1>em_unload<label id="em_unload"><p>
1925 <tag/Function/Unload an extended memory driver.
1926 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1927 <tag/Declaration/<tt/unsigned char __fastcall__ em_unload (void);/
1928 <tag/Description/The function unloads a loaded extended memory driver and
1929 frees all memory allocated for the driver.
1930 <tag/Limits/<itemize>
1931 <item>The function does nothing if no driver is loaded.
1933 <tag/Availability/cc65
1935 <ref id="em_load_driver" name="em_load_driver">
1941 <sect1>em_use<label id="em_use"><p>
1945 <tag/Function/Prepare an extended memory page for use.
1946 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1947 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
1948 <tag/Description/The function maps one page of extended memory into linear
1949 memory and returns a pointer to the page frame. This function is similar to
1950 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
1951 actual memory window in the assumption that the existing data is wrong or
1952 will get overwritten.
1953 <tag/Limits/<itemize>
1954 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
1955 made any changes to the data in the window, call <tt/<ref id="em_commit"
1956 name="em_commit">/ first, or the changes are lost.
1957 <item>The function is only available as fastcall function, so it may only be
1958 used in presence of a prototype.
1959 <item>The function produces undefined results if no extended memory driver is
1962 <tag/Availability/cc65
1964 <ref id="em_commit" name="em_commit">,
1965 <ref id="em_load_driver" name="em_load_driver">,
1966 <ref id="em_map" name="em_map">
1972 <sect1>exit<label id="exit"><p>
1976 <tag/Function/Terminate the program.
1977 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1978 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
1979 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
1980 return code of the program. Before termination, all files are closed, buffered
1981 output is written and any functions registered with <tt/<ref id="atexit"
1982 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
1983 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
1985 <tag/Limits/<itemize>
1986 <item>The function is only available as fastcall function, so it may only
1987 be used in presence of a prototype.
1988 <item>It depends on the host machine if the program return code can be
1989 evaluated or is ignored.
1991 <tag/Availability/ISO 9899
1993 <ref id="abort" name="abort">,
1994 <ref id="exit" name="exit">
2000 <sect1>fast<label id="fast"><p>
2004 <tag/Function/Switch the C128 into 2MHz mode.
2005 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
2006 <tag/Declaration/<tt/void fast (void);/
2007 <tag/Description/The function will switch the clock of the C128 to 2MHz. This
2008 will nearly double the speed compared to slow mode.
2009 <tag/Limits/<itemize>
2010 <item>The function is specific to the C128.
2011 <item>2MHz clock will not work in 40 column mode.
2013 <tag/Availability/C128
2015 <ref id="slow" name="slow">,
2016 <ref id="toggle_videomode" name="toggle_videomode">,
2017 <ref id="videomode" name="videomode">
2023 <sect1>feof<label id="feof"><p>
2027 <tag/Function/Return the end-of-file indicator of a stream.
2028 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2029 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
2030 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
2031 <tt/f/, and returns a non zero value if it is set.
2032 <tag/Limits/<itemize>
2033 <item>The indicator is set only after a read past the end of a file is
2035 <item>The function is only available as fastcall function, so it may only be
2036 used in presence of a prototype.
2038 <tag/Availability/ISO 9899
2040 <ref id="feof" name="clearerr">,
2041 <ref id="ferror" name="ferror">
2047 <sect1>ferror<label id="ferror"><p>
2051 <tag/Function/Return the error indicator of a stream.
2052 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2053 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
2054 <tag/Description/<tt/ferror/ tests the error indicator of the stream
2055 <tt/f/, and returns a non zero value if it is set.
2056 <tag/Limits/<itemize>
2057 <item>The function is only available as fastcall function, so it may only be
2058 used in presence of a prototype.
2060 <tag/Availability/ISO 9899
2062 <ref id="feof" name="clearerr">,
2063 <ref id="ferror" name="feof">
2069 <sect1>fileno<label id="fileno"><p>
2073 <tag/Function/Return the file handle used by a stream.
2074 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2075 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
2076 <tag/Description/The <tt/fileno/ function returns the file handle used
2077 internally by a C stream. This file handle (an integer) can be used as a
2078 handle for the POSIX input/output functions.
2079 <tag/Limits/<itemize>
2080 <item>The function is only available as fastcall function, so it may only be
2081 used in presence of a prototype.
2082 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
2083 file may have unpredictable results.
2085 <tag/Availability/POSIX 1003.1
2087 <ref id="creat" name="creat">,
2088 <ref id="open" name="open"> <!-- , -->
2089 <!-- <ref id="read" name="read">, -->
2090 <!-- <ref id="write" name="write"> -->
2096 <sect1>free<label id="free"><p>
2100 <tag/Function/Free a block of dynamic memory.
2101 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2102 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
2103 <tag/Description/Free a block of dynamic memory previously allocated with
2104 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
2105 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
2106 pointer is <tt/NULL/, no action is performed.
2109 <item>Passing an already free'd block to <tt/free/ again will cause undefined
2110 behaviour and may crash your program.
2111 <item>The function is only available as fastcall function, so it may only
2112 be used in presence of a prototype.
2114 <tag/Availability/ISO 9899
2116 <ref id="_heapadd" name="_heapadd">,
2117 <ref id="_heapblocksize" name="_heapblocksize">,
2118 <ref id="_heapmaxavail" name="_heapmaxavail">,
2119 <ref id="_heapmemavail" name="_heapmemavail">,
2120 <ref id="calloc" name="calloc">,
2121 <ref id="malloc" name="malloc">,
2122 <ref id="realloc" name="realloc">
2128 <sect1>get_ostype<label id="get_ostype"><p>
2132 <tag/Function/The function returns the operating system, the program runs on.
2133 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
2134 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
2135 <tag/Declaration/<tt/unsigned char get_ostype (void);/
2136 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
2137 all supported targets. If it exists, it returns a number that identifies the
2138 operating system or machine type, the program runs on. The machine dependent
2139 header files define constants that can be used to check the return code.
2140 <tag/Limits/<itemize>
2141 <item>The function does not exist on all platforms.
2142 <item>The return codes are platform dependent.
2144 <tag/Availability/cc65 (not all platforms)
2150 <sect1>getenv<label id="getenv"><p>
2154 <tag/Function/Return a value from the environment.
2155 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2156 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
2157 <tag/Description/The function searches the environment for an entry that
2158 matches <tt/name/ and returns its value. The environment consists of a list
2159 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
2161 <tag/Limits/<itemize>
2162 <item>What exactly is stored in the environment depends on the machine the
2163 program is running on.
2164 <item>The function is only available as fastcall function, so it may only
2165 be used in presence of a prototype.
2167 <tag/Availability/ISO 9899
2173 <sect1>getcpu<label id="getcpu"><p>
2177 <tag/Function/Determine on which CPU the program is running.
2178 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
2179 <tag/Declaration/<tt/unsigned char getcpu (void);/
2180 <tag/Description/The function checks on which CPU the code is running. It
2181 returns one of the constants<itemize>
2183 <item><tt/CPU_65C02/
2184 <item><tt/CPU_65816/
2186 <tag/Limits/<itemize>
2187 <item>Other, more exotic CPU types are not disinguished.
2189 <tag/Availability/cc65
2195 <sect1>gotox<label id="gotox"><p>
2199 <tag/Function/Move the text mode cursor to a new X position.
2200 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2201 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
2202 <tag/Description/The function moves the text mode cursor to the specified X
2203 position while leaving the Y position untouched. The leftmost position on the
2204 screen has the coordinate 0.
2205 <tag/Limits/<itemize>
2206 <item>The function is only available as fastcall function, so it may
2207 only be used in presence of a prototype.
2208 <item>Invalid values for the X position (out of screen coordinates) may
2209 lead to undefined behaviour.
2211 <tag/Availability/cc65
2213 <ref id="gotoy" name="gotoy">,
2214 <ref id="gotoxy" name="gotoxy">,
2215 <ref id="wherex" name="wherex">,
2216 <ref id="wherey" name="wherey">
2222 <sect1>gotoxy<label id="gotoxy"><p>
2226 <tag/Function/Move the text mode cursor to a new position.
2227 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2228 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
2229 <tag/Description/The function moves the text mode cursor to the specified
2230 position. The leftmost position on the screen has the X coordinate 0, the
2231 topmost line has the Y coordinate 0.
2232 <tag/Limits/<itemize>
2233 <item>The function is only available as fastcall function, so it may only be
2234 used in presence of a prototype.
2235 <item>Invalid values for any of both coordinates (out of screen positions) may
2236 lead to undefined behaviour.
2238 <tag/Availability/cc65
2240 <ref id="gotox" name="gotox">,
2241 <ref id="gotoy" name="gotoy">,
2242 <ref id="wherex" name="wherex">,
2243 <ref id="wherey" name="wherey">
2249 <sect1>gotoy<label id="gotoy"><p>
2253 <tag/Function/Move the text mode cursor to a new Y position.
2254 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2255 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
2256 <tag/Description/The function moves the text mode cursor to the specified Y
2257 position while leaving the X position untouched. The uppermost position on the
2258 screen has the coordinate 0.
2259 <tag/Limits/<itemize>
2260 <item>The function is only available as fastcall function, so it may
2261 only be used in presence of a prototype.
2262 <item>Invalid values for the Y position (out of screen coordinates) may lead
2263 to undefined behaviour.
2265 <tag/Availability/cc65
2267 <ref id="gotox" name="gotox">,
2268 <ref id="gotoxy" name="gotoxy">,
2269 <ref id="wherex" name="wherex">,
2270 <ref id="wherey" name="wherey">
2276 <sect1>isalnum<label id="isalnum"><p>
2280 <tag/Function/Check if a given character is a letter or digit.
2281 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2282 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
2283 <tag/Description/The function returns a value of zero if the given argument
2284 is a letter or digit. The return value is non zero if the character
2286 <tag/Limits/<itemize>
2287 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2288 inline sequence generated by the macro will not work correctly for values
2289 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2290 this range. The non inline function may be accessed by <tt/#undef/'ing
2292 <item>When compiling without <tt/-Os/, the function is only available as
2293 fastcall function, so it may only be used in presence of a prototype.
2295 <tag/Availability/ISO 9899
2297 <ref id="isalpha" name="isalpha">,
2298 <ref id="isascii" name="isascii">,
2299 <ref id="isblank" name="isblank">,
2300 <ref id="iscntrl" name="iscntrl">,
2301 <ref id="isdigit" name="isdigit">,
2302 <ref id="isgraph" name="isgraph">,
2303 <ref id="islower" name="islower">,
2304 <ref id="isprint" name="isprint">,
2305 <ref id="ispunct" name="ispunct">,
2306 <ref id="isspace" name="isspace">,
2307 <ref id="isupper" name="isupper">,
2308 <ref id="isxdigit" name="isxdigit">
2314 <sect1>isalpha<label id="isalpha"><p>
2318 <tag/Function/Check if a given character is a letter.
2319 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2320 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
2321 <tag/Description/The function returns a value of zero if the given argument
2322 is a letter. The return value is non zero if the character is anything else.
2323 <tag/Limits/<itemize>
2324 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2325 inline sequence generated by the macro will not work correctly for values
2326 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2327 this range. The non inline function may be accessed by <tt/#undef/'ing the
2329 <item>When compiling without <tt/-Os/, the function is only available as
2330 fastcall function, so it may only be used in presence of a prototype.
2332 <tag/Availability/ISO 9899
2334 <ref id="isalnum" name="isalnum">,
2335 <ref id="isascii" name="isascii">,
2336 <ref id="isblank" name="isblank">,
2337 <ref id="iscntrl" name="iscntrl">,
2338 <ref id="isdigit" name="isdigit">,
2339 <ref id="isgraph" name="isgraph">,
2340 <ref id="islower" name="islower">,
2341 <ref id="isprint" name="isprint">,
2342 <ref id="ispunct" name="ispunct">,
2343 <ref id="isspace" name="isspace">,
2344 <ref id="isupper" name="isupper">,
2345 <ref id="isxdigit" name="isxdigit">
2351 <sect1>isascii<label id="isascii"><p>
2355 <tag/Function/Check if a given character is in the ASCII (0..127) range.
2356 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2357 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
2358 <tag/Description/The function returns a value of zero if the given argument
2359 is in the range 0..127 (the range of valid ASCII characters) and a non zero
2361 <tag/Limits/<itemize>
2362 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2363 inline sequence generated by the macro will not work correctly for values
2364 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2365 this range. The non inline function may be accessed by <tt/#undef/'ing the
2367 <item>When compiling without <tt/-Os/, the function is only available as
2368 fastcall function, so it may only be used in presence of a prototype.
2370 <tag/Availability/ISO 9899
2372 <ref id="isalnum" name="isalnum">,
2373 <ref id="isalpha" name="isalpha">,
2374 <ref id="isblank" name="isblank">,
2375 <ref id="iscntrl" name="iscntrl">,
2376 <ref id="isdigit" name="isdigit">,
2377 <ref id="isgraph" name="isgraph">,
2378 <ref id="islower" name="islower">,
2379 <ref id="isprint" name="isprint">,
2380 <ref id="ispunct" name="ispunct">,
2381 <ref id="isspace" name="isspace">,
2382 <ref id="isupper" name="isupper">,
2383 <ref id="isxdigit" name="isxdigit">
2389 <sect1>isblank<label id="isblank"><p>
2393 <tag/Function/Check if a given character is a space or tab.
2394 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2395 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
2396 <tag/Description/The function returns a value of zero if the given argument
2397 is a space or tab character. The return value is non zero if the character
2399 <tag/Limits/<itemize>
2400 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2401 inline sequence generated by the macro will not work correctly for values
2402 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2403 this range. The non inline function may be accessed by <tt/#undef/'ing the
2405 <item>When compiling without <tt/-Os/, the function is only available as
2406 fastcall function, so it may only be used in presence of a prototype.
2408 <tag/Availability/cc65
2410 <ref id="isalnum" name="isalnum">,
2411 <ref id="isalpha" name="isalpha">,
2412 <ref id="isascii" name="isascii">,
2413 <ref id="iscntrl" name="iscntrl">,
2414 <ref id="isdigit" name="isdigit">,
2415 <ref id="isgraph" name="isgraph">,
2416 <ref id="islower" name="islower">,
2417 <ref id="isprint" name="isprint">,
2418 <ref id="ispunct" name="ispunct">,
2419 <ref id="isspace" name="isspace">,
2420 <ref id="isupper" name="isupper">,
2421 <ref id="isxdigit" name="isxdigit">
2427 <sect1>iscntrl<label id="iscntrl"><p>
2431 <tag/Function/Check if a given character is a control character.
2432 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2433 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
2434 <tag/Description/The function returns a value of zero if the given argument
2435 is a control character. The return value is non zero if the character
2437 <tag/Limits/<itemize>
2438 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2439 inline sequence generated by the macro will not work correctly for values
2440 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2441 this range. The non inline function may be accessed by <tt/#undef/'ing the
2443 <item>When compiling without <tt/-Os/, the function is only available as
2444 fastcall function, so it may only be used in presence of a prototype.
2446 <tag/Availability/ISO 9899
2448 <ref id="isalnum" name="isalnum">,
2449 <ref id="isalpha" name="isalpha">,
2450 <ref id="isascii" name="isascii">,
2451 <ref id="isblank" name="isblank">,
2452 <ref id="isdigit" name="isdigit">,
2453 <ref id="isgraph" name="isgraph">,
2454 <ref id="islower" name="islower">,
2455 <ref id="isprint" name="isprint">,
2456 <ref id="ispunct" name="ispunct">,
2457 <ref id="isspace" name="isspace">,
2458 <ref id="isupper" name="isupper">,
2459 <ref id="isxdigit" name="isxdigit">
2465 <sect1>isdigit<label id="isdigit"><p>
2469 <tag/Function/Check if a given character is a digit.
2470 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2471 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
2472 <tag/Description/The function returns a value of zero if the given argument
2473 is a digit. The return value is non zero if the character is anything else.
2474 <tag/Limits/<itemize>
2475 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2476 inline sequence generated by the macro will not work correctly for values
2477 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2478 this range. The non inline function may be accessed by <tt/#undef/'ing the
2480 <item>When compiling without <tt/-Os/, the function is only available as
2481 fastcall function, so it may only be used in presence of a prototype.
2483 <tag/Availability/ISO 9899
2485 <ref id="isalnum" name="isalnum">,
2486 <ref id="isalpha" name="isalpha">,
2487 <ref id="isascii" name="isascii">,
2488 <ref id="isblank" name="isblank">,
2489 <ref id="iscntrl" name="iscntrl">,
2490 <ref id="isgraph" name="isgraph">,
2491 <ref id="islower" name="islower">,
2492 <ref id="isprint" name="isprint">,
2493 <ref id="ispunct" name="ispunct">,
2494 <ref id="isspace" name="isspace">,
2495 <ref id="isupper" name="isupper">,
2496 <ref id="isxdigit" name="isxdigit">
2502 <sect1>isgraph<label id="isgraph"><p>
2506 <tag/Function/Check if a given character is a printable character (except
2508 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2509 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
2510 <tag/Description/The function returns a value of zero if the given argument
2511 is a printable character with the exception of space. The return value is non
2512 zero if the character is anything else.
2513 <tag/Limits/<itemize>
2514 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2515 inline sequence generated by the macro will not work correctly for values
2516 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2517 this range. The non inline function may be accessed by <tt/#undef/'ing the
2519 <item>When compiling without <tt/-Os/, the function is only available as
2520 fastcall function, so it may only be used in presence of a prototype.
2522 <tag/Availability/ISO 9899
2524 <ref id="isalnum" name="isalnum">,
2525 <ref id="isalpha" name="isalpha">,
2526 <ref id="isascii" name="isascii">,
2527 <ref id="isblank" name="isblank">,
2528 <ref id="iscntrl" name="iscntrl">,
2529 <ref id="isdigit" name="isdigit">,
2530 <ref id="islower" name="islower">,
2531 <ref id="isprint" name="isprint">,
2532 <ref id="ispunct" name="ispunct">,
2533 <ref id="isspace" name="isspace">,
2534 <ref id="isupper" name="isupper">,
2535 <ref id="isxdigit" name="isxdigit">
2541 <sect1>islower<label id="islower"><p>
2545 <tag/Function/Check if a given character is a lower case letter.
2546 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2547 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
2548 <tag/Description/The function returns a value of zero if the given argument
2549 is a lower case letter. The return value is non zero if the character is
2551 <tag/Limits/<itemize>
2552 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2553 inline sequence generated by the macro will not work correctly for values
2554 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2555 this range. The non inline function may be accessed by <tt/#undef/'ing the
2557 <item>When compiling without <tt/-Os/, the function is only available as
2558 fastcall function, so it may only be used in presence of a prototype.
2560 <tag/Availability/ISO 9899
2562 <ref id="isalnum" name="isalnum">,
2563 <ref id="isalpha" name="isalpha">,
2564 <ref id="isascii" name="isascii">,
2565 <ref id="isblank" name="isblank">,
2566 <ref id="iscntrl" name="iscntrl">,
2567 <ref id="isdigit" name="isdigit">,
2568 <ref id="isgraph" name="isgraph">,
2569 <ref id="isprint" name="isprint">,
2570 <ref id="ispunct" name="ispunct">,
2571 <ref id="isspace" name="isspace">,
2572 <ref id="isupper" name="isupper">,
2573 <ref id="isxdigit" name="isxdigit">
2579 <sect1>isprint<label id="isprint"><p>
2583 <tag/Function/Check if a given character is a printable character.
2584 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2585 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
2586 <tag/Description/The function returns a value of zero if the given argument
2587 is a printable character (this includes the space character). The return value
2588 is non zero if the character is anything else.
2589 <tag/Limits/<itemize>
2590 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2591 inline sequence generated by the macro will not work correctly for values
2592 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2593 this range. The non inline function may be accessed by <tt/#undef/'ing the
2595 <item>When compiling without <tt/-Os/, the function is only available as
2596 fastcall function, so it may only be used in presence of a prototype.
2598 <tag/Availability/ISO 9899
2600 <ref id="isalnum" name="isalnum">,
2601 <ref id="isalpha" name="isalpha">,
2602 <ref id="isascii" name="isascii">,
2603 <ref id="isblank" name="isblank">,
2604 <ref id="iscntrl" name="iscntrl">,
2605 <ref id="isdigit" name="isdigit">,
2606 <ref id="isgraph" name="isgraph">,
2607 <ref id="islower" name="islower">,
2608 <ref id="ispunct" name="ispunct">,
2609 <ref id="isspace" name="isspace">,
2610 <ref id="isupper" name="isupper">,
2611 <ref id="isxdigit" name="isxdigit">
2617 <sect1>ispunct<label id="ispunct"><p>
2621 <tag/Function/Check if a given character is a printable character but not a
2622 space or an alphanumeric character.
2623 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2624 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
2625 <tag/Description/The function returns a value of zero if the given argument
2626 is a printable character, but not a space or anything alphanumeric. The return
2627 value is non zero if the character is anything else.
2628 <tag/Limits/<itemize>
2629 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2630 inline sequence generated by the macro will not work correctly for values
2631 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2632 this range. The non inline function may be accessed by <tt/#undef/'ing the
2634 <item>When compiling without <tt/-Os/, the function is only available as
2635 fastcall function, so it may only be used in presence of a prototype.
2637 <tag/Availability/ISO 9899
2639 <ref id="isalnum" name="isalnum">,
2640 <ref id="isalpha" name="isalpha">,
2641 <ref id="isascii" name="isascii">,
2642 <ref id="isblank" name="isblank">,
2643 <ref id="iscntrl" name="iscntrl">,
2644 <ref id="isdigit" name="isdigit">,
2645 <ref id="isgraph" name="isgraph">,
2646 <ref id="islower" name="islower">,
2647 <ref id="isprint" name="isprint">,
2648 <ref id="isspace" name="isspace">,
2649 <ref id="isupper" name="isupper">,
2650 <ref id="isxdigit" name="isxdigit">
2656 <sect1>isspace<label id="isspace"><p>
2660 <tag/Function/Check if a given character is a a white-space character.
2661 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2662 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
2663 <tag/Description/The function returns a value of zero if the given argument
2664 is a white space character. The return value is non zero if the character is
2665 anything else. The standard white space characters are: space, formfeed ('\f'),
2666 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
2668 <tag/Limits/<itemize>
2669 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2670 inline sequence generated by the macro will not work correctly for values
2671 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2672 this range. The non inline function may be accessed by <tt/#undef/'ing the
2674 <item>When compiling without <tt/-Os/, the function is only available as
2675 fastcall function, so it may only be used in presence of a prototype.
2677 <tag/Availability/ISO 9899
2679 <ref id="isalnum" name="isalnum">,
2680 <ref id="isalpha" name="isalpha">,
2681 <ref id="isascii" name="isascii">,
2682 <ref id="isblank" name="isblank">,
2683 <ref id="iscntrl" name="iscntrl">,
2684 <ref id="isdigit" name="isdigit">,
2685 <ref id="isgraph" name="isgraph">,
2686 <ref id="islower" name="islower">,
2687 <ref id="isprint" name="isprint">,
2688 <ref id="ispunct" name="ispunct">,
2689 <ref id="isupper" name="isupper">,
2690 <ref id="isxdigit" name="isxdigit">
2696 <sect1>isupper<label id="isupper"><p>
2700 <tag/Function/Check if a given character is an upper case letter.
2701 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2702 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
2703 <tag/Description/The function returns a value of zero if the given argument
2704 is an upper case letter. The return value is non zero if the character is
2706 <tag/Limits/<itemize>
2707 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2708 inline sequence generated by the macro will not work correctly for values
2709 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2710 this range. The non inline function may be accessed by <tt/#undef/'ing the
2712 <item>When compiling without <tt/-Os/, the function is only available as
2713 fastcall function, so it may only be used in presence of a prototype.
2715 <tag/Availability/ISO 9899
2717 <ref id="isalnum" name="isalnum">,
2718 <ref id="isalpha" name="isalpha">,
2719 <ref id="isascii" name="isascii">,
2720 <ref id="isblank" name="isblank">,
2721 <ref id="iscntrl" name="iscntrl">,
2722 <ref id="isdigit" name="isdigit">,
2723 <ref id="isgraph" name="isgraph">,
2724 <ref id="islower" name="islower">,
2725 <ref id="isprint" name="isprint">,
2726 <ref id="ispunct" name="ispunct">,
2727 <ref id="isspace" name="isspace">,
2728 <ref id="isxdigit" name="isxdigit">
2734 <sect1>isxdigit<label id="isxdigit"><p>
2738 <tag/Function/Check if a given character is a hexadecimal digit.
2739 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2740 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
2741 <tag/Description/The function returns a value of zero if the given argument
2742 is a hexadecimal digit (0..9, a..f and A..F). The return value is non zero
2743 if the character is anything else.
2744 <tag/Limits/<itemize>
2745 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2746 inline sequence generated by the macro will not work correctly for values
2747 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2748 this range. The non inline function may be accessed by <tt/#undef/'ing the
2750 <item>When compiling without <tt/-Os/, the function is only available as
2751 fastcall function, so it may only be used in presence of a prototype.
2753 <tag/Availability/ISO 9899
2755 <ref id="isalnum" name="isalnum">,
2756 <ref id="isalpha" name="isalpha">,
2757 <ref id="isascii" name="isascii">,
2758 <ref id="isblank" name="isblank">,
2759 <ref id="iscntrl" name="iscntrl">,
2760 <ref id="isdigit" name="isdigit">,
2761 <ref id="isgraph" name="isgraph">,
2762 <ref id="islower" name="islower">,
2763 <ref id="isprint" name="isprint">,
2764 <ref id="ispunct" name="ispunct">,
2765 <ref id="isspace" name="isspace">,
2766 <ref id="isupper" name="isupper">
2772 <sect1>itoa<label id="itoa"><p>
2776 <tag/Function/Convert an integer into a string.
2777 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2778 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
2779 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
2780 <tt/radix/ as the base.
2781 <tag/Limits/<itemize>
2782 <item>There are no provisions to prevent a buffer overflow.
2783 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
2784 <item>The function is non standard, so it is not available in strict ANSI mode.
2785 You should probably use <tt/sprintf/ instead.
2786 <item>The function is only available as fastcall function, so it may only be
2787 used in presence of a prototype.
2789 <tag/Availability/cc65
2791 <ref id="atoi" name="atoi">,
2792 <ref id="atol" name="atol">,
2793 <ref id="ltoa" name="ltoa">,
2794 <ref id="ultoa" name="ultoa">,
2795 <ref id="utoa" name="utoa">
2801 <sect1>joy_count<label id="joy_count"><p>
2805 <tag/Function/Return the number of joysticks supported by the current driver.
2806 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2807 <tag/Declaration/<tt/unsigned char __fastcall__ joy_count (void);/
2808 <tag/Description/The function returns a the number of joysticks supported
2809 by the current joystick driver.
2810 <tag/Limits/<itemize>
2811 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
2812 name="joy_load_driver"> before calling this function.
2813 <item>The function returns the number of joysticks supported by the driver.
2814 There's no way to check for the number of actually connected joysticks.
2815 <item>The function is only available as fastcall function, so it may only be
2816 used in presence of a prototype.
2818 <tag/Availability/cc65
2820 <ref id="joy_load_driver" name="joy_load_driver">,
2821 <ref id="joy_read" name="joy_read">
2827 <sect1>joy_install<label id="joy_install"><p>
2831 <tag/Function/Install an already loaded driver and return an error code.
2832 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2833 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
2834 <tag/Description/The function installs a driver that was already loaded into
2835 memory (or linked statically to the program). It returns an error code
2836 (<tt/JOY_ERR_OK/ in case of success).
2837 <tag/Limits/<itemize>
2838 <item>The function is only available as fastcall function, so it may only be
2839 used in presence of a prototype.
2841 <tag/Availability/cc65
2843 <ref id="joy_load_driver" name="joy_load_driver">,
2844 <ref id="joy_uninstall" name="joy_uninstall">,
2845 <ref id="joy_unload" name="joy_unload">
2851 <sect1>joy_load_driver<label id="joy_load_driver"><p>
2855 <tag/Function/Load a driver from disk and install it.
2856 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2857 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
2858 <tag/Description/The function loads a driver with the given name from disk
2859 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
2860 driver was successfully loaded and installed.
2861 <tag/Limits/<itemize>
2862 <item>The function is only available as fastcall function, so it may only be
2863 used in presence of a prototype.
2865 <tag/Availability/cc65
2867 <ref id="joy_install" name="joy_install">,
2868 <ref id="joy_uninstall" name="joy_uninstall">,
2869 <ref id="joy_unload" name="joy_unload">
2875 <sect1>joy_read<label id="joy_read"><p>
2879 <tag/Function/Read the status of a joystick.
2880 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2881 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
2882 <tag/Description/The function reads the status bits for a joystick. The number
2883 of the joystick is passed as parameter. The result may be examined by using one
2884 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
2885 <tag/Limits/<itemize>
2886 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
2887 name="joy_load_driver"> before calling this function.
2888 <item>The function is only available as fastcall function, so it may only be
2889 used in presence of a prototype.
2891 <tag/Availability/cc65
2893 <ref id="joy_count" name="joy_count">,
2894 <ref id="joy_load_driver" name="joy_load_driver">,
2895 <ref id="joy_unload" name="joy_unload">
2901 <sect1>joy_uninstall<label id="joy_uninstall"><p>
2905 <tag/Function/Uninstall the current joystick driver.
2906 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2907 <tag/Declaration/<tt/unsigned char __fastcall__ joy_uninstall (void);/
2908 <tag/Description/The function uninstalls the currently installed joystick
2909 driver. It does not remove the driver from memory. The function returns an
2910 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
2911 <tag/Limits/<itemize>
2912 <item>A joystick driver must be installed using <ref id="joy_install"
2913 name="joy_install"> before calling this function.
2914 <item>The function is only available as fastcall function, so it may only be
2915 used in presence of a prototype.
2917 <tag/Availability/cc65
2919 <ref id="joy_install" name="joy_install">,
2920 <ref id="joy_load_driver" name="joy_load_driver">,
2921 <ref id="joy_unload" name="joy_unload">
2927 <sect1>joy_unload<label id="joy_unload"><p>
2931 <tag/Function/Uninstall, then unload the current joystick driver.
2932 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2933 <tag/Declaration/<tt/unsigned char __fastcall__ joy_unload (void);/
2934 <tag/Description/The function uninstalls the currently installed joystick
2935 driver and removes it from memory. An error code is returned, which is
2936 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
2937 <tag/Limits/<itemize>
2938 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
2939 name="joy_load_driver"> before calling this function.
2940 <item>The function is only available as fastcall function, so it may only be
2941 used in presence of a prototype.
2943 <tag/Availability/cc65
2945 <ref id="joy_load_driver" name="joy_load_driver">
2951 <sect1>kbhit<label id="kbhit"><p>
2955 <tag/Function/Check if there's a key waiting in the keyboard buffer.
2956 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2957 <tag/Declaration/<tt/unsigned char kbhit (void);/
2958 <tag/Description/The function returns a value of zero if there is no character
2959 waiting to be read from the keyboard. It returns non zero otherwise.
2960 <tag/Limits/<itemize>
2961 <item>If the system does not support a keyboard buffer (most systems
2962 do), the function is rather useless.
2964 <tag/Availability/cc65
2966 <ref id="cgetc" name="cgetc">,
2967 <ref id="cursor" name="cursor">
2973 <sect1>labs<label id="labs"><p>
2977 <tag/Function/Returns the absolute value of a long integer.
2978 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2979 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
2980 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
2982 <tag/Limits/<itemize>
2983 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
2984 <item>The function is only available as fastcall function, so it may only be
2985 used in presence of a prototype.
2987 <tag/Availability/ISO 9899
2989 <ref id="abs" name="abs">
2995 <sect1>ltoa<label id="ltoa"><p>
2999 <tag/Function/Convert a long integer into a string.
3000 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3001 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
3002 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
3003 using <tt/radix/ as the base.
3004 <tag/Limits/<itemize>
3005 <item>There are no provisions to prevent a buffer overflow.
3006 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
3007 <item>The function is non standard, so it is not available in strict ANSI mode.
3008 You should probably use <tt/sprintf/ instead.
3009 <item>The function is only available as fastcall function, so it may only be
3010 used in presence of a prototype.
3012 <tag/Availability/cc65
3014 <ref id="atoi" name="atoi">,
3015 <ref id="atol" name="atol">,
3016 <ref id="itoa" name="itoa">,
3017 <ref id="ultoa" name="ultoa">,
3018 <ref id="utoa" name="utoa">
3024 <sect1>localeconv<label id="localeconv"><p>
3028 <tag/Function/Returns a pointer to the current locale structure.
3029 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
3030 <tag/Declaration/<tt/struct lconv* localeconv (void);/
3031 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
3033 <tag/Limits/<itemize>
3034 <item>cc65 supports only the "C" locale, so even after setting a new locale
3035 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
3038 <tag/Availability/ISO 9899
3040 <ref id="setlocale" name="setlocale">
3046 <sect1>longjmp<label id="longjmp"><p>
3050 <tag/Function/Non local goto.
3051 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
3052 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
3053 <tag/Description/The <tt/longjmp/ function restores a program context from the
3054 data in <tt/buf/, which must have been set by a preceeding call to
3055 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
3056 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
3060 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
3061 was called with a value of one.
3062 <item>The function is only available as fastcall function, so it may only
3063 be used in presence of a prototype.
3065 <tag/Availability/ISO 9899
3067 <ref id="setjmp" name="setjmp">
3073 <sect1>malloc<label id="malloc"><p>
3077 <tag/Function/Allocate dynamic memory.
3078 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3079 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
3080 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
3081 pointer to the allocated memory block. On error (not enough memory available),
3082 <tt/malloc/ returns <tt/NULL/.
3085 <item>The function is only available as fastcall function, so it may only
3086 be used in presence of a prototype.
3088 <tag/Availability/ISO 9899
3090 <ref id="_heapadd" name="_heapadd">,
3091 <ref id="_heapblocksize" name="_heapblocksize">,
3092 <ref id="_heapmaxavail" name="_heapmaxavail">,
3093 <ref id="_heapmemavail" name="_heapmemavail">,
3094 <ref id="calloc" name="calloc">,
3095 <ref id="free" name="free">,
3096 <ref id="realloc" name="realloc">,
3097 <ref id="strdup" name="strdup">
3103 <sect1>memchr<label id="memchr"><p>
3107 <tag/Function/Search for a character in a block of raw memory.
3108 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3109 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
3110 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
3111 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
3112 that is of size <tt/count/. Upon completion, the function returns a pointer to
3113 the character found, or a null pointer if the character was not found.
3114 <tag/Limits/<itemize>
3115 <item>The function is only available as fastcall function, so it may only
3116 be used in presence of a prototype.
3118 <tag/Availability/ISO 9899
3120 <ref id="strchr" name="strchr">
3126 <sect1>memcpy<label id="memcpy"><p>
3130 <tag/Function/Copy a memory area.
3131 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3132 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
3133 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
3134 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
3138 <item>The result is undefined if the memory areas do overlap. Use
3139 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
3140 <item>The function is only available as fastcall function, so it may only
3141 be used in presence of a prototype.
3143 <tag/Availability/ISO 9899
3145 <ref id="_swap" name="_swap">,
3146 <ref id="memmove" name="memmove">,
3147 <ref id="memset" name="memset">
3153 <sect1>memmove<label id="memmove"><p>
3157 <tag/Function/Copy a memory area.
3158 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3159 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
3160 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
3161 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
3165 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
3166 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
3167 <item>The function is only available as fastcall function, so it may only
3168 be used in presence of a prototype.
3170 <tag/Availability/ISO 9899
3172 <ref id="_swap" name="_swap">,
3173 <ref id="memcpy" name="memcpy">,
3174 <ref id="memset" name="memset">
3180 <sect1>memset<label id="memset"><p>
3184 <tag/Function/Fill a memory area.
3185 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3186 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
3187 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
3188 the value <tt/val/. The function returns <tt/p/.
3191 <item>The function is only available as fastcall function, so it may only
3192 be used in presence of a prototype.
3194 <tag/Availability/ISO 9899
3196 <ref id="_swap" name="_swap">,
3197 <ref id="bzero" name="bzero">,
3198 <ref id="memcpy" name="memcpy">,
3199 <ref id="memmove" name="memmove">
3205 <sect1>mod_free<label id="mod_free"><p>
3209 <tag/Function/Free a relocatable module.
3210 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
3211 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
3212 <tag/Description/The function will free a module loaded into memory by use of
3213 the <tt/<ref id="mod_load" name="mod_load">/ function.
3214 <tag/Limits/<itemize>
3215 <item>The pointer passed as parameter is the pointer to the module memory,
3216 not the pointer to the control structure.
3218 <tag/Availability/cc65
3220 <ref id="mod_load" name="mod_load">
3226 <sect1>mod_load<label id="mod_load"><p>
3230 <tag/Function/Load a relocatable module.
3231 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
3232 <tag/Declaration/<tt/unsigned char mod_load (struct mod_ctrl* ctrl);/
3233 <tag/Description/The function will load a code module into memory and relocate
3234 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
3235 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
3236 the module just loaded. Possible error codes are:
3238 <item><tt/MLOAD_OK/ - Module load successful
3239 <item><tt/MLOAD_ERR_READ/ - Read error
3240 <item><tt/MLOAD_ERR_HDR/ - Header error
3241 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
3242 <item><tt/MLOAD_ERR_FMT/ - Data format error
3243 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
3245 <tag/Limits/<itemize>
3246 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
3247 relocatable o65 modules for use with this function.
3249 <tag/Availability/cc65
3251 <ref id="mod_free" name="mod_free">
3257 <sect1>mouse_setbox<label id="mouse_setbox"><p>
3261 <tag/Function/Specify a bounding box for the mouse cursor.
3262 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3263 <tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
3264 <tag/Description/The function allows to set a bounding box for mouse movement.
3265 <tag/Limits/<itemize>
3266 <item>The function does not check if the mouse cursor is currently within the
3267 given rectangle. Placing the mouse cursor within the bounding box is the
3268 responsibility of the programmer.
3269 <item>While the bounding box may be larger than the actual screen size, the
3270 standard mouse cursor draw routines may fail to set the cursor to coordinates
3271 outside of the screen area. Depending on the platform, you may have to supply
3272 your own mouse cursor routines.
3273 <item>The function is only available as fastcall function, so it may only be
3274 used in presence of a prototype.
3276 <tag/Availability/cc65
3278 <ref id="mouse_getbox" name="mouse_getbox">,
3279 <ref id="mouse_move" name="mouse_move">
3285 <sect1>mouse_getbox<label id="mouse_getbox"><p>
3289 <tag/Function/Return the current bounding box for the mouse cursor.
3290 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3291 <tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
3292 <tag/Description/The function queries the current bounding box for mouse
3294 <tag/Limits/<itemize>
3295 <item>The function is only available as fastcall function, so it may only be
3296 used in presence of a prototype.
3298 <tag/Availability/cc65
3300 <ref id="mouse_move" name="mouse_move">,
3301 <ref id="mouse_setbox" name="mouse_setbox">
3307 <sect1>mouse_buttons<label id="mouse_buttons"><p>
3311 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
3312 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3313 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_buttons (void);/
3314 <tag/Description/The function returns a bit mask that encodes the state of the
3315 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
3317 <tag/Limits/<itemize>
3318 <item>The function is only available as fastcall function, so it may only be
3319 used in presence of a prototype.
3321 <tag/Availability/cc65
3323 <ref id="mouse_info" name="mouse_info">,
3324 <ref id="mouse_pos" name="mouse_pos">
3330 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
3334 <tag/Function/Return a readable error message for an error code.
3335 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3336 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
3338 <tag/Description/The function returns an error message (in english) for the
3339 error code passed parameter.
3340 <tag/Limits/<itemize>
3341 <item>The function will return "Unknown error" for invalid error codes.
3342 <item>The function is only available as fastcall function, so it may only be
3343 used in presence of a prototype.
3345 <tag/Availability/cc65
3347 <ref id="mouse_load_driver" name="mouse_load_driver">,
3348 <ref id="mouse_uninstall" name="mouse_uninstall">,
3349 <ref id="mouse_unload" name="mouse_unload">
3355 <sect1>mouse_hide<label id="mouse_hide"><p>
3359 <tag/Function/Hide the mouse pointer.
3360 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3361 <tag/Declaration/<tt/void __fastcall__ mouse_hide (void);/
3362 <tag/Description/The function hides the mouse pointer. It manages a counter
3363 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
3364 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
3365 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
3367 <tag/Limits/<itemize>
3368 <item>The function is only available as fastcall function, so it may only be
3369 used in presence of a prototype.
3371 <tag/Availability/cc65
3373 <ref id="mouse_show" name="mouse_show">
3379 <sect1>mouse_info<label id="mouse_info"><p>
3383 <tag/Function/Return the state of the mouse buttons and the position of the
3385 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3386 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
3387 <tag/Description/The function returns the state of the mouse buttons and the
3388 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
3389 <tag/Limits/<itemize>
3390 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
3391 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
3392 name="mouse_pos">/ instead.
3393 <item>The function is only available as fastcall function, so it may only be
3394 used in presence of a prototype.
3396 <tag/Availability/cc65
3398 <ref id="mouse_buttons" name="mouse_buttons">,
3399 <ref id="mouse_pos" name="mouse_pos">
3405 <sect1>mouse_install<label id="mouse_install"><p>
3409 <tag/Function/Install an already loaded mouse driver.
3410 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3411 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
3412 mouse_callbacks* c, void* driver);/
3413 <tag/Description/The function installs an already loaded mouse driver and
3414 returns an error code. The <tt/mouse_callbacks/ structure passed as first
3415 parameter contains pointers to routines needed to move or hide/show the mouse
3416 pointer. Defaults for these routines are supplied by the library, so if you
3417 can live with these defaults (which are platform specific), just pass a
3418 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
3419 driver linked statically to the program.
3420 <tag/Limits/<itemize>
3421 <item>Not all drivers are able to detect if the supported hardware is really
3423 <item>After installing a driver, the mouse cursor is hidden.
3424 <item>The function is only available as fastcall function, so it may only be
3425 used in presence of a prototype.
3427 <tag/Availability/cc65
3429 <ref id="mouse_load_driver" name="mouse_load_driver">,
3430 <ref id="mouse_uninstall" name="mouse_uninstall">,
3431 <ref id="mouse_unload" name="mouse_unload">
3437 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
3441 <tag/Function/Call the driver specific ioctl function.
3442 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3443 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
3444 <tag/Description/The function calls the IOCTL entry in the mouse driver,
3445 which is driver specific. The <tt/code/ parameter will choose between
3446 different IOCTL functions, and the <tt/data/ depends on code. The
3447 function returns an error code. The purpose of this function is to allow
3448 for driver specific extensions. See the documentation for a specific mouse
3449 driver for supported ioctl calls.
3450 <tag/Limits/<itemize>
3451 <item>Calling this function is non portable, because each driver may
3452 implement different ioctl calls (or none at all).
3453 <item>The function is only available as fastcall function, so it may only be
3454 used in presence of a prototype.
3456 <tag/Availability/cc65
3462 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
3466 <tag/Function/Load and initialize a mouse driver.
3467 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3468 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
3469 mouse_callbacks* c, const char* driver);/
3470 <tag/Description/Load a mouse driver into memory and initialize it. The
3471 function returns an error code that tells if the call has been successful. The
3472 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
3473 routines needed to move or hide/show the mouse pointer. Defaults for these
3474 routines are supplied by the library, so if you can live with these defaults
3475 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
3476 <tag/Limits/<itemize>
3477 <item>The driver is loaded by name, so currently you must know the type of
3478 mouse that should be supported. There is no autodetect capability.
3479 <item>Not all drivers are able to detect if the supported hardware is really
3481 <item>After installing a driver, the mouse cursor is hidden.
3482 <item>The function is only available as fastcall function, so it may only be
3483 used in presence of a prototype.
3485 <tag/Availability/cc65
3487 <ref id="mouse_install" name="mouse_install">,
3488 <ref id="mouse_uninstall" name="mouse_uninstall">,
3489 <ref id="mouse_unload" name="mouse_unload">
3495 <sect1>mouse_move<label id="mouse_move"><p>
3499 <tag/Function/Move the mouse cursor to a specific position.
3500 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3501 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
3502 <tag/Description/The function updates the mouse position. If the mouse cursor
3503 is visible, it is shown at the new position.
3504 <tag/Limits/<itemize>
3505 <item>The function does not check if the new position is within the bounding
3506 box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
3507 <item>The function is only available as fastcall function, so it may only be
3508 used in presence of a prototype.
3510 <tag/Availability/cc65
3512 <ref id="mouse_getbox" name="mouse_getbox">,
3513 <ref id="mouse_setbox" name="mouse_setbox">
3519 <sect1>mouse_pos<label id="mouse_pos"><p>
3523 <tag/Function/Return the position of the mouse.
3524 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3525 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
3526 <tag/Description/The function returns the position of the mouse in the
3527 <tt/mouse_pos/ structure passed as parameter.
3528 <tag/Limits/<itemize>
3529 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
3530 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
3531 name="mouse_info">/ instead.
3532 <item>The function is only available as fastcall function, so it may only be
3533 used in presence of a prototype.
3535 <tag/Availability/cc65
3537 <ref id="mouse_buttons" name="mouse_buttons">,
3538 <ref id="mouse_info" name="mouse_info">
3544 <sect1>mouse_show<label id="mouse_show"><p>
3548 <tag/Function/Show the mouse pointer.
3549 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3550 <tag/Declaration/<tt/void __fastcall__ mouse_show (void);/
3551 <tag/Description/The function shows the mouse pointer. It manages a counter
3552 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
3553 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
3554 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
3555 <tag/Limits/<itemize>
3556 <item>The function is only available as fastcall function, so it may only be
3557 used in presence of a prototype.
3559 <tag/Availability/cc65
3561 <ref id="mouse_hide" name="mouse_hide">
3567 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
3571 <tag/Function/Uninstall an already loaded mouse driver.
3572 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3573 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (void);/
3574 <tag/Description/The function uninstalls an already loaded mouse driver but
3575 don't removes it from memory.
3576 <tag/Limits/<itemize>
3577 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
3578 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
3579 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
3581 <item>The function is only available as fastcall function, so it may only be
3582 used in presence of a prototype.
3584 <tag/Availability/cc65
3586 <ref id="mouse_install" name="mouse_install">,
3587 <ref id="mouse_load_driver" name="mouse_load_driver">,
3588 <ref id="mouse_unload" name="mouse_unload">
3594 <sect1>mouse_unload<label id="mouse_unload"><p>
3598 <tag/Function/Unload a mouse driver.
3599 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3600 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_unload (void);/
3601 <tag/Description/The function unloads a loaded mouse driver and frees all
3602 memory allocated for the driver.
3603 <tag/Limits/<itemize>
3604 <item>The function does nothing if no driver is loaded.
3606 <tag/Availability/cc65
3608 <ref id="mouse_install" name="mouse_install">,
3609 <ref id="mouse_load_driver" name="mouse_load_driver">,
3610 <ref id="mouse_uninstall" name="mouse_uninstall">
3616 <sect1>offsetof<label id="offsetof"><p>
3620 <tag/Function/Calculate the offset of a struct or union member.
3621 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
3622 <tag/Declaration/<tt/size_t offsetof (type, member);/
3623 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
3624 or <tt/union/ member.
3625 <tag/Limits/<itemize>
3626 <item>The function is actually a macro.
3628 <tag/Availability/ISO 9899
3634 <sect1>open<label id="open"><p>
3638 <tag/Function/Open and possibly create a file.
3639 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
3640 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
3641 <tag/Description/<tt/open/ opens a file and returns the file descriptor
3642 associated with it. On error, -1 is returned and an error code is stored in
3643 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
3644 <tag/Limits/<itemize>
3645 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
3646 open, which is used as the permission mask when a new file is created. While
3647 cc65 allows to pass this argument, it is ignored.
3649 <tag/Availability/POSIX 1003.1
3651 <ref id="close" name="close">,
3652 <ref id="creat" name="creat">
3658 <sect1>peekbsys<label id="peekbsys"><p>
3662 <tag/Function/Read one byte from a location in the system bank.
3663 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3664 <tt/<ref id="cbm510.h" name="cbm510.h">/
3665 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
3666 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
3667 system bank (bank 15) of the CBM PET-II machines and returns it.
3670 <item>The function is only available as fastcall function, so it may only
3671 be used in presence of a prototype.
3672 <item>This function may be a macro depending on the compiler options. The
3673 actual function is accessible by #undef'ing the macro.
3675 <tag/Availability/cc65
3677 <ref id="PEEK" name="PEEK">,
3678 <ref id="PEEKW" name="PEEKW">,
3679 <ref id="peekwsys" name="peekwsys">,
3680 <ref id="pokebsys" name="pokebsys">,
3681 <ref id="pokewsys" name="pokewsys">
3687 <sect1>peekwsys<label id="peekwsys"><p>
3691 <tag/Function/Read one word from a location in the system bank.
3692 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3693 <tt/<ref id="cbm510.h" name="cbm510.h">/
3694 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
3695 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
3696 system bank (bank 15) of the CBM PET-II machines and returns it. Following
3697 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
3698 high byte is read from <tt/addr+1/.
3701 <item>The function is only available as fastcall function, so it may only
3702 be used in presence of a prototype.
3703 <item>The order in which the two bytes are read is undefined.
3705 <tag/Availability/cc65
3707 <ref id="PEEK" name="PEEK">,
3708 <ref id="PEEKW" name="PEEKW">,
3709 <ref id="peekbsys" name="peekbsys">,
3710 <ref id="pokebsys" name="pokebsys">,
3711 <ref id="pokewsys" name="pokewsys">
3717 <sect1>perror<label id="perror"><p>
3721 <tag/Function/Print an error message for the error in <tt/errno/.
3722 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3723 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
3724 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
3725 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
3726 a blank. Then the error message for the current contents of <tt/errno/ is
3727 printed followed by a newline. The message output is the same as returned by
3728 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
3731 <item>The function is only available as fastcall function, so it may only
3732 be used in presence of a prototype.
3734 <tag/Availability/ISO 9899
3736 <ref id="_poserror" name="_poserror">,
3737 <ref id="strerror" name="strerror">
3743 <sect1>pokebsys<label id="pokebsys"><p>
3747 <tag/Function/Write one byte to a location in the system bank.
3748 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3749 <tt/<ref id="cbm510.h" name="cbm510.h">/
3750 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
3751 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
3752 system bank (bank 15) of the CBM PET-II machines.
3755 <item>The function is only available as fastcall function, so it may only
3756 be used in presence of a prototype.
3758 <tag/Availability/cc65
3760 <ref id="POKE" name="POKE">,
3761 <ref id="POKEW" name="POKEW">,
3762 <ref id="peekbsys" name="peekbsys">,
3763 <ref id="peekwsys" name="peekwsys">,
3764 <ref id="pokewsys" name="pokewsys">
3770 <sect1>pokewsys<label id="pokewsys"><p>
3774 <tag/Function/Write one word to a location in the system bank.
3775 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3776 <tt/<ref id="cbm510.h" name="cbm510.h">/
3777 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
3778 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
3779 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
3780 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
3781 high byte is written to <tt/addr+1/.
3784 <item>The function is only available as fastcall function, so it may only
3785 be used in presence of a prototype.
3786 <item>The order in which the two bytes are written is undefined.
3788 <tag/Availability/cc65
3790 <ref id="POKE" name="POKE">,
3791 <ref id="POKEW" name="POKEW">,
3792 <ref id="peekbsys" name="peekbsys">,
3793 <ref id="peekwsys" name="peekwsys">,
3794 <ref id="pokebsys" name="pokebsys">
3800 <sect1>qsort<label id="qsort"><p>
3804 <tag/Function/Sort an array.
3805 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3806 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
3807 size_t size, int (*compare) (const void*, const void*));/
3808 <tag/Description/<tt/qsort/ sorts an array according to a given compare
3809 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
3810 is the number of elements, <tt/size/ the size of an element and <tt/compare/
3811 the function used to compare the members.
3814 <item>If there are multiple members with the same key, the order after calling
3815 the function is undefined.
3816 <item>The function is only available as fastcall function, so it may only
3817 be used in presence of a prototype.
3819 <tag/Availability/ISO 9899
3821 <ref id="bsearch" name="bsearch">
3827 <sect1>raise<label id="raise"><p>
3831 <tag/Function/Send a signal to the executing program.
3832 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
3833 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
3834 <tag/Description/<tt/raise/ sends the given signal to the program. If the
3835 program has installed a signal handler for the signal, this signal handler
3836 will be executed. If no handler has been installed, the default action for
3837 the raised signal will be taken. The function returns zero on success,
3839 <tag/Limits/<itemize>
3840 <item>The function is only available as fastcall function, so it may only
3841 be used in presence of a prototype.
3843 <tag/Availability/ISO 9899
3845 <ref id="abort" name="abort">,
3846 <ref id="signal" name="signal">
3852 <sect1>rand<label id="rand"><p>
3856 <tag/Function/Return a pseudo random number.
3857 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3858 <tag/Declaration/<tt/int rand (void);/
3859 <tag/Description/The function returns a pseudo random number
3860 between 0 and <tt/RAND_MAX/ (exclusive).
3861 <tag/Limits/<itemize>
3862 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
3863 flow of numbers is generated.
3864 <item>On startup, the function behaves as if <ref id="srand" name="srand">
3865 had been used with an argument of 1.
3867 <tag/Availability/ISO 9899
3869 <ref id="_randomize" name="_randomize">,
3870 <ref id="srand" name="srand">
3876 <sect1>realloc<label id="realloc"><p>
3880 <tag/Function/Change the size of an allocated memory block.
3881 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3882 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
3883 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
3884 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
3885 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
3886 behaves as if <tt/free/ had been called. On error (not enough memory
3887 available), <tt/realloc/ returns <tt/NULL/.
3890 <item>The part of the memory block that is returned will have its contents
3892 <item>This function is somewhat dangerous to use. Be careful to save the
3893 pointer you're passing somewhere else, otherwise
3895 ptr = realloc (ptr, size);
3897 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
3898 <item>The function is only available as fastcall function, so it may only
3899 be used in presence of a prototype.
3901 <tag/Availability/ISO 9899
3903 <ref id="_heapadd" name="_heapadd">,
3904 <ref id="_heapblocksize" name="_heapblocksize">,
3905 <ref id="_heapmaxavail" name="_heapmaxavail">,
3906 <ref id="_heapmemavail" name="_heapmemavail">,
3907 <ref id="calloc" name="calloc">,
3908 <ref id="free" name="free">,
3909 <ref id="realloc" name="realloc">
3915 <sect1>remove<label id="remove"><p>
3919 <tag/Function/Delete a file.
3920 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3921 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
3922 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
3923 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
3924 code describing the reason for the failure.
3927 <item>This function is not available on all cc65 targets (depends on the
3928 availability of file I/O).
3929 <item>The function is only available as fastcall function, so it may only
3930 be used in presence of a prototype.
3932 <tag/Availability/ISO 9899
3934 <ref id="rename" name="rename">,
3935 <ref id="unlink" name="unlink">
3938 #include <stdio.h>
3940 #define FILENAME "helloworld"
3942 if (remove (FILENAME) == 0) {
3943 printf ("We deleted %s successfully\n", FILENAME);
3945 printf ("There was a problem deleting %s\n", FILENAME);
3952 <sect1>rename<label id="rename"><p>
3956 <tag/Function/Rename a file.
3957 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3958 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
3959 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
3960 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
3961 code describing the reason for the failure.
3964 <item>This function is not available on all cc65 targets (depends on the
3965 capabilities of the storage devices).
3966 <item>The function is only available as fastcall function, so it may only
3967 be used in presence of a prototype.
3969 <tag/Availability/ISO 9899
3971 <ref id="remove" name="remove">
3974 #include <stdio.h>
3976 #define OLDNAME "textfile.txt"
3977 #define NEWNAME "textfile.bak"
3979 if (rename (OLDNAME, NEWNAME) == 0) {
3980 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
3982 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
3989 <sect1>reset_brk<label id="reset_brk"><p>
3993 <tag/Function/Resets the break vector to its original value.
3994 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3995 <tag/Declaration/<tt/void __fastcall__ reset_brk (void);/
3996 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
3997 before a call to <tt/set_brk/.
4000 <item>Since <tt/<ref id="set_brk" name="set_brk">/ installs an exit handler,
4001 it is not strictly necessary to call this function as part of the cleanup when
4004 <tag/Availability/cc65
4006 <ref id="set_brk" name="set_brk">
4012 <sect1>revers<label id="revers"><p>
4016 <tag/Function/Control revers character display.
4017 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4018 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
4019 <tag/Description/If the argument is non zero, the function enables reverse
4020 character display. If the argument is zero, reverse character display is
4021 switched off. The old value of the setting is returned.
4022 <tag/Limits/<itemize>
4023 <item>The function may not be supported by the hardware, in which case
4024 the call is ignored.
4025 <item>The function is only available as fastcall function, so it may only
4026 be used in presence of a prototype.
4028 <tag/Availability/cc65
4030 <ref id="textcolor" name="textcolor">
4036 <sect1>screensize<label id="screensize"><p>
4040 <tag/Function/Return the dimensions of the text mode screen.
4041 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4042 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
4043 <tag/Description/The function returns the dimensions of the text mode screen.
4044 <tag/Limits/<itemize>
4045 <item>The function is only available as fastcall function, so it may only
4046 be used in presence of a prototype.
4048 <tag/Availability/cc65
4050 <ref id="gotox" name="gotox">,
4051 <ref id="gotoxy" name="gotoxy">,
4052 <ref id="gotoy" name="gotoy">,
4053 <ref id="wherex" name="wherex">,
4054 <ref id="wherey" name="wherey">
4060 <sect1>set_brk<label id="set_brk"><p>
4064 <tag/Function/Set the break vector to a user function.
4065 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
4066 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
4067 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
4068 program code by letting the vector point to a user written C function. The
4069 runtime library installs a small stub that saves the registers into global
4070 variables that may be accessed (and changed) by the break handler.
4073 <item>The function is only available as fastcall function, so it may only
4074 be used in presence of a prototype.
4075 <item>The stub saves the zero page registers used by the C runtime and switches
4076 to a small break handler stack. This means that it is safe to execute C code,
4077 even if C code was interrupted. Be careful however not to use too many local
4078 variables, and do not enable stack checks for the handler function or any other
4079 function called from it.
4080 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
4081 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
4082 otherwise the <tt/BRK/ instruction will get executed over and over again.
4083 <item>Since <tt/set_brk/ installs an exit handler, it is not strictly necessary
4084 to call <tt/<ref id="reset_brk" name="reset_brk">/ as part of the cleanup when
4085 the program terminates.
4087 <tag/Availability/cc65
4089 <ref id="reset_brk" name="reset_brk">
4095 <sect1>setjmp<label id="setjmp"><p>
4099 <tag/Function/Save the context for use with <tt/longjmp/.
4100 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4101 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
4102 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
4103 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
4107 <item>The function is only available as fastcall function, so it may only
4108 be used in presence of a prototype.
4109 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
4110 <item><tt/setjmp/ will not save the signal context.
4112 <tag/Availability/ISO 9899
4114 <ref id="longjmp" name="longjmp">
4120 <sect1>setlocale<label id="setlocale"><p>
4124 <tag/Function/Selects a locale.
4125 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4126 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
4127 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
4130 <item>The function is only available as fastcall function, so it may only
4131 be used in presence of a prototype.
4132 <item>cc65 supports only the "C" locale, so calling this function to set a
4133 different locale has no effect.
4135 <tag/Availability/ISO 9899
4137 <ref id="localeconv" name="localeconv">,
4138 <ref id="strcoll" name="strcoll">
4139 <ref id="strxfrm" name="strxfrm">
4145 <sect1>signal<label id="signal"><p>
4149 <tag/Function/Install a signal handler.
4150 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
4151 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
4152 <tag/Description/<tt/signal/ installs a handler for the given signal. The
4153 handler may either be a user supplied function, or one of the predefined
4154 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
4155 previous value if the signal , or the special function vector SIG_ERR in
4157 <tag/Limits/<itemize>
4158 <item>The function is only available as fastcall function, so it may only
4159 be used in presence of a prototype.
4161 <tag/Availability/ISO 9899
4163 <ref id="abort" name="abort">,
4164 <ref id="raise" name="raise">
4170 <sect1>sleep<label id="sleep"><p>
4174 <tag/Function/Sleep for a specified amount of time.
4175 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
4176 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
4177 <tag/Description/The function will return after the specified number of
4178 seconds have elapsed.
4179 <tag/Limits/<itemize>
4180 <item>The function is only available as fastcall function, so it may only
4181 be used in presence of a prototype.
4183 <tag/Availability/POSIX 1003.1
4189 <sect1>slow<label id="slow"><p>
4193 <tag/Function/Switch the C128 into 1MHz mode.
4194 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
4195 <tag/Declaration/<tt/void slow (void);/
4196 <tag/Description/The function will switch the clock of the C128 to 1MHz. This
4197 will halve the speed compared to fast mode.
4198 <tag/Limits/<itemize>
4199 <item>The function is specific to the C128.
4201 <tag/Availability/C128
4203 <ref id="fast" name="fast">,
4204 <ref id="toggle_videomode" name="toggle_videomode">,
4205 <ref id="videomode" name="videomode">
4211 <sect1>srand<label id="srand"><p>
4215 <tag/Function/Initialize the pseudo random number generator.
4216 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4217 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
4218 <tag/Description/The function initializes the random number generator using
4219 the given seed. On program startup, the generator behaves as if <tt/srand/ has
4220 been called with an argument of 1.
4221 <tag/Limits/<itemize>
4222 <item>The function is only available as fastcall function, so it may only
4223 be used in presence of a prototype.
4225 <tag/Availability/ISO 9899
4227 <ref id="_randomize" name="_randomize">,
4228 <ref id="rand" name="rand">
4234 <sect1>strcasecmp<label id="strcasecmp"><p>
4238 <tag/Function/Compare two strings case insensitive.
4239 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4240 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
4241 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
4242 as parameters without case sensitivity. It returns a value that is less than
4243 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
4244 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
4245 <tag/Limits/<itemize>
4246 <item>The function is only available as fastcall function, so it may only
4247 be used in presence of a prototype.
4248 <item>The function is not available in strict ANSI mode.
4250 <tag/Availability/cc65
4252 <ref id="strcmp" name="strcmp">,
4253 <ref id="strcoll" name="strcoll">,
4254 <ref id="stricmp" name="stricmp">,
4255 <ref id="strncmp" name="strncmp">
4256 <ref id="strxfrm" name="strxfrm">
4262 <sect1>strcat<label id="strcat"><p>
4266 <tag/Function/Concatentate two strings.
4267 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4268 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
4269 <tag/Description/The <tt/strcat/ function appends a copy of the string
4270 pointed to by s2 (including the terminating null byte) to the end of the
4271 string pointed to by s1. The initial byte of s2 overwrites the null byte at
4273 <tag/Limits/<itemize>
4274 <item>The function is only available as fastcall function, so it may only
4275 be used in presence of a prototype.
4276 <item>If copying takes place between objects that overlap, the behaviour
4279 <tag/Availability/ISO 9899
4281 <ref id="strcpy" name="strcpy">,
4282 <ref id="strncat" name="strncat">,
4283 <ref id="strncpy" name="strncpy">
4289 <sect1>strchr<label id="strchr"><p>
4293 <tag/Function/Search for a character in a string.
4294 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4295 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
4296 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
4297 (converted to a char) in the string pointed to by <tt/s/. The terminating null
4298 byte is considered to be part of the string. Upon completion, the function
4299 returns a pointer to the byte, or a null pointer if the byte was not found.
4300 <tag/Limits/<itemize>
4301 <item>The function is only available as fastcall function, so it may only
4302 be used in presence of a prototype.
4304 <tag/Availability/ISO 9899
4306 <ref id="memchr" name="memchr">,
4307 <ref id="strrchr" name="strrchr">
4313 <sect1>strcmp<label id="strcmp"><p>
4317 <tag/Function/Compare two strings.
4318 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4319 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
4320 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
4321 parameters. It returns a value that is less than zero if <tt/s1/ is less than
4322 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
4323 if <tt/s1/ is greater than <tt/s2/.
4324 <tag/Limits/<itemize>
4325 <item>The function is only available as fastcall function, so it may only
4326 be used in presence of a prototype.
4328 <tag/Availability/ISO 9899
4330 <ref id="strcasecmp" name="strcasecmp">,
4331 <ref id="strcoll" name="strcoll">,
4332 <ref id="stricmp" name="stricmp">,
4333 <ref id="strncmp" name="strncmp">
4334 <ref id="strxfrm" name="strxfrm">
4340 <sect1>strcoll<label id="strcoll"><p>
4344 <tag/Function/Compare two strings.
4345 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4346 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
4347 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
4348 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
4349 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
4350 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
4351 than zero if <tt/s1/ is greater than <tt/s2/.
4352 <tag/Limits/<itemize>
4353 <item>The function is only available as fastcall function, so it may only
4354 be used in presence of a prototype.
4356 <tag/Availability/ISO 9899
4358 <ref id="setlocale" name="setlocale">,
4359 <ref id="strcasecmp" name="strcasecmp">,
4360 <ref id="strcmp" name="strcmp">,
4361 <ref id="stricmp" name="stricmp">,
4362 <ref id="strncmp" name="strncmp">
4363 <ref id="strxfrm" name="strxfrm">
4369 <sect1>strcpy<label id="strcpy"><p>
4373 <tag/Function/Copy a string.
4374 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4375 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
4376 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
4377 <tt/s2/ (including the terminating null byte) into the array pointed to by
4378 <tt/s1/. The function will always return <tt/s1/.
4379 <tag/Limits/<itemize>
4380 <item>The function is only available as fastcall function, so it may only
4381 be used in presence of a prototype.
4382 <item>If copying takes place between objects that overlap, the behaviour
4385 <tag/Availability/ISO 9899
4387 <ref id="strcat" name="strcat">,
4388 <ref id="strncat" name="strncat">,
4389 <ref id="strncpy" name="strncpy">
4392 #include <string.h>
4394 static char hello[14];
4396 strcpy (hello, "Hello world!\n");
4402 <sect1>strcspn<label id="strcspn"><p>
4406 <tag/Function/Compute the length of a substring.
4407 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4408 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
4409 <tag/Description/The <tt/strcspn/ function computes and returns the length of
4410 the substring pointed to by <tt/s/ which does <em>not</em> consist of
4411 characters contained in the string <tt/set/.
4412 <tag/Limits/<itemize>
4413 <item>The function is only available as fastcall function, so it may only
4414 be used in presence of a prototype.
4416 <tag/Availability/ISO 9899
4418 <ref id="strspn" name="strspn">,
4419 <ref id="strstr" name="strstr">,
4420 <ref id="strtok" name="strtok">
4426 <sect1>strdup<label id="strdup"><p>
4430 <tag/Function/Allocate a copy of a string on the heap.
4431 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4432 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
4433 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
4434 to hold a copy of <tt/s/ including the terminating zero. If the allocation
4435 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
4436 memory block, and a pointer to the block is returned.
4437 <tag/Limits/<itemize>
4438 <item>The function is only available as fastcall function, so it may only
4439 be used in presence of a prototype.
4440 <item>It is up to the caller to free the allocated memory block.
4442 <tag/Availability/ISO 9899
4444 <ref id="free" name="free">,
4445 <ref id="malloc" name="malloc">
4451 <sect1>strerror<label id="strerror"><p>
4455 <tag/Function/Return a string describing an error code.
4456 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4457 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
4458 <tag/Description/The <tt/strerror/ function returns a string describing the
4459 given error code. If an invalid error code is passed, the string "Unknown
4460 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
4461 <tt/errno/ is left untouched.
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>While the return type of the function is a <tt/char*/, the returned
4466 string must not be modified by the caller!
4468 <tag/Availability/ISO 9899
4470 <ref id="_stroserror" name="_stroserror">
4476 <sect1>stricmp<label id="stricmp"><p>
4480 <tag/Function/Compare two strings case insensitive.
4481 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4482 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
4483 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
4484 parameters without case sensitivity. It returns a value that is less than zero
4485 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
4486 value greater than zero if <tt/s1/ is greater than <tt/s2/.
4487 <tag/Limits/<itemize>
4488 <item>The function is only available as fastcall function, so it may only
4489 be used in presence of a prototype.
4490 <item>The function is not available in strict ANSI mode.
4492 <tag/Availability/cc65
4494 <ref id="strcasecmp" name="strcasecmp">,
4495 <ref id="strcmp" name="strcmp">,
4496 <ref id="strcoll" name="strcoll">,
4497 <ref id="strncmp" name="strncmp">
4498 <ref id="strxfrm" name="strxfrm">
4504 <sect1>strlen<label id="strlen"><p>
4508 <tag/Function/Return the length of a string.
4509 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4510 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
4511 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
4512 string to which s points, not including the terminating null byte.
4513 <tag/Limits/<itemize>
4514 <item>The function is only available as fastcall function, so it may only
4515 be used in presence of a prototype.
4516 <item>When compiling with <tt/-Os/ (inline known standard functions), the
4517 function does not work correctly for strings with more than 255 characters.
4519 <tag/Availability/ISO 9899
4521 <ref id="strcpy" name="strcpy">
4527 <sect1>strlower<label id="strlower"><p>
4531 <tag/Function/Make a string lower case.
4532 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4533 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
4534 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
4535 function to each character of a string. The function will always return <tt/s/.
4536 <tag/Limits/<itemize>
4537 <item>The function is only available as fastcall function, so it may only
4538 be used in presence of a prototype.
4539 <item>The function prototype is unavailable when compiling in strict ANSI mode.
4540 <item>An alias name for this function is <tt/strlwr/.
4542 <tag/Availability/cc65
4544 <ref id="strupper" name="strupper">,
4545 <ref id="tolower" name="tolower">
4551 <sect1>strlwr<label id="strlwr"><p>
4558 <sect1>strncat<label id="strncat"><p>
4562 <tag/Function/Concatentate two strings.
4563 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4564 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
4565 <tag/Description/The <tt/strncat/ function appends not more than n characters
4566 of the string pointed to by s2 to the end of the string pointed to by s1. The
4567 terminating null character at the end of s1 is overwritten. A terminating null
4568 character is appended to the result, even if not all of s2 is appended to s1.
4569 <tag/Limits/<itemize>
4570 <item>The function is only available as fastcall function, so it may only
4571 be used in presence of a prototype.
4572 <item>If copying takes place between objects that overlap, the behaviour
4575 <tag/Availability/ISO 9899
4577 <ref id="strcpy" name="strcpy">,
4578 <ref id="strncat" name="strncat">,
4579 <ref id="strncpy" name="strncpy">
4585 <sect1>strncmp<label id="strncmp"><p>
4589 <tag/Function/Compare two strings.
4590 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4591 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
4592 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
4593 characters of the two strings passed as parameters. It returns a value that is
4594 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
4595 <tt/s2/, zero if they are identical, and a value greater than zero they are
4597 <tag/Limits/<itemize>
4598 <item>The function is only available as fastcall function, so it may only
4599 be used in presence of a prototype.
4601 <tag/Availability/ISO 9899
4603 <ref id="strcasecmp" name="strcasecmp">,
4604 <ref id="strcmp" name="strcmp">,
4605 <ref id="strcoll" name="strcoll">,
4606 <ref id="stricmp" name="stricmp">
4607 <ref id="strxfrm" name="strxfrm">
4613 <sect1>strncpy<label id="strncpy"><p>
4617 <tag/Function/Copy part of a string.
4618 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4619 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2, size_t n);/
4620 <tag/Description/The <tt/strncpy/ function copies not more than n bytes from
4621 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
4622 pointed to by <tt/s2/ is a string that is shorter than n bytes, null bytes are
4623 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
4624 written. The function will always return <tt/s1/.
4625 <tag/Limits/<itemize>
4626 <item>The function is only available as fastcall function, so it may only
4627 be used in presence of a prototype. If there is no null byte in the first <tt/n/
4628 bytes of the array pointed to by <tt/s2/, the result is not null-terminated.
4629 <item>If copying takes place between objects that overlap, the behaviour is
4632 <tag/Availability/ISO 9899
4634 <ref id="strcat" name="strcat">,
4635 <ref id="strcpy" name="strcpy">,
4636 <ref id="strncat" name="strncat">
4641 static char hello[6];
4643 strcpy (hello, "Hello world!\n", sizeof (hello) - 1);
4650 <sect1>strrchr<label id="strrchr"><p>
4654 <tag/Function/Search for a character in a string.
4655 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4656 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
4657 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
4658 (converted to a char) in the string pointed to by <tt/s/. The terminating null
4659 byte is considered to be part of the string. Upon completion, the function
4660 returns a pointer to the byte, or a null pointer if the byte was not found.
4661 <tag/Limits/<itemize>
4662 <item>The function is only available as fastcall function, so it may only
4663 be used in presence of a prototype.
4665 <tag/Availability/ISO 9899
4667 <ref id="strchr" name="strchr">
4673 <sect1>strspn<label id="strspn"><p>
4677 <tag/Function/Compute the length of a substring.
4678 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4679 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
4680 <tag/Description/The <tt/strspn/ function computes and returns the length of
4681 the substring pointed to by <tt/s/ which does consist only of characters
4682 contained in the string <tt/set/.
4683 <tag/Limits/<itemize>
4684 <item>The function is only available as fastcall function, so it may only
4685 be used in presence of a prototype.
4687 <tag/Availability/ISO 9899
4689 <ref id="strcspn" name="strcspn">,
4690 <ref id="strstr" name="strstr">
4696 <sect1>strstr<label id="strstr"><p>
4700 <tag/Function/Find a substring.
4701 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4702 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
4703 <tag/Description/<tt/strstr/ searches for the first occurance of the string
4704 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
4705 otherwise it returns <tt/NULL/.
4706 <tag/Limits/<itemize>
4707 <item>The function is only available as fastcall function, so it may only
4708 be used in presence of a prototype.
4710 <tag/Availability/ISO 9899
4712 <ref id="strcspn" name="strcspn">,
4713 <ref id="strspn" name="strspn">
4719 <sect1>strtok<label id="strtok"><p>
4723 <tag/Function/Break a string into tokens.
4724 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4725 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
4726 <tag/Description/<tt/strtok/ will break the string s1 into a sequence of
4727 tokens, which are delimited by characters from the string s2. The first call
4728 to <tt/strtok/ will return a pointer to the first token in the string s1.
4729 Following calls must pass a <tt/NULL/ pointer as s1 in order to get the next
4730 token in the string. Different sets of delimiters may be used for the
4731 subsequent calls to <tt/strtok/.
4732 <tag/Limits/<itemize>
4733 <item>The function is only available as fastcall function, so it may only
4734 be used in presence of a prototype.
4735 <item><tt/strtok/ will modify the string s1.
4737 <tag/Availability/ISO 9899
4739 <ref id="strcspn" name="strcspn">,
4740 <!-- <ref id="strpbrk" name="strpbrk"> -->
4746 <sect1>strxfrm<label id="strxfrm"><p>
4750 <tag/Function/Transform a string.
4751 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4752 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
4753 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
4754 s2 and places the resulting string into the string pointed to by s1. The
4755 transformation is such that if the <tt/strcmp/ function is applied to two
4756 transformed strings, it returns a value greater than, equal to, or less than
4757 zero, corresponding to the result of the <tt/strcoll/ function applied to the
4758 same two original strings. No more than n characters are placed into the
4759 resulting array pointed to by s1, including the terminating null character.
4760 <tag/Limits/<itemize>
4761 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
4762 the behaviour is undefined.
4763 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
4764 <item>The function is only available as fastcall function, so it may only
4765 be used in presence of a prototype.
4766 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
4767 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
4769 <tag/Availability/ISO 9899
4771 <ref id="strcmp" name="strcmp">,
4772 <ref id="strcoll" name="strcoll">,
4773 <ref id="strncpy" name="strncpy">,
4779 <sect1>strupper<label id="strupper"><p>
4783 <tag/Function/Make a string upper case.
4784 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4785 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
4786 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
4787 function to each character of a string. The function will always return <tt/s/.
4788 <tag/Limits/<itemize>
4789 <item>The function is only available as fastcall function, so it may only
4790 be used in presence of a prototype.
4791 <item>The function prototype is unavailable when compiling in strict ANSI mode.
4792 <item>An alias name for this function is <tt/strupr/.
4794 <tag/Availability/cc65
4796 <ref id="strlower" name="strlower">
4797 <ref id="toupper" name="toupper">
4803 <sect1>strupr<label id="strupr"><p>
4810 <sect1>textcolor<label id="textcolor"><p>
4814 <tag/Function/Set the text color.
4815 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4816 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
4817 <tag/Description/The function will set a new text color. It returns the old
4818 (current) text color. Text output using any <tt/conio.h/ function will use
4819 the color set by this function.
4820 <tag/Limits/<itemize>
4821 <item>Text colors are system dependent. The function may have no effect
4822 on systems where the text color cannot be changed.
4823 <item>The function is only available as fastcall function, so it may only
4824 be used in presence of a prototype.
4826 <tag/Availability/cc65
4828 <ref id="bgcolor" name="bgcolor">,
4829 <ref id="bordercolor" name="bordercolor">
4835 <sect1>time<label id="time"><p>
4839 <tag/Function/Get the time.
4840 <tag/Header/<tt/<ref id="time.h" name="time.h">/
4841 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
4842 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
4843 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
4844 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
4845 returned and <tt/errno/ is set to <tt/ENOSYS/.
4846 <tag/Limits/<itemize>
4847 <item>The function is only available as fastcall function, so it may
4848 only be used in presence of a prototype.
4849 <item>Many platforms supported by cc65 do not have a realtime clock, so the
4850 returned value may not be valid.
4852 <tag/Availability/ISO 9899
4858 <sect1>toggle_videomode<label id="toggle_videomode"><p>
4862 <tag/Function/Toggle between 40 and 80 column mode.
4863 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
4864 <tag/Declaration/<tt/void toggle_videomode (void);/
4865 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
4866 old mode (cursor position, color and so on) are saved and restored together
4868 <tag/Limits/<itemize>
4869 <item>The function is specific to the C128.
4870 <item>This function is deprecated. Please use <ref id="videomode"
4871 name="videomode"> instead!
4873 <tag/Availability/C128
4875 <ref id="fast" name="fast">,
4876 <ref id="slow" name="slow">,
4877 <ref id="videomode" name="videomode">
4883 <sect1>tolower<label id="tolower"><p>
4887 <tag/Function/Convert a character into its lower case representation.
4888 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4889 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
4890 <tag/Description/The function returns the given character converted to lower
4891 case. If the given character is not a letter, it is returned unchanged.
4892 <tag/Limits/<itemize>
4893 <item>The function is only available as fastcall function, so it may
4894 only be used in presence of a prototype.
4896 <tag/Availability/ISO 9899
4898 <ref id="islower" name="islower">,
4899 <ref id="isupper" name="isupper">,
4900 <ref id="toupper" name="toupper">
4906 <sect1>toupper<label id="toupper"><p>
4910 <tag/Function/Convert a character into its upper case representation.
4911 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4912 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
4913 <tag/Description/The function returns the given character converted to upper
4914 case. If the given character is not a letter, it is returned unchanged.
4915 <tag/Limits/<itemize>
4916 <item>The function is only available as fastcall function, so it may
4917 only be used in presence of a prototype.
4919 <tag/Availability/ISO 9899
4921 <ref id="islower" name="islower">,
4922 <ref id="isupper" name="isupper">,
4923 <ref id="tolower" name="tolower">
4929 <sect1>ultoa<label id="ultoa"><p>
4933 <tag/Function/Convert an unsigned long integer into a string.
4934 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4935 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
4936 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
4937 string using <tt/radix/ as the base.
4938 <tag/Limits/<itemize>
4939 <item>There are no provisions to prevent a buffer overflow.
4940 <item>The function is non standard, so it is not available in strict ANSI mode.
4941 You should probably use <tt/sprintf/ instead.
4942 <item>The function is only available as fastcall function, so it may only be
4943 used in presence of a prototype.
4945 <tag/Availability/cc65
4947 <ref id="atoi" name="atoi">,
4948 <ref id="atol" name="atol">,
4949 <ref id="itoa" name="itoa">,
4950 <ref id="ltoa" name="ltoa">,
4951 <ref id="utoa" name="utoa">
4957 <sect1>unlink<label id="unlink"><p>
4961 <tag/Function/Delete a file.
4962 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
4963 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
4964 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
4965 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
4966 code describing the reason for the failure.
4969 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
4970 name="remove">/ instead, which is a native ANSI C function and does the same.
4971 <item>This function is not available on all cc65 targets (depends on the
4972 availability of file I/O).
4973 <item>The function is only available as fastcall function, so it may only
4974 be used in presence of a prototype.
4975 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
4976 used, which has the same semantics, but is more portable, because it conforms
4977 to the ISO C standard.
4979 <tag/Availability/POSIX 1003.1
4981 <ref id="remove" name="remove">
4984 #include <stdio.h>
4985 #include <unistd.h>
4987 #define FILENAME "helloworld"
4989 if (unlink (FILENAME) == 0) {
4990 printf ("We deleted %s successfully\n", FILENAME);
4992 printf ("There was a problem deleting %s\n", FILENAME);
4999 <sect1>utoa<label id="utoa"><p>
5003 <tag/Function/Convert an unsigned integer into a string.
5004 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5005 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
5006 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
5007 using <tt/radix/ as the base.
5008 <tag/Limits/<itemize>
5009 <item>There are no provisions to prevent a buffer overflow.
5010 <item>The function is non standard, so it is not available in strict ANSI mode.
5011 You should probably use <tt/sprintf/ instead.
5012 <item>The function is only available as fastcall function, so it may only be
5013 used in presence of a prototype.
5015 <tag/Availability/cc65
5017 <ref id="atoi" name="atoi">,
5018 <ref id="atol" name="atol">,
5019 <ref id="itoa" name="itoa">,
5020 <ref id="ltoa" name="ltoa">,
5021 <ref id="ultoa" name="ultoa">
5027 <sect1>vcprintf<label id="vcprintf"><p>
5031 <tag/Function/Formatted output to the console.
5032 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5033 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
5034 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
5035 text where necessary and formatted according to the format string given. The
5036 resulting string is output to the console. <tt/vcprintf/ supports the same
5037 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
5038 <tag/Limits/<itemize>
5039 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
5040 between <tt/\r/ and <tt/\n/.
5041 <item>The function is only available as fastcall function, so it may only be
5042 used in presence of a prototype.
5044 <tag/Availability/cc65
5046 <ref id="cprintf" name="cprintf">,
5047 <ref id="cputc" name="cputc">,
5048 <ref id="cputcxy" name="cputcxy">,
5049 <ref id="cputs" name="cputs">,
5050 <ref id="cputsxy" name="cputsxy">
5056 <sect1>videomode<label id="videomode"><p>
5060 <tag/Function/Switch to either 40 or 80 column mode.
5061 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
5062 <ref id="c128.h" name="c128.h">/
5063 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
5064 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
5065 the requested mode is already active, nothing happens. The old mode is returned
5067 <tag/Limits/<itemize>
5068 <item>The function is specific to the C128 and enhanced Apple //e.
5069 <item>This function replaces <ref id="toggle_videomode"
5070 name="toggle_videomode">.
5071 <item>The function is only available as fastcall function, so it may only be
5072 used in presence of a prototype.
5074 <tag/Availability/C128 and enhanced Apple //e
5076 <ref id="fast" name="fast">,
5077 <ref id="slow" name="slow">,
5078 <ref id="toggle_videomode" name="toggle_videomode">
5084 <sect1>wherex<label id="wherex"><p>
5088 <tag/Function/Return the current X position of the text mode cursor.
5089 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5090 <tag/Declaration/<tt/unsigned char wherex (void);/
5091 <tag/Description/The function returns the current X position of the text mode
5092 cursor. Zero is returned for the leftmost screen position.
5093 <tag/Availability/cc65
5095 <ref id="gotox" name="gotox">,
5096 <ref id="gotoy" name="gotoy">,
5097 <ref id="gotoxy" name="gotoxy">,
5098 <ref id="wherey" name="wherey">
5104 <sect1>wherey<label id="wherey"><p>
5108 <tag/Function/Return the current Y position of the text mode cursor.
5109 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5110 <tag/Declaration/<tt/unsigned char wherey (void);/
5111 <tag/Description/The function returns the current Y position of the text mode
5112 cursor. Zero is returned for the uppermost screen position.
5113 <tag/Availability/cc65
5115 <ref id="gotox" name="gotox">,
5116 <ref id="gotoy" name="gotoy">,
5117 <ref id="gotoxy" name="gotoxy">,
5118 <ref id="wherex" name="wherex">