1 <!doctype linuxdoc system> <!-- -*- text-mode -*- -->
4 <title>cc65 function reference
5 <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
6 <url url="mailto:greg.king5@verizon.net" name="Greg King">
10 cc65 is a C compiler for 6502 based systems. This function reference describes
11 the C functions available in the standard library.
14 <!-- Table of contents -->
17 <!-- Begin the document -->
21 cc65 is a C compiler for 6502 based systems. It implements a subset of the ISO
22 C standard plus additional functions specially crafted for 6502 systems or
23 just some of the supported machines. This function refrence describes the
24 available functions together with any limitations.
26 For an overview about the available libraries, their purpose, and any
27 differences to the ISO standard, please have a look at the <url
28 url="library.html" name="cc65 Library Overview">.
30 <em/Note:/ Standard C functions are listed here, but not described in detail.
31 Since these functions behave identical on all standard compliant systems, they
32 are described in any book covering standard C.
34 Each entry for a function contains a detailed description
38 <tag/Function/Summary of what <bf/function/ does.
39 <tag/Header/The header file that contains the declaration.
40 <tag/Declaration/Describes the needed header files and declaration of the
42 <tag/Description/Description of the function.
43 <tag/Notes/Notes on the function.
44 <tag/Availability/The availability of the function.
45 <tag/See also/Other related functions.
46 <tag/Example/A piece of actual code using the function.
51 <sect>Functions by header file<p>
53 <sect1><tt/6502.h/<label id="6502.h"><p>
56 <item><ref id="BRK" name="BRK">
57 <item><ref id="CLI" name="CLI">
58 <item><ref id="SEI" name="SEI">
59 <item><ref id="_sys" name="_sys">
60 <item><ref id="getcpu" name="getcpu">
61 <item><ref id="reset_brk" name="reset_brk">
62 <item><ref id="reset_irq" name="reset_irq">
63 <item><ref id="set_brk" name="set_brk">
64 <item><ref id="set_irq" name="set_irq">
68 <sect1><tt/apple2.h/<label id="apple2.h"><p>
72 <item><ref id="get_ostype" name="get_ostype">
77 <sect1><tt/apple2enh.h/<label id="apple2enh.h"><p>
81 <item><ref id="get_ostype" name="get_ostype">
85 <item><ref id="videomode" name="videomode">
89 <sect1><tt/assert.h/<label id="assert.h"><p>
92 <item><ref id="assert" name="assert">
96 <sect1><tt/atari.h/<label id="atari.h"><p>
99 <!-- <item><ref id="_getcolor" name="_getcolor"> -->
100 <!-- <item><ref id="_getdefdev" name="_getdefdev"> -->
101 <!-- <item><ref id="_graphics" name="_graphics"> -->
102 <item><ref id="_is_cmdline_dos" name="_is_cmdline_dos">
103 <!-- <item><ref id="_rest_vecs" name="_rest_vecs"> -->
104 <!-- <item><ref id="_save_vecs" name="_save_vecs"> -->
105 <!-- <item><ref id="_scroll" name="_scroll"> -->
106 <!-- <item><ref id="_setcolor" name="_setcolor"> -->
107 <!-- <item><ref id="_setcolor_low" name="_setcolor_low"> -->
108 <item><ref id="get_ostype" name="get_ostype">
109 <!-- <item><ref id="get_tv" name="get_tv"> -->
115 <sect1><tt/atmos.h/<label id="atmos.h"><p>
118 <item><ref id="atmos_explode" name="atmos_explode">
119 <item><ref id="atmos_load" name="atmos_load">
120 <item><ref id="atmos_ping" name="atmos_ping">
121 <item><ref id="atmos_save" name="atmos_save">
122 <item><ref id="atmos_shoot" name="atmos_shoot">
123 <item><ref id="atmos_tick" name="atmos_tick">
124 <item><ref id="atmos_tock" name="atmos_tock">
125 <item><ref id="atmos_zap" name="atmos_zap">
129 <sect1><tt/c128.h/<label id="c128.h"><p>
132 <item><ref id="c64mode" name="c64mode">
133 <item><ref id="fast" name="fast">
134 <item><ref id="slow" name="slow">
135 <item><ref id="toggle_videomode" name="toggle_videomode">
136 <item><ref id="videomode" name="videomode">
140 <sect1><tt/c16.h/<label id="c16.h"><p>
145 <sect1><tt/c64.h/<label id="c64.h"><p>
148 <item><ref id="get_ostype" name="get_ostype">
152 <sect1><tt/cbm.h/<label id="cbm.h"><p>
155 <item><ref id="cbm_k_acptr" name="cbm_k_acptr">
156 <item><ref id="cbm_k_basin" name="cbm_k_basin">
157 <item><ref id="cbm_k_bsout" name="cbm_k_bsout">
158 <item><ref id="cbm_k_chkin" name="cbm_k_chkin">
159 <item><ref id="cbm_k_ciout" name="cbm_k_ciout">
160 <item><ref id="cbm_k_ckout" name="cbm_k_ckout">
161 <item><ref id="cbm_k_clall" name="cbm_k_clall">
162 <item><ref id="cbm_k_close" name="cbm_k_close">
163 <item><ref id="cbm_k_clrch" name="cbm_k_clrch">
164 <item><ref id="cbm_k_getin" name="cbm_k_getin">
165 <item><ref id="cbm_k_iobase" name="cbm_k_iobase">
166 <item><ref id="cbm_k_listen" name="cbm_k_listen">
167 <item><ref id="cbm_k_load" name="cbm_k_load">
168 <item><ref id="cbm_k_open" name="cbm_k_open">
169 <item><ref id="cbm_k_readst" name="cbm_k_readst">
170 <item><ref id="cbm_k_save" name="cbm_k_save">
171 <item><ref id="cbm_k_scnkey" name="cbm_k_scnkey">
172 <item><ref id="cbm_k_setlfs" name="cbm_k_setlfs">
173 <item><ref id="cbm_k_setnam" name="cbm_k_setnam">
174 <item><ref id="cbm_k_talk" name="cbm_k_talk">
175 <item><ref id="cbm_k_udtim" name="cbm_k_udtim">
176 <item><ref id="cbm_k_unlsn" name="cbm_k_unlsn">
177 <!-- <item><ref id="cbm_load" name="cbm_load"> -->
178 <!-- <item><ref id="cbm_open" name="cbm_open"> -->
179 <!-- <item><ref id="cbm_opendir" name="cbm_opendir"> -->
180 <!-- <item><ref id="cbm_read" name="cbm_read"> -->
181 <!-- <item><ref id="cbm_readdir" name="cbm_readdir"> -->
182 <!-- <item><ref id="cbm_save" name="cbm_save"> -->
183 <!-- <item><ref id="cbm_write" name="cbm_write"> -->
184 <!-- <item><ref id="get_tv" name="get_tv"> -->
185 <item><ref id="waitvsync" name="waitvsync">
186 <item><ref id="kbrepeat" name="kbrepeat">
192 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
195 <item><ref id="peekbsys" name="peekbsys">
196 <item><ref id="peekwsys" name="peekwsys">
197 <item><ref id="pokebsys" name="pokebsys">
198 <item><ref id="pokewsys" name="pokewsys">
202 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
205 <item><ref id="peekbsys" name="peekbsys">
206 <item><ref id="peekwsys" name="peekwsys">
207 <item><ref id="pokebsys" name="pokebsys">
208 <item><ref id="pokewsys" name="pokewsys">
212 <sect1><tt/cc65.h/<label id="cc65.h"><p>
215 <!-- <item><ref id="cc65_cos" name="cc65_cos"> -->
216 <!-- <item><ref id="cc65_idiv32by16r16" name="cc65_idiv32by16r16"> -->
217 <!-- <item><ref id="cc65_imul16x16r32" name="cc65_imul16x16r32"> -->
218 <!-- <item><ref id="cc65_imul8x8r16" name="cc65_imul8x8r16"> -->
219 <!-- <item><ref id="cc65_sin" name="cc65_sin"> -->
220 <!-- <item><ref id="cc65_udiv32by16r16" name="cc65_udiv32by16r16"> -->
221 <!-- <item><ref id="cc65_umul16x16r32" name="cc65_umul16x16r32"> -->
222 <!-- <item><ref id="cc65_umul16x8r32" name="cc65_umul16x8r32"> -->
223 <!-- <item><ref id="cc65_umul8x8r16" name="cc65_umul8x8r16"> -->
224 <item><ref id="doesclrscrafterexit" name="doesclrscrafterexit">
230 <sect1><tt/conio.h/<label id="conio.h"><p>
233 <item><ref id="bgcolor" name="bgcolor">
234 <item><ref id="bordercolor" name="bordercolor">
235 <item><ref id="cclear" name="cclear">
236 <item><ref id="cclearxy" name="cclearxy">
237 <item><ref id="cgetc" name="cgetc">
238 <item><ref id="chline" name="chline">
239 <item><ref id="chlinexy" name="chlinexy">
240 <item><ref id="clrscr" name="clrscr">
241 <item><ref id="cpeekc" name="cpeekc">
242 <item><ref id="cpeekcolor" name="cpeekcolor">
243 <item><ref id="cpeekrevers" name="cpeekrevers">
244 <item><ref id="cpeeks" name="cpeeks">
245 <item><ref id="cprintf" name="cprintf">
246 <item><ref id="cputc" name="cputc">
247 <item><ref id="cputcxy" name="cputcxy">
248 <item><ref id="cputs" name="cputs">
249 <item><ref id="cputsxy" name="cputsxy">
250 <item><ref id="cursor" name="cursor">
251 <item><ref id="cvline" name="cvline">
252 <item><ref id="cvlinexy" name="cvlinexy">
253 <item><ref id="gotox" name="gotox">
254 <item><ref id="gotoxy" name="gotoxy">
255 <item><ref id="gotoy" name="gotoy">
256 <item><ref id="kbhit" name="kbhit">
257 <item><ref id="revers" name="revers">
258 <item><ref id="screensize" name="screensize">
259 <item><ref id="textcolor" name="textcolor">
260 <item><ref id="vcprintf" name="vcprintf">
261 <item><ref id="wherex" name="wherex">
262 <item><ref id="wherey" name="wherey">
266 <sect1><tt/ctype.h/<label id="ctype.h"><p>
269 <item><ref id="isalnum" name="isalnum">
270 <item><ref id="isalpha" name="isalpha">
271 <item><ref id="isascii" name="isascii">
272 <item><ref id="isblank" name="isblank">
273 <item><ref id="iscntrl" name="iscntrl">
274 <item><ref id="isdigit" name="isdigit">
275 <item><ref id="isgraph" name="isgraph">
276 <item><ref id="islower" name="islower">
277 <item><ref id="isprint" name="isprint">
278 <item><ref id="ispunct" name="ispunct">
279 <item><ref id="isspace" name="isspace">
280 <item><ref id="isupper" name="isupper">
281 <item><ref id="isxdigit" name="isxdigit">
282 <item><ref id="tolower" name="tolower">
283 <item><ref id="toupper" name="toupper">
287 <sect1><tt/dbg.h/<label id="dbg.h"><p>
290 <!-- <item><ref id="DbgInit" name="DbgInit"> -->
296 <sect1><tt/device.h/<label id="device.h"><p>
299 <item><ref id="getcurrentdevice" name="getcurrentdevice">
300 <item><ref id="getdevicedir" name="getdevicedir">
301 <item><ref id="getfirstdevice" name="getfirstdevice">
302 <item><ref id="getnextdevice" name="getnextdevice">
306 <sect1><tt/dio.h/<label id="dio.h"><p>
308 <url url="dio.html" name="Low-level disk I/O API">.
311 <sect1><tt/dirent.h/<label id="dirent.h"><p>
314 <item><ref id="_DE_ISDIR" name="_DE_ISDIR">
315 <item><ref id="_DE_ISLBL" name="_DE_ISLBL">
316 <item><ref id="_DE_ISLNK" name="_DE_ISLNK">
317 <item><ref id="_DE_ISREG" name="_DE_ISREG">
318 <item><ref id="closedir" name="closedir">
319 <item><ref id="opendir" name="opendir">
320 <item><ref id="readdir" name="readdir">
321 <item><ref id="rewinddir" name="rewinddir">
322 <item><ref id="seekdir" name="seekdir">
323 <item><ref id="telldir" name="telldir">
327 <sect1><tt/em.h/<label id="em.h"><p>
330 <item><ref id="em_commit" name="em_commit">
331 <item><ref id="em_copyfrom" name="em_copyfrom">
332 <item><ref id="em_copyto" name="em_copyto">
333 <item><ref id="em_install" name="em_install">
334 <item><ref id="em_load_driver" name="em_load_driver">
335 <item><ref id="em_map" name="em_map">
336 <item><ref id="em_pagecount" name="em_pagecount">
337 <item><ref id="em_uninstall" name="em_uninstall">
338 <item><ref id="em_unload" name="em_unload">
339 <item><ref id="em_use" name="em_use">
343 <sect1><tt/errno.h/<label id="errno.h"><p>
346 <!-- <item><ref id="_directerrno" name="_directerrno"> -->
347 <!-- <item><ref id="_mappederrno" name="_mappederrno"> -->
348 <!-- <item><ref id="_osmaperrno" name="_osmaperrno"> -->
349 <!-- <item><ref id="_seterrno" name="_seterrno"> -->
355 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
358 <item><ref id="close" name="close">
359 <item><ref id="creat" name="creat">
360 <item><ref id="open" name="open">
364 <sect1><tt/gamate.h/<label id="gamate.h"><p>
367 <!-- <item><ref id="get_tv" name="get_tv"> -->
368 <item><ref id="waitvsync" name="waitvsync">
374 <sect1><tt/geos.h/<label id="geos.h"><p>
376 <url url="geos.html" name="GEOS API">.
379 <sect1><tt/joystick.h/<label id="joystick.h"><p>
382 <item><ref id="joy_count" name="joy_count">
383 <item><ref id="joy_install" name="joy_install">
384 <item><ref id="joy_load_driver" name="joy_load_driver">
385 <item><ref id="joy_read" name="joy_read">
386 <item><ref id="joy_uninstall" name="joy_uninstall">
387 <item><ref id="joy_unload" name="joy_unload">
391 <sect1><tt/locale.h/<label id="locale.h"><p>
394 <item><ref id="localeconv" name="localeconv">
395 <item><ref id="setlocale" name="setlocale">
399 <sect1><tt/lynx.h/<label id="lynx.h"><p>
402 <!-- <item><ref id="lynx_eeprom_erase" name="lynx_eeprom_erase"> -->
403 <!-- <item><ref id="lynx_eeprom_read" name="lynx_eeprom_read"> -->
404 <!-- <item><ref id="lynx_eeprom_write" name="lynx_eeprom_write"> -->
405 <!-- <item><ref id="lynx_eeread" name="lynx_eeread"> -->
406 <!-- <item><ref id="lynx_eewrite" name="lynx_eewrite"> -->
407 <!-- <item><ref id="lynx_exec" name="lynx_exec"> -->
408 <!-- <item><ref id="lynx_load" name="lynx_load"> -->
414 <sect1><tt/lz4.h/<label id="lz4.h"><p>
417 <item><ref id="decompress_lz4" name="decompress_lz4">
421 <sect1><tt/modload.h/<label id="modload.h"><p>
424 <item><ref id="mod_load" name="mod_load">
425 <item><ref id="mod_free" name="mod_free">
429 <sect1><tt/mouse.h/<label id="mouse.h"><p>
432 <item><ref id="mouse_buttons" name="mouse_buttons">
433 <item><ref id="mouse_getbox" name="mouse_getbox">
434 <item><ref id="mouse_geterrormsg" name="mouse_geterrormsg">
435 <item><ref id="mouse_hide" name="mouse_hide">
436 <item><ref id="mouse_info" name="mouse_info">
437 <item><ref id="mouse_install" name="mouse_install">
438 <item><ref id="mouse_ioctl" name="mouse_ioctl">
439 <item><ref id="mouse_load_driver" name="mouse_load_driver">
440 <item><ref id="mouse_move" name="mouse_move">
441 <item><ref id="mouse_pos" name="mouse_pos">
442 <item><ref id="mouse_setbox" name="mouse_setbox">
443 <item><ref id="mouse_show" name="mouse_show">
444 <item><ref id="mouse_uninstall" name="mouse_uninstall">
445 <item><ref id="mouse_unload" name="mouse_unload">
449 <sect1><tt/nes.h/<label id="nes.h"><p>
452 <!-- <item><ref id="get_tv" name="get_tv"> -->
453 <item><ref id="waitvsync" name="waitvsync">
459 <sect1><tt/o65.h/<label id="o65.h"><p>
461 The <tt/o65.h/ header file contains structure and constant definitions that
462 may be used when dealing with files in <url
463 url="http://www.6502.org/users/andre/o65/fileformat.html" name="the o65 format">.
464 It does not declare any functions.
467 <sect1><tt/pce.h/<label id="pce.h"><p>
470 <!-- <item><ref id="get_tv" name="get_tv"> -->
471 <item><ref id="waitvsync" name="waitvsync">
477 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
480 <item><ref id="PEEK" name="PEEK">
481 <item><ref id="PEEKW" name="PEEKW">
482 <item><ref id="POKE" name="POKE">
483 <item><ref id="POKEW" name="POKEW">
487 <sect1><tt/pen.h/<label id="pen.h"><p>
490 <!-- <item><ref id="pen_adjust" name="pen_adjust"> -->
491 <!-- <item><ref id="pen_calibrate" name="pen_calibrate"> -->
497 <sect1><tt/pet.h/<label id="pet.h"><p>
502 <sect1><tt/plus4.h/<label id="plus4.h"><p>
507 <sect1><tt/serial.h/<label id="serial.h"><p>
509 The <tt/serial.h/ header file contains definitions for initializing serial
513 <item><ref id="ser_close" name="ser_close">
514 <item><ref id="ser_get" name="ser_get">
515 <item><ref id="ser_install" name="ser_install">
516 <item><ref id="ser_ioctl" name="ser_ioctl">
517 <item><ref id="ser_load_driver" name="ser_load_driver">
518 <item><ref id="ser_open" name="ser_open">
519 <item><ref id="ser_put" name="ser_put">
520 <item><ref id="ser_status" name="ser_status">
521 <item><ref id="ser_uninstall" name="ser_uninstall">
522 <item><ref id="ser_unload" name="ser_unload">
526 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
529 <item><ref id="setjmp" name="setjmp">
530 <item><ref id="longjmp" name="longjmp">
534 <sect1><tt/signal.h/<label id="signal.h"><p>
537 <item><ref id="raise" name="raise">
538 <item><ref id="signal" name="signal">
542 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
547 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
552 <sect1><tt/stddef.h/<label id="stddef.h"><p>
555 <item><ref id="offsetof" name="offsetof">
559 <sect1><tt/stdio.h/<label id="stdio.h"><p>
562 <item><ref id="_poserror" name="_poserror">
563 <item><ref id="clearerr" name="clearerr">
564 <!-- <item><ref id="fclose" name="fclose"> -->
565 <!-- <item><ref id="fdopen" name="fdopen"> -->
566 <item><ref id="feof" name="feof">
567 <item><ref id="ferror" name="ferror">
568 <!-- <item><ref id="fflush" name="fflush"> -->
569 <!-- <item><ref id="fgetc" name="fgetc"> -->
570 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
571 <!-- <item><ref id="fgets" name="fgets"> -->
572 <item><ref id="fileno" name="fileno">
573 <!-- <item><ref id="fopen" name="fopen"> -->
574 <!-- <item><ref id="fprintf" name="fprintf"> -->
575 <!-- <item><ref id="fputc" name="fputc"> -->
576 <!-- <item><ref id="fputs" name="fputs"> -->
577 <!-- <item><ref id="fread" name="fread"> -->
578 <!-- <item><ref id="freopen" name="freopen"> -->
579 <!-- <item><ref id="fscanf" name="fscanf"> -->
580 <!-- <item><ref id="fseek" name="fseek"> -->
581 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
582 <!-- <item><ref id="ftell" name="ftell"> -->
583 <!-- <item><ref id="fwrite" name="fwrite"> -->
584 <!-- <item><ref id="getc" name="getc"> -->
585 <!-- <item><ref id="getchar" name="getchar"> -->
586 <!-- <item><ref id="gets" name="gets"> -->
587 <!-- <item><ref id="printf" name="printf"> -->
588 <!-- <item><ref id="putc" name="putc"> -->
589 <!-- <item><ref id="putchar" name="putchar"> -->
590 <!-- <item><ref id="puts" name="puts"> -->
591 <item><ref id="rename" name="rename">
592 <item><ref id="remove" name="remove">
593 <!-- <item><ref id="rewind" name="rewind"> -->
594 <!-- <item><ref id="scanf" name="scanf"> -->
595 <!-- <item><ref id="snprintf" name="snprintf"> -->
596 <!-- <item><ref id="sprintf" name="sprintf"> -->
597 <!-- <item><ref id="sscanf" name="sscanf"> -->
598 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
599 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
600 <!-- <item><ref id="vprintf" name="vprintf"> -->
601 <!-- <item><ref id="vscanf" name="vscanf"> -->
602 <!-- <item><ref id="vsnprintf" name="vsnprintf"> -->
603 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
604 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
610 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
613 <item><ref id="_heapadd" name="_heapadd">
614 <item><ref id="_heapblocksize" name="_heapblocksize">
615 <item><ref id="_heapmaxavail" name="_heapmaxavail">
616 <item><ref id="_heapmemavail" name="_heapmemavail">
617 <item><ref id="_randomize" name="_randomize">
618 <item><ref id="_swap" name="_swap">
619 <item><ref id="abort" name="abort">
620 <item><ref id="abs" name="abs">
621 <item><ref id="atexit" name="atexit">
622 <item><ref id="atoi" name="atoi">
623 <item><ref id="atol" name="atol">
624 <item><ref id="bsearch" name="bsearch">
625 <item><ref id="calloc" name="calloc">
626 <item><ref id="div" name="div">
627 <item><ref id="exit" name="exit">
628 <item><ref id="free" name="free">
629 <item><ref id="getenv" name="getenv">
630 <item><ref id="itoa" name="itoa">
631 <item><ref id="labs" name="labs">
632 <item><ref id="ltoa" name="ltoa">
633 <item><ref id="malloc" name="malloc">
634 <item><ref id="perror" name="perror">
635 <!-- <item><ref id="posix_memalign" name="posix_memalign"> -->
636 <!-- <item><ref id="putenv" name="putenv"> -->
637 <item><ref id="qsort" name="qsort">
638 <item><ref id="rand" name="rand">
639 <item><ref id="realloc" name="realloc">
640 <item><ref id="srand" name="srand">
641 <!-- <item><ref id="system" name="system"> -->
642 <item><ref id="ultoa" name="ultoa">
643 <item><ref id="utoa" name="utoa">
649 <sect1><tt/string.h/<label id="string.h"><p>
652 <item><ref id="_stroserror" name="_stroserror">
653 <item><ref id="bzero" name="bzero">
654 <item><ref id="memchr" name="memchr">
655 <item><ref id="memcmp" name="memcmp">
656 <item><ref id="memcpy" name="memcpy">
657 <item><ref id="memmove" name="memmove">
658 <item><ref id="memset" name="memset">
659 <item><ref id="strcasecmp" name="strcasecmp">
660 <item><ref id="strcat" name="strcat">
661 <item><ref id="strchr" name="strchr">
662 <item><ref id="strcmp" name="strcmp">
663 <item><ref id="strcoll" name="strcoll">
664 <item><ref id="strcpy" name="strcpy">
665 <item><ref id="strcspn" name="strcspn">
666 <item><ref id="strdup" name="strdup">
667 <item><ref id="strerror" name="strerror">
668 <item><ref id="stricmp" name="stricmp">
669 <item><ref id="strlen" name="strlen">
670 <item><ref id="strlower" name="strlower">
671 <item><ref id="strlwr" name="strlwr">
672 <item><ref id="strncasecmp" name="strncasecmp">
673 <item><ref id="strncat" name="strncat">
674 <item><ref id="strncmp" name="strncmp">
675 <item><ref id="strncpy" name="strncpy">
676 <item><ref id="strnicmp" name="strnicmp">
677 <item><ref id="strqtok" name="strqtok">
678 <item><ref id="strrchr" name="strrchr">
679 <item><ref id="strspn" name="strspn">
680 <item><ref id="strstr" name="strstr">
681 <item><ref id="strtok" name="strtok">
682 <item><ref id="strxfrm" name="strxfrm">
683 <item><ref id="strupper" name="strupper">
684 <item><ref id="strupr" name="strupr">
688 <sect1><tt/telestrat.h/<label id="telestrat.h"><p>
691 <item><ref id="atmos_explode" name="explode">
692 <item><ref id="atmos_ping" name="ping">
693 <item><ref id="atmos_shoot" name="shoot">
694 <item><ref id="atmos_zap" name="zap">
695 <!-- <item><ref id="kbdclick1" name="kbdclick1"> -->
696 <!-- <item><ref id="oups" name="oups"> -->
702 <sect1><tt/tgi.h/<label id="tgi.h"><p>
704 <url url="tgi.html" name="Tiny Graphics Interface">.
707 <sect1><tt/time.h/<label id="time.h"><p>
710 <!-- <item><ref id="_systime" name="_systime"> -->
711 <!-- <item><ref id="asctime" name="asctime"> -->
712 <item><ref id="clock" name="clock">
713 <!-- <item><ref id="ctime" name="ctime"> -->
714 <!-- <item><ref id="gmtime" name="gmtime"> -->
715 <!-- <item><ref id="localtime" name="localtime"> -->
716 <!-- <item><ref id="mktime" name="mktime"> -->
717 <!-- <item><ref id="strftime" name="strftime"> -->
718 <item><ref id="time" name="time">
724 <sect1><tt/unistd.h/<label id="unistd.h"><p>
727 <!-- <item><ref id="chdir" name="chdir"> -->
728 <item><ref id="exec" name="exec">
729 <item><ref id="getcwd" name="getcwd">
730 <item><ref id="getopt" name="getopt">
731 <!-- <item><ref id="lseek" name="lseek"> -->
732 <!-- <item><ref id="mkdir" name="mkdir"> -->
733 <!-- <item><ref id="read" name="read"> -->
734 <!-- <item><ref id="rmdir" name="rmdir"> -->
735 <item><ref id="sleep" name="sleep">
736 <item><ref id="unlink" name="unlink">
737 <!-- <item><ref id="write" name="write"> -->
743 <sect1><tt/vic20.h/<label id="vic20.h"><p>
748 <sect1><tt/zlib.h/<label id="zlib.h"><p>
751 <!-- <item><ref id="adler32" name="adler32"> -->
752 <!-- <item><ref id="crc32" name="crc32"> -->
753 <!-- <item><ref id="inflatemem" name="inflatemem"> -->
754 <!-- <item><ref id="uncompress" name="uncompress"> -->
760 <sect>Alphabetical function reference<p>
762 <sect1>_DE_ISDIR<label id="_DE_ISDIR"><p>
766 <tag/Function/Determine if a directory entry specifies a directory.
767 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
768 <tag/Declaration/<tt/int _DE_ISDIR(unsigned char type);/
769 <tag/Description/The function is called with the type of a directory entry
770 taken from a <tt/struct dirent/ and returns true if the entry designates
773 <item>The function is actually a macro.
775 <tag/Availability/cc65
777 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
778 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
779 <ref id="_DE_ISREG" name="_DE_ISREG">
785 <sect1>_DE_ISLBL<label id="_DE_ISLBL"><p>
789 <tag/Function/Determine if a directory entry specifies a disk label.
790 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
791 <tag/Declaration/<tt/int _DE_ISLBL(unsigned char type);/
792 <tag/Description/The function is called with the type of a directory entry
793 taken from a <tt/struct dirent/ and returns true if the entry designates
796 <item>The function is actually a macro.
798 <tag/Availability/cc65
800 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
801 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
802 <ref id="_DE_ISREG" name="_DE_ISREG">
808 <sect1>_DE_ISLNK<label id="_DE_ISLNK"><p>
812 <tag/Function/Determine if a directory entry specifies a link.
813 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
814 <tag/Declaration/<tt/int _DE_ISLNK(unsigned char type);/
815 <tag/Description/The function is called with the type of a directory entry
816 taken from a <tt/struct dirent/ and returns true if the entry designates
819 <item>The function is actually a macro.
821 <tag/Availability/cc65
823 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
824 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
825 <ref id="_DE_ISREG" name="_DE_ISREG">
831 <sect1>_DE_ISREG<label id="_DE_ISREG"><p>
835 <tag/Function/Determine if a directory entry specifies a regular file.
836 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
837 <tag/Declaration/<tt/int _DE_ISREG(unsigned char type);/
838 <tag/Description/The function is called with the type of a directory entry
839 taken from a <tt/struct dirent/ and returns true if the entry designates
842 <item>The function is actually a macro.
843 <item>A "regular file" means anything with data in it. This might still mean
844 that special processing is needed, when accessing the file. Relative files of
845 the CBM systems are classified as being "regular" files, for example.
847 <tag/Availability/cc65
849 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
850 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
851 <ref id="_DE_ISLNK" name="_DE_ISLNK">
857 <sect1>_heapadd<label id="_heapadd"><p>
861 <tag/Function/Add a block to the heap.
862 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
863 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
864 <tag/Description/The function adds a block of raw memory to the heap.
866 <item>The minimum blocksize that can be added is 6 bytes; the function will
867 ignore smaller blocks.
868 <item>The function is available only as a fastcall function; so, it may be used
869 only in the presence of a prototype.
871 <tag/Availability/cc65
873 <ref id="_heapblocksize" name="_heapblocksize">,
874 <ref id="_heapmaxavail" name="_heapmaxavail">,
875 <ref id="_heapmemavail" name="_heapmemavail">,
876 <ref id="calloc" name="calloc">,
877 <ref id="free" name="free">,
878 <ref id="malloc" name="malloc">,
879 <ref id="realloc" name="realloc">
885 <sect1>_heapblocksize<label id="_heapblocksize"><p>
889 <tag/Function/Return the size of an allocated block.
890 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
891 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
892 <tag/Description/The function returns the size of a block that must have
893 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
894 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
896 <item>Passing a pointer to a block that was is not the result of one of the
897 allocation functions, or that has been free'd will give unpredicable results.
898 <item>The function is available only as a fastcall function; so, it may be used
899 only in the presence of a prototype.
901 <tag/Availability/cc65
903 <ref id="_heapadd" name="_heapadd">,
904 <ref id="_heapmaxavail" name="_heapmaxavail">,
905 <ref id="_heapmemavail" name="_heapmemavail">,
906 <ref id="calloc" name="calloc">,
907 <ref id="free" name="free">,
908 <ref id="malloc" name="malloc">,
909 <ref id="realloc" name="realloc">
915 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
919 <tag/Function/Return the largest block that is available on the heap.
920 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
921 <tag/Declaration/<tt/size_t _heapmaxavail (void);/
922 <tag/Description/The function returns the size of the largest block that may
923 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
924 <tag/Availability/cc65
926 <ref id="_heapadd" name="_heapadd">,
927 <ref id="_heapblocksize" name="_heapblocksize">,
928 <ref id="_heapmemavail" name="_heapmemavail">,
929 <ref id="calloc" name="calloc">,
930 <ref id="free" name="free">,
931 <ref id="malloc" name="malloc">,
932 <ref id="realloc" name="realloc">
938 <sect1>_heapmemavail<label id="_heapmemavail"><p>
942 <tag/Function/Return the total available space on the heap.
943 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
944 <tag/Declaration/<tt/size_t _heapmemavail (void);/
945 <tag/Description/The function returns the total number of bytes available on
948 <item>This function is of less use than usually assumed, since the returned
949 heap space may be available but not in one block. So even if this function
950 says that several times more heap space is available than needed, <ref
951 id="malloc" name="malloc"> may still return <tt/NULL/.
953 <tag/Availability/cc65
955 <ref id="_heapadd" name="_heapadd">,
956 <ref id="_heapblocksize" name="_heapblocksize">,
957 <ref id="_heapmaxavail" name="_heapmaxavail">,
958 <ref id="calloc" name="calloc">,
959 <ref id="free" name="free">,
960 <ref id="malloc" name="malloc">,
961 <ref id="realloc" name="realloc">
967 <sect1>_is_cmdline_dos<label id="_is_cmdline_dos"><p>
971 <tag/Function/Determines whether the underlying DOS supports command line arguments.
972 <tag/Header/<tt/<ref id="atari.h" name="atari.h">/
973 <tag/Declaration/<tt/unsigned char _is_cmdline_dos (void);/
974 <tag/Description/The function returns 0 if the DOS doesn't support command line arguments.
975 It returns 1 if it does.
976 <tag/Availability/cc65 (<tt/atari/ and <tt/atarixl/ platforms)
981 <sect1>_poserror<label id="_poserror"><p>
985 <tag/Function/Print an error message for the error in <tt/_oserror/.
986 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
987 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
988 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
989 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
990 a colon and a blank. Then the error message for the current contents of
991 <tt/_oserror/ are printed followed by a newline. The message output is the
992 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
993 argument of <tt/_oserror/.
995 <item>Since operating system specific error code are - you guessed it -
996 operating system specific, the value in <tt/_oserror/ and the message that is
997 printed depends on the cc65 target.
998 <item>The function is only available as fastcall function, so it may only
999 be used in presence of a prototype.
1001 <tag/Availability/cc65
1003 <ref id="_stroserror" name="_stroserror">,
1004 <ref id="perror" name="perror">
1010 <sect1>_randomize<label id="_randomize"><p>
1014 <tag/Function/Initialize the pseudo random number generator.
1015 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1016 <tag/Declaration/<tt/void _randomize (void);/
1017 <tag/Description/The function initializes the random number generator with
1018 a seed derived from fast changing hardware events, so the seed itself can be
1019 considered random to a certain degree.
1020 <tag/Notes/<itemize>
1021 <item>The randomness of the seed depends on the machine hardware.
1023 <tag/Availability/cc65
1025 <ref id="rand" name="rand">,
1026 <ref id="srand" name="srand">
1032 <sect1>_stroserror<label id="_stroserror"><p>
1036 <tag/Function/Return a string describing an OS specific error code.
1037 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1038 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
1039 <tag/Description/<tt/_stroserror/ will return a string describing the given
1040 operating system specific error code.
1041 <tag/Notes/<itemize>
1042 <item>Since operating system specific error code are - you guessed it -
1043 operating system specific, the parameter and the string returned depend on the
1045 <item>The function is only available as fastcall function, so it may only be
1046 used in presence of a prototype.
1048 <tag/Availability/cc65
1050 <ref id="strerror" name="strerror">
1056 <sect1>_swap<label id="_swap"><p>
1060 <tag/Function/Swap the contents of memory areas.
1061 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1062 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
1063 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
1064 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
1065 <tt/size/ bytes in size.
1066 <tag/Notes/<itemize>
1067 <item>The memory areas may not overlap, otherwise the results are undefined.
1068 <item>The function is only available as fastcall function, so it may only be
1069 used in presence of a prototype.
1071 <tag/Availability/cc65
1073 <ref id="memcpy" name="memcpy">,
1074 <ref id="memmove" name="memmove">
1080 <sect1>_sys<label id="_sys"><p>
1084 <tag/Function/Call a subroutine passing register values.
1085 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1086 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
1087 <tag/Description/The function will call the subroutine at the address
1088 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
1089 registers and the CPU flags are set to the values given in the <tt/regs/
1090 structure. On return from the subroutine, the new values of the registers and
1091 flags are stored back overwriting the old values.
1092 <tag/Notes/<itemize>
1093 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
1094 when calling the subroutine (they are unchanged from their current values).
1095 <item>The function is only available as fastcall function, so it may only be
1096 used in presence of a prototype.
1098 <tag/Availability/cc65
1104 <sect1>BRK<label id="BRK"><p>
1108 <tag/Function/Insert a 6502 BRK instrunction into the code.
1109 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1110 <tag/Declaration/<tt/void BRK (void);/
1111 <tag/Description/The function will insert a 6502 BRK instruction into the code
1112 which may be used to trigger a debugger.
1113 <tag/Notes/<itemize>
1114 <item>The function is actually a macro.
1115 <item>The inserted instruction may lead to unexpected results if no debugger
1118 <tag/Availability/cc65
1120 <ref id="CLI" name="CLI">,
1121 <ref id="SEI" name="SEI">
1127 <sect1>CLI<label id="CLI"><p>
1131 <tag/Function/Insert a 6502 CLI instrunction into the code.
1132 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1133 <tag/Declaration/<tt/void CLI (void);/
1134 <tag/Description/The function will insert a 6502 CLI instruction into the code,
1135 so interrupts are enabled. Enabling interrupts has no effects if they are
1136 already enabled (the default).
1137 <tag/Notes/<itemize>
1138 <item>The function is actually a macro.
1139 <item>Disabling interrupts may lead to unexpected results.
1141 <tag/Availability/cc65
1143 <ref id="BRK" name="BRK">,
1144 <ref id="SEI" name="SEI">
1150 <sect1>PEEK<label id="PEEK"><p>
1154 <tag/Function/Read a byte from memory.
1155 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1156 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
1157 <tag/Description/The function will read the absolute memory given by <tt/addr/
1158 and return the value read.
1159 <tag/Notes/<itemize>
1160 <item>The function is actually a macro.
1161 <item>This function depends highly on the platform and environment.
1163 <tag/Availability/cc65
1165 <ref id="PEEKW" name="PEEKW">,
1166 <ref id="POKE" name="POKE">
1172 <sect1>PEEKW<label id="PEEKW"><p>
1176 <tag/Function/Read a word (two bytes) from memory.
1177 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1178 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
1179 <tag/Description/The function will read the absolute memory given by <tt/addr/
1180 and return the value read. The byte read from the higher address is the high
1181 byte of the return value.
1182 <tag/Notes/<itemize>
1183 <item>The function is actually a macro.
1184 <item>This function depends highly on the platform and environment.
1185 <item>The order in which the two bytes are read is unspecified and may
1186 depend of the address expression used.
1188 <tag/Availability/cc65
1190 <ref id="PEEK" name="PEEK">,
1191 <ref id="POKE" name="POKE">
1197 <sect1>POKE<label id="POKE"><p>
1201 <tag/Function/Write a byte to memory.
1202 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1203 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
1204 <tag/Description/The function writes the value <tt/val/ to the absolute
1205 memory address given by <tt/addr/.
1206 <tag/Notes/<itemize>
1207 <item>The function is actually a macro.
1208 <item>This function depends highly on the platform and environment.
1209 <item>Careless use will cause the program to act strange or may crash the
1212 <tag/Availability/cc65
1214 <ref id="PEEK" name="PEEK">,
1215 <ref id="POKEW" name="POKEW">
1221 <sect1>POKEW<label id="POKEW"><p>
1225 <tag/Function/Write a word (two bytes) to memory.
1226 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1227 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
1228 <tag/Description/The function writes the value <tt/val/ to the absolute
1229 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
1230 the <tt/addr/, the high byte is written to <tt/addr+1/.
1231 <tag/Notes/<itemize>
1232 <item>The function is actually a macro.
1233 <item>This function depends highly on the platform and environment.
1234 <item>Careless use will cause the program to act strange or may crash the
1236 <item>The order in which the two bytes are written is unspecified and may
1237 depend of the address expression used.
1239 <tag/Availability/cc65
1241 <ref id="PEEK" name="PEEK">,
1242 <ref id="POKE" name="POKE">
1248 <sect1>SEI<label id="SEI"><p>
1252 <tag/Function/Insert a 6502 SEI instrunction into the code.
1253 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1254 <tag/Declaration/<tt/void SEI (void);/
1255 <tag/Description/The function will insert a 6502 SEI instruction into the code,
1256 so interrupts are disabled. Note that non maskable interrupts cannot be
1258 <tag/Notes/<itemize>
1259 <item>The function is actually a macro.
1260 <item>Disabling interrupts may lead to unexpected results.
1262 <tag/Availability/cc65
1264 <ref id="BRK" name="BRK">,
1265 <ref id="CLI" name="CLI">
1271 <sect1>abort<label id="abort"><p>
1275 <tag/Function/Terminates a program abnormally.
1276 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1277 <tag/Declaration/<tt/void abort (void);/
1278 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
1279 on stderr, then terminates the program with an exit code of 3.
1280 <tag/Availability/ISO 9899
1282 <ref id="assert" name="assert">,
1283 <ref id="exit" name="exit">,
1284 <ref id="raise" name="raise">
1290 <sect1>abs<label id="abs"><p>
1294 <tag/Function/Returns the absolute value of an integer.
1295 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1296 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
1297 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
1299 <tag/Notes/<itemize>
1300 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
1301 <item>The function is only available as fastcall function, so it may only be
1302 used in presence of a prototype.
1304 <tag/Availability/ISO 9899
1306 <ref id="labs" name="labs">
1312 <sect1>assert<label id="assert"><p>
1316 <tag/Function/Test a condition and possibly abort.
1317 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
1318 <tag/Declaration/<tt/void assert (int cond);/
1319 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
1320 statement. If the condition evaluates t zero (false), assert prints a message
1321 on stderr and aborts the program.
1322 <tag/Notes/<itemize>
1323 <item>The function is actually a macro.
1325 <tag/Availability/ISO 9899
1327 <ref id="abort" name="abort">,
1328 <ref id="exit" name="exit">
1334 <sect1>atexit<label id="atexit"><p>
1338 <tag/Function/Register an exit function.
1339 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1340 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1341 <tag/Description/<tt/atexit/ registers the function pointed to by
1342 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1343 terminates, they are called in LIFO order (the last function registered is
1344 called first). <tt/atexit/ returns zero on success and a nonzero value on
1346 <tag/Notes/<itemize>
1347 <item>A maximum of 5 exit functions can be registered.
1348 <item>There is no way to unregister an exit function.
1349 <item>The function is only available as fastcall function, so it may only be
1350 used in presence of a prototype.
1352 <tag/Availability/ISO 9899
1354 <ref id="abort" name="abort">,
1355 <ref id="exit" name="exit">
1361 <sect1>atmos_explode<label id="atmos_explode"><p>
1365 <tag/Function/Bomb sound effect.
1366 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1367 <tag/Declaration/<tt/void __fastcall__ atmos_explode(void);/
1368 <tag/Description/<tt/atmos_explode/ plays the BASIC sound.
1369 <tag/Notes/<itemize>
1370 <item>The function is available only as a fastcall function; so, it may be used
1371 only in the presence of a prototype.
1373 <tag/Availability/cc65
1375 <ref id="atmos_ping" name="atmos_ping">,
1376 <ref id="atmos_shoot" name="atmos_shoot">,
1377 <ref id="atmos_tick" name="atmos_tick">,
1378 <ref id="atmos_tock" name="atmos_tock">,
1379 <ref id="atmos_zap" name="atmos_zap">
1385 <sect1>atmos_load<label id="atmos_load"><p>
1389 <tag/Function/Load Atmos tape.
1390 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1391 <tag/Declaration/<tt/void __fastcall__ atmos_load(const char* name);/
1392 <tag/Description/<tt/atmos_load/ reads a memory block from tape.
1393 <tag/Notes/<itemize>
1394 <item>The function is available only as a fastcall function; so, it may be used
1395 only in the presence of a prototype.
1397 <tag/Availability/cc65
1399 <ref id="atmos_save" name="atmos_save">
1405 <sect1>atmos_ping<label id="atmos_ping"><p>
1409 <tag/Function/Bell or ricochet sound effect.
1410 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1411 <tag/Declaration/<tt/void __fastcall__ atmos_ping(void);/
1412 <tag/Description/<tt/atmos_ping/ plays the BASIC sound.
1413 <tag/Notes/<itemize>
1414 <item>The function is available only as a fastcall function; so, it may be used
1415 only in the presence of a prototype.
1417 <tag/Availability/cc65
1419 <ref id="atmos_explode" name="atmos_explode">,
1420 <ref id="atmos_shoot" name="atmos_shoot">,
1421 <ref id="atmos_tick" name="atmos_tick">,
1422 <ref id="atmos_tock" name="atmos_tock">,
1423 <ref id="atmos_zap" name="atmos_zap">
1429 <sect1>atmos_save<label id="atmos_save"><p>
1433 <tag/Function/Save Atmos tape.
1434 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1435 <tag/Declaration/<tt/void __fastcall__ atmos_save(const char* name, const void* start, const void* end);/
1436 <tag/Description/<tt/atmos_save/ writes a memory block to tape.
1437 <tag/Notes/<itemize>
1438 <item>The function is available only as a fastcall function; so, it may be used
1439 only in the presence of a prototype.
1441 <tag/Availability/cc65
1443 <ref id="atmos_load" name="atmos_load">
1445 atmos_save("hires", 0xa000, 0xc000);
1451 <sect1>atmos_shoot<label id="atmos_shoot"><p>
1455 <tag/Function/Pistol sound effect.
1456 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1457 <tag/Declaration/<tt/void __fastcall__ atmos_shoot(void);/
1458 <tag/Description/<tt/atmos_shoot/ plays the BASIC sound.
1459 <tag/Notes/<itemize>
1460 <item>The function is available only as a fastcall function; so, it may be used
1461 only in the presence of a prototype.
1463 <tag/Availability/cc65
1465 <ref id="atmos_explode" name="atmos_explode">,
1466 <ref id="atmos_ping" name="atmos_ping">,
1467 <ref id="atmos_tick" name="atmos_tick">,
1468 <ref id="atmos_tock" name="atmos_tock">,
1469 <ref id="atmos_zap" name="atmos_zap">
1475 <sect1>atmos_tick<label id="atmos_tick"><p>
1479 <tag/Function/High-pitch click.
1480 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1481 <tag/Declaration/<tt/void __fastcall__ atmos_tick(void);/
1482 <tag/Description/<tt/atmos_tick/ plays the system sound.
1483 <tag/Notes/<itemize>
1484 <item>The function is available only as a fastcall function; so, it may be used
1485 only in the presence of a prototype.
1487 <tag/Availability/cc65
1489 <ref id="atmos_explode" name="atmos_explode">,
1490 <ref id="atmos_ping" name="atmos_ping">,
1491 <ref id="atmos_shoot" name="atmos_shoot">,
1492 <ref id="atmos_tock" name="atmos_tock">,
1493 <ref id="atmos_zap" name="atmos_zap">
1499 <sect1>atmos_tock<label id="atmos_tock"><p>
1503 <tag/Function/Low-pitch click.
1504 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1505 <tag/Declaration/<tt/void __fastcall__ atmos_tock(void);/
1506 <tag/Description/<tt/atmos_tock/ plays the system sound.
1507 <tag/Notes/<itemize>
1508 <item>The function is available only as a fastcall function; so, it may be used
1509 only in the presence of a prototype.
1511 <tag/Availability/cc65
1513 <ref id="atmos_explode" name="atmos_explode">,
1514 <ref id="atmos_ping" name="atmos_ping">,
1515 <ref id="atmos_shoot" name="atmos_shoot">,
1516 <ref id="atmos_tick" name="atmos_tick">,
1517 <ref id="atmos_zap" name="atmos_zap">
1523 <sect1>atmos_zap<label id="atmos_zap"><p>
1527 <tag/Function/Raygun sound effect.
1528 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1529 <tag/Declaration/<tt/void __fastcall__ atmos_zap(void);/
1530 <tag/Description/<tt/atmos_zap/ plays the BASIC sound.
1531 <tag/Notes/<itemize>
1532 <item>The function is available only as a fastcall function; so, it may be used
1533 only in the presence of a prototype.
1535 <tag/Availability/cc65
1537 <ref id="atmos_explode" name="atmos_explode">,
1538 <ref id="atmos_ping" name="atmos_ping">,
1539 <ref id="atmos_shoot" name="atmos_shoot">,
1540 <ref id="atmos_tick" name="atmos_tick">,
1541 <ref id="atmos_tock" name="atmos_tock">
1547 <sect1>atoi<label id="atoi"><p>
1551 <tag/Function/Convert a string to an integer.
1552 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1553 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1554 <tag/Description/<tt/atoi/ converts the given string into an integer.
1555 Conversion stops as soon as any invalid character is encountered.
1556 <tag/Notes/<itemize>
1557 <item>There is no way to detect any conversion errors.
1558 <item>The function does not check for an numerical overflow when converting.
1559 <item>The function is only available as fastcall function, so it may only be
1560 used in presence of a prototype.
1562 <tag/Availability/ISO 9899
1564 <ref id="atol" name="atol">,
1565 <ref id="itoa" name="itoa">,
1566 <ref id="ltoa" name="ltoa">,
1567 <ref id="ultoa" name="ultoa">,
1568 <ref id="utoa" name="utoa">
1574 <sect1>atol<label id="atol"><p>
1578 <tag/Function/Convert a string to a long integer.
1579 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1580 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1581 <tag/Description/<tt/atol/ converts the given string into a long integer.
1582 Conversion stops as soon as any invalid character is encountered.
1583 <tag/Notes/<itemize>
1584 <item>There is no way to detect any conversion errors.
1585 <item>The function does not check for an numerical overflow when converting.
1586 <item>The function is only available as fastcall function, so it may only be
1587 used in presence of a prototype.
1589 <tag/Availability/ISO 9899
1591 <ref id="atoi" name="atoi">,
1592 <ref id="itoa" name="itoa">,
1593 <ref id="ltoa" name="ltoa">,
1594 <ref id="ultoa" name="ultoa">,
1595 <ref id="utoa" name="utoa">
1601 <sect1>bgcolor<label id="bgcolor"><p>
1605 <tag/Function/Set the background text color.
1606 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1607 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1608 <tag/Description/The function will set a new background color and return the
1609 old (current) one. The background color is valid for the whole text output
1610 area of the screen, not just for new text.
1611 <tag/Notes/<itemize>
1612 <item>Background colors are system dependent. The function may have no effect
1613 on systems where the background color cannot be changed.
1614 <item>The function is only available as fastcall function, so it may only be
1615 used in presence of a prototype.
1617 <tag/Availability/cc65
1619 <ref id="bordercolor" name="bordercolor">,
1620 <ref id="textcolor" name="textcolor">
1626 <sect1>bordercolor<label id="bordercolor"><p>
1630 <tag/Function/Set the border (frame) color.
1631 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1632 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1633 <tag/Description/The function will set a new border color. It returns the old
1634 (current) border color.
1635 <tag/Notes/<itemize>
1636 <item>Border colors are system dependent. The function may have no effect
1637 on systems where the border color cannot be changed.
1638 <item>The function is only available as fastcall function, so it may only
1639 be used in presence of a prototype.
1641 <tag/Availability/cc65
1643 <ref id="bgcolor" name="bgcolor">,
1644 <ref id="textcolor" name="textcolor">
1650 <sect1>bsearch<label id="bsearch"><p>
1654 <tag/Function/Do a binary search in a sorted array.
1655 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1656 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1657 const void* base, size_t n, size_t size,
1658 int __fastcall__ (* cmp) (const void*, const void*));/
1659 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1660 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1661 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1662 the function used to compare the members against the key. The function returns
1663 a pointer to the member found, or <tt/NULL/ if there was no match.
1664 <tag/Notes/<itemize>
1665 <item>The contents of the array must be sorted in ascending order according to
1666 the compare function given.
1667 <item>If there are multiple members that match the key, the function will
1668 return one of the members.
1669 <item>The function is only available as fastcall function, so it may only
1670 be used in presence of a prototype.
1671 <item>The function to which <tt/cmp/ points must have the <tt/fastcall/ calling
1674 <tag/Availability/ISO 9899
1676 <ref id="qsort" name="qsort">
1682 <sect1>bzero<label id="bzero"><p>
1686 <tag/Function/Fill a memory area with zeroes.
1687 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1688 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1689 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1691 <tag/Notes/<itemize>
1692 <item>The function is non standard and therefore only available in non ANSI
1693 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1694 <item>The function is only available as fastcall function, so it may only
1695 be used in presence of a prototype.
1697 <tag/Availability/cc65
1699 <ref id="_swap" name="_swap">,
1700 <ref id="memcpy" name="memcpy">,
1701 <ref id="memmove" name="memmove">,
1702 <ref id="memset" name="memset">,
1708 <sect1>c64mode<label id="c64mode"><p>
1712 <tag/Function/Switch the C128 into C64 compatible mode.
1713 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1714 <tag/Declaration/<tt/void c64mode (void);/
1715 <tag/Description/The function will cause the machine to reboot into C64 mode.
1716 <tag/Notes/<itemize>
1717 <item>The function is specific to the C128.
1718 <item>The function will not return to the caller.
1720 <tag/Availability/C128
1726 <sect1>calloc<label id="calloc"><p>
1730 <tag/Function/Allocate and clear memory.
1731 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1732 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1733 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1734 of size <tt/size/, clears the whole block with binary zeroes and returns a
1735 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1737 <tag/Notes/<itemize>
1738 <item>Clearing the memory may not have the expected effect on all platforms:
1739 pointers in the block may not be <tt/NULL/ and floating point variables may
1740 not be zero (0.0). In other words: The "clearing" effect of this function
1741 should be used with care for portable programs.
1742 <item>The function is only available as fastcall function, so it may only
1743 be used in presence of a prototype.
1745 <tag/Availability/ISO 9899
1747 <ref id="_heapadd" name="_heapadd">,
1748 <ref id="_heapblocksize" name="_heapblocksize">,
1749 <ref id="_heapmaxavail" name="_heapmaxavail">,
1750 <ref id="_heapmemavail" name="_heapmemavail">,
1751 <ref id="free" name="free">,
1752 <ref id="malloc" name="malloc">,
1753 <ref id="realloc" name="realloc">
1759 <sect1>cbm_k_acptr<label id="cbm_k_acptr"><p>
1763 <tag/Function/Input byte from serial bus
1764 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1765 <tag/Declaration/<tt/unsigned char cbm_k_acptr (void);/
1766 <tag/Description/The function returns a byte of data, which it
1767 gets from the current TALKer on the serial bus.
1768 In order to receive the data, the device must have previously been
1769 sent a command to TALK and a secondary address if it needs one.
1770 <tag/Notes/<itemize>
1773 <tag/Availability/cc65
1775 <ref id="cbm_k_talk" name="cbm_k_talk">,
1781 <sect1>cbm_k_basin<label id="cbm_k_basin"><p>
1785 <tag/Function/Input a Character from the Current Device
1786 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1787 <tag/Declaration/<tt/unsigned char cbm_k_basin (void);/
1788 <tag/Description/The function returns a character from the current input device.
1789 Device must first have been OPENed and then designated as the input channel by the CHKIN routine.
1790 When this function is called, the next byte of data available from the device is returned.
1791 Exception is the routine for the keyboard device (which is the default input device).
1792 <tag/Notes/<itemize>
1795 <tag/Availability/cc65
1797 <ref id="cbm_k_open" name="cbm_k_open">,
1798 <ref id="cbm_k_chkin" name="cbm_k_chkin">
1804 <sect1>cbm_k_bsout<label id="cbm_k_bsout"><p>
1808 <tag/Function/Output a byte
1809 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1810 <tag/Declaration/<tt/void __fastcall__ cbm_k_bsout (unsigned char C);/
1811 <tag/Description/Function sends the character to the current output device.
1812 Unless a device has been OPENed and designated as the
1813 current output channel using the CHKOUT routine, the character is
1814 printed to the screen, which is the default output device. If the
1815 cassette is the current device, outputting a byte will only add it to
1816 the buffer. No actual transmission of data will occur until the
1817 192-byte buffer is full.
1818 <tag/Notes/<itemize>
1819 <item>The function is only available as fastcall function, so it may
1820 only be used in presence of a prototype.
1822 <tag/Availability/cc65
1824 <ref id="cbm_k_open" name="cbm_k_open">,
1825 <ref id="cbm_k_chkin" name="cbm_k_chkout">
1831 <sect1>cbm_k_chkin<label id="cbm_k_chkin"><p>
1835 <tag/Function/Designate a Logical File As the Current Input Channel
1836 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1837 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_chkin (unsigned char FN);/
1838 <tag/Description/If you wish to
1839 get data from any device other than the keyboard, this function must be
1840 called after OPENing the device, before you can get a data byte with
1841 the cbm_k_basin or cbm_k_getin routine. When called, the routine will designate
1842 the logical file whose file number was supplied as the
1843 current file, its device as the current device, and its secondary
1844 address as the current secondary address. If the device on the
1845 channel is a serial device, which requires a TALK command and
1846 sometimes a secondary address, function will send them over the
1848 <tag/Notes/<itemize>
1849 <item>The function is only available as fastcall function, so it may
1850 only be used in presence of a prototype.
1852 <tag/Availability/cc65
1854 <ref id="cbm_k_open" name="cbm_k_open">,
1855 <ref id="cbm_k_basin" name="cbm_k_basin">,
1856 <ref id="cbm_k_getin" name="cbm_k_getin">
1862 <sect1>cbm_k_ciout<label id="cbm_k_ciout"><p>
1866 <tag/Function/Transmit a byte over the serial bus
1867 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1868 <tag/Declaration/<tt/void __fastcall__ cbm_k_ciout (unsigned char C);/
1869 <tag/Description/Purpose of this function is to send a byte of data over
1870 the serial bus. In order for the data to be received, the serial
1871 device must have first been commanded to LISTEN and been given a
1872 secondary address if necessary. This routine always buffers the
1873 current character, and defers sending it until the next byte is
1874 buffered. When the UNLISTEN command is sent, the last byte will be
1875 sent with an End or Identify (EOI).
1876 <tag/Notes/<itemize>
1877 <item>The function is only available as fastcall function, so it may
1878 only be used in presence of a prototype.
1880 <tag/Availability/cc65
1882 <ref id="cbm_k_listen" name="cbm_k_listen">,
1883 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">
1889 <sect1>cbm_k_ckout<label id="cbm_k_ckout"><p>
1893 <tag/Function/Designate a Logical File As the Current Output Channel
1894 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1895 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_ckout (unsigned char FN);/
1896 <tag/Description/If you wish to
1897 output data to any device other than the screen, this routine must be
1898 called after OPENing the device, and before you output a data byte
1899 with the cbm_k_bsout() function. When called, the function will designate the
1900 logical file whose file number was supplied as the current
1901 file, its device as the current device, and its secondary address as
1902 the current secondary address. If the device on the channel uses the
1903 serial bus, and therefore requires a LISTEN command and possibly a
1904 secondary address, this information will be sent on the bus.
1905 <tag/Notes/<itemize>
1906 <item>The function is only available as fastcall function, so it may
1907 only be used in presence of a prototype.
1909 <tag/Availability/cc65
1911 <ref id="cbm_k_bsout" name="cbm_k_bsout">,
1912 <ref id="cbm_k_listen" name="cbm_k_listen">
1918 <sect1>cbm_k_clall<label id="cbm_k_clall"><p>
1922 <tag/Function/Close All Logical I/O Files
1923 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1924 <tag/Declaration/<tt/void cbm_k_clall (void);/
1925 <tag/Description/It closes all
1926 open files, by resetting the index into open files to
1927 zero and restores the default I/O devices.
1928 <tag/Notes/<itemize>
1931 <tag/Availability/cc65
1933 <ref id="cbm_k_open" name="cbm_k_open">,
1934 <ref id="cbm_k_close" name="cbm_k_close">
1940 <sect1>cbm_k_close<label id="cbm_k_close"><p>
1944 <tag/Function/Close a Logical I/O File
1945 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1946 <tag/Declaration/<tt/void __fastcall__ cbm_k_close (unsigned char FN);/
1947 <tag/Description/It is used to
1948 close a logical file after all I/O operations involving that file have
1950 <tag/Notes/<itemize>
1951 <item>The function is only available as fastcall function, so it may
1952 only be used in presence of a prototype.
1954 <tag/Availability/cc65
1956 <ref id="cbm_k_open" name="cbm_k_open">,
1957 <ref id="cbm_k_clall" name="cbm_k_clall">
1963 <sect1>cbm_k_clrch<label id="cbm_k_clrch"><p>
1967 <tag/Function/Restore Current Input and Output Devices to the Default Devices
1968 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1969 <tag/Declaration/<tt/void cbm_k_clrch (void);/
1970 <tag/Description/It sets the
1971 current input device to the keyboard, and the current output device to
1972 the screen. Also, if the current input device was formerly a serial
1973 device, the routine sends it an UNTALK command on the serial bus, and
1974 if a serial device was formerly the current output device, the routine
1975 sends it an UNLISTEN command.
1976 <tag/Notes/<itemize>
1979 <tag/Availability/cc65
1981 <ref id="cbm_k_chkin" name="cbm_k_chkin">,
1982 <ref id="cbm_k_ckout" name="cbm_k_ckout">
1988 <sect1>cbm_k_getin<label id="cbm_k_getin"><p>
1992 <tag/Function/Get One Byte from the Input Device
1993 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1994 <tag/Declaration/<tt/unsigned char cbm_k_getin (void);/
1995 <tag/Description/Function gets a character from the current input device.
1996 <tag/Notes/<itemize>
1999 <tag/Availability/cc65
2001 <ref id="cbm_k_basin" name="cbm_k_basin">
2007 <sect1>cbm_k_iobase<label id="cbm_k_iobase"><p>
2011 <tag/Function/Return Base Address of Memory-Mapped I/O Devices
2012 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2013 <tag/Declaration/<tt/unsigned cbm_k_iobase (void);/
2014 <tag/Description/This function returns the address of
2015 the memory section where the memory mapped I/O devices are located. This
2016 address can then be used with an offset to access the memory mapped I/O
2017 devices in the Commodore 64. The offset is the number of locations from
2018 the beginning of the page on which the I/O register you want is located.
2019 This function exists to provide compatibility between the Commodore 64,
2020 VIC-20, and future models of the Commodore 64. If the I/O locations for
2021 a program are set by a call to this function, they should
2022 still remain compatible with future versions of the Commodore 64, the
2024 <tag/Notes/<itemize>
2027 <tag/Availability/cc65
2035 <sect1>cbm_k_listen<label id="cbm_k_listen"><p>
2039 <tag/Function/Command a device on the serial bus to LISTEN
2040 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2041 <tag/Declaration/<tt/void __fastcall__ cbm_k_listen (unsigned char dev);/
2042 <tag/Description/This function will command a device on the serial bus to
2043 receive data. The KERNAL routine will OR the supplied device number bit by bit
2044 to convert it to a listen address, then transmits this data as a command on
2045 the serial bus. The specified device will then go into listen mode, and
2046 be ready to accept information.
2047 <tag/Notes/<itemize>
2048 <item>The function is only available as fastcall function, so it may
2049 only be used in presence of a prototype.
2051 <tag/Availability/cc65
2053 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">,
2059 <sect1>cbm_k_load<label id="cbm_k_load"><p>
2063 <tag/Function/Load RAM from a Device
2064 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2065 <tag/Declaration/<tt/unsigned int __fastcall__ cbm_k_load(unsigned char flag, unsigned addr);/
2066 <tag/Description/This function LOADs data bytes from any input device directly into the memory.
2067 It can also be used for a verify operation, comparing data from a device with the data already in
2068 memory, while leaving the data stored in RAM unchanged.
2069 The flag must be set to 0 for a LOAD operation, or 1 for a
2070 verify, If the input device is OPENed with a secondary address (SA) of 0
2071 the header information from the device is ignored. In this case, the starting address for the load must be supplied.
2072 If the device is addressed with a secondary address of 1, then the data is
2073 loaded into memory starting at the location specified by the header.
2074 Function returns the address of the highest RAM location loaded.
2075 Before this function can be called, the KERNAL SETLFS, and SETNAM
2076 routines must be called.
2077 <tag/Notes/<itemize>
2078 <item>The function is only available as fastcall function, so it may
2079 only be used in presence of a prototype.
2081 <tag/Availability/cc65
2083 <ref id="cbm_k_save" name="cbm_k_save">,
2084 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2085 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2091 <sect1>cbm_k_open<label id="cbm_k_open"><p>
2095 <tag/Function/Open a Logical I/O File
2096 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2097 <tag/Declaration/<tt/unsigned char cbm_k_open (void);/
2098 <tag/Description/This function assigns a logical file to a device, so that it can be used for
2099 Input/Output operations. In order to specify the logical file number,
2100 the device number, and the secondary address if any, the cbm_k_setlfs() function must first be called.
2101 Likewise, in order to designate the filename, the cbm_k_setnam() function must be used first. After these two
2102 functions are called, cbm_k_open() is then called.
2103 <tag/Notes/<itemize>
2106 <tag/Availability/cc65
2108 <ref id="cbm_k_close" name="cbm_k_close">,
2109 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2110 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2116 <sect1>cbm_k_readst<label id="cbm_k_readst"><p>
2120 <tag/Function/Read status word
2121 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2122 <tag/Declaration/<tt/unsigned char cbm_k_readst (void);/
2123 <tag/Description/This function returns the current status of the I/O devices. It is usually called after new communication to an I/O device and gives information about device status, or errors that have occurred during the I/O operation.
2124 <tag/Notes/<itemize>
2127 <tag/Availability/cc65
2135 <sect1>cbm_k_save<label id="cbm_k_save"><p>
2139 <tag/Function/Save RAM to a Device
2140 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2141 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_save(unsigned int start, unsigned int end)/
2142 <tag/Description/This function saves a section of memory. The cbm_k_setlfs() and cbm_k_setnam() functions must be
2143 used before calling this function. However, a file name is not required to
2144 SAVE to device 1 (the Datassette(TM) recorder). Any attempt to save to
2145 other devices without using a file name results in an error. NOTE: Device 0 (the keyboard), device 2 (RS-232), and device 3 (the screen) cannot be SAVEd to. If the attempt is made, an error occurs, and the SAVE is stopped.
2146 <tag/Notes/<itemize>
2147 <item>The function is only available as fastcall function, so it may
2148 only be used in presence of a prototype.
2150 <tag/Availability/cc65
2152 <ref id="cbm_k_load" name="cbm_k_load">,
2153 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2154 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2160 <sect1>cbm_k_scnkey<label id="cbm_k_scnkey"><p>
2164 <tag/Function/Scan the keyboard matrix.
2165 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2166 <tag/Declaration/<tt/void cbm_k_scnkey (void);/
2167 <tag/Description/This function looks at the switches in the keyboard, to see
2168 if any of them are being pressed. If they are, then code numbers for them are
2169 stored in RAM. Other functions use those numbers to input text. Normally,
2170 the keyboard is scanned by the Kernal's Interrupt Service Routine. But, if
2171 you divert the "Jiffy interrupt" to a C-code ISR, then that ISR must call this
2172 function, in order to provide input from the keyboard.
2173 <tag/Availability/cc65
2175 <ref id="cbm_k_getin" name="cbm_k_getin">,
2176 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2177 <ref id="cgetc" name="cgetc">,
2178 <!-- <ref id="getc" name="getc"> -->
2179 <!-- <ref id="getchar" name="getchar"> -->
2185 <sect1>cbm_k_setlfs<label id="cbm_k_setlfs"><p>
2189 <tag/Function/Set up a logical file
2190 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2191 <tag/Declaration/<tt/void __fastcall__ cbm_k_setlfs (unsigned char LFN, unsigned char DEV, unsigned char SA);/
2192 <tag/Description/This functions sets up the logical file by setting its number, device address,
2193 and secondary address.
2194 <tag/Notes/<itemize>
2195 <item>The function is only available as fastcall function, so it may
2196 only be used in presence of a prototype.
2198 <tag/Availability/cc65
2200 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2206 <sect1>cbm_k_setnam<label id="cbm_k_setnam"><p>
2210 <tag/Function/Set Filename Parameters
2211 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2212 <tag/Declaration/<tt/void __fastcall__ cbm_k_setnam (const char* Name);/
2213 <tag/Description/This function is used to set up the file name for the OPEN,
2214 SAVE, or LOAD operations.
2215 <tag/Notes/<itemize>
2216 <item>The function is only available as fastcall function, so it may
2217 only be used in presence of a prototype.
2219 <tag/Availability/cc65
2221 <ref id="cbm_k_open" name="cbm_k_open">,
2222 <ref id="cbm_k_load" name="cbm_k_load">,
2223 <ref id="cbm_k_save" name="cbm_k_save">
2229 <sect1>cbm_k_talk<label id="cbm_k_talk"><p>
2233 <tag/Function/Commands device to TALK
2234 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2235 <tag/Declaration/<tt/void __fastcall__ cbm_k_talk (unsigned char dev);/
2236 <tag/Description/When called, it ORs the device number with the TALK code (64, $40) and sends it on the serial
2237 bus. This commands the device to TALK.
2238 <tag/Notes/<itemize>
2239 <item>The function is only available as fastcall function, so it may
2240 only be used in presence of a prototype.
2242 <tag/Availability/cc65
2244 <ref id="cbm_k_acptr" name="cbm_k_acptr">
2250 <sect1>cbm_k_udtim<label id="cbm_k_udtim"><p>
2254 <tag/Function/Update the Jiffy clock.
2255 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2256 <tag/Declaration/<tt/void cbm_k_udtim (void);/
2257 <tag/Description/This function adds one count to the Jiffy clock. That clock
2258 counts sixtieths of a second. It is used by the library's <tt/clock()/
2259 function. Normally, the Jiffy clock is updated by the Kernal's Interrupt
2260 Service Routine. But, if you divert the "Jiffy interrupt" to a C-code ISR,
2261 then that ISR must call this function, in order to keep the clock valid.
2262 <tag/Availability/cc65
2264 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2265 <ref id="clock" name="clock">
2271 <sect1>cbm_k_unlsn<label id="cbm_k_unlsn"><p>
2275 <tag/Function/Send an UNLISTEN command
2276 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2277 <tag/Declaration/<tt/void cbm_k_unlsn (void);/
2278 <tag/Description/This function commands all devices on the serial bus to
2279 stop receiving data from the host computer (i.e., UNLISTEN). Calling this
2280 function results in an UNLISTEN command being transmitted on the serial
2281 bus. Only devices previously commanded to LISTEN are affected. This
2282 function is normally used after the host computer is finished sending data
2283 to external devices. Sending the UNLISTEN commands the listening devices
2284 to get off the serial bus so it can be used for other purposes.
2285 <tag/Notes/<itemize>
2288 <tag/Availability/cc65
2290 <ref id="cbm_k_listen" name="cbm_k_listen">
2296 <sect1>cclear<label id="cclear"><p>
2300 <tag/Function/Clear part of a line (write a given number of spaces).
2301 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2302 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
2303 <tag/Description/The function clears part of a line by writing <tt/length/
2304 spaces in the current text color.
2305 <tag/Notes/<itemize>
2306 <item>The function is only available as fastcall function, so it may
2307 only be used in presence of a prototype.
2309 <tag/Availability/cc65
2311 <ref id="cclearxy" name="cclearxy">,
2312 <ref id="clrscr" name="clrscr">
2318 <sect1>cclearxy<label id="cclearxy"><p>
2322 <tag/Function/Clear part of a line (write a given number of spaces) starting
2323 at a specific screen position.
2324 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2325 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
2326 <tag/Description/The function moves the cursor to a specific position, and
2327 will then clear part of the line by writing <tt/length/ spaces in the current
2329 <tag/Notes/<itemize>
2330 <item>The function is only available as fastcall function, so it may
2331 only be used in presence of a prototype.
2333 <tag/Availability/cc65
2335 <ref id="cclear" name="cclear">,
2336 <ref id="clrscr" name="clrscr">
2342 <sect1>cgetc<label id="cgetc"><p>
2346 <tag/Function/Read a character from the keyboard.
2347 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2348 <tag/Declaration/<tt/char cgetc (void);/
2349 <tag/Description/The function reads a character from the keyboard. If there is
2350 no character available, <tt/cgetc()/ waits until the user presses a key. If the
2351 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
2352 displayed while waiting.
2353 <tag/Notes/<itemize>
2354 <item>If the system supports a keyboard buffer, <tt/cgetc()/ will fetch a key
2355 from that buffer; and, wait only if the buffer is empty.
2356 <item>The keyboard must be scanned periodically, in order for this function to
2357 see anything that you type. (See the description of <tt/cbm_k_scnkey()/.)
2359 <tag/Availability/cc65
2361 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2362 <ref id="cursor" name="cursor">,
2363 <ref id="kbhit" name="kbhit">
2369 <sect1>chline<label id="chline"><p>
2373 <tag/Function/Output a horizontal line in text mode.
2374 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2375 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
2376 <tag/Description/The function outputs a horizontal line with the given length
2377 starting at the current cursor position.
2378 <tag/Notes/<itemize>
2379 <item>The character used to draw the horizontal line is system dependent.
2380 If available, a line drawing character is used. Drawing a line that is partially
2381 off screen leads to undefined behaviour.
2382 <item>The function is only available as fastcall function, so it may only be
2383 used in presence of a prototype.
2385 <tag/Availability/cc65
2387 <ref id="chlinexy" name="chlinexy">,
2388 <ref id="cvline" name="cvline">,
2389 <ref id="cvlinexy" name="cvlinexy">
2395 <sect1>chlinexy<label id="chlinexy"><p>
2399 <tag/Function/Output a horizontal line at a given position in text mode.
2400 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2401 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
2402 <tag/Description/The function outputs a horizontal line with the given length
2403 starting at a given position.
2404 <tag/Notes/<itemize>
2405 <item>The character used to draw the horizontal line is system dependent.
2406 If available, a line drawing character is used. Drawing a line that is partially
2407 off screen leads to undefined behaviour.
2408 <item>The function is only available as fastcall function, so it may only be
2409 used in presence of a prototype.
2411 <tag/Availability/cc65
2413 <ref id="chline" name="chline">,
2414 <ref id="cvline" name="cvline">,
2415 <ref id="cvlinexy" name="cvlinexy">
2421 <sect1>clearerr<label id="clearerr"><p>
2425 <tag/Function/Clear error and end-of-file status of a stream.
2426 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2427 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
2428 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
2429 indicators for the stream <tt/f/.
2430 <tag/Notes/<itemize>
2431 <item>The function is only available as fastcall function, so it may only be
2432 used in presence of a prototype.
2434 <tag/Availability/ISO 9899
2436 <ref id="feof" name="feof">,
2437 <ref id="ferror" name="ferror">
2443 <sect1>clock<label id="clock"><p>
2447 <tag/Function/Determine the processor time used.
2448 <tag/Header/<tt/<ref id="time.h" name="time.h">/
2449 <tag/Declaration/<tt/clock_t clock (void);/
2450 <tag/Description/The <tt/clock/ function returns an approximaton of processor
2451 time used by the program. The time is returned in implementation-defined
2452 units. It can be converted to seconds by dividing by the value of the macro
2453 <tt/CLOCKS_PER_SEC/.
2454 <tag/Notes/<itemize>
2455 <item>Since the machines that cc65-generated programs run on cannot run multiple
2456 processes, the function actually will return the time since some
2457 implementation-defined point in the past.
2458 <item>The Jiffy clock must be "running", in order for this function to return
2459 changing values. (See the description of <tt/cbm_k_udtim()/.)
2461 <tag/Availability/ISO 9899
2463 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2464 <ref id="time" name="time">
2470 <sect1>clrscr<label id="clrscr"><p>
2474 <tag/Function/Clear the text screen.
2475 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2476 <tag/Declaration/<tt/void clrscr (void);/
2477 <tag/Description/The function clears the text screen and moves the cursor to
2478 the upper left corner.
2479 <tag/Availability/cc65
2481 <ref id="cclear" name="cclear">,
2482 <ref id="cclearxy" name="cclearxy">
2488 <sect1>close<label id="close"><p>
2492 <tag/Function/Close a file descriptor.
2493 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2494 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
2495 <tag/Description/The function closes the given file descriptor. It returns zero
2496 on success and -1 on error. If an error occurs, the cause can be determined by
2497 reading the <tt/errno/ variable.
2498 <tag/Notes/<itemize>
2499 <item>The function is only available as fastcall function, so it may only
2500 be used in presence of a prototype.
2502 <tag/Availability/POSIX 1003.1
2504 <ref id="creat" name="creat">,
2505 <ref id="open" name="open">
2511 <sect1>closedir<label id="closedir"><p>
2515 <tag/Function/Close a directory.
2516 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
2517 <tag/Declaration/<tt/int __fastcall__ closedir (DIR* dir);/
2518 <tag/Description/The function closes the given directory descriptor. It returns
2519 zero on success and -1 on error. If an error occurs, the cause can be determined
2520 by reading the <tt/errno/ variable.
2521 <tag/Notes/<itemize>
2522 <item>The function is only available as fastcall function, so it may only
2523 be used in presence of a prototype.
2525 <tag/Availability/POSIX 1003.1
2527 <ref id="opendir" name="opendir">,
2528 <ref id="readdir" name="readdir">
2534 <sect1>cpeekc<label id="cpeekc"><p>
2538 <tag/Function/Get a character from the display memory.
2539 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2540 <tag/Declaration/<tt/char cpeekc (void);/
2541 <tag/Description/The function gets the character that's at the current location
2542 of the cursor in the display screen RAM. That character is converted, if
2543 needed, into the encoding that can be passed to <tt/cputc()/.
2544 <tag/Notes/<itemize>
2545 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2546 done to make it obvious that peeking doesn't move the cursor in any way. Your
2547 program must place the cursor where it wants to peek before it calls any of
2550 <tag/Availability/cc65
2552 <ref id="cpeekcolor" name="cpeekcolor">,
2553 <ref id="cpeekrevers" name="cpeekrevers">,
2554 <ref id="cpeeks" name="cpeeks">,
2555 <ref id="cputc" name="cputc">
2561 <sect1>cpeekcolor<label id="cpeekcolor"><p>
2565 <tag/Function/Get a color from the display memory.
2566 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2567 <tag/Declaration/<tt/unsigned char cpeekcolor (void);/
2568 <tag/Description/The function gets the color number that's at the current
2569 location of the cursor in the display screen RAM. That number can be passed to
2571 <tag/Notes/<itemize>
2572 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2573 done to make it obvious that peeking doesn't move the cursor in any way. Your
2574 program must place the cursor where it wants to peek before it calls any of
2577 <tag/Availability/cc65
2579 <ref id="cpeekc" name="cpeekc">,
2580 <ref id="cpeekrevers" name="cpeekrevers">,
2581 <ref id="cpeeks" name="cpeeks">,
2582 <ref id="cputc" name="cputc">,
2583 <ref id="textcolor" name="textcolor">
2589 <sect1>cpeekrevers<label id="cpeekrevers"><p>
2593 <tag/Function/Get a reverse-character attribute from the display memory.
2594 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2595 <tag/Declaration/<tt/unsigned char cpeekrevers (void);/
2596 <tag/Description/The function gets the "reverse-mode" attribute of the
2597 character that's at the current location of the cursor in the display screen
2598 RAM. It returns a boolean value (0/1) that can be passed to <tt/revers()/.
2599 <tag/Notes/<itemize>
2600 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2601 done to make it obvious that peeking doesn't move the cursor in any way. Your
2602 program must place the cursor where it wants to peek before it calls any of
2605 <tag/Availability/cc65
2607 <ref id="cpeekc" name="cpeekc">,
2608 <ref id="cpeekcolor" name="cpeekcolor">,
2609 <ref id="cpeeks" name="cpeeks">,
2610 <ref id="cputc" name="cputc">,
2611 <ref id="revers" name="revers">
2617 <sect1>cpeeks<label id="cpeeks"><p>
2621 <tag/Function/Get a string from the display memory.
2622 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2623 <tag/Declaration/<tt/void __fastcall__ cpeeks (char* s, unsigned length);/
2624 <tag/Description/The function gets a fixed-length string ('\0'-terminated) of
2625 characters that start at the current location of the cursor in the display
2626 screen RAM. Those characters are converted, if needed, into the encoding that
2627 can be passed to <tt/cputs()/. The first argument must point to a RAM area
2628 that's large enough to hold "length + 1" bytes.
2629 <tag/Notes/<itemize>
2630 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2631 done to make it obvious that peeking doesn't move the cursor in any way. Your
2632 program must place the cursor where it wants to peek before it calls any of
2634 <item>The function is available as only a fastcall function;
2635 so, it may be used only in the presence of a prototype.
2637 <tag/Availability/cc65
2639 <ref id="cpeekc" name="cpeekc">,
2640 <ref id="cpeekcolor" name="cpeekcolor">,
2641 <ref id="cpeekrevers" name="cpeekrevers">,
2642 <ref id="cputc" name="cputc">,
2643 <ref id="cputs" name="cputs">
2649 <sect1>creat<label id="creat"><p>
2653 <tag/Function/Create a file.
2654 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2655 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
2656 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
2657 associated with it. On error, -1 is returned and an error code is stored in
2659 <tag/Notes/<itemize>
2660 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
2661 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
2662 <item>The function is only available as fastcall function, so it may only
2663 be used in presence of a prototype.
2665 <tag/Availability/POSIX 1003.1
2667 <ref id="close" name="close">,
2668 <ref id="open" name="open">
2674 <sect1>cprintf<label id="cprintf"><p>
2678 <tag/Function/Formatted output to the console.
2679 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2680 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
2681 <tag/Description/The arguments are converted to text where necessary and
2682 formatted according to the format string given. The resulting string is output
2683 to the console. <tt/cprintf/ supports the same format specifiers as
2684 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
2685 <tag/Notes/<itemize>
2686 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
2687 between <tt/\r/ and <tt/\n/.
2689 <tag/Availability/cc65
2691 <ref id="cputc" name="cputc">,
2692 <ref id="cputcxy" name="cputcxy">,
2693 <ref id="cputs" name="cputs">,
2694 <ref id="cputsxy" name="cputsxy">,
2695 <ref id="vcprintf" name="vcprintf">
2701 <sect1>cputc<label id="cputc"><p>
2705 <tag/Function/Output a character directly to the console.
2706 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2707 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
2708 <tag/Description/Output one character to the console at the current cursor
2710 <tag/Notes/<itemize>
2711 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
2712 between <tt/\r/ and <tt/\n/.
2713 <item>The function is only available as fastcall function, so it may only
2714 be used in presence of a prototype.
2716 <tag/Availability/cc65
2718 <ref id="cprintf" name="cprintf">,
2719 <ref id="cputcxy" name="cputcxy">,
2720 <ref id="cputs" name="cputs">,
2721 <ref id="cputsxy" name="cputsxy">,
2722 <ref id="vcprintf" name="vcprintf">
2728 <sect1>cputcxy<label id="cputcxy"><p>
2732 <tag/Function/Output a character at a specific screen position.
2733 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2734 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
2735 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
2736 the screen and outputs one character.
2737 <tag/Notes/<itemize>
2738 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
2739 between <tt/\r/ and <tt/\n/.
2740 <item>The function is only available as fastcall function, so it may only
2741 be used in presence of a prototype.
2743 <tag/Availability/cc65
2745 <ref id="cprintf" name="cprintf">,
2746 <ref id="cputc" name="cputc">,
2747 <ref id="cputs" name="cputs">,
2748 <ref id="cputsxy" name="cputsxy">,
2749 <ref id="vcprintf" name="vcprintf">
2755 <sect1>cputs<label id="cputs"><p>
2759 <tag/Function/Output a string directly to the console.
2760 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2761 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
2762 <tag/Description/The function outputs the given string on the console at the
2763 current cursor position.
2764 <tag/Notes/<itemize>
2765 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
2766 between <tt/\r/ and <tt/\n/.
2767 <item>The function is only available as fastcall function, so it may only
2768 be used in presence of a prototype.
2770 <tag/Availability/cc65
2772 <ref id="cprintf" name="cprintf">,
2773 <ref id="cputc" name="cputc">,
2774 <ref id="cputcxy" name="cputcxy">,
2775 <ref id="cputsxy" name="cputsxy">,
2776 <ref id="vcprintf" name="vcprintf">
2782 <sect1>cputsxy<label id="cputsxy"><p>
2786 <tag/Function/Output a string to the console at a given position.
2787 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2788 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
2789 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
2790 and outputs the string <tt/s/.
2791 <tag/Notes/<itemize>
2792 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
2793 between <tt/\r/ and <tt/\n/.
2794 <item>The function is only available as fastcall function, so it may only
2795 be used in presence of a prototype.
2797 <tag/Availability/cc65
2799 <ref id="cprintf" name="cprintf">,
2800 <ref id="cputc" name="cputc">,
2801 <ref id="cputcxy" name="cputcxy">,
2802 <ref id="cputs" name="cputs">,
2803 <ref id="vcprintf" name="vcprintf">
2809 <sect1>cursor<label id="cursor"><p>
2813 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
2814 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2815 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
2816 <tag/Description/If the argument to the function is non zero, a blinking cursor
2817 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
2818 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
2819 <tag/Notes/<itemize>
2820 <item>The function is only available as fastcall function, so it may only
2821 be used in presence of a prototype.
2823 <tag/Availability/cc65
2825 <ref id="cgetc" name="cgetc">,
2826 <ref id="kbhit" name="kbhit">
2832 <sect1>cvline<label id="cvline"><p>
2836 <tag/Function/Output a vertical line in text mode.
2837 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2838 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
2839 <tag/Description/The function outputs a vertical line with the given length
2840 starting at the current cursor position.
2841 <tag/Notes/<itemize>
2842 <item>The character used to draw the vertical line is system dependent.
2843 If available, a line drawing character is used. Drawing a line that is partially
2844 off screen leads to undefined behaviour.
2845 <item>The function is only available as fastcall function, so it may only be
2846 used in presence of a prototype.
2848 <tag/Availability/cc65
2850 <ref id="chline" name="chline">,
2851 <ref id="chlinexy" name="chlinexy">,
2852 <ref id="cvlinexy" name="cvlinexy">
2858 <sect1>cvlinexy<label id="cvlinexy"><p>
2862 <tag/Function/Output a vertical line at a given position in text mode.
2863 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2864 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
2865 <tag/Description/The function outputs a vertical line with the given length
2866 starting at a given position.
2867 <tag/Notes/<itemize>
2868 <item>The character used to draw the vertical line is system dependent.
2869 If available, a line drawing character is used. Drawing a line that is partially
2870 off screen leads to undefined behaviour.
2871 <item>The function is only available as fastcall function, so it may only be
2872 used in presence of a prototype.
2874 <tag/Availability/cc65
2876 <ref id="chline" name="chline">,
2877 <ref id="chlinexy" name="chlinexy">,
2878 <ref id="cvline" name="cvline">
2884 <sect1>decompress_lz4<label id="decompress_lz4"><p>
2888 <tag/Function/Uncompress a LZ4-compressed buffer.
2889 <tag/Header/<tt/<ref id="lz4.h" name="lz4.h">/
2890 <tag/Declaration/<tt/void decompress_lz4 (const unsigned char* src, unsigned char* const dst, const unsigned short uncompressed_size);/
2891 <tag/Description/<tt/decompress_lz4/ uncompresses a LZ4-compressed buffer.
2892 <tag/Notes/<itemize>
2893 <item>Use LZ4_compress_HC with compression level 16 for best compression.
2895 <tag/Availability/cc65
2901 <sect1>div<label id="div"><p>
2905 <tag/Function/Divide two ints and return quotient and remainder.
2906 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2907 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
2908 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
2909 quotient and remainder in a <tt/div_t/ structure.
2910 <tag/Notes/<itemize>
2911 <item>The function is only available as fastcall function, so it may only
2912 be used in presence of a prototype.
2914 <tag/Availability/ISO 9899
2922 <sect1>doesclrscrafterexit<label id="doesclrscrafterexit"><p>
2926 <tag/Function/Determines whether the screen is going to be cleared after program exit.
2927 <tag/Header/<tt/<ref id="cc65.h" name="cc65.h">/
2928 <tag/Declaration/<tt/unsigned char doesclrscrafterexit (void);/
2929 <tag/Description/The function returns zero if the screen won't be cleared immediately after
2930 program termination. It returns a non-zero value if it will.
2931 <tag/Notes/<itemize>
2932 <item>Some systems, maybe depending on configuration, immediately clear the screen
2933 after a program exits. Therefore it might be difficult to read
2934 the last messages printed by the program prior to its exit. This function can be used
2935 to decide if a delay or wait for a key press should be executed when then program
2938 <tag/Availability/cc65
2941 #include <stdio.h>
2942 #include <unistd.h>
2943 #include <cc65.h>
2946 printf("Hello World\n");
2947 if (doesclrscrafterexit())
2956 <sect1>em_commit<label id="em_commit"><p>
2960 <tag/Function/Commit changes into extended memory.
2961 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2962 <tag/Declaration/<tt/void em_commit (void);/
2963 <tag/Description/Commit changes in the memory window to extended storage. If
2964 the contents of the memory window have been changed, these changes may be lost
2965 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
2966 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
2967 name="em_copyto">/ are called without calling <tt/em_commit/ first.
2968 <tag/Notes/<itemize>
2969 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
2970 memory window are discarded, it does just mean that the drivers is allowed
2972 <item>The function is only available as fastcall function, so it may only be
2973 used in presence of a prototype.
2974 <item>The function produces undefined results if no extended memory driver is
2977 <tag/Availability/cc65
2979 <ref id="em_load_driver" name="em_load_driver">,
2980 <ref id="em_map" name="em_map">,
2981 <ref id="em_use" name="em_use">
2987 <sect1>em_copyfrom<label id="em_copyfrom"><p>
2991 <tag/Function/Copy from extended into normal memory.
2992 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2993 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
2994 <tag/Description/Copy data from extended memory into linear memory. Source and
2995 target addresses as well as the number of bytes to transfer are specified in
2996 the <tt/em_copy/ structure that is passed as a parameter.
2997 <tag/Notes/<itemize>
2998 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
2999 made any changes to the data in the window, call <tt/<ref id="em_commit"
3000 name="em_commit">/ first, or the changes are lost.
3001 <item>The function is only available as fastcall function, so it may only be
3002 used in presence of a prototype.
3003 <item>The function produces undefined results if no extended memory driver is
3006 <tag/Availability/cc65
3008 <ref id="em_commit" name="em_commit">,
3009 <ref id="em_copyto" name="em_copyto">,
3010 <ref id="em_load_driver" name="em_load_driver">
3016 <sect1>em_copyto<label id="em_copyto"><p>
3020 <tag/Function/Copy from normal into extended memory.
3021 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3022 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
3023 <tag/Description/Copy data from linear into extended memory. Source and
3024 target addresses as well as the number of bytes to transfer are specified in
3025 the <tt/em_copy/ structure that is passed as a parameter.
3026 <tag/Notes/<itemize>
3027 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
3028 made any changes to the data in the window, call <tt/<ref id="em_commit"
3029 name="em_commit">/ first, or the changes are lost.
3030 <item>The function is only available as fastcall function, so it may only be
3031 used in presence of a prototype.
3032 <item>The function produces undefined results if no extended memory driver is
3035 <tag/Availability/cc65
3037 <ref id="em_commit" name="em_commit">,
3038 <ref id="em_copyfrom" name="em_copyfrom">,
3039 <ref id="em_load_driver" name="em_load_driver">
3045 <sect1>em_install<label id="em_install"><p>
3049 <tag/Function/Install an already loaded extended memory driver.
3050 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3051 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
3052 <tag/Description/The function installs an already loaded extended memory driver
3053 and returns an error code. The function may be used to install a driver linked
3054 statically to the program.
3055 <tag/Notes/<itemize>
3056 <item>Not all drivers are able to detect if the supported hardware is really
3058 <item>The function is only available as fastcall function, so it may only be
3059 used in presence of a prototype.
3061 <tag/Availability/cc65
3063 <ref id="em_load_driver" name="em_load_driver">,
3064 <ref id="em_uninstall" name="em_uninstall">,
3065 <ref id="em_unload" name="em_unload">
3071 <sect1>em_load_driver<label id="em_load_driver"><p>
3075 <tag/Function/Load and initialize an extended memory driver.
3076 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3077 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
3078 <tag/Description/Load an extended memory driver into memory and initialize
3079 it. The function returns an error code that tells if all this has been
3081 <tag/Notes/<itemize>
3082 <item>Not all drivers are able to detect if the supported hardware is really
3084 <item>The function is only available as fastcall function, so it may only be
3085 used in presence of a prototype.
3086 <item>The driver is loaded by name, so currently you must know the type of
3087 extended memory that should be supported. There is no autodetect capability.
3089 <tag/Availability/cc65
3091 <ref id="em_unload" name="em_unload">
3097 <sect1>em_map<label id="em_map"><p>
3101 <tag/Function/Make a page of extended memory accessible.
3102 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3103 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
3104 <tag/Description/The function maps one page of extended memory into linear
3105 memory and returns a pointer to the page frame. Depending on the hardware
3106 and driver, the data is either mapped into the address space or transfered
3107 into a buffer. If you don't need the actual contents of the page (for example
3108 because you're going to overwrite it completely), it is better to call
3109 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
3110 data if it is possible to avoid that.
3111 <tag/Notes/<itemize>
3112 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
3113 made any changes to the data in the window, call <tt/<ref id="em_commit"
3114 name="em_commit">/ first, or the changes are lost.
3115 <item>The function is only available as fastcall function, so it may only be
3116 used in presence of a prototype.
3117 <item>The function produces undefined results if no extended memory driver is
3120 <tag/Availability/cc65
3122 <ref id="em_commit" name="em_commit">,
3123 <ref id="em_load_driver" name="em_load_driver">,
3124 <ref id="em_use" name="em_use">
3130 <sect1>em_pagecount<label id="em_pagecount"><p>
3134 <tag/Function/Return the number of available extended memory pages.
3135 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3136 <tag/Declaration/<tt/unsigned em_pagecount (void);/
3137 <tag/Description/The function returns the size of the extended memory supported
3138 by the driver in 256 byte pages.
3139 <tag/Notes/<itemize>
3140 <item>The function returns zero if no extended memory driver is loaded.
3141 <item>The function may return zero if the supported hardware was not detected.
3143 <tag/Availability/cc65
3145 <ref id="em_load_driver" name="em_load_driver">
3151 <sect1>em_uninstall<label id="em_uninstall"><p>
3155 <tag/Function/Uninstall an already loaded extended memory driver.
3156 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3157 <tag/Declaration/<tt/unsigned char em_uninstall (void);/
3158 <tag/Description/The function uninstalls an already loaded extended memory
3159 driver but doesn't remove it from memory.
3160 <tag/Notes/<itemize>
3161 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
3162 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
3163 should be used instead of <tt/em_uninstall/ so the driver is also removed
3166 <tag/Availability/cc65
3168 <ref id="em_install" name="em_install">,
3169 <ref id="em_load_driver" name="em_load_driver">,
3170 <ref id="em_unload" name="em_unload">
3176 <sect1>em_unload<label id="em_unload"><p>
3180 <tag/Function/Unload an extended memory driver.
3181 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3182 <tag/Declaration/<tt/unsigned char em_unload (void);/
3183 <tag/Description/The function unloads a loaded extended memory driver and
3184 frees all memory allocated for the driver.
3185 <tag/Notes/<itemize>
3186 <item>The function does nothing if no driver is loaded.
3188 <tag/Availability/cc65
3190 <ref id="em_load_driver" name="em_load_driver">
3196 <sect1>em_use<label id="em_use"><p>
3200 <tag/Function/Prepare an extended memory page for use.
3201 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3202 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
3203 <tag/Description/The function maps one page of extended memory into linear
3204 memory and returns a pointer to the page frame. This function is similar to
3205 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
3206 actual memory window in the assumption that the existing data is wrong or
3207 will get overwritten.
3208 <tag/Notes/<itemize>
3209 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
3210 made any changes to the data in the window, call <tt/<ref id="em_commit"
3211 name="em_commit">/ first, or the changes are lost.
3212 <item>The function is only available as fastcall function, so it may only be
3213 used in presence of a prototype.
3214 <item>The function produces undefined results if no extended memory driver is
3217 <tag/Availability/cc65
3219 <ref id="em_commit" name="em_commit">,
3220 <ref id="em_load_driver" name="em_load_driver">,
3221 <ref id="em_map" name="em_map">
3227 <sect1>exit<label id="exit"><p>
3231 <tag/Function/Terminate the program.
3232 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3233 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
3234 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
3235 return code of the program. Before termination, all files are closed, buffered
3236 output is written and any functions registered with <tt/<ref id="atexit"
3237 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
3238 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
3240 <tag/Notes/<itemize>
3241 <item>The function is only available as fastcall function, so it may only
3242 be used in presence of a prototype.
3243 <item>It depends on the host machine if the program return code can be
3244 evaluated or is ignored.
3246 <tag/Availability/ISO 9899
3248 <ref id="abort" name="abort">,
3249 <ref id="exit" name="exit">
3255 <sect1>exec<label id="exec"><p>
3259 <tag/Function/Execute a program file.
3260 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3261 <tag/Declaration/<tt/int __fastcall__ exec (const char* progname, const char* cmdline);/
3262 <tag/Description/<tt/exec/ replaces the currently running program by a new one.
3263 Calling <tt/exec()/ is identical to calling <tt/<ref id="exit" name="exit()">/,
3264 then loading and starting the program named in the first argument, passing
3265 the command line specified as second argument. Instead of an empty string,
3266 a <tt/NULL/ pointer may be passed as second parameter.
3267 On success, the function does not return. On failure, -1 is returned and
3268 <tt/errno/ contains an error code.
3269 <tag/Notes/<itemize>
3270 <item>The function is only available as fastcall function, so it may only
3271 be used in presence of a prototype.
3272 <item>On most platforms, the function needs to copy a small stub loader to
3273 some memory area outside the program space. This may collide with other
3274 programs. See the platform specific docs on this.
3275 <item>Because it is necessary to terminate the running program before the
3276 memory can be reused to load the new one, there is a high chance that the
3277 function may not be able to return on errors.
3278 <item>The command line is passed to the new program in the same way as cc65
3279 programs expect the command line. If the new program is not a cc65 generated
3280 program, it may not be able to read it.
3282 <tag/Availability/cc65
3284 <ref id="exit" name="exit">
3290 <sect1>fast<label id="fast"><p>
3294 <tag/Function/Switch the C128 into 2MHz mode.
3295 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
3296 <tag/Declaration/<tt/void fast (void);/
3297 <tag/Description/The function will switch the clock of the C128 to 2MHz. This
3298 will nearly double the speed compared to slow mode.
3299 <tag/Notes/<itemize>
3300 <item>The function is specific to the C128.
3301 <item>2MHz clock will not work in 40 column mode.
3303 <tag/Availability/C128
3305 <ref id="slow" name="slow">,
3306 <ref id="toggle_videomode" name="toggle_videomode">,
3307 <ref id="videomode" name="videomode">
3313 <sect1>feof<label id="feof"><p>
3317 <tag/Function/Return the end-of-file indicator of a stream.
3318 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3319 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
3320 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
3321 <tt/f/, and returns a non zero value if it is set.
3322 <tag/Notes/<itemize>
3323 <item>The indicator is set only after a read past the end of a file is
3325 <item>The function is only available as fastcall function, so it may only be
3326 used in presence of a prototype.
3328 <tag/Availability/ISO 9899
3330 <ref id="feof" name="clearerr">,
3331 <ref id="ferror" name="ferror">
3337 <sect1>ferror<label id="ferror"><p>
3341 <tag/Function/Return the error indicator of a stream.
3342 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3343 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
3344 <tag/Description/<tt/ferror/ tests the error indicator of the stream
3345 <tt/f/, and returns a non zero value if it is set.
3346 <tag/Notes/<itemize>
3347 <item>The function is only available as fastcall function, so it may only be
3348 used in presence of a prototype.
3350 <tag/Availability/ISO 9899
3352 <ref id="feof" name="clearerr">,
3353 <ref id="ferror" name="feof">
3359 <sect1>fileno<label id="fileno"><p>
3363 <tag/Function/Return the file handle used by a stream.
3364 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3365 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
3366 <tag/Description/The <tt/fileno/ function returns the file handle used
3367 internally by a C stream. This file handle (an integer) can be used as a
3368 handle for the POSIX input/output functions.
3369 <tag/Notes/<itemize>
3370 <item>The function is only available as fastcall function, so it may only be
3371 used in presence of a prototype.
3372 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
3373 file may have unpredictable results.
3375 <tag/Availability/POSIX 1003.1
3377 <ref id="creat" name="creat">,
3378 <ref id="open" name="open"> <!-- , -->
3379 <!-- <ref id="read" name="read">, -->
3380 <!-- <ref id="write" name="write"> -->
3386 <sect1>free<label id="free"><p>
3390 <tag/Function/Free a block of dynamic memory.
3391 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3392 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
3393 <tag/Description/Free a block of dynamic memory previously allocated with
3394 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
3395 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
3396 pointer is <tt/NULL/, no action is performed.
3397 <tag/Notes/<itemize>
3398 <item>Passing an already free'd block to <tt/free/ again will cause undefined
3399 behaviour and may crash your program.
3400 <item>The function is only available as fastcall function, so it may only
3401 be used in presence of a prototype.
3403 <tag/Availability/ISO 9899
3405 <ref id="_heapadd" name="_heapadd">,
3406 <ref id="_heapblocksize" name="_heapblocksize">,
3407 <ref id="_heapmaxavail" name="_heapmaxavail">,
3408 <ref id="_heapmemavail" name="_heapmemavail">,
3409 <ref id="calloc" name="calloc">,
3410 <ref id="malloc" name="malloc">,
3411 <ref id="realloc" name="realloc">
3417 <sect1>get_ostype<label id="get_ostype"><p>
3421 <tag/Function/The function returns the operating system, the program runs on.
3422 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
3423 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
3424 <tag/Declaration/<tt/unsigned char get_ostype (void);/
3425 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
3426 all supported targets. If it exists, it returns a number that identifies the
3427 operating system or machine type, the program runs on. The machine dependent
3428 header files define constants that can be used to check the return code.
3429 <tag/Notes/<itemize>
3430 <item>The function does not exist on all platforms.
3431 <item>The return codes are platform dependent.
3433 <tag/Availability/cc65 (not all platforms)
3439 <sect1>getcpu<label id="getcpu"><p>
3443 <tag/Function/Determine on which CPU the program is running.
3444 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3445 <tag/Declaration/<tt/unsigned char getcpu (void);/
3446 <tag/Description/The function checks on which CPU the code is running. It
3447 returns one of the constants<itemize>
3449 <item><tt/CPU_65C02/
3450 <item><tt/CPU_65816/
3452 <item><tt/CPU_65SC02/
3453 <item><tt/CPU_65CE02/
3455 <tag/Notes/<itemize>
3456 <item>Other, more exotic CPU types are not disinguished.
3458 <tag/Availability/cc65
3464 <sect1>getcurrentdevice<label id="getcurrentdevice"><p>
3468 <tag/Function/Get current device.
3469 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3470 <tag/Declaration/<tt/unsigned char getcurrentdevice (void);/
3471 <tag/Description/The function returns the current device.
3472 It allows to access the current device with the <ref id="dio.h"
3473 name="Low-level disk I/O API"> or <ref id="cbm.h" name="cbm_* I/O
3474 functions"> requiring a 'device' parameter.
3475 <tag/Availability/cc65
3477 <ref id="getdevicedir" name="getdevicedir">,
3478 <ref id="getfirstdevice" name="getfirstdevice">,
3479 <ref id="getnextdevice" name="getnextdevice">
3481 dio_open (getcurrentdevice ());
3487 <sect1>getcwd<label id="getcwd"><p>
3491 <tag/Function/Get current working directory.
3492 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3493 <tag/Declaration/<tt/char* __fastcall__ getcwd (char* buf, size_t size);/
3494 <tag/Description/The function will return the current working directory.
3495 <tag/Notes/<itemize>
3496 <item>The function is only available as fastcall function, so it may only
3497 be used in presence of a prototype.
3499 <tag/Availability/POSIX 1003.1
3505 <sect1>getdevicedir<label id="getdevicedir"><p>
3509 <tag/Function/Get device directory.
3510 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3511 <tag/Declaration/<tt/char* __fastcall__ getdevicedir (unsigned char device, char* buf, size_t size);/
3512 <tag/Description/The function returns the directory representing <tt/device/.
3513 It allows to access the device on filesystem level by calling chdir() with
3514 the directory returned.
3515 <tag/Notes/<itemize>
3516 <item>Calling getdevicedir() <em/does/ check for a (formatted) disk in a
3517 floppy-disk-type device and returns NULL if that check fails.
3518 <item>The function is only available as fastcall function, so it may only
3519 be used in presence of a prototype.
3521 <tag/Availability/cc65
3523 <ref id="getcwd" name="getcwd">,
3524 <ref id="getcurrentdevice" name="getcurrentdevice">,
3525 <ref id="getfirstdevice" name="getfirstdevice">,
3526 <ref id="getnextdevice" name="getnextdevice">
3528 chdir (getdevicedir (device, buf, sizeof buf));
3530 cf. <tt/samples/enumdevdir.c/
3535 <sect1>getenv<label id="getenv"><p>
3539 <tag/Function/Return a value from the environment.
3540 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3541 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
3542 <tag/Description/The function searches the environment for an entry that
3543 matches <tt/name/ and returns its value. The environment consists of a list
3544 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
3546 <tag/Notes/<itemize>
3547 <item>What exactly is stored in the environment depends on the machine the
3548 program is running on.
3549 <item>The function is only available as fastcall function, so it may only
3550 be used in presence of a prototype.
3552 <tag/Availability/ISO 9899
3558 <sect1>getfirstdevice<label id="getfirstdevice"><p>
3562 <tag/Function/Get first device.
3563 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3564 <tag/Declaration/<tt/unsigned char getfirstdevice (void);/
3565 <tag/Description/The function returns the first device.
3566 The constant <tt/INVALID_DEVICE/ indicates no device.
3567 <tag/Notes/<itemize>
3568 <item>Calling getfirstdevice() does <em/not/ turn on the motor of a
3569 drive-type device and does <em/not/ check for a disk in the drive.
3571 <tag/Availability/cc65
3573 <ref id="getcurrentdevice" name="getcurrentdevice">,
3574 <ref id="getdevicedir" name="getdevicedir">,
3575 <ref id="getnextdevice" name="getnextdevice">
3577 unsigned char dev = getfirstdevice ();
3578 while (dev != INVALID_DEVICE) {
3579 printf ("%d\n", dev);
3580 dev = getnextdevice (dev);
3587 <sect1>getnextdevice<label id="getnextdevice"><p>
3591 <tag/Function/Get next device.
3592 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3593 <tag/Declaration/<tt/unsigned char __fastcall__ getnextdevice (unsigned char device);/
3594 <tag/Description/The function returns the next device after <tt/device/.
3595 The constant <tt/INVALID_DEVICE/ indicates no further device.
3596 <tag/Notes/<itemize>
3597 <item>Calling getnextdevice() does <em/not/ turn on the motor of a
3598 drive-type device and does <em/not/ check for a disk in the drive.
3599 <item>The function is only available as fastcall function, so it may only
3600 be used in presence of a prototype.
3602 <tag/Availability/cc65
3604 <ref id="getcurrentdevice" name="getcurrentdevice">,
3605 <ref id="getdevicedir" name="getdevicedir">,
3606 <ref id="getfirstdevice" name="getfirstdevice">
3608 unsigned char dev = getfirstdevice ();
3609 while (dev != INVALID_DEVICE) {
3610 printf ("%d\n", dev);
3611 dev = getnextdevice (dev);
3618 <sect1>getopt<label id="getopt"><p>
3622 <tag/Function/Parse command line options.
3623 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3624 <tag/Declaration/<tt/int __fastcall__ getopt (int argc, char* const* argv,
3625 const char* optstring);/
3626 <tag/Description/The function parses command line arguments, <tt/argc/ and
3627 <tt/argv/ are the argument count and array passed to <tt/main/. <tt/optstring/
3628 is a string that contains command line option characters. If a character in
3629 <tt/optstring/ is followed by a colon, the option requires an argument. An
3630 option on the command line is recognized if it is one of the option characters
3632 <tt/getopt/ must be called repeatedly. It will return each option character
3633 found on the command line and <tt/EOF/ (-1) if there is no other option. An
3634 option argument is placed in <tt/optarg/, the index of the next element on the
3635 command line to be processed is placed in <tt/optind/.
3636 <tag/Notes/<itemize>
3637 <item>The implementation will not reorder options. A non option on the command
3638 line will terminate option processing. All remaining arguments are not
3639 recognized as options, even if the start with a '-' character.
3640 <item>The function is only available as fastcall function, so it may only
3641 be used in presence of a prototype.
3643 <tag/Availability/POSIX.2
3649 <sect1>gotox<label id="gotox"><p>
3653 <tag/Function/Move the text mode cursor to a new X position.
3654 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3655 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
3656 <tag/Description/The function moves the text mode cursor to the specified X
3657 position while leaving the Y position untouched. The leftmost position on the
3658 screen has the coordinate 0.
3659 <tag/Notes/<itemize>
3660 <item>The function is only available as fastcall function, so it may
3661 only be used in presence of a prototype.
3662 <item>Invalid values for the X position (out of screen coordinates) may
3663 lead to undefined behaviour.
3665 <tag/Availability/cc65
3667 <ref id="gotoy" name="gotoy">,
3668 <ref id="gotoxy" name="gotoxy">,
3669 <ref id="wherex" name="wherex">,
3670 <ref id="wherey" name="wherey">
3676 <sect1>gotoxy<label id="gotoxy"><p>
3680 <tag/Function/Move the text mode cursor to a new position.
3681 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3682 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
3683 <tag/Description/The function moves the text mode cursor to the specified
3684 position. The leftmost position on the screen has the X coordinate 0, the
3685 topmost line has the Y coordinate 0.
3686 <tag/Notes/<itemize>
3687 <item>The function is only available as fastcall function, so it may only be
3688 used in presence of a prototype.
3689 <item>Invalid values for any of both coordinates (out of screen positions) may
3690 lead to undefined behaviour.
3692 <tag/Availability/cc65
3694 <ref id="gotox" name="gotox">,
3695 <ref id="gotoy" name="gotoy">,
3696 <ref id="wherex" name="wherex">,
3697 <ref id="wherey" name="wherey">
3703 <sect1>gotoy<label id="gotoy"><p>
3707 <tag/Function/Move the text mode cursor to a new Y position.
3708 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3709 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
3710 <tag/Description/The function moves the text mode cursor to the specified Y
3711 position while leaving the X position untouched. The uppermost position on the
3712 screen has the coordinate 0.
3713 <tag/Notes/<itemize>
3714 <item>The function is only available as fastcall function, so it may
3715 only be used in presence of a prototype.
3716 <item>Invalid values for the Y position (out of screen coordinates) may lead
3717 to undefined behaviour.
3719 <tag/Availability/cc65
3721 <ref id="gotox" name="gotox">,
3722 <ref id="gotoxy" name="gotoxy">,
3723 <ref id="wherex" name="wherex">,
3724 <ref id="wherey" name="wherey">
3730 <sect1>isalnum<label id="isalnum"><p>
3734 <tag/Function/Check if a given character is a letter or digit.
3735 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3736 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
3737 <tag/Description/The function returns a non zero value if the given argument
3738 is a letter or digit. The return value is zero if the character is anything
3740 <tag/Notes/<itemize>
3741 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3742 inline sequence generated by the macro will not work correctly for values
3743 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3744 this range. The non inline function may be accessed by <tt/#undef/'ing
3746 <item>When compiling without <tt/-Os/, the function is only available as
3747 fastcall function, so it may only be used in presence of a prototype.
3749 <tag/Availability/ISO 9899
3751 <ref id="isalpha" name="isalpha">,
3752 <ref id="isascii" name="isascii">,
3753 <ref id="isblank" name="isblank">,
3754 <ref id="iscntrl" name="iscntrl">,
3755 <ref id="isdigit" name="isdigit">,
3756 <ref id="isgraph" name="isgraph">,
3757 <ref id="islower" name="islower">,
3758 <ref id="isprint" name="isprint">,
3759 <ref id="ispunct" name="ispunct">,
3760 <ref id="isspace" name="isspace">,
3761 <ref id="isupper" name="isupper">,
3762 <ref id="isxdigit" name="isxdigit">
3768 <sect1>isalpha<label id="isalpha"><p>
3772 <tag/Function/Check if a given character is a letter.
3773 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3774 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
3775 <tag/Description/The function returns a non zero value if the given argument
3776 is a letter. The return value is zero if the character is anything else.
3777 <tag/Notes/<itemize>
3778 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3779 inline sequence generated by the macro will not work correctly for values
3780 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3781 this range. The non inline function may be accessed by <tt/#undef/'ing the
3783 <item>When compiling without <tt/-Os/, the function is only available as
3784 fastcall function, so it may only be used in presence of a prototype.
3786 <tag/Availability/ISO 9899
3788 <ref id="isalnum" name="isalnum">,
3789 <ref id="isascii" name="isascii">,
3790 <ref id="isblank" name="isblank">,
3791 <ref id="iscntrl" name="iscntrl">,
3792 <ref id="isdigit" name="isdigit">,
3793 <ref id="isgraph" name="isgraph">,
3794 <ref id="islower" name="islower">,
3795 <ref id="isprint" name="isprint">,
3796 <ref id="ispunct" name="ispunct">,
3797 <ref id="isspace" name="isspace">,
3798 <ref id="isupper" name="isupper">,
3799 <ref id="isxdigit" name="isxdigit">
3805 <sect1>isascii<label id="isascii"><p>
3809 <tag/Function/Check if a given character is in the ASCII (0..127) range.
3810 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3811 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
3812 <tag/Description/The function returns a non zero value if the given argument
3813 is in the range 0..127 (the range of valid ASCII characters) and zero if not.
3814 <tag/Notes/<itemize>
3815 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3816 inline sequence generated by the macro will not work correctly for values
3817 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3818 this range. The non inline function may be accessed by <tt/#undef/'ing the
3820 <item>When compiling without <tt/-Os/, the function is only available as
3821 fastcall function, so it may only be used in presence of a prototype.
3823 <tag/Availability/ISO 9899
3825 <ref id="isalnum" name="isalnum">,
3826 <ref id="isalpha" name="isalpha">,
3827 <ref id="isblank" name="isblank">,
3828 <ref id="iscntrl" name="iscntrl">,
3829 <ref id="isdigit" name="isdigit">,
3830 <ref id="isgraph" name="isgraph">,
3831 <ref id="islower" name="islower">,
3832 <ref id="isprint" name="isprint">,
3833 <ref id="ispunct" name="ispunct">,
3834 <ref id="isspace" name="isspace">,
3835 <ref id="isupper" name="isupper">,
3836 <ref id="isxdigit" name="isxdigit">
3842 <sect1>isblank<label id="isblank"><p>
3846 <tag/Function/Check if a given character is a space or tab.
3847 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3848 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
3849 <tag/Description/The function returns a non zero value if the given argument
3850 is a space or tab character. The return value is zero if the character is
3852 <tag/Notes/<itemize>
3853 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3854 inline sequence generated by the macro will not work correctly for values
3855 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3856 this range. The non inline function may be accessed by <tt/#undef/'ing the
3858 <item>When compiling without <tt/-Os/, the function is only available as
3859 fastcall function, so it may only be used in presence of a prototype.
3861 <tag/Availability/ISO 9899
3863 <ref id="isalnum" name="isalnum">,
3864 <ref id="isalpha" name="isalpha">,
3865 <ref id="isascii" name="isascii">,
3866 <ref id="iscntrl" name="iscntrl">,
3867 <ref id="isdigit" name="isdigit">,
3868 <ref id="isgraph" name="isgraph">,
3869 <ref id="islower" name="islower">,
3870 <ref id="isprint" name="isprint">,
3871 <ref id="ispunct" name="ispunct">,
3872 <ref id="isspace" name="isspace">,
3873 <ref id="isupper" name="isupper">,
3874 <ref id="isxdigit" name="isxdigit">
3880 <sect1>iscntrl<label id="iscntrl"><p>
3884 <tag/Function/Check if a given character is a control character.
3885 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3886 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
3887 <tag/Description/The function returns a non zero value if the given argument
3888 is a control character. The return value is zero if the character is anything
3890 <tag/Notes/<itemize>
3891 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3892 inline sequence generated by the macro will not work correctly for values
3893 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3894 this range. The non inline function may be accessed by <tt/#undef/'ing the
3896 <item>When compiling without <tt/-Os/, the function is only available as
3897 fastcall function, so it may only be used in presence of a prototype.
3899 <tag/Availability/ISO 9899
3901 <ref id="isalnum" name="isalnum">,
3902 <ref id="isalpha" name="isalpha">,
3903 <ref id="isascii" name="isascii">,
3904 <ref id="isblank" name="isblank">,
3905 <ref id="isdigit" name="isdigit">,
3906 <ref id="isgraph" name="isgraph">,
3907 <ref id="islower" name="islower">,
3908 <ref id="isprint" name="isprint">,
3909 <ref id="ispunct" name="ispunct">,
3910 <ref id="isspace" name="isspace">,
3911 <ref id="isupper" name="isupper">,
3912 <ref id="isxdigit" name="isxdigit">
3918 <sect1>isdigit<label id="isdigit"><p>
3922 <tag/Function/Check if a given character is a digit.
3923 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3924 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
3925 <tag/Description/The function returns a non zero value if the given argument
3926 is a digit. The return value is zero if the character is anything else.
3927 <tag/Notes/<itemize>
3928 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3929 inline sequence generated by the macro will not work correctly for values
3930 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3931 this range. The non inline function may be accessed by <tt/#undef/'ing the
3933 <item>When compiling without <tt/-Os/, the function is only available as
3934 fastcall function, so it may only be used in presence of a prototype.
3936 <tag/Availability/ISO 9899
3938 <ref id="isalnum" name="isalnum">,
3939 <ref id="isalpha" name="isalpha">,
3940 <ref id="isascii" name="isascii">,
3941 <ref id="isblank" name="isblank">,
3942 <ref id="iscntrl" name="iscntrl">,
3943 <ref id="isgraph" name="isgraph">,
3944 <ref id="islower" name="islower">,
3945 <ref id="isprint" name="isprint">,
3946 <ref id="ispunct" name="ispunct">,
3947 <ref id="isspace" name="isspace">,
3948 <ref id="isupper" name="isupper">,
3949 <ref id="isxdigit" name="isxdigit">
3955 <sect1>isgraph<label id="isgraph"><p>
3959 <tag/Function/Check if a given character is a printable character (except
3961 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3962 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
3963 <tag/Description/The function returns a non zero value if the given argument
3964 is a printable character with the exception of space. The return value is zero
3965 if the character is anything else.
3966 <tag/Notes/<itemize>
3967 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3968 inline sequence generated by the macro will not work correctly for values
3969 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3970 this range. The non inline function may be accessed by <tt/#undef/'ing the
3972 <item>When compiling without <tt/-Os/, the function is only available as
3973 fastcall function, so it may only be used in presence of a prototype.
3975 <tag/Availability/ISO 9899
3977 <ref id="isalnum" name="isalnum">,
3978 <ref id="isalpha" name="isalpha">,
3979 <ref id="isascii" name="isascii">,
3980 <ref id="isblank" name="isblank">,
3981 <ref id="iscntrl" name="iscntrl">,
3982 <ref id="isdigit" name="isdigit">,
3983 <ref id="islower" name="islower">,
3984 <ref id="isprint" name="isprint">,
3985 <ref id="ispunct" name="ispunct">,
3986 <ref id="isspace" name="isspace">,
3987 <ref id="isupper" name="isupper">,
3988 <ref id="isxdigit" name="isxdigit">
3994 <sect1>islower<label id="islower"><p>
3998 <tag/Function/Check if a given character is a lower case letter.
3999 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4000 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
4001 <tag/Description/The function returns a non zero value if the given argument
4002 is a lower case letter. The return value is zero if the character is anything
4004 <tag/Notes/<itemize>
4005 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4006 inline sequence generated by the macro will not work correctly for values
4007 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4008 this range. The non inline function may be accessed by <tt/#undef/'ing the
4010 <item>When compiling without <tt/-Os/, the function is only available as
4011 fastcall function, so it may only be used in presence of a prototype.
4013 <tag/Availability/ISO 9899
4015 <ref id="isalnum" name="isalnum">,
4016 <ref id="isalpha" name="isalpha">,
4017 <ref id="isascii" name="isascii">,
4018 <ref id="isblank" name="isblank">,
4019 <ref id="iscntrl" name="iscntrl">,
4020 <ref id="isdigit" name="isdigit">,
4021 <ref id="isgraph" name="isgraph">,
4022 <ref id="isprint" name="isprint">,
4023 <ref id="ispunct" name="ispunct">,
4024 <ref id="isspace" name="isspace">,
4025 <ref id="isupper" name="isupper">,
4026 <ref id="isxdigit" name="isxdigit">
4032 <sect1>isprint<label id="isprint"><p>
4036 <tag/Function/Check if a given character is a printable character.
4037 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4038 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
4039 <tag/Description/The function returns a non zero value if the given argument
4040 is a printable character (this includes the space character). The return value
4041 is zero if the character is anything else.
4042 <tag/Notes/<itemize>
4043 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4044 inline sequence generated by the macro will not work correctly for values
4045 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4046 this range. The non inline function may be accessed by <tt/#undef/'ing the
4048 <item>When compiling without <tt/-Os/, the function is only available as
4049 fastcall function, so it may only be used in presence of a prototype.
4051 <tag/Availability/ISO 9899
4053 <ref id="isalnum" name="isalnum">,
4054 <ref id="isalpha" name="isalpha">,
4055 <ref id="isascii" name="isascii">,
4056 <ref id="isblank" name="isblank">,
4057 <ref id="iscntrl" name="iscntrl">,
4058 <ref id="isdigit" name="isdigit">,
4059 <ref id="isgraph" name="isgraph">,
4060 <ref id="islower" name="islower">,
4061 <ref id="ispunct" name="ispunct">,
4062 <ref id="isspace" name="isspace">,
4063 <ref id="isupper" name="isupper">,
4064 <ref id="isxdigit" name="isxdigit">
4070 <sect1>ispunct<label id="ispunct"><p>
4074 <tag/Function/Check if a given character is a printable character but not a
4075 space or an alphanumeric character.
4076 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4077 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
4078 <tag/Description/The function returns a non zero value if the given argument
4079 is a printable character, but not a space or anything alphanumeric. The return
4080 value is zero if the character is anything else.
4081 <tag/Notes/<itemize>
4082 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4083 inline sequence generated by the macro will not work correctly for values
4084 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4085 this range. The non inline function may be accessed by <tt/#undef/'ing the
4087 <item>When compiling without <tt/-Os/, the function is only available as
4088 fastcall function, so it may only be used in presence of a prototype.
4090 <tag/Availability/ISO 9899
4092 <ref id="isalnum" name="isalnum">,
4093 <ref id="isalpha" name="isalpha">,
4094 <ref id="isascii" name="isascii">,
4095 <ref id="isblank" name="isblank">,
4096 <ref id="iscntrl" name="iscntrl">,
4097 <ref id="isdigit" name="isdigit">,
4098 <ref id="isgraph" name="isgraph">,
4099 <ref id="islower" name="islower">,
4100 <ref id="isprint" name="isprint">,
4101 <ref id="isspace" name="isspace">,
4102 <ref id="isupper" name="isupper">,
4103 <ref id="isxdigit" name="isxdigit">
4109 <sect1>isspace<label id="isspace"><p>
4113 <tag/Function/Check if a given character is a white-space character.
4114 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4115 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
4116 <tag/Description/The function returns a non zero value if the given argument
4117 is a white space character. The return value is zero if the character is
4118 anything else. The standard white space characters are: space, formfeed ('\f'),
4119 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
4121 <tag/Notes/<itemize>
4122 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4123 inline sequence generated by the macro will not work correctly for values
4124 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4125 this range. The non inline function may be accessed by <tt/#undef/'ing the
4127 <item>When compiling without <tt/-Os/, the function is only available as
4128 fastcall function, so it may only be used in presence of a prototype.
4130 <tag/Availability/ISO 9899
4132 <ref id="isalnum" name="isalnum">,
4133 <ref id="isalpha" name="isalpha">,
4134 <ref id="isascii" name="isascii">,
4135 <ref id="isblank" name="isblank">,
4136 <ref id="iscntrl" name="iscntrl">,
4137 <ref id="isdigit" name="isdigit">,
4138 <ref id="isgraph" name="isgraph">,
4139 <ref id="islower" name="islower">,
4140 <ref id="isprint" name="isprint">,
4141 <ref id="ispunct" name="ispunct">,
4142 <ref id="isupper" name="isupper">,
4143 <ref id="isxdigit" name="isxdigit">
4149 <sect1>isupper<label id="isupper"><p>
4153 <tag/Function/Check if a given character is an upper case letter.
4154 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4155 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
4156 <tag/Description/The function returns a non zero value if the given argument
4157 is an upper case letter. The return value is zero if the character is anything
4159 <tag/Notes/<itemize>
4160 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4161 inline sequence generated by the macro will not work correctly for values
4162 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4163 this range. The non inline function may be accessed by <tt/#undef/'ing the
4165 <item>When compiling without <tt/-Os/, the function is only available as
4166 fastcall function, so it may only be used in presence of a prototype.
4168 <tag/Availability/ISO 9899
4170 <ref id="isalnum" name="isalnum">,
4171 <ref id="isalpha" name="isalpha">,
4172 <ref id="isascii" name="isascii">,
4173 <ref id="isblank" name="isblank">,
4174 <ref id="iscntrl" name="iscntrl">,
4175 <ref id="isdigit" name="isdigit">,
4176 <ref id="isgraph" name="isgraph">,
4177 <ref id="islower" name="islower">,
4178 <ref id="isprint" name="isprint">,
4179 <ref id="ispunct" name="ispunct">,
4180 <ref id="isspace" name="isspace">,
4181 <ref id="isxdigit" name="isxdigit">
4187 <sect1>isxdigit<label id="isxdigit"><p>
4191 <tag/Function/Check if a given character is a hexadecimal digit.
4192 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4193 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
4194 <tag/Description/The function returns a non zero value if the given argument
4195 is a hexadecimal digit (0..9, a..f and A..F). The return value is zero if the
4196 character is anything else.
4197 <tag/Notes/<itemize>
4198 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4199 inline sequence generated by the macro will not work correctly for values
4200 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4201 this range. The non inline function may be accessed by <tt/#undef/'ing the
4203 <item>When compiling without <tt/-Os/, the function is only available as
4204 fastcall function, so it may only be used in presence of a prototype.
4206 <tag/Availability/ISO 9899
4208 <ref id="isalnum" name="isalnum">,
4209 <ref id="isalpha" name="isalpha">,
4210 <ref id="isascii" name="isascii">,
4211 <ref id="isblank" name="isblank">,
4212 <ref id="iscntrl" name="iscntrl">,
4213 <ref id="isdigit" name="isdigit">,
4214 <ref id="isgraph" name="isgraph">,
4215 <ref id="islower" name="islower">,
4216 <ref id="isprint" name="isprint">,
4217 <ref id="ispunct" name="ispunct">,
4218 <ref id="isspace" name="isspace">,
4219 <ref id="isupper" name="isupper">
4225 <sect1>itoa<label id="itoa"><p>
4229 <tag/Function/Convert an integer into a string.
4230 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4231 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
4232 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
4233 <tt/radix/ as the base.
4234 <tag/Notes/<itemize>
4235 <item>There are no provisions to prevent a buffer overflow.
4236 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
4237 <item>The function is non standard, so it is not available in strict ANSI mode.
4238 You should probably use <tt/sprintf/ instead.
4239 <item>The function is only available as fastcall function, so it may only be
4240 used in presence of a prototype.
4242 <tag/Availability/cc65
4244 <ref id="atoi" name="atoi">,
4245 <ref id="atol" name="atol">,
4246 <ref id="ltoa" name="ltoa">,
4247 <ref id="ultoa" name="ultoa">,
4248 <ref id="utoa" name="utoa">
4254 <sect1>joy_count<label id="joy_count"><p>
4258 <tag/Function/Return the number of joysticks supported by the current driver.
4259 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4260 <tag/Declaration/<tt/unsigned char joy_count (void);/
4261 <tag/Description/The function returns a the number of joysticks supported
4262 by the current joystick driver.
4263 <tag/Notes/<itemize>
4264 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4265 name="joy_load_driver"> before calling this function.
4266 <item>The function returns the number of joysticks supported by the driver.
4267 There's no way to check for the number of actually connected joysticks.
4269 <tag/Availability/cc65
4271 <ref id="joy_load_driver" name="joy_load_driver">,
4272 <ref id="joy_read" name="joy_read">
4278 <sect1>joy_install<label id="joy_install"><p>
4282 <tag/Function/Install an already loaded driver and return an error code.
4283 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4284 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
4285 <tag/Description/The function installs a driver that was already loaded into
4286 memory (or linked statically to the program). It returns an error code
4287 (<tt/JOY_ERR_OK/ in case of success).
4288 <tag/Notes/<itemize>
4289 <item>The function is only available as fastcall function, so it may only be
4290 used in presence of a prototype.
4292 <tag/Availability/cc65
4294 <ref id="joy_load_driver" name="joy_load_driver">,
4295 <ref id="joy_uninstall" name="joy_uninstall">,
4296 <ref id="joy_unload" name="joy_unload">
4302 <sect1>joy_load_driver<label id="joy_load_driver"><p>
4306 <tag/Function/Load a driver from disk and install it.
4307 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4308 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
4309 <tag/Description/The function loads a driver with the given name from disk
4310 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
4311 driver was successfully loaded and installed.
4312 <tag/Notes/<itemize>
4313 <item>The function is only available as fastcall function, so it may only be
4314 used in presence of a prototype.
4316 <tag/Availability/cc65
4318 <ref id="joy_install" name="joy_install">,
4319 <ref id="joy_uninstall" name="joy_uninstall">,
4320 <ref id="joy_unload" name="joy_unload">
4326 <sect1>joy_read<label id="joy_read"><p>
4330 <tag/Function/Read the status of a joystick.
4331 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4332 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
4333 <tag/Description/The function reads the status bits for a joystick. The number
4334 of the joystick is passed as parameter. The result may be examined by using one
4335 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
4336 <tag/Notes/<itemize>
4337 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4338 name="joy_load_driver"> before calling this function.
4339 <item>The function is only available as fastcall function, so it may only be
4340 used in presence of a prototype.
4342 <tag/Availability/cc65
4344 <ref id="joy_count" name="joy_count">,
4345 <ref id="joy_load_driver" name="joy_load_driver">,
4346 <ref id="joy_unload" name="joy_unload">
4352 <sect1>joy_uninstall<label id="joy_uninstall"><p>
4356 <tag/Function/Uninstall the current joystick driver.
4357 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4358 <tag/Declaration/<tt/unsigned char joy_uninstall (void);/
4359 <tag/Description/The function uninstalls the currently installed joystick
4360 driver. It does not remove the driver from memory. The function returns an
4361 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4362 <tag/Notes/<itemize>
4363 <item>A joystick driver must be installed using <ref id="joy_install"
4364 name="joy_install"> before calling this function.
4366 <tag/Availability/cc65
4368 <ref id="joy_install" name="joy_install">,
4369 <ref id="joy_load_driver" name="joy_load_driver">,
4370 <ref id="joy_unload" name="joy_unload">
4376 <sect1>joy_unload<label id="joy_unload"><p>
4380 <tag/Function/Uninstall, then unload the current joystick driver.
4381 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4382 <tag/Declaration/<tt/unsigned char joy_unload (void);/
4383 <tag/Description/The function uninstalls the currently installed joystick
4384 driver and removes it from memory. An error code is returned, which is
4385 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4386 <tag/Notes/<itemize>
4387 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4388 name="joy_load_driver"> before calling this function.
4390 <tag/Availability/cc65
4392 <ref id="joy_load_driver" name="joy_load_driver">
4398 <sect1>kbhit<label id="kbhit"><p>
4402 <tag/Function/Check if there's a key waiting in the keyboard buffer.
4403 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4404 <tag/Declaration/<tt/unsigned char kbhit (void);/
4405 <tag/Description/The function returns a value of zero if there is no character
4406 waiting to be read from the keyboard. It returns non zero otherwise.
4407 <tag/Notes/<itemize>
4408 <item>If the system does not support a keyboard buffer (most systems
4409 do), the function is rather useless.
4411 <tag/Availability/cc65
4413 <ref id="cgetc" name="cgetc">,
4414 <ref id="cursor" name="cursor">
4420 <sect1>kbrepeat<label id="kbrepeat"><p>
4424 <tag/Function/Set the keyboard repeat mode.
4425 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
4426 <tag/Declaration/<tt/unsigned char __fastcall__ kbrepeat (unsigned char mode);/
4427 <tag/Description/This function changes which keys have automatic repeat when
4428 being held down for a certain time. Possible values are <tt/KBREPEAT_CURSOR/
4429 (repeat only cursor-related keys), <tt/KBREPEAT_NONE/ (no repeat for any
4430 keys), and <tt/KBREPEAT_ALL/ (repeat all keys). The old mode is returned, so
4431 it can be restored later.
4432 <tag/Notes/<itemize>
4433 <item>The function is available only as a fastcall function; so, it may be used
4434 only in the presence of a prototype.
4436 <tag/Availability/cc65
4442 <sect1>labs<label id="labs"><p>
4446 <tag/Function/Returns the absolute value of a long integer.
4447 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4448 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
4449 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
4451 <tag/Notes/<itemize>
4452 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
4453 <item>The function is only available as fastcall function, so it may only be
4454 used in presence of a prototype.
4456 <tag/Availability/ISO 9899
4458 <ref id="abs" name="abs">
4464 <sect1>ltoa<label id="ltoa"><p>
4468 <tag/Function/Convert a long integer into a string.
4469 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4470 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
4471 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
4472 using <tt/radix/ as the base.
4473 <tag/Notes/<itemize>
4474 <item>There are no provisions to prevent a buffer overflow.
4475 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
4476 <item>The function is non standard, so it is not available in strict ANSI mode.
4477 You should probably use <tt/sprintf/ instead.
4478 <item>The function is only available as fastcall function, so it may only be
4479 used in presence of a prototype.
4481 <tag/Availability/cc65
4483 <ref id="atoi" name="atoi">,
4484 <ref id="atol" name="atol">,
4485 <ref id="itoa" name="itoa">,
4486 <ref id="ultoa" name="ultoa">,
4487 <ref id="utoa" name="utoa">
4493 <sect1>localeconv<label id="localeconv"><p>
4497 <tag/Function/Returns a pointer to the current locale structure.
4498 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4499 <tag/Declaration/<tt/struct lconv* localeconv (void);/
4500 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
4502 <tag/Notes/<itemize>
4503 <item>cc65 supports only the "C" locale, so even after setting a new locale
4504 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
4507 <tag/Availability/ISO 9899
4509 <ref id="setlocale" name="setlocale">
4515 <sect1>longjmp<label id="longjmp"><p>
4519 <tag/Function/Non local goto.
4520 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4521 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
4522 <tag/Description/The <tt/longjmp/ function restores a program context from the
4523 data in <tt/buf/, which must have been set by a preceeding call to
4524 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
4525 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
4527 <tag/Notes/<itemize>
4528 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
4529 was called with a value of one.
4530 <item>The function is only available as fastcall function, so it may only
4531 be used in presence of a prototype.
4533 <tag/Availability/ISO 9899
4535 <ref id="setjmp" name="setjmp">
4541 <sect1>malloc<label id="malloc"><p>
4545 <tag/Function/Allocate dynamic memory.
4546 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4547 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
4548 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
4549 pointer to the allocated memory block. On error (not enough memory available),
4550 <tt/malloc/ returns <tt/NULL/.
4551 <tag/Notes/<itemize>
4552 <item>The function is only available as fastcall function, so it may only
4553 be used in presence of a prototype.
4555 <tag/Availability/ISO 9899
4557 <ref id="_heapadd" name="_heapadd">,
4558 <ref id="_heapblocksize" name="_heapblocksize">,
4559 <ref id="_heapmaxavail" name="_heapmaxavail">,
4560 <ref id="_heapmemavail" name="_heapmemavail">,
4561 <ref id="calloc" name="calloc">,
4562 <ref id="free" name="free">,
4563 <ref id="realloc" name="realloc">,
4564 <ref id="strdup" name="strdup">
4570 <sect1>memchr<label id="memchr"><p>
4574 <tag/Function/Search for a character in a block of raw memory.
4575 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4576 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
4577 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
4578 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
4579 that is of size <tt/count/. Upon completion, the function returns a pointer to
4580 the character found, or a null pointer if the character was not found.
4581 <tag/Notes/<itemize>
4582 <item>The function is only available as fastcall function, so it may only
4583 be used in presence of a prototype.
4585 <tag/Availability/ISO 9899
4587 <ref id="strchr" name="strchr">
4593 <sect1>memcmp<label id="memcmp"><p>
4597 <tag/Function/Compare two memory areas.
4598 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4599 <tag/Declaration/<tt/int __fastcall__ memcmp (const void* p1, const void* p2, size_t count);/
4600 <tag/Description/<tt/memcmp/ compares <tt/count/ bytes from the memory area
4601 pointed to by <tt/p1/ into the memory area pointed to by <tt/p2/. It returns a value that is less than
4602 zero if <tt/p1/ is less than <tt/p2/, zero if <tt/p1/ is the same as <tt/p2/,
4603 and a value greater than zero if <tt/p1/ is greater than <tt/p2/.
4604 <tag/Notes/<itemize>
4605 <item>The function is only available as fastcall function, so it may only
4606 be used in presence of a prototype.
4608 <tag/Availability/ISO 9899
4610 <ref id="strcmp" name="strcmp">,
4611 <ref id="memmove" name="memmove">,
4612 <ref id="memset" name="memset">
4618 <sect1>memcpy<label id="memcpy"><p>
4622 <tag/Function/Copy a memory area.
4623 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4624 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
4625 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
4626 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4628 <tag/Notes/<itemize>
4629 <item>The result is undefined if the memory areas do overlap. Use
4630 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
4631 <item>The function is only available as fastcall function, so it may only
4632 be used in presence of a prototype.
4634 <tag/Availability/ISO 9899
4636 <ref id="_swap" name="_swap">,
4637 <ref id="memmove" name="memmove">,
4638 <ref id="memset" name="memset">
4644 <sect1>memmove<label id="memmove"><p>
4648 <tag/Function/Copy a memory area.
4649 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4650 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
4651 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
4652 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4654 <tag/Notes/<itemize>
4655 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
4656 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
4657 <item>The function is only available as fastcall function, so it may only
4658 be used in presence of a prototype.
4660 <tag/Availability/ISO 9899
4662 <ref id="_swap" name="_swap">,
4663 <ref id="memcpy" name="memcpy">,
4664 <ref id="memset" name="memset">
4670 <sect1>memset<label id="memset"><p>
4674 <tag/Function/Fill a memory area.
4675 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4676 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
4677 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
4678 the value <tt/val/. The function returns <tt/p/.
4679 <tag/Notes/<itemize>
4680 <item>The function is only available as fastcall function, so it may only
4681 be used in presence of a prototype.
4683 <tag/Availability/ISO 9899
4685 <ref id="_swap" name="_swap">,
4686 <ref id="bzero" name="bzero">,
4687 <ref id="memcpy" name="memcpy">,
4688 <ref id="memmove" name="memmove">
4694 <sect1>mod_free<label id="mod_free"><p>
4698 <tag/Function/Free a relocatable module.
4699 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4700 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
4701 <tag/Description/The function will free a module loaded into memory by use of
4702 the <tt/<ref id="mod_load" name="mod_load">/ function.
4703 <tag/Notes/<itemize>
4704 <item>The pointer passed as parameter is the pointer to the module memory,
4705 not the pointer to the control structure.
4706 <item>The function is available only as a fastcall function; so, it may be used
4707 only in the presence of a prototype.
4709 <tag/Availability/cc65
4711 <ref id="mod_load" name="mod_load">
4717 <sect1>mod_load<label id="mod_load"><p>
4721 <tag/Function/Load a relocatable module.
4722 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4723 <tag/Declaration/<tt/unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl);/
4724 <tag/Description/The function will load a code module into memory and relocate
4725 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
4726 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
4727 the module just loaded. Possible error codes are:
4729 <item><tt/MLOAD_OK/ - Module load successful
4730 <item><tt/MLOAD_ERR_READ/ - Read error
4731 <item><tt/MLOAD_ERR_HDR/ - Header error
4732 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
4733 <item><tt/MLOAD_ERR_FMT/ - Data format error
4734 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
4736 <tag/Notes/<itemize>
4737 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
4738 relocatable o65 modules for use with this function.
4739 <item>The function is available only as a fastcall function; so, it may be used
4740 only in the presence of a prototype.
4742 <tag/Availability/cc65
4744 <ref id="mod_free" name="mod_free">
4750 <sect1>mouse_setbox<label id="mouse_setbox"><p>
4754 <tag/Function/Specify a bounding box for the mouse cursor.
4755 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4756 <tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
4757 <tag/Description/The function allows to set a bounding box for mouse movement.
4758 <tag/Notes/<itemize>
4759 <item>The function does not check if the mouse cursor is currently within the
4760 given rectangle. Placing the mouse cursor within the bounding box is the
4761 responsibility of the programmer.
4762 <item>While the bounding box may be larger than the actual screen size, the
4763 standard mouse cursor draw routines may fail to set the cursor to coordinates
4764 outside of the screen area. Depending on the platform, you may have to supply
4765 your own mouse cursor routines.
4766 <item>The function is only available as fastcall function, so it may only be
4767 used in presence of a prototype.
4769 <tag/Availability/cc65
4771 <ref id="mouse_getbox" name="mouse_getbox">,
4772 <ref id="mouse_move" name="mouse_move">
4778 <sect1>mouse_getbox<label id="mouse_getbox"><p>
4782 <tag/Function/Return the current bounding box for the mouse cursor.
4783 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4784 <tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
4785 <tag/Description/The function queries the current bounding box for mouse
4787 <tag/Notes/<itemize>
4788 <item>The function is only available as fastcall function, so it may only be
4789 used in presence of a prototype.
4791 <tag/Availability/cc65
4793 <ref id="mouse_move" name="mouse_move">,
4794 <ref id="mouse_setbox" name="mouse_setbox">
4800 <sect1>mouse_buttons<label id="mouse_buttons"><p>
4804 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
4805 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4806 <tag/Declaration/<tt/unsigned char mouse_buttons (void);/
4807 <tag/Description/The function returns a bit mask that encodes the state of the
4808 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
4810 <tag/Availability/cc65
4812 <ref id="mouse_info" name="mouse_info">,
4813 <ref id="mouse_pos" name="mouse_pos">
4819 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
4823 <tag/Function/Return a readable error message for an error code.
4824 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4825 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
4827 <tag/Description/The function returns an error message (in english) for the
4828 error code passed parameter.
4829 <tag/Notes/<itemize>
4830 <item>The function will return "Unknown error" for invalid error codes.
4831 <item>The function is only available as fastcall function, so it may only be
4832 used in presence of a prototype.
4834 <tag/Availability/cc65
4836 <ref id="mouse_load_driver" name="mouse_load_driver">,
4837 <ref id="mouse_uninstall" name="mouse_uninstall">,
4838 <ref id="mouse_unload" name="mouse_unload">
4844 <sect1>mouse_hide<label id="mouse_hide"><p>
4848 <tag/Function/Hide the mouse pointer.
4849 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4850 <tag/Declaration/<tt/void mouse_hide (void);/
4851 <tag/Description/The function hides the mouse pointer. It manages a counter
4852 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
4853 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
4854 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
4856 <tag/Availability/cc65
4858 <ref id="mouse_show" name="mouse_show">
4864 <sect1>mouse_info<label id="mouse_info"><p>
4868 <tag/Function/Return the state of the mouse buttons and the position of the
4870 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4871 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
4872 <tag/Description/The function returns the state of the mouse buttons and the
4873 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
4874 <tag/Notes/<itemize>
4875 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
4876 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
4877 name="mouse_pos">/ instead.
4878 <item>The function is only available as fastcall function, so it may only be
4879 used in presence of a prototype.
4881 <tag/Availability/cc65
4883 <ref id="mouse_buttons" name="mouse_buttons">,
4884 <ref id="mouse_pos" name="mouse_pos">
4890 <sect1>mouse_install<label id="mouse_install"><p>
4894 <tag/Function/Install an already loaded mouse driver.
4895 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4896 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
4897 mouse_callbacks* c, void* driver);/
4898 <tag/Description/The function installs an already loaded mouse driver and
4899 returns an error code. The <tt/mouse_callbacks/ structure passed as first
4900 parameter contains pointers to routines needed to move or hide/show the mouse
4901 pointer. Defaults for these routines are supplied by the library, so if you
4902 can live with these defaults (which are platform specific), just pass a
4903 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
4904 driver linked statically to the program.
4905 <tag/Notes/<itemize>
4906 <item>Not all drivers are able to detect if the supported hardware is really
4908 <item>After installing a driver, the mouse cursor is hidden.
4909 <item>The function is only available as fastcall function, so it may only be
4910 used in presence of a prototype.
4912 <tag/Availability/cc65
4914 <ref id="mouse_load_driver" name="mouse_load_driver">,
4915 <ref id="mouse_uninstall" name="mouse_uninstall">,
4916 <ref id="mouse_unload" name="mouse_unload">
4922 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
4926 <tag/Function/Call the driver specific ioctl function.
4927 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4928 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
4929 <tag/Description/The function calls the IOCTL entry in the mouse driver,
4930 which is driver specific. The <tt/code/ parameter will choose between
4931 different IOCTL functions, and the <tt/data/ depends on code. The
4932 function returns an error code. The purpose of this function is to allow
4933 for driver specific extensions. See the documentation for a specific mouse
4934 driver for supported ioctl calls.
4935 <tag/Notes/<itemize>
4936 <item>Calling this function is non portable, because each driver may
4937 implement different ioctl calls (or none at all).
4938 <item>The function is only available as fastcall function, so it may only be
4939 used in presence of a prototype.
4941 <tag/Availability/cc65
4947 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
4951 <tag/Function/Load and initialize a mouse driver.
4952 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4953 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
4954 mouse_callbacks* c, const char* driver);/
4955 <tag/Description/Load a mouse driver into memory and initialize it. The
4956 function returns an error code that tells if the call has been successful. The
4957 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
4958 routines needed to move or hide/show the mouse pointer. Defaults for these
4959 routines are supplied by the library, so if you can live with these defaults
4960 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
4961 <tag/Notes/<itemize>
4962 <item>The driver is loaded by name, so currently you must know the type of
4963 mouse that should be supported. There is no autodetect capability.
4964 <item>Not all drivers are able to detect if the supported hardware is really
4966 <item>After installing a driver, the mouse cursor is hidden.
4967 <item>The function is only available as fastcall function, so it may only be
4968 used in presence of a prototype.
4970 <tag/Availability/cc65
4972 <ref id="mouse_install" name="mouse_install">,
4973 <ref id="mouse_uninstall" name="mouse_uninstall">,
4974 <ref id="mouse_unload" name="mouse_unload">
4980 <sect1>mouse_move<label id="mouse_move"><p>
4984 <tag/Function/Move the mouse cursor to a specific position.
4985 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4986 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
4987 <tag/Description/The function updates the mouse position. If the mouse cursor
4988 is visible, it is shown at the new position.
4989 <tag/Notes/<itemize>
4990 <item>The function does not check if the new position is within the bounding
4991 box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
4992 <item>The function is only available as fastcall function, so it may only be
4993 used in presence of a prototype.
4995 <tag/Availability/cc65
4997 <ref id="mouse_getbox" name="mouse_getbox">,
4998 <ref id="mouse_setbox" name="mouse_setbox">
5004 <sect1>mouse_pos<label id="mouse_pos"><p>
5008 <tag/Function/Return the position of the mouse.
5009 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5010 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
5011 <tag/Description/The function returns the position of the mouse in the
5012 <tt/mouse_pos/ structure passed as parameter.
5013 <tag/Notes/<itemize>
5014 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
5015 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
5016 name="mouse_info">/ instead.
5017 <item>The function is only available as fastcall function, so it may only be
5018 used in presence of a prototype.
5020 <tag/Availability/cc65
5022 <ref id="mouse_buttons" name="mouse_buttons">,
5023 <ref id="mouse_info" name="mouse_info">
5029 <sect1>mouse_show<label id="mouse_show"><p>
5033 <tag/Function/Show the mouse pointer.
5034 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5035 <tag/Declaration/<tt/void mouse_show (void);/
5036 <tag/Description/The function shows the mouse pointer. It manages a counter
5037 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
5038 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
5039 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
5040 <tag/Availability/cc65
5042 <ref id="mouse_hide" name="mouse_hide">
5048 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
5052 <tag/Function/Uninstall an already loaded mouse driver.
5053 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5054 <tag/Declaration/<tt/unsigned char mouse_uninstall (void);/
5055 <tag/Description/The function uninstalls an already loaded mouse driver but
5056 don't removes it from memory.
5057 <tag/Notes/<itemize>
5058 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
5059 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
5060 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
5063 <tag/Availability/cc65
5065 <ref id="mouse_install" name="mouse_install">,
5066 <ref id="mouse_load_driver" name="mouse_load_driver">,
5067 <ref id="mouse_unload" name="mouse_unload">
5073 <sect1>mouse_unload<label id="mouse_unload"><p>
5077 <tag/Function/Unload a mouse driver.
5078 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5079 <tag/Declaration/<tt/unsigned char mouse_unload (void);/
5080 <tag/Description/The function unloads a loaded mouse driver and frees all
5081 memory allocated for the driver.
5082 <tag/Notes/<itemize>
5083 <item>The function does nothing if no driver is loaded.
5085 <tag/Availability/cc65
5087 <ref id="mouse_install" name="mouse_install">,
5088 <ref id="mouse_load_driver" name="mouse_load_driver">,
5089 <ref id="mouse_uninstall" name="mouse_uninstall">
5095 <sect1>offsetof<label id="offsetof"><p>
5099 <tag/Function/Calculate the offset of a struct or union member.
5100 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
5101 <tag/Declaration/<tt/size_t offsetof (type, member);/
5102 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
5103 or <tt/union/ member.
5104 <tag/Notes/<itemize>
5105 <item>The function is actually a macro.
5107 <tag/Availability/ISO 9899
5113 <sect1>open<label id="open"><p>
5117 <tag/Function/Open and possibly create a file.
5118 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
5119 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
5120 <tag/Description/<tt/open/ opens a file and returns the file descriptor
5121 associated with it. On error, -1 is returned and an error code is stored in
5122 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
5123 <tag/Notes/<itemize>
5124 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
5125 open, which is used as the permission mask when a new file is created. While
5126 cc65 allows to pass this argument, it is ignored.
5128 <tag/Availability/POSIX 1003.1
5130 <ref id="close" name="close">,
5131 <ref id="creat" name="creat">
5137 <sect1>opendir<label id="opendir"><p>
5141 <tag/Function/Open a directory.
5142 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5143 <tag/Declaration/<tt/DIR* __fastcall__ opendir (const char* name);/
5144 <tag/Description/<tt/opendir/ opens a directory and returns the direcory
5145 descriptor associated with it. On error, NULL is returned and an error code is
5146 stored in <tt/errno/.
5147 <tag/Notes/<itemize>
5148 <item>The function is only available as fastcall function, so it may only
5149 be used in presence of a prototype.
5151 <tag/Availability/POSIX 1003.1
5153 <ref id="closedir" name="closedir">,
5154 <ref id="readdir" name="readdir">
5160 <sect1>peekbsys<label id="peekbsys"><p>
5164 <tag/Function/Read one byte from a location in the system bank.
5165 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5166 <tt/<ref id="cbm510.h" name="cbm510.h">/
5167 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
5168 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
5169 system bank (bank 15) of the CBM PET-II machines and returns it.
5170 <tag/Notes/<itemize>
5171 <item>The function is only available as fastcall function, so it may only
5172 be used in presence of a prototype.
5173 <item>This function may be a macro depending on the compiler options. The
5174 actual function is accessible by #undef'ing the macro.
5176 <tag/Availability/cc65
5178 <ref id="PEEK" name="PEEK">,
5179 <ref id="PEEKW" name="PEEKW">,
5180 <ref id="peekwsys" name="peekwsys">,
5181 <ref id="pokebsys" name="pokebsys">,
5182 <ref id="pokewsys" name="pokewsys">
5188 <sect1>peekwsys<label id="peekwsys"><p>
5192 <tag/Function/Read one word from a location in the system bank.
5193 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5194 <tt/<ref id="cbm510.h" name="cbm510.h">/
5195 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
5196 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
5197 system bank (bank 15) of the CBM PET-II machines and returns it. Following
5198 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
5199 high byte is read from <tt/addr+1/.
5200 <tag/Notes/<itemize>
5201 <item>The function is only available as fastcall function, so it may only
5202 be used in presence of a prototype.
5203 <item>The order in which the two bytes are read is undefined.
5205 <tag/Availability/cc65
5207 <ref id="PEEK" name="PEEK">,
5208 <ref id="PEEKW" name="PEEKW">,
5209 <ref id="peekbsys" name="peekbsys">,
5210 <ref id="pokebsys" name="pokebsys">,
5211 <ref id="pokewsys" name="pokewsys">
5217 <sect1>perror<label id="perror"><p>
5221 <tag/Function/Print an error message for the error in <tt/errno/.
5222 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5223 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
5224 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
5225 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
5226 a blank. Then the error message for the current contents of <tt/errno/ is
5227 printed followed by a newline. The message output is the same as returned by
5228 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
5229 <tag/Notes/<itemize>
5230 <item>The function is only available as fastcall function, so it may only
5231 be used in presence of a prototype.
5233 <tag/Availability/ISO 9899
5235 <ref id="_poserror" name="_poserror">,
5236 <ref id="strerror" name="strerror">
5242 <sect1>pokebsys<label id="pokebsys"><p>
5246 <tag/Function/Write one byte to a location in the system bank.
5247 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5248 <tt/<ref id="cbm510.h" name="cbm510.h">/
5249 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
5250 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
5251 system bank (bank 15) of the CBM PET-II machines.
5252 <tag/Notes/<itemize>
5253 <item>The function is only available as fastcall function, so it may only
5254 be used in presence of a prototype.
5256 <tag/Availability/cc65
5258 <ref id="POKE" name="POKE">,
5259 <ref id="POKEW" name="POKEW">,
5260 <ref id="peekbsys" name="peekbsys">,
5261 <ref id="peekwsys" name="peekwsys">,
5262 <ref id="pokewsys" name="pokewsys">
5268 <sect1>pokewsys<label id="pokewsys"><p>
5272 <tag/Function/Write one word to a location in the system bank.
5273 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5274 <tt/<ref id="cbm510.h" name="cbm510.h">/
5275 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
5276 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
5277 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
5278 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
5279 high byte is written to <tt/addr+1/.
5280 <tag/Notes/<itemize>
5281 <item>The function is only available as fastcall function, so it may only
5282 be used in presence of a prototype.
5283 <item>The order in which the two bytes are written is undefined.
5285 <tag/Availability/cc65
5287 <ref id="POKE" name="POKE">,
5288 <ref id="POKEW" name="POKEW">,
5289 <ref id="peekbsys" name="peekbsys">,
5290 <ref id="peekwsys" name="peekwsys">,
5291 <ref id="pokebsys" name="pokebsys">
5297 <sect1>qsort<label id="qsort"><p>
5301 <tag/Function/Sort an array.
5302 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5303 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
5304 size_t size, int __fastcall__ (* compare) (const void*, const void*));/
5305 <tag/Description/<tt/qsort/ sorts an array according to a given compare
5306 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
5307 is the number of elements, <tt/size/ the size of an element and <tt/compare/
5308 the function used to compare the members.
5309 <tag/Notes/<itemize>
5310 <item>If there are multiple members with the same key, the order after calling
5311 the function is undefined.
5312 <item>The function is only available as fastcall function, so it may only
5313 be used in presence of a prototype.
5314 <item>The function to which <tt/compare/ points must have the <tt/fastcall/
5317 <tag/Availability/ISO 9899
5319 <ref id="bsearch" name="bsearch">
5325 <sect1>raise<label id="raise"><p>
5329 <tag/Function/Send a signal to the executing program.
5330 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
5331 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
5332 <tag/Description/<tt/raise/ sends the given signal to the program. If the
5333 program has installed a signal handler for the signal, this signal handler
5334 will be executed. If no handler has been installed, the default action for
5335 the raised signal will be taken. The function returns zero on success,
5337 <tag/Notes/<itemize>
5338 <item>The function is only available as fastcall function, so it may only
5339 be used in presence of a prototype.
5341 <tag/Availability/ISO 9899
5343 <ref id="abort" name="abort">,
5344 <ref id="signal" name="signal">
5350 <sect1>rand<label id="rand"><p>
5354 <tag/Function/Return a pseudo random number.
5355 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5356 <tag/Declaration/<tt/int rand (void);/
5357 <tag/Description/The function returns a pseudo random number
5358 between 0 and <tt/RAND_MAX/ (exclusive).
5359 <tag/Notes/<itemize>
5360 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
5361 flow of numbers is generated.
5362 <item>On startup, the function behaves as if <ref id="srand" name="srand">
5363 had been used with an argument of 1.
5365 <tag/Availability/ISO 9899
5367 <ref id="_randomize" name="_randomize">,
5368 <ref id="srand" name="srand">
5374 <sect1>readdir<label id="readdir"><p>
5378 <tag/Function/Read a directory.
5379 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5380 <tag/Declaration/<tt/struct dirent* __fastcall__ readdir (DIR* dir);/
5381 <tag/Description/<tt/readdir/ reads the next directory entry from the directory
5382 stream pointed to by <tt/dir/. It stores the data in a <tt/dirent/ structure
5383 and returns a pointer to it. If the end of directory is reached, or an error
5384 occurs, NULL is returned. In case of errors, an error code is stored into
5386 <tag/Notes/<itemize>
5387 <item>The function is only available as fastcall function, so it may only
5388 be used in presence of a prototype.
5389 <item>The returned pointer may point to a statically allocated instance of
5390 <tt/struct dirent/, so it may get overwritten by subsequent calls to
5392 <item>On several platforms, namely the CBMs and the Atari, the disk drives get
5393 confused when opening/closing files between directory reads. So for example a
5394 program that reads the list of files on a disk, and after each call to
5395 <tt/readdir/, opens the file to process it, will fail.<newline>
5396 Possible solutions are reading the directory into memory before processing the
5397 file list, or to reset the directory by seeking to the correct position after
5398 opening/closing a file:
5400 seekdir (DIR, telldir (DIR));
5402 Platforms known to work without problems are: Apple.
5404 <tag/Availability/POSIX 1003.1
5406 <ref id="closedir" name="closedir">,
5407 <ref id="opendir" name="opendir">
5413 <sect1>realloc<label id="realloc"><p>
5417 <tag/Function/Change the size of an allocated memory block.
5418 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5419 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
5420 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
5421 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
5422 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
5423 behaves as if <tt/free/ had been called. On error (not enough memory
5424 available), <tt/realloc/ returns <tt/NULL/.
5425 <tag/Notes/<itemize>
5426 <item>The part of the memory block that is returned will have its contents
5428 <item>This function is somewhat dangerous to use. Be careful to save the
5429 pointer you're passing somewhere else, otherwise
5431 ptr = realloc (ptr, size);
5433 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
5434 <item>The function is only available as fastcall function, so it may only
5435 be used in presence of a prototype.
5437 <tag/Availability/ISO 9899
5439 <ref id="_heapadd" name="_heapadd">,
5440 <ref id="_heapblocksize" name="_heapblocksize">,
5441 <ref id="_heapmaxavail" name="_heapmaxavail">,
5442 <ref id="_heapmemavail" name="_heapmemavail">,
5443 <ref id="calloc" name="calloc">,
5444 <ref id="free" name="free">,
5445 <ref id="realloc" name="realloc">
5451 <sect1>remove<label id="remove"><p>
5455 <tag/Function/Delete a file.
5456 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5457 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
5458 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
5459 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5460 code describing the reason for the failure.
5461 <tag/Notes/<itemize>
5462 <item>This function is not available on all cc65 targets (depends on the
5463 availability of file I/O).
5464 <item>The function is only available as fastcall function, so it may only
5465 be used in presence of a prototype.
5467 <tag/Availability/ISO 9899
5469 <ref id="rename" name="rename">,
5470 <ref id="unlink" name="unlink">
5473 #include <stdio.h>
5475 #define FILENAME "helloworld"
5477 if (remove (FILENAME) == 0) {
5478 printf ("We deleted %s successfully\n", FILENAME);
5480 printf ("There was a problem deleting %s\n", FILENAME);
5487 <sect1>rename<label id="rename"><p>
5491 <tag/Function/Rename a file.
5492 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5493 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
5494 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
5495 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5496 code describing the reason for the failure.
5497 <tag/Notes/<itemize>
5498 <item>This function is not available on all cc65 targets (depends on the
5499 capabilities of the storage devices).
5500 <item>The function is only available as fastcall function, so it may only
5501 be used in presence of a prototype.
5503 <tag/Availability/ISO 9899
5505 <ref id="remove" name="remove">
5508 #include <stdio.h>
5510 #define OLDNAME "textfile.txt"
5511 #define NEWNAME "textfile.bak"
5513 if (rename (OLDNAME, NEWNAME) == 0) {
5514 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
5516 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
5523 <sect1>reset_brk<label id="reset_brk"><p>
5527 <tag/Function/Resets the break vector to its original value.
5528 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5529 <tag/Declaration/<tt/void reset_brk (void);/
5530 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
5531 before a call to <tt/set_brk/.
5532 <tag/Notes/<itemize>
5533 <item>The break vector is reset on program termination, so it's not strictly
5534 necessary to call this function as a part of your clean-up when exitting the program.
5536 <tag/Availability/cc65
5538 <ref id="reset_irq" name="reset_irq">,
5539 <ref id="set_brk" name="set_brk">,
5540 <ref id="set_irq" name="set_irq">
5546 <sect1>reset_irq<label id="reset_irq"><p>
5550 <tag/Function/Resets the C level interrupt request vector.
5551 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5552 <tag/Declaration/<tt/void reset_irq (void);/
5553 <tag/Description/<tt/reset_irq/ resets the C level interrupt request vector.
5554 <tag/Notes/<itemize>
5555 <item>The interrupt vector is reset on program termination, so it's not strictly
5556 necessary to call this function as a part of your clean-up when exitting the program.
5558 <tag/Availability/cc65
5560 <ref id="reset_brk" name="reset_brk">,
5561 <ref id="set_brk" name="set_brk">,
5562 <ref id="set_irq" name="set_irq">
5568 <sect1>revers<label id="revers"><p>
5572 <tag/Function/Control revers character display.
5573 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5574 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
5575 <tag/Description/If the argument is non zero, the function enables reverse
5576 character display. If the argument is zero, reverse character display is
5577 switched off. The old value of the setting is returned.
5578 <tag/Notes/<itemize>
5579 <item>The function may not be supported by the hardware, in which case
5580 the call is ignored.
5581 <item>The function is only available as fastcall function, so it may only
5582 be used in presence of a prototype.
5584 <tag/Availability/cc65
5586 <ref id="textcolor" name="textcolor">
5592 <sect1>rewinddir<label id="rewinddir"><p>
5596 <tag/Function/Reset a directory stream.
5597 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5598 <tag/Declaration/<tt/void __fastcall__ rewinddir (DIR* dir);/
5599 <tag/Description/<tt/rewinddir/ sets the position of the directory stream
5600 pointed to by <tt/dir/ to the start of the directory.
5601 <tag/Notes/<itemize>
5602 <item>The function is only available as fastcall function, so it may only
5603 be used in presence of a prototype.
5605 <tag/Availability/POSIX 1003.1
5607 <ref id="seekdir" name="seekdir">,
5608 <ref id="telldir" name="telldir">
5614 <sect1>screensize<label id="screensize"><p>
5618 <tag/Function/Return the dimensions of the text mode screen.
5619 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5620 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
5621 <tag/Description/The function returns the dimensions of the text mode screen.
5622 <tag/Notes/<itemize>
5623 <item>The function is only available as fastcall function, so it may only
5624 be used in presence of a prototype.
5626 <tag/Availability/cc65
5628 <ref id="gotox" name="gotox">,
5629 <ref id="gotoxy" name="gotoxy">,
5630 <ref id="gotoy" name="gotoy">,
5631 <ref id="wherex" name="wherex">,
5632 <ref id="wherey" name="wherey">
5638 <sect1>seekdir<label id="seekdir"><p>
5642 <tag/Function/Set the position of a directory stream.
5643 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5644 <tag/Declaration/<tt/void __fastcall__ seekdir (DIR* dir, long offset);/
5645 <tag/Description/<tt/seekdir/ sets the position of the directory stream
5646 pointed to by <tt/dir/ to the value given in <tt/offset/, which should be a
5647 value returned by <tt/<ref id="telldir" name="telldir">/.
5648 <tag/Notes/<itemize>
5649 <item>The function is only available as fastcall function, so it may only
5650 be used in presence of a prototype.
5652 <tag/Availability/POSIX 1003.1
5654 <ref id="rewinddir" name="rewinddir">,
5655 <ref id="telldir" name="telldir">
5661 <sect1>ser_close<label id="ser_close"><p>
5665 <tag/Function/Close the port and disable interrupts
5666 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5667 <tag/Declaration/<tt/unsigned char ser_close (void);/
5668 <tag/Description/Close the port by clearing buffers and disable interrupts.
5669 <tag/Availability/cc65
5670 <tag/See also/Other serial functions.
5675 static void initialize(){
5676 struct ser_params params = {
5683 ser_install(lynx_comlynx); // This will activate the ComLynx
5685 ser_open(&params);
5692 <sect1>ser_get<label id="ser_get"><p>
5696 <tag/Function/Read a character from serial port.
5697 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5698 <tag/Declaration/<tt/unsigned char __fastcall__ ser_get (char* b);/
5699 <tag/Description/Get a character from the serial port. If no characters are
5700 available, the function will return SER_ERR_NO_DATA, so this is not a fatal
5702 <tag/Notes/<itemize>
5703 <item>The function is only available as fastcall function, so it may only
5704 be used in presence of a prototype.
5706 <tag/Availability/cc65
5707 <tag/See also/Other serial functions.
5709 Wait for a character to be available from a serial port.
5712 while (ser_get(&ch) == SER_ERR_NO_DATA)
5719 <sect1>ser_install<label id="ser_install"><p>
5723 <tag/Function/Install an already loaded driver and return an error code.
5724 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5725 <tag/Declaration/<tt/unsigned char __fastcall__ ser_install (void* driver);/
5726 <tag/Description/The function installs a driver that was already loaded into
5727 memory (or linked statically to the program). It returns an error code
5728 (<tt/SER_ERR_OK/ in case of success).
5729 <tag/Notes/<itemize>
5730 <item>The function is only available as fastcall function, so it may only be
5731 used in presence of a prototype.
5733 <tag/Availability/cc65
5735 <ref id="ser_load_driver" name="ser_load_driver">,
5736 <ref id="ser_uninstall" name="ser_uninstall">,
5737 <ref id="ser_unload" name="ser_unload">
5739 ser_install(lynx_comlynx); //Include the driver statically instead of loading it.
5745 <sect1>ser_ioctl<label id="ser_ioctl"><p>
5749 <tag/Function/Platform dependent code extensions.
5750 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5751 <tag/Declaration/<tt/unsigned __fastcall__ ser_ioctl (unsigned char code, void* data);/
5752 <tag/Description/Some platforms have extra serial functions that are not
5753 supported by standard serial driver functions. You can extend the driver to support
5754 this extra functionality bt using ser_ioctl functions.
5755 <tag/Notes/<itemize>
5756 <item>The function is only available as fastcall function, so it may only
5757 be used in presence of a prototype.
5758 <item>These functions are not easily portable to other cc65 platforms.
5760 <tag/Availability/cc65
5761 <tag/See also/Other serial functions.
5766 <sect1>ser_load_driver<label id="ser_load_driver"><p>
5770 <tag/Function/Load and install a serial driver.
5771 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5772 <tag/Declaration/<tt/unsigned char __fastcall__ ser_load_driver (const char *name);/
5773 <tag/Description/Load and install the driver by name.
5774 Will just load the driver and check if loading was successful.
5775 <tag/Notes/<itemize>
5776 <item>The function is only available as fastcall function, so it may only
5777 be used in presence of a prototype.
5779 <tag/Availability/cc65
5780 <tag/See also/Other serial functions.
5786 <sect1>ser_open<label id="ser_open"><p>
5790 <tag/Function/Open the port by setting the port parameters and enable interrupts
5791 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5792 <tag/Declaration/<tt/unsigned char __fastcall__ ser_open (const struct ser_params* params);/
5793 <tag/Description/Open the port by setting the port parameters and enable interrupts.
5794 <tag/Notes/<itemize>
5795 <item>The function is only available as fastcall function, so it may only
5796 be used in presence of a prototype.
5798 <tag/Availability/cc65
5799 <tag/See also/Other serial functions.
5804 static void initialize(){
5805 struct ser_params params = {
5812 ser_install(lynx_comlynx); // This will activate the ComLynx
5814 ser_open(&params);
5821 <sect1>ser_put<label id="ser_put"><p>
5825 <tag/Function/Write a character to a serial port.
5826 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5827 <tag/Declaration/<tt/unsigned char __fastcall__ ser_put (char b);/
5828 <tag/Description/Send a character via the serial port. There is a transmit
5829 buffer, but transmitting is not done via interrupt. The function returns
5830 SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
5831 <tag/Notes/<itemize>
5832 <item>The function is only available as fastcall function, so it may only
5833 be used in presence of a prototype.
5835 <tag/Availability/cc65
5836 <tag/See also/Other serial functions.
5845 <sect1>ser_status<label id="ser_status"><p>
5849 <tag/Function/Return the serial port status.
5850 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5851 <tag/Declaration/<tt/unsigned char __fastcall__ ser_status (unsigned char* status);/
5852 <tag/Description/Return the serial port status.
5853 <tag/Notes/<itemize>
5854 <item>The function is only available as fastcall function, so it may only
5855 be used in presence of a prototype.
5857 <tag/Availability/cc65
5858 <tag/See also/Other serial functions.
5864 <sect1>ser_uninstall<label id="ser_uninstall"><p>
5868 <tag/Function/Uninstall the currently loaded driver but do not unload it.
5869 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5870 <tag/Declaration/<tt/unsigned char ser_uninstall (void);/
5871 <tag/Description/Uninstall the currently loaded driver but do not unload it.
5872 <tag/Availability/cc65
5873 <tag/See also/Other serial functions.
5878 <sect1>ser_unload<label id="ser_unload"><p>
5882 <tag/Function/Uninstall, then unload the currently loaded driver.
5883 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5884 <tag/Declaration/<tt/unsigned char ser_unload (void);/
5885 <tag/Description/Uninstall, then unload the currently loaded driver.
5886 <tag/Availability/cc65
5887 <tag/See also/Other serial functions.
5893 <sect1>set_brk<label id="set_brk"><p>
5897 <tag/Function/Set the break vector to a user function.
5898 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5899 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
5900 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
5901 program code by letting the vector point to a user written C function. The
5902 runtime library installs a small stub that saves the registers into global
5903 variables that may be accessed (and changed) by the break handler.
5904 <tag/Notes/<itemize>
5905 <item>The function is only available as fastcall function, so it may only
5906 be used in presence of a prototype.
5907 <item>The stub saves the zero page registers used by the C runtime and switches
5908 to a small break handler stack. This means that it is safe to execute C code,
5909 even if C code was interrupted. Be careful however not to use too many local
5910 variables, and do not enable stack checks for the handler function or any other
5911 function called from it.
5912 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
5913 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
5914 otherwise the <tt/BRK/ instruction will get executed over and over again.
5915 <item>The break vector is reset on program termination, so it's not strictly
5916 necessary to call <tt/<ref id="reset_brk" name="reset_brk">/ as a part of your
5917 clean-up when exitting the program.
5919 <tag/Availability/cc65
5921 <ref id="reset_brk" name="reset_brk">
5927 <sect1>set_irq<label id="set_irq"><p>
5931 <tag/Function/Set the C level interrupt request vector to the given address.
5932 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5933 <tag/Declaration/<tt/void __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);/
5934 <tag/Description/<tt/set_irq/ allows a user program to handle interrupt requests
5935 (IRQs) within the program code by letting the vector point to a user written C
5936 function. The runtime library installs a small stub that saves the zero page
5937 registers used by the C runtime before calling the handler function and restores
5938 them after the handler function returns. Additionally the stub temporarily switches
5939 the C runtime stack to the stack area provided as parameter. If the handler function
5940 was set up to handle a "private", "exclusive" interrupt request source it must
5941 return the value <tt/IRQ_HANDLED/ if and only if it has verified that the current
5942 interrupt request actually stems from that source. In all other cases it must return
5943 the value <tt/IRQ_NOT_HANDLED/.
5944 <tag/Notes/<itemize>
5945 <item>The function is only available as fastcall function, so it may only
5946 be used in presence of a prototype.
5947 <item>The stub saves the registers and zero page locations used by the C runtime
5948 and switches to the provided stack area. As a consequence, there is some
5949 runtime overhead, but it it is safe to execute C code, even if other C code
5950 was interrupted. Be careful however not to call C library functions, and do not
5951 enable stack checks for the handler function or any other function called from
5953 <item>The interrupt vector is reset on program termination, so it's not strictly
5954 necessary to call <tt/<ref id="reset_irq" name="reset_irq">/ as a part of your
5955 clean-up when exitting the program.
5957 <tag/Availability/cc65
5959 <ref id="reset_brk" name="reset_brk">,
5960 <ref id="reset_irq" name="reset_irq">,
5961 <ref id="set_brk" name="set_brk">
5967 <sect1>setjmp<label id="setjmp"><p>
5971 <tag/Function/Save the context for use with <tt/longjmp/.
5972 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
5973 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
5974 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
5975 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
5977 <tag/Notes/<itemize>
5978 <item>The function is only available as fastcall function, so it may only
5979 be used in presence of a prototype.
5980 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
5981 <item><tt/setjmp/ will not save the signal context.
5983 <tag/Availability/ISO 9899
5985 <ref id="longjmp" name="longjmp">
5991 <sect1>setlocale<label id="setlocale"><p>
5995 <tag/Function/Selects a locale.
5996 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
5997 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
5998 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
5999 <tag/Notes/<itemize>
6000 <item>The function is only available as fastcall function, so it may only
6001 be used in presence of a prototype.
6002 <item>cc65 supports only the "C" locale, so calling this function to set a
6003 different locale has no effect.
6005 <tag/Availability/ISO 9899
6007 <ref id="localeconv" name="localeconv">,
6008 <ref id="strcoll" name="strcoll">
6009 <ref id="strxfrm" name="strxfrm">
6015 <sect1>signal<label id="signal"><p>
6019 <tag/Function/Install a signal handler.
6020 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
6021 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
6022 <tag/Description/<tt/signal/ installs a handler for the given signal. The
6023 handler may either be a user supplied function, or one of the predefined
6024 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
6025 previous value if the signal , or the special function vector SIG_ERR in
6027 <tag/Notes/<itemize>
6028 <item>The function is only available as fastcall function, so it may only
6029 be used in presence of a prototype.
6031 <tag/Availability/ISO 9899
6033 <ref id="abort" name="abort">,
6034 <ref id="raise" name="raise">
6040 <sect1>sleep<label id="sleep"><p>
6044 <tag/Function/Sleep for a specified amount of time.
6045 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
6046 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
6047 <tag/Description/The function will return after the specified number of
6048 seconds have elapsed.
6049 <tag/Notes/<itemize>
6050 <item>The function is only available as fastcall function, so it may only
6051 be used in presence of a prototype.
6053 <tag/Availability/POSIX 1003.1
6059 <sect1>slow<label id="slow"><p>
6063 <tag/Function/Switch the C128 into 1MHz mode.
6064 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
6065 <tag/Declaration/<tt/void slow (void);/
6066 <tag/Description/The function will switch the clock of the C128 to 1MHz. This
6067 will halve the speed compared to fast mode.
6068 <tag/Notes/<itemize>
6069 <item>The function is specific to the C128.
6071 <tag/Availability/C128
6073 <ref id="fast" name="fast">,
6074 <ref id="toggle_videomode" name="toggle_videomode">,
6075 <ref id="videomode" name="videomode">
6081 <sect1>srand<label id="srand"><p>
6085 <tag/Function/Initialize the pseudo random number generator.
6086 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
6087 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
6088 <tag/Description/The function initializes the random number generator using
6089 the given seed. On program startup, the generator behaves as if <tt/srand/ has
6090 been called with an argument of 1.
6091 <tag/Notes/<itemize>
6092 <item>The function is only available as fastcall function, so it may only
6093 be used in presence of a prototype.
6095 <tag/Availability/ISO 9899
6097 <ref id="_randomize" name="_randomize">,
6098 <ref id="rand" name="rand">
6104 <sect1>strcasecmp<label id="strcasecmp"><p>
6108 <tag/Function/Compare two strings case insensitive.
6109 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6110 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
6111 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
6112 as parameters without case sensitivity. It returns a value that is less than
6113 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
6114 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
6115 <tag/Notes/<itemize>
6116 <item>The function is only available as fastcall function, so it may only
6117 be used in presence of a prototype.
6118 <item>The function is not available in strict ANSI mode.
6120 <tag/Availability/cc65
6122 <ref id="strcmp" name="strcmp">,
6123 <ref id="strcoll" name="strcoll">,
6124 <ref id="stricmp" name="stricmp">,
6125 <ref id="strncmp" name="strncmp">,
6126 <ref id="strxfrm" name="strxfrm">
6132 <sect1>strcat<label id="strcat"><p>
6136 <tag/Function/Concatentate two strings.
6137 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6138 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
6139 <tag/Description/The <tt/strcat/ function appends a copy of the string
6140 pointed to by s2 (including the terminating null byte) to the end of the
6141 string pointed to by s1. The initial byte of s2 overwrites the null byte at
6143 <tag/Notes/<itemize>
6144 <item>The function is only available as fastcall function, so it may only
6145 be used in presence of a prototype.
6146 <item>If copying takes place between objects that overlap, the behaviour
6149 <tag/Availability/ISO 9899
6151 <ref id="strcpy" name="strcpy">,
6152 <ref id="strncat" name="strncat">,
6153 <ref id="strncpy" name="strncpy">
6159 <sect1>strchr<label id="strchr"><p>
6163 <tag/Function/Search for a character in a string.
6164 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6165 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
6166 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
6167 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6168 byte is considered to be part of the string. Upon completion, the function
6169 returns a pointer to the byte, or a null pointer if the byte was not found.
6170 <tag/Notes/<itemize>
6171 <item>The function is only available as fastcall function, so it may only
6172 be used in presence of a prototype.
6174 <tag/Availability/ISO 9899
6176 <ref id="memchr" name="memchr">,
6177 <ref id="strrchr" name="strrchr">
6183 <sect1>strcmp<label id="strcmp"><p>
6187 <tag/Function/Compare two strings.
6188 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6189 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
6190 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
6191 parameters. It returns a value that is less than zero if <tt/s1/ is less than
6192 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
6193 if <tt/s1/ is greater than <tt/s2/.
6194 <tag/Notes/<itemize>
6195 <item>The function is only available as fastcall function, so it may only
6196 be used in presence of a prototype.
6198 <tag/Availability/ISO 9899
6200 <ref id="strcasecmp" name="strcasecmp">,
6201 <ref id="strcoll" name="strcoll">,
6202 <ref id="stricmp" name="stricmp">,
6203 <ref id="strncmp" name="strncmp">
6204 <ref id="strxfrm" name="strxfrm">
6210 <sect1>strcoll<label id="strcoll"><p>
6214 <tag/Function/Compare two strings.
6215 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6216 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
6217 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
6218 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
6219 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
6220 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
6221 than zero if <tt/s1/ is greater than <tt/s2/.
6222 <tag/Notes/<itemize>
6223 <item>The function is only available as fastcall function, so it may only
6224 be used in presence of a prototype.
6226 <tag/Availability/ISO 9899
6228 <ref id="setlocale" name="setlocale">,
6229 <ref id="strcasecmp" name="strcasecmp">,
6230 <ref id="strcmp" name="strcmp">,
6231 <ref id="stricmp" name="stricmp">,
6232 <ref id="strncmp" name="strncmp">,
6233 <ref id="strxfrm" name="strxfrm">
6239 <sect1>strcpy<label id="strcpy"><p>
6243 <tag/Function/Copy a string.
6244 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6245 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
6246 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
6247 <tt/s2/ (including the terminating null byte) into the array pointed to by
6248 <tt/s1/. The function will always return <tt/s1/.
6249 <tag/Notes/<itemize>
6250 <item>The function is only available as fastcall function, so it may only
6251 be used in presence of a prototype.
6252 <item>If copying takes place between objects that overlap, the behaviour
6255 <tag/Availability/ISO 9899
6257 <ref id="strcat" name="strcat">,
6258 <ref id="strncat" name="strncat">,
6259 <ref id="strncpy" name="strncpy">
6262 #include <string.h>
6264 static char hello[14];
6266 strcpy (hello, "Hello world!\n");
6272 <sect1>strcspn<label id="strcspn"><p>
6276 <tag/Function/Compute the length of a substring.
6277 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6278 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
6279 <tag/Description/The <tt/strcspn/ function computes and returns the length of
6280 the substring pointed to by <tt/s/ which does <em>not</em> consist of
6281 characters contained in the string <tt/set/.
6282 <tag/Notes/<itemize>
6283 <item>The function is only available as fastcall function, so it may only
6284 be used in presence of a prototype.
6286 <tag/Availability/ISO 9899
6288 <ref id="strqtok" name="strqtok">,
6289 <ref id="strspn" name="strspn">,
6290 <ref id="strstr" name="strstr">,
6291 <ref id="strtok" name="strtok">
6297 <sect1>strdup<label id="strdup"><p>
6301 <tag/Function/Allocate a copy of a string on the heap.
6302 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6303 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
6304 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
6305 to hold a copy of <tt/s/ including the terminating zero. If the allocation
6306 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
6307 memory block, and a pointer to the block is returned.
6308 <tag/Notes/<itemize>
6309 <item>The function is only available as fastcall function, so it may only
6310 be used in presence of a prototype.
6311 <item>It is up to the caller to free the allocated memory block.
6313 <tag/Availability/ISO 9899
6315 <ref id="free" name="free">,
6316 <ref id="malloc" name="malloc">
6322 <sect1>strerror<label id="strerror"><p>
6326 <tag/Function/Return a string describing an error code.
6327 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6328 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
6329 <tag/Description/The <tt/strerror/ function returns a string describing the
6330 given error code. If an invalid error code is passed, the string "Unknown
6331 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
6332 <tt/errno/ is left untouched.
6333 <tag/Notes/<itemize>
6334 <item>The function is only available as fastcall function, so it may only
6335 be used in presence of a prototype.
6336 <item>While the return type of the function is a <tt/char*/, the returned
6337 string must not be modified by the caller!
6339 <tag/Availability/ISO 9899
6341 <ref id="_stroserror" name="_stroserror">
6347 <sect1>stricmp<label id="stricmp"><p>
6351 <tag/Function/Compare two strings case insensitive.
6352 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6353 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
6354 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
6355 parameters without case sensitivity. It returns a value that is less than zero
6356 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
6357 value greater than zero if <tt/s1/ is greater than <tt/s2/.
6358 <tag/Notes/<itemize>
6359 <item>The function is only available as fastcall function, so it may only
6360 be used in presence of a prototype.
6361 <item>The function is not available in strict ANSI mode.
6363 <tag/Availability/cc65
6365 <ref id="strcasecmp" name="strcasecmp">,
6366 <ref id="strcmp" name="strcmp">,
6367 <ref id="strcoll" name="strcoll">,
6368 <ref id="strncmp" name="strncmp">,
6369 <ref id="strxfrm" name="strxfrm">
6375 <sect1>strlen<label id="strlen"><p>
6379 <tag/Function/Return the length of a string.
6380 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6381 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
6382 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
6383 string to which s points, not including the terminating null byte.
6384 <tag/Notes/<itemize>
6385 <item>The function is only available as fastcall function, so it may only
6386 be used in presence of a prototype.
6387 <item>When compiling with <tt/-Os/ (inline known standard functions), the
6388 function does not work correctly for strings with more than 255 characters.
6390 <tag/Availability/ISO 9899
6392 <ref id="strcpy" name="strcpy">
6398 <sect1>strlower<label id="strlower"><p>
6402 <tag/Function/Make a string lower case.
6403 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6404 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
6405 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
6406 function to each character of a string. The function will always return <tt/s/.
6407 <tag/Notes/<itemize>
6408 <item>The function is only available as fastcall function, so it may only
6409 be used in presence of a prototype.
6410 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6411 <item>An alias name for this function is <tt/strlwr/.
6413 <tag/Availability/cc65
6415 <ref id="strupper" name="strupper">,
6416 <ref id="tolower" name="tolower">
6422 <sect1>strlwr<label id="strlwr"><p>
6429 <sect1>strncasecmp<label id="strncasecmp"><p>
6433 <tag/Function/Compare two strings case insensitive.
6434 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6435 <tag/Declaration/<tt/int __fastcall__ strncasecmp (const char* s1, const char* s2, size_t count);/
6436 <tag/Description/The <tt/strncasecmp/ function compares the two strings passed
6437 as parameters without case sensitivity. It returns a value that is less than
6438 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
6439 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
6440 <tag/Notes/<itemize>
6441 <item>The function is only available as fastcall function, so it may only
6442 be used in presence of a prototype.
6443 <item>The function is not available in strict ANSI mode.
6445 <tag/Availability/cc65
6447 <ref id="strcmp" name="strcmp">,
6448 <ref id="strcoll" name="strcoll">,
6449 <ref id="stricmp" name="stricmp">,
6450 <ref id="strncmp" name="strncmp">,
6451 <ref id="strxfrm" name="strxfrm">
6457 <sect1>strncat<label id="strncat"><p>
6461 <tag/Function/Concatentate two strings.
6462 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6463 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
6464 <tag/Description/The <tt/strncat/ function appends not more than n characters
6465 of the string pointed to by s2 to the end of the string pointed to by s1. The
6466 terminating null character at the end of s1 is overwritten. A terminating null
6467 character is appended to the result, even if not all of s2 is appended to s1.
6468 <tag/Notes/<itemize>
6469 <item>The function is only available as fastcall function, so it may only
6470 be used in presence of a prototype.
6471 <item>If copying takes place between objects that overlap, the behaviour
6474 <tag/Availability/ISO 9899
6476 <ref id="strcpy" name="strcpy">,
6477 <ref id="strncat" name="strncat">,
6478 <ref id="strncpy" name="strncpy">
6484 <sect1>strncmp<label id="strncmp"><p>
6488 <tag/Function/Compare two strings.
6489 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6490 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
6491 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
6492 characters of the two strings passed as parameters. It returns a value that is
6493 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
6494 <tt/s2/, zero if they are identical, and a value greater than zero they are
6496 <tag/Notes/<itemize>
6497 <item>The function is only available as fastcall function, so it may only
6498 be used in presence of a prototype.
6500 <tag/Availability/ISO 9899
6502 <ref id="strcasecmp" name="strcasecmp">,
6503 <ref id="strcmp" name="strcmp">,
6504 <ref id="strcoll" name="strcoll">,
6505 <ref id="stricmp" name="stricmp">,
6506 <ref id="strxfrm" name="strxfrm">
6512 <sect1>strncpy<label id="strncpy"><p>
6516 <tag/Function/Copy part of a string.
6517 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6518 <tag/Declaration/<tt/char* __fastcall__ strncpy (char* s1, const char* s2, size_t n);/
6519 <tag/Description/The <tt/strncpy/ function copies not more than <tt/n/ bytes from
6520 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
6521 pointed to by <tt/s2/ is a string that is shorter than <tt/n/ bytes, null bytes are
6522 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
6523 written. The function always will return <tt/s1/.
6524 <tag/Notes/<itemize>
6525 <item>The function is available only as a fastcall function; so, it may be used
6526 only in the presence of a prototype.
6527 <item>If there is no null byte in the first <tt/n/ bytes of the array pointed
6528 to by <tt/s2/, the result is <em/not/ null-terminated!
6529 <item>If copying takes place between objects that overlap, the behaviour is
6532 <tag/Availability/ISO 9899
6534 <ref id="memcpy" name="memcpy">,
6535 <ref id="strcat" name="strcat">,
6536 <ref id="strcpy" name="strcpy">,
6537 <ref id="strncat" name="strncat">
6542 static char hello[6];
6544 strncpy (hello, "Hello world!\n", sizeof hello - 1)[5] = '\0';
6550 <sect1>strnicmp<label id="strnicmp"><p>
6554 <tag/Function/Compare two strings case insensitive.
6555 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6556 <tag/Declaration/<tt/int __fastcall__ strnicmp (const char* s1, const char* s2, size_t count);/
6557 <tag/Description/The <tt/strnicmp/ function compares the two strings passed as
6558 parameters without case sensitivity. It returns a value that is less than zero
6559 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
6560 value greater than zero if <tt/s1/ is greater than <tt/s2/.
6561 <tag/Notes/<itemize>
6562 <item>The function is only available as fastcall function, so it may only
6563 be used in presence of a prototype.
6564 <item>The function is not available in strict ANSI mode.
6566 <tag/Availability/cc65
6568 <ref id="strcasecmp" name="strcasecmp">,
6569 <ref id="strcmp" name="strcmp">,
6570 <ref id="strcoll" name="strcoll">,
6571 <ref id="strncmp" name="strncmp">,
6572 <ref id="strxfrm" name="strxfrm">
6578 <sect1>strqtok<label id="strqtok"><p>
6582 <tag/Function/Break a string into tokens.
6583 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6584 <tag/Declaration/<tt/char* __fastcall__ strqtok (char* s1, const char* s2);/
6585 <tag/Description/<tt/strqtok()/ will break the string <tt/s1/ into a sequence of
6586 tokens, which are delimited by either quotation marks or characters from the
6587 string <tt/s2/. Tokens inside quotation marks may contain characters from <tt/s2/
6588 (they aren't delimiters there). The first call to <tt/strqtok()/ will return a
6589 pointer to the first token in the string <tt/s1/. The following calls must pass
6590 a <tt/NULL/ pointer as <tt/s1/, in order to get the next token in the string.
6591 Different sets of delimiters may be used for the subsequent calls to <tt/strqtok()/.
6592 <tag/Notes/<itemize>
6593 <item>The function is available only as a fastcall function; so, it may be used
6594 only in the presence of a prototype.
6595 <item><tt/strqtok()/ will modify the string <tt/s1/.
6596 <item>The function will forget where it is in the <tt/s1/ string if it is given
6597 a second <tt/s1/ string before it finishes the first one.
6599 <tag/Availability/cc65
6601 <ref id="strcspn" name="strcspn">,
6602 <!-- <ref id="strpbrk" name="strpbrk">, -->
6603 <ref id="strspn" name="strspn">,
6604 <ref id="strtok" name="strtok">
6610 <sect1>strrchr<label id="strrchr"><p>
6614 <tag/Function/Search for a character in a string.
6615 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6616 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
6617 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
6618 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6619 byte is considered to be part of the string. Upon completion, the function
6620 returns a pointer to the byte, or a null pointer if the byte was not found.
6621 <tag/Notes/<itemize>
6622 <item>The function is only available as fastcall function, so it may only
6623 be used in presence of a prototype.
6625 <tag/Availability/ISO 9899
6627 <ref id="strchr" name="strchr">
6633 <sect1>strspn<label id="strspn"><p>
6637 <tag/Function/Compute the length of a substring.
6638 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6639 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
6640 <tag/Description/The <tt/strspn/ function computes and returns the length of
6641 the substring pointed to by <tt/s/ which does consist only of characters
6642 contained in the string <tt/set/.
6643 <tag/Notes/<itemize>
6644 <item>The function is only available as fastcall function, so it may only
6645 be used in presence of a prototype.
6647 <tag/Availability/ISO 9899
6649 <ref id="strcspn" name="strcspn">,
6650 <ref id="strstr" name="strstr">
6656 <sect1>strstr<label id="strstr"><p>
6660 <tag/Function/Find a substring.
6661 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6662 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
6663 <tag/Description/<tt/strstr/ searches for the first occurance of the string
6664 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
6665 otherwise it returns <tt/NULL/.
6666 <tag/Notes/<itemize>
6667 <item>The function is only available as fastcall function, so it may only
6668 be used in presence of a prototype.
6670 <tag/Availability/ISO 9899
6672 <ref id="strcspn" name="strcspn">,
6673 <ref id="strspn" name="strspn">
6679 <sect1>strtok<label id="strtok"><p>
6683 <tag/Function/Break a string into tokens.
6684 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6685 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
6686 <tag/Description/<tt/strtok()/ will break the string <tt/s1/ into a sequence of
6687 tokens, which are delimited by characters from the string <tt/s2/. The first call
6688 to <tt/strtok()/ will return a pointer to the first token in the string <tt/s1/.
6689 The following calls must pass a <tt/NULL/ pointer as <tt/s1/, in order to get
6690 the next token in the string. Different sets of delimiters may be used for the
6691 subsequent calls to <tt/strtok()/.
6692 <tag/Notes/<itemize>
6693 <item>The function is only available as fastcall function, so it may only
6694 be used in presence of a prototype.
6695 <item><tt/strtok()/ will modify the string <tt/s1/.
6696 <item>The function will forget where it is in the <tt/s1/ string if it is given
6697 a second <tt/s1/ string before it finishes the first one.
6699 <tag/Availability/ISO 9899
6701 <ref id="strcspn" name="strcspn">,
6702 <!-- <ref id="strpbrk" name="strpbrk">, -->
6703 <ref id="strqtok" name="strqtok">,
6704 <ref id="strspn" name="strspn">
6710 <sect1>strxfrm<label id="strxfrm"><p>
6714 <tag/Function/Transform a string.
6715 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6716 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
6717 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
6718 s2 and places the resulting string into the string pointed to by s1. The
6719 transformation is such that if the <tt/strcmp/ function is applied to two
6720 transformed strings, it returns a value greater than, equal to, or less than
6721 zero, corresponding to the result of the <tt/strcoll/ function applied to the
6722 same two original strings. No more than n characters are placed into the
6723 resulting array pointed to by s1, including the terminating null character.
6724 <tag/Notes/<itemize>
6725 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
6726 the behaviour is undefined.
6727 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
6728 <item>The function is only available as fastcall function, so it may only
6729 be used in presence of a prototype.
6730 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
6731 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
6733 <tag/Availability/ISO 9899
6735 <ref id="strcmp" name="strcmp">,
6736 <ref id="strcoll" name="strcoll">,
6737 <ref id="strncpy" name="strncpy">
6743 <sect1>strupper<label id="strupper"><p>
6747 <tag/Function/Make a string upper case.
6748 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6749 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
6750 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
6751 function to each character of a string. The function will always return <tt/s/.
6752 <tag/Notes/<itemize>
6753 <item>The function is only available as fastcall function, so it may only
6754 be used in presence of a prototype.
6755 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6756 <item>An alias name for this function is <tt/strupr/.
6758 <tag/Availability/cc65
6760 <ref id="strlower" name="strlower">
6761 <ref id="toupper" name="toupper">
6767 <sect1>strupr<label id="strupr"><p>
6774 <sect1>telldir<label id="telldir"><p>
6778 <tag/Function/Return the current position of a directory stream.
6779 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
6780 <tag/Declaration/<tt/long __fastcall__ telldir (DIR* dir);/
6781 <tag/Description/<tt/telldir/ returns the current position of a directory
6782 stream. The return value may be used in subsequent calls to
6783 <tt/<ref id="seekdir" name="seekdir">/.
6784 <tag/Notes/<itemize>
6785 <item>The function is only available as fastcall function, so it may only
6786 be used in presence of a prototype.
6788 <tag/Availability/POSIX 1003.1
6790 <ref id="seekdir" name="seekdir">,
6791 <ref id="telldir" name="telldir">
6797 <sect1>textcolor<label id="textcolor"><p>
6801 <tag/Function/Set the text color.
6802 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6803 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
6804 <tag/Description/The function will set a new text color. It returns the old
6805 (current) text color. Text output using any <tt/conio.h/ function will use
6806 the color set by this function.
6807 <tag/Notes/<itemize>
6808 <item>Text colors are system dependent. The function may have no effect
6809 on systems where the text color cannot be changed.
6810 <item>The function is only available as fastcall function, so it may only
6811 be used in presence of a prototype.
6813 <tag/Availability/cc65
6815 <ref id="bgcolor" name="bgcolor">,
6816 <ref id="bordercolor" name="bordercolor">
6822 <sect1>time<label id="time"><p>
6826 <tag/Function/Get the time.
6827 <tag/Header/<tt/<ref id="time.h" name="time.h">/
6828 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
6829 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
6830 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
6831 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
6832 returned and <tt/errno/ is set to <tt/ENOSYS/.
6833 <tag/Notes/<itemize>
6834 <item>The function is only available as fastcall function, so it may
6835 only be used in presence of a prototype.
6836 <item>Many platforms supported by cc65 do not have a realtime clock, so the
6837 returned value may not be valid.
6839 <tag/Availability/ISO 9899
6841 <ref id="clock" name="clock">
6847 <sect1>toggle_videomode<label id="toggle_videomode"><p>
6851 <tag/Function/Toggle between 40 and 80 column mode.
6852 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
6853 <tag/Declaration/<tt/void toggle_videomode (void);/
6854 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
6855 old mode (cursor position, color and so on) are saved and restored together
6857 <tag/Notes/<itemize>
6858 <item>The function is specific to the C128.
6859 <item>This function is deprecated. Please use <ref id="videomode"
6860 name="videomode"> instead!
6862 <tag/Availability/C128
6864 <ref id="fast" name="fast">,
6865 <ref id="slow" name="slow">,
6866 <ref id="videomode" name="videomode">
6872 <sect1>tolower<label id="tolower"><p>
6876 <tag/Function/Convert a character into its lower case representation.
6877 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
6878 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
6879 <tag/Description/The function returns the given character converted to lower
6880 case. If the given character is not a letter, it is returned unchanged.
6881 <tag/Notes/<itemize>
6882 <item>The function is only available as fastcall function, so it may
6883 only be used in presence of a prototype.
6885 <tag/Availability/ISO 9899
6887 <ref id="islower" name="islower">,
6888 <ref id="isupper" name="isupper">,
6889 <ref id="toupper" name="toupper">
6895 <sect1>toupper<label id="toupper"><p>
6899 <tag/Function/Convert a character into its upper case representation.
6900 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
6901 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
6902 <tag/Description/The function returns the given character converted to upper
6903 case. If the given character is not a letter, it is returned unchanged.
6904 <tag/Notes/<itemize>
6905 <item>The function is only available as fastcall function, so it may
6906 only be used in presence of a prototype.
6908 <tag/Availability/ISO 9899
6910 <ref id="islower" name="islower">,
6911 <ref id="isupper" name="isupper">,
6912 <ref id="tolower" name="tolower">
6918 <sect1>ultoa<label id="ultoa"><p>
6922 <tag/Function/Convert an unsigned long integer into a string.
6923 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
6924 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
6925 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
6926 string using <tt/radix/ as the base.
6927 <tag/Notes/<itemize>
6928 <item>There are no provisions to prevent a buffer overflow.
6929 <item>The function is non standard, so it is not available in strict ANSI mode.
6930 You should probably use <tt/sprintf/ instead.
6931 <item>The function is only available as fastcall function, so it may only be
6932 used in presence of a prototype.
6934 <tag/Availability/cc65
6936 <ref id="atoi" name="atoi">,
6937 <ref id="atol" name="atol">,
6938 <ref id="itoa" name="itoa">,
6939 <ref id="ltoa" name="ltoa">,
6940 <ref id="utoa" name="utoa">
6946 <sect1>unlink<label id="unlink"><p>
6950 <tag/Function/Delete a file.
6951 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
6952 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
6953 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
6954 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
6955 code describing the reason for the failure.
6956 <tag/Notes/<itemize>
6957 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
6958 name="remove">/ instead, which is a native ANSI C function and does the same.
6959 <item>This function is not available on all cc65 targets (depends on the
6960 availability of file I/O).
6961 <item>The function is only available as fastcall function, so it may only
6962 be used in presence of a prototype.
6963 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
6964 used, which has the same semantics, but is more portable, because it conforms
6965 to the ISO C standard.
6967 <tag/Availability/POSIX 1003.1
6969 <ref id="remove" name="remove">
6972 #include <stdio.h>
6973 #include <unistd.h>
6975 #define FILENAME "helloworld"
6977 if (unlink (FILENAME) == 0) {
6978 printf ("We deleted %s successfully\n", FILENAME);
6980 printf ("There was a problem deleting %s\n", FILENAME);
6987 <sect1>utoa<label id="utoa"><p>
6991 <tag/Function/Convert an unsigned integer into a string.
6992 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
6993 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
6994 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
6995 using <tt/radix/ as the base.
6996 <tag/Notes/<itemize>
6997 <item>There are no provisions to prevent a buffer overflow.
6998 <item>The function is non standard, so it is not available in strict ANSI mode.
6999 You should probably use <tt/sprintf/ instead.
7000 <item>The function is only available as fastcall function, so it may only be
7001 used in presence of a prototype.
7003 <tag/Availability/cc65
7005 <ref id="atoi" name="atoi">,
7006 <ref id="atol" name="atol">,
7007 <ref id="itoa" name="itoa">,
7008 <ref id="ltoa" name="ltoa">,
7009 <ref id="ultoa" name="ultoa">
7015 <sect1>vcprintf<label id="vcprintf"><p>
7019 <tag/Function/Formatted output to the console.
7020 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7021 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
7022 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
7023 text where necessary and formatted according to the format string given. The
7024 resulting string is output to the console. <tt/vcprintf/ supports the same
7025 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
7026 <tag/Notes/<itemize>
7027 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
7028 between <tt/\r/ and <tt/\n/.
7029 <item>The function is only available as fastcall function, so it may only be
7030 used in presence of a prototype.
7032 <tag/Availability/cc65
7034 <ref id="cprintf" name="cprintf">,
7035 <ref id="cputc" name="cputc">,
7036 <ref id="cputcxy" name="cputcxy">,
7037 <ref id="cputs" name="cputs">,
7038 <ref id="cputsxy" name="cputsxy">
7044 <sect1>videomode<label id="videomode"><p>
7048 <tag/Function/Switch to either 40 or 80 column mode.
7049 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
7050 <ref id="c128.h" name="c128.h">/
7051 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
7052 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
7053 the requested mode is already active, nothing happens. The old mode is returned
7055 <tag/Notes/<itemize>
7056 <item>The function is specific to the C128 and enhanced Apple //e.
7057 <item>This function replaces <ref id="toggle_videomode"
7058 name="toggle_videomode">.
7059 <item>The function is only available as fastcall function, so it may only be
7060 used in presence of a prototype.
7062 <tag/Availability/C128 and enhanced Apple //e
7064 <ref id="fast" name="fast">,
7065 <ref id="slow" name="slow">,
7066 <ref id="toggle_videomode" name="toggle_videomode">
7072 <sect1>waitvsync<label id="waitvsync"><p>
7076 <tag/Function/Wait until the start of the next frame.
7078 <tt/<ref id="cbm.h" name="cbm.h">/,
7079 <tt/<ref id="gamate.h" name="gamate.h">/,
7080 <tt/<ref id="nes.h" name="nes.h">/,
7081 <tt/<ref id="pce.h" name="pce.h">/
7082 <tag/Declaration/<tt/void waitvsync (void);/
7083 <tag/Description/Wait for vertical sync to reduce flickering.
7084 <tag/Availability/Platforms above
7090 <sect1>wherex<label id="wherex"><p>
7094 <tag/Function/Return the current X position of the text mode cursor.
7095 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7096 <tag/Declaration/<tt/unsigned char wherex (void);/
7097 <tag/Description/The function returns the current X position of the text mode
7098 cursor. Zero is returned for the leftmost screen position.
7099 <tag/Availability/cc65
7101 <ref id="gotox" name="gotox">,
7102 <ref id="gotoy" name="gotoy">,
7103 <ref id="gotoxy" name="gotoxy">,
7104 <ref id="wherey" name="wherey">
7110 <sect1>wherey<label id="wherey"><p>
7114 <tag/Function/Return the current Y position of the text mode cursor.
7115 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7116 <tag/Declaration/<tt/unsigned char wherey (void);/
7117 <tag/Description/The function returns the current Y position of the text mode
7118 cursor. Zero is returned for the uppermost screen position.
7119 <tag/Availability/cc65
7121 <ref id="gotox" name="gotox">,
7122 <ref id="gotoy" name="gotoy">,
7123 <ref id="gotoxy" name="gotoxy">,
7124 <ref id="wherex" name="wherex">