1 <!doctype linuxdoc system>
4 <title>cc65 function reference
5 <author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
9 cc65 is a C compiler for 6502 based systems. This function reference describes
10 the C functions available in the standard library.
13 <!-- Table of contents -->
16 <!-- Begin the document -->
20 cc65 is a C compiler for 6502 based systems. It implements a subset of the ISO
21 C standard plus additional functions specially crafted for 6502 systems or
22 just some of the supported machines. This function refrence describes the
23 available functions together with any limitations.
25 For an overview about the available libraries, their purpose, and any
26 differences to the ISO standard, please have a look at the <htmlurl
27 url="library.html" name="cc65 Library Overview">.
29 <bf/Note:/ Standard C functions are listed here, but not described in detail.
30 Since these functions behave identical on all standard compliant systems, they
31 are described in any book covering standard C.
33 Each entry for a function contains a detailed description
37 <tag/Function/Summary of what <bf/function/ does.
38 <tag/Header/The header file that contains the declaration.
39 <tag/Declaration/Describes the needed header files and declaration of the
41 <tag/Description/Description of the function.
43 <tag/Availability/The availability of the function.
44 <tag/See also/Other related functions.
45 <tag/Example/A piece of actual code using the function.
50 <sect>Functions by header file<p>
52 <sect1><tt/6502.h/<label id="6502.h"><p>
55 <item><ref id="BRK" name="BRK">
56 <item><ref id="CLI" name="CLI">
57 <item><ref id="SEI" name="SEI">
58 <item><ref id="_sys" name="_sys">
59 <item><ref id="getcpu" name="getcpu">
60 <item><ref id="reset_brk" name="reset_brk">
61 <item><ref id="set_brk" name="set_brk">
65 <sect1><tt/apple2.h/<label id="apple2.h"><p>
69 <item><ref id="get_ostype" name="get_ostype">
73 <sect1><tt/apple2enh.h/<label id="apple2enh.h"><p>
79 <item><ref id="get_ostype" name="get_ostype">
83 <sect1><tt/assert.h/<label id="assert.h"><p>
86 <item><ref id="assert" name="assert">
90 <sect1><tt/atari.h/<label id="atari.h"><p>
93 <item><ref id="get_ostype" name="get_ostype">
99 <sect1><tt/atmos.h/<label id="atmos.h"><p>
104 <sect1><tt/c128.h/<label id="c128.h"><p>
107 <item><ref id="c64mode" name="c64mode">
108 <item><ref id="fast" name="fast">
109 <item><ref id="slow" name="slow">
110 <item><ref id="toggle_videomode" name="toggle_videomode">
111 <item><ref id="videomode" name="videomode">
115 <sect1><tt/c16.h/<label id="c16.h"><p>
120 <sect1><tt/c64.h/<label id="c64.h"><p>
123 <item><ref id="get_ostype" name="get_ostype">
127 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
130 <item><ref id="peekbsys" name="peekbsys">
131 <item><ref id="peekwsys" name="peekwsys">
132 <item><ref id="pokebsys" name="pokebsys">
133 <item><ref id="pokewsys" name="pokewsys">
137 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
140 <item><ref id="peekbsys" name="peekbsys">
141 <item><ref id="peekwsys" name="peekwsys">
142 <item><ref id="pokebsys" name="pokebsys">
143 <item><ref id="pokewsys" name="pokewsys">
147 <sect1><tt/conio.h/<label id="conio.h"><p>
150 <item><ref id="bgcolor" name="bgcolor">
151 <item><ref id="bordercolor" name="bordercolor">
152 <item><ref id="cclear" name="cclear">
153 <item><ref id="cclearxy" name="cclearxy">
154 <item><ref id="cgetc" name="cgetc">
155 <item><ref id="chline" name="chline">
156 <item><ref id="chlinexy" name="chlinexy">
157 <item><ref id="clrscr" name="clrscr">
158 <item><ref id="cprintf" name="cprintf">
159 <item><ref id="cputc" name="cputc">
160 <item><ref id="cputcxy" name="cputcxy">
161 <item><ref id="cputs" name="cputs">
162 <item><ref id="cputsxy" name="cputsxy">
163 <item><ref id="cursor" name="cursor">
164 <item><ref id="cvline" name="cvline">
165 <item><ref id="cvlinexy" name="cvlinexy">
166 <item><ref id="gotox" name="gotox">
167 <item><ref id="gotoxy" name="gotoxy">
168 <item><ref id="gotoy" name="gotoy">
169 <item><ref id="kbhit" name="kbhit">
170 <item><ref id="revers" name="revers">
171 <item><ref id="screensize" name="screensize">
172 <item><ref id="textcolor" name="textcolor">
173 <item><ref id="vcprintf" name="vcprintf">
174 <item><ref id="wherex" name="wherex">
175 <item><ref id="wherey" name="wherey">
179 <sect1><tt/ctype.h/<label id="ctype.h"><p>
182 <item><ref id="isalnum" name="isalnum">
183 <item><ref id="isalpha" name="isalpha">
184 <item><ref id="isascii" name="isascii">
185 <item><ref id="isblank" name="isblank">
186 <item><ref id="iscntrl" name="iscntrl">
187 <item><ref id="isdigit" name="isdigit">
188 <item><ref id="isgraph" name="isgraph">
189 <item><ref id="islower" name="islower">
190 <item><ref id="isprint" name="isprint">
191 <item><ref id="ispunct" name="ispunct">
192 <item><ref id="isspace" name="isspace">
193 <item><ref id="isupper" name="isupper">
194 <item><ref id="isxdigit" name="isxdigit">
195 <item><ref id="tolower" name="tolower">
196 <item><ref id="toupper" name="toupper">
200 <sect1><tt/dbg.h/<label id="dbg.h"><p>
205 <sect1><tt/dio.h/<label id="dio.h"><p>
210 <sect1><tt/em.h/<label id="em.h"><p>
213 <item><ref id="em_commit" name="em_commit">
214 <item><ref id="em_copyfrom" name="em_copyfrom">
215 <item><ref id="em_copyto" name="em_copyto">
216 <item><ref id="em_install" name="em_install">
217 <item><ref id="em_load_driver" name="em_load_driver">
218 <item><ref id="em_map" name="em_map">
219 <item><ref id="em_pagecount" name="em_pagecount">
220 <item><ref id="em_uninstall" name="em_uninstall">
221 <item><ref id="em_unload" name="em_unload">
222 <item><ref id="em_use" name="em_use">
226 <sect1><tt/errno.h/<label id="errno.h"><p>
231 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
234 <item><ref id="close" name="close">
235 <item><ref id="creat" name="creat">
236 <item><ref id="open" name="open">
240 <sect1><tt/geos.h/<label id="geos.h"><p>
245 <sect1><tt/joystick.h/<label id="joystick.h"><p>
248 <item><ref id="joy_count" name="joy_count">
249 <item><ref id="joy_install" name="joy_install">
250 <item><ref id="joy_load_driver" name="joy_load_driver">
251 <item><ref id="joy_read" name="joy_read">
252 <item><ref id="joy_uninstall" name="joy_uninstall">
253 <item><ref id="joy_unload" name="joy_unload">
257 <sect1><tt/locale.h/<label id="locale.h"><p>
260 <item><ref id="localeconv" name="localeconv">
261 <item><ref id="setlocale" name="setlocale">
265 <sect1><tt/modload.h/<label id="modload.h"><p>
268 <item><ref id="mod_load" name="mod_load">
269 <item><ref id="mod_free" name="mod_free">
273 <sect1><tt/mouse.h/<label id="mouse.h"><p>
276 <item><ref id="mouse_load_driver" name="mouse_load_driver">
277 <item><ref id="mouse_unload" name="mouse_unload">
278 <item><ref id="mouse_install" name="mouse_install">
279 <item><ref id="mouse_uninstall" name="mouse_uninstall">
280 <item><ref id="mouse_hide" name="mouse_hide">
281 <item><ref id="mouse_show" name="mouse_show">
282 <item><ref id="mouse_box" name="mouse_box">
283 <item><ref id="mouse_move" name="mouse_move">
284 <item><ref id="mouse_buttons" name="mouse_buttons">
285 <item><ref id="mouse_pos" name="mouse_pos">
286 <item><ref id="mouse_info" name="mouse_info">
287 <item><ref id="mouse_ioctl" name="mouse_ioctl">
293 <sect1><tt/nes.h/<label id="nes.h"><p>
298 <sect1><tt/o65.h/<label id="o65.h"><p>
300 The <tt/o65.h/ header file contains structure and constant definitions that
301 may be used when dealing with files in <htmlurl
302 url="http://www.6502.org/users/andre/o65/fileformat.html" name="o65 format">.
303 It does not declare any functions.
306 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
309 <item><ref id="PEEK" name="PEEK">
310 <item><ref id="PEEKW" name="PEEKW">
311 <item><ref id="POKE" name="POKE">
312 <item><ref id="POKEW" name="POKEW">
316 <sect1><tt/pet.h/<label id="pet.h"><p>
321 <sect1><tt/plus4.h/<label id="plus4.h"><p>
326 <sect1><tt/serial.h/<label id="serial.h"><p>
330 <item><ref id="ser_load_driver" name="ser_load_driver">
331 <item><ref id="ser_unload" name="ser_unload">
332 <item><ref id="ser_install" name="ser_install">
333 <item><ref id="ser_uninstall" name="ser_uninstall">
334 <item><ref id="ser_open" name="ser_open">
335 <item><ref id="ser_close" name="ser_close">
336 <item><ref id="ser_get" name="ser_get">
337 <item><ref id="ser_put" name="ser_put">
338 <item><ref id="ser_status" name="ser_status">
339 <item><ref id="ser_ioctl" name="ser_ioctl">
346 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
349 <item><ref id="setjmp" name="setjmp">
350 <item><ref id="longjmp" name="longjmp">
354 <sect1><tt/signal.h/<label id="signal.h"><p>
357 <item><ref id="raise" name="raise">
358 <item><ref id="signal" name="signal">
362 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
367 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
372 <sect1><tt/stddef.h/<label id="stddef.h"><p>
375 <item><ref id="offsetof" name="offsetof">
379 <sect1><tt/stdio.h/<label id="stdio.h"><p>
382 <item><ref id="clearerr" name="clearerr">
383 <!-- <item><ref id="fclose" name="fclose"> -->
384 <!-- <item><ref id="fdopen" name="fdopen"> -->
385 <item><ref id="feof" name="feof">
386 <item><ref id="ferror" name="ferror">
387 <!-- <item><ref id="fflush" name="fflush"> -->
388 <!-- <item><ref id="fgetc" name="fgetc"> -->
389 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
390 <!-- <item><ref id="fgets" name="fgets"> -->
391 <item><ref id="fileno" name="fileno">
392 <!-- <item><ref id="fopen" name="fopen"> -->
393 <!-- <item><ref id="fprintf" name="fprintf"> -->
394 <!-- <item><ref id="fputc" name="fputc"> -->
395 <!-- <item><ref id="fputs" name="fputs"> -->
396 <!-- <item><ref id="fread" name="fread"> -->
397 <!-- <item><ref id="freopen" name="freopen"> -->
398 <!-- <item><ref id="fscanf" name="fscanf"> -->
399 <!-- <item><ref id="fseek" name="fseek"> -->
400 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
401 <!-- <item><ref id="ftell" name="ftell"> -->
402 <!-- <item><ref id="fwrite" name="fwrite"> -->
403 <!-- <item><ref id="getc" name="getc"> -->
404 <!-- <item><ref id="getchar" name="getchar"> -->
405 <!-- <item><ref id="gets" name="gets"> -->
406 <!-- <item><ref id="printf" name="printf"> -->
407 <!-- <item><ref id="putc" name="putc"> -->
408 <!-- <item><ref id="putchar" name="putchar"> -->
409 <!-- <item><ref id="puts" name="puts"> -->
410 <item><ref id="rename" name="rename">
411 <item><ref id="remove" name="remove">
412 <!-- <item><ref id="rewind" name="rewind"> -->
413 <!-- <item><ref id="scanf" name="scanf"> -->
414 <!-- <item><ref id="sprintf" name="sprintf"> -->
415 <!-- <item><ref id="sscanf" name="sscanf"> -->
416 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
417 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
418 <!-- <item><ref id="vprintf" name="vprintf"> -->
419 <!-- <item><ref id="vscanf" name="vscanf"> -->
420 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
421 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
427 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
430 <item><ref id="_heapadd" name="_heapadd">
431 <item><ref id="_heapblocksize" name="_heapblocksize">
432 <item><ref id="_heapmaxavail" name="_heapmaxavail">
433 <item><ref id="_heapmemavail" name="_heapmemavail">
434 <item><ref id="_poserror" name="_poserror">
435 <item><ref id="_randomize" name="_randomize">
436 <item><ref id="_swap" name="_swap">
437 <item><ref id="abort" name="abort">
438 <item><ref id="abs" name="abs">
439 <item><ref id="atexit" name="atexit">
440 <item><ref id="atoi" name="atoi">
441 <item><ref id="atol" name="atol">
442 <item><ref id="bsearch" name="bsearch">
443 <item><ref id="calloc" name="calloc">
444 <item><ref id="div" name="div">
445 <item><ref id="exit" name="exit">
446 <item><ref id="free" name="free">
447 <item><ref id="getenv" name="getenv">
448 <item><ref id="itoa" name="itoa">
449 <item><ref id="labs" name="labs">
450 <item><ref id="ltoa" name="ltoa">
451 <item><ref id="malloc" name="malloc">
452 <item><ref id="perror" name="perror">
453 <item><ref id="qsort" name="qsort">
454 <item><ref id="rand" name="rand">
455 <item><ref id="realloc" name="realloc">
456 <item><ref id="srand" name="srand">
457 <item><ref id="ultoa" name="ultoa">
458 <item><ref id="utoa" name="utoa">
462 <sect1><tt/string.h/<label id="string.h"><p>
465 <item><ref id="_stroserror" name="_stroserror">
466 <item><ref id="bzero" name="bzero">
467 <item><ref id="memchr" name="memchr">
468 <item><ref id="memcpy" name="memcpy">
469 <item><ref id="memmove" name="memmove">
470 <item><ref id="memset" name="memset">
471 <item><ref id="strcasecmp" name="strcasecmp">
472 <item><ref id="strcat" name="strcat">
473 <item><ref id="strchr" name="strchr">
474 <item><ref id="strcmp" name="strcmp">
475 <item><ref id="strcoll" name="strcoll">
476 <item><ref id="strcpy" name="strcpy">
477 <item><ref id="strcspn" name="strcspn">
478 <item><ref id="strdup" name="strdup">
479 <item><ref id="strerror" name="strerror">
480 <item><ref id="stricmp" name="stricmp">
481 <item><ref id="strlen" name="strlen">
482 <item><ref id="strlower" name="strlower">
483 <item><ref id="strlwr" name="strlwr">
484 <item><ref id="strncat" name="strncat">
485 <item><ref id="strncmp" name="strncmp">
486 <item><ref id="strncpy" name="strncpy">
487 <item><ref id="strrchr" name="strrchr">
488 <item><ref id="strspn" name="strspn">
489 <item><ref id="strstr" name="strstr">
490 <item><ref id="strtok" name="strtok">
491 <item><ref id="strxfrm" name="strxfrm">
492 <item><ref id="strupper" name="strupper">
493 <item><ref id="strupr" name="strupr">
499 <sect1><tt/tgi.h/<label id="tgi.h"><p>
504 <sect1><tt/time.h/<label id="time.h"><p>
507 <!-- <item><ref id="_systime" name="_systime"> -->
508 <!-- <item><ref id="asctime" name="asctime"> -->
509 <!-- <item><ref id="clock" name="clock"> -->
510 <!-- <item><ref id="ctime" name="ctime"> -->
511 <!-- <item><ref id="gmtime" name="gmtime"> -->
512 <!-- <item><ref id="localtime" name="localtime"> -->
513 <!-- <item><ref id="mktime" name="mktime"> -->
514 <!-- <item><ref id="strftime" name="strftime"> -->
515 <item><ref id="time" name="time">
521 <sect1><tt/unistd.h/<label id="unistd.h"><p>
524 <!-- <item><ref id="chdir" name="chdir"> -->
525 <!-- <item><ref id="getcwd" name="getcwd"> -->
526 <!-- <item><ref id="lseek" name="lseek"> -->
527 <!-- <item><ref id="mkdir" name="mkdir"> -->
528 <!-- <item><ref id="read" name="read"> -->
529 <!-- <item><ref id="rmdir" name="rmdir"> -->
530 <item><ref id="sleep" name="sleep">
531 <item><ref id="unlink" name="unlink">
532 <!-- <item><ref id="write" name="write"> -->
538 <sect1><tt/vic20.h/<label id="vic20.h"><p>
543 <sect1><tt/zlib.h/<label id="zlib.h"><p>
548 <sect>Alphabetical function reference<p>
550 <sect1>_heapadd<label id="_heapadd"><p>
554 <tag/Function/Add a block to the heap.
555 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
556 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
557 <tag/Description/The function adds a block of raw memory to the heap.
560 <item>The minimum blocksize that can be added is 6 bytes; the function will
561 ignore smaller blocks.
563 <tag/Availability/cc65
565 <ref id="_heapblocksize" name="_heapblocksize">,
566 <ref id="_heapmaxavail" name="_heapmaxavail">,
567 <ref id="_heapmemavail" name="_heapmemavail">,
568 <ref id="calloc" name="calloc">,
569 <ref id="free" name="free">,
570 <ref id="malloc" name="malloc">,
571 <ref id="realloc" name="realloc">
577 <sect1>_heapblocksize<label id="_heapblocksize"><p>
581 <tag/Function/Return the size of an allocated block.
582 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
583 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
584 <tag/Description/The function returns the size of a block that must have
585 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
586 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
589 <item>Passing a pointer to a block that was is not the result of one of the
590 allocation functions, or that has been free'd will give unpredicable results.
592 <tag/Availability/cc65
594 <ref id="_heapadd" name="_heapadd">,
595 <ref id="_heapmaxavail" name="_heapmaxavail">,
596 <ref id="_heapmemavail" name="_heapmemavail">,
597 <ref id="calloc" name="calloc">,
598 <ref id="free" name="free">,
599 <ref id="malloc" name="malloc">,
600 <ref id="realloc" name="realloc">
606 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
610 <tag/Function/Return the largest block that is available on the heap.
611 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
612 <tag/Declaration/<tt/size_t __fastcall__ _heapmaxavail (void);/
613 <tag/Description/The function returns the size of the largest block that may
614 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
615 <tag/Availability/cc65
617 <ref id="_heapadd" name="_heapadd">,
618 <ref id="_heapblocksize" name="_heapblocksize">,
619 <ref id="_heapmemavail" name="_heapmemavail">,
620 <ref id="calloc" name="calloc">,
621 <ref id="free" name="free">,
622 <ref id="malloc" name="malloc">,
623 <ref id="realloc" name="realloc">
629 <sect1>_heapmemavail<label id="_heapmemavail"><p>
633 <tag/Function/Return the total available space on the heap.
634 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
635 <tag/Declaration/<tt/size_t __fastcall__ _heapmemavail (void);/
636 <tag/Description/The function returns the total number of bytes available on
640 <item>This function is of less use than usually assumed, since the returned
641 heap space may be available but not in one block. So even if this function
642 says that several times more heap space is available than needed, <ref
643 id="malloc" name="malloc"> may still return <tt/NULL/.
645 <tag/Availability/cc65
647 <ref id="_heapadd" name="_heapadd">,
648 <ref id="_heapblocksize" name="_heapblocksize">,
649 <ref id="_heapmaxavail" name="_heapmaxavail">,
650 <ref id="calloc" name="calloc">,
651 <ref id="free" name="free">,
652 <ref id="malloc" name="malloc">,
653 <ref id="realloc" name="realloc">
659 <sect1>_poserror<label id="_poserror"><p>
663 <tag/Function/Print an error message for the error in <tt/_oserrno/.
664 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
665 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
666 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
667 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
668 a colon and a blank. Then the error message for the current contents of
669 <tt/_oserrno/ are printed followed by a newline. The message output is the
670 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
671 argument of <tt/_oserrno/.
674 <item>Since operating system specific error code are - you guessed it -
675 operating system specific, the value in <tt/_oserror/ and the message that is
676 printed depend on the cc65 target.
677 <item>The function is only available as fastcall function, so it may only
678 be used in presence of a prototype.
680 <tag/Availability/cc65
682 <ref id="_stroserror" name="_stroserror">,
683 <ref id="perror" name="perror">
689 <sect1>_randomize<label id="_randomize"><p>
693 <tag/Function/Initialize the pseudo random number generator.
694 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
695 <tag/Declaration/<tt/void _randomize (void);/
696 <tag/Description/The function initializes the random number generator with
697 a seed derived from fast changing hardware events, so the seed itself can be
698 considered random to a certain degree.
699 <tag/Limits/<itemize>
700 <item>The randomness of the seed depends on the machine hardware.
702 <tag/Availability/cc65
704 <ref id="rand" name="rand">,
705 <ref id="srand" name="srand">
711 <sect1>_stroserror<label id="_stroserror"><p>
715 <tag/Function/Return a string describing an OS specific error code.
716 <tag/Header/<tt/<ref id="string.h" name="string.h">/
717 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
718 <tag/Description/<tt/_stroserror/ will return a string describing the given
719 operating system specific error code.
720 <tag/Limits/<itemize>
721 <item>Since operating system specific error code are - you guessed it -
722 operating system specific, the parameter and the string returned depend on the
724 <item>The function is only available as fastcall function, so it may only be
725 used in presence of a prototype.
727 <tag/Availability/cc65
729 <ref id="strerror" name="strerror">
735 <sect1>_swap<label id="_swap"><p>
739 <tag/Function/Swap the contents of memory areas.
740 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
741 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
742 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
743 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
744 <tt/size/ bytes in size.
745 <tag/Limits/<itemize>
746 <item>The memory areas may not overlap, otherwise the results are undefined.
747 <item>The function is only available as fastcall function, so it may only be
748 used in presence of a prototype.
750 <tag/Availability/cc65
752 <ref id="memcpy" name="memcpy">,
753 <ref id="memmove" name="memmove">
759 <sect1>_sys<label id="_sys"><p>
763 <tag/Function/Call a subroutine passing register values.
764 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
765 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
766 <tag/Description/The function will call the subroutine at the address
767 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
768 registers and the CPU flags are set to the values given in the <tt/regs/
769 structure. On return from the subroutine, the new values of the registers and
770 flags are stored back overwriting the old values.
771 <tag/Limits/<itemize>
772 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
773 when calling the subroutine (they are unchanged from their current values).
774 <item>The function is only available as fastcall function, so it may only be
775 used in presence of a prototype.
777 <tag/Availability/cc65
783 <sect1>BRK<label id="BRK"><p>
787 <tag/Function/Insert a 6502 BRK instrunction into the code.
788 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
789 <tag/Declaration/<tt/void BRK (void);/
790 <tag/Description/The function will insert a 6502 BRK instruction into the code
791 which may be used to trigger a debugger.
792 <tag/Limits/<itemize>
793 <item>The function is actually a macro.
794 <item>The inserted instruction may lead to unexpected results if no debugger
797 <tag/Availability/cc65
799 <ref id="CLI" name="CLI">,
800 <ref id="SEI" name="SEI">
806 <sect1>CLI<label id="CLI"><p>
810 <tag/Function/Insert a 6502 CLI instrunction into the code.
811 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
812 <tag/Declaration/<tt/void CLI (void);/
813 <tag/Description/The function will insert a 6502 CLI instruction into the code,
814 so interrupts are enabled. Enabling interrupts has no effects if they are
815 already enabled (the default).
816 <tag/Limits/<itemize>
817 <item>The function is actually a macro.
818 <item>Disabling interrupts may lead to unexpected results.
820 <tag/Availability/cc65
822 <ref id="BRK" name="BRK">,
823 <ref id="SEI" name="SEI">
829 <sect1>PEEK<label id="PEEK"><p>
833 <tag/Function/Read a byte from memory.
834 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
835 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
836 <tag/Description/The function will read the absolute memory given by <tt/addr/
837 and return the value read.
838 <tag/Limits/<itemize>
839 <item>The function is actually a macro.
840 <item>This function depends highly on the platform and environment.
842 <tag/Availability/cc65
844 <ref id="PEEKW" name="PEEKW">,
845 <ref id="POKE" name="POKE">
851 <sect1>PEEKW<label id="PEEKW"><p>
855 <tag/Function/Read a word (two bytes) from memory.
856 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
857 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
858 <tag/Description/The function will read the absolute memory given by <tt/addr/
859 and return the value read. The byte read from the higher address is the high
860 byte of the return value.
861 <tag/Limits/<itemize>
862 <item>The function is actually a macro.
863 <item>This function depends highly on the platform and environment.
864 <item>The order in which the two bytes are read is unspecified and may
865 depend of the address expression used.
867 <tag/Availability/cc65
869 <ref id="PEEK" name="PEEK">,
870 <ref id="POKE" name="POKE">
876 <sect1>POKE<label id="POKE"><p>
880 <tag/Function/Write a byte to memory.
881 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
882 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
883 <tag/Description/The function writes the value <tt/val/ to the absolute
884 memory address given by <tt/addr/.
885 <tag/Limits/<itemize>
886 <item>The function is actually a macro.
887 <item>This function depends highly on the platform and environment.
888 <item>Careless use will cause the program to act strange or may crash the
891 <tag/Availability/cc65
893 <ref id="PEEK" name="PEEK">,
894 <ref id="POKEW" name="POKEW">
900 <sect1>POKEW<label id="POKEW"><p>
904 <tag/Function/Write a word (two bytes) to memory.
905 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
906 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
907 <tag/Description/The function writes the value <tt/val/ to the absolute
908 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
909 the <tt/addr/, the high byte is written to <tt/addr+1/.
910 <tag/Limits/<itemize>
911 <item>The function is actually a macro.
912 <item>This function depends highly on the platform and environment.
913 <item>Careless use will cause the program to act strange or may crash the
915 <item>The order in which the two bytes are written is unspecified and may
916 depend of the address expression used.
918 <tag/Availability/cc65
920 <ref id="PEEK" name="PEEK">,
921 <ref id="POKE" name="POKE">
927 <sect1>SEI<label id="SEI"><p>
931 <tag/Function/Insert a 6502 SEI instrunction into the code.
932 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
933 <tag/Declaration/<tt/void SEI (void);/
934 <tag/Description/The function will insert a 6502 SEI instruction into the code,
935 so interrupts are disabled. Note that non maskable interrupts cannot be
937 <tag/Limits/<itemize>
938 <item>The function is actually a macro.
939 <item>Disabling interrupts may lead to unexpected results.
941 <tag/Availability/cc65
943 <ref id="BRK" name="BRK">,
944 <ref id="CLI" name="CLI">
950 <sect1>abort<label id="abort"><p>
954 <tag/Function/Terminates a program abnormally.
955 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
956 <tag/Declaration/<tt/void abort (void);/
957 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
958 on stderr, then terminates the program with an exit code of 3.
959 <tag/Availability/ISO 9899
961 <ref id="assert" name="assert">,
962 <ref id="exit" name="exit">,
963 <ref id="raise" name="raise">
969 <sect1>abs<label id="abs"><p>
973 <tag/Function/Returns the absolute value of an integer.
974 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
975 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
976 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
978 <tag/Limits/<itemize>
979 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
980 <item>The function is only available as fastcall function, so it may only be
981 used in presence of a prototype.
983 <tag/Availability/ISO 9899
985 <ref id="labs" name="labs">
991 <sect1>assert<label id="assert"><p>
995 <tag/Function/Test a condition and possibly abort.
996 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
997 <tag/Declaration/<tt/void assert (int cond);/
998 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
999 statement. If the condition evaluates t zero (false), assert prints a message
1000 on stderr and aborts the program.
1001 <tag/Limits/<itemize>
1002 <item>The function is actually a macro.
1004 <tag/Availability/ISO 9899
1006 <ref id="abort" name="abort">,
1007 <ref id="exit" name="exit">
1013 <sect1>atexit<label id="atexit"><p>
1017 <tag/Function/Register an exit function.
1018 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1019 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1020 <tag/Description/<tt/atexit/ registers the function pointed to by
1021 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1022 terminates, they are called in LIFO order (the last function registered is
1023 called first). <tt/atexit/ returns zero on success and a nonzero value on
1025 <tag/Limits/<itemize>
1026 <item>A maximum of 5 exit functions can be registered.
1027 <item>There is no way to unregister an exit function.
1028 <item>The function is only available as fastcall function, so it may only be
1029 used in presence of a prototype.
1031 <tag/Availability/ISO 9899
1033 <ref id="abort" name="abort">,
1034 <ref id="exit" name="exit">
1040 <sect1>atoi<label id="atoi"><p>
1044 <tag/Function/Convert a string to an integer.
1045 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1046 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1047 <tag/Description/<tt/atoi/ converts the given string into an integer.
1048 Conversion stops as soon as any invalid character is encountered.
1049 <tag/Limits/<itemize>
1050 <item>There is no way to detect any conversion errors.
1051 <item>The function does not check for an numerical overflow when converting.
1052 <item>The function is only available as fastcall function, so it may only be
1053 used in presence of a prototype.
1055 <tag/Availability/ISO 9899
1057 <ref id="atol" name="atol">,
1058 <ref id="itoa" name="itoa">,
1059 <ref id="ltoa" name="ltoa">,
1060 <ref id="ultoa" name="ultoa">,
1061 <ref id="utoa" name="utoa">
1067 <sect1>atol<label id="atol"><p>
1071 <tag/Function/Convert a string to a long integer.
1072 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1073 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1074 <tag/Description/<tt/atol/ converts the given string into a long integer.
1075 Conversion stops as soon as any invalid character is encountered.
1076 <tag/Limits/<itemize>
1077 <item>There is no way to detect any conversion errors.
1078 <item>The function does not check for an numerical overflow when converting.
1079 <item>The function is only available as fastcall function, so it may only be
1080 used in presence of a prototype.
1082 <tag/Availability/ISO 9899
1084 <ref id="atoi" name="atoi">,
1085 <ref id="itoa" name="itoa">,
1086 <ref id="ltoa" name="ltoa">,
1087 <ref id="ultoa" name="ultoa">,
1088 <ref id="utoa" name="utoa">
1094 <sect1>bgcolor<label id="bgcolor"><p>
1098 <tag/Function/Set the background text color.
1099 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1100 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1101 <tag/Description/The function will set a new background color and return the
1102 old (current) one. The background color is valid for the whole text output
1103 area of the screen, not just for new text.
1104 <tag/Limits/<itemize>
1105 <item>Background colors are system dependent. The function may have no effect
1106 on systems where the background color cannot be changed.
1107 <item>The function is only available as fastcall function, so it may only be
1108 used in presence of a prototype.
1110 <tag/Availability/cc65
1112 <ref id="bordercolor" name="bordercolor">,
1113 <ref id="textcolor" name="textcolor">
1119 <sect1>bordercolor<label id="bordercolor"><p>
1123 <tag/Function/Set the border (frame) color.
1124 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1125 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1126 <tag/Description/The function will set a new border color. It returns the old
1127 (current) border color.
1128 <tag/Limits/<itemize>
1129 <item>Border colors are system dependent. The function may have no effect
1130 on systems where the border color cannot be changed.
1131 <item>The function is only available as fastcall function, so it may only
1132 be used in presence of a prototype.
1134 <tag/Availability/cc65
1136 <ref id="bgcolor" name="bgcolor">,
1137 <ref id="textcolor" name="textcolor">
1143 <sect1>bsearch<label id="bsearch"><p>
1147 <tag/Function/Do a binary search in a sorted array.
1148 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1149 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1150 const void* base, size_t n, size_t size,
1151 int (*cmp) (const void*, const void*));/
1152 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1153 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1154 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1155 the function used to compare the members against the key. The function returns
1156 a pointer to the member found, or <tt/NULL/ if there was no match.
1159 <item>The contents of the array must be sorted in ascending order according to
1160 the compare function given.
1161 <item>If there are multiple members that match the key, the function will
1162 return one of the members.
1163 <item>The function is only available as fastcall function, so it may only
1164 be used in presence of a prototype.
1166 <tag/Availability/ISO 9899
1168 <ref id="qsort" name="qsort">
1174 <sect1>bzero<label id="bzero"><p>
1178 <tag/Function/Fill a memory area with zeroes.
1179 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1180 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1181 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1185 <item>The function is non standard and therefore only available in non ANSI
1186 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1187 <item>The function is only available as fastcall function, so it may only
1188 be used in presence of a prototype.
1190 <tag/Availability/cc65
1192 <ref id="_swap" name="_swap">,
1193 <ref id="memcpy" name="memcpy">,
1194 <ref id="memmove" name="memmove">,
1195 <ref id="memset" name="memset">,
1201 <sect1>c64mode<label id="c64mode"><p>
1205 <tag/Function/Switch the C128 into C64 compatible mode.
1206 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1207 <tag/Declaration/<tt/void c64mode (void);/
1208 <tag/Description/The function will cause the machine to reboot into C64 mode.
1209 <tag/Limits/<itemize>
1210 <item>The function is specific to the C128.
1211 <item>The function will not return to the caller.
1213 <tag/Availability/C128
1219 <sect1>calloc<label id="calloc"><p>
1223 <tag/Function/Allocate and clear memory.
1224 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1225 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1226 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1227 of size <tt/size/, clears the whole block with binary zeroes and returns a
1228 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1232 <item>Clearing the memory may not have the expected effect on all platforms:
1233 pointers in the block may not be <tt/NULL/ and floating point variables may
1234 not be zero (0.0). In other words: The "clearing" effect of this function
1235 should be used with care for portable programs.
1236 <item>The function is only available as fastcall function, so it may only
1237 be used in presence of a prototype.
1239 <tag/Availability/ISO 9899
1241 <ref id="_heapadd" name="_heapadd">,
1242 <ref id="_heapblocksize" name="_heapblocksize">,
1243 <ref id="_heapmaxavail" name="_heapmaxavail">,
1244 <ref id="_heapmemavail" name="_heapmemavail">,
1245 <ref id="free" name="free">,
1246 <ref id="malloc" name="malloc">,
1247 <ref id="realloc" name="realloc">
1253 <sect1>cclear<label id="cclear"><p>
1257 <tag/Function/Clear part of a line (write a given number of spaces).
1258 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1259 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
1260 <tag/Description/The function clears part of a line by writing <tt/length/
1261 spaces in the current text color.
1262 <tag/Limits/<itemize>
1263 <item>The function is only available as fastcall function, so it may
1264 only be used in presence of a prototype.
1266 <tag/Availability/cc65
1268 <ref id="cclearxy" name="cclearxy">,
1269 <ref id="clrscr" name="clrscr">
1275 <sect1>cclearxy<label id="cclearxy"><p>
1279 <tag/Function/Clear part of a line (write a given number of spaces) starting
1280 at a specific screen position.
1281 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1282 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
1283 <tag/Description/The function moves the cursor to a specific position, and
1284 will then clear part of the line by writing <tt/length/ spaces in the current
1286 <tag/Limits/<itemize>
1287 <item>The function is only available as fastcall function, so it may
1288 only be used in presence of a prototype.
1290 <tag/Availability/cc65
1292 <ref id="cclear" name="cclear">,
1293 <ref id="clrscr" name="clrscr">
1299 <sect1>cgetc<label id="cgetc"><p>
1303 <tag/Function/Read a character from the keyboard.
1304 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1305 <tag/Declaration/<tt/char cgetc (void);/
1306 <tag/Description/The function reads a character from the keyboard. If there is
1307 no character available, <tt/cgetc/ waits until the user presses a key. If the
1308 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
1309 displayed while waiting.
1310 <tag/Limits/<itemize>
1311 <item>If the system supports a keyboard buffer, <tt/cgetc/ will fetch a key
1312 from this buffer and wait only if the buffer is empty.
1314 <tag/Availability/cc65
1316 <ref id="cursor" name="cursor">,
1317 <ref id="kbhit" name="kbhit">
1323 <sect1>chline<label id="chline"><p>
1327 <tag/Function/Output a horizontal line in text mode.
1328 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1329 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
1330 <tag/Description/The function outputs a horizontal line with the given length
1331 starting at the current cursor position.
1332 <tag/Limits/<itemize>
1333 <item>The character used to draw the horizontal line is system dependent.
1334 If available, a line drawing character is used. Drawing a line that is partially
1335 off screen leads to undefined behaviour.
1336 <item>The function is only available as fastcall function, so it may only be
1337 used in presence of a prototype.
1339 <tag/Availability/cc65
1341 <ref id="chlinexy" name="chlinexy">,
1342 <ref id="cvline" name="cvline">,
1343 <ref id="cvlinexy" name="cvlinexy">
1349 <sect1>chlinexy<label id="chlinexy"><p>
1353 <tag/Function/Output a horizontal line at a given position in text mode.
1354 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1355 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
1356 <tag/Description/The function outputs a horizontal line with the given length
1357 starting at a given position.
1358 <tag/Limits/<itemize>
1359 <item>The character used to draw the horizontal line is system dependent.
1360 If available, a line drawing character is used. Drawing a line that is partially
1361 off screen leads to undefined behaviour.
1362 <item>The function is only available as fastcall function, so it may only be
1363 used in presence of a prototype.
1365 <tag/Availability/cc65
1367 <ref id="chline" name="chline">,
1368 <ref id="cvline" name="cvline">,
1369 <ref id="cvlinexy" name="cvlinexy">
1375 <sect1>clearerr<label id="clearerr"><p>
1379 <tag/Function/Clear error and end-of-file status of a stream.
1380 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1381 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
1382 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
1383 indicators for the stream <tt/f/.
1384 <tag/Limits/<itemize>
1385 <item>The function is only available as fastcall function, so it may only be
1386 used in presence of a prototype.
1388 <tag/Availability/ISO 9899
1390 <ref id="feof" name="feof">,
1391 <ref id="ferror" name="ferror">
1397 <sect1>clrscr<label id="clrscr"><p>
1401 <tag/Function/Clear the text screen.
1402 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1403 <tag/Declaration/<tt/void clrscr (void);/
1404 <tag/Description/The function clears the text screen and moves the cursor to
1405 the upper left corner.
1406 <tag/Availability/cc65
1408 <ref id="cclear" name="cclear">,
1409 <ref id="cclearxy" name="cclearxy">
1415 <sect1>close<label id="close"><p>
1419 <tag/Function/Close a file descriptor.
1420 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1421 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
1422 <tag/Description/The function closes the given file descriptor. It returns zero
1423 on success and -1 on error. If an error occurs, the cause can be determined by
1424 reading the <tt/errno/ variable.
1425 <tag/Limits/<itemize>
1426 <item>The function is only available as fastcall function, so it may only
1427 be used in presence of a prototype.
1429 <tag/Availability/POSIX 1003.1
1431 <ref id="creat" name="creat">,
1432 <ref id="open" name="open">
1438 <sect1>creat<label id="creat"><p>
1442 <tag/Function/Create a file.
1443 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1444 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
1445 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
1446 associated with it. On error, -1 is returned and an error code is stored in
1448 <tag/Limits/<itemize>
1449 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
1450 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
1451 <item>The function is only available as fastcall function, so it may only
1452 be used in presence of a prototype.
1454 <tag/Availability/POSIX 1003.1
1456 <ref id="close" name="close">,
1457 <ref id="open" name="open">
1463 <sect1>cprintf<label id="cprintf"><p>
1467 <tag/Function/Formatted output to the console.
1468 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1469 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
1470 <tag/Description/The arguments are converted to text where necessary and
1471 formatted according to the format string given. The resulting string is output
1472 to the console. <tt/cprintf/ supports the same format specifiers as
1473 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
1474 <tag/Limits/<itemize>
1475 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
1476 between <tt/\r/ and <tt/\n/.
1478 <tag/Availability/cc65
1480 <ref id="cputc" name="cputc">,
1481 <ref id="cputcxy" name="cputcxy">,
1482 <ref id="cputs" name="cputs">,
1483 <ref id="cputsxy" name="cputsxy">,
1484 <ref id="vcprintf" name="vcprintf">
1490 <sect1>cputc<label id="cputc"><p>
1494 <tag/Function/Output a character directly to the console.
1495 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1496 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
1497 <tag/Description/Output one character to the console at the current cursor
1499 <tag/Limits/<itemize>
1500 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
1501 between <tt/\r/ and <tt/\n/.
1502 <item>The function is only available as fastcall function, so it may only
1503 be used in presence of a prototype.
1505 <tag/Availability/cc65
1507 <ref id="cprintf" name="cprintf">,
1508 <ref id="cputcxy" name="cputcxy">,
1509 <ref id="cputs" name="cputs">,
1510 <ref id="cputsxy" name="cputsxy">,
1511 <ref id="vcprintf" name="vcprintf">
1517 <sect1>cputcxy<label id="cputcxy"><p>
1521 <tag/Function/Output a character at a specific screen position.
1522 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1523 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
1524 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
1525 the screen and outputs one character.
1526 <tag/Limits/<itemize>
1527 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
1528 between <tt/\r/ and <tt/\n/.
1529 <item>The function is only available as fastcall function, so it may only
1530 be used in presence of a prototype.
1532 <tag/Availability/cc65
1534 <ref id="cprintf" name="cprintf">,
1535 <ref id="cputc" name="cputc">,
1536 <ref id="cputs" name="cputs">,
1537 <ref id="cputsxy" name="cputsxy">,
1538 <ref id="vcprintf" name="vcprintf">
1544 <sect1>cputs<label id="cputs"><p>
1548 <tag/Function/Output a string directly to the console.
1549 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1550 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
1551 <tag/Description/The function outputs the given string on the console at the
1552 current cursor position.
1553 <tag/Limits/<itemize>
1554 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
1555 between <tt/\r/ and <tt/\n/.
1556 <item>The function is only available as fastcall function, so it may only
1557 be used in presence of a prototype.
1559 <tag/Availability/cc65
1561 <ref id="cprintf" name="cprintf">,
1562 <ref id="cputc" name="cputc">,
1563 <ref id="cputcxy" name="cputcxy">,
1564 <ref id="cputsxy" name="cputsxy">,
1565 <ref id="vcprintf" name="vcprintf">
1571 <sect1>cputsxy<label id="cputsxy"><p>
1575 <tag/Function/Output a string to the console at a given position.
1576 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1577 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
1578 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
1579 and outputs the string <tt/s/.
1580 <tag/Limits/<itemize>
1581 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
1582 between <tt/\r/ and <tt/\n/.
1583 <item>The function is only available as fastcall function, so it may only
1584 be used in presence of a prototype.
1586 <tag/Availability/cc65
1588 <ref id="cprintf" name="cprintf">,
1589 <ref id="cputc" name="cputc">,
1590 <ref id="cputcxy" name="cputcxy">,
1591 <ref id="cputs" name="cputs">,
1592 <ref id="vcprintf" name="vcprintf">
1598 <sect1>cursor<label id="cursor"><p>
1602 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
1603 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1604 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
1605 <tag/Description/If the argument to the function is non zero, a blinking cursor
1606 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
1607 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
1608 <tag/Limits/<itemize>
1609 <item>The function is only available as fastcall function, so it may only
1610 be used in presence of a prototype.
1612 <tag/Availability/cc65
1614 <ref id="cgetc" name="cgetc">,
1615 <ref id="kbhit" name="kbhit">
1621 <sect1>cvline<label id="cvline"><p>
1625 <tag/Function/Output a vertical line in text mode.
1626 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1627 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
1628 <tag/Description/The function outputs a vertical line with the given length
1629 starting at the current cursor position.
1630 <tag/Limits/<itemize>
1631 <item>The character used to draw the vertical line is system dependent.
1632 If available, a line drawing character is used. Drawing a line that is partially
1633 off screen leads to undefined behaviour.
1634 <item>The function is only available as fastcall function, so it may only be
1635 used in presence of a prototype.
1637 <tag/Availability/cc65
1639 <ref id="chline" name="chline">,
1640 <ref id="chlinexy" name="chlinexy">,
1641 <ref id="cvlinexy" name="cvlinexy">
1647 <sect1>cvlinexy<label id="cvlinexy"><p>
1651 <tag/Function/Output a vertical line at a given position in text mode.
1652 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1653 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
1654 <tag/Description/The function outputs a vertical line with the given length
1655 starting at a given position.
1656 <tag/Limits/<itemize>
1657 <item>The character used to draw the vertical line is system dependent.
1658 If available, a line drawing character is used. Drawing a line that is partially
1659 off screen leads to undefined behaviour.
1660 <item>The function is only available as fastcall function, so it may only be
1661 used in presence of a prototype.
1663 <tag/Availability/cc65
1665 <ref id="chline" name="chline">,
1666 <ref id="chlinexy" name="chlinexy">,
1667 <ref id="cvline" name="cvline">
1673 <sect1>div<label id="div"><p>
1677 <tag/Function/Divide two ints and return quotient and remainder.
1678 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1679 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
1680 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
1681 quotient and remainder in a <tt/div_t/ structure.
1684 <item>The function is only available as fastcall function, so it may only
1685 be used in presence of a prototype.
1687 <tag/Availability/ISO 9899
1695 <sect1>em_commit<label id="em_commit"><p>
1699 <tag/Function/Commit changes into extended memory.
1700 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1701 <tag/Declaration/<tt/void __fastcall__ em_commit (void);/
1702 <tag/Description/Commit changes in the memory window to extended storage. If
1703 the contents of the memory window have been changed, these changes may be lost
1704 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
1705 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
1706 name="em_copyto">/ are called without calling <tt/em_commit/ first.
1707 <tag/Limits/<itemize>
1708 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
1709 memory window are discarded, it does just mean that the drivers is allowed
1711 <item>The function is only available as fastcall function, so it may only be
1712 used in presence of a prototype.
1713 <item>The function produces undefined results if no extended memory driver is
1716 <tag/Availability/cc65
1718 <ref id="em_load_driver" name="em_load_driver">,
1719 <ref id="em_map" name="em_map">,
1720 <ref id="em_use" name="em_use">
1726 <sect1>em_copyfrom<label id="em_copyfrom"><p>
1730 <tag/Function/Copy from extended into normal memory.
1731 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1732 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
1733 <tag/Description/Copy data from extended memory into linear memory. Source and
1734 target addresses as well as the number of bytes to transfer are specified in
1735 the <tt/em_copy/ structure that is passed as a parameter.
1736 <tag/Limits/<itemize>
1737 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
1738 made any changes to the data in the window, call <tt/<ref id="em_commit"
1739 name="em_commit">/ first, or the changes are lost.
1740 <item>The function is only available as fastcall function, so it may only be
1741 used in presence of a prototype.
1742 <item>The function produces undefined results if no extended memory driver is
1745 <tag/Availability/cc65
1747 <ref id="em_commit" name="em_commit">,
1748 <ref id="em_copyto" name="em_copyto">,
1749 <ref id="em_load_driver" name="em_load_driver">
1755 <sect1>em_copyto<label id="em_copyto"><p>
1759 <tag/Function/Copy from normal into extended memory.
1760 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1761 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
1762 <tag/Description/Copy data from linear into extended memory. Source and
1763 target addresses as well as the number of bytes to transfer are specified in
1764 the <tt/em_copy/ structure that is passed as a parameter.
1765 <tag/Limits/<itemize>
1766 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
1767 made any changes to the data in the window, call <tt/<ref id="em_commit"
1768 name="em_commit">/ first, or the changes are lost.
1769 <item>The function is only available as fastcall function, so it may only be
1770 used in presence of a prototype.
1771 <item>The function produces undefined results if no extended memory driver is
1774 <tag/Availability/cc65
1776 <ref id="em_commit" name="em_commit">,
1777 <ref id="em_copyfrom" name="em_copyfrom">,
1778 <ref id="em_load_driver" name="em_load_driver">
1784 <sect1>em_install<label id="em_install"><p>
1788 <tag/Function/Install an already loaded extended memory driver.
1789 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1790 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
1791 <tag/Description/The function installs an already loaded extended memory driver
1792 and returns an error code. The function may be used to install a driver linked
1793 statically to the program.
1794 <tag/Limits/<itemize>
1795 <item>Not all drivers are able to detect if the supported hardware is really
1797 <item>The function is only available as fastcall function, so it may only be
1798 used in presence of a prototype.
1800 <tag/Availability/cc65
1802 <ref id="em_load_driver" name="em_load_driver">,
1803 <ref id="em_uninstall" name="em_uninstall">,
1804 <ref id="em_unload" name="em_unload">
1810 <sect1>em_load_driver<label id="em_load_driver"><p>
1814 <tag/Function/Load and initialize an extended memory driver.
1815 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1816 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
1817 <tag/Description/Load an extended memory driver into memory and initialize
1818 it. The function returns an error code that tells if all this has been
1820 <tag/Limits/<itemize>
1821 <item>Not all drivers are able to detect if the supported hardware is really
1823 <item>The function is only available as fastcall function, so it may only be
1824 used in presence of a prototype.
1825 <item>The driver is loaded by name, so currently you must know the type of
1826 extended memory that should be supported. There is no autodetect capability.
1828 <tag/Availability/cc65
1830 <ref id="em_unload" name="em_unload">
1836 <sect1>em_map<label id="em_map"><p>
1840 <tag/Function/Make a page of extended memory accessible.
1841 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1842 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
1843 <tag/Description/The function maps one page of extended memory into linear
1844 memory and returns a pointer to the page frame. Depending on the hardware
1845 and driver, the data is either mapped into the address space or transfered
1846 into a buffer. If you don't need the actual contents of the page (for example
1847 because you're going to overwrite it completely, it is better to call
1848 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
1849 data if it is possible to avoid that.
1850 <tag/Limits/<itemize>
1851 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
1852 made any changes to the data in the window, call <tt/<ref id="em_commit"
1853 name="em_commit">/ first, or the changes are lost.
1854 <item>The function is only available as fastcall function, so it may only be
1855 used in presence of a prototype.
1856 <item>The function produces undefined results if no extended memory driver is
1859 <tag/Availability/cc65
1861 <ref id="em_commit" name="em_commit">,
1862 <ref id="em_load_driver" name="em_load_driver">,
1863 <ref id="em_use" name="em_use">
1869 <sect1>em_pagecount<label id="em_pagecount"><p>
1873 <tag/Function/Return the number of available extended memory pages.
1874 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1875 <tag/Declaration/<tt/unsigned __fastcall__ em_pagecount (void);/
1876 <tag/Description/The function returns the size of the extended memory supported
1877 by the driver in 256 byte pages.
1878 <tag/Limits/<itemize>
1879 <item>The function returns zero if no extended memory driver is loaded.
1880 <item>The function may return zero if the supported hardware was not detected.
1882 <tag/Availability/cc65
1884 <ref id="em_load_driver" name="em_load_driver">
1890 <sect1>em_uninstall<label id="em_uninstall"><p>
1894 <tag/Function/Uninstall an already loaded extended memory driver.
1895 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1896 <tag/Declaration/<tt/unsigned char __fastcall__ em_install (void);/
1897 <tag/Description/The function uninstalls an already loaded extended memory
1898 driver but doesn't remove it from memory.
1899 <tag/Limits/<itemize>
1900 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
1901 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
1902 should be used instead of <tt/em_uninstall/ so the driver is also removed
1904 <item>The function is only available as fastcall function, so it may only be
1905 used in presence of a prototype.
1907 <tag/Availability/cc65
1909 <ref id="em_install" name="em_install">,
1910 <ref id="em_load_driver" name="em_load_driver">,
1911 <ref id="em_unload" name="em_unload">
1917 <sect1>em_unload<label id="em_unload"><p>
1921 <tag/Function/Unload an extended memory driver.
1922 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1923 <tag/Declaration/<tt/unsigned char __fastcall__ em_unload (void);/
1924 <tag/Description/The function unloads a loaded extended memory driver and
1925 frees all memory allocated for the driver.
1926 <tag/Limits/<itemize>
1927 <item>The function does nothing if no driver is loaded.
1929 <tag/Availability/cc65
1931 <ref id="em_load_driver" name="em_load_driver">
1937 <sect1>em_use<label id="em_use"><p>
1941 <tag/Function/Prepare an extended memory page for use.
1942 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1943 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
1944 <tag/Description/The function maps one page of extended memory into linear
1945 memory and returns a pointer to the page frame. This function is similar to
1946 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
1947 actual memory window in the assumption that the existing data is wrong or
1948 will get overwritten.
1949 <tag/Limits/<itemize>
1950 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
1951 made any changes to the data in the window, call <tt/<ref id="em_commit"
1952 name="em_commit">/ first, or the changes are lost.
1953 <item>The function is only available as fastcall function, so it may only be
1954 used in presence of a prototype.
1955 <item>The function produces undefined results if no extended memory driver is
1958 <tag/Availability/cc65
1960 <ref id="em_commit" name="em_commit">,
1961 <ref id="em_load_driver" name="em_load_driver">,
1962 <ref id="em_map" name="em_map">
1968 <sect1>exit<label id="exit"><p>
1972 <tag/Function/Terminate the program.
1973 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1974 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
1975 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
1976 return code of the program. Before termination, all files are closed, buffered
1977 output is written and any functions registered with <tt/<ref id="atexit"
1978 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
1979 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
1981 <tag/Limits/<itemize>
1982 <item>The function is only available as fastcall function, so it may only
1983 be used in presence of a prototype.
1984 <item>It depends on the host machine if the program return code can be
1985 evaluated or is ignored.
1987 <tag/Availability/ISO 9899
1989 <ref id="abort" name="abort">,
1990 <ref id="exit" name="exit">
1996 <sect1>fast<label id="fast"><p>
2000 <tag/Function/Switch the C128 into 2MHz mode.
2001 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
2002 <tag/Declaration/<tt/void fast (void);/
2003 <tag/Description/The function will switch the clock of the C128 to 2MHz. This
2004 will nearly double the speed compared to slow mode.
2005 <tag/Limits/<itemize>
2006 <item>The function is specific to the C128.
2007 <item>2MHz clock will not work in 40 column mode.
2009 <tag/Availability/C128
2011 <ref id="slow" name="slow">,
2012 <ref id="toggle_videomode" name="toggle_videomode">,
2013 <ref id="videomode" name="videomode">
2019 <sect1>feof<label id="feof"><p>
2023 <tag/Function/Return the end-of-file indicator of a stream.
2024 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2025 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
2026 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
2027 <tt/f/, and returns a non zero value if it is set.
2028 <tag/Limits/<itemize>
2029 <item>The indicator is set only after a read past the end of a file is
2031 <item>The function is only available as fastcall function, so it may only be
2032 used in presence of a prototype.
2034 <tag/Availability/ISO 9899
2036 <ref id="feof" name="clearerr">,
2037 <ref id="ferror" name="ferror">
2043 <sect1>ferror<label id="ferror"><p>
2047 <tag/Function/Return the error indicator of a stream.
2048 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2049 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
2050 <tag/Description/<tt/ferror/ tests the error indicator of the stream
2051 <tt/f/, and returns a non zero value if it is set.
2052 <tag/Limits/<itemize>
2053 <item>The function is only available as fastcall function, so it may only be
2054 used in presence of a prototype.
2056 <tag/Availability/ISO 9899
2058 <ref id="feof" name="clearerr">,
2059 <ref id="ferror" name="feof">
2065 <sect1>fileno<label id="fileno"><p>
2069 <tag/Function/Return the file handle used by a stream.
2070 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2071 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
2072 <tag/Description/The <tt/fileno/ function returns the file handle used
2073 internally by a C stream. This file handle (an integer) can be used as a
2074 handle for the POSIX input/output functions.
2075 <tag/Limits/<itemize>
2076 <item>The function is only available as fastcall function, so it may only be
2077 used in presence of a prototype.
2078 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
2079 file may have unpredictable results.
2081 <tag/Availability/POSIX 1003.1
2083 <ref id="creat" name="creat">,
2084 <ref id="open" name="open"> <!-- , -->
2085 <!-- <ref id="read" name="read">, -->
2086 <!-- <ref id="write" name="write"> -->
2092 <sect1>free<label id="free"><p>
2096 <tag/Function/Free a block of dynamic memory.
2097 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2098 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
2099 <tag/Description/Free a block of dynamic memory previously allocated with
2100 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
2101 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
2102 pointer is <tt/NULL/, no action is performed.
2105 <item>Passing an already free'd block to <tt/free/ again will cause undefined
2106 behaviour and may crash your program.
2107 <item>The function is only available as fastcall function, so it may only
2108 be used in presence of a prototype.
2110 <tag/Availability/ISO 9899
2112 <ref id="_heapadd" name="_heapadd">,
2113 <ref id="_heapblocksize" name="_heapblocksize">,
2114 <ref id="_heapmaxavail" name="_heapmaxavail">,
2115 <ref id="_heapmemavail" name="_heapmemavail">,
2116 <ref id="calloc" name="calloc">,
2117 <ref id="malloc" name="malloc">,
2118 <ref id="realloc" name="realloc">
2124 <sect1>get_ostype<label id="get_ostype"><p>
2128 <tag/Function/The function returns the operating system, the program runs on.
2129 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
2130 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
2131 <tag/Declaration/<tt/unsigned char get_ostype (void);/
2132 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
2133 all supported targets. If it exists, it returns a number that identifies the
2134 operating system or machine type, the program runs on. The machine dependent
2135 header files define constants that can be used to check the return code.
2136 <tag/Limits/<itemize>
2137 <item>The function does not exist on all platforms.
2138 <item>The return codes are platform dependent.
2140 <tag/Availability/cc65 (not all platforms)
2146 <sect1>getenv<label id="getenv"><p>
2150 <tag/Function/Return a value from the environment.
2151 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2152 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
2153 <tag/Description/The function searches the environment for an entry that
2154 matches <tt/name/ and returns its value. The environment consists of a list
2155 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
2157 <tag/Limits/<itemize>
2158 <item>What exactly is stored in the environment depends on the machine the
2159 program is running on.
2160 <item>The function is only available as fastcall function, so it may only
2161 be used in presence of a prototype.
2163 <tag/Availability/ISO 9899
2169 <sect1>getcpu<label id="getcpu"><p>
2173 <tag/Function/Determine on which CPU the program is running.
2174 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
2175 <tag/Declaration/<tt/unsigned char getcpu (void);/
2176 <tag/Description/The function checks on which CPU the code is running. It
2177 returns one of the constants<itemize>
2179 <item><tt/CPU_65C02/
2180 <item><tt/CPU_65816/
2182 <tag/Limits/<itemize>
2183 <item>Other, more exotic CPU types are not disinguished.
2185 <tag/Availability/cc65
2191 <sect1>gotox<label id="gotox"><p>
2195 <tag/Function/Move the text mode cursor to a new X position.
2196 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2197 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
2198 <tag/Description/The function moves the text mode cursor to the specified X
2199 position while leaving the Y position untouched. The leftmost position on the
2200 screen has the coordinate 0.
2201 <tag/Limits/<itemize>
2202 <item>The function is only available as fastcall function, so it may
2203 only be used in presence of a prototype.
2204 <item>Invalid values for the X position (out of screen coordinates) may
2205 lead to undefined behaviour.
2207 <tag/Availability/cc65
2209 <ref id="gotoy" name="gotoy">,
2210 <ref id="gotoxy" name="gotoxy">,
2211 <ref id="wherex" name="wherex">,
2212 <ref id="wherey" name="wherey">
2218 <sect1>gotoxy<label id="gotoxy"><p>
2222 <tag/Function/Move the text mode cursor to a new position.
2223 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2224 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
2225 <tag/Description/The function moves the text mode cursor to the specified
2226 position. The leftmost position on the screen has the X coordinate 0, the
2227 topmost line has the Y coordinate 0.
2228 <tag/Limits/<itemize>
2229 <item>The function is only available as fastcall function, so it may only be
2230 used in presence of a prototype.
2231 <item>Invalid values for any of both coordinates (out of screen positions) may
2232 lead to undefined behaviour.
2234 <tag/Availability/cc65
2236 <ref id="gotox" name="gotox">,
2237 <ref id="gotoy" name="gotoy">,
2238 <ref id="wherex" name="wherex">,
2239 <ref id="wherey" name="wherey">
2245 <sect1>gotoy<label id="gotoy"><p>
2249 <tag/Function/Move the text mode cursor to a new Y position.
2250 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2251 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
2252 <tag/Description/The function moves the text mode cursor to the specified Y
2253 position while leaving the X position untouched. The uppermost position on the
2254 screen has the coordinate 0.
2255 <tag/Limits/<itemize>
2256 <item>The function is only available as fastcall function, so it may
2257 only be used in presence of a prototype.
2258 <item>Invalid values for the Y position (out of screen coordinates) may lead
2259 to undefined behaviour.
2261 <tag/Availability/cc65
2263 <ref id="gotox" name="gotox">,
2264 <ref id="gotoxy" name="gotoxy">,
2265 <ref id="wherex" name="wherex">,
2266 <ref id="wherey" name="wherey">
2272 <sect1>isalnum<label id="isalnum"><p>
2276 <tag/Function/Check if a given character is a letter or digit.
2277 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2278 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
2279 <tag/Description/The function returns a value of zero if the given argument
2280 is a letter or digit. The return value is non zero if the character
2282 <tag/Limits/<itemize>
2283 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2284 inline sequence generated by the macro will not work correctly for values
2285 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2286 this range. The non inline function may be accessed by <tt/#undef/'ing
2288 <item>When compiling without <tt/-Os/, the function is only available as
2289 fastcall function, so it may only be used in presence of a prototype.
2291 <tag/Availability/ISO 9899
2293 <ref id="isalpha" name="isalpha">,
2294 <ref id="isascii" name="isascii">,
2295 <ref id="isblank" name="isblank">,
2296 <ref id="iscntrl" name="iscntrl">,
2297 <ref id="isdigit" name="isdigit">,
2298 <ref id="isgraph" name="isgraph">,
2299 <ref id="islower" name="islower">,
2300 <ref id="isprint" name="isprint">,
2301 <ref id="ispunct" name="ispunct">,
2302 <ref id="isspace" name="isspace">,
2303 <ref id="isupper" name="isupper">,
2304 <ref id="isxdigit" name="isxdigit">
2310 <sect1>isalpha<label id="isalpha"><p>
2314 <tag/Function/Check if a given character is a letter.
2315 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2316 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
2317 <tag/Description/The function returns a value of zero if the given argument
2318 is a letter. The return value is non zero if the character is anything else.
2319 <tag/Limits/<itemize>
2320 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2321 inline sequence generated by the macro will not work correctly for values
2322 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2323 this range. The non inline function may be accessed by <tt/#undef/'ing the
2325 <item>When compiling without <tt/-Os/, the function is only available as
2326 fastcall function, so it may only be used in presence of a prototype.
2328 <tag/Availability/ISO 9899
2330 <ref id="isalnum" name="isalnum">,
2331 <ref id="isascii" name="isascii">,
2332 <ref id="isblank" name="isblank">,
2333 <ref id="iscntrl" name="iscntrl">,
2334 <ref id="isdigit" name="isdigit">,
2335 <ref id="isgraph" name="isgraph">,
2336 <ref id="islower" name="islower">,
2337 <ref id="isprint" name="isprint">,
2338 <ref id="ispunct" name="ispunct">,
2339 <ref id="isspace" name="isspace">,
2340 <ref id="isupper" name="isupper">,
2341 <ref id="isxdigit" name="isxdigit">
2347 <sect1>isascii<label id="isascii"><p>
2351 <tag/Function/Check if a given character is in the ASCII (0..127) range.
2352 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2353 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
2354 <tag/Description/The function returns a value of zero if the given argument
2355 is in the range 0..127 (the range of valid ASCII characters) and a non zero
2357 <tag/Limits/<itemize>
2358 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2359 inline sequence generated by the macro will not work correctly for values
2360 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2361 this range. The non inline function may be accessed by <tt/#undef/'ing the
2363 <item>When compiling without <tt/-Os/, the function is only available as
2364 fastcall function, so it may only be used in presence of a prototype.
2366 <tag/Availability/ISO 9899
2368 <ref id="isalnum" name="isalnum">,
2369 <ref id="isalpha" name="isalpha">,
2370 <ref id="isblank" name="isblank">,
2371 <ref id="iscntrl" name="iscntrl">,
2372 <ref id="isdigit" name="isdigit">,
2373 <ref id="isgraph" name="isgraph">,
2374 <ref id="islower" name="islower">,
2375 <ref id="isprint" name="isprint">,
2376 <ref id="ispunct" name="ispunct">,
2377 <ref id="isspace" name="isspace">,
2378 <ref id="isupper" name="isupper">,
2379 <ref id="isxdigit" name="isxdigit">
2385 <sect1>isblank<label id="isblank"><p>
2389 <tag/Function/Check if a given character is a space or tab.
2390 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2391 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
2392 <tag/Description/The function returns a value of zero if the given argument
2393 is a space or tab character. The return value is non zero if the character
2395 <tag/Limits/<itemize>
2396 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2397 inline sequence generated by the macro will not work correctly for values
2398 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2399 this range. The non inline function may be accessed by <tt/#undef/'ing the
2401 <item>When compiling without <tt/-Os/, the function is only available as
2402 fastcall function, so it may only be used in presence of a prototype.
2404 <tag/Availability/cc65
2406 <ref id="isalnum" name="isalnum">,
2407 <ref id="isalpha" name="isalpha">,
2408 <ref id="isascii" name="isascii">,
2409 <ref id="iscntrl" name="iscntrl">,
2410 <ref id="isdigit" name="isdigit">,
2411 <ref id="isgraph" name="isgraph">,
2412 <ref id="islower" name="islower">,
2413 <ref id="isprint" name="isprint">,
2414 <ref id="ispunct" name="ispunct">,
2415 <ref id="isspace" name="isspace">,
2416 <ref id="isupper" name="isupper">,
2417 <ref id="isxdigit" name="isxdigit">
2423 <sect1>iscntrl<label id="iscntrl"><p>
2427 <tag/Function/Check if a given character is a control character.
2428 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2429 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
2430 <tag/Description/The function returns a value of zero if the given argument
2431 is a control character. The return value is non zero if the character
2433 <tag/Limits/<itemize>
2434 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2435 inline sequence generated by the macro will not work correctly for values
2436 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2437 this range. The non inline function may be accessed by <tt/#undef/'ing the
2439 <item>When compiling without <tt/-Os/, the function is only available as
2440 fastcall function, so it may only be used in presence of a prototype.
2442 <tag/Availability/ISO 9899
2444 <ref id="isalnum" name="isalnum">,
2445 <ref id="isalpha" name="isalpha">,
2446 <ref id="isascii" name="isascii">,
2447 <ref id="isblank" name="isblank">,
2448 <ref id="isdigit" name="isdigit">,
2449 <ref id="isgraph" name="isgraph">,
2450 <ref id="islower" name="islower">,
2451 <ref id="isprint" name="isprint">,
2452 <ref id="ispunct" name="ispunct">,
2453 <ref id="isspace" name="isspace">,
2454 <ref id="isupper" name="isupper">,
2455 <ref id="isxdigit" name="isxdigit">
2461 <sect1>isdigit<label id="isdigit"><p>
2465 <tag/Function/Check if a given character is a digit.
2466 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2467 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
2468 <tag/Description/The function returns a value of zero if the given argument
2469 is a digit. The return value is non zero if the character is anything else.
2470 <tag/Limits/<itemize>
2471 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2472 inline sequence generated by the macro will not work correctly for values
2473 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2474 this range. The non inline function may be accessed by <tt/#undef/'ing the
2476 <item>When compiling without <tt/-Os/, the function is only available as
2477 fastcall function, so it may only be used in presence of a prototype.
2479 <tag/Availability/ISO 9899
2481 <ref id="isalnum" name="isalnum">,
2482 <ref id="isalpha" name="isalpha">,
2483 <ref id="isascii" name="isascii">,
2484 <ref id="isblank" name="isblank">,
2485 <ref id="iscntrl" name="iscntrl">,
2486 <ref id="isgraph" name="isgraph">,
2487 <ref id="islower" name="islower">,
2488 <ref id="isprint" name="isprint">,
2489 <ref id="ispunct" name="ispunct">,
2490 <ref id="isspace" name="isspace">,
2491 <ref id="isupper" name="isupper">,
2492 <ref id="isxdigit" name="isxdigit">
2498 <sect1>isgraph<label id="isgraph"><p>
2502 <tag/Function/Check if a given character is a printable character (except
2504 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2505 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
2506 <tag/Description/The function returns a value of zero if the given argument
2507 is a printable character with the exception of space. The return value is non
2508 zero if the character is anything else.
2509 <tag/Limits/<itemize>
2510 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2511 inline sequence generated by the macro will not work correctly for values
2512 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2513 this range. The non inline function may be accessed by <tt/#undef/'ing the
2515 <item>When compiling without <tt/-Os/, the function is only available as
2516 fastcall function, so it may only be used in presence of a prototype.
2518 <tag/Availability/ISO 9899
2520 <ref id="isalnum" name="isalnum">,
2521 <ref id="isalpha" name="isalpha">,
2522 <ref id="isascii" name="isascii">,
2523 <ref id="isblank" name="isblank">,
2524 <ref id="iscntrl" name="iscntrl">,
2525 <ref id="isdigit" name="isdigit">,
2526 <ref id="islower" name="islower">,
2527 <ref id="isprint" name="isprint">,
2528 <ref id="ispunct" name="ispunct">,
2529 <ref id="isspace" name="isspace">,
2530 <ref id="isupper" name="isupper">,
2531 <ref id="isxdigit" name="isxdigit">
2537 <sect1>islower<label id="islower"><p>
2541 <tag/Function/Check if a given character is a lower case letter.
2542 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2543 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
2544 <tag/Description/The function returns a value of zero if the given argument
2545 is a lower case letter. The return value is non zero if the character is
2547 <tag/Limits/<itemize>
2548 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2549 inline sequence generated by the macro will not work correctly for values
2550 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2551 this range. The non inline function may be accessed by <tt/#undef/'ing the
2553 <item>When compiling without <tt/-Os/, the function is only available as
2554 fastcall function, so it may only be used in presence of a prototype.
2556 <tag/Availability/ISO 9899
2558 <ref id="isalnum" name="isalnum">,
2559 <ref id="isalpha" name="isalpha">,
2560 <ref id="isascii" name="isascii">,
2561 <ref id="isblank" name="isblank">,
2562 <ref id="iscntrl" name="iscntrl">,
2563 <ref id="isdigit" name="isdigit">,
2564 <ref id="isgraph" name="isgraph">,
2565 <ref id="isprint" name="isprint">,
2566 <ref id="ispunct" name="ispunct">,
2567 <ref id="isspace" name="isspace">,
2568 <ref id="isupper" name="isupper">,
2569 <ref id="isxdigit" name="isxdigit">
2575 <sect1>isprint<label id="isprint"><p>
2579 <tag/Function/Check if a given character is a printable character.
2580 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2581 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
2582 <tag/Description/The function returns a value of zero if the given argument
2583 is a printable character (this includes the space character). The return value
2584 is non zero if the character is anything else.
2585 <tag/Limits/<itemize>
2586 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2587 inline sequence generated by the macro will not work correctly for values
2588 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2589 this range. The non inline function may be accessed by <tt/#undef/'ing the
2591 <item>When compiling without <tt/-Os/, the function is only available as
2592 fastcall function, so it may only be used in presence of a prototype.
2594 <tag/Availability/ISO 9899
2596 <ref id="isalnum" name="isalnum">,
2597 <ref id="isalpha" name="isalpha">,
2598 <ref id="isascii" name="isascii">,
2599 <ref id="isblank" name="isblank">,
2600 <ref id="iscntrl" name="iscntrl">,
2601 <ref id="isdigit" name="isdigit">,
2602 <ref id="isgraph" name="isgraph">,
2603 <ref id="islower" name="islower">,
2604 <ref id="ispunct" name="ispunct">,
2605 <ref id="isspace" name="isspace">,
2606 <ref id="isupper" name="isupper">,
2607 <ref id="isxdigit" name="isxdigit">
2613 <sect1>ispunct<label id="ispunct"><p>
2617 <tag/Function/Check if a given character is a printable character but not a
2618 space or an alphanumeric character.
2619 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2620 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
2621 <tag/Description/The function returns a value of zero if the given argument
2622 is a printable character, but not a space or anything alphanumeric. The return
2623 value is non zero if the character is anything else.
2624 <tag/Limits/<itemize>
2625 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2626 inline sequence generated by the macro will not work correctly for values
2627 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2628 this range. The non inline function may be accessed by <tt/#undef/'ing the
2630 <item>When compiling without <tt/-Os/, the function is only available as
2631 fastcall function, so it may only be used in presence of a prototype.
2633 <tag/Availability/ISO 9899
2635 <ref id="isalnum" name="isalnum">,
2636 <ref id="isalpha" name="isalpha">,
2637 <ref id="isascii" name="isascii">,
2638 <ref id="isblank" name="isblank">,
2639 <ref id="iscntrl" name="iscntrl">,
2640 <ref id="isdigit" name="isdigit">,
2641 <ref id="isgraph" name="isgraph">,
2642 <ref id="islower" name="islower">,
2643 <ref id="isprint" name="isprint">,
2644 <ref id="isspace" name="isspace">,
2645 <ref id="isupper" name="isupper">,
2646 <ref id="isxdigit" name="isxdigit">
2652 <sect1>isspace<label id="isspace"><p>
2656 <tag/Function/Check if a given character is a a white-space character.
2657 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2658 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
2659 <tag/Description/The function returns a value of zero if the given argument
2660 is a white space character. The return value is non zero if the character is
2661 anything else. The standard white space characters are: space, formfeed ('\f'),
2662 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
2664 <tag/Limits/<itemize>
2665 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2666 inline sequence generated by the macro will not work correctly for values
2667 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2668 this range. The non inline function may be accessed by <tt/#undef/'ing the
2670 <item>When compiling without <tt/-Os/, the function is only available as
2671 fastcall function, so it may only be used in presence of a prototype.
2673 <tag/Availability/ISO 9899
2675 <ref id="isalnum" name="isalnum">,
2676 <ref id="isalpha" name="isalpha">,
2677 <ref id="isascii" name="isascii">,
2678 <ref id="isblank" name="isblank">,
2679 <ref id="iscntrl" name="iscntrl">,
2680 <ref id="isdigit" name="isdigit">,
2681 <ref id="isgraph" name="isgraph">,
2682 <ref id="islower" name="islower">,
2683 <ref id="isprint" name="isprint">,
2684 <ref id="ispunct" name="ispunct">,
2685 <ref id="isupper" name="isupper">,
2686 <ref id="isxdigit" name="isxdigit">
2692 <sect1>isupper<label id="isupper"><p>
2696 <tag/Function/Check if a given character is an upper case letter.
2697 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2698 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
2699 <tag/Description/The function returns a value of zero if the given argument
2700 is an upper case letter. The return value is non zero if the character is
2702 <tag/Limits/<itemize>
2703 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2704 inline sequence generated by the macro will not work correctly for values
2705 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2706 this range. The non inline function may be accessed by <tt/#undef/'ing the
2708 <item>When compiling without <tt/-Os/, the function is only available as
2709 fastcall function, so it may only be used in presence of a prototype.
2711 <tag/Availability/ISO 9899
2713 <ref id="isalnum" name="isalnum">,
2714 <ref id="isalpha" name="isalpha">,
2715 <ref id="isascii" name="isascii">,
2716 <ref id="isblank" name="isblank">,
2717 <ref id="iscntrl" name="iscntrl">,
2718 <ref id="isdigit" name="isdigit">,
2719 <ref id="isgraph" name="isgraph">,
2720 <ref id="islower" name="islower">,
2721 <ref id="isprint" name="isprint">,
2722 <ref id="ispunct" name="ispunct">,
2723 <ref id="isspace" name="isspace">,
2724 <ref id="isxdigit" name="isxdigit">
2730 <sect1>isxdigit<label id="isxdigit"><p>
2734 <tag/Function/Check if a given character is a hexadecimal digit.
2735 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2736 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
2737 <tag/Description/The function returns a value of zero if the given argument
2738 is a hexadecimal digit (0..9, a..f and A..F). The return value is non zero
2739 if the character is anything else.
2740 <tag/Limits/<itemize>
2741 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2742 inline sequence generated by the macro will not work correctly for values
2743 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2744 this range. The non inline function may be accessed by <tt/#undef/'ing the
2746 <item>When compiling without <tt/-Os/, the function is only available as
2747 fastcall function, so it may only be used in presence of a prototype.
2749 <tag/Availability/ISO 9899
2751 <ref id="isalnum" name="isalnum">,
2752 <ref id="isalpha" name="isalpha">,
2753 <ref id="isascii" name="isascii">,
2754 <ref id="isblank" name="isblank">,
2755 <ref id="iscntrl" name="iscntrl">,
2756 <ref id="isdigit" name="isdigit">,
2757 <ref id="isgraph" name="isgraph">,
2758 <ref id="islower" name="islower">,
2759 <ref id="isprint" name="isprint">,
2760 <ref id="ispunct" name="ispunct">,
2761 <ref id="isspace" name="isspace">,
2762 <ref id="isupper" name="isupper">
2768 <sect1>itoa<label id="itoa"><p>
2772 <tag/Function/Convert an integer into a string.
2773 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2774 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
2775 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
2776 <tt/radix/ as the base.
2777 <tag/Limits/<itemize>
2778 <item>There are no provisions to prevent a buffer overflow.
2779 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
2780 <item>The function is non standard, so it is not available in strict ANSI mode.
2781 You should probably use <tt/sprintf/ instead.
2782 <item>The function is only available as fastcall function, so it may only be
2783 used in presence of a prototype.
2785 <tag/Availability/cc65
2787 <ref id="atoi" name="atoi">,
2788 <ref id="atol" name="atol">,
2789 <ref id="ltoa" name="ltoa">,
2790 <ref id="ultoa" name="ultoa">,
2791 <ref id="utoa" name="utoa">
2797 <sect1>joy_count<label id="joy_count"><p>
2801 <tag/Function/Return the number of joysticks supported by the current driver.
2802 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2803 <tag/Declaration/<tt/unsigned char __fastcall__ joy_count (void);/
2804 <tag/Description/The function returns a the number of joysticks supported
2805 by the current joystick driver.
2806 <tag/Limits/<itemize>
2807 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
2808 name="joy_load_driver"> before calling this function.
2809 <item>The function returns the number of joysticks supported by the driver.
2810 There's no way to check for the number of actually connected joysticks.
2811 <item>The function is only available as fastcall function, so it may only be
2812 used in presence of a prototype.
2814 <tag/Availability/cc65
2816 <ref id="joy_load_driver" name="joy_load_driver">,
2817 <ref id="joy_read" name="joy_read">
2823 <sect1>joy_install<label id="joy_install"><p>
2827 <tag/Function/Install an already loaded driver and return an error code.
2828 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2829 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
2830 <tag/Description/The function installs a driver that was already loaded into
2831 memory (or linked statically to the program). It returns an error code
2832 (<tt/JOY_ERR_OK/ in case of success).
2833 <tag/Limits/<itemize>
2834 <item>The function is only available as fastcall function, so it may only be
2835 used in presence of a prototype.
2837 <tag/Availability/cc65
2839 <ref id="joy_load_driver" name="joy_load_driver">,
2840 <ref id="joy_uninstall" name="joy_uninstall">,
2841 <ref id="joy_unload" name="joy_unload">
2847 <sect1>joy_load_driver<label id="joy_load_driver"><p>
2851 <tag/Function/Load a driver from disk and install it.
2852 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2853 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
2854 <tag/Description/The function loads a driver with the given name from disk
2855 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
2856 driver was successfully loaded and installed.
2857 <tag/Limits/<itemize>
2858 <item>The function is only available as fastcall function, so it may only be
2859 used in presence of a prototype.
2861 <tag/Availability/cc65
2863 <ref id="joy_install" name="joy_install">,
2864 <ref id="joy_uninstall" name="joy_uninstall">,
2865 <ref id="joy_unload" name="joy_unload">
2871 <sect1>joy_read<label id="joy_read"><p>
2875 <tag/Function/Read the status of a joystick.
2876 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2877 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
2878 <tag/Description/The function reads the status bits for a joystick. The number
2879 of the joystick is passed as parameter. The result may be examined by using one
2880 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
2881 <tag/Limits/<itemize>
2882 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
2883 name="joy_load_driver"> before calling this function.
2884 <item>The function is only available as fastcall function, so it may only be
2885 used in presence of a prototype.
2887 <tag/Availability/cc65
2889 <ref id="joy_count" name="joy_count">,
2890 <ref id="joy_load_driver" name="joy_load_driver">,
2891 <ref id="joy_unload" name="joy_unload">
2897 <sect1>joy_uninstall<label id="joy_uninstall"><p>
2901 <tag/Function/Uninstall the current joystick driver.
2902 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2903 <tag/Declaration/<tt/unsigned char __fastcall__ joy_uninstall (void);/
2904 <tag/Description/The function uninstalls the currently installed joystick
2905 driver. It does not remove the driver from memory. The function returns an
2906 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
2907 <tag/Limits/<itemize>
2908 <item>A joystick driver must be installed using <ref id="joy_install"
2909 name="joy_install"> before calling this function.
2910 <item>The function is only available as fastcall function, so it may only be
2911 used in presence of a prototype.
2913 <tag/Availability/cc65
2915 <ref id="joy_install" name="joy_install">,
2916 <ref id="joy_load_driver" name="joy_load_driver">,
2917 <ref id="joy_unload" name="joy_unload">
2923 <sect1>joy_unload<label id="joy_unload"><p>
2927 <tag/Function/Uninstall, then unload the current joystick driver.
2928 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2929 <tag/Declaration/<tt/unsigned char __fastcall__ joy_unload (void);/
2930 <tag/Description/The function uninstalls the currently installed joystick
2931 driver and removes it from memory. An error code is returned, which is
2932 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
2933 <tag/Limits/<itemize>
2934 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
2935 name="joy_load_driver"> before calling this function.
2936 <item>The function is only available as fastcall function, so it may only be
2937 used in presence of a prototype.
2939 <tag/Availability/cc65
2941 <ref id="joy_load_driver" name="joy_load_driver">
2947 <sect1>kbhit<label id="kbhit"><p>
2951 <tag/Function/Check if there's a key waiting in the keyboard buffer.
2952 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2953 <tag/Declaration/<tt/unsigned char kbhit (void);/
2954 <tag/Description/The function returns a value of zero if there is no character
2955 waiting to be read from the keyboard. It returns non zero otherwise.
2956 <tag/Limits/<itemize>
2957 <item>If the system does not support a keyboard buffer (most systems
2958 do), the function is rather useless.
2960 <tag/Availability/cc65
2962 <ref id="cgetc" name="cgetc">,
2963 <ref id="cursor" name="cursor">
2969 <sect1>labs<label id="labs"><p>
2973 <tag/Function/Returns the absolute value of a long integer.
2974 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2975 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
2976 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
2978 <tag/Limits/<itemize>
2979 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
2980 <item>The function is only available as fastcall function, so it may only be
2981 used in presence of a prototype.
2983 <tag/Availability/ISO 9899
2985 <ref id="abs" name="abs">
2991 <sect1>ltoa<label id="ltoa"><p>
2995 <tag/Function/Convert a long integer into a string.
2996 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2997 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
2998 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
2999 using <tt/radix/ as the base.
3000 <tag/Limits/<itemize>
3001 <item>There are no provisions to prevent a buffer overflow.
3002 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
3003 <item>The function is non standard, so it is not available in strict ANSI mode.
3004 You should probably use <tt/sprintf/ instead.
3005 <item>The function is only available as fastcall function, so it may only be
3006 used in presence of a prototype.
3008 <tag/Availability/cc65
3010 <ref id="atoi" name="atoi">,
3011 <ref id="atol" name="atol">,
3012 <ref id="itoa" name="itoa">,
3013 <ref id="ultoa" name="ultoa">,
3014 <ref id="utoa" name="utoa">
3020 <sect1>localeconv<label id="localeconv"><p>
3024 <tag/Function/Returns a pointer to the current locale structure.
3025 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
3026 <tag/Declaration/<tt/struct lconv* localeconv (void);/
3027 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
3029 <tag/Limits/<itemize>
3030 <item>cc65 supports only the "C" locale, so even after setting a new locale
3031 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
3034 <tag/Availability/ISO 9899
3036 <ref id="setlocale" name="setlocale">
3042 <sect1>longjmp<label id="longjmp"><p>
3046 <tag/Function/Non local goto.
3047 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
3048 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
3049 <tag/Description/The <tt/longjmp/ function restores a program context from the
3050 data in <tt/buf/, which must have been set by a preceeding call to
3051 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
3052 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
3056 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
3057 was called with a value of one.
3058 <item>The function is only available as fastcall function, so it may only
3059 be used in presence of a prototype.
3061 <tag/Availability/ISO 9899
3063 <ref id="setjmp" name="setjmp">
3069 <sect1>malloc<label id="malloc"><p>
3073 <tag/Function/Allocate dynamic memory.
3074 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3075 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
3076 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
3077 pointer to the allocated memory block. On error (not enough memory available),
3078 <tt/malloc/ returns <tt/NULL/.
3081 <item>The function is only available as fastcall function, so it may only
3082 be used in presence of a prototype.
3084 <tag/Availability/ISO 9899
3086 <ref id="_heapadd" name="_heapadd">,
3087 <ref id="_heapblocksize" name="_heapblocksize">,
3088 <ref id="_heapmaxavail" name="_heapmaxavail">,
3089 <ref id="_heapmemavail" name="_heapmemavail">,
3090 <ref id="calloc" name="calloc">,
3091 <ref id="free" name="free">,
3092 <ref id="realloc" name="realloc">,
3093 <ref id="strdup" name="strdup">
3099 <sect1>memchr<label id="memchr"><p>
3103 <tag/Function/Search for a character in a block of raw memory.
3104 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3105 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
3106 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
3107 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
3108 that is of size <tt/count/. Upon completion, the function returns a pointer to
3109 the character found, or a null pointer if the character was not found.
3110 <tag/Limits/<itemize>
3111 <item>The function is only available as fastcall function, so it may only
3112 be used in presence of a prototype.
3114 <tag/Availability/ISO 9899
3116 <ref id="strchr" name="strchr">
3122 <sect1>memcpy<label id="memcpy"><p>
3126 <tag/Function/Copy a memory area.
3127 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3128 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
3129 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
3130 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
3134 <item>The result is undefined if the memory areas do overlap. Use
3135 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
3136 <item>The function is only available as fastcall function, so it may only
3137 be used in presence of a prototype.
3139 <tag/Availability/ISO 9899
3141 <ref id="_swap" name="_swap">,
3142 <ref id="memmove" name="memmove">,
3143 <ref id="memset" name="memset">
3149 <sect1>memmove<label id="memmove"><p>
3153 <tag/Function/Copy a memory area.
3154 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3155 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
3156 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
3157 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
3161 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
3162 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
3163 <item>The function is only available as fastcall function, so it may only
3164 be used in presence of a prototype.
3166 <tag/Availability/ISO 9899
3168 <ref id="_swap" name="_swap">,
3169 <ref id="memcpy" name="memcpy">,
3170 <ref id="memset" name="memset">
3176 <sect1>memset<label id="memset"><p>
3180 <tag/Function/Fill a memory area.
3181 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3182 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
3183 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
3184 the value <tt/val/. The function returns <tt/p/.
3187 <item>The function is only available as fastcall function, so it may only
3188 be used in presence of a prototype.
3190 <tag/Availability/ISO 9899
3192 <ref id="_swap" name="_swap">,
3193 <ref id="bzero" name="bzero">,
3194 <ref id="memcpy" name="memcpy">,
3195 <ref id="memmove" name="memmove">
3201 <sect1>mod_free<label id="mod_free"><p>
3205 <tag/Function/Free a relocatable module.
3206 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
3207 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
3208 <tag/Description/The function will free a module loaded into memory by use of
3209 the <tt/<ref id="mod_load" name="mod_load">/ function.
3210 <tag/Limits/<itemize>
3211 <item>The pointer passed as parameter is the pointer to the module memory,
3212 not the pointer to the control structure.
3214 <tag/Availability/cc65
3216 <ref id="mod_load" name="mod_load">
3222 <sect1>mod_load<label id="mod_load"><p>
3226 <tag/Function/Load a relocatable module.
3227 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
3228 <tag/Declaration/<tt/unsigned char mod_load (struct mod_ctrl* ctrl);/
3229 <tag/Description/The function will load a code module into memory and relocate
3230 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
3231 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
3232 the module just loaded. Possible error codes are:
3234 <item><tt/MLOAD_OK/ - Module load successful
3235 <item><tt/MLOAD_ERR_READ/ - Read error
3236 <item><tt/MLOAD_ERR_HDR/ - Header error
3237 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
3238 <item><tt/MLOAD_ERR_FMT/ - Data format error
3239 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
3241 <tag/Limits/<itemize>
3242 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
3243 relocatable o65 modules for use with this function.
3245 <tag/Availability/cc65
3247 <ref id="mod_free" name="mod_free">
3253 <sect1>mouse_box<label id="mouse_box"><p>
3257 <tag/Function/Specify a bounding box for the mouse cursor.
3258 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3259 <tag/Declaration/<tt/void __fastcall__ mouse_box (int minx, int miny,
3260 int maxx, int maxy);/
3261 <tag/Description/The function allows to set a bounding box for mouse movement.
3262 <tag/Limits/<itemize>
3263 <item>The function does not check if the mouse cursor is currently within the
3264 given rectangle. Placing the mouse cursor within the bounding box is the
3265 responsibility of the programmer.
3266 <item>While the bounding box may be larger than the actual screen size, the
3267 standard mouse cursor draw routines may fail to set the cursor to coordinates
3268 outside of the screen area. Depending on the platform, you may have to supply
3269 your own mouse cursor routines.
3270 <item>The function is only available as fastcall function, so it may only be
3271 used in presence of a prototype.
3273 <tag/Availability/cc65
3275 <ref id="mouse_move" name="mouse_move">
3281 <sect1>mouse_buttons<label id="mouse_buttons"><p>
3285 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
3286 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3287 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_buttons (void);/
3288 <tag/Description/The function returns a bit mask that encodes the state of the
3289 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
3291 <tag/Limits/<itemize>
3292 <item>The function is only available as fastcall function, so it may only be
3293 used in presence of a prototype.
3295 <tag/Availability/cc65
3297 <ref id="mouse_info" name="mouse_info">,
3298 <ref id="mouse_pos" name="mouse_pos">
3304 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
3308 <tag/Function/Return a readable error message for an error code.
3309 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3310 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
3312 <tag/Description/The function returns an error message (in english) for the
3313 error code passed parameter.
3314 <tag/Limits/<itemize>
3315 <item>The function will return "Unknown error" for invalid error codes.
3316 <item>The function is only available as fastcall function, so it may only be
3317 used in presence of a prototype.
3319 <tag/Availability/cc65
3321 <ref id="mouse_load_driver" name="mouse_load_driver">,
3322 <ref id="mouse_uninstall" name="mouse_uninstall">,
3323 <ref id="mouse_unload" name="mouse_unload">
3329 <sect1>mouse_hide<label id="mouse_hide"><p>
3333 <tag/Function/Hide the mouse pointer.
3334 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3335 <tag/Declaration/<tt/void __fastcall__ mouse_hide (void);/
3336 <tag/Description/The function hides the mouse pointer. It manages a counter
3337 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
3338 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
3339 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
3341 <tag/Limits/<itemize>
3342 <item>The function is only available as fastcall function, so it may only be
3343 used in presence of a prototype.
3345 <tag/Availability/cc65
3347 <ref id="mouse_show" name="mouse_show">
3353 <sect1>mouse_info<label id="mouse_info"><p>
3357 <tag/Function/Return the state of the mouse buttons and the position of the
3359 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3360 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
3361 <tag/Description/The function returns the state of the mouse buttons and the
3362 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
3363 <tag/Limits/<itemize>
3364 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
3365 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
3366 name="mouse_pos">/ instead.
3367 <item>The function is only available as fastcall function, so it may only be
3368 used in presence of a prototype.
3370 <tag/Availability/cc65
3372 <ref id="mouse_buttons" name="mouse_buttons">,
3373 <ref id="mouse_pos" name="mouse_pos">
3379 <sect1>mouse_install<label id="mouse_install"><p>
3383 <tag/Function/Install an already loaded mouse driver.
3384 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3385 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
3386 mouse_callbacks* c, void* driver);/
3387 <tag/Description/The function installs an already loaded mouse driver and
3388 returns an error code. The <tt/mouse_callbacks/ structure passed as first
3389 parameter contains pointers to routines needed to move or hide/show the mouse
3390 pointer. Defaults for these routines are supplied by the library, so if you
3391 can live with these defaults (which are platform specific), just pass a
3392 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
3393 driver linked statically to the program.
3394 <tag/Limits/<itemize>
3395 <item>Not all drivers are able to detect if the supported hardware is really
3397 <item>After installing a driver, the mouse cursor is hidden.
3398 <item>The function is only available as fastcall function, so it may only be
3399 used in presence of a prototype.
3401 <tag/Availability/cc65
3403 <ref id="mouse_load_driver" name="mouse_load_driver">,
3404 <ref id="mouse_uninstall" name="mouse_uninstall">,
3405 <ref id="mouse_unload" name="mouse_unload">
3411 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
3415 <tag/Function/Call the driver specific ioctl function.
3416 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3417 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
3418 <tag/Description/The function calls the IOCTL entry in the mouse driver,
3419 which is driver specific. The <tt/code/ parameter will choose between
3420 different IOCTL functions, and the <tt/data/ depends on code. The
3421 function returns an error code. The purpose of this function is to allow
3422 for driver specific extensions. See the documentation for a specific mouse
3423 driver for supported ioctl calls.
3424 <tag/Limits/<itemize>
3425 <item>Calling this function is non portable, because each driver may
3426 implement different ioctl calls (or none at all).
3427 <item>The function is only available as fastcall function, so it may only be
3428 used in presence of a prototype.
3430 <tag/Availability/cc65
3436 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
3440 <tag/Function/Load and initialize a mouse driver.
3441 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3442 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
3443 mouse_callbacks* c, const char* driver);/
3444 <tag/Description/Load a mouse driver into memory and initialize it. The
3445 function returns an error code that tells if the call has been successful. The
3446 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
3447 routines needed to move or hide/show the mouse pointer. Defaults for these
3448 routines are supplied by the library, so if you can live with these defaults
3449 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
3450 <tag/Limits/<itemize>
3451 <item>The driver is loaded by name, so currently you must know the type of
3452 mouse that should be supported. There is no autodetect capability.
3453 <item>Not all drivers are able to detect if the supported hardware is really
3455 <item>After installing a driver, the mouse cursor is hidden.
3456 <item>The function is only available as fastcall function, so it may only be
3457 used in presence of a prototype.
3459 <tag/Availability/cc65
3461 <ref id="mouse_install" name="mouse_install">,
3462 <ref id="mouse_uninstall" name="mouse_uninstall">,
3463 <ref id="mouse_unload" name="mouse_unload">
3469 <sect1>mouse_move<label id="mouse_move"><p>
3473 <tag/Function/Move the mouse cursor to a specific position.
3474 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3475 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
3476 <tag/Description/The function updates the mouse position. If the mouse cursor
3477 is visible, it is shown at the new position.
3478 <tag/Limits/<itemize>
3479 <item>The function does not check if the new position is within the bounding
3480 box specified with <tt/<ref id="mouse_box" name="mouse_box">/.
3481 <item>The function is only available as fastcall function, so it may only be
3482 used in presence of a prototype.
3484 <tag/Availability/cc65
3486 <ref id="mouse_box" name="mouse_box">
3492 <sect1>mouse_pos<label id="mouse_pos"><p>
3496 <tag/Function/Return the position of the mouse.
3497 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3498 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
3499 <tag/Description/The function returns the position of the mouse in the
3500 <tt/mouse_pos/ structure passed as parameter.
3501 <tag/Limits/<itemize>
3502 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
3503 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
3504 name="mouse_info">/ instead.
3505 <item>The function is only available as fastcall function, so it may only be
3506 used in presence of a prototype.
3508 <tag/Availability/cc65
3510 <ref id="mouse_buttons" name="mouse_buttons">,
3511 <ref id="mouse_info" name="mouse_info">
3517 <sect1>mouse_show<label id="mouse_show"><p>
3521 <tag/Function/Show the mouse pointer.
3522 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3523 <tag/Declaration/<tt/void __fastcall__ mouse_show (void);/
3524 <tag/Description/The function shows the mouse pointer. It manages a counter
3525 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
3526 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
3527 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
3528 <tag/Limits/<itemize>
3529 <item>The function is only available as fastcall function, so it may only be
3530 used in presence of a prototype.
3532 <tag/Availability/cc65
3534 <ref id="mouse_hide" name="mouse_hide">
3540 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
3544 <tag/Function/Uninstall an already loaded mouse driver.
3545 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3546 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (void);/
3547 <tag/Description/The function uninstalls an already loaded mouse driver but
3548 don't removes it from memory.
3549 <tag/Limits/<itemize>
3550 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
3551 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
3552 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
3554 <item>The function is only available as fastcall function, so it may only be
3555 used in presence of a prototype.
3557 <tag/Availability/cc65
3559 <ref id="mouse_install" name="mouse_install">,
3560 <ref id="mouse_load_driver" name="mouse_load_driver">,
3561 <ref id="mouse_unload" name="mouse_unload">
3567 <sect1>mouse_unload<label id="mouse_unload"><p>
3571 <tag/Function/Unload a mouse driver.
3572 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3573 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_unload (void);/
3574 <tag/Description/The function unloads a loaded mouse driver and frees all
3575 memory allocated for the driver.
3576 <tag/Limits/<itemize>
3577 <item>The function does nothing if no driver is loaded.
3579 <tag/Availability/cc65
3581 <ref id="mouse_install" name="mouse_install">,
3582 <ref id="mouse_load_driver" name="mouse_load_driver">,
3583 <ref id="mouse_uninstall" name="mouse_uninstall">
3589 <sect1>offsetof<label id="offsetof"><p>
3593 <tag/Function/Calculate the offset of a struct or union member.
3594 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
3595 <tag/Declaration/<tt/size_t offsetof (type, member);/
3596 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
3597 or <tt/union/ member.
3598 <tag/Limits/<itemize>
3599 <item>The function is actually a macro.
3601 <tag/Availability/ISO 9899
3607 <sect1>open<label id="open"><p>
3611 <tag/Function/Open and possibly create a file.
3612 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
3613 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
3614 <tag/Description/<tt/open/ opens a file and returns the file descriptor
3615 associated with it. On error, -1 is returned and an error code is stored in
3616 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
3617 <tag/Limits/<itemize>
3618 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
3619 open, which is used as the permission mask when a new file is created. While
3620 cc65 allows to pass this argument, it is ignored.
3622 <tag/Availability/POSIX 1003.1
3624 <ref id="close" name="close">,
3625 <ref id="creat" name="creat">
3631 <sect1>peekbsys<label id="peekbsys"><p>
3635 <tag/Function/Read one byte from a location in the system bank.
3636 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3637 <tt/<ref id="cbm510.h" name="cbm510.h">/
3638 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
3639 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
3640 system bank (bank 15) of the CBM PET-II machines and returns it.
3643 <item>The function is only available as fastcall function, so it may only
3644 be used in presence of a prototype.
3645 <item>This function may be a macro depending on the compiler options. The
3646 actual function is accessible by #undef'ing the macro.
3648 <tag/Availability/cc65
3650 <ref id="PEEK" name="PEEK">,
3651 <ref id="PEEKW" name="PEEKW">,
3652 <ref id="peekwsys" name="peekwsys">,
3653 <ref id="pokebsys" name="pokebsys">,
3654 <ref id="pokewsys" name="pokewsys">
3660 <sect1>peekwsys<label id="peekwsys"><p>
3664 <tag/Function/Read one word 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 __fastcall__ peekwsys (unsigned addr);/
3668 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
3669 system bank (bank 15) of the CBM PET-II machines and returns it. Following
3670 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
3671 high byte is read from <tt/addr+1/.
3674 <item>The function is only available as fastcall function, so it may only
3675 be used in presence of a prototype.
3676 <item>The order in which the two bytes are read is undefined.
3678 <tag/Availability/cc65
3680 <ref id="PEEK" name="PEEK">,
3681 <ref id="PEEKW" name="PEEKW">,
3682 <ref id="peekbsys" name="peekbsys">,
3683 <ref id="pokebsys" name="pokebsys">,
3684 <ref id="pokewsys" name="pokewsys">
3690 <sect1>perror<label id="perror"><p>
3694 <tag/Function/Print an error message for the error in <tt/errno/.
3695 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3696 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
3697 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
3698 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
3699 a blank. Then the error message for the current contents of <tt/errno/ is
3700 printed followed by a newline. The message output is the same as returned by
3701 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
3704 <item>The function is only available as fastcall function, so it may only
3705 be used in presence of a prototype.
3707 <tag/Availability/ISO 9899
3709 <ref id="_poserror" name="_poserror">,
3710 <ref id="strerror" name="strerror">
3716 <sect1>pokebsys<label id="pokebsys"><p>
3720 <tag/Function/Write one byte to a location in the system bank.
3721 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3722 <tt/<ref id="cbm510.h" name="cbm510.h">/
3723 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
3724 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
3725 system bank (bank 15) of the CBM PET-II machines.
3728 <item>The function is only available as fastcall function, so it may only
3729 be used in presence of a prototype.
3731 <tag/Availability/cc65
3733 <ref id="POKE" name="POKE">,
3734 <ref id="POKEW" name="POKEW">,
3735 <ref id="peekbsys" name="peekbsys">,
3736 <ref id="peekwsys" name="peekwsys">,
3737 <ref id="pokewsys" name="pokewsys">
3743 <sect1>pokewsys<label id="pokewsys"><p>
3747 <tag/Function/Write one word to a location in the system bank.
3748 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3749 <tt/<ref id="cbm510.h" name="cbm510.h">/
3750 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
3751 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
3752 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
3753 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
3754 high byte is written to <tt/addr+1/.
3757 <item>The function is only available as fastcall function, so it may only
3758 be used in presence of a prototype.
3759 <item>The order in which the two bytes are written is undefined.
3761 <tag/Availability/cc65
3763 <ref id="POKE" name="POKE">,
3764 <ref id="POKEW" name="POKEW">,
3765 <ref id="peekbsys" name="peekbsys">,
3766 <ref id="peekwsys" name="peekwsys">,
3767 <ref id="pokebsys" name="pokebsys">
3773 <sect1>qsort<label id="qsort"><p>
3777 <tag/Function/Sort an array.
3778 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3779 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
3780 size_t size, int (*compare) (const void*, const void*));/
3781 <tag/Description/<tt/qsort/ sorts an array according to a given compare
3782 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
3783 is the number of elements, <tt/size/ the size of an element and <tt/compare/
3784 the function used to compare the members.
3787 <item>If there are multiple members with the same key, the order after calling
3788 the function is undefined.
3789 <item>The function is only available as fastcall function, so it may only
3790 be used in presence of a prototype.
3792 <tag/Availability/ISO 9899
3794 <ref id="bsearch" name="bsearch">
3800 <sect1>raise<label id="raise"><p>
3804 <tag/Function/Send a signal to the executing program.
3805 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
3806 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
3807 <tag/Description/<tt/raise/ sends the given signal to the program. If the
3808 program has installed a signal handler for the signal, this signal handler
3809 will be executed. If no handler has been installed, the default action for
3810 the raised signal will be taken. The function returns zero on success,
3812 <tag/Limits/<itemize>
3813 <item>The function is only available as fastcall function, so it may only
3814 be used in presence of a prototype.
3816 <tag/Availability/ISO 9899
3818 <ref id="abort" name="abort">,
3819 <ref id="signal" name="signal">
3825 <sect1>rand<label id="rand"><p>
3829 <tag/Function/Return a pseudo random number.
3830 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3831 <tag/Declaration/<tt/int rand (void);/
3832 <tag/Description/The function returns a pseudo random number
3833 between 0 and <tt/RAND_MAX/ (exclusive).
3834 <tag/Limits/<itemize>
3835 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
3836 flow of numbers is generated.
3837 <item>On startup, the function behaves as if <ref id="srand" name="srand">
3838 had been used with an argument of 1.
3840 <tag/Availability/ISO 9899
3842 <ref id="_randomize" name="_randomize">,
3843 <ref id="srand" name="srand">
3849 <sect1>realloc<label id="realloc"><p>
3853 <tag/Function/Change the size of an allocated memory block.
3854 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3855 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
3856 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
3857 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
3858 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
3859 behaves as if <tt/free/ had been called. On error (not enough memory
3860 available), <tt/realloc/ returns <tt/NULL/.
3863 <item>The part of the memory block that is returned will have its contents
3865 <item>This function is somewhat dangerous to use. Be careful to save the
3866 pointer you're passing somewhere else, otherwise
3868 ptr = realloc (ptr, size);
3870 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
3871 <item>The function is only available as fastcall function, so it may only
3872 be used in presence of a prototype.
3874 <tag/Availability/ISO 9899
3876 <ref id="_heapadd" name="_heapadd">,
3877 <ref id="_heapblocksize" name="_heapblocksize">,
3878 <ref id="_heapmaxavail" name="_heapmaxavail">,
3879 <ref id="_heapmemavail" name="_heapmemavail">,
3880 <ref id="calloc" name="calloc">,
3881 <ref id="free" name="free">,
3882 <ref id="realloc" name="realloc">
3888 <sect1>remove<label id="remove"><p>
3892 <tag/Function/Delete a file.
3893 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3894 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
3895 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
3896 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
3897 code describing the reason for the failure.
3900 <item>This function is not available on all cc65 targets (depends on the
3901 availability of file I/O).
3902 <item>The function is only available as fastcall function, so it may only
3903 be used in presence of a prototype.
3905 <tag/Availability/ISO 9899
3907 <ref id="rename" name="rename">,
3908 <ref id="unlink" name="unlink">
3911 #include <stdio.h>
3913 #define FILENAME "helloworld"
3915 if (remove (FILENAME) == 0) {
3916 printf ("We deleted %s successfully\n", FILENAME);
3918 printf ("There was a problem deleting %s\n", FILENAME);
3925 <sect1>rename<label id="rename"><p>
3929 <tag/Function/Rename a file.
3930 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3931 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
3932 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
3933 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
3934 code describing the reason for the failure.
3937 <item>This function is not available on all cc65 targets (depends on the
3938 capabilities of the storage devices).
3939 <item>The function is only available as fastcall function, so it may only
3940 be used in presence of a prototype.
3942 <tag/Availability/ISO 9899
3944 <ref id="remove" name="remove">
3947 #include <stdio.h>
3949 #define OLDNAME "textfile.txt"
3950 #define NEWNAME "textfile.bak"
3952 if (rename (OLDNAME, NEWNAME) == 0) {
3953 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
3955 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
3962 <sect1>reset_brk<label id="reset_brk"><p>
3966 <tag/Function/Resets the break vector to its original value.
3967 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3968 <tag/Declaration/<tt/void __fastcall__ reset_brk (void);/
3969 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
3970 before a call to <tt/set_brk/.
3973 <item>Since <tt/<ref id="set_brk" name="set_brk">/ installs an exit handler,
3974 it is not strictly necessary to call this function as part of the cleanup when
3977 <tag/Availability/cc65
3979 <ref id="set_brk" name="set_brk">
3985 <sect1>revers<label id="revers"><p>
3989 <tag/Function/Control revers character display.
3990 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3991 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
3992 <tag/Description/If the argument is non zero, the function enables reverse
3993 character display. If the argument is zero, reverse character display is
3994 switched off. The old value of the setting is returned.
3995 <tag/Limits/<itemize>
3996 <item>The function may not be supported by the hardware, in which case
3997 the call is ignored.
3998 <item>The function is only available as fastcall function, so it may only
3999 be used in presence of a prototype.
4001 <tag/Availability/cc65
4003 <ref id="textcolor" name="textcolor">
4009 <sect1>screensize<label id="screensize"><p>
4013 <tag/Function/Return the dimensions of the text mode screen.
4014 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4015 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
4016 <tag/Description/The function returns the dimensions of the text mode screen.
4017 <tag/Limits/<itemize>
4018 <item>The function is only available as fastcall function, so it may only
4019 be used in presence of a prototype.
4021 <tag/Availability/cc65
4023 <ref id="gotox" name="gotox">,
4024 <ref id="gotoxy" name="gotoxy">,
4025 <ref id="gotoy" name="gotoy">,
4026 <ref id="wherex" name="wherex">,
4027 <ref id="wherey" name="wherey">
4033 <sect1>set_brk<label id="set_brk"><p>
4037 <tag/Function/Set the break vector to a user function.
4038 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
4039 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
4040 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
4041 program code by letting the vector point to a user written C function. The
4042 runtime library installs a small stub that saves the registers into global
4043 variables that may be accessed (and changed) by the break handler.
4046 <item>The function is only available as fastcall function, so it may only
4047 be used in presence of a prototype.
4048 <item>The stub saves the zero page registers used by the C runtime and switches
4049 to a small break handler stack. This means that it is safe to execute C code,
4050 even if C code was interrupted. Be careful however not to use too many local
4051 variables, and do not enable stack checks for the handler function or any other
4052 function called from it.
4053 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
4054 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
4055 otherwise the <tt/BRK/ instruction will get executed over and over again.
4056 <item>Since <tt/set_brk/ installs an exit handler, it is not strictly necessary
4057 to call <tt/<ref id="reset_brk" name="reset_brk">/ as part of the cleanup when
4058 the program terminates.
4060 <tag/Availability/cc65
4062 <ref id="reset_brk" name="reset_brk">
4068 <sect1>setjmp<label id="setjmp"><p>
4072 <tag/Function/Save the context for use with <tt/longjmp/.
4073 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4074 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
4075 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
4076 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
4080 <item>The function is only available as fastcall function, so it may only
4081 be used in presence of a prototype.
4082 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
4083 <item><tt/setjmp/ will not save the signal context.
4085 <tag/Availability/ISO 9899
4087 <ref id="longjmp" name="longjmp">
4093 <sect1>setlocale<label id="setlocale"><p>
4097 <tag/Function/Selects a locale.
4098 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4099 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
4100 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
4103 <item>The function is only available as fastcall function, so it may only
4104 be used in presence of a prototype.
4105 <item>cc65 supports only the "C" locale, so calling this function to set a
4106 different locale has no effect.
4108 <tag/Availability/ISO 9899
4110 <ref id="localeconv" name="localeconv">,
4111 <ref id="strcoll" name="strcoll">
4112 <ref id="strxfrm" name="strxfrm">
4118 <sect1>signal<label id="signal"><p>
4122 <tag/Function/Install a signal handler.
4123 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
4124 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
4125 <tag/Description/<tt/signal/ installs a handler for the given signal. The
4126 handler may either be a user supplied function, or one of the predefined
4127 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
4128 previous value if the signal , or the special function vector SIG_ERR in
4130 <tag/Limits/<itemize>
4131 <item>The function is only available as fastcall function, so it may only
4132 be used in presence of a prototype.
4134 <tag/Availability/ISO 9899
4136 <ref id="abort" name="abort">,
4137 <ref id="raise" name="raise">
4143 <sect1>sleep<label id="sleep"><p>
4147 <tag/Function/Sleep for a specified amount of time.
4148 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
4149 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
4150 <tag/Description/The function will return after the specified number of
4151 seconds have elapsed.
4152 <tag/Limits/<itemize>
4153 <item>The function is only available as fastcall function, so it may only
4154 be used in presence of a prototype.
4156 <tag/Availability/POSIX 1003.1
4162 <sect1>slow<label id="slow"><p>
4166 <tag/Function/Switch the C128 into 1MHz mode.
4167 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
4168 <tag/Declaration/<tt/void slow (void);/
4169 <tag/Description/The function will switch the clock of the C128 to 1MHz. This
4170 will halve the speed compared to fast mode.
4171 <tag/Limits/<itemize>
4172 <item>The function is specific to the C128.
4174 <tag/Availability/C128
4176 <ref id="fast" name="fast">,
4177 <ref id="toggle_videomode" name="toggle_videomode">,
4178 <ref id="videomode" name="videomode">
4184 <sect1>srand<label id="srand"><p>
4188 <tag/Function/Initialize the pseudo random number generator.
4189 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4190 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
4191 <tag/Description/The function initializes the random number generator using
4192 the given seed. On program startup, the generator behaves as if <tt/srand/ has
4193 been called with an argument of 1.
4194 <tag/Limits/<itemize>
4195 <item>The function is only available as fastcall function, so it may only
4196 be used in presence of a prototype.
4198 <tag/Availability/ISO 9899
4200 <ref id="_randomize" name="_randomize">,
4201 <ref id="rand" name="rand">
4207 <sect1>strcasecmp<label id="strcasecmp"><p>
4211 <tag/Function/Compare two strings case insensitive.
4212 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4213 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
4214 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
4215 as parameters without case sensitivity. It returns a value that is less than
4216 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
4217 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
4218 <tag/Limits/<itemize>
4219 <item>The function is only available as fastcall function, so it may only
4220 be used in presence of a prototype.
4221 <item>The function is not available in strict ANSI mode.
4223 <tag/Availability/cc65
4225 <ref id="strcmp" name="strcmp">,
4226 <ref id="strcoll" name="strcoll">,
4227 <ref id="stricmp" name="stricmp">,
4228 <ref id="strncmp" name="strncmp">
4229 <ref id="strxfrm" name="strxfrm">
4235 <sect1>strcat<label id="strcat"><p>
4239 <tag/Function/Concatentate two strings.
4240 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4241 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
4242 <tag/Description/The <tt/strcat/ function appends a copy of the string
4243 pointed to by s2 (including the terminating null byte) to the end of the
4244 string pointed to by s1. The initial byte of s2 overwrites the null byte at
4246 <tag/Limits/<itemize>
4247 <item>The function is only available as fastcall function, so it may only
4248 be used in presence of a prototype.
4249 <item>If copying takes place between objects that overlap, the behaviour
4252 <tag/Availability/ISO 9899
4254 <ref id="strcpy" name="strcpy">,
4255 <ref id="strncat" name="strncat">,
4256 <ref id="strncpy" name="strncpy">
4262 <sect1>strchr<label id="strchr"><p>
4266 <tag/Function/Search for a character in a string.
4267 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4268 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
4269 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
4270 (converted to a char) in the string pointed to by <tt/s/. The terminating null
4271 byte is considered to be part of the string. Upon completion, the function
4272 returns a pointer to the byte, or a null pointer if the byte was not found.
4273 <tag/Limits/<itemize>
4274 <item>The function is only available as fastcall function, so it may only
4275 be used in presence of a prototype.
4277 <tag/Availability/ISO 9899
4279 <ref id="memchr" name="memchr">,
4280 <ref id="strrchr" name="strrchr">
4286 <sect1>strcmp<label id="strcmp"><p>
4290 <tag/Function/Compare two strings.
4291 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4292 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
4293 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
4294 parameters. It returns a value that is less than zero if <tt/s1/ is less than
4295 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
4296 if <tt/s1/ is greater than <tt/s2/.
4297 <tag/Limits/<itemize>
4298 <item>The function is only available as fastcall function, so it may only
4299 be used in presence of a prototype.
4301 <tag/Availability/ISO 9899
4303 <ref id="strcasecmp" name="strcasecmp">,
4304 <ref id="strcoll" name="strcoll">,
4305 <ref id="stricmp" name="stricmp">,
4306 <ref id="strncmp" name="strncmp">
4307 <ref id="strxfrm" name="strxfrm">
4313 <sect1>strcoll<label id="strcoll"><p>
4317 <tag/Function/Compare two strings.
4318 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4319 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
4320 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
4321 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
4322 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
4323 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
4324 than zero if <tt/s1/ is greater than <tt/s2/.
4325 <tag/Limits/<itemize>
4326 <item>The function is only available as fastcall function, so it may only
4327 be used in presence of a prototype.
4329 <tag/Availability/ISO 9899
4331 <ref id="setlocale" name="setlocale">,
4332 <ref id="strcasecmp" name="strcasecmp">,
4333 <ref id="strcmp" name="strcmp">,
4334 <ref id="stricmp" name="stricmp">,
4335 <ref id="strncmp" name="strncmp">
4336 <ref id="strxfrm" name="strxfrm">
4342 <sect1>strcpy<label id="strcpy"><p>
4346 <tag/Function/Copy a string.
4347 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4348 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
4349 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
4350 <tt/s2/ (including the terminating null byte) into the array pointed to by
4351 <tt/s1/. The function will always return <tt/s1/.
4352 <tag/Limits/<itemize>
4353 <item>The function is only available as fastcall function, so it may only
4354 be used in presence of a prototype.
4355 <item>If copying takes place between objects that overlap, the behaviour
4358 <tag/Availability/ISO 9899
4360 <ref id="strcat" name="strcat">,
4361 <ref id="strncat" name="strncat">,
4362 <ref id="strncpy" name="strncpy">
4365 #include <string.h>
4367 static char hello[14];
4369 strcpy (hello, "Hello world!\n");
4375 <sect1>strcspn<label id="strcspn"><p>
4379 <tag/Function/Compute the length of a substring.
4380 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4381 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
4382 <tag/Description/The <tt/strcspn/ function computes and returns the length of
4383 the substring pointed to by <tt/s/ which does <em>not</em> consist of
4384 characters contained in the string <tt/set/.
4385 <tag/Limits/<itemize>
4386 <item>The function is only available as fastcall function, so it may only
4387 be used in presence of a prototype.
4389 <tag/Availability/ISO 9899
4391 <ref id="strspn" name="strspn">,
4392 <ref id="strstr" name="strstr">,
4393 <ref id="strtok" name="strtok">
4399 <sect1>strdup<label id="strdup"><p>
4403 <tag/Function/Allocate a copy of a string on the heap.
4404 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4405 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
4406 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
4407 to hold a copy of <tt/s/ including the terminating zero. If the allocation
4408 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
4409 memory block, and a pointer to the block is returned.
4410 <tag/Limits/<itemize>
4411 <item>The function is only available as fastcall function, so it may only
4412 be used in presence of a prototype.
4413 <item>It is up to the caller to free the allocated memory block.
4415 <tag/Availability/ISO 9899
4417 <ref id="free" name="free">,
4418 <ref id="malloc" name="malloc">
4424 <sect1>strerror<label id="strerror"><p>
4428 <tag/Function/Return a string describing an error code.
4429 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4430 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
4431 <tag/Description/The <tt/strerror/ function returns a string describing the
4432 given error code. If an invalid error code is passed, the string "Unknown
4433 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
4434 <tt/errno/ is left untouched.
4435 <tag/Limits/<itemize>
4436 <item>The function is only available as fastcall function, so it may only
4437 be used in presence of a prototype.
4438 <item>While the return type of the function is a <tt/char*/, the returned
4439 string must not be modified by the caller!
4441 <tag/Availability/ISO 9899
4443 <ref id="_stroserror" name="_stroserror">
4449 <sect1>stricmp<label id="stricmp"><p>
4453 <tag/Function/Compare two strings case insensitive.
4454 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4455 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
4456 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
4457 parameters without case sensitivity. It returns a value that is less than zero
4458 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
4459 value greater than zero if <tt/s1/ is greater than <tt/s2/.
4460 <tag/Limits/<itemize>
4461 <item>The function is only available as fastcall function, so it may only
4462 be used in presence of a prototype.
4463 <item>The function is not available in strict ANSI mode.
4465 <tag/Availability/cc65
4467 <ref id="strcasecmp" name="strcasecmp">,
4468 <ref id="strcmp" name="strcmp">,
4469 <ref id="strcoll" name="strcoll">,
4470 <ref id="strncmp" name="strncmp">
4471 <ref id="strxfrm" name="strxfrm">
4477 <sect1>strlen<label id="strlen"><p>
4481 <tag/Function/Return the length of a string.
4482 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4483 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
4484 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
4485 string to which s points, not including the terminating null byte.
4486 <tag/Limits/<itemize>
4487 <item>The function is only available as fastcall function, so it may only
4488 be used in presence of a prototype.
4489 <item>When compiling with <tt/-Os/ (inline known standard functions), the
4490 function does not work correctly for strings with more than 255 characters.
4492 <tag/Availability/ISO 9899
4494 <ref id="strcpy" name="strcpy">
4500 <sect1>strlower<label id="strlower"><p>
4504 <tag/Function/Make a string lower case.
4505 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4506 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
4507 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
4508 function to each character of a string. The function will always return <tt/s/.
4509 <tag/Limits/<itemize>
4510 <item>The function is only available as fastcall function, so it may only
4511 be used in presence of a prototype.
4512 <item>The function prototype is unavailable when compiling in strict ANSI mode.
4513 <item>An alias name for this function is <tt/strlwr/.
4515 <tag/Availability/cc65
4517 <ref id="strupper" name="strupper">,
4518 <ref id="tolower" name="tolower">
4524 <sect1>strlwr<label id="strlwr"><p>
4531 <sect1>strncat<label id="strncat"><p>
4535 <tag/Function/Concatentate two strings.
4536 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4537 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
4538 <tag/Description/The <tt/strncat/ function appends not more than n characters
4539 of the string pointed to by s2 to the end of the string pointed to by s1. The
4540 terminating null character at the end of s1 is overwritten. A terminating null
4541 character is appended to the result, even if not all of s2 is appended to s1.
4542 <tag/Limits/<itemize>
4543 <item>The function is only available as fastcall function, so it may only
4544 be used in presence of a prototype.
4545 <item>If copying takes place between objects that overlap, the behaviour
4548 <tag/Availability/ISO 9899
4550 <ref id="strcpy" name="strcpy">,
4551 <ref id="strncat" name="strncat">,
4552 <ref id="strncpy" name="strncpy">
4558 <sect1>strncmp<label id="strncmp"><p>
4562 <tag/Function/Compare two strings.
4563 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4564 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
4565 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
4566 characters of the two strings passed as parameters. It returns a value that is
4567 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
4568 <tt/s2/, zero if they are identical, and a value greater than zero they are
4570 <tag/Limits/<itemize>
4571 <item>The function is only available as fastcall function, so it may only
4572 be used in presence of a prototype.
4574 <tag/Availability/ISO 9899
4576 <ref id="strcasecmp" name="strcasecmp">,
4577 <ref id="strcmp" name="strcmp">,
4578 <ref id="strcoll" name="strcoll">,
4579 <ref id="stricmp" name="stricmp">
4580 <ref id="strxfrm" name="strxfrm">
4586 <sect1>strncpy<label id="strncpy"><p>
4590 <tag/Function/Copy part of a string.
4591 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4592 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2, size_t n);/
4593 <tag/Description/The <tt/strncpy/ function copies not more than n bytes from
4594 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
4595 pointed to by <tt/s2/ is a string that is shorter than n bytes, null bytes are
4596 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
4597 written. The function will always return <tt/s1/.
4598 <tag/Limits/<itemize>
4599 <item>The function is only available as fastcall function, so it may only
4600 be used in presence of a prototype. If there is no null byte in the first <tt/n/
4601 bytes of the array pointed to by <tt/s2/, the result is not null-terminated.
4602 <item>If copying takes place between objects that overlap, the behaviour is
4605 <tag/Availability/ISO 9899
4607 <ref id="strcat" name="strcat">,
4608 <ref id="strcpy" name="strcpy">,
4609 <ref id="strncat" name="strncat">
4614 static char hello[6];
4616 strcpy (hello, "Hello world!\n", sizeof (hello) - 1);
4623 <sect1>strrchr<label id="strrchr"><p>
4627 <tag/Function/Search for a character in a string.
4628 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4629 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
4630 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
4631 (converted to a char) in the string pointed to by <tt/s/. The terminating null
4632 byte is considered to be part of the string. Upon completion, the function
4633 returns a pointer to the byte, or a null pointer if the byte was not found.
4634 <tag/Limits/<itemize>
4635 <item>The function is only available as fastcall function, so it may only
4636 be used in presence of a prototype.
4638 <tag/Availability/ISO 9899
4640 <ref id="strchr" name="strchr">
4646 <sect1>strspn<label id="strspn"><p>
4650 <tag/Function/Compute the length of a substring.
4651 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4652 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
4653 <tag/Description/The <tt/strspn/ function computes and returns the length of
4654 the substring pointed to by <tt/s/ which does consist only of characters
4655 contained in the string <tt/set/.
4656 <tag/Limits/<itemize>
4657 <item>The function is only available as fastcall function, so it may only
4658 be used in presence of a prototype.
4660 <tag/Availability/ISO 9899
4662 <ref id="strcspn" name="strcspn">,
4663 <ref id="strstr" name="strstr">
4669 <sect1>strstr<label id="strstr"><p>
4673 <tag/Function/Find a substring.
4674 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4675 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
4676 <tag/Description/<tt/strstr/ searches for the first occurance of the string
4677 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
4678 otherwise it returns <tt/NULL/.
4679 <tag/Limits/<itemize>
4680 <item>The function is only available as fastcall function, so it may only
4681 be used in presence of a prototype.
4683 <tag/Availability/ISO 9899
4685 <ref id="strcspn" name="strcspn">,
4686 <ref id="strspn" name="strspn">
4692 <sect1>strtok<label id="strtok"><p>
4696 <tag/Function/Break a string into tokens.
4697 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4698 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
4699 <tag/Description/<tt/strtok/ will break the string s1 into a sequence of
4700 tokens, which are delimited by characters from the string s2. The first call
4701 to <tt/strtok/ will return a pointer to the first token in the string s1.
4702 Following calls must pass a <tt/NULL/ pointer as s1 in order to get the next
4703 token in the string. Different sets of delimiters may be used for the
4704 subsequent calls to <tt/strtok/.
4705 <tag/Limits/<itemize>
4706 <item>The function is only available as fastcall function, so it may only
4707 be used in presence of a prototype.
4708 <item><tt/strtok/ will modify the string s1.
4710 <tag/Availability/ISO 9899
4712 <ref id="strcspn" name="strcspn">,
4713 <!-- <ref id="strpbrk" name="strpbrk"> -->
4719 <sect1>strxfrm<label id="strxfrm"><p>
4723 <tag/Function/Transform a string.
4724 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4725 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
4726 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
4727 s2 and places the resulting string into the string pointed to by s1. The
4728 transformation is such that if the <tt/strcmp/ function is applied to two
4729 transformed strings, it returns a value greater than, equal to, or less than
4730 zero, corresponding to the result of the <tt/strcoll/ function applied to the
4731 same two original strings. No more than n characters are placed into the
4732 resulting array pointed to by s1, including the terminating null character.
4733 <tag/Limits/<itemize>
4734 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
4735 the behaviour is undefined.
4736 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
4737 <item>The function is only available as fastcall function, so it may only
4738 be used in presence of a prototype.
4739 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
4740 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
4742 <tag/Availability/ISO 9899
4744 <ref id="strcmp" name="strcmp">,
4745 <ref id="strcoll" name="strcoll">,
4746 <ref id="strncpy" name="strncpy">,
4752 <sect1>strupper<label id="strupper"><p>
4756 <tag/Function/Make a string upper case.
4757 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4758 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
4759 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
4760 function to each character of a string. The function will always return <tt/s/.
4761 <tag/Limits/<itemize>
4762 <item>The function is only available as fastcall function, so it may only
4763 be used in presence of a prototype.
4764 <item>The function prototype is unavailable when compiling in strict ANSI mode.
4765 <item>An alias name for this function is <tt/strupr/.
4767 <tag/Availability/cc65
4769 <ref id="strlower" name="strlower">
4770 <ref id="toupper" name="toupper">
4776 <sect1>strupr<label id="strupr"><p>
4783 <sect1>textcolor<label id="textcolor"><p>
4787 <tag/Function/Set the text color.
4788 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4789 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
4790 <tag/Description/The function will set a new text color. It returns the old
4791 (current) text color. Text output using any <tt/conio.h/ function will use
4792 the color set by this function.
4793 <tag/Limits/<itemize>
4794 <item>Text colors are system dependent. The function may have no effect
4795 on systems where the text color cannot be changed.
4796 <item>The function is only available as fastcall function, so it may only
4797 be used in presence of a prototype.
4799 <tag/Availability/cc65
4801 <ref id="bgcolor" name="bgcolor">,
4802 <ref id="bordercolor" name="bordercolor">
4808 <sect1>time<label id="time"><p>
4812 <tag/Function/Get the time.
4813 <tag/Header/<tt/<ref id="time.h" name="time.h">/
4814 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
4815 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
4816 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
4817 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
4818 returned and <tt/errno/ is set to <tt/ENOSYS/.
4819 <tag/Limits/<itemize>
4820 <item>The function is only available as fastcall function, so it may
4821 only be used in presence of a prototype.
4822 <item>Many platforms supported by cc65 do not have a realtime clock, so the
4823 returned value may not be valid.
4825 <tag/Availability/ISO 9899
4831 <sect1>toggle_videomode<label id="toggle_videomode"><p>
4835 <tag/Function/Toggle between 40 and 80 column mode.
4836 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
4837 <tag/Declaration/<tt/void toggle_videomode (void);/
4838 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
4839 old mode (cursor position, color and so on) are saved and restored together
4841 <tag/Limits/<itemize>
4842 <item>The function is specific to the C128.
4843 <item>This function is deprecated. Please use <ref id="videomode"
4844 name="videomode"> instead!
4846 <tag/Availability/C128
4848 <ref id="fast" name="fast">,
4849 <ref id="slow" name="slow">,
4850 <ref id="videomode" name="videomode">
4856 <sect1>tolower<label id="tolower"><p>
4860 <tag/Function/Convert a character into its lower case representation.
4861 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4862 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
4863 <tag/Description/The function returns the given character converted to lower
4864 case. If the given character is not a letter, it is returned unchanged.
4865 <tag/Limits/<itemize>
4866 <item>The function is only available as fastcall function, so it may
4867 only be used in presence of a prototype.
4869 <tag/Availability/ISO 9899
4871 <ref id="islower" name="islower">,
4872 <ref id="isupper" name="isupper">,
4873 <ref id="toupper" name="toupper">
4879 <sect1>toupper<label id="toupper"><p>
4883 <tag/Function/Convert a character into its upper case representation.
4884 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4885 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
4886 <tag/Description/The function returns the given character converted to upper
4887 case. If the given character is not a letter, it is returned unchanged.
4888 <tag/Limits/<itemize>
4889 <item>The function is only available as fastcall function, so it may
4890 only be used in presence of a prototype.
4892 <tag/Availability/ISO 9899
4894 <ref id="islower" name="islower">,
4895 <ref id="isupper" name="isupper">,
4896 <ref id="tolower" name="tolower">
4902 <sect1>ultoa<label id="ultoa"><p>
4906 <tag/Function/Convert an unsigned long integer into a string.
4907 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4908 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
4909 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
4910 string using <tt/radix/ as the base.
4911 <tag/Limits/<itemize>
4912 <item>There are no provisions to prevent a buffer overflow.
4913 <item>The function is non standard, so it is not available in strict ANSI mode.
4914 You should probably use <tt/sprintf/ instead.
4915 <item>The function is only available as fastcall function, so it may only be
4916 used in presence of a prototype.
4918 <tag/Availability/cc65
4920 <ref id="atoi" name="atoi">,
4921 <ref id="atol" name="atol">,
4922 <ref id="itoa" name="itoa">,
4923 <ref id="ltoa" name="ltoa">,
4924 <ref id="utoa" name="utoa">
4930 <sect1>unlink<label id="unlink"><p>
4934 <tag/Function/Delete a file.
4935 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
4936 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
4937 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
4938 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
4939 code describing the reason for the failure.
4942 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
4943 name="remove">/ instead, which is a native ANSI C function and does the same.
4944 <item>This function is not available on all cc65 targets (depends on the
4945 availability of file I/O).
4946 <item>The function is only available as fastcall function, so it may only
4947 be used in presence of a prototype.
4948 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
4949 used, which has the same semantics, but is more portable, because it conforms
4950 to the ISO C standard.
4952 <tag/Availability/POSIX 1003.1
4954 <ref id="remove" name="remove">
4957 #include <stdio.h>
4958 #include <unistd.h>
4960 #define FILENAME "helloworld"
4962 if (unlink (FILENAME) == 0) {
4963 printf ("We deleted %s successfully\n", FILENAME);
4965 printf ("There was a problem deleting %s\n", FILENAME);
4972 <sect1>utoa<label id="utoa"><p>
4976 <tag/Function/Convert an unsigned integer into a string.
4977 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4978 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
4979 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
4980 using <tt/radix/ as the base.
4981 <tag/Limits/<itemize>
4982 <item>There are no provisions to prevent a buffer overflow.
4983 <item>The function is non standard, so it is not available in strict ANSI mode.
4984 You should probably use <tt/sprintf/ instead.
4985 <item>The function is only available as fastcall function, so it may only be
4986 used in presence of a prototype.
4988 <tag/Availability/cc65
4990 <ref id="atoi" name="atoi">,
4991 <ref id="atol" name="atol">,
4992 <ref id="itoa" name="itoa">,
4993 <ref id="ltoa" name="ltoa">,
4994 <ref id="ultoa" name="ultoa">
5000 <sect1>vcprintf<label id="vcprintf"><p>
5004 <tag/Function/Formatted output to the console.
5005 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5006 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
5007 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
5008 text where necessary and formatted according to the format string given. The
5009 resulting string is output to the console. <tt/vcprintf/ supports the same
5010 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
5011 <tag/Limits/<itemize>
5012 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
5013 between <tt/\r/ and <tt/\n/.
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="cprintf" name="cprintf">,
5020 <ref id="cputc" name="cputc">,
5021 <ref id="cputcxy" name="cputcxy">,
5022 <ref id="cputs" name="cputs">,
5023 <ref id="cputsxy" name="cputsxy">
5029 <sect1>videomode<label id="videomode"><p>
5033 <tag/Function/Switch to either 40 or 80 column mode.
5034 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
5035 <tag/Declaration/<tt/unsigned char __fastcall__ videomode (unsigned char Mode);/
5036 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
5037 the requested mode is already active, nothing happens. The old mode is returned
5039 <tag/Limits/<itemize>
5040 <item>The function is specific to the C128.
5041 <item>This function is replaces <ref id="toggle_videomode"
5042 name="toggle_videomode">.
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/C128
5048 <ref id="fast" name="fast">,
5049 <ref id="slow" name="slow">,
5050 <ref id="toggle_videomode" name="toggle_videomode">
5056 <sect1>wherex<label id="wherex"><p>
5060 <tag/Function/Return the current X position of the text mode cursor.
5061 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5062 <tag/Declaration/<tt/unsigned char wherex (void);/
5063 <tag/Description/The function returns the current X position of the text mode
5064 cursor. Zero is returned for the leftmost screen position.
5065 <tag/Availability/cc65
5067 <ref id="gotox" name="gotox">,
5068 <ref id="gotoy" name="gotoy">,
5069 <ref id="gotoxy" name="gotoxy">,
5070 <ref id="wherey" name="wherey">
5076 <sect1>wherey<label id="wherey"><p>
5080 <tag/Function/Return the current Y position of the text mode cursor.
5081 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5082 <tag/Declaration/<tt/unsigned char wherey (void);/
5083 <tag/Description/The function returns the current Y position of the text mode
5084 cursor. Zero is returned for the uppermost screen position.
5085 <tag/Availability/cc65
5087 <ref id="gotox" name="gotox">,
5088 <ref id="gotoy" name="gotoy">,
5089 <ref id="gotoxy" name="gotoxy">,
5090 <ref id="wherex" name="wherex">