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 <bf/Note:/ Standard C functions are listed here, but not described in detail.
26 Since these functions behave identical on all standard compliant systems, they
27 are described in any book covering standard C.
29 Each entry for a function contains a detailed description
33 <tag/Function/Summary of what <bf/function/ does.
34 <tag/Header/The header file that contains the declaration.
35 <tag/Declaration/Describes the needed header files and declaration of the
37 <tag/Description/Description of the function.
39 <tag/Availability/The availability of the function.
40 <tag/See also/Other related functions.
41 <tag/Example/A piece of actual code using the function.
46 <sect>Functions by header file<p>
48 <sect1><tt/6502.h/<label id="6502.h"><p>
51 <item><ref id="BRK" name="BRK">
52 <item><ref id="CLI" name="CLI">
53 <item><ref id="SEI" name="SEI">
54 <!-- <item><ref id="_sys" name="_sys"> -->
55 <!-- <item><ref id="getcpu" name="getcpu"> -->
56 <!-- <item><ref id="reset_brk" name="reset_brk"> -->
57 <!-- <item><ref id="set_brk" name="set_brk"> -->
61 <sect1><tt/assert.h/<label id="assert.h"><p>
64 <item><ref id="assert" name="assert">
68 <sect1><tt/conio.h/<label id="conio.h"><p>
71 <item><ref id="bgcolor" name="bgcolor">
72 <item><ref id="bordercolor" name="bordercolor">
73 <item><ref id="cclear" name="cclear">
74 <item><ref id="cclearxy" name="cclearxy">
75 <item><ref id="cgetc" name="cgetc">
76 <item><ref id="chline" name="chline">
77 <item><ref id="chlinexy" name="chlinexy">
78 <item><ref id="clrscr" name="clrscr">
79 <!-- <item><ref id="cprintf" name="cprintf"> -->
80 <!-- <item><ref id="cputc" name="cputc"> -->
81 <!-- <item><ref id="cputcxy" name="cputcxy"> -->
82 <!-- <item><ref id="cputs" name="cputs"> -->
83 <!-- <item><ref id="cputsxy" name="cputsxy"> -->
84 <item><ref id="cursor" name="cursor">
85 <item><ref id="cvline" name="cvline">
86 <item><ref id="cvlinexy" name="cvlinexy">
87 <item><ref id="gotox" name="gotox">
88 <item><ref id="gotoxy" name="gotoxy">
89 <item><ref id="gotoy" name="gotoy">
90 <item><ref id="kbhit" name="kbhit">
91 <item><ref id="revers" name="revers">
92 <item><ref id="screensize" name="screensize">
93 <item><ref id="textcolor" name="textcolor">
94 <!-- <item><ref id="vcprintf" name="vcprintf"> -->
95 <item><ref id="wherex" name="wherex">
96 <item><ref id="wherey" name="wherey">
100 <sect1><tt/ctype.h/<label id="ctype.h"><p>
103 <item><ref id="isalnum" name="isalnum">
104 <item><ref id="isalpha" name="isalpha">
105 <item><ref id="isascii" name="isascii">
106 <item><ref id="isblank" name="isblank">
107 <item><ref id="iscntrl" name="iscntrl">
108 <item><ref id="isdigit" name="isdigit">
109 <item><ref id="isgraph" name="isgraph">
110 <item><ref id="islower" name="islower">
111 <item><ref id="isprint" name="isprint">
112 <item><ref id="ispunct" name="ispunct">
113 <item><ref id="isspace" name="isspace">
114 <item><ref id="isupper" name="isupper">
115 <item><ref id="isxdigit" name="isxdigit">
116 <item><ref id="tolower" name="tolower">
117 <item><ref id="toupper" name="toupper">
121 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
124 <item><ref id="abort" name="abort">
125 <item><ref id="atexit" name="atexit">
126 <item><ref id="exit" name="exit">
132 <sect>Alphabetical function reference<p>
134 <sect1>BRK<label id="BRK"><p>
138 <tag/Function/Insert a 6502 BRK instrunction into the code.
139 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
140 <tag/Declaration/<tt/void BRK (void);/
141 <tag/Description/The function will insert a 6502 BRK instruction into the code
142 which may be used to trigger a debugger.
143 <tag/Limits/The function is actually a macro. The inserted instruction may lead
144 to unexpected results if no debugger is present.
145 <tag/Availability/cc65
147 <ref id="CLI" name="CLI">,
148 <ref id="SEI" name="SEI">
149 <tag/Example/Actual code using the function.
154 <sect1>CLI<label id="CLI"><p>
158 <tag/Function/Insert a 6502 CLI instrunction into the code.
159 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
160 <tag/Declaration/<tt/void CLI (void);/
161 <tag/Description/The function will insert a 6502 CLI instruction into the code,
162 so interrupts are disabled. Note that non maskable interrupts cannot be
164 <tag/Limits/The function is actually a macro. Disabling interrupts may lead to
166 <tag/Availability/cc65
168 <ref id="BRK" name="BRK">,
169 <ref id="SEI" name="SEI">
170 <tag/Example/Actual code using the function.
175 <sect1>SEI<label id="SEI"><p>
179 <tag/Function/Insert a 6502 SEI instrunction into the code.
180 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
181 <tag/Declaration/<tt/void SEI (void);/
182 <tag/Description/The function will insert a 6502 SEI instruction into the code,
183 so interrupts are enabled. Enabling interrupts has no effects if they are
184 already enabled (the default).
185 <tag/Limits/The function is actually a macro.
186 <tag/Availability/cc65
188 <ref id="BRK" name="BRK">,
189 <ref id="CLI" name="CLI">
190 <tag/Example/Actual code using the function.
195 <sect1>abort<label id="abort"><p>
199 <tag/Function/Terminates a program abnormally.
200 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
201 <tag/Declaration/<tt/void abort (void);/
202 <tag/Description/<tt/abort/ writes a termination message on stderr, then
203 terminates the program with an exit code of 3.
204 <tag/Availability/ISO 9899
206 <ref id="assert" name="assert">,
207 <ref id="exit" name="exit">
208 <tag/Example/Actual code using the function.
213 <sect1>assert<label id="assert"><p>
217 <tag/Function/Test a condition and possibly abort.
218 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
219 <tag/Declaration/<tt/void assert (int cond);/
220 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
221 statement. If the condition evaluates t zero (false), assert prints a message
222 on stderr and aborts the program.
223 <tag/Limits/The function is actually a macro.
224 <tag/Availability/ISO 9899
226 <ref id="abort" name="abort">,
227 <ref id="exit" name="exit">
228 <tag/Example/Actual code using the function.
233 <sect1>atexit<label id="atexit"><p>
237 <tag/Function/Register an exit function.
238 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
239 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
240 <tag/Description/<tt/atexit/ registers the function pointed to by
241 <tt/exitfunc/ as an exit function. Exit functions are called when the program
242 terminates, they are called in LIFO order (the last function registered is
243 called first). <tt/atexit/ returns zero on success and a nonzero value on
245 <tag/Limits/A maximum of 5 exit functions can be registered. There is no way
246 to unregister an exit function. The function is only available as fastcall
247 function, so it may only be used in presence of a prototype.
248 <tag/Availability/ISO 9899
250 <ref id="abort" name="abort">,
251 <ref id="exit" name="exit">
252 <tag/Example/Actual code using the function.
257 <sect1>bgcolor<label id="bgcolor"><p>
261 <tag/Function/Set the background text color.
262 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
263 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
264 <tag/Description/The function will set a new background text color. It returns
265 the old (current) background color.
266 <tag/Limits/Background colors are system dependent. The function may have no effect
267 on systems where the background color cannot be changed. The function is only
268 available as fastcall function, so it may only be used in presence of a
270 <tag/Availability/cc65
272 <ref id="bordercolor" name="bordercolor">,
273 <ref id="textcolor" name="textcolor">
274 <tag/Example/Actual code using the function.
279 <sect1>bordercolor<label id="bordercolor"><p>
283 <tag/Function/Set the border (frame) color.
284 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
285 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
286 <tag/Description/The function will set a new border color. It returns the old
287 (current) border color.
288 <tag/Limits/Border colors are system dependent. The function may have no effect
289 on systems where the border color cannot be changed. The function is only
290 available as fastcall function, so it may only be used in presence of a
292 <tag/Availability/cc65
294 <ref id="bgcolor" name="bgcolor">,
295 <ref id="textcolor" name="textcolor">
296 <tag/Example/Actual code using the function.
301 <sect1>cclear<label id="cclear"><p>
305 <tag/Function/Clear part of a line (write a given amount of spaces).
306 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
307 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
308 <tag/Description/The function clears part of a line by writing <tt/length/
309 spaces in the current text color.
310 <tag/Limits/The function is only available as fastcall function, so it may
311 only be used in presence of a prototype.
312 <tag/Availability/cc65
314 <ref id="cclearxy" name="cclearxy">,
315 <ref id="clrscr" name="clrscr">
316 <tag/Example/Actual code using the function.
321 <sect1>cclearxy<label id="cclearxy"><p>
325 <tag/Function/Clear part of a line (write a given amount of spaces) starting
326 at a specific screen position.
327 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
328 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char length);/
329 <tag/Description/The function moves the cursor to a specific position, and
330 will then clear part of the line by writing <tt/length/ spaces in the current
332 <tag/Limits/The function is only available as fastcall function, so it may
333 only be used in presence of a prototype.
334 <tag/Availability/cc65
336 <ref id="cclear" name="cclear">,
337 <ref id="clrscr" name="clrscr">
338 <tag/Example/Actual code using the function.
343 <sect1>cgetc<label id="cgetc"><p>
347 <tag/Function/Read a character from the keyboard.
348 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
349 <tag/Declaration/<tt/char cgetc (void);/
350 <tag/Description/The function reads a character from the keyboard. If there is
351 no character available, <tt/cgetc/ waits until the user presses a key. If the
352 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
353 displayed while waiting.
354 <tag/Limits/If the system supports a keyboard buffer, <tt/cgetc/ will fetch a
355 key from this buffer and wait only if the buffer is empty.
356 <tag/Availability/cc65
358 <ref id="cursor" name="cursor">,
359 <ref id="kbhit" name="kbhit">
360 <tag/Example/Actual code using the function.
365 <sect1>chline<label id="chline"><p>
369 <tag/Function/Output a horizontal line in text mode.
370 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
371 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
372 <tag/Description/The function outputs a horizontal line with the given length
373 starting at the current cursor position.
374 <tag/Limits/The character used to draw the horizontal line is system dependent.
375 If available, a line drawing character is used. Drawing a line that is partially
376 off screen leads to undefined behaviour. The function is only available
377 as fastcall function, so it may only be used in presence of a prototype.
378 <tag/Availability/cc65
380 <ref id="chlinexy" name="chlinexy">,
381 <ref id="cvline" name="cvline">,
382 <ref id="cvlinexy" name="cvlinexy">
383 <tag/Example/Actual code using the function.
388 <sect1>chlinexy<label id="chlinexy"><p>
392 <tag/Function/Output a horizontal line at a given position in text mode.
393 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
394 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
395 <tag/Description/The function outputs a horizontal line with the given length
396 starting at a given position.
397 <tag/Limits/The character used to draw the horizontal line is system dependent.
398 If available, a line drawing character is used. Drawing a line that is partially
399 off screen leads to undefined behaviour. The function is only available
400 as fastcall function, so it may only be used in presence of a prototype.
401 <tag/Availability/cc65
403 <ref id="chline" name="chline">,
404 <ref id="cvline" name="cvline">,
405 <ref id="cvlinexy" name="cvlinexy">
406 <tag/Example/Actual code using the function.
411 <sect1>clrscr<label id="clrscr"><p>
415 <tag/Function/Clear the text screen.
416 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
417 <tag/Declaration/<tt/void clrscr (void);/
418 <tag/Description/The function clears the text screen and moves the cursor to
419 the upper left corner.
420 <tag/Availability/cc65
422 <ref id="cclear" name="cclear">,
423 <ref id="cclearxy" name="cclearxy">
424 <tag/Example/Actual code using the function.
429 <sect1>cursor<label id="cursor"><p>
433 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
434 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
435 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
436 <tag/Description/If the argument to the function is non zero, a blinking cursor
437 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
438 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
439 <tag/Limits/The function is only available as fastcall function, so it may only
440 be used in presence of a prototype.
441 <tag/Availability/cc65
443 <ref id="cgetc" name="cgetc">,
444 <ref id="kbhit" name="kbhit">
445 <tag/Example/Actual code using the function.
450 <sect1>cvline<label id="cvline"><p>
454 <tag/Function/Output a vertical line in text mode.
455 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
456 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
457 <tag/Description/The function outputs a vertical line with the given length
458 starting at the current cursor position.
459 <tag/Limits/The character used to draw the vertical line is system dependent.
460 If available, a line drawing character is used. Drawing a line that is partially
461 off screen leads to undefined behaviour. The function is only available
462 as fastcall function, so it may only be used in presence of a prototype.
463 <tag/Availability/cc65
465 <ref id="chline" name="chline">,
466 <ref id="chlinexy" name="chlinexy">,
467 <ref id="cvlinexy" name="cvlinexy">
468 <tag/Example/Actual code using the function.
473 <sect1>cvlinexy<label id="cvlinexy"><p>
477 <tag/Function/Output a vertical line at a given position in text mode.
478 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
479 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
480 <tag/Description/The function outputs a vertical line with the given length
481 starting at a given position.
482 <tag/Limits/The character used to draw the vertical line is system dependent.
483 If available, a line drawing character is used. Drawing a line that is partially
484 off screen leads to undefined behaviour. The function is only available
485 as fastcall function, so it may only be used in presence of a prototype.
486 <tag/Availability/cc65
488 <ref id="chline" name="chline">,
489 <ref id="chlinexy" name="chlinexy">,
490 <ref id="cvline" name="cvline">
491 <tag/Example/Actual code using the function.
496 <sect1>exit<label id="exit"><p>
500 <tag/Function/Terminate the program.
501 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
502 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
503 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
504 return code of the program. Before termination, all files are closed, buffered
505 output is written and any functions registered with <tt/<ref id="atexit"
506 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
507 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
509 <tag/Limits/The function is only available as fastcall function, so it may only
510 be used in presence of a prototype. It depends on the host machine if the
511 program return code can be evaluated or is ignored.
512 <tag/Availability/ISO 9899
514 <ref id="abort" name="abort">,
515 <ref id="exit" name="exit">
516 <tag/Example/Actual code using the function.
521 <sect1>gotox<label id="gotox"><p>
525 <tag/Function/Move the text mode cursor to a new X position.
526 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
527 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
528 <tag/Description/The function moves the text mode cursor to the specified X
529 position while leaving the Y position untouched. The leftmost position on the
530 screen has the coordinate 0.
531 <tag/Limits/The function is only available as fastcall function, so it may
532 only be used in presence of a prototype. Invalid values for the X position
533 (out of screen coordinates) may lead to undefined behaviour.
534 <tag/Availability/cc65
536 <ref id="gotoy" name="gotoy">,
537 <ref id="gotoxy" name="gotoxy">,
538 <ref id="wherex" name="wherex">,
539 <ref id="wherey" name="wherey">
540 <tag/Example/Actual code using the function.
545 <sect1>gotoxy<label id="gotoxy"><p>
549 <tag/Function/Move the text mode cursor to a new position.
550 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
551 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
552 <tag/Description/The function moves the text mode cursor to the specified
553 position. The leftmost position on the screen has the X coordinate 0, the
554 topmost line has the Y coordinate 0.
555 <tag/Limits/The function is only available as fastcall function, so it may
556 only be used in presence of a prototype. Invalid values for any of both
557 coordinates (out of screen positions) may lead to undefined behaviour.
558 <tag/Availability/cc65
560 <ref id="gotox" name="gotox">,
561 <ref id="gotoy" name="gotoy">,
562 <ref id="wherex" name="wherex">,
563 <ref id="wherey" name="wherey">
564 <tag/Example/Actual code using the function.
569 <sect1>gotoy<label id="gotoy"><p>
573 <tag/Function/Move the text mode cursor to a new Y position.
574 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
575 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
576 <tag/Description/The function moves the text mode cursor to the specified Y
577 position while leaving the X position untouched. The uppermost position on the
578 screen has the coordinate 0.
579 <tag/Limits/The function is only available as fastcall function, so it may
580 only be used in presence of a prototype. Invalid values for the Y position
581 (out of screen coordinates) may lead to undefined behaviour.
582 <tag/Availability/cc65
584 <ref id="gotox" name="gotox">,
585 <ref id="gotoxy" name="gotoxy">,
586 <ref id="wherex" name="wherex">,
587 <ref id="wherey" name="wherey">
588 <tag/Example/Actual code using the function.
593 <sect1>isalnum<label id="isalnum"><p>
597 <tag/Function/Check if a given character is a letter or digit.
598 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
599 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
600 <tag/Description/The function returns a value of zero if the given argument
601 is a letter or digit. The return value is non zero if the character
603 <tag/Limits/When compiling with <tt/-Os/ the function is actually a macro. The
604 generated inline sequence will not work correctly for values outside the range
605 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of this range. The non
606 inline function may be accessed by <tt/#undef/'ing the macro. When compiling
607 without <tt/-Os/, the function is only available as fastcall function, so it
608 may only be used in presence of a prototype.
609 <tag/Availability/ISO 9899
611 <ref id="isalpha" name="isalpha">,
612 <ref id="isascii" name="isascii">,
613 <ref id="isblank" name="isblank">,
614 <ref id="iscntrl" name="iscntrl">,
615 <ref id="isdigit" name="isdigit">,
616 <ref id="isgraph" name="isgraph">,
617 <ref id="islower" name="islower">,
618 <ref id="isprint" name="isprint">,
619 <ref id="ispunct" name="ispunct">,
620 <ref id="isspace" name="isspace">,
621 <ref id="isupper" name="isupper">,
622 <ref id="isxdigit" name="isxdigit">
623 <tag/Example/Actual code using the function.
628 <sect1>isalpha<label id="isalpha"><p>
632 <tag/Function/Check if a given character is a letter.
633 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
634 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
635 <tag/Description/The function returns a value of zero if the given argument
636 is a letter. The return value is non zero if the character is anything else.
637 <tag/Limits/When compiling with <tt/-Os/ the function is actually a macro. The
638 generated inline sequence will not work correctly for values outside the range
639 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of this range. The non
640 inline function may be accessed by <tt/#undef/'ing the macro. When compiling
641 without <tt/-Os/, the function is only available as fastcall function, so it
642 may only be used in presence of a prototype.
643 <tag/Availability/ISO 9899
645 <ref id="isalnum" name="isalnum">,
646 <ref id="isascii" name="isascii">,
647 <ref id="isblank" name="isblank">,
648 <ref id="iscntrl" name="iscntrl">,
649 <ref id="isdigit" name="isdigit">,
650 <ref id="isgraph" name="isgraph">,
651 <ref id="islower" name="islower">,
652 <ref id="isprint" name="isprint">,
653 <ref id="ispunct" name="ispunct">,
654 <ref id="isspace" name="isspace">,
655 <ref id="isupper" name="isupper">,
656 <ref id="isxdigit" name="isxdigit">
657 <tag/Example/Actual code using the function.
662 <sect1>isascii<label id="isascii"><p>
666 <tag/Function/Check if a given character is in the ASCII (0..127) range.
667 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
668 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
669 <tag/Description/The function returns a value of zero if the given argument
670 is in the range 0..127 (the range of valid ASCII characters) and a non zero
672 <tag/Limits/When compiling with <tt/-Os/ the function is actually a macro. The
673 generated inline sequence will not work correctly for values outside the range
674 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of this range. The non
675 inline function may be accessed by <tt/#undef/'ing the macro. When compiling
676 without <tt/-Os/, the function is only available as fastcall function, so it
677 may only be used in presence of a prototype.
678 <tag/Availability/ISO 9899
680 <ref id="isalnum" name="isalnum">,
681 <ref id="isalpha" name="isalpha">,
682 <ref id="isblank" name="isblank">,
683 <ref id="iscntrl" name="iscntrl">,
684 <ref id="isdigit" name="isdigit">,
685 <ref id="isgraph" name="isgraph">,
686 <ref id="islower" name="islower">,
687 <ref id="isprint" name="isprint">,
688 <ref id="ispunct" name="ispunct">,
689 <ref id="isspace" name="isspace">,
690 <ref id="isupper" name="isupper">,
691 <ref id="isxdigit" name="isxdigit">
692 <tag/Example/Actual code using the function.
697 <sect1>isblank<label id="isblank"><p>
701 <tag/Function/Check if a given character is a space or tab.
702 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
703 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
704 <tag/Description/The function returns a value of zero if the given argument
705 is a blank or space character. The return value is non zero if the character
707 <tag/Limits/When compiling with <tt/-Os/ the function is actually a macro. The
708 generated inline sequence will not work correctly for values outside the range
709 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of this range. The non
710 inline function may be accessed by <tt/#undef/'ing the macro. When compiling
711 without <tt/-Os/, the function is only available as fastcall function, so it
712 may only be used in presence of a prototype.
713 <tag/Availability/cc65
715 <ref id="isalnum" name="isalnum">,
716 <ref id="isalpha" name="isalpha">,
717 <ref id="isascii" name="isascii">,
718 <ref id="iscntrl" name="iscntrl">,
719 <ref id="isdigit" name="isdigit">,
720 <ref id="isgraph" name="isgraph">,
721 <ref id="islower" name="islower">,
722 <ref id="isprint" name="isprint">,
723 <ref id="ispunct" name="ispunct">,
724 <ref id="isspace" name="isspace">,
725 <ref id="isupper" name="isupper">,
726 <ref id="isxdigit" name="isxdigit">
727 <tag/Example/Actual code using the function.
732 <sect1>iscntrl<label id="iscntrl"><p>
736 <tag/Function/Check if a given character is a control character.
737 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
738 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
739 <tag/Description/The function returns a value of zero if the given argument
740 is a control character. The return value is non zero if the character
742 <tag/Limits/When compiling with <tt/-Os/ the function is actually a macro. The
743 generated inline sequence will not work correctly for values outside the range
744 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of this range. The non
745 inline function may be accessed by <tt/#undef/'ing the macro. When compiling
746 without <tt/-Os/, the function is only available as fastcall function, so it
747 may only be used in presence of a prototype.
748 <tag/Availability/ISO 9899
750 <ref id="isalnum" name="isalnum">,
751 <ref id="isalpha" name="isalpha">,
752 <ref id="isascii" name="isascii">,
753 <ref id="isblank" name="isblank">,
754 <ref id="isdigit" name="isdigit">,
755 <ref id="isgraph" name="isgraph">,
756 <ref id="islower" name="islower">,
757 <ref id="isprint" name="isprint">,
758 <ref id="ispunct" name="ispunct">,
759 <ref id="isspace" name="isspace">,
760 <ref id="isupper" name="isupper">,
761 <ref id="isxdigit" name="isxdigit">
762 <tag/Example/Actual code using the function.
767 <sect1>isdigit<label id="isdigit"><p>
771 <tag/Function/Check if a given character is a digit.
772 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
773 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
774 <tag/Description/The function returns a value of zero if the given argument
775 is a digit. The return value is non zero if the character is anything else.
776 <tag/Limits/When compiling with <tt/-Os/ the function is actually a macro. The
777 generated inline sequence will not work correctly for values outside the range
778 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of this range. The non
779 inline function may be accessed by <tt/#undef/'ing the macro. When compiling
780 without <tt/-Os/, the function is only available as fastcall function, so it
781 may only be used in presence of a prototype.
782 <tag/Availability/ISO 9899
784 <ref id="isalnum" name="isalnum">,
785 <ref id="isalpha" name="isalpha">,
786 <ref id="isascii" name="isascii">,
787 <ref id="isblank" name="isblank">,
788 <ref id="iscntrl" name="iscntrl">,
789 <ref id="isgraph" name="isgraph">,
790 <ref id="islower" name="islower">,
791 <ref id="isprint" name="isprint">,
792 <ref id="ispunct" name="ispunct">,
793 <ref id="isspace" name="isspace">,
794 <ref id="isupper" name="isupper">,
795 <ref id="isxdigit" name="isxdigit">
796 <tag/Example/Actual code using the function.
801 <sect1>isgraph<label id="isgraph"><p>
805 <tag/Function/Check if a given character is a printable character (except
807 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
808 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
809 <tag/Description/The function returns a value of zero if the given argument
810 is a printable character with the exception of space. The return value is non
811 zero if the character is anything else.
812 <tag/Limits/When compiling with <tt/-Os/ the function is actually a macro. The
813 generated inline sequence will not work correctly for values outside the range
814 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of this range. The non
815 inline function may be accessed by <tt/#undef/'ing the macro. When compiling
816 without <tt/-Os/, the function is only available as fastcall function, so it
817 may only be used in presence of a prototype.
818 <tag/Availability/ISO 9899
820 <ref id="isalnum" name="isalnum">,
821 <ref id="isalpha" name="isalpha">,
822 <ref id="isascii" name="isascii">,
823 <ref id="isblank" name="isblank">,
824 <ref id="iscntrl" name="iscntrl">,
825 <ref id="isdigit" name="isdigit">,
826 <ref id="islower" name="islower">,
827 <ref id="isprint" name="isprint">,
828 <ref id="ispunct" name="ispunct">,
829 <ref id="isspace" name="isspace">,
830 <ref id="isupper" name="isupper">,
831 <ref id="isxdigit" name="isxdigit">
832 <tag/Example/Actual code using the function.
837 <sect1>islower<label id="islower"><p>
841 <tag/Function/Check if a given character is a lower case letter.
842 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
843 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
844 <tag/Description/The function returns a value of zero if the given argument
845 is a lower case letter. The return value is non zero if the character is
847 <tag/Limits/When compiling with <tt/-Os/ the function is actually a macro. The
848 generated inline sequence will not work correctly for values outside the range
849 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of this range. The non
850 inline function may be accessed by <tt/#undef/'ing the macro. When compiling
851 without <tt/-Os/, the function is only available as fastcall function, so it
852 may only be used in presence of a prototype.
853 <tag/Availability/ISO 9899
855 <ref id="isalnum" name="isalnum">,
856 <ref id="isalpha" name="isalpha">,
857 <ref id="isascii" name="isascii">,
858 <ref id="isblank" name="isblank">,
859 <ref id="iscntrl" name="iscntrl">,
860 <ref id="isdigit" name="isdigit">,
861 <ref id="isgraph" name="isgraph">,
862 <ref id="isprint" name="isprint">,
863 <ref id="ispunct" name="ispunct">,
864 <ref id="isspace" name="isspace">,
865 <ref id="isupper" name="isupper">,
866 <ref id="isxdigit" name="isxdigit">
867 <tag/Example/Actual code using the function.
872 <sect1>isprint<label id="isprint"><p>
876 <tag/Function/Check if a given character is a printable character.
877 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
878 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
879 <tag/Description/The function returns a value of zero if the given argument
880 is a printable character (this includes the space character). The return value
881 is non zero if the character is anything else.
882 <tag/Limits/When compiling with <tt/-Os/ the function is actually a macro. The
883 generated inline sequence will not work correctly for values outside the range
884 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of this range. The non
885 inline function may be accessed by <tt/#undef/'ing the macro. When compiling
886 without <tt/-Os/, the function is only available as fastcall function, so it
887 may only be used in presence of a prototype.
888 <tag/Availability/ISO 9899
890 <ref id="isalnum" name="isalnum">,
891 <ref id="isalpha" name="isalpha">,
892 <ref id="isascii" name="isascii">,
893 <ref id="isblank" name="isblank">,
894 <ref id="iscntrl" name="iscntrl">,
895 <ref id="isdigit" name="isdigit">,
896 <ref id="isgraph" name="isgraph">,
897 <ref id="islower" name="islower">,
898 <ref id="ispunct" name="ispunct">,
899 <ref id="isspace" name="isspace">,
900 <ref id="isupper" name="isupper">,
901 <ref id="isxdigit" name="isxdigit">
902 <tag/Example/Actual code using the function.
907 <sect1>ispunct<label id="ispunct"><p>
911 <tag/Function/Check if a given character is a printable character but not a
912 space or an alphanumeric character.
913 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
914 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
915 <tag/Description/The function returns a value of zero if the given argument
916 is a printable character, but not a space or anything alphanumeric. The return
917 value is non zero if the character is anything else.
918 <tag/Limits/When compiling with <tt/-Os/ the function is actually a macro. The
919 generated inline sequence will not work correctly for values outside the range
920 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of this range. The non
921 inline function may be accessed by <tt/#undef/'ing the macro. When compiling
922 without <tt/-Os/, the function is only available as fastcall function, so it
923 may only be used in presence of a prototype.
924 <tag/Availability/ISO 9899
926 <ref id="isalnum" name="isalnum">,
927 <ref id="isalpha" name="isalpha">,
928 <ref id="isascii" name="isascii">,
929 <ref id="isblank" name="isblank">,
930 <ref id="iscntrl" name="iscntrl">,
931 <ref id="isdigit" name="isdigit">,
932 <ref id="isgraph" name="isgraph">,
933 <ref id="islower" name="islower">,
934 <ref id="isprint" name="isprint">,
935 <ref id="isspace" name="isspace">,
936 <ref id="isupper" name="isupper">,
937 <ref id="isxdigit" name="isxdigit">
938 <tag/Example/Actual code using the function.
943 <sect1>isspace<label id="isspace"><p>
947 <tag/Function/Check if a given character is a a white-space character.
948 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
949 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
950 <tag/Description/The function returns a value of zero if the given argument
951 is a white space character. The return value is non zero if the character is
952 anything else. The standard white space characters are: space, formfeed ('\f'),
953 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
955 <tag/Limits/When compiling with <tt/-Os/ the function is actually a macro. The
956 generated inline sequence will not work correctly for values outside the range
957 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of this range. The non
958 inline function may be accessed by <tt/#undef/'ing the macro. When compiling
959 without <tt/-Os/, the function is only available as fastcall function, so it
960 may only be used in presence of a prototype.
961 <tag/Availability/ISO 9899
963 <ref id="isalnum" name="isalnum">,
964 <ref id="isalpha" name="isalpha">,
965 <ref id="isascii" name="isascii">,
966 <ref id="isblank" name="isblank">,
967 <ref id="iscntrl" name="iscntrl">,
968 <ref id="isdigit" name="isdigit">,
969 <ref id="isgraph" name="isgraph">,
970 <ref id="islower" name="islower">,
971 <ref id="isprint" name="isprint">,
972 <ref id="ispunct" name="ispunct">,
973 <ref id="isupper" name="isupper">,
974 <ref id="isxdigit" name="isxdigit">
975 <tag/Example/Actual code using the function.
980 <sect1>isupper<label id="isupper"><p>
984 <tag/Function/Check if a given character is an upper case letter.
985 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
986 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
987 <tag/Description/The function returns a value of zero if the given argument
988 is an upper case letter. The return value is non zero if the character is
990 <tag/Limits/When compiling with <tt/-Os/ the function is actually a macro. The
991 generated inline sequence will not work correctly for values outside the range
992 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of this range. The non
993 inline function may be accessed by <tt/#undef/'ing the macro. When compiling
994 without <tt/-Os/, the function is only available as fastcall function, so it
995 may only be used in presence of a prototype.
996 <tag/Availability/ISO 9899
998 <ref id="isalnum" name="isalnum">,
999 <ref id="isalpha" name="isalpha">,
1000 <ref id="isascii" name="isascii">,
1001 <ref id="isblank" name="isblank">,
1002 <ref id="iscntrl" name="iscntrl">,
1003 <ref id="isdigit" name="isdigit">,
1004 <ref id="isgraph" name="isgraph">,
1005 <ref id="islower" name="islower">,
1006 <ref id="isprint" name="isprint">,
1007 <ref id="ispunct" name="ispunct">,
1008 <ref id="isspace" name="isspace">,
1009 <ref id="isxdigit" name="isxdigit">
1010 <tag/Example/Actual code using the function.
1015 <sect1>isxdigit<label id="isxdigit"><p>
1019 <tag/Function/Check if a given character is a hexadecimal digit.
1020 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1021 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
1022 <tag/Description/The function returns a value of zero if the given argument
1023 is a hexadecimal digit (0..9, a..f and A..F). The return value is non zero
1024 if the character is anything else.
1025 <tag/Limits/When compiling with <tt/-Os/ the function is actually a macro. The
1026 generated inline sequence will not work correctly for values outside the range
1027 0..255. <bf/Note:/ The constant <tt/EOF/ is not part of this range. The non
1028 inline function may be accessed by <tt/#undef/'ing the macro. When compiling
1029 without <tt/-Os/, the function is only available as fastcall function, so it
1030 may only be used in presence of a prototype.
1031 <tag/Availability/ISO 9899
1033 <ref id="isalnum" name="isalnum">,
1034 <ref id="isalpha" name="isalpha">,
1035 <ref id="isascii" name="isascii">,
1036 <ref id="isblank" name="isblank">,
1037 <ref id="iscntrl" name="iscntrl">,
1038 <ref id="isdigit" name="isdigit">,
1039 <ref id="isgraph" name="isgraph">,
1040 <ref id="islower" name="islower">,
1041 <ref id="isprint" name="isprint">,
1042 <ref id="ispunct" name="ispunct">,
1043 <ref id="isspace" name="isspace">,
1044 <ref id="isupper" name="isupper">
1045 <tag/Example/Actual code using the function.
1050 <sect1>kbhit<label id="kbhit"><p>
1054 <tag/Function/Check if there's a key waiting in the keyboard buffer.
1055 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1056 <tag/Declaration/<tt/unsigned char kbhit (void);/
1057 <tag/Description/The function returns a value of zero if there is no character
1058 waiting to be read from the keyboard. It returns non zero otherwise.
1059 <tag/Limits/If the system does not support a keyboard buffer (most systems
1060 do), the function is rather useless.
1061 <tag/Availability/cc65
1063 <ref id="cgetc" name="cgetc">,
1064 <ref id="cursor" name="cursor">
1065 <tag/Example/Actual code using the function.
1070 <sect1>revers<label id="revers"><p>
1074 <tag/Function/Control revers character display.
1075 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1076 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
1077 <tag/Description/If the argument is non zero, the function enables reverse
1078 character display. If the argument is zero, reverse character display is
1079 switched off. The old value of the setting is returned.
1080 <tag/Limits/The function may not be supported by the hardware, in which case
1081 the call is ignored. The function is only available as fastcall function, so it
1082 may only be used in presence of a prototype.
1083 <tag/Availability/cc65
1085 <ref id="textcolor" name="textcolor">
1086 <tag/Example/Actual code using the function.
1091 <sect1>screensize<label id="screensize"><p>
1095 <tag/Function/Return the dimensions of the text mode screen.
1096 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1097 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
1098 <tag/Description/The function returns the dimensions of the text mode screen.
1099 <tag/Limits/The function is only available as fastcall function, so it may only
1100 be used in presence of a prototype.
1101 <tag/Availability/cc65
1103 <ref id="gotox" name="gotox">,
1104 <ref id="gotoxy" name="gotoxy">,
1105 <ref id="gotoy" name="gotoy">,
1106 <ref id="wherex" name="wherex">,
1107 <ref id="wherey" name="wherey">
1108 <tag/Example/Actual code using the function.
1113 <sect1>textcolor<label id="textcolor"><p>
1117 <tag/Function/Set the text color.
1118 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1119 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
1120 <tag/Description/The function will set a new text color. It returns the old
1121 (current) text color. Text output using any <tt/conio.h/ function will use
1122 the color set by this function.
1123 <tag/Limits/Text colors are system dependent. The function may have no effect
1124 on systems where the text color cannot be changed. The function is only
1125 available as fastcall function, so it may only be used in presence of a
1127 <tag/Availability/cc65
1129 <ref id="bgcolor" name="bgcolor">,
1130 <ref id="bordercolor" name="bordercolor">
1131 <tag/Example/Actual code using the function.
1136 <sect1>tolower<label id="tolower"><p>
1140 <tag/Function/Convert a character into its lower case representation.
1141 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1142 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
1143 <tag/Description/The function returns the given character converted to lower
1144 case. If the given character is not a letter, it is returned unchanged.
1145 <tag/Limits/The function is only available as fastcall function, so it may
1146 only be used in presence of a prototype.
1147 <tag/Availability/ISO 9899
1149 <ref id="islower" name="islower">,
1150 <ref id="isupper" name="isupper">,
1151 <ref id="toupper" name="toupper">
1152 <tag/Example/Actual code using the function.
1157 <sect1>toupper<label id="toupper"><p>
1161 <tag/Function/Convert a character into its upper case representation.
1162 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
1163 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
1164 <tag/Description/The function returns the given character converted to upper
1165 case. If the given character is not a letter, it is returned unchanged.
1166 <tag/Limits/The function is only available as fastcall function, so it may
1167 only be used in presence of a prototype.
1168 <tag/Availability/ISO 9899
1170 <ref id="islower" name="islower">,
1171 <ref id="isupper" name="isupper">,
1172 <ref id="tolower" name="tolower">
1173 <tag/Example/Actual code using the function.
1178 <sect1>wherex<label id="wherex"><p>
1182 <tag/Function/Return the current X position of the text mode cursor.
1183 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1184 <tag/Declaration/<tt/unsigned char wherex (void);/
1185 <tag/Description/The function returns the current X position of the text mode
1186 cursor. Zero is returned for the leftmost screen position.
1187 <tag/Availability/cc65
1189 <ref id="gotox" name="gotox">,
1190 <ref id="gotoy" name="gotoy">,
1191 <ref id="gotoxy" name="gotoxy">,
1192 <ref id="wherey" name="wherey">
1193 <tag/Example/Actual code using the function.
1198 <sect1>wherey<label id="wherey"><p>
1202 <tag/Function/Return the current Y position of the text mode cursor.
1203 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1204 <tag/Declaration/<tt/unsigned char wherey (void);/
1205 <tag/Description/The function returns the current Y position of the text mode
1206 cursor. Zero is returned for the uppermost screen position.
1207 <tag/Availability/cc65
1209 <ref id="gotox" name="gotox">,
1210 <ref id="gotoy" name="gotoy">,
1211 <ref id="gotoxy" name="gotoxy">,
1212 <ref id="wherex" name="wherex">
1213 <tag/Example/Actual code using the function.