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>
68 <item><ref id="get_ostype" name="get_ostype">
72 <sect1><tt/apple2enh.h/<label id="apple2enh.h"><p>
77 <sect1><tt/assert.h/<label id="assert.h"><p>
80 <item><ref id="assert" name="assert">
84 <sect1><tt/atari.h/<label id="atari.h"><p>
87 <item><ref id="get_ostype" name="get_ostype">
93 <sect1><tt/atmos.h/<label id="atmos.h"><p>
98 <sect1><tt/c128.h/<label id="c128.h"><p>
101 <item><ref id="c64mode" name="c64mode">
102 <item><ref id="fast" name="fast">
103 <item><ref id="toggle_videomode" name="toggle_videomode">
104 <item><ref id="slow" name="slow">
108 <sect1><tt/c16.h/<label id="c16.h"><p>
113 <sect1><tt/c64.h/<label id="c64.h"><p>
116 <item><ref id="get_ostype" name="get_ostype">
120 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
123 <item><ref id="peekbsys" name="peekbsys">
124 <item><ref id="peekwsys" name="peekwsys">
125 <item><ref id="pokebsys" name="pokebsys">
126 <item><ref id="pokewsys" name="pokewsys">
130 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
133 <item><ref id="peekbsys" name="peekbsys">
134 <item><ref id="peekwsys" name="peekwsys">
135 <item><ref id="pokebsys" name="pokebsys">
136 <item><ref id="pokewsys" name="pokewsys">
140 <sect1><tt/conio.h/<label id="conio.h"><p>
143 <item><ref id="bgcolor" name="bgcolor">
144 <item><ref id="bordercolor" name="bordercolor">
145 <item><ref id="cclear" name="cclear">
146 <item><ref id="cclearxy" name="cclearxy">
147 <item><ref id="cgetc" name="cgetc">
148 <item><ref id="chline" name="chline">
149 <item><ref id="chlinexy" name="chlinexy">
150 <item><ref id="clrscr" name="clrscr">
151 <item><ref id="cprintf" name="cprintf">
152 <item><ref id="cputc" name="cputc">
153 <item><ref id="cputcxy" name="cputcxy">
154 <item><ref id="cputs" name="cputs">
155 <item><ref id="cputsxy" name="cputsxy">
156 <item><ref id="cursor" name="cursor">
157 <item><ref id="cvline" name="cvline">
158 <item><ref id="cvlinexy" name="cvlinexy">
159 <item><ref id="gotox" name="gotox">
160 <item><ref id="gotoxy" name="gotoxy">
161 <item><ref id="gotoy" name="gotoy">
162 <item><ref id="kbhit" name="kbhit">
163 <item><ref id="revers" name="revers">
164 <item><ref id="screensize" name="screensize">
165 <item><ref id="textcolor" name="textcolor">
166 <item><ref id="vcprintf" name="vcprintf">
167 <item><ref id="wherex" name="wherex">
168 <item><ref id="wherey" name="wherey">
172 <sect1><tt/ctype.h/<label id="ctype.h"><p>
175 <item><ref id="isalnum" name="isalnum">
176 <item><ref id="isalpha" name="isalpha">
177 <item><ref id="isascii" name="isascii">
178 <item><ref id="isblank" name="isblank">
179 <item><ref id="iscntrl" name="iscntrl">
180 <item><ref id="isdigit" name="isdigit">
181 <item><ref id="isgraph" name="isgraph">
182 <item><ref id="islower" name="islower">
183 <item><ref id="isprint" name="isprint">
184 <item><ref id="ispunct" name="ispunct">
185 <item><ref id="isspace" name="isspace">
186 <item><ref id="isupper" name="isupper">
187 <item><ref id="isxdigit" name="isxdigit">
188 <item><ref id="tolower" name="tolower">
189 <item><ref id="toupper" name="toupper">
193 <sect1><tt/dbg.h/<label id="dbg.h"><p>
198 <sect1><tt/dio.h/<label id="dio.h"><p>
203 <sect1><tt/em.h/<label id="em.h"><p>
206 <item><ref id="em_commit" name="em_commit">
207 <item><ref id="em_copyfrom" name="em_copyfrom">
208 <item><ref id="em_copyto" name="em_copyto">
209 <item><ref id="em_load_driver" name="em_load_driver">
210 <item><ref id="em_map" name="em_map">
211 <item><ref id="em_pagecount" name="em_pagecount">
212 <item><ref id="em_unload" name="em_unload">
213 <item><ref id="em_use" name="em_use">
217 <sect1><tt/errno.h/<label id="errno.h"><p>
222 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
225 <item><ref id="close" name="close">
226 <item><ref id="creat" name="creat">
227 <item><ref id="open" name="open">
231 <sect1><tt/geos.h/<label id="geos.h"><p>
236 <sect1><tt/joystick.h/<label id="joystick.h"><p>
239 <item><ref id="joy_count" name="joy_count">
240 <item><ref id="joy_install" name="joy_install">
241 <item><ref id="joy_load_driver" name="joy_load_driver">
242 <item><ref id="joy_read" name="joy_read">
243 <item><ref id="joy_uninstall" name="joy_uninstall">
244 <item><ref id="joy_unload" name="joy_unload">
248 <sect1><tt/locale.h/<label id="locale.h"><p>
251 <item><ref id="localeconv" name="localeconv">
252 <item><ref id="setlocale" name="setlocale">
256 <sect1><tt/modload.h/<label id="modload.h"><p>
259 <item><ref id="mod_load" name="mod_load">
260 <item><ref id="mod_free" name="mod_free">
264 <sect1><tt/mouse.h/<label id="mouse.h"><p>
267 <!-- <item><ref id="mouse_load_driver" name="mouse_load_driver"> -->
268 <!-- <item><ref id="mouse_unload" name="mouse_unload"> -->
269 <!-- <item><ref id="mouse_install" name="mouse_install"> -->
270 <!-- <item><ref id="mouse_uninstall" name="mouse_uninstall"> -->
271 <!-- <item><ref id="mouse_hide" name="mouse_hide"> -->
272 <!-- <item><ref id="mouse_show" name="mouse_show"> -->
273 <!-- <item><ref id="mouse_box" name="mouse_box"> -->
274 <!-- <item><ref id="mouse_move" name="mouse_move"> -->
275 <!-- <item><ref id="mouse_buttons" name="mouse_buttons"> -->
276 <!-- <item><ref id="mouse_pos" name="mouse_pos"> -->
277 <!-- <item><ref id="mouse_info" name="mouse_info"> -->
278 <!-- <item><ref id="mouse_ioctl" name="mouse_ioctl"> -->
284 <sect1><tt/nes.h/<label id="nes.h"><p>
289 <sect1><tt/o65.h/<label id="o65.h"><p>
291 The <tt/o65.h/ header file contains structure and constant definitions that
292 may be used when dealing with files in <htmlurl
293 url="http://www.6502.org/users/andre/o65/fileformat.html" name="o65 format">.
294 It does not declare any functions.
297 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
300 <item><ref id="PEEK" name="PEEK">
301 <item><ref id="PEEKW" name="PEEKW">
302 <item><ref id="POKE" name="POKE">
303 <item><ref id="POKEW" name="POKEW">
307 <sect1><tt/pet.h/<label id="pet.h"><p>
312 <sect1><tt/plus4.h/<label id="plus4.h"><p>
317 <sect1><tt/serial.h/<label id="serial.h"><p>
321 <item><ref id="ser_load_driver" name="ser_load_driver">
322 <item><ref id="ser_unload" name="ser_unload">
323 <item><ref id="ser_install" name="ser_install">
324 <item><ref id="ser_uninstall" name="ser_uninstall">
325 <item><ref id="ser_open" name="ser_open">
326 <item><ref id="ser_close" name="ser_close">
327 <item><ref id="ser_get" name="ser_get">
328 <item><ref id="ser_put" name="ser_put">
329 <item><ref id="ser_status" name="ser_status">
330 <item><ref id="ser_ioctl" name="ser_ioctl">
337 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
340 <item><ref id="setjmp" name="setjmp">
341 <item><ref id="longjmp" name="longjmp">
345 <sect1><tt/signal.h/<label id="signal.h"><p>
348 <item><ref id="raise" name="raise">
349 <item><ref id="signal" name="signal">
353 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
358 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
363 <sect1><tt/stddef.h/<label id="stddef.h"><p>
366 <item><ref id="offsetof" name="offsetof">
370 <sect1><tt/stdio.h/<label id="stdio.h"><p>
373 <item><ref id="clearerr" name="clearerr">
374 <!-- <item><ref id="fclose" name="fclose"> -->
375 <!-- <item><ref id="fdopen" name="fdopen"> -->
376 <item><ref id="feof" name="feof">
377 <item><ref id="ferror" name="ferror">
378 <!-- <item><ref id="fflush" name="fflush"> -->
379 <!-- <item><ref id="fgetc" name="fgetc"> -->
380 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
381 <!-- <item><ref id="fgets" name="fgets"> -->
382 <item><ref id="fileno" name="fileno">
383 <!-- <item><ref id="flushall" name="flushall"> -->
384 <!-- <item><ref id="fopen" name="fopen"> -->
385 <!-- <item><ref id="fprintf" name="fprintf"> -->
386 <!-- <item><ref id="fputc" name="fputc"> -->
387 <!-- <item><ref id="fputs" name="fputs"> -->
388 <!-- <item><ref id="fread" name="fread"> -->
389 <!-- <item><ref id="freopen" name="freopen"> -->
390 <!-- <item><ref id="fscanf" name="fscanf"> -->
391 <!-- <item><ref id="fseek" name="fseek"> -->
392 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
393 <!-- <item><ref id="ftell" name="ftell"> -->
394 <!-- <item><ref id="fwrite" name="fwrite"> -->
395 <!-- <item><ref id="getc" name="getc"> -->
396 <!-- <item><ref id="getchar" name="getchar"> -->
397 <!-- <item><ref id="gets" name="gets"> -->
398 <!-- <item><ref id="printf" name="printf"> -->
399 <!-- <item><ref id="putc" name="putc"> -->
400 <!-- <item><ref id="putchar" name="putchar"> -->
401 <!-- <item><ref id="puts" name="puts"> -->
402 <!-- <item><ref id="rename" name="rename"> -->
403 <!-- <item><ref id="rewind" name="rewind"> -->
404 <!-- <item><ref id="scanf" name="scanf"> -->
405 <!-- <item><ref id="sprintf" name="sprintf"> -->
406 <!-- <item><ref id="sscanf" name="sscanf"> -->
407 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
408 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
409 <!-- <item><ref id="vprintf" name="vprintf"> -->
410 <!-- <item><ref id="vscanf" name="vscanf"> -->
411 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
412 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
418 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
421 <item><ref id="_heapadd" name="_heapadd">
422 <item><ref id="_heapblocksize" name="_heapblocksize">
423 <item><ref id="_heapmaxavail" name="_heapmaxavail">
424 <item><ref id="_heapmemavail" name="_heapmemavail">
425 <item><ref id="_poserror" name="_poserror">
426 <item><ref id="_randomize" name="_randomize">
427 <item><ref id="_swap" name="_swap">
428 <item><ref id="abort" name="abort">
429 <item><ref id="abs" name="abs">
430 <item><ref id="atexit" name="atexit">
431 <item><ref id="atoi" name="atoi">
432 <item><ref id="atol" name="atol">
433 <item><ref id="bsearch" name="bsearch">
434 <item><ref id="calloc" name="calloc">
435 <item><ref id="div" name="div">
436 <item><ref id="exit" name="exit">
437 <item><ref id="free" name="free">
438 <item><ref id="getenv" name="getenv">
439 <item><ref id="itoa" name="itoa">
440 <item><ref id="labs" name="labs">
441 <item><ref id="ltoa" name="ltoa">
442 <item><ref id="malloc" name="malloc">
443 <item><ref id="perror" name="perror">
444 <item><ref id="qsort" name="qsort">
445 <item><ref id="rand" name="rand">
446 <item><ref id="realloc" name="realloc">
447 <item><ref id="remove" name="remove">
448 <item><ref id="srand" name="srand">
449 <item><ref id="ultoa" name="ultoa">
450 <item><ref id="utoa" name="utoa">
454 <sect1><tt/string.h/<label id="string.h"><p>
457 <item><ref id="_stroserror" name="_stroserror">
458 <item><ref id="bzero" name="bzero">
459 <item><ref id="memchr" name="memchr">
460 <item><ref id="memcpy" name="memcpy">
461 <item><ref id="memmove" name="memmove">
462 <item><ref id="memset" name="memset">
463 <item><ref id="strcasecmp" name="strcasecmp">
464 <item><ref id="strcat" name="strcat">
465 <item><ref id="strchr" name="strchr">
466 <item><ref id="strcmp" name="strcmp">
467 <item><ref id="strcoll" name="strcoll">
468 <item><ref id="strcpy" name="strcpy">
469 <item><ref id="strcspn" name="strcspn">
470 <item><ref id="strdup" name="strdup">
471 <item><ref id="strerror" name="strerror">
472 <item><ref id="stricmp" name="stricmp">
473 <item><ref id="strlen" name="strlen">
474 <item><ref id="strlower" name="strlower">
475 <item><ref id="strlwr" name="strlwr">
476 <item><ref id="strncat" name="strncat">
477 <item><ref id="strncmp" name="strncmp">
478 <item><ref id="strncpy" name="strncpy">
479 <item><ref id="strrchr" name="strrchr">
480 <item><ref id="strspn" name="strspn">
481 <item><ref id="strstr" name="strstr">
482 <item><ref id="strtok" name="strtok">
483 <!-- <item><ref id="strxfrm" name="strxfrm"> -->
484 <item><ref id="strupper" name="strupper">
485 <item><ref id="strupr" name="strupr">
491 <sect1><tt/tgi.h/<label id="tgi.h"><p>
496 <sect1><tt/time.h/<label id="time.h"><p>
499 <!-- <item><ref id="_systime" name="_systime"> -->
500 <!-- <item><ref id="asctime" name="asctime"> -->
501 <!-- <item><ref id="clock" name="clock"> -->
502 <!-- <item><ref id="ctime" name="ctime"> -->
503 <!-- <item><ref id="gmtime" name="gmtime"> -->
504 <!-- <item><ref id="localtime" name="localtime"> -->
505 <!-- <item><ref id="mktime" name="mktime"> -->
506 <!-- <item><ref id="strftime" name="strftime"> -->
507 <item><ref id="time" name="time">
513 <sect1><tt/unistd.h/<label id="unistd.h"><p>
516 <!-- <item><ref id="chdir" name="chdir"> -->
517 <!-- <item><ref id="getcwd" name="getcwd"> -->
518 <!-- <item><ref id="lseek" name="lseek"> -->
519 <!-- <item><ref id="mkdir" name="mkdir"> -->
520 <!-- <item><ref id="read" name="read"> -->
521 <!-- <item><ref id="rmdir" name="rmdir"> -->
522 <item><ref id="sleep" name="sleep">
523 <item><ref id="unlink" name="unlink">
524 <!-- <item><ref id="write" name="write"> -->
530 <sect1><tt/vic20.h/<label id="vic20.h"><p>
535 <sect1><tt/zlib.h/<label id="zlib.h"><p>
540 <sect>Alphabetical function reference<p>
542 <sect1>_heapadd<label id="_heapadd"><p>
546 <tag/Function/Add a block to the heap.
547 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
548 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
549 <tag/Description/The function adds a block of raw memory to the heap.
552 <item>The minimum blocksize that can be added is 6 bytes; the function will
553 ignore smaller blocks.
555 <tag/Availability/cc65
557 <ref id="_heapblocksize" name="_heapblocksize">,
558 <ref id="_heapmaxavail" name="_heapmaxavail">,
559 <ref id="_heapmemavail" name="_heapmemavail">,
560 <ref id="calloc" name="calloc">,
561 <ref id="free" name="free">,
562 <ref id="malloc" name="malloc">,
563 <ref id="realloc" name="realloc">
569 <sect1>_heapblocksize<label id="_heapblocksize"><p>
573 <tag/Function/Return the size of an allocated block.
574 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
575 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
576 <tag/Description/The function returns the size of a block that must have
577 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
578 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
581 <item>Passing a pointer to a block that was is not the result of one of the
582 allocation functions, or that has been free'd will give unpredicable results.
584 <tag/Availability/cc65
586 <ref id="_heapadd" name="_heapadd">,
587 <ref id="_heapmaxavail" name="_heapmaxavail">,
588 <ref id="_heapmemavail" name="_heapmemavail">,
589 <ref id="calloc" name="calloc">,
590 <ref id="free" name="free">,
591 <ref id="malloc" name="malloc">,
592 <ref id="realloc" name="realloc">
598 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
602 <tag/Function/Return the largest block that is available on the heap.
603 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
604 <tag/Declaration/<tt/size_t __fastcall__ _heapmaxavail (void);/
605 <tag/Description/The function returns the size of the largest block that may
606 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
607 <tag/Availability/cc65
609 <ref id="_heapadd" name="_heapadd">,
610 <ref id="_heapblocksize" name="_heapblocksize">,
611 <ref id="_heapmemavail" name="_heapmemavail">,
612 <ref id="calloc" name="calloc">,
613 <ref id="free" name="free">,
614 <ref id="malloc" name="malloc">,
615 <ref id="realloc" name="realloc">
621 <sect1>_heapmemavail<label id="_heapmemavail"><p>
625 <tag/Function/Return the total available space on the heap.
626 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
627 <tag/Declaration/<tt/size_t __fastcall__ _heapmemavail (void);/
628 <tag/Description/The function returns the total number of bytes available on
632 <item>This function is of less use than usually assumed, since the returned
633 heap space may be available but not in one block. So even if this function
634 says that several times more heap space is available than needed, <ref
635 id="malloc" name="malloc"> may still return <tt/NULL/.
637 <tag/Availability/cc65
639 <ref id="_heapadd" name="_heapadd">,
640 <ref id="_heapblocksize" name="_heapblocksize">,
641 <ref id="_heapmaxavail" name="_heapmaxavail">,
642 <ref id="calloc" name="calloc">,
643 <ref id="free" name="free">,
644 <ref id="malloc" name="malloc">,
645 <ref id="realloc" name="realloc">
651 <sect1>_poserror<label id="_poserror"><p>
655 <tag/Function/Print an error message for the error in <tt/_oserrno/.
656 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
657 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
658 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
659 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
660 a colon and a blank. Then the error message for the current contents of
661 <tt/_oserrno/ are printed followed by a newline. The message output is the
662 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
663 argument of <tt/_oserrno/.
666 <item>Since operating system specific error code are - you guessed it -
667 operating system specific, the value in <tt/_oserror/ and the message that is
668 printed depend on the cc65 target.
669 <item>The function is only available as fastcall function, so it may only
670 be used in presence of a prototype.
672 <tag/Availability/cc65
674 <ref id="_stroserror" name="_stroserror">,
675 <ref id="perror" name="perror">
681 <sect1>_randomize<label id="_randomize"><p>
685 <tag/Function/Initialize the pseudo random number generator.
686 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
687 <tag/Declaration/<tt/void _randomize (void);/
688 <tag/Description/The function initializes the random number generator with
689 a seed derived from fast changing hardware events, so the seed itself can be
690 considered random to a certain degree.
691 <tag/Limits/<itemize>
692 <item>The randomness of the seed depends on the machine hardware.
694 <tag/Availability/cc65
696 <ref id="rand" name="rand">,
697 <ref id="srand" name="srand">
703 <sect1>_stroserror<label id="_stroserror"><p>
707 <tag/Function/Return a string describing an OS specific error code.
708 <tag/Header/<tt/<ref id="string.h" name="string.h">/
709 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
710 <tag/Description/<tt/_stroserror/ will return a string describing the given
711 operating system specific error code.
712 <tag/Limits/<itemize>
713 <item>Since operating system specific error code are - you guessed it -
714 operating system specific, the parameter and the string returned depend on the
716 <item>The function is only available as fastcall function, so it may only be
717 used in presence of a prototype.
719 <tag/Availability/cc65
721 <ref id="strerror" name="strerror">
727 <sect1>_swap<label id="_swap"><p>
731 <tag/Function/Swap the contents of memory areas.
732 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
733 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
734 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
735 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
736 <tt/size/ bytes in size.
737 <tag/Limits/<itemize>
738 <item>The memory areas may not overlap, otherwise the results are undefined.
739 <item>The function is only available as fastcall function, so it may only be
740 used in presence of a prototype.
742 <tag/Availability/cc65
744 <ref id="memcpy" name="memcpy">,
745 <ref id="memmove" name="memmove">
751 <sect1>_sys<label id="_sys"><p>
755 <tag/Function/Call a subroutine passing register values.
756 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
757 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
758 <tag/Description/The function will call the subroutine at the address
759 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
760 registers and the CPU flags are set to the values given in the <tt/regs/
761 structure. On return from the subroutine, the new values of the registers and
762 flags are stored back overwriting the old values.
763 <tag/Limits/<itemize>
764 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
765 when calling the subroutine (they are unchanged from their current values).
766 <item>The function is only available as fastcall function, so it may only be
767 used in presence of a prototype.
769 <tag/Availability/cc65
775 <sect1>BRK<label id="BRK"><p>
779 <tag/Function/Insert a 6502 BRK instrunction into the code.
780 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
781 <tag/Declaration/<tt/void BRK (void);/
782 <tag/Description/The function will insert a 6502 BRK instruction into the code
783 which may be used to trigger a debugger.
784 <tag/Limits/<itemize>
785 <item>The function is actually a macro.
786 <item>The inserted instruction may lead to unexpected results if no debugger
789 <tag/Availability/cc65
791 <ref id="CLI" name="CLI">,
792 <ref id="SEI" name="SEI">
798 <sect1>CLI<label id="CLI"><p>
802 <tag/Function/Insert a 6502 CLI instrunction into the code.
803 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
804 <tag/Declaration/<tt/void CLI (void);/
805 <tag/Description/The function will insert a 6502 CLI instruction into the code,
806 so interrupts are disabled. Note that non maskable interrupts cannot be
808 <tag/Limits/<itemize>
809 <item>The function is actually a macro.
810 <item>Disabling interrupts may lead to unexpected results.
812 <tag/Availability/cc65
814 <ref id="BRK" name="BRK">,
815 <ref id="SEI" name="SEI">
821 <sect1>PEEK<label id="PEEK"><p>
825 <tag/Function/Read a byte from memory.
826 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
827 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
828 <tag/Description/The function will read the absolute memory given by <tt/addr/
829 and return the value read.
830 <tag/Limits/<itemize>
831 <item>The function is actually a macro.
832 <item>This function depends highly on the platform and environment.
834 <tag/Availability/cc65
836 <ref id="PEEKW" name="PEEKW">,
837 <ref id="POKE" name="POKE">
843 <sect1>PEEKW<label id="PEEKW"><p>
847 <tag/Function/Read a word (two bytes) from memory.
848 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
849 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
850 <tag/Description/The function will read the absolute memory given by <tt/addr/
851 and return the value read. The byte read from the higher address is the high
852 byte of the return value.
853 <tag/Limits/<itemize>
854 <item>The function is actually a macro.
855 <item>This function depends highly on the platform and environment.
856 <item>The order in which the two bytes are read is unspecified and may
857 depend of the address expression used.
859 <tag/Availability/cc65
861 <ref id="PEEK" name="PEEK">,
862 <ref id="POKE" name="POKE">
868 <sect1>POKE<label id="POKE"><p>
872 <tag/Function/Write a byte to memory.
873 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
874 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
875 <tag/Description/The function writes the value <tt/val/ to the absolute
876 memory address given by <tt/addr/.
877 <tag/Limits/<itemize>
878 <item>The function is actually a macro.
879 <item>This function depends highly on the platform and environment.
880 <item>Careless use will cause the program to act strange or may crash the
883 <tag/Availability/cc65
885 <ref id="PEEK" name="PEEK">,
886 <ref id="POKEW" name="POKEW">
892 <sect1>POKEW<label id="POKEW"><p>
896 <tag/Function/Write a word (two bytes) to memory.
897 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
898 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
899 <tag/Description/The function writes the value <tt/val/ to the absolute
900 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
901 the <tt/addr/, the high byte is written to <tt/addr+1/.
902 <tag/Limits/<itemize>
903 <item>The function is actually a macro.
904 <item>This function depends highly on the platform and environment.
905 <item>Careless use will cause the program to act strange or may crash the
907 <item>The order in which the two bytes are written is unspecified and may
908 depend of the address expression used.
910 <tag/Availability/cc65
912 <ref id="PEEK" name="PEEK">,
913 <ref id="POKE" name="POKE">
919 <sect1>SEI<label id="SEI"><p>
923 <tag/Function/Insert a 6502 SEI instrunction into the code.
924 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
925 <tag/Declaration/<tt/void SEI (void);/
926 <tag/Description/The function will insert a 6502 SEI instruction into the code,
927 so interrupts are enabled. Enabling interrupts has no effects if they are
928 already enabled (the default).
929 <tag/Limits/<itemize>
930 <item>The function is actually a macro.
932 <tag/Availability/cc65
934 <ref id="BRK" name="BRK">,
935 <ref id="CLI" name="CLI">
941 <sect1>abort<label id="abort"><p>
945 <tag/Function/Terminates a program abnormally.
946 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
947 <tag/Declaration/<tt/void abort (void);/
948 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
949 on stderr, then terminates the program with an exit code of 3.
950 <tag/Availability/ISO 9899
952 <ref id="assert" name="assert">,
953 <ref id="exit" name="exit">,
954 <ref id="raise" name="raise">
960 <sect1>abs<label id="abs"><p>
964 <tag/Function/Returns the absolute value of an integer.
965 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
966 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
967 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
969 <tag/Limits/<itemize>
970 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
971 <item>The function is only available as fastcall function, so it may only be
972 used in presence of a prototype.
974 <tag/Availability/ISO 9899
976 <ref id="labs" name="labs">
982 <sect1>assert<label id="assert"><p>
986 <tag/Function/Test a condition and possibly abort.
987 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
988 <tag/Declaration/<tt/void assert (int cond);/
989 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
990 statement. If the condition evaluates t zero (false), assert prints a message
991 on stderr and aborts the program.
992 <tag/Limits/<itemize>
993 <item>The function is actually a macro.
995 <tag/Availability/ISO 9899
997 <ref id="abort" name="abort">,
998 <ref id="exit" name="exit">
1004 <sect1>atexit<label id="atexit"><p>
1008 <tag/Function/Register an exit function.
1009 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1010 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1011 <tag/Description/<tt/atexit/ registers the function pointed to by
1012 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1013 terminates, they are called in LIFO order (the last function registered is
1014 called first). <tt/atexit/ returns zero on success and a nonzero value on
1016 <tag/Limits/<itemize>
1017 <item>A maximum of 5 exit functions can be registered.
1018 <item>There is no way to unregister an exit function.
1019 <item>The function is only available as fastcall function, so it may only be
1020 used in presence of a prototype.
1022 <tag/Availability/ISO 9899
1024 <ref id="abort" name="abort">,
1025 <ref id="exit" name="exit">
1031 <sect1>atoi<label id="atoi"><p>
1035 <tag/Function/Convert a string to an integer.
1036 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1037 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1038 <tag/Description/<tt/atoi/ converts the given string into an integer.
1039 Conversion stops as soon as any invalid character is encountered.
1040 <tag/Limits/<itemize>
1041 <item>There is no way to detect any conversion errors.
1042 <item>The function does not check for an numerical overflow when converting.
1043 <item>The function is only available as fastcall function, so it may only be
1044 used in presence of a prototype.
1046 <tag/Availability/ISO 9899
1048 <ref id="atol" name="atol">,
1049 <ref id="itoa" name="itoa">,
1050 <ref id="ltoa" name="ltoa">,
1051 <ref id="ultoa" name="ultoa">,
1052 <ref id="utoa" name="utoa">
1058 <sect1>atol<label id="atol"><p>
1062 <tag/Function/Convert a string to a long integer.
1063 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1064 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1065 <tag/Description/<tt/atol/ converts the given string into a long integer.
1066 Conversion stops as soon as any invalid character is encountered.
1067 <tag/Limits/<itemize>
1068 <item>There is no way to detect any conversion errors.
1069 <item>The function does not check for an numerical overflow when converting.
1070 <item>The function is only available as fastcall function, so it may only be
1071 used in presence of a prototype.
1073 <tag/Availability/ISO 9899
1075 <ref id="atoi" name="atoi">,
1076 <ref id="itoa" name="itoa">,
1077 <ref id="ltoa" name="ltoa">,
1078 <ref id="ultoa" name="ultoa">,
1079 <ref id="utoa" name="utoa">
1085 <sect1>bgcolor<label id="bgcolor"><p>
1089 <tag/Function/Set the background text color.
1090 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1091 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1092 <tag/Description/The function will set a new background color and return the
1093 old (current) one. The background color is valid for the whole text output
1094 area of the screen, not just for new text.
1095 <tag/Limits/<itemize>
1096 <item>Background colors are system dependent. The function may have no effect
1097 on systems where the background color cannot be changed.
1098 <item>The function is only available as fastcall function, so it may only be
1099 used in presence of a prototype.
1101 <tag/Availability/cc65
1103 <ref id="bordercolor" name="bordercolor">,
1104 <ref id="textcolor" name="textcolor">
1110 <sect1>bordercolor<label id="bordercolor"><p>
1114 <tag/Function/Set the border (frame) color.
1115 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1116 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1117 <tag/Description/The function will set a new border color. It returns the old
1118 (current) border color.
1119 <tag/Limits/<itemize>
1120 <item>Border colors are system dependent. The function may have no effect
1121 on systems where the border color cannot be changed.
1122 <item>The function is only available as fastcall function, so it may only
1123 be used in presence of a prototype.
1125 <tag/Availability/cc65
1127 <ref id="bgcolor" name="bgcolor">,
1128 <ref id="textcolor" name="textcolor">
1134 <sect1>bsearch<label id="bsearch"><p>
1138 <tag/Function/Do a binary search in a sorted array.
1139 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1140 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1141 const void* base, size_t n, size_t size,
1142 int (*cmp) (const void*, const void*));/
1143 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1144 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1145 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1146 the function used to compare the members against the key. The function returns
1147 a pointer to the member found, or <tt/NULL/ if there was no match.
1150 <item>The contents of the array must be sorted in ascending order according to
1151 the compare function given.
1152 <item>If there are multiple members that match the key, the function will
1153 return one of the members.
1154 <item>The function is only available as fastcall function, so it may only
1155 be used in presence of a prototype.
1157 <tag/Availability/ISO 9899
1159 <ref id="qsort" name="qsort">
1165 <sect1>bzero<label id="bzero"><p>
1169 <tag/Function/Fill a memory area with zeroes.
1170 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1171 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1172 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1176 <item>The function is non standard and therefore only available in non ANSI
1177 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1178 <item>The function is only available as fastcall function, so it may only
1179 be used in presence of a prototype.
1181 <tag/Availability/cc65
1183 <ref id="_swap" name="_swap">,
1184 <ref id="memcpy" name="memcpy">,
1185 <ref id="memmove" name="memmove">,
1186 <ref id="memset" name="memset">,
1192 <sect1>c64mode<label id="c64mode"><p>
1196 <tag/Function/Switch the C128 into C64 compatible mode.
1197 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1198 <tag/Declaration/<tt/void c64mode (void);/
1199 <tag/Description/The function will cause the machine to reboot into C64 mode.
1200 <tag/Limits/<itemize>
1201 <item>The function is specific to the C128.
1202 <item>The function will not return to the caller.
1204 <tag/Availability/C128
1210 <sect1>calloc<label id="calloc"><p>
1214 <tag/Function/Allocate and clear memory.
1215 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1216 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1217 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1218 of size <tt/size/, clears the whole block with binary zeroes and returns a
1219 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1223 <item>Clearing the memory may not have the expected effect on all platforms:
1224 pointers in the block may not be <tt/NULL/ and floating point variables may
1225 not be zero (0.0). In other words: The "clearing" effect of this function
1226 should be used with care for portable programs.
1227 <item>The function is only available as fastcall function, so it may only
1228 be used in presence of a prototype.
1230 <tag/Availability/ISO 9899
1232 <ref id="_heapadd" name="_heapadd">,
1233 <ref id="_heapblocksize" name="_heapblocksize">,
1234 <ref id="_heapmaxavail" name="_heapmaxavail">,
1235 <ref id="_heapmemavail" name="_heapmemavail">,
1236 <ref id="free" name="free">,
1237 <ref id="malloc" name="malloc">,
1238 <ref id="realloc" name="realloc">
1244 <sect1>cclear<label id="cclear"><p>
1248 <tag/Function/Clear part of a line (write a given number of spaces).
1249 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1250 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
1251 <tag/Description/The function clears part of a line by writing <tt/length/
1252 spaces in the current text color.
1253 <tag/Limits/<itemize>
1254 <item>The function is only available as fastcall function, so it may
1255 only be used in presence of a prototype.
1257 <tag/Availability/cc65
1259 <ref id="cclearxy" name="cclearxy">,
1260 <ref id="clrscr" name="clrscr">
1266 <sect1>cclearxy<label id="cclearxy"><p>
1270 <tag/Function/Clear part of a line (write a given number of spaces) starting
1271 at a specific screen position.
1272 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1273 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
1274 <tag/Description/The function moves the cursor to a specific position, and
1275 will then clear part of the line by writing <tt/length/ spaces in the current
1277 <tag/Limits/<itemize>
1278 <item>The function is only available as fastcall function, so it may
1279 only be used in presence of a prototype.
1281 <tag/Availability/cc65
1283 <ref id="cclear" name="cclear">,
1284 <ref id="clrscr" name="clrscr">
1290 <sect1>cgetc<label id="cgetc"><p>
1294 <tag/Function/Read a character from the keyboard.
1295 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1296 <tag/Declaration/<tt/char cgetc (void);/
1297 <tag/Description/The function reads a character from the keyboard. If there is
1298 no character available, <tt/cgetc/ waits until the user presses a key. If the
1299 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
1300 displayed while waiting.
1301 <tag/Limits/<itemize>
1302 <item>If the system supports a keyboard buffer, <tt/cgetc/ will fetch a key
1303 from this buffer and wait only if the buffer is empty.
1305 <tag/Availability/cc65
1307 <ref id="cursor" name="cursor">,
1308 <ref id="kbhit" name="kbhit">
1314 <sect1>chline<label id="chline"><p>
1318 <tag/Function/Output a horizontal line in text mode.
1319 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1320 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
1321 <tag/Description/The function outputs a horizontal line with the given length
1322 starting at the current cursor position.
1323 <tag/Limits/<itemize>
1324 <item>The character used to draw the horizontal line is system dependent.
1325 If available, a line drawing character is used. Drawing a line that is partially
1326 off screen leads to undefined behaviour.
1327 <item>The function is only available as fastcall function, so it may only be
1328 used in presence of a prototype.
1330 <tag/Availability/cc65
1332 <ref id="chlinexy" name="chlinexy">,
1333 <ref id="cvline" name="cvline">,
1334 <ref id="cvlinexy" name="cvlinexy">
1340 <sect1>chlinexy<label id="chlinexy"><p>
1344 <tag/Function/Output a horizontal line at a given position in text mode.
1345 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1346 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
1347 <tag/Description/The function outputs a horizontal line with the given length
1348 starting at a given position.
1349 <tag/Limits/<itemize>
1350 <item>The character used to draw the horizontal line is system dependent.
1351 If available, a line drawing character is used. Drawing a line that is partially
1352 off screen leads to undefined behaviour.
1353 <item>The function is only available as fastcall function, so it may only be
1354 used in presence of a prototype.
1356 <tag/Availability/cc65
1358 <ref id="chline" name="chline">,
1359 <ref id="cvline" name="cvline">,
1360 <ref id="cvlinexy" name="cvlinexy">
1366 <sect1>clearerr<label id="clearerr"><p>
1370 <tag/Function/Clear error and end-of-file status of a stream.
1371 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1372 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
1373 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
1374 indicators for the stream <tt/f/.
1375 <tag/Limits/<itemize>
1376 <item>The function is only available as fastcall function, so it may only be
1377 used in presence of a prototype.
1379 <tag/Availability/ISO 9899
1381 <ref id="feof" name="feof">,
1382 <ref id="ferror" name="ferror">
1388 <sect1>clrscr<label id="clrscr"><p>
1392 <tag/Function/Clear the text screen.
1393 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1394 <tag/Declaration/<tt/void clrscr (void);/
1395 <tag/Description/The function clears the text screen and moves the cursor to
1396 the upper left corner.
1397 <tag/Availability/cc65
1399 <ref id="cclear" name="cclear">,
1400 <ref id="cclearxy" name="cclearxy">
1406 <sect1>close<label id="close"><p>
1410 <tag/Function/Close a file descriptor.
1411 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1412 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
1413 <tag/Description/The function closes the given file descriptor. It returns zero
1414 on success and -1 on error. If an error occurs, the cause can be determined by
1415 reading the <tt/errno/ variable.
1416 <tag/Limits/<itemize>
1417 <item>The function is only available as fastcall function, so it may only
1418 be used in presence of a prototype.
1420 <tag/Availability/POSIX 1003.1
1422 <ref id="creat" name="creat">,
1423 <ref id="open" name="open">
1429 <sect1>creat<label id="creat"><p>
1433 <tag/Function/Create a file.
1434 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1435 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
1436 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
1437 associated with it. On error, -1 is returned and an error code is stored in
1439 <tag/Limits/<itemize>
1440 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
1441 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
1442 <item>The function is only available as fastcall function, so it may only
1443 be used in presence of a prototype.
1445 <tag/Availability/POSIX 1003.1
1447 <ref id="close" name="close">,
1448 <ref id="open" name="open">
1454 <sect1>cprintf<label id="cprintf"><p>
1458 <tag/Function/Formatted output to the console.
1459 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1460 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
1461 <tag/Description/The arguments are converted to text where necessary and
1462 formatted according to the format string given. The resulting string is output
1463 to the console. <tt/cprintf/ supports the same format specifiers as
1464 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
1465 <tag/Limits/<itemize>
1466 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
1467 between <tt/\r/ and <tt/\n/.
1469 <tag/Availability/cc65
1471 <ref id="cputc" name="cputc">,
1472 <ref id="cputcxy" name="cputcxy">,
1473 <ref id="cputs" name="cputs">,
1474 <ref id="cputsxy" name="cputsxy">,
1475 <ref id="vcprintf" name="vcprintf">
1481 <sect1>cputc<label id="cputc"><p>
1485 <tag/Function/Output a character directly to the console.
1486 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1487 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
1488 <tag/Description/Output one character to the console at the current cursor
1490 <tag/Limits/<itemize>
1491 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
1492 between <tt/\r/ and <tt/\n/.
1493 <item>The function is only available as fastcall function, so it may only
1494 be used in presence of a prototype.
1496 <tag/Availability/cc65
1498 <ref id="cprintf" name="cprintf">,
1499 <ref id="cputcxy" name="cputcxy">,
1500 <ref id="cputs" name="cputs">,
1501 <ref id="cputsxy" name="cputsxy">,
1502 <ref id="vcprintf" name="vcprintf">
1508 <sect1>cputcxy<label id="cputcxy"><p>
1512 <tag/Function/Output a character at a specific screen position.
1513 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1514 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
1515 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
1516 the screen and outputs one character.
1517 <tag/Limits/<itemize>
1518 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
1519 between <tt/\r/ and <tt/\n/.
1520 <item>The function is only available as fastcall function, so it may only
1521 be used in presence of a prototype.
1523 <tag/Availability/cc65
1525 <ref id="cprintf" name="cprintf">,
1526 <ref id="cputc" name="cputc">,
1527 <ref id="cputs" name="cputs">,
1528 <ref id="cputsxy" name="cputsxy">,
1529 <ref id="vcprintf" name="vcprintf">
1535 <sect1>cputs<label id="cputs"><p>
1539 <tag/Function/Output a string directly to the console.
1540 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1541 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
1542 <tag/Description/The function outputs the given string on the console at the
1543 current cursor position.
1544 <tag/Limits/<itemize>
1545 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
1546 between <tt/\r/ and <tt/\n/.
1547 <item>The function is only available as fastcall function, so it may only
1548 be used in presence of a prototype.
1550 <tag/Availability/cc65
1552 <ref id="cprintf" name="cprintf">,
1553 <ref id="cputc" name="cputc">,
1554 <ref id="cputcxy" name="cputcxy">,
1555 <ref id="cputsxy" name="cputsxy">,
1556 <ref id="vcprintf" name="vcprintf">
1562 <sect1>cputsxy<label id="cputsxy"><p>
1566 <tag/Function/Output a string to the console at a given position.
1567 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1568 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
1569 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
1570 and outputs the string <tt/s/.
1571 <tag/Limits/<itemize>
1572 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
1573 between <tt/\r/ and <tt/\n/.
1574 <item>The function is only available as fastcall function, so it may only
1575 be used in presence of a prototype.
1577 <tag/Availability/cc65
1579 <ref id="cprintf" name="cprintf">,
1580 <ref id="cputc" name="cputc">,
1581 <ref id="cputcxy" name="cputcxy">,
1582 <ref id="cputs" name="cputs">,
1583 <ref id="vcprintf" name="vcprintf">
1589 <sect1>cursor<label id="cursor"><p>
1593 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
1594 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1595 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
1596 <tag/Description/If the argument to the function is non zero, a blinking cursor
1597 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
1598 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
1599 <tag/Limits/<itemize>
1600 <item>The function is only available as fastcall function, so it may only
1601 be used in presence of a prototype.
1603 <tag/Availability/cc65
1605 <ref id="cgetc" name="cgetc">,
1606 <ref id="kbhit" name="kbhit">
1612 <sect1>cvline<label id="cvline"><p>
1616 <tag/Function/Output a vertical line in text mode.
1617 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1618 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
1619 <tag/Description/The function outputs a vertical line with the given length
1620 starting at the current cursor position.
1621 <tag/Limits/<itemize>
1622 <item>The character used to draw the vertical line is system dependent.
1623 If available, a line drawing character is used. Drawing a line that is partially
1624 off screen leads to undefined behaviour.
1625 <item>The function is only available as fastcall function, so it may only be
1626 used in presence of a prototype.
1628 <tag/Availability/cc65
1630 <ref id="chline" name="chline">,
1631 <ref id="chlinexy" name="chlinexy">,
1632 <ref id="cvlinexy" name="cvlinexy">
1638 <sect1>cvlinexy<label id="cvlinexy"><p>
1642 <tag/Function/Output a vertical line at a given position in text mode.
1643 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1644 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
1645 <tag/Description/The function outputs a vertical line with the given length
1646 starting at a given position.
1647 <tag/Limits/<itemize>
1648 <item>The character used to draw the vertical line is system dependent.
1649 If available, a line drawing character is used. Drawing a line that is partially
1650 off screen leads to undefined behaviour.
1651 <item>The function is only available as fastcall function, so it may only be
1652 used in presence of a prototype.
1654 <tag/Availability/cc65
1656 <ref id="chline" name="chline">,
1657 <ref id="chlinexy" name="chlinexy">,
1658 <ref id="cvline" name="cvline">
1664 <sect1>div<label id="div"><p>
1668 <tag/Function/Divide two ints and return quotient and remainder.
1669 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1670 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
1671 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
1672 quotient and remainder in a <tt/div_t/ structure.
1675 <item>The function is only available as fastcall function, so it may only
1676 be used in presence of a prototype.
1678 <tag/Availability/ISO 9899
1686 <sect1>em_commit<label id="em_commit"><p>
1690 <tag/Function/Commit changes into extended memory.
1691 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1692 <tag/Declaration/<tt/void __fastcall__ em_commit (void);/
1693 <tag/Description/Commit changes in the memory window to extended storage. If
1694 the contents of the memory window have been changed, these changes may be lost
1695 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
1696 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
1697 name="em_copyto">/ are called without calling <tt/em_commit/ first.
1698 <tag/Limits/<itemize>
1699 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
1700 memory window are discarded, it does just mean that the drivers is allowed
1702 <item>The function is only available as fastcall function, so it may only be
1703 used in presence of a prototype.
1704 <item>The function produces undefined results if no extended memory driver is
1707 <tag/Availability/cc65
1709 <ref id="em_load_driver" name="em_load_driver">,
1710 <ref id="em_map" name="em_map">,
1711 <ref id="em_use" name="em_use">
1717 <sect1>em_copyfrom<label id="em_copyfrom"><p>
1721 <tag/Function/Copy from extended into normal memory.
1722 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1723 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
1724 <tag/Description/Copy data from extended memory into linear memory. Source and
1725 target addresses as well as the number of bytes to transfer are specified in
1726 the <tt/em_copy/ structure that is passed as a parameter.
1727 <tag/Limits/<itemize>
1728 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
1729 made any changes to the data in the window, call <tt/<ref id="em_commit"
1730 name="em_commit">/ first, or the changes are lost.
1731 <item>The function is only available as fastcall function, so it may only be
1732 used in presence of a prototype.
1733 <item>The function produces undefined results if no extended memory driver is
1736 <tag/Availability/cc65
1738 <ref id="em_commit" name="em_commit">,
1739 <ref id="em_copyto" name="em_copyto">,
1740 <ref id="em_load_driver" name="em_load_driver">
1746 <sect1>em_copyto<label id="em_copyto"><p>
1750 <tag/Function/Copy from normal into extended memory.
1751 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1752 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
1753 <tag/Description/Copy data from linear into extended memory. Source and
1754 target addresses as well as the number of bytes to transfer are specified in
1755 the <tt/em_copy/ structure that is passed as a parameter.
1756 <tag/Limits/<itemize>
1757 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
1758 made any changes to the data in the window, call <tt/<ref id="em_commit"
1759 name="em_commit">/ first, or the changes are lost.
1760 <item>The function is only available as fastcall function, so it may only be
1761 used in presence of a prototype.
1762 <item>The function produces undefined results if no extended memory driver is
1765 <tag/Availability/cc65
1767 <ref id="em_commit" name="em_commit">,
1768 <ref id="em_copyfrom" name="em_copyfrom">,
1769 <ref id="em_load_driver" name="em_load_driver">
1775 <sect1>em_load_driver<label id="em_load_driver"><p>
1779 <tag/Function/Load and initialize an extended memory driver.
1780 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1781 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
1782 <tag/Description/Load an extended memory driver into memory and initialize
1783 it. The function returns an error code that tells if all this has been
1785 <tag/Limits/<itemize>
1786 <item>Not all drivers are able to detect if the supported hardware is really
1788 <item>The function is only available as fastcall function, so it may only be
1789 used in presence of a prototype.
1790 <item>The driver is loaded by name, so currently you must know the type of
1791 extended memory that should be supported. There is no autodetect capability.
1793 <tag/Availability/cc65
1795 <ref id="em_unload" name="em_unload">
1801 <sect1>em_map<label id="em_map"><p>
1805 <tag/Function/Make a page of extended memory accessible.
1806 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1807 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
1808 <tag/Description/The function maps one page of extended memory into linear
1809 memory and returns a pointer to the page frame. Depending on the hardware
1810 and driver, the data is either mapped into the address space or transfered
1811 into a buffer. If you don't need the actual contents of the page (for example
1812 because you're going to overwrite it completely, it is better to call
1813 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
1814 data if it is possible to avoid that.
1815 <tag/Limits/<itemize>
1816 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
1817 made any changes to the data in the window, call <tt/<ref id="em_commit"
1818 name="em_commit">/ first, or the changes are lost.
1819 <item>The function is only available as fastcall function, so it may only be
1820 used in presence of a prototype.
1821 <item>The function produces undefined results if no extended memory driver is
1824 <tag/Availability/cc65
1826 <ref id="em_commit" name="em_commit">,
1827 <ref id="em_load_driver" name="em_load_driver">,
1828 <ref id="em_use" name="em_use">
1834 <sect1>em_pagecount<label id="em_pagecount"><p>
1838 <tag/Function/Return the number of available extended memory pages.
1839 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1840 <tag/Declaration/<tt/unsigned __fastcall__ em_pagecount (void);/
1841 <tag/Description/The function returns the size of the extended memory supported
1842 by the driver in 256 byte pages.
1843 <tag/Limits/<itemize>
1844 <item>The function returns zero if no extended memory driver is loaded.
1845 <item>The function may return zero if the supported hardware was not detected.
1847 <tag/Availability/cc65
1849 <ref id="em_load_driver" name="em_load_driver">
1855 <sect1>em_unload<label id="em_unload"><p>
1859 <tag/Function/Unload an extended memory driver.
1860 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1861 <tag/Declaration/<tt/void __fastcall__ em_unload (void);/
1862 <tag/Description/The function unloads a loaded extended memory driver and
1863 frees all memory allocated for the driver.
1864 <tag/Limits/<itemize>
1865 <item>The function does nothing if no driver is loaded.
1867 <tag/Availability/cc65
1869 <ref id="em_load_driver" name="em_load_driver">
1875 <sect1>em_use<label id="em_use"><p>
1879 <tag/Function/Prepare an extended memory page for use.
1880 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1881 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
1882 <tag/Description/The function maps one page of extended memory into linear
1883 memory and returns a pointer to the page frame. This function is similar to
1884 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
1885 actual memory window in the assumption that the existing data is wrong or
1886 will get overwritten.
1887 <tag/Limits/<itemize>
1888 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
1889 made any changes to the data in the window, call <tt/<ref id="em_commit"
1890 name="em_commit">/ first, or the changes are lost.
1891 <item>The function is only available as fastcall function, so it may only be
1892 used in presence of a prototype.
1893 <item>The function produces undefined results if no extended memory driver is
1896 <tag/Availability/cc65
1898 <ref id="em_commit" name="em_commit">,
1899 <ref id="em_load_driver" name="em_load_driver">,
1900 <ref id="em_map" name="em_map">
1906 <sect1>exit<label id="exit"><p>
1910 <tag/Function/Terminate the program.
1911 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1912 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
1913 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
1914 return code of the program. Before termination, all files are closed, buffered
1915 output is written and any functions registered with <tt/<ref id="atexit"
1916 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
1917 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
1919 <tag/Limits/<itemize>
1920 <item>The function is only available as fastcall function, so it may only
1921 be used in presence of a prototype.
1922 <item>It depends on the host machine if the program return code can be
1923 evaluated or is ignored.
1925 <tag/Availability/ISO 9899
1927 <ref id="abort" name="abort">,
1928 <ref id="exit" name="exit">
1934 <sect1>fast<label id="fast"><p>
1938 <tag/Function/Switch the C128 into 2MHz mode.
1939 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1940 <tag/Declaration/<tt/void fast (void);/
1941 <tag/Description/The function will switch the clock of the C128 to 2MHz. This
1942 will nearly double the speed compared to slow mode.
1943 <tag/Limits/<itemize>
1944 <item>The function is specific to the C128.
1945 <item>2MHz clock will not work in 40 column mode.
1947 <tag/Availability/C128
1949 <ref id="slow" name="slow">,
1950 <ref id="toggle_videomode" name="toggle_videomode">
1956 <sect1>feof<label id="feof"><p>
1960 <tag/Function/Return the end-of-file indicator of a stream.
1961 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1962 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
1963 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
1964 <tt/f/, and returns a non zero value if it is set.
1965 <tag/Limits/<itemize>
1966 <item>The indicator is set only after a read past the end of a file is
1968 <item>The function is only available as fastcall function, so it may only be
1969 used in presence of a prototype.
1971 <tag/Availability/ISO 9899
1973 <ref id="feof" name="clearerr">,
1974 <ref id="ferror" name="ferror">
1980 <sect1>ferror<label id="ferror"><p>
1984 <tag/Function/Return the error indicator of a stream.
1985 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1986 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
1987 <tag/Description/<tt/ferror/ tests the error indicator of the stream
1988 <tt/f/, and returns a non zero value if it is set.
1989 <tag/Limits/<itemize>
1990 <item>The function is only available as fastcall function, so it may only be
1991 used in presence of a prototype.
1993 <tag/Availability/ISO 9899
1995 <ref id="feof" name="clearerr">,
1996 <ref id="ferror" name="feof">
2002 <sect1>fileno<label id="fileno"><p>
2006 <tag/Function/Return the file handle used by a stream.
2007 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2008 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
2009 <tag/Description/The <tt/fileno/ function returns the file handle used
2010 internally by a C stream. This file handle (an integer) can be used as a
2011 handle for the POSIX input/output functions.
2012 <tag/Limits/<itemize>
2013 <item>The function is only available as fastcall function, so it may only be
2014 used in presence of a prototype.
2015 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
2016 file may have unpredictable results.
2018 <tag/Availability/POSIX 1003.1
2020 <ref id="creat" name="creat">,
2021 <ref id="open" name="open"> <!-- , -->
2022 <!-- <ref id="read" name="read">, -->
2023 <!-- <ref id="write" name="write"> -->
2029 <sect1>free<label id="free"><p>
2033 <tag/Function/Free a block of dynamic memory.
2034 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2035 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
2036 <tag/Description/Free a block of dynamic memory previously allocated with
2037 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
2038 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
2039 pointer is <tt/NULL/, no action is performed.
2042 <item>Passing an already free'd block to <tt/free/ again will cause undefined
2043 behaviour and may crash your program.
2044 <item>The function is only available as fastcall function, so it may only
2045 be used in presence of a prototype.
2047 <tag/Availability/ISO 9899
2049 <ref id="_heapadd" name="_heapadd">,
2050 <ref id="_heapblocksize" name="_heapblocksize">,
2051 <ref id="_heapmaxavail" name="_heapmaxavail">,
2052 <ref id="_heapmemavail" name="_heapmemavail">,
2053 <ref id="calloc" name="calloc">,
2054 <ref id="malloc" name="malloc">,
2055 <ref id="realloc" name="realloc">
2061 <sect1>get_ostype<label id="get_ostype"><p>
2065 <tag/Function/The function returns the operating system, the program runs on.
2066 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
2067 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
2068 <tag/Declaration/<tt/unsigned char get_ostype (void);/
2069 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
2070 all supported targets. If it exists, it returns a number that identifies the
2071 operating system or machine type, the program runs on. The machine dependent
2072 header files define constants that can be used to check the return code.
2073 <tag/Limits/<itemize>
2074 <item>The function does not exist on all platforms.
2075 <item>The return codes are platform dependent.
2077 <tag/Availability/cc65 (not all platforms)
2083 <sect1>getenv<label id="getenv"><p>
2087 <tag/Function/Return a value from the environment.
2088 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2089 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
2090 <tag/Description/The function searches the environment for an entry that
2091 matches <tt/name/ and returns its value. The environment consists of a list
2092 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
2094 <tag/Limits/<itemize>
2095 <item>What exactly is stored in the environment depends on the machine the
2096 program is running on.
2097 <item>The function is only available as fastcall function, so it may only
2098 be used in presence of a prototype.
2100 <tag/Availability/ISO 9899
2106 <sect1>getcpu<label id="getcpu"><p>
2110 <tag/Function/Determine on which CPU the program is running.
2111 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
2112 <tag/Declaration/<tt/unsigned char getcpu (void);/
2113 <tag/Description/The function checks on which CPU the code is running. It
2114 returns one of the constants<itemize>
2116 <item><tt/CPU_65C02/
2117 <item><tt/CPU_65816/
2119 <tag/Limits/<itemize>
2120 <item>Other, more exotic CPU types are not disinguished.
2122 <tag/Availability/cc65
2128 <sect1>gotox<label id="gotox"><p>
2132 <tag/Function/Move the text mode cursor to a new X position.
2133 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2134 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
2135 <tag/Description/The function moves the text mode cursor to the specified X
2136 position while leaving the Y position untouched. The leftmost position on the
2137 screen has the coordinate 0.
2138 <tag/Limits/<itemize>
2139 <item>The function is only available as fastcall function, so it may
2140 only be used in presence of a prototype.
2141 <item>Invalid values for the X position (out of screen coordinates) may
2142 lead to undefined behaviour.
2144 <tag/Availability/cc65
2146 <ref id="gotoy" name="gotoy">,
2147 <ref id="gotoxy" name="gotoxy">,
2148 <ref id="wherex" name="wherex">,
2149 <ref id="wherey" name="wherey">
2155 <sect1>gotoxy<label id="gotoxy"><p>
2159 <tag/Function/Move the text mode cursor to a new position.
2160 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2161 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
2162 <tag/Description/The function moves the text mode cursor to the specified
2163 position. The leftmost position on the screen has the X coordinate 0, the
2164 topmost line has the Y coordinate 0.
2165 <tag/Limits/<itemize>
2166 <item>The function is only available as fastcall function, so it may only be
2167 used in presence of a prototype.
2168 <item>Invalid values for any of both coordinates (out of screen positions) may
2169 lead to undefined behaviour.
2171 <tag/Availability/cc65
2173 <ref id="gotox" name="gotox">,
2174 <ref id="gotoy" name="gotoy">,
2175 <ref id="wherex" name="wherex">,
2176 <ref id="wherey" name="wherey">
2182 <sect1>gotoy<label id="gotoy"><p>
2186 <tag/Function/Move the text mode cursor to a new Y position.
2187 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2188 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
2189 <tag/Description/The function moves the text mode cursor to the specified Y
2190 position while leaving the X position untouched. The uppermost position on the
2191 screen has the coordinate 0.
2192 <tag/Limits/<itemize>
2193 <item>The function is only available as fastcall function, so it may
2194 only be used in presence of a prototype.
2195 <item>Invalid values for the Y position (out of screen coordinates) may lead
2196 to undefined behaviour.
2198 <tag/Availability/cc65
2200 <ref id="gotox" name="gotox">,
2201 <ref id="gotoxy" name="gotoxy">,
2202 <ref id="wherex" name="wherex">,
2203 <ref id="wherey" name="wherey">
2209 <sect1>isalnum<label id="isalnum"><p>
2213 <tag/Function/Check if a given character is a letter or digit.
2214 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2215 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
2216 <tag/Description/The function returns a value of zero if the given argument
2217 is a letter or digit. The return value is non zero if the character
2219 <tag/Limits/<itemize>
2220 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2221 inline sequence generated by the macro will not work correctly for values
2222 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2223 this range. The non inline function may be accessed by <tt/#undef/'ing
2225 <item>When compiling without <tt/-Os/, the function is only available as
2226 fastcall function, so it may only be used in presence of a prototype.
2228 <tag/Availability/ISO 9899
2230 <ref id="isalpha" name="isalpha">,
2231 <ref id="isascii" name="isascii">,
2232 <ref id="isblank" name="isblank">,
2233 <ref id="iscntrl" name="iscntrl">,
2234 <ref id="isdigit" name="isdigit">,
2235 <ref id="isgraph" name="isgraph">,
2236 <ref id="islower" name="islower">,
2237 <ref id="isprint" name="isprint">,
2238 <ref id="ispunct" name="ispunct">,
2239 <ref id="isspace" name="isspace">,
2240 <ref id="isupper" name="isupper">,
2241 <ref id="isxdigit" name="isxdigit">
2247 <sect1>isalpha<label id="isalpha"><p>
2251 <tag/Function/Check if a given character is a letter.
2252 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2253 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
2254 <tag/Description/The function returns a value of zero if the given argument
2255 is a letter. The return value is non zero if the character is anything else.
2256 <tag/Limits/<itemize>
2257 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2258 inline sequence generated by the macro will not work correctly for values
2259 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2260 this range. The non inline function may be accessed by <tt/#undef/'ing the
2262 <item>When compiling without <tt/-Os/, the function is only available as
2263 fastcall function, so it may only be used in presence of a prototype.
2265 <tag/Availability/ISO 9899
2267 <ref id="isalnum" name="isalnum">,
2268 <ref id="isascii" name="isascii">,
2269 <ref id="isblank" name="isblank">,
2270 <ref id="iscntrl" name="iscntrl">,
2271 <ref id="isdigit" name="isdigit">,
2272 <ref id="isgraph" name="isgraph">,
2273 <ref id="islower" name="islower">,
2274 <ref id="isprint" name="isprint">,
2275 <ref id="ispunct" name="ispunct">,
2276 <ref id="isspace" name="isspace">,
2277 <ref id="isupper" name="isupper">,
2278 <ref id="isxdigit" name="isxdigit">
2284 <sect1>isascii<label id="isascii"><p>
2288 <tag/Function/Check if a given character is in the ASCII (0..127) range.
2289 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2290 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
2291 <tag/Description/The function returns a value of zero if the given argument
2292 is in the range 0..127 (the range of valid ASCII characters) and a non zero
2294 <tag/Limits/<itemize>
2295 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2296 inline sequence generated by the macro will not work correctly for values
2297 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2298 this range. The non inline function may be accessed by <tt/#undef/'ing the
2300 <item>When compiling without <tt/-Os/, the function is only available as
2301 fastcall function, so it may only be used in presence of a prototype.
2303 <tag/Availability/ISO 9899
2305 <ref id="isalnum" name="isalnum">,
2306 <ref id="isalpha" name="isalpha">,
2307 <ref id="isblank" name="isblank">,
2308 <ref id="iscntrl" name="iscntrl">,
2309 <ref id="isdigit" name="isdigit">,
2310 <ref id="isgraph" name="isgraph">,
2311 <ref id="islower" name="islower">,
2312 <ref id="isprint" name="isprint">,
2313 <ref id="ispunct" name="ispunct">,
2314 <ref id="isspace" name="isspace">,
2315 <ref id="isupper" name="isupper">,
2316 <ref id="isxdigit" name="isxdigit">
2322 <sect1>isblank<label id="isblank"><p>
2326 <tag/Function/Check if a given character is a space or tab.
2327 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2328 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
2329 <tag/Description/The function returns a value of zero if the given argument
2330 is a space or tab character. The return value is non zero if the character
2332 <tag/Limits/<itemize>
2333 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2334 inline sequence generated by the macro will not work correctly for values
2335 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2336 this range. The non inline function may be accessed by <tt/#undef/'ing the
2338 <item>When compiling without <tt/-Os/, the function is only available as
2339 fastcall function, so it may only be used in presence of a prototype.
2341 <tag/Availability/cc65
2343 <ref id="isalnum" name="isalnum">,
2344 <ref id="isalpha" name="isalpha">,
2345 <ref id="isascii" name="isascii">,
2346 <ref id="iscntrl" name="iscntrl">,
2347 <ref id="isdigit" name="isdigit">,
2348 <ref id="isgraph" name="isgraph">,
2349 <ref id="islower" name="islower">,
2350 <ref id="isprint" name="isprint">,
2351 <ref id="ispunct" name="ispunct">,
2352 <ref id="isspace" name="isspace">,
2353 <ref id="isupper" name="isupper">,
2354 <ref id="isxdigit" name="isxdigit">
2360 <sect1>iscntrl<label id="iscntrl"><p>
2364 <tag/Function/Check if a given character is a control character.
2365 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2366 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
2367 <tag/Description/The function returns a value of zero if the given argument
2368 is a control character. The return value is non zero if the character
2370 <tag/Limits/<itemize>
2371 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2372 inline sequence generated by the macro will not work correctly for values
2373 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2374 this range. The non inline function may be accessed by <tt/#undef/'ing the
2376 <item>When compiling without <tt/-Os/, the function is only available as
2377 fastcall function, so it may only be used in presence of a prototype.
2379 <tag/Availability/ISO 9899
2381 <ref id="isalnum" name="isalnum">,
2382 <ref id="isalpha" name="isalpha">,
2383 <ref id="isascii" name="isascii">,
2384 <ref id="isblank" name="isblank">,
2385 <ref id="isdigit" name="isdigit">,
2386 <ref id="isgraph" name="isgraph">,
2387 <ref id="islower" name="islower">,
2388 <ref id="isprint" name="isprint">,
2389 <ref id="ispunct" name="ispunct">,
2390 <ref id="isspace" name="isspace">,
2391 <ref id="isupper" name="isupper">,
2392 <ref id="isxdigit" name="isxdigit">
2398 <sect1>isdigit<label id="isdigit"><p>
2402 <tag/Function/Check if a given character is a digit.
2403 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2404 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
2405 <tag/Description/The function returns a value of zero if the given argument
2406 is a digit. The return value is non zero if the character is anything else.
2407 <tag/Limits/<itemize>
2408 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2409 inline sequence generated by the macro will not work correctly for values
2410 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2411 this range. The non inline function may be accessed by <tt/#undef/'ing the
2413 <item>When compiling without <tt/-Os/, the function is only available as
2414 fastcall function, so it may only be used in presence of a prototype.
2416 <tag/Availability/ISO 9899
2418 <ref id="isalnum" name="isalnum">,
2419 <ref id="isalpha" name="isalpha">,
2420 <ref id="isascii" name="isascii">,
2421 <ref id="isblank" name="isblank">,
2422 <ref id="iscntrl" name="iscntrl">,
2423 <ref id="isgraph" name="isgraph">,
2424 <ref id="islower" name="islower">,
2425 <ref id="isprint" name="isprint">,
2426 <ref id="ispunct" name="ispunct">,
2427 <ref id="isspace" name="isspace">,
2428 <ref id="isupper" name="isupper">,
2429 <ref id="isxdigit" name="isxdigit">
2435 <sect1>isgraph<label id="isgraph"><p>
2439 <tag/Function/Check if a given character is a printable character (except
2441 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2442 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
2443 <tag/Description/The function returns a value of zero if the given argument
2444 is a printable character with the exception of space. The return value is non
2445 zero if the character is anything else.
2446 <tag/Limits/<itemize>
2447 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2448 inline sequence generated by the macro will not work correctly for values
2449 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2450 this range. The non inline function may be accessed by <tt/#undef/'ing the
2452 <item>When compiling without <tt/-Os/, the function is only available as
2453 fastcall function, so it may only be used in presence of a prototype.
2455 <tag/Availability/ISO 9899
2457 <ref id="isalnum" name="isalnum">,
2458 <ref id="isalpha" name="isalpha">,
2459 <ref id="isascii" name="isascii">,
2460 <ref id="isblank" name="isblank">,
2461 <ref id="iscntrl" name="iscntrl">,
2462 <ref id="isdigit" name="isdigit">,
2463 <ref id="islower" name="islower">,
2464 <ref id="isprint" name="isprint">,
2465 <ref id="ispunct" name="ispunct">,
2466 <ref id="isspace" name="isspace">,
2467 <ref id="isupper" name="isupper">,
2468 <ref id="isxdigit" name="isxdigit">
2474 <sect1>islower<label id="islower"><p>
2478 <tag/Function/Check if a given character is a lower case letter.
2479 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2480 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
2481 <tag/Description/The function returns a value of zero if the given argument
2482 is a lower case letter. The return value is non zero if the character is
2484 <tag/Limits/<itemize>
2485 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2486 inline sequence generated by the macro will not work correctly for values
2487 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2488 this range. The non inline function may be accessed by <tt/#undef/'ing the
2490 <item>When compiling without <tt/-Os/, the function is only available as
2491 fastcall function, so it may only be used in presence of a prototype.
2493 <tag/Availability/ISO 9899
2495 <ref id="isalnum" name="isalnum">,
2496 <ref id="isalpha" name="isalpha">,
2497 <ref id="isascii" name="isascii">,
2498 <ref id="isblank" name="isblank">,
2499 <ref id="iscntrl" name="iscntrl">,
2500 <ref id="isdigit" name="isdigit">,
2501 <ref id="isgraph" name="isgraph">,
2502 <ref id="isprint" name="isprint">,
2503 <ref id="ispunct" name="ispunct">,
2504 <ref id="isspace" name="isspace">,
2505 <ref id="isupper" name="isupper">,
2506 <ref id="isxdigit" name="isxdigit">
2512 <sect1>isprint<label id="isprint"><p>
2516 <tag/Function/Check if a given character is a printable character.
2517 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2518 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
2519 <tag/Description/The function returns a value of zero if the given argument
2520 is a printable character (this includes the space character). The return value
2521 is non zero if the character is anything else.
2522 <tag/Limits/<itemize>
2523 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2524 inline sequence generated by the macro will not work correctly for values
2525 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2526 this range. The non inline function may be accessed by <tt/#undef/'ing the
2528 <item>When compiling without <tt/-Os/, the function is only available as
2529 fastcall function, so it may only be used in presence of a prototype.
2531 <tag/Availability/ISO 9899
2533 <ref id="isalnum" name="isalnum">,
2534 <ref id="isalpha" name="isalpha">,
2535 <ref id="isascii" name="isascii">,
2536 <ref id="isblank" name="isblank">,
2537 <ref id="iscntrl" name="iscntrl">,
2538 <ref id="isdigit" name="isdigit">,
2539 <ref id="isgraph" name="isgraph">,
2540 <ref id="islower" name="islower">,
2541 <ref id="ispunct" name="ispunct">,
2542 <ref id="isspace" name="isspace">,
2543 <ref id="isupper" name="isupper">,
2544 <ref id="isxdigit" name="isxdigit">
2550 <sect1>ispunct<label id="ispunct"><p>
2554 <tag/Function/Check if a given character is a printable character but not a
2555 space or an alphanumeric character.
2556 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2557 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
2558 <tag/Description/The function returns a value of zero if the given argument
2559 is a printable character, but not a space or anything alphanumeric. The return
2560 value is non zero if the character is anything else.
2561 <tag/Limits/<itemize>
2562 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2563 inline sequence generated by the macro will not work correctly for values
2564 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2565 this range. The non inline function may be accessed by <tt/#undef/'ing the
2567 <item>When compiling without <tt/-Os/, the function is only available as
2568 fastcall function, so it may only be used in presence of a prototype.
2570 <tag/Availability/ISO 9899
2572 <ref id="isalnum" name="isalnum">,
2573 <ref id="isalpha" name="isalpha">,
2574 <ref id="isascii" name="isascii">,
2575 <ref id="isblank" name="isblank">,
2576 <ref id="iscntrl" name="iscntrl">,
2577 <ref id="isdigit" name="isdigit">,
2578 <ref id="isgraph" name="isgraph">,
2579 <ref id="islower" name="islower">,
2580 <ref id="isprint" name="isprint">,
2581 <ref id="isspace" name="isspace">,
2582 <ref id="isupper" name="isupper">,
2583 <ref id="isxdigit" name="isxdigit">
2589 <sect1>isspace<label id="isspace"><p>
2593 <tag/Function/Check if a given character is a a white-space character.
2594 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2595 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
2596 <tag/Description/The function returns a value of zero if the given argument
2597 is a white space character. The return value is non zero if the character is
2598 anything else. The standard white space characters are: space, formfeed ('\f'),
2599 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
2601 <tag/Limits/<itemize>
2602 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2603 inline sequence generated by the macro will not work correctly for values
2604 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2605 this range. The non inline function may be accessed by <tt/#undef/'ing the
2607 <item>When compiling without <tt/-Os/, the function is only available as
2608 fastcall function, so it may only be used in presence of a prototype.
2610 <tag/Availability/ISO 9899
2612 <ref id="isalnum" name="isalnum">,
2613 <ref id="isalpha" name="isalpha">,
2614 <ref id="isascii" name="isascii">,
2615 <ref id="isblank" name="isblank">,
2616 <ref id="iscntrl" name="iscntrl">,
2617 <ref id="isdigit" name="isdigit">,
2618 <ref id="isgraph" name="isgraph">,
2619 <ref id="islower" name="islower">,
2620 <ref id="isprint" name="isprint">,
2621 <ref id="ispunct" name="ispunct">,
2622 <ref id="isupper" name="isupper">,
2623 <ref id="isxdigit" name="isxdigit">
2629 <sect1>isupper<label id="isupper"><p>
2633 <tag/Function/Check if a given character is an upper case letter.
2634 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2635 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
2636 <tag/Description/The function returns a value of zero if the given argument
2637 is an upper case letter. The return value is non zero if the character is
2639 <tag/Limits/<itemize>
2640 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2641 inline sequence generated by the macro will not work correctly for values
2642 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2643 this range. The non inline function may be accessed by <tt/#undef/'ing the
2645 <item>When compiling without <tt/-Os/, the function is only available as
2646 fastcall function, so it may only be used in presence of a prototype.
2648 <tag/Availability/ISO 9899
2650 <ref id="isalnum" name="isalnum">,
2651 <ref id="isalpha" name="isalpha">,
2652 <ref id="isascii" name="isascii">,
2653 <ref id="isblank" name="isblank">,
2654 <ref id="iscntrl" name="iscntrl">,
2655 <ref id="isdigit" name="isdigit">,
2656 <ref id="isgraph" name="isgraph">,
2657 <ref id="islower" name="islower">,
2658 <ref id="isprint" name="isprint">,
2659 <ref id="ispunct" name="ispunct">,
2660 <ref id="isspace" name="isspace">,
2661 <ref id="isxdigit" name="isxdigit">
2667 <sect1>isxdigit<label id="isxdigit"><p>
2671 <tag/Function/Check if a given character is a hexadecimal digit.
2672 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2673 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
2674 <tag/Description/The function returns a value of zero if the given argument
2675 is a hexadecimal digit (0..9, a..f and A..F). The return value is non zero
2676 if the character is anything else.
2677 <tag/Limits/<itemize>
2678 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2679 inline sequence generated by the macro will not work correctly for values
2680 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2681 this range. The non inline function may be accessed by <tt/#undef/'ing the
2683 <item>When compiling without <tt/-Os/, the function is only available as
2684 fastcall function, so it may only be used in presence of a prototype.
2686 <tag/Availability/ISO 9899
2688 <ref id="isalnum" name="isalnum">,
2689 <ref id="isalpha" name="isalpha">,
2690 <ref id="isascii" name="isascii">,
2691 <ref id="isblank" name="isblank">,
2692 <ref id="iscntrl" name="iscntrl">,
2693 <ref id="isdigit" name="isdigit">,
2694 <ref id="isgraph" name="isgraph">,
2695 <ref id="islower" name="islower">,
2696 <ref id="isprint" name="isprint">,
2697 <ref id="ispunct" name="ispunct">,
2698 <ref id="isspace" name="isspace">,
2699 <ref id="isupper" name="isupper">
2705 <sect1>itoa<label id="itoa"><p>
2709 <tag/Function/Convert an integer into a string.
2710 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2711 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
2712 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
2713 <tt/radix/ as the base.
2714 <tag/Limits/<itemize>
2715 <item>There are no provisions to prevent a buffer overflow.
2716 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
2717 <item>The function is non standard, so it is not available in strict ANSI mode.
2718 You should probably use <tt/sprintf/ instead.
2719 <item>The function is only available as fastcall function, so it may only be
2720 used in presence of a prototype.
2722 <tag/Availability/cc65
2724 <ref id="atoi" name="atoi">,
2725 <ref id="atol" name="atol">,
2726 <ref id="ltoa" name="ltoa">,
2727 <ref id="ultoa" name="ultoa">,
2728 <ref id="utoa" name="utoa">
2734 <sect1>joy_count<label id="joy_count"><p>
2738 <tag/Function/Return the number of joysticks supported by the current driver.
2739 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2740 <tag/Declaration/<tt/unsigned char __fastcall__ joy_count (void);/
2741 <tag/Description/The function returns a the number of joysticks supported
2742 by the current joystick driver.
2743 <tag/Limits/<itemize>
2744 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
2745 name="joy_load_driver"> before calling this function.
2746 <item>The function returns the number of joysticks supported by the driver.
2747 There's no way to check for the number of actually connected joysticks.
2748 <item>The function is only available as fastcall function, so it may only be
2749 used in presence of a prototype.
2751 <tag/Availability/cc65
2753 <ref id="joy_load_driver" name="joy_load_driver">,
2754 <ref id="joy_read" name="joy_read">
2760 <sect1>joy_install<label id="joy_install"><p>
2764 <tag/Function/Install an already loaded driver and return an error code.
2765 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2766 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
2767 <tag/Description/The function installs a driver that was already loaded into
2768 memory (or linked statically to the program). It returns an error code
2769 (<tt/JOY_ERR_OK/ in case of success).
2770 <tag/Limits/<itemize>
2771 <item>The function is only available as fastcall function, so it may only be
2772 used in presence of a prototype.
2774 <tag/Availability/cc65
2776 <ref id="joy_load_driver" name="joy_load_driver">,
2777 <ref id="joy_uninstall" name="joy_uninstall">,
2778 <ref id="joy_unload" name="joy_unload">
2784 <sect1>joy_load_driver<label id="joy_load_driver"><p>
2788 <tag/Function/Load a driver from disk and install it.
2789 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2790 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
2791 <tag/Description/The function loads a driver with the given name from disk
2792 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
2793 driver was successfully loaded and installed.
2794 <tag/Limits/<itemize>
2795 <item>The function is only available as fastcall function, so it may only be
2796 used in presence of a prototype.
2798 <tag/Availability/cc65
2800 <ref id="joy_install" name="joy_install">,
2801 <ref id="joy_uninstall" name="joy_uninstall">,
2802 <ref id="joy_unload" name="joy_unload">
2808 <sect1>joy_read<label id="joy_read"><p>
2812 <tag/Function/Read the status of a joystick.
2813 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2814 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
2815 <tag/Description/The function reads the status bits for a joystick. The number
2816 of the joystick is passed as parameter. The result may be examined by using one
2817 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
2818 <tag/Limits/<itemize>
2819 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
2820 name="joy_load_driver"> before calling this function.
2821 <item>The function is only available as fastcall function, so it may only be
2822 used in presence of a prototype.
2824 <tag/Availability/cc65
2826 <ref id="joy_count" name="joy_count">,
2827 <ref id="joy_load_driver" name="joy_load_driver">,
2828 <ref id="joy_unload" name="joy_unload">
2834 <sect1>joy_uninstall<label id="joy_uninstall"><p>
2838 <tag/Function/Uninstall the current joystick driver.
2839 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2840 <tag/Declaration/<tt/unsigned char __fastcall__ joy_uninstall (void);/
2841 <tag/Description/The function uninstalls the currently installed joystick
2842 driver. It does not remove the driver from memory. The function returns an
2843 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
2844 <tag/Limits/<itemize>
2845 <item>A joystick driver must be installed using <ref id="joy_install"
2846 name="joy_install"> before calling this function.
2847 <item>The function is only available as fastcall function, so it may only be
2848 used in presence of a prototype.
2850 <tag/Availability/cc65
2852 <ref id="joy_install" name="joy_install">,
2853 <ref id="joy_load_driver" name="joy_load_driver">,
2854 <ref id="joy_unload" name="joy_unload">
2860 <sect1>joy_unload<label id="joy_unload"><p>
2864 <tag/Function/Uninstall, then unload the current joystick driver.
2865 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2866 <tag/Declaration/<tt/unsigned char __fastcall__ joy_unload (void);/
2867 <tag/Description/The function uninstalls the currently installed joystick
2868 driver and removes it from memory. An error code is returned, which is
2869 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
2870 <tag/Limits/<itemize>
2871 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
2872 name="joy_load_driver"> before calling this function.
2873 <item>The function is only available as fastcall function, so it may only be
2874 used in presence of a prototype.
2876 <tag/Availability/cc65
2878 <ref id="joy_load_driver" name="joy_load_driver">
2884 <sect1>kbhit<label id="kbhit"><p>
2888 <tag/Function/Check if there's a key waiting in the keyboard buffer.
2889 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2890 <tag/Declaration/<tt/unsigned char kbhit (void);/
2891 <tag/Description/The function returns a value of zero if there is no character
2892 waiting to be read from the keyboard. It returns non zero otherwise.
2893 <tag/Limits/<itemize>
2894 <item>If the system does not support a keyboard buffer (most systems
2895 do), the function is rather useless.
2897 <tag/Availability/cc65
2899 <ref id="cgetc" name="cgetc">,
2900 <ref id="cursor" name="cursor">
2906 <sect1>labs<label id="labs"><p>
2910 <tag/Function/Returns the absolute value of a long integer.
2911 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2912 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
2913 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
2915 <tag/Limits/<itemize>
2916 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
2917 <item>The function is only available as fastcall function, so it may only be
2918 used in presence of a prototype.
2920 <tag/Availability/ISO 9899
2922 <ref id="abs" name="abs">
2928 <sect1>ltoa<label id="ltoa"><p>
2932 <tag/Function/Convert a long integer into a string.
2933 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2934 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
2935 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
2936 using <tt/radix/ as the base.
2937 <tag/Limits/<itemize>
2938 <item>There are no provisions to prevent a buffer overflow.
2939 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
2940 <item>The function is non standard, so it is not available in strict ANSI mode.
2941 You should probably use <tt/sprintf/ instead.
2942 <item>The function is only available as fastcall function, so it may only be
2943 used in presence of a prototype.
2945 <tag/Availability/cc65
2947 <ref id="atoi" name="atoi">,
2948 <ref id="atol" name="atol">,
2949 <ref id="itoa" name="itoa">,
2950 <ref id="ultoa" name="ultoa">,
2951 <ref id="utoa" name="utoa">
2957 <sect1>localeconv<label id="localeconv"><p>
2961 <tag/Function/Returns a pointer to the current locale structure.
2962 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
2963 <tag/Declaration/<tt/struct lconv* localeconv (void);/
2964 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
2966 <tag/Limits/<itemize>
2967 <item>cc65 supports only the "C" locale, so even after setting a new locale
2968 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
2971 <tag/Availability/ISO 9899
2973 <ref id="setlocale" name="setlocale">
2979 <sect1>longjmp<label id="longjmp"><p>
2983 <tag/Function/Non local goto.
2984 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
2985 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
2986 <tag/Description/The <tt/longjmp/ function restores a program context from the
2987 data in <tt/buf/, which must have been set by a preceeding call to
2988 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
2989 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
2993 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
2994 was called with a value of one.
2995 <item>The function is only available as fastcall function, so it may only
2996 be used in presence of a prototype.
2998 <tag/Availability/ISO 9899
3000 <ref id="setjmp" name="setjmp">
3006 <sect1>malloc<label id="malloc"><p>
3010 <tag/Function/Allocate dynamic memory.
3011 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3012 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
3013 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
3014 pointer to the allocated memory block. On error (not enough memory available),
3015 <tt/malloc/ returns <tt/NULL/.
3018 <item>The function is only available as fastcall function, so it may only
3019 be used in presence of a prototype.
3021 <tag/Availability/ISO 9899
3023 <ref id="_heapadd" name="_heapadd">,
3024 <ref id="_heapblocksize" name="_heapblocksize">,
3025 <ref id="_heapmaxavail" name="_heapmaxavail">,
3026 <ref id="_heapmemavail" name="_heapmemavail">,
3027 <ref id="calloc" name="calloc">,
3028 <ref id="free" name="free">,
3029 <ref id="realloc" name="realloc">,
3030 <ref id="strdup" name="strdup">
3036 <sect1>memchr<label id="memchr"><p>
3040 <tag/Function/Search for a character in a block of raw memory.
3041 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3042 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
3043 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
3044 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
3045 that is of size <tt/count/. Upon completion, the function returns a pointer to
3046 the character found, or a null pointer if the character was not found.
3047 <tag/Limits/<itemize>
3048 <item>The function is only available as fastcall function, so it may only
3049 be used in presence of a prototype.
3051 <tag/Availability/ISO 9899
3053 <ref id="strchr" name="strchr">
3059 <sect1>memcpy<label id="memcpy"><p>
3063 <tag/Function/Copy a memory area.
3064 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3065 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
3066 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
3067 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
3071 <item>The result is undefined if the memory areas do overlap. Use
3072 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
3073 <item>The function is only available as fastcall function, so it may only
3074 be used in presence of a prototype.
3076 <tag/Availability/ISO 9899
3078 <ref id="_swap" name="_swap">,
3079 <ref id="memmove" name="memmove">,
3080 <ref id="memset" name="memset">
3086 <sect1>memmove<label id="memmove"><p>
3090 <tag/Function/Copy a memory area.
3091 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3092 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
3093 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
3094 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
3098 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
3099 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
3100 <item>The function is only available as fastcall function, so it may only
3101 be used in presence of a prototype.
3103 <tag/Availability/ISO 9899
3105 <ref id="_swap" name="_swap">,
3106 <ref id="memcpy" name="memcpy">,
3107 <ref id="memset" name="memset">
3113 <sect1>memset<label id="memset"><p>
3117 <tag/Function/Fill a memory area.
3118 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3119 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
3120 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
3121 the value <tt/val/. The function returns <tt/p/.
3124 <item>The function is only available as fastcall function, so it may only
3125 be used in presence of a prototype.
3127 <tag/Availability/ISO 9899
3129 <ref id="_swap" name="_swap">,
3130 <ref id="bzero" name="bzero">,
3131 <ref id="memcpy" name="memcpy">,
3132 <ref id="memmove" name="memmove">
3138 <sect1>mod_free<label id="mod_free"><p>
3142 <tag/Function/Free a relocatable module.
3143 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
3144 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
3145 <tag/Description/The function will free a module loaded into memory by use of
3146 the <tt/<ref id="mod_load" name="mod_load">/ function.
3147 <tag/Limits/<itemize>
3148 <item>The pointer passed as parameter is the pointer to the module memory,
3149 not the pointer to the control structure.
3151 <tag/Availability/cc65
3153 <ref id="mod_load" name="mod_load">
3159 <sect1>mod_load<label id="mod_load"><p>
3163 <tag/Function/Load a relocatable module.
3164 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
3165 <tag/Declaration/<tt/unsigned char mod_load (struct mod_ctrl* ctrl);/
3166 <tag/Description/The function will load a code module into memory and relocate
3167 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
3168 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
3169 the module just loaded. Possible error codes are:
3171 <item><tt/MLOAD_OK/ - Module load successful
3172 <item><tt/MLOAD_ERR_READ/ - Read error
3173 <item><tt/MLOAD_ERR_HDR/ - Header error
3174 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
3175 <item><tt/MLOAD_ERR_FMT/ - Data format error
3176 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
3178 <tag/Limits/<itemize>
3179 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
3180 relocatable o65 modules for use with this function.
3182 <tag/Availability/cc65
3184 <ref id="mod_free" name="mod_free">
3190 <sect1>offsetof<label id="offsetof"><p>
3194 <tag/Function/Calculate the offset of a struct or union member.
3195 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
3196 <tag/Declaration/<tt/size_t offsetof (type, member);/
3197 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
3198 or <tt/union/ member.
3199 <tag/Limits/<itemize>
3200 <item>The function is actually a macro.
3202 <tag/Availability/ISO 9899
3208 <sect1>open<label id="open"><p>
3212 <tag/Function/Open and possibly create a file.
3213 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
3214 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
3215 <tag/Description/<tt/open/ opens a file and returns the file descriptor
3216 associated with it. On error, -1 is returned and an error code is stored in
3217 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
3218 <tag/Limits/<itemize>
3219 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
3220 open, which is used as the permission mask when a new file is created. While
3221 cc65 allows to pass this argument, it is ignored.
3223 <tag/Availability/POSIX 1003.1
3225 <ref id="close" name="close">,
3226 <ref id="creat" name="creat">
3232 <sect1>peekbsys<label id="peekbsys"><p>
3236 <tag/Function/Read one byte from a location in the system bank.
3237 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3238 <tt/<ref id="cbm510.h" name="cbm510.h">/
3239 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
3240 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
3241 system bank (bank 15) of the CBM PET-II machines and returns it.
3244 <item>The function is only available as fastcall function, so it may only
3245 be used in presence of a prototype.
3246 <item>This function may be a macro depending on the compiler options. The
3247 actual function is accessible by #undef'ing the macro.
3249 <tag/Availability/cc65
3251 <ref id="PEEK" name="PEEK">,
3252 <ref id="PEEKW" name="PEEKW">,
3253 <ref id="peekwsys" name="peekwsys">,
3254 <ref id="pokebsys" name="pokebsys">,
3255 <ref id="pokewsys" name="pokewsys">
3261 <sect1>peekwsys<label id="peekwsys"><p>
3265 <tag/Function/Read one word from a location in the system bank.
3266 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3267 <tt/<ref id="cbm510.h" name="cbm510.h">/
3268 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
3269 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
3270 system bank (bank 15) of the CBM PET-II machines and returns it. Following
3271 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
3272 high byte is read from <tt/addr+1/.
3275 <item>The function is only available as fastcall function, so it may only
3276 be used in presence of a prototype.
3277 <item>The order in which the two bytes are read is undefined.
3279 <tag/Availability/cc65
3281 <ref id="PEEK" name="PEEK">,
3282 <ref id="PEEKW" name="PEEKW">,
3283 <ref id="peekbsys" name="peekbsys">,
3284 <ref id="pokebsys" name="pokebsys">,
3285 <ref id="pokewsys" name="pokewsys">
3291 <sect1>perror<label id="perror"><p>
3295 <tag/Function/Print an error message for the error in <tt/errno/.
3296 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3297 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
3298 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
3299 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
3300 a blank. Then the error message for the current contents of <tt/errno/ is
3301 printed followed by a newline. The message output is the same as returned by
3302 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
3305 <item>The function is only available as fastcall function, so it may only
3306 be used in presence of a prototype.
3308 <tag/Availability/ISO 9899
3310 <ref id="_poserror" name="_poserror">,
3311 <ref id="strerror" name="strerror">
3317 <sect1>pokebsys<label id="pokebsys"><p>
3321 <tag/Function/Write one byte to a location in the system bank.
3322 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3323 <tt/<ref id="cbm510.h" name="cbm510.h">/
3324 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
3325 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
3326 system bank (bank 15) of the CBM PET-II machines.
3329 <item>The function is only available as fastcall function, so it may only
3330 be used in presence of a prototype.
3332 <tag/Availability/cc65
3334 <ref id="POKE" name="POKE">,
3335 <ref id="POKEW" name="POKEW">,
3336 <ref id="peekbsys" name="peekbsys">,
3337 <ref id="peekwsys" name="peekwsys">,
3338 <ref id="pokewsys" name="pokewsys">
3344 <sect1>pokewsys<label id="pokewsys"><p>
3348 <tag/Function/Write one word to a location in the system bank.
3349 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3350 <tt/<ref id="cbm510.h" name="cbm510.h">/
3351 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
3352 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
3353 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
3354 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
3355 high byte is written to <tt/addr+1/.
3358 <item>The function is only available as fastcall function, so it may only
3359 be used in presence of a prototype.
3360 <item>The order in which the two bytes are written is undefined.
3362 <tag/Availability/cc65
3364 <ref id="POKE" name="POKE">,
3365 <ref id="POKEW" name="POKEW">,
3366 <ref id="peekbsys" name="peekbsys">,
3367 <ref id="peekwsys" name="peekwsys">,
3368 <ref id="pokebsys" name="pokebsys">
3374 <sect1>qsort<label id="qsort"><p>
3378 <tag/Function/Sort an array.
3379 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3380 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
3381 size_t size, int (*compare) (const void*, const void*));/
3382 <tag/Description/<tt/qsort/ sorts an array according to a given compare
3383 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
3384 is the number of elements, <tt/size/ the size of an element and <tt/compare/
3385 the function used to compare the members.
3388 <item>If there are multiple members with the same key, the order after calling
3389 the function is undefined.
3390 <item>The function is only available as fastcall function, so it may only
3391 be used in presence of a prototype.
3393 <tag/Availability/ISO 9899
3395 <ref id="bsearch" name="bsearch">
3401 <sect1>raise<label id="raise"><p>
3405 <tag/Function/Send a signal to the executing program.
3406 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
3407 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
3408 <tag/Description/<tt/raise/ sends the given signal to the program. If the
3409 program has installed a signal handler for the signal, this signal handler
3410 will be executed. If no handler has been installed, the default action for
3411 the raised signal will be taken. The function returns zero on success,
3413 <tag/Limits/<itemize>
3414 <item>The function is only available as fastcall function, so it may only
3415 be used in presence of a prototype.
3417 <tag/Availability/ISO 9899
3419 <ref id="abort" name="abort">,
3420 <ref id="signal" name="signal">
3426 <sect1>rand<label id="rand"><p>
3430 <tag/Function/Return a pseudo random number.
3431 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3432 <tag/Declaration/<tt/int rand (void);/
3433 <tag/Description/The function returns a pseudo random number
3434 between 0 and <tt/RAND_MAX/ (exclusive).
3435 <tag/Limits/<itemize>
3436 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
3437 flow of numbers is generated.
3438 <item>On startup, the function behaves as if <ref id="srand" name="srand">
3439 had been used with an argument of 1.
3441 <tag/Availability/ISO 9899
3443 <ref id="_randomize" name="_randomize">,
3444 <ref id="srand" name="srand">
3450 <sect1>realloc<label id="realloc"><p>
3454 <tag/Function/Change the size of an allocated memory block.
3455 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3456 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
3457 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
3458 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
3459 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
3460 behaves as if <tt/free/ had been called. On error (not enough memory
3461 available), <tt/realloc/ returns <tt/NULL/.
3464 <item>The part of the memory block that is returned will have its contents
3466 <item>This function is somewhat dangerous to use. Be careful to save the
3467 pointer you're passing somewhere else, otherwise
3469 ptr = realloc (ptr, size);
3471 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
3472 <item>The function is only available as fastcall function, so it may only
3473 be used in presence of a prototype.
3475 <tag/Availability/ISO 9899
3477 <ref id="_heapadd" name="_heapadd">,
3478 <ref id="_heapblocksize" name="_heapblocksize">,
3479 <ref id="_heapmaxavail" name="_heapmaxavail">,
3480 <ref id="_heapmemavail" name="_heapmemavail">,
3481 <ref id="calloc" name="calloc">,
3482 <ref id="free" name="free">,
3483 <ref id="realloc" name="realloc">
3489 <sect1>remove<label id="remove"><p>
3493 <tag/Function/Delete a file.
3494 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3495 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
3496 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
3497 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
3498 code describing the reason for the failure.
3501 <item>This function is not available on all cc65 targets (depends on the
3502 availability of file I/O).
3503 <item>The function is only available as fastcall function, so it may only
3504 be used in presence of a prototype.
3506 <tag/Availability/ISO 9899
3508 <ref id="unlink" name="unlink">
3510 #include <stdio.h>
3512 #define FILENAME "helloworld"
3514 if (remove (FILENAME) == 0) {
3515 printf ("We deleted %s successfully\n", FILENAME);
3517 printf ("There was a problem deleting %s\n", FILENAME);
3523 <sect1>reset_brk<label id="reset_brk"><p>
3527 <tag/Function/Resets the break vector to its original value.
3528 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3529 <tag/Declaration/<tt/void __fastcall__ reset_brk (void);/
3530 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
3531 before a call to <tt/set_brk/.
3534 <item>Since <tt/<ref id="set_brk" name="set_brk">/ installs an exit handler,
3535 it is not strictly necessary to call this function as part of the cleanup when
3538 <tag/Availability/cc65
3540 <ref id="set_brk" name="set_brk">
3546 <sect1>revers<label id="revers"><p>
3550 <tag/Function/Control revers character display.
3551 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3552 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
3553 <tag/Description/If the argument is non zero, the function enables reverse
3554 character display. If the argument is zero, reverse character display is
3555 switched off. The old value of the setting is returned.
3556 <tag/Limits/<itemize>
3557 <item>The function may not be supported by the hardware, in which case
3558 the call is ignored.
3559 <item>The function is only available as fastcall function, so it may only
3560 be used in presence of a prototype.
3562 <tag/Availability/cc65
3564 <ref id="textcolor" name="textcolor">
3570 <sect1>screensize<label id="screensize"><p>
3574 <tag/Function/Return the dimensions of the text mode screen.
3575 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3576 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
3577 <tag/Description/The function returns the dimensions of the text mode screen.
3578 <tag/Limits/<itemize>
3579 <item>The function is only available as fastcall function, so it may only
3580 be used in presence of a prototype.
3582 <tag/Availability/cc65
3584 <ref id="gotox" name="gotox">,
3585 <ref id="gotoxy" name="gotoxy">,
3586 <ref id="gotoy" name="gotoy">,
3587 <ref id="wherex" name="wherex">,
3588 <ref id="wherey" name="wherey">
3594 <sect1>set_brk<label id="set_brk"><p>
3598 <tag/Function/Set the break vector to a user function.
3599 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3600 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
3601 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
3602 program code by letting the vector point to a user written C function. The
3603 runtime library installs a small stub that saves the registers into global
3604 variables that may be accessed (and changed) by the break handler.
3607 <item>The function is only available as fastcall function, so it may only
3608 be used in presence of a prototype.
3609 <item>The stub saves the zero page registers used by the C runtime and switches
3610 to a small break handler stack. This means that it is safe to execute C code,
3611 even if C code was interrupted. Be careful however not to use too many local
3612 variables, and do not enable stack checks for the handler function or any other
3613 function called from it.
3614 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
3615 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
3616 otherwise the <tt/BRK/ instruction will get executed over and over again.
3617 <item>Since <tt/set_brk/ installs an exit handler, it is not strictly necessary
3618 to call <tt/<ref id="reset_brk" name="reset_brk">/ as part of the cleanup when
3619 the program terminates.
3621 <tag/Availability/cc65
3623 <ref id="reset_brk" name="reset_brk">
3629 <sect1>setjmp<label id="setjmp"><p>
3633 <tag/Function/Save the context for use with <tt/longjmp/.
3634 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
3635 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
3636 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
3637 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
3641 <item>The function is only available as fastcall function, so it may only
3642 be used in presence of a prototype.
3643 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
3644 <item><tt/setjmp/ will not save the signal context.
3646 <tag/Availability/ISO 9899
3648 <ref id="longjmp" name="longjmp">
3654 <sect1>setlocale<label id="setlocale"><p>
3658 <tag/Function/Selects a locale.
3659 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
3660 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
3661 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
3664 <item>The function is only available as fastcall function, so it may only
3665 be used in presence of a prototype.
3666 <item>cc65 supports only the "C" locale, so calling this function to set a
3667 different locale has no effect.
3669 <tag/Availability/ISO 9899
3671 <ref id="localeconv" name="localeconv">,
3672 <ref id="strcoll" name="strcoll">
3678 <sect1>signal<label id="signal"><p>
3682 <tag/Function/Install a signal handler.
3683 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
3684 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
3685 <tag/Description/<tt/signal/ installs a handler for the given signal. The
3686 handler may either be a user supplied function, or one of the predefined
3687 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
3688 previous value if the signal , or the special function vector SIG_ERR in
3690 <tag/Limits/<itemize>
3691 <item>The function is only available as fastcall function, so it may only
3692 be used in presence of a prototype.
3694 <tag/Availability/ISO 9899
3696 <ref id="abort" name="abort">,
3697 <ref id="raise" name="raise">
3703 <sect1>sleep<label id="sleep"><p>
3707 <tag/Function/Sleep for a specified amount of time.
3708 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3709 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
3710 <tag/Description/The function will return after the specified number of
3711 seconds have elapsed.
3712 <tag/Limits/<itemize>
3713 <item>The function is only available as fastcall function, so it may only
3714 be used in presence of a prototype.
3716 <tag/Availability/POSIX 1003.1
3722 <sect1>slow<label id="slow"><p>
3726 <tag/Function/Switch the C128 into 1MHz mode.
3727 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
3728 <tag/Declaration/<tt/void slow (void);/
3729 <tag/Description/The function will switch the clock of the C128 to 1MHz. This
3730 will halve the speed compared to fast mode.
3731 <tag/Limits/<itemize>
3732 <item>The function is specific to the C128.
3734 <tag/Availability/C128
3736 <ref id="fast" name="fast">,
3737 <ref id="toggle_videomode" name="toggle_videomode">
3743 <sect1>srand<label id="srand"><p>
3747 <tag/Function/Initialize the pseudo random number generator.
3748 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3749 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
3750 <tag/Description/The function initializes the random number generator using
3751 the given seed. On program startup, the generator behaves as if <tt/srand/ has
3752 been called with an argument of 1.
3753 <tag/Limits/<itemize>
3754 <item>The function is only available as fastcall function, so it may only
3755 be used in presence of a prototype.
3757 <tag/Availability/ISO 9899
3759 <ref id="_randomize" name="_randomize">,
3760 <ref id="rand" name="rand">
3766 <sect1>strcasecmp<label id="strcasecmp"><p>
3770 <tag/Function/Compare two strings case insensitive.
3771 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3772 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
3773 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
3774 as parameters without case sensitivity. It returns a value that is less than
3775 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
3776 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
3777 <tag/Limits/<itemize>
3778 <item>The function is only available as fastcall function, so it may only
3779 be used in presence of a prototype.
3780 <item>The function is not available in strict ANSI mode.
3782 <tag/Availability/cc65
3784 <ref id="strcmp" name="strcmp">,
3785 <ref id="strcoll" name="strcoll">,
3786 <ref id="stricmp" name="stricmp">,
3787 <ref id="strncmp" name="strncmp">
3793 <sect1>strcat<label id="strcat"><p>
3797 <tag/Function/Concatentate two strings.
3798 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3799 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
3800 <tag/Description/The <tt/strcat/ function appends a copy of the string
3801 pointed to by s2 (including the terminating null byte) to the end of the
3802 string pointed to by s1. The initial byte of s2 overwrites the null byte at
3804 <tag/Limits/<itemize>
3805 <item>The function is only available as fastcall function, so it may only
3806 be used in presence of a prototype.
3807 <item>If copying takes place between objects that overlap, the behaviour
3810 <tag/Availability/ISO 9899
3812 <ref id="strcpy" name="strcpy">,
3813 <ref id="strncat" name="strncat">,
3814 <ref id="strncpy" name="strncpy">
3820 <sect1>strchr<label id="strchr"><p>
3824 <tag/Function/Search for a character in a string.
3825 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3826 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
3827 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
3828 (converted to a char) in the string pointed to by <tt/s/. The terminating null
3829 byte is considered to be part of the string. Upon completion, the function
3830 returns a pointer to the byte, or a null pointer if the byte was not found.
3831 <tag/Limits/<itemize>
3832 <item>The function is only available as fastcall function, so it may only
3833 be used in presence of a prototype.
3835 <tag/Availability/ISO 9899
3837 <ref id="memchr" name="memchr">,
3838 <ref id="strrchr" name="strrchr">
3844 <sect1>strcmp<label id="strcmp"><p>
3848 <tag/Function/Compare two strings.
3849 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3850 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
3851 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
3852 parameters. It returns a value that is less than zero if <tt/s1/ is less than
3853 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
3854 if <tt/s1/ is greater than <tt/s2/.
3855 <tag/Limits/<itemize>
3856 <item>The function is only available as fastcall function, so it may only
3857 be used in presence of a prototype.
3859 <tag/Availability/ISO 9899
3861 <ref id="strcasecmp" name="strcasecmp">,
3862 <ref id="strcoll" name="strcoll">,
3863 <ref id="stricmp" name="stricmp">,
3864 <ref id="strncmp" name="strncmp">
3870 <sect1>strcoll<label id="strcoll"><p>
3874 <tag/Function/Compare two strings.
3875 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3876 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
3877 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
3878 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
3879 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
3880 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
3881 than zero if <tt/s1/ is greater than <tt/s2/.
3882 <tag/Limits/<itemize>
3883 <item>The function is only available as fastcall function, so it may only
3884 be used in presence of a prototype.
3886 <tag/Availability/ISO 9899
3888 <ref id="setlocale" name="setlocale">,
3889 <ref id="strcasecmp" name="strcasecmp">,
3890 <ref id="strcmp" name="strcmp">,
3891 <ref id="stricmp" name="stricmp">,
3892 <ref id="strncmp" name="strncmp">
3898 <sect1>strcpy<label id="strcpy"><p>
3902 <tag/Function/Copy a string.
3903 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3904 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
3905 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
3906 <tt/s2/ (including the terminating null byte) into the array pointed to by
3907 <tt/s1/. The function will always return <tt/s1/.
3908 <tag/Limits/<itemize>
3909 <item>The function is only available as fastcall function, so it may only
3910 be used in presence of a prototype.
3911 <item>If copying takes place between objects that overlap, the behaviour
3914 <tag/Availability/ISO 9899
3916 <ref id="strcat" name="strcat">,
3917 <ref id="strncat" name="strncat">,
3918 <ref id="strncpy" name="strncpy">
3921 #include <string.h>
3923 static char hello[14];
3925 strcpy (hello, "Hello world!\n");
3931 <sect1>strcspn<label id="strcspn"><p>
3935 <tag/Function/Compute the length of a substring.
3936 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3937 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
3938 <tag/Description/The <tt/strcspn/ function computes and returns the length of
3939 the substring pointed to by <tt/s/ which does <em>not</em> consist of
3940 characters contained in the string <tt/set/.
3941 <tag/Limits/<itemize>
3942 <item>The function is only available as fastcall function, so it may only
3943 be used in presence of a prototype.
3945 <tag/Availability/ISO 9899
3947 <ref id="strspn" name="strspn">,
3948 <ref id="strstr" name="strstr">,
3949 <ref id="strtok" name="strtok">
3955 <sect1>strdup<label id="strdup"><p>
3959 <tag/Function/Allocate a copy of a string on the heap.
3960 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3961 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
3962 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
3963 to hold a copy of <tt/s/ including the terminating zero. If the allocation
3964 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
3965 memory block, and a pointer to the block is returned.
3966 <tag/Limits/<itemize>
3967 <item>The function is only available as fastcall function, so it may only
3968 be used in presence of a prototype.
3969 <item>It is up to the caller to free the allocated memory block.
3971 <tag/Availability/ISO 9899
3973 <ref id="free" name="free">,
3974 <ref id="malloc" name="malloc">
3980 <sect1>strerror<label id="strerror"><p>
3984 <tag/Function/Return a string describing an error code.
3985 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3986 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
3987 <tag/Description/The <tt/strerror/ function returns a string describing the
3988 given error code. If an invalid error code is passed, the string "Unknown
3989 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
3990 <tt/errno/ is left untouched.
3991 <tag/Limits/<itemize>
3992 <item>The function is only available as fastcall function, so it may only
3993 be used in presence of a prototype.
3994 <item>While the return type of the function is a <tt/char*/, the returned
3995 string must not be modified by the caller!
3997 <tag/Availability/ISO 9899
3999 <ref id="_stroserror" name="_stroserror">
4005 <sect1>stricmp<label id="stricmp"><p>
4009 <tag/Function/Compare two strings case insensitive.
4010 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4011 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
4012 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
4013 parameters without case sensitivity. It returns a value that is less than zero
4014 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
4015 value greater than zero if <tt/s1/ is greater than <tt/s2/.
4016 <tag/Limits/<itemize>
4017 <item>The function is only available as fastcall function, so it may only
4018 be used in presence of a prototype.
4019 <item>The function is not available in strict ANSI mode.
4021 <tag/Availability/cc65
4023 <ref id="strcasecmp" name="strcasecmp">,
4024 <ref id="strcmp" name="strcmp">,
4025 <ref id="strcoll" name="strcoll">,
4026 <ref id="strncmp" name="strncmp">
4032 <sect1>strlen<label id="strlen"><p>
4036 <tag/Function/Return the length of a string.
4037 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4038 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
4039 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
4040 string to which s points, not including the terminating null byte.
4041 <tag/Limits/<itemize>
4042 <item>The function is only available as fastcall function, so it may only
4043 be used in presence of a prototype.
4044 <item>When compiling with <tt/-Os/ (inline known standard functions), the
4045 function does not work correctly for strings with more than 255 characters.
4047 <tag/Availability/ISO 9899
4049 <ref id="strcpy" name="strcpy">
4055 <sect1>strlower<label id="strlower"><p>
4059 <tag/Function/Make a string lower case.
4060 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4061 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
4062 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
4063 function to each character of a string. The function will always return <tt/s/.
4064 <tag/Limits/<itemize>
4065 <item>The function is only available as fastcall function, so it may only
4066 be used in presence of a prototype.
4067 <item>The function prototype is unavailable when compiling in strict ANSI mode.
4068 <item>An alias name for this function is <tt/strlwr/.
4070 <tag/Availability/cc65
4072 <ref id="strupper" name="strupper">,
4073 <ref id="tolower" name="tolower">
4079 <sect1>strlwr<label id="strlwr"><p>
4086 <sect1>strncat<label id="strncat"><p>
4090 <tag/Function/Concatentate two strings.
4091 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4092 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
4093 <tag/Description/The <tt/strncat/ function appends not more than n characters
4094 of the string pointed to by s2 to the end of the string pointed to by s1. The
4095 terminating null character at the end of s1 is overwritten. A terminating null
4096 character is appended to the result, even if not all of s2 is appended to s1.
4097 <tag/Limits/<itemize>
4098 <item>The function is only available as fastcall function, so it may only
4099 be used in presence of a prototype.
4100 <item>If copying takes place between objects that overlap, the behaviour
4103 <tag/Availability/ISO 9899
4105 <ref id="strcpy" name="strcpy">,
4106 <ref id="strncat" name="strncat">,
4107 <ref id="strncpy" name="strncpy">
4113 <sect1>strncmp<label id="strncmp"><p>
4117 <tag/Function/Compare two strings.
4118 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4119 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
4120 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
4121 characters of the two strings passed as parameters. It returns a value that is
4122 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
4123 <tt/s2/, zero if they are identical, and a value greater than zero they are
4125 <tag/Limits/<itemize>
4126 <item>The function is only available as fastcall function, so it may only
4127 be used in presence of a prototype.
4129 <tag/Availability/ISO 9899
4131 <ref id="strcasecmp" name="strcasecmp">,
4132 <ref id="strcmp" name="strcmp">,
4133 <ref id="strcoll" name="strcoll">,
4134 <ref id="stricmp" name="stricmp">
4140 <sect1>strncpy<label id="strncpy"><p>
4144 <tag/Function/Copy part of a string.
4145 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4146 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2, size_t n);/
4147 <tag/Description/The <tt/strncpy/ function copies not more than n bytes from
4148 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
4149 pointed to by <tt/s2/ is a string that is shorter than n bytes, null bytes are
4150 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
4151 written. The function will always return <tt/s1/.
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. If there is no null byte in the first <tt/n/
4155 bytes of the array pointed to by <tt/s2/, the result is not null-terminated.
4156 <item>If copying takes place between objects that overlap, the behaviour is
4159 <tag/Availability/ISO 9899
4161 <ref id="strcat" name="strcat">,
4162 <ref id="strcpy" name="strcpy">,
4163 <ref id="strncat" name="strncat">
4168 static char hello[6];
4170 strcpy (hello, "Hello world!\n", sizeof (hello) - 1);
4177 <sect1>strrchr<label id="strrchr"><p>
4181 <tag/Function/Search for a character in a string.
4182 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4183 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
4184 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
4185 (converted to a char) in the string pointed to by <tt/s/. The terminating null
4186 byte is considered to be part of the string. Upon completion, the function
4187 returns a pointer to the byte, or a null pointer if the byte was not found.
4188 <tag/Limits/<itemize>
4189 <item>The function is only available as fastcall function, so it may only
4190 be used in presence of a prototype.
4192 <tag/Availability/ISO 9899
4194 <ref id="strchr" name="strchr">
4200 <sect1>strspn<label id="strspn"><p>
4204 <tag/Function/Compute the length of a substring.
4205 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4206 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
4207 <tag/Description/The <tt/strspn/ function computes and returns the length of
4208 the substring pointed to by <tt/s/ which does consist only of characters
4209 contained in the string <tt/set/.
4210 <tag/Limits/<itemize>
4211 <item>The function is only available as fastcall function, so it may only
4212 be used in presence of a prototype.
4214 <tag/Availability/ISO 9899
4216 <ref id="strcspn" name="strcspn">,
4217 <ref id="strstr" name="strstr">
4223 <sect1>strstr<label id="strstr"><p>
4227 <tag/Function/Find a substring.
4228 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4229 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
4230 <tag/Description/<tt/strstr/ searches for the first occurance of the string
4231 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
4232 otherwise it returns <tt/NULL/.
4233 <tag/Limits/<itemize>
4234 <item>The function is only available as fastcall function, so it may only
4235 be used in presence of a prototype.
4237 <tag/Availability/ISO 9899
4239 <ref id="strcspn" name="strcspn">,
4240 <ref id="strspn" name="strspn">
4246 <sect1>strtok<label id="strtok"><p>
4250 <tag/Function/Break a string into tokens.
4251 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4252 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
4253 <tag/Description/<tt/strtok/ will break the string s1 into a sequence of
4254 tokens, which are delimited by characters from the string s2. The first call
4255 to <tt/strtok/ will return a pointer to the first token in the string s1.
4256 Following calls must pass a <tt/NULL/ pointer as s1 in order to get the next
4257 token in the string. Different sets of delimiters may be used for the
4258 subsequent calls to <tt/strtok/.
4259 <tag/Limits/<itemize>
4260 <item>The function is only available as fastcall function, so it may only
4261 be used in presence of a prototype.
4262 <item><tt/strtok/ will modify the string s1.
4264 <tag/Availability/ISO 9899
4266 <ref id="strcspn" name="strcspn">,
4267 <!-- <ref id="strpbrk" name="strpbrk"> -->
4273 <sect1>strupper<label id="strupper"><p>
4277 <tag/Function/Make a string upper case.
4278 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4279 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
4280 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
4281 function to each character of a string. The function will always return <tt/s/.
4282 <tag/Limits/<itemize>
4283 <item>The function is only available as fastcall function, so it may only
4284 be used in presence of a prototype.
4285 <item>The function prototype is unavailable when compiling in strict ANSI mode.
4286 <item>An alias name for this function is <tt/strupr/.
4288 <tag/Availability/cc65
4290 <ref id="strlower" name="strlower">
4291 <ref id="toupper" name="toupper">
4297 <sect1>strupr<label id="strupr"><p>
4304 <sect1>textcolor<label id="textcolor"><p>
4308 <tag/Function/Set the text color.
4309 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4310 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
4311 <tag/Description/The function will set a new text color. It returns the old
4312 (current) text color. Text output using any <tt/conio.h/ function will use
4313 the color set by this function.
4314 <tag/Limits/<itemize>
4315 <item>Text colors are system dependent. The function may have no effect
4316 on systems where the text color cannot be changed.
4317 <item>The function is only available as fastcall function, so it may only
4318 be used in presence of a prototype.
4320 <tag/Availability/cc65
4322 <ref id="bgcolor" name="bgcolor">,
4323 <ref id="bordercolor" name="bordercolor">
4329 <sect1>time<label id="time"><p>
4333 <tag/Function/Get the time.
4334 <tag/Header/<tt/<ref id="time.h" name="time.h">/
4335 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
4336 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
4337 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
4338 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
4339 returned and <tt/errno/ is set to <tt/ENOSYS/.
4340 <tag/Limits/<itemize>
4341 <item>The function is only available as fastcall function, so it may
4342 only be used in presence of a prototype.
4343 <item>Many platforms supported by cc65 do not have a realtime clock, so the
4344 returned value may not be valid.
4346 <tag/Availability/ISO 9899
4352 <sect1>toggle_videomode<label id="toggle_videomode"><p>
4356 <tag/Function/Toggle between 40 and 80 column mode.
4357 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
4358 <tag/Declaration/<tt/void toggle_videomode (void);/
4359 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
4360 old mode (cursor position, color and so on) are saved and restored together
4362 <tag/Limits/<itemize>
4363 <item>The function is specific to the C128.
4365 <tag/Availability/C128
4367 <ref id="fast" name="fast">,
4368 <ref id="slow" name="slow">
4374 <sect1>tolower<label id="tolower"><p>
4378 <tag/Function/Convert a character into its lower case representation.
4379 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4380 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
4381 <tag/Description/The function returns the given character converted to lower
4382 case. If the given character is not a letter, it is returned unchanged.
4383 <tag/Limits/<itemize>
4384 <item>The function is only available as fastcall function, so it may
4385 only be used in presence of a prototype.
4387 <tag/Availability/ISO 9899
4389 <ref id="islower" name="islower">,
4390 <ref id="isupper" name="isupper">,
4391 <ref id="toupper" name="toupper">
4397 <sect1>toupper<label id="toupper"><p>
4401 <tag/Function/Convert a character into its upper case representation.
4402 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4403 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
4404 <tag/Description/The function returns the given character converted to upper
4405 case. If the given character is not a letter, it is returned unchanged.
4406 <tag/Limits/<itemize>
4407 <item>The function is only available as fastcall function, so it may
4408 only be used in presence of a prototype.
4410 <tag/Availability/ISO 9899
4412 <ref id="islower" name="islower">,
4413 <ref id="isupper" name="isupper">,
4414 <ref id="tolower" name="tolower">
4420 <sect1>ultoa<label id="ultoa"><p>
4424 <tag/Function/Convert an unsigned long integer into a string.
4425 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4426 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
4427 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
4428 string using <tt/radix/ as the base.
4429 <tag/Limits/<itemize>
4430 <item>There are no provisions to prevent a buffer overflow.
4431 <item>The function is non standard, so it is not available in strict ANSI mode.
4432 You should probably use <tt/sprintf/ instead.
4433 <item>The function is only available as fastcall function, so it may only be
4434 used in presence of a prototype.
4436 <tag/Availability/cc65
4438 <ref id="atoi" name="atoi">,
4439 <ref id="atol" name="atol">,
4440 <ref id="itoa" name="itoa">,
4441 <ref id="ltoa" name="ltoa">,
4442 <ref id="utoa" name="utoa">
4448 <sect1>unlink<label id="unlink"><p>
4452 <tag/Function/Delete a file.
4453 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
4454 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
4455 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
4456 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
4457 code describing the reason for the failure.
4460 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
4461 name="remove">/ instead, which is a native ANSI C function and does the same.
4462 <item>This function is not available on all cc65 targets (depends on the
4463 availability of file I/O).
4464 <item>The function is only available as fastcall function, so it may only
4465 be used in presence of a prototype.
4466 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
4467 used, which has the same semantics, but is more portable, because it conforms
4468 to the ISO C standard.
4470 <tag/Availability/POSIX 1003.1
4472 <ref id="remove" name="remove">
4474 #include <stdio.h>
4475 #include <unistd.h>
4477 #define FILENAME "helloworld"
4479 if (unlink (FILENAME) == 0) {
4480 printf ("We deleted %s successfully\n", FILENAME);
4482 printf ("There was a problem deleting %s\n", FILENAME);
4488 <sect1>utoa<label id="utoa"><p>
4492 <tag/Function/Convert an unsigned integer into a string.
4493 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4494 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
4495 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
4496 using <tt/radix/ as the base.
4497 <tag/Limits/<itemize>
4498 <item>There are no provisions to prevent a buffer overflow.
4499 <item>The function is non standard, so it is not available in strict ANSI mode.
4500 You should probably use <tt/sprintf/ instead.
4501 <item>The function is only available as fastcall function, so it may only be
4502 used in presence of a prototype.
4504 <tag/Availability/cc65
4506 <ref id="atoi" name="atoi">,
4507 <ref id="atol" name="atol">,
4508 <ref id="itoa" name="itoa">,
4509 <ref id="ltoa" name="ltoa">,
4510 <ref id="ultoa" name="ultoa">
4516 <sect1>vcprintf<label id="vcprintf"><p>
4520 <tag/Function/Formatted output to the console.
4521 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4522 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
4523 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
4524 text where necessary and formatted according to the format string given. The
4525 resulting string is output to the console. <tt/vcprintf/ supports the same
4526 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
4527 <tag/Limits/<itemize>
4528 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
4529 between <tt/\r/ and <tt/\n/.
4530 <item>The function is only available as fastcall function, so it may only be
4531 used in presence of a prototype.
4533 <tag/Availability/cc65
4535 <ref id="cprintf" name="cprintf">,
4536 <ref id="cputc" name="cputc">,
4537 <ref id="cputcxy" name="cputcxy">,
4538 <ref id="cputs" name="cputs">,
4539 <ref id="cputsxy" name="cputsxy">
4545 <sect1>wherex<label id="wherex"><p>
4549 <tag/Function/Return the current X position of the text mode cursor.
4550 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4551 <tag/Declaration/<tt/unsigned char wherex (void);/
4552 <tag/Description/The function returns the current X position of the text mode
4553 cursor. Zero is returned for the leftmost screen position.
4554 <tag/Availability/cc65
4556 <ref id="gotox" name="gotox">,
4557 <ref id="gotoy" name="gotoy">,
4558 <ref id="gotoxy" name="gotoxy">,
4559 <ref id="wherey" name="wherey">
4565 <sect1>wherey<label id="wherey"><p>
4569 <tag/Function/Return the current Y position of the text mode cursor.
4570 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4571 <tag/Declaration/<tt/unsigned char wherey (void);/
4572 <tag/Description/The function returns the current Y position of the text mode
4573 cursor. Zero is returned for the uppermost screen position.
4574 <tag/Availability/cc65
4576 <ref id="gotox" name="gotox">,
4577 <ref id="gotoy" name="gotoy">,
4578 <ref id="gotoxy" name="gotoxy">,
4579 <ref id="wherex" name="wherex">