1 <!doctype linuxdoc system>
4 <title>cc65 function reference
5 <author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
9 cc65 is a C compiler for 6502 based systems. This function reference describes
10 the C functions available in the standard library.
13 <!-- Table of contents -->
16 <!-- Begin the document -->
20 cc65 is a C compiler for 6502 based systems. It implements a subset of the ISO
21 C standard plus additional functions specially crafted for 6502 systems or
22 just some of the supported machines. This function refrence describes the
23 available functions together with any limitations.
25 For an overview about the available libraries, their purpose, and any
26 differences to the ISO standard, please have a look at the <htmlurl
27 url="library.html" name="cc65 Library Overview">.
29 <bf/Note:/ Standard C functions are listed here, but not described in detail.
30 Since these functions behave identical on all standard compliant systems, they
31 are described in any book covering standard C.
33 Each entry for a function contains a detailed description
37 <tag/Function/Summary of what <bf/function/ does.
38 <tag/Header/The header file that contains the declaration.
39 <tag/Declaration/Describes the needed header files and declaration of the
41 <tag/Description/Description of the function.
43 <tag/Availability/The availability of the function.
44 <tag/See also/Other related functions.
45 <tag/Example/A piece of actual code using the function.
50 <sect>Functions by header file<p>
52 <sect1><tt/6502.h/<label id="6502.h"><p>
55 <item><ref id="BRK" name="BRK">
56 <item><ref id="CLI" name="CLI">
57 <item><ref id="SEI" name="SEI">
58 <item><ref id="_sys" name="_sys">
59 <item><ref id="getcpu" name="getcpu">
60 <item><ref id="reset_brk" name="reset_brk">
61 <item><ref id="set_brk" name="set_brk">
65 <sect1><tt/apple2.h/<label id="apple2.h"><p>
69 <item><ref id="get_ostype" name="get_ostype">
73 <sect1><tt/apple2enh.h/<label id="apple2enh.h"><p>
77 <item><ref id="get_ostype" name="get_ostype">
80 <item><ref id="videomode" name="videomode">
84 <sect1><tt/assert.h/<label id="assert.h"><p>
87 <item><ref id="assert" name="assert">
91 <sect1><tt/atari.h/<label id="atari.h"><p>
94 <item><ref id="get_ostype" name="get_ostype">
100 <sect1><tt/atmos.h/<label id="atmos.h"><p>
105 <sect1><tt/c128.h/<label id="c128.h"><p>
108 <item><ref id="c64mode" name="c64mode">
109 <item><ref id="fast" name="fast">
110 <item><ref id="slow" name="slow">
111 <item><ref id="toggle_videomode" name="toggle_videomode">
112 <item><ref id="videomode" name="videomode">
116 <sect1><tt/c16.h/<label id="c16.h"><p>
121 <sect1><tt/c64.h/<label id="c64.h"><p>
124 <item><ref id="get_ostype" name="get_ostype">
128 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
131 <item><ref id="peekbsys" name="peekbsys">
132 <item><ref id="peekwsys" name="peekwsys">
133 <item><ref id="pokebsys" name="pokebsys">
134 <item><ref id="pokewsys" name="pokewsys">
138 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
141 <item><ref id="peekbsys" name="peekbsys">
142 <item><ref id="peekwsys" name="peekwsys">
143 <item><ref id="pokebsys" name="pokebsys">
144 <item><ref id="pokewsys" name="pokewsys">
148 <sect1><tt/conio.h/<label id="conio.h"><p>
151 <item><ref id="bgcolor" name="bgcolor">
152 <item><ref id="bordercolor" name="bordercolor">
153 <item><ref id="cclear" name="cclear">
154 <item><ref id="cclearxy" name="cclearxy">
155 <item><ref id="cgetc" name="cgetc">
156 <item><ref id="chline" name="chline">
157 <item><ref id="chlinexy" name="chlinexy">
158 <item><ref id="clrscr" name="clrscr">
159 <item><ref id="cprintf" name="cprintf">
160 <item><ref id="cputc" name="cputc">
161 <item><ref id="cputcxy" name="cputcxy">
162 <item><ref id="cputs" name="cputs">
163 <item><ref id="cputsxy" name="cputsxy">
164 <item><ref id="cursor" name="cursor">
165 <item><ref id="cvline" name="cvline">
166 <item><ref id="cvlinexy" name="cvlinexy">
167 <item><ref id="gotox" name="gotox">
168 <item><ref id="gotoxy" name="gotoxy">
169 <item><ref id="gotoy" name="gotoy">
170 <item><ref id="kbhit" name="kbhit">
171 <item><ref id="revers" name="revers">
172 <item><ref id="screensize" name="screensize">
173 <item><ref id="textcolor" name="textcolor">
174 <item><ref id="vcprintf" name="vcprintf">
175 <item><ref id="wherex" name="wherex">
176 <item><ref id="wherey" name="wherey">
180 <sect1><tt/ctype.h/<label id="ctype.h"><p>
183 <item><ref id="isalnum" name="isalnum">
184 <item><ref id="isalpha" name="isalpha">
185 <item><ref id="isascii" name="isascii">
186 <item><ref id="isblank" name="isblank">
187 <item><ref id="iscntrl" name="iscntrl">
188 <item><ref id="isdigit" name="isdigit">
189 <item><ref id="isgraph" name="isgraph">
190 <item><ref id="islower" name="islower">
191 <item><ref id="isprint" name="isprint">
192 <item><ref id="ispunct" name="ispunct">
193 <item><ref id="isspace" name="isspace">
194 <item><ref id="isupper" name="isupper">
195 <item><ref id="isxdigit" name="isxdigit">
196 <item><ref id="tolower" name="tolower">
197 <item><ref id="toupper" name="toupper">
201 <sect1><tt/dbg.h/<label id="dbg.h"><p>
206 <sect1><tt/dio.h/<label id="dio.h"><p>
211 <sect1><tt/em.h/<label id="em.h"><p>
214 <item><ref id="em_commit" name="em_commit">
215 <item><ref id="em_copyfrom" name="em_copyfrom">
216 <item><ref id="em_copyto" name="em_copyto">
217 <item><ref id="em_install" name="em_install">
218 <item><ref id="em_load_driver" name="em_load_driver">
219 <item><ref id="em_map" name="em_map">
220 <item><ref id="em_pagecount" name="em_pagecount">
221 <item><ref id="em_uninstall" name="em_uninstall">
222 <item><ref id="em_unload" name="em_unload">
223 <item><ref id="em_use" name="em_use">
227 <sect1><tt/errno.h/<label id="errno.h"><p>
232 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
235 <item><ref id="close" name="close">
236 <item><ref id="creat" name="creat">
237 <item><ref id="open" name="open">
241 <sect1><tt/geos.h/<label id="geos.h"><p>
246 <sect1><tt/joystick.h/<label id="joystick.h"><p>
249 <item><ref id="joy_count" name="joy_count">
250 <item><ref id="joy_install" name="joy_install">
251 <item><ref id="joy_load_driver" name="joy_load_driver">
252 <item><ref id="joy_read" name="joy_read">
253 <item><ref id="joy_uninstall" name="joy_uninstall">
254 <item><ref id="joy_unload" name="joy_unload">
258 <sect1><tt/locale.h/<label id="locale.h"><p>
261 <item><ref id="localeconv" name="localeconv">
262 <item><ref id="setlocale" name="setlocale">
266 <sect1><tt/modload.h/<label id="modload.h"><p>
269 <item><ref id="mod_load" name="mod_load">
270 <item><ref id="mod_free" name="mod_free">
274 <sect1><tt/mouse.h/<label id="mouse.h"><p>
277 <item><ref id="mouse_load_driver" name="mouse_load_driver">
278 <item><ref id="mouse_unload" name="mouse_unload">
279 <item><ref id="mouse_install" name="mouse_install">
280 <item><ref id="mouse_uninstall" name="mouse_uninstall">
281 <item><ref id="mouse_hide" name="mouse_hide">
282 <item><ref id="mouse_show" name="mouse_show">
283 <item><ref id="mouse_box" name="mouse_box">
284 <item><ref id="mouse_move" name="mouse_move">
285 <item><ref id="mouse_buttons" name="mouse_buttons">
286 <item><ref id="mouse_pos" name="mouse_pos">
287 <item><ref id="mouse_info" name="mouse_info">
288 <item><ref id="mouse_ioctl" name="mouse_ioctl">
294 <sect1><tt/nes.h/<label id="nes.h"><p>
299 <sect1><tt/o65.h/<label id="o65.h"><p>
301 The <tt/o65.h/ header file contains structure and constant definitions that
302 may be used when dealing with files in <htmlurl
303 url="http://www.6502.org/users/andre/o65/fileformat.html" name="o65 format">.
304 It does not declare any functions.
307 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
310 <item><ref id="PEEK" name="PEEK">
311 <item><ref id="PEEKW" name="PEEKW">
312 <item><ref id="POKE" name="POKE">
313 <item><ref id="POKEW" name="POKEW">
317 <sect1><tt/pet.h/<label id="pet.h"><p>
322 <sect1><tt/plus4.h/<label id="plus4.h"><p>
327 <sect1><tt/serial.h/<label id="serial.h"><p>
331 <item><ref id="ser_load_driver" name="ser_load_driver">
332 <item><ref id="ser_unload" name="ser_unload">
333 <item><ref id="ser_install" name="ser_install">
334 <item><ref id="ser_uninstall" name="ser_uninstall">
335 <item><ref id="ser_open" name="ser_open">
336 <item><ref id="ser_close" name="ser_close">
337 <item><ref id="ser_get" name="ser_get">
338 <item><ref id="ser_put" name="ser_put">
339 <item><ref id="ser_status" name="ser_status">
340 <item><ref id="ser_ioctl" name="ser_ioctl">
347 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
350 <item><ref id="setjmp" name="setjmp">
351 <item><ref id="longjmp" name="longjmp">
355 <sect1><tt/signal.h/<label id="signal.h"><p>
358 <item><ref id="raise" name="raise">
359 <item><ref id="signal" name="signal">
363 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
368 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
373 <sect1><tt/stddef.h/<label id="stddef.h"><p>
376 <item><ref id="offsetof" name="offsetof">
380 <sect1><tt/stdio.h/<label id="stdio.h"><p>
383 <item><ref id="clearerr" name="clearerr">
384 <!-- <item><ref id="fclose" name="fclose"> -->
385 <!-- <item><ref id="fdopen" name="fdopen"> -->
386 <item><ref id="feof" name="feof">
387 <item><ref id="ferror" name="ferror">
388 <!-- <item><ref id="fflush" name="fflush"> -->
389 <!-- <item><ref id="fgetc" name="fgetc"> -->
390 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
391 <!-- <item><ref id="fgets" name="fgets"> -->
392 <item><ref id="fileno" name="fileno">
393 <!-- <item><ref id="fopen" name="fopen"> -->
394 <!-- <item><ref id="fprintf" name="fprintf"> -->
395 <!-- <item><ref id="fputc" name="fputc"> -->
396 <!-- <item><ref id="fputs" name="fputs"> -->
397 <!-- <item><ref id="fread" name="fread"> -->
398 <!-- <item><ref id="freopen" name="freopen"> -->
399 <!-- <item><ref id="fscanf" name="fscanf"> -->
400 <!-- <item><ref id="fseek" name="fseek"> -->
401 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
402 <!-- <item><ref id="ftell" name="ftell"> -->
403 <!-- <item><ref id="fwrite" name="fwrite"> -->
404 <!-- <item><ref id="getc" name="getc"> -->
405 <!-- <item><ref id="getchar" name="getchar"> -->
406 <!-- <item><ref id="gets" name="gets"> -->
407 <!-- <item><ref id="printf" name="printf"> -->
408 <!-- <item><ref id="putc" name="putc"> -->
409 <!-- <item><ref id="putchar" name="putchar"> -->
410 <!-- <item><ref id="puts" name="puts"> -->
411 <item><ref id="rename" name="rename">
412 <item><ref id="remove" name="remove">
413 <!-- <item><ref id="rewind" name="rewind"> -->
414 <!-- <item><ref id="scanf" name="scanf"> -->
415 <!-- <item><ref id="sprintf" name="sprintf"> -->
416 <!-- <item><ref id="sscanf" name="sscanf"> -->
417 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
418 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
419 <!-- <item><ref id="vprintf" name="vprintf"> -->
420 <!-- <item><ref id="vscanf" name="vscanf"> -->
421 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
422 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
428 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
431 <item><ref id="_heapadd" name="_heapadd">
432 <item><ref id="_heapblocksize" name="_heapblocksize">
433 <item><ref id="_heapmaxavail" name="_heapmaxavail">
434 <item><ref id="_heapmemavail" name="_heapmemavail">
435 <item><ref id="_poserror" name="_poserror">
436 <item><ref id="_randomize" name="_randomize">
437 <item><ref id="_swap" name="_swap">
438 <item><ref id="abort" name="abort">
439 <item><ref id="abs" name="abs">
440 <item><ref id="atexit" name="atexit">
441 <item><ref id="atoi" name="atoi">
442 <item><ref id="atol" name="atol">
443 <item><ref id="bsearch" name="bsearch">
444 <item><ref id="calloc" name="calloc">
445 <item><ref id="div" name="div">
446 <item><ref id="exit" name="exit">
447 <item><ref id="free" name="free">
448 <item><ref id="getenv" name="getenv">
449 <item><ref id="itoa" name="itoa">
450 <item><ref id="labs" name="labs">
451 <item><ref id="ltoa" name="ltoa">
452 <item><ref id="malloc" name="malloc">
453 <item><ref id="perror" name="perror">
454 <item><ref id="qsort" name="qsort">
455 <item><ref id="rand" name="rand">
456 <item><ref id="realloc" name="realloc">
457 <item><ref id="srand" name="srand">
458 <item><ref id="ultoa" name="ultoa">
459 <item><ref id="utoa" name="utoa">
463 <sect1><tt/string.h/<label id="string.h"><p>
466 <item><ref id="_stroserror" name="_stroserror">
467 <item><ref id="bzero" name="bzero">
468 <item><ref id="memchr" name="memchr">
469 <item><ref id="memcpy" name="memcpy">
470 <item><ref id="memmove" name="memmove">
471 <item><ref id="memset" name="memset">
472 <item><ref id="strcasecmp" name="strcasecmp">
473 <item><ref id="strcat" name="strcat">
474 <item><ref id="strchr" name="strchr">
475 <item><ref id="strcmp" name="strcmp">
476 <item><ref id="strcoll" name="strcoll">
477 <item><ref id="strcpy" name="strcpy">
478 <item><ref id="strcspn" name="strcspn">
479 <item><ref id="strdup" name="strdup">
480 <item><ref id="strerror" name="strerror">
481 <item><ref id="stricmp" name="stricmp">
482 <item><ref id="strlen" name="strlen">
483 <item><ref id="strlower" name="strlower">
484 <item><ref id="strlwr" name="strlwr">
485 <item><ref id="strncat" name="strncat">
486 <item><ref id="strncmp" name="strncmp">
487 <item><ref id="strncpy" name="strncpy">
488 <item><ref id="strrchr" name="strrchr">
489 <item><ref id="strspn" name="strspn">
490 <item><ref id="strstr" name="strstr">
491 <item><ref id="strtok" name="strtok">
492 <item><ref id="strxfrm" name="strxfrm">
493 <item><ref id="strupper" name="strupper">
494 <item><ref id="strupr" name="strupr">
500 <sect1><tt/tgi.h/<label id="tgi.h"><p>
505 <sect1><tt/time.h/<label id="time.h"><p>
508 <!-- <item><ref id="_systime" name="_systime"> -->
509 <!-- <item><ref id="asctime" name="asctime"> -->
510 <!-- <item><ref id="clock" name="clock"> -->
511 <!-- <item><ref id="ctime" name="ctime"> -->
512 <!-- <item><ref id="gmtime" name="gmtime"> -->
513 <!-- <item><ref id="localtime" name="localtime"> -->
514 <!-- <item><ref id="mktime" name="mktime"> -->
515 <!-- <item><ref id="strftime" name="strftime"> -->
516 <item><ref id="time" name="time">
522 <sect1><tt/unistd.h/<label id="unistd.h"><p>
525 <!-- <item><ref id="chdir" name="chdir"> -->
526 <!-- <item><ref id="getcwd" name="getcwd"> -->
527 <!-- <item><ref id="lseek" name="lseek"> -->
528 <!-- <item><ref id="mkdir" name="mkdir"> -->
529 <!-- <item><ref id="read" name="read"> -->
530 <!-- <item><ref id="rmdir" name="rmdir"> -->
531 <item><ref id="sleep" name="sleep">
532 <item><ref id="unlink" name="unlink">
533 <!-- <item><ref id="write" name="write"> -->
539 <sect1><tt/vic20.h/<label id="vic20.h"><p>
544 <sect1><tt/zlib.h/<label id="zlib.h"><p>
549 <sect>Alphabetical function reference<p>
551 <sect1>_heapadd<label id="_heapadd"><p>
555 <tag/Function/Add a block to the heap.
556 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
557 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
558 <tag/Description/The function adds a block of raw memory to the heap.
561 <item>The minimum blocksize that can be added is 6 bytes; the function will
562 ignore smaller blocks.
564 <tag/Availability/cc65
566 <ref id="_heapblocksize" name="_heapblocksize">,
567 <ref id="_heapmaxavail" name="_heapmaxavail">,
568 <ref id="_heapmemavail" name="_heapmemavail">,
569 <ref id="calloc" name="calloc">,
570 <ref id="free" name="free">,
571 <ref id="malloc" name="malloc">,
572 <ref id="realloc" name="realloc">
578 <sect1>_heapblocksize<label id="_heapblocksize"><p>
582 <tag/Function/Return the size of an allocated block.
583 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
584 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
585 <tag/Description/The function returns the size of a block that must have
586 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
587 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
590 <item>Passing a pointer to a block that was is not the result of one of the
591 allocation functions, or that has been free'd will give unpredicable results.
593 <tag/Availability/cc65
595 <ref id="_heapadd" name="_heapadd">,
596 <ref id="_heapmaxavail" name="_heapmaxavail">,
597 <ref id="_heapmemavail" name="_heapmemavail">,
598 <ref id="calloc" name="calloc">,
599 <ref id="free" name="free">,
600 <ref id="malloc" name="malloc">,
601 <ref id="realloc" name="realloc">
607 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
611 <tag/Function/Return the largest block that is available on the heap.
612 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
613 <tag/Declaration/<tt/size_t __fastcall__ _heapmaxavail (void);/
614 <tag/Description/The function returns the size of the largest block that may
615 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
616 <tag/Availability/cc65
618 <ref id="_heapadd" name="_heapadd">,
619 <ref id="_heapblocksize" name="_heapblocksize">,
620 <ref id="_heapmemavail" name="_heapmemavail">,
621 <ref id="calloc" name="calloc">,
622 <ref id="free" name="free">,
623 <ref id="malloc" name="malloc">,
624 <ref id="realloc" name="realloc">
630 <sect1>_heapmemavail<label id="_heapmemavail"><p>
634 <tag/Function/Return the total available space on the heap.
635 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
636 <tag/Declaration/<tt/size_t __fastcall__ _heapmemavail (void);/
637 <tag/Description/The function returns the total number of bytes available on
641 <item>This function is of less use than usually assumed, since the returned
642 heap space may be available but not in one block. So even if this function
643 says that several times more heap space is available than needed, <ref
644 id="malloc" name="malloc"> may still return <tt/NULL/.
646 <tag/Availability/cc65
648 <ref id="_heapadd" name="_heapadd">,
649 <ref id="_heapblocksize" name="_heapblocksize">,
650 <ref id="_heapmaxavail" name="_heapmaxavail">,
651 <ref id="calloc" name="calloc">,
652 <ref id="free" name="free">,
653 <ref id="malloc" name="malloc">,
654 <ref id="realloc" name="realloc">
660 <sect1>_poserror<label id="_poserror"><p>
664 <tag/Function/Print an error message for the error in <tt/_oserrno/.
665 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
666 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
667 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
668 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
669 a colon and a blank. Then the error message for the current contents of
670 <tt/_oserrno/ are printed followed by a newline. The message output is the
671 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
672 argument of <tt/_oserrno/.
675 <item>Since operating system specific error code are - you guessed it -
676 operating system specific, the value in <tt/_oserror/ and the message that is
677 printed depend on the cc65 target.
678 <item>The function is only available as fastcall function, so it may only
679 be used in presence of a prototype.
681 <tag/Availability/cc65
683 <ref id="_stroserror" name="_stroserror">,
684 <ref id="perror" name="perror">
690 <sect1>_randomize<label id="_randomize"><p>
694 <tag/Function/Initialize the pseudo random number generator.
695 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
696 <tag/Declaration/<tt/void _randomize (void);/
697 <tag/Description/The function initializes the random number generator with
698 a seed derived from fast changing hardware events, so the seed itself can be
699 considered random to a certain degree.
700 <tag/Limits/<itemize>
701 <item>The randomness of the seed depends on the machine hardware.
703 <tag/Availability/cc65
705 <ref id="rand" name="rand">,
706 <ref id="srand" name="srand">
712 <sect1>_stroserror<label id="_stroserror"><p>
716 <tag/Function/Return a string describing an OS specific error code.
717 <tag/Header/<tt/<ref id="string.h" name="string.h">/
718 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
719 <tag/Description/<tt/_stroserror/ will return a string describing the given
720 operating system specific error code.
721 <tag/Limits/<itemize>
722 <item>Since operating system specific error code are - you guessed it -
723 operating system specific, the parameter and the string returned depend on the
725 <item>The function is only available as fastcall function, so it may only be
726 used in presence of a prototype.
728 <tag/Availability/cc65
730 <ref id="strerror" name="strerror">
736 <sect1>_swap<label id="_swap"><p>
740 <tag/Function/Swap the contents of memory areas.
741 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
742 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
743 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
744 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
745 <tt/size/ bytes in size.
746 <tag/Limits/<itemize>
747 <item>The memory areas may not overlap, otherwise the results are undefined.
748 <item>The function is only available as fastcall function, so it may only be
749 used in presence of a prototype.
751 <tag/Availability/cc65
753 <ref id="memcpy" name="memcpy">,
754 <ref id="memmove" name="memmove">
760 <sect1>_sys<label id="_sys"><p>
764 <tag/Function/Call a subroutine passing register values.
765 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
766 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
767 <tag/Description/The function will call the subroutine at the address
768 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
769 registers and the CPU flags are set to the values given in the <tt/regs/
770 structure. On return from the subroutine, the new values of the registers and
771 flags are stored back overwriting the old values.
772 <tag/Limits/<itemize>
773 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
774 when calling the subroutine (they are unchanged from their current values).
775 <item>The function is only available as fastcall function, so it may only be
776 used in presence of a prototype.
778 <tag/Availability/cc65
784 <sect1>BRK<label id="BRK"><p>
788 <tag/Function/Insert a 6502 BRK instrunction into the code.
789 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
790 <tag/Declaration/<tt/void BRK (void);/
791 <tag/Description/The function will insert a 6502 BRK instruction into the code
792 which may be used to trigger a debugger.
793 <tag/Limits/<itemize>
794 <item>The function is actually a macro.
795 <item>The inserted instruction may lead to unexpected results if no debugger
798 <tag/Availability/cc65
800 <ref id="CLI" name="CLI">,
801 <ref id="SEI" name="SEI">
807 <sect1>CLI<label id="CLI"><p>
811 <tag/Function/Insert a 6502 CLI instrunction into the code.
812 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
813 <tag/Declaration/<tt/void CLI (void);/
814 <tag/Description/The function will insert a 6502 CLI instruction into the code,
815 so interrupts are enabled. Enabling interrupts has no effects if they are
816 already enabled (the default).
817 <tag/Limits/<itemize>
818 <item>The function is actually a macro.
819 <item>Disabling interrupts may lead to unexpected results.
821 <tag/Availability/cc65
823 <ref id="BRK" name="BRK">,
824 <ref id="SEI" name="SEI">
830 <sect1>PEEK<label id="PEEK"><p>
834 <tag/Function/Read a byte from memory.
835 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
836 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
837 <tag/Description/The function will read the absolute memory given by <tt/addr/
838 and return the value read.
839 <tag/Limits/<itemize>
840 <item>The function is actually a macro.
841 <item>This function depends highly on the platform and environment.
843 <tag/Availability/cc65
845 <ref id="PEEKW" name="PEEKW">,
846 <ref id="POKE" name="POKE">
852 <sect1>PEEKW<label id="PEEKW"><p>
856 <tag/Function/Read a word (two bytes) from memory.
857 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
858 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
859 <tag/Description/The function will read the absolute memory given by <tt/addr/
860 and return the value read. The byte read from the higher address is the high
861 byte of the return value.
862 <tag/Limits/<itemize>
863 <item>The function is actually a macro.
864 <item>This function depends highly on the platform and environment.
865 <item>The order in which the two bytes are read is unspecified and may
866 depend of the address expression used.
868 <tag/Availability/cc65
870 <ref id="PEEK" name="PEEK">,
871 <ref id="POKE" name="POKE">
877 <sect1>POKE<label id="POKE"><p>
881 <tag/Function/Write a byte to memory.
882 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
883 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
884 <tag/Description/The function writes the value <tt/val/ to the absolute
885 memory address given by <tt/addr/.
886 <tag/Limits/<itemize>
887 <item>The function is actually a macro.
888 <item>This function depends highly on the platform and environment.
889 <item>Careless use will cause the program to act strange or may crash the
892 <tag/Availability/cc65
894 <ref id="PEEK" name="PEEK">,
895 <ref id="POKEW" name="POKEW">
901 <sect1>POKEW<label id="POKEW"><p>
905 <tag/Function/Write a word (two bytes) to memory.
906 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
907 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
908 <tag/Description/The function writes the value <tt/val/ to the absolute
909 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
910 the <tt/addr/, the high byte is written to <tt/addr+1/.
911 <tag/Limits/<itemize>
912 <item>The function is actually a macro.
913 <item>This function depends highly on the platform and environment.
914 <item>Careless use will cause the program to act strange or may crash the
916 <item>The order in which the two bytes are written is unspecified and may
917 depend of the address expression used.
919 <tag/Availability/cc65
921 <ref id="PEEK" name="PEEK">,
922 <ref id="POKE" name="POKE">
928 <sect1>SEI<label id="SEI"><p>
932 <tag/Function/Insert a 6502 SEI instrunction into the code.
933 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
934 <tag/Declaration/<tt/void SEI (void);/
935 <tag/Description/The function will insert a 6502 SEI instruction into the code,
936 so interrupts are disabled. Note that non maskable interrupts cannot be
938 <tag/Limits/<itemize>
939 <item>The function is actually a macro.
940 <item>Disabling interrupts may lead to unexpected results.
942 <tag/Availability/cc65
944 <ref id="BRK" name="BRK">,
945 <ref id="CLI" name="CLI">
951 <sect1>abort<label id="abort"><p>
955 <tag/Function/Terminates a program abnormally.
956 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
957 <tag/Declaration/<tt/void abort (void);/
958 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
959 on stderr, then terminates the program with an exit code of 3.
960 <tag/Availability/ISO 9899
962 <ref id="assert" name="assert">,
963 <ref id="exit" name="exit">,
964 <ref id="raise" name="raise">
970 <sect1>abs<label id="abs"><p>
974 <tag/Function/Returns the absolute value of an integer.
975 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
976 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
977 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
979 <tag/Limits/<itemize>
980 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
981 <item>The function is only available as fastcall function, so it may only be
982 used in presence of a prototype.
984 <tag/Availability/ISO 9899
986 <ref id="labs" name="labs">
992 <sect1>assert<label id="assert"><p>
996 <tag/Function/Test a condition and possibly abort.
997 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
998 <tag/Declaration/<tt/void assert (int cond);/
999 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
1000 statement. If the condition evaluates t zero (false), assert prints a message
1001 on stderr and aborts the program.
1002 <tag/Limits/<itemize>
1003 <item>The function is actually a macro.
1005 <tag/Availability/ISO 9899
1007 <ref id="abort" name="abort">,
1008 <ref id="exit" name="exit">
1014 <sect1>atexit<label id="atexit"><p>
1018 <tag/Function/Register an exit function.
1019 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1020 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1021 <tag/Description/<tt/atexit/ registers the function pointed to by
1022 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1023 terminates, they are called in LIFO order (the last function registered is
1024 called first). <tt/atexit/ returns zero on success and a nonzero value on
1026 <tag/Limits/<itemize>
1027 <item>A maximum of 5 exit functions can be registered.
1028 <item>There is no way to unregister an exit function.
1029 <item>The function is only available as fastcall function, so it may only be
1030 used in presence of a prototype.
1032 <tag/Availability/ISO 9899
1034 <ref id="abort" name="abort">,
1035 <ref id="exit" name="exit">
1041 <sect1>atoi<label id="atoi"><p>
1045 <tag/Function/Convert a string to an integer.
1046 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1047 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1048 <tag/Description/<tt/atoi/ converts the given string into an integer.
1049 Conversion stops as soon as any invalid character is encountered.
1050 <tag/Limits/<itemize>
1051 <item>There is no way to detect any conversion errors.
1052 <item>The function does not check for an numerical overflow when converting.
1053 <item>The function is only available as fastcall function, so it may only be
1054 used in presence of a prototype.
1056 <tag/Availability/ISO 9899
1058 <ref id="atol" name="atol">,
1059 <ref id="itoa" name="itoa">,
1060 <ref id="ltoa" name="ltoa">,
1061 <ref id="ultoa" name="ultoa">,
1062 <ref id="utoa" name="utoa">
1068 <sect1>atol<label id="atol"><p>
1072 <tag/Function/Convert a string to a long integer.
1073 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1074 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1075 <tag/Description/<tt/atol/ converts the given string into a long integer.
1076 Conversion stops as soon as any invalid character is encountered.
1077 <tag/Limits/<itemize>
1078 <item>There is no way to detect any conversion errors.
1079 <item>The function does not check for an numerical overflow when converting.
1080 <item>The function is only available as fastcall function, so it may only be
1081 used in presence of a prototype.
1083 <tag/Availability/ISO 9899
1085 <ref id="atoi" name="atoi">,
1086 <ref id="itoa" name="itoa">,
1087 <ref id="ltoa" name="ltoa">,
1088 <ref id="ultoa" name="ultoa">,
1089 <ref id="utoa" name="utoa">
1095 <sect1>bgcolor<label id="bgcolor"><p>
1099 <tag/Function/Set the background text color.
1100 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1101 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1102 <tag/Description/The function will set a new background color and return the
1103 old (current) one. The background color is valid for the whole text output
1104 area of the screen, not just for new text.
1105 <tag/Limits/<itemize>
1106 <item>Background colors are system dependent. The function may have no effect
1107 on systems where the background color cannot be changed.
1108 <item>The function is only available as fastcall function, so it may only be
1109 used in presence of a prototype.
1111 <tag/Availability/cc65
1113 <ref id="bordercolor" name="bordercolor">,
1114 <ref id="textcolor" name="textcolor">
1120 <sect1>bordercolor<label id="bordercolor"><p>
1124 <tag/Function/Set the border (frame) color.
1125 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1126 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1127 <tag/Description/The function will set a new border color. It returns the old
1128 (current) border color.
1129 <tag/Limits/<itemize>
1130 <item>Border colors are system dependent. The function may have no effect
1131 on systems where the border color cannot be changed.
1132 <item>The function is only available as fastcall function, so it may only
1133 be used in presence of a prototype.
1135 <tag/Availability/cc65
1137 <ref id="bgcolor" name="bgcolor">,
1138 <ref id="textcolor" name="textcolor">
1144 <sect1>bsearch<label id="bsearch"><p>
1148 <tag/Function/Do a binary search in a sorted array.
1149 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1150 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1151 const void* base, size_t n, size_t size,
1152 int (*cmp) (const void*, const void*));/
1153 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1154 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1155 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1156 the function used to compare the members against the key. The function returns
1157 a pointer to the member found, or <tt/NULL/ if there was no match.
1160 <item>The contents of the array must be sorted in ascending order according to
1161 the compare function given.
1162 <item>If there are multiple members that match the key, the function will
1163 return one of the members.
1164 <item>The function is only available as fastcall function, so it may only
1165 be used in presence of a prototype.
1167 <tag/Availability/ISO 9899
1169 <ref id="qsort" name="qsort">
1175 <sect1>bzero<label id="bzero"><p>
1179 <tag/Function/Fill a memory area with zeroes.
1180 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1181 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1182 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1186 <item>The function is non standard and therefore only available in non ANSI
1187 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1188 <item>The function is only available as fastcall function, so it may only
1189 be used in presence of a prototype.
1191 <tag/Availability/cc65
1193 <ref id="_swap" name="_swap">,
1194 <ref id="memcpy" name="memcpy">,
1195 <ref id="memmove" name="memmove">,
1196 <ref id="memset" name="memset">,
1202 <sect1>c64mode<label id="c64mode"><p>
1206 <tag/Function/Switch the C128 into C64 compatible mode.
1207 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1208 <tag/Declaration/<tt/void c64mode (void);/
1209 <tag/Description/The function will cause the machine to reboot into C64 mode.
1210 <tag/Limits/<itemize>
1211 <item>The function is specific to the C128.
1212 <item>The function will not return to the caller.
1214 <tag/Availability/C128
1220 <sect1>calloc<label id="calloc"><p>
1224 <tag/Function/Allocate and clear memory.
1225 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1226 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1227 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1228 of size <tt/size/, clears the whole block with binary zeroes and returns a
1229 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1233 <item>Clearing the memory may not have the expected effect on all platforms:
1234 pointers in the block may not be <tt/NULL/ and floating point variables may
1235 not be zero (0.0). In other words: The "clearing" effect of this function
1236 should be used with care for portable programs.
1237 <item>The function is only available as fastcall function, so it may only
1238 be used in presence of a prototype.
1240 <tag/Availability/ISO 9899
1242 <ref id="_heapadd" name="_heapadd">,
1243 <ref id="_heapblocksize" name="_heapblocksize">,
1244 <ref id="_heapmaxavail" name="_heapmaxavail">,
1245 <ref id="_heapmemavail" name="_heapmemavail">,
1246 <ref id="free" name="free">,
1247 <ref id="malloc" name="malloc">,
1248 <ref id="realloc" name="realloc">
1254 <sect1>cclear<label id="cclear"><p>
1258 <tag/Function/Clear part of a line (write a given number of spaces).
1259 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1260 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
1261 <tag/Description/The function clears part of a line by writing <tt/length/
1262 spaces in the current text color.
1263 <tag/Limits/<itemize>
1264 <item>The function is only available as fastcall function, so it may
1265 only be used in presence of a prototype.
1267 <tag/Availability/cc65
1269 <ref id="cclearxy" name="cclearxy">,
1270 <ref id="clrscr" name="clrscr">
1276 <sect1>cclearxy<label id="cclearxy"><p>
1280 <tag/Function/Clear part of a line (write a given number of spaces) starting
1281 at a specific screen position.
1282 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1283 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
1284 <tag/Description/The function moves the cursor to a specific position, and
1285 will then clear part of the line by writing <tt/length/ spaces in the current
1287 <tag/Limits/<itemize>
1288 <item>The function is only available as fastcall function, so it may
1289 only be used in presence of a prototype.
1291 <tag/Availability/cc65
1293 <ref id="cclear" name="cclear">,
1294 <ref id="clrscr" name="clrscr">
1300 <sect1>cgetc<label id="cgetc"><p>
1304 <tag/Function/Read a character from the keyboard.
1305 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1306 <tag/Declaration/<tt/char cgetc (void);/
1307 <tag/Description/The function reads a character from the keyboard. If there is
1308 no character available, <tt/cgetc/ waits until the user presses a key. If the
1309 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
1310 displayed while waiting.
1311 <tag/Limits/<itemize>
1312 <item>If the system supports a keyboard buffer, <tt/cgetc/ will fetch a key
1313 from this buffer and wait only if the buffer is empty.
1315 <tag/Availability/cc65
1317 <ref id="cursor" name="cursor">,
1318 <ref id="kbhit" name="kbhit">
1324 <sect1>chline<label id="chline"><p>
1328 <tag/Function/Output a horizontal line in text mode.
1329 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1330 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
1331 <tag/Description/The function outputs a horizontal line with the given length
1332 starting at the current cursor position.
1333 <tag/Limits/<itemize>
1334 <item>The character used to draw the horizontal line is system dependent.
1335 If available, a line drawing character is used. Drawing a line that is partially
1336 off screen leads to undefined behaviour.
1337 <item>The function is only available as fastcall function, so it may only be
1338 used in presence of a prototype.
1340 <tag/Availability/cc65
1342 <ref id="chlinexy" name="chlinexy">,
1343 <ref id="cvline" name="cvline">,
1344 <ref id="cvlinexy" name="cvlinexy">
1350 <sect1>chlinexy<label id="chlinexy"><p>
1354 <tag/Function/Output a horizontal line at a given position in text mode.
1355 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1356 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
1357 <tag/Description/The function outputs a horizontal line with the given length
1358 starting at a given position.
1359 <tag/Limits/<itemize>
1360 <item>The character used to draw the horizontal line is system dependent.
1361 If available, a line drawing character is used. Drawing a line that is partially
1362 off screen leads to undefined behaviour.
1363 <item>The function is only available as fastcall function, so it may only be
1364 used in presence of a prototype.
1366 <tag/Availability/cc65
1368 <ref id="chline" name="chline">,
1369 <ref id="cvline" name="cvline">,
1370 <ref id="cvlinexy" name="cvlinexy">
1376 <sect1>clearerr<label id="clearerr"><p>
1380 <tag/Function/Clear error and end-of-file status of a stream.
1381 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1382 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
1383 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
1384 indicators for the stream <tt/f/.
1385 <tag/Limits/<itemize>
1386 <item>The function is only available as fastcall function, so it may only be
1387 used in presence of a prototype.
1389 <tag/Availability/ISO 9899
1391 <ref id="feof" name="feof">,
1392 <ref id="ferror" name="ferror">
1398 <sect1>clrscr<label id="clrscr"><p>
1402 <tag/Function/Clear the text screen.
1403 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1404 <tag/Declaration/<tt/void clrscr (void);/
1405 <tag/Description/The function clears the text screen and moves the cursor to
1406 the upper left corner.
1407 <tag/Availability/cc65
1409 <ref id="cclear" name="cclear">,
1410 <ref id="cclearxy" name="cclearxy">
1416 <sect1>close<label id="close"><p>
1420 <tag/Function/Close a file descriptor.
1421 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1422 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
1423 <tag/Description/The function closes the given file descriptor. It returns zero
1424 on success and -1 on error. If an error occurs, the cause can be determined by
1425 reading the <tt/errno/ variable.
1426 <tag/Limits/<itemize>
1427 <item>The function is only available as fastcall function, so it may only
1428 be used in presence of a prototype.
1430 <tag/Availability/POSIX 1003.1
1432 <ref id="creat" name="creat">,
1433 <ref id="open" name="open">
1439 <sect1>creat<label id="creat"><p>
1443 <tag/Function/Create a file.
1444 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1445 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
1446 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
1447 associated with it. On error, -1 is returned and an error code is stored in
1449 <tag/Limits/<itemize>
1450 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
1451 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
1452 <item>The function is only available as fastcall function, so it may only
1453 be used in presence of a prototype.
1455 <tag/Availability/POSIX 1003.1
1457 <ref id="close" name="close">,
1458 <ref id="open" name="open">
1464 <sect1>cprintf<label id="cprintf"><p>
1468 <tag/Function/Formatted output to the console.
1469 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1470 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
1471 <tag/Description/The arguments are converted to text where necessary and
1472 formatted according to the format string given. The resulting string is output
1473 to the console. <tt/cprintf/ supports the same format specifiers as
1474 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
1475 <tag/Limits/<itemize>
1476 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
1477 between <tt/\r/ and <tt/\n/.
1479 <tag/Availability/cc65
1481 <ref id="cputc" name="cputc">,
1482 <ref id="cputcxy" name="cputcxy">,
1483 <ref id="cputs" name="cputs">,
1484 <ref id="cputsxy" name="cputsxy">,
1485 <ref id="vcprintf" name="vcprintf">
1491 <sect1>cputc<label id="cputc"><p>
1495 <tag/Function/Output a character directly to the console.
1496 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1497 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
1498 <tag/Description/Output one character to the console at the current cursor
1500 <tag/Limits/<itemize>
1501 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
1502 between <tt/\r/ and <tt/\n/.
1503 <item>The function is only available as fastcall function, so it may only
1504 be used in presence of a prototype.
1506 <tag/Availability/cc65
1508 <ref id="cprintf" name="cprintf">,
1509 <ref id="cputcxy" name="cputcxy">,
1510 <ref id="cputs" name="cputs">,
1511 <ref id="cputsxy" name="cputsxy">,
1512 <ref id="vcprintf" name="vcprintf">
1518 <sect1>cputcxy<label id="cputcxy"><p>
1522 <tag/Function/Output a character at a specific screen position.
1523 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1524 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
1525 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
1526 the screen and outputs one character.
1527 <tag/Limits/<itemize>
1528 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
1529 between <tt/\r/ and <tt/\n/.
1530 <item>The function is only available as fastcall function, so it may only
1531 be used in presence of a prototype.
1533 <tag/Availability/cc65
1535 <ref id="cprintf" name="cprintf">,
1536 <ref id="cputc" name="cputc">,
1537 <ref id="cputs" name="cputs">,
1538 <ref id="cputsxy" name="cputsxy">,
1539 <ref id="vcprintf" name="vcprintf">
1545 <sect1>cputs<label id="cputs"><p>
1549 <tag/Function/Output a string directly to the console.
1550 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1551 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
1552 <tag/Description/The function outputs the given string on the console at the
1553 current cursor position.
1554 <tag/Limits/<itemize>
1555 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
1556 between <tt/\r/ and <tt/\n/.
1557 <item>The function is only available as fastcall function, so it may only
1558 be used in presence of a prototype.
1560 <tag/Availability/cc65
1562 <ref id="cprintf" name="cprintf">,
1563 <ref id="cputc" name="cputc">,
1564 <ref id="cputcxy" name="cputcxy">,
1565 <ref id="cputsxy" name="cputsxy">,
1566 <ref id="vcprintf" name="vcprintf">
1572 <sect1>cputsxy<label id="cputsxy"><p>
1576 <tag/Function/Output a string to the console at a given position.
1577 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1578 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
1579 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
1580 and outputs the string <tt/s/.
1581 <tag/Limits/<itemize>
1582 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
1583 between <tt/\r/ and <tt/\n/.
1584 <item>The function is only available as fastcall function, so it may only
1585 be used in presence of a prototype.
1587 <tag/Availability/cc65
1589 <ref id="cprintf" name="cprintf">,
1590 <ref id="cputc" name="cputc">,
1591 <ref id="cputcxy" name="cputcxy">,
1592 <ref id="cputs" name="cputs">,
1593 <ref id="vcprintf" name="vcprintf">
1599 <sect1>cursor<label id="cursor"><p>
1603 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
1604 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1605 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
1606 <tag/Description/If the argument to the function is non zero, a blinking cursor
1607 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
1608 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
1609 <tag/Limits/<itemize>
1610 <item>The function is only available as fastcall function, so it may only
1611 be used in presence of a prototype.
1613 <tag/Availability/cc65
1615 <ref id="cgetc" name="cgetc">,
1616 <ref id="kbhit" name="kbhit">
1622 <sect1>cvline<label id="cvline"><p>
1626 <tag/Function/Output a vertical line in text mode.
1627 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1628 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
1629 <tag/Description/The function outputs a vertical line with the given length
1630 starting at the current cursor position.
1631 <tag/Limits/<itemize>
1632 <item>The character used to draw the vertical line is system dependent.
1633 If available, a line drawing character is used. Drawing a line that is partially
1634 off screen leads to undefined behaviour.
1635 <item>The function is only available as fastcall function, so it may only be
1636 used in presence of a prototype.
1638 <tag/Availability/cc65
1640 <ref id="chline" name="chline">,
1641 <ref id="chlinexy" name="chlinexy">,
1642 <ref id="cvlinexy" name="cvlinexy">
1648 <sect1>cvlinexy<label id="cvlinexy"><p>
1652 <tag/Function/Output a vertical line at a given position in text mode.
1653 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1654 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
1655 <tag/Description/The function outputs a vertical line with the given length
1656 starting at a given position.
1657 <tag/Limits/<itemize>
1658 <item>The character used to draw the vertical line is system dependent.
1659 If available, a line drawing character is used. Drawing a line that is partially
1660 off screen leads to undefined behaviour.
1661 <item>The function is only available as fastcall function, so it may only be
1662 used in presence of a prototype.
1664 <tag/Availability/cc65
1666 <ref id="chline" name="chline">,
1667 <ref id="chlinexy" name="chlinexy">,
1668 <ref id="cvline" name="cvline">
1674 <sect1>div<label id="div"><p>
1678 <tag/Function/Divide two ints and return quotient and remainder.
1679 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1680 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
1681 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
1682 quotient and remainder in a <tt/div_t/ structure.
1685 <item>The function is only available as fastcall function, so it may only
1686 be used in presence of a prototype.
1688 <tag/Availability/ISO 9899
1696 <sect1>em_commit<label id="em_commit"><p>
1700 <tag/Function/Commit changes into extended memory.
1701 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1702 <tag/Declaration/<tt/void __fastcall__ em_commit (void);/
1703 <tag/Description/Commit changes in the memory window to extended storage. If
1704 the contents of the memory window have been changed, these changes may be lost
1705 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
1706 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
1707 name="em_copyto">/ are called without calling <tt/em_commit/ first.
1708 <tag/Limits/<itemize>
1709 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
1710 memory window are discarded, it does just mean that the drivers is allowed
1712 <item>The function is only available as fastcall function, so it may only be
1713 used in presence of a prototype.
1714 <item>The function produces undefined results if no extended memory driver is
1717 <tag/Availability/cc65
1719 <ref id="em_load_driver" name="em_load_driver">,
1720 <ref id="em_map" name="em_map">,
1721 <ref id="em_use" name="em_use">
1727 <sect1>em_copyfrom<label id="em_copyfrom"><p>
1731 <tag/Function/Copy from extended into normal memory.
1732 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1733 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
1734 <tag/Description/Copy data from extended memory into linear memory. Source and
1735 target addresses as well as the number of bytes to transfer are specified in
1736 the <tt/em_copy/ structure that is passed as a parameter.
1737 <tag/Limits/<itemize>
1738 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
1739 made any changes to the data in the window, call <tt/<ref id="em_commit"
1740 name="em_commit">/ first, or the changes are lost.
1741 <item>The function is only available as fastcall function, so it may only be
1742 used in presence of a prototype.
1743 <item>The function produces undefined results if no extended memory driver is
1746 <tag/Availability/cc65
1748 <ref id="em_commit" name="em_commit">,
1749 <ref id="em_copyto" name="em_copyto">,
1750 <ref id="em_load_driver" name="em_load_driver">
1756 <sect1>em_copyto<label id="em_copyto"><p>
1760 <tag/Function/Copy from normal into extended memory.
1761 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1762 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
1763 <tag/Description/Copy data from linear into extended memory. Source and
1764 target addresses as well as the number of bytes to transfer are specified in
1765 the <tt/em_copy/ structure that is passed as a parameter.
1766 <tag/Limits/<itemize>
1767 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
1768 made any changes to the data in the window, call <tt/<ref id="em_commit"
1769 name="em_commit">/ first, or the changes are lost.
1770 <item>The function is only available as fastcall function, so it may only be
1771 used in presence of a prototype.
1772 <item>The function produces undefined results if no extended memory driver is
1775 <tag/Availability/cc65
1777 <ref id="em_commit" name="em_commit">,
1778 <ref id="em_copyfrom" name="em_copyfrom">,
1779 <ref id="em_load_driver" name="em_load_driver">
1785 <sect1>em_install<label id="em_install"><p>
1789 <tag/Function/Install an already loaded extended memory driver.
1790 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1791 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
1792 <tag/Description/The function installs an already loaded extended memory driver
1793 and returns an error code. The function may be used to install a driver linked
1794 statically to the program.
1795 <tag/Limits/<itemize>
1796 <item>Not all drivers are able to detect if the supported hardware is really
1798 <item>The function is only available as fastcall function, so it may only be
1799 used in presence of a prototype.
1801 <tag/Availability/cc65
1803 <ref id="em_load_driver" name="em_load_driver">,
1804 <ref id="em_uninstall" name="em_uninstall">,
1805 <ref id="em_unload" name="em_unload">
1811 <sect1>em_load_driver<label id="em_load_driver"><p>
1815 <tag/Function/Load and initialize an extended memory driver.
1816 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1817 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
1818 <tag/Description/Load an extended memory driver into memory and initialize
1819 it. The function returns an error code that tells if all this has been
1821 <tag/Limits/<itemize>
1822 <item>Not all drivers are able to detect if the supported hardware is really
1824 <item>The function is only available as fastcall function, so it may only be
1825 used in presence of a prototype.
1826 <item>The driver is loaded by name, so currently you must know the type of
1827 extended memory that should be supported. There is no autodetect capability.
1829 <tag/Availability/cc65
1831 <ref id="em_unload" name="em_unload">
1837 <sect1>em_map<label id="em_map"><p>
1841 <tag/Function/Make a page of extended memory accessible.
1842 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1843 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
1844 <tag/Description/The function maps one page of extended memory into linear
1845 memory and returns a pointer to the page frame. Depending on the hardware
1846 and driver, the data is either mapped into the address space or transfered
1847 into a buffer. If you don't need the actual contents of the page (for example
1848 because you're going to overwrite it completely, it is better to call
1849 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
1850 data if it is possible to avoid that.
1851 <tag/Limits/<itemize>
1852 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
1853 made any changes to the data in the window, call <tt/<ref id="em_commit"
1854 name="em_commit">/ first, or the changes are lost.
1855 <item>The function is only available as fastcall function, so it may only be
1856 used in presence of a prototype.
1857 <item>The function produces undefined results if no extended memory driver is
1860 <tag/Availability/cc65
1862 <ref id="em_commit" name="em_commit">,
1863 <ref id="em_load_driver" name="em_load_driver">,
1864 <ref id="em_use" name="em_use">
1870 <sect1>em_pagecount<label id="em_pagecount"><p>
1874 <tag/Function/Return the number of available extended memory pages.
1875 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1876 <tag/Declaration/<tt/unsigned __fastcall__ em_pagecount (void);/
1877 <tag/Description/The function returns the size of the extended memory supported
1878 by the driver in 256 byte pages.
1879 <tag/Limits/<itemize>
1880 <item>The function returns zero if no extended memory driver is loaded.
1881 <item>The function may return zero if the supported hardware was not detected.
1883 <tag/Availability/cc65
1885 <ref id="em_load_driver" name="em_load_driver">
1891 <sect1>em_uninstall<label id="em_uninstall"><p>
1895 <tag/Function/Uninstall an already loaded extended memory driver.
1896 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1897 <tag/Declaration/<tt/unsigned char __fastcall__ em_install (void);/
1898 <tag/Description/The function uninstalls an already loaded extended memory
1899 driver but doesn't remove it from memory.
1900 <tag/Limits/<itemize>
1901 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
1902 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
1903 should be used instead of <tt/em_uninstall/ so the driver is also removed
1905 <item>The function is only available as fastcall function, so it may only be
1906 used in presence of a prototype.
1908 <tag/Availability/cc65
1910 <ref id="em_install" name="em_install">,
1911 <ref id="em_load_driver" name="em_load_driver">,
1912 <ref id="em_unload" name="em_unload">
1918 <sect1>em_unload<label id="em_unload"><p>
1922 <tag/Function/Unload an extended memory driver.
1923 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1924 <tag/Declaration/<tt/unsigned char __fastcall__ em_unload (void);/
1925 <tag/Description/The function unloads a loaded extended memory driver and
1926 frees all memory allocated for the driver.
1927 <tag/Limits/<itemize>
1928 <item>The function does nothing if no driver is loaded.
1930 <tag/Availability/cc65
1932 <ref id="em_load_driver" name="em_load_driver">
1938 <sect1>em_use<label id="em_use"><p>
1942 <tag/Function/Prepare an extended memory page for use.
1943 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1944 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
1945 <tag/Description/The function maps one page of extended memory into linear
1946 memory and returns a pointer to the page frame. This function is similar to
1947 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
1948 actual memory window in the assumption that the existing data is wrong or
1949 will get overwritten.
1950 <tag/Limits/<itemize>
1951 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
1952 made any changes to the data in the window, call <tt/<ref id="em_commit"
1953 name="em_commit">/ first, or the changes are lost.
1954 <item>The function is only available as fastcall function, so it may only be
1955 used in presence of a prototype.
1956 <item>The function produces undefined results if no extended memory driver is
1959 <tag/Availability/cc65
1961 <ref id="em_commit" name="em_commit">,
1962 <ref id="em_load_driver" name="em_load_driver">,
1963 <ref id="em_map" name="em_map">
1969 <sect1>exit<label id="exit"><p>
1973 <tag/Function/Terminate the program.
1974 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1975 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
1976 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
1977 return code of the program. Before termination, all files are closed, buffered
1978 output is written and any functions registered with <tt/<ref id="atexit"
1979 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
1980 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
1982 <tag/Limits/<itemize>
1983 <item>The function is only available as fastcall function, so it may only
1984 be used in presence of a prototype.
1985 <item>It depends on the host machine if the program return code can be
1986 evaluated or is ignored.
1988 <tag/Availability/ISO 9899
1990 <ref id="abort" name="abort">,
1991 <ref id="exit" name="exit">
1997 <sect1>fast<label id="fast"><p>
2001 <tag/Function/Switch the C128 into 2MHz mode.
2002 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
2003 <tag/Declaration/<tt/void fast (void);/
2004 <tag/Description/The function will switch the clock of the C128 to 2MHz. This
2005 will nearly double the speed compared to slow mode.
2006 <tag/Limits/<itemize>
2007 <item>The function is specific to the C128.
2008 <item>2MHz clock will not work in 40 column mode.
2010 <tag/Availability/C128
2012 <ref id="slow" name="slow">,
2013 <ref id="toggle_videomode" name="toggle_videomode">,
2014 <ref id="videomode" name="videomode">
2020 <sect1>feof<label id="feof"><p>
2024 <tag/Function/Return the end-of-file indicator of a stream.
2025 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2026 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
2027 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
2028 <tt/f/, and returns a non zero value if it is set.
2029 <tag/Limits/<itemize>
2030 <item>The indicator is set only after a read past the end of a file is
2032 <item>The function is only available as fastcall function, so it may only be
2033 used in presence of a prototype.
2035 <tag/Availability/ISO 9899
2037 <ref id="feof" name="clearerr">,
2038 <ref id="ferror" name="ferror">
2044 <sect1>ferror<label id="ferror"><p>
2048 <tag/Function/Return the error indicator of a stream.
2049 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2050 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
2051 <tag/Description/<tt/ferror/ tests the error indicator of the stream
2052 <tt/f/, and returns a non zero value if it is set.
2053 <tag/Limits/<itemize>
2054 <item>The function is only available as fastcall function, so it may only be
2055 used in presence of a prototype.
2057 <tag/Availability/ISO 9899
2059 <ref id="feof" name="clearerr">,
2060 <ref id="ferror" name="feof">
2066 <sect1>fileno<label id="fileno"><p>
2070 <tag/Function/Return the file handle used by a stream.
2071 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2072 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
2073 <tag/Description/The <tt/fileno/ function returns the file handle used
2074 internally by a C stream. This file handle (an integer) can be used as a
2075 handle for the POSIX input/output functions.
2076 <tag/Limits/<itemize>
2077 <item>The function is only available as fastcall function, so it may only be
2078 used in presence of a prototype.
2079 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
2080 file may have unpredictable results.
2082 <tag/Availability/POSIX 1003.1
2084 <ref id="creat" name="creat">,
2085 <ref id="open" name="open"> <!-- , -->
2086 <!-- <ref id="read" name="read">, -->
2087 <!-- <ref id="write" name="write"> -->
2093 <sect1>free<label id="free"><p>
2097 <tag/Function/Free a block of dynamic memory.
2098 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2099 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
2100 <tag/Description/Free a block of dynamic memory previously allocated with
2101 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
2102 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
2103 pointer is <tt/NULL/, no action is performed.
2106 <item>Passing an already free'd block to <tt/free/ again will cause undefined
2107 behaviour and may crash your program.
2108 <item>The function is only available as fastcall function, so it may only
2109 be used in presence of a prototype.
2111 <tag/Availability/ISO 9899
2113 <ref id="_heapadd" name="_heapadd">,
2114 <ref id="_heapblocksize" name="_heapblocksize">,
2115 <ref id="_heapmaxavail" name="_heapmaxavail">,
2116 <ref id="_heapmemavail" name="_heapmemavail">,
2117 <ref id="calloc" name="calloc">,
2118 <ref id="malloc" name="malloc">,
2119 <ref id="realloc" name="realloc">
2125 <sect1>get_ostype<label id="get_ostype"><p>
2129 <tag/Function/The function returns the operating system, the program runs on.
2130 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
2131 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
2132 <tag/Declaration/<tt/unsigned char get_ostype (void);/
2133 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
2134 all supported targets. If it exists, it returns a number that identifies the
2135 operating system or machine type, the program runs on. The machine dependent
2136 header files define constants that can be used to check the return code.
2137 <tag/Limits/<itemize>
2138 <item>The function does not exist on all platforms.
2139 <item>The return codes are platform dependent.
2141 <tag/Availability/cc65 (not all platforms)
2147 <sect1>getenv<label id="getenv"><p>
2151 <tag/Function/Return a value from the environment.
2152 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2153 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
2154 <tag/Description/The function searches the environment for an entry that
2155 matches <tt/name/ and returns its value. The environment consists of a list
2156 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
2158 <tag/Limits/<itemize>
2159 <item>What exactly is stored in the environment depends on the machine the
2160 program is running on.
2161 <item>The function is only available as fastcall function, so it may only
2162 be used in presence of a prototype.
2164 <tag/Availability/ISO 9899
2170 <sect1>getcpu<label id="getcpu"><p>
2174 <tag/Function/Determine on which CPU the program is running.
2175 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
2176 <tag/Declaration/<tt/unsigned char getcpu (void);/
2177 <tag/Description/The function checks on which CPU the code is running. It
2178 returns one of the constants<itemize>
2180 <item><tt/CPU_65C02/
2181 <item><tt/CPU_65816/
2183 <tag/Limits/<itemize>
2184 <item>Other, more exotic CPU types are not disinguished.
2186 <tag/Availability/cc65
2192 <sect1>gotox<label id="gotox"><p>
2196 <tag/Function/Move the text mode cursor to a new X position.
2197 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2198 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
2199 <tag/Description/The function moves the text mode cursor to the specified X
2200 position while leaving the Y position untouched. The leftmost position on the
2201 screen has the coordinate 0.
2202 <tag/Limits/<itemize>
2203 <item>The function is only available as fastcall function, so it may
2204 only be used in presence of a prototype.
2205 <item>Invalid values for the X position (out of screen coordinates) may
2206 lead to undefined behaviour.
2208 <tag/Availability/cc65
2210 <ref id="gotoy" name="gotoy">,
2211 <ref id="gotoxy" name="gotoxy">,
2212 <ref id="wherex" name="wherex">,
2213 <ref id="wherey" name="wherey">
2219 <sect1>gotoxy<label id="gotoxy"><p>
2223 <tag/Function/Move the text mode cursor to a new position.
2224 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2225 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
2226 <tag/Description/The function moves the text mode cursor to the specified
2227 position. The leftmost position on the screen has the X coordinate 0, the
2228 topmost line has the Y coordinate 0.
2229 <tag/Limits/<itemize>
2230 <item>The function is only available as fastcall function, so it may only be
2231 used in presence of a prototype.
2232 <item>Invalid values for any of both coordinates (out of screen positions) may
2233 lead to undefined behaviour.
2235 <tag/Availability/cc65
2237 <ref id="gotox" name="gotox">,
2238 <ref id="gotoy" name="gotoy">,
2239 <ref id="wherex" name="wherex">,
2240 <ref id="wherey" name="wherey">
2246 <sect1>gotoy<label id="gotoy"><p>
2250 <tag/Function/Move the text mode cursor to a new Y position.
2251 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2252 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
2253 <tag/Description/The function moves the text mode cursor to the specified Y
2254 position while leaving the X position untouched. The uppermost position on the
2255 screen has the coordinate 0.
2256 <tag/Limits/<itemize>
2257 <item>The function is only available as fastcall function, so it may
2258 only be used in presence of a prototype.
2259 <item>Invalid values for the Y position (out of screen coordinates) may lead
2260 to undefined behaviour.
2262 <tag/Availability/cc65
2264 <ref id="gotox" name="gotox">,
2265 <ref id="gotoxy" name="gotoxy">,
2266 <ref id="wherex" name="wherex">,
2267 <ref id="wherey" name="wherey">
2273 <sect1>isalnum<label id="isalnum"><p>
2277 <tag/Function/Check if a given character is a letter or digit.
2278 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2279 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
2280 <tag/Description/The function returns a value of zero if the given argument
2281 is a letter or digit. The return value is non zero if the character
2283 <tag/Limits/<itemize>
2284 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2285 inline sequence generated by the macro will not work correctly for values
2286 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2287 this range. The non inline function may be accessed by <tt/#undef/'ing
2289 <item>When compiling without <tt/-Os/, the function is only available as
2290 fastcall function, so it may only be used in presence of a prototype.
2292 <tag/Availability/ISO 9899
2294 <ref id="isalpha" name="isalpha">,
2295 <ref id="isascii" name="isascii">,
2296 <ref id="isblank" name="isblank">,
2297 <ref id="iscntrl" name="iscntrl">,
2298 <ref id="isdigit" name="isdigit">,
2299 <ref id="isgraph" name="isgraph">,
2300 <ref id="islower" name="islower">,
2301 <ref id="isprint" name="isprint">,
2302 <ref id="ispunct" name="ispunct">,
2303 <ref id="isspace" name="isspace">,
2304 <ref id="isupper" name="isupper">,
2305 <ref id="isxdigit" name="isxdigit">
2311 <sect1>isalpha<label id="isalpha"><p>
2315 <tag/Function/Check if a given character is a letter.
2316 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2317 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
2318 <tag/Description/The function returns a value of zero if the given argument
2319 is a letter. The return value is non zero if the character is anything else.
2320 <tag/Limits/<itemize>
2321 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2322 inline sequence generated by the macro will not work correctly for values
2323 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2324 this range. The non inline function may be accessed by <tt/#undef/'ing the
2326 <item>When compiling without <tt/-Os/, the function is only available as
2327 fastcall function, so it may only be used in presence of a prototype.
2329 <tag/Availability/ISO 9899
2331 <ref id="isalnum" name="isalnum">,
2332 <ref id="isascii" name="isascii">,
2333 <ref id="isblank" name="isblank">,
2334 <ref id="iscntrl" name="iscntrl">,
2335 <ref id="isdigit" name="isdigit">,
2336 <ref id="isgraph" name="isgraph">,
2337 <ref id="islower" name="islower">,
2338 <ref id="isprint" name="isprint">,
2339 <ref id="ispunct" name="ispunct">,
2340 <ref id="isspace" name="isspace">,
2341 <ref id="isupper" name="isupper">,
2342 <ref id="isxdigit" name="isxdigit">
2348 <sect1>isascii<label id="isascii"><p>
2352 <tag/Function/Check if a given character is in the ASCII (0..127) range.
2353 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2354 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
2355 <tag/Description/The function returns a value of zero if the given argument
2356 is in the range 0..127 (the range of valid ASCII characters) and a non zero
2358 <tag/Limits/<itemize>
2359 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2360 inline sequence generated by the macro will not work correctly for values
2361 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2362 this range. The non inline function may be accessed by <tt/#undef/'ing the
2364 <item>When compiling without <tt/-Os/, the function is only available as
2365 fastcall function, so it may only be used in presence of a prototype.
2367 <tag/Availability/ISO 9899
2369 <ref id="isalnum" name="isalnum">,
2370 <ref id="isalpha" name="isalpha">,
2371 <ref id="isblank" name="isblank">,
2372 <ref id="iscntrl" name="iscntrl">,
2373 <ref id="isdigit" name="isdigit">,
2374 <ref id="isgraph" name="isgraph">,
2375 <ref id="islower" name="islower">,
2376 <ref id="isprint" name="isprint">,
2377 <ref id="ispunct" name="ispunct">,
2378 <ref id="isspace" name="isspace">,
2379 <ref id="isupper" name="isupper">,
2380 <ref id="isxdigit" name="isxdigit">
2386 <sect1>isblank<label id="isblank"><p>
2390 <tag/Function/Check if a given character is a space or tab.
2391 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2392 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
2393 <tag/Description/The function returns a value of zero if the given argument
2394 is a space or tab character. The return value is non zero if the character
2396 <tag/Limits/<itemize>
2397 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2398 inline sequence generated by the macro will not work correctly for values
2399 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2400 this range. The non inline function may be accessed by <tt/#undef/'ing the
2402 <item>When compiling without <tt/-Os/, the function is only available as
2403 fastcall function, so it may only be used in presence of a prototype.
2405 <tag/Availability/cc65
2407 <ref id="isalnum" name="isalnum">,
2408 <ref id="isalpha" name="isalpha">,
2409 <ref id="isascii" name="isascii">,
2410 <ref id="iscntrl" name="iscntrl">,
2411 <ref id="isdigit" name="isdigit">,
2412 <ref id="isgraph" name="isgraph">,
2413 <ref id="islower" name="islower">,
2414 <ref id="isprint" name="isprint">,
2415 <ref id="ispunct" name="ispunct">,
2416 <ref id="isspace" name="isspace">,
2417 <ref id="isupper" name="isupper">,
2418 <ref id="isxdigit" name="isxdigit">
2424 <sect1>iscntrl<label id="iscntrl"><p>
2428 <tag/Function/Check if a given character is a control character.
2429 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2430 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
2431 <tag/Description/The function returns a value of zero if the given argument
2432 is a control character. The return value is non zero if the character
2434 <tag/Limits/<itemize>
2435 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2436 inline sequence generated by the macro will not work correctly for values
2437 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2438 this range. The non inline function may be accessed by <tt/#undef/'ing the
2440 <item>When compiling without <tt/-Os/, the function is only available as
2441 fastcall function, so it may only be used in presence of a prototype.
2443 <tag/Availability/ISO 9899
2445 <ref id="isalnum" name="isalnum">,
2446 <ref id="isalpha" name="isalpha">,
2447 <ref id="isascii" name="isascii">,
2448 <ref id="isblank" name="isblank">,
2449 <ref id="isdigit" name="isdigit">,
2450 <ref id="isgraph" name="isgraph">,
2451 <ref id="islower" name="islower">,
2452 <ref id="isprint" name="isprint">,
2453 <ref id="ispunct" name="ispunct">,
2454 <ref id="isspace" name="isspace">,
2455 <ref id="isupper" name="isupper">,
2456 <ref id="isxdigit" name="isxdigit">
2462 <sect1>isdigit<label id="isdigit"><p>
2466 <tag/Function/Check if a given character is a digit.
2467 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2468 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
2469 <tag/Description/The function returns a value of zero if the given argument
2470 is a digit. The return value is non zero if the character is anything else.
2471 <tag/Limits/<itemize>
2472 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2473 inline sequence generated by the macro will not work correctly for values
2474 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2475 this range. The non inline function may be accessed by <tt/#undef/'ing the
2477 <item>When compiling without <tt/-Os/, the function is only available as
2478 fastcall function, so it may only be used in presence of a prototype.
2480 <tag/Availability/ISO 9899
2482 <ref id="isalnum" name="isalnum">,
2483 <ref id="isalpha" name="isalpha">,
2484 <ref id="isascii" name="isascii">,
2485 <ref id="isblank" name="isblank">,
2486 <ref id="iscntrl" name="iscntrl">,
2487 <ref id="isgraph" name="isgraph">,
2488 <ref id="islower" name="islower">,
2489 <ref id="isprint" name="isprint">,
2490 <ref id="ispunct" name="ispunct">,
2491 <ref id="isspace" name="isspace">,
2492 <ref id="isupper" name="isupper">,
2493 <ref id="isxdigit" name="isxdigit">
2499 <sect1>isgraph<label id="isgraph"><p>
2503 <tag/Function/Check if a given character is a printable character (except
2505 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2506 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
2507 <tag/Description/The function returns a value of zero if the given argument
2508 is a printable character with the exception of space. The return value is non
2509 zero if the character is anything else.
2510 <tag/Limits/<itemize>
2511 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2512 inline sequence generated by the macro will not work correctly for values
2513 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2514 this range. The non inline function may be accessed by <tt/#undef/'ing the
2516 <item>When compiling without <tt/-Os/, the function is only available as
2517 fastcall function, so it may only be used in presence of a prototype.
2519 <tag/Availability/ISO 9899
2521 <ref id="isalnum" name="isalnum">,
2522 <ref id="isalpha" name="isalpha">,
2523 <ref id="isascii" name="isascii">,
2524 <ref id="isblank" name="isblank">,
2525 <ref id="iscntrl" name="iscntrl">,
2526 <ref id="isdigit" name="isdigit">,
2527 <ref id="islower" name="islower">,
2528 <ref id="isprint" name="isprint">,
2529 <ref id="ispunct" name="ispunct">,
2530 <ref id="isspace" name="isspace">,
2531 <ref id="isupper" name="isupper">,
2532 <ref id="isxdigit" name="isxdigit">
2538 <sect1>islower<label id="islower"><p>
2542 <tag/Function/Check if a given character is a lower case letter.
2543 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2544 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
2545 <tag/Description/The function returns a value of zero if the given argument
2546 is a lower case letter. The return value is non zero if the character is
2548 <tag/Limits/<itemize>
2549 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2550 inline sequence generated by the macro will not work correctly for values
2551 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2552 this range. The non inline function may be accessed by <tt/#undef/'ing the
2554 <item>When compiling without <tt/-Os/, the function is only available as
2555 fastcall function, so it may only be used in presence of a prototype.
2557 <tag/Availability/ISO 9899
2559 <ref id="isalnum" name="isalnum">,
2560 <ref id="isalpha" name="isalpha">,
2561 <ref id="isascii" name="isascii">,
2562 <ref id="isblank" name="isblank">,
2563 <ref id="iscntrl" name="iscntrl">,
2564 <ref id="isdigit" name="isdigit">,
2565 <ref id="isgraph" name="isgraph">,
2566 <ref id="isprint" name="isprint">,
2567 <ref id="ispunct" name="ispunct">,
2568 <ref id="isspace" name="isspace">,
2569 <ref id="isupper" name="isupper">,
2570 <ref id="isxdigit" name="isxdigit">
2576 <sect1>isprint<label id="isprint"><p>
2580 <tag/Function/Check if a given character is a printable character.
2581 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2582 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
2583 <tag/Description/The function returns a value of zero if the given argument
2584 is a printable character (this includes the space character). The return value
2585 is non zero if the character is anything else.
2586 <tag/Limits/<itemize>
2587 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2588 inline sequence generated by the macro will not work correctly for values
2589 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2590 this range. The non inline function may be accessed by <tt/#undef/'ing the
2592 <item>When compiling without <tt/-Os/, the function is only available as
2593 fastcall function, so it may only be used in presence of a prototype.
2595 <tag/Availability/ISO 9899
2597 <ref id="isalnum" name="isalnum">,
2598 <ref id="isalpha" name="isalpha">,
2599 <ref id="isascii" name="isascii">,
2600 <ref id="isblank" name="isblank">,
2601 <ref id="iscntrl" name="iscntrl">,
2602 <ref id="isdigit" name="isdigit">,
2603 <ref id="isgraph" name="isgraph">,
2604 <ref id="islower" name="islower">,
2605 <ref id="ispunct" name="ispunct">,
2606 <ref id="isspace" name="isspace">,
2607 <ref id="isupper" name="isupper">,
2608 <ref id="isxdigit" name="isxdigit">
2614 <sect1>ispunct<label id="ispunct"><p>
2618 <tag/Function/Check if a given character is a printable character but not a
2619 space or an alphanumeric character.
2620 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2621 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
2622 <tag/Description/The function returns a value of zero if the given argument
2623 is a printable character, but not a space or anything alphanumeric. The return
2624 value is non zero if the character is anything else.
2625 <tag/Limits/<itemize>
2626 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2627 inline sequence generated by the macro will not work correctly for values
2628 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2629 this range. The non inline function may be accessed by <tt/#undef/'ing the
2631 <item>When compiling without <tt/-Os/, the function is only available as
2632 fastcall function, so it may only be used in presence of a prototype.
2634 <tag/Availability/ISO 9899
2636 <ref id="isalnum" name="isalnum">,
2637 <ref id="isalpha" name="isalpha">,
2638 <ref id="isascii" name="isascii">,
2639 <ref id="isblank" name="isblank">,
2640 <ref id="iscntrl" name="iscntrl">,
2641 <ref id="isdigit" name="isdigit">,
2642 <ref id="isgraph" name="isgraph">,
2643 <ref id="islower" name="islower">,
2644 <ref id="isprint" name="isprint">,
2645 <ref id="isspace" name="isspace">,
2646 <ref id="isupper" name="isupper">,
2647 <ref id="isxdigit" name="isxdigit">
2653 <sect1>isspace<label id="isspace"><p>
2657 <tag/Function/Check if a given character is a a white-space character.
2658 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2659 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
2660 <tag/Description/The function returns a value of zero if the given argument
2661 is a white space character. The return value is non zero if the character is
2662 anything else. The standard white space characters are: space, formfeed ('\f'),
2663 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
2665 <tag/Limits/<itemize>
2666 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2667 inline sequence generated by the macro will not work correctly for values
2668 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2669 this range. The non inline function may be accessed by <tt/#undef/'ing the
2671 <item>When compiling without <tt/-Os/, the function is only available as
2672 fastcall function, so it may only be used in presence of a prototype.
2674 <tag/Availability/ISO 9899
2676 <ref id="isalnum" name="isalnum">,
2677 <ref id="isalpha" name="isalpha">,
2678 <ref id="isascii" name="isascii">,
2679 <ref id="isblank" name="isblank">,
2680 <ref id="iscntrl" name="iscntrl">,
2681 <ref id="isdigit" name="isdigit">,
2682 <ref id="isgraph" name="isgraph">,
2683 <ref id="islower" name="islower">,
2684 <ref id="isprint" name="isprint">,
2685 <ref id="ispunct" name="ispunct">,
2686 <ref id="isupper" name="isupper">,
2687 <ref id="isxdigit" name="isxdigit">
2693 <sect1>isupper<label id="isupper"><p>
2697 <tag/Function/Check if a given character is an upper case letter.
2698 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2699 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
2700 <tag/Description/The function returns a value of zero if the given argument
2701 is an upper case letter. The return value is non zero if the character is
2703 <tag/Limits/<itemize>
2704 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2705 inline sequence generated by the macro will not work correctly for values
2706 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2707 this range. The non inline function may be accessed by <tt/#undef/'ing the
2709 <item>When compiling without <tt/-Os/, the function is only available as
2710 fastcall function, so it may only be used in presence of a prototype.
2712 <tag/Availability/ISO 9899
2714 <ref id="isalnum" name="isalnum">,
2715 <ref id="isalpha" name="isalpha">,
2716 <ref id="isascii" name="isascii">,
2717 <ref id="isblank" name="isblank">,
2718 <ref id="iscntrl" name="iscntrl">,
2719 <ref id="isdigit" name="isdigit">,
2720 <ref id="isgraph" name="isgraph">,
2721 <ref id="islower" name="islower">,
2722 <ref id="isprint" name="isprint">,
2723 <ref id="ispunct" name="ispunct">,
2724 <ref id="isspace" name="isspace">,
2725 <ref id="isxdigit" name="isxdigit">
2731 <sect1>isxdigit<label id="isxdigit"><p>
2735 <tag/Function/Check if a given character is a hexadecimal digit.
2736 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2737 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
2738 <tag/Description/The function returns a value of zero if the given argument
2739 is a hexadecimal digit (0..9, a..f and A..F). The return value is non zero
2740 if the character is anything else.
2741 <tag/Limits/<itemize>
2742 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2743 inline sequence generated by the macro will not work correctly for values
2744 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2745 this range. The non inline function may be accessed by <tt/#undef/'ing the
2747 <item>When compiling without <tt/-Os/, the function is only available as
2748 fastcall function, so it may only be used in presence of a prototype.
2750 <tag/Availability/ISO 9899
2752 <ref id="isalnum" name="isalnum">,
2753 <ref id="isalpha" name="isalpha">,
2754 <ref id="isascii" name="isascii">,
2755 <ref id="isblank" name="isblank">,
2756 <ref id="iscntrl" name="iscntrl">,
2757 <ref id="isdigit" name="isdigit">,
2758 <ref id="isgraph" name="isgraph">,
2759 <ref id="islower" name="islower">,
2760 <ref id="isprint" name="isprint">,
2761 <ref id="ispunct" name="ispunct">,
2762 <ref id="isspace" name="isspace">,
2763 <ref id="isupper" name="isupper">
2769 <sect1>itoa<label id="itoa"><p>
2773 <tag/Function/Convert an integer into a string.
2774 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2775 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
2776 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
2777 <tt/radix/ as the base.
2778 <tag/Limits/<itemize>
2779 <item>There are no provisions to prevent a buffer overflow.
2780 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
2781 <item>The function is non standard, so it is not available in strict ANSI mode.
2782 You should probably use <tt/sprintf/ instead.
2783 <item>The function is only available as fastcall function, so it may only be
2784 used in presence of a prototype.
2786 <tag/Availability/cc65
2788 <ref id="atoi" name="atoi">,
2789 <ref id="atol" name="atol">,
2790 <ref id="ltoa" name="ltoa">,
2791 <ref id="ultoa" name="ultoa">,
2792 <ref id="utoa" name="utoa">
2798 <sect1>joy_count<label id="joy_count"><p>
2802 <tag/Function/Return the number of joysticks supported by the current driver.
2803 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2804 <tag/Declaration/<tt/unsigned char __fastcall__ joy_count (void);/
2805 <tag/Description/The function returns a the number of joysticks supported
2806 by the current joystick driver.
2807 <tag/Limits/<itemize>
2808 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
2809 name="joy_load_driver"> before calling this function.
2810 <item>The function returns the number of joysticks supported by the driver.
2811 There's no way to check for the number of actually connected joysticks.
2812 <item>The function is only available as fastcall function, so it may only be
2813 used in presence of a prototype.
2815 <tag/Availability/cc65
2817 <ref id="joy_load_driver" name="joy_load_driver">,
2818 <ref id="joy_read" name="joy_read">
2824 <sect1>joy_install<label id="joy_install"><p>
2828 <tag/Function/Install an already loaded driver and return an error code.
2829 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2830 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
2831 <tag/Description/The function installs a driver that was already loaded into
2832 memory (or linked statically to the program). It returns an error code
2833 (<tt/JOY_ERR_OK/ in case of success).
2834 <tag/Limits/<itemize>
2835 <item>The function is only available as fastcall function, so it may only be
2836 used in presence of a prototype.
2838 <tag/Availability/cc65
2840 <ref id="joy_load_driver" name="joy_load_driver">,
2841 <ref id="joy_uninstall" name="joy_uninstall">,
2842 <ref id="joy_unload" name="joy_unload">
2848 <sect1>joy_load_driver<label id="joy_load_driver"><p>
2852 <tag/Function/Load a driver from disk and install it.
2853 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2854 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
2855 <tag/Description/The function loads a driver with the given name from disk
2856 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
2857 driver was successfully loaded and installed.
2858 <tag/Limits/<itemize>
2859 <item>The function is only available as fastcall function, so it may only be
2860 used in presence of a prototype.
2862 <tag/Availability/cc65
2864 <ref id="joy_install" name="joy_install">,
2865 <ref id="joy_uninstall" name="joy_uninstall">,
2866 <ref id="joy_unload" name="joy_unload">
2872 <sect1>joy_read<label id="joy_read"><p>
2876 <tag/Function/Read the status of a joystick.
2877 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2878 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
2879 <tag/Description/The function reads the status bits for a joystick. The number
2880 of the joystick is passed as parameter. The result may be examined by using one
2881 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
2882 <tag/Limits/<itemize>
2883 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
2884 name="joy_load_driver"> before calling this function.
2885 <item>The function is only available as fastcall function, so it may only be
2886 used in presence of a prototype.
2888 <tag/Availability/cc65
2890 <ref id="joy_count" name="joy_count">,
2891 <ref id="joy_load_driver" name="joy_load_driver">,
2892 <ref id="joy_unload" name="joy_unload">
2898 <sect1>joy_uninstall<label id="joy_uninstall"><p>
2902 <tag/Function/Uninstall the current joystick driver.
2903 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2904 <tag/Declaration/<tt/unsigned char __fastcall__ joy_uninstall (void);/
2905 <tag/Description/The function uninstalls the currently installed joystick
2906 driver. It does not remove the driver from memory. The function returns an
2907 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
2908 <tag/Limits/<itemize>
2909 <item>A joystick driver must be installed using <ref id="joy_install"
2910 name="joy_install"> before calling this function.
2911 <item>The function is only available as fastcall function, so it may only be
2912 used in presence of a prototype.
2914 <tag/Availability/cc65
2916 <ref id="joy_install" name="joy_install">,
2917 <ref id="joy_load_driver" name="joy_load_driver">,
2918 <ref id="joy_unload" name="joy_unload">
2924 <sect1>joy_unload<label id="joy_unload"><p>
2928 <tag/Function/Uninstall, then unload the current joystick driver.
2929 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2930 <tag/Declaration/<tt/unsigned char __fastcall__ joy_unload (void);/
2931 <tag/Description/The function uninstalls the currently installed joystick
2932 driver and removes it from memory. An error code is returned, which is
2933 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
2934 <tag/Limits/<itemize>
2935 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
2936 name="joy_load_driver"> before calling this function.
2937 <item>The function is only available as fastcall function, so it may only be
2938 used in presence of a prototype.
2940 <tag/Availability/cc65
2942 <ref id="joy_load_driver" name="joy_load_driver">
2948 <sect1>kbhit<label id="kbhit"><p>
2952 <tag/Function/Check if there's a key waiting in the keyboard buffer.
2953 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2954 <tag/Declaration/<tt/unsigned char kbhit (void);/
2955 <tag/Description/The function returns a value of zero if there is no character
2956 waiting to be read from the keyboard. It returns non zero otherwise.
2957 <tag/Limits/<itemize>
2958 <item>If the system does not support a keyboard buffer (most systems
2959 do), the function is rather useless.
2961 <tag/Availability/cc65
2963 <ref id="cgetc" name="cgetc">,
2964 <ref id="cursor" name="cursor">
2970 <sect1>labs<label id="labs"><p>
2974 <tag/Function/Returns the absolute value of a long integer.
2975 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2976 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
2977 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
2979 <tag/Limits/<itemize>
2980 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
2981 <item>The function is only available as fastcall function, so it may only be
2982 used in presence of a prototype.
2984 <tag/Availability/ISO 9899
2986 <ref id="abs" name="abs">
2992 <sect1>ltoa<label id="ltoa"><p>
2996 <tag/Function/Convert a long integer into a string.
2997 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2998 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
2999 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
3000 using <tt/radix/ as the base.
3001 <tag/Limits/<itemize>
3002 <item>There are no provisions to prevent a buffer overflow.
3003 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
3004 <item>The function is non standard, so it is not available in strict ANSI mode.
3005 You should probably use <tt/sprintf/ instead.
3006 <item>The function is only available as fastcall function, so it may only be
3007 used in presence of a prototype.
3009 <tag/Availability/cc65
3011 <ref id="atoi" name="atoi">,
3012 <ref id="atol" name="atol">,
3013 <ref id="itoa" name="itoa">,
3014 <ref id="ultoa" name="ultoa">,
3015 <ref id="utoa" name="utoa">
3021 <sect1>localeconv<label id="localeconv"><p>
3025 <tag/Function/Returns a pointer to the current locale structure.
3026 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
3027 <tag/Declaration/<tt/struct lconv* localeconv (void);/
3028 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
3030 <tag/Limits/<itemize>
3031 <item>cc65 supports only the "C" locale, so even after setting a new locale
3032 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
3035 <tag/Availability/ISO 9899
3037 <ref id="setlocale" name="setlocale">
3043 <sect1>longjmp<label id="longjmp"><p>
3047 <tag/Function/Non local goto.
3048 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
3049 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
3050 <tag/Description/The <tt/longjmp/ function restores a program context from the
3051 data in <tt/buf/, which must have been set by a preceeding call to
3052 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
3053 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
3057 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
3058 was called with a value of one.
3059 <item>The function is only available as fastcall function, so it may only
3060 be used in presence of a prototype.
3062 <tag/Availability/ISO 9899
3064 <ref id="setjmp" name="setjmp">
3070 <sect1>malloc<label id="malloc"><p>
3074 <tag/Function/Allocate dynamic memory.
3075 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3076 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
3077 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
3078 pointer to the allocated memory block. On error (not enough memory available),
3079 <tt/malloc/ returns <tt/NULL/.
3082 <item>The function is only available as fastcall function, so it may only
3083 be used in presence of a prototype.
3085 <tag/Availability/ISO 9899
3087 <ref id="_heapadd" name="_heapadd">,
3088 <ref id="_heapblocksize" name="_heapblocksize">,
3089 <ref id="_heapmaxavail" name="_heapmaxavail">,
3090 <ref id="_heapmemavail" name="_heapmemavail">,
3091 <ref id="calloc" name="calloc">,
3092 <ref id="free" name="free">,
3093 <ref id="realloc" name="realloc">,
3094 <ref id="strdup" name="strdup">
3100 <sect1>memchr<label id="memchr"><p>
3104 <tag/Function/Search for a character in a block of raw memory.
3105 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3106 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
3107 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
3108 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
3109 that is of size <tt/count/. Upon completion, the function returns a pointer to
3110 the character found, or a null pointer if the character was not found.
3111 <tag/Limits/<itemize>
3112 <item>The function is only available as fastcall function, so it may only
3113 be used in presence of a prototype.
3115 <tag/Availability/ISO 9899
3117 <ref id="strchr" name="strchr">
3123 <sect1>memcpy<label id="memcpy"><p>
3127 <tag/Function/Copy a memory area.
3128 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3129 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
3130 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
3131 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
3135 <item>The result is undefined if the memory areas do overlap. Use
3136 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
3137 <item>The function is only available as fastcall function, so it may only
3138 be used in presence of a prototype.
3140 <tag/Availability/ISO 9899
3142 <ref id="_swap" name="_swap">,
3143 <ref id="memmove" name="memmove">,
3144 <ref id="memset" name="memset">
3150 <sect1>memmove<label id="memmove"><p>
3154 <tag/Function/Copy a memory area.
3155 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3156 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
3157 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
3158 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
3162 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
3163 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
3164 <item>The function is only available as fastcall function, so it may only
3165 be used in presence of a prototype.
3167 <tag/Availability/ISO 9899
3169 <ref id="_swap" name="_swap">,
3170 <ref id="memcpy" name="memcpy">,
3171 <ref id="memset" name="memset">
3177 <sect1>memset<label id="memset"><p>
3181 <tag/Function/Fill a memory area.
3182 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3183 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
3184 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
3185 the value <tt/val/. The function returns <tt/p/.
3188 <item>The function is only available as fastcall function, so it may only
3189 be used in presence of a prototype.
3191 <tag/Availability/ISO 9899
3193 <ref id="_swap" name="_swap">,
3194 <ref id="bzero" name="bzero">,
3195 <ref id="memcpy" name="memcpy">,
3196 <ref id="memmove" name="memmove">
3202 <sect1>mod_free<label id="mod_free"><p>
3206 <tag/Function/Free a relocatable module.
3207 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
3208 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
3209 <tag/Description/The function will free a module loaded into memory by use of
3210 the <tt/<ref id="mod_load" name="mod_load">/ function.
3211 <tag/Limits/<itemize>
3212 <item>The pointer passed as parameter is the pointer to the module memory,
3213 not the pointer to the control structure.
3215 <tag/Availability/cc65
3217 <ref id="mod_load" name="mod_load">
3223 <sect1>mod_load<label id="mod_load"><p>
3227 <tag/Function/Load a relocatable module.
3228 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
3229 <tag/Declaration/<tt/unsigned char mod_load (struct mod_ctrl* ctrl);/
3230 <tag/Description/The function will load a code module into memory and relocate
3231 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
3232 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
3233 the module just loaded. Possible error codes are:
3235 <item><tt/MLOAD_OK/ - Module load successful
3236 <item><tt/MLOAD_ERR_READ/ - Read error
3237 <item><tt/MLOAD_ERR_HDR/ - Header error
3238 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
3239 <item><tt/MLOAD_ERR_FMT/ - Data format error
3240 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
3242 <tag/Limits/<itemize>
3243 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
3244 relocatable o65 modules for use with this function.
3246 <tag/Availability/cc65
3248 <ref id="mod_free" name="mod_free">
3254 <sect1>mouse_box<label id="mouse_box"><p>
3258 <tag/Function/Specify a bounding box for the mouse cursor.
3259 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3260 <tag/Declaration/<tt/void __fastcall__ mouse_box (int minx, int miny,
3261 int maxx, int maxy);/
3262 <tag/Description/The function allows to set a bounding box for mouse movement.
3263 <tag/Limits/<itemize>
3264 <item>The function does not check if the mouse cursor is currently within the
3265 given rectangle. Placing the mouse cursor within the bounding box is the
3266 responsibility of the programmer.
3267 <item>While the bounding box may be larger than the actual screen size, the
3268 standard mouse cursor draw routines may fail to set the cursor to coordinates
3269 outside of the screen area. Depending on the platform, you may have to supply
3270 your own mouse cursor routines.
3271 <item>The function is only available as fastcall function, so it may only be
3272 used in presence of a prototype.
3274 <tag/Availability/cc65
3276 <ref id="mouse_move" name="mouse_move">
3282 <sect1>mouse_buttons<label id="mouse_buttons"><p>
3286 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
3287 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3288 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_buttons (void);/
3289 <tag/Description/The function returns a bit mask that encodes the state of the
3290 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
3292 <tag/Limits/<itemize>
3293 <item>The function is only available as fastcall function, so it may only be
3294 used in presence of a prototype.
3296 <tag/Availability/cc65
3298 <ref id="mouse_info" name="mouse_info">,
3299 <ref id="mouse_pos" name="mouse_pos">
3305 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
3309 <tag/Function/Return a readable error message for an error code.
3310 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3311 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
3313 <tag/Description/The function returns an error message (in english) for the
3314 error code passed parameter.
3315 <tag/Limits/<itemize>
3316 <item>The function will return "Unknown error" for invalid error codes.
3317 <item>The function is only available as fastcall function, so it may only be
3318 used in presence of a prototype.
3320 <tag/Availability/cc65
3322 <ref id="mouse_load_driver" name="mouse_load_driver">,
3323 <ref id="mouse_uninstall" name="mouse_uninstall">,
3324 <ref id="mouse_unload" name="mouse_unload">
3330 <sect1>mouse_hide<label id="mouse_hide"><p>
3334 <tag/Function/Hide the mouse pointer.
3335 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3336 <tag/Declaration/<tt/void __fastcall__ mouse_hide (void);/
3337 <tag/Description/The function hides the mouse pointer. It manages a counter
3338 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
3339 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
3340 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
3342 <tag/Limits/<itemize>
3343 <item>The function is only available as fastcall function, so it may only be
3344 used in presence of a prototype.
3346 <tag/Availability/cc65
3348 <ref id="mouse_show" name="mouse_show">
3354 <sect1>mouse_info<label id="mouse_info"><p>
3358 <tag/Function/Return the state of the mouse buttons and the position of the
3360 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3361 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
3362 <tag/Description/The function returns the state of the mouse buttons and the
3363 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
3364 <tag/Limits/<itemize>
3365 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
3366 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
3367 name="mouse_pos">/ instead.
3368 <item>The function is only available as fastcall function, so it may only be
3369 used in presence of a prototype.
3371 <tag/Availability/cc65
3373 <ref id="mouse_buttons" name="mouse_buttons">,
3374 <ref id="mouse_pos" name="mouse_pos">
3380 <sect1>mouse_install<label id="mouse_install"><p>
3384 <tag/Function/Install an already loaded mouse driver.
3385 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3386 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
3387 mouse_callbacks* c, void* driver);/
3388 <tag/Description/The function installs an already loaded mouse driver and
3389 returns an error code. The <tt/mouse_callbacks/ structure passed as first
3390 parameter contains pointers to routines needed to move or hide/show the mouse
3391 pointer. Defaults for these routines are supplied by the library, so if you
3392 can live with these defaults (which are platform specific), just pass a
3393 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
3394 driver linked statically to the program.
3395 <tag/Limits/<itemize>
3396 <item>Not all drivers are able to detect if the supported hardware is really
3398 <item>After installing a driver, the mouse cursor is hidden.
3399 <item>The function is only available as fastcall function, so it may only be
3400 used in presence of a prototype.
3402 <tag/Availability/cc65
3404 <ref id="mouse_load_driver" name="mouse_load_driver">,
3405 <ref id="mouse_uninstall" name="mouse_uninstall">,
3406 <ref id="mouse_unload" name="mouse_unload">
3412 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
3416 <tag/Function/Call the driver specific ioctl function.
3417 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3418 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
3419 <tag/Description/The function calls the IOCTL entry in the mouse driver,
3420 which is driver specific. The <tt/code/ parameter will choose between
3421 different IOCTL functions, and the <tt/data/ depends on code. The
3422 function returns an error code. The purpose of this function is to allow
3423 for driver specific extensions. See the documentation for a specific mouse
3424 driver for supported ioctl calls.
3425 <tag/Limits/<itemize>
3426 <item>Calling this function is non portable, because each driver may
3427 implement different ioctl calls (or none at all).
3428 <item>The function is only available as fastcall function, so it may only be
3429 used in presence of a prototype.
3431 <tag/Availability/cc65
3437 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
3441 <tag/Function/Load and initialize a mouse driver.
3442 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3443 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
3444 mouse_callbacks* c, const char* driver);/
3445 <tag/Description/Load a mouse driver into memory and initialize it. The
3446 function returns an error code that tells if the call has been successful. The
3447 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
3448 routines needed to move or hide/show the mouse pointer. Defaults for these
3449 routines are supplied by the library, so if you can live with these defaults
3450 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
3451 <tag/Limits/<itemize>
3452 <item>The driver is loaded by name, so currently you must know the type of
3453 mouse that should be supported. There is no autodetect capability.
3454 <item>Not all drivers are able to detect if the supported hardware is really
3456 <item>After installing a driver, the mouse cursor is hidden.
3457 <item>The function is only available as fastcall function, so it may only be
3458 used in presence of a prototype.
3460 <tag/Availability/cc65
3462 <ref id="mouse_install" name="mouse_install">,
3463 <ref id="mouse_uninstall" name="mouse_uninstall">,
3464 <ref id="mouse_unload" name="mouse_unload">
3470 <sect1>mouse_move<label id="mouse_move"><p>
3474 <tag/Function/Move the mouse cursor to a specific position.
3475 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3476 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
3477 <tag/Description/The function updates the mouse position. If the mouse cursor
3478 is visible, it is shown at the new position.
3479 <tag/Limits/<itemize>
3480 <item>The function does not check if the new position is within the bounding
3481 box specified with <tt/<ref id="mouse_box" name="mouse_box">/.
3482 <item>The function is only available as fastcall function, so it may only be
3483 used in presence of a prototype.
3485 <tag/Availability/cc65
3487 <ref id="mouse_box" name="mouse_box">
3493 <sect1>mouse_pos<label id="mouse_pos"><p>
3497 <tag/Function/Return the position of the mouse.
3498 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3499 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
3500 <tag/Description/The function returns the position of the mouse in the
3501 <tt/mouse_pos/ structure passed as parameter.
3502 <tag/Limits/<itemize>
3503 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
3504 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
3505 name="mouse_info">/ instead.
3506 <item>The function is only available as fastcall function, so it may only be
3507 used in presence of a prototype.
3509 <tag/Availability/cc65
3511 <ref id="mouse_buttons" name="mouse_buttons">,
3512 <ref id="mouse_info" name="mouse_info">
3518 <sect1>mouse_show<label id="mouse_show"><p>
3522 <tag/Function/Show the mouse pointer.
3523 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3524 <tag/Declaration/<tt/void __fastcall__ mouse_show (void);/
3525 <tag/Description/The function shows the mouse pointer. It manages a counter
3526 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
3527 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
3528 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
3529 <tag/Limits/<itemize>
3530 <item>The function is only available as fastcall function, so it may only be
3531 used in presence of a prototype.
3533 <tag/Availability/cc65
3535 <ref id="mouse_hide" name="mouse_hide">
3541 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
3545 <tag/Function/Uninstall an already loaded mouse driver.
3546 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3547 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (void);/
3548 <tag/Description/The function uninstalls an already loaded mouse driver but
3549 don't removes it from memory.
3550 <tag/Limits/<itemize>
3551 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
3552 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
3553 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
3555 <item>The function is only available as fastcall function, so it may only be
3556 used in presence of a prototype.
3558 <tag/Availability/cc65
3560 <ref id="mouse_install" name="mouse_install">,
3561 <ref id="mouse_load_driver" name="mouse_load_driver">,
3562 <ref id="mouse_unload" name="mouse_unload">
3568 <sect1>mouse_unload<label id="mouse_unload"><p>
3572 <tag/Function/Unload a mouse driver.
3573 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3574 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_unload (void);/
3575 <tag/Description/The function unloads a loaded mouse driver and frees all
3576 memory allocated for the driver.
3577 <tag/Limits/<itemize>
3578 <item>The function does nothing if no driver is loaded.
3580 <tag/Availability/cc65
3582 <ref id="mouse_install" name="mouse_install">,
3583 <ref id="mouse_load_driver" name="mouse_load_driver">,
3584 <ref id="mouse_uninstall" name="mouse_uninstall">
3590 <sect1>offsetof<label id="offsetof"><p>
3594 <tag/Function/Calculate the offset of a struct or union member.
3595 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
3596 <tag/Declaration/<tt/size_t offsetof (type, member);/
3597 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
3598 or <tt/union/ member.
3599 <tag/Limits/<itemize>
3600 <item>The function is actually a macro.
3602 <tag/Availability/ISO 9899
3608 <sect1>open<label id="open"><p>
3612 <tag/Function/Open and possibly create a file.
3613 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
3614 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
3615 <tag/Description/<tt/open/ opens a file and returns the file descriptor
3616 associated with it. On error, -1 is returned and an error code is stored in
3617 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
3618 <tag/Limits/<itemize>
3619 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
3620 open, which is used as the permission mask when a new file is created. While
3621 cc65 allows to pass this argument, it is ignored.
3623 <tag/Availability/POSIX 1003.1
3625 <ref id="close" name="close">,
3626 <ref id="creat" name="creat">
3632 <sect1>peekbsys<label id="peekbsys"><p>
3636 <tag/Function/Read one byte from a location in the system bank.
3637 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3638 <tt/<ref id="cbm510.h" name="cbm510.h">/
3639 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
3640 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
3641 system bank (bank 15) of the CBM PET-II machines and returns it.
3644 <item>The function is only available as fastcall function, so it may only
3645 be used in presence of a prototype.
3646 <item>This function may be a macro depending on the compiler options. The
3647 actual function is accessible by #undef'ing the macro.
3649 <tag/Availability/cc65
3651 <ref id="PEEK" name="PEEK">,
3652 <ref id="PEEKW" name="PEEKW">,
3653 <ref id="peekwsys" name="peekwsys">,
3654 <ref id="pokebsys" name="pokebsys">,
3655 <ref id="pokewsys" name="pokewsys">
3661 <sect1>peekwsys<label id="peekwsys"><p>
3665 <tag/Function/Read one word from a location in the system bank.
3666 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3667 <tt/<ref id="cbm510.h" name="cbm510.h">/
3668 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
3669 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
3670 system bank (bank 15) of the CBM PET-II machines and returns it. Following
3671 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
3672 high byte is read from <tt/addr+1/.
3675 <item>The function is only available as fastcall function, so it may only
3676 be used in presence of a prototype.
3677 <item>The order in which the two bytes are read is undefined.
3679 <tag/Availability/cc65
3681 <ref id="PEEK" name="PEEK">,
3682 <ref id="PEEKW" name="PEEKW">,
3683 <ref id="peekbsys" name="peekbsys">,
3684 <ref id="pokebsys" name="pokebsys">,
3685 <ref id="pokewsys" name="pokewsys">
3691 <sect1>perror<label id="perror"><p>
3695 <tag/Function/Print an error message for the error in <tt/errno/.
3696 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3697 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
3698 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
3699 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
3700 a blank. Then the error message for the current contents of <tt/errno/ is
3701 printed followed by a newline. The message output is the same as returned by
3702 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
3705 <item>The function is only available as fastcall function, so it may only
3706 be used in presence of a prototype.
3708 <tag/Availability/ISO 9899
3710 <ref id="_poserror" name="_poserror">,
3711 <ref id="strerror" name="strerror">
3717 <sect1>pokebsys<label id="pokebsys"><p>
3721 <tag/Function/Write one byte to a location in the system bank.
3722 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3723 <tt/<ref id="cbm510.h" name="cbm510.h">/
3724 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
3725 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
3726 system bank (bank 15) of the CBM PET-II machines.
3729 <item>The function is only available as fastcall function, so it may only
3730 be used in presence of a prototype.
3732 <tag/Availability/cc65
3734 <ref id="POKE" name="POKE">,
3735 <ref id="POKEW" name="POKEW">,
3736 <ref id="peekbsys" name="peekbsys">,
3737 <ref id="peekwsys" name="peekwsys">,
3738 <ref id="pokewsys" name="pokewsys">
3744 <sect1>pokewsys<label id="pokewsys"><p>
3748 <tag/Function/Write one word to a location in the system bank.
3749 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3750 <tt/<ref id="cbm510.h" name="cbm510.h">/
3751 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
3752 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
3753 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
3754 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
3755 high byte is written to <tt/addr+1/.
3758 <item>The function is only available as fastcall function, so it may only
3759 be used in presence of a prototype.
3760 <item>The order in which the two bytes are written is undefined.
3762 <tag/Availability/cc65
3764 <ref id="POKE" name="POKE">,
3765 <ref id="POKEW" name="POKEW">,
3766 <ref id="peekbsys" name="peekbsys">,
3767 <ref id="peekwsys" name="peekwsys">,
3768 <ref id="pokebsys" name="pokebsys">
3774 <sect1>qsort<label id="qsort"><p>
3778 <tag/Function/Sort an array.
3779 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3780 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
3781 size_t size, int (*compare) (const void*, const void*));/
3782 <tag/Description/<tt/qsort/ sorts an array according to a given compare
3783 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
3784 is the number of elements, <tt/size/ the size of an element and <tt/compare/
3785 the function used to compare the members.
3788 <item>If there are multiple members with the same key, the order after calling
3789 the function is undefined.
3790 <item>The function is only available as fastcall function, so it may only
3791 be used in presence of a prototype.
3793 <tag/Availability/ISO 9899
3795 <ref id="bsearch" name="bsearch">
3801 <sect1>raise<label id="raise"><p>
3805 <tag/Function/Send a signal to the executing program.
3806 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
3807 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
3808 <tag/Description/<tt/raise/ sends the given signal to the program. If the
3809 program has installed a signal handler for the signal, this signal handler
3810 will be executed. If no handler has been installed, the default action for
3811 the raised signal will be taken. The function returns zero on success,
3813 <tag/Limits/<itemize>
3814 <item>The function is only available as fastcall function, so it may only
3815 be used in presence of a prototype.
3817 <tag/Availability/ISO 9899
3819 <ref id="abort" name="abort">,
3820 <ref id="signal" name="signal">
3826 <sect1>rand<label id="rand"><p>
3830 <tag/Function/Return a pseudo random number.
3831 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3832 <tag/Declaration/<tt/int rand (void);/
3833 <tag/Description/The function returns a pseudo random number
3834 between 0 and <tt/RAND_MAX/ (exclusive).
3835 <tag/Limits/<itemize>
3836 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
3837 flow of numbers is generated.
3838 <item>On startup, the function behaves as if <ref id="srand" name="srand">
3839 had been used with an argument of 1.
3841 <tag/Availability/ISO 9899
3843 <ref id="_randomize" name="_randomize">,
3844 <ref id="srand" name="srand">
3850 <sect1>realloc<label id="realloc"><p>
3854 <tag/Function/Change the size of an allocated memory block.
3855 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3856 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
3857 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
3858 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
3859 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
3860 behaves as if <tt/free/ had been called. On error (not enough memory
3861 available), <tt/realloc/ returns <tt/NULL/.
3864 <item>The part of the memory block that is returned will have its contents
3866 <item>This function is somewhat dangerous to use. Be careful to save the
3867 pointer you're passing somewhere else, otherwise
3869 ptr = realloc (ptr, size);
3871 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
3872 <item>The function is only available as fastcall function, so it may only
3873 be used in presence of a prototype.
3875 <tag/Availability/ISO 9899
3877 <ref id="_heapadd" name="_heapadd">,
3878 <ref id="_heapblocksize" name="_heapblocksize">,
3879 <ref id="_heapmaxavail" name="_heapmaxavail">,
3880 <ref id="_heapmemavail" name="_heapmemavail">,
3881 <ref id="calloc" name="calloc">,
3882 <ref id="free" name="free">,
3883 <ref id="realloc" name="realloc">
3889 <sect1>remove<label id="remove"><p>
3893 <tag/Function/Delete a file.
3894 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3895 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
3896 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
3897 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
3898 code describing the reason for the failure.
3901 <item>This function is not available on all cc65 targets (depends on the
3902 availability of file I/O).
3903 <item>The function is only available as fastcall function, so it may only
3904 be used in presence of a prototype.
3906 <tag/Availability/ISO 9899
3908 <ref id="rename" name="rename">,
3909 <ref id="unlink" name="unlink">
3912 #include <stdio.h>
3914 #define FILENAME "helloworld"
3916 if (remove (FILENAME) == 0) {
3917 printf ("We deleted %s successfully\n", FILENAME);
3919 printf ("There was a problem deleting %s\n", FILENAME);
3926 <sect1>rename<label id="rename"><p>
3930 <tag/Function/Rename a file.
3931 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3932 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
3933 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
3934 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
3935 code describing the reason for the failure.
3938 <item>This function is not available on all cc65 targets (depends on the
3939 capabilities of the storage devices).
3940 <item>The function is only available as fastcall function, so it may only
3941 be used in presence of a prototype.
3943 <tag/Availability/ISO 9899
3945 <ref id="remove" name="remove">
3948 #include <stdio.h>
3950 #define OLDNAME "textfile.txt"
3951 #define NEWNAME "textfile.bak"
3953 if (rename (OLDNAME, NEWNAME) == 0) {
3954 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
3956 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
3963 <sect1>reset_brk<label id="reset_brk"><p>
3967 <tag/Function/Resets the break vector to its original value.
3968 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3969 <tag/Declaration/<tt/void __fastcall__ reset_brk (void);/
3970 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
3971 before a call to <tt/set_brk/.
3974 <item>Since <tt/<ref id="set_brk" name="set_brk">/ installs an exit handler,
3975 it is not strictly necessary to call this function as part of the cleanup when
3978 <tag/Availability/cc65
3980 <ref id="set_brk" name="set_brk">
3986 <sect1>revers<label id="revers"><p>
3990 <tag/Function/Control revers character display.
3991 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3992 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
3993 <tag/Description/If the argument is non zero, the function enables reverse
3994 character display. If the argument is zero, reverse character display is
3995 switched off. The old value of the setting is returned.
3996 <tag/Limits/<itemize>
3997 <item>The function may not be supported by the hardware, in which case
3998 the call is ignored.
3999 <item>The function is only available as fastcall function, so it may only
4000 be used in presence of a prototype.
4002 <tag/Availability/cc65
4004 <ref id="textcolor" name="textcolor">
4010 <sect1>screensize<label id="screensize"><p>
4014 <tag/Function/Return the dimensions of the text mode screen.
4015 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4016 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
4017 <tag/Description/The function returns the dimensions of the text mode screen.
4018 <tag/Limits/<itemize>
4019 <item>The function is only available as fastcall function, so it may only
4020 be used in presence of a prototype.
4022 <tag/Availability/cc65
4024 <ref id="gotox" name="gotox">,
4025 <ref id="gotoxy" name="gotoxy">,
4026 <ref id="gotoy" name="gotoy">,
4027 <ref id="wherex" name="wherex">,
4028 <ref id="wherey" name="wherey">
4034 <sect1>set_brk<label id="set_brk"><p>
4038 <tag/Function/Set the break vector to a user function.
4039 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
4040 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
4041 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
4042 program code by letting the vector point to a user written C function. The
4043 runtime library installs a small stub that saves the registers into global
4044 variables that may be accessed (and changed) by the break handler.
4047 <item>The function is only available as fastcall function, so it may only
4048 be used in presence of a prototype.
4049 <item>The stub saves the zero page registers used by the C runtime and switches
4050 to a small break handler stack. This means that it is safe to execute C code,
4051 even if C code was interrupted. Be careful however not to use too many local
4052 variables, and do not enable stack checks for the handler function or any other
4053 function called from it.
4054 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
4055 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
4056 otherwise the <tt/BRK/ instruction will get executed over and over again.
4057 <item>Since <tt/set_brk/ installs an exit handler, it is not strictly necessary
4058 to call <tt/<ref id="reset_brk" name="reset_brk">/ as part of the cleanup when
4059 the program terminates.
4061 <tag/Availability/cc65
4063 <ref id="reset_brk" name="reset_brk">
4069 <sect1>setjmp<label id="setjmp"><p>
4073 <tag/Function/Save the context for use with <tt/longjmp/.
4074 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4075 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
4076 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
4077 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
4081 <item>The function is only available as fastcall function, so it may only
4082 be used in presence of a prototype.
4083 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
4084 <item><tt/setjmp/ will not save the signal context.
4086 <tag/Availability/ISO 9899
4088 <ref id="longjmp" name="longjmp">
4094 <sect1>setlocale<label id="setlocale"><p>
4098 <tag/Function/Selects a locale.
4099 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4100 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
4101 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
4104 <item>The function is only available as fastcall function, so it may only
4105 be used in presence of a prototype.
4106 <item>cc65 supports only the "C" locale, so calling this function to set a
4107 different locale has no effect.
4109 <tag/Availability/ISO 9899
4111 <ref id="localeconv" name="localeconv">,
4112 <ref id="strcoll" name="strcoll">
4113 <ref id="strxfrm" name="strxfrm">
4119 <sect1>signal<label id="signal"><p>
4123 <tag/Function/Install a signal handler.
4124 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
4125 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
4126 <tag/Description/<tt/signal/ installs a handler for the given signal. The
4127 handler may either be a user supplied function, or one of the predefined
4128 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
4129 previous value if the signal , or the special function vector SIG_ERR in
4131 <tag/Limits/<itemize>
4132 <item>The function is only available as fastcall function, so it may only
4133 be used in presence of a prototype.
4135 <tag/Availability/ISO 9899
4137 <ref id="abort" name="abort">,
4138 <ref id="raise" name="raise">
4144 <sect1>sleep<label id="sleep"><p>
4148 <tag/Function/Sleep for a specified amount of time.
4149 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
4150 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
4151 <tag/Description/The function will return after the specified number of
4152 seconds have elapsed.
4153 <tag/Limits/<itemize>
4154 <item>The function is only available as fastcall function, so it may only
4155 be used in presence of a prototype.
4157 <tag/Availability/POSIX 1003.1
4163 <sect1>slow<label id="slow"><p>
4167 <tag/Function/Switch the C128 into 1MHz mode.
4168 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
4169 <tag/Declaration/<tt/void slow (void);/
4170 <tag/Description/The function will switch the clock of the C128 to 1MHz. This
4171 will halve the speed compared to fast mode.
4172 <tag/Limits/<itemize>
4173 <item>The function is specific to the C128.
4175 <tag/Availability/C128
4177 <ref id="fast" name="fast">,
4178 <ref id="toggle_videomode" name="toggle_videomode">,
4179 <ref id="videomode" name="videomode">
4185 <sect1>srand<label id="srand"><p>
4189 <tag/Function/Initialize the pseudo random number generator.
4190 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4191 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
4192 <tag/Description/The function initializes the random number generator using
4193 the given seed. On program startup, the generator behaves as if <tt/srand/ has
4194 been called with an argument of 1.
4195 <tag/Limits/<itemize>
4196 <item>The function is only available as fastcall function, so it may only
4197 be used in presence of a prototype.
4199 <tag/Availability/ISO 9899
4201 <ref id="_randomize" name="_randomize">,
4202 <ref id="rand" name="rand">
4208 <sect1>strcasecmp<label id="strcasecmp"><p>
4212 <tag/Function/Compare two strings case insensitive.
4213 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4214 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
4215 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
4216 as parameters without case sensitivity. It returns a value that is less than
4217 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
4218 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
4219 <tag/Limits/<itemize>
4220 <item>The function is only available as fastcall function, so it may only
4221 be used in presence of a prototype.
4222 <item>The function is not available in strict ANSI mode.
4224 <tag/Availability/cc65
4226 <ref id="strcmp" name="strcmp">,
4227 <ref id="strcoll" name="strcoll">,
4228 <ref id="stricmp" name="stricmp">,
4229 <ref id="strncmp" name="strncmp">
4230 <ref id="strxfrm" name="strxfrm">
4236 <sect1>strcat<label id="strcat"><p>
4240 <tag/Function/Concatentate two strings.
4241 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4242 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
4243 <tag/Description/The <tt/strcat/ function appends a copy of the string
4244 pointed to by s2 (including the terminating null byte) to the end of the
4245 string pointed to by s1. The initial byte of s2 overwrites the null byte at
4247 <tag/Limits/<itemize>
4248 <item>The function is only available as fastcall function, so it may only
4249 be used in presence of a prototype.
4250 <item>If copying takes place between objects that overlap, the behaviour
4253 <tag/Availability/ISO 9899
4255 <ref id="strcpy" name="strcpy">,
4256 <ref id="strncat" name="strncat">,
4257 <ref id="strncpy" name="strncpy">
4263 <sect1>strchr<label id="strchr"><p>
4267 <tag/Function/Search for a character in a string.
4268 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4269 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
4270 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
4271 (converted to a char) in the string pointed to by <tt/s/. The terminating null
4272 byte is considered to be part of the string. Upon completion, the function
4273 returns a pointer to the byte, or a null pointer if the byte was not found.
4274 <tag/Limits/<itemize>
4275 <item>The function is only available as fastcall function, so it may only
4276 be used in presence of a prototype.
4278 <tag/Availability/ISO 9899
4280 <ref id="memchr" name="memchr">,
4281 <ref id="strrchr" name="strrchr">
4287 <sect1>strcmp<label id="strcmp"><p>
4291 <tag/Function/Compare two strings.
4292 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4293 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
4294 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
4295 parameters. It returns a value that is less than zero if <tt/s1/ is less than
4296 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
4297 if <tt/s1/ is greater than <tt/s2/.
4298 <tag/Limits/<itemize>
4299 <item>The function is only available as fastcall function, so it may only
4300 be used in presence of a prototype.
4302 <tag/Availability/ISO 9899
4304 <ref id="strcasecmp" name="strcasecmp">,
4305 <ref id="strcoll" name="strcoll">,
4306 <ref id="stricmp" name="stricmp">,
4307 <ref id="strncmp" name="strncmp">
4308 <ref id="strxfrm" name="strxfrm">
4314 <sect1>strcoll<label id="strcoll"><p>
4318 <tag/Function/Compare two strings.
4319 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4320 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
4321 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
4322 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
4323 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
4324 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
4325 than zero if <tt/s1/ is greater than <tt/s2/.
4326 <tag/Limits/<itemize>
4327 <item>The function is only available as fastcall function, so it may only
4328 be used in presence of a prototype.
4330 <tag/Availability/ISO 9899
4332 <ref id="setlocale" name="setlocale">,
4333 <ref id="strcasecmp" name="strcasecmp">,
4334 <ref id="strcmp" name="strcmp">,
4335 <ref id="stricmp" name="stricmp">,
4336 <ref id="strncmp" name="strncmp">
4337 <ref id="strxfrm" name="strxfrm">
4343 <sect1>strcpy<label id="strcpy"><p>
4347 <tag/Function/Copy a string.
4348 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4349 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
4350 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
4351 <tt/s2/ (including the terminating null byte) into the array pointed to by
4352 <tt/s1/. The function will always return <tt/s1/.
4353 <tag/Limits/<itemize>
4354 <item>The function is only available as fastcall function, so it may only
4355 be used in presence of a prototype.
4356 <item>If copying takes place between objects that overlap, the behaviour
4359 <tag/Availability/ISO 9899
4361 <ref id="strcat" name="strcat">,
4362 <ref id="strncat" name="strncat">,
4363 <ref id="strncpy" name="strncpy">
4366 #include <string.h>
4368 static char hello[14];
4370 strcpy (hello, "Hello world!\n");
4376 <sect1>strcspn<label id="strcspn"><p>
4380 <tag/Function/Compute the length of a substring.
4381 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4382 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
4383 <tag/Description/The <tt/strcspn/ function computes and returns the length of
4384 the substring pointed to by <tt/s/ which does <em>not</em> consist of
4385 characters contained in the string <tt/set/.
4386 <tag/Limits/<itemize>
4387 <item>The function is only available as fastcall function, so it may only
4388 be used in presence of a prototype.
4390 <tag/Availability/ISO 9899
4392 <ref id="strspn" name="strspn">,
4393 <ref id="strstr" name="strstr">,
4394 <ref id="strtok" name="strtok">
4400 <sect1>strdup<label id="strdup"><p>
4404 <tag/Function/Allocate a copy of a string on the heap.
4405 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4406 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
4407 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
4408 to hold a copy of <tt/s/ including the terminating zero. If the allocation
4409 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
4410 memory block, and a pointer to the block is returned.
4411 <tag/Limits/<itemize>
4412 <item>The function is only available as fastcall function, so it may only
4413 be used in presence of a prototype.
4414 <item>It is up to the caller to free the allocated memory block.
4416 <tag/Availability/ISO 9899
4418 <ref id="free" name="free">,
4419 <ref id="malloc" name="malloc">
4425 <sect1>strerror<label id="strerror"><p>
4429 <tag/Function/Return a string describing an error code.
4430 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4431 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
4432 <tag/Description/The <tt/strerror/ function returns a string describing the
4433 given error code. If an invalid error code is passed, the string "Unknown
4434 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
4435 <tt/errno/ is left untouched.
4436 <tag/Limits/<itemize>
4437 <item>The function is only available as fastcall function, so it may only
4438 be used in presence of a prototype.
4439 <item>While the return type of the function is a <tt/char*/, the returned
4440 string must not be modified by the caller!
4442 <tag/Availability/ISO 9899
4444 <ref id="_stroserror" name="_stroserror">
4450 <sect1>stricmp<label id="stricmp"><p>
4454 <tag/Function/Compare two strings case insensitive.
4455 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4456 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
4457 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
4458 parameters without case sensitivity. It returns a value that is less than zero
4459 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
4460 value greater than zero if <tt/s1/ is greater than <tt/s2/.
4461 <tag/Limits/<itemize>
4462 <item>The function is only available as fastcall function, so it may only
4463 be used in presence of a prototype.
4464 <item>The function is not available in strict ANSI mode.
4466 <tag/Availability/cc65
4468 <ref id="strcasecmp" name="strcasecmp">,
4469 <ref id="strcmp" name="strcmp">,
4470 <ref id="strcoll" name="strcoll">,
4471 <ref id="strncmp" name="strncmp">
4472 <ref id="strxfrm" name="strxfrm">
4478 <sect1>strlen<label id="strlen"><p>
4482 <tag/Function/Return the length of a string.
4483 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4484 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
4485 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
4486 string to which s points, not including the terminating null byte.
4487 <tag/Limits/<itemize>
4488 <item>The function is only available as fastcall function, so it may only
4489 be used in presence of a prototype.
4490 <item>When compiling with <tt/-Os/ (inline known standard functions), the
4491 function does not work correctly for strings with more than 255 characters.
4493 <tag/Availability/ISO 9899
4495 <ref id="strcpy" name="strcpy">
4501 <sect1>strlower<label id="strlower"><p>
4505 <tag/Function/Make a string lower case.
4506 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4507 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
4508 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
4509 function to each character of a string. The function will always return <tt/s/.
4510 <tag/Limits/<itemize>
4511 <item>The function is only available as fastcall function, so it may only
4512 be used in presence of a prototype.
4513 <item>The function prototype is unavailable when compiling in strict ANSI mode.
4514 <item>An alias name for this function is <tt/strlwr/.
4516 <tag/Availability/cc65
4518 <ref id="strupper" name="strupper">,
4519 <ref id="tolower" name="tolower">
4525 <sect1>strlwr<label id="strlwr"><p>
4532 <sect1>strncat<label id="strncat"><p>
4536 <tag/Function/Concatentate two strings.
4537 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4538 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
4539 <tag/Description/The <tt/strncat/ function appends not more than n characters
4540 of the string pointed to by s2 to the end of the string pointed to by s1. The
4541 terminating null character at the end of s1 is overwritten. A terminating null
4542 character is appended to the result, even if not all of s2 is appended to s1.
4543 <tag/Limits/<itemize>
4544 <item>The function is only available as fastcall function, so it may only
4545 be used in presence of a prototype.
4546 <item>If copying takes place between objects that overlap, the behaviour
4549 <tag/Availability/ISO 9899
4551 <ref id="strcpy" name="strcpy">,
4552 <ref id="strncat" name="strncat">,
4553 <ref id="strncpy" name="strncpy">
4559 <sect1>strncmp<label id="strncmp"><p>
4563 <tag/Function/Compare two strings.
4564 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4565 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
4566 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
4567 characters of the two strings passed as parameters. It returns a value that is
4568 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
4569 <tt/s2/, zero if they are identical, and a value greater than zero they are
4571 <tag/Limits/<itemize>
4572 <item>The function is only available as fastcall function, so it may only
4573 be used in presence of a prototype.
4575 <tag/Availability/ISO 9899
4577 <ref id="strcasecmp" name="strcasecmp">,
4578 <ref id="strcmp" name="strcmp">,
4579 <ref id="strcoll" name="strcoll">,
4580 <ref id="stricmp" name="stricmp">
4581 <ref id="strxfrm" name="strxfrm">
4587 <sect1>strncpy<label id="strncpy"><p>
4591 <tag/Function/Copy part of a string.
4592 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4593 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2, size_t n);/
4594 <tag/Description/The <tt/strncpy/ function copies not more than n bytes from
4595 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
4596 pointed to by <tt/s2/ is a string that is shorter than n bytes, null bytes are
4597 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
4598 written. The function will always return <tt/s1/.
4599 <tag/Limits/<itemize>
4600 <item>The function is only available as fastcall function, so it may only
4601 be used in presence of a prototype. If there is no null byte in the first <tt/n/
4602 bytes of the array pointed to by <tt/s2/, the result is not null-terminated.
4603 <item>If copying takes place between objects that overlap, the behaviour is
4606 <tag/Availability/ISO 9899
4608 <ref id="strcat" name="strcat">,
4609 <ref id="strcpy" name="strcpy">,
4610 <ref id="strncat" name="strncat">
4615 static char hello[6];
4617 strcpy (hello, "Hello world!\n", sizeof (hello) - 1);
4624 <sect1>strrchr<label id="strrchr"><p>
4628 <tag/Function/Search for a character in a string.
4629 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4630 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
4631 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
4632 (converted to a char) in the string pointed to by <tt/s/. The terminating null
4633 byte is considered to be part of the string. Upon completion, the function
4634 returns a pointer to the byte, or a null pointer if the byte was not found.
4635 <tag/Limits/<itemize>
4636 <item>The function is only available as fastcall function, so it may only
4637 be used in presence of a prototype.
4639 <tag/Availability/ISO 9899
4641 <ref id="strchr" name="strchr">
4647 <sect1>strspn<label id="strspn"><p>
4651 <tag/Function/Compute the length of a substring.
4652 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4653 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
4654 <tag/Description/The <tt/strspn/ function computes and returns the length of
4655 the substring pointed to by <tt/s/ which does consist only of characters
4656 contained in the string <tt/set/.
4657 <tag/Limits/<itemize>
4658 <item>The function is only available as fastcall function, so it may only
4659 be used in presence of a prototype.
4661 <tag/Availability/ISO 9899
4663 <ref id="strcspn" name="strcspn">,
4664 <ref id="strstr" name="strstr">
4670 <sect1>strstr<label id="strstr"><p>
4674 <tag/Function/Find a substring.
4675 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4676 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
4677 <tag/Description/<tt/strstr/ searches for the first occurance of the string
4678 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
4679 otherwise it returns <tt/NULL/.
4680 <tag/Limits/<itemize>
4681 <item>The function is only available as fastcall function, so it may only
4682 be used in presence of a prototype.
4684 <tag/Availability/ISO 9899
4686 <ref id="strcspn" name="strcspn">,
4687 <ref id="strspn" name="strspn">
4693 <sect1>strtok<label id="strtok"><p>
4697 <tag/Function/Break a string into tokens.
4698 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4699 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
4700 <tag/Description/<tt/strtok/ will break the string s1 into a sequence of
4701 tokens, which are delimited by characters from the string s2. The first call
4702 to <tt/strtok/ will return a pointer to the first token in the string s1.
4703 Following calls must pass a <tt/NULL/ pointer as s1 in order to get the next
4704 token in the string. Different sets of delimiters may be used for the
4705 subsequent calls to <tt/strtok/.
4706 <tag/Limits/<itemize>
4707 <item>The function is only available as fastcall function, so it may only
4708 be used in presence of a prototype.
4709 <item><tt/strtok/ will modify the string s1.
4711 <tag/Availability/ISO 9899
4713 <ref id="strcspn" name="strcspn">,
4714 <!-- <ref id="strpbrk" name="strpbrk"> -->
4720 <sect1>strxfrm<label id="strxfrm"><p>
4724 <tag/Function/Transform a string.
4725 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4726 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
4727 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
4728 s2 and places the resulting string into the string pointed to by s1. The
4729 transformation is such that if the <tt/strcmp/ function is applied to two
4730 transformed strings, it returns a value greater than, equal to, or less than
4731 zero, corresponding to the result of the <tt/strcoll/ function applied to the
4732 same two original strings. No more than n characters are placed into the
4733 resulting array pointed to by s1, including the terminating null character.
4734 <tag/Limits/<itemize>
4735 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
4736 the behaviour is undefined.
4737 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
4738 <item>The function is only available as fastcall function, so it may only
4739 be used in presence of a prototype.
4740 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
4741 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
4743 <tag/Availability/ISO 9899
4745 <ref id="strcmp" name="strcmp">,
4746 <ref id="strcoll" name="strcoll">,
4747 <ref id="strncpy" name="strncpy">,
4753 <sect1>strupper<label id="strupper"><p>
4757 <tag/Function/Make a string upper case.
4758 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4759 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
4760 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
4761 function to each character of a string. The function will always return <tt/s/.
4762 <tag/Limits/<itemize>
4763 <item>The function is only available as fastcall function, so it may only
4764 be used in presence of a prototype.
4765 <item>The function prototype is unavailable when compiling in strict ANSI mode.
4766 <item>An alias name for this function is <tt/strupr/.
4768 <tag/Availability/cc65
4770 <ref id="strlower" name="strlower">
4771 <ref id="toupper" name="toupper">
4777 <sect1>strupr<label id="strupr"><p>
4784 <sect1>textcolor<label id="textcolor"><p>
4788 <tag/Function/Set the text color.
4789 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4790 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
4791 <tag/Description/The function will set a new text color. It returns the old
4792 (current) text color. Text output using any <tt/conio.h/ function will use
4793 the color set by this function.
4794 <tag/Limits/<itemize>
4795 <item>Text colors are system dependent. The function may have no effect
4796 on systems where the text color cannot be changed.
4797 <item>The function is only available as fastcall function, so it may only
4798 be used in presence of a prototype.
4800 <tag/Availability/cc65
4802 <ref id="bgcolor" name="bgcolor">,
4803 <ref id="bordercolor" name="bordercolor">
4809 <sect1>time<label id="time"><p>
4813 <tag/Function/Get the time.
4814 <tag/Header/<tt/<ref id="time.h" name="time.h">/
4815 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
4816 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
4817 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
4818 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
4819 returned and <tt/errno/ is set to <tt/ENOSYS/.
4820 <tag/Limits/<itemize>
4821 <item>The function is only available as fastcall function, so it may
4822 only be used in presence of a prototype.
4823 <item>Many platforms supported by cc65 do not have a realtime clock, so the
4824 returned value may not be valid.
4826 <tag/Availability/ISO 9899
4832 <sect1>toggle_videomode<label id="toggle_videomode"><p>
4836 <tag/Function/Toggle between 40 and 80 column mode.
4837 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
4838 <tag/Declaration/<tt/void toggle_videomode (void);/
4839 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
4840 old mode (cursor position, color and so on) are saved and restored together
4842 <tag/Limits/<itemize>
4843 <item>The function is specific to the C128.
4844 <item>This function is deprecated. Please use <ref id="videomode"
4845 name="videomode"> instead!
4847 <tag/Availability/C128
4849 <ref id="fast" name="fast">,
4850 <ref id="slow" name="slow">,
4851 <ref id="videomode" name="videomode">
4857 <sect1>tolower<label id="tolower"><p>
4861 <tag/Function/Convert a character into its lower case representation.
4862 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4863 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
4864 <tag/Description/The function returns the given character converted to lower
4865 case. If the given character is not a letter, it is returned unchanged.
4866 <tag/Limits/<itemize>
4867 <item>The function is only available as fastcall function, so it may
4868 only be used in presence of a prototype.
4870 <tag/Availability/ISO 9899
4872 <ref id="islower" name="islower">,
4873 <ref id="isupper" name="isupper">,
4874 <ref id="toupper" name="toupper">
4880 <sect1>toupper<label id="toupper"><p>
4884 <tag/Function/Convert a character into its upper case representation.
4885 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4886 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
4887 <tag/Description/The function returns the given character converted to upper
4888 case. If the given character is not a letter, it is returned unchanged.
4889 <tag/Limits/<itemize>
4890 <item>The function is only available as fastcall function, so it may
4891 only be used in presence of a prototype.
4893 <tag/Availability/ISO 9899
4895 <ref id="islower" name="islower">,
4896 <ref id="isupper" name="isupper">,
4897 <ref id="tolower" name="tolower">
4903 <sect1>ultoa<label id="ultoa"><p>
4907 <tag/Function/Convert an unsigned long integer into a string.
4908 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4909 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
4910 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
4911 string using <tt/radix/ as the base.
4912 <tag/Limits/<itemize>
4913 <item>There are no provisions to prevent a buffer overflow.
4914 <item>The function is non standard, so it is not available in strict ANSI mode.
4915 You should probably use <tt/sprintf/ instead.
4916 <item>The function is only available as fastcall function, so it may only be
4917 used in presence of a prototype.
4919 <tag/Availability/cc65
4921 <ref id="atoi" name="atoi">,
4922 <ref id="atol" name="atol">,
4923 <ref id="itoa" name="itoa">,
4924 <ref id="ltoa" name="ltoa">,
4925 <ref id="utoa" name="utoa">
4931 <sect1>unlink<label id="unlink"><p>
4935 <tag/Function/Delete a file.
4936 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
4937 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
4938 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
4939 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
4940 code describing the reason for the failure.
4943 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
4944 name="remove">/ instead, which is a native ANSI C function and does the same.
4945 <item>This function is not available on all cc65 targets (depends on the
4946 availability of file I/O).
4947 <item>The function is only available as fastcall function, so it may only
4948 be used in presence of a prototype.
4949 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
4950 used, which has the same semantics, but is more portable, because it conforms
4951 to the ISO C standard.
4953 <tag/Availability/POSIX 1003.1
4955 <ref id="remove" name="remove">
4958 #include <stdio.h>
4959 #include <unistd.h>
4961 #define FILENAME "helloworld"
4963 if (unlink (FILENAME) == 0) {
4964 printf ("We deleted %s successfully\n", FILENAME);
4966 printf ("There was a problem deleting %s\n", FILENAME);
4973 <sect1>utoa<label id="utoa"><p>
4977 <tag/Function/Convert an unsigned integer into a string.
4978 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4979 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
4980 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
4981 using <tt/radix/ as the base.
4982 <tag/Limits/<itemize>
4983 <item>There are no provisions to prevent a buffer overflow.
4984 <item>The function is non standard, so it is not available in strict ANSI mode.
4985 You should probably use <tt/sprintf/ instead.
4986 <item>The function is only available as fastcall function, so it may only be
4987 used in presence of a prototype.
4989 <tag/Availability/cc65
4991 <ref id="atoi" name="atoi">,
4992 <ref id="atol" name="atol">,
4993 <ref id="itoa" name="itoa">,
4994 <ref id="ltoa" name="ltoa">,
4995 <ref id="ultoa" name="ultoa">
5001 <sect1>vcprintf<label id="vcprintf"><p>
5005 <tag/Function/Formatted output to the console.
5006 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5007 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
5008 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
5009 text where necessary and formatted according to the format string given. The
5010 resulting string is output to the console. <tt/vcprintf/ supports the same
5011 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
5012 <tag/Limits/<itemize>
5013 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
5014 between <tt/\r/ and <tt/\n/.
5015 <item>The function is only available as fastcall function, so it may only be
5016 used in presence of a prototype.
5018 <tag/Availability/cc65
5020 <ref id="cprintf" name="cprintf">,
5021 <ref id="cputc" name="cputc">,
5022 <ref id="cputcxy" name="cputcxy">,
5023 <ref id="cputs" name="cputs">,
5024 <ref id="cputsxy" name="cputsxy">
5030 <sect1>videomode<label id="videomode"><p>
5034 <tag/Function/Switch to either 40 or 80 column mode.
5035 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
5036 <ref id="c128.h" name="c128.h">/
5037 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
5038 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
5039 the requested mode is already active, nothing happens. The old mode is returned
5041 <tag/Limits/<itemize>
5042 <item>The function is specific to the C128 and enhanced Apple //e.
5043 <item>This function replaces <ref id="toggle_videomode"
5044 name="toggle_videomode">.
5045 <item>The function is only available as fastcall function, so it may only be
5046 used in presence of a prototype.
5048 <tag/Availability/C128 and enhanced Apple //e
5050 <ref id="fast" name="fast">,
5051 <ref id="slow" name="slow">,
5052 <ref id="toggle_videomode" name="toggle_videomode">
5058 <sect1>wherex<label id="wherex"><p>
5062 <tag/Function/Return the current X position of the text mode cursor.
5063 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5064 <tag/Declaration/<tt/unsigned char wherex (void);/
5065 <tag/Description/The function returns the current X position of the text mode
5066 cursor. Zero is returned for the leftmost screen position.
5067 <tag/Availability/cc65
5069 <ref id="gotox" name="gotox">,
5070 <ref id="gotoy" name="gotoy">,
5071 <ref id="gotoxy" name="gotoxy">,
5072 <ref id="wherey" name="wherey">
5078 <sect1>wherey<label id="wherey"><p>
5082 <tag/Function/Return the current Y position of the text mode cursor.
5083 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5084 <tag/Declaration/<tt/unsigned char wherey (void);/
5085 <tag/Description/The function returns the current Y position of the text mode
5086 cursor. Zero is returned for the uppermost screen position.
5087 <tag/Availability/cc65
5089 <ref id="gotox" name="gotox">,
5090 <ref id="gotoy" name="gotoy">,
5091 <ref id="gotoxy" name="gotoxy">,
5092 <ref id="wherex" name="wherex">