1 <!doctype linuxdoc system>
4 <title>cc65 function reference
5 <author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
9 cc65 is a C compiler for 6502 based systems. This function reference describes
10 the C functions available in the standard library.
13 <!-- Table of contents -->
16 <!-- Begin the document -->
20 cc65 is a C compiler for 6502 based systems. It implements a subset of the ISO
21 C standard plus additional functions specially crafted for 6502 systems or
22 just some of the supported machines. This function refrence describes the
23 available functions together with any limitations.
25 For an overview about the available libraries, their purpose, and any
26 differences to the ISO standard, please have a look at the <htmlurl
27 url="library.html" name="cc65 Library Overview">.
29 <bf/Note:/ Standard C functions are listed here, but not described in detail.
30 Since these functions behave identical on all standard compliant systems, they
31 are described in any book covering standard C.
33 Each entry for a function contains a detailed description
37 <tag/Function/Summary of what <bf/function/ does.
38 <tag/Header/The header file that contains the declaration.
39 <tag/Declaration/Describes the needed header files and declaration of the
41 <tag/Description/Description of the function.
43 <tag/Availability/The availability of the function.
44 <tag/See also/Other related functions.
45 <tag/Example/A piece of actual code using the function.
50 <sect>Functions by header file<p>
52 <sect1><tt/6502.h/<label id="6502.h"><p>
55 <item><ref id="BRK" name="BRK">
56 <item><ref id="CLI" name="CLI">
57 <item><ref id="SEI" name="SEI">
58 <item><ref id="_sys" name="_sys">
59 <item><ref id="getcpu" name="getcpu">
60 <item><ref id="reset_brk" name="reset_brk">
61 <item><ref id="set_brk" name="set_brk">
65 <sect1><tt/apple2.h/<label id="apple2.h"><p>
68 <sect1><tt/atari.h/<label id="atari.h"><p>
71 <sect1><tt/atmos.h/<label id="atmos.h"><p>
74 <sect1><tt/assert.h/<label id="assert.h"><p>
77 <item><ref id="assert" name="assert">
81 <sect1><tt/c128.h/<label id="c128.h"><p>
84 <item><ref id="c64mode" name="c64mode">
85 <item><ref id="fast" name="fast">
86 <item><ref id="toggle_videomode" name="toggle_videomode">
87 <item><ref id="slow" name="slow">
91 <sect1><tt/c16.h/<label id="c16.h"><p>
94 <sect1><tt/c64.h/<label id="c64.h"><p>
97 <sect1><tt/conio.h/<label id="conio.h"><p>
100 <item><ref id="bgcolor" name="bgcolor">
101 <item><ref id="bordercolor" name="bordercolor">
102 <item><ref id="cclear" name="cclear">
103 <item><ref id="cclearxy" name="cclearxy">
104 <item><ref id="cgetc" name="cgetc">
105 <item><ref id="chline" name="chline">
106 <item><ref id="chlinexy" name="chlinexy">
107 <item><ref id="clrscr" name="clrscr">
108 <!-- <item><ref id="cprintf" name="cprintf"> -->
109 <!-- <item><ref id="cputc" name="cputc"> -->
110 <!-- <item><ref id="cputcxy" name="cputcxy"> -->
111 <!-- <item><ref id="cputs" name="cputs"> -->
112 <!-- <item><ref id="cputsxy" name="cputsxy"> -->
113 <item><ref id="cursor" name="cursor">
114 <item><ref id="cvline" name="cvline">
115 <item><ref id="cvlinexy" name="cvlinexy">
116 <item><ref id="gotox" name="gotox">
117 <item><ref id="gotoxy" name="gotoxy">
118 <item><ref id="gotoy" name="gotoy">
119 <item><ref id="kbhit" name="kbhit">
120 <item><ref id="revers" name="revers">
121 <item><ref id="screensize" name="screensize">
122 <item><ref id="textcolor" name="textcolor">
123 <!-- <item><ref id="vcprintf" name="vcprintf"> -->
124 <item><ref id="wherex" name="wherex">
125 <item><ref id="wherey" name="wherey">
129 <sect1><tt/ctype.h/<label id="ctype.h"><p>
132 <item><ref id="isalnum" name="isalnum">
133 <item><ref id="isalpha" name="isalpha">
134 <item><ref id="isascii" name="isascii">
135 <item><ref id="isblank" name="isblank">
136 <item><ref id="iscntrl" name="iscntrl">
137 <item><ref id="isdigit" name="isdigit">
138 <item><ref id="isgraph" name="isgraph">
139 <item><ref id="islower" name="islower">
140 <item><ref id="isprint" name="isprint">
141 <item><ref id="ispunct" name="ispunct">
142 <item><ref id="isspace" name="isspace">
143 <item><ref id="isupper" name="isupper">
144 <item><ref id="isxdigit" name="isxdigit">
145 <item><ref id="tolower" name="tolower">
146 <item><ref id="toupper" name="toupper">
150 <sect1><tt/dbg.h/<label id="dbg.h"><p>
153 <sect1><tt/dio.h/<label id="dio.h"><p>
156 <sect1><tt/em.h/<label id="em.h"><p>
159 <item><ref id="em_commit" name="em_commit">
160 <item><ref id="em_copyfrom" name="em_copyfrom">
161 <item><ref id="em_copyto" name="em_copyto">
162 <item><ref id="em_load_driver" name="em_load_driver">
163 <item><ref id="em_map" name="em_map">
164 <item><ref id="em_pagecount" name="em_pagecount">
165 <item><ref id="em_unload" name="em_unload">
166 <item><ref id="em_use" name="em_use">
170 <sect1><tt/errno.h/<label id="errno.h"><p>
173 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
176 <item><ref id="close" name="close">
177 <item><ref id="creat" name="creat">
178 <item><ref id="open" name="open">
182 <sect1><tt/geos.h/<label id="geos.h"><p>
185 <sect1><tt/joystick.h/<label id="joystick.h"><p>
188 <sect1><tt/locale.h/<label id="locale.h"><p>
191 <item><ref id="localeconv" name="localeconv">
192 <item><ref id="setlocale" name="setlocale">
196 <sect1><tt/modload.h/<label id="modload.h"><p>
199 <sect1><tt/nes.h/<label id="nes.h"><p>
202 <sect1><tt/o65.h/<label id="o65.h"><p>
205 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
208 <item><ref id="PEEK" name="PEEK">
209 <item><ref id="PEEKW" name="PEEKW">
210 <item><ref id="POKE" name="POKE">
211 <item><ref id="POKEW" name="POKEW">
215 <sect1><tt/pet.h/<label id="pet.h"><p>
218 <sect1><tt/plus4.h/<label id="plus4.h"><p>
221 <sect1><tt/serial.h/<label id="serial.h"><p>
224 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
227 <sect1><tt/signal.h/<label id="signal.h"><p>
230 <item><ref id="raise" name="raise">
231 <item><ref id="signal" name="signal">
235 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
238 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
241 <sect1><tt/stddef.h/<label id="stddef.h"><p>
244 <item><ref id="offsetof" name="offsetof">
248 <sect1><tt/stdio.h/<label id="stdio.h"><p>
251 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
254 <item><ref id="_heapadd" name="_heapadd">
255 <item><ref id="_heapmaxavail" name="_heapmaxavail">
256 <item><ref id="_heapmemavail" name="_heapmemavail">
257 <item><ref id="_randomize" name="_randomize">
258 <item><ref id="_swap" name="_swap">
259 <item><ref id="abort" name="abort">
260 <item><ref id="abs" name="abs">
261 <item><ref id="atexit" name="atexit">
262 <item><ref id="atoi" name="atoi">
263 <item><ref id="atol" name="atol">
264 <item><ref id="bsearch" name="bsearch">
265 <item><ref id="calloc" name="calloc">
266 <item><ref id="div" name="div">
267 <item><ref id="exit" name="exit">
268 <item><ref id="free" name="free">
269 <item><ref id="getenv" name="getenv">
270 <item><ref id="itoa" name="itoa">
271 <item><ref id="labs" name="labs">
272 <item><ref id="ltoa" name="ltoa">
273 <item><ref id="malloc" name="malloc">
274 <item><ref id="qsort" name="qsort">
275 <item><ref id="rand" name="rand">
276 <item><ref id="realloc" name="realloc">
277 <item><ref id="srand" name="srand">
278 <item><ref id="ultoa" name="ultoa">
279 <item><ref id="utoa" name="utoa">
283 <sect1><tt/string.h/<label id="string.h"><p>
286 <!-- <item><ref id="_stroserror" name="_stroserror"> -->
287 <item><ref id="bzero" name="bzero">
288 <!-- <item><ref id="memchr" name="memchr"> -->
289 <item><ref id="memcpy" name="memcpy">
290 <item><ref id="memmove" name="memmove">
291 <item><ref id="memset" name="memset">
292 <item><ref id="strcasecmp" name="strcasecmp">
293 <item><ref id="strcat" name="strcat">
294 <item><ref id="strchr" name="strchr">
295 <item><ref id="strcmp" name="strcmp">
296 <item><ref id="strcoll" name="strcoll">
297 <item><ref id="strcpy" name="strcpy">
298 <!-- <item><ref id="strcspn" name="strcspn"> -->
299 <!-- <item><ref id="strdup" name="strdup"> -->
300 <!-- <item><ref id="strerror" name="strerror"> -->
301 <item><ref id="stricmp" name="stricmp">
302 <item><ref id="strlen" name="strlen">
303 <item><ref id="strlower" name="strlower">
304 <item><ref id="strlwr" name="strlwr">
305 <!-- <item><ref id="strncat" name="strncat"> -->
306 <!-- <item><ref id="strncmp" name="strncmp"> -->
307 <item><ref id="strncpy" name="strncpy">
308 <item><ref id="strrchr" name="strrchr">
309 <!-- <item><ref id="strspn" name="strspn"> -->
310 <!-- <item><ref id="strstr" name="strstr"> -->
311 <!-- <item><ref id="strtok" name="strtok"> -->
312 <!-- <item><ref id="strxfrm" name="strxfrm"> -->
313 <item><ref id="strupper" name="strupper">
314 <item><ref id="strupr" name="strupr">
318 <sect1><tt/tgi.h/<label id="tgi.h"><p>
321 <sect1><tt/time.h/<label id="time.h"><p>
325 <item><ref id="_systime" name="_systime">
326 <item><ref id="asctime" name="asctime">
327 <item><ref id="clock" name="clock">
328 <item><ref id="ctime" name="ctime">
329 <item><ref id="gmtime" name="gmtime">
330 <item><ref id="localtime" name="localtime">
331 <item><ref id="mktime" name="mktime">
332 <item><ref id="strftime" name="strftime">
333 <item><ref id="time" name="time">
338 <sect1><tt/unistd.h/<label id="unistd.h"><p>
341 <!-- <item><ref id="chdir" name="chdir"> -->
342 <!-- <item><ref id="getcwd" name="getcwd"> -->
343 <!-- <item><ref id="lseek" name="lseek"> -->
344 <!-- <item><ref id="mkdir" name="mkdir"> -->
345 <!-- <item><ref id="read" name="read"> -->
346 <!-- <item><ref id="rmdir" name="rmdir"> -->
347 <item><ref id="sleep" name="sleep">
348 <!-- <item><ref id="unlink" name="unlink"> -->
349 <!-- <item><ref id="write" name="write"> -->
353 <sect1><tt/vic20.h/<label id="vic20.h"><p>
356 <sect1><tt/zlib.h/<label id="zlib.h"><p>
361 <sect>Alphabetical function reference<p>
363 <sect1>_heapadd<label id="_heapadd"><p>
367 <tag/Function/Add a block to the heap.
368 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
369 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
370 <tag/Description/The function adds a block of raw memory to the heap.
373 <item>The minimum blocksize that can be added is 6 bytes; the function will
374 ignore blocks with smaller sizes.
376 <tag/Availability/cc65
378 <ref id="_heapmaxavail" name="_heapmaxavail">,
379 <ref id="_heapmemavail" name="_heapmemavail">,
380 <ref id="calloc" name="calloc">,
381 <ref id="free" name="free">,
382 <ref id="malloc" name="malloc">,
383 <ref id="realloc" name="realloc">
389 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
393 <tag/Function/Return the largest block that is available on the heap.
394 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
395 <tag/Declaration/<tt/size_t __fastcall__ _heapmaxavail (void);/
396 <tag/Description/The function returns the size of the largest block that may
397 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
398 <tag/Availability/cc65
400 <ref id="_heapadd" name="_heapadd">,
401 <ref id="_heapmemavail" name="_heapmemavail">,
402 <ref id="calloc" name="calloc">,
403 <ref id="free" name="free">,
404 <ref id="malloc" name="malloc">,
405 <ref id="realloc" name="realloc">
411 <sect1>_heapmemavail<label id="_heapmemavail"><p>
415 <tag/Function/Return the total available space on the heap.
416 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
417 <tag/Declaration/<tt/size_t __fastcall__ _heapmemavail (void);/
418 <tag/Description/The function returns the total number of bytes available on
422 <item>This function is of less use than usually assumed, since the returned
423 heap space may be available but not in one block. So even if this function
424 says that several times more heap space is available than needed, <ref
425 id="malloc" name="malloc"> may still return <tt/NULL/.
427 <tag/Availability/cc65
429 <ref id="_heapadd" name="_heapadd">,
430 <ref id="_heapmaxavail" name="_heapmaxavail">,
431 <ref id="calloc" name="calloc">,
432 <ref id="free" name="free">,
433 <ref id="malloc" name="malloc">,
434 <ref id="realloc" name="realloc">
440 <sect1>_randomize<label id="_randomize"><p>
444 <tag/Function/Initialize the pseudo random number generator.
445 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
446 <tag/Declaration/<tt/void _randomize (void);/
447 <tag/Description/The function initializes the random number generator with
448 a seed derived from fast changing hardware events, so the seed itself can be
449 considered random to a certain degree.
450 <tag/Limits/<itemize>
451 <item>The randomness of the seed depends on the machine hardware.
453 <tag/Availability/cc65
455 <ref id="rand" name="rand">,
456 <ref id="srand" name="srand">
462 <sect1>_swap<label id="_swap"><p>
466 <tag/Function/Swap the contents of memory areas.
467 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
468 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
469 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
470 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
471 <tt/size/ bytes in size.
472 <tag/Limits/<itemize>
473 <item>The memory areas may not overlap, otherwise the results are undefined.
474 <item>The function is only available as fastcall function, so it may only be
475 used in presence of a prototype.
477 <tag/Availability/cc65
479 <ref id="memcpy" name="memcpy">,
480 <ref id="memmove" name="memmove">
486 <sect1>_sys<label id="_sys"><p>
490 <tag/Function/Call a subroutine passing register values.
491 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
492 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
493 <tag/Description/The function will call the subroutine at the address
494 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
495 registers and the CPU flags are set to the values given in the <tt/regs/
496 structure. On return from the subroutine, the new values of the registers and
497 flags are stored back overwriting the old values.
498 <tag/Limits/<itemize>
499 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
500 when calling the subroutine (they are unchanged from their current values).
501 <item>The function is only available as fastcall function, so it may only be
502 used in presence of a prototype.
504 <tag/Availability/cc65
510 <sect1>BRK<label id="BRK"><p>
514 <tag/Function/Insert a 6502 BRK instrunction into the code.
515 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
516 <tag/Declaration/<tt/void BRK (void);/
517 <tag/Description/The function will insert a 6502 BRK instruction into the code
518 which may be used to trigger a debugger.
519 <tag/Limits/<itemize>
520 <item>The function is actually a macro.
521 <item>The inserted instruction may lead to unexpected results if no debugger
524 <tag/Availability/cc65
526 <ref id="CLI" name="CLI">,
527 <ref id="SEI" name="SEI">
533 <sect1>CLI<label id="CLI"><p>
537 <tag/Function/Insert a 6502 CLI instrunction into the code.
538 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
539 <tag/Declaration/<tt/void CLI (void);/
540 <tag/Description/The function will insert a 6502 CLI instruction into the code,
541 so interrupts are disabled. Note that non maskable interrupts cannot be
543 <tag/Limits/<itemize>
544 <item>The function is actually a macro.
545 <item>Disabling interrupts may lead to unexpected results.
547 <tag/Availability/cc65
549 <ref id="BRK" name="BRK">,
550 <ref id="SEI" name="SEI">
556 <sect1>PEEK<label id="PEEK"><p>
560 <tag/Function/Read a byte from memory.
561 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
562 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
563 <tag/Description/The function will read the absolute memory given by <tt/addr/
564 and return the value read.
565 <tag/Limits/<itemize>
566 <item>The function is actually a macro.
567 <item>This function depends highly on the platform and environment.
569 <tag/Availability/cc65
571 <ref id="PEEKW" name="PEEKW">,
572 <ref id="POKE" name="POKE">
578 <sect1>PEEKW<label id="PEEKW"><p>
582 <tag/Function/Read a word (two bytes) from memory.
583 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
584 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
585 <tag/Description/The function will read the absolute memory given by <tt/addr/
586 and return the value read. The byte read from the higher address is the high
587 byte of the return value.
588 <tag/Limits/<itemize>
589 <item>The function is actually a macro.
590 <item>This function depends highly on the platform and environment.
591 <item>The order in which the two bytes are read is unspecified and may
592 depend of the address expression used.
594 <tag/Availability/cc65
596 <ref id="PEEK" name="PEEK">,
597 <ref id="POKE" name="POKE">
603 <sect1>POKE<label id="POKE"><p>
607 <tag/Function/Write a byte to memory.
608 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
609 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
610 <tag/Description/The function writes the value <tt/val/ to the absolute
611 memory address given by <tt/addr/.
612 <tag/Limits/<itemize>
613 <item>The function is actually a macro.
614 <item>This function depends highly on the platform and environment.
615 <item>Careless use will cause the program to act strange or may crash the
618 <tag/Availability/cc65
620 <ref id="PEEK" name="PEEK">,
621 <ref id="POKEW" name="POKEW">
627 <sect1>POKEW<label id="POKEW"><p>
631 <tag/Function/Write a word (two bytes) to memory.
632 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
633 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
634 <tag/Description/The function writes the value <tt/val/ to the absolute
635 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
636 the <tt/addr/, the high byte is written to <tt/addr+1/.
637 <tag/Limits/<itemize>
638 <item>The function is actually a macro.
639 <item>This function depends highly on the platform and environment.
640 <item>Careless use will cause the program to act strange or may crash the
642 <item>The order in which the two bytes are written is unspecified and may
643 depend of the address expression used.
645 <tag/Availability/cc65
647 <ref id="PEEK" name="PEEK">,
648 <ref id="POKE" name="POKE">
654 <sect1>SEI<label id="SEI"><p>
658 <tag/Function/Insert a 6502 SEI instrunction into the code.
659 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
660 <tag/Declaration/<tt/void SEI (void);/
661 <tag/Description/The function will insert a 6502 SEI instruction into the code,
662 so interrupts are enabled. Enabling interrupts has no effects if they are
663 already enabled (the default).
664 <tag/Limits/<itemize>
665 <item>The function is actually a macro.
667 <tag/Availability/cc65
669 <ref id="BRK" name="BRK">,
670 <ref id="CLI" name="CLI">
676 <sect1>abort<label id="abort"><p>
680 <tag/Function/Terminates a program abnormally.
681 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
682 <tag/Declaration/<tt/void abort (void);/
683 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
684 on stderr, then terminates the program with an exit code of 3.
685 <tag/Availability/ISO 9899
687 <ref id="assert" name="assert">,
688 <ref id="exit" name="exit">,
689 <ref id="raise" name="raise">
695 <sect1>abs<label id="abs"><p>
699 <tag/Function/Returns the absolute value of an integer.
700 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
701 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
702 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
704 <tag/Limits/<itemize>
705 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
706 <item>The function is only available as fastcall function, so it may only be
707 used in presence of a prototype.
709 <tag/Availability/ISO 9899
711 <ref id="labs" name="labs">
717 <sect1>assert<label id="assert"><p>
721 <tag/Function/Test a condition and possibly abort.
722 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
723 <tag/Declaration/<tt/void assert (int cond);/
724 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
725 statement. If the condition evaluates t zero (false), assert prints a message
726 on stderr and aborts the program.
727 <tag/Limits/<itemize>
728 <item>The function is actually a macro.
730 <tag/Availability/ISO 9899
732 <ref id="abort" name="abort">,
733 <ref id="exit" name="exit">
739 <sect1>atexit<label id="atexit"><p>
743 <tag/Function/Register an exit function.
744 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
745 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
746 <tag/Description/<tt/atexit/ registers the function pointed to by
747 <tt/exitfunc/ as an exit function. Exit functions are called when the program
748 terminates, they are called in LIFO order (the last function registered is
749 called first). <tt/atexit/ returns zero on success and a nonzero value on
751 <tag/Limits/<itemize>
752 <item>A maximum of 5 exit functions can be registered.
753 <item>There is no way to unregister an exit function.
754 <item>The function is only available as fastcall function, so it may only be
755 used in presence of a prototype.
757 <tag/Availability/ISO 9899
759 <ref id="abort" name="abort">,
760 <ref id="exit" name="exit">
766 <sect1>atoi<label id="atoi"><p>
770 <tag/Function/Convert a string to an integer.
771 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
772 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
773 <tag/Description/<tt/atoi/ converts the given string into an integer.
774 Conversion stops as soon as any invalid character is encountered.
775 <tag/Limits/<itemize>
776 <item>There is no way to detect any conversion errors.
777 <item>The function does not check for an numerical overflow when converting.
778 <item>The function is only available as fastcall function, so it may only be
779 used in presence of a prototype.
781 <tag/Availability/ISO 9899
783 <ref id="atol" name="atol">,
784 <ref id="itoa" name="itoa">,
785 <ref id="ltoa" name="ltoa">,
786 <ref id="ultoa" name="ultoa">,
787 <ref id="utoa" name="utoa">
793 <sect1>atol<label id="atol"><p>
797 <tag/Function/Convert a string to a long integer.
798 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
799 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
800 <tag/Description/<tt/atol/ converts the given string into a long integer.
801 Conversion stops as soon as any invalid character is encountered.
802 <tag/Limits/<itemize>
803 <item>There is no way to detect any conversion errors.
804 <item>The function does not check for an numerical overflow when converting.
805 <item>The function is only available as fastcall function, so it may only be
806 used in presence of a prototype.
808 <tag/Availability/ISO 9899
810 <ref id="atoi" name="atoi">,
811 <ref id="itoa" name="itoa">,
812 <ref id="ltoa" name="ltoa">,
813 <ref id="ultoa" name="ultoa">,
814 <ref id="utoa" name="utoa">
820 <sect1>bgcolor<label id="bgcolor"><p>
824 <tag/Function/Set the background text color.
825 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
826 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
827 <tag/Description/The function will set a new background text color. It returns
828 the old (current) background color.
829 <tag/Limits/<itemize>
830 <item>Background colors are system dependent. The function may have no effect
831 on systems where the background color cannot be changed.
832 <item>The function is only available as fastcall function, so it may only be
833 used in presence of a prototype.
835 <tag/Availability/cc65
837 <ref id="bordercolor" name="bordercolor">,
838 <ref id="textcolor" name="textcolor">
844 <sect1>bordercolor<label id="bordercolor"><p>
848 <tag/Function/Set the border (frame) color.
849 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
850 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
851 <tag/Description/The function will set a new border color. It returns the old
852 (current) border color.
853 <tag/Limits/<itemize>
854 <item>Border colors are system dependent. The function may have no effect
855 on systems where the border color cannot be changed.
856 <item>The function is only available as fastcall function, so it may only
857 be used in presence of a prototype.
859 <tag/Availability/cc65
861 <ref id="bgcolor" name="bgcolor">,
862 <ref id="textcolor" name="textcolor">
868 <sect1>bsearch<label id="bsearch"><p>
872 <tag/Function/Do a binary search in a sorted array.
873 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
874 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
875 const void* base, size_t n, size_t size,
876 int (*cmp) (const void*, const void*));/
877 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
878 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
879 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
880 the function used to compare the members against the key. The function returns
881 a pointer to the member found, or <tt/NULL/ if there was no match.
884 <item>The contents of the array must be sorted in ascending order according to
885 the compare function given.
886 <item>If there are multiple members that match the key, the function will
887 return one of the members.
888 <item>The function is only available as fastcall function, so it may only
889 be used in presence of a prototype.
891 <tag/Availability/ISO 9899
893 <ref id="qsort" name="qsort">
899 <sect1>bzero<label id="bzero"><p>
903 <tag/Function/Fill a memory area with zeroes.
904 <tag/Header/<tt/<ref id="string.h" name="string.h">/
905 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
906 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
910 <item>The function is non standard and therefore only available in non ANSI
911 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
912 <item>The function is only available as fastcall function, so it may only
913 be used in presence of a prototype.
915 <tag/Availability/cc65
917 <ref id="_swap" name="_swap">,
918 <ref id="memcpy" name="memcpy">,
919 <ref id="memmove" name="memmove">,
920 <ref id="memset" name="memset">,
926 <sect1>c64mode<label id="c64mode"><p>
930 <tag/Function/Switch the C128 into C64 compatible mode.
931 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
932 <tag/Declaration/<tt/void c64mode (void);/
933 <tag/Description/The function will cause the machine to reboot into C64 mode.
934 <tag/Limits/<itemize>
935 <item>The function is specific to the C128.
936 <item>The function will not return to the caller.
938 <tag/Availability/C128
944 <sect1>calloc<label id="calloc"><p>
948 <tag/Function/Allocate and clear memory.
949 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
950 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
951 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
952 of size <tt/size/, clears the whole block with binary zeroes and returns a
953 pointer to it. On error (not enough memory available), <tt/calloc/ returns
957 <item>Clearing the memory may not have the expected effect on all platforms:
958 pointers in the block may not be <tt/NULL/ and floating point variables may
959 not be zero (0.0). In other words: The "clearing" effect of this function
960 should be used with care for portable programs.
961 <item>The function is only available as fastcall function, so it may only
962 be used in presence of a prototype.
964 <tag/Availability/ISO 9899
966 <ref id="_heapadd" name="_heapadd">,
967 <ref id="_heapmaxavail" name="_heapmaxavail">,
968 <ref id="_heapmemavail" name="_heapmemavail">,
969 <ref id="free" name="free">,
970 <ref id="malloc" name="malloc">,
971 <ref id="realloc" name="realloc">
977 <sect1>cclear<label id="cclear"><p>
981 <tag/Function/Clear part of a line (write a given amount of spaces).
982 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
983 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
984 <tag/Description/The function clears part of a line by writing <tt/length/
985 spaces in the current text color.
986 <tag/Limits/<itemize>
987 <item>The function is only available as fastcall function, so it may
988 only be used in presence of a prototype.
990 <tag/Availability/cc65
992 <ref id="cclearxy" name="cclearxy">,
993 <ref id="clrscr" name="clrscr">
999 <sect1>cclearxy<label id="cclearxy"><p>
1003 <tag/Function/Clear part of a line (write a given amount of spaces) starting
1004 at a specific screen position.
1005 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1006 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char length);/
1007 <tag/Description/The function moves the cursor to a specific position, and
1008 will then clear part of the line by writing <tt/length/ spaces in the current
1010 <tag/Limits/<itemize>
1011 <item>The function is only available as fastcall function, so it may
1012 only be used in presence of a prototype.
1014 <tag/Availability/cc65
1016 <ref id="cclear" name="cclear">,
1017 <ref id="clrscr" name="clrscr">
1023 <sect1>cgetc<label id="cgetc"><p>
1027 <tag/Function/Read a character from the keyboard.
1028 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1029 <tag/Declaration/<tt/char cgetc (void);/
1030 <tag/Description/The function reads a character from the keyboard. If there is
1031 no character available, <tt/cgetc/ waits until the user presses a key. If the
1032 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
1033 displayed while waiting.
1034 <tag/Limits/<itemize>
1035 <item>If the system supports a keyboard buffer, <tt/cgetc/ will fetch a key
1036 from this buffer and wait only if the buffer is empty.
1038 <tag/Availability/cc65
1040 <ref id="cursor" name="cursor">,
1041 <ref id="kbhit" name="kbhit">
1047 <sect1>chline<label id="chline"><p>
1051 <tag/Function/Output a horizontal line in text mode.
1052 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1053 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
1054 <tag/Description/The function outputs a horizontal line with the given length
1055 starting at the current cursor position.
1056 <tag/Limits/<itemize>
1057 <item>The character used to draw the horizontal line is system dependent.
1058 If available, a line drawing character is used. Drawing a line that is partially
1059 off screen leads to undefined behaviour.
1060 <item>The function is only available as fastcall function, so it may only be
1061 used in presence of a prototype.
1063 <tag/Availability/cc65
1065 <ref id="chlinexy" name="chlinexy">,
1066 <ref id="cvline" name="cvline">,
1067 <ref id="cvlinexy" name="cvlinexy">
1073 <sect1>chlinexy<label id="chlinexy"><p>
1077 <tag/Function/Output a horizontal line at a given position in text mode.
1078 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1079 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
1080 <tag/Description/The function outputs a horizontal line with the given length
1081 starting at a given position.
1082 <tag/Limits/<itemize>
1083 <item>The character used to draw the horizontal line is system dependent.
1084 If available, a line drawing character is used. Drawing a line that is partially
1085 off screen leads to undefined behaviour.
1086 <item>The function is only available as fastcall function, so it may only be
1087 used in presence of a prototype.
1089 <tag/Availability/cc65
1091 <ref id="chline" name="chline">,
1092 <ref id="cvline" name="cvline">,
1093 <ref id="cvlinexy" name="cvlinexy">
1099 <sect1>clrscr<label id="clrscr"><p>
1103 <tag/Function/Clear the text screen.
1104 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1105 <tag/Declaration/<tt/void clrscr (void);/
1106 <tag/Description/The function clears the text screen and moves the cursor to
1107 the upper left corner.
1108 <tag/Availability/cc65
1110 <ref id="cclear" name="cclear">,
1111 <ref id="cclearxy" name="cclearxy">
1117 <sect1>close<label id="close"><p>
1121 <tag/Function/Close a file descriptor.
1122 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1123 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
1124 <tag/Description/The function closes the given file descriptor. It returns zero
1125 on success and -1 on error. If an error occurs, the cause can be determined by
1126 reading the <tt/errno/ variable.
1127 <tag/Limits/<itemize>
1128 <item>The function is only available as fastcall function, so it may only
1129 be used in presence of a prototype.
1131 <tag/Availability/POSIX
1133 <ref id="creat" name="creat">,
1134 <ref id="open" name="open">
1140 <sect1>creat<label id="creat"><p>
1144 <tag/Function/Create a file.
1145 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1146 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
1147 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
1148 associated with it. On error, -1 is returned and an error code is stored in
1150 <tag/Limits/<itemize>
1151 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
1152 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
1153 <item>The function is only available as fastcall function, so it may only
1154 be used in presence of a prototype.
1156 <tag/Availability/POSIX
1158 <ref id="close" name="close">,
1159 <ref id="open" name="open">
1165 <sect1>cursor<label id="cursor"><p>
1169 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
1170 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1171 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
1172 <tag/Description/If the argument to the function is non zero, a blinking cursor
1173 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
1174 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
1175 <tag/Limits/<itemize>
1176 <item>The function is only available as fastcall function, so it may only
1177 be used in presence of a prototype.
1179 <tag/Availability/cc65
1181 <ref id="cgetc" name="cgetc">,
1182 <ref id="kbhit" name="kbhit">
1188 <sect1>cvline<label id="cvline"><p>
1192 <tag/Function/Output a vertical line in text mode.
1193 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1194 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
1195 <tag/Description/The function outputs a vertical line with the given length
1196 starting at the current cursor position.
1197 <tag/Limits/<itemize>
1198 <item>The character used to draw the vertical line is system dependent.
1199 If available, a line drawing character is used. Drawing a line that is partially
1200 off screen leads to undefined behaviour.
1201 <item>The function is only available as fastcall function, so it may only be
1202 used in presence of a prototype.
1204 <tag/Availability/cc65
1206 <ref id="chline" name="chline">,
1207 <ref id="chlinexy" name="chlinexy">,
1208 <ref id="cvlinexy" name="cvlinexy">
1214 <sect1>cvlinexy<label id="cvlinexy"><p>
1218 <tag/Function/Output a vertical line at a given position in text mode.
1219 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1220 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
1221 <tag/Description/The function outputs a vertical line with the given length
1222 starting at a given position.
1223 <tag/Limits/<itemize>
1224 <item>The character used to draw the vertical line is system dependent.
1225 If available, a line drawing character is used. Drawing a line that is partially
1226 off screen leads to undefined behaviour.
1227 <item>The function is only available as fastcall function, so it may only be
1228 used in presence of a prototype.
1230 <tag/Availability/cc65
1232 <ref id="chline" name="chline">,
1233 <ref id="chlinexy" name="chlinexy">,
1234 <ref id="cvline" name="cvline">
1240 <sect1>div<label id="div"><p>
1244 <tag/Function/Divide two ints and return quotient and remainder.
1245 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1246 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
1247 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
1248 quotient and remainder in a <tt/div_t/ structure.
1251 <item>The function is only available as fastcall function, so it may only
1252 be used in presence of a prototype.
1254 <tag/Availability/ISO 9899
1262 <sect1>em_commit<label id="em_commit"><p>
1266 <tag/Function/Commit changes into extended memory.
1267 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1268 <tag/Declaration/<tt/void __fastcall__ em_commit (void);/
1269 <tag/Description/Commit changes in the memory window to extended storage. If
1270 the contents of the memory window have been changed, these changes may be lost
1271 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
1272 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
1273 name="em_copyto">/ are called without calling <tt/em_commit/ first.
1274 <tag/Limits/<itemize>
1275 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
1276 memory window are discarded, it does just mean that the drivers is allowed
1278 <item>The function is only available as fastcall function, so it may only be
1279 used in presence of a prototype.
1280 <item>The function produces undefined results if no extended memory driver is
1283 <tag/Availability/cc65
1285 <ref id="em_load_driver" name="em_load_driver">,
1286 <ref id="em_map" name="em_map">,
1287 <ref id="em_use" name="em_use">
1293 <sect1>em_copyfrom<label id="em_copyfrom"><p>
1297 <tag/Function/Copy from extended into normal memory.
1298 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1299 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
1300 <tag/Description/Copy data from extended memory into linear memory. Source and
1301 target addresses as well as the number of bytes to transfer are specified in
1302 the <tt/em_copy/ structure that is passed as a parameter.
1303 <tag/Limits/<itemize>
1304 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
1305 made any changes to the data in the window, call <tt/<ref id="em_commit"
1306 name="em_commit">/ first, or the changes are lost.
1307 <item>The function is only available as fastcall function, so it may only be
1308 used in presence of a prototype.
1309 <item>The function produces undefined results if no extended memory driver is
1312 <tag/Availability/cc65
1314 <ref id="em_commit" name="em_commit">,
1315 <ref id="em_copyto" name="em_copyto">,
1316 <ref id="em_load_driver" name="em_load_driver">
1322 <sect1>em_copyto<label id="em_copyto"><p>
1326 <tag/Function/Copy from normal into extended memory.
1327 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1328 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
1329 <tag/Description/Copy data from linear into extended memory. Source and
1330 target addresses as well as the number of bytes to transfer are specified in
1331 the <tt/em_copy/ structure that is passed as a parameter.
1332 <tag/Limits/<itemize>
1333 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
1334 made any changes to the data in the window, call <tt/<ref id="em_commit"
1335 name="em_commit">/ first, or the changes are lost.
1336 <item>The function is only available as fastcall function, so it may only be
1337 used in presence of a prototype.
1338 <item>The function produces undefined results if no extended memory driver is
1341 <tag/Availability/cc65
1343 <ref id="em_commit" name="em_commit">,
1344 <ref id="em_copyfrom" name="em_copyfrom">,
1345 <ref id="em_load_driver" name="em_load_driver">
1351 <sect1>em_load_driver<label id="em_load_driver"><p>
1355 <tag/Function/Load and initialize an extended memory driver.
1356 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1357 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
1358 <tag/Description/Load an extended memory driver into memory and initialize
1359 it. The function returns an error code that tells if all this has been
1361 <tag/Limits/<itemize>
1362 <item>Not all drivers are able to detect if the supported hardware is really
1364 <item>The function is only available as fastcall function, so it may only be
1365 used in presence of a prototype.
1366 <item>The driver is loaded by name, so currently you must know the type of
1367 extended memory that should be supported. There is no autodetect capability.
1369 <tag/Availability/cc65
1371 <ref id="em_unload" name="em_unload">
1377 <sect1>em_map<label id="em_map"><p>
1381 <tag/Function/Make a page of extended memory accessible.
1382 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1383 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
1384 <tag/Description/The function maps one page of extended memory into linear
1385 memory and returns a pointer to the page frame. Depending on the hardware
1386 and driver, the data is either mapped into the address space or transfered
1387 into a buffer. If you don't need the actual contents of the page (for example
1388 because you're going to overwrite it completely, it is better to call
1389 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
1390 data if it is possible to avoid that.
1391 <tag/Limits/<itemize>
1392 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
1393 made any changes to the data in the window, call <tt/<ref id="em_commit"
1394 name="em_commit">/ first, or the changes are lost.
1395 <item>The function is only available as fastcall function, so it may only be
1396 used in presence of a prototype.
1397 <item>The function produces undefined results if no extended memory driver is
1400 <tag/Availability/cc65
1402 <ref id="em_commit" name="em_commit">,
1403 <ref id="em_load_driver" name="em_load_driver">,
1404 <ref id="em_use" name="em_use">
1410 <sect1>em_pagecount<label id="em_pagecount"><p>
1414 <tag/Function/Return the number of available extended memory pages.
1415 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1416 <tag/Declaration/<tt/unsigned __fastcall__ em_pagecount (void);/
1417 <tag/Description/The function returns the size of the extended memory supported
1418 by the driver in 256 byte pages.
1419 <tag/Limits/<itemize>
1420 <item>The function returns zero if no extended memory driver is loaded.
1421 <item>The function may return zero if the supported hardware was not detected.
1423 <tag/Availability/cc65
1425 <ref id="em_load_driver" name="em_load_driver">
1431 <sect1>em_unload<label id="em_unload"><p>
1435 <tag/Function/Unload an extended memory driver.
1436 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1437 <tag/Declaration/<tt/void __fastcall__ em_unload (void);/
1438 <tag/Description/The function unloads a loaded extended memory driver and
1439 frees all memory allocated for the driver.
1440 <tag/Limits/<itemize>
1441 <item>The function does nothing if no driver is loaded.
1443 <tag/Availability/cc65
1445 <ref id="em_load_driver" name="em_load_driver">
1451 <sect1>em_use<label id="em_use"><p>
1455 <tag/Function/Prepare an extended memory page for use.
1456 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1457 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
1458 <tag/Description/The function maps one page of extended memory into linear
1459 memory and returns a pointer to the page frame. This function is similar to
1460 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
1461 actual memory window in the assumption that the existing data is wrong or
1462 will get overwritten.
1463 <tag/Limits/<itemize>
1464 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
1465 made any changes to the data in the window, call <tt/<ref id="em_commit"
1466 name="em_commit">/ first, or the changes are lost.
1467 <item>The function is only available as fastcall function, so it may only be
1468 used in presence of a prototype.
1469 <item>The function produces undefined results if no extended memory driver is
1472 <tag/Availability/cc65
1474 <ref id="em_commit" name="em_commit">,
1475 <ref id="em_load_driver" name="em_load_driver">,
1476 <ref id="em_map" name="em_map">
1482 <sect1>exit<label id="exit"><p>
1486 <tag/Function/Terminate the program.
1487 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1488 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
1489 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
1490 return code of the program. Before termination, all files are closed, buffered
1491 output is written and any functions registered with <tt/<ref id="atexit"
1492 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
1493 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
1495 <tag/Limits/<itemize>
1496 <item>The function is only available as fastcall function, so it may only
1497 be used in presence of a prototype.
1498 <item>It depends on the host machine if the program return code can be
1499 evaluated or is ignored.
1501 <tag/Availability/ISO 9899
1503 <ref id="abort" name="abort">,
1504 <ref id="exit" name="exit">
1510 <sect1>fast<label id="fast"><p>
1514 <tag/Function/Switch the C128 into 2MHz mode.
1515 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1516 <tag/Declaration/<tt/void fast (void);/
1517 <tag/Description/The function will switch the clock of the C128 to 2MHz. This
1518 will nearly double the speed compared to slow mode.
1519 <tag/Limits/<itemize>
1520 <item>The function is specific to the C128.
1521 <item>2MHz clock will not work in 40 column mode.
1523 <tag/Availability/C128
1525 <ref id="slow" name="slow">,
1526 <ref id="toggle_videomode" name="toggle_videomode">
1532 <sect1>free<label id="free"><p>
1536 <tag/Function/Free a block of dynamic memory.
1537 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1538 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
1539 <tag/Description/Free a block of dynamic memory previously allocated with
1540 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
1541 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
1542 pointer is <tt/NULL/, no action is performed.
1545 <item>Passing an already free'd block to <tt/free/ again will cause undefined
1546 behaviour and may crash your program.
1547 <item>The function is only available as fastcall function, so it may only
1548 be used in presence of a prototype.
1550 <tag/Availability/ISO 9899
1552 <ref id="_heapadd" name="_heapadd">,
1553 <ref id="_heapmaxavail" name="_heapmaxavail">,
1554 <ref id="_heapmemavail" name="_heapmemavail">,
1555 <ref id="calloc" name="calloc">,
1556 <ref id="malloc" name="malloc">,
1557 <ref id="realloc" name="realloc">
1563 <sect1>getenv<label id="getenv"><p>
1567 <tag/Function/Return a value from the environment.
1568 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1569 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
1570 <tag/Description/The function searches the environment for an entry that
1571 matches <tt/name/ and returns its value. The environment consists of a list
1572 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
1574 <tag/Limits/<itemize>
1575 <item>What exactly is stored in the environment depends on the machine the
1576 program is running on.
1577 <item>The function is only available as fastcall function, so it may only
1578 be used in presence of a prototype.
1580 <tag/Availability/ISO 9899
1586 <sect1>getcpu<label id="getcpu"><p>
1590 <tag/Function/Determine on which CPU the program is running.
1591 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1592 <tag/Declaration/<tt/unsigned char getcpu (void);/
1593 <tag/Description/The function checks on which CPU the code is running. It
1594 returns one of the constants<itemize>
1596 <item><tt/CPU_65C02/
1597 <item><tt/CPU_65816/
1599 <tag/Limits/<itemize>
1600 <item>Other, more exotic CPU types are not disinguished.
1602 <tag/Availability/cc65
1608 <sect1>gotox<label id="gotox"><p>
1612 <tag/Function/Move the text mode cursor to a new X position.
1613 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1614 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
1615 <tag/Description/The function moves the text mode cursor to the specified X
1616 position while leaving the Y position untouched. The leftmost position on the
1617 screen has the coordinate 0.
1618 <tag/Limits/<itemize>
1619 <item>The function is only available as fastcall function, so it may
1620 only be used in presence of a prototype.
1621 <item>Invalid values for the X position (out of screen coordinates) may
1622 lead to undefined behaviour.
1624 <tag/Availability/cc65
1626 <ref id="gotoy" name="gotoy">,
1627 <ref id="gotoxy" name="gotoxy">,
1628 <ref id="wherex" name="wherex">,
1629 <ref id="wherey" name="wherey">
1635 <sect1>gotoxy<label id="gotoxy"><p>
1639 <tag/Function/Move the text mode cursor to a new position.
1640 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1641 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
1642 <tag/Description/The function moves the text mode cursor to the specified
1643 position. The leftmost position on the screen has the X coordinate 0, the
1644 topmost line has the Y coordinate 0.
1645 <tag/Limits/<itemize>
1646 <item>The function is only available as fastcall function, so it may only be
1647 used in presence of a prototype.
1648 <item>Invalid values for any of both coordinates (out of screen positions) may
1649 lead to undefined behaviour.
1651 <tag/Availability/cc65
1653 <ref id="gotox" name="gotox">,
1654 <ref id="gotoy" name="gotoy">,
1655 <ref id="wherex" name="wherex">,
1656 <ref id="wherey" name="wherey">
1662 <sect1>gotoy<label id="gotoy"><p>
1666 <tag/Function/Move the text mode cursor to a new Y position.
1667 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1668 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
1669 <tag/Description/The function moves the text mode cursor to the specified Y
1670 position while leaving the X position untouched. The uppermost position on the
1671 screen has the coordinate 0.
1672 <tag/Limits/<itemize>
1673 <item>The function is only available as fastcall function, so it may
1674 only be used in presence of a prototype.
1675 <item>Invalid values for the Y position (out of screen coordinates) may lead
1676 to undefined behaviour.
1678 <tag/Availability/cc65
1680 <ref id="gotox" name="gotox">,
1681 <ref id="gotoxy" name="gotoxy">,
1682 <ref id="wherex" name="wherex">,
1683 <ref id="wherey" name="wherey">
1689 <sect1>isalnum<label id="isalnum"><p>
1693 <tag/Function/Check if a given character is a letter or digit.
1694 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1695 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
1696 <tag/Description/The function returns a value of zero if the given argument
1697 is a letter or digit. The return value is non zero if the character
1699 <tag/Limits/<itemize>
1700 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1701 inline sequence generated by the macro will not work correctly for values
1702 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1703 this range. The non inline function may be accessed by <tt/#undef/'ing
1705 <item>When compiling without <tt/-Os/, the function is only available as
1706 fastcall function, so it may only be used in presence of a prototype.
1708 <tag/Availability/ISO 9899
1710 <ref id="isalpha" name="isalpha">,
1711 <ref id="isascii" name="isascii">,
1712 <ref id="isblank" name="isblank">,
1713 <ref id="iscntrl" name="iscntrl">,
1714 <ref id="isdigit" name="isdigit">,
1715 <ref id="isgraph" name="isgraph">,
1716 <ref id="islower" name="islower">,
1717 <ref id="isprint" name="isprint">,
1718 <ref id="ispunct" name="ispunct">,
1719 <ref id="isspace" name="isspace">,
1720 <ref id="isupper" name="isupper">,
1721 <ref id="isxdigit" name="isxdigit">
1727 <sect1>isalpha<label id="isalpha"><p>
1731 <tag/Function/Check if a given character is a letter.
1732 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1733 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
1734 <tag/Description/The function returns a value of zero if the given argument
1735 is a letter. The return value is non zero if the character is anything else.
1736 <tag/Limits/<itemize>
1737 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1738 inline sequence generated by the macro will not work correctly for values
1739 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1740 this range. The non inline function may be accessed by <tt/#undef/'ing the
1742 <item>When compiling without <tt/-Os/, the function is only available as
1743 fastcall function, so it may only be used in presence of a prototype.
1745 <tag/Availability/ISO 9899
1747 <ref id="isalnum" name="isalnum">,
1748 <ref id="isascii" name="isascii">,
1749 <ref id="isblank" name="isblank">,
1750 <ref id="iscntrl" name="iscntrl">,
1751 <ref id="isdigit" name="isdigit">,
1752 <ref id="isgraph" name="isgraph">,
1753 <ref id="islower" name="islower">,
1754 <ref id="isprint" name="isprint">,
1755 <ref id="ispunct" name="ispunct">,
1756 <ref id="isspace" name="isspace">,
1757 <ref id="isupper" name="isupper">,
1758 <ref id="isxdigit" name="isxdigit">
1764 <sect1>isascii<label id="isascii"><p>
1768 <tag/Function/Check if a given character is in the ASCII (0..127) range.
1769 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1770 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
1771 <tag/Description/The function returns a value of zero if the given argument
1772 is in the range 0..127 (the range of valid ASCII characters) and a non zero
1774 <tag/Limits/<itemize>
1775 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1776 inline sequence generated by the macro will not work correctly for values
1777 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1778 this range. The non inline function may be accessed by <tt/#undef/'ing the
1780 <item>When compiling without <tt/-Os/, the function is only available as
1781 fastcall function, so it may only be used in presence of a prototype.
1783 <tag/Availability/ISO 9899
1785 <ref id="isalnum" name="isalnum">,
1786 <ref id="isalpha" name="isalpha">,
1787 <ref id="isblank" name="isblank">,
1788 <ref id="iscntrl" name="iscntrl">,
1789 <ref id="isdigit" name="isdigit">,
1790 <ref id="isgraph" name="isgraph">,
1791 <ref id="islower" name="islower">,
1792 <ref id="isprint" name="isprint">,
1793 <ref id="ispunct" name="ispunct">,
1794 <ref id="isspace" name="isspace">,
1795 <ref id="isupper" name="isupper">,
1796 <ref id="isxdigit" name="isxdigit">
1802 <sect1>isblank<label id="isblank"><p>
1806 <tag/Function/Check if a given character is a space or tab.
1807 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1808 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
1809 <tag/Description/The function returns a value of zero if the given argument
1810 is a space or tab character. The return value is non zero if the character
1812 <tag/Limits/<itemize>
1813 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1814 inline sequence generated by the macro will not work correctly for values
1815 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1816 this range. The non inline function may be accessed by <tt/#undef/'ing the
1818 <item>When compiling without <tt/-Os/, the function is only available as
1819 fastcall function, so it may only be used in presence of a prototype.
1821 <tag/Availability/cc65
1823 <ref id="isalnum" name="isalnum">,
1824 <ref id="isalpha" name="isalpha">,
1825 <ref id="isascii" name="isascii">,
1826 <ref id="iscntrl" name="iscntrl">,
1827 <ref id="isdigit" name="isdigit">,
1828 <ref id="isgraph" name="isgraph">,
1829 <ref id="islower" name="islower">,
1830 <ref id="isprint" name="isprint">,
1831 <ref id="ispunct" name="ispunct">,
1832 <ref id="isspace" name="isspace">,
1833 <ref id="isupper" name="isupper">,
1834 <ref id="isxdigit" name="isxdigit">
1840 <sect1>iscntrl<label id="iscntrl"><p>
1844 <tag/Function/Check if a given character is a control character.
1845 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1846 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
1847 <tag/Description/The function returns a value of zero if the given argument
1848 is a control character. The return value is non zero if the character
1850 <tag/Limits/<itemize>
1851 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1852 inline sequence generated by the macro will not work correctly for values
1853 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1854 this range. The non inline function may be accessed by <tt/#undef/'ing the
1856 <item>When compiling without <tt/-Os/, the function is only available as
1857 fastcall function, so it may only be used in presence of a prototype.
1859 <tag/Availability/ISO 9899
1861 <ref id="isalnum" name="isalnum">,
1862 <ref id="isalpha" name="isalpha">,
1863 <ref id="isascii" name="isascii">,
1864 <ref id="isblank" name="isblank">,
1865 <ref id="isdigit" name="isdigit">,
1866 <ref id="isgraph" name="isgraph">,
1867 <ref id="islower" name="islower">,
1868 <ref id="isprint" name="isprint">,
1869 <ref id="ispunct" name="ispunct">,
1870 <ref id="isspace" name="isspace">,
1871 <ref id="isupper" name="isupper">,
1872 <ref id="isxdigit" name="isxdigit">
1878 <sect1>isdigit<label id="isdigit"><p>
1882 <tag/Function/Check if a given character is a digit.
1883 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1884 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
1885 <tag/Description/The function returns a value of zero if the given argument
1886 is a digit. The return value is non zero if the character is anything else.
1887 <tag/Limits/<itemize>
1888 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1889 inline sequence generated by the macro will not work correctly for values
1890 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1891 this range. The non inline function may be accessed by <tt/#undef/'ing the
1893 <item>When compiling without <tt/-Os/, the function is only available as
1894 fastcall function, so it may only be used in presence of a prototype.
1896 <tag/Availability/ISO 9899
1898 <ref id="isalnum" name="isalnum">,
1899 <ref id="isalpha" name="isalpha">,
1900 <ref id="isascii" name="isascii">,
1901 <ref id="isblank" name="isblank">,
1902 <ref id="iscntrl" name="iscntrl">,
1903 <ref id="isgraph" name="isgraph">,
1904 <ref id="islower" name="islower">,
1905 <ref id="isprint" name="isprint">,
1906 <ref id="ispunct" name="ispunct">,
1907 <ref id="isspace" name="isspace">,
1908 <ref id="isupper" name="isupper">,
1909 <ref id="isxdigit" name="isxdigit">
1915 <sect1>isgraph<label id="isgraph"><p>
1919 <tag/Function/Check if a given character is a printable character (except
1921 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1922 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
1923 <tag/Description/The function returns a value of zero if the given argument
1924 is a printable character with the exception of space. The return value is non
1925 zero if the character is anything else.
1926 <tag/Limits/<itemize>
1927 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1928 inline sequence generated by the macro will not work correctly for values
1929 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1930 this range. The non inline function may be accessed by <tt/#undef/'ing the
1932 <item>When compiling without <tt/-Os/, the function is only available as
1933 fastcall function, so it may only be used in presence of a prototype.
1935 <tag/Availability/ISO 9899
1937 <ref id="isalnum" name="isalnum">,
1938 <ref id="isalpha" name="isalpha">,
1939 <ref id="isascii" name="isascii">,
1940 <ref id="isblank" name="isblank">,
1941 <ref id="iscntrl" name="iscntrl">,
1942 <ref id="isdigit" name="isdigit">,
1943 <ref id="islower" name="islower">,
1944 <ref id="isprint" name="isprint">,
1945 <ref id="ispunct" name="ispunct">,
1946 <ref id="isspace" name="isspace">,
1947 <ref id="isupper" name="isupper">,
1948 <ref id="isxdigit" name="isxdigit">
1954 <sect1>islower<label id="islower"><p>
1958 <tag/Function/Check if a given character is a lower case letter.
1959 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1960 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
1961 <tag/Description/The function returns a value of zero if the given argument
1962 is a lower case letter. The return value is non zero if the character is
1964 <tag/Limits/<itemize>
1965 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1966 inline sequence generated by the macro will not work correctly for values
1967 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1968 this range. The non inline function may be accessed by <tt/#undef/'ing the
1970 <item>When compiling without <tt/-Os/, the function is only available as
1971 fastcall function, so it may only be used in presence of a prototype.
1973 <tag/Availability/ISO 9899
1975 <ref id="isalnum" name="isalnum">,
1976 <ref id="isalpha" name="isalpha">,
1977 <ref id="isascii" name="isascii">,
1978 <ref id="isblank" name="isblank">,
1979 <ref id="iscntrl" name="iscntrl">,
1980 <ref id="isdigit" name="isdigit">,
1981 <ref id="isgraph" name="isgraph">,
1982 <ref id="isprint" name="isprint">,
1983 <ref id="ispunct" name="ispunct">,
1984 <ref id="isspace" name="isspace">,
1985 <ref id="isupper" name="isupper">,
1986 <ref id="isxdigit" name="isxdigit">
1992 <sect1>isprint<label id="isprint"><p>
1996 <tag/Function/Check if a given character is a printable character.
1997 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1998 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
1999 <tag/Description/The function returns a value of zero if the given argument
2000 is a printable character (this includes the space character). The return value
2001 is non zero if the character is anything else.
2002 <tag/Limits/<itemize>
2003 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2004 inline sequence generated by the macro will not work correctly for values
2005 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2006 this range. The non inline function may be accessed by <tt/#undef/'ing the
2008 <item>When compiling without <tt/-Os/, the function is only available as
2009 fastcall function, so it may only be used in presence of a prototype.
2011 <tag/Availability/ISO 9899
2013 <ref id="isalnum" name="isalnum">,
2014 <ref id="isalpha" name="isalpha">,
2015 <ref id="isascii" name="isascii">,
2016 <ref id="isblank" name="isblank">,
2017 <ref id="iscntrl" name="iscntrl">,
2018 <ref id="isdigit" name="isdigit">,
2019 <ref id="isgraph" name="isgraph">,
2020 <ref id="islower" name="islower">,
2021 <ref id="ispunct" name="ispunct">,
2022 <ref id="isspace" name="isspace">,
2023 <ref id="isupper" name="isupper">,
2024 <ref id="isxdigit" name="isxdigit">
2030 <sect1>ispunct<label id="ispunct"><p>
2034 <tag/Function/Check if a given character is a printable character but not a
2035 space or an alphanumeric character.
2036 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2037 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
2038 <tag/Description/The function returns a value of zero if the given argument
2039 is a printable character, but not a space or anything alphanumeric. The return
2040 value is non zero if the character is anything else.
2041 <tag/Limits/<itemize>
2042 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2043 inline sequence generated by the macro will not work correctly for values
2044 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2045 this range. The non inline function may be accessed by <tt/#undef/'ing the
2047 <item>When compiling without <tt/-Os/, the function is only available as
2048 fastcall function, so it may only be used in presence of a prototype.
2050 <tag/Availability/ISO 9899
2052 <ref id="isalnum" name="isalnum">,
2053 <ref id="isalpha" name="isalpha">,
2054 <ref id="isascii" name="isascii">,
2055 <ref id="isblank" name="isblank">,
2056 <ref id="iscntrl" name="iscntrl">,
2057 <ref id="isdigit" name="isdigit">,
2058 <ref id="isgraph" name="isgraph">,
2059 <ref id="islower" name="islower">,
2060 <ref id="isprint" name="isprint">,
2061 <ref id="isspace" name="isspace">,
2062 <ref id="isupper" name="isupper">,
2063 <ref id="isxdigit" name="isxdigit">
2069 <sect1>isspace<label id="isspace"><p>
2073 <tag/Function/Check if a given character is a a white-space character.
2074 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2075 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
2076 <tag/Description/The function returns a value of zero if the given argument
2077 is a white space character. The return value is non zero if the character is
2078 anything else. The standard white space characters are: space, formfeed ('\f'),
2079 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
2081 <tag/Limits/<itemize>
2082 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2083 inline sequence generated by the macro will not work correctly for values
2084 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2085 this range. The non inline function may be accessed by <tt/#undef/'ing the
2087 <item>When compiling without <tt/-Os/, the function is only available as
2088 fastcall function, so it may only be used in presence of a prototype.
2090 <tag/Availability/ISO 9899
2092 <ref id="isalnum" name="isalnum">,
2093 <ref id="isalpha" name="isalpha">,
2094 <ref id="isascii" name="isascii">,
2095 <ref id="isblank" name="isblank">,
2096 <ref id="iscntrl" name="iscntrl">,
2097 <ref id="isdigit" name="isdigit">,
2098 <ref id="isgraph" name="isgraph">,
2099 <ref id="islower" name="islower">,
2100 <ref id="isprint" name="isprint">,
2101 <ref id="ispunct" name="ispunct">,
2102 <ref id="isupper" name="isupper">,
2103 <ref id="isxdigit" name="isxdigit">
2109 <sect1>isupper<label id="isupper"><p>
2113 <tag/Function/Check if a given character is an upper case letter.
2114 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2115 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
2116 <tag/Description/The function returns a value of zero if the given argument
2117 is an upper case letter. The return value is non zero if the character is
2119 <tag/Limits/<itemize>
2120 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2121 inline sequence generated by the macro will not work correctly for values
2122 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2123 this range. The non inline function may be accessed by <tt/#undef/'ing the
2125 <item>When compiling without <tt/-Os/, the function is only available as
2126 fastcall function, so it may only be used in presence of a prototype.
2128 <tag/Availability/ISO 9899
2130 <ref id="isalnum" name="isalnum">,
2131 <ref id="isalpha" name="isalpha">,
2132 <ref id="isascii" name="isascii">,
2133 <ref id="isblank" name="isblank">,
2134 <ref id="iscntrl" name="iscntrl">,
2135 <ref id="isdigit" name="isdigit">,
2136 <ref id="isgraph" name="isgraph">,
2137 <ref id="islower" name="islower">,
2138 <ref id="isprint" name="isprint">,
2139 <ref id="ispunct" name="ispunct">,
2140 <ref id="isspace" name="isspace">,
2141 <ref id="isxdigit" name="isxdigit">
2147 <sect1>isxdigit<label id="isxdigit"><p>
2151 <tag/Function/Check if a given character is a hexadecimal digit.
2152 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2153 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
2154 <tag/Description/The function returns a value of zero if the given argument
2155 is a hexadecimal digit (0..9, a..f and A..F). The return value is non zero
2156 if the character is anything else.
2157 <tag/Limits/<itemize>
2158 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2159 inline sequence generated by the macro will not work correctly for values
2160 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2161 this range. The non inline function may be accessed by <tt/#undef/'ing the
2163 <item>When compiling without <tt/-Os/, the function is only available as
2164 fastcall function, so it may only be used in presence of a prototype.
2166 <tag/Availability/ISO 9899
2168 <ref id="isalnum" name="isalnum">,
2169 <ref id="isalpha" name="isalpha">,
2170 <ref id="isascii" name="isascii">,
2171 <ref id="isblank" name="isblank">,
2172 <ref id="iscntrl" name="iscntrl">,
2173 <ref id="isdigit" name="isdigit">,
2174 <ref id="isgraph" name="isgraph">,
2175 <ref id="islower" name="islower">,
2176 <ref id="isprint" name="isprint">,
2177 <ref id="ispunct" name="ispunct">,
2178 <ref id="isspace" name="isspace">,
2179 <ref id="isupper" name="isupper">
2185 <sect1>itoa<label id="itoa"><p>
2189 <tag/Function/Convert an integer into a string.
2190 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2191 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
2192 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
2193 <tt/radix/ as the base.
2194 <tag/Limits/<itemize>
2195 <item>There are no provisions to prevent a buffer overflow.
2196 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
2197 <item>The function is non standard, so it is not available in strict ANSI mode.
2198 You should probably use <tt/sprintf/ instead.
2199 <item>The function is only available as fastcall function, so it may only be
2200 used in presence of a prototype.
2202 <tag/Availability/cc65
2204 <ref id="atoi" name="atoi">,
2205 <ref id="atol" name="atol">,
2206 <ref id="ltoa" name="ltoa">,
2207 <ref id="ultoa" name="ultoa">,
2208 <ref id="utoa" name="utoa">
2214 <sect1>kbhit<label id="kbhit"><p>
2218 <tag/Function/Check if there's a key waiting in the keyboard buffer.
2219 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2220 <tag/Declaration/<tt/unsigned char kbhit (void);/
2221 <tag/Description/The function returns a value of zero if there is no character
2222 waiting to be read from the keyboard. It returns non zero otherwise.
2223 <tag/Limits/<itemize>
2224 <item>If the system does not support a keyboard buffer (most systems
2225 do), the function is rather useless.
2227 <tag/Availability/cc65
2229 <ref id="cgetc" name="cgetc">,
2230 <ref id="cursor" name="cursor">
2236 <sect1>labs<label id="labs"><p>
2240 <tag/Function/Returns the absolute value of a long integer.
2241 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2242 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
2243 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
2245 <tag/Limits/<itemize>
2246 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
2247 <item>The function is only available as fastcall function, so it may only be
2248 used in presence of a prototype.
2250 <tag/Availability/ISO 9899
2252 <ref id="abs" name="abs">
2258 <sect1>ltoa<label id="ltoa"><p>
2262 <tag/Function/Convert a long integer into a string.
2263 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2264 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
2265 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
2266 using <tt/radix/ as the base.
2267 <tag/Limits/<itemize>
2268 <item>There are no provisions to prevent a buffer overflow.
2269 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
2270 <item>The function is non standard, so it is not available in strict ANSI mode.
2271 You should probably use <tt/sprintf/ instead.
2272 <item>The function is only available as fastcall function, so it may only be
2273 used in presence of a prototype.
2275 <tag/Availability/cc65
2277 <ref id="atoi" name="atoi">,
2278 <ref id="atol" name="atol">,
2279 <ref id="itoa" name="itoa">,
2280 <ref id="ultoa" name="ultoa">,
2281 <ref id="utoa" name="utoa">
2287 <sect1>localeconv<label id="localeconv"><p>
2291 <tag/Function/Returns a pointer to the current locale structure.
2292 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
2293 <tag/Declaration/<tt/struct lconv* localeconv (void);/
2294 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
2296 <tag/Limits/<itemize>
2297 <item>cc65 supports only the "C" locale, so even after setting a new locale
2298 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
2301 <tag/Availability/ISO 9899
2303 <ref id="setlocale" name="setlocale">
2309 <sect1>malloc<label id="malloc"><p>
2313 <tag/Function/Allocate dynamic memory.
2314 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2315 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
2316 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
2317 pointer to the allocated memory block. On error (not enough memory available),
2318 <tt/malloc/ returns <tt/NULL/.
2321 <item>The function is only available as fastcall function, so it may only
2322 be used in presence of a prototype.
2324 <tag/Availability/ISO 9899
2326 <ref id="_heapadd" name="_heapadd">,
2327 <ref id="_heapmaxavail" name="_heapmaxavail">,
2328 <ref id="_heapmemavail" name="_heapmemavail">,
2329 <ref id="calloc" name="calloc">,
2330 <ref id="free" name="free">,
2331 <ref id="realloc" name="realloc">
2337 <sect1>memcpy<label id="memcpy"><p>
2341 <tag/Function/Copy a memory area.
2342 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2343 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
2344 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
2345 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
2349 <item>The result is undefined if the memory areas do overlap. Use
2350 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
2351 <item>The function is only available as fastcall function, so it may only
2352 be used in presence of a prototype.
2354 <tag/Availability/ISO 9899
2356 <ref id="_swap" name="_swap">,
2357 <ref id="memmove" name="memmove">,
2358 <ref id="memset" name="memset">
2364 <sect1>memmove<label id="memmove"><p>
2368 <tag/Function/Copy a memory area.
2369 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2370 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
2371 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
2372 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
2376 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
2377 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
2378 <item>The function is only available as fastcall function, so it may only
2379 be used in presence of a prototype.
2381 <tag/Availability/ISO 9899
2383 <ref id="_swap" name="_swap">,
2384 <ref id="memcpy" name="memcpy">,
2385 <ref id="memset" name="memset">
2391 <sect1>memset<label id="memset"><p>
2395 <tag/Function/Fill a memory area.
2396 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2397 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
2398 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
2399 the value <tt/val/. The function returns <tt/p/.
2402 <item>The function is only available as fastcall function, so it may only
2403 be used in presence of a prototype.
2405 <tag/Availability/ISO 9899
2407 <ref id="_swap" name="_swap">,
2408 <ref id="bzero" name="bzero">,
2409 <ref id="memcpy" name="memcpy">,
2410 <ref id="memmove" name="memmove">
2416 <sect1>offsetof<label id="offsetof"><p>
2420 <tag/Function/Calculate the offset of a struct or union member.
2421 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
2422 <tag/Declaration/<tt/size_t offsetof (type, member);/
2423 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
2424 or <tt/union/ member.
2425 <tag/Limits/<itemize>
2426 <item>The function is actually a macro.
2428 <tag/Availability/ISO 9899
2434 <sect1>open<label id="open"><p>
2438 <tag/Function/Open and possibly create a file.
2439 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2440 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
2441 <tag/Description/<tt/open/ opens a file and returns the file descriptor
2442 associated with it. On error, -1 is returned and an error code is stored in
2443 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
2444 <tag/Limits/<itemize>
2445 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
2446 open, which is used as the permission mask when a new file is created. While
2447 cc65 allows to pass this argument, it is ignored.
2449 <tag/Availability/POSIX
2451 <ref id="close" name="close">,
2452 <ref id="creat" name="creat">
2458 <sect1>qsort<label id="qsort"><p>
2462 <tag/Function/Sort an array.
2463 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2464 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
2465 size_t size, int (*compare) (const void*, const void*));/
2466 <tag/Description/<tt/qsort/ sorts an array according to a given compare
2467 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
2468 is the number of elements, <tt/size/ the size of an element and <tt/compare/
2469 the function used to compare the members.
2472 <item>If there are multiple members with the same key, the order after calling
2473 the function is undefined.
2474 <item>The function is only available as fastcall function, so it may only
2475 be used in presence of a prototype.
2477 <tag/Availability/ISO 9899
2479 <ref id="bsearch" name="bsearch">
2485 <sect1>raise<label id="raise"><p>
2489 <tag/Function/Send a signal to the executing program.
2490 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
2491 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
2492 <tag/Description/<tt/raise/ sends the given signal to the program. If the
2493 program has installed a signal handler for the signal, this signal handler
2494 will be executed. If no handler has been installed, the default action for
2495 the raised signal will be taken. The function returns zero on success,
2497 <tag/Limits/<itemize>
2498 <item>The function is only available as fastcall function, so it may only
2499 be used in presence of a prototype.
2501 <tag/Availability/ISO 9899
2503 <ref id="abort" name="abort">,
2504 <ref id="signal" name="signal">
2510 <sect1>rand<label id="rand"><p>
2514 <tag/Function/Return a pseudo random number.
2515 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2516 <tag/Declaration/<tt/int rand (void);/
2517 <tag/Description/The function returns a pseudo random number
2518 between 0 and <tt/RAND_MAX/ (exclusive).
2519 <tag/Limits/<itemize>
2520 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
2521 flow of numbers is generated.
2522 <item>On startup, the function behaves as if <ref id="srand" name="srand">
2523 had been used with an argument of 1.
2525 <tag/Availability/ISO 9899
2527 <ref id="_randomize" name="_randomize">,
2528 <ref id="srand" name="srand">
2534 <sect1>realloc<label id="realloc"><p>
2538 <tag/Function/Change the size of an allocated memory block.
2539 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2540 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
2541 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
2542 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
2543 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
2544 behaves as if <tt/free/ had been called. On error (not enough memory
2545 available), <tt/realloc/ returns <tt/NULL/.
2548 <item>The part of the memory block that is returned will have its contents
2550 <item>This function is somewhat dangerous to use. Be careful to save the
2551 pointer you're passing somewhere else, otherwise
2553 ptr = realloc (ptr, size);
2555 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
2556 <item>The function is only available as fastcall function, so it may only
2557 be used in presence of a prototype.
2559 <tag/Availability/ISO 9899
2561 <ref id="_heapadd" name="_heapadd">,
2562 <ref id="_heapmaxavail" name="_heapmaxavail">,
2563 <ref id="_heapmemavail" name="_heapmemavail">,
2564 <ref id="calloc" name="calloc">,
2565 <ref id="free" name="free">,
2566 <ref id="realloc" name="realloc">
2572 <sect1>reset_brk<label id="reset_brk"><p>
2576 <tag/Function/Resets the break vector to its original value.
2577 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
2578 <tag/Declaration/<tt/void __fastcall__ reset_brk (void);/
2579 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
2580 before a call to <tt/set_brk/.
2583 <item>Since <tt/<ref id="set_brk" name="set_brk">/ installs an exit handler,
2584 it is not strictly necessary to call this function as part of the cleanup when
2587 <tag/Availability/cc65
2589 <ref id="set_brk" name="set_brk">
2595 <sect1>revers<label id="revers"><p>
2599 <tag/Function/Control revers character display.
2600 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2601 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
2602 <tag/Description/If the argument is non zero, the function enables reverse
2603 character display. If the argument is zero, reverse character display is
2604 switched off. The old value of the setting is returned.
2605 <tag/Limits/<itemize>
2606 <item>The function may not be supported by the hardware, in which case
2607 the call is ignored.
2608 <item>The function is only available as fastcall function, so it may only
2609 be used in presence of a prototype.
2611 <tag/Availability/cc65
2613 <ref id="textcolor" name="textcolor">
2619 <sect1>screensize<label id="screensize"><p>
2623 <tag/Function/Return the dimensions of the text mode screen.
2624 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2625 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
2626 <tag/Description/The function returns the dimensions of the text mode screen.
2627 <tag/Limits/<itemize>
2628 <item>The function is only available as fastcall function, so it may only
2629 be used in presence of a prototype.
2631 <tag/Availability/cc65
2633 <ref id="gotox" name="gotox">,
2634 <ref id="gotoxy" name="gotoxy">,
2635 <ref id="gotoy" name="gotoy">,
2636 <ref id="wherex" name="wherex">,
2637 <ref id="wherey" name="wherey">
2643 <sect1>set_brk<label id="set_brk"><p>
2647 <tag/Function/Set the break vector to a user function.
2648 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
2649 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
2650 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
2651 program code by letting the vector point to a user written C function. The
2652 runtime library installs a small stub that saves the registers into global
2653 variables that may be accessed (and changed) by the break handler.
2656 <item>The function is only available as fastcall function, so it may only
2657 be used in presence of a prototype.
2658 <item>The stub saves the zero page registers used by the C runtime and switches
2659 to a small break handler stack. This means that it is safe to execute C code,
2660 even if C code was interrupted. Be careful however not to use too many local
2661 variables, and do not enable stack checks for the handler function or any other
2662 function called from it.
2663 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
2664 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
2665 otherwise the <tt/BRK/ instruction will get executed over and over again.
2666 <item>Since <tt/set_brk/ installs an exit handler, it is not strictly necessary
2667 to call <tt/<ref id="reset_brk" name="reset_brk">/ as part of the cleanup when
2668 the program terminates.
2670 <tag/Availability/cc65
2672 <ref id="reset_brk" name="reset_brk">
2678 <sect1>setlocale<label id="setlocale"><p>
2682 <tag/Function/Selects a locale.
2683 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
2684 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
2685 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
2688 <item>The function is only available as fastcall function, so it may only
2689 be used in presence of a prototype.
2690 <item>cc65 supports only the "C" locale, so calling this function to set a
2691 different locale has no effect.
2693 <tag/Availability/ISO 9899
2695 <ref id="localeconv" name="localeconv">,
2696 <ref id="strcoll" name="strcoll">
2702 <sect1>signal<label id="signal"><p>
2706 <tag/Function/Install a signal handler.
2707 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
2708 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
2709 <tag/Description/<tt/signal/ installs a handler for the given signal. The
2710 handler may either be a user supplied function, or one of the predefined
2711 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
2712 previous value if the signal , or the special function vector SIG_ERR in
2714 <tag/Limits/<itemize>
2715 <item>The function is only available as fastcall function, so it may only
2716 be used in presence of a prototype.
2718 <tag/Availability/ISO 9899
2720 <ref id="abort" name="abort">,
2721 <ref id="raise" name="raise">
2727 <sect1>sleep<label id="sleep"><p>
2731 <tag/Function/Sleep for a specified amount of time.
2732 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
2733 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
2734 <tag/Description/The function will return after the specified number of
2735 seconds have elapsed.
2736 <tag/Limits/<itemize>
2737 <item>The function is only available as fastcall function, so it may only
2738 be used in presence of a prototype.
2740 <tag/Availability/POSIX
2746 <sect1>slow<label id="slow"><p>
2750 <tag/Function/Switch the C128 into 1MHz mode.
2751 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
2752 <tag/Declaration/<tt/void slow (void);/
2753 <tag/Description/The function will switch the clock of the C128 to 1MHz. This
2754 will halve the speed compared to fast mode.
2755 <tag/Limits/<itemize>
2756 <item>The function is specific to the C128.
2758 <tag/Availability/C128
2760 <ref id="fast" name="fast">,
2761 <ref id="toggle_videomode" name="toggle_videomode">
2767 <sect1>srand<label id="srand"><p>
2771 <tag/Function/Initialize the pseudo random number generator.
2772 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2773 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
2774 <tag/Description/The function initializes the random number generator using
2775 the given seed. On program startup, the generator behaves as if <tt/srand/ has
2776 been called with an argument of 1.
2777 <tag/Limits/<itemize>
2778 <item>The function is only available as fastcall function, so it may only
2779 be used in presence of a prototype.
2781 <tag/Availability/ISO 9899
2783 <ref id="_randomize" name="_randomize">,
2784 <ref id="rand" name="rand">
2790 <sect1>strcasecmp<label id="strcasecmp"><p>
2794 <tag/Function/Compare two strings case insensitive.
2795 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2796 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
2797 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
2798 as parameters without case sensitivity. It returns a value that is less than
2799 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
2800 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
2801 <tag/Limits/<itemize>
2802 <item>The function is only available as fastcall function, so it may only
2803 be used in presence of a prototype.
2804 <item>The function is not available in strict ANSI mode.
2806 <tag/Availability/cc65
2808 <ref id="strcmp" name="strcmp">,
2809 <ref id="strcoll" name="strcoll">,
2810 <ref id="stricmp" name="stricmp">
2816 <sect1>strcat<label id="strcat"><p>
2820 <tag/Function/Concatentate two strings.
2821 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2822 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
2823 <tag/Description/The <tt/strcat/ function appends a copy of the string
2824 pointed to by s2 (including the terminating null byte) to the end of the
2825 string pointed to by s1. The initial byte of s2 overwrites the null byte at
2827 <tag/Limits/<itemize>
2828 <item>The function is only available as fastcall function, so it may only
2829 be used in presence of a prototype.
2830 <item>If copying takes place between objects that overlap, the behavior
2833 <tag/Availability/ISO 9899
2835 <ref id="strcpy" name="strcpy">
2836 <ref id="strncpy" name="strncpy">
2842 <sect1>strchr<label id="strchr"><p>
2846 <tag/Function/Search for a character in a string.
2847 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2848 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
2849 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
2850 (converted to a char) in the string pointed to by <tt/s/. The terminating null
2851 byte is considered to be part of the string. Upon completion, the function
2852 returns a pointer to the byte, or a null pointer if the byte was not found.
2853 <tag/Limits/<itemize>
2854 <item>The function is only available as fastcall function, so it may only
2855 be used in presence of a prototype.
2857 <tag/Availability/ISO 9899
2859 <ref id="strrchr" name="strrchr">
2865 <sect1>strcmp<label id="strcmp"><p>
2869 <tag/Function/Compare two strings.
2870 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2871 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
2872 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
2873 parameters. It returns a value that is less than zero if <tt/s1/ is less than
2874 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
2875 if <tt/s1/ is greater than <tt/s2/.
2876 <tag/Limits/<itemize>
2877 <item>The function is only available as fastcall function, so it may only
2878 be used in presence of a prototype.
2880 <tag/Availability/ISO 9899
2882 <ref id="strcasecmp" name="strcasecmp">,
2883 <ref id="strcoll" name="strcoll">,
2884 <ref id="stricmp" name="stricmp">
2890 <sect1>strcoll<label id="strcoll"><p>
2894 <tag/Function/Compare two strings.
2895 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2896 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
2897 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
2898 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
2899 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
2900 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
2901 than zero if <tt/s1/ is greater than <tt/s2/.
2902 <tag/Limits/<itemize>
2903 <item>The function is only available as fastcall function, so it may only
2904 be used in presence of a prototype.
2906 <tag/Availability/ISO 9899
2908 <ref id="setlocale" name="setlocale">,
2909 <ref id="strcasecmp" name="strcasecmp">,
2910 <ref id="strcmp" name="strcmp">,
2911 <ref id="stricmp" name="stricmp">
2917 <sect1>strcpy<label id="strcpy"><p>
2921 <tag/Function/Copy a string.
2922 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2923 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
2924 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
2925 <tt/s2/ (including the terminating null byte) into the array pointed to by
2926 <tt/s1/. The function will always return <tt/s1/.
2927 <tag/Limits/<itemize>
2928 <item>The function is only available as fastcall function, so it may only
2929 be used in presence of a prototype.
2930 <item>If copying takes place between objects that overlap, the behavior
2933 <tag/Availability/ISO 9899
2935 <ref id="strcat" name="strcat">
2936 <ref id="strncpy" name="strncpy">
2941 static char hello[14];
2943 strcpy (hello, "Hello world!\n");
2949 <sect1>stricmp<label id="stricmp"><p>
2953 <tag/Function/Compare two strings case insensitive.
2954 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2955 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
2956 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
2957 parameters without case sensitivity. It returns a value that is less than zero
2958 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
2959 value greater than zero if <tt/s1/ is greater than <tt/s2/.
2960 <tag/Limits/<itemize>
2961 <item>The function is only available as fastcall function, so it may only
2962 be used in presence of a prototype.
2963 <item>The function is not available in strict ANSI mode.
2965 <tag/Availability/cc65
2967 <ref id="strcasecmp" name="strcasecmp">,
2968 <ref id="strcmp" name="strcmp">,
2969 <ref id="strcoll" name="strcoll">
2975 <sect1>strlen<label id="strlen"><p>
2979 <tag/Function/Return the length of a string.
2980 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2981 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
2982 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
2983 string to which s points, not including the terminating null byte.
2984 <tag/Limits/<itemize>
2985 <item>The function is only available as fastcall function, so it may only
2986 be used in presence of a prototype.
2987 <item>When compiling with <tt/-Os/ (inline known standard functions), the
2988 function does not work correctly for strings with more than 255 characters.
2990 <tag/Availability/ISO 9899
2992 <ref id="strcpy" name="strcpy">
2998 <sect1>strlower<label id="strlower"><p>
3002 <tag/Function/Make a string lower case.
3003 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3004 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
3005 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
3006 function to each character of a string. The function will always return <tt/s/.
3007 <tag/Limits/<itemize>
3008 <item>The function is only available as fastcall function, so it may only
3009 be used in presence of a prototype.
3010 <item>The function prototype is unavailable when compiling in strict ANSI mode.
3011 <item>An alias name for this function is <tt/strlwr/.
3013 <tag/Availability/cc65
3015 <ref id="strupper" name="strupper">
3016 <ref id="tolower" name="tolower">
3022 <sect1>strlwr<label id="strlwr"><p>
3029 <sect1>strncpy<label id="strncpy"><p>
3033 <tag/Function/Copy part of a string.
3034 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3035 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2, size_t n);/
3036 <tag/Description/The <tt/strncpy/ function copies not more than n bytes from
3037 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
3038 pointed to by <tt/s2/ is a string that is shorter than n bytes, null bytes are
3039 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
3040 written. The function will always return <tt/s1/.
3041 <tag/Limits/<itemize>
3042 <item>The function is only available as fastcall function, so it may only
3043 be used in presence of a prototype. If there is no null byte in the first <tt/n/
3044 bytes of the array pointed to by <tt/s2/, the result is not null-terminated.
3045 <item>If copying takes place between objects that overlap, the behavior is
3048 <tag/Availability/ISO 9899
3050 <ref id="strcat" name="strcat">
3051 <ref id="strcpy" name="strcpy">
3056 static char hello[6];
3058 strcpy (hello, "Hello world!\n", sizeof (hello) - 1);
3065 <sect1>strrchr<label id="strrchr"><p>
3069 <tag/Function/Search for a character in a string.
3070 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3071 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
3072 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
3073 (converted to a char) in the string pointed to by <tt/s/. The terminating null
3074 byte is considered to be part of the string. Upon completion, the function
3075 returns a pointer to the byte, or a null pointer if the byte was not found.
3076 <tag/Limits/<itemize>
3077 <item>The function is only available as fastcall function, so it may only
3078 be used in presence of a prototype.
3080 <tag/Availability/ISO 9899
3082 <ref id="strchr" name="strchr">
3088 <sect1>strupper<label id="strupper"><p>
3092 <tag/Function/Make a string upper case.
3093 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3094 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
3095 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
3096 function to each character of a string. The function will always return <tt/s/.
3097 <tag/Limits/<itemize>
3098 <item>The function is only available as fastcall function, so it may only
3099 be used in presence of a prototype.
3100 <item>The function prototype is unavailable when compiling in strict ANSI mode.
3101 <item>An alias name for this function is <tt/strupr/.
3103 <tag/Availability/cc65
3105 <ref id="strlower" name="strlower">
3106 <ref id="toupper" name="toupper">
3112 <sect1>strupr<label id="strupr"><p>
3119 <sect1>textcolor<label id="textcolor"><p>
3123 <tag/Function/Set the text color.
3124 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3125 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
3126 <tag/Description/The function will set a new text color. It returns the old
3127 (current) text color. Text output using any <tt/conio.h/ function will use
3128 the color set by this function.
3129 <tag/Limits/<itemize>
3130 <item>Text colors are system dependent. The function may have no effect
3131 on systems where the text color cannot be changed.
3132 <item>The function is only available as fastcall function, so it may only
3133 be used in presence of a prototype.
3135 <tag/Availability/cc65
3137 <ref id="bgcolor" name="bgcolor">,
3138 <ref id="bordercolor" name="bordercolor">
3144 <sect1>toggle_videomode<label id="toggle_videomode"><p>
3148 <tag/Function/Toggle between 40 and 80 column mode.
3149 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
3150 <tag/Declaration/<tt/void toggle_videomode (void);/
3151 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
3152 old mode (cursor position, color and so on) are saved and restored together
3154 <tag/Limits/<itemize>
3155 <item>The function is specific to the C128.
3157 <tag/Availability/C128
3159 <ref id="fast" name="fast">,
3160 <ref id="slow" name="slow">
3166 <sect1>tolower<label id="tolower"><p>
3170 <tag/Function/Convert a character into its lower case representation.
3171 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3172 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
3173 <tag/Description/The function returns the given character converted to lower
3174 case. If the given character is not a letter, it is returned unchanged.
3175 <tag/Limits/<itemize>
3176 <item>The function is only available as fastcall function, so it may
3177 only be used in presence of a prototype.
3179 <tag/Availability/ISO 9899
3181 <ref id="islower" name="islower">,
3182 <ref id="isupper" name="isupper">,
3183 <ref id="toupper" name="toupper">
3189 <sect1>toupper<label id="toupper"><p>
3193 <tag/Function/Convert a character into its upper case representation.
3194 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3195 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
3196 <tag/Description/The function returns the given character converted to upper
3197 case. If the given character is not a letter, it is returned unchanged.
3198 <tag/Limits/<itemize>
3199 <item>The function is only available as fastcall function, so it may
3200 only be used in presence of a prototype.
3202 <tag/Availability/ISO 9899
3204 <ref id="islower" name="islower">,
3205 <ref id="isupper" name="isupper">,
3206 <ref id="tolower" name="tolower">
3212 <sect1>ultoa<label id="ultoa"><p>
3216 <tag/Function/Convert an unsigned long integer into a string.
3217 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3218 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
3219 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
3220 string using <tt/radix/ as the base.
3221 <tag/Limits/<itemize>
3222 <item>There are no provisions to prevent a buffer overflow.
3223 <item>The function is non standard, so it is not available in strict ANSI mode.
3224 You should probably use <tt/sprintf/ instead.
3225 <item>The function is only available as fastcall function, so it may only be
3226 used in presence of a prototype.
3228 <tag/Availability/cc65
3230 <ref id="atoi" name="atoi">,
3231 <ref id="atol" name="atol">,
3232 <ref id="itoa" name="itoa">,
3233 <ref id="ltoa" name="ltoa">,
3234 <ref id="utoa" name="utoa">
3240 <sect1>utoa<label id="utoa"><p>
3244 <tag/Function/Convert an unsigned integer into a string.
3245 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3246 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
3247 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
3248 using <tt/radix/ as the base.
3249 <tag/Limits/<itemize>
3250 <item>There are no provisions to prevent a buffer overflow.
3251 <item>The function is non standard, so it is not available in strict ANSI mode.
3252 You should probably use <tt/sprintf/ instead.
3253 <item>The function is only available as fastcall function, so it may only be
3254 used in presence of a prototype.
3256 <tag/Availability/cc65
3258 <ref id="atoi" name="atoi">,
3259 <ref id="atol" name="atol">,
3260 <ref id="itoa" name="itoa">,
3261 <ref id="ltoa" name="ltoa">,
3262 <ref id="ultoa" name="ultoa">
3268 <sect1>wherex<label id="wherex"><p>
3272 <tag/Function/Return the current X position of the text mode cursor.
3273 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3274 <tag/Declaration/<tt/unsigned char wherex (void);/
3275 <tag/Description/The function returns the current X position of the text mode
3276 cursor. Zero is returned for the leftmost screen position.
3277 <tag/Availability/cc65
3279 <ref id="gotox" name="gotox">,
3280 <ref id="gotoy" name="gotoy">,
3281 <ref id="gotoxy" name="gotoxy">,
3282 <ref id="wherey" name="wherey">
3288 <sect1>wherey<label id="wherey"><p>
3292 <tag/Function/Return the current Y position of the text mode cursor.
3293 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3294 <tag/Declaration/<tt/unsigned char wherey (void);/
3295 <tag/Description/The function returns the current Y position of the text mode
3296 cursor. Zero is returned for the uppermost screen position.
3297 <tag/Availability/cc65
3299 <ref id="gotox" name="gotox">,
3300 <ref id="gotoy" name="gotoy">,
3301 <ref id="gotoxy" name="gotoxy">,
3302 <ref id="wherex" name="wherex">