1 <!doctype linuxdoc system>
4 <title>cc65 function reference
5 <author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
9 cc65 is a C compiler for 6502 based systems. This function reference describes
10 the C functions available in the standard library.
13 <!-- Table of contents -->
16 <!-- Begin the document -->
20 cc65 is a C compiler for 6502 based systems. It implements a subset of the ISO
21 C standard plus additional functions specially crafted for 6502 systems or
22 just some of the supported machines. This function refrence describes the
23 available functions together with any limitations.
25 For an overview about the available libraries, their purpose, and any
26 differences to the ISO standard, please have a look at the <htmlurl
27 url="library.html" name="cc65 Library Overview">.
29 <bf/Note:/ Standard C functions are listed here, but not described in detail.
30 Since these functions behave identical on all standard compliant systems, they
31 are described in any book covering standard C.
33 Each entry for a function contains a detailed description
37 <tag/Function/Summary of what <bf/function/ does.
38 <tag/Header/The header file that contains the declaration.
39 <tag/Declaration/Describes the needed header files and declaration of the
41 <tag/Description/Description of the function.
43 <tag/Availability/The availability of the function.
44 <tag/See also/Other related functions.
45 <tag/Example/A piece of actual code using the function.
50 <sect>Functions by header file<p>
52 <sect1><tt/6502.h/<label id="6502.h"><p>
55 <item><ref id="BRK" name="BRK">
56 <item><ref id="CLI" name="CLI">
57 <item><ref id="SEI" name="SEI">
58 <item><ref id="_sys" name="_sys">
59 <item><ref id="getcpu" name="getcpu">
60 <item><ref id="reset_brk" name="reset_brk">
61 <item><ref id="set_brk" name="set_brk">
65 <sect1><tt/apple2.h/<label id="apple2.h"><p>
69 <item><ref id="get_ostype" name="get_ostype">
73 <sect1><tt/apple2enh.h/<label id="apple2enh.h"><p>
79 <item><ref id="get_ostype" name="get_ostype">
83 <sect1><tt/assert.h/<label id="assert.h"><p>
86 <item><ref id="assert" name="assert">
90 <sect1><tt/atari.h/<label id="atari.h"><p>
93 <item><ref id="get_ostype" name="get_ostype">
99 <sect1><tt/atmos.h/<label id="atmos.h"><p>
104 <sect1><tt/c128.h/<label id="c128.h"><p>
107 <item><ref id="c64mode" name="c64mode">
108 <item><ref id="fast" name="fast">
109 <item><ref id="toggle_videomode" name="toggle_videomode">
110 <item><ref id="slow" name="slow">
114 <sect1><tt/c16.h/<label id="c16.h"><p>
119 <sect1><tt/c64.h/<label id="c64.h"><p>
122 <item><ref id="get_ostype" name="get_ostype">
126 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
129 <item><ref id="peekbsys" name="peekbsys">
130 <item><ref id="peekwsys" name="peekwsys">
131 <item><ref id="pokebsys" name="pokebsys">
132 <item><ref id="pokewsys" name="pokewsys">
136 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
139 <item><ref id="peekbsys" name="peekbsys">
140 <item><ref id="peekwsys" name="peekwsys">
141 <item><ref id="pokebsys" name="pokebsys">
142 <item><ref id="pokewsys" name="pokewsys">
146 <sect1><tt/conio.h/<label id="conio.h"><p>
149 <item><ref id="bgcolor" name="bgcolor">
150 <item><ref id="bordercolor" name="bordercolor">
151 <item><ref id="cclear" name="cclear">
152 <item><ref id="cclearxy" name="cclearxy">
153 <item><ref id="cgetc" name="cgetc">
154 <item><ref id="chline" name="chline">
155 <item><ref id="chlinexy" name="chlinexy">
156 <item><ref id="clrscr" name="clrscr">
157 <item><ref id="cprintf" name="cprintf">
158 <item><ref id="cputc" name="cputc">
159 <item><ref id="cputcxy" name="cputcxy">
160 <item><ref id="cputs" name="cputs">
161 <item><ref id="cputsxy" name="cputsxy">
162 <item><ref id="cursor" name="cursor">
163 <item><ref id="cvline" name="cvline">
164 <item><ref id="cvlinexy" name="cvlinexy">
165 <item><ref id="gotox" name="gotox">
166 <item><ref id="gotoxy" name="gotoxy">
167 <item><ref id="gotoy" name="gotoy">
168 <item><ref id="kbhit" name="kbhit">
169 <item><ref id="revers" name="revers">
170 <item><ref id="screensize" name="screensize">
171 <item><ref id="textcolor" name="textcolor">
172 <item><ref id="vcprintf" name="vcprintf">
173 <item><ref id="wherex" name="wherex">
174 <item><ref id="wherey" name="wherey">
178 <sect1><tt/ctype.h/<label id="ctype.h"><p>
181 <item><ref id="isalnum" name="isalnum">
182 <item><ref id="isalpha" name="isalpha">
183 <item><ref id="isascii" name="isascii">
184 <item><ref id="isblank" name="isblank">
185 <item><ref id="iscntrl" name="iscntrl">
186 <item><ref id="isdigit" name="isdigit">
187 <item><ref id="isgraph" name="isgraph">
188 <item><ref id="islower" name="islower">
189 <item><ref id="isprint" name="isprint">
190 <item><ref id="ispunct" name="ispunct">
191 <item><ref id="isspace" name="isspace">
192 <item><ref id="isupper" name="isupper">
193 <item><ref id="isxdigit" name="isxdigit">
194 <item><ref id="tolower" name="tolower">
195 <item><ref id="toupper" name="toupper">
199 <sect1><tt/dbg.h/<label id="dbg.h"><p>
204 <sect1><tt/dio.h/<label id="dio.h"><p>
209 <sect1><tt/em.h/<label id="em.h"><p>
212 <item><ref id="em_commit" name="em_commit">
213 <item><ref id="em_copyfrom" name="em_copyfrom">
214 <item><ref id="em_copyto" name="em_copyto">
215 <item><ref id="em_install" name="em_install">
216 <item><ref id="em_load_driver" name="em_load_driver">
217 <item><ref id="em_map" name="em_map">
218 <item><ref id="em_pagecount" name="em_pagecount">
219 <item><ref id="em_uninstall" name="em_uninstall">
220 <item><ref id="em_unload" name="em_unload">
221 <item><ref id="em_use" name="em_use">
225 <sect1><tt/errno.h/<label id="errno.h"><p>
230 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
233 <item><ref id="close" name="close">
234 <item><ref id="creat" name="creat">
235 <item><ref id="open" name="open">
239 <sect1><tt/geos.h/<label id="geos.h"><p>
244 <sect1><tt/joystick.h/<label id="joystick.h"><p>
247 <item><ref id="joy_count" name="joy_count">
248 <item><ref id="joy_install" name="joy_install">
249 <item><ref id="joy_load_driver" name="joy_load_driver">
250 <item><ref id="joy_read" name="joy_read">
251 <item><ref id="joy_uninstall" name="joy_uninstall">
252 <item><ref id="joy_unload" name="joy_unload">
256 <sect1><tt/locale.h/<label id="locale.h"><p>
259 <item><ref id="localeconv" name="localeconv">
260 <item><ref id="setlocale" name="setlocale">
264 <sect1><tt/modload.h/<label id="modload.h"><p>
267 <item><ref id="mod_load" name="mod_load">
268 <item><ref id="mod_free" name="mod_free">
272 <sect1><tt/mouse.h/<label id="mouse.h"><p>
275 <item><ref id="mouse_load_driver" name="mouse_load_driver">
276 <item><ref id="mouse_unload" name="mouse_unload">
277 <item><ref id="mouse_install" name="mouse_install">
278 <item><ref id="mouse_uninstall" name="mouse_uninstall">
279 <item><ref id="mouse_hide" name="mouse_hide">
280 <item><ref id="mouse_show" name="mouse_show">
281 <item><ref id="mouse_box" name="mouse_box">
282 <item><ref id="mouse_move" name="mouse_move">
283 <item><ref id="mouse_buttons" name="mouse_buttons">
284 <item><ref id="mouse_pos" name="mouse_pos">
285 <item><ref id="mouse_info" name="mouse_info">
286 <item><ref id="mouse_ioctl" name="mouse_ioctl">
292 <sect1><tt/nes.h/<label id="nes.h"><p>
297 <sect1><tt/o65.h/<label id="o65.h"><p>
299 The <tt/o65.h/ header file contains structure and constant definitions that
300 may be used when dealing with files in <htmlurl
301 url="http://www.6502.org/users/andre/o65/fileformat.html" name="o65 format">.
302 It does not declare any functions.
305 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
308 <item><ref id="PEEK" name="PEEK">
309 <item><ref id="PEEKW" name="PEEKW">
310 <item><ref id="POKE" name="POKE">
311 <item><ref id="POKEW" name="POKEW">
315 <sect1><tt/pet.h/<label id="pet.h"><p>
320 <sect1><tt/plus4.h/<label id="plus4.h"><p>
325 <sect1><tt/serial.h/<label id="serial.h"><p>
329 <item><ref id="ser_load_driver" name="ser_load_driver">
330 <item><ref id="ser_unload" name="ser_unload">
331 <item><ref id="ser_install" name="ser_install">
332 <item><ref id="ser_uninstall" name="ser_uninstall">
333 <item><ref id="ser_open" name="ser_open">
334 <item><ref id="ser_close" name="ser_close">
335 <item><ref id="ser_get" name="ser_get">
336 <item><ref id="ser_put" name="ser_put">
337 <item><ref id="ser_status" name="ser_status">
338 <item><ref id="ser_ioctl" name="ser_ioctl">
345 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
348 <item><ref id="setjmp" name="setjmp">
349 <item><ref id="longjmp" name="longjmp">
353 <sect1><tt/signal.h/<label id="signal.h"><p>
356 <item><ref id="raise" name="raise">
357 <item><ref id="signal" name="signal">
361 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
366 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
371 <sect1><tt/stddef.h/<label id="stddef.h"><p>
374 <item><ref id="offsetof" name="offsetof">
378 <sect1><tt/stdio.h/<label id="stdio.h"><p>
381 <item><ref id="clearerr" name="clearerr">
382 <!-- <item><ref id="fclose" name="fclose"> -->
383 <!-- <item><ref id="fdopen" name="fdopen"> -->
384 <item><ref id="feof" name="feof">
385 <item><ref id="ferror" name="ferror">
386 <!-- <item><ref id="fflush" name="fflush"> -->
387 <!-- <item><ref id="fgetc" name="fgetc"> -->
388 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
389 <!-- <item><ref id="fgets" name="fgets"> -->
390 <item><ref id="fileno" name="fileno">
391 <!-- <item><ref id="fopen" name="fopen"> -->
392 <!-- <item><ref id="fprintf" name="fprintf"> -->
393 <!-- <item><ref id="fputc" name="fputc"> -->
394 <!-- <item><ref id="fputs" name="fputs"> -->
395 <!-- <item><ref id="fread" name="fread"> -->
396 <!-- <item><ref id="freopen" name="freopen"> -->
397 <!-- <item><ref id="fscanf" name="fscanf"> -->
398 <!-- <item><ref id="fseek" name="fseek"> -->
399 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
400 <!-- <item><ref id="ftell" name="ftell"> -->
401 <!-- <item><ref id="fwrite" name="fwrite"> -->
402 <!-- <item><ref id="getc" name="getc"> -->
403 <!-- <item><ref id="getchar" name="getchar"> -->
404 <!-- <item><ref id="gets" name="gets"> -->
405 <!-- <item><ref id="printf" name="printf"> -->
406 <!-- <item><ref id="putc" name="putc"> -->
407 <!-- <item><ref id="putchar" name="putchar"> -->
408 <!-- <item><ref id="puts" name="puts"> -->
409 <!-- <item><ref id="rename" name="rename"> -->
410 <!-- <item><ref id="rewind" name="rewind"> -->
411 <!-- <item><ref id="scanf" name="scanf"> -->
412 <!-- <item><ref id="sprintf" name="sprintf"> -->
413 <!-- <item><ref id="sscanf" name="sscanf"> -->
414 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
415 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
416 <!-- <item><ref id="vprintf" name="vprintf"> -->
417 <!-- <item><ref id="vscanf" name="vscanf"> -->
418 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
419 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
425 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
428 <item><ref id="_heapadd" name="_heapadd">
429 <item><ref id="_heapblocksize" name="_heapblocksize">
430 <item><ref id="_heapmaxavail" name="_heapmaxavail">
431 <item><ref id="_heapmemavail" name="_heapmemavail">
432 <item><ref id="_poserror" name="_poserror">
433 <item><ref id="_randomize" name="_randomize">
434 <item><ref id="_swap" name="_swap">
435 <item><ref id="abort" name="abort">
436 <item><ref id="abs" name="abs">
437 <item><ref id="atexit" name="atexit">
438 <item><ref id="atoi" name="atoi">
439 <item><ref id="atol" name="atol">
440 <item><ref id="bsearch" name="bsearch">
441 <item><ref id="calloc" name="calloc">
442 <item><ref id="div" name="div">
443 <item><ref id="exit" name="exit">
444 <item><ref id="free" name="free">
445 <item><ref id="getenv" name="getenv">
446 <item><ref id="itoa" name="itoa">
447 <item><ref id="labs" name="labs">
448 <item><ref id="ltoa" name="ltoa">
449 <item><ref id="malloc" name="malloc">
450 <item><ref id="perror" name="perror">
451 <item><ref id="qsort" name="qsort">
452 <item><ref id="rand" name="rand">
453 <item><ref id="realloc" name="realloc">
454 <item><ref id="remove" name="remove">
455 <item><ref id="srand" name="srand">
456 <item><ref id="ultoa" name="ultoa">
457 <item><ref id="utoa" name="utoa">
461 <sect1><tt/string.h/<label id="string.h"><p>
464 <item><ref id="_stroserror" name="_stroserror">
465 <item><ref id="bzero" name="bzero">
466 <item><ref id="memchr" name="memchr">
467 <item><ref id="memcpy" name="memcpy">
468 <item><ref id="memmove" name="memmove">
469 <item><ref id="memset" name="memset">
470 <item><ref id="strcasecmp" name="strcasecmp">
471 <item><ref id="strcat" name="strcat">
472 <item><ref id="strchr" name="strchr">
473 <item><ref id="strcmp" name="strcmp">
474 <item><ref id="strcoll" name="strcoll">
475 <item><ref id="strcpy" name="strcpy">
476 <item><ref id="strcspn" name="strcspn">
477 <item><ref id="strdup" name="strdup">
478 <item><ref id="strerror" name="strerror">
479 <item><ref id="stricmp" name="stricmp">
480 <item><ref id="strlen" name="strlen">
481 <item><ref id="strlower" name="strlower">
482 <item><ref id="strlwr" name="strlwr">
483 <item><ref id="strncat" name="strncat">
484 <item><ref id="strncmp" name="strncmp">
485 <item><ref id="strncpy" name="strncpy">
486 <item><ref id="strrchr" name="strrchr">
487 <item><ref id="strspn" name="strspn">
488 <item><ref id="strstr" name="strstr">
489 <item><ref id="strtok" name="strtok">
490 <item><ref id="strxfrm" name="strxfrm">
491 <item><ref id="strupper" name="strupper">
492 <item><ref id="strupr" name="strupr">
498 <sect1><tt/tgi.h/<label id="tgi.h"><p>
503 <sect1><tt/time.h/<label id="time.h"><p>
506 <!-- <item><ref id="_systime" name="_systime"> -->
507 <!-- <item><ref id="asctime" name="asctime"> -->
508 <!-- <item><ref id="clock" name="clock"> -->
509 <!-- <item><ref id="ctime" name="ctime"> -->
510 <!-- <item><ref id="gmtime" name="gmtime"> -->
511 <!-- <item><ref id="localtime" name="localtime"> -->
512 <!-- <item><ref id="mktime" name="mktime"> -->
513 <!-- <item><ref id="strftime" name="strftime"> -->
514 <item><ref id="time" name="time">
520 <sect1><tt/unistd.h/<label id="unistd.h"><p>
523 <!-- <item><ref id="chdir" name="chdir"> -->
524 <!-- <item><ref id="getcwd" name="getcwd"> -->
525 <!-- <item><ref id="lseek" name="lseek"> -->
526 <!-- <item><ref id="mkdir" name="mkdir"> -->
527 <!-- <item><ref id="read" name="read"> -->
528 <!-- <item><ref id="rmdir" name="rmdir"> -->
529 <item><ref id="sleep" name="sleep">
530 <item><ref id="unlink" name="unlink">
531 <!-- <item><ref id="write" name="write"> -->
537 <sect1><tt/vic20.h/<label id="vic20.h"><p>
542 <sect1><tt/zlib.h/<label id="zlib.h"><p>
547 <sect>Alphabetical function reference<p>
549 <sect1>_heapadd<label id="_heapadd"><p>
553 <tag/Function/Add a block to the heap.
554 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
555 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
556 <tag/Description/The function adds a block of raw memory to the heap.
559 <item>The minimum blocksize that can be added is 6 bytes; the function will
560 ignore smaller blocks.
562 <tag/Availability/cc65
564 <ref id="_heapblocksize" name="_heapblocksize">,
565 <ref id="_heapmaxavail" name="_heapmaxavail">,
566 <ref id="_heapmemavail" name="_heapmemavail">,
567 <ref id="calloc" name="calloc">,
568 <ref id="free" name="free">,
569 <ref id="malloc" name="malloc">,
570 <ref id="realloc" name="realloc">
576 <sect1>_heapblocksize<label id="_heapblocksize"><p>
580 <tag/Function/Return the size of an allocated block.
581 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
582 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
583 <tag/Description/The function returns the size of a block that must have
584 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
585 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
588 <item>Passing a pointer to a block that was is not the result of one of the
589 allocation functions, or that has been free'd will give unpredicable results.
591 <tag/Availability/cc65
593 <ref id="_heapadd" name="_heapadd">,
594 <ref id="_heapmaxavail" name="_heapmaxavail">,
595 <ref id="_heapmemavail" name="_heapmemavail">,
596 <ref id="calloc" name="calloc">,
597 <ref id="free" name="free">,
598 <ref id="malloc" name="malloc">,
599 <ref id="realloc" name="realloc">
605 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
609 <tag/Function/Return the largest block that is available on the heap.
610 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
611 <tag/Declaration/<tt/size_t __fastcall__ _heapmaxavail (void);/
612 <tag/Description/The function returns the size of the largest block that may
613 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
614 <tag/Availability/cc65
616 <ref id="_heapadd" name="_heapadd">,
617 <ref id="_heapblocksize" name="_heapblocksize">,
618 <ref id="_heapmemavail" name="_heapmemavail">,
619 <ref id="calloc" name="calloc">,
620 <ref id="free" name="free">,
621 <ref id="malloc" name="malloc">,
622 <ref id="realloc" name="realloc">
628 <sect1>_heapmemavail<label id="_heapmemavail"><p>
632 <tag/Function/Return the total available space on the heap.
633 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
634 <tag/Declaration/<tt/size_t __fastcall__ _heapmemavail (void);/
635 <tag/Description/The function returns the total number of bytes available on
639 <item>This function is of less use than usually assumed, since the returned
640 heap space may be available but not in one block. So even if this function
641 says that several times more heap space is available than needed, <ref
642 id="malloc" name="malloc"> may still return <tt/NULL/.
644 <tag/Availability/cc65
646 <ref id="_heapadd" name="_heapadd">,
647 <ref id="_heapblocksize" name="_heapblocksize">,
648 <ref id="_heapmaxavail" name="_heapmaxavail">,
649 <ref id="calloc" name="calloc">,
650 <ref id="free" name="free">,
651 <ref id="malloc" name="malloc">,
652 <ref id="realloc" name="realloc">
658 <sect1>_poserror<label id="_poserror"><p>
662 <tag/Function/Print an error message for the error in <tt/_oserrno/.
663 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
664 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
665 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
666 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
667 a colon and a blank. Then the error message for the current contents of
668 <tt/_oserrno/ are printed followed by a newline. The message output is the
669 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
670 argument of <tt/_oserrno/.
673 <item>Since operating system specific error code are - you guessed it -
674 operating system specific, the value in <tt/_oserror/ and the message that is
675 printed depend on the cc65 target.
676 <item>The function is only available as fastcall function, so it may only
677 be used in presence of a prototype.
679 <tag/Availability/cc65
681 <ref id="_stroserror" name="_stroserror">,
682 <ref id="perror" name="perror">
688 <sect1>_randomize<label id="_randomize"><p>
692 <tag/Function/Initialize the pseudo random number generator.
693 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
694 <tag/Declaration/<tt/void _randomize (void);/
695 <tag/Description/The function initializes the random number generator with
696 a seed derived from fast changing hardware events, so the seed itself can be
697 considered random to a certain degree.
698 <tag/Limits/<itemize>
699 <item>The randomness of the seed depends on the machine hardware.
701 <tag/Availability/cc65
703 <ref id="rand" name="rand">,
704 <ref id="srand" name="srand">
710 <sect1>_stroserror<label id="_stroserror"><p>
714 <tag/Function/Return a string describing an OS specific error code.
715 <tag/Header/<tt/<ref id="string.h" name="string.h">/
716 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
717 <tag/Description/<tt/_stroserror/ will return a string describing the given
718 operating system specific error code.
719 <tag/Limits/<itemize>
720 <item>Since operating system specific error code are - you guessed it -
721 operating system specific, the parameter and the string returned depend on the
723 <item>The function is only available as fastcall function, so it may only be
724 used in presence of a prototype.
726 <tag/Availability/cc65
728 <ref id="strerror" name="strerror">
734 <sect1>_swap<label id="_swap"><p>
738 <tag/Function/Swap the contents of memory areas.
739 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
740 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
741 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
742 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
743 <tt/size/ bytes in size.
744 <tag/Limits/<itemize>
745 <item>The memory areas may not overlap, otherwise the results are undefined.
746 <item>The function is only available as fastcall function, so it may only be
747 used in presence of a prototype.
749 <tag/Availability/cc65
751 <ref id="memcpy" name="memcpy">,
752 <ref id="memmove" name="memmove">
758 <sect1>_sys<label id="_sys"><p>
762 <tag/Function/Call a subroutine passing register values.
763 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
764 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
765 <tag/Description/The function will call the subroutine at the address
766 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
767 registers and the CPU flags are set to the values given in the <tt/regs/
768 structure. On return from the subroutine, the new values of the registers and
769 flags are stored back overwriting the old values.
770 <tag/Limits/<itemize>
771 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
772 when calling the subroutine (they are unchanged from their current values).
773 <item>The function is only available as fastcall function, so it may only be
774 used in presence of a prototype.
776 <tag/Availability/cc65
782 <sect1>BRK<label id="BRK"><p>
786 <tag/Function/Insert a 6502 BRK instrunction into the code.
787 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
788 <tag/Declaration/<tt/void BRK (void);/
789 <tag/Description/The function will insert a 6502 BRK instruction into the code
790 which may be used to trigger a debugger.
791 <tag/Limits/<itemize>
792 <item>The function is actually a macro.
793 <item>The inserted instruction may lead to unexpected results if no debugger
796 <tag/Availability/cc65
798 <ref id="CLI" name="CLI">,
799 <ref id="SEI" name="SEI">
805 <sect1>CLI<label id="CLI"><p>
809 <tag/Function/Insert a 6502 CLI instrunction into the code.
810 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
811 <tag/Declaration/<tt/void CLI (void);/
812 <tag/Description/The function will insert a 6502 CLI instruction into the code,
813 so interrupts are enabled. Enabling interrupts has no effects if they are
814 already enabled (the default).
815 <tag/Limits/<itemize>
816 <item>The function is actually a macro.
817 <item>Disabling interrupts may lead to unexpected results.
819 <tag/Availability/cc65
821 <ref id="BRK" name="BRK">,
822 <ref id="SEI" name="SEI">
828 <sect1>PEEK<label id="PEEK"><p>
832 <tag/Function/Read a byte from memory.
833 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
834 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
835 <tag/Description/The function will read the absolute memory given by <tt/addr/
836 and return the value read.
837 <tag/Limits/<itemize>
838 <item>The function is actually a macro.
839 <item>This function depends highly on the platform and environment.
841 <tag/Availability/cc65
843 <ref id="PEEKW" name="PEEKW">,
844 <ref id="POKE" name="POKE">
850 <sect1>PEEKW<label id="PEEKW"><p>
854 <tag/Function/Read a word (two bytes) from memory.
855 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
856 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
857 <tag/Description/The function will read the absolute memory given by <tt/addr/
858 and return the value read. The byte read from the higher address is the high
859 byte of the return value.
860 <tag/Limits/<itemize>
861 <item>The function is actually a macro.
862 <item>This function depends highly on the platform and environment.
863 <item>The order in which the two bytes are read is unspecified and may
864 depend of the address expression used.
866 <tag/Availability/cc65
868 <ref id="PEEK" name="PEEK">,
869 <ref id="POKE" name="POKE">
875 <sect1>POKE<label id="POKE"><p>
879 <tag/Function/Write a byte to memory.
880 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
881 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
882 <tag/Description/The function writes the value <tt/val/ to the absolute
883 memory address given by <tt/addr/.
884 <tag/Limits/<itemize>
885 <item>The function is actually a macro.
886 <item>This function depends highly on the platform and environment.
887 <item>Careless use will cause the program to act strange or may crash the
890 <tag/Availability/cc65
892 <ref id="PEEK" name="PEEK">,
893 <ref id="POKEW" name="POKEW">
899 <sect1>POKEW<label id="POKEW"><p>
903 <tag/Function/Write a word (two bytes) to memory.
904 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
905 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
906 <tag/Description/The function writes the value <tt/val/ to the absolute
907 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
908 the <tt/addr/, the high byte is written to <tt/addr+1/.
909 <tag/Limits/<itemize>
910 <item>The function is actually a macro.
911 <item>This function depends highly on the platform and environment.
912 <item>Careless use will cause the program to act strange or may crash the
914 <item>The order in which the two bytes are written is unspecified and may
915 depend of the address expression used.
917 <tag/Availability/cc65
919 <ref id="PEEK" name="PEEK">,
920 <ref id="POKE" name="POKE">
926 <sect1>SEI<label id="SEI"><p>
930 <tag/Function/Insert a 6502 SEI instrunction into the code.
931 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
932 <tag/Declaration/<tt/void SEI (void);/
933 <tag/Description/The function will insert a 6502 SEI instruction into the code,
934 so interrupts are disabled. Note that non maskable interrupts cannot be
936 <tag/Limits/<itemize>
937 <item>The function is actually a macro.
938 <item>Disabling interrupts may lead to unexpected results.
940 <tag/Availability/cc65
942 <ref id="BRK" name="BRK">,
943 <ref id="CLI" name="CLI">
949 <sect1>abort<label id="abort"><p>
953 <tag/Function/Terminates a program abnormally.
954 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
955 <tag/Declaration/<tt/void abort (void);/
956 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
957 on stderr, then terminates the program with an exit code of 3.
958 <tag/Availability/ISO 9899
960 <ref id="assert" name="assert">,
961 <ref id="exit" name="exit">,
962 <ref id="raise" name="raise">
968 <sect1>abs<label id="abs"><p>
972 <tag/Function/Returns the absolute value of an integer.
973 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
974 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
975 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
977 <tag/Limits/<itemize>
978 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
979 <item>The function is only available as fastcall function, so it may only be
980 used in presence of a prototype.
982 <tag/Availability/ISO 9899
984 <ref id="labs" name="labs">
990 <sect1>assert<label id="assert"><p>
994 <tag/Function/Test a condition and possibly abort.
995 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
996 <tag/Declaration/<tt/void assert (int cond);/
997 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
998 statement. If the condition evaluates t zero (false), assert prints a message
999 on stderr and aborts the program.
1000 <tag/Limits/<itemize>
1001 <item>The function is actually a macro.
1003 <tag/Availability/ISO 9899
1005 <ref id="abort" name="abort">,
1006 <ref id="exit" name="exit">
1012 <sect1>atexit<label id="atexit"><p>
1016 <tag/Function/Register an exit function.
1017 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1018 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1019 <tag/Description/<tt/atexit/ registers the function pointed to by
1020 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1021 terminates, they are called in LIFO order (the last function registered is
1022 called first). <tt/atexit/ returns zero on success and a nonzero value on
1024 <tag/Limits/<itemize>
1025 <item>A maximum of 5 exit functions can be registered.
1026 <item>There is no way to unregister an exit function.
1027 <item>The function is only available as fastcall function, so it may only be
1028 used in presence of a prototype.
1030 <tag/Availability/ISO 9899
1032 <ref id="abort" name="abort">,
1033 <ref id="exit" name="exit">
1039 <sect1>atoi<label id="atoi"><p>
1043 <tag/Function/Convert a string to an integer.
1044 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1045 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1046 <tag/Description/<tt/atoi/ converts the given string into an integer.
1047 Conversion stops as soon as any invalid character is encountered.
1048 <tag/Limits/<itemize>
1049 <item>There is no way to detect any conversion errors.
1050 <item>The function does not check for an numerical overflow when converting.
1051 <item>The function is only available as fastcall function, so it may only be
1052 used in presence of a prototype.
1054 <tag/Availability/ISO 9899
1056 <ref id="atol" name="atol">,
1057 <ref id="itoa" name="itoa">,
1058 <ref id="ltoa" name="ltoa">,
1059 <ref id="ultoa" name="ultoa">,
1060 <ref id="utoa" name="utoa">
1066 <sect1>atol<label id="atol"><p>
1070 <tag/Function/Convert a string to a long integer.
1071 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1072 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1073 <tag/Description/<tt/atol/ converts the given string into a long integer.
1074 Conversion stops as soon as any invalid character is encountered.
1075 <tag/Limits/<itemize>
1076 <item>There is no way to detect any conversion errors.
1077 <item>The function does not check for an numerical overflow when converting.
1078 <item>The function is only available as fastcall function, so it may only be
1079 used in presence of a prototype.
1081 <tag/Availability/ISO 9899
1083 <ref id="atoi" name="atoi">,
1084 <ref id="itoa" name="itoa">,
1085 <ref id="ltoa" name="ltoa">,
1086 <ref id="ultoa" name="ultoa">,
1087 <ref id="utoa" name="utoa">
1093 <sect1>bgcolor<label id="bgcolor"><p>
1097 <tag/Function/Set the background text color.
1098 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1099 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1100 <tag/Description/The function will set a new background color and return the
1101 old (current) one. The background color is valid for the whole text output
1102 area of the screen, not just for new text.
1103 <tag/Limits/<itemize>
1104 <item>Background colors are system dependent. The function may have no effect
1105 on systems where the background color cannot be changed.
1106 <item>The function is only available as fastcall function, so it may only be
1107 used in presence of a prototype.
1109 <tag/Availability/cc65
1111 <ref id="bordercolor" name="bordercolor">,
1112 <ref id="textcolor" name="textcolor">
1118 <sect1>bordercolor<label id="bordercolor"><p>
1122 <tag/Function/Set the border (frame) color.
1123 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1124 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1125 <tag/Description/The function will set a new border color. It returns the old
1126 (current) border color.
1127 <tag/Limits/<itemize>
1128 <item>Border colors are system dependent. The function may have no effect
1129 on systems where the border color cannot be changed.
1130 <item>The function is only available as fastcall function, so it may only
1131 be used in presence of a prototype.
1133 <tag/Availability/cc65
1135 <ref id="bgcolor" name="bgcolor">,
1136 <ref id="textcolor" name="textcolor">
1142 <sect1>bsearch<label id="bsearch"><p>
1146 <tag/Function/Do a binary search in a sorted array.
1147 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1148 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1149 const void* base, size_t n, size_t size,
1150 int (*cmp) (const void*, const void*));/
1151 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1152 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1153 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1154 the function used to compare the members against the key. The function returns
1155 a pointer to the member found, or <tt/NULL/ if there was no match.
1158 <item>The contents of the array must be sorted in ascending order according to
1159 the compare function given.
1160 <item>If there are multiple members that match the key, the function will
1161 return one of the members.
1162 <item>The function is only available as fastcall function, so it may only
1163 be used in presence of a prototype.
1165 <tag/Availability/ISO 9899
1167 <ref id="qsort" name="qsort">
1173 <sect1>bzero<label id="bzero"><p>
1177 <tag/Function/Fill a memory area with zeroes.
1178 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1179 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1180 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1184 <item>The function is non standard and therefore only available in non ANSI
1185 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1186 <item>The function is only available as fastcall function, so it may only
1187 be used in presence of a prototype.
1189 <tag/Availability/cc65
1191 <ref id="_swap" name="_swap">,
1192 <ref id="memcpy" name="memcpy">,
1193 <ref id="memmove" name="memmove">,
1194 <ref id="memset" name="memset">,
1200 <sect1>c64mode<label id="c64mode"><p>
1204 <tag/Function/Switch the C128 into C64 compatible mode.
1205 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1206 <tag/Declaration/<tt/void c64mode (void);/
1207 <tag/Description/The function will cause the machine to reboot into C64 mode.
1208 <tag/Limits/<itemize>
1209 <item>The function is specific to the C128.
1210 <item>The function will not return to the caller.
1212 <tag/Availability/C128
1218 <sect1>calloc<label id="calloc"><p>
1222 <tag/Function/Allocate and clear memory.
1223 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1224 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1225 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1226 of size <tt/size/, clears the whole block with binary zeroes and returns a
1227 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1231 <item>Clearing the memory may not have the expected effect on all platforms:
1232 pointers in the block may not be <tt/NULL/ and floating point variables may
1233 not be zero (0.0). In other words: The "clearing" effect of this function
1234 should be used with care for portable programs.
1235 <item>The function is only available as fastcall function, so it may only
1236 be used in presence of a prototype.
1238 <tag/Availability/ISO 9899
1240 <ref id="_heapadd" name="_heapadd">,
1241 <ref id="_heapblocksize" name="_heapblocksize">,
1242 <ref id="_heapmaxavail" name="_heapmaxavail">,
1243 <ref id="_heapmemavail" name="_heapmemavail">,
1244 <ref id="free" name="free">,
1245 <ref id="malloc" name="malloc">,
1246 <ref id="realloc" name="realloc">
1252 <sect1>cclear<label id="cclear"><p>
1256 <tag/Function/Clear part of a line (write a given number of spaces).
1257 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1258 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
1259 <tag/Description/The function clears part of a line by writing <tt/length/
1260 spaces in the current text color.
1261 <tag/Limits/<itemize>
1262 <item>The function is only available as fastcall function, so it may
1263 only be used in presence of a prototype.
1265 <tag/Availability/cc65
1267 <ref id="cclearxy" name="cclearxy">,
1268 <ref id="clrscr" name="clrscr">
1274 <sect1>cclearxy<label id="cclearxy"><p>
1278 <tag/Function/Clear part of a line (write a given number of spaces) starting
1279 at a specific screen position.
1280 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1281 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
1282 <tag/Description/The function moves the cursor to a specific position, and
1283 will then clear part of the line by writing <tt/length/ spaces in the current
1285 <tag/Limits/<itemize>
1286 <item>The function is only available as fastcall function, so it may
1287 only be used in presence of a prototype.
1289 <tag/Availability/cc65
1291 <ref id="cclear" name="cclear">,
1292 <ref id="clrscr" name="clrscr">
1298 <sect1>cgetc<label id="cgetc"><p>
1302 <tag/Function/Read a character from the keyboard.
1303 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1304 <tag/Declaration/<tt/char cgetc (void);/
1305 <tag/Description/The function reads a character from the keyboard. If there is
1306 no character available, <tt/cgetc/ waits until the user presses a key. If the
1307 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
1308 displayed while waiting.
1309 <tag/Limits/<itemize>
1310 <item>If the system supports a keyboard buffer, <tt/cgetc/ will fetch a key
1311 from this buffer and wait only if the buffer is empty.
1313 <tag/Availability/cc65
1315 <ref id="cursor" name="cursor">,
1316 <ref id="kbhit" name="kbhit">
1322 <sect1>chline<label id="chline"><p>
1326 <tag/Function/Output a horizontal line in text mode.
1327 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1328 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
1329 <tag/Description/The function outputs a horizontal line with the given length
1330 starting at the current cursor position.
1331 <tag/Limits/<itemize>
1332 <item>The character used to draw the horizontal line is system dependent.
1333 If available, a line drawing character is used. Drawing a line that is partially
1334 off screen leads to undefined behaviour.
1335 <item>The function is only available as fastcall function, so it may only be
1336 used in presence of a prototype.
1338 <tag/Availability/cc65
1340 <ref id="chlinexy" name="chlinexy">,
1341 <ref id="cvline" name="cvline">,
1342 <ref id="cvlinexy" name="cvlinexy">
1348 <sect1>chlinexy<label id="chlinexy"><p>
1352 <tag/Function/Output a horizontal line at a given position in text mode.
1353 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1354 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
1355 <tag/Description/The function outputs a horizontal line with the given length
1356 starting at a given position.
1357 <tag/Limits/<itemize>
1358 <item>The character used to draw the horizontal line is system dependent.
1359 If available, a line drawing character is used. Drawing a line that is partially
1360 off screen leads to undefined behaviour.
1361 <item>The function is only available as fastcall function, so it may only be
1362 used in presence of a prototype.
1364 <tag/Availability/cc65
1366 <ref id="chline" name="chline">,
1367 <ref id="cvline" name="cvline">,
1368 <ref id="cvlinexy" name="cvlinexy">
1374 <sect1>clearerr<label id="clearerr"><p>
1378 <tag/Function/Clear error and end-of-file status of a stream.
1379 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1380 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
1381 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
1382 indicators for the stream <tt/f/.
1383 <tag/Limits/<itemize>
1384 <item>The function is only available as fastcall function, so it may only be
1385 used in presence of a prototype.
1387 <tag/Availability/ISO 9899
1389 <ref id="feof" name="feof">,
1390 <ref id="ferror" name="ferror">
1396 <sect1>clrscr<label id="clrscr"><p>
1400 <tag/Function/Clear the text screen.
1401 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1402 <tag/Declaration/<tt/void clrscr (void);/
1403 <tag/Description/The function clears the text screen and moves the cursor to
1404 the upper left corner.
1405 <tag/Availability/cc65
1407 <ref id="cclear" name="cclear">,
1408 <ref id="cclearxy" name="cclearxy">
1414 <sect1>close<label id="close"><p>
1418 <tag/Function/Close a file descriptor.
1419 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1420 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
1421 <tag/Description/The function closes the given file descriptor. It returns zero
1422 on success and -1 on error. If an error occurs, the cause can be determined by
1423 reading the <tt/errno/ variable.
1424 <tag/Limits/<itemize>
1425 <item>The function is only available as fastcall function, so it may only
1426 be used in presence of a prototype.
1428 <tag/Availability/POSIX 1003.1
1430 <ref id="creat" name="creat">,
1431 <ref id="open" name="open">
1437 <sect1>creat<label id="creat"><p>
1441 <tag/Function/Create a file.
1442 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1443 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
1444 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
1445 associated with it. On error, -1 is returned and an error code is stored in
1447 <tag/Limits/<itemize>
1448 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
1449 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
1450 <item>The function is only available as fastcall function, so it may only
1451 be used in presence of a prototype.
1453 <tag/Availability/POSIX 1003.1
1455 <ref id="close" name="close">,
1456 <ref id="open" name="open">
1462 <sect1>cprintf<label id="cprintf"><p>
1466 <tag/Function/Formatted output to the console.
1467 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1468 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
1469 <tag/Description/The arguments are converted to text where necessary and
1470 formatted according to the format string given. The resulting string is output
1471 to the console. <tt/cprintf/ supports the same format specifiers as
1472 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
1473 <tag/Limits/<itemize>
1474 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
1475 between <tt/\r/ and <tt/\n/.
1477 <tag/Availability/cc65
1479 <ref id="cputc" name="cputc">,
1480 <ref id="cputcxy" name="cputcxy">,
1481 <ref id="cputs" name="cputs">,
1482 <ref id="cputsxy" name="cputsxy">,
1483 <ref id="vcprintf" name="vcprintf">
1489 <sect1>cputc<label id="cputc"><p>
1493 <tag/Function/Output a character directly to the console.
1494 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1495 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
1496 <tag/Description/Output one character to the console at the current cursor
1498 <tag/Limits/<itemize>
1499 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
1500 between <tt/\r/ and <tt/\n/.
1501 <item>The function is only available as fastcall function, so it may only
1502 be used in presence of a prototype.
1504 <tag/Availability/cc65
1506 <ref id="cprintf" name="cprintf">,
1507 <ref id="cputcxy" name="cputcxy">,
1508 <ref id="cputs" name="cputs">,
1509 <ref id="cputsxy" name="cputsxy">,
1510 <ref id="vcprintf" name="vcprintf">
1516 <sect1>cputcxy<label id="cputcxy"><p>
1520 <tag/Function/Output a character at a specific screen position.
1521 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1522 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
1523 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
1524 the screen and outputs one character.
1525 <tag/Limits/<itemize>
1526 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
1527 between <tt/\r/ and <tt/\n/.
1528 <item>The function is only available as fastcall function, so it may only
1529 be used in presence of a prototype.
1531 <tag/Availability/cc65
1533 <ref id="cprintf" name="cprintf">,
1534 <ref id="cputc" name="cputc">,
1535 <ref id="cputs" name="cputs">,
1536 <ref id="cputsxy" name="cputsxy">,
1537 <ref id="vcprintf" name="vcprintf">
1543 <sect1>cputs<label id="cputs"><p>
1547 <tag/Function/Output a string directly to the console.
1548 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1549 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
1550 <tag/Description/The function outputs the given string on the console at the
1551 current cursor position.
1552 <tag/Limits/<itemize>
1553 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
1554 between <tt/\r/ and <tt/\n/.
1555 <item>The function is only available as fastcall function, so it may only
1556 be used in presence of a prototype.
1558 <tag/Availability/cc65
1560 <ref id="cprintf" name="cprintf">,
1561 <ref id="cputc" name="cputc">,
1562 <ref id="cputcxy" name="cputcxy">,
1563 <ref id="cputsxy" name="cputsxy">,
1564 <ref id="vcprintf" name="vcprintf">
1570 <sect1>cputsxy<label id="cputsxy"><p>
1574 <tag/Function/Output a string to the console at a given position.
1575 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1576 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
1577 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
1578 and outputs the string <tt/s/.
1579 <tag/Limits/<itemize>
1580 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
1581 between <tt/\r/ and <tt/\n/.
1582 <item>The function is only available as fastcall function, so it may only
1583 be used in presence of a prototype.
1585 <tag/Availability/cc65
1587 <ref id="cprintf" name="cprintf">,
1588 <ref id="cputc" name="cputc">,
1589 <ref id="cputcxy" name="cputcxy">,
1590 <ref id="cputs" name="cputs">,
1591 <ref id="vcprintf" name="vcprintf">
1597 <sect1>cursor<label id="cursor"><p>
1601 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
1602 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1603 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
1604 <tag/Description/If the argument to the function is non zero, a blinking cursor
1605 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
1606 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
1607 <tag/Limits/<itemize>
1608 <item>The function is only available as fastcall function, so it may only
1609 be used in presence of a prototype.
1611 <tag/Availability/cc65
1613 <ref id="cgetc" name="cgetc">,
1614 <ref id="kbhit" name="kbhit">
1620 <sect1>cvline<label id="cvline"><p>
1624 <tag/Function/Output a vertical line in text mode.
1625 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1626 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
1627 <tag/Description/The function outputs a vertical line with the given length
1628 starting at the current cursor position.
1629 <tag/Limits/<itemize>
1630 <item>The character used to draw the vertical line is system dependent.
1631 If available, a line drawing character is used. Drawing a line that is partially
1632 off screen leads to undefined behaviour.
1633 <item>The function is only available as fastcall function, so it may only be
1634 used in presence of a prototype.
1636 <tag/Availability/cc65
1638 <ref id="chline" name="chline">,
1639 <ref id="chlinexy" name="chlinexy">,
1640 <ref id="cvlinexy" name="cvlinexy">
1646 <sect1>cvlinexy<label id="cvlinexy"><p>
1650 <tag/Function/Output a vertical line at a given position in text mode.
1651 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1652 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
1653 <tag/Description/The function outputs a vertical line with the given length
1654 starting at a given position.
1655 <tag/Limits/<itemize>
1656 <item>The character used to draw the vertical line is system dependent.
1657 If available, a line drawing character is used. Drawing a line that is partially
1658 off screen leads to undefined behaviour.
1659 <item>The function is only available as fastcall function, so it may only be
1660 used in presence of a prototype.
1662 <tag/Availability/cc65
1664 <ref id="chline" name="chline">,
1665 <ref id="chlinexy" name="chlinexy">,
1666 <ref id="cvline" name="cvline">
1672 <sect1>div<label id="div"><p>
1676 <tag/Function/Divide two ints and return quotient and remainder.
1677 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1678 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
1679 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
1680 quotient and remainder in a <tt/div_t/ structure.
1683 <item>The function is only available as fastcall function, so it may only
1684 be used in presence of a prototype.
1686 <tag/Availability/ISO 9899
1694 <sect1>em_commit<label id="em_commit"><p>
1698 <tag/Function/Commit changes into extended memory.
1699 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1700 <tag/Declaration/<tt/void __fastcall__ em_commit (void);/
1701 <tag/Description/Commit changes in the memory window to extended storage. If
1702 the contents of the memory window have been changed, these changes may be lost
1703 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
1704 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
1705 name="em_copyto">/ are called without calling <tt/em_commit/ first.
1706 <tag/Limits/<itemize>
1707 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
1708 memory window are discarded, it does just mean that the drivers is allowed
1710 <item>The function is only available as fastcall function, so it may only be
1711 used in presence of a prototype.
1712 <item>The function produces undefined results if no extended memory driver is
1715 <tag/Availability/cc65
1717 <ref id="em_load_driver" name="em_load_driver">,
1718 <ref id="em_map" name="em_map">,
1719 <ref id="em_use" name="em_use">
1725 <sect1>em_copyfrom<label id="em_copyfrom"><p>
1729 <tag/Function/Copy from extended into normal memory.
1730 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1731 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
1732 <tag/Description/Copy data from extended memory into linear memory. Source and
1733 target addresses as well as the number of bytes to transfer are specified in
1734 the <tt/em_copy/ structure that is passed as a parameter.
1735 <tag/Limits/<itemize>
1736 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
1737 made any changes to the data in the window, call <tt/<ref id="em_commit"
1738 name="em_commit">/ first, or the changes are lost.
1739 <item>The function is only available as fastcall function, so it may only be
1740 used in presence of a prototype.
1741 <item>The function produces undefined results if no extended memory driver is
1744 <tag/Availability/cc65
1746 <ref id="em_commit" name="em_commit">,
1747 <ref id="em_copyto" name="em_copyto">,
1748 <ref id="em_load_driver" name="em_load_driver">
1754 <sect1>em_copyto<label id="em_copyto"><p>
1758 <tag/Function/Copy from normal into extended memory.
1759 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1760 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
1761 <tag/Description/Copy data from linear into extended memory. Source and
1762 target addresses as well as the number of bytes to transfer are specified in
1763 the <tt/em_copy/ structure that is passed as a parameter.
1764 <tag/Limits/<itemize>
1765 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
1766 made any changes to the data in the window, call <tt/<ref id="em_commit"
1767 name="em_commit">/ first, or the changes are lost.
1768 <item>The function is only available as fastcall function, so it may only be
1769 used in presence of a prototype.
1770 <item>The function produces undefined results if no extended memory driver is
1773 <tag/Availability/cc65
1775 <ref id="em_commit" name="em_commit">,
1776 <ref id="em_copyfrom" name="em_copyfrom">,
1777 <ref id="em_load_driver" name="em_load_driver">
1783 <sect1>em_install<label id="em_install"><p>
1787 <tag/Function/Install an already loaded extended memory driver.
1788 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1789 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
1790 <tag/Description/The function installs an already loaded extended memory driver
1791 and returns an error code. The function may be used to install a driver linked
1792 statically to the program.
1793 <tag/Limits/<itemize>
1794 <item>Not all drivers are able to detect if the supported hardware is really
1796 <item>The function is only available as fastcall function, so it may only be
1797 used in presence of a prototype.
1799 <tag/Availability/cc65
1801 <ref id="em_load_driver" name="em_load_driver">,
1802 <ref id="em_uninstall" name="em_uninstall">,
1803 <ref id="em_unload" name="em_unload">
1809 <sect1>em_load_driver<label id="em_load_driver"><p>
1813 <tag/Function/Load and initialize an extended memory driver.
1814 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1815 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
1816 <tag/Description/Load an extended memory driver into memory and initialize
1817 it. The function returns an error code that tells if all this has been
1819 <tag/Limits/<itemize>
1820 <item>Not all drivers are able to detect if the supported hardware is really
1822 <item>The function is only available as fastcall function, so it may only be
1823 used in presence of a prototype.
1824 <item>The driver is loaded by name, so currently you must know the type of
1825 extended memory that should be supported. There is no autodetect capability.
1827 <tag/Availability/cc65
1829 <ref id="em_unload" name="em_unload">
1835 <sect1>em_map<label id="em_map"><p>
1839 <tag/Function/Make a page of extended memory accessible.
1840 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1841 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
1842 <tag/Description/The function maps one page of extended memory into linear
1843 memory and returns a pointer to the page frame. Depending on the hardware
1844 and driver, the data is either mapped into the address space or transfered
1845 into a buffer. If you don't need the actual contents of the page (for example
1846 because you're going to overwrite it completely, it is better to call
1847 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
1848 data if it is possible to avoid that.
1849 <tag/Limits/<itemize>
1850 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
1851 made any changes to the data in the window, call <tt/<ref id="em_commit"
1852 name="em_commit">/ first, or the changes are lost.
1853 <item>The function is only available as fastcall function, so it may only be
1854 used in presence of a prototype.
1855 <item>The function produces undefined results if no extended memory driver is
1858 <tag/Availability/cc65
1860 <ref id="em_commit" name="em_commit">,
1861 <ref id="em_load_driver" name="em_load_driver">,
1862 <ref id="em_use" name="em_use">
1868 <sect1>em_pagecount<label id="em_pagecount"><p>
1872 <tag/Function/Return the number of available extended memory pages.
1873 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1874 <tag/Declaration/<tt/unsigned __fastcall__ em_pagecount (void);/
1875 <tag/Description/The function returns the size of the extended memory supported
1876 by the driver in 256 byte pages.
1877 <tag/Limits/<itemize>
1878 <item>The function returns zero if no extended memory driver is loaded.
1879 <item>The function may return zero if the supported hardware was not detected.
1881 <tag/Availability/cc65
1883 <ref id="em_load_driver" name="em_load_driver">
1889 <sect1>em_uninstall<label id="em_uninstall"><p>
1893 <tag/Function/Uninstall an already loaded extended memory driver.
1894 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1895 <tag/Declaration/<tt/unsigned char __fastcall__ em_install (void);/
1896 <tag/Description/The function uninstalls an already loaded extended memory
1897 driver but doesn't remove it from memory.
1898 <tag/Limits/<itemize>
1899 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
1900 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
1901 should be used instead of <tt/em_uninstall/ so the driver is also removed
1903 <item>The function is only available as fastcall function, so it may only be
1904 used in presence of a prototype.
1906 <tag/Availability/cc65
1908 <ref id="em_install" name="em_install">,
1909 <ref id="em_load_driver" name="em_load_driver">,
1910 <ref id="em_unload" name="em_unload">
1916 <sect1>em_unload<label id="em_unload"><p>
1920 <tag/Function/Unload an extended memory driver.
1921 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1922 <tag/Declaration/<tt/unsigned char __fastcall__ em_unload (void);/
1923 <tag/Description/The function unloads a loaded extended memory driver and
1924 frees all memory allocated for the driver.
1925 <tag/Limits/<itemize>
1926 <item>The function does nothing if no driver is loaded.
1928 <tag/Availability/cc65
1930 <ref id="em_load_driver" name="em_load_driver">
1936 <sect1>em_use<label id="em_use"><p>
1940 <tag/Function/Prepare an extended memory page for use.
1941 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1942 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
1943 <tag/Description/The function maps one page of extended memory into linear
1944 memory and returns a pointer to the page frame. This function is similar to
1945 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
1946 actual memory window in the assumption that the existing data is wrong or
1947 will get overwritten.
1948 <tag/Limits/<itemize>
1949 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
1950 made any changes to the data in the window, call <tt/<ref id="em_commit"
1951 name="em_commit">/ first, or the changes are lost.
1952 <item>The function is only available as fastcall function, so it may only be
1953 used in presence of a prototype.
1954 <item>The function produces undefined results if no extended memory driver is
1957 <tag/Availability/cc65
1959 <ref id="em_commit" name="em_commit">,
1960 <ref id="em_load_driver" name="em_load_driver">,
1961 <ref id="em_map" name="em_map">
1967 <sect1>exit<label id="exit"><p>
1971 <tag/Function/Terminate the program.
1972 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1973 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
1974 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
1975 return code of the program. Before termination, all files are closed, buffered
1976 output is written and any functions registered with <tt/<ref id="atexit"
1977 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
1978 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
1980 <tag/Limits/<itemize>
1981 <item>The function is only available as fastcall function, so it may only
1982 be used in presence of a prototype.
1983 <item>It depends on the host machine if the program return code can be
1984 evaluated or is ignored.
1986 <tag/Availability/ISO 9899
1988 <ref id="abort" name="abort">,
1989 <ref id="exit" name="exit">
1995 <sect1>fast<label id="fast"><p>
1999 <tag/Function/Switch the C128 into 2MHz mode.
2000 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
2001 <tag/Declaration/<tt/void fast (void);/
2002 <tag/Description/The function will switch the clock of the C128 to 2MHz. This
2003 will nearly double the speed compared to slow mode.
2004 <tag/Limits/<itemize>
2005 <item>The function is specific to the C128.
2006 <item>2MHz clock will not work in 40 column mode.
2008 <tag/Availability/C128
2010 <ref id="slow" name="slow">,
2011 <ref id="toggle_videomode" name="toggle_videomode">
2017 <sect1>feof<label id="feof"><p>
2021 <tag/Function/Return the end-of-file indicator of a stream.
2022 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2023 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
2024 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
2025 <tt/f/, and returns a non zero value if it is set.
2026 <tag/Limits/<itemize>
2027 <item>The indicator is set only after a read past the end of a file is
2029 <item>The function is only available as fastcall function, so it may only be
2030 used in presence of a prototype.
2032 <tag/Availability/ISO 9899
2034 <ref id="feof" name="clearerr">,
2035 <ref id="ferror" name="ferror">
2041 <sect1>ferror<label id="ferror"><p>
2045 <tag/Function/Return the error indicator of a stream.
2046 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2047 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
2048 <tag/Description/<tt/ferror/ tests the error indicator of the stream
2049 <tt/f/, and returns a non zero value if it is set.
2050 <tag/Limits/<itemize>
2051 <item>The function is only available as fastcall function, so it may only be
2052 used in presence of a prototype.
2054 <tag/Availability/ISO 9899
2056 <ref id="feof" name="clearerr">,
2057 <ref id="ferror" name="feof">
2063 <sect1>fileno<label id="fileno"><p>
2067 <tag/Function/Return the file handle used by a stream.
2068 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2069 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
2070 <tag/Description/The <tt/fileno/ function returns the file handle used
2071 internally by a C stream. This file handle (an integer) can be used as a
2072 handle for the POSIX input/output functions.
2073 <tag/Limits/<itemize>
2074 <item>The function is only available as fastcall function, so it may only be
2075 used in presence of a prototype.
2076 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
2077 file may have unpredictable results.
2079 <tag/Availability/POSIX 1003.1
2081 <ref id="creat" name="creat">,
2082 <ref id="open" name="open"> <!-- , -->
2083 <!-- <ref id="read" name="read">, -->
2084 <!-- <ref id="write" name="write"> -->
2090 <sect1>free<label id="free"><p>
2094 <tag/Function/Free a block of dynamic memory.
2095 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2096 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
2097 <tag/Description/Free a block of dynamic memory previously allocated with
2098 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
2099 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
2100 pointer is <tt/NULL/, no action is performed.
2103 <item>Passing an already free'd block to <tt/free/ again will cause undefined
2104 behaviour and may crash your program.
2105 <item>The function is only available as fastcall function, so it may only
2106 be used in presence of a prototype.
2108 <tag/Availability/ISO 9899
2110 <ref id="_heapadd" name="_heapadd">,
2111 <ref id="_heapblocksize" name="_heapblocksize">,
2112 <ref id="_heapmaxavail" name="_heapmaxavail">,
2113 <ref id="_heapmemavail" name="_heapmemavail">,
2114 <ref id="calloc" name="calloc">,
2115 <ref id="malloc" name="malloc">,
2116 <ref id="realloc" name="realloc">
2122 <sect1>get_ostype<label id="get_ostype"><p>
2126 <tag/Function/The function returns the operating system, the program runs on.
2127 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
2128 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
2129 <tag/Declaration/<tt/unsigned char get_ostype (void);/
2130 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
2131 all supported targets. If it exists, it returns a number that identifies the
2132 operating system or machine type, the program runs on. The machine dependent
2133 header files define constants that can be used to check the return code.
2134 <tag/Limits/<itemize>
2135 <item>The function does not exist on all platforms.
2136 <item>The return codes are platform dependent.
2138 <tag/Availability/cc65 (not all platforms)
2144 <sect1>getenv<label id="getenv"><p>
2148 <tag/Function/Return a value from the environment.
2149 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2150 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
2151 <tag/Description/The function searches the environment for an entry that
2152 matches <tt/name/ and returns its value. The environment consists of a list
2153 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
2155 <tag/Limits/<itemize>
2156 <item>What exactly is stored in the environment depends on the machine the
2157 program is running on.
2158 <item>The function is only available as fastcall function, so it may only
2159 be used in presence of a prototype.
2161 <tag/Availability/ISO 9899
2167 <sect1>getcpu<label id="getcpu"><p>
2171 <tag/Function/Determine on which CPU the program is running.
2172 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
2173 <tag/Declaration/<tt/unsigned char getcpu (void);/
2174 <tag/Description/The function checks on which CPU the code is running. It
2175 returns one of the constants<itemize>
2177 <item><tt/CPU_65C02/
2178 <item><tt/CPU_65816/
2180 <tag/Limits/<itemize>
2181 <item>Other, more exotic CPU types are not disinguished.
2183 <tag/Availability/cc65
2189 <sect1>gotox<label id="gotox"><p>
2193 <tag/Function/Move the text mode cursor to a new X position.
2194 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2195 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
2196 <tag/Description/The function moves the text mode cursor to the specified X
2197 position while leaving the Y position untouched. The leftmost position on the
2198 screen has the coordinate 0.
2199 <tag/Limits/<itemize>
2200 <item>The function is only available as fastcall function, so it may
2201 only be used in presence of a prototype.
2202 <item>Invalid values for the X position (out of screen coordinates) may
2203 lead to undefined behaviour.
2205 <tag/Availability/cc65
2207 <ref id="gotoy" name="gotoy">,
2208 <ref id="gotoxy" name="gotoxy">,
2209 <ref id="wherex" name="wherex">,
2210 <ref id="wherey" name="wherey">
2216 <sect1>gotoxy<label id="gotoxy"><p>
2220 <tag/Function/Move the text mode cursor to a new position.
2221 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2222 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
2223 <tag/Description/The function moves the text mode cursor to the specified
2224 position. The leftmost position on the screen has the X coordinate 0, the
2225 topmost line has the Y coordinate 0.
2226 <tag/Limits/<itemize>
2227 <item>The function is only available as fastcall function, so it may only be
2228 used in presence of a prototype.
2229 <item>Invalid values for any of both coordinates (out of screen positions) may
2230 lead to undefined behaviour.
2232 <tag/Availability/cc65
2234 <ref id="gotox" name="gotox">,
2235 <ref id="gotoy" name="gotoy">,
2236 <ref id="wherex" name="wherex">,
2237 <ref id="wherey" name="wherey">
2243 <sect1>gotoy<label id="gotoy"><p>
2247 <tag/Function/Move the text mode cursor to a new Y position.
2248 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2249 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
2250 <tag/Description/The function moves the text mode cursor to the specified Y
2251 position while leaving the X position untouched. The uppermost position on the
2252 screen has the coordinate 0.
2253 <tag/Limits/<itemize>
2254 <item>The function is only available as fastcall function, so it may
2255 only be used in presence of a prototype.
2256 <item>Invalid values for the Y position (out of screen coordinates) may lead
2257 to undefined behaviour.
2259 <tag/Availability/cc65
2261 <ref id="gotox" name="gotox">,
2262 <ref id="gotoxy" name="gotoxy">,
2263 <ref id="wherex" name="wherex">,
2264 <ref id="wherey" name="wherey">
2270 <sect1>isalnum<label id="isalnum"><p>
2274 <tag/Function/Check if a given character is a letter or digit.
2275 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2276 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
2277 <tag/Description/The function returns a value of zero if the given argument
2278 is a letter or digit. The return value is non zero if the character
2280 <tag/Limits/<itemize>
2281 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2282 inline sequence generated by the macro will not work correctly for values
2283 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2284 this range. The non inline function may be accessed by <tt/#undef/'ing
2286 <item>When compiling without <tt/-Os/, the function is only available as
2287 fastcall function, so it may only be used in presence of a prototype.
2289 <tag/Availability/ISO 9899
2291 <ref id="isalpha" name="isalpha">,
2292 <ref id="isascii" name="isascii">,
2293 <ref id="isblank" name="isblank">,
2294 <ref id="iscntrl" name="iscntrl">,
2295 <ref id="isdigit" name="isdigit">,
2296 <ref id="isgraph" name="isgraph">,
2297 <ref id="islower" name="islower">,
2298 <ref id="isprint" name="isprint">,
2299 <ref id="ispunct" name="ispunct">,
2300 <ref id="isspace" name="isspace">,
2301 <ref id="isupper" name="isupper">,
2302 <ref id="isxdigit" name="isxdigit">
2308 <sect1>isalpha<label id="isalpha"><p>
2312 <tag/Function/Check if a given character is a letter.
2313 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2314 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
2315 <tag/Description/The function returns a value of zero if the given argument
2316 is a letter. The return value is non zero if the character is anything else.
2317 <tag/Limits/<itemize>
2318 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2319 inline sequence generated by the macro will not work correctly for values
2320 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2321 this range. The non inline function may be accessed by <tt/#undef/'ing the
2323 <item>When compiling without <tt/-Os/, the function is only available as
2324 fastcall function, so it may only be used in presence of a prototype.
2326 <tag/Availability/ISO 9899
2328 <ref id="isalnum" name="isalnum">,
2329 <ref id="isascii" name="isascii">,
2330 <ref id="isblank" name="isblank">,
2331 <ref id="iscntrl" name="iscntrl">,
2332 <ref id="isdigit" name="isdigit">,
2333 <ref id="isgraph" name="isgraph">,
2334 <ref id="islower" name="islower">,
2335 <ref id="isprint" name="isprint">,
2336 <ref id="ispunct" name="ispunct">,
2337 <ref id="isspace" name="isspace">,
2338 <ref id="isupper" name="isupper">,
2339 <ref id="isxdigit" name="isxdigit">
2345 <sect1>isascii<label id="isascii"><p>
2349 <tag/Function/Check if a given character is in the ASCII (0..127) range.
2350 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2351 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
2352 <tag/Description/The function returns a value of zero if the given argument
2353 is in the range 0..127 (the range of valid ASCII characters) and a non zero
2355 <tag/Limits/<itemize>
2356 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2357 inline sequence generated by the macro will not work correctly for values
2358 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2359 this range. The non inline function may be accessed by <tt/#undef/'ing the
2361 <item>When compiling without <tt/-Os/, the function is only available as
2362 fastcall function, so it may only be used in presence of a prototype.
2364 <tag/Availability/ISO 9899
2366 <ref id="isalnum" name="isalnum">,
2367 <ref id="isalpha" name="isalpha">,
2368 <ref id="isblank" name="isblank">,
2369 <ref id="iscntrl" name="iscntrl">,
2370 <ref id="isdigit" name="isdigit">,
2371 <ref id="isgraph" name="isgraph">,
2372 <ref id="islower" name="islower">,
2373 <ref id="isprint" name="isprint">,
2374 <ref id="ispunct" name="ispunct">,
2375 <ref id="isspace" name="isspace">,
2376 <ref id="isupper" name="isupper">,
2377 <ref id="isxdigit" name="isxdigit">
2383 <sect1>isblank<label id="isblank"><p>
2387 <tag/Function/Check if a given character is a space or tab.
2388 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2389 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
2390 <tag/Description/The function returns a value of zero if the given argument
2391 is a space or tab character. The return value is non zero if the character
2393 <tag/Limits/<itemize>
2394 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2395 inline sequence generated by the macro will not work correctly for values
2396 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2397 this range. The non inline function may be accessed by <tt/#undef/'ing the
2399 <item>When compiling without <tt/-Os/, the function is only available as
2400 fastcall function, so it may only be used in presence of a prototype.
2402 <tag/Availability/cc65
2404 <ref id="isalnum" name="isalnum">,
2405 <ref id="isalpha" name="isalpha">,
2406 <ref id="isascii" name="isascii">,
2407 <ref id="iscntrl" name="iscntrl">,
2408 <ref id="isdigit" name="isdigit">,
2409 <ref id="isgraph" name="isgraph">,
2410 <ref id="islower" name="islower">,
2411 <ref id="isprint" name="isprint">,
2412 <ref id="ispunct" name="ispunct">,
2413 <ref id="isspace" name="isspace">,
2414 <ref id="isupper" name="isupper">,
2415 <ref id="isxdigit" name="isxdigit">
2421 <sect1>iscntrl<label id="iscntrl"><p>
2425 <tag/Function/Check if a given character is a control character.
2426 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2427 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
2428 <tag/Description/The function returns a value of zero if the given argument
2429 is a control character. The return value is non zero if the character
2431 <tag/Limits/<itemize>
2432 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2433 inline sequence generated by the macro will not work correctly for values
2434 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2435 this range. The non inline function may be accessed by <tt/#undef/'ing the
2437 <item>When compiling without <tt/-Os/, the function is only available as
2438 fastcall function, so it may only be used in presence of a prototype.
2440 <tag/Availability/ISO 9899
2442 <ref id="isalnum" name="isalnum">,
2443 <ref id="isalpha" name="isalpha">,
2444 <ref id="isascii" name="isascii">,
2445 <ref id="isblank" name="isblank">,
2446 <ref id="isdigit" name="isdigit">,
2447 <ref id="isgraph" name="isgraph">,
2448 <ref id="islower" name="islower">,
2449 <ref id="isprint" name="isprint">,
2450 <ref id="ispunct" name="ispunct">,
2451 <ref id="isspace" name="isspace">,
2452 <ref id="isupper" name="isupper">,
2453 <ref id="isxdigit" name="isxdigit">
2459 <sect1>isdigit<label id="isdigit"><p>
2463 <tag/Function/Check if a given character is a digit.
2464 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2465 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
2466 <tag/Description/The function returns a value of zero if the given argument
2467 is a digit. The return value is non zero if the character is anything else.
2468 <tag/Limits/<itemize>
2469 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2470 inline sequence generated by the macro will not work correctly for values
2471 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2472 this range. The non inline function may be accessed by <tt/#undef/'ing the
2474 <item>When compiling without <tt/-Os/, the function is only available as
2475 fastcall function, so it may only be used in presence of a prototype.
2477 <tag/Availability/ISO 9899
2479 <ref id="isalnum" name="isalnum">,
2480 <ref id="isalpha" name="isalpha">,
2481 <ref id="isascii" name="isascii">,
2482 <ref id="isblank" name="isblank">,
2483 <ref id="iscntrl" name="iscntrl">,
2484 <ref id="isgraph" name="isgraph">,
2485 <ref id="islower" name="islower">,
2486 <ref id="isprint" name="isprint">,
2487 <ref id="ispunct" name="ispunct">,
2488 <ref id="isspace" name="isspace">,
2489 <ref id="isupper" name="isupper">,
2490 <ref id="isxdigit" name="isxdigit">
2496 <sect1>isgraph<label id="isgraph"><p>
2500 <tag/Function/Check if a given character is a printable character (except
2502 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2503 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
2504 <tag/Description/The function returns a value of zero if the given argument
2505 is a printable character with the exception of space. The return value is non
2506 zero if the character is anything else.
2507 <tag/Limits/<itemize>
2508 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2509 inline sequence generated by the macro will not work correctly for values
2510 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2511 this range. The non inline function may be accessed by <tt/#undef/'ing the
2513 <item>When compiling without <tt/-Os/, the function is only available as
2514 fastcall function, so it may only be used in presence of a prototype.
2516 <tag/Availability/ISO 9899
2518 <ref id="isalnum" name="isalnum">,
2519 <ref id="isalpha" name="isalpha">,
2520 <ref id="isascii" name="isascii">,
2521 <ref id="isblank" name="isblank">,
2522 <ref id="iscntrl" name="iscntrl">,
2523 <ref id="isdigit" name="isdigit">,
2524 <ref id="islower" name="islower">,
2525 <ref id="isprint" name="isprint">,
2526 <ref id="ispunct" name="ispunct">,
2527 <ref id="isspace" name="isspace">,
2528 <ref id="isupper" name="isupper">,
2529 <ref id="isxdigit" name="isxdigit">
2535 <sect1>islower<label id="islower"><p>
2539 <tag/Function/Check if a given character is a lower case letter.
2540 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2541 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
2542 <tag/Description/The function returns a value of zero if the given argument
2543 is a lower case letter. The return value is non zero if the character is
2545 <tag/Limits/<itemize>
2546 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2547 inline sequence generated by the macro will not work correctly for values
2548 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2549 this range. The non inline function may be accessed by <tt/#undef/'ing the
2551 <item>When compiling without <tt/-Os/, the function is only available as
2552 fastcall function, so it may only be used in presence of a prototype.
2554 <tag/Availability/ISO 9899
2556 <ref id="isalnum" name="isalnum">,
2557 <ref id="isalpha" name="isalpha">,
2558 <ref id="isascii" name="isascii">,
2559 <ref id="isblank" name="isblank">,
2560 <ref id="iscntrl" name="iscntrl">,
2561 <ref id="isdigit" name="isdigit">,
2562 <ref id="isgraph" name="isgraph">,
2563 <ref id="isprint" name="isprint">,
2564 <ref id="ispunct" name="ispunct">,
2565 <ref id="isspace" name="isspace">,
2566 <ref id="isupper" name="isupper">,
2567 <ref id="isxdigit" name="isxdigit">
2573 <sect1>isprint<label id="isprint"><p>
2577 <tag/Function/Check if a given character is a printable character.
2578 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2579 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
2580 <tag/Description/The function returns a value of zero if the given argument
2581 is a printable character (this includes the space character). The return value
2582 is non zero if the character is anything else.
2583 <tag/Limits/<itemize>
2584 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2585 inline sequence generated by the macro will not work correctly for values
2586 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2587 this range. The non inline function may be accessed by <tt/#undef/'ing the
2589 <item>When compiling without <tt/-Os/, the function is only available as
2590 fastcall function, so it may only be used in presence of a prototype.
2592 <tag/Availability/ISO 9899
2594 <ref id="isalnum" name="isalnum">,
2595 <ref id="isalpha" name="isalpha">,
2596 <ref id="isascii" name="isascii">,
2597 <ref id="isblank" name="isblank">,
2598 <ref id="iscntrl" name="iscntrl">,
2599 <ref id="isdigit" name="isdigit">,
2600 <ref id="isgraph" name="isgraph">,
2601 <ref id="islower" name="islower">,
2602 <ref id="ispunct" name="ispunct">,
2603 <ref id="isspace" name="isspace">,
2604 <ref id="isupper" name="isupper">,
2605 <ref id="isxdigit" name="isxdigit">
2611 <sect1>ispunct<label id="ispunct"><p>
2615 <tag/Function/Check if a given character is a printable character but not a
2616 space or an alphanumeric character.
2617 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2618 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
2619 <tag/Description/The function returns a value of zero if the given argument
2620 is a printable character, but not a space or anything alphanumeric. The return
2621 value is non zero if the character is anything else.
2622 <tag/Limits/<itemize>
2623 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2624 inline sequence generated by the macro will not work correctly for values
2625 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2626 this range. The non inline function may be accessed by <tt/#undef/'ing the
2628 <item>When compiling without <tt/-Os/, the function is only available as
2629 fastcall function, so it may only be used in presence of a prototype.
2631 <tag/Availability/ISO 9899
2633 <ref id="isalnum" name="isalnum">,
2634 <ref id="isalpha" name="isalpha">,
2635 <ref id="isascii" name="isascii">,
2636 <ref id="isblank" name="isblank">,
2637 <ref id="iscntrl" name="iscntrl">,
2638 <ref id="isdigit" name="isdigit">,
2639 <ref id="isgraph" name="isgraph">,
2640 <ref id="islower" name="islower">,
2641 <ref id="isprint" name="isprint">,
2642 <ref id="isspace" name="isspace">,
2643 <ref id="isupper" name="isupper">,
2644 <ref id="isxdigit" name="isxdigit">
2650 <sect1>isspace<label id="isspace"><p>
2654 <tag/Function/Check if a given character is a a white-space character.
2655 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2656 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
2657 <tag/Description/The function returns a value of zero if the given argument
2658 is a white space character. The return value is non zero if the character is
2659 anything else. The standard white space characters are: space, formfeed ('\f'),
2660 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
2662 <tag/Limits/<itemize>
2663 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2664 inline sequence generated by the macro will not work correctly for values
2665 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2666 this range. The non inline function may be accessed by <tt/#undef/'ing the
2668 <item>When compiling without <tt/-Os/, the function is only available as
2669 fastcall function, so it may only be used in presence of a prototype.
2671 <tag/Availability/ISO 9899
2673 <ref id="isalnum" name="isalnum">,
2674 <ref id="isalpha" name="isalpha">,
2675 <ref id="isascii" name="isascii">,
2676 <ref id="isblank" name="isblank">,
2677 <ref id="iscntrl" name="iscntrl">,
2678 <ref id="isdigit" name="isdigit">,
2679 <ref id="isgraph" name="isgraph">,
2680 <ref id="islower" name="islower">,
2681 <ref id="isprint" name="isprint">,
2682 <ref id="ispunct" name="ispunct">,
2683 <ref id="isupper" name="isupper">,
2684 <ref id="isxdigit" name="isxdigit">
2690 <sect1>isupper<label id="isupper"><p>
2694 <tag/Function/Check if a given character is an upper case letter.
2695 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2696 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
2697 <tag/Description/The function returns a value of zero if the given argument
2698 is an upper case letter. The return value is non zero if the character is
2700 <tag/Limits/<itemize>
2701 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2702 inline sequence generated by the macro will not work correctly for values
2703 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2704 this range. The non inline function may be accessed by <tt/#undef/'ing the
2706 <item>When compiling without <tt/-Os/, the function is only available as
2707 fastcall function, so it may only be used in presence of a prototype.
2709 <tag/Availability/ISO 9899
2711 <ref id="isalnum" name="isalnum">,
2712 <ref id="isalpha" name="isalpha">,
2713 <ref id="isascii" name="isascii">,
2714 <ref id="isblank" name="isblank">,
2715 <ref id="iscntrl" name="iscntrl">,
2716 <ref id="isdigit" name="isdigit">,
2717 <ref id="isgraph" name="isgraph">,
2718 <ref id="islower" name="islower">,
2719 <ref id="isprint" name="isprint">,
2720 <ref id="ispunct" name="ispunct">,
2721 <ref id="isspace" name="isspace">,
2722 <ref id="isxdigit" name="isxdigit">
2728 <sect1>isxdigit<label id="isxdigit"><p>
2732 <tag/Function/Check if a given character is a hexadecimal digit.
2733 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2734 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
2735 <tag/Description/The function returns a value of zero if the given argument
2736 is a hexadecimal digit (0..9, a..f and A..F). The return value is non zero
2737 if the character is anything else.
2738 <tag/Limits/<itemize>
2739 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2740 inline sequence generated by the macro will not work correctly for values
2741 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2742 this range. The non inline function may be accessed by <tt/#undef/'ing the
2744 <item>When compiling without <tt/-Os/, the function is only available as
2745 fastcall function, so it may only be used in presence of a prototype.
2747 <tag/Availability/ISO 9899
2749 <ref id="isalnum" name="isalnum">,
2750 <ref id="isalpha" name="isalpha">,
2751 <ref id="isascii" name="isascii">,
2752 <ref id="isblank" name="isblank">,
2753 <ref id="iscntrl" name="iscntrl">,
2754 <ref id="isdigit" name="isdigit">,
2755 <ref id="isgraph" name="isgraph">,
2756 <ref id="islower" name="islower">,
2757 <ref id="isprint" name="isprint">,
2758 <ref id="ispunct" name="ispunct">,
2759 <ref id="isspace" name="isspace">,
2760 <ref id="isupper" name="isupper">
2766 <sect1>itoa<label id="itoa"><p>
2770 <tag/Function/Convert an integer into a string.
2771 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2772 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
2773 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
2774 <tt/radix/ as the base.
2775 <tag/Limits/<itemize>
2776 <item>There are no provisions to prevent a buffer overflow.
2777 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
2778 <item>The function is non standard, so it is not available in strict ANSI mode.
2779 You should probably use <tt/sprintf/ instead.
2780 <item>The function is only available as fastcall function, so it may only be
2781 used in presence of a prototype.
2783 <tag/Availability/cc65
2785 <ref id="atoi" name="atoi">,
2786 <ref id="atol" name="atol">,
2787 <ref id="ltoa" name="ltoa">,
2788 <ref id="ultoa" name="ultoa">,
2789 <ref id="utoa" name="utoa">
2795 <sect1>joy_count<label id="joy_count"><p>
2799 <tag/Function/Return the number of joysticks supported by the current driver.
2800 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2801 <tag/Declaration/<tt/unsigned char __fastcall__ joy_count (void);/
2802 <tag/Description/The function returns a the number of joysticks supported
2803 by the current joystick driver.
2804 <tag/Limits/<itemize>
2805 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
2806 name="joy_load_driver"> before calling this function.
2807 <item>The function returns the number of joysticks supported by the driver.
2808 There's no way to check for the number of actually connected joysticks.
2809 <item>The function is only available as fastcall function, so it may only be
2810 used in presence of a prototype.
2812 <tag/Availability/cc65
2814 <ref id="joy_load_driver" name="joy_load_driver">,
2815 <ref id="joy_read" name="joy_read">
2821 <sect1>joy_install<label id="joy_install"><p>
2825 <tag/Function/Install an already loaded driver and return an error code.
2826 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2827 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
2828 <tag/Description/The function installs a driver that was already loaded into
2829 memory (or linked statically to the program). It returns an error code
2830 (<tt/JOY_ERR_OK/ in case of success).
2831 <tag/Limits/<itemize>
2832 <item>The function is only available as fastcall function, so it may only be
2833 used in presence of a prototype.
2835 <tag/Availability/cc65
2837 <ref id="joy_load_driver" name="joy_load_driver">,
2838 <ref id="joy_uninstall" name="joy_uninstall">,
2839 <ref id="joy_unload" name="joy_unload">
2845 <sect1>joy_load_driver<label id="joy_load_driver"><p>
2849 <tag/Function/Load a driver from disk and install it.
2850 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2851 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
2852 <tag/Description/The function loads a driver with the given name from disk
2853 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
2854 driver was successfully loaded and installed.
2855 <tag/Limits/<itemize>
2856 <item>The function is only available as fastcall function, so it may only be
2857 used in presence of a prototype.
2859 <tag/Availability/cc65
2861 <ref id="joy_install" name="joy_install">,
2862 <ref id="joy_uninstall" name="joy_uninstall">,
2863 <ref id="joy_unload" name="joy_unload">
2869 <sect1>joy_read<label id="joy_read"><p>
2873 <tag/Function/Read the status of a joystick.
2874 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2875 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
2876 <tag/Description/The function reads the status bits for a joystick. The number
2877 of the joystick is passed as parameter. The result may be examined by using one
2878 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
2879 <tag/Limits/<itemize>
2880 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
2881 name="joy_load_driver"> before calling this function.
2882 <item>The function is only available as fastcall function, so it may only be
2883 used in presence of a prototype.
2885 <tag/Availability/cc65
2887 <ref id="joy_count" name="joy_count">,
2888 <ref id="joy_load_driver" name="joy_load_driver">,
2889 <ref id="joy_unload" name="joy_unload">
2895 <sect1>joy_uninstall<label id="joy_uninstall"><p>
2899 <tag/Function/Uninstall the current joystick driver.
2900 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2901 <tag/Declaration/<tt/unsigned char __fastcall__ joy_uninstall (void);/
2902 <tag/Description/The function uninstalls the currently installed joystick
2903 driver. It does not remove the driver from memory. The function returns an
2904 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
2905 <tag/Limits/<itemize>
2906 <item>A joystick driver must be installed using <ref id="joy_install"
2907 name="joy_install"> before calling this function.
2908 <item>The function is only available as fastcall function, so it may only be
2909 used in presence of a prototype.
2911 <tag/Availability/cc65
2913 <ref id="joy_install" name="joy_install">,
2914 <ref id="joy_load_driver" name="joy_load_driver">,
2915 <ref id="joy_unload" name="joy_unload">
2921 <sect1>joy_unload<label id="joy_unload"><p>
2925 <tag/Function/Uninstall, then unload the current joystick driver.
2926 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
2927 <tag/Declaration/<tt/unsigned char __fastcall__ joy_unload (void);/
2928 <tag/Description/The function uninstalls the currently installed joystick
2929 driver and removes it from memory. An error code is returned, which is
2930 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
2931 <tag/Limits/<itemize>
2932 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
2933 name="joy_load_driver"> before calling this function.
2934 <item>The function is only available as fastcall function, so it may only be
2935 used in presence of a prototype.
2937 <tag/Availability/cc65
2939 <ref id="joy_load_driver" name="joy_load_driver">
2945 <sect1>kbhit<label id="kbhit"><p>
2949 <tag/Function/Check if there's a key waiting in the keyboard buffer.
2950 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2951 <tag/Declaration/<tt/unsigned char kbhit (void);/
2952 <tag/Description/The function returns a value of zero if there is no character
2953 waiting to be read from the keyboard. It returns non zero otherwise.
2954 <tag/Limits/<itemize>
2955 <item>If the system does not support a keyboard buffer (most systems
2956 do), the function is rather useless.
2958 <tag/Availability/cc65
2960 <ref id="cgetc" name="cgetc">,
2961 <ref id="cursor" name="cursor">
2967 <sect1>labs<label id="labs"><p>
2971 <tag/Function/Returns the absolute value of a long integer.
2972 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2973 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
2974 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
2976 <tag/Limits/<itemize>
2977 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
2978 <item>The function is only available as fastcall function, so it may only be
2979 used in presence of a prototype.
2981 <tag/Availability/ISO 9899
2983 <ref id="abs" name="abs">
2989 <sect1>ltoa<label id="ltoa"><p>
2993 <tag/Function/Convert a long integer into a string.
2994 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2995 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
2996 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
2997 using <tt/radix/ as the base.
2998 <tag/Limits/<itemize>
2999 <item>There are no provisions to prevent a buffer overflow.
3000 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
3001 <item>The function is non standard, so it is not available in strict ANSI mode.
3002 You should probably use <tt/sprintf/ instead.
3003 <item>The function is only available as fastcall function, so it may only be
3004 used in presence of a prototype.
3006 <tag/Availability/cc65
3008 <ref id="atoi" name="atoi">,
3009 <ref id="atol" name="atol">,
3010 <ref id="itoa" name="itoa">,
3011 <ref id="ultoa" name="ultoa">,
3012 <ref id="utoa" name="utoa">
3018 <sect1>localeconv<label id="localeconv"><p>
3022 <tag/Function/Returns a pointer to the current locale structure.
3023 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
3024 <tag/Declaration/<tt/struct lconv* localeconv (void);/
3025 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
3027 <tag/Limits/<itemize>
3028 <item>cc65 supports only the "C" locale, so even after setting a new locale
3029 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
3032 <tag/Availability/ISO 9899
3034 <ref id="setlocale" name="setlocale">
3040 <sect1>longjmp<label id="longjmp"><p>
3044 <tag/Function/Non local goto.
3045 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
3046 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
3047 <tag/Description/The <tt/longjmp/ function restores a program context from the
3048 data in <tt/buf/, which must have been set by a preceeding call to
3049 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
3050 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
3054 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
3055 was called with a value of one.
3056 <item>The function is only available as fastcall function, so it may only
3057 be used in presence of a prototype.
3059 <tag/Availability/ISO 9899
3061 <ref id="setjmp" name="setjmp">
3067 <sect1>malloc<label id="malloc"><p>
3071 <tag/Function/Allocate dynamic memory.
3072 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3073 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
3074 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
3075 pointer to the allocated memory block. On error (not enough memory available),
3076 <tt/malloc/ returns <tt/NULL/.
3079 <item>The function is only available as fastcall function, so it may only
3080 be used in presence of a prototype.
3082 <tag/Availability/ISO 9899
3084 <ref id="_heapadd" name="_heapadd">,
3085 <ref id="_heapblocksize" name="_heapblocksize">,
3086 <ref id="_heapmaxavail" name="_heapmaxavail">,
3087 <ref id="_heapmemavail" name="_heapmemavail">,
3088 <ref id="calloc" name="calloc">,
3089 <ref id="free" name="free">,
3090 <ref id="realloc" name="realloc">,
3091 <ref id="strdup" name="strdup">
3097 <sect1>memchr<label id="memchr"><p>
3101 <tag/Function/Search for a character in a block of raw memory.
3102 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3103 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
3104 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
3105 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
3106 that is of size <tt/count/. Upon completion, the function returns a pointer to
3107 the character found, or a null pointer if the character was not found.
3108 <tag/Limits/<itemize>
3109 <item>The function is only available as fastcall function, so it may only
3110 be used in presence of a prototype.
3112 <tag/Availability/ISO 9899
3114 <ref id="strchr" name="strchr">
3120 <sect1>memcpy<label id="memcpy"><p>
3124 <tag/Function/Copy a memory area.
3125 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3126 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
3127 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
3128 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
3132 <item>The result is undefined if the memory areas do overlap. Use
3133 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
3134 <item>The function is only available as fastcall function, so it may only
3135 be used in presence of a prototype.
3137 <tag/Availability/ISO 9899
3139 <ref id="_swap" name="_swap">,
3140 <ref id="memmove" name="memmove">,
3141 <ref id="memset" name="memset">
3147 <sect1>memmove<label id="memmove"><p>
3151 <tag/Function/Copy a memory area.
3152 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3153 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
3154 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
3155 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
3159 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
3160 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
3161 <item>The function is only available as fastcall function, so it may only
3162 be used in presence of a prototype.
3164 <tag/Availability/ISO 9899
3166 <ref id="_swap" name="_swap">,
3167 <ref id="memcpy" name="memcpy">,
3168 <ref id="memset" name="memset">
3174 <sect1>memset<label id="memset"><p>
3178 <tag/Function/Fill a memory area.
3179 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3180 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
3181 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
3182 the value <tt/val/. The function returns <tt/p/.
3185 <item>The function is only available as fastcall function, so it may only
3186 be used in presence of a prototype.
3188 <tag/Availability/ISO 9899
3190 <ref id="_swap" name="_swap">,
3191 <ref id="bzero" name="bzero">,
3192 <ref id="memcpy" name="memcpy">,
3193 <ref id="memmove" name="memmove">
3199 <sect1>mod_free<label id="mod_free"><p>
3203 <tag/Function/Free a relocatable module.
3204 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
3205 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
3206 <tag/Description/The function will free a module loaded into memory by use of
3207 the <tt/<ref id="mod_load" name="mod_load">/ function.
3208 <tag/Limits/<itemize>
3209 <item>The pointer passed as parameter is the pointer to the module memory,
3210 not the pointer to the control structure.
3212 <tag/Availability/cc65
3214 <ref id="mod_load" name="mod_load">
3220 <sect1>mod_load<label id="mod_load"><p>
3224 <tag/Function/Load a relocatable module.
3225 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
3226 <tag/Declaration/<tt/unsigned char mod_load (struct mod_ctrl* ctrl);/
3227 <tag/Description/The function will load a code module into memory and relocate
3228 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
3229 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
3230 the module just loaded. Possible error codes are:
3232 <item><tt/MLOAD_OK/ - Module load successful
3233 <item><tt/MLOAD_ERR_READ/ - Read error
3234 <item><tt/MLOAD_ERR_HDR/ - Header error
3235 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
3236 <item><tt/MLOAD_ERR_FMT/ - Data format error
3237 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
3239 <tag/Limits/<itemize>
3240 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
3241 relocatable o65 modules for use with this function.
3243 <tag/Availability/cc65
3245 <ref id="mod_free" name="mod_free">
3251 <sect1>mouse_box<label id="mouse_box"><p>
3255 <tag/Function/Specify a bounding box for the mouse cursor.
3256 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3257 <tag/Declaration/<tt/void __fastcall__ mouse_box (int minx, int miny,
3258 int maxx, int maxy);/
3259 <tag/Description/The function allows to set a bounding box for mouse movement.
3260 <tag/Limits/<itemize>
3261 <item>The function does not check if the mouse cursor is currently within the
3262 given rectangle. Placing the mouse cursor within the bounding box is the
3263 responsibility of the programmer.
3264 <item>While the bounding box may be larger than the actual screen size, the
3265 standard mouse cursor draw routines may fail to set the cursor to coordinates
3266 outside of the screen area. Depending on the platform, you may have to supply
3267 your own mouse cursor routines.
3268 <item>The function is only available as fastcall function, so it may only be
3269 used in presence of a prototype.
3271 <tag/Availability/cc65
3273 <ref id="mouse_move" name="mouse_move">
3279 <sect1>mouse_buttons<label id="mouse_buttons"><p>
3283 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
3284 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3285 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_buttons (void);/
3286 <tag/Description/The function returns a bit mask that encodes the state of the
3287 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
3289 <tag/Limits/<itemize>
3290 <item>The function is only available as fastcall function, so it may only be
3291 used in presence of a prototype.
3293 <tag/Availability/cc65
3295 <ref id="mouse_info" name="mouse_info">,
3296 <ref id="mouse_pos" name="mouse_pos">
3302 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
3306 <tag/Function/Return a readable error message for an error code.
3307 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3308 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
3310 <tag/Description/The function returns an error message (in english) for the
3311 error code passed parameter.
3312 <tag/Limits/<itemize>
3313 <item>The function will return "Unknown error" for invalid error codes.
3314 <item>The function is only available as fastcall function, so it may only be
3315 used in presence of a prototype.
3317 <tag/Availability/cc65
3319 <ref id="mouse_load_driver" name="mouse_load_driver">,
3320 <ref id="mouse_uninstall" name="mouse_uninstall">,
3321 <ref id="mouse_unload" name="mouse_unload">
3327 <sect1>mouse_hide<label id="mouse_hide"><p>
3331 <tag/Function/Hide the mouse pointer.
3332 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3333 <tag/Declaration/<tt/void __fastcall__ mouse_hide (void);/
3334 <tag/Description/The function hides the mouse pointer. It manages a counter
3335 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
3336 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
3337 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
3339 <tag/Limits/<itemize>
3340 <item>The function is only available as fastcall function, so it may only be
3341 used in presence of a prototype.
3343 <tag/Availability/cc65
3345 <ref id="mouse_show" name="mouse_show">
3351 <sect1>mouse_info<label id="mouse_info"><p>
3355 <tag/Function/Return the state of the mouse buttons and the position of the
3357 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3358 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
3359 <tag/Description/The function returns the state of the mouse buttons and the
3360 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
3361 <tag/Limits/<itemize>
3362 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
3363 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
3364 name="mouse_pos">/ instead.
3365 <item>The function is only available as fastcall function, so it may only be
3366 used in presence of a prototype.
3368 <tag/Availability/cc65
3370 <ref id="mouse_buttons" name="mouse_buttons">,
3371 <ref id="mouse_pos" name="mouse_pos">
3377 <sect1>mouse_install<label id="mouse_install"><p>
3381 <tag/Function/Install an already loaded mouse driver.
3382 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3383 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
3384 mouse_callbacks* c, void* driver);/
3385 <tag/Description/The function installs an already loaded mouse driver and
3386 returns an error code. The <tt/mouse_callbacks/ structure passed as first
3387 parameter contains pointers to routines needed to move or hide/show the mouse
3388 pointer. Defaults for these routines are supplied by the library, so if you
3389 can live with these defaults (which are platform specific), just pass a
3390 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
3391 driver linked statically to the program.
3392 <tag/Limits/<itemize>
3393 <item>Not all drivers are able to detect if the supported hardware is really
3395 <item>After installing a driver, the mouse cursor is hidden.
3396 <item>The function is only available as fastcall function, so it may only be
3397 used in presence of a prototype.
3399 <tag/Availability/cc65
3401 <ref id="mouse_load_driver" name="mouse_load_driver">,
3402 <ref id="mouse_uninstall" name="mouse_uninstall">,
3403 <ref id="mouse_unload" name="mouse_unload">
3409 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
3413 <tag/Function/Call the driver specific ioctl function.
3414 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3415 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
3416 <tag/Description/The function calls the IOCTL entry in the mouse driver,
3417 which is driver specific. The <tt/code/ parameter will choose between
3418 different IOCTL functions, and the <tt/data/ depends on code. The
3419 function returns an error code. The purpose of this function is to allow
3420 for driver specific extensions. See the documentation for a specific mouse
3421 driver for supported ioctl calls.
3422 <tag/Limits/<itemize>
3423 <item>Calling this function is non portable, because each driver may
3424 implement different ioctl calls (or none at all).
3425 <item>The function is only available as fastcall function, so it may only be
3426 used in presence of a prototype.
3428 <tag/Availability/cc65
3434 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
3438 <tag/Function/Load and initialize a mouse driver.
3439 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3440 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
3441 mouse_callbacks* c, const char* driver);/
3442 <tag/Description/Load a mouse driver into memory and initialize it. The
3443 function returns an error code that tells if the call has been successful. The
3444 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
3445 routines needed to move or hide/show the mouse pointer. Defaults for these
3446 routines are supplied by the library, so if you can live with these defaults
3447 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
3448 <tag/Limits/<itemize>
3449 <item>The driver is loaded by name, so currently you must know the type of
3450 mouse that should be supported. There is no autodetect capability.
3451 <item>Not all drivers are able to detect if the supported hardware is really
3453 <item>After installing a driver, the mouse cursor is hidden.
3454 <item>The function is only available as fastcall function, so it may only be
3455 used in presence of a prototype.
3457 <tag/Availability/cc65
3459 <ref id="mouse_install" name="mouse_install">,
3460 <ref id="mouse_uninstall" name="mouse_uninstall">,
3461 <ref id="mouse_unload" name="mouse_unload">
3467 <sect1>mouse_move<label id="mouse_move"><p>
3471 <tag/Function/Move the mouse cursor to a specific position.
3472 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3473 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
3474 <tag/Description/The function updates the mouse position. If the mouse cursor
3475 is visible, it is shown at the new position.
3476 <tag/Limits/<itemize>
3477 <item>The function does not check if the new position is within the bounding
3478 box specified with <tt/<ref id="mouse_box" name="mouse_box">/.
3479 <item>The function is only available as fastcall function, so it may only be
3480 used in presence of a prototype.
3482 <tag/Availability/cc65
3484 <ref id="mouse_box" name="mouse_box">
3490 <sect1>mouse_pos<label id="mouse_pos"><p>
3494 <tag/Function/Return the position of the mouse.
3495 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3496 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
3497 <tag/Description/The function returns the position of the mouse in the
3498 <tt/mouse_pos/ structure passed as parameter.
3499 <tag/Limits/<itemize>
3500 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
3501 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
3502 name="mouse_info">/ instead.
3503 <item>The function is only available as fastcall function, so it may only be
3504 used in presence of a prototype.
3506 <tag/Availability/cc65
3508 <ref id="mouse_buttons" name="mouse_buttons">,
3509 <ref id="mouse_info" name="mouse_info">
3515 <sect1>mouse_show<label id="mouse_show"><p>
3519 <tag/Function/Show the mouse pointer.
3520 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3521 <tag/Declaration/<tt/void __fastcall__ mouse_show (void);/
3522 <tag/Description/The function shows the mouse pointer. It manages a counter
3523 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
3524 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
3525 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
3526 <tag/Limits/<itemize>
3527 <item>The function is only available as fastcall function, so it may only be
3528 used in presence of a prototype.
3530 <tag/Availability/cc65
3532 <ref id="mouse_hide" name="mouse_hide">
3538 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
3542 <tag/Function/Uninstall an already loaded mouse driver.
3543 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3544 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (void);/
3545 <tag/Description/The function uninstalls an already loaded mouse driver but
3546 don't removes it from memory.
3547 <tag/Limits/<itemize>
3548 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
3549 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
3550 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
3552 <item>The function is only available as fastcall function, so it may only be
3553 used in presence of a prototype.
3555 <tag/Availability/cc65
3557 <ref id="mouse_install" name="mouse_install">,
3558 <ref id="mouse_load_driver" name="mouse_load_driver">,
3559 <ref id="mouse_unload" name="mouse_unload">
3565 <sect1>mouse_unload<label id="mouse_unload"><p>
3569 <tag/Function/Unload a mouse driver.
3570 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
3571 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_unload (void);/
3572 <tag/Description/The function unloads a loaded mouse driver and frees all
3573 memory allocated for the driver.
3574 <tag/Limits/<itemize>
3575 <item>The function does nothing if no driver is loaded.
3577 <tag/Availability/cc65
3579 <ref id="mouse_install" name="mouse_install">,
3580 <ref id="mouse_load_driver" name="mouse_load_driver">,
3581 <ref id="mouse_uninstall" name="mouse_uninstall">
3587 <sect1>offsetof<label id="offsetof"><p>
3591 <tag/Function/Calculate the offset of a struct or union member.
3592 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
3593 <tag/Declaration/<tt/size_t offsetof (type, member);/
3594 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
3595 or <tt/union/ member.
3596 <tag/Limits/<itemize>
3597 <item>The function is actually a macro.
3599 <tag/Availability/ISO 9899
3605 <sect1>open<label id="open"><p>
3609 <tag/Function/Open and possibly create a file.
3610 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
3611 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
3612 <tag/Description/<tt/open/ opens a file and returns the file descriptor
3613 associated with it. On error, -1 is returned and an error code is stored in
3614 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
3615 <tag/Limits/<itemize>
3616 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
3617 open, which is used as the permission mask when a new file is created. While
3618 cc65 allows to pass this argument, it is ignored.
3620 <tag/Availability/POSIX 1003.1
3622 <ref id="close" name="close">,
3623 <ref id="creat" name="creat">
3629 <sect1>peekbsys<label id="peekbsys"><p>
3633 <tag/Function/Read one byte from a location in the system bank.
3634 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3635 <tt/<ref id="cbm510.h" name="cbm510.h">/
3636 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
3637 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
3638 system bank (bank 15) of the CBM PET-II machines and returns it.
3641 <item>The function is only available as fastcall function, so it may only
3642 be used in presence of a prototype.
3643 <item>This function may be a macro depending on the compiler options. The
3644 actual function is accessible by #undef'ing the macro.
3646 <tag/Availability/cc65
3648 <ref id="PEEK" name="PEEK">,
3649 <ref id="PEEKW" name="PEEKW">,
3650 <ref id="peekwsys" name="peekwsys">,
3651 <ref id="pokebsys" name="pokebsys">,
3652 <ref id="pokewsys" name="pokewsys">
3658 <sect1>peekwsys<label id="peekwsys"><p>
3662 <tag/Function/Read one word from a location in the system bank.
3663 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3664 <tt/<ref id="cbm510.h" name="cbm510.h">/
3665 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
3666 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
3667 system bank (bank 15) of the CBM PET-II machines and returns it. Following
3668 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
3669 high byte is read from <tt/addr+1/.
3672 <item>The function is only available as fastcall function, so it may only
3673 be used in presence of a prototype.
3674 <item>The order in which the two bytes are read is undefined.
3676 <tag/Availability/cc65
3678 <ref id="PEEK" name="PEEK">,
3679 <ref id="PEEKW" name="PEEKW">,
3680 <ref id="peekbsys" name="peekbsys">,
3681 <ref id="pokebsys" name="pokebsys">,
3682 <ref id="pokewsys" name="pokewsys">
3688 <sect1>perror<label id="perror"><p>
3692 <tag/Function/Print an error message for the error in <tt/errno/.
3693 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3694 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
3695 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
3696 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
3697 a blank. Then the error message for the current contents of <tt/errno/ is
3698 printed followed by a newline. The message output is the same as returned by
3699 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
3702 <item>The function is only available as fastcall function, so it may only
3703 be used in presence of a prototype.
3705 <tag/Availability/ISO 9899
3707 <ref id="_poserror" name="_poserror">,
3708 <ref id="strerror" name="strerror">
3714 <sect1>pokebsys<label id="pokebsys"><p>
3718 <tag/Function/Write one byte to a location in the system bank.
3719 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3720 <tt/<ref id="cbm510.h" name="cbm510.h">/
3721 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
3722 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
3723 system bank (bank 15) of the CBM PET-II machines.
3726 <item>The function is only available as fastcall function, so it may only
3727 be used in presence of a prototype.
3729 <tag/Availability/cc65
3731 <ref id="POKE" name="POKE">,
3732 <ref id="POKEW" name="POKEW">,
3733 <ref id="peekbsys" name="peekbsys">,
3734 <ref id="peekwsys" name="peekwsys">,
3735 <ref id="pokewsys" name="pokewsys">
3741 <sect1>pokewsys<label id="pokewsys"><p>
3745 <tag/Function/Write one word to a location in the system bank.
3746 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
3747 <tt/<ref id="cbm510.h" name="cbm510.h">/
3748 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
3749 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
3750 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
3751 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
3752 high byte is written to <tt/addr+1/.
3755 <item>The function is only available as fastcall function, so it may only
3756 be used in presence of a prototype.
3757 <item>The order in which the two bytes are written is undefined.
3759 <tag/Availability/cc65
3761 <ref id="POKE" name="POKE">,
3762 <ref id="POKEW" name="POKEW">,
3763 <ref id="peekbsys" name="peekbsys">,
3764 <ref id="peekwsys" name="peekwsys">,
3765 <ref id="pokebsys" name="pokebsys">
3771 <sect1>qsort<label id="qsort"><p>
3775 <tag/Function/Sort an array.
3776 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3777 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
3778 size_t size, int (*compare) (const void*, const void*));/
3779 <tag/Description/<tt/qsort/ sorts an array according to a given compare
3780 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
3781 is the number of elements, <tt/size/ the size of an element and <tt/compare/
3782 the function used to compare the members.
3785 <item>If there are multiple members with the same key, the order after calling
3786 the function is undefined.
3787 <item>The function is only available as fastcall function, so it may only
3788 be used in presence of a prototype.
3790 <tag/Availability/ISO 9899
3792 <ref id="bsearch" name="bsearch">
3798 <sect1>raise<label id="raise"><p>
3802 <tag/Function/Send a signal to the executing program.
3803 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
3804 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
3805 <tag/Description/<tt/raise/ sends the given signal to the program. If the
3806 program has installed a signal handler for the signal, this signal handler
3807 will be executed. If no handler has been installed, the default action for
3808 the raised signal will be taken. The function returns zero on success,
3810 <tag/Limits/<itemize>
3811 <item>The function is only available as fastcall function, so it may only
3812 be used in presence of a prototype.
3814 <tag/Availability/ISO 9899
3816 <ref id="abort" name="abort">,
3817 <ref id="signal" name="signal">
3823 <sect1>rand<label id="rand"><p>
3827 <tag/Function/Return a pseudo random number.
3828 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3829 <tag/Declaration/<tt/int rand (void);/
3830 <tag/Description/The function returns a pseudo random number
3831 between 0 and <tt/RAND_MAX/ (exclusive).
3832 <tag/Limits/<itemize>
3833 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
3834 flow of numbers is generated.
3835 <item>On startup, the function behaves as if <ref id="srand" name="srand">
3836 had been used with an argument of 1.
3838 <tag/Availability/ISO 9899
3840 <ref id="_randomize" name="_randomize">,
3841 <ref id="srand" name="srand">
3847 <sect1>realloc<label id="realloc"><p>
3851 <tag/Function/Change the size of an allocated memory block.
3852 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3853 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
3854 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
3855 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
3856 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
3857 behaves as if <tt/free/ had been called. On error (not enough memory
3858 available), <tt/realloc/ returns <tt/NULL/.
3861 <item>The part of the memory block that is returned will have its contents
3863 <item>This function is somewhat dangerous to use. Be careful to save the
3864 pointer you're passing somewhere else, otherwise
3866 ptr = realloc (ptr, size);
3868 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
3869 <item>The function is only available as fastcall function, so it may only
3870 be used in presence of a prototype.
3872 <tag/Availability/ISO 9899
3874 <ref id="_heapadd" name="_heapadd">,
3875 <ref id="_heapblocksize" name="_heapblocksize">,
3876 <ref id="_heapmaxavail" name="_heapmaxavail">,
3877 <ref id="_heapmemavail" name="_heapmemavail">,
3878 <ref id="calloc" name="calloc">,
3879 <ref id="free" name="free">,
3880 <ref id="realloc" name="realloc">
3886 <sect1>remove<label id="remove"><p>
3890 <tag/Function/Delete a file.
3891 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3892 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
3893 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
3894 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
3895 code describing the reason for the failure.
3898 <item>This function is not available on all cc65 targets (depends on the
3899 availability of file I/O).
3900 <item>The function is only available as fastcall function, so it may only
3901 be used in presence of a prototype.
3903 <tag/Availability/ISO 9899
3905 <ref id="unlink" name="unlink">
3907 #include <stdio.h>
3909 #define FILENAME "helloworld"
3911 if (remove (FILENAME) == 0) {
3912 printf ("We deleted %s successfully\n", FILENAME);
3914 printf ("There was a problem deleting %s\n", FILENAME);
3920 <sect1>reset_brk<label id="reset_brk"><p>
3924 <tag/Function/Resets the break vector to its original value.
3925 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3926 <tag/Declaration/<tt/void __fastcall__ reset_brk (void);/
3927 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
3928 before a call to <tt/set_brk/.
3931 <item>Since <tt/<ref id="set_brk" name="set_brk">/ installs an exit handler,
3932 it is not strictly necessary to call this function as part of the cleanup when
3935 <tag/Availability/cc65
3937 <ref id="set_brk" name="set_brk">
3943 <sect1>revers<label id="revers"><p>
3947 <tag/Function/Control revers character display.
3948 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3949 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
3950 <tag/Description/If the argument is non zero, the function enables reverse
3951 character display. If the argument is zero, reverse character display is
3952 switched off. The old value of the setting is returned.
3953 <tag/Limits/<itemize>
3954 <item>The function may not be supported by the hardware, in which case
3955 the call is ignored.
3956 <item>The function is only available as fastcall function, so it may only
3957 be used in presence of a prototype.
3959 <tag/Availability/cc65
3961 <ref id="textcolor" name="textcolor">
3967 <sect1>screensize<label id="screensize"><p>
3971 <tag/Function/Return the dimensions of the text mode screen.
3972 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3973 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
3974 <tag/Description/The function returns the dimensions of the text mode screen.
3975 <tag/Limits/<itemize>
3976 <item>The function is only available as fastcall function, so it may only
3977 be used in presence of a prototype.
3979 <tag/Availability/cc65
3981 <ref id="gotox" name="gotox">,
3982 <ref id="gotoxy" name="gotoxy">,
3983 <ref id="gotoy" name="gotoy">,
3984 <ref id="wherex" name="wherex">,
3985 <ref id="wherey" name="wherey">
3991 <sect1>set_brk<label id="set_brk"><p>
3995 <tag/Function/Set the break vector to a user function.
3996 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3997 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
3998 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
3999 program code by letting the vector point to a user written C function. The
4000 runtime library installs a small stub that saves the registers into global
4001 variables that may be accessed (and changed) by the break handler.
4004 <item>The function is only available as fastcall function, so it may only
4005 be used in presence of a prototype.
4006 <item>The stub saves the zero page registers used by the C runtime and switches
4007 to a small break handler stack. This means that it is safe to execute C code,
4008 even if C code was interrupted. Be careful however not to use too many local
4009 variables, and do not enable stack checks for the handler function or any other
4010 function called from it.
4011 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
4012 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
4013 otherwise the <tt/BRK/ instruction will get executed over and over again.
4014 <item>Since <tt/set_brk/ installs an exit handler, it is not strictly necessary
4015 to call <tt/<ref id="reset_brk" name="reset_brk">/ as part of the cleanup when
4016 the program terminates.
4018 <tag/Availability/cc65
4020 <ref id="reset_brk" name="reset_brk">
4026 <sect1>setjmp<label id="setjmp"><p>
4030 <tag/Function/Save the context for use with <tt/longjmp/.
4031 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4032 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
4033 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
4034 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
4038 <item>The function is only available as fastcall function, so it may only
4039 be used in presence of a prototype.
4040 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
4041 <item><tt/setjmp/ will not save the signal context.
4043 <tag/Availability/ISO 9899
4045 <ref id="longjmp" name="longjmp">
4051 <sect1>setlocale<label id="setlocale"><p>
4055 <tag/Function/Selects a locale.
4056 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4057 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
4058 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
4061 <item>The function is only available as fastcall function, so it may only
4062 be used in presence of a prototype.
4063 <item>cc65 supports only the "C" locale, so calling this function to set a
4064 different locale has no effect.
4066 <tag/Availability/ISO 9899
4068 <ref id="localeconv" name="localeconv">,
4069 <ref id="strcoll" name="strcoll">
4070 <ref id="strxfrm" name="strxfrm">
4076 <sect1>signal<label id="signal"><p>
4080 <tag/Function/Install a signal handler.
4081 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
4082 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
4083 <tag/Description/<tt/signal/ installs a handler for the given signal. The
4084 handler may either be a user supplied function, or one of the predefined
4085 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
4086 previous value if the signal , or the special function vector SIG_ERR in
4088 <tag/Limits/<itemize>
4089 <item>The function is only available as fastcall function, so it may only
4090 be used in presence of a prototype.
4092 <tag/Availability/ISO 9899
4094 <ref id="abort" name="abort">,
4095 <ref id="raise" name="raise">
4101 <sect1>sleep<label id="sleep"><p>
4105 <tag/Function/Sleep for a specified amount of time.
4106 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
4107 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
4108 <tag/Description/The function will return after the specified number of
4109 seconds have elapsed.
4110 <tag/Limits/<itemize>
4111 <item>The function is only available as fastcall function, so it may only
4112 be used in presence of a prototype.
4114 <tag/Availability/POSIX 1003.1
4120 <sect1>slow<label id="slow"><p>
4124 <tag/Function/Switch the C128 into 1MHz mode.
4125 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
4126 <tag/Declaration/<tt/void slow (void);/
4127 <tag/Description/The function will switch the clock of the C128 to 1MHz. This
4128 will halve the speed compared to fast mode.
4129 <tag/Limits/<itemize>
4130 <item>The function is specific to the C128.
4132 <tag/Availability/C128
4134 <ref id="fast" name="fast">,
4135 <ref id="toggle_videomode" name="toggle_videomode">
4141 <sect1>srand<label id="srand"><p>
4145 <tag/Function/Initialize the pseudo random number generator.
4146 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4147 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
4148 <tag/Description/The function initializes the random number generator using
4149 the given seed. On program startup, the generator behaves as if <tt/srand/ has
4150 been called with an argument of 1.
4151 <tag/Limits/<itemize>
4152 <item>The function is only available as fastcall function, so it may only
4153 be used in presence of a prototype.
4155 <tag/Availability/ISO 9899
4157 <ref id="_randomize" name="_randomize">,
4158 <ref id="rand" name="rand">
4164 <sect1>strcasecmp<label id="strcasecmp"><p>
4168 <tag/Function/Compare two strings case insensitive.
4169 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4170 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
4171 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
4172 as parameters without case sensitivity. It returns a value that is less than
4173 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
4174 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
4175 <tag/Limits/<itemize>
4176 <item>The function is only available as fastcall function, so it may only
4177 be used in presence of a prototype.
4178 <item>The function is not available in strict ANSI mode.
4180 <tag/Availability/cc65
4182 <ref id="strcmp" name="strcmp">,
4183 <ref id="strcoll" name="strcoll">,
4184 <ref id="stricmp" name="stricmp">,
4185 <ref id="strncmp" name="strncmp">
4186 <ref id="strxfrm" name="strxfrm">
4192 <sect1>strcat<label id="strcat"><p>
4196 <tag/Function/Concatentate two strings.
4197 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4198 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
4199 <tag/Description/The <tt/strcat/ function appends a copy of the string
4200 pointed to by s2 (including the terminating null byte) to the end of the
4201 string pointed to by s1. The initial byte of s2 overwrites the null byte at
4203 <tag/Limits/<itemize>
4204 <item>The function is only available as fastcall function, so it may only
4205 be used in presence of a prototype.
4206 <item>If copying takes place between objects that overlap, the behaviour
4209 <tag/Availability/ISO 9899
4211 <ref id="strcpy" name="strcpy">,
4212 <ref id="strncat" name="strncat">,
4213 <ref id="strncpy" name="strncpy">
4219 <sect1>strchr<label id="strchr"><p>
4223 <tag/Function/Search for a character in a string.
4224 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4225 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
4226 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
4227 (converted to a char) in the string pointed to by <tt/s/. The terminating null
4228 byte is considered to be part of the string. Upon completion, the function
4229 returns a pointer to the byte, or a null pointer if the byte was not found.
4230 <tag/Limits/<itemize>
4231 <item>The function is only available as fastcall function, so it may only
4232 be used in presence of a prototype.
4234 <tag/Availability/ISO 9899
4236 <ref id="memchr" name="memchr">,
4237 <ref id="strrchr" name="strrchr">
4243 <sect1>strcmp<label id="strcmp"><p>
4247 <tag/Function/Compare two strings.
4248 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4249 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
4250 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
4251 parameters. It returns a value that is less than zero if <tt/s1/ is less than
4252 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
4253 if <tt/s1/ is greater than <tt/s2/.
4254 <tag/Limits/<itemize>
4255 <item>The function is only available as fastcall function, so it may only
4256 be used in presence of a prototype.
4258 <tag/Availability/ISO 9899
4260 <ref id="strcasecmp" name="strcasecmp">,
4261 <ref id="strcoll" name="strcoll">,
4262 <ref id="stricmp" name="stricmp">,
4263 <ref id="strncmp" name="strncmp">
4264 <ref id="strxfrm" name="strxfrm">
4270 <sect1>strcoll<label id="strcoll"><p>
4274 <tag/Function/Compare two strings.
4275 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4276 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
4277 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
4278 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
4279 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
4280 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
4281 than zero if <tt/s1/ is greater than <tt/s2/.
4282 <tag/Limits/<itemize>
4283 <item>The function is only available as fastcall function, so it may only
4284 be used in presence of a prototype.
4286 <tag/Availability/ISO 9899
4288 <ref id="setlocale" name="setlocale">,
4289 <ref id="strcasecmp" name="strcasecmp">,
4290 <ref id="strcmp" name="strcmp">,
4291 <ref id="stricmp" name="stricmp">,
4292 <ref id="strncmp" name="strncmp">
4293 <ref id="strxfrm" name="strxfrm">
4299 <sect1>strcpy<label id="strcpy"><p>
4303 <tag/Function/Copy a string.
4304 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4305 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
4306 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
4307 <tt/s2/ (including the terminating null byte) into the array pointed to by
4308 <tt/s1/. The function will always return <tt/s1/.
4309 <tag/Limits/<itemize>
4310 <item>The function is only available as fastcall function, so it may only
4311 be used in presence of a prototype.
4312 <item>If copying takes place between objects that overlap, the behaviour
4315 <tag/Availability/ISO 9899
4317 <ref id="strcat" name="strcat">,
4318 <ref id="strncat" name="strncat">,
4319 <ref id="strncpy" name="strncpy">
4322 #include <string.h>
4324 static char hello[14];
4326 strcpy (hello, "Hello world!\n");
4332 <sect1>strcspn<label id="strcspn"><p>
4336 <tag/Function/Compute the length of a substring.
4337 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4338 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
4339 <tag/Description/The <tt/strcspn/ function computes and returns the length of
4340 the substring pointed to by <tt/s/ which does <em>not</em> consist of
4341 characters contained in the string <tt/set/.
4342 <tag/Limits/<itemize>
4343 <item>The function is only available as fastcall function, so it may only
4344 be used in presence of a prototype.
4346 <tag/Availability/ISO 9899
4348 <ref id="strspn" name="strspn">,
4349 <ref id="strstr" name="strstr">,
4350 <ref id="strtok" name="strtok">
4356 <sect1>strdup<label id="strdup"><p>
4360 <tag/Function/Allocate a copy of a string on the heap.
4361 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4362 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
4363 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
4364 to hold a copy of <tt/s/ including the terminating zero. If the allocation
4365 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
4366 memory block, and a pointer to the block is returned.
4367 <tag/Limits/<itemize>
4368 <item>The function is only available as fastcall function, so it may only
4369 be used in presence of a prototype.
4370 <item>It is up to the caller to free the allocated memory block.
4372 <tag/Availability/ISO 9899
4374 <ref id="free" name="free">,
4375 <ref id="malloc" name="malloc">
4381 <sect1>strerror<label id="strerror"><p>
4385 <tag/Function/Return a string describing an error code.
4386 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4387 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
4388 <tag/Description/The <tt/strerror/ function returns a string describing the
4389 given error code. If an invalid error code is passed, the string "Unknown
4390 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
4391 <tt/errno/ is left untouched.
4392 <tag/Limits/<itemize>
4393 <item>The function is only available as fastcall function, so it may only
4394 be used in presence of a prototype.
4395 <item>While the return type of the function is a <tt/char*/, the returned
4396 string must not be modified by the caller!
4398 <tag/Availability/ISO 9899
4400 <ref id="_stroserror" name="_stroserror">
4406 <sect1>stricmp<label id="stricmp"><p>
4410 <tag/Function/Compare two strings case insensitive.
4411 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4412 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
4413 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
4414 parameters without case sensitivity. It returns a value that is less than zero
4415 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
4416 value greater than zero if <tt/s1/ is greater than <tt/s2/.
4417 <tag/Limits/<itemize>
4418 <item>The function is only available as fastcall function, so it may only
4419 be used in presence of a prototype.
4420 <item>The function is not available in strict ANSI mode.
4422 <tag/Availability/cc65
4424 <ref id="strcasecmp" name="strcasecmp">,
4425 <ref id="strcmp" name="strcmp">,
4426 <ref id="strcoll" name="strcoll">,
4427 <ref id="strncmp" name="strncmp">
4428 <ref id="strxfrm" name="strxfrm">
4434 <sect1>strlen<label id="strlen"><p>
4438 <tag/Function/Return the length of a string.
4439 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4440 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
4441 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
4442 string to which s points, not including the terminating null byte.
4443 <tag/Limits/<itemize>
4444 <item>The function is only available as fastcall function, so it may only
4445 be used in presence of a prototype.
4446 <item>When compiling with <tt/-Os/ (inline known standard functions), the
4447 function does not work correctly for strings with more than 255 characters.
4449 <tag/Availability/ISO 9899
4451 <ref id="strcpy" name="strcpy">
4457 <sect1>strlower<label id="strlower"><p>
4461 <tag/Function/Make a string lower case.
4462 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4463 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
4464 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
4465 function to each character of a string. The function will always return <tt/s/.
4466 <tag/Limits/<itemize>
4467 <item>The function is only available as fastcall function, so it may only
4468 be used in presence of a prototype.
4469 <item>The function prototype is unavailable when compiling in strict ANSI mode.
4470 <item>An alias name for this function is <tt/strlwr/.
4472 <tag/Availability/cc65
4474 <ref id="strupper" name="strupper">,
4475 <ref id="tolower" name="tolower">
4481 <sect1>strlwr<label id="strlwr"><p>
4488 <sect1>strncat<label id="strncat"><p>
4492 <tag/Function/Concatentate two strings.
4493 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4494 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
4495 <tag/Description/The <tt/strncat/ function appends not more than n characters
4496 of the string pointed to by s2 to the end of the string pointed to by s1. The
4497 terminating null character at the end of s1 is overwritten. A terminating null
4498 character is appended to the result, even if not all of s2 is appended to s1.
4499 <tag/Limits/<itemize>
4500 <item>The function is only available as fastcall function, so it may only
4501 be used in presence of a prototype.
4502 <item>If copying takes place between objects that overlap, the behaviour
4505 <tag/Availability/ISO 9899
4507 <ref id="strcpy" name="strcpy">,
4508 <ref id="strncat" name="strncat">,
4509 <ref id="strncpy" name="strncpy">
4515 <sect1>strncmp<label id="strncmp"><p>
4519 <tag/Function/Compare two strings.
4520 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4521 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
4522 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
4523 characters of the two strings passed as parameters. It returns a value that is
4524 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
4525 <tt/s2/, zero if they are identical, and a value greater than zero they are
4527 <tag/Limits/<itemize>
4528 <item>The function is only available as fastcall function, so it may only
4529 be used in presence of a prototype.
4531 <tag/Availability/ISO 9899
4533 <ref id="strcasecmp" name="strcasecmp">,
4534 <ref id="strcmp" name="strcmp">,
4535 <ref id="strcoll" name="strcoll">,
4536 <ref id="stricmp" name="stricmp">
4537 <ref id="strxfrm" name="strxfrm">
4543 <sect1>strncpy<label id="strncpy"><p>
4547 <tag/Function/Copy part of a string.
4548 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4549 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2, size_t n);/
4550 <tag/Description/The <tt/strncpy/ function copies not more than n bytes from
4551 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
4552 pointed to by <tt/s2/ is a string that is shorter than n bytes, null bytes are
4553 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
4554 written. The function will always return <tt/s1/.
4555 <tag/Limits/<itemize>
4556 <item>The function is only available as fastcall function, so it may only
4557 be used in presence of a prototype. If there is no null byte in the first <tt/n/
4558 bytes of the array pointed to by <tt/s2/, the result is not null-terminated.
4559 <item>If copying takes place between objects that overlap, the behaviour is
4562 <tag/Availability/ISO 9899
4564 <ref id="strcat" name="strcat">,
4565 <ref id="strcpy" name="strcpy">,
4566 <ref id="strncat" name="strncat">
4571 static char hello[6];
4573 strcpy (hello, "Hello world!\n", sizeof (hello) - 1);
4580 <sect1>strrchr<label id="strrchr"><p>
4584 <tag/Function/Search for a character in a string.
4585 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4586 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
4587 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
4588 (converted to a char) in the string pointed to by <tt/s/. The terminating null
4589 byte is considered to be part of the string. Upon completion, the function
4590 returns a pointer to the byte, or a null pointer if the byte was not found.
4591 <tag/Limits/<itemize>
4592 <item>The function is only available as fastcall function, so it may only
4593 be used in presence of a prototype.
4595 <tag/Availability/ISO 9899
4597 <ref id="strchr" name="strchr">
4603 <sect1>strspn<label id="strspn"><p>
4607 <tag/Function/Compute the length of a substring.
4608 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4609 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
4610 <tag/Description/The <tt/strspn/ function computes and returns the length of
4611 the substring pointed to by <tt/s/ which does consist only of characters
4612 contained in the string <tt/set/.
4613 <tag/Limits/<itemize>
4614 <item>The function is only available as fastcall function, so it may only
4615 be used in presence of a prototype.
4617 <tag/Availability/ISO 9899
4619 <ref id="strcspn" name="strcspn">,
4620 <ref id="strstr" name="strstr">
4626 <sect1>strstr<label id="strstr"><p>
4630 <tag/Function/Find a substring.
4631 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4632 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
4633 <tag/Description/<tt/strstr/ searches for the first occurance of the string
4634 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
4635 otherwise it returns <tt/NULL/.
4636 <tag/Limits/<itemize>
4637 <item>The function is only available as fastcall function, so it may only
4638 be used in presence of a prototype.
4640 <tag/Availability/ISO 9899
4642 <ref id="strcspn" name="strcspn">,
4643 <ref id="strspn" name="strspn">
4649 <sect1>strtok<label id="strtok"><p>
4653 <tag/Function/Break a string into tokens.
4654 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4655 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
4656 <tag/Description/<tt/strtok/ will break the string s1 into a sequence of
4657 tokens, which are delimited by characters from the string s2. The first call
4658 to <tt/strtok/ will return a pointer to the first token in the string s1.
4659 Following calls must pass a <tt/NULL/ pointer as s1 in order to get the next
4660 token in the string. Different sets of delimiters may be used for the
4661 subsequent calls to <tt/strtok/.
4662 <tag/Limits/<itemize>
4663 <item>The function is only available as fastcall function, so it may only
4664 be used in presence of a prototype.
4665 <item><tt/strtok/ will modify the string s1.
4667 <tag/Availability/ISO 9899
4669 <ref id="strcspn" name="strcspn">,
4670 <!-- <ref id="strpbrk" name="strpbrk"> -->
4676 <sect1>strxfrm<label id="strxfrm"><p>
4680 <tag/Function/Transform a string.
4681 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4682 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
4683 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
4684 s2 and places the resulting string into the string pointed to by s1. The
4685 transformation is such that if the <tt/strcmp/ function is applied to two
4686 transformed strings, it returns a value greater than, equal to, or less than
4687 zero, corresponding to the result of the <tt/strcoll/ function applied to the
4688 same two original strings. No more than n characters are placed into the
4689 resulting array pointed to by s1, including the terminating null character.
4690 <tag/Limits/<itemize>
4691 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
4692 the behaviour is undefined.
4693 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
4694 <item>The function is only available as fastcall function, so it may only
4695 be used in presence of a prototype.
4696 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
4697 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
4699 <tag/Availability/ISO 9899
4701 <ref id="strcmp" name="strcmp">,
4702 <ref id="strcoll" name="strcoll">,
4703 <ref id="strncpy" name="strncpy">,
4709 <sect1>strupper<label id="strupper"><p>
4713 <tag/Function/Make a string upper case.
4714 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4715 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
4716 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
4717 function to each character of a string. The function will always return <tt/s/.
4718 <tag/Limits/<itemize>
4719 <item>The function is only available as fastcall function, so it may only
4720 be used in presence of a prototype.
4721 <item>The function prototype is unavailable when compiling in strict ANSI mode.
4722 <item>An alias name for this function is <tt/strupr/.
4724 <tag/Availability/cc65
4726 <ref id="strlower" name="strlower">
4727 <ref id="toupper" name="toupper">
4733 <sect1>strupr<label id="strupr"><p>
4740 <sect1>textcolor<label id="textcolor"><p>
4744 <tag/Function/Set the text color.
4745 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4746 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
4747 <tag/Description/The function will set a new text color. It returns the old
4748 (current) text color. Text output using any <tt/conio.h/ function will use
4749 the color set by this function.
4750 <tag/Limits/<itemize>
4751 <item>Text colors are system dependent. The function may have no effect
4752 on systems where the text color cannot be changed.
4753 <item>The function is only available as fastcall function, so it may only
4754 be used in presence of a prototype.
4756 <tag/Availability/cc65
4758 <ref id="bgcolor" name="bgcolor">,
4759 <ref id="bordercolor" name="bordercolor">
4765 <sect1>time<label id="time"><p>
4769 <tag/Function/Get the time.
4770 <tag/Header/<tt/<ref id="time.h" name="time.h">/
4771 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
4772 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
4773 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
4774 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
4775 returned and <tt/errno/ is set to <tt/ENOSYS/.
4776 <tag/Limits/<itemize>
4777 <item>The function is only available as fastcall function, so it may
4778 only be used in presence of a prototype.
4779 <item>Many platforms supported by cc65 do not have a realtime clock, so the
4780 returned value may not be valid.
4782 <tag/Availability/ISO 9899
4788 <sect1>toggle_videomode<label id="toggle_videomode"><p>
4792 <tag/Function/Toggle between 40 and 80 column mode.
4793 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
4794 <tag/Declaration/<tt/void toggle_videomode (void);/
4795 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
4796 old mode (cursor position, color and so on) are saved and restored together
4798 <tag/Limits/<itemize>
4799 <item>The function is specific to the C128.
4801 <tag/Availability/C128
4803 <ref id="fast" name="fast">,
4804 <ref id="slow" name="slow">
4810 <sect1>tolower<label id="tolower"><p>
4814 <tag/Function/Convert a character into its lower case representation.
4815 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4816 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
4817 <tag/Description/The function returns the given character converted to lower
4818 case. If the given character is not a letter, it is returned unchanged.
4819 <tag/Limits/<itemize>
4820 <item>The function is only available as fastcall function, so it may
4821 only be used in presence of a prototype.
4823 <tag/Availability/ISO 9899
4825 <ref id="islower" name="islower">,
4826 <ref id="isupper" name="isupper">,
4827 <ref id="toupper" name="toupper">
4833 <sect1>toupper<label id="toupper"><p>
4837 <tag/Function/Convert a character into its upper case representation.
4838 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4839 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
4840 <tag/Description/The function returns the given character converted to upper
4841 case. If the given character is not a letter, it is returned unchanged.
4842 <tag/Limits/<itemize>
4843 <item>The function is only available as fastcall function, so it may
4844 only be used in presence of a prototype.
4846 <tag/Availability/ISO 9899
4848 <ref id="islower" name="islower">,
4849 <ref id="isupper" name="isupper">,
4850 <ref id="tolower" name="tolower">
4856 <sect1>ultoa<label id="ultoa"><p>
4860 <tag/Function/Convert an unsigned long integer into a string.
4861 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4862 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
4863 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
4864 string using <tt/radix/ as the base.
4865 <tag/Limits/<itemize>
4866 <item>There are no provisions to prevent a buffer overflow.
4867 <item>The function is non standard, so it is not available in strict ANSI mode.
4868 You should probably use <tt/sprintf/ instead.
4869 <item>The function is only available as fastcall function, so it may only be
4870 used in presence of a prototype.
4872 <tag/Availability/cc65
4874 <ref id="atoi" name="atoi">,
4875 <ref id="atol" name="atol">,
4876 <ref id="itoa" name="itoa">,
4877 <ref id="ltoa" name="ltoa">,
4878 <ref id="utoa" name="utoa">
4884 <sect1>unlink<label id="unlink"><p>
4888 <tag/Function/Delete a file.
4889 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
4890 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
4891 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
4892 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
4893 code describing the reason for the failure.
4896 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
4897 name="remove">/ instead, which is a native ANSI C function and does the same.
4898 <item>This function is not available on all cc65 targets (depends on the
4899 availability of file I/O).
4900 <item>The function is only available as fastcall function, so it may only
4901 be used in presence of a prototype.
4902 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
4903 used, which has the same semantics, but is more portable, because it conforms
4904 to the ISO C standard.
4906 <tag/Availability/POSIX 1003.1
4908 <ref id="remove" name="remove">
4910 #include <stdio.h>
4911 #include <unistd.h>
4913 #define FILENAME "helloworld"
4915 if (unlink (FILENAME) == 0) {
4916 printf ("We deleted %s successfully\n", FILENAME);
4918 printf ("There was a problem deleting %s\n", FILENAME);
4924 <sect1>utoa<label id="utoa"><p>
4928 <tag/Function/Convert an unsigned integer into a string.
4929 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4930 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
4931 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
4932 using <tt/radix/ as the base.
4933 <tag/Limits/<itemize>
4934 <item>There are no provisions to prevent a buffer overflow.
4935 <item>The function is non standard, so it is not available in strict ANSI mode.
4936 You should probably use <tt/sprintf/ instead.
4937 <item>The function is only available as fastcall function, so it may only be
4938 used in presence of a prototype.
4940 <tag/Availability/cc65
4942 <ref id="atoi" name="atoi">,
4943 <ref id="atol" name="atol">,
4944 <ref id="itoa" name="itoa">,
4945 <ref id="ltoa" name="ltoa">,
4946 <ref id="ultoa" name="ultoa">
4952 <sect1>vcprintf<label id="vcprintf"><p>
4956 <tag/Function/Formatted output to the console.
4957 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4958 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
4959 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
4960 text where necessary and formatted according to the format string given. The
4961 resulting string is output to the console. <tt/vcprintf/ supports the same
4962 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
4963 <tag/Limits/<itemize>
4964 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
4965 between <tt/\r/ and <tt/\n/.
4966 <item>The function is only available as fastcall function, so it may only be
4967 used in presence of a prototype.
4969 <tag/Availability/cc65
4971 <ref id="cprintf" name="cprintf">,
4972 <ref id="cputc" name="cputc">,
4973 <ref id="cputcxy" name="cputcxy">,
4974 <ref id="cputs" name="cputs">,
4975 <ref id="cputsxy" name="cputsxy">
4981 <sect1>wherex<label id="wherex"><p>
4985 <tag/Function/Return the current X position of the text mode cursor.
4986 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4987 <tag/Declaration/<tt/unsigned char wherex (void);/
4988 <tag/Description/The function returns the current X position of the text mode
4989 cursor. Zero is returned for the leftmost screen position.
4990 <tag/Availability/cc65
4992 <ref id="gotox" name="gotox">,
4993 <ref id="gotoy" name="gotoy">,
4994 <ref id="gotoxy" name="gotoxy">,
4995 <ref id="wherey" name="wherey">
5001 <sect1>wherey<label id="wherey"><p>
5005 <tag/Function/Return the current Y position of the text mode cursor.
5006 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5007 <tag/Declaration/<tt/unsigned char wherey (void);/
5008 <tag/Description/The function returns the current Y position of the text mode
5009 cursor. Zero is returned for the uppermost screen position.
5010 <tag/Availability/cc65
5012 <ref id="gotox" name="gotox">,
5013 <ref id="gotoy" name="gotoy">,
5014 <ref id="gotoxy" name="gotoxy">,
5015 <ref id="wherex" name="wherex">