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/assert.h/<label id="assert.h"><p>
68 <item><ref id="assert" name="assert">
72 <sect1><tt/c128.h/<label id="c128.h"><p>
75 <item><ref id="c64mode" name="c64mode">
76 <item><ref id="fast" name="fast">
77 <item><ref id="toggle_videomode" name="toggle_videomode">
78 <item><ref id="slow" name="slow">
82 <sect1><tt/conio.h/<label id="conio.h"><p>
85 <item><ref id="bgcolor" name="bgcolor">
86 <item><ref id="bordercolor" name="bordercolor">
87 <item><ref id="cclear" name="cclear">
88 <item><ref id="cclearxy" name="cclearxy">
89 <item><ref id="cgetc" name="cgetc">
90 <item><ref id="chline" name="chline">
91 <item><ref id="chlinexy" name="chlinexy">
92 <item><ref id="clrscr" name="clrscr">
93 <!-- <item><ref id="cprintf" name="cprintf"> -->
94 <!-- <item><ref id="cputc" name="cputc"> -->
95 <!-- <item><ref id="cputcxy" name="cputcxy"> -->
96 <!-- <item><ref id="cputs" name="cputs"> -->
97 <!-- <item><ref id="cputsxy" name="cputsxy"> -->
98 <item><ref id="cursor" name="cursor">
99 <item><ref id="cvline" name="cvline">
100 <item><ref id="cvlinexy" name="cvlinexy">
101 <item><ref id="gotox" name="gotox">
102 <item><ref id="gotoxy" name="gotoxy">
103 <item><ref id="gotoy" name="gotoy">
104 <item><ref id="kbhit" name="kbhit">
105 <item><ref id="revers" name="revers">
106 <item><ref id="screensize" name="screensize">
107 <item><ref id="textcolor" name="textcolor">
108 <!-- <item><ref id="vcprintf" name="vcprintf"> -->
109 <item><ref id="wherex" name="wherex">
110 <item><ref id="wherey" name="wherey">
114 <sect1><tt/ctype.h/<label id="ctype.h"><p>
117 <item><ref id="isalnum" name="isalnum">
118 <item><ref id="isalpha" name="isalpha">
119 <item><ref id="isascii" name="isascii">
120 <item><ref id="isblank" name="isblank">
121 <item><ref id="iscntrl" name="iscntrl">
122 <item><ref id="isdigit" name="isdigit">
123 <item><ref id="isgraph" name="isgraph">
124 <item><ref id="islower" name="islower">
125 <item><ref id="isprint" name="isprint">
126 <item><ref id="ispunct" name="ispunct">
127 <item><ref id="isspace" name="isspace">
128 <item><ref id="isupper" name="isupper">
129 <item><ref id="isxdigit" name="isxdigit">
130 <item><ref id="tolower" name="tolower">
131 <item><ref id="toupper" name="toupper">
135 <sect1><tt/em.h/<label id="em.h"><p>
138 <item><ref id="em_commit" name="em_commit">
139 <item><ref id="em_copyfrom" name="em_copyfrom">
140 <item><ref id="em_copyto" name="em_copyto">
141 <item><ref id="em_load_driver" name="em_load_driver">
142 <item><ref id="em_map" name="em_map">
143 <item><ref id="em_pagecount" name="em_pagecount">
144 <item><ref id="em_unload" name="em_unload">
145 <item><ref id="em_use" name="em_use">
149 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
152 <item><ref id="close" name="close">
153 <item><ref id="creat" name="creat">
154 <item><ref id="open" name="open">
158 <sect1><tt/signal.h/<label id="signal.h"><p>
161 <item><ref id="raise" name="raise">
162 <item><ref id="signal" name="signal">
166 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
169 <item><ref id="_heapadd" name="_heapadd">
170 <item><ref id="_heapmaxavail" name="_heapmaxavail">
171 <item><ref id="_heapmemavail" name="_heapmemavail">
172 <item><ref id="_randomize" name="_randomize">
173 <item><ref id="_swap" name="_swap">
174 <item><ref id="abort" name="abort">
175 <item><ref id="abs" name="abs">
176 <item><ref id="atexit" name="atexit">
177 <item><ref id="atoi" name="atoi">
178 <item><ref id="atol" name="atol">
179 <!-- <item><ref id="bsearch" name="bsearch"> -->
180 <item><ref id="calloc" name="calloc">
181 <!-- <item><ref id="div" name="div"> -->
182 <item><ref id="exit" name="exit">
183 <item><ref id="free" name="free">
184 <item><ref id="getenv" name="getenv">
185 <item><ref id="itoa" name="itoa">
186 <item><ref id="labs" name="labs">
187 <item><ref id="ltoa" name="ltoa">
188 <item><ref id="malloc" name="malloc">
189 <!-- <item><ref id="qsort" name="qsort"> -->
190 <item><ref id="rand" name="rand">
191 <item><ref id="realloc" name="realloc">
192 <item><ref id="srand" name="srand">
193 <item><ref id="ultoa" name="ultoa">
194 <item><ref id="utoa" name="utoa">
198 <sect1><tt/string.h/<label id="string.h"><p>
201 <!-- <item><ref id="_stroserror" name="_stroserror"> -->
202 <item><ref id="bzero" name="bzero">
203 <!-- <item><ref id="memchr" name="memchr"> -->
204 <item><ref id="memcpy" name="memcpy">
205 <item><ref id="memmove" name="memmove">
206 <item><ref id="memset" name="memset">
207 <!-- <item><ref id="strcasecmp" name="strcasecmp"> -->
208 <item><ref id="strcat" name="strcat">
209 <item><ref id="strchr" name="strchr">
210 <!-- <item><ref id="strcmp" name="strcmp"> -->
211 <!-- <item><ref id="strcoll" name="strcoll"> -->
212 <item><ref id="strcpy" name="strcpy">
213 <!-- <item><ref id="strcspn" name="strcspn"> -->
214 <!-- <item><ref id="strdup" name="strdup"> -->
215 <!-- <item><ref id="strerror" name="strerror"> -->
216 <!-- <item><ref id="stricmp" name="stricmp"> -->
217 <item><ref id="strlen" name="strlen">
218 <item><ref id="strlower" name="strlower">
219 <item><ref id="strlwr" name="strlwr">
220 <!-- <item><ref id="strncat" name="strncat"> -->
221 <!-- <item><ref id="strncmp" name="strncmp"> -->
222 <item><ref id="strncpy" name="strncpy">
223 <item><ref id="strrchr" name="strrchr">
224 <!-- <item><ref id="strspn" name="strspn"> -->
225 <!-- <item><ref id="strstr" name="strstr"> -->
226 <!-- <item><ref id="strtok" name="strtok"> -->
227 <!-- <item><ref id="strxfrm" name="strxfrm"> -->
228 <item><ref id="strupper" name="strupper">
229 <item><ref id="strupr" name="strupr">
233 <sect1><tt/unistd.h/<label id="unistd.h"><p>
236 <!-- <item><ref id="chdir" name="chdir"> -->
237 <!-- <item><ref id="getcwd" name="getcwd"> -->
238 <!-- <item><ref id="lseek" name="lseek"> -->
239 <!-- <item><ref id="mkdir" name="mkdir"> -->
240 <!-- <item><ref id="read" name="read"> -->
241 <!-- <item><ref id="rmdir" name="rmdir"> -->
242 <item><ref id="sleep" name="sleep">
243 <!-- <item><ref id="unlink" name="unlink"> -->
244 <!-- <item><ref id="write" name="write"> -->
250 <sect>Alphabetical function reference<p>
252 <sect1>_heapadd<label id="_heapadd"><p>
256 <tag/Function/Add a block to the heap.
257 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
258 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
259 <tag/Description/The function adds a block of raw memory to the heap.
262 <item>The minimum blocksize that can be added is 6 bytes; the function will
263 ignore blocks with smaller sizes.
265 <tag/Availability/cc65
267 <ref id="_heapmaxavail" name="_heapmaxavail">,
268 <ref id="_heapmemavail" name="_heapmemavail">,
269 <ref id="calloc" name="calloc">,
270 <ref id="free" name="free">,
271 <ref id="malloc" name="malloc">,
272 <ref id="realloc" name="realloc">
278 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
282 <tag/Function/Return the largest block that is available on the heap.
283 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
284 <tag/Declaration/<tt/size_t __fastcall__ _heapmaxavail (void);/
285 <tag/Description/The function returns the size of the largest block that may
286 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
287 <tag/Availability/cc65
289 <ref id="_heapadd" name="_heapadd">,
290 <ref id="_heapmemavail" name="_heapmemavail">,
291 <ref id="calloc" name="calloc">,
292 <ref id="free" name="free">,
293 <ref id="malloc" name="malloc">,
294 <ref id="realloc" name="realloc">
300 <sect1>_heapmemavail<label id="_heapmemavail"><p>
304 <tag/Function/Return the total available space on the heap.
305 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
306 <tag/Declaration/<tt/size_t __fastcall__ _heapmemavail (void);/
307 <tag/Description/The function returns the total number of bytes available on
311 <item>This function is of less use than usually assumed, since the returned
312 heap space may be available but not in one block. So even if this function
313 says that several times more heap space is available than needed, <ref
314 id="malloc" name="malloc"> may still return <tt/NULL/.
316 <tag/Availability/cc65
318 <ref id="_heapadd" name="_heapadd">,
319 <ref id="_heapmaxavail" name="_heapmaxavail">,
320 <ref id="calloc" name="calloc">,
321 <ref id="free" name="free">,
322 <ref id="malloc" name="malloc">,
323 <ref id="realloc" name="realloc">
329 <sect1>_randomize<label id="_randomize"><p>
333 <tag/Function/Initialize the pseudo random number generator.
334 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
335 <tag/Declaration/<tt/void _randomize (void);/
336 <tag/Description/The function initializes the random number generator with
337 a seed derived from fast changing hardware events, so the seed itself can be
338 considered random to a certain degree.
339 <tag/Limits/<itemize>
340 <item>The randomness of the seed depends on the machine hardware.
342 <tag/Availability/cc65
344 <ref id="rand" name="rand">,
345 <ref id="srand" name="srand">
351 <sect1>_swap<label id="_swap"><p>
355 <tag/Function/Swap the contents of memory areas.
356 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
357 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
358 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
359 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
360 <tt/size/ bytes in size.
361 <tag/Limits/<itemize>
362 <item>The memory areas may not overlap, otherwise the results are undefined.
363 <item>The function is only available as fastcall function, so it may only be
364 used in presence of a prototype.
366 <tag/Availability/cc65
368 <ref id="memcpy" name="memcpy">,
369 <ref id="memmove" name="memmove">
375 <sect1>_sys<label id="_sys"><p>
379 <tag/Function/Call a subroutine passing register values.
380 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
381 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
382 <tag/Description/The function will call the subroutine at the address
383 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
384 registers and the CPU flags are set to the values given in the <tt/regs/
385 structure. On return from the subroutine, the new values of the registers and
386 flags are stored back overwriting the old values.
387 <tag/Limits/<itemize>
388 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
389 when calling the subroutine (they are unchanged from their current values).
390 <item>The function is only available as fastcall function, so it may only be
391 used in presence of a prototype.
393 <tag/Availability/cc65
399 <sect1>BRK<label id="BRK"><p>
403 <tag/Function/Insert a 6502 BRK instrunction into the code.
404 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
405 <tag/Declaration/<tt/void BRK (void);/
406 <tag/Description/The function will insert a 6502 BRK instruction into the code
407 which may be used to trigger a debugger.
408 <tag/Limits/<itemize>
409 <item>The function is actually a macro.
410 <item>The inserted instruction may lead to unexpected results if no debugger
413 <tag/Availability/cc65
415 <ref id="CLI" name="CLI">,
416 <ref id="SEI" name="SEI">
422 <sect1>CLI<label id="CLI"><p>
426 <tag/Function/Insert a 6502 CLI instrunction into the code.
427 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
428 <tag/Declaration/<tt/void CLI (void);/
429 <tag/Description/The function will insert a 6502 CLI instruction into the code,
430 so interrupts are disabled. Note that non maskable interrupts cannot be
432 <tag/Limits/<itemize>
433 <item>The function is actually a macro.
434 <item>Disabling interrupts may lead to unexpected results.
436 <tag/Availability/cc65
438 <ref id="BRK" name="BRK">,
439 <ref id="SEI" name="SEI">
445 <sect1>SEI<label id="SEI"><p>
449 <tag/Function/Insert a 6502 SEI instrunction into the code.
450 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
451 <tag/Declaration/<tt/void SEI (void);/
452 <tag/Description/The function will insert a 6502 SEI instruction into the code,
453 so interrupts are enabled. Enabling interrupts has no effects if they are
454 already enabled (the default).
455 <tag/Limits/<itemize>
456 <item>The function is actually a macro.
458 <tag/Availability/cc65
460 <ref id="BRK" name="BRK">,
461 <ref id="CLI" name="CLI">
467 <sect1>abort<label id="abort"><p>
471 <tag/Function/Terminates a program abnormally.
472 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
473 <tag/Declaration/<tt/void abort (void);/
474 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
475 on stderr, then terminates the program with an exit code of 3.
476 <tag/Availability/ISO 9899
478 <ref id="assert" name="assert">,
479 <ref id="exit" name="exit">,
480 <ref id="raise" name="raise">
486 <sect1>abs<label id="abs"><p>
490 <tag/Function/Returns the absolute value of an integer.
491 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
492 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
493 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
495 <tag/Limits/<itemize>
496 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
497 <item>The function is only available as fastcall function, so it may only be
498 used in presence of a prototype.
500 <tag/Availability/ISO 9899
502 <ref id="labs" name="labs">
508 <sect1>assert<label id="assert"><p>
512 <tag/Function/Test a condition and possibly abort.
513 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
514 <tag/Declaration/<tt/void assert (int cond);/
515 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
516 statement. If the condition evaluates t zero (false), assert prints a message
517 on stderr and aborts the program.
518 <tag/Limits/<itemize>
519 <item>The function is actually a macro.
521 <tag/Availability/ISO 9899
523 <ref id="abort" name="abort">,
524 <ref id="exit" name="exit">
530 <sect1>atexit<label id="atexit"><p>
534 <tag/Function/Register an exit function.
535 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
536 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
537 <tag/Description/<tt/atexit/ registers the function pointed to by
538 <tt/exitfunc/ as an exit function. Exit functions are called when the program
539 terminates, they are called in LIFO order (the last function registered is
540 called first). <tt/atexit/ returns zero on success and a nonzero value on
542 <tag/Limits/<itemize>
543 <item>A maximum of 5 exit functions can be registered.
544 <item>There is no way to unregister an exit function.
545 <item>The function is only available as fastcall function, so it may only be
546 used in presence of a prototype.
548 <tag/Availability/ISO 9899
550 <ref id="abort" name="abort">,
551 <ref id="exit" name="exit">
557 <sect1>atoi<label id="atoi"><p>
561 <tag/Function/Convert a string to an integer.
562 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
563 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
564 <tag/Description/<tt/atoi/ converts the given string into an integer.
565 Conversion stops as soon as any invalid character is encountered.
566 <tag/Limits/<itemize>
567 <item>There is no way to detect any conversion errors.
568 <item>The function does not check for an numerical overflow when converting.
569 <item>The function is only available as fastcall function, so it may only be
570 used in presence of a prototype.
572 <tag/Availability/ISO 9899
574 <ref id="atol" name="atol">,
575 <ref id="itoa" name="itoa">,
576 <ref id="ltoa" name="ltoa">,
577 <ref id="ultoa" name="ultoa">,
578 <ref id="utoa" name="utoa">
584 <sect1>atol<label id="atol"><p>
588 <tag/Function/Convert a string to a long integer.
589 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
590 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
591 <tag/Description/<tt/atol/ converts the given string into a long integer.
592 Conversion stops as soon as any invalid character is encountered.
593 <tag/Limits/<itemize>
594 <item>There is no way to detect any conversion errors.
595 <item>The function does not check for an numerical overflow when converting.
596 <item>The function is only available as fastcall function, so it may only be
597 used in presence of a prototype.
599 <tag/Availability/ISO 9899
601 <ref id="atoi" name="atoi">,
602 <ref id="itoa" name="itoa">,
603 <ref id="ltoa" name="ltoa">,
604 <ref id="ultoa" name="ultoa">,
605 <ref id="utoa" name="utoa">
611 <sect1>bgcolor<label id="bgcolor"><p>
615 <tag/Function/Set the background text color.
616 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
617 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
618 <tag/Description/The function will set a new background text color. It returns
619 the old (current) background color.
620 <tag/Limits/<itemize>
621 <item>Background colors are system dependent. The function may have no effect
622 on systems where the background color cannot be changed.
623 <item>The function is only available as fastcall function, so it may only be
624 used in presence of a prototype.
626 <tag/Availability/cc65
628 <ref id="bordercolor" name="bordercolor">,
629 <ref id="textcolor" name="textcolor">
635 <sect1>bordercolor<label id="bordercolor"><p>
639 <tag/Function/Set the border (frame) color.
640 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
641 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
642 <tag/Description/The function will set a new border color. It returns the old
643 (current) border color.
644 <tag/Limits/<itemize>
645 <item>Border colors are system dependent. The function may have no effect
646 on systems where the border color cannot be changed.
647 <item>The function is only available as fastcall function, so it may only
648 be used in presence of a prototype.
650 <tag/Availability/cc65
652 <ref id="bgcolor" name="bgcolor">,
653 <ref id="textcolor" name="textcolor">
659 <sect1>bzero<label id="bzero"><p>
663 <tag/Function/Fill a memory area with zeroes.
664 <tag/Header/<tt/<ref id="string.h" name="string.h">/
665 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
666 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
670 <item>The function is non standard and therefore only available in non ANSI
671 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
672 <item>The function is only available as fastcall function, so it may only
673 be used in presence of a prototype.
675 <tag/Availability/cc65
677 <ref id="_swap" name="_swap">,
678 <ref id="memcpy" name="memcpy">,
679 <ref id="memmove" name="memmove">,
680 <ref id="memset" name="memset">,
686 <sect1>c64mode<label id="c64mode"><p>
690 <tag/Function/Switch the C128 into C64 compatible mode.
691 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
692 <tag/Declaration/<tt/void c64mode (void);/
693 <tag/Description/The function will cause the machine to reboot into C64 mode.
694 <tag/Limits/<itemize>
695 <item>The function is specific to the C128.
696 <item>The function will not return to the caller.
698 <tag/Availability/C128
704 <sect1>calloc<label id="calloc"><p>
708 <tag/Function/Allocate and clear memory.
709 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
710 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
711 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
712 of size <tt/size/, clears the whole block with binary zeroes and returns a
713 pointer to it. On error (not enough memory available), <tt/calloc/ returns
717 <item>Clearing the memory may not have the expected effect on all platforms:
718 pointers in the block may not be <tt/NULL/ and floating point variables may
719 not be zero (0.0). In other words: The "clearing" effect of this function
720 should be used with care for portable programs.
721 <item>The function is only available as fastcall function, so it may only
722 be used in presence of a prototype.
724 <tag/Availability/ISO 9899
726 <ref id="_heapadd" name="_heapadd">,
727 <ref id="_heapmaxavail" name="_heapmaxavail">,
728 <ref id="_heapmemavail" name="_heapmemavail">,
729 <ref id="free" name="free">,
730 <ref id="malloc" name="malloc">,
731 <ref id="realloc" name="realloc">
737 <sect1>cclear<label id="cclear"><p>
741 <tag/Function/Clear part of a line (write a given amount of spaces).
742 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
743 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
744 <tag/Description/The function clears part of a line by writing <tt/length/
745 spaces in the current text color.
746 <tag/Limits/<itemize>
747 <item>The function is only available as fastcall function, so it may
748 only be used in presence of a prototype.
750 <tag/Availability/cc65
752 <ref id="cclearxy" name="cclearxy">,
753 <ref id="clrscr" name="clrscr">
759 <sect1>cclearxy<label id="cclearxy"><p>
763 <tag/Function/Clear part of a line (write a given amount of spaces) starting
764 at a specific screen position.
765 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
766 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char length);/
767 <tag/Description/The function moves the cursor to a specific position, and
768 will then clear part of the line by writing <tt/length/ spaces in the current
770 <tag/Limits/<itemize>
771 <item>The function is only available as fastcall function, so it may
772 only be used in presence of a prototype.
774 <tag/Availability/cc65
776 <ref id="cclear" name="cclear">,
777 <ref id="clrscr" name="clrscr">
783 <sect1>cgetc<label id="cgetc"><p>
787 <tag/Function/Read a character from the keyboard.
788 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
789 <tag/Declaration/<tt/char cgetc (void);/
790 <tag/Description/The function reads a character from the keyboard. If there is
791 no character available, <tt/cgetc/ waits until the user presses a key. If the
792 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
793 displayed while waiting.
794 <tag/Limits/<itemize>
795 <item>If the system supports a keyboard buffer, <tt/cgetc/ will fetch a key
796 from this buffer and wait only if the buffer is empty.
798 <tag/Availability/cc65
800 <ref id="cursor" name="cursor">,
801 <ref id="kbhit" name="kbhit">
807 <sect1>chline<label id="chline"><p>
811 <tag/Function/Output a horizontal line in text mode.
812 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
813 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
814 <tag/Description/The function outputs a horizontal line with the given length
815 starting at the current cursor position.
816 <tag/Limits/<itemize>
817 <item>The character used to draw the horizontal line is system dependent.
818 If available, a line drawing character is used. Drawing a line that is partially
819 off screen leads to undefined behaviour.
820 <item>The function is only available as fastcall function, so it may only be
821 used in presence of a prototype.
823 <tag/Availability/cc65
825 <ref id="chlinexy" name="chlinexy">,
826 <ref id="cvline" name="cvline">,
827 <ref id="cvlinexy" name="cvlinexy">
833 <sect1>chlinexy<label id="chlinexy"><p>
837 <tag/Function/Output a horizontal line at a given position in text mode.
838 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
839 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
840 <tag/Description/The function outputs a horizontal line with the given length
841 starting at a given position.
842 <tag/Limits/<itemize>
843 <item>The character used to draw the horizontal line is system dependent.
844 If available, a line drawing character is used. Drawing a line that is partially
845 off screen leads to undefined behaviour.
846 <item>The function is only available as fastcall function, so it may only be
847 used in presence of a prototype.
849 <tag/Availability/cc65
851 <ref id="chline" name="chline">,
852 <ref id="cvline" name="cvline">,
853 <ref id="cvlinexy" name="cvlinexy">
859 <sect1>clrscr<label id="clrscr"><p>
863 <tag/Function/Clear the text screen.
864 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
865 <tag/Declaration/<tt/void clrscr (void);/
866 <tag/Description/The function clears the text screen and moves the cursor to
867 the upper left corner.
868 <tag/Availability/cc65
870 <ref id="cclear" name="cclear">,
871 <ref id="cclearxy" name="cclearxy">
877 <sect1>close<label id="close"><p>
881 <tag/Function/Close a file descriptor.
882 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
883 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
884 <tag/Description/The function closes the given file descriptor. It returns zero
885 on success and -1 on error. If an error occurs, the cause can be determined by
886 reading the <tt/errno/ variable.
887 <tag/Limits/<itemize>
888 <item>The function is only available as fastcall function, so it may only
889 be used in presence of a prototype.
891 <tag/Availability/POSIX
893 <ref id="creat" name="creat">,
894 <ref id="open" name="open">
900 <sect1>creat<label id="creat"><p>
904 <tag/Function/Create a file.
905 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
906 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
907 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
908 associated with it. On error, -1 is returned and an error code is stored in
910 <tag/Limits/<itemize>
911 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
912 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
913 <item>The function is only available as fastcall function, so it may only
914 be used in presence of a prototype.
916 <tag/Availability/POSIX
918 <ref id="close" name="close">,
919 <ref id="open" name="open">
925 <sect1>cursor<label id="cursor"><p>
929 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
930 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
931 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
932 <tag/Description/If the argument to the function is non zero, a blinking cursor
933 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
934 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
935 <tag/Limits/<itemize>
936 <item>The function is only available as fastcall function, so it may only
937 be used in presence of a prototype.
939 <tag/Availability/cc65
941 <ref id="cgetc" name="cgetc">,
942 <ref id="kbhit" name="kbhit">
948 <sect1>cvline<label id="cvline"><p>
952 <tag/Function/Output a vertical line in text mode.
953 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
954 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
955 <tag/Description/The function outputs a vertical line with the given length
956 starting at the current cursor position.
957 <tag/Limits/<itemize>
958 <item>The character used to draw the vertical line is system dependent.
959 If available, a line drawing character is used. Drawing a line that is partially
960 off screen leads to undefined behaviour.
961 <item>The function is only available as fastcall function, so it may only be
962 used in presence of a prototype.
964 <tag/Availability/cc65
966 <ref id="chline" name="chline">,
967 <ref id="chlinexy" name="chlinexy">,
968 <ref id="cvlinexy" name="cvlinexy">
974 <sect1>cvlinexy<label id="cvlinexy"><p>
978 <tag/Function/Output a vertical line at a given position in text mode.
979 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
980 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
981 <tag/Description/The function outputs a vertical line with the given length
982 starting at a given position.
983 <tag/Limits/<itemize>
984 <item>The character used to draw the vertical line is system dependent.
985 If available, a line drawing character is used. Drawing a line that is partially
986 off screen leads to undefined behaviour.
987 <item>The function is only available as fastcall function, so it may only be
988 used in presence of a prototype.
990 <tag/Availability/cc65
992 <ref id="chline" name="chline">,
993 <ref id="chlinexy" name="chlinexy">,
994 <ref id="cvline" name="cvline">
1000 <sect1>em_commit<label id="em_commit"><p>
1004 <tag/Function/Commit changes into extended memory.
1005 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1006 <tag/Declaration/<tt/void __fastcall__ em_commit (void);/
1007 <tag/Description/Commit changes in the memory window to extended storage. If
1008 the contents of the memory window have been changed, these changes may be lost
1009 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
1010 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
1011 name="em_copyto">/ are called without calling <tt/em_commit/ first.
1012 <tag/Limits/<itemize>
1013 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
1014 memory window are discarded, it does just mean that the drivers is allowed
1016 <item>The function is only available as fastcall function, so it may only be
1017 used in presence of a prototype.
1018 <item>The function produces undefined results if no extended memory driver is
1021 <tag/Availability/cc65
1023 <ref id="em_load_driver" name="em_load_driver">,
1024 <ref id="em_map" name="em_map">,
1025 <ref id="em_use" name="em_use">
1031 <sect1>em_copyfrom<label id="em_copyfrom"><p>
1035 <tag/Function/Copy from extended into normal memory.
1036 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1037 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
1038 <tag/Description/Copy data from extended memory into linear memory. Source and
1039 target addresses as well as the number of bytes to transfer are specified in
1040 the <tt/em_copy/ structure that is passed as a parameter.
1041 <tag/Limits/<itemize>
1042 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
1043 made any changes to the data in the window, call <tt/<ref id="em_commit"
1044 name="em_commit">/ first, or the changes are lost.
1045 <item>The function is only available as fastcall function, so it may only be
1046 used in presence of a prototype.
1047 <item>The function produces undefined results if no extended memory driver is
1050 <tag/Availability/cc65
1052 <ref id="em_commit" name="em_commit">,
1053 <ref id="em_copyto" name="em_copyto">,
1054 <ref id="em_load_driver" name="em_load_driver">
1060 <sect1>em_copyto<label id="em_copyto"><p>
1064 <tag/Function/Copy from normal into extended memory.
1065 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1066 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
1067 <tag/Description/Copy data from linear into extended memory. Source and
1068 target addresses as well as the number of bytes to transfer are specified in
1069 the <tt/em_copy/ structure that is passed as a parameter.
1070 <tag/Limits/<itemize>
1071 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
1072 made any changes to the data in the window, call <tt/<ref id="em_commit"
1073 name="em_commit">/ first, or the changes are lost.
1074 <item>The function is only available as fastcall function, so it may only be
1075 used in presence of a prototype.
1076 <item>The function produces undefined results if no extended memory driver is
1079 <tag/Availability/cc65
1081 <ref id="em_commit" name="em_commit">,
1082 <ref id="em_copyfrom" name="em_copyfrom">,
1083 <ref id="em_load_driver" name="em_load_driver">
1089 <sect1>em_load_driver<label id="em_load_driver"><p>
1093 <tag/Function/Load and initialize an extended memory driver.
1094 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1095 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
1096 <tag/Description/Load an extended memory driver into memory and initialize
1097 it. The function returns an error code that tells if all this has been
1099 <tag/Limits/<itemize>
1100 <item>Not all drivers are able to detect if the supported hardware is really
1102 <item>The function is only available as fastcall function, so it may only be
1103 used in presence of a prototype.
1104 <item>The driver is loaded by name, so currently you must know the type of
1105 extended memory that should be supported. There is no autodetect capability.
1107 <tag/Availability/cc65
1109 <ref id="em_unload" name="em_unload">
1115 <sect1>em_map<label id="em_map"><p>
1119 <tag/Function/Make a page of extended memory accessible.
1120 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1121 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
1122 <tag/Description/The function maps one page of extended memory into linear
1123 memory and returns a pointer to the page frame. Depending on the hardware
1124 and driver, the data is either mapped into the address space or transfered
1125 into a buffer. If you don't need the actual contents of the page (for example
1126 because you're going to overwrite it completely, it is better to call
1127 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
1128 data if it is possible to avoid that.
1129 <tag/Limits/<itemize>
1130 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
1131 made any changes to the data in the window, call <tt/<ref id="em_commit"
1132 name="em_commit">/ first, or the changes are lost.
1133 <item>The function is only available as fastcall function, so it may only be
1134 used in presence of a prototype.
1135 <item>The function produces undefined results if no extended memory driver is
1138 <tag/Availability/cc65
1140 <ref id="em_commit" name="em_commit">,
1141 <ref id="em_load_driver" name="em_load_driver">,
1142 <ref id="em_use" name="em_use">
1148 <sect1>em_pagecount<label id="em_pagecount"><p>
1152 <tag/Function/Return the number of available extended memory pages.
1153 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1154 <tag/Declaration/<tt/unsigned __fastcall__ em_pagecount (void);/
1155 <tag/Description/The function returns the size of the extended memory supported
1156 by the driver in 256 byte pages.
1157 <tag/Limits/<itemize>
1158 <item>The function returns zero if no extended memory driver is loaded.
1159 <item>The function may return zero if the supported hardware was not detected.
1161 <tag/Availability/cc65
1163 <ref id="em_load_driver" name="em_load_driver">
1169 <sect1>em_unload<label id="em_unload"><p>
1173 <tag/Function/Unload an extended memory driver.
1174 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1175 <tag/Declaration/<tt/void __fastcall__ em_unload (void);/
1176 <tag/Description/The function unloads a loaded extended memory driver and
1177 frees all memory allocated for the driver.
1178 <tag/Limits/<itemize>
1179 <item>The function does nothing if no driver is loaded.
1181 <tag/Availability/cc65
1183 <ref id="em_load_driver" name="em_load_driver">
1189 <sect1>em_use<label id="em_use"><p>
1193 <tag/Function/Prepare an extended memory page for use.
1194 <tag/Header/<tt/<ref id="em.h" name="em.h">/
1195 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
1196 <tag/Description/The function maps one page of extended memory into linear
1197 memory and returns a pointer to the page frame. This function is similar to
1198 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
1199 actual memory window in the assumption that the existing data is wrong or
1200 will get overwritten.
1201 <tag/Limits/<itemize>
1202 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
1203 made any changes to the data in the window, call <tt/<ref id="em_commit"
1204 name="em_commit">/ first, or the changes are lost.
1205 <item>The function is only available as fastcall function, so it may only be
1206 used in presence of a prototype.
1207 <item>The function produces undefined results if no extended memory driver is
1210 <tag/Availability/cc65
1212 <ref id="em_commit" name="em_commit">,
1213 <ref id="em_load_driver" name="em_load_driver">,
1214 <ref id="em_map" name="em_map">
1220 <sect1>exit<label id="exit"><p>
1224 <tag/Function/Terminate the program.
1225 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1226 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
1227 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
1228 return code of the program. Before termination, all files are closed, buffered
1229 output is written and any functions registered with <tt/<ref id="atexit"
1230 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
1231 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
1233 <tag/Limits/<itemize>
1234 <item>The function is only available as fastcall function, so it may only
1235 be used in presence of a prototype.
1236 <item>It depends on the host machine if the program return code can be
1237 evaluated or is ignored.
1239 <tag/Availability/ISO 9899
1241 <ref id="abort" name="abort">,
1242 <ref id="exit" name="exit">
1248 <sect1>fast<label id="fast"><p>
1252 <tag/Function/Switch the C128 into 2MHz mode.
1253 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1254 <tag/Declaration/<tt/void fast (void);/
1255 <tag/Description/The function will switch the clock of the C128 to 2MHz. This
1256 will nearly double the speed compared to slow mode.
1257 <tag/Limits/<itemize>
1258 <item>The function is specific to the C128.
1259 <item>2MHz clock will not work in 40 column mode.
1261 <tag/Availability/C128
1263 <ref id="slow" name="slow">,
1264 <ref id="toggle_videomode" name="toggle_videomode">
1270 <sect1>free<label id="free"><p>
1274 <tag/Function/Free a block of dynamic memory.
1275 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1276 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
1277 <tag/Description/Free a block of dynamic memory previously allocated with
1278 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
1279 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
1280 pointer is <tt/NULL/, no action is performed.
1283 <item>Passing an already free'd block to <tt/free/ again will cause undefined
1284 behaviour and may crash your program.
1285 <item>The function is only available as fastcall function, so it may only
1286 be used in presence of a prototype.
1288 <tag/Availability/ISO 9899
1290 <ref id="_heapadd" name="_heapadd">,
1291 <ref id="_heapmaxavail" name="_heapmaxavail">,
1292 <ref id="_heapmemavail" name="_heapmemavail">,
1293 <ref id="calloc" name="calloc">,
1294 <ref id="malloc" name="malloc">,
1295 <ref id="realloc" name="realloc">
1301 <sect1>getenv<label id="getenv"><p>
1305 <tag/Function/Return a value from the environment.
1306 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1307 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
1308 <tag/Description/The function searches the environment for an entry that
1309 matches <tt/name/ and returns its value. The environment consists of a list
1310 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
1312 <tag/Limits/<itemize>
1313 <item>What exactly is stored in the environment depends on the machine the
1314 program is running on.
1315 <item>The function is only available as fastcall function, so it may only
1316 be used in presence of a prototype.
1318 <tag/Availability/ISO 9899
1324 <sect1>getcpu<label id="getcpu"><p>
1328 <tag/Function/Determine on which CPU the program is running.
1329 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1330 <tag/Declaration/<tt/unsigned char getcpu (void);/
1331 <tag/Description/The function checks on which CPU the code is running. It
1332 returns one of the constants<itemize>
1334 <item><tt/CPU_65C02/
1335 <item><tt/CPU_65816/
1337 <tag/Limits/<itemize>
1338 <item>Other, more exotic CPU types are not disinguished.
1340 <tag/Availability/cc65
1346 <sect1>gotox<label id="gotox"><p>
1350 <tag/Function/Move the text mode cursor to a new X position.
1351 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1352 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
1353 <tag/Description/The function moves the text mode cursor to the specified X
1354 position while leaving the Y position untouched. The leftmost position on the
1355 screen has the coordinate 0.
1356 <tag/Limits/<itemize>
1357 <item>The function is only available as fastcall function, so it may
1358 only be used in presence of a prototype.
1359 <item>Invalid values for the X position (out of screen coordinates) may
1360 lead to undefined behaviour.
1362 <tag/Availability/cc65
1364 <ref id="gotoy" name="gotoy">,
1365 <ref id="gotoxy" name="gotoxy">,
1366 <ref id="wherex" name="wherex">,
1367 <ref id="wherey" name="wherey">
1373 <sect1>gotoxy<label id="gotoxy"><p>
1377 <tag/Function/Move the text mode cursor to a new position.
1378 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1379 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
1380 <tag/Description/The function moves the text mode cursor to the specified
1381 position. The leftmost position on the screen has the X coordinate 0, the
1382 topmost line has the Y coordinate 0.
1383 <tag/Limits/<itemize>
1384 <item>The function is only available as fastcall function, so it may only be
1385 used in presence of a prototype.
1386 <item>Invalid values for any of both coordinates (out of screen positions) may
1387 lead to undefined behaviour.
1389 <tag/Availability/cc65
1391 <ref id="gotox" name="gotox">,
1392 <ref id="gotoy" name="gotoy">,
1393 <ref id="wherex" name="wherex">,
1394 <ref id="wherey" name="wherey">
1400 <sect1>gotoy<label id="gotoy"><p>
1404 <tag/Function/Move the text mode cursor to a new Y position.
1405 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1406 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
1407 <tag/Description/The function moves the text mode cursor to the specified Y
1408 position while leaving the X position untouched. The uppermost position on the
1409 screen has the coordinate 0.
1410 <tag/Limits/<itemize>
1411 <item>The function is only available as fastcall function, so it may
1412 only be used in presence of a prototype.
1413 <item>Invalid values for the Y position (out of screen coordinates) may lead
1414 to undefined behaviour.
1416 <tag/Availability/cc65
1418 <ref id="gotox" name="gotox">,
1419 <ref id="gotoxy" name="gotoxy">,
1420 <ref id="wherex" name="wherex">,
1421 <ref id="wherey" name="wherey">
1427 <sect1>isalnum<label id="isalnum"><p>
1431 <tag/Function/Check if a given character is a letter or digit.
1432 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1433 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
1434 <tag/Description/The function returns a value of zero if the given argument
1435 is a letter or digit. The return value is non zero if the character
1437 <tag/Limits/<itemize>
1438 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1439 inline sequence generated by the macro will not work correctly for values
1440 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1441 this range. The non inline function may be accessed by <tt/#undef/'ing
1443 <item>When compiling without <tt/-Os/, the function is only available as
1444 fastcall function, so it may only be used in presence of a prototype.
1446 <tag/Availability/ISO 9899
1448 <ref id="isalpha" name="isalpha">,
1449 <ref id="isascii" name="isascii">,
1450 <ref id="isblank" name="isblank">,
1451 <ref id="iscntrl" name="iscntrl">,
1452 <ref id="isdigit" name="isdigit">,
1453 <ref id="isgraph" name="isgraph">,
1454 <ref id="islower" name="islower">,
1455 <ref id="isprint" name="isprint">,
1456 <ref id="ispunct" name="ispunct">,
1457 <ref id="isspace" name="isspace">,
1458 <ref id="isupper" name="isupper">,
1459 <ref id="isxdigit" name="isxdigit">
1465 <sect1>isalpha<label id="isalpha"><p>
1469 <tag/Function/Check if a given character is a letter.
1470 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1471 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
1472 <tag/Description/The function returns a value of zero if the given argument
1473 is a letter. The return value is non zero if the character is anything else.
1474 <tag/Limits/<itemize>
1475 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1476 inline sequence generated by the macro will not work correctly for values
1477 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1478 this range. The non inline function may be accessed by <tt/#undef/'ing the
1480 <item>When compiling without <tt/-Os/, the function is only available as
1481 fastcall function, so it may only be used in presence of a prototype.
1483 <tag/Availability/ISO 9899
1485 <ref id="isalnum" name="isalnum">,
1486 <ref id="isascii" name="isascii">,
1487 <ref id="isblank" name="isblank">,
1488 <ref id="iscntrl" name="iscntrl">,
1489 <ref id="isdigit" name="isdigit">,
1490 <ref id="isgraph" name="isgraph">,
1491 <ref id="islower" name="islower">,
1492 <ref id="isprint" name="isprint">,
1493 <ref id="ispunct" name="ispunct">,
1494 <ref id="isspace" name="isspace">,
1495 <ref id="isupper" name="isupper">,
1496 <ref id="isxdigit" name="isxdigit">
1502 <sect1>isascii<label id="isascii"><p>
1506 <tag/Function/Check if a given character is in the ASCII (0..127) range.
1507 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1508 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
1509 <tag/Description/The function returns a value of zero if the given argument
1510 is in the range 0..127 (the range of valid ASCII characters) and a non zero
1512 <tag/Limits/<itemize>
1513 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1514 inline sequence generated by the macro will not work correctly for values
1515 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1516 this range. The non inline function may be accessed by <tt/#undef/'ing the
1518 <item>When compiling without <tt/-Os/, the function is only available as
1519 fastcall function, so it may only be used in presence of a prototype.
1521 <tag/Availability/ISO 9899
1523 <ref id="isalnum" name="isalnum">,
1524 <ref id="isalpha" name="isalpha">,
1525 <ref id="isblank" name="isblank">,
1526 <ref id="iscntrl" name="iscntrl">,
1527 <ref id="isdigit" name="isdigit">,
1528 <ref id="isgraph" name="isgraph">,
1529 <ref id="islower" name="islower">,
1530 <ref id="isprint" name="isprint">,
1531 <ref id="ispunct" name="ispunct">,
1532 <ref id="isspace" name="isspace">,
1533 <ref id="isupper" name="isupper">,
1534 <ref id="isxdigit" name="isxdigit">
1540 <sect1>isblank<label id="isblank"><p>
1544 <tag/Function/Check if a given character is a space or tab.
1545 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1546 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
1547 <tag/Description/The function returns a value of zero if the given argument
1548 is a blank or space character. The return value is non zero if the character
1550 <tag/Limits/<itemize>
1551 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1552 inline sequence generated by the macro will not work correctly for values
1553 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1554 this range. The non inline function may be accessed by <tt/#undef/'ing the
1556 <item>When compiling without <tt/-Os/, the function is only available as
1557 fastcall function, so it may only be used in presence of a prototype.
1559 <tag/Availability/cc65
1561 <ref id="isalnum" name="isalnum">,
1562 <ref id="isalpha" name="isalpha">,
1563 <ref id="isascii" name="isascii">,
1564 <ref id="iscntrl" name="iscntrl">,
1565 <ref id="isdigit" name="isdigit">,
1566 <ref id="isgraph" name="isgraph">,
1567 <ref id="islower" name="islower">,
1568 <ref id="isprint" name="isprint">,
1569 <ref id="ispunct" name="ispunct">,
1570 <ref id="isspace" name="isspace">,
1571 <ref id="isupper" name="isupper">,
1572 <ref id="isxdigit" name="isxdigit">
1578 <sect1>iscntrl<label id="iscntrl"><p>
1582 <tag/Function/Check if a given character is a control character.
1583 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1584 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
1585 <tag/Description/The function returns a value of zero if the given argument
1586 is a control character. The return value is non zero if the character
1588 <tag/Limits/<itemize>
1589 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1590 inline sequence generated by the macro will not work correctly for values
1591 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1592 this range. The non inline function may be accessed by <tt/#undef/'ing the
1594 <item>When compiling without <tt/-Os/, the function is only available as
1595 fastcall function, so it may only be used in presence of a prototype.
1597 <tag/Availability/ISO 9899
1599 <ref id="isalnum" name="isalnum">,
1600 <ref id="isalpha" name="isalpha">,
1601 <ref id="isascii" name="isascii">,
1602 <ref id="isblank" name="isblank">,
1603 <ref id="isdigit" name="isdigit">,
1604 <ref id="isgraph" name="isgraph">,
1605 <ref id="islower" name="islower">,
1606 <ref id="isprint" name="isprint">,
1607 <ref id="ispunct" name="ispunct">,
1608 <ref id="isspace" name="isspace">,
1609 <ref id="isupper" name="isupper">,
1610 <ref id="isxdigit" name="isxdigit">
1616 <sect1>isdigit<label id="isdigit"><p>
1620 <tag/Function/Check if a given character is a digit.
1621 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1622 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
1623 <tag/Description/The function returns a value of zero if the given argument
1624 is a digit. The return value is non zero if the character is anything else.
1625 <tag/Limits/<itemize>
1626 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1627 inline sequence generated by the macro will not work correctly for values
1628 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1629 this range. The non inline function may be accessed by <tt/#undef/'ing the
1631 <item>When compiling without <tt/-Os/, the function is only available as
1632 fastcall function, so it may only be used in presence of a prototype.
1634 <tag/Availability/ISO 9899
1636 <ref id="isalnum" name="isalnum">,
1637 <ref id="isalpha" name="isalpha">,
1638 <ref id="isascii" name="isascii">,
1639 <ref id="isblank" name="isblank">,
1640 <ref id="iscntrl" name="iscntrl">,
1641 <ref id="isgraph" name="isgraph">,
1642 <ref id="islower" name="islower">,
1643 <ref id="isprint" name="isprint">,
1644 <ref id="ispunct" name="ispunct">,
1645 <ref id="isspace" name="isspace">,
1646 <ref id="isupper" name="isupper">,
1647 <ref id="isxdigit" name="isxdigit">
1653 <sect1>isgraph<label id="isgraph"><p>
1657 <tag/Function/Check if a given character is a printable character (except
1659 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1660 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
1661 <tag/Description/The function returns a value of zero if the given argument
1662 is a printable character with the exception of space. The return value is non
1663 zero if the character is anything else.
1664 <tag/Limits/<itemize>
1665 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1666 inline sequence generated by the macro will not work correctly for values
1667 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1668 this range. The non inline function may be accessed by <tt/#undef/'ing the
1670 <item>When compiling without <tt/-Os/, the function is only available as
1671 fastcall function, so it may only be used in presence of a prototype.
1673 <tag/Availability/ISO 9899
1675 <ref id="isalnum" name="isalnum">,
1676 <ref id="isalpha" name="isalpha">,
1677 <ref id="isascii" name="isascii">,
1678 <ref id="isblank" name="isblank">,
1679 <ref id="iscntrl" name="iscntrl">,
1680 <ref id="isdigit" name="isdigit">,
1681 <ref id="islower" name="islower">,
1682 <ref id="isprint" name="isprint">,
1683 <ref id="ispunct" name="ispunct">,
1684 <ref id="isspace" name="isspace">,
1685 <ref id="isupper" name="isupper">,
1686 <ref id="isxdigit" name="isxdigit">
1692 <sect1>islower<label id="islower"><p>
1696 <tag/Function/Check if a given character is a lower case letter.
1697 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1698 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
1699 <tag/Description/The function returns a value of zero if the given argument
1700 is a lower case letter. The return value is non zero if the character is
1702 <tag/Limits/<itemize>
1703 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1704 inline sequence generated by the macro will not work correctly for values
1705 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1706 this range. The non inline function may be accessed by <tt/#undef/'ing the
1708 <item>When compiling without <tt/-Os/, the function is only available as
1709 fastcall function, so it may only be used in presence of a prototype.
1711 <tag/Availability/ISO 9899
1713 <ref id="isalnum" name="isalnum">,
1714 <ref id="isalpha" name="isalpha">,
1715 <ref id="isascii" name="isascii">,
1716 <ref id="isblank" name="isblank">,
1717 <ref id="iscntrl" name="iscntrl">,
1718 <ref id="isdigit" name="isdigit">,
1719 <ref id="isgraph" name="isgraph">,
1720 <ref id="isprint" name="isprint">,
1721 <ref id="ispunct" name="ispunct">,
1722 <ref id="isspace" name="isspace">,
1723 <ref id="isupper" name="isupper">,
1724 <ref id="isxdigit" name="isxdigit">
1730 <sect1>isprint<label id="isprint"><p>
1734 <tag/Function/Check if a given character is a printable character.
1735 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1736 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
1737 <tag/Description/The function returns a value of zero if the given argument
1738 is a printable character (this includes the space character). The return value
1739 is non zero if the character is anything else.
1740 <tag/Limits/<itemize>
1741 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1742 inline sequence generated by the macro will not work correctly for values
1743 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1744 this range. The non inline function may be accessed by <tt/#undef/'ing the
1746 <item>When compiling without <tt/-Os/, the function is only available as
1747 fastcall function, so it may only be used in presence of a prototype.
1749 <tag/Availability/ISO 9899
1751 <ref id="isalnum" name="isalnum">,
1752 <ref id="isalpha" name="isalpha">,
1753 <ref id="isascii" name="isascii">,
1754 <ref id="isblank" name="isblank">,
1755 <ref id="iscntrl" name="iscntrl">,
1756 <ref id="isdigit" name="isdigit">,
1757 <ref id="isgraph" name="isgraph">,
1758 <ref id="islower" name="islower">,
1759 <ref id="ispunct" name="ispunct">,
1760 <ref id="isspace" name="isspace">,
1761 <ref id="isupper" name="isupper">,
1762 <ref id="isxdigit" name="isxdigit">
1768 <sect1>ispunct<label id="ispunct"><p>
1772 <tag/Function/Check if a given character is a printable character but not a
1773 space or an alphanumeric character.
1774 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1775 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
1776 <tag/Description/The function returns a value of zero if the given argument
1777 is a printable character, but not a space or anything alphanumeric. The return
1778 value is non zero if the character is anything else.
1779 <tag/Limits/<itemize>
1780 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1781 inline sequence generated by the macro will not work correctly for values
1782 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1783 this range. The non inline function may be accessed by <tt/#undef/'ing the
1785 <item>When compiling without <tt/-Os/, the function is only available as
1786 fastcall function, so it may only be used in presence of a prototype.
1788 <tag/Availability/ISO 9899
1790 <ref id="isalnum" name="isalnum">,
1791 <ref id="isalpha" name="isalpha">,
1792 <ref id="isascii" name="isascii">,
1793 <ref id="isblank" name="isblank">,
1794 <ref id="iscntrl" name="iscntrl">,
1795 <ref id="isdigit" name="isdigit">,
1796 <ref id="isgraph" name="isgraph">,
1797 <ref id="islower" name="islower">,
1798 <ref id="isprint" name="isprint">,
1799 <ref id="isspace" name="isspace">,
1800 <ref id="isupper" name="isupper">,
1801 <ref id="isxdigit" name="isxdigit">
1807 <sect1>isspace<label id="isspace"><p>
1811 <tag/Function/Check if a given character is a a white-space character.
1812 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1813 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
1814 <tag/Description/The function returns a value of zero if the given argument
1815 is a white space character. The return value is non zero if the character is
1816 anything else. The standard white space characters are: space, formfeed ('\f'),
1817 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
1819 <tag/Limits/<itemize>
1820 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1821 inline sequence generated by the macro will not work correctly for values
1822 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1823 this range. The non inline function may be accessed by <tt/#undef/'ing the
1825 <item>When compiling without <tt/-Os/, the function is only available as
1826 fastcall function, so it may only be used in presence of a prototype.
1828 <tag/Availability/ISO 9899
1830 <ref id="isalnum" name="isalnum">,
1831 <ref id="isalpha" name="isalpha">,
1832 <ref id="isascii" name="isascii">,
1833 <ref id="isblank" name="isblank">,
1834 <ref id="iscntrl" name="iscntrl">,
1835 <ref id="isdigit" name="isdigit">,
1836 <ref id="isgraph" name="isgraph">,
1837 <ref id="islower" name="islower">,
1838 <ref id="isprint" name="isprint">,
1839 <ref id="ispunct" name="ispunct">,
1840 <ref id="isupper" name="isupper">,
1841 <ref id="isxdigit" name="isxdigit">
1847 <sect1>isupper<label id="isupper"><p>
1851 <tag/Function/Check if a given character is an upper case letter.
1852 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1853 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
1854 <tag/Description/The function returns a value of zero if the given argument
1855 is an upper case letter. The return value is non zero if the character is
1857 <tag/Limits/<itemize>
1858 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1859 inline sequence generated by the macro will not work correctly for values
1860 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1861 this range. The non inline function may be accessed by <tt/#undef/'ing the
1863 <item>When compiling without <tt/-Os/, the function is only available as
1864 fastcall function, so it may only be used in presence of a prototype.
1866 <tag/Availability/ISO 9899
1868 <ref id="isalnum" name="isalnum">,
1869 <ref id="isalpha" name="isalpha">,
1870 <ref id="isascii" name="isascii">,
1871 <ref id="isblank" name="isblank">,
1872 <ref id="iscntrl" name="iscntrl">,
1873 <ref id="isdigit" name="isdigit">,
1874 <ref id="isgraph" name="isgraph">,
1875 <ref id="islower" name="islower">,
1876 <ref id="isprint" name="isprint">,
1877 <ref id="ispunct" name="ispunct">,
1878 <ref id="isspace" name="isspace">,
1879 <ref id="isxdigit" name="isxdigit">
1885 <sect1>isxdigit<label id="isxdigit"><p>
1889 <tag/Function/Check if a given character is a hexadecimal digit.
1890 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1891 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
1892 <tag/Description/The function returns a value of zero if the given argument
1893 is a hexadecimal digit (0..9, a..f and A..F). The return value is non zero
1894 if the character is anything else.
1895 <tag/Limits/<itemize>
1896 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1897 inline sequence generated by the macro will not work correctly for values
1898 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1899 this range. The non inline function may be accessed by <tt/#undef/'ing the
1901 <item>When compiling without <tt/-Os/, the function is only available as
1902 fastcall function, so it may only be used in presence of a prototype.
1904 <tag/Availability/ISO 9899
1906 <ref id="isalnum" name="isalnum">,
1907 <ref id="isalpha" name="isalpha">,
1908 <ref id="isascii" name="isascii">,
1909 <ref id="isblank" name="isblank">,
1910 <ref id="iscntrl" name="iscntrl">,
1911 <ref id="isdigit" name="isdigit">,
1912 <ref id="isgraph" name="isgraph">,
1913 <ref id="islower" name="islower">,
1914 <ref id="isprint" name="isprint">,
1915 <ref id="ispunct" name="ispunct">,
1916 <ref id="isspace" name="isspace">,
1917 <ref id="isupper" name="isupper">
1923 <sect1>itoa<label id="itoa"><p>
1927 <tag/Function/Convert an integer into a string.
1928 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1929 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
1930 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
1931 <tt/radix/ as the base.
1932 <tag/Limits/<itemize>
1933 <item>There are no provisions to prevent a buffer overflow.
1934 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
1935 <item>The function is non standard, so it is not available in strict ANSI mode.
1936 You should probably use <tt/sprintf/ instead.
1937 <item>The function is only available as fastcall function, so it may only be
1938 used in presence of a prototype.
1940 <tag/Availability/cc65
1942 <ref id="atoi" name="atoi">,
1943 <ref id="atol" name="atol">,
1944 <ref id="ltoa" name="ltoa">,
1945 <ref id="ultoa" name="ultoa">,
1946 <ref id="utoa" name="utoa">
1952 <sect1>kbhit<label id="kbhit"><p>
1956 <tag/Function/Check if there's a key waiting in the keyboard buffer.
1957 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1958 <tag/Declaration/<tt/unsigned char kbhit (void);/
1959 <tag/Description/The function returns a value of zero if there is no character
1960 waiting to be read from the keyboard. It returns non zero otherwise.
1961 <tag/Limits/<itemize>
1962 <item>If the system does not support a keyboard buffer (most systems
1963 do), the function is rather useless.
1965 <tag/Availability/cc65
1967 <ref id="cgetc" name="cgetc">,
1968 <ref id="cursor" name="cursor">
1974 <sect1>labs<label id="labs"><p>
1978 <tag/Function/Returns the absolute value of a long integer.
1979 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1980 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
1981 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
1983 <tag/Limits/<itemize>
1984 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
1985 <item>The function is only available as fastcall function, so it may only be
1986 used in presence of a prototype.
1988 <tag/Availability/ISO 9899
1990 <ref id="abs" name="abs">
1996 <sect1>ltoa<label id="ltoa"><p>
2000 <tag/Function/Convert a long integer into a string.
2001 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2002 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
2003 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
2004 using <tt/radix/ as the base.
2005 <tag/Limits/<itemize>
2006 <item>There are no provisions to prevent a buffer overflow.
2007 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
2008 <item>The function is non standard, so it is not available in strict ANSI mode.
2009 You should probably use <tt/sprintf/ instead.
2010 <item>The function is only available as fastcall function, so it may only be
2011 used in presence of a prototype.
2013 <tag/Availability/cc65
2015 <ref id="atoi" name="atoi">,
2016 <ref id="atol" name="atol">,
2017 <ref id="itoa" name="itoa">,
2018 <ref id="ultoa" name="ultoa">,
2019 <ref id="utoa" name="utoa">
2025 <sect1>malloc<label id="malloc"><p>
2029 <tag/Function/Allocate dynamic memory.
2030 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2031 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
2032 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
2033 pointer to the allocated memory block. On error (not enough memory available),
2034 <tt/malloc/ returns <tt/NULL/.
2037 <item>The function is only available as fastcall function, so it may only
2038 be used in presence of a prototype.
2040 <tag/Availability/ISO 9899
2042 <ref id="_heapadd" name="_heapadd">,
2043 <ref id="_heapmaxavail" name="_heapmaxavail">,
2044 <ref id="_heapmemavail" name="_heapmemavail">,
2045 <ref id="calloc" name="calloc">,
2046 <ref id="free" name="free">,
2047 <ref id="realloc" name="realloc">
2053 <sect1>memcpy<label id="memcpy"><p>
2057 <tag/Function/Copy a memory area.
2058 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2059 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
2060 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
2061 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
2065 <item>The result is undefined if the memory areas do overlap. Use
2066 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
2067 <item>The function is only available as fastcall function, so it may only
2068 be used in presence of a prototype.
2070 <tag/Availability/ISO 9899
2072 <ref id="_swap" name="_swap">,
2073 <ref id="memmove" name="memmove">,
2074 <ref id="memset" name="memset">
2080 <sect1>memmove<label id="memmove"><p>
2084 <tag/Function/Copy a memory area.
2085 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2086 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
2087 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
2088 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
2092 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
2093 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
2094 <item>The function is only available as fastcall function, so it may only
2095 be used in presence of a prototype.
2097 <tag/Availability/ISO 9899
2099 <ref id="_swap" name="_swap">,
2100 <ref id="memcpy" name="memcpy">,
2101 <ref id="memset" name="memset">
2107 <sect1>memset<label id="memset"><p>
2111 <tag/Function/Fill a memory area.
2112 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2113 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
2114 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
2115 the value <tt/val/. The function returns <tt/p/.
2118 <item>The function is only available as fastcall function, so it may only
2119 be used in presence of a prototype.
2121 <tag/Availability/ISO 9899
2123 <ref id="_swap" name="_swap">,
2124 <ref id="bzero" name="bzero">,
2125 <ref id="memcpy" name="memcpy">,
2126 <ref id="memmove" name="memmove">
2132 <sect1>open<label id="open"><p>
2136 <tag/Function/Open and possibly create a file.
2137 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2138 <tag/Declaration/<tt/int __fastcall__ open (const char* name, int flags, ...);/
2139 <tag/Description/<tt/open/ opens a file and returns the file descriptor
2140 associated with it. On error, -1 is returned and an error code is stored in
2141 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
2142 <tag/Limits/<itemize>
2143 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
2144 open, which is used as the permission mask when a new file is created. While
2145 cc65 allows to pass this argument, it is ignored.
2146 <item>The function is only available as fastcall function, so it may only
2147 be used in presence of a prototype.
2149 <tag/Availability/POSIX
2151 <ref id="close" name="close">,
2152 <ref id="creat" name="creat">
2158 <sect1>raise<label id="raise"><p>
2162 <tag/Function/Send a signal to the executing program.
2163 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
2164 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
2165 <tag/Description/<tt/raise/ sends the given signal to the program. If the
2166 program has installed a signal handler for the signal, this signal handler
2167 will be executed. If no handler has been installed, the default action for
2168 the raised signal will be taken. The function returns zero on success,
2170 <tag/Limits/<itemize>
2171 <item>The function is only available as fastcall function, so it may only
2172 be used in presence of a prototype.
2174 <tag/Availability/ISO 9899
2176 <ref id="abort" name="abort">,
2177 <ref id="signal" name="signal">
2183 <sect1>rand<label id="rand"><p>
2187 <tag/Function/Return a pseudo random number.
2188 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2189 <tag/Declaration/<tt/int rand (void);/
2190 <tag/Description/The function returns a pseudo random number
2191 between 0 and <tt/RAND_MAX/ (exclusive).
2192 <tag/Limits/<itemize>
2193 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
2194 flow of numbers is generated.
2195 <item>On startup, the function behaves as if <ref id="srand" name="srand">
2196 had been used with an argument of 1.
2198 <tag/Availability/ISO 9899
2200 <ref id="_randomize" name="_randomize">,
2201 <ref id="srand" name="srand">
2207 <sect1>realloc<label id="realloc"><p>
2211 <tag/Function/Change the size of an allocated memory block.
2212 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2213 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
2214 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
2215 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
2216 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
2217 behaves as if <tt/free/ had been called. On error (not enough memory
2218 available), <tt/realloc/ returns <tt/NULL/.
2221 <item>The part of the memory block that is returned will have its contents
2223 <item>This function is somewhat dangerous to use. Be careful to save the
2224 pointer you're passing somewhere else, otherwise
2226 ptr = realloc (ptr, size);
2228 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
2229 <item>The function is only available as fastcall function, so it may only
2230 be used in presence of a prototype.
2232 <tag/Availability/ISO 9899
2234 <ref id="_heapadd" name="_heapadd">,
2235 <ref id="_heapmaxavail" name="_heapmaxavail">,
2236 <ref id="_heapmemavail" name="_heapmemavail">,
2237 <ref id="calloc" name="calloc">,
2238 <ref id="free" name="free">,
2239 <ref id="realloc" name="realloc">
2245 <sect1>revers<label id="revers"><p>
2249 <tag/Function/Control revers character display.
2250 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2251 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
2252 <tag/Description/If the argument is non zero, the function enables reverse
2253 character display. If the argument is zero, reverse character display is
2254 switched off. The old value of the setting is returned.
2255 <tag/Limits/<itemize>
2256 <item>The function may not be supported by the hardware, in which case
2257 the call is ignored.
2258 <item>The function is only available as fastcall function, so it may only
2259 be used in presence of a prototype.
2261 <tag/Availability/cc65
2263 <ref id="textcolor" name="textcolor">
2269 <sect1>screensize<label id="screensize"><p>
2273 <tag/Function/Return the dimensions of the text mode screen.
2274 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2275 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
2276 <tag/Description/The function returns the dimensions of the text mode screen.
2277 <tag/Limits/<itemize>
2278 <item>The function is only available as fastcall function, so it may only
2279 be used in presence of a prototype.
2281 <tag/Availability/cc65
2283 <ref id="gotox" name="gotox">,
2284 <ref id="gotoxy" name="gotoxy">,
2285 <ref id="gotoy" name="gotoy">,
2286 <ref id="wherex" name="wherex">,
2287 <ref id="wherey" name="wherey">
2293 <sect1>signal<label id="signal"><p>
2297 <tag/Function/Install a signal handler.
2298 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
2299 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
2300 <tag/Description/<tt/signal/ installs a handler for the given signal. The
2301 handler may either be a user supplied function, or one of the predefined
2302 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
2303 previous value if the signal , or the special function vector SIG_ERR in
2305 <tag/Limits/<itemize>
2306 <item>The function is only available as fastcall function, so it may only
2307 be used in presence of a prototype.
2309 <tag/Availability/ISO 9899
2311 <ref id="abort" name="abort">,
2312 <ref id="raise" name="raise">
2318 <sect1>sleep<label id="sleep"><p>
2322 <tag/Function/Sleep for a specified amount of time.
2323 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
2324 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
2325 <tag/Description/The function will return after the specified number of
2326 seconds have elapsed.
2327 <tag/Limits/<itemize>
2328 <item>The function is only available as fastcall function, so it may only
2329 be used in presence of a prototype.
2331 <tag/Availability/POSIX
2337 <sect1>slow<label id="slow"><p>
2341 <tag/Function/Switch the C128 into 1MHz mode.
2342 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
2343 <tag/Declaration/<tt/void slow (void);/
2344 <tag/Description/The function will switch the clock of the C128 to 1MHz. This
2345 will halve the speed compared to fast mode.
2346 <tag/Limits/<itemize>
2347 <item>The function is specific to the C128.
2349 <tag/Availability/C128
2351 <ref id="fast" name="fast">,
2352 <ref id="toggle_videomode" name="toggle_videomode">
2358 <sect1>srand<label id="srand"><p>
2362 <tag/Function/Initialize the pseudo random number generator.
2363 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2364 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
2365 <tag/Description/The function initializes the random number generator using
2366 the given seed. On program startup, the generator behaves as if <tt/srand/ has
2367 been called with an argument of 1.
2368 <tag/Limits/<itemize>
2369 <item>The function is only available as fastcall function, so it may only
2370 be used in presence of a prototype.
2372 <tag/Availability/ISO 9899
2374 <ref id="_randomize" name="_randomize">,
2375 <ref id="rand" name="rand">
2381 <sect1>strcat<label id="strcat"><p>
2385 <tag/Function/Concatentate two strings.
2386 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2387 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
2388 <tag/Description/The <tt/strcat/ function appends a copy of the string
2389 pointed to by s2 (including the terminating null byte) to the end of the
2390 string pointed to by s1. The initial byte of s2 overwrites the null byte at
2392 <tag/Limits/<itemize>
2393 <item>The function is only available as fastcall function, so it may only
2394 be used in presence of a prototype.
2395 <item>If copying takes place between objects that overlap, the behavior
2398 <tag/Availability/ISO 9899
2400 <ref id="strcpy" name="strcpy">
2401 <ref id="strncpy" name="strncpy">
2407 <sect1>strchr<label id="strchr"><p>
2411 <tag/Function/Search for a character in a string.
2412 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2413 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
2414 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
2415 (converted to a char) in the string pointed to by <tt/s/. The terminating null
2416 byte is considered to be part of the string. Upon completion, the function
2417 returns a pointer to the byte, or a null pointer if the byte was not found.
2418 <tag/Limits/<itemize>
2419 <item>The function is only available as fastcall function, so it may only
2420 be used in presence of a prototype.
2422 <tag/Availability/ISO 9899
2424 <ref id="strrchr" name="strrchr">
2430 <sect1>strcpy<label id="strcpy"><p>
2434 <tag/Function/Copy a string.
2435 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2436 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
2437 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
2438 <tt/s2/ (including the terminating null byte) into the array pointed to by
2439 <tt/s1/. The function will always return <tt/s1/.
2440 <tag/Limits/<itemize>
2441 <item>The function is only available as fastcall function, so it may only
2442 be used in presence of a prototype.
2443 <item>If copying takes place between objects that overlap, the behavior
2446 <tag/Availability/ISO 9899
2448 <ref id="strcat" name="strcat">
2449 <ref id="strncpy" name="strncpy">
2454 static char hello[14];
2456 strcpy (hello, "Hello world!\n");
2462 <sect1>strlen<label id="strlen"><p>
2466 <tag/Function/Return the length of a string.
2467 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2468 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
2469 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
2470 string to which s points, not including the terminating null byte.
2471 <tag/Limits/<itemize>
2472 <item>The function is only available as fastcall function, so it may only
2473 be used in presence of a prototype.
2474 <item>When compiling with <tt/-Os/ (inline known standard functions), the
2475 function does not work correctly for strings with more than 255 characters.
2477 <tag/Availability/ISO 9899
2479 <ref id="strcpy" name="strcpy">
2485 <sect1>strlower<label id="strlower"><p>
2489 <tag/Function/Make a string lower case.
2490 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2491 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
2492 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
2493 function to each character of a string. The function will always return <tt/s/.
2494 <tag/Limits/<itemize>
2495 <item>The function is only available as fastcall function, so it may only
2496 be used in presence of a prototype.
2497 <item>The function prototype is unavailable when compiling in strict ANSI mode.
2498 <item>An alias name for this function is <tt/strlwr/.
2500 <tag/Availability/cc65
2502 <ref id="strupper" name="strupper">
2503 <ref id="tolower" name="tolower">
2509 <sect1>strlwr<label id="strlwr"><p>
2516 <sect1>strncpy<label id="strncpy"><p>
2520 <tag/Function/Copy part of a string.
2521 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2522 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2, size_t n);/
2523 <tag/Description/The <tt/strncpy/ function copies not more than n bytes from
2524 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
2525 pointed to by <tt/s2/ is a string that is shorter than n bytes, null bytes are
2526 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
2527 written. The function will always return <tt/s1/.
2528 <tag/Limits/<itemize>
2529 <item>The function is only available as fastcall function, so it may only
2530 be used in presence of a prototype. If there is no null byte in the first <tt/n/
2531 bytes of the array pointed to by <tt/s2/, the result is not null-terminated.
2532 <item>If copying takes place between objects that overlap, the behavior is
2535 <tag/Availability/ISO 9899
2537 <ref id="strcat" name="strcat">
2538 <ref id="strcpy" name="strcpy">
2543 static char hello[6];
2545 strcpy (hello, "Hello world!\n", sizeof (hello) - 1);
2552 <sect1>strrchr<label id="strrchr"><p>
2556 <tag/Function/Search for a character in a string.
2557 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2558 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
2559 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
2560 (converted to a char) in the string pointed to by <tt/s/. The terminating null
2561 byte is considered to be part of the string. Upon completion, the function
2562 returns a pointer to the byte, or a null pointer if the byte was not found.
2563 <tag/Limits/<itemize>
2564 <item>The function is only available as fastcall function, so it may only
2565 be used in presence of a prototype.
2567 <tag/Availability/ISO 9899
2569 <ref id="strchr" name="strchr">
2575 <sect1>strupper<label id="strupper"><p>
2579 <tag/Function/Make a string upper case.
2580 <tag/Header/<tt/<ref id="string.h" name="string.h">/
2581 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
2582 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
2583 function to each character of a string. The function will always return <tt/s/.
2584 <tag/Limits/<itemize>
2585 <item>The function is only available as fastcall function, so it may only
2586 be used in presence of a prototype.
2587 <item>The function prototype is unavailable when compiling in strict ANSI mode.
2588 <item>An alias name for this function is <tt/strupr/.
2590 <tag/Availability/cc65
2592 <ref id="strlower" name="strlower">
2593 <ref id="toupper" name="toupper">
2599 <sect1>strupr<label id="strupr"><p>
2606 <sect1>textcolor<label id="textcolor"><p>
2610 <tag/Function/Set the text color.
2611 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2612 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
2613 <tag/Description/The function will set a new text color. It returns the old
2614 (current) text color. Text output using any <tt/conio.h/ function will use
2615 the color set by this function.
2616 <tag/Limits/<itemize>
2617 <item>Text colors are system dependent. The function may have no effect
2618 on systems where the text color cannot be changed.
2619 <item>The function is only available as fastcall function, so it may only
2620 be used in presence of a prototype.
2622 <tag/Availability/cc65
2624 <ref id="bgcolor" name="bgcolor">,
2625 <ref id="bordercolor" name="bordercolor">
2631 <sect1>toggle_videomode<label id="toggle_videomode"><p>
2635 <tag/Function/Toggle between 40 and 80 column mode.
2636 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
2637 <tag/Declaration/<tt/void toggle_videomode (void);/
2638 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
2639 old mode (cursor position, color and so on) are saved and restored together
2641 <tag/Limits/<itemize>
2642 <item>The function is specific to the C128.
2644 <tag/Availability/C128
2646 <ref id="fast" name="fast">,
2647 <ref id="slow" name="slow">
2653 <sect1>tolower<label id="tolower"><p>
2657 <tag/Function/Convert a character into its lower case representation.
2658 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2659 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
2660 <tag/Description/The function returns the given character converted to lower
2661 case. If the given character is not a letter, it is returned unchanged.
2662 <tag/Limits/<itemize>
2663 <item>The function is only available as fastcall function, so it may
2664 only be used in presence of a prototype.
2666 <tag/Availability/ISO 9899
2668 <ref id="islower" name="islower">,
2669 <ref id="isupper" name="isupper">,
2670 <ref id="toupper" name="toupper">
2676 <sect1>toupper<label id="toupper"><p>
2680 <tag/Function/Convert a character into its upper case representation.
2681 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2682 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
2683 <tag/Description/The function returns the given character converted to upper
2684 case. If the given character is not a letter, it is returned unchanged.
2685 <tag/Limits/<itemize>
2686 <item>The function is only available as fastcall function, so it may
2687 only be used in presence of a prototype.
2689 <tag/Availability/ISO 9899
2691 <ref id="islower" name="islower">,
2692 <ref id="isupper" name="isupper">,
2693 <ref id="tolower" name="tolower">
2699 <sect1>ultoa<label id="ultoa"><p>
2703 <tag/Function/Convert an unsigned long integer into a string.
2704 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2705 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
2706 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
2707 string using <tt/radix/ as the base.
2708 <tag/Limits/<itemize>
2709 <item>There are no provisions to prevent a buffer overflow.
2710 <item>The function is non standard, so it is not available in strict ANSI mode.
2711 You should probably use <tt/sprintf/ instead.
2712 <item>The function is only available as fastcall function, so it may only be
2713 used in presence of a prototype.
2715 <tag/Availability/cc65
2717 <ref id="atoi" name="atoi">,
2718 <ref id="atol" name="atol">,
2719 <ref id="itoa" name="itoa">,
2720 <ref id="ltoa" name="ltoa">,
2721 <ref id="utoa" name="utoa">
2727 <sect1>utoa<label id="utoa"><p>
2731 <tag/Function/Convert an unsigned integer into a string.
2732 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2733 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
2734 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
2735 using <tt/radix/ as the base.
2736 <tag/Limits/<itemize>
2737 <item>There are no provisions to prevent a buffer overflow.
2738 <item>The function is non standard, so it is not available in strict ANSI mode.
2739 You should probably use <tt/sprintf/ instead.
2740 <item>The function is only available as fastcall function, so it may only be
2741 used in presence of a prototype.
2743 <tag/Availability/cc65
2745 <ref id="atoi" name="atoi">,
2746 <ref id="atol" name="atol">,
2747 <ref id="itoa" name="itoa">,
2748 <ref id="ltoa" name="ltoa">,
2749 <ref id="ultoa" name="ultoa">
2755 <sect1>wherex<label id="wherex"><p>
2759 <tag/Function/Return the current X position of the text mode cursor.
2760 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2761 <tag/Declaration/<tt/unsigned char wherex (void);/
2762 <tag/Description/The function returns the current X position of the text mode
2763 cursor. Zero is returned for the leftmost screen position.
2764 <tag/Availability/cc65
2766 <ref id="gotox" name="gotox">,
2767 <ref id="gotoy" name="gotoy">,
2768 <ref id="gotoxy" name="gotoxy">,
2769 <ref id="wherey" name="wherey">
2775 <sect1>wherey<label id="wherey"><p>
2779 <tag/Function/Return the current Y position of the text mode cursor.
2780 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2781 <tag/Declaration/<tt/unsigned char wherey (void);/
2782 <tag/Description/The function returns the current Y position of the text mode
2783 cursor. Zero is returned for the uppermost screen position.
2784 <tag/Availability/cc65
2786 <ref id="gotox" name="gotox">,
2787 <ref id="gotoy" name="gotoy">,
2788 <ref id="gotoxy" name="gotoxy">,
2789 <ref id="wherex" name="wherex">