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>bzero<label id="bzero"><p>
872 <tag/Function/Fill a memory area with zeroes.
873 <tag/Header/<tt/<ref id="string.h" name="string.h">/
874 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
875 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
879 <item>The function is non standard and therefore only available in non ANSI
880 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
881 <item>The function is only available as fastcall function, so it may only
882 be used in presence of a prototype.
884 <tag/Availability/cc65
886 <ref id="_swap" name="_swap">,
887 <ref id="memcpy" name="memcpy">,
888 <ref id="memmove" name="memmove">,
889 <ref id="memset" name="memset">,
895 <sect1>c64mode<label id="c64mode"><p>
899 <tag/Function/Switch the C128 into C64 compatible mode.
900 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
901 <tag/Declaration/<tt/void c64mode (void);/
902 <tag/Description/The function will cause the machine to reboot into C64 mode.
903 <tag/Limits/<itemize>
904 <item>The function is specific to the C128.
905 <item>The function will not return to the caller.
907 <tag/Availability/C128
913 <sect1>calloc<label id="calloc"><p>
917 <tag/Function/Allocate and clear memory.
918 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
919 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
920 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
921 of size <tt/size/, clears the whole block with binary zeroes and returns a
922 pointer to it. On error (not enough memory available), <tt/calloc/ returns
926 <item>Clearing the memory may not have the expected effect on all platforms:
927 pointers in the block may not be <tt/NULL/ and floating point variables may
928 not be zero (0.0). In other words: The "clearing" effect of this function
929 should be used with care for portable programs.
930 <item>The function is only available as fastcall function, so it may only
931 be used in presence of a prototype.
933 <tag/Availability/ISO 9899
935 <ref id="_heapadd" name="_heapadd">,
936 <ref id="_heapmaxavail" name="_heapmaxavail">,
937 <ref id="_heapmemavail" name="_heapmemavail">,
938 <ref id="free" name="free">,
939 <ref id="malloc" name="malloc">,
940 <ref id="realloc" name="realloc">
946 <sect1>cclear<label id="cclear"><p>
950 <tag/Function/Clear part of a line (write a given amount of spaces).
951 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
952 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
953 <tag/Description/The function clears part of a line by writing <tt/length/
954 spaces in the current text color.
955 <tag/Limits/<itemize>
956 <item>The function is only available as fastcall function, so it may
957 only be used in presence of a prototype.
959 <tag/Availability/cc65
961 <ref id="cclearxy" name="cclearxy">,
962 <ref id="clrscr" name="clrscr">
968 <sect1>cclearxy<label id="cclearxy"><p>
972 <tag/Function/Clear part of a line (write a given amount of spaces) starting
973 at a specific screen position.
974 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
975 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char length);/
976 <tag/Description/The function moves the cursor to a specific position, and
977 will then clear part of the line by writing <tt/length/ spaces in the current
979 <tag/Limits/<itemize>
980 <item>The function is only available as fastcall function, so it may
981 only be used in presence of a prototype.
983 <tag/Availability/cc65
985 <ref id="cclear" name="cclear">,
986 <ref id="clrscr" name="clrscr">
992 <sect1>cgetc<label id="cgetc"><p>
996 <tag/Function/Read a character from the keyboard.
997 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
998 <tag/Declaration/<tt/char cgetc (void);/
999 <tag/Description/The function reads a character from the keyboard. If there is
1000 no character available, <tt/cgetc/ waits until the user presses a key. If the
1001 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
1002 displayed while waiting.
1003 <tag/Limits/<itemize>
1004 <item>If the system supports a keyboard buffer, <tt/cgetc/ will fetch a key
1005 from this buffer and wait only if the buffer is empty.
1007 <tag/Availability/cc65
1009 <ref id="cursor" name="cursor">,
1010 <ref id="kbhit" name="kbhit">
1016 <sect1>chline<label id="chline"><p>
1020 <tag/Function/Output a horizontal line in text mode.
1021 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1022 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
1023 <tag/Description/The function outputs a horizontal line with the given length
1024 starting at the current cursor position.
1025 <tag/Limits/<itemize>
1026 <item>The character used to draw the horizontal line is system dependent.
1027 If available, a line drawing character is used. Drawing a line that is partially
1028 off screen leads to undefined behaviour.
1029 <item>The function is only available as fastcall function, so it may only be
1030 used in presence of a prototype.
1032 <tag/Availability/cc65
1034 <ref id="chlinexy" name="chlinexy">,
1035 <ref id="cvline" name="cvline">,
1036 <ref id="cvlinexy" name="cvlinexy">
1042 <sect1>chlinexy<label id="chlinexy"><p>
1046 <tag/Function/Output a horizontal line at a given position in text mode.
1047 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1048 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
1049 <tag/Description/The function outputs a horizontal line with the given length
1050 starting at a given position.
1051 <tag/Limits/<itemize>
1052 <item>The character used to draw the horizontal line is system dependent.
1053 If available, a line drawing character is used. Drawing a line that is partially
1054 off screen leads to undefined behaviour.
1055 <item>The function is only available as fastcall function, so it may only be
1056 used in presence of a prototype.
1058 <tag/Availability/cc65
1060 <ref id="chline" name="chline">,
1061 <ref id="cvline" name="cvline">,
1062 <ref id="cvlinexy" name="cvlinexy">
1068 <sect1>clrscr<label id="clrscr"><p>
1072 <tag/Function/Clear the text screen.
1073 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1074 <tag/Declaration/<tt/void clrscr (void);/
1075 <tag/Description/The function clears the text screen and moves the cursor to
1076 the upper left corner.
1077 <tag/Availability/cc65
1079 <ref id="cclear" name="cclear">,
1080 <ref id="cclearxy" name="cclearxy">
1086 <sect1>close<label id="close"><p>
1090 <tag/Function/Close a file descriptor.
1091 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1092 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
1093 <tag/Description/The function closes the given file descriptor. It returns zero
1094 on success and -1 on error. If an error occurs, the cause can be determined by
1095 reading the <tt/errno/ variable.
1096 <tag/Limits/<itemize>
1097 <item>The function is only available as fastcall function, so it may only
1098 be used in presence of a prototype.
1100 <tag/Availability/POSIX
1102 <ref id="creat" name="creat">,
1103 <ref id="open" name="open">
1109 <sect1>creat<label id="creat"><p>
1113 <tag/Function/Create a file.
1114 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
1115 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
1116 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
1117 associated with it. On error, -1 is returned and an error code is stored in
1119 <tag/Limits/<itemize>
1120 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
1121 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
1122 <item>The function is only available as fastcall function, so it may only
1123 be used in presence of a prototype.
1125 <tag/Availability/POSIX
1127 <ref id="close" name="close">,
1128 <ref id="open" name="open">
1134 <sect1>cursor<label id="cursor"><p>
1138 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
1139 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1140 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
1141 <tag/Description/If the argument to the function is non zero, a blinking cursor
1142 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
1143 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
1144 <tag/Limits/<itemize>
1145 <item>The function is only available as fastcall function, so it may only
1146 be used in presence of a prototype.
1148 <tag/Availability/cc65
1150 <ref id="cgetc" name="cgetc">,
1151 <ref id="kbhit" name="kbhit">
1157 <sect1>cvline<label id="cvline"><p>
1161 <tag/Function/Output a vertical line in text mode.
1162 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1163 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
1164 <tag/Description/The function outputs a vertical line with the given length
1165 starting at the current cursor position.
1166 <tag/Limits/<itemize>
1167 <item>The character used to draw the vertical line is system dependent.
1168 If available, a line drawing character is used. Drawing a line that is partially
1169 off screen leads to undefined behaviour.
1170 <item>The function is only available as fastcall function, so it may only be
1171 used in presence of a prototype.
1173 <tag/Availability/cc65
1175 <ref id="chline" name="chline">,
1176 <ref id="chlinexy" name="chlinexy">,
1177 <ref id="cvlinexy" name="cvlinexy">
1183 <sect1>cvlinexy<label id="cvlinexy"><p>
1187 <tag/Function/Output a vertical line at a given position in text mode.
1188 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1189 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
1190 <tag/Description/The function outputs a vertical line with the given length
1191 starting at a given position.
1192 <tag/Limits/<itemize>
1193 <item>The character used to draw the vertical line is system dependent.
1194 If available, a line drawing character is used. Drawing a line that is partially
1195 off screen leads to undefined behaviour.
1196 <item>The function is only available as fastcall function, so it may only be
1197 used in presence of a prototype.
1199 <tag/Availability/cc65
1201 <ref id="chline" name="chline">,
1202 <ref id="chlinexy" name="chlinexy">,
1203 <ref id="cvline" name="cvline">
1209 <sect1>em_commit<label id="em_commit"><p>
1213 <tag/Function/Commit changes into extended memory.
1214 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1215 <tag/Declaration/<tt/void __fastcall__ em_commit (void);/
1216 <tag/Description/Commit changes in the memory window to extended storage. If
1217 the contents of the memory window have been changed, these changes may be lost
1218 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
1219 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
1220 name="em_copyto">/ are called without calling <tt/em_commit/ first.
1221 <tag/Limits/<itemize>
1222 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
1223 memory window are discarded, it does just mean that the drivers is allowed
1225 <item>The function is only available as fastcall function, so it may only be
1226 used in presence of a prototype.
1227 <item>The function produces undefined results if no extended memory driver is
1230 <tag/Availability/cc65
1232 <ref id="em_load_driver" name="em_load_driver">,
1233 <ref id="em_map" name="em_map">,
1234 <ref id="em_use" name="em_use">
1240 <sect1>em_copyfrom<label id="em_copyfrom"><p>
1244 <tag/Function/Copy from extended into normal memory.
1245 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1246 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
1247 <tag/Description/Copy data from extended memory into linear memory. Source and
1248 target addresses as well as the number of bytes to transfer are specified in
1249 the <tt/em_copy/ structure that is passed as a parameter.
1250 <tag/Limits/<itemize>
1251 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
1252 made any changes to the data in the window, call <tt/<ref id="em_commit"
1253 name="em_commit">/ first, or the changes are lost.
1254 <item>The function is only available as fastcall function, so it may only be
1255 used in presence of a prototype.
1256 <item>The function produces undefined results if no extended memory driver is
1259 <tag/Availability/cc65
1261 <ref id="em_commit" name="em_commit">,
1262 <ref id="em_copyto" name="em_copyto">,
1263 <ref id="em_load_driver" name="em_load_driver">
1269 <sect1>em_copyto<label id="em_copyto"><p>
1273 <tag/Function/Copy from normal into extended memory.
1274 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1275 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
1276 <tag/Description/Copy data from linear into extended memory. Source and
1277 target addresses as well as the number of bytes to transfer are specified in
1278 the <tt/em_copy/ structure that is passed as a parameter.
1279 <tag/Limits/<itemize>
1280 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
1281 made any changes to the data in the window, call <tt/<ref id="em_commit"
1282 name="em_commit">/ first, or the changes are lost.
1283 <item>The function is only available as fastcall function, so it may only be
1284 used in presence of a prototype.
1285 <item>The function produces undefined results if no extended memory driver is
1288 <tag/Availability/cc65
1290 <ref id="em_commit" name="em_commit">,
1291 <ref id="em_copyfrom" name="em_copyfrom">,
1292 <ref id="em_load_driver" name="em_load_driver">
1298 <sect1>em_load_driver<label id="em_load_driver"><p>
1302 <tag/Function/Load and initialize an extended memory driver.
1303 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1304 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
1305 <tag/Description/Load an extended memory driver into memory and initialize
1306 it. The function returns an error code that tells if all this has been
1308 <tag/Limits/<itemize>
1309 <item>Not all drivers are able to detect if the supported hardware is really
1311 <item>The function is only available as fastcall function, so it may only be
1312 used in presence of a prototype.
1313 <item>The driver is loaded by name, so currently you must know the type of
1314 extended memory that should be supported. There is no autodetect capability.
1316 <tag/Availability/cc65
1318 <ref id="em_unload" name="em_unload">
1324 <sect1>em_map<label id="em_map"><p>
1328 <tag/Function/Make a page of extended memory accessible.
1329 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1330 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
1331 <tag/Description/The function maps one page of extended memory into linear
1332 memory and returns a pointer to the page frame. Depending on the hardware
1333 and driver, the data is either mapped into the address space or transfered
1334 into a buffer. If you don't need the actual contents of the page (for example
1335 because you're going to overwrite it completely, it is better to call
1336 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
1337 data if it is possible to avoid that.
1338 <tag/Limits/<itemize>
1339 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
1340 made any changes to the data in the window, call <tt/<ref id="em_commit"
1341 name="em_commit">/ first, or the changes are lost.
1342 <item>The function is only available as fastcall function, so it may only be
1343 used in presence of a prototype.
1344 <item>The function produces undefined results if no extended memory driver is
1347 <tag/Availability/cc65
1349 <ref id="em_commit" name="em_commit">,
1350 <ref id="em_load_driver" name="em_load_driver">,
1351 <ref id="em_use" name="em_use">
1357 <sect1>em_pagecount<label id="em_pagecount"><p>
1361 <tag/Function/Return the number of available extended memory pages.
1362 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1363 <tag/Declaration/<tt/unsigned __fastcall__ em_pagecount (void);/
1364 <tag/Description/The function returns the size of the extended memory supported
1365 by the driver in 256 byte pages.
1366 <tag/Limits/<itemize>
1367 <item>The function returns zero if no extended memory driver is loaded.
1368 <item>The function may return zero if the supported hardware was not detected.
1370 <tag/Availability/cc65
1372 <ref id="em_load_driver" name="em_load_driver">
1378 <sect1>em_unload<label id="em_unload"><p>
1382 <tag/Function/Unload an extended memory driver.
1383 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1384 <tag/Declaration/<tt/void __fastcall__ em_unload (void);/
1385 <tag/Description/The function unloads a loaded extended memory driver and
1386 frees all memory allocated for the driver.
1387 <tag/Limits/<itemize>
1388 <item>The function does nothing if no driver is loaded.
1390 <tag/Availability/cc65
1392 <ref id="em_load_driver" name="em_load_driver">
1398 <sect1>em_use<label id="em_use"><p>
1402 <tag/Function/Prepare an extended memory page for use.
1403 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1404 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
1405 <tag/Description/The function maps one page of extended memory into linear
1406 memory and returns a pointer to the page frame. This function is similar to
1407 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
1408 actual memory window in the assumption that the existing data is wrong or
1409 will get overwritten.
1410 <tag/Limits/<itemize>
1411 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
1412 made any changes to the data in the window, call <tt/<ref id="em_commit"
1413 name="em_commit">/ first, or the changes are lost.
1414 <item>The function is only available as fastcall function, so it may only be
1415 used in presence of a prototype.
1416 <item>The function produces undefined results if no extended memory driver is
1419 <tag/Availability/cc65
1421 <ref id="em_commit" name="em_commit">,
1422 <ref id="em_load_driver" name="em_load_driver">,
1423 <ref id="em_map" name="em_map">
1429 <sect1>exit<label id="exit"><p>
1433 <tag/Function/Terminate the program.
1434 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1435 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
1436 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
1437 return code of the program. Before termination, all files are closed, buffered
1438 output is written and any functions registered with <tt/<ref id="atexit"
1439 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
1440 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
1442 <tag/Limits/<itemize>
1443 <item>The function is only available as fastcall function, so it may only
1444 be used in presence of a prototype.
1445 <item>It depends on the host machine if the program return code can be
1446 evaluated or is ignored.
1448 <tag/Availability/ISO 9899
1450 <ref id="abort" name="abort">,
1451 <ref id="exit" name="exit">
1457 <sect1>fast<label id="fast"><p>
1461 <tag/Function/Switch the C128 into 2MHz mode.
1462 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1463 <tag/Declaration/<tt/void fast (void);/
1464 <tag/Description/The function will switch the clock of the C128 to 2MHz. This
1465 will nearly double the speed compared to slow mode.
1466 <tag/Limits/<itemize>
1467 <item>The function is specific to the C128.
1468 <item>2MHz clock will not work in 40 column mode.
1470 <tag/Availability/C128
1472 <ref id="slow" name="slow">,
1473 <ref id="toggle_videomode" name="toggle_videomode">
1479 <sect1>free<label id="free"><p>
1483 <tag/Function/Free a block of dynamic memory.
1484 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1485 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
1486 <tag/Description/Free a block of dynamic memory previously allocated with
1487 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
1488 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
1489 pointer is <tt/NULL/, no action is performed.
1492 <item>Passing an already free'd block to <tt/free/ again will cause undefined
1493 behaviour and may crash your program.
1494 <item>The function is only available as fastcall function, so it may only
1495 be used in presence of a prototype.
1497 <tag/Availability/ISO 9899
1499 <ref id="_heapadd" name="_heapadd">,
1500 <ref id="_heapmaxavail" name="_heapmaxavail">,
1501 <ref id="_heapmemavail" name="_heapmemavail">,
1502 <ref id="calloc" name="calloc">,
1503 <ref id="malloc" name="malloc">,
1504 <ref id="realloc" name="realloc">
1510 <sect1>getenv<label id="getenv"><p>
1514 <tag/Function/Return a value from the environment.
1515 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1516 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
1517 <tag/Description/The function searches the environment for an entry that
1518 matches <tt/name/ and returns its value. The environment consists of a list
1519 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
1521 <tag/Limits/<itemize>
1522 <item>What exactly is stored in the environment depends on the machine the
1523 program is running on.
1524 <item>The function is only available as fastcall function, so it may only
1525 be used in presence of a prototype.
1527 <tag/Availability/ISO 9899
1533 <sect1>getcpu<label id="getcpu"><p>
1537 <tag/Function/Determine on which CPU the program is running.
1538 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1539 <tag/Declaration/<tt/unsigned char getcpu (void);/
1540 <tag/Description/The function checks on which CPU the code is running. It
1541 returns one of the constants<itemize>
1543 <item><tt/CPU_65C02/
1544 <item><tt/CPU_65816/
1546 <tag/Limits/<itemize>
1547 <item>Other, more exotic CPU types are not disinguished.
1549 <tag/Availability/cc65
1555 <sect1>gotox<label id="gotox"><p>
1559 <tag/Function/Move the text mode cursor to a new X position.
1560 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1561 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
1562 <tag/Description/The function moves the text mode cursor to the specified X
1563 position while leaving the Y position untouched. The leftmost position on the
1564 screen has the coordinate 0.
1565 <tag/Limits/<itemize>
1566 <item>The function is only available as fastcall function, so it may
1567 only be used in presence of a prototype.
1568 <item>Invalid values for the X position (out of screen coordinates) may
1569 lead to undefined behaviour.
1571 <tag/Availability/cc65
1573 <ref id="gotoy" name="gotoy">,
1574 <ref id="gotoxy" name="gotoxy">,
1575 <ref id="wherex" name="wherex">,
1576 <ref id="wherey" name="wherey">
1582 <sect1>gotoxy<label id="gotoxy"><p>
1586 <tag/Function/Move the text mode cursor to a new position.
1587 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1588 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
1589 <tag/Description/The function moves the text mode cursor to the specified
1590 position. The leftmost position on the screen has the X coordinate 0, the
1591 topmost line has the Y coordinate 0.
1592 <tag/Limits/<itemize>
1593 <item>The function is only available as fastcall function, so it may only be
1594 used in presence of a prototype.
1595 <item>Invalid values for any of both coordinates (out of screen positions) may
1596 lead to undefined behaviour.
1598 <tag/Availability/cc65
1600 <ref id="gotox" name="gotox">,
1601 <ref id="gotoy" name="gotoy">,
1602 <ref id="wherex" name="wherex">,
1603 <ref id="wherey" name="wherey">
1609 <sect1>gotoy<label id="gotoy"><p>
1613 <tag/Function/Move the text mode cursor to a new Y position.
1614 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1615 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
1616 <tag/Description/The function moves the text mode cursor to the specified Y
1617 position while leaving the X position untouched. The uppermost position on the
1618 screen has the coordinate 0.
1619 <tag/Limits/<itemize>
1620 <item>The function is only available as fastcall function, so it may
1621 only be used in presence of a prototype.
1622 <item>Invalid values for the Y position (out of screen coordinates) may lead
1623 to undefined behaviour.
1625 <tag/Availability/cc65
1627 <ref id="gotox" name="gotox">,
1628 <ref id="gotoxy" name="gotoxy">,
1629 <ref id="wherex" name="wherex">,
1630 <ref id="wherey" name="wherey">
1636 <sect1>isalnum<label id="isalnum"><p>
1640 <tag/Function/Check if a given character is a letter or digit.
1641 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1642 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
1643 <tag/Description/The function returns a value of zero if the given argument
1644 is a letter or digit. The return value is non zero if the character
1646 <tag/Limits/<itemize>
1647 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1648 inline sequence generated by the macro will not work correctly for values
1649 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1650 this range. The non inline function may be accessed by <tt/#undef/'ing
1652 <item>When compiling without <tt/-Os/, the function is only available as
1653 fastcall function, so it may only be used in presence of a prototype.
1655 <tag/Availability/ISO 9899
1657 <ref id="isalpha" name="isalpha">,
1658 <ref id="isascii" name="isascii">,
1659 <ref id="isblank" name="isblank">,
1660 <ref id="iscntrl" name="iscntrl">,
1661 <ref id="isdigit" name="isdigit">,
1662 <ref id="isgraph" name="isgraph">,
1663 <ref id="islower" name="islower">,
1664 <ref id="isprint" name="isprint">,
1665 <ref id="ispunct" name="ispunct">,
1666 <ref id="isspace" name="isspace">,
1667 <ref id="isupper" name="isupper">,
1668 <ref id="isxdigit" name="isxdigit">
1674 <sect1>isalpha<label id="isalpha"><p>
1678 <tag/Function/Check if a given character is a letter.
1679 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1680 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
1681 <tag/Description/The function returns a value of zero if the given argument
1682 is a letter. The return value is non zero if the character is anything else.
1683 <tag/Limits/<itemize>
1684 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1685 inline sequence generated by the macro will not work correctly for values
1686 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1687 this range. The non inline function may be accessed by <tt/#undef/'ing the
1689 <item>When compiling without <tt/-Os/, the function is only available as
1690 fastcall function, so it may only be used in presence of a prototype.
1692 <tag/Availability/ISO 9899
1694 <ref id="isalnum" name="isalnum">,
1695 <ref id="isascii" name="isascii">,
1696 <ref id="isblank" name="isblank">,
1697 <ref id="iscntrl" name="iscntrl">,
1698 <ref id="isdigit" name="isdigit">,
1699 <ref id="isgraph" name="isgraph">,
1700 <ref id="islower" name="islower">,
1701 <ref id="isprint" name="isprint">,
1702 <ref id="ispunct" name="ispunct">,
1703 <ref id="isspace" name="isspace">,
1704 <ref id="isupper" name="isupper">,
1705 <ref id="isxdigit" name="isxdigit">
1711 <sect1>isascii<label id="isascii"><p>
1715 <tag/Function/Check if a given character is in the ASCII (0..127) range.
1716 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1717 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
1718 <tag/Description/The function returns a value of zero if the given argument
1719 is in the range 0..127 (the range of valid ASCII characters) and a non zero
1721 <tag/Limits/<itemize>
1722 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1723 inline sequence generated by the macro will not work correctly for values
1724 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1725 this range. The non inline function may be accessed by <tt/#undef/'ing the
1727 <item>When compiling without <tt/-Os/, the function is only available as
1728 fastcall function, so it may only be used in presence of a prototype.
1730 <tag/Availability/ISO 9899
1732 <ref id="isalnum" name="isalnum">,
1733 <ref id="isalpha" name="isalpha">,
1734 <ref id="isblank" name="isblank">,
1735 <ref id="iscntrl" name="iscntrl">,
1736 <ref id="isdigit" name="isdigit">,
1737 <ref id="isgraph" name="isgraph">,
1738 <ref id="islower" name="islower">,
1739 <ref id="isprint" name="isprint">,
1740 <ref id="ispunct" name="ispunct">,
1741 <ref id="isspace" name="isspace">,
1742 <ref id="isupper" name="isupper">,
1743 <ref id="isxdigit" name="isxdigit">
1749 <sect1>isblank<label id="isblank"><p>
1753 <tag/Function/Check if a given character is a space or tab.
1754 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1755 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
1756 <tag/Description/The function returns a value of zero if the given argument
1757 is a blank or space character. The return value is non zero if the character
1759 <tag/Limits/<itemize>
1760 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1761 inline sequence generated by the macro will not work correctly for values
1762 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1763 this range. The non inline function may be accessed by <tt/#undef/'ing the
1765 <item>When compiling without <tt/-Os/, the function is only available as
1766 fastcall function, so it may only be used in presence of a prototype.
1768 <tag/Availability/cc65
1770 <ref id="isalnum" name="isalnum">,
1771 <ref id="isalpha" name="isalpha">,
1772 <ref id="isascii" name="isascii">,
1773 <ref id="iscntrl" name="iscntrl">,
1774 <ref id="isdigit" name="isdigit">,
1775 <ref id="isgraph" name="isgraph">,
1776 <ref id="islower" name="islower">,
1777 <ref id="isprint" name="isprint">,
1778 <ref id="ispunct" name="ispunct">,
1779 <ref id="isspace" name="isspace">,
1780 <ref id="isupper" name="isupper">,
1781 <ref id="isxdigit" name="isxdigit">
1787 <sect1>iscntrl<label id="iscntrl"><p>
1791 <tag/Function/Check if a given character is a control character.
1792 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1793 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
1794 <tag/Description/The function returns a value of zero if the given argument
1795 is a control character. The return value is non zero if the character
1797 <tag/Limits/<itemize>
1798 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1799 inline sequence generated by the macro will not work correctly for values
1800 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1801 this range. The non inline function may be accessed by <tt/#undef/'ing the
1803 <item>When compiling without <tt/-Os/, the function is only available as
1804 fastcall function, so it may only be used in presence of a prototype.
1806 <tag/Availability/ISO 9899
1808 <ref id="isalnum" name="isalnum">,
1809 <ref id="isalpha" name="isalpha">,
1810 <ref id="isascii" name="isascii">,
1811 <ref id="isblank" name="isblank">,
1812 <ref id="isdigit" name="isdigit">,
1813 <ref id="isgraph" name="isgraph">,
1814 <ref id="islower" name="islower">,
1815 <ref id="isprint" name="isprint">,
1816 <ref id="ispunct" name="ispunct">,
1817 <ref id="isspace" name="isspace">,
1818 <ref id="isupper" name="isupper">,
1819 <ref id="isxdigit" name="isxdigit">
1825 <sect1>isdigit<label id="isdigit"><p>
1829 <tag/Function/Check if a given character is a digit.
1830 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1831 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
1832 <tag/Description/The function returns a value of zero if the given argument
1833 is a digit. The return value is non zero if the character is anything else.
1834 <tag/Limits/<itemize>
1835 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1836 inline sequence generated by the macro will not work correctly for values
1837 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1838 this range. The non inline function may be accessed by <tt/#undef/'ing the
1840 <item>When compiling without <tt/-Os/, the function is only available as
1841 fastcall function, so it may only be used in presence of a prototype.
1843 <tag/Availability/ISO 9899
1845 <ref id="isalnum" name="isalnum">,
1846 <ref id="isalpha" name="isalpha">,
1847 <ref id="isascii" name="isascii">,
1848 <ref id="isblank" name="isblank">,
1849 <ref id="iscntrl" name="iscntrl">,
1850 <ref id="isgraph" name="isgraph">,
1851 <ref id="islower" name="islower">,
1852 <ref id="isprint" name="isprint">,
1853 <ref id="ispunct" name="ispunct">,
1854 <ref id="isspace" name="isspace">,
1855 <ref id="isupper" name="isupper">,
1856 <ref id="isxdigit" name="isxdigit">
1862 <sect1>isgraph<label id="isgraph"><p>
1866 <tag/Function/Check if a given character is a printable character (except
1868 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1869 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
1870 <tag/Description/The function returns a value of zero if the given argument
1871 is a printable character with the exception of space. The return value is non
1872 zero if the character is anything else.
1873 <tag/Limits/<itemize>
1874 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1875 inline sequence generated by the macro will not work correctly for values
1876 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1877 this range. The non inline function may be accessed by <tt/#undef/'ing the
1879 <item>When compiling without <tt/-Os/, the function is only available as
1880 fastcall function, so it may only be used in presence of a prototype.
1882 <tag/Availability/ISO 9899
1884 <ref id="isalnum" name="isalnum">,
1885 <ref id="isalpha" name="isalpha">,
1886 <ref id="isascii" name="isascii">,
1887 <ref id="isblank" name="isblank">,
1888 <ref id="iscntrl" name="iscntrl">,
1889 <ref id="isdigit" name="isdigit">,
1890 <ref id="islower" name="islower">,
1891 <ref id="isprint" name="isprint">,
1892 <ref id="ispunct" name="ispunct">,
1893 <ref id="isspace" name="isspace">,
1894 <ref id="isupper" name="isupper">,
1895 <ref id="isxdigit" name="isxdigit">
1901 <sect1>islower<label id="islower"><p>
1905 <tag/Function/Check if a given character is a lower case letter.
1906 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1907 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
1908 <tag/Description/The function returns a value of zero if the given argument
1909 is a lower case letter. The return value is non zero if the character is
1911 <tag/Limits/<itemize>
1912 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1913 inline sequence generated by the macro will not work correctly for values
1914 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1915 this range. The non inline function may be accessed by <tt/#undef/'ing the
1917 <item>When compiling without <tt/-Os/, the function is only available as
1918 fastcall function, so it may only be used in presence of a prototype.
1920 <tag/Availability/ISO 9899
1922 <ref id="isalnum" name="isalnum">,
1923 <ref id="isalpha" name="isalpha">,
1924 <ref id="isascii" name="isascii">,
1925 <ref id="isblank" name="isblank">,
1926 <ref id="iscntrl" name="iscntrl">,
1927 <ref id="isdigit" name="isdigit">,
1928 <ref id="isgraph" name="isgraph">,
1929 <ref id="isprint" name="isprint">,
1930 <ref id="ispunct" name="ispunct">,
1931 <ref id="isspace" name="isspace">,
1932 <ref id="isupper" name="isupper">,
1933 <ref id="isxdigit" name="isxdigit">
1939 <sect1>isprint<label id="isprint"><p>
1943 <tag/Function/Check if a given character is a printable character.
1944 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1945 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
1946 <tag/Description/The function returns a value of zero if the given argument
1947 is a printable character (this includes the space character). The return value
1948 is non zero if the character is anything else.
1949 <tag/Limits/<itemize>
1950 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1951 inline sequence generated by the macro will not work correctly for values
1952 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1953 this range. The non inline function may be accessed by <tt/#undef/'ing the
1955 <item>When compiling without <tt/-Os/, the function is only available as
1956 fastcall function, so it may only be used in presence of a prototype.
1958 <tag/Availability/ISO 9899
1960 <ref id="isalnum" name="isalnum">,
1961 <ref id="isalpha" name="isalpha">,
1962 <ref id="isascii" name="isascii">,
1963 <ref id="isblank" name="isblank">,
1964 <ref id="iscntrl" name="iscntrl">,
1965 <ref id="isdigit" name="isdigit">,
1966 <ref id="isgraph" name="isgraph">,
1967 <ref id="islower" name="islower">,
1968 <ref id="ispunct" name="ispunct">,
1969 <ref id="isspace" name="isspace">,
1970 <ref id="isupper" name="isupper">,
1971 <ref id="isxdigit" name="isxdigit">
1977 <sect1>ispunct<label id="ispunct"><p>
1981 <tag/Function/Check if a given character is a printable character but not a
1982 space or an alphanumeric character.
1983 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1984 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
1985 <tag/Description/The function returns a value of zero if the given argument
1986 is a printable character, but not a space or anything alphanumeric. The return
1987 value is non zero if the character is anything else.
1988 <tag/Limits/<itemize>
1989 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1990 inline sequence generated by the macro will not work correctly for values
1991 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1992 this range. The non inline function may be accessed by <tt/#undef/'ing the
1994 <item>When compiling without <tt/-Os/, the function is only available as
1995 fastcall function, so it may only be used in presence of a prototype.
1997 <tag/Availability/ISO 9899
1999 <ref id="isalnum" name="isalnum">,
2000 <ref id="isalpha" name="isalpha">,
2001 <ref id="isascii" name="isascii">,
2002 <ref id="isblank" name="isblank">,
2003 <ref id="iscntrl" name="iscntrl">,
2004 <ref id="isdigit" name="isdigit">,
2005 <ref id="isgraph" name="isgraph">,
2006 <ref id="islower" name="islower">,
2007 <ref id="isprint" name="isprint">,
2008 <ref id="isspace" name="isspace">,
2009 <ref id="isupper" name="isupper">,
2010 <ref id="isxdigit" name="isxdigit">
2016 <sect1>isspace<label id="isspace"><p>
2020 <tag/Function/Check if a given character is a a white-space character.
2021 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2022 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
2023 <tag/Description/The function returns a value of zero if the given argument
2024 is a white space character. The return value is non zero if the character is
2025 anything else. The standard white space characters are: space, formfeed ('\f'),
2026 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
2028 <tag/Limits/<itemize>
2029 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2030 inline sequence generated by the macro will not work correctly for values
2031 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2032 this range. The non inline function may be accessed by <tt/#undef/'ing the
2034 <item>When compiling without <tt/-Os/, the function is only available as
2035 fastcall function, so it may only be used in presence of a prototype.
2037 <tag/Availability/ISO 9899
2039 <ref id="isalnum" name="isalnum">,
2040 <ref id="isalpha" name="isalpha">,
2041 <ref id="isascii" name="isascii">,
2042 <ref id="isblank" name="isblank">,
2043 <ref id="iscntrl" name="iscntrl">,
2044 <ref id="isdigit" name="isdigit">,
2045 <ref id="isgraph" name="isgraph">,
2046 <ref id="islower" name="islower">,
2047 <ref id="isprint" name="isprint">,
2048 <ref id="ispunct" name="ispunct">,
2049 <ref id="isupper" name="isupper">,
2050 <ref id="isxdigit" name="isxdigit">
2056 <sect1>isupper<label id="isupper"><p>
2060 <tag/Function/Check if a given character is an upper case letter.
2061 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2062 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
2063 <tag/Description/The function returns a value of zero if the given argument
2064 is an upper case letter. The return value is non zero if the character is
2066 <tag/Limits/<itemize>
2067 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2068 inline sequence generated by the macro will not work correctly for values
2069 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2070 this range. The non inline function may be accessed by <tt/#undef/'ing the
2072 <item>When compiling without <tt/-Os/, the function is only available as
2073 fastcall function, so it may only be used in presence of a prototype.
2075 <tag/Availability/ISO 9899
2077 <ref id="isalnum" name="isalnum">,
2078 <ref id="isalpha" name="isalpha">,
2079 <ref id="isascii" name="isascii">,
2080 <ref id="isblank" name="isblank">,
2081 <ref id="iscntrl" name="iscntrl">,
2082 <ref id="isdigit" name="isdigit">,
2083 <ref id="isgraph" name="isgraph">,
2084 <ref id="islower" name="islower">,
2085 <ref id="isprint" name="isprint">,
2086 <ref id="ispunct" name="ispunct">,
2087 <ref id="isspace" name="isspace">,
2088 <ref id="isxdigit" name="isxdigit">
2094 <sect1>isxdigit<label id="isxdigit"><p>
2098 <tag/Function/Check if a given character is a hexadecimal digit.
2099 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2100 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
2101 <tag/Description/The function returns a value of zero if the given argument
2102 is a hexadecimal digit (0..9, a..f and A..F). The return value is non zero
2103 if the character is anything else.
2104 <tag/Limits/<itemize>
2105 <item>When compiling with <tt/-Os/ the function is actually a macro. The
2106 inline sequence generated by the macro will not work correctly for values
2107 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
2108 this range. The non inline function may be accessed by <tt/#undef/'ing the
2110 <item>When compiling without <tt/-Os/, the function is only available as
2111 fastcall function, so it may only be used in presence of a prototype.
2113 <tag/Availability/ISO 9899
2115 <ref id="isalnum" name="isalnum">,
2116 <ref id="isalpha" name="isalpha">,
2117 <ref id="isascii" name="isascii">,
2118 <ref id="isblank" name="isblank">,
2119 <ref id="iscntrl" name="iscntrl">,
2120 <ref id="isdigit" name="isdigit">,
2121 <ref id="isgraph" name="isgraph">,
2122 <ref id="islower" name="islower">,
2123 <ref id="isprint" name="isprint">,
2124 <ref id="ispunct" name="ispunct">,
2125 <ref id="isspace" name="isspace">,
2126 <ref id="isupper" name="isupper">
2132 <sect1>itoa<label id="itoa"><p>
2136 <tag/Function/Convert an integer into a string.
2137 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2138 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
2139 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
2140 <tt/radix/ as the base.
2141 <tag/Limits/<itemize>
2142 <item>There are no provisions to prevent a buffer overflow.
2143 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
2144 <item>The function is non standard, so it is not available in strict ANSI mode.
2145 You should probably use <tt/sprintf/ instead.
2146 <item>The function is only available as fastcall function, so it may only be
2147 used in presence of a prototype.
2149 <tag/Availability/cc65
2151 <ref id="atoi" name="atoi">,
2152 <ref id="atol" name="atol">,
2153 <ref id="ltoa" name="ltoa">,
2154 <ref id="ultoa" name="ultoa">,
2155 <ref id="utoa" name="utoa">
2161 <sect1>kbhit<label id="kbhit"><p>
2165 <tag/Function/Check if there's a key waiting in the keyboard buffer.
2166 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2167 <tag/Declaration/<tt/unsigned char kbhit (void);/
2168 <tag/Description/The function returns a value of zero if there is no character
2169 waiting to be read from the keyboard. It returns non zero otherwise.
2170 <tag/Limits/<itemize>
2171 <item>If the system does not support a keyboard buffer (most systems
2172 do), the function is rather useless.
2174 <tag/Availability/cc65
2176 <ref id="cgetc" name="cgetc">,
2177 <ref id="cursor" name="cursor">
2183 <sect1>labs<label id="labs"><p>
2187 <tag/Function/Returns the absolute value of a long integer.
2188 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2189 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
2190 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
2192 <tag/Limits/<itemize>
2193 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
2194 <item>The function is only available as fastcall function, so it may only be
2195 used in presence of a prototype.
2197 <tag/Availability/ISO 9899
2199 <ref id="abs" name="abs">
2205 <sect1>ltoa<label id="ltoa"><p>
2209 <tag/Function/Convert a long integer into a string.
2210 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2211 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
2212 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
2213 using <tt/radix/ as the base.
2214 <tag/Limits/<itemize>
2215 <item>There are no provisions to prevent a buffer overflow.
2216 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
2217 <item>The function is non standard, so it is not available in strict ANSI mode.
2218 You should probably use <tt/sprintf/ instead.
2219 <item>The function is only available as fastcall function, so it may only be
2220 used in presence of a prototype.
2222 <tag/Availability/cc65
2224 <ref id="atoi" name="atoi">,
2225 <ref id="atol" name="atol">,
2226 <ref id="itoa" name="itoa">,
2227 <ref id="ultoa" name="ultoa">,
2228 <ref id="utoa" name="utoa">
2234 <sect1>localeconv<label id="localeconv"><p>
2238 <tag/Function/Returns a pointer to the current locale structure.
2239 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
2240 <tag/Declaration/<tt/struct lconv* localeconv (void);/
2241 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
2243 <tag/Limits/<itemize>
2244 <item>cc65 supports only the "C" locale, so even after setting a new locale
2245 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
2248 <tag/Availability/ISO 9899
2250 <ref id="setlocale" name="setlocale">
2256 <sect1>malloc<label id="malloc"><p>
2260 <tag/Function/Allocate dynamic memory.
2261 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2262 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
2263 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
2264 pointer to the allocated memory block. On error (not enough memory available),
2265 <tt/malloc/ returns <tt/NULL/.
2268 <item>The function is only available as fastcall function, so it may only
2269 be used in presence of a prototype.
2271 <tag/Availability/ISO 9899
2273 <ref id="_heapadd" name="_heapadd">,
2274 <ref id="_heapmaxavail" name="_heapmaxavail">,
2275 <ref id="_heapmemavail" name="_heapmemavail">,
2276 <ref id="calloc" name="calloc">,
2277 <ref id="free" name="free">,
2278 <ref id="realloc" name="realloc">
2284 <sect1>memcpy<label id="memcpy"><p>
2288 <tag/Function/Copy a memory area.
2289 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2290 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
2291 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
2292 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
2296 <item>The result is undefined if the memory areas do overlap. Use
2297 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
2298 <item>The function is only available as fastcall function, so it may only
2299 be used in presence of a prototype.
2301 <tag/Availability/ISO 9899
2303 <ref id="_swap" name="_swap">,
2304 <ref id="memmove" name="memmove">,
2305 <ref id="memset" name="memset">
2311 <sect1>memmove<label id="memmove"><p>
2315 <tag/Function/Copy a memory area.
2316 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2317 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
2318 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
2319 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
2323 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
2324 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
2325 <item>The function is only available as fastcall function, so it may only
2326 be used in presence of a prototype.
2328 <tag/Availability/ISO 9899
2330 <ref id="_swap" name="_swap">,
2331 <ref id="memcpy" name="memcpy">,
2332 <ref id="memset" name="memset">
2338 <sect1>memset<label id="memset"><p>
2342 <tag/Function/Fill a memory area.
2343 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2344 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
2345 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
2346 the value <tt/val/. The function returns <tt/p/.
2349 <item>The function is only available as fastcall function, so it may only
2350 be used in presence of a prototype.
2352 <tag/Availability/ISO 9899
2354 <ref id="_swap" name="_swap">,
2355 <ref id="bzero" name="bzero">,
2356 <ref id="memcpy" name="memcpy">,
2357 <ref id="memmove" name="memmove">
2363 <sect1>offsetof<label id="offsetof"><p>
2367 <tag/Function/Calculate the offset of a struct or union member.
2368 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
2369 <tag/Declaration/<tt/size_t offsetof (type, member);/
2370 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
2371 or <tt/union/ member.
2372 <tag/Limits/<itemize>
2373 <item>The function is actually a macro.
2375 <tag/Availability/ISO 9899
2381 <sect1>open<label id="open"><p>
2385 <tag/Function/Open and possibly create a file.
2386 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2387 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
2388 <tag/Description/<tt/open/ opens a file and returns the file descriptor
2389 associated with it. On error, -1 is returned and an error code is stored in
2390 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
2391 <tag/Limits/<itemize>
2392 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
2393 open, which is used as the permission mask when a new file is created. While
2394 cc65 allows to pass this argument, it is ignored.
2396 <tag/Availability/POSIX
2398 <ref id="close" name="close">,
2399 <ref id="creat" name="creat">
2405 <sect1>raise<label id="raise"><p>
2409 <tag/Function/Send a signal to the executing program.
2410 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
2411 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
2412 <tag/Description/<tt/raise/ sends the given signal to the program. If the
2413 program has installed a signal handler for the signal, this signal handler
2414 will be executed. If no handler has been installed, the default action for
2415 the raised signal will be taken. The function returns zero on success,
2417 <tag/Limits/<itemize>
2418 <item>The function is only available as fastcall function, so it may only
2419 be used in presence of a prototype.
2421 <tag/Availability/ISO 9899
2423 <ref id="abort" name="abort">,
2424 <ref id="signal" name="signal">
2430 <sect1>rand<label id="rand"><p>
2434 <tag/Function/Return a pseudo random number.
2435 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2436 <tag/Declaration/<tt/int rand (void);/
2437 <tag/Description/The function returns a pseudo random number
2438 between 0 and <tt/RAND_MAX/ (exclusive).
2439 <tag/Limits/<itemize>
2440 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
2441 flow of numbers is generated.
2442 <item>On startup, the function behaves as if <ref id="srand" name="srand">
2443 had been used with an argument of 1.
2445 <tag/Availability/ISO 9899
2447 <ref id="_randomize" name="_randomize">,
2448 <ref id="srand" name="srand">
2454 <sect1>realloc<label id="realloc"><p>
2458 <tag/Function/Change the size of an allocated memory block.
2459 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2460 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
2461 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
2462 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
2463 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
2464 behaves as if <tt/free/ had been called. On error (not enough memory
2465 available), <tt/realloc/ returns <tt/NULL/.
2468 <item>The part of the memory block that is returned will have its contents
2470 <item>This function is somewhat dangerous to use. Be careful to save the
2471 pointer you're passing somewhere else, otherwise
2473 ptr = realloc (ptr, size);
2475 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
2476 <item>The function is only available as fastcall function, so it may only
2477 be used in presence of a prototype.
2479 <tag/Availability/ISO 9899
2481 <ref id="_heapadd" name="_heapadd">,
2482 <ref id="_heapmaxavail" name="_heapmaxavail">,
2483 <ref id="_heapmemavail" name="_heapmemavail">,
2484 <ref id="calloc" name="calloc">,
2485 <ref id="free" name="free">,
2486 <ref id="realloc" name="realloc">
2492 <sect1>reset_brk<label id="reset_brk"><p>
2496 <tag/Function/Resets the break vector to its original value.
2497 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
2498 <tag/Declaration/<tt/void __fastcall__ reset_brk (void);/
2499 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
2500 before a call to <tt/set_brk/.
2503 <item>Since <tt/<ref id="set_brk" name="set_brk">/ installs an exit handler,
2504 it is not strictly necessary to call this function as part of the cleanup when
2507 <tag/Availability/cc65
2509 <ref id="set_brk" name="set_brk">
2515 <sect1>revers<label id="revers"><p>
2519 <tag/Function/Control revers character display.
2520 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2521 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
2522 <tag/Description/If the argument is non zero, the function enables reverse
2523 character display. If the argument is zero, reverse character display is
2524 switched off. The old value of the setting is returned.
2525 <tag/Limits/<itemize>
2526 <item>The function may not be supported by the hardware, in which case
2527 the call is ignored.
2528 <item>The function is only available as fastcall function, so it may only
2529 be used in presence of a prototype.
2531 <tag/Availability/cc65
2533 <ref id="textcolor" name="textcolor">
2539 <sect1>screensize<label id="screensize"><p>
2543 <tag/Function/Return the dimensions of the text mode screen.
2544 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2545 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
2546 <tag/Description/The function returns the dimensions of the text mode screen.
2547 <tag/Limits/<itemize>
2548 <item>The function is only available as fastcall function, so it may only
2549 be used in presence of a prototype.
2551 <tag/Availability/cc65
2553 <ref id="gotox" name="gotox">,
2554 <ref id="gotoxy" name="gotoxy">,
2555 <ref id="gotoy" name="gotoy">,
2556 <ref id="wherex" name="wherex">,
2557 <ref id="wherey" name="wherey">
2563 <sect1>set_brk<label id="set_brk"><p>
2567 <tag/Function/Set the break vector to a user function.
2568 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
2569 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
2570 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
2571 program code by letting the vector point to a user written C function. The
2572 runtime library installs a small stub that saves the registers into global
2573 variables that may be accessed (and changed) by the break handler.
2576 <item>The function is only available as fastcall function, so it may only
2577 be used in presence of a prototype.
2578 <item>The stub saves the zero page registers used by the C runtime and switches
2579 to a small break handler stack. This means that it is safe to execute C code,
2580 even if C code was interrupted. Be careful however not to use too many local
2581 variables, and do not enable stack checks for the handler function or any other
2582 function called from it.
2583 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
2584 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
2585 otherwise the <tt/BRK/ instruction will get executed over and over again.
2586 <item>Since <tt/set_brk/ installs an exit handler, it is not strictly necessary
2587 to call <tt/<ref id="reset_brk" name="reset_brk">/ as part of the cleanup when
2588 the program terminates.
2590 <tag/Availability/cc65
2592 <ref id="reset_brk" name="reset_brk">
2598 <sect1>setlocale<label id="setlocale"><p>
2602 <tag/Function/Selects a locale.
2603 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
2604 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
2605 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
2608 <item>The function is only available as fastcall function, so it may only
2609 be used in presence of a prototype.
2610 <item>cc65 supports only the "C" locale, so calling this function to set a
2611 different locale has no effect.
2613 <tag/Availability/ISO 9899
2615 <ref id="localeconv" name="localeconv">,
2616 <ref id="strcoll" name="strcoll">
2622 <sect1>signal<label id="signal"><p>
2626 <tag/Function/Install a signal handler.
2627 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
2628 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
2629 <tag/Description/<tt/signal/ installs a handler for the given signal. The
2630 handler may either be a user supplied function, or one of the predefined
2631 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
2632 previous value if the signal , or the special function vector SIG_ERR in
2634 <tag/Limits/<itemize>
2635 <item>The function is only available as fastcall function, so it may only
2636 be used in presence of a prototype.
2638 <tag/Availability/ISO 9899
2640 <ref id="abort" name="abort">,
2641 <ref id="raise" name="raise">
2647 <sect1>sleep<label id="sleep"><p>
2651 <tag/Function/Sleep for a specified amount of time.
2652 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
2653 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
2654 <tag/Description/The function will return after the specified number of
2655 seconds have elapsed.
2656 <tag/Limits/<itemize>
2657 <item>The function is only available as fastcall function, so it may only
2658 be used in presence of a prototype.
2660 <tag/Availability/POSIX
2666 <sect1>slow<label id="slow"><p>
2670 <tag/Function/Switch the C128 into 1MHz mode.
2671 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
2672 <tag/Declaration/<tt/void slow (void);/
2673 <tag/Description/The function will switch the clock of the C128 to 1MHz. This
2674 will halve the speed compared to fast mode.
2675 <tag/Limits/<itemize>
2676 <item>The function is specific to the C128.
2678 <tag/Availability/C128
2680 <ref id="fast" name="fast">,
2681 <ref id="toggle_videomode" name="toggle_videomode">
2687 <sect1>srand<label id="srand"><p>
2691 <tag/Function/Initialize the pseudo random number generator.
2692 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2693 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
2694 <tag/Description/The function initializes the random number generator using
2695 the given seed. On program startup, the generator behaves as if <tt/srand/ has
2696 been called with an argument of 1.
2697 <tag/Limits/<itemize>
2698 <item>The function is only available as fastcall function, so it may only
2699 be used in presence of a prototype.
2701 <tag/Availability/ISO 9899
2703 <ref id="_randomize" name="_randomize">,
2704 <ref id="rand" name="rand">
2710 <sect1>strcasecmp<label id="strcasecmp"><p>
2714 <tag/Function/Compare two strings case insensitive.
2715 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2716 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
2717 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
2718 as parameters without case sensitivity. It returns a value that is less than
2719 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
2720 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
2721 <tag/Limits/<itemize>
2722 <item>The function is only available as fastcall function, so it may only
2723 be used in presence of a prototype.
2724 <item>The function is not available in strict ANSI mode.
2726 <tag/Availability/cc65
2728 <ref id="strcmp" name="strcmp">,
2729 <ref id="strcoll" name="strcoll">,
2730 <ref id="stricmp" name="stricmp">
2736 <sect1>strcat<label id="strcat"><p>
2740 <tag/Function/Concatentate two strings.
2741 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2742 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
2743 <tag/Description/The <tt/strcat/ function appends a copy of the string
2744 pointed to by s2 (including the terminating null byte) to the end of the
2745 string pointed to by s1. The initial byte of s2 overwrites the null byte at
2747 <tag/Limits/<itemize>
2748 <item>The function is only available as fastcall function, so it may only
2749 be used in presence of a prototype.
2750 <item>If copying takes place between objects that overlap, the behavior
2753 <tag/Availability/ISO 9899
2755 <ref id="strcpy" name="strcpy">
2756 <ref id="strncpy" name="strncpy">
2762 <sect1>strchr<label id="strchr"><p>
2766 <tag/Function/Search for a character in a string.
2767 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2768 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
2769 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
2770 (converted to a char) in the string pointed to by <tt/s/. The terminating null
2771 byte is considered to be part of the string. Upon completion, the function
2772 returns a pointer to the byte, or a null pointer if the byte was not found.
2773 <tag/Limits/<itemize>
2774 <item>The function is only available as fastcall function, so it may only
2775 be used in presence of a prototype.
2777 <tag/Availability/ISO 9899
2779 <ref id="strrchr" name="strrchr">
2785 <sect1>strcmp<label id="strcmp"><p>
2789 <tag/Function/Compare two strings.
2790 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2791 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
2792 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
2793 parameters. It returns a value that is less than zero if <tt/s1/ is less than
2794 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
2795 if <tt/s1/ is greater than <tt/s2/.
2796 <tag/Limits/<itemize>
2797 <item>The function is only available as fastcall function, so it may only
2798 be used in presence of a prototype.
2800 <tag/Availability/ISO 9899
2802 <ref id="strcasecmp" name="strcasecmp">,
2803 <ref id="strcoll" name="strcoll">,
2804 <ref id="stricmp" name="stricmp">
2810 <sect1>strcoll<label id="strcoll"><p>
2814 <tag/Function/Compare two strings.
2815 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2816 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
2817 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
2818 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
2819 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
2820 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
2821 than zero if <tt/s1/ is greater than <tt/s2/.
2822 <tag/Limits/<itemize>
2823 <item>The function is only available as fastcall function, so it may only
2824 be used in presence of a prototype.
2826 <tag/Availability/ISO 9899
2828 <ref id="setlocale" name="setlocale">,
2829 <ref id="strcasecmp" name="strcasecmp">,
2830 <ref id="strcmp" name="strcmp">,
2831 <ref id="stricmp" name="stricmp">
2837 <sect1>strcpy<label id="strcpy"><p>
2841 <tag/Function/Copy a string.
2842 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2843 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
2844 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
2845 <tt/s2/ (including the terminating null byte) into the array pointed to by
2846 <tt/s1/. The function will always return <tt/s1/.
2847 <tag/Limits/<itemize>
2848 <item>The function is only available as fastcall function, so it may only
2849 be used in presence of a prototype.
2850 <item>If copying takes place between objects that overlap, the behavior
2853 <tag/Availability/ISO 9899
2855 <ref id="strcat" name="strcat">
2856 <ref id="strncpy" name="strncpy">
2861 static char hello[14];
2863 strcpy (hello, "Hello world!\n");
2869 <sect1>stricmp<label id="stricmp"><p>
2873 <tag/Function/Compare two strings case insensitive.
2874 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2875 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
2876 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
2877 parameters without case sensitivity. It returns a value that is less than zero
2878 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
2879 value greater than zero if <tt/s1/ is greater than <tt/s2/.
2880 <tag/Limits/<itemize>
2881 <item>The function is only available as fastcall function, so it may only
2882 be used in presence of a prototype.
2883 <item>The function is not available in strict ANSI mode.
2885 <tag/Availability/cc65
2887 <ref id="strcasecmp" name="strcasecmp">,
2888 <ref id="strcmp" name="strcmp">,
2889 <ref id="strcoll" name="strcoll">
2895 <sect1>strlen<label id="strlen"><p>
2899 <tag/Function/Return the length of a string.
2900 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2901 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
2902 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
2903 string to which s points, not including the terminating null byte.
2904 <tag/Limits/<itemize>
2905 <item>The function is only available as fastcall function, so it may only
2906 be used in presence of a prototype.
2907 <item>When compiling with <tt/-Os/ (inline known standard functions), the
2908 function does not work correctly for strings with more than 255 characters.
2910 <tag/Availability/ISO 9899
2912 <ref id="strcpy" name="strcpy">
2918 <sect1>strlower<label id="strlower"><p>
2922 <tag/Function/Make a string lower case.
2923 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2924 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
2925 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
2926 function to each character of a string. The function will always return <tt/s/.
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>The function prototype is unavailable when compiling in strict ANSI mode.
2931 <item>An alias name for this function is <tt/strlwr/.
2933 <tag/Availability/cc65
2935 <ref id="strupper" name="strupper">
2936 <ref id="tolower" name="tolower">
2942 <sect1>strlwr<label id="strlwr"><p>
2949 <sect1>strncpy<label id="strncpy"><p>
2953 <tag/Function/Copy part of a string.
2954 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2955 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2, size_t n);/
2956 <tag/Description/The <tt/strncpy/ function copies not more than n bytes from
2957 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
2958 pointed to by <tt/s2/ is a string that is shorter than n bytes, null bytes are
2959 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
2960 written. The function will always return <tt/s1/.
2961 <tag/Limits/<itemize>
2962 <item>The function is only available as fastcall function, so it may only
2963 be used in presence of a prototype. If there is no null byte in the first <tt/n/
2964 bytes of the array pointed to by <tt/s2/, the result is not null-terminated.
2965 <item>If copying takes place between objects that overlap, the behavior is
2968 <tag/Availability/ISO 9899
2970 <ref id="strcat" name="strcat">
2971 <ref id="strcpy" name="strcpy">
2976 static char hello[6];
2978 strcpy (hello, "Hello world!\n", sizeof (hello) - 1);
2985 <sect1>strrchr<label id="strrchr"><p>
2989 <tag/Function/Search for a character in a string.
2990 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2991 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
2992 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
2993 (converted to a char) in the string pointed to by <tt/s/. The terminating null
2994 byte is considered to be part of the string. Upon completion, the function
2995 returns a pointer to the byte, or a null pointer if the byte was not found.
2996 <tag/Limits/<itemize>
2997 <item>The function is only available as fastcall function, so it may only
2998 be used in presence of a prototype.
3000 <tag/Availability/ISO 9899
3002 <ref id="strchr" name="strchr">
3008 <sect1>strupper<label id="strupper"><p>
3012 <tag/Function/Make a string upper case.
3013 <tag/Header/<tt/<ref id="string.h" name="string.h">/
3014 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
3015 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
3016 function to each character of a string. The function will always return <tt/s/.
3017 <tag/Limits/<itemize>
3018 <item>The function is only available as fastcall function, so it may only
3019 be used in presence of a prototype.
3020 <item>The function prototype is unavailable when compiling in strict ANSI mode.
3021 <item>An alias name for this function is <tt/strupr/.
3023 <tag/Availability/cc65
3025 <ref id="strlower" name="strlower">
3026 <ref id="toupper" name="toupper">
3032 <sect1>strupr<label id="strupr"><p>
3039 <sect1>textcolor<label id="textcolor"><p>
3043 <tag/Function/Set the text color.
3044 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3045 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
3046 <tag/Description/The function will set a new text color. It returns the old
3047 (current) text color. Text output using any <tt/conio.h/ function will use
3048 the color set by this function.
3049 <tag/Limits/<itemize>
3050 <item>Text colors are system dependent. The function may have no effect
3051 on systems where the text color cannot be changed.
3052 <item>The function is only available as fastcall function, so it may only
3053 be used in presence of a prototype.
3055 <tag/Availability/cc65
3057 <ref id="bgcolor" name="bgcolor">,
3058 <ref id="bordercolor" name="bordercolor">
3064 <sect1>toggle_videomode<label id="toggle_videomode"><p>
3068 <tag/Function/Toggle between 40 and 80 column mode.
3069 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
3070 <tag/Declaration/<tt/void toggle_videomode (void);/
3071 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
3072 old mode (cursor position, color and so on) are saved and restored together
3074 <tag/Limits/<itemize>
3075 <item>The function is specific to the C128.
3077 <tag/Availability/C128
3079 <ref id="fast" name="fast">,
3080 <ref id="slow" name="slow">
3086 <sect1>tolower<label id="tolower"><p>
3090 <tag/Function/Convert a character into its lower case representation.
3091 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3092 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
3093 <tag/Description/The function returns the given character converted to lower
3094 case. If the given character is not a letter, it is returned unchanged.
3095 <tag/Limits/<itemize>
3096 <item>The function is only available as fastcall function, so it may
3097 only be used in presence of a prototype.
3099 <tag/Availability/ISO 9899
3101 <ref id="islower" name="islower">,
3102 <ref id="isupper" name="isupper">,
3103 <ref id="toupper" name="toupper">
3109 <sect1>toupper<label id="toupper"><p>
3113 <tag/Function/Convert a character into its upper case representation.
3114 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3115 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
3116 <tag/Description/The function returns the given character converted to upper
3117 case. If the given character is not a letter, it is returned unchanged.
3118 <tag/Limits/<itemize>
3119 <item>The function is only available as fastcall function, so it may
3120 only be used in presence of a prototype.
3122 <tag/Availability/ISO 9899
3124 <ref id="islower" name="islower">,
3125 <ref id="isupper" name="isupper">,
3126 <ref id="tolower" name="tolower">
3132 <sect1>ultoa<label id="ultoa"><p>
3136 <tag/Function/Convert an unsigned long integer into a string.
3137 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3138 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
3139 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
3140 string using <tt/radix/ as the base.
3141 <tag/Limits/<itemize>
3142 <item>There are no provisions to prevent a buffer overflow.
3143 <item>The function is non standard, so it is not available in strict ANSI mode.
3144 You should probably use <tt/sprintf/ instead.
3145 <item>The function is only available as fastcall function, so it may only be
3146 used in presence of a prototype.
3148 <tag/Availability/cc65
3150 <ref id="atoi" name="atoi">,
3151 <ref id="atol" name="atol">,
3152 <ref id="itoa" name="itoa">,
3153 <ref id="ltoa" name="ltoa">,
3154 <ref id="utoa" name="utoa">
3160 <sect1>utoa<label id="utoa"><p>
3164 <tag/Function/Convert an unsigned integer into a string.
3165 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3166 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
3167 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
3168 using <tt/radix/ as the base.
3169 <tag/Limits/<itemize>
3170 <item>There are no provisions to prevent a buffer overflow.
3171 <item>The function is non standard, so it is not available in strict ANSI mode.
3172 You should probably use <tt/sprintf/ instead.
3173 <item>The function is only available as fastcall function, so it may only be
3174 used in presence of a prototype.
3176 <tag/Availability/cc65
3178 <ref id="atoi" name="atoi">,
3179 <ref id="atol" name="atol">,
3180 <ref id="itoa" name="itoa">,
3181 <ref id="ltoa" name="ltoa">,
3182 <ref id="ultoa" name="ultoa">
3188 <sect1>wherex<label id="wherex"><p>
3192 <tag/Function/Return the current X position of the text mode cursor.
3193 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3194 <tag/Declaration/<tt/unsigned char wherex (void);/
3195 <tag/Description/The function returns the current X position of the text mode
3196 cursor. Zero is returned for the leftmost screen position.
3197 <tag/Availability/cc65
3199 <ref id="gotox" name="gotox">,
3200 <ref id="gotoy" name="gotoy">,
3201 <ref id="gotoxy" name="gotoxy">,
3202 <ref id="wherey" name="wherey">
3208 <sect1>wherey<label id="wherey"><p>
3212 <tag/Function/Return the current Y position of the text mode cursor.
3213 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3214 <tag/Declaration/<tt/unsigned char wherey (void);/
3215 <tag/Description/The function returns the current Y position of the text mode
3216 cursor. Zero is returned for the uppermost screen position.
3217 <tag/Availability/cc65
3219 <ref id="gotox" name="gotox">,
3220 <ref id="gotoy" name="gotoy">,
3221 <ref id="gotoxy" name="gotoxy">,
3222 <ref id="wherex" name="wherex">