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 available C functions supplied by the 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/stdlib.h/<label id="stdlib.h"><p>
152 <!-- <item><ref id="_heapadd" name="_heapadd"> -->
153 <!-- <item><ref id="_heapmaxavail" name="_heapmaxavail"> -->
154 <!-- <item><ref id="_heapmemavail" name="_heapmemavail"> -->
155 <item><ref id="_randomize" name="_randomize">
156 <!-- <item><ref id="_swap" name="_swap"> -->
157 <item><ref id="abort" name="abort">
158 <item><ref id="abs" name="abs">
159 <item><ref id="atexit" name="atexit">
160 <!-- <item><ref id="atoi" name="atoi"> -->
161 <!-- <item><ref id="atol" name="atol"> -->
162 <!-- <item><ref id="bsearch" name="bsearch"> -->
163 <!-- <item><ref id="calloc" name="calloc"> -->
164 <!-- <item><ref id="div" name="div"> -->
165 <item><ref id="exit" name="exit">
166 <!-- <item><ref id="free" name="free"> -->
167 <!-- <item><ref id="getenv" name="getenv"> -->
168 <!-- <item><ref id="itoa" name="itoa"> -->
169 <item><ref id="labs" name="labs">
170 <!-- <item><ref id="ltoa" name="ltoa"> -->
171 <!-- <item><ref id="malloc" name="malloc"> -->
172 <!-- <item><ref id="qsort" name="qsort"> -->
173 <item><ref id="rand" name="rand">
174 <!-- <item><ref id="realloc" name="realloc"> -->
175 <item><ref id="srand" name="srand">
176 <!-- <item><ref id="ultoa" name="ultoa"> -->
177 <!-- <item><ref id="utoa" name="utoa"> -->
181 <sect1><tt/string.h/<label id="string.h"><p>
184 <item><ref id="strcat" name="strcat">
185 <item><ref id="strchr" name="strchr">
186 <item><ref id="strcpy" name="strcpy">
187 <item><ref id="strlen" name="strlen">
188 <item><ref id="strlower" name="strlower">
189 <item><ref id="strlwr" name="strlwr">
190 <item><ref id="strncpy" name="strncpy">
191 <item><ref id="strrchr" name="strrchr">
192 <item><ref id="strupper" name="strupper">
193 <item><ref id="strupr" name="strupr">
199 <sect>Alphabetical function reference<p>
201 <sect1>_randomize<label id="_randomize"><p>
205 <tag/Function/Initialize the pseudo random number generator.
206 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
207 <tag/Declaration/<tt/void _randomize (void);/
208 <tag/Description/The function initializes the random number generator with
209 a seed derived from fast changing hardware events, so the seed itself can be
210 considered random to a certain degree.
211 <tag/Limits/<itemize>
212 <item>The randomness of the seed depends on the machine hardware.
214 <tag/Availability/cc65
216 <ref id="rand" name="rand">,
217 <ref id="srand" name="srand">
223 <sect1>_sys<label id="_sys"><p>
227 <tag/Function/Call a subroutine passing register values.
228 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
229 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
230 <tag/Description/The function will call the subroutine at the address
231 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
232 registers and the CPU flags are set to the values given in the <tt/regs/
233 structure. On return from the subroutine, the new values of the registers and
234 flags are stored back overwriting the old values.
235 <tag/Limits/<itemize>
236 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
237 when calling the subroutine (they are unchanged from their current values).
238 <item>The function is only available as fastcall function, so it may only be
239 used in presence of a prototype.
241 <tag/Availability/cc65
247 <sect1>BRK<label id="BRK"><p>
251 <tag/Function/Insert a 6502 BRK instrunction into the code.
252 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
253 <tag/Declaration/<tt/void BRK (void);/
254 <tag/Description/The function will insert a 6502 BRK instruction into the code
255 which may be used to trigger a debugger.
256 <tag/Limits/<itemize>
257 <item>The function is actually a macro.
258 <item>The inserted instruction may lead to unexpected results if no debugger
261 <tag/Availability/cc65
263 <ref id="CLI" name="CLI">,
264 <ref id="SEI" name="SEI">
270 <sect1>CLI<label id="CLI"><p>
274 <tag/Function/Insert a 6502 CLI instrunction into the code.
275 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
276 <tag/Declaration/<tt/void CLI (void);/
277 <tag/Description/The function will insert a 6502 CLI instruction into the code,
278 so interrupts are disabled. Note that non maskable interrupts cannot be
280 <tag/Limits/<itemize>
281 <item>The function is actually a macro.
282 <item>Disabling interrupts may lead to unexpected results.
284 <tag/Availability/cc65
286 <ref id="BRK" name="BRK">,
287 <ref id="SEI" name="SEI">
293 <sect1>SEI<label id="SEI"><p>
297 <tag/Function/Insert a 6502 SEI instrunction into the code.
298 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
299 <tag/Declaration/<tt/void SEI (void);/
300 <tag/Description/The function will insert a 6502 SEI instruction into the code,
301 so interrupts are enabled. Enabling interrupts has no effects if they are
302 already enabled (the default).
303 <tag/Limits/<itemize>
304 <item>The function is actually a macro.
306 <tag/Availability/cc65
308 <ref id="BRK" name="BRK">,
309 <ref id="CLI" name="CLI">
315 <sect1>abort<label id="abort"><p>
319 <tag/Function/Terminates a program abnormally.
320 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
321 <tag/Declaration/<tt/void abort (void);/
322 <tag/Description/<tt/abort/ writes a termination message on stderr, then
323 terminates the program with an exit code of 3.
324 <tag/Availability/ISO 9899
326 <ref id="assert" name="assert">,
327 <ref id="exit" name="exit">
333 <sect1>abs<label id="abs"><p>
337 <tag/Function/Returns the absolute value of an integer.
338 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
339 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
340 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
342 <tag/Limits/<itemize>
343 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
344 <item>The function is only available as fastcall function, so it may only be
345 used in presence of a prototype.
347 <tag/Availability/ISO 9899
349 <ref id="labs" name="labs">
355 <sect1>assert<label id="assert"><p>
359 <tag/Function/Test a condition and possibly abort.
360 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
361 <tag/Declaration/<tt/void assert (int cond);/
362 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
363 statement. If the condition evaluates t zero (false), assert prints a message
364 on stderr and aborts the program.
365 <tag/Limits/<itemize>
366 <item>The function is actually a macro.
368 <tag/Availability/ISO 9899
370 <ref id="abort" name="abort">,
371 <ref id="exit" name="exit">
377 <sect1>atexit<label id="atexit"><p>
381 <tag/Function/Register an exit function.
382 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
383 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
384 <tag/Description/<tt/atexit/ registers the function pointed to by
385 <tt/exitfunc/ as an exit function. Exit functions are called when the program
386 terminates, they are called in LIFO order (the last function registered is
387 called first). <tt/atexit/ returns zero on success and a nonzero value on
389 <tag/Limits/<itemize>
390 <item>A maximum of 5 exit functions can be registered.
391 <item>There is no way to unregister an exit function.
392 <item>The function is only available as fastcall function, so it may only be
393 used in presence of a prototype.
395 <tag/Availability/ISO 9899
397 <ref id="abort" name="abort">,
398 <ref id="exit" name="exit">
404 <sect1>bgcolor<label id="bgcolor"><p>
408 <tag/Function/Set the background text color.
409 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
410 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
411 <tag/Description/The function will set a new background text color. It returns
412 the old (current) background color.
413 <tag/Limits/<itemize>
414 <item>Background colors are system dependent. The function may have no effect
415 on systems where the background color cannot be changed.
416 <item>The function is only available as fastcall function, so it may only be
417 used in presence of a prototype.
419 <tag/Availability/cc65
421 <ref id="bordercolor" name="bordercolor">,
422 <ref id="textcolor" name="textcolor">
428 <sect1>bordercolor<label id="bordercolor"><p>
432 <tag/Function/Set the border (frame) color.
433 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
434 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
435 <tag/Description/The function will set a new border color. It returns the old
436 (current) border color.
437 <tag/Limits/<itemize>
438 <item>Border colors are system dependent. The function may have no effect
439 on systems where the border color cannot be changed.
440 <item>The function is only available as fastcall function, so it may only
441 be used in presence of a prototype.
443 <tag/Availability/cc65
445 <ref id="bgcolor" name="bgcolor">,
446 <ref id="textcolor" name="textcolor">
452 <sect1>c64mode<label id="c64mode"><p>
456 <tag/Function/Switch the C128 into C64 compatible mode.
457 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
458 <tag/Declaration/<tt/void c64mode (void);/
459 <tag/Description/The function will cause the machine to reboot into C64 mode.
460 <tag/Limits/<itemize>
461 <item>The function is specific to the C128.
462 <item>The function will not return to the caller.
464 <tag/Availability/C128
470 <sect1>cclear<label id="cclear"><p>
474 <tag/Function/Clear part of a line (write a given amount of spaces).
475 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
476 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
477 <tag/Description/The function clears part of a line by writing <tt/length/
478 spaces in the current text color.
479 <tag/Limits/<itemize>
480 <item>The function is only available as fastcall function, so it may
481 only be used in presence of a prototype.
483 <tag/Availability/cc65
485 <ref id="cclearxy" name="cclearxy">,
486 <ref id="clrscr" name="clrscr">
492 <sect1>cclearxy<label id="cclearxy"><p>
496 <tag/Function/Clear part of a line (write a given amount of spaces) starting
497 at a specific screen position.
498 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
499 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char length);/
500 <tag/Description/The function moves the cursor to a specific position, and
501 will then clear part of the line by writing <tt/length/ spaces in the current
503 <tag/Limits/<itemize>
504 <item>The function is only available as fastcall function, so it may
505 only be used in presence of a prototype.
507 <tag/Availability/cc65
509 <ref id="cclear" name="cclear">,
510 <ref id="clrscr" name="clrscr">
516 <sect1>cgetc<label id="cgetc"><p>
520 <tag/Function/Read a character from the keyboard.
521 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
522 <tag/Declaration/<tt/char cgetc (void);/
523 <tag/Description/The function reads a character from the keyboard. If there is
524 no character available, <tt/cgetc/ waits until the user presses a key. If the
525 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
526 displayed while waiting.
527 <tag/Limits/<itemize>
528 <item>If the system supports a keyboard buffer, <tt/cgetc/ will fetch a key
529 from this buffer and wait only if the buffer is empty.
531 <tag/Availability/cc65
533 <ref id="cursor" name="cursor">,
534 <ref id="kbhit" name="kbhit">
540 <sect1>chline<label id="chline"><p>
544 <tag/Function/Output a horizontal line in text mode.
545 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
546 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
547 <tag/Description/The function outputs a horizontal line with the given length
548 starting at the current cursor position.
549 <tag/Limits/<itemize>
550 <item>The character used to draw the horizontal line is system dependent.
551 If available, a line drawing character is used. Drawing a line that is partially
552 off screen leads to undefined behaviour.
553 <item>The function is only available as fastcall function, so it may only be
554 used in presence of a prototype.
556 <tag/Availability/cc65
558 <ref id="chlinexy" name="chlinexy">,
559 <ref id="cvline" name="cvline">,
560 <ref id="cvlinexy" name="cvlinexy">
566 <sect1>chlinexy<label id="chlinexy"><p>
570 <tag/Function/Output a horizontal line at a given position in text mode.
571 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
572 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
573 <tag/Description/The function outputs a horizontal line with the given length
574 starting at a given position.
575 <tag/Limits/<itemize>
576 <item>The character used to draw the horizontal line is system dependent.
577 If available, a line drawing character is used. Drawing a line that is partially
578 off screen leads to undefined behaviour.
579 <item>The function is only available as fastcall function, so it may only be
580 used in presence of a prototype.
582 <tag/Availability/cc65
584 <ref id="chline" name="chline">,
585 <ref id="cvline" name="cvline">,
586 <ref id="cvlinexy" name="cvlinexy">
592 <sect1>clrscr<label id="clrscr"><p>
596 <tag/Function/Clear the text screen.
597 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
598 <tag/Declaration/<tt/void clrscr (void);/
599 <tag/Description/The function clears the text screen and moves the cursor to
600 the upper left corner.
601 <tag/Availability/cc65
603 <ref id="cclear" name="cclear">,
604 <ref id="cclearxy" name="cclearxy">
610 <sect1>cursor<label id="cursor"><p>
614 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
615 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
616 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
617 <tag/Description/If the argument to the function is non zero, a blinking cursor
618 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
619 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
620 <tag/Limits/<itemize>
621 <item>The function is only available as fastcall function, so it may only
622 be used in presence of a prototype.
624 <tag/Availability/cc65
626 <ref id="cgetc" name="cgetc">,
627 <ref id="kbhit" name="kbhit">
633 <sect1>cvline<label id="cvline"><p>
637 <tag/Function/Output a vertical line in text mode.
638 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
639 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
640 <tag/Description/The function outputs a vertical line with the given length
641 starting at the current cursor position.
642 <tag/Limits/<itemize>
643 <item>The character used to draw the vertical line is system dependent.
644 If available, a line drawing character is used. Drawing a line that is partially
645 off screen leads to undefined behaviour.
646 <item>The function is only available as fastcall function, so it may only be
647 used in presence of a prototype.
649 <tag/Availability/cc65
651 <ref id="chline" name="chline">,
652 <ref id="chlinexy" name="chlinexy">,
653 <ref id="cvlinexy" name="cvlinexy">
659 <sect1>cvlinexy<label id="cvlinexy"><p>
663 <tag/Function/Output a vertical line at a given position in text mode.
664 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
665 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
666 <tag/Description/The function outputs a vertical line with the given length
667 starting at a given position.
668 <tag/Limits/<itemize>
669 <item>The character used to draw the vertical line is system dependent.
670 If available, a line drawing character is used. Drawing a line that is partially
671 off screen leads to undefined behaviour.
672 <item>The function is only available as fastcall function, so it may only be
673 used in presence of a prototype.
675 <tag/Availability/cc65
677 <ref id="chline" name="chline">,
678 <ref id="chlinexy" name="chlinexy">,
679 <ref id="cvline" name="cvline">
685 <sect1>em_commit<label id="em_commit"><p>
689 <tag/Function/Commit changes into extended memory.
690 <tag/Header/<tt/<ref id="em.h" name="em.h">/
691 <tag/Declaration/<tt/void __fastcall__ em_commit (void);/
692 <tag/Description/Commit changes in the memory window to extended storage. If
693 the contents of the memory window have been changed, these changes may be lost
694 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
695 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
696 name="em_copyto">/ are called without calling <tt/em_commit/ first.
697 <tag/Limits/<itemize>
698 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
699 memory window are discarded, it does just mean that the drivers is allowed
701 <item>The function is only available as fastcall function, so it may only be
702 used in presence of a prototype.
703 <item>The function produces undefined results if no extended memory driver is
706 <tag/Availability/cc65
708 <ref id="em_load_driver" name="em_load_driver">,
709 <ref id="em_map" name="em_map">,
710 <ref id="em_use" name="em_use">
716 <sect1>em_copyfrom<label id="em_copyfrom"><p>
720 <tag/Function/Copy from extended into normal memory.
721 <tag/Header/<tt/<ref id="em.h" name="em.h">/
722 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
723 <tag/Description/Copy data from extended memory into linear memory. Source and
724 target addresses as well as the number of bytes to transfer are specified in
725 the <tt/em_copy/ structure that is passed as a parameter.
726 <tag/Limits/<itemize>
727 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
728 made any changes to the data in the window, call <tt/<ref id="em_commit"
729 name="em_commit">/ first, or the changes are lost.
730 <item>The function is only available as fastcall function, so it may only be
731 used in presence of a prototype.
732 <item>The function produces undefined results if no extended memory driver is
735 <tag/Availability/cc65
737 <ref id="em_commit" name="em_commit">,
738 <ref id="em_copyto" name="em_copyto">,
739 <ref id="em_load_driver" name="em_load_driver">
745 <sect1>em_copyto<label id="em_copyto"><p>
749 <tag/Function/Copy from normal into extended memory.
750 <tag/Header/<tt/<ref id="em.h" name="em.h">/
751 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
752 <tag/Description/Copy data from linear into extended memory. Source and
753 target addresses as well as the number of bytes to transfer are specified in
754 the <tt/em_copy/ structure that is passed as a parameter.
755 <tag/Limits/<itemize>
756 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
757 made any changes to the data in the window, call <tt/<ref id="em_commit"
758 name="em_commit">/ first, or the changes are lost.
759 <item>The function is only available as fastcall function, so it may only be
760 used in presence of a prototype.
761 <item>The function produces undefined results if no extended memory driver is
764 <tag/Availability/cc65
766 <ref id="em_commit" name="em_commit">,
767 <ref id="em_copyfrom" name="em_copyfrom">,
768 <ref id="em_load_driver" name="em_load_driver">
774 <sect1>em_load_driver<label id="em_load_driver"><p>
778 <tag/Function/Load and initialize an extended memory driver.
779 <tag/Header/<tt/<ref id="em.h" name="em.h">/
780 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
781 <tag/Description/Load an extended memory driver into memory and initialize
782 it. The function returns an error code that tells if all this has been
784 <tag/Limits/<itemize>
785 <item>Not all drivers are able to detect if the supported hardware is really
787 <item>The function is only available as fastcall function, so it may only be
788 used in presence of a prototype.
789 <item>The driver is loaded by name, so currently you must know the type of
790 extended memory that should be supported. There is no autodetect capability.
792 <tag/Availability/cc65
794 <ref id="em_unload" name="em_unload">
800 <sect1>em_map<label id="em_map"><p>
804 <tag/Function/Make a page of extended memory accessible.
805 <tag/Header/<tt/<ref id="em.h" name="em.h">/
806 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
807 <tag/Description/The function maps one page of extended memory into linear
808 memory and returns a pointer to the page frame. Depending on the hardware
809 and driver, the data is either mapped into the address space or transfered
810 into a buffer. If you don't need the actual contents of the page (for example
811 because you're going to overwrite it completely, it is better to call
812 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
813 data if it is possible to avoid that.
814 <tag/Limits/<itemize>
815 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
816 made any changes to the data in the window, call <tt/<ref id="em_commit"
817 name="em_commit">/ first, or the changes are lost.
818 <item>The function is only available as fastcall function, so it may only be
819 used in presence of a prototype.
820 <item>The function produces undefined results if no extended memory driver is
823 <tag/Availability/cc65
825 <ref id="em_commit" name="em_commit">,
826 <ref id="em_load_driver" name="em_load_driver">,
827 <ref id="em_use" name="em_use">
833 <sect1>em_pagecount<label id="em_pagecount"><p>
837 <tag/Function/Return the number of available extended memory pages.
838 <tag/Header/<tt/<ref id="em.h" name="em.h">/
839 <tag/Declaration/<tt/unsigned __fastcall__ em_pagecount (void);/
840 <tag/Description/The function returns the size of the extended memory supported
841 by the driver in 256 byte pages.
842 <tag/Limits/<itemize>
843 <item>The function returns zero if no extended memory driver is loaded.
844 <item>The function may return zero if the supported hardware was not detected.
846 <tag/Availability/cc65
848 <ref id="em_load_driver" name="em_load_driver">
854 <sect1>em_unload<label id="em_unload"><p>
858 <tag/Function/Unload an extended memory driver.
859 <tag/Header/<tt/<ref id="em.h" name="em.h">/
860 <tag/Declaration/<tt/void __fastcall__ em_unload (void);/
861 <tag/Description/The function unloads a loaded extended memory driver and
862 frees all memory allocated for the driver.
863 <tag/Limits/<itemize>
864 <item>The function does nothing if no driver is loaded.
866 <tag/Availability/cc65
868 <ref id="em_load_driver" name="em_load_driver">
874 <sect1>em_use<label id="em_use"><p>
878 <tag/Function/Prepare an extended memory page for use.
879 <tag/Header/<tt/<ref id="em.h" name="em.h">/
880 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
881 <tag/Description/The function maps one page of extended memory into linear
882 memory and returns a pointer to the page frame. This function is similar to
883 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
884 actual memory window in the assumption that the existing data is wrong or
885 will get overwritten.
886 <tag/Limits/<itemize>
887 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
888 made any changes to the data in the window, call <tt/<ref id="em_commit"
889 name="em_commit">/ first, or the changes are lost.
890 <item>The function is only available as fastcall function, so it may only be
891 used in presence of a prototype.
892 <item>The function produces undefined results if no extended memory driver is
895 <tag/Availability/cc65
897 <ref id="em_commit" name="em_commit">,
898 <ref id="em_load_driver" name="em_load_driver">,
899 <ref id="em_map" name="em_map">
905 <sect1>exit<label id="exit"><p>
909 <tag/Function/Terminate the program.
910 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
911 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
912 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
913 return code of the program. Before termination, all files are closed, buffered
914 output is written and any functions registered with <tt/<ref id="atexit"
915 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
916 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
918 <tag/Limits/<itemize>
919 <item>The function is only available as fastcall function, so it may only
920 be used in presence of a prototype.
921 <item>It depends on the host machine if the program return code can be
922 evaluated or is ignored.
924 <tag/Availability/ISO 9899
926 <ref id="abort" name="abort">,
927 <ref id="exit" name="exit">
933 <sect1>fast<label id="fast"><p>
937 <tag/Function/Switch the C128 into 2MHz mode.
938 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
939 <tag/Declaration/<tt/void fast (void);/
940 <tag/Description/The function will switch the clock of the C128 to 2MHz. This
941 will nearly double the speed compared to slow mode.
942 <tag/Limits/<itemize>
943 <item>The function is specific to the C128.
944 <item>2MHz clock will not work in 40 column mode.
946 <tag/Availability/C128
948 <ref id="slow" name="slow">,
949 <ref id="toggle_videomode" name="toggle_videomode">
955 <sect1>getcpu<label id="getcpu"><p>
959 <tag/Function/Determine on which CPU the program is running.
960 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
961 <tag/Declaration/<tt/unsigned char getcpu (void);/
962 <tag/Description/The function checks on which CPU the code is running. It
963 returns one of the constants<itemize>
968 <tag/Limits/<itemize>
969 <item>Other, more exotic CPU types are not disinguished.
971 <tag/Availability/cc65
977 <sect1>gotox<label id="gotox"><p>
981 <tag/Function/Move the text mode cursor to a new X position.
982 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
983 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
984 <tag/Description/The function moves the text mode cursor to the specified X
985 position while leaving the Y position untouched. The leftmost position on the
986 screen has the coordinate 0.
987 <tag/Limits/<itemize>
988 <item>The function is only available as fastcall function, so it may
989 only be used in presence of a prototype.
990 <item>Invalid values for the X position (out of screen coordinates) may
991 lead to undefined behaviour.
993 <tag/Availability/cc65
995 <ref id="gotoy" name="gotoy">,
996 <ref id="gotoxy" name="gotoxy">,
997 <ref id="wherex" name="wherex">,
998 <ref id="wherey" name="wherey">
1004 <sect1>gotoxy<label id="gotoxy"><p>
1008 <tag/Function/Move the text mode cursor to a new position.
1009 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1010 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
1011 <tag/Description/The function moves the text mode cursor to the specified
1012 position. The leftmost position on the screen has the X coordinate 0, the
1013 topmost line has the Y coordinate 0.
1014 <tag/Limits/<itemize>
1015 <item>The function is only available as fastcall function, so it may only be
1016 used in presence of a prototype.
1017 <item>Invalid values for any of both coordinates (out of screen positions) may
1018 lead to undefined behaviour.
1020 <tag/Availability/cc65
1022 <ref id="gotox" name="gotox">,
1023 <ref id="gotoy" name="gotoy">,
1024 <ref id="wherex" name="wherex">,
1025 <ref id="wherey" name="wherey">
1031 <sect1>gotoy<label id="gotoy"><p>
1035 <tag/Function/Move the text mode cursor to a new Y position.
1036 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1037 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
1038 <tag/Description/The function moves the text mode cursor to the specified Y
1039 position while leaving the X position untouched. The uppermost position on the
1040 screen has the coordinate 0.
1041 <tag/Limits/<itemize>
1042 <item>The function is only available as fastcall function, so it may
1043 only be used in presence of a prototype.
1044 <item>Invalid values for the Y position (out of screen coordinates) may lead
1045 to undefined behaviour.
1047 <tag/Availability/cc65
1049 <ref id="gotox" name="gotox">,
1050 <ref id="gotoxy" name="gotoxy">,
1051 <ref id="wherex" name="wherex">,
1052 <ref id="wherey" name="wherey">
1058 <sect1>isalnum<label id="isalnum"><p>
1062 <tag/Function/Check if a given character is a letter or digit.
1063 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1064 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
1065 <tag/Description/The function returns a value of zero if the given argument
1066 is a letter or digit. The return value is non zero if the character
1068 <tag/Limits/<itemize>
1069 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1070 inline sequence generated by the macro will not work correctly for values
1071 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1072 this range. The non inline function may be accessed by <tt/#undef/'ing
1074 <item>When compiling without <tt/-Os/, the function is only available as
1075 fastcall function, so it may only be used in presence of a prototype.
1077 <tag/Availability/ISO 9899
1079 <ref id="isalpha" name="isalpha">,
1080 <ref id="isascii" name="isascii">,
1081 <ref id="isblank" name="isblank">,
1082 <ref id="iscntrl" name="iscntrl">,
1083 <ref id="isdigit" name="isdigit">,
1084 <ref id="isgraph" name="isgraph">,
1085 <ref id="islower" name="islower">,
1086 <ref id="isprint" name="isprint">,
1087 <ref id="ispunct" name="ispunct">,
1088 <ref id="isspace" name="isspace">,
1089 <ref id="isupper" name="isupper">,
1090 <ref id="isxdigit" name="isxdigit">
1096 <sect1>isalpha<label id="isalpha"><p>
1100 <tag/Function/Check if a given character is a letter.
1101 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1102 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
1103 <tag/Description/The function returns a value of zero if the given argument
1104 is a letter. The return value is non zero if the character is anything else.
1105 <tag/Limits/<itemize>
1106 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1107 inline sequence generated by the macro will not work correctly for values
1108 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1109 this range. The non inline function may be accessed by <tt/#undef/'ing the
1111 <item>When compiling without <tt/-Os/, the function is only available as
1112 fastcall function, so it may only be used in presence of a prototype.
1114 <tag/Availability/ISO 9899
1116 <ref id="isalnum" name="isalnum">,
1117 <ref id="isascii" name="isascii">,
1118 <ref id="isblank" name="isblank">,
1119 <ref id="iscntrl" name="iscntrl">,
1120 <ref id="isdigit" name="isdigit">,
1121 <ref id="isgraph" name="isgraph">,
1122 <ref id="islower" name="islower">,
1123 <ref id="isprint" name="isprint">,
1124 <ref id="ispunct" name="ispunct">,
1125 <ref id="isspace" name="isspace">,
1126 <ref id="isupper" name="isupper">,
1127 <ref id="isxdigit" name="isxdigit">
1133 <sect1>isascii<label id="isascii"><p>
1137 <tag/Function/Check if a given character is in the ASCII (0..127) range.
1138 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1139 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
1140 <tag/Description/The function returns a value of zero if the given argument
1141 is in the range 0..127 (the range of valid ASCII characters) and a non zero
1143 <tag/Limits/<itemize>
1144 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1145 inline sequence generated by the macro will not work correctly for values
1146 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1147 this range. The non inline function may be accessed by <tt/#undef/'ing the
1149 <item>When compiling without <tt/-Os/, the function is only available as
1150 fastcall function, so it may only be used in presence of a prototype.
1152 <tag/Availability/ISO 9899
1154 <ref id="isalnum" name="isalnum">,
1155 <ref id="isalpha" name="isalpha">,
1156 <ref id="isblank" name="isblank">,
1157 <ref id="iscntrl" name="iscntrl">,
1158 <ref id="isdigit" name="isdigit">,
1159 <ref id="isgraph" name="isgraph">,
1160 <ref id="islower" name="islower">,
1161 <ref id="isprint" name="isprint">,
1162 <ref id="ispunct" name="ispunct">,
1163 <ref id="isspace" name="isspace">,
1164 <ref id="isupper" name="isupper">,
1165 <ref id="isxdigit" name="isxdigit">
1171 <sect1>isblank<label id="isblank"><p>
1175 <tag/Function/Check if a given character is a space or tab.
1176 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1177 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
1178 <tag/Description/The function returns a value of zero if the given argument
1179 is a blank or space character. The return value is non zero if the character
1181 <tag/Limits/<itemize>
1182 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1183 inline sequence generated by the macro will not work correctly for values
1184 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1185 this range. The non inline function may be accessed by <tt/#undef/'ing the
1187 <item>When compiling without <tt/-Os/, the function is only available as
1188 fastcall function, so it may only be used in presence of a prototype.
1190 <tag/Availability/cc65
1192 <ref id="isalnum" name="isalnum">,
1193 <ref id="isalpha" name="isalpha">,
1194 <ref id="isascii" name="isascii">,
1195 <ref id="iscntrl" name="iscntrl">,
1196 <ref id="isdigit" name="isdigit">,
1197 <ref id="isgraph" name="isgraph">,
1198 <ref id="islower" name="islower">,
1199 <ref id="isprint" name="isprint">,
1200 <ref id="ispunct" name="ispunct">,
1201 <ref id="isspace" name="isspace">,
1202 <ref id="isupper" name="isupper">,
1203 <ref id="isxdigit" name="isxdigit">
1209 <sect1>iscntrl<label id="iscntrl"><p>
1213 <tag/Function/Check if a given character is a control character.
1214 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1215 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
1216 <tag/Description/The function returns a value of zero if the given argument
1217 is a control character. The return value is non zero if the character
1219 <tag/Limits/<itemize>
1220 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1221 inline sequence generated by the macro will not work correctly for values
1222 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1223 this range. The non inline function may be accessed by <tt/#undef/'ing the
1225 <item>When compiling without <tt/-Os/, the function is only available as
1226 fastcall function, so it may only be used in presence of a prototype.
1228 <tag/Availability/ISO 9899
1230 <ref id="isalnum" name="isalnum">,
1231 <ref id="isalpha" name="isalpha">,
1232 <ref id="isascii" name="isascii">,
1233 <ref id="isblank" name="isblank">,
1234 <ref id="isdigit" name="isdigit">,
1235 <ref id="isgraph" name="isgraph">,
1236 <ref id="islower" name="islower">,
1237 <ref id="isprint" name="isprint">,
1238 <ref id="ispunct" name="ispunct">,
1239 <ref id="isspace" name="isspace">,
1240 <ref id="isupper" name="isupper">,
1241 <ref id="isxdigit" name="isxdigit">
1247 <sect1>isdigit<label id="isdigit"><p>
1251 <tag/Function/Check if a given character is a digit.
1252 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1253 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
1254 <tag/Description/The function returns a value of zero if the given argument
1255 is a digit. The return value is non zero if the character is anything else.
1256 <tag/Limits/<itemize>
1257 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1258 inline sequence generated by the macro will not work correctly for values
1259 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1260 this range. The non inline function may be accessed by <tt/#undef/'ing the
1262 <item>When compiling without <tt/-Os/, the function is only available as
1263 fastcall function, so it may only be used in presence of a prototype.
1265 <tag/Availability/ISO 9899
1267 <ref id="isalnum" name="isalnum">,
1268 <ref id="isalpha" name="isalpha">,
1269 <ref id="isascii" name="isascii">,
1270 <ref id="isblank" name="isblank">,
1271 <ref id="iscntrl" name="iscntrl">,
1272 <ref id="isgraph" name="isgraph">,
1273 <ref id="islower" name="islower">,
1274 <ref id="isprint" name="isprint">,
1275 <ref id="ispunct" name="ispunct">,
1276 <ref id="isspace" name="isspace">,
1277 <ref id="isupper" name="isupper">,
1278 <ref id="isxdigit" name="isxdigit">
1284 <sect1>isgraph<label id="isgraph"><p>
1288 <tag/Function/Check if a given character is a printable character (except
1290 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1291 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
1292 <tag/Description/The function returns a value of zero if the given argument
1293 is a printable character with the exception of space. The return value is non
1294 zero if the character is anything else.
1295 <tag/Limits/<itemize>
1296 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1297 inline sequence generated by the macro will not work correctly for values
1298 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1299 this range. The non inline function may be accessed by <tt/#undef/'ing the
1301 <item>When compiling without <tt/-Os/, the function is only available as
1302 fastcall function, so it may only be used in presence of a prototype.
1304 <tag/Availability/ISO 9899
1306 <ref id="isalnum" name="isalnum">,
1307 <ref id="isalpha" name="isalpha">,
1308 <ref id="isascii" name="isascii">,
1309 <ref id="isblank" name="isblank">,
1310 <ref id="iscntrl" name="iscntrl">,
1311 <ref id="isdigit" name="isdigit">,
1312 <ref id="islower" name="islower">,
1313 <ref id="isprint" name="isprint">,
1314 <ref id="ispunct" name="ispunct">,
1315 <ref id="isspace" name="isspace">,
1316 <ref id="isupper" name="isupper">,
1317 <ref id="isxdigit" name="isxdigit">
1323 <sect1>islower<label id="islower"><p>
1327 <tag/Function/Check if a given character is a lower case letter.
1328 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1329 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
1330 <tag/Description/The function returns a value of zero if the given argument
1331 is a lower case letter. The return value is non zero if the character is
1333 <tag/Limits/<itemize>
1334 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1335 inline sequence generated by the macro will not work correctly for values
1336 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1337 this range. The non inline function may be accessed by <tt/#undef/'ing the
1339 <item>When compiling without <tt/-Os/, the function is only available as
1340 fastcall function, so it may only be used in presence of a prototype.
1342 <tag/Availability/ISO 9899
1344 <ref id="isalnum" name="isalnum">,
1345 <ref id="isalpha" name="isalpha">,
1346 <ref id="isascii" name="isascii">,
1347 <ref id="isblank" name="isblank">,
1348 <ref id="iscntrl" name="iscntrl">,
1349 <ref id="isdigit" name="isdigit">,
1350 <ref id="isgraph" name="isgraph">,
1351 <ref id="isprint" name="isprint">,
1352 <ref id="ispunct" name="ispunct">,
1353 <ref id="isspace" name="isspace">,
1354 <ref id="isupper" name="isupper">,
1355 <ref id="isxdigit" name="isxdigit">
1361 <sect1>isprint<label id="isprint"><p>
1365 <tag/Function/Check if a given character is a printable character.
1366 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1367 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
1368 <tag/Description/The function returns a value of zero if the given argument
1369 is a printable character (this includes the space character). The return value
1370 is non zero if the character is anything else.
1371 <tag/Limits/<itemize>
1372 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1373 inline sequence generated by the macro will not work correctly for values
1374 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1375 this range. The non inline function may be accessed by <tt/#undef/'ing the
1377 <item>When compiling without <tt/-Os/, the function is only available as
1378 fastcall function, so it may only be used in presence of a prototype.
1380 <tag/Availability/ISO 9899
1382 <ref id="isalnum" name="isalnum">,
1383 <ref id="isalpha" name="isalpha">,
1384 <ref id="isascii" name="isascii">,
1385 <ref id="isblank" name="isblank">,
1386 <ref id="iscntrl" name="iscntrl">,
1387 <ref id="isdigit" name="isdigit">,
1388 <ref id="isgraph" name="isgraph">,
1389 <ref id="islower" name="islower">,
1390 <ref id="ispunct" name="ispunct">,
1391 <ref id="isspace" name="isspace">,
1392 <ref id="isupper" name="isupper">,
1393 <ref id="isxdigit" name="isxdigit">
1399 <sect1>ispunct<label id="ispunct"><p>
1403 <tag/Function/Check if a given character is a printable character but not a
1404 space or an alphanumeric character.
1405 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1406 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
1407 <tag/Description/The function returns a value of zero if the given argument
1408 is a printable character, but not a space or anything alphanumeric. The return
1409 value is non zero if the character is anything else.
1410 <tag/Limits/<itemize>
1411 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1412 inline sequence generated by the macro will not work correctly for values
1413 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1414 this range. The non inline function may be accessed by <tt/#undef/'ing the
1416 <item>When compiling without <tt/-Os/, the function is only available as
1417 fastcall function, so it may only be used in presence of a prototype.
1419 <tag/Availability/ISO 9899
1421 <ref id="isalnum" name="isalnum">,
1422 <ref id="isalpha" name="isalpha">,
1423 <ref id="isascii" name="isascii">,
1424 <ref id="isblank" name="isblank">,
1425 <ref id="iscntrl" name="iscntrl">,
1426 <ref id="isdigit" name="isdigit">,
1427 <ref id="isgraph" name="isgraph">,
1428 <ref id="islower" name="islower">,
1429 <ref id="isprint" name="isprint">,
1430 <ref id="isspace" name="isspace">,
1431 <ref id="isupper" name="isupper">,
1432 <ref id="isxdigit" name="isxdigit">
1438 <sect1>isspace<label id="isspace"><p>
1442 <tag/Function/Check if a given character is a a white-space character.
1443 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1444 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
1445 <tag/Description/The function returns a value of zero if the given argument
1446 is a white space character. The return value is non zero if the character is
1447 anything else. The standard white space characters are: space, formfeed ('\f'),
1448 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
1450 <tag/Limits/<itemize>
1451 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1452 inline sequence generated by the macro will not work correctly for values
1453 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1454 this range. The non inline function may be accessed by <tt/#undef/'ing the
1456 <item>When compiling without <tt/-Os/, the function is only available as
1457 fastcall function, so it may only be used in presence of a prototype.
1459 <tag/Availability/ISO 9899
1461 <ref id="isalnum" name="isalnum">,
1462 <ref id="isalpha" name="isalpha">,
1463 <ref id="isascii" name="isascii">,
1464 <ref id="isblank" name="isblank">,
1465 <ref id="iscntrl" name="iscntrl">,
1466 <ref id="isdigit" name="isdigit">,
1467 <ref id="isgraph" name="isgraph">,
1468 <ref id="islower" name="islower">,
1469 <ref id="isprint" name="isprint">,
1470 <ref id="ispunct" name="ispunct">,
1471 <ref id="isupper" name="isupper">,
1472 <ref id="isxdigit" name="isxdigit">
1478 <sect1>isupper<label id="isupper"><p>
1482 <tag/Function/Check if a given character is an upper case letter.
1483 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1484 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
1485 <tag/Description/The function returns a value of zero if the given argument
1486 is an upper case letter. The return value is non zero if the character is
1488 <tag/Limits/<itemize>
1489 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1490 inline sequence generated by the macro will not work correctly for values
1491 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1492 this range. The non inline function may be accessed by <tt/#undef/'ing the
1494 <item>When compiling without <tt/-Os/, the function is only available as
1495 fastcall function, so it may only be used in presence of a prototype.
1497 <tag/Availability/ISO 9899
1499 <ref id="isalnum" name="isalnum">,
1500 <ref id="isalpha" name="isalpha">,
1501 <ref id="isascii" name="isascii">,
1502 <ref id="isblank" name="isblank">,
1503 <ref id="iscntrl" name="iscntrl">,
1504 <ref id="isdigit" name="isdigit">,
1505 <ref id="isgraph" name="isgraph">,
1506 <ref id="islower" name="islower">,
1507 <ref id="isprint" name="isprint">,
1508 <ref id="ispunct" name="ispunct">,
1509 <ref id="isspace" name="isspace">,
1510 <ref id="isxdigit" name="isxdigit">
1516 <sect1>isxdigit<label id="isxdigit"><p>
1520 <tag/Function/Check if a given character is a hexadecimal digit.
1521 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1522 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
1523 <tag/Description/The function returns a value of zero if the given argument
1524 is a hexadecimal digit (0..9, a..f and A..F). The return value is non zero
1525 if the character is anything else.
1526 <tag/Limits/<itemize>
1527 <item>When compiling with <tt/-Os/ the function is actually a macro. The
1528 inline sequence generated by the macro will not work correctly for values
1529 outside the range 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of
1530 this range. The non inline function may be accessed by <tt/#undef/'ing the
1532 <item>When compiling without <tt/-Os/, the function is only available as
1533 fastcall function, so it may only be used in presence of a prototype.
1535 <tag/Availability/ISO 9899
1537 <ref id="isalnum" name="isalnum">,
1538 <ref id="isalpha" name="isalpha">,
1539 <ref id="isascii" name="isascii">,
1540 <ref id="isblank" name="isblank">,
1541 <ref id="iscntrl" name="iscntrl">,
1542 <ref id="isdigit" name="isdigit">,
1543 <ref id="isgraph" name="isgraph">,
1544 <ref id="islower" name="islower">,
1545 <ref id="isprint" name="isprint">,
1546 <ref id="ispunct" name="ispunct">,
1547 <ref id="isspace" name="isspace">,
1548 <ref id="isupper" name="isupper">
1554 <sect1>kbhit<label id="kbhit"><p>
1558 <tag/Function/Check if there's a key waiting in the keyboard buffer.
1559 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1560 <tag/Declaration/<tt/unsigned char kbhit (void);/
1561 <tag/Description/The function returns a value of zero if there is no character
1562 waiting to be read from the keyboard. It returns non zero otherwise.
1563 <tag/Limits/<itemize>
1564 <item>If the system does not support a keyboard buffer (most systems
1565 do), the function is rather useless.
1567 <tag/Availability/cc65
1569 <ref id="cgetc" name="cgetc">,
1570 <ref id="cursor" name="cursor">
1576 <sect1>labs<label id="labs"><p>
1580 <tag/Function/Returns the absolute value of a long integer.
1581 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1582 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
1583 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
1585 <tag/Limits/<itemize>
1586 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
1587 <item>The function is only available as fastcall function, so it may only be
1588 used in presence of a prototype.
1590 <tag/Availability/ISO 9899
1592 <ref id="abs" name="abs">
1598 <sect1>rand<label id="rand"><p>
1602 <tag/Function/Return a pseudo random number.
1603 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1604 <tag/Declaration/<tt/int rand (void);/
1605 <tag/Description/The function returns a pseudo random number
1606 between 0 and <tt/RAND_MAX/ (exclusive).
1607 <tag/Limits/<itemize>
1608 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
1609 flow of numbers is generated.
1610 <item>On startup, the function behaves as if <ref id="srand" name="srand">
1611 had been used with an argument of 1.
1613 <tag/Availability/ISO 9899
1615 <ref id="_randomize" name="_randomize">,
1616 <ref id="srand" name="srand">
1622 <sect1>revers<label id="revers"><p>
1626 <tag/Function/Control revers character display.
1627 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1628 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
1629 <tag/Description/If the argument is non zero, the function enables reverse
1630 character display. If the argument is zero, reverse character display is
1631 switched off. The old value of the setting is returned.
1632 <tag/Limits/<itemize>
1633 <item>The function may not be supported by the hardware, in which case
1634 the call is ignored.
1635 <item>The function is only available as fastcall function, so it may only
1636 be used in presence of a prototype.
1638 <tag/Availability/cc65
1640 <ref id="textcolor" name="textcolor">
1646 <sect1>screensize<label id="screensize"><p>
1650 <tag/Function/Return the dimensions of the text mode screen.
1651 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1652 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
1653 <tag/Description/The function returns the dimensions of the text mode screen.
1654 <tag/Limits/<itemize>
1655 <item>The function is only available as fastcall function, so it may only
1656 be used in presence of a prototype.
1658 <tag/Availability/cc65
1660 <ref id="gotox" name="gotox">,
1661 <ref id="gotoxy" name="gotoxy">,
1662 <ref id="gotoy" name="gotoy">,
1663 <ref id="wherex" name="wherex">,
1664 <ref id="wherey" name="wherey">
1670 <sect1>slow<label id="slow"><p>
1674 <tag/Function/Switch the C128 into 1MHz mode.
1675 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1676 <tag/Declaration/<tt/void slow (void);/
1677 <tag/Description/The function will switch the clock of the C128 to 1MHz. This
1678 will halve the speed compared to fast mode.
1679 <tag/Limits/<itemize>
1680 <item>The function is specific to the C128.
1682 <tag/Availability/C128
1684 <ref id="fast" name="fast">,
1685 <ref id="toggle_videomode" name="toggle_videomode">
1691 <sect1>srand<label id="srand"><p>
1695 <tag/Function/Initialize the pseudo random number generator.
1696 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1697 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
1698 <tag/Description/The function initializes the random number generator using
1699 the given seed. On program startup, the generator behaves as if <tt/srand/ has
1700 been called with an argument of 1.
1701 <tag/Limits/<itemize>
1702 <item>The function is only available as fastcall function, so it may only
1703 be used in presence of a prototype.
1705 <tag/Availability/ISO 9899
1707 <ref id="_randomize" name="_randomize">,
1708 <ref id="rand" name="rand">
1714 <sect1>strcat<label id="strcat"><p>
1718 <tag/Function/Concatentate two strings.
1719 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1720 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
1721 <tag/Description/The <tt/strcat/ function appends a copy of the string
1722 pointed to by s2 (including the terminating null byte) to the end of the
1723 string pointed to by s1. The initial byte of s2 overwrites the null byte at
1725 <tag/Limits/<itemize>
1726 <item>The function is only available as fastcall function, so it may only
1727 be used in presence of a prototype.
1728 <item>If copying takes place between objects that overlap, the behavior
1731 <tag/Availability/ISO 9899
1733 <ref id="strcpy" name="strcpy">
1734 <ref id="strncpy" name="strncpy">
1740 <sect1>strchr<label id="strchr"><p>
1744 <tag/Function/Search for a character in a string.
1745 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1746 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
1747 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
1748 (converted to a char) in the string pointed to by <tt/s/. The terminating null
1749 byte is considered to be part of the string. Upon completion, the function
1750 returns a pointer to the byte, or a null pointer if the byte was not found.
1751 <tag/Limits/<itemize>
1752 <item>The function is only available as fastcall function, so it may only
1753 be used in presence of a prototype.
1755 <tag/Availability/ISO 9899
1757 <ref id="strrchr" name="strrchr">
1763 <sect1>strcpy<label id="strcpy"><p>
1767 <tag/Function/Copy a string.
1768 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1769 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
1770 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
1771 <tt/s2/ (including the terminating null byte) into the array pointed to by
1772 <tt/s1/. The function will always return <tt/s1/.
1773 <tag/Limits/<itemize>
1774 <item>The function is only available as fastcall function, so it may only
1775 be used in presence of a prototype.
1776 <item>If copying takes place between objects that overlap, the behavior
1779 <tag/Availability/ISO 9899
1781 <ref id="strcat" name="strcat">
1782 <ref id="strncpy" name="strncpy">
1787 static char hello[14];
1789 strcpy (hello, "Hello world!\n");
1795 <sect1>strlen<label id="strlen"><p>
1799 <tag/Function/Return the length of a string.
1800 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1801 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
1802 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
1803 string to which s points, not including the terminating null byte.
1804 <tag/Limits/<itemize>
1805 <item>The function is only available as fastcall function, so it may only
1806 be used in presence of a prototype.
1807 <item>When compiling with <tt/-Os/ (inline known standard functions), the
1808 function does not work correctly for strings with more than 255 characters.
1810 <tag/Availability/ISO 9899
1812 <ref id="strcpy" name="strcpy">
1818 <sect1>strlower<label id="strlower"><p>
1822 <tag/Function/Make a string lower case.
1823 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1824 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
1825 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
1826 function to each character of a string. The function will always return <tt/s/.
1827 <tag/Limits/<itemize>
1828 <item>The function is only available as fastcall function, so it may only
1829 be used in presence of a prototype.
1830 <item>The function prototype is unavailable when compiling in strict ANSI mode.
1831 <item>An alias name for this function is <tt/strlwr/.
1833 <tag/Availability/cc65
1835 <ref id="strupper" name="strupper">
1836 <ref id="tolower" name="tolower">
1842 <sect1>strlwr<label id="strlwr"><p>
1849 <sect1>strncpy<label id="strncpy"><p>
1853 <tag/Function/Copy part of a string.
1854 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1855 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2, size_t n);/
1856 <tag/Description/The <tt/strncpy/ function copies not more than n bytes from
1857 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
1858 pointed to by <tt/s2/ is a string that is shorter than n bytes, null bytes are
1859 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
1860 written. The function will always return <tt/s1/.
1861 <tag/Limits/<itemize>
1862 <item>The function is only available as fastcall function, so it may only
1863 be used in presence of a prototype. If there is no null byte in the first <tt/n/
1864 bytes of the array pointed to by <tt/s2/, the result is not null-terminated.
1865 <item>If copying takes place between objects that overlap, the behavior is
1868 <tag/Availability/ISO 9899
1870 <ref id="strcat" name="strcat">
1871 <ref id="strcpy" name="strcpy">
1876 static char hello[6];
1878 strcpy (hello, "Hello world!\n", sizeof (hello) - 1);
1885 <sect1>strrchr<label id="strrchr"><p>
1889 <tag/Function/Search for a character in a string.
1890 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1891 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
1892 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
1893 (converted to a char) in the string pointed to by <tt/s/. The terminating null
1894 byte is considered to be part of the string. Upon completion, the function
1895 returns a pointer to the byte, or a null pointer if the byte was not found.
1896 <tag/Limits/<itemize>
1897 <item>The function is only available as fastcall function, so it may only
1898 be used in presence of a prototype.
1900 <tag/Availability/ISO 9899
1902 <ref id="strchr" name="strchr">
1908 <sect1>strupper<label id="strupper"><p>
1912 <tag/Function/Make a string upper case.
1913 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1914 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
1915 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
1916 function to each character of a string. The function will always return <tt/s/.
1917 <tag/Limits/<itemize>
1918 <item>The function is only available as fastcall function, so it may only
1919 be used in presence of a prototype.
1920 <item>The function prototype is unavailable when compiling in strict ANSI mode.
1921 <item>An alias name for this function is <tt/strupr/.
1923 <tag/Availability/cc65
1925 <ref id="strlower" name="strlower">
1926 <ref id="toupper" name="toupper">
1932 <sect1>strupr<label id="strupr"><p>
1939 <sect1>textcolor<label id="textcolor"><p>
1943 <tag/Function/Set the text color.
1944 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1945 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
1946 <tag/Description/The function will set a new text color. It returns the old
1947 (current) text color. Text output using any <tt/conio.h/ function will use
1948 the color set by this function.
1949 <tag/Limits/<itemize>
1950 <item>Text colors are system dependent. The function may have no effect
1951 on systems where the text color cannot be changed.
1952 <item>The function is only available as fastcall function, so it may only
1953 be used in presence of a prototype.
1955 <tag/Availability/cc65
1957 <ref id="bgcolor" name="bgcolor">,
1958 <ref id="bordercolor" name="bordercolor">
1964 <sect1>toggle_videomode<label id="toggle_videomode"><p>
1968 <tag/Function/Toggle between 40 and 80 column mode.
1969 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1970 <tag/Declaration/<tt/void toggle_videomode (void);/
1971 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
1972 old mode (cursor position, color and so on) are saved and restored together
1974 <tag/Limits/<itemize>
1975 <item>The function is specific to the C128.
1977 <tag/Availability/C128
1979 <ref id="fast" name="fast">,
1980 <ref id="slow" name="slow">
1986 <sect1>tolower<label id="tolower"><p>
1990 <tag/Function/Convert a character into its lower case representation.
1991 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1992 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
1993 <tag/Description/The function returns the given character converted to lower
1994 case. If the given character is not a letter, it is returned unchanged.
1995 <tag/Limits/<itemize>
1996 <item>The function is only available as fastcall function, so it may
1997 only be used in presence of a prototype.
1999 <tag/Availability/ISO 9899
2001 <ref id="islower" name="islower">,
2002 <ref id="isupper" name="isupper">,
2003 <ref id="toupper" name="toupper">
2009 <sect1>toupper<label id="toupper"><p>
2013 <tag/Function/Convert a character into its upper case representation.
2014 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
2015 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
2016 <tag/Description/The function returns the given character converted to upper
2017 case. If the given character is not a letter, it is returned unchanged.
2018 <tag/Limits/<itemize>
2019 <item>The function is only available as fastcall function, so it may
2020 only be used in presence of a prototype.
2022 <tag/Availability/ISO 9899
2024 <ref id="islower" name="islower">,
2025 <ref id="isupper" name="isupper">,
2026 <ref id="tolower" name="tolower">
2032 <sect1>wherex<label id="wherex"><p>
2036 <tag/Function/Return the current X position of the text mode cursor.
2037 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2038 <tag/Declaration/<tt/unsigned char wherex (void);/
2039 <tag/Description/The function returns the current X position of the text mode
2040 cursor. Zero is returned for the leftmost screen position.
2041 <tag/Availability/cc65
2043 <ref id="gotox" name="gotox">,
2044 <ref id="gotoy" name="gotoy">,
2045 <ref id="gotoxy" name="gotoxy">,
2046 <ref id="wherey" name="wherey">
2052 <sect1>wherey<label id="wherey"><p>
2056 <tag/Function/Return the current Y position of the text mode cursor.
2057 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2058 <tag/Declaration/<tt/unsigned char wherey (void);/
2059 <tag/Description/The function returns the current Y position of the text mode
2060 cursor. Zero is returned for the uppermost screen position.
2061 <tag/Availability/cc65
2063 <ref id="gotox" name="gotox">,
2064 <ref id="gotoy" name="gotoy">,
2065 <ref id="gotoxy" name="gotoxy">,
2066 <ref id="wherex" name="wherex">