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="snprintf" name="snprintf"> -->
419 <!-- <item><ref id="sprintf" name="sprintf"> -->
420 <!-- <item><ref id="sscanf" name="sscanf"> -->
421 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
422 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
423 <!-- <item><ref id="vprintf" name="vprintf"> -->
424 <!-- <item><ref id="vscanf" name="vscanf"> -->
425 <!-- <item><ref id="vsnprintf" name="vsnprintf"> -->
426 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
427 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
433 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
436 <item><ref id="_heapadd" name="_heapadd">
437 <item><ref id="_heapblocksize" name="_heapblocksize">
438 <item><ref id="_heapmaxavail" name="_heapmaxavail">
439 <item><ref id="_heapmemavail" name="_heapmemavail">
440 <item><ref id="_poserror" name="_poserror">
441 <item><ref id="_randomize" name="_randomize">
442 <item><ref id="_swap" name="_swap">
443 <item><ref id="abort" name="abort">
444 <item><ref id="abs" name="abs">
445 <item><ref id="atexit" name="atexit">
446 <item><ref id="atoi" name="atoi">
447 <item><ref id="atol" name="atol">
448 <item><ref id="bsearch" name="bsearch">
449 <item><ref id="calloc" name="calloc">
450 <item><ref id="div" name="div">
451 <item><ref id="exit" name="exit">
452 <item><ref id="free" name="free">
453 <item><ref id="getenv" name="getenv">
454 <item><ref id="itoa" name="itoa">
455 <item><ref id="labs" name="labs">
456 <item><ref id="ltoa" name="ltoa">
457 <item><ref id="malloc" name="malloc">
458 <item><ref id="perror" name="perror">
459 <item><ref id="qsort" name="qsort">
460 <item><ref id="rand" name="rand">
461 <item><ref id="realloc" name="realloc">
462 <item><ref id="srand" name="srand">
463 <item><ref id="ultoa" name="ultoa">
464 <item><ref id="utoa" name="utoa">
468 <sect1><tt/string.h/<label id="string.h"><p>
471 <item><ref id="_stroserror" name="_stroserror">
472 <item><ref id="bzero" name="bzero">
473 <item><ref id="memchr" name="memchr">
474 <item><ref id="memcpy" name="memcpy">
475 <item><ref id="memmove" name="memmove">
476 <item><ref id="memset" name="memset">
477 <item><ref id="strcasecmp" name="strcasecmp">
478 <item><ref id="strcat" name="strcat">
479 <item><ref id="strchr" name="strchr">
480 <item><ref id="strcmp" name="strcmp">
481 <item><ref id="strcoll" name="strcoll">
482 <item><ref id="strcpy" name="strcpy">
483 <item><ref id="strcspn" name="strcspn">
484 <item><ref id="strdup" name="strdup">
485 <item><ref id="strerror" name="strerror">
486 <item><ref id="stricmp" name="stricmp">
487 <item><ref id="strlen" name="strlen">
488 <item><ref id="strlower" name="strlower">
489 <item><ref id="strlwr" name="strlwr">
490 <item><ref id="strncat" name="strncat">
491 <item><ref id="strncmp" name="strncmp">
492 <item><ref id="strncpy" name="strncpy">
493 <item><ref id="strrchr" name="strrchr">
494 <item><ref id="strspn" name="strspn">
495 <item><ref id="strstr" name="strstr">
496 <item><ref id="strtok" name="strtok">
497 <item><ref id="strxfrm" name="strxfrm">
498 <item><ref id="strupper" name="strupper">
499 <item><ref id="strupr" name="strupr">
505 <sect1><tt/tgi.h/<label id="tgi.h"><p>
510 <sect1><tt/time.h/<label id="time.h"><p>
513 <!-- <item><ref id="_systime" name="_systime"> -->
514 <!-- <item><ref id="asctime" name="asctime"> -->
515 <!-- <item><ref id="clock" name="clock"> -->
516 <!-- <item><ref id="ctime" name="ctime"> -->
517 <!-- <item><ref id="gmtime" name="gmtime"> -->
518 <!-- <item><ref id="localtime" name="localtime"> -->
519 <!-- <item><ref id="mktime" name="mktime"> -->
520 <!-- <item><ref id="strftime" name="strftime"> -->
521 <item><ref id="time" name="time">
527 <sect1><tt/unistd.h/<label id="unistd.h"><p>
530 <!-- <item><ref id="chdir" name="chdir"> -->
531 <!-- <item><ref id="getcwd" name="getcwd"> -->
532 <!-- <item><ref id="lseek" name="lseek"> -->
533 <!-- <item><ref id="mkdir" name="mkdir"> -->
534 <!-- <item><ref id="read" name="read"> -->
535 <!-- <item><ref id="rmdir" name="rmdir"> -->
536 <item><ref id="sleep" name="sleep">
537 <item><ref id="unlink" name="unlink">
538 <!-- <item><ref id="write" name="write"> -->
544 <sect1><tt/vic20.h/<label id="vic20.h"><p>
549 <sect1><tt/zlib.h/<label id="zlib.h"><p>
554 <sect>Alphabetical function reference<p>
556 <sect1>_heapadd<label id="_heapadd"><p>
560 <tag/Function/Add a block to the heap.
561 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
562 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
563 <tag/Description/The function adds a block of raw memory to the heap.
566 <item>The minimum blocksize that can be added is 6 bytes; the function will
567 ignore smaller blocks.
569 <tag/Availability/cc65
571 <ref id="_heapblocksize" name="_heapblocksize">,
572 <ref id="_heapmaxavail" name="_heapmaxavail">,
573 <ref id="_heapmemavail" name="_heapmemavail">,
574 <ref id="calloc" name="calloc">,
575 <ref id="free" name="free">,
576 <ref id="malloc" name="malloc">,
577 <ref id="realloc" name="realloc">
583 <sect1>_heapblocksize<label id="_heapblocksize"><p>
587 <tag/Function/Return the size of an allocated block.
588 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
589 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
590 <tag/Description/The function returns the size of a block that must have
591 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
592 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
595 <item>Passing a pointer to a block that was is not the result of one of the
596 allocation functions, or that has been free'd will give unpredicable results.
598 <tag/Availability/cc65
600 <ref id="_heapadd" name="_heapadd">,
601 <ref id="_heapmaxavail" name="_heapmaxavail">,
602 <ref id="_heapmemavail" name="_heapmemavail">,
603 <ref id="calloc" name="calloc">,
604 <ref id="free" name="free">,
605 <ref id="malloc" name="malloc">,
606 <ref id="realloc" name="realloc">
612 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
616 <tag/Function/Return the largest block that is available on the heap.
617 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
618 <tag/Declaration/<tt/size_t __fastcall__ _heapmaxavail (void);/
619 <tag/Description/The function returns the size of the largest block that may
620 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
621 <tag/Availability/cc65
623 <ref id="_heapadd" name="_heapadd">,
624 <ref id="_heapblocksize" name="_heapblocksize">,
625 <ref id="_heapmemavail" name="_heapmemavail">,
626 <ref id="calloc" name="calloc">,
627 <ref id="free" name="free">,
628 <ref id="malloc" name="malloc">,
629 <ref id="realloc" name="realloc">
635 <sect1>_heapmemavail<label id="_heapmemavail"><p>
639 <tag/Function/Return the total available space on the heap.
640 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
641 <tag/Declaration/<tt/size_t __fastcall__ _heapmemavail (void);/
642 <tag/Description/The function returns the total number of bytes available on
646 <item>This function is of less use than usually assumed, since the returned
647 heap space may be available but not in one block. So even if this function
648 says that several times more heap space is available than needed, <ref
649 id="malloc" name="malloc"> may still return <tt/NULL/.
651 <tag/Availability/cc65
653 <ref id="_heapadd" name="_heapadd">,
654 <ref id="_heapblocksize" name="_heapblocksize">,
655 <ref id="_heapmaxavail" name="_heapmaxavail">,
656 <ref id="calloc" name="calloc">,
657 <ref id="free" name="free">,
658 <ref id="malloc" name="malloc">,
659 <ref id="realloc" name="realloc">
665 <sect1>_poserror<label id="_poserror"><p>
669 <tag/Function/Print an error message for the error in <tt/_oserrno/.
670 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
671 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
672 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
673 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
674 a colon and a blank. Then the error message for the current contents of
675 <tt/_oserrno/ are printed followed by a newline. The message output is the
676 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
677 argument of <tt/_oserrno/.
680 <item>Since operating system specific error code are - you guessed it -
681 operating system specific, the value in <tt/_oserror/ and the message that is
682 printed depend on the cc65 target.
683 <item>The function is only available as fastcall function, so it may only
684 be used in presence of a prototype.
686 <tag/Availability/cc65
688 <ref id="_stroserror" name="_stroserror">,
689 <ref id="perror" name="perror">
695 <sect1>_randomize<label id="_randomize"><p>
699 <tag/Function/Initialize the pseudo random number generator.
700 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
701 <tag/Declaration/<tt/void _randomize (void);/
702 <tag/Description/The function initializes the random number generator with
703 a seed derived from fast changing hardware events, so the seed itself can be
704 considered random to a certain degree.
705 <tag/Limits/<itemize>
706 <item>The randomness of the seed depends on the machine hardware.
708 <tag/Availability/cc65
710 <ref id="rand" name="rand">,
711 <ref id="srand" name="srand">
717 <sect1>_stroserror<label id="_stroserror"><p>
721 <tag/Function/Return a string describing an OS specific error code.
722 <tag/Header/<tt/<ref id="string.h" name="string.h">/
723 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
724 <tag/Description/<tt/_stroserror/ will return a string describing the given
725 operating system specific error code.
726 <tag/Limits/<itemize>
727 <item>Since operating system specific error code are - you guessed it -
728 operating system specific, the parameter and the string returned depend on the
730 <item>The function is only available as fastcall function, so it may only be
731 used in presence of a prototype.
733 <tag/Availability/cc65
735 <ref id="strerror" name="strerror">
741 <sect1>_swap<label id="_swap"><p>
745 <tag/Function/Swap the contents of memory areas.
746 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
747 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
748 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
749 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
750 <tt/size/ bytes in size.
751 <tag/Limits/<itemize>
752 <item>The memory areas may not overlap, otherwise the results are undefined.
753 <item>The function is only available as fastcall function, so it may only be
754 used in presence of a prototype.
756 <tag/Availability/cc65
758 <ref id="memcpy" name="memcpy">,
759 <ref id="memmove" name="memmove">
765 <sect1>_sys<label id="_sys"><p>
769 <tag/Function/Call a subroutine passing register values.
770 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
771 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
772 <tag/Description/The function will call the subroutine at the address
773 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
774 registers and the CPU flags are set to the values given in the <tt/regs/
775 structure. On return from the subroutine, the new values of the registers and
776 flags are stored back overwriting the old values.
777 <tag/Limits/<itemize>
778 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
779 when calling the subroutine (they are unchanged from their current values).
780 <item>The function is only available as fastcall function, so it may only be
781 used in presence of a prototype.
783 <tag/Availability/cc65
789 <sect1>BRK<label id="BRK"><p>
793 <tag/Function/Insert a 6502 BRK instrunction into the code.
794 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
795 <tag/Declaration/<tt/void BRK (void);/
796 <tag/Description/The function will insert a 6502 BRK instruction into the code
797 which may be used to trigger a debugger.
798 <tag/Limits/<itemize>
799 <item>The function is actually a macro.
800 <item>The inserted instruction may lead to unexpected results if no debugger
803 <tag/Availability/cc65
805 <ref id="CLI" name="CLI">,
806 <ref id="SEI" name="SEI">
812 <sect1>CLI<label id="CLI"><p>
816 <tag/Function/Insert a 6502 CLI instrunction into the code.
817 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
818 <tag/Declaration/<tt/void CLI (void);/
819 <tag/Description/The function will insert a 6502 CLI instruction into the code,
820 so interrupts are enabled. Enabling interrupts has no effects if they are
821 already enabled (the default).
822 <tag/Limits/<itemize>
823 <item>The function is actually a macro.
824 <item>Disabling interrupts may lead to unexpected results.
826 <tag/Availability/cc65
828 <ref id="BRK" name="BRK">,
829 <ref id="SEI" name="SEI">
835 <sect1>PEEK<label id="PEEK"><p>
839 <tag/Function/Read a byte from memory.
840 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
841 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
842 <tag/Description/The function will read the absolute memory given by <tt/addr/
843 and return the value read.
844 <tag/Limits/<itemize>
845 <item>The function is actually a macro.
846 <item>This function depends highly on the platform and environment.
848 <tag/Availability/cc65
850 <ref id="PEEKW" name="PEEKW">,
851 <ref id="POKE" name="POKE">
857 <sect1>PEEKW<label id="PEEKW"><p>
861 <tag/Function/Read a word (two bytes) from memory.
862 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
863 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
864 <tag/Description/The function will read the absolute memory given by <tt/addr/
865 and return the value read. The byte read from the higher address is the high
866 byte of the return value.
867 <tag/Limits/<itemize>
868 <item>The function is actually a macro.
869 <item>This function depends highly on the platform and environment.
870 <item>The order in which the two bytes are read is unspecified and may
871 depend of the address expression used.
873 <tag/Availability/cc65
875 <ref id="PEEK" name="PEEK">,
876 <ref id="POKE" name="POKE">
882 <sect1>POKE<label id="POKE"><p>
886 <tag/Function/Write a byte to memory.
887 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
888 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
889 <tag/Description/The function writes the value <tt/val/ to the absolute
890 memory address given by <tt/addr/.
891 <tag/Limits/<itemize>
892 <item>The function is actually a macro.
893 <item>This function depends highly on the platform and environment.
894 <item>Careless use will cause the program to act strange or may crash the
897 <tag/Availability/cc65
899 <ref id="PEEK" name="PEEK">,
900 <ref id="POKEW" name="POKEW">
906 <sect1>POKEW<label id="POKEW"><p>
910 <tag/Function/Write a word (two bytes) to memory.
911 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
912 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
913 <tag/Description/The function writes the value <tt/val/ to the absolute
914 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
915 the <tt/addr/, the high byte is written to <tt/addr+1/.
916 <tag/Limits/<itemize>
917 <item>The function is actually a macro.
918 <item>This function depends highly on the platform and environment.
919 <item>Careless use will cause the program to act strange or may crash the
921 <item>The order in which the two bytes are written is unspecified and may
922 depend of the address expression used.
924 <tag/Availability/cc65
926 <ref id="PEEK" name="PEEK">,
927 <ref id="POKE" name="POKE">
933 <sect1>SEI<label id="SEI"><p>
937 <tag/Function/Insert a 6502 SEI instrunction into the code.
938 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
939 <tag/Declaration/<tt/void SEI (void);/
940 <tag/Description/The function will insert a 6502 SEI instruction into the code,
941 so interrupts are disabled. Note that non maskable interrupts cannot be
943 <tag/Limits/<itemize>
944 <item>The function is actually a macro.
945 <item>Disabling interrupts may lead to unexpected results.
947 <tag/Availability/cc65
949 <ref id="BRK" name="BRK">,
950 <ref id="CLI" name="CLI">
956 <sect1>abort<label id="abort"><p>
960 <tag/Function/Terminates a program abnormally.
961 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
962 <tag/Declaration/<tt/void abort (void);/
963 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
964 on stderr, then terminates the program with an exit code of 3.
965 <tag/Availability/ISO 9899
967 <ref id="assert" name="assert">,
968 <ref id="exit" name="exit">,
969 <ref id="raise" name="raise">
975 <sect1>abs<label id="abs"><p>
979 <tag/Function/Returns the absolute value of an integer.
980 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
981 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
982 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
984 <tag/Limits/<itemize>
985 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
986 <item>The function is only available as fastcall function, so it may only be
987 used in presence of a prototype.
989 <tag/Availability/ISO 9899
991 <ref id="labs" name="labs">
997 <sect1>assert<label id="assert"><p>
1001 <tag/Function/Test a condition and possibly abort.
1002 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
1003 <tag/Declaration/<tt/void assert (int cond);/
1004 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
1005 statement. If the condition evaluates t zero (false), assert prints a message
1006 on stderr and aborts the program.
1007 <tag/Limits/<itemize>
1008 <item>The function is actually a macro.
1010 <tag/Availability/ISO 9899
1012 <ref id="abort" name="abort">,
1013 <ref id="exit" name="exit">
1019 <sect1>atexit<label id="atexit"><p>
1023 <tag/Function/Register an exit function.
1024 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1025 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1026 <tag/Description/<tt/atexit/ registers the function pointed to by
1027 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1028 terminates, they are called in LIFO order (the last function registered is
1029 called first). <tt/atexit/ returns zero on success and a nonzero value on
1031 <tag/Limits/<itemize>
1032 <item>A maximum of 5 exit functions can be registered.
1033 <item>There is no way to unregister an exit function.
1034 <item>The function is only available as fastcall function, so it may only be
1035 used in presence of a prototype.
1037 <tag/Availability/ISO 9899
1039 <ref id="abort" name="abort">,
1040 <ref id="exit" name="exit">
1046 <sect1>atoi<label id="atoi"><p>
1050 <tag/Function/Convert a string to an integer.
1051 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1052 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1053 <tag/Description/<tt/atoi/ converts the given string into an integer.
1054 Conversion stops as soon as any invalid character is encountered.
1055 <tag/Limits/<itemize>
1056 <item>There is no way to detect any conversion errors.
1057 <item>The function does not check for an numerical overflow when converting.
1058 <item>The function is only available as fastcall function, so it may only be
1059 used in presence of a prototype.
1061 <tag/Availability/ISO 9899
1063 <ref id="atol" name="atol">,
1064 <ref id="itoa" name="itoa">,
1065 <ref id="ltoa" name="ltoa">,
1066 <ref id="ultoa" name="ultoa">,
1067 <ref id="utoa" name="utoa">
1073 <sect1>atol<label id="atol"><p>
1077 <tag/Function/Convert a string to a long integer.
1078 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1079 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1080 <tag/Description/<tt/atol/ converts the given string into a long integer.
1081 Conversion stops as soon as any invalid character is encountered.
1082 <tag/Limits/<itemize>
1083 <item>There is no way to detect any conversion errors.
1084 <item>The function does not check for an numerical overflow when converting.
1085 <item>The function is only available as fastcall function, so it may only be
1086 used in presence of a prototype.
1088 <tag/Availability/ISO 9899
1090 <ref id="atoi" name="atoi">,
1091 <ref id="itoa" name="itoa">,
1092 <ref id="ltoa" name="ltoa">,
1093 <ref id="ultoa" name="ultoa">,
1094 <ref id="utoa" name="utoa">
1100 <sect1>bgcolor<label id="bgcolor"><p>
1104 <tag/Function/Set the background text color.
1105 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1106 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1107 <tag/Description/The function will set a new background color and return the
1108 old (current) one. The background color is valid for the whole text output
1109 area of the screen, not just for new text.
1110 <tag/Limits/<itemize>
1111 <item>Background colors are system dependent. The function may have no effect
1112 on systems where the background color cannot be changed.
1113 <item>The function is only available as fastcall function, so it may only be
1114 used in presence of a prototype.
1116 <tag/Availability/cc65
1118 <ref id="bordercolor" name="bordercolor">,
1119 <ref id="textcolor" name="textcolor">
1125 <sect1>bordercolor<label id="bordercolor"><p>
1129 <tag/Function/Set the border (frame) color.
1130 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1131 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1132 <tag/Description/The function will set a new border color. It returns the old
1133 (current) border color.
1134 <tag/Limits/<itemize>
1135 <item>Border colors are system dependent. The function may have no effect
1136 on systems where the border color cannot be changed.
1137 <item>The function is only available as fastcall function, so it may only
1138 be used in presence of a prototype.
1140 <tag/Availability/cc65
1142 <ref id="bgcolor" name="bgcolor">,
1143 <ref id="textcolor" name="textcolor">
1149 <sect1>bsearch<label id="bsearch"><p>
1153 <tag/Function/Do a binary search in a sorted array.
1154 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1155 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1156 const void* base, size_t n, size_t size,
1157 int (*cmp) (const void*, const void*));/
1158 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1159 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1160 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1161 the function used to compare the members against the key. The function returns
1162 a pointer to the member found, or <tt/NULL/ if there was no match.
1165 <item>The contents of the array must be sorted in ascending order according to
1166 the compare function given.
1167 <item>If there are multiple members that match the key, the function will
1168 return one of the members.
1169 <item>The function is only available as fastcall function, so it may only
1170 be used in presence of a prototype.
1172 <tag/Availability/ISO 9899
1174 <ref id="qsort" name="qsort">
1180 <sect1>bzero<label id="bzero"><p>
1184 <tag/Function/Fill a memory area with zeroes.
1185 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1186 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1187 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1191 <item>The function is non standard and therefore only available in non ANSI
1192 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1193 <item>The function is only available as fastcall function, so it may only
1194 be used in presence of a prototype.
1196 <tag/Availability/cc65
1198 <ref id="_swap" name="_swap">,
1199 <ref id="memcpy" name="memcpy">,
1200 <ref id="memmove" name="memmove">,
1201 <ref id="memset" name="memset">,
1207 <sect1>c64mode<label id="c64mode"><p>
1211 <tag/Function/Switch the C128 into C64 compatible mode.
1212 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1213 <tag/Declaration/<tt/void c64mode (void);/
1214 <tag/Description/The function will cause the machine to reboot into C64 mode.
1215 <tag/Limits/<itemize>
1216 <item>The function is specific to the C128.
1217 <item>The function will not return to the caller.
1219 <tag/Availability/C128
1225 <sect1>calloc<label id="calloc"><p>
1229 <tag/Function/Allocate and clear memory.
1230 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1231 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1232 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1233 of size <tt/size/, clears the whole block with binary zeroes and returns a
1234 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1238 <item>Clearing the memory may not have the expected effect on all platforms:
1239 pointers in the block may not be <tt/NULL/ and floating point variables may
1240 not be zero (0.0). In other words: The "clearing" effect of this function
1241 should be used with care for portable programs.
1242 <item>The function is only available as fastcall function, so it may only
1243 be used in presence of a prototype.
1245 <tag/Availability/ISO 9899
1247 <ref id="_heapadd" name="_heapadd">,
1248 <ref id="_heapblocksize" name="_heapblocksize">,
1249 <ref id="_heapmaxavail" name="_heapmaxavail">,
1250 <ref id="_heapmemavail" name="_heapmemavail">,
1251 <ref id="free" name="free">,
1252 <ref id="malloc" name="malloc">,
1253 <ref id="realloc" name="realloc">
1259 <sect1>cclear<label id="cclear"><p>
1263 <tag/Function/Clear part of a line (write a given number of spaces).
1264 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1265 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
1266 <tag/Description/The function clears part of a line by writing <tt/length/
1267 spaces in the current text color.
1268 <tag/Limits/<itemize>
1269 <item>The function is only available as fastcall function, so it may
1270 only be used in presence of a prototype.
1272 <tag/Availability/cc65
1274 <ref id="cclearxy" name="cclearxy">,
1275 <ref id="clrscr" name="clrscr">
1281 <sect1>cclearxy<label id="cclearxy"><p>
1285 <tag/Function/Clear part of a line (write a given number of spaces) starting
1286 at a specific screen position.
1287 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1288 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
1289 <tag/Description/The function moves the cursor to a specific position, and
1290 will then clear part of the line by writing <tt/length/ spaces in the current
1292 <tag/Limits/<itemize>
1293 <item>The function is only available as fastcall function, so it may
1294 only be used in presence of a prototype.
1296 <tag/Availability/cc65
1298 <ref id="cclear" name="cclear">,
1299 <ref id="clrscr" name="clrscr">
1305 <sect1>cgetc<label id="cgetc"><p>
1309 <tag/Function/Read a character from the keyboard.
1310 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1311 <tag/Declaration/<tt/char cgetc (void);/
1312 <tag/Description/The function reads a character from the keyboard. If there is
1313 no character available, <tt/cgetc/ waits until the user presses a key. If the
1314 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
1315 displayed while waiting.
1316 <tag/Limits/<itemize>
1317 <item>If the system supports a keyboard buffer, <tt/cgetc/ will fetch a key
1318 from this buffer and wait only if the buffer is empty.
1320 <tag/Availability/cc65
1322 <ref id="cursor" name="cursor">,
1323 <ref id="kbhit" name="kbhit">
1329 <sect1>chline<label id="chline"><p>
1333 <tag/Function/Output a horizontal line in text mode.
1334 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1335 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
1336 <tag/Description/The function outputs a horizontal line with the given length
1337 starting at the current cursor position.
1338 <tag/Limits/<itemize>
1339 <item>The character used to draw the horizontal line is system dependent.
1340 If available, a line drawing character is used. Drawing a line that is partially
1341 off screen leads to undefined behaviour.
1342 <item>The function is only available as fastcall function, so it may only be
1343 used in presence of a prototype.
1345 <tag/Availability/cc65
1347 <ref id="chlinexy" name="chlinexy">,
1348 <ref id="cvline" name="cvline">,
1349 <ref id="cvlinexy" name="cvlinexy">
1355 <sect1>chlinexy<label id="chlinexy"><p>
1359 <tag/Function/Output a horizontal line at a given position in text mode.
1360 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1361 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
1362 <tag/Description/The function outputs a horizontal line with the given length
1363 starting at a given position.
1364 <tag/Limits/<itemize>
1365 <item>The character used to draw the horizontal line is system dependent.
1366 If available, a line drawing character is used. Drawing a line that is partially
1367 off screen leads to undefined behaviour.
1368 <item>The function is only available as fastcall function, so it may only be
1369 used in presence of a prototype.
1371 <tag/Availability/cc65
1373 <ref id="chline" name="chline">,
1374 <ref id="cvline" name="cvline">,
1375 <ref id="cvlinexy" name="cvlinexy">
1381 <sect1>clearerr<label id="clearerr"><p>
1385 <tag/Function/Clear error and end-of-file status of a stream.
1386 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1387 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
1388 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
1389 indicators for the stream <tt/f/.
1390 <tag/Limits/<itemize>
1391 <item>The function is only available as fastcall function, so it may only be
1392 used in presence of a prototype.
1394 <tag/Availability/ISO 9899
1396 <ref id="feof" name="feof">,
1397 <ref id="ferror" name="ferror">
1403 <sect1>clrscr<label id="clrscr"><p>
1407 <tag/Function/Clear the text screen.
1408 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1409 <tag/Declaration/<tt/void clrscr (void);/
1410 <tag/Description/The function clears the text screen and moves the cursor to
1411 the upper left corner.
1412 <tag/Availability/cc65
1414 <ref id="cclear" name="cclear">,
1415 <ref id="cclearxy" name="cclearxy">
1421 <sect1>close<label id="close"><p>
1425 <tag/Function/Close a file descriptor.
1426 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1427 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
1428 <tag/Description/The function closes the given file descriptor. It returns zero
1429 on success and -1 on error. If an error occurs, the cause can be determined by
1430 reading the <tt/errno/ variable.
1431 <tag/Limits/<itemize>
1432 <item>The function is only available as fastcall function, so it may only
1433 be used in presence of a prototype.
1435 <tag/Availability/POSIX 1003.1
1437 <ref id="creat" name="creat">,
1438 <ref id="open" name="open">
1444 <sect1>creat<label id="creat"><p>
1448 <tag/Function/Create a file.
1449 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1450 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
1451 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
1452 associated with it. On error, -1 is returned and an error code is stored in
1454 <tag/Limits/<itemize>
1455 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
1456 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
1457 <item>The function is only available as fastcall function, so it may only
1458 be used in presence of a prototype.
1460 <tag/Availability/POSIX 1003.1
1462 <ref id="close" name="close">,
1463 <ref id="open" name="open">
1469 <sect1>cprintf<label id="cprintf"><p>
1473 <tag/Function/Formatted output to the console.
1474 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1475 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
1476 <tag/Description/The arguments are converted to text where necessary and
1477 formatted according to the format string given. The resulting string is output
1478 to the console. <tt/cprintf/ supports the same format specifiers as
1479 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
1480 <tag/Limits/<itemize>
1481 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
1482 between <tt/\r/ and <tt/\n/.
1484 <tag/Availability/cc65
1486 <ref id="cputc" name="cputc">,
1487 <ref id="cputcxy" name="cputcxy">,
1488 <ref id="cputs" name="cputs">,
1489 <ref id="cputsxy" name="cputsxy">,
1490 <ref id="vcprintf" name="vcprintf">
1496 <sect1>cputc<label id="cputc"><p>
1500 <tag/Function/Output a character directly to the console.
1501 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1502 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
1503 <tag/Description/Output one character to the console at the current cursor
1505 <tag/Limits/<itemize>
1506 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
1507 between <tt/\r/ and <tt/\n/.
1508 <item>The function is only available as fastcall function, so it may only
1509 be used in presence of a prototype.
1511 <tag/Availability/cc65
1513 <ref id="cprintf" name="cprintf">,
1514 <ref id="cputcxy" name="cputcxy">,
1515 <ref id="cputs" name="cputs">,
1516 <ref id="cputsxy" name="cputsxy">,
1517 <ref id="vcprintf" name="vcprintf">
1523 <sect1>cputcxy<label id="cputcxy"><p>
1527 <tag/Function/Output a character at a specific screen position.
1528 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1529 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
1530 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
1531 the screen and outputs one character.
1532 <tag/Limits/<itemize>
1533 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
1534 between <tt/\r/ and <tt/\n/.
1535 <item>The function is only available as fastcall function, so it may only
1536 be used in presence of a prototype.
1538 <tag/Availability/cc65
1540 <ref id="cprintf" name="cprintf">,
1541 <ref id="cputc" name="cputc">,
1542 <ref id="cputs" name="cputs">,
1543 <ref id="cputsxy" name="cputsxy">,
1544 <ref id="vcprintf" name="vcprintf">
1550 <sect1>cputs<label id="cputs"><p>
1554 <tag/Function/Output a string directly to the console.
1555 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1556 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
1557 <tag/Description/The function outputs the given string on the console at the
1558 current cursor position.
1559 <tag/Limits/<itemize>
1560 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
1561 between <tt/\r/ and <tt/\n/.
1562 <item>The function is only available as fastcall function, so it may only
1563 be used in presence of a prototype.
1565 <tag/Availability/cc65
1567 <ref id="cprintf" name="cprintf">,
1568 <ref id="cputc" name="cputc">,
1569 <ref id="cputcxy" name="cputcxy">,
1570 <ref id="cputsxy" name="cputsxy">,
1571 <ref id="vcprintf" name="vcprintf">
1577 <sect1>cputsxy<label id="cputsxy"><p>
1581 <tag/Function/Output a string to the console at a given position.
1582 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1583 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
1584 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
1585 and outputs the string <tt/s/.
1586 <tag/Limits/<itemize>
1587 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
1588 between <tt/\r/ and <tt/\n/.
1589 <item>The function is only available as fastcall function, so it may only
1590 be used in presence of a prototype.
1592 <tag/Availability/cc65
1594 <ref id="cprintf" name="cprintf">,
1595 <ref id="cputc" name="cputc">,
1596 <ref id="cputcxy" name="cputcxy">,
1597 <ref id="cputs" name="cputs">,
1598 <ref id="vcprintf" name="vcprintf">
1604 <sect1>cursor<label id="cursor"><p>
1608 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
1609 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1610 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
1611 <tag/Description/If the argument to the function is non zero, a blinking cursor
1612 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
1613 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
1614 <tag/Limits/<itemize>
1615 <item>The function is only available as fastcall function, so it may only
1616 be used in presence of a prototype.
1618 <tag/Availability/cc65
1620 <ref id="cgetc" name="cgetc">,
1621 <ref id="kbhit" name="kbhit">
1627 <sect1>cvline<label id="cvline"><p>
1631 <tag/Function/Output a vertical line in text mode.
1632 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1633 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
1634 <tag/Description/The function outputs a vertical line with the given length
1635 starting at the current cursor position.
1636 <tag/Limits/<itemize>
1637 <item>The character used to draw the vertical line is system dependent.
1638 If available, a line drawing character is used. Drawing a line that is partially
1639 off screen leads to undefined behaviour.
1640 <item>The function is only available as fastcall function, so it may only be
1641 used in presence of a prototype.
1643 <tag/Availability/cc65
1645 <ref id="chline" name="chline">,
1646 <ref id="chlinexy" name="chlinexy">,
1647 <ref id="cvlinexy" name="cvlinexy">
1653 <sect1>cvlinexy<label id="cvlinexy"><p>
1657 <tag/Function/Output a vertical line at a given position in text mode.
1658 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1659 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
1660 <tag/Description/The function outputs a vertical line with the given length
1661 starting at a given position.
1662 <tag/Limits/<itemize>
1663 <item>The character used to draw the vertical line is system dependent.
1664 If available, a line drawing character is used. Drawing a line that is partially
1665 off screen leads to undefined behaviour.
1666 <item>The function is only available as fastcall function, so it may only be
1667 used in presence of a prototype.
1669 <tag/Availability/cc65
1671 <ref id="chline" name="chline">,
1672 <ref id="chlinexy" name="chlinexy">,
1673 <ref id="cvline" name="cvline">
1679 <sect1>div<label id="div"><p>
1683 <tag/Function/Divide two ints and return quotient and remainder.
1684 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1685 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
1686 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
1687 quotient and remainder in a <tt/div_t/ structure.
1690 <item>The function is only available as fastcall function, so it may only
1691 be used in presence of a prototype.
1693 <tag/Availability/ISO 9899
1701 <sect1>em_commit<label id="em_commit"><p>
1705 <tag/Function/Commit changes into extended memory.
1706 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1707 <tag/Declaration/<tt/void __fastcall__ em_commit (void);/
1708 <tag/Description/Commit changes in the memory window to extended storage. If
1709 the contents of the memory window have been changed, these changes may be lost
1710 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
1711 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
1712 name="em_copyto">/ are called without calling <tt/em_commit/ first.
1713 <tag/Limits/<itemize>
1714 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
1715 memory window are discarded, it does just mean that the drivers is allowed
1717 <item>The function is only available as fastcall function, so it may only be
1718 used in presence of a prototype.
1719 <item>The function produces undefined results if no extended memory driver is
1722 <tag/Availability/cc65
1724 <ref id="em_load_driver" name="em_load_driver">,
1725 <ref id="em_map" name="em_map">,
1726 <ref id="em_use" name="em_use">
1732 <sect1>em_copyfrom<label id="em_copyfrom"><p>
1736 <tag/Function/Copy from extended into normal memory.
1737 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1738 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
1739 <tag/Description/Copy data from extended memory into linear memory. Source and
1740 target addresses as well as the number of bytes to transfer are specified in
1741 the <tt/em_copy/ structure that is passed as a parameter.
1742 <tag/Limits/<itemize>
1743 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
1744 made any changes to the data in the window, call <tt/<ref id="em_commit"
1745 name="em_commit">/ first, or the changes are lost.
1746 <item>The function is only available as fastcall function, so it may only be
1747 used in presence of a prototype.
1748 <item>The function produces undefined results if no extended memory driver is
1751 <tag/Availability/cc65
1753 <ref id="em_commit" name="em_commit">,
1754 <ref id="em_copyto" name="em_copyto">,
1755 <ref id="em_load_driver" name="em_load_driver">
1761 <sect1>em_copyto<label id="em_copyto"><p>
1765 <tag/Function/Copy from normal into extended memory.
1766 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1767 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
1768 <tag/Description/Copy data from linear into extended memory. Source and
1769 target addresses as well as the number of bytes to transfer are specified in
1770 the <tt/em_copy/ structure that is passed as a parameter.
1771 <tag/Limits/<itemize>
1772 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
1773 made any changes to the data in the window, call <tt/<ref id="em_commit"
1774 name="em_commit">/ first, or the changes are lost.
1775 <item>The function is only available as fastcall function, so it may only be
1776 used in presence of a prototype.
1777 <item>The function produces undefined results if no extended memory driver is
1780 <tag/Availability/cc65
1782 <ref id="em_commit" name="em_commit">,
1783 <ref id="em_copyfrom" name="em_copyfrom">,
1784 <ref id="em_load_driver" name="em_load_driver">
1790 <sect1>em_install<label id="em_install"><p>
1794 <tag/Function/Install an already loaded extended memory driver.
1795 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1796 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
1797 <tag/Description/The function installs an already loaded extended memory driver
1798 and returns an error code. The function may be used to install a driver linked
1799 statically to the program.
1800 <tag/Limits/<itemize>
1801 <item>Not all drivers are able to detect if the supported hardware is really
1803 <item>The function is only available as fastcall function, so it may only be
1804 used in presence of a prototype.
1806 <tag/Availability/cc65
1808 <ref id="em_load_driver" name="em_load_driver">,
1809 <ref id="em_uninstall" name="em_uninstall">,
1810 <ref id="em_unload" name="em_unload">
1816 <sect1>em_load_driver<label id="em_load_driver"><p>
1820 <tag/Function/Load and initialize an extended memory driver.
1821 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1822 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
1823 <tag/Description/Load an extended memory driver into memory and initialize
1824 it. The function returns an error code that tells if all this has been
1826 <tag/Limits/<itemize>
1827 <item>Not all drivers are able to detect if the supported hardware is really
1829 <item>The function is only available as fastcall function, so it may only be
1830 used in presence of a prototype.
1831 <item>The driver is loaded by name, so currently you must know the type of
1832 extended memory that should be supported. There is no autodetect capability.
1834 <tag/Availability/cc65
1836 <ref id="em_unload" name="em_unload">
1842 <sect1>em_map<label id="em_map"><p>
1846 <tag/Function/Make a page of extended memory accessible.
1847 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1848 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
1849 <tag/Description/The function maps one page of extended memory into linear
1850 memory and returns a pointer to the page frame. Depending on the hardware
1851 and driver, the data is either mapped into the address space or transfered
1852 into a buffer. If you don't need the actual contents of the page (for example
1853 because you're going to overwrite it completely), it is better to call
1854 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
1855 data if it is possible to avoid that.
1856 <tag/Limits/<itemize>
1857 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
1858 made any changes to the data in the window, call <tt/<ref id="em_commit"
1859 name="em_commit">/ first, or the changes are lost.
1860 <item>The function is only available as fastcall function, so it may only be
1861 used in presence of a prototype.
1862 <item>The function produces undefined results if no extended memory driver is
1865 <tag/Availability/cc65
1867 <ref id="em_commit" name="em_commit">,
1868 <ref id="em_load_driver" name="em_load_driver">,
1869 <ref id="em_use" name="em_use">
1875 <sect1>em_pagecount<label id="em_pagecount"><p>
1879 <tag/Function/Return the number of available extended memory pages.
1880 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1881 <tag/Declaration/<tt/unsigned __fastcall__ em_pagecount (void);/
1882 <tag/Description/The function returns the size of the extended memory supported
1883 by the driver in 256 byte pages.
1884 <tag/Limits/<itemize>
1885 <item>The function returns zero if no extended memory driver is loaded.
1886 <item>The function may return zero if the supported hardware was not detected.
1888 <tag/Availability/cc65
1890 <ref id="em_load_driver" name="em_load_driver">
1896 <sect1>em_uninstall<label id="em_uninstall"><p>
1900 <tag/Function/Uninstall an already loaded extended memory driver.
1901 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1902 <tag/Declaration/<tt/unsigned char __fastcall__ em_install (void);/
1903 <tag/Description/The function uninstalls an already loaded extended memory
1904 driver but doesn't remove it from memory.
1905 <tag/Limits/<itemize>
1906 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
1907 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
1908 should be used instead of <tt/em_uninstall/ so the driver is also removed
1910 <item>The function is only available as fastcall function, so it may only be
1911 used in presence of a prototype.
1913 <tag/Availability/cc65
1915 <ref id="em_install" name="em_install">,
1916 <ref id="em_load_driver" name="em_load_driver">,
1917 <ref id="em_unload" name="em_unload">
1923 <sect1>em_unload<label id="em_unload"><p>
1927 <tag/Function/Unload an extended memory driver.
1928 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1929 <tag/Declaration/<tt/unsigned char __fastcall__ em_unload (void);/
1930 <tag/Description/The function unloads a loaded extended memory driver and
1931 frees all memory allocated for the driver.
1932 <tag/Limits/<itemize>
1933 <item>The function does nothing if no driver is loaded.
1935 <tag/Availability/cc65
1937 <ref id="em_load_driver" name="em_load_driver">
1943 <sect1>em_use<label id="em_use"><p>
1947 <tag/Function/Prepare an extended memory page for use.
1948 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1949 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
1950 <tag/Description/The function maps one page of extended memory into linear
1951 memory and returns a pointer to the page frame. This function is similar to
1952 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
1953 actual memory window in the assumption that the existing data is wrong or
1954 will get overwritten.
1955 <tag/Limits/<itemize>
1956 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
1957 made any changes to the data in the window, call <tt/<ref id="em_commit"
1958 name="em_commit">/ first, or the changes are lost.
1959 <item>The function is only available as fastcall function, so it may only be
1960 used in presence of a prototype.
1961 <item>The function produces undefined results if no extended memory driver is
1964 <tag/Availability/cc65
1966 <ref id="em_commit" name="em_commit">,
1967 <ref id="em_load_driver" name="em_load_driver">,
1968 <ref id="em_map" name="em_map">
1974 <sect1>exit<label id="exit"><p>
1978 <tag/Function/Terminate the program.
1979 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1980 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
1981 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
1982 return code of the program. Before termination, all files are closed, buffered
1983 output is written and any functions registered with <tt/<ref id="atexit"
1984 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
1985 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
1987 <tag/Limits/<itemize>
1988 <item>The function is only available as fastcall function, so it may only
1989 be used in presence of a prototype.
1990 <item>It depends on the host machine if the program return code can be
1991 evaluated or is ignored.
1993 <tag/Availability/ISO 9899
1995 <ref id="abort" name="abort">,
1996 <ref id="exit" name="exit">
2002 <sect1>fast<label id="fast"><p>
2006 <tag/Function/Switch the C128 into 2MHz mode.
2007 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
2008 <tag/Declaration/<tt/void fast (void);/
2009 <tag/Description/The function will switch the clock of the C128 to 2MHz. This
2010 will nearly double the speed compared to slow mode.
2011 <tag/Limits/<itemize>
2012 <item>The function is specific to the C128.
2013 <item>2MHz clock will not work in 40 column mode.
2015 <tag/Availability/C128
2017 <ref id="slow" name="slow">,
2018 <ref id="toggle_videomode" name="toggle_videomode">,
2019 <ref id="videomode" name="videomode">
2025 <sect1>feof<label id="feof"><p>
2029 <tag/Function/Return the end-of-file indicator of a stream.
2030 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2031 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
2032 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
2033 <tt/f/, and returns a non zero value if it is set.
2034 <tag/Limits/<itemize>
2035 <item>The indicator is set only after a read past the end of a file is
2037 <item>The function is only available as fastcall function, so it may only be
2038 used in presence of a prototype.
2040 <tag/Availability/ISO 9899
2042 <ref id="feof" name="clearerr">,
2043 <ref id="ferror" name="ferror">
2049 <sect1>ferror<label id="ferror"><p>
2053 <tag/Function/Return the error indicator of a stream.
2054 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2055 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
2056 <tag/Description/<tt/ferror/ tests the error indicator of the stream
2057 <tt/f/, and returns a non zero value if it is set.
2058 <tag/Limits/<itemize>
2059 <item>The function is only available as fastcall function, so it may only be
2060 used in presence of a prototype.
2062 <tag/Availability/ISO 9899
2064 <ref id="feof" name="clearerr">,
2065 <ref id="ferror" name="feof">
2071 <sect1>fileno<label id="fileno"><p>
2075 <tag/Function/Return the file handle used by a stream.
2076 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2077 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
2078 <tag/Description/The <tt/fileno/ function returns the file handle used
2079 internally by a C stream. This file handle (an integer) can be used as a
2080 handle for the POSIX input/output functions.
2081 <tag/Limits/<itemize>
2082 <item>The function is only available as fastcall function, so it may only be
2083 used in presence of a prototype.
2084 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
2085 file may have unpredictable results.
2087 <tag/Availability/POSIX 1003.1
2089 <ref id="creat" name="creat">,
2090 <ref id="open" name="open"> <!-- , -->
2091 <!-- <ref id="read" name="read">, -->
2092 <!-- <ref id="write" name="write"> -->
2098 <sect1>free<label id="free"><p>
2102 <tag/Function/Free a block of dynamic memory.
2103 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2104 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
2105 <tag/Description/Free a block of dynamic memory previously allocated with
2106 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
2107 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
2108 pointer is <tt/NULL/, no action is performed.
2111 <item>Passing an already free'd block to <tt/free/ again will cause undefined
2112 behaviour and may crash your program.
2113 <item>The function is only available as fastcall function, so it may only
2114 be used in presence of a prototype.
2116 <tag/Availability/ISO 9899
2118 <ref id="_heapadd" name="_heapadd">,
2119 <ref id="_heapblocksize" name="_heapblocksize">,
2120 <ref id="_heapmaxavail" name="_heapmaxavail">,
2121 <ref id="_heapmemavail" name="_heapmemavail">,
2122 <ref id="calloc" name="calloc">,
2123 <ref id="malloc" name="malloc">,
2124 <ref id="realloc" name="realloc">
2130 <sect1>get_ostype<label id="get_ostype"><p>
2134 <tag/Function/The function returns the operating system, the program runs on.
2135 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
2136 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
2137 <tag/Declaration/<tt/unsigned char get_ostype (void);/
2138 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
2139 all supported targets. If it exists, it returns a number that identifies the
2140 operating system or machine type, the program runs on. The machine dependent
2141 header files define constants that can be used to check the return code.
2142 <tag/Limits/<itemize>
2143 <item>The function does not exist on all platforms.
2144 <item>The return codes are platform dependent.
2146 <tag/Availability/cc65 (not all platforms)
2152 <sect1>getenv<label id="getenv"><p>
2156 <tag/Function/Return a value from the environment.
2157 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2158 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
2159 <tag/Description/The function searches the environment for an entry that
2160 matches <tt/name/ and returns its value. The environment consists of a list
2161 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
2163 <tag/Limits/<itemize>
2164 <item>What exactly is stored in the environment depends on the machine the
2165 program is running on.
2166 <item>The function is only available as fastcall function, so it may only
2167 be used in presence of a prototype.
2169 <tag/Availability/ISO 9899
2175 <sect1>getcpu<label id="getcpu"><p>
2179 <tag/Function/Determine on which CPU the program is running.
2180 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
2181 <tag/Declaration/<tt/unsigned char getcpu (void);/
2182 <tag/Description/The function checks on which CPU the code is running. It
2183 returns one of the constants<itemize>
2185 <item><tt/CPU_65C02/
2186 <item><tt/CPU_65816/
2188 <tag/Limits/<itemize>
2189 <item>Other, more exotic CPU types are not disinguished.
2191 <tag/Availability/cc65
2197 <sect1>gotox<label id="gotox"><p>
2201 <tag/Function/Move the text mode cursor to a new X position.
2202 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2203 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
2204 <tag/Description/The function moves the text mode cursor to the specified X
2205 position while leaving the Y position untouched. The leftmost position on the
2206 screen has the coordinate 0.
2207 <tag/Limits/<itemize>
2208 <item>The function is only available as fastcall function, so it may
2209 only be used in presence of a prototype.
2210 <item>Invalid values for the X position (out of screen coordinates) may
2211 lead to undefined behaviour.
2213 <tag/Availability/cc65
2215 <ref id="gotoy" name="gotoy">,
2216 <ref id="gotoxy" name="gotoxy">,
2217 <ref id="wherex" name="wherex">,
2218 <ref id="wherey" name="wherey">
2224 <sect1>gotoxy<label id="gotoxy"><p>
2228 <tag/Function/Move the text mode cursor to a new position.
2229 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2230 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
2231 <tag/Description/The function moves the text mode cursor to the specified
2232 position. The leftmost position on the screen has the X coordinate 0, the
2233 topmost line has the Y coordinate 0.
2234 <tag/Limits/<itemize>
2235 <item>The function is only available as fastcall function, so it may only be
2236 used in presence of a prototype.
2237 <item>Invalid values for any of both coordinates (out of screen positions) may
2238 lead to undefined behaviour.
2240 <tag/Availability/cc65
2242 <ref id="gotox" name="gotox">,
2243 <ref id="gotoy" name="gotoy">,
2244 <ref id="wherex" name="wherex">,
2245 <ref id="wherey" name="wherey">
2251 <sect1>gotoy<label id="gotoy"><p>
2255 <tag/Function/Move the text mode cursor to a new Y position.
2256 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2257 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
2258 <tag/Description/The function moves the text mode cursor to the specified Y
2259 position while leaving the X position untouched. The uppermost position on the
2260 screen has the coordinate 0.
2261 <tag/Limits/<itemize>
2262 <item>The function is only available as fastcall function, so it may
2263 only be used in presence of a prototype.
2264 <item>Invalid values for the Y position (out of screen coordinates) may lead
2265 to undefined behaviour.
2267 <tag/Availability/cc65
2269 <ref id="gotox" name="gotox">,
2270 <ref id="gotoxy" name="gotoxy">,
2271 <ref id="wherex" name="wherex">,
2272 <ref id="wherey" name="wherey">
2278 <sect1>isalnum<label id="isalnum"><p>
2282 <tag/Function/Check if a given character is a letter or digit.
2283 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2284 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
2285 <tag/Description/The function returns a value of zero if the given argument
2286 is a letter or digit. The return value is non zero if the character
2288 <tag/Limits/<itemize>
2289 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2290 inline sequence generated by the macro will not work correctly for values
2291 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2292 this range. The non inline function may be accessed by <tt/#undef/'ing
2294 <item>When compiling without <tt/-Os/, the function is only available as
2295 fastcall function, so it may only be used in presence of a prototype.
2297 <tag/Availability/ISO 9899
2299 <ref id="isalpha" name="isalpha">,
2300 <ref id="isascii" name="isascii">,
2301 <ref id="isblank" name="isblank">,
2302 <ref id="iscntrl" name="iscntrl">,
2303 <ref id="isdigit" name="isdigit">,
2304 <ref id="isgraph" name="isgraph">,
2305 <ref id="islower" name="islower">,
2306 <ref id="isprint" name="isprint">,
2307 <ref id="ispunct" name="ispunct">,
2308 <ref id="isspace" name="isspace">,
2309 <ref id="isupper" name="isupper">,
2310 <ref id="isxdigit" name="isxdigit">
2316 <sect1>isalpha<label id="isalpha"><p>
2320 <tag/Function/Check if a given character is a letter.
2321 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2322 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
2323 <tag/Description/The function returns a value of zero if the given argument
2324 is a letter. The return value is non zero if the character is anything else.
2325 <tag/Limits/<itemize>
2326 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2327 inline sequence generated by the macro will not work correctly for values
2328 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2329 this range. The non inline function may be accessed by <tt/#undef/'ing the
2331 <item>When compiling without <tt/-Os/, the function is only available as
2332 fastcall function, so it may only be used in presence of a prototype.
2334 <tag/Availability/ISO 9899
2336 <ref id="isalnum" name="isalnum">,
2337 <ref id="isascii" name="isascii">,
2338 <ref id="isblank" name="isblank">,
2339 <ref id="iscntrl" name="iscntrl">,
2340 <ref id="isdigit" name="isdigit">,
2341 <ref id="isgraph" name="isgraph">,
2342 <ref id="islower" name="islower">,
2343 <ref id="isprint" name="isprint">,
2344 <ref id="ispunct" name="ispunct">,
2345 <ref id="isspace" name="isspace">,
2346 <ref id="isupper" name="isupper">,
2347 <ref id="isxdigit" name="isxdigit">
2353 <sect1>isascii<label id="isascii"><p>
2357 <tag/Function/Check if a given character is in the ASCII (0..127) range.
2358 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2359 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
2360 <tag/Description/The function returns a value of zero if the given argument
2361 is in the range 0..127 (the range of valid ASCII characters) and a non zero
2363 <tag/Limits/<itemize>
2364 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2365 inline sequence generated by the macro will not work correctly for values
2366 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2367 this range. The non inline function may be accessed by <tt/#undef/'ing the
2369 <item>When compiling without <tt/-Os/, the function is only available as
2370 fastcall function, so it may only be used in presence of a prototype.
2372 <tag/Availability/ISO 9899
2374 <ref id="isalnum" name="isalnum">,
2375 <ref id="isalpha" name="isalpha">,
2376 <ref id="isblank" name="isblank">,
2377 <ref id="iscntrl" name="iscntrl">,
2378 <ref id="isdigit" name="isdigit">,
2379 <ref id="isgraph" name="isgraph">,
2380 <ref id="islower" name="islower">,
2381 <ref id="isprint" name="isprint">,
2382 <ref id="ispunct" name="ispunct">,
2383 <ref id="isspace" name="isspace">,
2384 <ref id="isupper" name="isupper">,
2385 <ref id="isxdigit" name="isxdigit">
2391 <sect1>isblank<label id="isblank"><p>
2395 <tag/Function/Check if a given character is a space or tab.
2396 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2397 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
2398 <tag/Description/The function returns a value of zero if the given argument
2399 is a space or tab character. The return value is non zero if the character
2401 <tag/Limits/<itemize>
2402 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2403 inline sequence generated by the macro will not work correctly for values
2404 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2405 this range. The non inline function may be accessed by <tt/#undef/'ing the
2407 <item>When compiling without <tt/-Os/, the function is only available as
2408 fastcall function, so it may only be used in presence of a prototype.
2410 <tag/Availability/cc65
2412 <ref id="isalnum" name="isalnum">,
2413 <ref id="isalpha" name="isalpha">,
2414 <ref id="isascii" name="isascii">,
2415 <ref id="iscntrl" name="iscntrl">,
2416 <ref id="isdigit" name="isdigit">,
2417 <ref id="isgraph" name="isgraph">,
2418 <ref id="islower" name="islower">,
2419 <ref id="isprint" name="isprint">,
2420 <ref id="ispunct" name="ispunct">,
2421 <ref id="isspace" name="isspace">,
2422 <ref id="isupper" name="isupper">,
2423 <ref id="isxdigit" name="isxdigit">
2429 <sect1>iscntrl<label id="iscntrl"><p>
2433 <tag/Function/Check if a given character is a control character.
2434 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2435 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
2436 <tag/Description/The function returns a value of zero if the given argument
2437 is a control character. The return value is non zero if the character
2439 <tag/Limits/<itemize>
2440 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2441 inline sequence generated by the macro will not work correctly for values
2442 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2443 this range. The non inline function may be accessed by <tt/#undef/'ing the
2445 <item>When compiling without <tt/-Os/, the function is only available as
2446 fastcall function, so it may only be used in presence of a prototype.
2448 <tag/Availability/ISO 9899
2450 <ref id="isalnum" name="isalnum">,
2451 <ref id="isalpha" name="isalpha">,
2452 <ref id="isascii" name="isascii">,
2453 <ref id="isblank" name="isblank">,
2454 <ref id="isdigit" name="isdigit">,
2455 <ref id="isgraph" name="isgraph">,
2456 <ref id="islower" name="islower">,
2457 <ref id="isprint" name="isprint">,
2458 <ref id="ispunct" name="ispunct">,
2459 <ref id="isspace" name="isspace">,
2460 <ref id="isupper" name="isupper">,
2461 <ref id="isxdigit" name="isxdigit">
2467 <sect1>isdigit<label id="isdigit"><p>
2471 <tag/Function/Check if a given character is a digit.
2472 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2473 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
2474 <tag/Description/The function returns a value of zero if the given argument
2475 is a digit. The return value is non zero if the character is anything else.
2476 <tag/Limits/<itemize>
2477 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2478 inline sequence generated by the macro will not work correctly for values
2479 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2480 this range. The non inline function may be accessed by <tt/#undef/'ing the
2482 <item>When compiling without <tt/-Os/, the function is only available as
2483 fastcall function, so it may only be used in presence of a prototype.
2485 <tag/Availability/ISO 9899
2487 <ref id="isalnum" name="isalnum">,
2488 <ref id="isalpha" name="isalpha">,
2489 <ref id="isascii" name="isascii">,
2490 <ref id="isblank" name="isblank">,
2491 <ref id="iscntrl" name="iscntrl">,
2492 <ref id="isgraph" name="isgraph">,
2493 <ref id="islower" name="islower">,
2494 <ref id="isprint" name="isprint">,
2495 <ref id="ispunct" name="ispunct">,
2496 <ref id="isspace" name="isspace">,
2497 <ref id="isupper" name="isupper">,
2498 <ref id="isxdigit" name="isxdigit">
2504 <sect1>isgraph<label id="isgraph"><p>
2508 <tag/Function/Check if a given character is a printable character (except
2510 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2511 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
2512 <tag/Description/The function returns a value of zero if the given argument
2513 is a printable character with the exception of space. The return value is non
2514 zero if the character is anything else.
2515 <tag/Limits/<itemize>
2516 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2517 inline sequence generated by the macro will not work correctly for values
2518 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2519 this range. The non inline function may be accessed by <tt/#undef/'ing the
2521 <item>When compiling without <tt/-Os/, the function is only available as
2522 fastcall function, so it may only be used in presence of a prototype.
2524 <tag/Availability/ISO 9899
2526 <ref id="isalnum" name="isalnum">,
2527 <ref id="isalpha" name="isalpha">,
2528 <ref id="isascii" name="isascii">,
2529 <ref id="isblank" name="isblank">,
2530 <ref id="iscntrl" name="iscntrl">,
2531 <ref id="isdigit" name="isdigit">,
2532 <ref id="islower" name="islower">,
2533 <ref id="isprint" name="isprint">,
2534 <ref id="ispunct" name="ispunct">,
2535 <ref id="isspace" name="isspace">,
2536 <ref id="isupper" name="isupper">,
2537 <ref id="isxdigit" name="isxdigit">
2543 <sect1>islower<label id="islower"><p>
2547 <tag/Function/Check if a given character is a lower case letter.
2548 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2549 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
2550 <tag/Description/The function returns a value of zero if the given argument
2551 is a lower case letter. The return value is non zero if the character is
2553 <tag/Limits/<itemize>
2554 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2555 inline sequence generated by the macro will not work correctly for values
2556 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2557 this range. The non inline function may be accessed by <tt/#undef/'ing the
2559 <item>When compiling without <tt/-Os/, the function is only available as
2560 fastcall function, so it may only be used in presence of a prototype.
2562 <tag/Availability/ISO 9899
2564 <ref id="isalnum" name="isalnum">,
2565 <ref id="isalpha" name="isalpha">,
2566 <ref id="isascii" name="isascii">,
2567 <ref id="isblank" name="isblank">,
2568 <ref id="iscntrl" name="iscntrl">,
2569 <ref id="isdigit" name="isdigit">,
2570 <ref id="isgraph" name="isgraph">,
2571 <ref id="isprint" name="isprint">,
2572 <ref id="ispunct" name="ispunct">,
2573 <ref id="isspace" name="isspace">,
2574 <ref id="isupper" name="isupper">,
2575 <ref id="isxdigit" name="isxdigit">
2581 <sect1>isprint<label id="isprint"><p>
2585 <tag/Function/Check if a given character is a printable character.
2586 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2587 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
2588 <tag/Description/The function returns a value of zero if the given argument
2589 is a printable character (this includes the space character). The return value
2590 is non zero if the character is anything else.
2591 <tag/Limits/<itemize>
2592 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2593 inline sequence generated by the macro will not work correctly for values
2594 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2595 this range. The non inline function may be accessed by <tt/#undef/'ing the
2597 <item>When compiling without <tt/-Os/, the function is only available as
2598 fastcall function, so it may only be used in presence of a prototype.
2600 <tag/Availability/ISO 9899
2602 <ref id="isalnum" name="isalnum">,
2603 <ref id="isalpha" name="isalpha">,
2604 <ref id="isascii" name="isascii">,
2605 <ref id="isblank" name="isblank">,
2606 <ref id="iscntrl" name="iscntrl">,
2607 <ref id="isdigit" name="isdigit">,
2608 <ref id="isgraph" name="isgraph">,
2609 <ref id="islower" name="islower">,
2610 <ref id="ispunct" name="ispunct">,
2611 <ref id="isspace" name="isspace">,
2612 <ref id="isupper" name="isupper">,
2613 <ref id="isxdigit" name="isxdigit">
2619 <sect1>ispunct<label id="ispunct"><p>
2623 <tag/Function/Check if a given character is a printable character but not a
2624 space or an alphanumeric character.
2625 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2626 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
2627 <tag/Description/The function returns a value of zero if the given argument
2628 is a printable character, but not a space or anything alphanumeric. The return
2629 value is non zero if the character is anything else.
2630 <tag/Limits/<itemize>
2631 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2632 inline sequence generated by the macro will not work correctly for values
2633 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2634 this range. The non inline function may be accessed by <tt/#undef/'ing the
2636 <item>When compiling without <tt/-Os/, the function is only available as
2637 fastcall function, so it may only be used in presence of a prototype.
2639 <tag/Availability/ISO 9899
2641 <ref id="isalnum" name="isalnum">,
2642 <ref id="isalpha" name="isalpha">,
2643 <ref id="isascii" name="isascii">,
2644 <ref id="isblank" name="isblank">,
2645 <ref id="iscntrl" name="iscntrl">,
2646 <ref id="isdigit" name="isdigit">,
2647 <ref id="isgraph" name="isgraph">,
2648 <ref id="islower" name="islower">,
2649 <ref id="isprint" name="isprint">,
2650 <ref id="isspace" name="isspace">,
2651 <ref id="isupper" name="isupper">,
2652 <ref id="isxdigit" name="isxdigit">
2658 <sect1>isspace<label id="isspace"><p>
2662 <tag/Function/Check if a given character is a a white-space character.
2663 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2664 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
2665 <tag/Description/The function returns a value of zero if the given argument
2666 is a white space character. The return value is non zero if the character is
2667 anything else. The standard white space characters are: space, formfeed ('\f'),
2668 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
2670 <tag/Limits/<itemize>
2671 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2672 inline sequence generated by the macro will not work correctly for values
2673 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2674 this range. The non inline function may be accessed by <tt/#undef/'ing the
2676 <item>When compiling without <tt/-Os/, the function is only available as
2677 fastcall function, so it may only be used in presence of a prototype.
2679 <tag/Availability/ISO 9899
2681 <ref id="isalnum" name="isalnum">,
2682 <ref id="isalpha" name="isalpha">,
2683 <ref id="isascii" name="isascii">,
2684 <ref id="isblank" name="isblank">,
2685 <ref id="iscntrl" name="iscntrl">,
2686 <ref id="isdigit" name="isdigit">,
2687 <ref id="isgraph" name="isgraph">,
2688 <ref id="islower" name="islower">,
2689 <ref id="isprint" name="isprint">,
2690 <ref id="ispunct" name="ispunct">,
2691 <ref id="isupper" name="isupper">,
2692 <ref id="isxdigit" name="isxdigit">
2698 <sect1>isupper<label id="isupper"><p>
2702 <tag/Function/Check if a given character is an upper case letter.
2703 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2704 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
2705 <tag/Description/The function returns a value of zero if the given argument
2706 is an upper case letter. The return value is non zero if the character is
2708 <tag/Limits/<itemize>
2709 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2710 inline sequence generated by the macro will not work correctly for values
2711 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2712 this range. The non inline function may be accessed by <tt/#undef/'ing the
2714 <item>When compiling without <tt/-Os/, the function is only available as
2715 fastcall function, so it may only be used in presence of a prototype.
2717 <tag/Availability/ISO 9899
2719 <ref id="isalnum" name="isalnum">,
2720 <ref id="isalpha" name="isalpha">,
2721 <ref id="isascii" name="isascii">,
2722 <ref id="isblank" name="isblank">,
2723 <ref id="iscntrl" name="iscntrl">,
2724 <ref id="isdigit" name="isdigit">,
2725 <ref id="isgraph" name="isgraph">,
2726 <ref id="islower" name="islower">,
2727 <ref id="isprint" name="isprint">,
2728 <ref id="ispunct" name="ispunct">,
2729 <ref id="isspace" name="isspace">,
2730 <ref id="isxdigit" name="isxdigit">
2736 <sect1>isxdigit<label id="isxdigit"><p>
2740 <tag/Function/Check if a given character is a hexadecimal digit.
2741 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2742 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
2743 <tag/Description/The function returns a value of zero if the given argument
2744 is a hexadecimal digit (0..9, a..f and A..F). The return value is non zero
2745 if the character is anything else.
2746 <tag/Limits/<itemize>
2747 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2748 inline sequence generated by the macro will not work correctly for values
2749 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2750 this range. The non inline function may be accessed by <tt/#undef/'ing the
2752 <item>When compiling without <tt/-Os/, the function is only available as
2753 fastcall function, so it may only be used in presence of a prototype.
2755 <tag/Availability/ISO 9899
2757 <ref id="isalnum" name="isalnum">,
2758 <ref id="isalpha" name="isalpha">,
2759 <ref id="isascii" name="isascii">,
2760 <ref id="isblank" name="isblank">,
2761 <ref id="iscntrl" name="iscntrl">,
2762 <ref id="isdigit" name="isdigit">,
2763 <ref id="isgraph" name="isgraph">,
2764 <ref id="islower" name="islower">,
2765 <ref id="isprint" name="isprint">,
2766 <ref id="ispunct" name="ispunct">,
2767 <ref id="isspace" name="isspace">,
2768 <ref id="isupper" name="isupper">
2774 <sect1>itoa<label id="itoa"><p>
2778 <tag/Function/Convert an integer into a string.
2779 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2780 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
2781 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
2782 <tt/radix/ as the base.
2783 <tag/Limits/<itemize>
2784 <item>There are no provisions to prevent a buffer overflow.
2785 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
2786 <item>The function is non standard, so it is not available in strict ANSI mode.
2787 You should probably use <tt/sprintf/ instead.
2788 <item>The function is only available as fastcall function, so it may only be
2789 used in presence of a prototype.
2791 <tag/Availability/cc65
2793 <ref id="atoi" name="atoi">,
2794 <ref id="atol" name="atol">,
2795 <ref id="ltoa" name="ltoa">,
2796 <ref id="ultoa" name="ultoa">,
2797 <ref id="utoa" name="utoa">
2803 <sect1>joy_count<label id="joy_count"><p>
2807 <tag/Function/Return the number of joysticks supported by the current driver.
2808 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2809 <tag/Declaration/<tt/unsigned char __fastcall__ joy_count (void);/
2810 <tag/Description/The function returns a the number of joysticks supported
2811 by the current joystick driver.
2812 <tag/Limits/<itemize>
2813 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
2814 name="joy_load_driver"> before calling this function.
2815 <item>The function returns the number of joysticks supported by the driver.
2816 There's no way to check for the number of actually connected joysticks.
2817 <item>The function is only available as fastcall function, so it may only be
2818 used in presence of a prototype.
2820 <tag/Availability/cc65
2822 <ref id="joy_load_driver" name="joy_load_driver">,
2823 <ref id="joy_read" name="joy_read">
2829 <sect1>joy_install<label id="joy_install"><p>
2833 <tag/Function/Install an already loaded driver and return an error code.
2834 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2835 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
2836 <tag/Description/The function installs a driver that was already loaded into
2837 memory (or linked statically to the program). It returns an error code
2838 (<tt/JOY_ERR_OK/ in case of success).
2839 <tag/Limits/<itemize>
2840 <item>The function is only available as fastcall function, so it may only be
2841 used in presence of a prototype.
2843 <tag/Availability/cc65
2845 <ref id="joy_load_driver" name="joy_load_driver">,
2846 <ref id="joy_uninstall" name="joy_uninstall">,
2847 <ref id="joy_unload" name="joy_unload">
2853 <sect1>joy_load_driver<label id="joy_load_driver"><p>
2857 <tag/Function/Load a driver from disk and install it.
2858 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2859 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
2860 <tag/Description/The function loads a driver with the given name from disk
2861 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
2862 driver was successfully loaded and installed.
2863 <tag/Limits/<itemize>
2864 <item>The function is only available as fastcall function, so it may only be
2865 used in presence of a prototype.
2867 <tag/Availability/cc65
2869 <ref id="joy_install" name="joy_install">,
2870 <ref id="joy_uninstall" name="joy_uninstall">,
2871 <ref id="joy_unload" name="joy_unload">
2877 <sect1>joy_read<label id="joy_read"><p>
2881 <tag/Function/Read the status of a joystick.
2882 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2883 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
2884 <tag/Description/The function reads the status bits for a joystick. The number
2885 of the joystick is passed as parameter. The result may be examined by using one
2886 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
2887 <tag/Limits/<itemize>
2888 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
2889 name="joy_load_driver"> before calling this function.
2890 <item>The function is only available as fastcall function, so it may only be
2891 used in presence of a prototype.
2893 <tag/Availability/cc65
2895 <ref id="joy_count" name="joy_count">,
2896 <ref id="joy_load_driver" name="joy_load_driver">,
2897 <ref id="joy_unload" name="joy_unload">
2903 <sect1>joy_uninstall<label id="joy_uninstall"><p>
2907 <tag/Function/Uninstall the current joystick driver.
2908 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2909 <tag/Declaration/<tt/unsigned char __fastcall__ joy_uninstall (void);/
2910 <tag/Description/The function uninstalls the currently installed joystick
2911 driver. It does not remove the driver from memory. The function returns an
2912 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
2913 <tag/Limits/<itemize>
2914 <item>A joystick driver must be installed using <ref id="joy_install"
2915 name="joy_install"> before calling this function.
2916 <item>The function is only available as fastcall function, so it may only be
2917 used in presence of a prototype.
2919 <tag/Availability/cc65
2921 <ref id="joy_install" name="joy_install">,
2922 <ref id="joy_load_driver" name="joy_load_driver">,
2923 <ref id="joy_unload" name="joy_unload">
2929 <sect1>joy_unload<label id="joy_unload"><p>
2933 <tag/Function/Uninstall, then unload the current joystick driver.
2934 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2935 <tag/Declaration/<tt/unsigned char __fastcall__ joy_unload (void);/
2936 <tag/Description/The function uninstalls the currently installed joystick
2937 driver and removes it from memory. An error code is returned, which is
2938 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
2939 <tag/Limits/<itemize>
2940 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
2941 name="joy_load_driver"> before calling this function.
2942 <item>The function is only available as fastcall function, so it may only be
2943 used in presence of a prototype.
2945 <tag/Availability/cc65
2947 <ref id="joy_load_driver" name="joy_load_driver">
2953 <sect1>kbhit<label id="kbhit"><p>
2957 <tag/Function/Check if there's a key waiting in the keyboard buffer.
2958 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2959 <tag/Declaration/<tt/unsigned char kbhit (void);/
2960 <tag/Description/The function returns a value of zero if there is no character
2961 waiting to be read from the keyboard. It returns non zero otherwise.
2962 <tag/Limits/<itemize>
2963 <item>If the system does not support a keyboard buffer (most systems
2964 do), the function is rather useless.
2966 <tag/Availability/cc65
2968 <ref id="cgetc" name="cgetc">,
2969 <ref id="cursor" name="cursor">
2975 <sect1>labs<label id="labs"><p>
2979 <tag/Function/Returns the absolute value of a long integer.
2980 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2981 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
2982 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
2984 <tag/Limits/<itemize>
2985 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
2986 <item>The function is only available as fastcall function, so it may only be
2987 used in presence of a prototype.
2989 <tag/Availability/ISO 9899
2991 <ref id="abs" name="abs">
2997 <sect1>ltoa<label id="ltoa"><p>
3001 <tag/Function/Convert a long integer into a string.
3002 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3003 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
3004 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
3005 using <tt/radix/ as the base.
3006 <tag/Limits/<itemize>
3007 <item>There are no provisions to prevent a buffer overflow.
3008 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
3009 <item>The function is non standard, so it is not available in strict ANSI mode.
3010 You should probably use <tt/sprintf/ instead.
3011 <item>The function is only available as fastcall function, so it may only be
3012 used in presence of a prototype.
3014 <tag/Availability/cc65
3016 <ref id="atoi" name="atoi">,
3017 <ref id="atol" name="atol">,
3018 <ref id="itoa" name="itoa">,
3019 <ref id="ultoa" name="ultoa">,
3020 <ref id="utoa" name="utoa">
3026 <sect1>localeconv<label id="localeconv"><p>
3030 <tag/Function/Returns a pointer to the current locale structure.
3031 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
3032 <tag/Declaration/<tt/struct lconv* localeconv (void);/
3033 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
3035 <tag/Limits/<itemize>
3036 <item>cc65 supports only the "C" locale, so even after setting a new locale
3037 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
3040 <tag/Availability/ISO 9899
3042 <ref id="setlocale" name="setlocale">
3048 <sect1>longjmp<label id="longjmp"><p>
3052 <tag/Function/Non local goto.
3053 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
3054 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
3055 <tag/Description/The <tt/longjmp/ function restores a program context from the
3056 data in <tt/buf/, which must have been set by a preceeding call to
3057 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
3058 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
3062 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
3063 was called with a value of one.
3064 <item>The function is only available as fastcall function, so it may only
3065 be used in presence of a prototype.
3067 <tag/Availability/ISO 9899
3069 <ref id="setjmp" name="setjmp">
3075 <sect1>malloc<label id="malloc"><p>
3079 <tag/Function/Allocate dynamic memory.
3080 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3081 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
3082 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
3083 pointer to the allocated memory block. On error (not enough memory available),
3084 <tt/malloc/ returns <tt/NULL/.
3087 <item>The function is only available as fastcall function, so it may only
3088 be used in presence of a prototype.
3090 <tag/Availability/ISO 9899
3092 <ref id="_heapadd" name="_heapadd">,
3093 <ref id="_heapblocksize" name="_heapblocksize">,
3094 <ref id="_heapmaxavail" name="_heapmaxavail">,
3095 <ref id="_heapmemavail" name="_heapmemavail">,
3096 <ref id="calloc" name="calloc">,
3097 <ref id="free" name="free">,
3098 <ref id="realloc" name="realloc">,
3099 <ref id="strdup" name="strdup">
3105 <sect1>memchr<label id="memchr"><p>
3109 <tag/Function/Search for a character in a block of raw memory.
3110 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3111 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
3112 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
3113 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
3114 that is of size <tt/count/. Upon completion, the function returns a pointer to
3115 the character found, or a null pointer if the character was not found.
3116 <tag/Limits/<itemize>
3117 <item>The function is only available as fastcall function, so it may only
3118 be used in presence of a prototype.
3120 <tag/Availability/ISO 9899
3122 <ref id="strchr" name="strchr">
3128 <sect1>memcpy<label id="memcpy"><p>
3132 <tag/Function/Copy a memory area.
3133 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3134 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
3135 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
3136 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
3140 <item>The result is undefined if the memory areas do overlap. Use
3141 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
3142 <item>The function is only available as fastcall function, so it may only
3143 be used in presence of a prototype.
3145 <tag/Availability/ISO 9899
3147 <ref id="_swap" name="_swap">,
3148 <ref id="memmove" name="memmove">,
3149 <ref id="memset" name="memset">
3155 <sect1>memmove<label id="memmove"><p>
3159 <tag/Function/Copy a memory area.
3160 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3161 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
3162 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
3163 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
3167 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
3168 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
3169 <item>The function is only available as fastcall function, so it may only
3170 be used in presence of a prototype.
3172 <tag/Availability/ISO 9899
3174 <ref id="_swap" name="_swap">,
3175 <ref id="memcpy" name="memcpy">,
3176 <ref id="memset" name="memset">
3182 <sect1>memset<label id="memset"><p>
3186 <tag/Function/Fill a memory area.
3187 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3188 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
3189 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
3190 the value <tt/val/. The function returns <tt/p/.
3193 <item>The function is only available as fastcall function, so it may only
3194 be used in presence of a prototype.
3196 <tag/Availability/ISO 9899
3198 <ref id="_swap" name="_swap">,
3199 <ref id="bzero" name="bzero">,
3200 <ref id="memcpy" name="memcpy">,
3201 <ref id="memmove" name="memmove">
3207 <sect1>mod_free<label id="mod_free"><p>
3211 <tag/Function/Free a relocatable module.
3212 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
3213 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
3214 <tag/Description/The function will free a module loaded into memory by use of
3215 the <tt/<ref id="mod_load" name="mod_load">/ function.
3216 <tag/Limits/<itemize>
3217 <item>The pointer passed as parameter is the pointer to the module memory,
3218 not the pointer to the control structure.
3220 <tag/Availability/cc65
3222 <ref id="mod_load" name="mod_load">
3228 <sect1>mod_load<label id="mod_load"><p>
3232 <tag/Function/Load a relocatable module.
3233 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
3234 <tag/Declaration/<tt/unsigned char mod_load (struct mod_ctrl* ctrl);/
3235 <tag/Description/The function will load a code module into memory and relocate
3236 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
3237 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
3238 the module just loaded. Possible error codes are:
3240 <item><tt/MLOAD_OK/ - Module load successful
3241 <item><tt/MLOAD_ERR_READ/ - Read error
3242 <item><tt/MLOAD_ERR_HDR/ - Header error
3243 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
3244 <item><tt/MLOAD_ERR_FMT/ - Data format error
3245 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
3247 <tag/Limits/<itemize>
3248 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
3249 relocatable o65 modules for use with this function.
3251 <tag/Availability/cc65
3253 <ref id="mod_free" name="mod_free">
3259 <sect1>mouse_setbox<label id="mouse_setbox"><p>
3263 <tag/Function/Specify a bounding box for the mouse cursor.
3264 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3265 <tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
3266 <tag/Description/The function allows to set a bounding box for mouse movement.
3267 <tag/Limits/<itemize>
3268 <item>The function does not check if the mouse cursor is currently within the
3269 given rectangle. Placing the mouse cursor within the bounding box is the
3270 responsibility of the programmer.
3271 <item>While the bounding box may be larger than the actual screen size, the
3272 standard mouse cursor draw routines may fail to set the cursor to coordinates
3273 outside of the screen area. Depending on the platform, you may have to supply
3274 your own mouse cursor routines.
3275 <item>The function is only available as fastcall function, so it may only be
3276 used in presence of a prototype.
3278 <tag/Availability/cc65
3280 <ref id="mouse_getbox" name="mouse_getbox">,
3281 <ref id="mouse_move" name="mouse_move">
3287 <sect1>mouse_getbox<label id="mouse_getbox"><p>
3291 <tag/Function/Return the current bounding box for the mouse cursor.
3292 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3293 <tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
3294 <tag/Description/The function queries the current bounding box for mouse
3296 <tag/Limits/<itemize>
3297 <item>The function is only available as fastcall function, so it may only be
3298 used in presence of a prototype.
3300 <tag/Availability/cc65
3302 <ref id="mouse_move" name="mouse_move">,
3303 <ref id="mouse_setbox" name="mouse_setbox">
3309 <sect1>mouse_buttons<label id="mouse_buttons"><p>
3313 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
3314 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3315 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_buttons (void);/
3316 <tag/Description/The function returns a bit mask that encodes the state of the
3317 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
3319 <tag/Limits/<itemize>
3320 <item>The function is only available as fastcall function, so it may only be
3321 used in presence of a prototype.
3323 <tag/Availability/cc65
3325 <ref id="mouse_info" name="mouse_info">,
3326 <ref id="mouse_pos" name="mouse_pos">
3332 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
3336 <tag/Function/Return a readable error message for an error code.
3337 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3338 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
3340 <tag/Description/The function returns an error message (in english) for the
3341 error code passed parameter.
3342 <tag/Limits/<itemize>
3343 <item>The function will return "Unknown error" for invalid error codes.
3344 <item>The function is only available as fastcall function, so it may only be
3345 used in presence of a prototype.
3347 <tag/Availability/cc65
3349 <ref id="mouse_load_driver" name="mouse_load_driver">,
3350 <ref id="mouse_uninstall" name="mouse_uninstall">,
3351 <ref id="mouse_unload" name="mouse_unload">
3357 <sect1>mouse_hide<label id="mouse_hide"><p>
3361 <tag/Function/Hide the mouse pointer.
3362 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3363 <tag/Declaration/<tt/void __fastcall__ mouse_hide (void);/
3364 <tag/Description/The function hides the mouse pointer. It manages a counter
3365 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
3366 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
3367 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
3369 <tag/Limits/<itemize>
3370 <item>The function is only available as fastcall function, so it may only be
3371 used in presence of a prototype.
3373 <tag/Availability/cc65
3375 <ref id="mouse_show" name="mouse_show">
3381 <sect1>mouse_info<label id="mouse_info"><p>
3385 <tag/Function/Return the state of the mouse buttons and the position of the
3387 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3388 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
3389 <tag/Description/The function returns the state of the mouse buttons and the
3390 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
3391 <tag/Limits/<itemize>
3392 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
3393 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
3394 name="mouse_pos">/ instead.
3395 <item>The function is only available as fastcall function, so it may only be
3396 used in presence of a prototype.
3398 <tag/Availability/cc65
3400 <ref id="mouse_buttons" name="mouse_buttons">,
3401 <ref id="mouse_pos" name="mouse_pos">
3407 <sect1>mouse_install<label id="mouse_install"><p>
3411 <tag/Function/Install an already loaded mouse driver.
3412 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3413 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
3414 mouse_callbacks* c, void* driver);/
3415 <tag/Description/The function installs an already loaded mouse driver and
3416 returns an error code. The <tt/mouse_callbacks/ structure passed as first
3417 parameter contains pointers to routines needed to move or hide/show the mouse
3418 pointer. Defaults for these routines are supplied by the library, so if you
3419 can live with these defaults (which are platform specific), just pass a
3420 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
3421 driver linked statically to the program.
3422 <tag/Limits/<itemize>
3423 <item>Not all drivers are able to detect if the supported hardware is really
3425 <item>After installing a driver, the mouse cursor is hidden.
3426 <item>The function is only available as fastcall function, so it may only be
3427 used in presence of a prototype.
3429 <tag/Availability/cc65
3431 <ref id="mouse_load_driver" name="mouse_load_driver">,
3432 <ref id="mouse_uninstall" name="mouse_uninstall">,
3433 <ref id="mouse_unload" name="mouse_unload">
3439 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
3443 <tag/Function/Call the driver specific ioctl function.
3444 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3445 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
3446 <tag/Description/The function calls the IOCTL entry in the mouse driver,
3447 which is driver specific. The <tt/code/ parameter will choose between
3448 different IOCTL functions, and the <tt/data/ depends on code. The
3449 function returns an error code. The purpose of this function is to allow
3450 for driver specific extensions. See the documentation for a specific mouse
3451 driver for supported ioctl calls.
3452 <tag/Limits/<itemize>
3453 <item>Calling this function is non portable, because each driver may
3454 implement different ioctl calls (or none at all).
3455 <item>The function is only available as fastcall function, so it may only be
3456 used in presence of a prototype.
3458 <tag/Availability/cc65
3464 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
3468 <tag/Function/Load and initialize a mouse driver.
3469 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3470 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
3471 mouse_callbacks* c, const char* driver);/
3472 <tag/Description/Load a mouse driver into memory and initialize it. The
3473 function returns an error code that tells if the call has been successful. The
3474 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
3475 routines needed to move or hide/show the mouse pointer. Defaults for these
3476 routines are supplied by the library, so if you can live with these defaults
3477 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
3478 <tag/Limits/<itemize>
3479 <item>The driver is loaded by name, so currently you must know the type of
3480 mouse that should be supported. There is no autodetect capability.
3481 <item>Not all drivers are able to detect if the supported hardware is really
3483 <item>After installing a driver, the mouse cursor is hidden.
3484 <item>The function is only available as fastcall function, so it may only be
3485 used in presence of a prototype.
3487 <tag/Availability/cc65
3489 <ref id="mouse_install" name="mouse_install">,
3490 <ref id="mouse_uninstall" name="mouse_uninstall">,
3491 <ref id="mouse_unload" name="mouse_unload">
3497 <sect1>mouse_move<label id="mouse_move"><p>
3501 <tag/Function/Move the mouse cursor to a specific position.
3502 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3503 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
3504 <tag/Description/The function updates the mouse position. If the mouse cursor
3505 is visible, it is shown at the new position.
3506 <tag/Limits/<itemize>
3507 <item>The function does not check if the new position is within the bounding
3508 box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
3509 <item>The function is only available as fastcall function, so it may only be
3510 used in presence of a prototype.
3512 <tag/Availability/cc65
3514 <ref id="mouse_getbox" name="mouse_getbox">,
3515 <ref id="mouse_setbox" name="mouse_setbox">
3521 <sect1>mouse_pos<label id="mouse_pos"><p>
3525 <tag/Function/Return the position of the mouse.
3526 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3527 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
3528 <tag/Description/The function returns the position of the mouse in the
3529 <tt/mouse_pos/ structure passed as parameter.
3530 <tag/Limits/<itemize>
3531 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
3532 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
3533 name="mouse_info">/ instead.
3534 <item>The function is only available as fastcall function, so it may only be
3535 used in presence of a prototype.
3537 <tag/Availability/cc65
3539 <ref id="mouse_buttons" name="mouse_buttons">,
3540 <ref id="mouse_info" name="mouse_info">
3546 <sect1>mouse_show<label id="mouse_show"><p>
3550 <tag/Function/Show the mouse pointer.
3551 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3552 <tag/Declaration/<tt/void __fastcall__ mouse_show (void);/
3553 <tag/Description/The function shows the mouse pointer. It manages a counter
3554 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
3555 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
3556 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
3557 <tag/Limits/<itemize>
3558 <item>The function is only available as fastcall function, so it may only be
3559 used in presence of a prototype.
3561 <tag/Availability/cc65
3563 <ref id="mouse_hide" name="mouse_hide">
3569 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
3573 <tag/Function/Uninstall an already loaded mouse driver.
3574 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3575 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (void);/
3576 <tag/Description/The function uninstalls an already loaded mouse driver but
3577 don't removes it from memory.
3578 <tag/Limits/<itemize>
3579 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
3580 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
3581 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
3583 <item>The function is only available as fastcall function, so it may only be
3584 used in presence of a prototype.
3586 <tag/Availability/cc65
3588 <ref id="mouse_install" name="mouse_install">,
3589 <ref id="mouse_load_driver" name="mouse_load_driver">,
3590 <ref id="mouse_unload" name="mouse_unload">
3596 <sect1>mouse_unload<label id="mouse_unload"><p>
3600 <tag/Function/Unload a mouse driver.
3601 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3602 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_unload (void);/
3603 <tag/Description/The function unloads a loaded mouse driver and frees all
3604 memory allocated for the driver.
3605 <tag/Limits/<itemize>
3606 <item>The function does nothing if no driver is loaded.
3608 <tag/Availability/cc65
3610 <ref id="mouse_install" name="mouse_install">,
3611 <ref id="mouse_load_driver" name="mouse_load_driver">,
3612 <ref id="mouse_uninstall" name="mouse_uninstall">
3618 <sect1>offsetof<label id="offsetof"><p>
3622 <tag/Function/Calculate the offset of a struct or union member.
3623 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
3624 <tag/Declaration/<tt/size_t offsetof (type, member);/
3625 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
3626 or <tt/union/ member.
3627 <tag/Limits/<itemize>
3628 <item>The function is actually a macro.
3630 <tag/Availability/ISO 9899
3636 <sect1>open<label id="open"><p>
3640 <tag/Function/Open and possibly create a file.
3641 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
3642 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
3643 <tag/Description/<tt/open/ opens a file and returns the file descriptor
3644 associated with it. On error, -1 is returned and an error code is stored in
3645 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
3646 <tag/Limits/<itemize>
3647 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
3648 open, which is used as the permission mask when a new file is created. While
3649 cc65 allows to pass this argument, it is ignored.
3651 <tag/Availability/POSIX 1003.1
3653 <ref id="close" name="close">,
3654 <ref id="creat" name="creat">
3660 <sect1>peekbsys<label id="peekbsys"><p>
3664 <tag/Function/Read one byte from a location in the system bank.
3665 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3666 <tt/<ref id="cbm510.h" name="cbm510.h">/
3667 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
3668 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
3669 system bank (bank 15) of the CBM PET-II machines and returns it.
3672 <item>The function is only available as fastcall function, so it may only
3673 be used in presence of a prototype.
3674 <item>This function may be a macro depending on the compiler options. The
3675 actual function is accessible by #undef'ing the macro.
3677 <tag/Availability/cc65
3679 <ref id="PEEK" name="PEEK">,
3680 <ref id="PEEKW" name="PEEKW">,
3681 <ref id="peekwsys" name="peekwsys">,
3682 <ref id="pokebsys" name="pokebsys">,
3683 <ref id="pokewsys" name="pokewsys">
3689 <sect1>peekwsys<label id="peekwsys"><p>
3693 <tag/Function/Read one word from a location in the system bank.
3694 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3695 <tt/<ref id="cbm510.h" name="cbm510.h">/
3696 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
3697 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
3698 system bank (bank 15) of the CBM PET-II machines and returns it. Following
3699 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
3700 high byte is read from <tt/addr+1/.
3703 <item>The function is only available as fastcall function, so it may only
3704 be used in presence of a prototype.
3705 <item>The order in which the two bytes are read is undefined.
3707 <tag/Availability/cc65
3709 <ref id="PEEK" name="PEEK">,
3710 <ref id="PEEKW" name="PEEKW">,
3711 <ref id="peekbsys" name="peekbsys">,
3712 <ref id="pokebsys" name="pokebsys">,
3713 <ref id="pokewsys" name="pokewsys">
3719 <sect1>perror<label id="perror"><p>
3723 <tag/Function/Print an error message for the error in <tt/errno/.
3724 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3725 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
3726 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
3727 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
3728 a blank. Then the error message for the current contents of <tt/errno/ is
3729 printed followed by a newline. The message output is the same as returned by
3730 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
3733 <item>The function is only available as fastcall function, so it may only
3734 be used in presence of a prototype.
3736 <tag/Availability/ISO 9899
3738 <ref id="_poserror" name="_poserror">,
3739 <ref id="strerror" name="strerror">
3745 <sect1>pokebsys<label id="pokebsys"><p>
3749 <tag/Function/Write one byte to a location in the system bank.
3750 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3751 <tt/<ref id="cbm510.h" name="cbm510.h">/
3752 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
3753 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
3754 system bank (bank 15) of the CBM PET-II machines.
3757 <item>The function is only available as fastcall function, so it may only
3758 be used in presence of a prototype.
3760 <tag/Availability/cc65
3762 <ref id="POKE" name="POKE">,
3763 <ref id="POKEW" name="POKEW">,
3764 <ref id="peekbsys" name="peekbsys">,
3765 <ref id="peekwsys" name="peekwsys">,
3766 <ref id="pokewsys" name="pokewsys">
3772 <sect1>pokewsys<label id="pokewsys"><p>
3776 <tag/Function/Write one word to a location in the system bank.
3777 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3778 <tt/<ref id="cbm510.h" name="cbm510.h">/
3779 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
3780 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
3781 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
3782 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
3783 high byte is written to <tt/addr+1/.
3786 <item>The function is only available as fastcall function, so it may only
3787 be used in presence of a prototype.
3788 <item>The order in which the two bytes are written is undefined.
3790 <tag/Availability/cc65
3792 <ref id="POKE" name="POKE">,
3793 <ref id="POKEW" name="POKEW">,
3794 <ref id="peekbsys" name="peekbsys">,
3795 <ref id="peekwsys" name="peekwsys">,
3796 <ref id="pokebsys" name="pokebsys">
3802 <sect1>qsort<label id="qsort"><p>
3806 <tag/Function/Sort an array.
3807 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3808 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
3809 size_t size, int (*compare) (const void*, const void*));/
3810 <tag/Description/<tt/qsort/ sorts an array according to a given compare
3811 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
3812 is the number of elements, <tt/size/ the size of an element and <tt/compare/
3813 the function used to compare the members.
3816 <item>If there are multiple members with the same key, the order after calling
3817 the function is undefined.
3818 <item>The function is only available as fastcall function, so it may only
3819 be used in presence of a prototype.
3821 <tag/Availability/ISO 9899
3823 <ref id="bsearch" name="bsearch">
3829 <sect1>raise<label id="raise"><p>
3833 <tag/Function/Send a signal to the executing program.
3834 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
3835 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
3836 <tag/Description/<tt/raise/ sends the given signal to the program. If the
3837 program has installed a signal handler for the signal, this signal handler
3838 will be executed. If no handler has been installed, the default action for
3839 the raised signal will be taken. The function returns zero on success,
3841 <tag/Limits/<itemize>
3842 <item>The function is only available as fastcall function, so it may only
3843 be used in presence of a prototype.
3845 <tag/Availability/ISO 9899
3847 <ref id="abort" name="abort">,
3848 <ref id="signal" name="signal">
3854 <sect1>rand<label id="rand"><p>
3858 <tag/Function/Return a pseudo random number.
3859 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3860 <tag/Declaration/<tt/int rand (void);/
3861 <tag/Description/The function returns a pseudo random number
3862 between 0 and <tt/RAND_MAX/ (exclusive).
3863 <tag/Limits/<itemize>
3864 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
3865 flow of numbers is generated.
3866 <item>On startup, the function behaves as if <ref id="srand" name="srand">
3867 had been used with an argument of 1.
3869 <tag/Availability/ISO 9899
3871 <ref id="_randomize" name="_randomize">,
3872 <ref id="srand" name="srand">
3878 <sect1>realloc<label id="realloc"><p>
3882 <tag/Function/Change the size of an allocated memory block.
3883 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3884 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
3885 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
3886 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
3887 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
3888 behaves as if <tt/free/ had been called. On error (not enough memory
3889 available), <tt/realloc/ returns <tt/NULL/.
3892 <item>The part of the memory block that is returned will have its contents
3894 <item>This function is somewhat dangerous to use. Be careful to save the
3895 pointer you're passing somewhere else, otherwise
3897 ptr = realloc (ptr, size);
3899 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
3900 <item>The function is only available as fastcall function, so it may only
3901 be used in presence of a prototype.
3903 <tag/Availability/ISO 9899
3905 <ref id="_heapadd" name="_heapadd">,
3906 <ref id="_heapblocksize" name="_heapblocksize">,
3907 <ref id="_heapmaxavail" name="_heapmaxavail">,
3908 <ref id="_heapmemavail" name="_heapmemavail">,
3909 <ref id="calloc" name="calloc">,
3910 <ref id="free" name="free">,
3911 <ref id="realloc" name="realloc">
3917 <sect1>remove<label id="remove"><p>
3921 <tag/Function/Delete a file.
3922 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3923 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
3924 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
3925 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
3926 code describing the reason for the failure.
3929 <item>This function is not available on all cc65 targets (depends on the
3930 availability of file I/O).
3931 <item>The function is only available as fastcall function, so it may only
3932 be used in presence of a prototype.
3934 <tag/Availability/ISO 9899
3936 <ref id="rename" name="rename">,
3937 <ref id="unlink" name="unlink">
3940 #include <stdio.h>
3942 #define FILENAME "helloworld"
3944 if (remove (FILENAME) == 0) {
3945 printf ("We deleted %s successfully\n", FILENAME);
3947 printf ("There was a problem deleting %s\n", FILENAME);
3954 <sect1>rename<label id="rename"><p>
3958 <tag/Function/Rename a file.
3959 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3960 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
3961 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
3962 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
3963 code describing the reason for the failure.
3966 <item>This function is not available on all cc65 targets (depends on the
3967 capabilities of the storage devices).
3968 <item>The function is only available as fastcall function, so it may only
3969 be used in presence of a prototype.
3971 <tag/Availability/ISO 9899
3973 <ref id="remove" name="remove">
3976 #include <stdio.h>
3978 #define OLDNAME "textfile.txt"
3979 #define NEWNAME "textfile.bak"
3981 if (rename (OLDNAME, NEWNAME) == 0) {
3982 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
3984 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
3991 <sect1>reset_brk<label id="reset_brk"><p>
3995 <tag/Function/Resets the break vector to its original value.
3996 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3997 <tag/Declaration/<tt/void __fastcall__ reset_brk (void);/
3998 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
3999 before a call to <tt/set_brk/.
4002 <item>Since <tt/<ref id="set_brk" name="set_brk">/ installs an exit handler,
4003 it is not strictly necessary to call this function as part of the cleanup when
4006 <tag/Availability/cc65
4008 <ref id="set_brk" name="set_brk">
4014 <sect1>revers<label id="revers"><p>
4018 <tag/Function/Control revers character display.
4019 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4020 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
4021 <tag/Description/If the argument is non zero, the function enables reverse
4022 character display. If the argument is zero, reverse character display is
4023 switched off. The old value of the setting is returned.
4024 <tag/Limits/<itemize>
4025 <item>The function may not be supported by the hardware, in which case
4026 the call is ignored.
4027 <item>The function is only available as fastcall function, so it may only
4028 be used in presence of a prototype.
4030 <tag/Availability/cc65
4032 <ref id="textcolor" name="textcolor">
4038 <sect1>screensize<label id="screensize"><p>
4042 <tag/Function/Return the dimensions of the text mode screen.
4043 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4044 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
4045 <tag/Description/The function returns the dimensions of the text mode screen.
4046 <tag/Limits/<itemize>
4047 <item>The function is only available as fastcall function, so it may only
4048 be used in presence of a prototype.
4050 <tag/Availability/cc65
4052 <ref id="gotox" name="gotox">,
4053 <ref id="gotoxy" name="gotoxy">,
4054 <ref id="gotoy" name="gotoy">,
4055 <ref id="wherex" name="wherex">,
4056 <ref id="wherey" name="wherey">
4062 <sect1>set_brk<label id="set_brk"><p>
4066 <tag/Function/Set the break vector to a user function.
4067 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
4068 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
4069 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
4070 program code by letting the vector point to a user written C function. The
4071 runtime library installs a small stub that saves the registers into global
4072 variables that may be accessed (and changed) by the break handler.
4075 <item>The function is only available as fastcall function, so it may only
4076 be used in presence of a prototype.
4077 <item>The stub saves the zero page registers used by the C runtime and switches
4078 to a small break handler stack. This means that it is safe to execute C code,
4079 even if C code was interrupted. Be careful however not to use too many local
4080 variables, and do not enable stack checks for the handler function or any other
4081 function called from it.
4082 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
4083 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
4084 otherwise the <tt/BRK/ instruction will get executed over and over again.
4085 <item>Since <tt/set_brk/ installs an exit handler, it is not strictly necessary
4086 to call <tt/<ref id="reset_brk" name="reset_brk">/ as part of the cleanup when
4087 the program terminates.
4089 <tag/Availability/cc65
4091 <ref id="reset_brk" name="reset_brk">
4097 <sect1>setjmp<label id="setjmp"><p>
4101 <tag/Function/Save the context for use with <tt/longjmp/.
4102 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4103 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
4104 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
4105 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
4109 <item>The function is only available as fastcall function, so it may only
4110 be used in presence of a prototype.
4111 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
4112 <item><tt/setjmp/ will not save the signal context.
4114 <tag/Availability/ISO 9899
4116 <ref id="longjmp" name="longjmp">
4122 <sect1>setlocale<label id="setlocale"><p>
4126 <tag/Function/Selects a locale.
4127 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4128 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
4129 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
4132 <item>The function is only available as fastcall function, so it may only
4133 be used in presence of a prototype.
4134 <item>cc65 supports only the "C" locale, so calling this function to set a
4135 different locale has no effect.
4137 <tag/Availability/ISO 9899
4139 <ref id="localeconv" name="localeconv">,
4140 <ref id="strcoll" name="strcoll">
4141 <ref id="strxfrm" name="strxfrm">
4147 <sect1>signal<label id="signal"><p>
4151 <tag/Function/Install a signal handler.
4152 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
4153 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
4154 <tag/Description/<tt/signal/ installs a handler for the given signal. The
4155 handler may either be a user supplied function, or one of the predefined
4156 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
4157 previous value if the signal , or the special function vector SIG_ERR in
4159 <tag/Limits/<itemize>
4160 <item>The function is only available as fastcall function, so it may only
4161 be used in presence of a prototype.
4163 <tag/Availability/ISO 9899
4165 <ref id="abort" name="abort">,
4166 <ref id="raise" name="raise">
4172 <sect1>sleep<label id="sleep"><p>
4176 <tag/Function/Sleep for a specified amount of time.
4177 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
4178 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
4179 <tag/Description/The function will return after the specified number of
4180 seconds have elapsed.
4181 <tag/Limits/<itemize>
4182 <item>The function is only available as fastcall function, so it may only
4183 be used in presence of a prototype.
4185 <tag/Availability/POSIX 1003.1
4191 <sect1>slow<label id="slow"><p>
4195 <tag/Function/Switch the C128 into 1MHz mode.
4196 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
4197 <tag/Declaration/<tt/void slow (void);/
4198 <tag/Description/The function will switch the clock of the C128 to 1MHz. This
4199 will halve the speed compared to fast mode.
4200 <tag/Limits/<itemize>
4201 <item>The function is specific to the C128.
4203 <tag/Availability/C128
4205 <ref id="fast" name="fast">,
4206 <ref id="toggle_videomode" name="toggle_videomode">,
4207 <ref id="videomode" name="videomode">
4213 <sect1>srand<label id="srand"><p>
4217 <tag/Function/Initialize the pseudo random number generator.
4218 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4219 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
4220 <tag/Description/The function initializes the random number generator using
4221 the given seed. On program startup, the generator behaves as if <tt/srand/ has
4222 been called with an argument of 1.
4223 <tag/Limits/<itemize>
4224 <item>The function is only available as fastcall function, so it may only
4225 be used in presence of a prototype.
4227 <tag/Availability/ISO 9899
4229 <ref id="_randomize" name="_randomize">,
4230 <ref id="rand" name="rand">
4236 <sect1>strcasecmp<label id="strcasecmp"><p>
4240 <tag/Function/Compare two strings case insensitive.
4241 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4242 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
4243 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
4244 as parameters without case sensitivity. It returns a value that is less than
4245 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
4246 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
4247 <tag/Limits/<itemize>
4248 <item>The function is only available as fastcall function, so it may only
4249 be used in presence of a prototype.
4250 <item>The function is not available in strict ANSI mode.
4252 <tag/Availability/cc65
4254 <ref id="strcmp" name="strcmp">,
4255 <ref id="strcoll" name="strcoll">,
4256 <ref id="stricmp" name="stricmp">,
4257 <ref id="strncmp" name="strncmp">
4258 <ref id="strxfrm" name="strxfrm">
4264 <sect1>strcat<label id="strcat"><p>
4268 <tag/Function/Concatentate two strings.
4269 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4270 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
4271 <tag/Description/The <tt/strcat/ function appends a copy of the string
4272 pointed to by s2 (including the terminating null byte) to the end of the
4273 string pointed to by s1. The initial byte of s2 overwrites the null byte at
4275 <tag/Limits/<itemize>
4276 <item>The function is only available as fastcall function, so it may only
4277 be used in presence of a prototype.
4278 <item>If copying takes place between objects that overlap, the behaviour
4281 <tag/Availability/ISO 9899
4283 <ref id="strcpy" name="strcpy">,
4284 <ref id="strncat" name="strncat">,
4285 <ref id="strncpy" name="strncpy">
4291 <sect1>strchr<label id="strchr"><p>
4295 <tag/Function/Search for a character in a string.
4296 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4297 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
4298 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
4299 (converted to a char) in the string pointed to by <tt/s/. The terminating null
4300 byte is considered to be part of the string. Upon completion, the function
4301 returns a pointer to the byte, or a null pointer if the byte was not found.
4302 <tag/Limits/<itemize>
4303 <item>The function is only available as fastcall function, so it may only
4304 be used in presence of a prototype.
4306 <tag/Availability/ISO 9899
4308 <ref id="memchr" name="memchr">,
4309 <ref id="strrchr" name="strrchr">
4315 <sect1>strcmp<label id="strcmp"><p>
4319 <tag/Function/Compare two strings.
4320 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4321 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
4322 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
4323 parameters. It returns a value that is less than zero if <tt/s1/ is less than
4324 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
4325 if <tt/s1/ is greater than <tt/s2/.
4326 <tag/Limits/<itemize>
4327 <item>The function is only available as fastcall function, so it may only
4328 be used in presence of a prototype.
4330 <tag/Availability/ISO 9899
4332 <ref id="strcasecmp" name="strcasecmp">,
4333 <ref id="strcoll" name="strcoll">,
4334 <ref id="stricmp" name="stricmp">,
4335 <ref id="strncmp" name="strncmp">
4336 <ref id="strxfrm" name="strxfrm">
4342 <sect1>strcoll<label id="strcoll"><p>
4346 <tag/Function/Compare two strings.
4347 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4348 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
4349 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
4350 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
4351 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
4352 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
4353 than zero if <tt/s1/ is greater than <tt/s2/.
4354 <tag/Limits/<itemize>
4355 <item>The function is only available as fastcall function, so it may only
4356 be used in presence of a prototype.
4358 <tag/Availability/ISO 9899
4360 <ref id="setlocale" name="setlocale">,
4361 <ref id="strcasecmp" name="strcasecmp">,
4362 <ref id="strcmp" name="strcmp">,
4363 <ref id="stricmp" name="stricmp">,
4364 <ref id="strncmp" name="strncmp">
4365 <ref id="strxfrm" name="strxfrm">
4371 <sect1>strcpy<label id="strcpy"><p>
4375 <tag/Function/Copy a string.
4376 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4377 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
4378 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
4379 <tt/s2/ (including the terminating null byte) into the array pointed to by
4380 <tt/s1/. The function will always return <tt/s1/.
4381 <tag/Limits/<itemize>
4382 <item>The function is only available as fastcall function, so it may only
4383 be used in presence of a prototype.
4384 <item>If copying takes place between objects that overlap, the behaviour
4387 <tag/Availability/ISO 9899
4389 <ref id="strcat" name="strcat">,
4390 <ref id="strncat" name="strncat">,
4391 <ref id="strncpy" name="strncpy">
4394 #include <string.h>
4396 static char hello[14];
4398 strcpy (hello, "Hello world!\n");
4404 <sect1>strcspn<label id="strcspn"><p>
4408 <tag/Function/Compute the length of a substring.
4409 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4410 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
4411 <tag/Description/The <tt/strcspn/ function computes and returns the length of
4412 the substring pointed to by <tt/s/ which does <em>not</em> consist of
4413 characters contained in the string <tt/set/.
4414 <tag/Limits/<itemize>
4415 <item>The function is only available as fastcall function, so it may only
4416 be used in presence of a prototype.
4418 <tag/Availability/ISO 9899
4420 <ref id="strspn" name="strspn">,
4421 <ref id="strstr" name="strstr">,
4422 <ref id="strtok" name="strtok">
4428 <sect1>strdup<label id="strdup"><p>
4432 <tag/Function/Allocate a copy of a string on the heap.
4433 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4434 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
4435 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
4436 to hold a copy of <tt/s/ including the terminating zero. If the allocation
4437 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
4438 memory block, and a pointer to the block is returned.
4439 <tag/Limits/<itemize>
4440 <item>The function is only available as fastcall function, so it may only
4441 be used in presence of a prototype.
4442 <item>It is up to the caller to free the allocated memory block.
4444 <tag/Availability/ISO 9899
4446 <ref id="free" name="free">,
4447 <ref id="malloc" name="malloc">
4453 <sect1>strerror<label id="strerror"><p>
4457 <tag/Function/Return a string describing an error code.
4458 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4459 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
4460 <tag/Description/The <tt/strerror/ function returns a string describing the
4461 given error code. If an invalid error code is passed, the string "Unknown
4462 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
4463 <tt/errno/ is left untouched.
4464 <tag/Limits/<itemize>
4465 <item>The function is only available as fastcall function, so it may only
4466 be used in presence of a prototype.
4467 <item>While the return type of the function is a <tt/char*/, the returned
4468 string must not be modified by the caller!
4470 <tag/Availability/ISO 9899
4472 <ref id="_stroserror" name="_stroserror">
4478 <sect1>stricmp<label id="stricmp"><p>
4482 <tag/Function/Compare two strings case insensitive.
4483 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4484 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
4485 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
4486 parameters without case sensitivity. It returns a value that is less than zero
4487 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
4488 value greater than zero if <tt/s1/ is greater than <tt/s2/.
4489 <tag/Limits/<itemize>
4490 <item>The function is only available as fastcall function, so it may only
4491 be used in presence of a prototype.
4492 <item>The function is not available in strict ANSI mode.
4494 <tag/Availability/cc65
4496 <ref id="strcasecmp" name="strcasecmp">,
4497 <ref id="strcmp" name="strcmp">,
4498 <ref id="strcoll" name="strcoll">,
4499 <ref id="strncmp" name="strncmp">
4500 <ref id="strxfrm" name="strxfrm">
4506 <sect1>strlen<label id="strlen"><p>
4510 <tag/Function/Return the length of a string.
4511 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4512 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
4513 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
4514 string to which s points, not including the terminating null byte.
4515 <tag/Limits/<itemize>
4516 <item>The function is only available as fastcall function, so it may only
4517 be used in presence of a prototype.
4518 <item>When compiling with <tt/-Os/ (inline known standard functions), the
4519 function does not work correctly for strings with more than 255 characters.
4521 <tag/Availability/ISO 9899
4523 <ref id="strcpy" name="strcpy">
4529 <sect1>strlower<label id="strlower"><p>
4533 <tag/Function/Make a string lower case.
4534 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4535 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
4536 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
4537 function to each character of a string. The function will always return <tt/s/.
4538 <tag/Limits/<itemize>
4539 <item>The function is only available as fastcall function, so it may only
4540 be used in presence of a prototype.
4541 <item>The function prototype is unavailable when compiling in strict ANSI mode.
4542 <item>An alias name for this function is <tt/strlwr/.
4544 <tag/Availability/cc65
4546 <ref id="strupper" name="strupper">,
4547 <ref id="tolower" name="tolower">
4553 <sect1>strlwr<label id="strlwr"><p>
4560 <sect1>strncat<label id="strncat"><p>
4564 <tag/Function/Concatentate two strings.
4565 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4566 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
4567 <tag/Description/The <tt/strncat/ function appends not more than n characters
4568 of the string pointed to by s2 to the end of the string pointed to by s1. The
4569 terminating null character at the end of s1 is overwritten. A terminating null
4570 character is appended to the result, even if not all of s2 is appended to s1.
4571 <tag/Limits/<itemize>
4572 <item>The function is only available as fastcall function, so it may only
4573 be used in presence of a prototype.
4574 <item>If copying takes place between objects that overlap, the behaviour
4577 <tag/Availability/ISO 9899
4579 <ref id="strcpy" name="strcpy">,
4580 <ref id="strncat" name="strncat">,
4581 <ref id="strncpy" name="strncpy">
4587 <sect1>strncmp<label id="strncmp"><p>
4591 <tag/Function/Compare two strings.
4592 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4593 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
4594 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
4595 characters of the two strings passed as parameters. It returns a value that is
4596 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
4597 <tt/s2/, zero if they are identical, and a value greater than zero they are
4599 <tag/Limits/<itemize>
4600 <item>The function is only available as fastcall function, so it may only
4601 be used in presence of a prototype.
4603 <tag/Availability/ISO 9899
4605 <ref id="strcasecmp" name="strcasecmp">,
4606 <ref id="strcmp" name="strcmp">,
4607 <ref id="strcoll" name="strcoll">,
4608 <ref id="stricmp" name="stricmp">
4609 <ref id="strxfrm" name="strxfrm">
4615 <sect1>strncpy<label id="strncpy"><p>
4619 <tag/Function/Copy part of a string.
4620 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4621 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2, size_t n);/
4622 <tag/Description/The <tt/strncpy/ function copies not more than n bytes from
4623 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
4624 pointed to by <tt/s2/ is a string that is shorter than n bytes, null bytes are
4625 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
4626 written. The function will always return <tt/s1/.
4627 <tag/Limits/<itemize>
4628 <item>The function is only available as fastcall function, so it may only
4629 be used in presence of a prototype. If there is no null byte in the first <tt/n/
4630 bytes of the array pointed to by <tt/s2/, the result is not null-terminated.
4631 <item>If copying takes place between objects that overlap, the behaviour is
4634 <tag/Availability/ISO 9899
4636 <ref id="strcat" name="strcat">,
4637 <ref id="strcpy" name="strcpy">,
4638 <ref id="strncat" name="strncat">
4643 static char hello[6];
4645 strcpy (hello, "Hello world!\n", sizeof (hello) - 1);
4652 <sect1>strrchr<label id="strrchr"><p>
4656 <tag/Function/Search for a character in a string.
4657 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4658 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
4659 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
4660 (converted to a char) in the string pointed to by <tt/s/. The terminating null
4661 byte is considered to be part of the string. Upon completion, the function
4662 returns a pointer to the byte, or a null pointer if the byte was not found.
4663 <tag/Limits/<itemize>
4664 <item>The function is only available as fastcall function, so it may only
4665 be used in presence of a prototype.
4667 <tag/Availability/ISO 9899
4669 <ref id="strchr" name="strchr">
4675 <sect1>strspn<label id="strspn"><p>
4679 <tag/Function/Compute the length of a substring.
4680 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4681 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
4682 <tag/Description/The <tt/strspn/ function computes and returns the length of
4683 the substring pointed to by <tt/s/ which does consist only of characters
4684 contained in the string <tt/set/.
4685 <tag/Limits/<itemize>
4686 <item>The function is only available as fastcall function, so it may only
4687 be used in presence of a prototype.
4689 <tag/Availability/ISO 9899
4691 <ref id="strcspn" name="strcspn">,
4692 <ref id="strstr" name="strstr">
4698 <sect1>strstr<label id="strstr"><p>
4702 <tag/Function/Find a substring.
4703 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4704 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
4705 <tag/Description/<tt/strstr/ searches for the first occurance of the string
4706 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
4707 otherwise it returns <tt/NULL/.
4708 <tag/Limits/<itemize>
4709 <item>The function is only available as fastcall function, so it may only
4710 be used in presence of a prototype.
4712 <tag/Availability/ISO 9899
4714 <ref id="strcspn" name="strcspn">,
4715 <ref id="strspn" name="strspn">
4721 <sect1>strtok<label id="strtok"><p>
4725 <tag/Function/Break a string into tokens.
4726 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4727 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
4728 <tag/Description/<tt/strtok/ will break the string s1 into a sequence of
4729 tokens, which are delimited by characters from the string s2. The first call
4730 to <tt/strtok/ will return a pointer to the first token in the string s1.
4731 Following calls must pass a <tt/NULL/ pointer as s1 in order to get the next
4732 token in the string. Different sets of delimiters may be used for the
4733 subsequent calls to <tt/strtok/.
4734 <tag/Limits/<itemize>
4735 <item>The function is only available as fastcall function, so it may only
4736 be used in presence of a prototype.
4737 <item><tt/strtok/ will modify the string s1.
4739 <tag/Availability/ISO 9899
4741 <ref id="strcspn" name="strcspn">,
4742 <!-- <ref id="strpbrk" name="strpbrk"> -->
4748 <sect1>strxfrm<label id="strxfrm"><p>
4752 <tag/Function/Transform a string.
4753 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4754 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
4755 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
4756 s2 and places the resulting string into the string pointed to by s1. The
4757 transformation is such that if the <tt/strcmp/ function is applied to two
4758 transformed strings, it returns a value greater than, equal to, or less than
4759 zero, corresponding to the result of the <tt/strcoll/ function applied to the
4760 same two original strings. No more than n characters are placed into the
4761 resulting array pointed to by s1, including the terminating null character.
4762 <tag/Limits/<itemize>
4763 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
4764 the behaviour is undefined.
4765 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
4766 <item>The function is only available as fastcall function, so it may only
4767 be used in presence of a prototype.
4768 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
4769 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
4771 <tag/Availability/ISO 9899
4773 <ref id="strcmp" name="strcmp">,
4774 <ref id="strcoll" name="strcoll">,
4775 <ref id="strncpy" name="strncpy">,
4781 <sect1>strupper<label id="strupper"><p>
4785 <tag/Function/Make a string upper case.
4786 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4787 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
4788 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
4789 function to each character of a string. The function will always return <tt/s/.
4790 <tag/Limits/<itemize>
4791 <item>The function is only available as fastcall function, so it may only
4792 be used in presence of a prototype.
4793 <item>The function prototype is unavailable when compiling in strict ANSI mode.
4794 <item>An alias name for this function is <tt/strupr/.
4796 <tag/Availability/cc65
4798 <ref id="strlower" name="strlower">
4799 <ref id="toupper" name="toupper">
4805 <sect1>strupr<label id="strupr"><p>
4812 <sect1>textcolor<label id="textcolor"><p>
4816 <tag/Function/Set the text color.
4817 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4818 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
4819 <tag/Description/The function will set a new text color. It returns the old
4820 (current) text color. Text output using any <tt/conio.h/ function will use
4821 the color set by this function.
4822 <tag/Limits/<itemize>
4823 <item>Text colors are system dependent. The function may have no effect
4824 on systems where the text color cannot be changed.
4825 <item>The function is only available as fastcall function, so it may only
4826 be used in presence of a prototype.
4828 <tag/Availability/cc65
4830 <ref id="bgcolor" name="bgcolor">,
4831 <ref id="bordercolor" name="bordercolor">
4837 <sect1>time<label id="time"><p>
4841 <tag/Function/Get the time.
4842 <tag/Header/<tt/<ref id="time.h" name="time.h">/
4843 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
4844 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
4845 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
4846 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
4847 returned and <tt/errno/ is set to <tt/ENOSYS/.
4848 <tag/Limits/<itemize>
4849 <item>The function is only available as fastcall function, so it may
4850 only be used in presence of a prototype.
4851 <item>Many platforms supported by cc65 do not have a realtime clock, so the
4852 returned value may not be valid.
4854 <tag/Availability/ISO 9899
4860 <sect1>toggle_videomode<label id="toggle_videomode"><p>
4864 <tag/Function/Toggle between 40 and 80 column mode.
4865 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
4866 <tag/Declaration/<tt/void toggle_videomode (void);/
4867 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
4868 old mode (cursor position, color and so on) are saved and restored together
4870 <tag/Limits/<itemize>
4871 <item>The function is specific to the C128.
4872 <item>This function is deprecated. Please use <ref id="videomode"
4873 name="videomode"> instead!
4875 <tag/Availability/C128
4877 <ref id="fast" name="fast">,
4878 <ref id="slow" name="slow">,
4879 <ref id="videomode" name="videomode">
4885 <sect1>tolower<label id="tolower"><p>
4889 <tag/Function/Convert a character into its lower case representation.
4890 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4891 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
4892 <tag/Description/The function returns the given character converted to lower
4893 case. If the given character is not a letter, it is returned unchanged.
4894 <tag/Limits/<itemize>
4895 <item>The function is only available as fastcall function, so it may
4896 only be used in presence of a prototype.
4898 <tag/Availability/ISO 9899
4900 <ref id="islower" name="islower">,
4901 <ref id="isupper" name="isupper">,
4902 <ref id="toupper" name="toupper">
4908 <sect1>toupper<label id="toupper"><p>
4912 <tag/Function/Convert a character into its upper case representation.
4913 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4914 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
4915 <tag/Description/The function returns the given character converted to upper
4916 case. If the given character is not a letter, it is returned unchanged.
4917 <tag/Limits/<itemize>
4918 <item>The function is only available as fastcall function, so it may
4919 only be used in presence of a prototype.
4921 <tag/Availability/ISO 9899
4923 <ref id="islower" name="islower">,
4924 <ref id="isupper" name="isupper">,
4925 <ref id="tolower" name="tolower">
4931 <sect1>ultoa<label id="ultoa"><p>
4935 <tag/Function/Convert an unsigned long integer into a string.
4936 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4937 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
4938 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
4939 string using <tt/radix/ as the base.
4940 <tag/Limits/<itemize>
4941 <item>There are no provisions to prevent a buffer overflow.
4942 <item>The function is non standard, so it is not available in strict ANSI mode.
4943 You should probably use <tt/sprintf/ instead.
4944 <item>The function is only available as fastcall function, so it may only be
4945 used in presence of a prototype.
4947 <tag/Availability/cc65
4949 <ref id="atoi" name="atoi">,
4950 <ref id="atol" name="atol">,
4951 <ref id="itoa" name="itoa">,
4952 <ref id="ltoa" name="ltoa">,
4953 <ref id="utoa" name="utoa">
4959 <sect1>unlink<label id="unlink"><p>
4963 <tag/Function/Delete a file.
4964 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
4965 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
4966 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
4967 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
4968 code describing the reason for the failure.
4971 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
4972 name="remove">/ instead, which is a native ANSI C function and does the same.
4973 <item>This function is not available on all cc65 targets (depends on the
4974 availability of file I/O).
4975 <item>The function is only available as fastcall function, so it may only
4976 be used in presence of a prototype.
4977 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
4978 used, which has the same semantics, but is more portable, because it conforms
4979 to the ISO C standard.
4981 <tag/Availability/POSIX 1003.1
4983 <ref id="remove" name="remove">
4986 #include <stdio.h>
4987 #include <unistd.h>
4989 #define FILENAME "helloworld"
4991 if (unlink (FILENAME) == 0) {
4992 printf ("We deleted %s successfully\n", FILENAME);
4994 printf ("There was a problem deleting %s\n", FILENAME);
5001 <sect1>utoa<label id="utoa"><p>
5005 <tag/Function/Convert an unsigned integer into a string.
5006 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5007 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
5008 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
5009 using <tt/radix/ as the base.
5010 <tag/Limits/<itemize>
5011 <item>There are no provisions to prevent a buffer overflow.
5012 <item>The function is non standard, so it is not available in strict ANSI mode.
5013 You should probably use <tt/sprintf/ instead.
5014 <item>The function is only available as fastcall function, so it may only be
5015 used in presence of a prototype.
5017 <tag/Availability/cc65
5019 <ref id="atoi" name="atoi">,
5020 <ref id="atol" name="atol">,
5021 <ref id="itoa" name="itoa">,
5022 <ref id="ltoa" name="ltoa">,
5023 <ref id="ultoa" name="ultoa">
5029 <sect1>vcprintf<label id="vcprintf"><p>
5033 <tag/Function/Formatted output to the console.
5034 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5035 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
5036 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
5037 text where necessary and formatted according to the format string given. The
5038 resulting string is output to the console. <tt/vcprintf/ supports the same
5039 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
5040 <tag/Limits/<itemize>
5041 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
5042 between <tt/\r/ and <tt/\n/.
5043 <item>The function is only available as fastcall function, so it may only be
5044 used in presence of a prototype.
5046 <tag/Availability/cc65
5048 <ref id="cprintf" name="cprintf">,
5049 <ref id="cputc" name="cputc">,
5050 <ref id="cputcxy" name="cputcxy">,
5051 <ref id="cputs" name="cputs">,
5052 <ref id="cputsxy" name="cputsxy">
5058 <sect1>videomode<label id="videomode"><p>
5062 <tag/Function/Switch to either 40 or 80 column mode.
5063 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
5064 <ref id="c128.h" name="c128.h">/
5065 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
5066 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
5067 the requested mode is already active, nothing happens. The old mode is returned
5069 <tag/Limits/<itemize>
5070 <item>The function is specific to the C128 and enhanced Apple //e.
5071 <item>This function replaces <ref id="toggle_videomode"
5072 name="toggle_videomode">.
5073 <item>The function is only available as fastcall function, so it may only be
5074 used in presence of a prototype.
5076 <tag/Availability/C128 and enhanced Apple //e
5078 <ref id="fast" name="fast">,
5079 <ref id="slow" name="slow">,
5080 <ref id="toggle_videomode" name="toggle_videomode">
5086 <sect1>wherex<label id="wherex"><p>
5090 <tag/Function/Return the current X position of the text mode cursor.
5091 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5092 <tag/Declaration/<tt/unsigned char wherex (void);/
5093 <tag/Description/The function returns the current X position of the text mode
5094 cursor. Zero is returned for the leftmost screen position.
5095 <tag/Availability/cc65
5097 <ref id="gotox" name="gotox">,
5098 <ref id="gotoy" name="gotoy">,
5099 <ref id="gotoxy" name="gotoxy">,
5100 <ref id="wherey" name="wherey">
5106 <sect1>wherey<label id="wherey"><p>
5110 <tag/Function/Return the current Y position of the text mode cursor.
5111 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5112 <tag/Declaration/<tt/unsigned char wherey (void);/
5113 <tag/Description/The function returns the current Y position of the text mode
5114 cursor. Zero is returned for the uppermost screen position.
5115 <tag/Availability/cc65
5117 <ref id="gotox" name="gotox">,
5118 <ref id="gotoy" name="gotoy">,
5119 <ref id="gotoxy" name="gotoxy">,
5120 <ref id="wherex" name="wherex">