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/accelerator.h/<label id="accelerator.h"><p>
71 <item><ref id="detect_c64dtv" name="detect_c64dtv">
72 <item><ref id="detect_scpu" name="detect_scpu">
73 <item><ref id="get_c64dtv_speed" name="get_c64dtv_speed">
74 <item><ref id="get_scpu_speed" name="get_scpu_speed">
75 <item><ref id="set_c64dtv_speed" name="set_c64dtv_speed">
76 <item><ref id="set_scpu_speed" name="set_scpu_speed">
80 <sect1><tt/apple2.h/<label id="apple2.h"><p>
84 <item><ref id="get_ostype" name="get_ostype">
89 <sect1><tt/apple2enh.h/<label id="apple2enh.h"><p>
93 <item><ref id="get_ostype" name="get_ostype">
97 <item><ref id="videomode" name="videomode">
101 <sect1><tt/assert.h/<label id="assert.h"><p>
104 <item><ref id="assert" name="assert">
108 <sect1><tt/atari.h/<label id="atari.h"><p>
111 <!-- <item><ref id="_getcolor" name="_getcolor"> -->
112 <!-- <item><ref id="_getdefdev" name="_getdefdev"> -->
113 <!-- <item><ref id="_graphics" name="_graphics"> -->
114 <item><ref id="_is_cmdline_dos" name="_is_cmdline_dos">
115 <!-- <item><ref id="_rest_vecs" name="_rest_vecs"> -->
116 <!-- <item><ref id="_save_vecs" name="_save_vecs"> -->
117 <!-- <item><ref id="_scroll" name="_scroll"> -->
118 <!-- <item><ref id="_setcolor" name="_setcolor"> -->
119 <!-- <item><ref id="_setcolor_low" name="_setcolor_low"> -->
120 <item><ref id="get_ostype" name="get_ostype">
121 <!-- <item><ref id="get_tv" name="get_tv"> -->
127 <sect1><tt/atmos.h/<label id="atmos.h"><p>
130 <item><ref id="atmos_explode" name="atmos_explode">
131 <item><ref id="atmos_load" name="atmos_load">
132 <item><ref id="atmos_ping" name="atmos_ping">
133 <item><ref id="atmos_save" name="atmos_save">
134 <item><ref id="atmos_shoot" name="atmos_shoot">
135 <item><ref id="atmos_tick" name="atmos_tick">
136 <item><ref id="atmos_tock" name="atmos_tock">
137 <item><ref id="atmos_zap" name="atmos_zap">
141 <sect1><tt/c128.h/<label id="c128.h"><p>
144 <item><ref id="c64mode" name="c64mode">
145 <item><ref id="fast" name="fast">
146 <item><ref id="isfast" name="isfast">
147 <item><ref id="slow" name="slow">
148 <item><ref id="toggle_videomode" name="toggle_videomode">
149 <item><ref id="videomode" name="videomode">
153 <sect1><tt/c16.h/<label id="c16.h"><p>
156 <item><ref id="fast" name="fast">
157 <item><ref id="isfast" name="isfast">
158 <item><ref id="slow" name="slow">
164 <sect1><tt/c64.h/<label id="c64.h"><p>
167 <item><ref id="get_ostype" name="get_ostype">
171 <sect1><tt/cbm.h/<label id="cbm.h"><p>
174 <item><ref id="cbm_k_acptr" name="cbm_k_acptr">
175 <item><ref id="cbm_k_basin" name="cbm_k_basin">
176 <item><ref id="cbm_k_bsout" name="cbm_k_bsout">
177 <item><ref id="cbm_k_chkin" name="cbm_k_chkin">
178 <item><ref id="cbm_k_ciout" name="cbm_k_ciout">
179 <item><ref id="cbm_k_ckout" name="cbm_k_ckout">
180 <item><ref id="cbm_k_clall" name="cbm_k_clall">
181 <item><ref id="cbm_k_close" name="cbm_k_close">
182 <item><ref id="cbm_k_clrch" name="cbm_k_clrch">
183 <item><ref id="cbm_k_getin" name="cbm_k_getin">
184 <item><ref id="cbm_k_iobase" name="cbm_k_iobase">
185 <item><ref id="cbm_k_listen" name="cbm_k_listen">
186 <item><ref id="cbm_k_load" name="cbm_k_load">
187 <item><ref id="cbm_k_open" name="cbm_k_open">
188 <item><ref id="cbm_k_readst" name="cbm_k_readst">
189 <item><ref id="cbm_k_save" name="cbm_k_save">
190 <item><ref id="cbm_k_scnkey" name="cbm_k_scnkey">
191 <item><ref id="cbm_k_setlfs" name="cbm_k_setlfs">
192 <item><ref id="cbm_k_setnam" name="cbm_k_setnam">
193 <item><ref id="cbm_k_talk" name="cbm_k_talk">
194 <item><ref id="cbm_k_udtim" name="cbm_k_udtim">
195 <item><ref id="cbm_k_unlsn" name="cbm_k_unlsn">
196 <!-- <item><ref id="cbm_load" name="cbm_load"> -->
197 <!-- <item><ref id="cbm_open" name="cbm_open"> -->
198 <!-- <item><ref id="cbm_opendir" name="cbm_opendir"> -->
199 <!-- <item><ref id="cbm_read" name="cbm_read"> -->
200 <!-- <item><ref id="cbm_readdir" name="cbm_readdir"> -->
201 <!-- <item><ref id="cbm_save" name="cbm_save"> -->
202 <!-- <item><ref id="cbm_write" name="cbm_write"> -->
203 <!-- <item><ref id="get_tv" name="get_tv"> -->
204 <item><ref id="waitvsync" name="waitvsync">
205 <item><ref id="kbrepeat" name="kbrepeat">
211 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
214 <item><ref id="peekbsys" name="peekbsys">
215 <item><ref id="peekwsys" name="peekwsys">
216 <item><ref id="pokebsys" name="pokebsys">
217 <item><ref id="pokewsys" name="pokewsys">
221 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
224 <item><ref id="peekbsys" name="peekbsys">
225 <item><ref id="peekwsys" name="peekwsys">
226 <item><ref id="pokebsys" name="pokebsys">
227 <item><ref id="pokewsys" name="pokewsys">
231 <sect1><tt/cc65.h/<label id="cc65.h"><p>
234 <!-- <item><ref id="cc65_cos" name="cc65_cos"> -->
235 <!-- <item><ref id="cc65_idiv32by16r16" name="cc65_idiv32by16r16"> -->
236 <!-- <item><ref id="cc65_imul16x16r32" name="cc65_imul16x16r32"> -->
237 <!-- <item><ref id="cc65_imul8x8r16" name="cc65_imul8x8r16"> -->
238 <!-- <item><ref id="cc65_sin" name="cc65_sin"> -->
239 <!-- <item><ref id="cc65_udiv32by16r16" name="cc65_udiv32by16r16"> -->
240 <!-- <item><ref id="cc65_umul16x16r32" name="cc65_umul16x16r32"> -->
241 <!-- <item><ref id="cc65_umul16x8r32" name="cc65_umul16x8r32"> -->
242 <!-- <item><ref id="cc65_umul8x8r16" name="cc65_umul8x8r16"> -->
243 <item><ref id="doesclrscrafterexit" name="doesclrscrafterexit">
249 <sect1><tt/conio.h/<label id="conio.h"><p>
252 <item><ref id="bgcolor" name="bgcolor">
253 <item><ref id="bordercolor" name="bordercolor">
254 <item><ref id="cclear" name="cclear">
255 <item><ref id="cclearxy" name="cclearxy">
256 <item><ref id="cgetc" name="cgetc">
257 <item><ref id="chline" name="chline">
258 <item><ref id="chlinexy" name="chlinexy">
259 <item><ref id="clrscr" name="clrscr">
260 <item><ref id="cpeekc" name="cpeekc">
261 <item><ref id="cpeekcolor" name="cpeekcolor">
262 <item><ref id="cpeekrevers" name="cpeekrevers">
263 <item><ref id="cpeeks" name="cpeeks">
264 <item><ref id="cprintf" name="cprintf">
265 <item><ref id="cputc" name="cputc">
266 <item><ref id="cputcxy" name="cputcxy">
267 <item><ref id="cputs" name="cputs">
268 <item><ref id="cputsxy" name="cputsxy">
269 <item><ref id="cursor" name="cursor">
270 <item><ref id="cvline" name="cvline">
271 <item><ref id="cvlinexy" name="cvlinexy">
272 <item><ref id="gotox" name="gotox">
273 <item><ref id="gotoxy" name="gotoxy">
274 <item><ref id="gotoy" name="gotoy">
275 <item><ref id="kbhit" name="kbhit">
276 <item><ref id="revers" name="revers">
277 <item><ref id="screensize" name="screensize">
278 <item><ref id="textcolor" name="textcolor">
279 <item><ref id="vcprintf" name="vcprintf">
280 <item><ref id="wherex" name="wherex">
281 <item><ref id="wherey" name="wherey">
285 <sect1><tt/ctype.h/<label id="ctype.h"><p>
288 <item><ref id="isalnum" name="isalnum">
289 <item><ref id="isalpha" name="isalpha">
290 <item><ref id="isascii" name="isascii">
291 <item><ref id="isblank" name="isblank">
292 <item><ref id="iscntrl" name="iscntrl">
293 <item><ref id="isdigit" name="isdigit">
294 <item><ref id="isgraph" name="isgraph">
295 <item><ref id="islower" name="islower">
296 <item><ref id="isprint" name="isprint">
297 <item><ref id="ispunct" name="ispunct">
298 <item><ref id="isspace" name="isspace">
299 <item><ref id="isupper" name="isupper">
300 <item><ref id="isxdigit" name="isxdigit">
301 <item><ref id="tolower" name="tolower">
302 <item><ref id="toupper" name="toupper">
306 <sect1><tt/dbg.h/<label id="dbg.h"><p>
309 <!-- <item><ref id="DbgInit" name="DbgInit"> -->
315 <sect1><tt/device.h/<label id="device.h"><p>
318 <item><ref id="getcurrentdevice" name="getcurrentdevice">
319 <item><ref id="getdevicedir" name="getdevicedir">
320 <item><ref id="getfirstdevice" name="getfirstdevice">
321 <item><ref id="getnextdevice" name="getnextdevice">
325 <sect1><tt/dio.h/<label id="dio.h"><p>
327 <url url="dio.html" name="Low-level disk I/O API">.
330 <sect1><tt/dirent.h/<label id="dirent.h"><p>
333 <item><ref id="_DE_ISDIR" name="_DE_ISDIR">
334 <item><ref id="_DE_ISLBL" name="_DE_ISLBL">
335 <item><ref id="_DE_ISLNK" name="_DE_ISLNK">
336 <item><ref id="_DE_ISREG" name="_DE_ISREG">
337 <item><ref id="closedir" name="closedir">
338 <item><ref id="opendir" name="opendir">
339 <item><ref id="readdir" name="readdir">
340 <item><ref id="rewinddir" name="rewinddir">
341 <item><ref id="seekdir" name="seekdir">
342 <item><ref id="telldir" name="telldir">
346 <sect1><tt/em.h/<label id="em.h"><p>
349 <item><ref id="em_commit" name="em_commit">
350 <item><ref id="em_copyfrom" name="em_copyfrom">
351 <item><ref id="em_copyto" name="em_copyto">
352 <item><ref id="em_install" name="em_install">
353 <item><ref id="em_load_driver" name="em_load_driver">
354 <item><ref id="em_map" name="em_map">
355 <item><ref id="em_pagecount" name="em_pagecount">
356 <item><ref id="em_uninstall" name="em_uninstall">
357 <item><ref id="em_unload" name="em_unload">
358 <item><ref id="em_use" name="em_use">
362 <sect1><tt/errno.h/<label id="errno.h"><p>
365 <!-- <item><ref id="_directerrno" name="_directerrno"> -->
366 <!-- <item><ref id="_mappederrno" name="_mappederrno"> -->
367 <!-- <item><ref id="_osmaperrno" name="_osmaperrno"> -->
368 <!-- <item><ref id="_seterrno" name="_seterrno"> -->
374 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
377 <item><ref id="close" name="close">
378 <item><ref id="creat" name="creat">
379 <item><ref id="open" name="open">
383 <sect1><tt/gamate.h/<label id="gamate.h"><p>
386 <!-- <item><ref id="get_tv" name="get_tv"> -->
387 <item><ref id="waitvsync" name="waitvsync">
393 <sect1><tt/geos.h/<label id="geos.h"><p>
395 <url url="geos.html" name="GEOS API">.
398 <sect1><tt/joystick.h/<label id="joystick.h"><p>
401 <item><ref id="joy_count" name="joy_count">
402 <item><ref id="joy_install" name="joy_install">
403 <item><ref id="joy_load_driver" name="joy_load_driver">
404 <item><ref id="joy_read" name="joy_read">
405 <item><ref id="joy_uninstall" name="joy_uninstall">
406 <item><ref id="joy_unload" name="joy_unload">
410 <sect1><tt/locale.h/<label id="locale.h"><p>
413 <item><ref id="localeconv" name="localeconv">
414 <item><ref id="setlocale" name="setlocale">
418 <sect1><tt/lynx.h/<label id="lynx.h"><p>
421 <!-- <item><ref id="lynx_eeprom_erase" name="lynx_eeprom_erase"> -->
422 <!-- <item><ref id="lynx_eeprom_read" name="lynx_eeprom_read"> -->
423 <!-- <item><ref id="lynx_eeprom_write" name="lynx_eeprom_write"> -->
424 <!-- <item><ref id="lynx_eeread" name="lynx_eeread"> -->
425 <!-- <item><ref id="lynx_eewrite" name="lynx_eewrite"> -->
426 <!-- <item><ref id="lynx_exec" name="lynx_exec"> -->
427 <!-- <item><ref id="lynx_load" name="lynx_load"> -->
433 <sect1><tt/lz4.h/<label id="lz4.h"><p>
436 <item><ref id="decompress_lz4" name="decompress_lz4">
440 <sect1><tt/modload.h/<label id="modload.h"><p>
443 <item><ref id="mod_load" name="mod_load">
444 <item><ref id="mod_free" name="mod_free">
448 <sect1><tt/mouse.h/<label id="mouse.h"><p>
451 <item><ref id="mouse_buttons" name="mouse_buttons">
452 <item><ref id="mouse_getbox" name="mouse_getbox">
453 <item><ref id="mouse_geterrormsg" name="mouse_geterrormsg">
454 <item><ref id="mouse_hide" name="mouse_hide">
455 <item><ref id="mouse_info" name="mouse_info">
456 <item><ref id="mouse_install" name="mouse_install">
457 <item><ref id="mouse_ioctl" name="mouse_ioctl">
458 <item><ref id="mouse_load_driver" name="mouse_load_driver">
459 <item><ref id="mouse_move" name="mouse_move">
460 <item><ref id="mouse_pos" name="mouse_pos">
461 <item><ref id="mouse_setbox" name="mouse_setbox">
462 <item><ref id="mouse_show" name="mouse_show">
463 <item><ref id="mouse_uninstall" name="mouse_uninstall">
464 <item><ref id="mouse_unload" name="mouse_unload">
468 <sect1><tt/nes.h/<label id="nes.h"><p>
471 <!-- <item><ref id="get_tv" name="get_tv"> -->
472 <item><ref id="waitvsync" name="waitvsync">
478 <sect1><tt/o65.h/<label id="o65.h"><p>
480 The <tt/o65.h/ header file contains structure and constant definitions that
481 may be used when dealing with files in <url
482 url="http://www.6502.org/users/andre/o65/fileformat.html" name="the o65 format">.
483 It does not declare any functions.
486 <sect1><tt/pce.h/<label id="pce.h"><p>
489 <!-- <item><ref id="get_tv" name="get_tv"> -->
490 <item><ref id="waitvsync" name="waitvsync">
496 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
499 <item><ref id="PEEK" name="PEEK">
500 <item><ref id="PEEKW" name="PEEKW">
501 <item><ref id="POKE" name="POKE">
502 <item><ref id="POKEW" name="POKEW">
506 <sect1><tt/pen.h/<label id="pen.h"><p>
509 <!-- <item><ref id="pen_adjust" name="pen_adjust"> -->
510 <!-- <item><ref id="pen_calibrate" name="pen_calibrate"> -->
516 <sect1><tt/pet.h/<label id="pet.h"><p>
521 <sect1><tt/plus4.h/<label id="plus4.h"><p>
524 <item><ref id="fast" name="fast">
525 <item><ref id="isfast" name="isfast">
526 <item><ref id="slow" name="slow">
532 <sect1><tt/serial.h/<label id="serial.h"><p>
534 The <tt/serial.h/ header file contains definitions for initializing serial
538 <item><ref id="ser_close" name="ser_close">
539 <item><ref id="ser_get" name="ser_get">
540 <item><ref id="ser_install" name="ser_install">
541 <item><ref id="ser_ioctl" name="ser_ioctl">
542 <item><ref id="ser_load_driver" name="ser_load_driver">
543 <item><ref id="ser_open" name="ser_open">
544 <item><ref id="ser_put" name="ser_put">
545 <item><ref id="ser_status" name="ser_status">
546 <item><ref id="ser_uninstall" name="ser_uninstall">
547 <item><ref id="ser_unload" name="ser_unload">
551 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
554 <item><ref id="setjmp" name="setjmp">
555 <item><ref id="longjmp" name="longjmp">
559 <sect1><tt/signal.h/<label id="signal.h"><p>
562 <item><ref id="raise" name="raise">
563 <item><ref id="signal" name="signal">
567 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
572 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
577 <sect1><tt/stddef.h/<label id="stddef.h"><p>
580 <item><ref id="offsetof" name="offsetof">
584 <sect1><tt/stdio.h/<label id="stdio.h"><p>
587 <item><ref id="_poserror" name="_poserror">
588 <item><ref id="clearerr" name="clearerr">
589 <!-- <item><ref id="fclose" name="fclose"> -->
590 <!-- <item><ref id="fdopen" name="fdopen"> -->
591 <item><ref id="feof" name="feof">
592 <item><ref id="ferror" name="ferror">
593 <!-- <item><ref id="fflush" name="fflush"> -->
594 <!-- <item><ref id="fgetc" name="fgetc"> -->
595 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
596 <!-- <item><ref id="fgets" name="fgets"> -->
597 <item><ref id="fileno" name="fileno">
598 <!-- <item><ref id="fopen" name="fopen"> -->
599 <!-- <item><ref id="fprintf" name="fprintf"> -->
600 <!-- <item><ref id="fputc" name="fputc"> -->
601 <!-- <item><ref id="fputs" name="fputs"> -->
602 <!-- <item><ref id="fread" name="fread"> -->
603 <!-- <item><ref id="freopen" name="freopen"> -->
604 <!-- <item><ref id="fscanf" name="fscanf"> -->
605 <!-- <item><ref id="fseek" name="fseek"> -->
606 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
607 <!-- <item><ref id="ftell" name="ftell"> -->
608 <!-- <item><ref id="fwrite" name="fwrite"> -->
609 <!-- <item><ref id="getc" name="getc"> -->
610 <!-- <item><ref id="getchar" name="getchar"> -->
611 <!-- <item><ref id="gets" name="gets"> -->
612 <!-- <item><ref id="printf" name="printf"> -->
613 <!-- <item><ref id="putc" name="putc"> -->
614 <!-- <item><ref id="putchar" name="putchar"> -->
615 <!-- <item><ref id="puts" name="puts"> -->
616 <item><ref id="rename" name="rename">
617 <item><ref id="remove" name="remove">
618 <!-- <item><ref id="rewind" name="rewind"> -->
619 <!-- <item><ref id="scanf" name="scanf"> -->
620 <!-- <item><ref id="snprintf" name="snprintf"> -->
621 <!-- <item><ref id="sprintf" name="sprintf"> -->
622 <!-- <item><ref id="sscanf" name="sscanf"> -->
623 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
624 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
625 <!-- <item><ref id="vprintf" name="vprintf"> -->
626 <!-- <item><ref id="vscanf" name="vscanf"> -->
627 <!-- <item><ref id="vsnprintf" name="vsnprintf"> -->
628 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
629 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
635 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
638 <item><ref id="_heapadd" name="_heapadd">
639 <item><ref id="_heapblocksize" name="_heapblocksize">
640 <item><ref id="_heapmaxavail" name="_heapmaxavail">
641 <item><ref id="_heapmemavail" name="_heapmemavail">
642 <item><ref id="_randomize" name="_randomize">
643 <item><ref id="_swap" name="_swap">
644 <item><ref id="abort" name="abort">
645 <item><ref id="abs" name="abs">
646 <item><ref id="atexit" name="atexit">
647 <item><ref id="atoi" name="atoi">
648 <item><ref id="atol" name="atol">
649 <item><ref id="bsearch" name="bsearch">
650 <item><ref id="calloc" name="calloc">
651 <item><ref id="div" name="div">
652 <item><ref id="exit" name="exit">
653 <item><ref id="free" name="free">
654 <item><ref id="getenv" name="getenv">
655 <item><ref id="itoa" name="itoa">
656 <item><ref id="labs" name="labs">
657 <item><ref id="ltoa" name="ltoa">
658 <item><ref id="malloc" name="malloc">
659 <item><ref id="perror" name="perror">
660 <!-- <item><ref id="posix_memalign" name="posix_memalign"> -->
661 <!-- <item><ref id="putenv" name="putenv"> -->
662 <item><ref id="qsort" name="qsort">
663 <item><ref id="rand" name="rand">
664 <item><ref id="realloc" name="realloc">
665 <item><ref id="srand" name="srand">
666 <!-- <item><ref id="system" name="system"> -->
667 <item><ref id="ultoa" name="ultoa">
668 <item><ref id="utoa" name="utoa">
674 <sect1><tt/string.h/<label id="string.h"><p>
677 <item><ref id="_stroserror" name="_stroserror">
678 <item><ref id="bzero" name="bzero">
679 <item><ref id="memchr" name="memchr">
680 <item><ref id="memcmp" name="memcmp">
681 <item><ref id="memcpy" name="memcpy">
682 <item><ref id="memmove" name="memmove">
683 <item><ref id="memset" name="memset">
684 <item><ref id="strcasecmp" name="strcasecmp">
685 <item><ref id="strcat" name="strcat">
686 <item><ref id="strchr" name="strchr">
687 <item><ref id="strcmp" name="strcmp">
688 <item><ref id="strcoll" name="strcoll">
689 <item><ref id="strcpy" name="strcpy">
690 <item><ref id="strcspn" name="strcspn">
691 <item><ref id="strdup" name="strdup">
692 <item><ref id="strerror" name="strerror">
693 <item><ref id="stricmp" name="stricmp">
694 <item><ref id="strlen" name="strlen">
695 <item><ref id="strlower" name="strlower">
696 <item><ref id="strlwr" name="strlwr">
697 <item><ref id="strncasecmp" name="strncasecmp">
698 <item><ref id="strncat" name="strncat">
699 <item><ref id="strncmp" name="strncmp">
700 <item><ref id="strncpy" name="strncpy">
701 <item><ref id="strnicmp" name="strnicmp">
702 <item><ref id="strqtok" name="strqtok">
703 <item><ref id="strrchr" name="strrchr">
704 <item><ref id="strspn" name="strspn">
705 <item><ref id="strstr" name="strstr">
706 <item><ref id="strtok" name="strtok">
707 <item><ref id="strxfrm" name="strxfrm">
708 <item><ref id="strupper" name="strupper">
709 <item><ref id="strupr" name="strupr">
713 <sect1><tt/telestrat.h/<label id="telestrat.h"><p>
716 <item><ref id="atmos_explode" name="explode">
717 <item><ref id="atmos_ping" name="ping">
718 <item><ref id="atmos_shoot" name="shoot">
719 <item><ref id="atmos_zap" name="zap">
720 <!-- <item><ref id="kbdclick1" name="kbdclick1"> -->
721 <!-- <item><ref id="oups" name="oups"> -->
727 <sect1><tt/tgi.h/<label id="tgi.h"><p>
729 <url url="tgi.html" name="Tiny Graphics Interface">.
732 <sect1><tt/time.h/<label id="time.h"><p>
735 <!-- <item><ref id="_systime" name="_systime"> -->
736 <!-- <item><ref id="asctime" name="asctime"> -->
737 <item><ref id="clock" name="clock">
738 <!-- <item><ref id="ctime" name="ctime"> -->
739 <!-- <item><ref id="gmtime" name="gmtime"> -->
740 <!-- <item><ref id="localtime" name="localtime"> -->
741 <!-- <item><ref id="mktime" name="mktime"> -->
742 <!-- <item><ref id="strftime" name="strftime"> -->
743 <item><ref id="time" name="time">
749 <sect1><tt/unistd.h/<label id="unistd.h"><p>
752 <!-- <item><ref id="chdir" name="chdir"> -->
753 <item><ref id="exec" name="exec">
754 <item><ref id="getcwd" name="getcwd">
755 <item><ref id="getopt" name="getopt">
756 <!-- <item><ref id="lseek" name="lseek"> -->
757 <!-- <item><ref id="mkdir" name="mkdir"> -->
758 <!-- <item><ref id="read" name="read"> -->
759 <!-- <item><ref id="rmdir" name="rmdir"> -->
760 <item><ref id="sleep" name="sleep">
761 <item><ref id="unlink" name="unlink">
762 <!-- <item><ref id="write" name="write"> -->
768 <sect1><tt/vic20.h/<label id="vic20.h"><p>
773 <sect1><tt/zlib.h/<label id="zlib.h"><p>
776 <!-- <item><ref id="adler32" name="adler32"> -->
777 <!-- <item><ref id="crc32" name="crc32"> -->
778 <!-- <item><ref id="inflatemem" name="inflatemem"> -->
779 <!-- <item><ref id="uncompress" name="uncompress"> -->
785 <sect>Alphabetical function reference<p>
787 <sect1>_DE_ISDIR<label id="_DE_ISDIR"><p>
791 <tag/Function/Determine if a directory entry specifies a directory.
792 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
793 <tag/Declaration/<tt/int _DE_ISDIR(unsigned char type);/
794 <tag/Description/The function is called with the type of a directory entry
795 taken from a <tt/struct dirent/ and returns true if the entry designates
798 <item>The function is actually a macro.
800 <tag/Availability/cc65
802 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
803 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
804 <ref id="_DE_ISREG" name="_DE_ISREG">
810 <sect1>_DE_ISLBL<label id="_DE_ISLBL"><p>
814 <tag/Function/Determine if a directory entry specifies a disk label.
815 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
816 <tag/Declaration/<tt/int _DE_ISLBL(unsigned char type);/
817 <tag/Description/The function is called with the type of a directory entry
818 taken from a <tt/struct dirent/ and returns true if the entry designates
821 <item>The function is actually a macro.
823 <tag/Availability/cc65
825 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
826 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
827 <ref id="_DE_ISREG" name="_DE_ISREG">
833 <sect1>_DE_ISLNK<label id="_DE_ISLNK"><p>
837 <tag/Function/Determine if a directory entry specifies a link.
838 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
839 <tag/Declaration/<tt/int _DE_ISLNK(unsigned char type);/
840 <tag/Description/The function is called with the type of a directory entry
841 taken from a <tt/struct dirent/ and returns true if the entry designates
844 <item>The function is actually a macro.
846 <tag/Availability/cc65
848 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
849 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
850 <ref id="_DE_ISREG" name="_DE_ISREG">
856 <sect1>_DE_ISREG<label id="_DE_ISREG"><p>
860 <tag/Function/Determine if a directory entry specifies a regular file.
861 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
862 <tag/Declaration/<tt/int _DE_ISREG(unsigned char type);/
863 <tag/Description/The function is called with the type of a directory entry
864 taken from a <tt/struct dirent/ and returns true if the entry designates
867 <item>The function is actually a macro.
868 <item>A "regular file" means anything with data in it. This might still mean
869 that special processing is needed, when accessing the file. Relative files of
870 the CBM systems are classified as being "regular" files, for example.
872 <tag/Availability/cc65
874 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
875 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
876 <ref id="_DE_ISLNK" name="_DE_ISLNK">
882 <sect1>_heapadd<label id="_heapadd"><p>
886 <tag/Function/Add a block to the heap.
887 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
888 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
889 <tag/Description/The function adds a block of raw memory to the heap.
891 <item>The minimum blocksize that can be added is 6 bytes; the function will
892 ignore smaller blocks.
893 <item>The function is available only as a fastcall function; so, it may be used
894 only in the presence of a prototype.
896 <tag/Availability/cc65
898 <ref id="_heapblocksize" name="_heapblocksize">,
899 <ref id="_heapmaxavail" name="_heapmaxavail">,
900 <ref id="_heapmemavail" name="_heapmemavail">,
901 <ref id="calloc" name="calloc">,
902 <ref id="free" name="free">,
903 <ref id="malloc" name="malloc">,
904 <ref id="realloc" name="realloc">
910 <sect1>_heapblocksize<label id="_heapblocksize"><p>
914 <tag/Function/Return the size of an allocated block.
915 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
916 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
917 <tag/Description/The function returns the size of a block that must have
918 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
919 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
921 <item>Passing a pointer to a block that was is not the result of one of the
922 allocation functions, or that has been free'd will give unpredicable results.
923 <item>The function is available only as a fastcall function; so, it may be used
924 only in the presence of a prototype.
926 <tag/Availability/cc65
928 <ref id="_heapadd" name="_heapadd">,
929 <ref id="_heapmaxavail" name="_heapmaxavail">,
930 <ref id="_heapmemavail" name="_heapmemavail">,
931 <ref id="calloc" name="calloc">,
932 <ref id="free" name="free">,
933 <ref id="malloc" name="malloc">,
934 <ref id="realloc" name="realloc">
940 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
944 <tag/Function/Return the largest block that is available on the heap.
945 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
946 <tag/Declaration/<tt/size_t _heapmaxavail (void);/
947 <tag/Description/The function returns the size of the largest block that may
948 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
949 <tag/Availability/cc65
951 <ref id="_heapadd" name="_heapadd">,
952 <ref id="_heapblocksize" name="_heapblocksize">,
953 <ref id="_heapmemavail" name="_heapmemavail">,
954 <ref id="calloc" name="calloc">,
955 <ref id="free" name="free">,
956 <ref id="malloc" name="malloc">,
957 <ref id="realloc" name="realloc">
963 <sect1>_heapmemavail<label id="_heapmemavail"><p>
967 <tag/Function/Return the total available space on the heap.
968 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
969 <tag/Declaration/<tt/size_t _heapmemavail (void);/
970 <tag/Description/The function returns the total number of bytes available on
973 <item>This function is of less use than usually assumed, since the returned
974 heap space may be available but not in one block. So even if this function
975 says that several times more heap space is available than needed, <ref
976 id="malloc" name="malloc"> may still return <tt/NULL/.
978 <tag/Availability/cc65
980 <ref id="_heapadd" name="_heapadd">,
981 <ref id="_heapblocksize" name="_heapblocksize">,
982 <ref id="_heapmaxavail" name="_heapmaxavail">,
983 <ref id="calloc" name="calloc">,
984 <ref id="free" name="free">,
985 <ref id="malloc" name="malloc">,
986 <ref id="realloc" name="realloc">
992 <sect1>_is_cmdline_dos<label id="_is_cmdline_dos"><p>
996 <tag/Function/Determines whether the underlying DOS supports command line arguments.
997 <tag/Header/<tt/<ref id="atari.h" name="atari.h">/
998 <tag/Declaration/<tt/unsigned char _is_cmdline_dos (void);/
999 <tag/Description/The function returns 0 if the DOS doesn't support command line arguments.
1000 It returns 1 if it does.
1001 <tag/Availability/cc65 (<tt/atari/ and <tt/atarixl/ platforms)
1006 <sect1>_poserror<label id="_poserror"><p>
1010 <tag/Function/Print an error message for the error in <tt/_oserror/.
1011 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1012 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
1013 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
1014 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
1015 a colon and a blank. Then the error message for the current contents of
1016 <tt/_oserror/ are printed followed by a newline. The message output is the
1017 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
1018 argument of <tt/_oserror/.
1019 <tag/Notes/<itemize>
1020 <item>Since operating system specific error code are - you guessed it -
1021 operating system specific, the value in <tt/_oserror/ and the message that is
1022 printed depends on the cc65 target.
1023 <item>The function is only available as fastcall function, so it may only
1024 be used in presence of a prototype.
1026 <tag/Availability/cc65
1028 <ref id="_stroserror" name="_stroserror">,
1029 <ref id="perror" name="perror">
1035 <sect1>_randomize<label id="_randomize"><p>
1039 <tag/Function/Initialize the pseudo random number generator.
1040 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1041 <tag/Declaration/<tt/void _randomize (void);/
1042 <tag/Description/The function initializes the random number generator with
1043 a seed derived from fast changing hardware events, so the seed itself can be
1044 considered random to a certain degree.
1045 <tag/Notes/<itemize>
1046 <item>The randomness of the seed depends on the machine hardware.
1048 <tag/Availability/cc65
1050 <ref id="rand" name="rand">,
1051 <ref id="srand" name="srand">
1057 <sect1>_stroserror<label id="_stroserror"><p>
1061 <tag/Function/Return a string describing an OS specific error code.
1062 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1063 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
1064 <tag/Description/<tt/_stroserror/ will return a string describing the given
1065 operating system specific error code.
1066 <tag/Notes/<itemize>
1067 <item>Since operating system specific error code are - you guessed it -
1068 operating system specific, the parameter and the string returned depend on the
1070 <item>The function is only available as fastcall function, so it may only be
1071 used in presence of a prototype.
1073 <tag/Availability/cc65
1075 <ref id="strerror" name="strerror">
1081 <sect1>_swap<label id="_swap"><p>
1085 <tag/Function/Swap the contents of memory areas.
1086 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1087 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
1088 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
1089 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
1090 <tt/size/ bytes in size.
1091 <tag/Notes/<itemize>
1092 <item>The memory areas may not overlap, otherwise the results are undefined.
1093 <item>The function is only available as fastcall function, so it may only be
1094 used in presence of a prototype.
1096 <tag/Availability/cc65
1098 <ref id="memcpy" name="memcpy">,
1099 <ref id="memmove" name="memmove">
1105 <sect1>_sys<label id="_sys"><p>
1109 <tag/Function/Call a subroutine passing register values.
1110 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1111 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
1112 <tag/Description/The function will call the subroutine at the address
1113 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
1114 registers and the CPU flags are set to the values given in the <tt/regs/
1115 structure. On return from the subroutine, the new values of the registers and
1116 flags are stored back overwriting the old values.
1117 <tag/Notes/<itemize>
1118 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
1119 when calling the subroutine (they are unchanged from their current values).
1120 <item>The function is only available as fastcall function, so it may only be
1121 used in presence of a prototype.
1123 <tag/Availability/cc65
1129 <sect1>BRK<label id="BRK"><p>
1133 <tag/Function/Insert a 6502 BRK instrunction into the code.
1134 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1135 <tag/Declaration/<tt/void BRK (void);/
1136 <tag/Description/The function will insert a 6502 BRK instruction into the code
1137 which may be used to trigger a debugger.
1138 <tag/Notes/<itemize>
1139 <item>The function is actually a macro.
1140 <item>The inserted instruction may lead to unexpected results if no debugger
1143 <tag/Availability/cc65
1145 <ref id="CLI" name="CLI">,
1146 <ref id="SEI" name="SEI">
1152 <sect1>CLI<label id="CLI"><p>
1156 <tag/Function/Insert a 6502 CLI instrunction into the code.
1157 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1158 <tag/Declaration/<tt/void CLI (void);/
1159 <tag/Description/The function will insert a 6502 CLI instruction into the code,
1160 so interrupts are enabled. Enabling interrupts has no effects if they are
1161 already enabled (the default).
1162 <tag/Notes/<itemize>
1163 <item>The function is actually a macro.
1164 <item>Disabling interrupts may lead to unexpected results.
1166 <tag/Availability/cc65
1168 <ref id="BRK" name="BRK">,
1169 <ref id="SEI" name="SEI">
1175 <sect1>PEEK<label id="PEEK"><p>
1179 <tag/Function/Read a byte from memory.
1180 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1181 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
1182 <tag/Description/The function will read the absolute memory given by <tt/addr/
1183 and return the value read.
1184 <tag/Notes/<itemize>
1185 <item>The function is actually a macro.
1186 <item>This function depends highly on the platform and environment.
1188 <tag/Availability/cc65
1190 <ref id="PEEKW" name="PEEKW">,
1191 <ref id="POKE" name="POKE">
1197 <sect1>PEEKW<label id="PEEKW"><p>
1201 <tag/Function/Read a word (two bytes) from memory.
1202 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1203 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
1204 <tag/Description/The function will read the absolute memory given by <tt/addr/
1205 and return the value read. The byte read from the higher address is the high
1206 byte of the return value.
1207 <tag/Notes/<itemize>
1208 <item>The function is actually a macro.
1209 <item>This function depends highly on the platform and environment.
1210 <item>The order in which the two bytes are read is unspecified and may
1211 depend of the address expression used.
1213 <tag/Availability/cc65
1215 <ref id="PEEK" name="PEEK">,
1216 <ref id="POKE" name="POKE">
1222 <sect1>POKE<label id="POKE"><p>
1226 <tag/Function/Write a byte to memory.
1227 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1228 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
1229 <tag/Description/The function writes the value <tt/val/ to the absolute
1230 memory address given by <tt/addr/.
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
1237 <tag/Availability/cc65
1239 <ref id="PEEK" name="PEEK">,
1240 <ref id="POKEW" name="POKEW">
1246 <sect1>POKEW<label id="POKEW"><p>
1250 <tag/Function/Write a word (two bytes) to memory.
1251 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1252 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
1253 <tag/Description/The function writes the value <tt/val/ to the absolute
1254 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
1255 the <tt/addr/, the high byte is written to <tt/addr+1/.
1256 <tag/Notes/<itemize>
1257 <item>The function is actually a macro.
1258 <item>This function depends highly on the platform and environment.
1259 <item>Careless use will cause the program to act strange or may crash the
1261 <item>The order in which the two bytes are written is unspecified and may
1262 depend of the address expression used.
1264 <tag/Availability/cc65
1266 <ref id="PEEK" name="PEEK">,
1267 <ref id="POKE" name="POKE">
1273 <sect1>SEI<label id="SEI"><p>
1277 <tag/Function/Insert a 6502 SEI instrunction into the code.
1278 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1279 <tag/Declaration/<tt/void SEI (void);/
1280 <tag/Description/The function will insert a 6502 SEI instruction into the code,
1281 so interrupts are disabled. Note that non maskable interrupts cannot be
1283 <tag/Notes/<itemize>
1284 <item>The function is actually a macro.
1285 <item>Disabling interrupts may lead to unexpected results.
1287 <tag/Availability/cc65
1289 <ref id="BRK" name="BRK">,
1290 <ref id="CLI" name="CLI">
1296 <sect1>abort<label id="abort"><p>
1300 <tag/Function/Terminates a program abnormally.
1301 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1302 <tag/Declaration/<tt/void abort (void);/
1303 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
1304 on stderr, then terminates the program with an exit code of 3.
1305 <tag/Availability/ISO 9899
1307 <ref id="assert" name="assert">,
1308 <ref id="exit" name="exit">,
1309 <ref id="raise" name="raise">
1315 <sect1>abs<label id="abs"><p>
1319 <tag/Function/Returns the absolute value of an integer.
1320 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1321 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
1322 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
1324 <tag/Notes/<itemize>
1325 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
1326 <item>The function is only available as fastcall function, so it may only be
1327 used in presence of a prototype.
1329 <tag/Availability/ISO 9899
1331 <ref id="labs" name="labs">
1337 <sect1>assert<label id="assert"><p>
1341 <tag/Function/Test a condition and possibly abort.
1342 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
1343 <tag/Declaration/<tt/void assert (int cond);/
1344 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
1345 statement. If the condition evaluates t zero (false), assert prints a message
1346 on stderr and aborts the program.
1347 <tag/Notes/<itemize>
1348 <item>The function is actually a macro.
1350 <tag/Availability/ISO 9899
1352 <ref id="abort" name="abort">,
1353 <ref id="exit" name="exit">
1359 <sect1>atexit<label id="atexit"><p>
1363 <tag/Function/Register an exit function.
1364 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1365 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1366 <tag/Description/<tt/atexit/ registers the function pointed to by
1367 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1368 terminates, they are called in LIFO order (the last function registered is
1369 called first). <tt/atexit/ returns zero on success and a nonzero value on
1371 <tag/Notes/<itemize>
1372 <item>A maximum of 5 exit functions can be registered.
1373 <item>There is no way to unregister an exit function.
1374 <item>The function is only available as fastcall function, so it may only be
1375 used in presence of a prototype.
1377 <tag/Availability/ISO 9899
1379 <ref id="abort" name="abort">,
1380 <ref id="exit" name="exit">
1386 <sect1>atmos_explode<label id="atmos_explode"><p>
1390 <tag/Function/Bomb sound effect.
1391 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1392 <tag/Declaration/<tt/void __fastcall__ atmos_explode(void);/
1393 <tag/Description/<tt/atmos_explode/ plays the BASIC sound.
1394 <tag/Notes/<itemize>
1395 <item>The function is available only as a fastcall function; so, it may be used
1396 only in the presence of a prototype.
1398 <tag/Availability/cc65
1400 <ref id="atmos_ping" name="atmos_ping">,
1401 <ref id="atmos_shoot" name="atmos_shoot">,
1402 <ref id="atmos_tick" name="atmos_tick">,
1403 <ref id="atmos_tock" name="atmos_tock">,
1404 <ref id="atmos_zap" name="atmos_zap">
1410 <sect1>atmos_load<label id="atmos_load"><p>
1414 <tag/Function/Load Atmos tape.
1415 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1416 <tag/Declaration/<tt/void __fastcall__ atmos_load(const char* name);/
1417 <tag/Description/<tt/atmos_load/ reads a memory block from tape.
1418 <tag/Notes/<itemize>
1419 <item>The function is available only as a fastcall function; so, it may be used
1420 only in the presence of a prototype.
1422 <tag/Availability/cc65
1424 <ref id="atmos_save" name="atmos_save">
1430 <sect1>atmos_ping<label id="atmos_ping"><p>
1434 <tag/Function/Bell or ricochet sound effect.
1435 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1436 <tag/Declaration/<tt/void __fastcall__ atmos_ping(void);/
1437 <tag/Description/<tt/atmos_ping/ plays the BASIC sound.
1438 <tag/Notes/<itemize>
1439 <item>The function is available only as a fastcall function; so, it may be used
1440 only in the presence of a prototype.
1442 <tag/Availability/cc65
1444 <ref id="atmos_explode" name="atmos_explode">,
1445 <ref id="atmos_shoot" name="atmos_shoot">,
1446 <ref id="atmos_tick" name="atmos_tick">,
1447 <ref id="atmos_tock" name="atmos_tock">,
1448 <ref id="atmos_zap" name="atmos_zap">
1454 <sect1>atmos_save<label id="atmos_save"><p>
1458 <tag/Function/Save Atmos tape.
1459 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1460 <tag/Declaration/<tt/void __fastcall__ atmos_save(const char* name, const void* start, const void* end);/
1461 <tag/Description/<tt/atmos_save/ writes a memory block to tape.
1462 <tag/Notes/<itemize>
1463 <item>The function is available only as a fastcall function; so, it may be used
1464 only in the presence of a prototype.
1466 <tag/Availability/cc65
1468 <ref id="atmos_load" name="atmos_load">
1470 atmos_save("hires", 0xa000, 0xc000);
1476 <sect1>atmos_shoot<label id="atmos_shoot"><p>
1480 <tag/Function/Pistol sound effect.
1481 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1482 <tag/Declaration/<tt/void __fastcall__ atmos_shoot(void);/
1483 <tag/Description/<tt/atmos_shoot/ plays the BASIC sound.
1484 <tag/Notes/<itemize>
1485 <item>The function is available only as a fastcall function; so, it may be used
1486 only in the presence of a prototype.
1488 <tag/Availability/cc65
1490 <ref id="atmos_explode" name="atmos_explode">,
1491 <ref id="atmos_ping" name="atmos_ping">,
1492 <ref id="atmos_tick" name="atmos_tick">,
1493 <ref id="atmos_tock" name="atmos_tock">,
1494 <ref id="atmos_zap" name="atmos_zap">
1500 <sect1>atmos_tick<label id="atmos_tick"><p>
1504 <tag/Function/High-pitch click.
1505 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1506 <tag/Declaration/<tt/void __fastcall__ atmos_tick(void);/
1507 <tag/Description/<tt/atmos_tick/ plays the system sound.
1508 <tag/Notes/<itemize>
1509 <item>The function is available only as a fastcall function; so, it may be used
1510 only in the presence of a prototype.
1512 <tag/Availability/cc65
1514 <ref id="atmos_explode" name="atmos_explode">,
1515 <ref id="atmos_ping" name="atmos_ping">,
1516 <ref id="atmos_shoot" name="atmos_shoot">,
1517 <ref id="atmos_tock" name="atmos_tock">,
1518 <ref id="atmos_zap" name="atmos_zap">
1524 <sect1>atmos_tock<label id="atmos_tock"><p>
1528 <tag/Function/Low-pitch click.
1529 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1530 <tag/Declaration/<tt/void __fastcall__ atmos_tock(void);/
1531 <tag/Description/<tt/atmos_tock/ plays the system sound.
1532 <tag/Notes/<itemize>
1533 <item>The function is available only as a fastcall function; so, it may be used
1534 only in the presence of a prototype.
1536 <tag/Availability/cc65
1538 <ref id="atmos_explode" name="atmos_explode">,
1539 <ref id="atmos_ping" name="atmos_ping">,
1540 <ref id="atmos_shoot" name="atmos_shoot">,
1541 <ref id="atmos_tick" name="atmos_tick">,
1542 <ref id="atmos_zap" name="atmos_zap">
1548 <sect1>atmos_zap<label id="atmos_zap"><p>
1552 <tag/Function/Raygun sound effect.
1553 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1554 <tag/Declaration/<tt/void __fastcall__ atmos_zap(void);/
1555 <tag/Description/<tt/atmos_zap/ plays the BASIC sound.
1556 <tag/Notes/<itemize>
1557 <item>The function is available only as a fastcall function; so, it may be used
1558 only in the presence of a prototype.
1560 <tag/Availability/cc65
1562 <ref id="atmos_explode" name="atmos_explode">,
1563 <ref id="atmos_ping" name="atmos_ping">,
1564 <ref id="atmos_shoot" name="atmos_shoot">,
1565 <ref id="atmos_tick" name="atmos_tick">,
1566 <ref id="atmos_tock" name="atmos_tock">
1572 <sect1>atoi<label id="atoi"><p>
1576 <tag/Function/Convert a string to an integer.
1577 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1578 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1579 <tag/Description/<tt/atoi/ converts the given string into an integer.
1580 Conversion stops as soon as any invalid character is encountered.
1581 <tag/Notes/<itemize>
1582 <item>There is no way to detect any conversion errors.
1583 <item>The function does not check for an numerical overflow when converting.
1584 <item>The function is only available as fastcall function, so it may only be
1585 used in presence of a prototype.
1587 <tag/Availability/ISO 9899
1589 <ref id="atol" name="atol">,
1590 <ref id="itoa" name="itoa">,
1591 <ref id="ltoa" name="ltoa">,
1592 <ref id="ultoa" name="ultoa">,
1593 <ref id="utoa" name="utoa">
1599 <sect1>atol<label id="atol"><p>
1603 <tag/Function/Convert a string to a long integer.
1604 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1605 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1606 <tag/Description/<tt/atol/ converts the given string into a long integer.
1607 Conversion stops as soon as any invalid character is encountered.
1608 <tag/Notes/<itemize>
1609 <item>There is no way to detect any conversion errors.
1610 <item>The function does not check for an numerical overflow when converting.
1611 <item>The function is only available as fastcall function, so it may only be
1612 used in presence of a prototype.
1614 <tag/Availability/ISO 9899
1616 <ref id="atoi" name="atoi">,
1617 <ref id="itoa" name="itoa">,
1618 <ref id="ltoa" name="ltoa">,
1619 <ref id="ultoa" name="ultoa">,
1620 <ref id="utoa" name="utoa">
1626 <sect1>bgcolor<label id="bgcolor"><p>
1630 <tag/Function/Set the background text color.
1631 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1632 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1633 <tag/Description/The function will set a new background color and return the
1634 old (current) one. The background color is valid for the whole text output
1635 area of the screen, not just for new text.
1636 <tag/Notes/<itemize>
1637 <item>Background colors are system dependent. The function may have no effect
1638 on systems where the background color cannot be changed.
1639 <item>The function is only available as fastcall function, so it may only be
1640 used in presence of a prototype.
1642 <tag/Availability/cc65
1644 <ref id="bordercolor" name="bordercolor">,
1645 <ref id="textcolor" name="textcolor">
1651 <sect1>bordercolor<label id="bordercolor"><p>
1655 <tag/Function/Set the border (frame) color.
1656 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1657 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1658 <tag/Description/The function will set a new border color. It returns the old
1659 (current) border color.
1660 <tag/Notes/<itemize>
1661 <item>Border colors are system dependent. The function may have no effect
1662 on systems where the border color cannot be changed.
1663 <item>The function is only available as fastcall function, so it may only
1664 be used in presence of a prototype.
1666 <tag/Availability/cc65
1668 <ref id="bgcolor" name="bgcolor">,
1669 <ref id="textcolor" name="textcolor">
1675 <sect1>bsearch<label id="bsearch"><p>
1679 <tag/Function/Do a binary search in a sorted array.
1680 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1681 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1682 const void* base, size_t n, size_t size,
1683 int __fastcall__ (* cmp) (const void*, const void*));/
1684 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1685 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1686 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1687 the function used to compare the members against the key. The function returns
1688 a pointer to the member found, or <tt/NULL/ if there was no match.
1689 <tag/Notes/<itemize>
1690 <item>The contents of the array must be sorted in ascending order according to
1691 the compare function given.
1692 <item>If there are multiple members that match the key, the function will
1693 return one of the members.
1694 <item>The function is only available as fastcall function, so it may only
1695 be used in presence of a prototype.
1696 <item>The function to which <tt/cmp/ points must have the <tt/fastcall/ calling
1699 <tag/Availability/ISO 9899
1701 <ref id="qsort" name="qsort">
1707 <sect1>bzero<label id="bzero"><p>
1711 <tag/Function/Fill a memory area with zeroes.
1712 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1713 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1714 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1716 <tag/Notes/<itemize>
1717 <item>The function is non standard and therefore only available in non ANSI
1718 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1719 <item>The function is only available as fastcall function, so it may only
1720 be used in presence of a prototype.
1722 <tag/Availability/cc65
1724 <ref id="_swap" name="_swap">,
1725 <ref id="memcpy" name="memcpy">,
1726 <ref id="memmove" name="memmove">,
1727 <ref id="memset" name="memset">,
1733 <sect1>c64mode<label id="c64mode"><p>
1737 <tag/Function/Switch the C128 into C64 compatible mode.
1738 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1739 <tag/Declaration/<tt/void c64mode (void);/
1740 <tag/Description/The function will cause the machine to reboot into C64 mode.
1741 <tag/Notes/<itemize>
1742 <item>The function is specific to the C128.
1743 <item>The function will not return to the caller.
1745 <tag/Availability/C128
1751 <sect1>calloc<label id="calloc"><p>
1755 <tag/Function/Allocate and clear memory.
1756 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1757 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1758 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1759 of size <tt/size/, clears the whole block with binary zeroes and returns a
1760 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1762 <tag/Notes/<itemize>
1763 <item>Clearing the memory may not have the expected effect on all platforms:
1764 pointers in the block may not be <tt/NULL/ and floating point variables may
1765 not be zero (0.0). In other words: The "clearing" effect of this function
1766 should be used with care for portable programs.
1767 <item>The function is only available as fastcall function, so it may only
1768 be used in presence of a prototype.
1770 <tag/Availability/ISO 9899
1772 <ref id="_heapadd" name="_heapadd">,
1773 <ref id="_heapblocksize" name="_heapblocksize">,
1774 <ref id="_heapmaxavail" name="_heapmaxavail">,
1775 <ref id="_heapmemavail" name="_heapmemavail">,
1776 <ref id="free" name="free">,
1777 <ref id="malloc" name="malloc">,
1778 <ref id="realloc" name="realloc">
1784 <sect1>cbm_k_acptr<label id="cbm_k_acptr"><p>
1788 <tag/Function/Input byte from serial bus
1789 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1790 <tag/Declaration/<tt/unsigned char cbm_k_acptr (void);/
1791 <tag/Description/The function returns a byte of data, which it
1792 gets from the current TALKer on the serial bus.
1793 In order to receive the data, the device must have previously been
1794 sent a command to TALK and a secondary address if it needs one.
1795 <tag/Notes/<itemize>
1798 <tag/Availability/cc65
1800 <ref id="cbm_k_talk" name="cbm_k_talk">,
1806 <sect1>cbm_k_basin<label id="cbm_k_basin"><p>
1810 <tag/Function/Input a Character from the Current Device
1811 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1812 <tag/Declaration/<tt/unsigned char cbm_k_basin (void);/
1813 <tag/Description/The function returns a character from the current input device.
1814 Device must first have been OPENed and then designated as the input channel by the CHKIN routine.
1815 When this function is called, the next byte of data available from the device is returned.
1816 Exception is the routine for the keyboard device (which is the default input device).
1817 <tag/Notes/<itemize>
1820 <tag/Availability/cc65
1822 <ref id="cbm_k_open" name="cbm_k_open">,
1823 <ref id="cbm_k_chkin" name="cbm_k_chkin">
1829 <sect1>cbm_k_bsout<label id="cbm_k_bsout"><p>
1833 <tag/Function/Output a byte
1834 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1835 <tag/Declaration/<tt/void __fastcall__ cbm_k_bsout (unsigned char C);/
1836 <tag/Description/Function sends the character to the current output device.
1837 Unless a device has been OPENed and designated as the
1838 current output channel using the CHKOUT routine, the character is
1839 printed to the screen, which is the default output device. If the
1840 cassette is the current device, outputting a byte will only add it to
1841 the buffer. No actual transmission of data will occur until the
1842 192-byte buffer is full.
1843 <tag/Notes/<itemize>
1844 <item>The function is only available as fastcall function, so it may
1845 only be used in presence of a prototype.
1847 <tag/Availability/cc65
1849 <ref id="cbm_k_open" name="cbm_k_open">,
1850 <ref id="cbm_k_chkin" name="cbm_k_chkout">
1856 <sect1>cbm_k_chkin<label id="cbm_k_chkin"><p>
1860 <tag/Function/Designate a Logical File As the Current Input Channel
1861 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1862 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_chkin (unsigned char FN);/
1863 <tag/Description/If you wish to
1864 get data from any device other than the keyboard, this function must be
1865 called after OPENing the device, before you can get a data byte with
1866 the cbm_k_basin or cbm_k_getin routine. When called, the routine will designate
1867 the logical file whose file number was supplied as the
1868 current file, its device as the current device, and its secondary
1869 address as the current secondary address. If the device on the
1870 channel is a serial device, which requires a TALK command and
1871 sometimes a secondary address, function will send them over the
1873 <tag/Notes/<itemize>
1874 <item>The function is only available as fastcall function, so it may
1875 only be used in presence of a prototype.
1877 <tag/Availability/cc65
1879 <ref id="cbm_k_open" name="cbm_k_open">,
1880 <ref id="cbm_k_basin" name="cbm_k_basin">,
1881 <ref id="cbm_k_getin" name="cbm_k_getin">
1887 <sect1>cbm_k_ciout<label id="cbm_k_ciout"><p>
1891 <tag/Function/Transmit a byte over the serial bus
1892 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1893 <tag/Declaration/<tt/void __fastcall__ cbm_k_ciout (unsigned char C);/
1894 <tag/Description/Purpose of this function is to send a byte of data over
1895 the serial bus. In order for the data to be received, the serial
1896 device must have first been commanded to LISTEN and been given a
1897 secondary address if necessary. This routine always buffers the
1898 current character, and defers sending it until the next byte is
1899 buffered. When the UNLISTEN command is sent, the last byte will be
1900 sent with an End or Identify (EOI).
1901 <tag/Notes/<itemize>
1902 <item>The function is only available as fastcall function, so it may
1903 only be used in presence of a prototype.
1905 <tag/Availability/cc65
1907 <ref id="cbm_k_listen" name="cbm_k_listen">,
1908 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">
1914 <sect1>cbm_k_ckout<label id="cbm_k_ckout"><p>
1918 <tag/Function/Designate a Logical File As the Current Output Channel
1919 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1920 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_ckout (unsigned char FN);/
1921 <tag/Description/If you wish to
1922 output data to any device other than the screen, this routine must be
1923 called after OPENing the device, and before you output a data byte
1924 with the cbm_k_bsout() function. When called, the function will designate the
1925 logical file whose file number was supplied as the current
1926 file, its device as the current device, and its secondary address as
1927 the current secondary address. If the device on the channel uses the
1928 serial bus, and therefore requires a LISTEN command and possibly a
1929 secondary address, this information will be sent on the bus.
1930 <tag/Notes/<itemize>
1931 <item>The function is only available as fastcall function, so it may
1932 only be used in presence of a prototype.
1934 <tag/Availability/cc65
1936 <ref id="cbm_k_bsout" name="cbm_k_bsout">,
1937 <ref id="cbm_k_listen" name="cbm_k_listen">
1943 <sect1>cbm_k_clall<label id="cbm_k_clall"><p>
1947 <tag/Function/Close All Logical I/O Files
1948 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1949 <tag/Declaration/<tt/void cbm_k_clall (void);/
1950 <tag/Description/It closes all
1951 open files, by resetting the index into open files to
1952 zero and restores the default I/O devices.
1953 <tag/Notes/<itemize>
1956 <tag/Availability/cc65
1958 <ref id="cbm_k_open" name="cbm_k_open">,
1959 <ref id="cbm_k_close" name="cbm_k_close">
1965 <sect1>cbm_k_close<label id="cbm_k_close"><p>
1969 <tag/Function/Close a Logical I/O File
1970 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1971 <tag/Declaration/<tt/void __fastcall__ cbm_k_close (unsigned char FN);/
1972 <tag/Description/It is used to
1973 close a logical file after all I/O operations involving that file have
1975 <tag/Notes/<itemize>
1976 <item>The function is only available as fastcall function, so it may
1977 only be used in presence of a prototype.
1979 <tag/Availability/cc65
1981 <ref id="cbm_k_open" name="cbm_k_open">,
1982 <ref id="cbm_k_clall" name="cbm_k_clall">
1988 <sect1>cbm_k_clrch<label id="cbm_k_clrch"><p>
1992 <tag/Function/Restore Current Input and Output Devices to the Default Devices
1993 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1994 <tag/Declaration/<tt/void cbm_k_clrch (void);/
1995 <tag/Description/It sets the
1996 current input device to the keyboard, and the current output device to
1997 the screen. Also, if the current input device was formerly a serial
1998 device, the routine sends it an UNTALK command on the serial bus, and
1999 if a serial device was formerly the current output device, the routine
2000 sends it an UNLISTEN command.
2001 <tag/Notes/<itemize>
2004 <tag/Availability/cc65
2006 <ref id="cbm_k_chkin" name="cbm_k_chkin">,
2007 <ref id="cbm_k_ckout" name="cbm_k_ckout">
2013 <sect1>cbm_k_getin<label id="cbm_k_getin"><p>
2017 <tag/Function/Get One Byte from the Input Device
2018 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2019 <tag/Declaration/<tt/unsigned char cbm_k_getin (void);/
2020 <tag/Description/Function gets a character from the current input device.
2021 <tag/Notes/<itemize>
2024 <tag/Availability/cc65
2026 <ref id="cbm_k_basin" name="cbm_k_basin">
2032 <sect1>cbm_k_iobase<label id="cbm_k_iobase"><p>
2036 <tag/Function/Return Base Address of Memory-Mapped I/O Devices
2037 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2038 <tag/Declaration/<tt/unsigned cbm_k_iobase (void);/
2039 <tag/Description/This function returns the address of
2040 the memory section where the memory mapped I/O devices are located. This
2041 address can then be used with an offset to access the memory mapped I/O
2042 devices in the Commodore 64. The offset is the number of locations from
2043 the beginning of the page on which the I/O register you want is located.
2044 This function exists to provide compatibility between the Commodore 64,
2045 VIC-20, and future models of the Commodore 64. If the I/O locations for
2046 a program are set by a call to this function, they should
2047 still remain compatible with future versions of the Commodore 64, the
2049 <tag/Notes/<itemize>
2052 <tag/Availability/cc65
2060 <sect1>cbm_k_listen<label id="cbm_k_listen"><p>
2064 <tag/Function/Command a device on the serial bus to LISTEN
2065 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2066 <tag/Declaration/<tt/void __fastcall__ cbm_k_listen (unsigned char dev);/
2067 <tag/Description/This function will command a device on the serial bus to
2068 receive data. The KERNAL routine will OR the supplied device number bit by bit
2069 to convert it to a listen address, then transmits this data as a command on
2070 the serial bus. The specified device will then go into listen mode, and
2071 be ready to accept information.
2072 <tag/Notes/<itemize>
2073 <item>The function is only available as fastcall function, so it may
2074 only be used in presence of a prototype.
2076 <tag/Availability/cc65
2078 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">,
2084 <sect1>cbm_k_load<label id="cbm_k_load"><p>
2088 <tag/Function/Load RAM from a Device
2089 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2090 <tag/Declaration/<tt/unsigned int __fastcall__ cbm_k_load(unsigned char flag, unsigned addr);/
2091 <tag/Description/This function LOADs data bytes from any input device directly into the memory.
2092 It can also be used for a verify operation, comparing data from a device with the data already in
2093 memory, while leaving the data stored in RAM unchanged.
2094 The flag must be set to 0 for a LOAD operation, or 1 for a
2095 verify, If the input device is OPENed with a secondary address (SA) of 0
2096 the header information from the device is ignored. In this case, the starting address for the load must be supplied.
2097 If the device is addressed with a secondary address of 1, then the data is
2098 loaded into memory starting at the location specified by the header.
2099 Function returns the address of the highest RAM location loaded.
2100 Before this function can be called, the KERNAL SETLFS, and SETNAM
2101 routines must be called.
2102 <tag/Notes/<itemize>
2103 <item>The function is only available as fastcall function, so it may
2104 only be used in presence of a prototype.
2106 <tag/Availability/cc65
2108 <ref id="cbm_k_save" name="cbm_k_save">,
2109 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2110 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2116 <sect1>cbm_k_open<label id="cbm_k_open"><p>
2120 <tag/Function/Open a Logical I/O File
2121 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2122 <tag/Declaration/<tt/unsigned char cbm_k_open (void);/
2123 <tag/Description/This function assigns a logical file to a device, so that it can be used for
2124 Input/Output operations. In order to specify the logical file number,
2125 the device number, and the secondary address if any, the cbm_k_setlfs() function must first be called.
2126 Likewise, in order to designate the filename, the cbm_k_setnam() function must be used first. After these two
2127 functions are called, cbm_k_open() is then called.
2128 <tag/Notes/<itemize>
2131 <tag/Availability/cc65
2133 <ref id="cbm_k_close" name="cbm_k_close">,
2134 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2135 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2141 <sect1>cbm_k_readst<label id="cbm_k_readst"><p>
2145 <tag/Function/Read status word
2146 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2147 <tag/Declaration/<tt/unsigned char cbm_k_readst (void);/
2148 <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.
2149 <tag/Notes/<itemize>
2152 <tag/Availability/cc65
2160 <sect1>cbm_k_save<label id="cbm_k_save"><p>
2164 <tag/Function/Save RAM to a Device
2165 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2166 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_save(unsigned int start, unsigned int end)/
2167 <tag/Description/This function saves a section of memory. The cbm_k_setlfs() and cbm_k_setnam() functions must be
2168 used before calling this function. However, a file name is not required to
2169 SAVE to device 1 (the Datassette(TM) recorder). Any attempt to save to
2170 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.
2171 <tag/Notes/<itemize>
2172 <item>The function is only available as fastcall function, so it may
2173 only be used in presence of a prototype.
2175 <tag/Availability/cc65
2177 <ref id="cbm_k_load" name="cbm_k_load">,
2178 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2179 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2185 <sect1>cbm_k_scnkey<label id="cbm_k_scnkey"><p>
2189 <tag/Function/Scan the keyboard matrix.
2190 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2191 <tag/Declaration/<tt/void cbm_k_scnkey (void);/
2192 <tag/Description/This function looks at the switches in the keyboard, to see
2193 if any of them are being pressed. If they are, then code numbers for them are
2194 stored in RAM. Other functions use those numbers to input text. Normally,
2195 the keyboard is scanned by the Kernal's Interrupt Service Routine. But, if
2196 you divert the "Jiffy interrupt" to a C-code ISR, then that ISR must call this
2197 function, in order to provide input from the keyboard.
2198 <tag/Availability/cc65
2200 <ref id="cbm_k_getin" name="cbm_k_getin">,
2201 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2202 <ref id="cgetc" name="cgetc">,
2203 <!-- <ref id="getc" name="getc"> -->
2204 <!-- <ref id="getchar" name="getchar"> -->
2210 <sect1>cbm_k_setlfs<label id="cbm_k_setlfs"><p>
2214 <tag/Function/Set up a logical file
2215 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2216 <tag/Declaration/<tt/void __fastcall__ cbm_k_setlfs (unsigned char LFN, unsigned char DEV, unsigned char SA);/
2217 <tag/Description/This functions sets up the logical file by setting its number, device address,
2218 and secondary address.
2219 <tag/Notes/<itemize>
2220 <item>The function is only available as fastcall function, so it may
2221 only be used in presence of a prototype.
2223 <tag/Availability/cc65
2225 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2231 <sect1>cbm_k_setnam<label id="cbm_k_setnam"><p>
2235 <tag/Function/Set Filename Parameters
2236 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2237 <tag/Declaration/<tt/void __fastcall__ cbm_k_setnam (const char* Name);/
2238 <tag/Description/This function is used to set up the file name for the OPEN,
2239 SAVE, or LOAD operations.
2240 <tag/Notes/<itemize>
2241 <item>The function is only available as fastcall function, so it may
2242 only be used in presence of a prototype.
2244 <tag/Availability/cc65
2246 <ref id="cbm_k_open" name="cbm_k_open">,
2247 <ref id="cbm_k_load" name="cbm_k_load">,
2248 <ref id="cbm_k_save" name="cbm_k_save">
2254 <sect1>cbm_k_talk<label id="cbm_k_talk"><p>
2258 <tag/Function/Commands device to TALK
2259 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2260 <tag/Declaration/<tt/void __fastcall__ cbm_k_talk (unsigned char dev);/
2261 <tag/Description/When called, it ORs the device number with the TALK code (64, $40) and sends it on the serial
2262 bus. This commands the device to TALK.
2263 <tag/Notes/<itemize>
2264 <item>The function is only available as fastcall function, so it may
2265 only be used in presence of a prototype.
2267 <tag/Availability/cc65
2269 <ref id="cbm_k_acptr" name="cbm_k_acptr">
2275 <sect1>cbm_k_udtim<label id="cbm_k_udtim"><p>
2279 <tag/Function/Update the Jiffy clock.
2280 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2281 <tag/Declaration/<tt/void cbm_k_udtim (void);/
2282 <tag/Description/This function adds one count to the Jiffy clock. That clock
2283 counts sixtieths of a second. It is used by the library's <tt/clock()/
2284 function. Normally, the Jiffy clock is updated by the Kernal's Interrupt
2285 Service Routine. But, if you divert the "Jiffy interrupt" to a C-code ISR,
2286 then that ISR must call this function, in order to keep the clock valid.
2287 <tag/Availability/cc65
2289 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2290 <ref id="clock" name="clock">
2296 <sect1>cbm_k_unlsn<label id="cbm_k_unlsn"><p>
2300 <tag/Function/Send an UNLISTEN command
2301 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2302 <tag/Declaration/<tt/void cbm_k_unlsn (void);/
2303 <tag/Description/This function commands all devices on the serial bus to
2304 stop receiving data from the host computer (i.e., UNLISTEN). Calling this
2305 function results in an UNLISTEN command being transmitted on the serial
2306 bus. Only devices previously commanded to LISTEN are affected. This
2307 function is normally used after the host computer is finished sending data
2308 to external devices. Sending the UNLISTEN commands the listening devices
2309 to get off the serial bus so it can be used for other purposes.
2310 <tag/Notes/<itemize>
2313 <tag/Availability/cc65
2315 <ref id="cbm_k_listen" name="cbm_k_listen">
2321 <sect1>cclear<label id="cclear"><p>
2325 <tag/Function/Clear part of a line (write a given number of spaces).
2326 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2327 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
2328 <tag/Description/The function clears part of a line by writing <tt/length/
2329 spaces in the current text color.
2330 <tag/Notes/<itemize>
2331 <item>The function is only available as fastcall function, so it may
2332 only be used in presence of a prototype.
2334 <tag/Availability/cc65
2336 <ref id="cclearxy" name="cclearxy">,
2337 <ref id="clrscr" name="clrscr">
2343 <sect1>cclearxy<label id="cclearxy"><p>
2347 <tag/Function/Clear part of a line (write a given number of spaces) starting
2348 at a specific screen position.
2349 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2350 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
2351 <tag/Description/The function moves the cursor to a specific position, and
2352 will then clear part of the line by writing <tt/length/ spaces in the current
2354 <tag/Notes/<itemize>
2355 <item>The function is only available as fastcall function, so it may
2356 only be used in presence of a prototype.
2358 <tag/Availability/cc65
2360 <ref id="cclear" name="cclear">,
2361 <ref id="clrscr" name="clrscr">
2367 <sect1>cgetc<label id="cgetc"><p>
2371 <tag/Function/Read a character from the keyboard.
2372 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2373 <tag/Declaration/<tt/char cgetc (void);/
2374 <tag/Description/The function reads a character from the keyboard. If there is
2375 no character available, <tt/cgetc()/ waits until the user presses a key. If the
2376 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
2377 displayed while waiting.
2378 <tag/Notes/<itemize>
2379 <item>If the system supports a keyboard buffer, <tt/cgetc()/ will fetch a key
2380 from that buffer; and, wait only if the buffer is empty.
2381 <item>The keyboard must be scanned periodically, in order for this function to
2382 see anything that you type. (See the description of <tt/cbm_k_scnkey()/.)
2384 <tag/Availability/cc65
2386 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2387 <ref id="cursor" name="cursor">,
2388 <ref id="kbhit" name="kbhit">
2394 <sect1>chline<label id="chline"><p>
2398 <tag/Function/Output a horizontal line in text mode.
2399 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2400 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
2401 <tag/Description/The function outputs a horizontal line with the given length
2402 starting at the current cursor position.
2403 <tag/Notes/<itemize>
2404 <item>The character used to draw the horizontal line is system dependent.
2405 If available, a line drawing character is used. Drawing a line that is partially
2406 off screen leads to undefined behaviour.
2407 <item>The function is only available as fastcall function, so it may only be
2408 used in presence of a prototype.
2410 <tag/Availability/cc65
2412 <ref id="chlinexy" name="chlinexy">,
2413 <ref id="cvline" name="cvline">,
2414 <ref id="cvlinexy" name="cvlinexy">
2420 <sect1>chlinexy<label id="chlinexy"><p>
2424 <tag/Function/Output a horizontal line at a given position in text mode.
2425 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2426 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
2427 <tag/Description/The function outputs a horizontal line with the given length
2428 starting at a given position.
2429 <tag/Notes/<itemize>
2430 <item>The character used to draw the horizontal line is system dependent.
2431 If available, a line drawing character is used. Drawing a line that is partially
2432 off screen leads to undefined behaviour.
2433 <item>The function is only available as fastcall function, so it may only be
2434 used in presence of a prototype.
2436 <tag/Availability/cc65
2438 <ref id="chline" name="chline">,
2439 <ref id="cvline" name="cvline">,
2440 <ref id="cvlinexy" name="cvlinexy">
2446 <sect1>clearerr<label id="clearerr"><p>
2450 <tag/Function/Clear error and end-of-file status of a stream.
2451 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2452 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
2453 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
2454 indicators for the stream <tt/f/.
2455 <tag/Notes/<itemize>
2456 <item>The function is only available as fastcall function, so it may only be
2457 used in presence of a prototype.
2459 <tag/Availability/ISO 9899
2461 <ref id="feof" name="feof">,
2462 <ref id="ferror" name="ferror">
2468 <sect1>clock<label id="clock"><p>
2472 <tag/Function/Determine the processor time used.
2473 <tag/Header/<tt/<ref id="time.h" name="time.h">/
2474 <tag/Declaration/<tt/clock_t clock (void);/
2475 <tag/Description/The <tt/clock/ function returns an approximaton of processor
2476 time used by the program. The time is returned in implementation-defined
2477 units. It can be converted to seconds by dividing by the value of the macro
2478 <tt/CLOCKS_PER_SEC/.
2479 <tag/Notes/<itemize>
2480 <item>Since the machines that cc65-generated programs run on cannot run multiple
2481 processes, the function actually will return the time since some
2482 implementation-defined point in the past.
2483 <item>The Jiffy clock must be "running", in order for this function to return
2484 changing values. (See the description of <tt/cbm_k_udtim()/.)
2486 <tag/Availability/ISO 9899
2488 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2489 <ref id="time" name="time">
2495 <sect1>clrscr<label id="clrscr"><p>
2499 <tag/Function/Clear the text screen.
2500 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2501 <tag/Declaration/<tt/void clrscr (void);/
2502 <tag/Description/The function clears the text screen and moves the cursor to
2503 the upper left corner.
2504 <tag/Availability/cc65
2506 <ref id="cclear" name="cclear">,
2507 <ref id="cclearxy" name="cclearxy">
2513 <sect1>close<label id="close"><p>
2517 <tag/Function/Close a file descriptor.
2518 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2519 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
2520 <tag/Description/The function closes the given file descriptor. It returns zero
2521 on success and -1 on error. If an error occurs, the cause can be determined by
2522 reading the <tt/errno/ variable.
2523 <tag/Notes/<itemize>
2524 <item>The function is only available as fastcall function, so it may only
2525 be used in presence of a prototype.
2527 <tag/Availability/POSIX 1003.1
2529 <ref id="creat" name="creat">,
2530 <ref id="open" name="open">
2536 <sect1>closedir<label id="closedir"><p>
2540 <tag/Function/Close a directory.
2541 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
2542 <tag/Declaration/<tt/int __fastcall__ closedir (DIR* dir);/
2543 <tag/Description/The function closes the given directory descriptor. It returns
2544 zero on success and -1 on error. If an error occurs, the cause can be determined
2545 by reading the <tt/errno/ variable.
2546 <tag/Notes/<itemize>
2547 <item>The function is only available as fastcall function, so it may only
2548 be used in presence of a prototype.
2550 <tag/Availability/POSIX 1003.1
2552 <ref id="opendir" name="opendir">,
2553 <ref id="readdir" name="readdir">
2559 <sect1>cpeekc<label id="cpeekc"><p>
2563 <tag/Function/Get a character from the display memory.
2564 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2565 <tag/Declaration/<tt/char cpeekc (void);/
2566 <tag/Description/The function gets the character that's at the current location
2567 of the cursor in the display screen RAM. That character is converted, if
2568 needed, into the encoding that can be passed to <tt/cputc()/.
2569 <tag/Notes/<itemize>
2570 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2571 done to make it obvious that peeking doesn't move the cursor in any way. Your
2572 program must place the cursor where it wants to peek before it calls any of
2575 <tag/Availability/cc65
2577 <ref id="cpeekcolor" name="cpeekcolor">,
2578 <ref id="cpeekrevers" name="cpeekrevers">,
2579 <ref id="cpeeks" name="cpeeks">,
2580 <ref id="cputc" name="cputc">
2586 <sect1>cpeekcolor<label id="cpeekcolor"><p>
2590 <tag/Function/Get a color from the display memory.
2591 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2592 <tag/Declaration/<tt/unsigned char cpeekcolor (void);/
2593 <tag/Description/The function gets the color number that's at the current
2594 location of the cursor in the display screen RAM. That number can be passed to
2596 <tag/Notes/<itemize>
2597 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2598 done to make it obvious that peeking doesn't move the cursor in any way. Your
2599 program must place the cursor where it wants to peek before it calls any of
2602 <tag/Availability/cc65
2604 <ref id="cpeekc" name="cpeekc">,
2605 <ref id="cpeekrevers" name="cpeekrevers">,
2606 <ref id="cpeeks" name="cpeeks">,
2607 <ref id="cputc" name="cputc">,
2608 <ref id="textcolor" name="textcolor">
2614 <sect1>cpeekrevers<label id="cpeekrevers"><p>
2618 <tag/Function/Get a reverse-character attribute from the display memory.
2619 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2620 <tag/Declaration/<tt/unsigned char cpeekrevers (void);/
2621 <tag/Description/The function gets the "reverse-mode" attribute of the
2622 character that's at the current location of the cursor in the display screen
2623 RAM. It returns a boolean value (0/1) that can be passed to <tt/revers()/.
2624 <tag/Notes/<itemize>
2625 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2626 done to make it obvious that peeking doesn't move the cursor in any way. Your
2627 program must place the cursor where it wants to peek before it calls any of
2630 <tag/Availability/cc65
2632 <ref id="cpeekc" name="cpeekc">,
2633 <ref id="cpeekcolor" name="cpeekcolor">,
2634 <ref id="cpeeks" name="cpeeks">,
2635 <ref id="cputc" name="cputc">,
2636 <ref id="revers" name="revers">
2642 <sect1>cpeeks<label id="cpeeks"><p>
2646 <tag/Function/Get a string from the display memory.
2647 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2648 <tag/Declaration/<tt/void __fastcall__ cpeeks (char* s, unsigned length);/
2649 <tag/Description/The function gets a fixed-length string ('\0'-terminated) of
2650 characters that start at the current location of the cursor in the display
2651 screen RAM. Those characters are converted, if needed, into the encoding that
2652 can be passed to <tt/cputs()/. The first argument must point to a RAM area
2653 that's large enough to hold "length + 1" bytes.
2654 <tag/Notes/<itemize>
2655 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2656 done to make it obvious that peeking doesn't move the cursor in any way. Your
2657 program must place the cursor where it wants to peek before it calls any of
2659 <item>The function is available as only a fastcall function;
2660 so, it may be used only in the presence of a prototype.
2662 <tag/Availability/cc65
2664 <ref id="cpeekc" name="cpeekc">,
2665 <ref id="cpeekcolor" name="cpeekcolor">,
2666 <ref id="cpeekrevers" name="cpeekrevers">,
2667 <ref id="cputc" name="cputc">,
2668 <ref id="cputs" name="cputs">
2674 <sect1>creat<label id="creat"><p>
2678 <tag/Function/Create a file.
2679 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2680 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
2681 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
2682 associated with it. On error, -1 is returned and an error code is stored in
2684 <tag/Notes/<itemize>
2685 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
2686 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
2687 <item>The function is only available as fastcall function, so it may only
2688 be used in presence of a prototype.
2690 <tag/Availability/POSIX 1003.1
2692 <ref id="close" name="close">,
2693 <ref id="open" name="open">
2699 <sect1>cprintf<label id="cprintf"><p>
2703 <tag/Function/Formatted output to the console.
2704 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2705 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
2706 <tag/Description/The arguments are converted to text where necessary and
2707 formatted according to the format string given. The resulting string is output
2708 to the console. <tt/cprintf/ supports the same format specifiers as
2709 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
2710 <tag/Notes/<itemize>
2711 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
2712 between <tt/\r/ and <tt/\n/.
2714 <tag/Availability/cc65
2716 <ref id="cputc" name="cputc">,
2717 <ref id="cputcxy" name="cputcxy">,
2718 <ref id="cputs" name="cputs">,
2719 <ref id="cputsxy" name="cputsxy">,
2720 <ref id="vcprintf" name="vcprintf">
2726 <sect1>cputc<label id="cputc"><p>
2730 <tag/Function/Output a character directly to the console.
2731 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2732 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
2733 <tag/Description/Output one character to the console at the current cursor
2735 <tag/Notes/<itemize>
2736 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
2737 between <tt/\r/ and <tt/\n/.
2738 <item>The function is only available as fastcall function, so it may only
2739 be used in presence of a prototype.
2741 <tag/Availability/cc65
2743 <ref id="cprintf" name="cprintf">,
2744 <ref id="cputcxy" name="cputcxy">,
2745 <ref id="cputs" name="cputs">,
2746 <ref id="cputsxy" name="cputsxy">,
2747 <ref id="vcprintf" name="vcprintf">
2753 <sect1>cputcxy<label id="cputcxy"><p>
2757 <tag/Function/Output a character at a specific screen position.
2758 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2759 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
2760 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
2761 the screen and outputs one character.
2762 <tag/Notes/<itemize>
2763 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
2764 between <tt/\r/ and <tt/\n/.
2765 <item>The function is only available as fastcall function, so it may only
2766 be used in presence of a prototype.
2768 <tag/Availability/cc65
2770 <ref id="cprintf" name="cprintf">,
2771 <ref id="cputc" name="cputc">,
2772 <ref id="cputs" name="cputs">,
2773 <ref id="cputsxy" name="cputsxy">,
2774 <ref id="vcprintf" name="vcprintf">
2780 <sect1>cputs<label id="cputs"><p>
2784 <tag/Function/Output a string directly to the console.
2785 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2786 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
2787 <tag/Description/The function outputs the given string on the console at the
2788 current cursor position.
2789 <tag/Notes/<itemize>
2790 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
2791 between <tt/\r/ and <tt/\n/.
2792 <item>The function is only available as fastcall function, so it may only
2793 be used in presence of a prototype.
2795 <tag/Availability/cc65
2797 <ref id="cprintf" name="cprintf">,
2798 <ref id="cputc" name="cputc">,
2799 <ref id="cputcxy" name="cputcxy">,
2800 <ref id="cputsxy" name="cputsxy">,
2801 <ref id="vcprintf" name="vcprintf">
2807 <sect1>cputsxy<label id="cputsxy"><p>
2811 <tag/Function/Output a string to the console at a given position.
2812 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2813 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
2814 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
2815 and outputs the string <tt/s/.
2816 <tag/Notes/<itemize>
2817 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
2818 between <tt/\r/ and <tt/\n/.
2819 <item>The function is only available as fastcall function, so it may only
2820 be used in presence of a prototype.
2822 <tag/Availability/cc65
2824 <ref id="cprintf" name="cprintf">,
2825 <ref id="cputc" name="cputc">,
2826 <ref id="cputcxy" name="cputcxy">,
2827 <ref id="cputs" name="cputs">,
2828 <ref id="vcprintf" name="vcprintf">
2834 <sect1>cursor<label id="cursor"><p>
2838 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
2839 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2840 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
2841 <tag/Description/If the argument to the function is non zero, a blinking cursor
2842 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
2843 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
2844 <tag/Notes/<itemize>
2845 <item>The function is only available as fastcall function, so it may only
2846 be used in presence of a prototype.
2848 <tag/Availability/cc65
2850 <ref id="cgetc" name="cgetc">,
2851 <ref id="kbhit" name="kbhit">
2857 <sect1>cvline<label id="cvline"><p>
2861 <tag/Function/Output a vertical line in text mode.
2862 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2863 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
2864 <tag/Description/The function outputs a vertical line with the given length
2865 starting at the current cursor position.
2866 <tag/Notes/<itemize>
2867 <item>The character used to draw the vertical line is system dependent.
2868 If available, a line drawing character is used. Drawing a line that is partially
2869 off screen leads to undefined behaviour.
2870 <item>The function is only available as fastcall function, so it may only be
2871 used in presence of a prototype.
2873 <tag/Availability/cc65
2875 <ref id="chline" name="chline">,
2876 <ref id="chlinexy" name="chlinexy">,
2877 <ref id="cvlinexy" name="cvlinexy">
2883 <sect1>cvlinexy<label id="cvlinexy"><p>
2887 <tag/Function/Output a vertical line at a given position in text mode.
2888 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2889 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
2890 <tag/Description/The function outputs a vertical line with the given length
2891 starting at a given position.
2892 <tag/Notes/<itemize>
2893 <item>The character used to draw the vertical line is system dependent.
2894 If available, a line drawing character is used. Drawing a line that is partially
2895 off screen leads to undefined behaviour.
2896 <item>The function is only available as fastcall function, so it may only be
2897 used in presence of a prototype.
2899 <tag/Availability/cc65
2901 <ref id="chline" name="chline">,
2902 <ref id="chlinexy" name="chlinexy">,
2903 <ref id="cvline" name="cvline">
2909 <sect1>decompress_lz4<label id="decompress_lz4"><p>
2913 <tag/Function/Uncompress a LZ4-compressed buffer.
2914 <tag/Header/<tt/<ref id="lz4.h" name="lz4.h">/
2915 <tag/Declaration/<tt/void decompress_lz4 (const unsigned char* src, unsigned char* const dst, const unsigned short uncompressed_size);/
2916 <tag/Description/<tt/decompress_lz4/ uncompresses a LZ4-compressed buffer.
2917 <tag/Notes/<itemize>
2918 <item>Use LZ4_compress_HC with compression level 16 for best compression.
2920 <tag/Availability/cc65
2926 <sect1>detect_c64dtv<label id="detect_c64dtv"><p>
2930 <tag/Function/Check for the presence of the C64DTV.
2931 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
2932 <tag/Declaration/<tt/unsigned char detect_c64dtv (void);/
2933 <tag/Description/The function returns a 1 if a C64DTV has been detected.
2934 <tag/Notes/<itemize>
2935 <item>The function is specific to the C64.
2937 <tag/Availability/cc65 (not all platforms)
2939 <ref id="get_c64dtv_speed" name="get_c64dtv_speed">,
2940 <ref id="set_c64dtv_speed" name="set_c64dtv_speed">,
2946 <sect1>detect_scpu<label id="detect_scpu"><p>
2950 <tag/Function/Check for the presence of the C64/C128 SuperCPU cartridge.
2951 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
2952 <tag/Declaration/<tt/unsigned char detect_scpu (void);/
2953 <tag/Description/The function returns a 1 if a SuperCPU cartridge has been detected.
2954 <tag/Notes/<itemize>
2955 <item>The function is specific to the C128 and C64.
2957 <tag/Availability/cc65 (not all platforms)
2959 <ref id="get_scpu_speed" name="get_scpu_speed">,
2960 <ref id="set_scpu_speed" name="set_scpu_speed">,
2966 <sect1>div<label id="div"><p>
2970 <tag/Function/Divide two ints and return quotient and remainder.
2971 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2972 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
2973 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
2974 quotient and remainder in a <tt/div_t/ structure.
2975 <tag/Notes/<itemize>
2976 <item>The function is only available as fastcall function, so it may only
2977 be used in presence of a prototype.
2979 <tag/Availability/ISO 9899
2987 <sect1>doesclrscrafterexit<label id="doesclrscrafterexit"><p>
2991 <tag/Function/Determines whether the screen is going to be cleared after program exit.
2992 <tag/Header/<tt/<ref id="cc65.h" name="cc65.h">/
2993 <tag/Declaration/<tt/unsigned char doesclrscrafterexit (void);/
2994 <tag/Description/The function returns zero if the screen won't be cleared immediately after
2995 program termination. It returns a non-zero value if it will.
2996 <tag/Notes/<itemize>
2997 <item>Some systems, maybe depending on configuration, immediately clear the screen
2998 after a program exits. Therefore it might be difficult to read
2999 the last messages printed by the program prior to its exit. This function can be used
3000 to decide if a delay or wait for a key press should be executed when then program
3003 <tag/Availability/cc65
3006 #include <stdio.h>
3007 #include <unistd.h>
3008 #include <cc65.h>
3011 printf("Hello World\n");
3012 if (doesclrscrafterexit())
3021 <sect1>em_commit<label id="em_commit"><p>
3025 <tag/Function/Commit changes into extended memory.
3026 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3027 <tag/Declaration/<tt/void em_commit (void);/
3028 <tag/Description/Commit changes in the memory window to extended storage. If
3029 the contents of the memory window have been changed, these changes may be lost
3030 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
3031 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
3032 name="em_copyto">/ are called without calling <tt/em_commit/ first.
3033 <tag/Notes/<itemize>
3034 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
3035 memory window are discarded, it does just mean that the drivers is allowed
3037 <item>The function is only available as fastcall function, so it may only be
3038 used in presence of a prototype.
3039 <item>The function produces undefined results if no extended memory driver is
3042 <tag/Availability/cc65
3044 <ref id="em_load_driver" name="em_load_driver">,
3045 <ref id="em_map" name="em_map">,
3046 <ref id="em_use" name="em_use">
3052 <sect1>em_copyfrom<label id="em_copyfrom"><p>
3056 <tag/Function/Copy from extended into normal memory.
3057 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3058 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
3059 <tag/Description/Copy data from extended memory into linear memory. Source and
3060 target addresses as well as the number of bytes to transfer are specified in
3061 the <tt/em_copy/ structure that is passed as a parameter.
3062 <tag/Notes/<itemize>
3063 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
3064 made any changes to the data in the window, call <tt/<ref id="em_commit"
3065 name="em_commit">/ first, or the changes are lost.
3066 <item>The function is only available as fastcall function, so it may only be
3067 used in presence of a prototype.
3068 <item>The function produces undefined results if no extended memory driver is
3071 <tag/Availability/cc65
3073 <ref id="em_commit" name="em_commit">,
3074 <ref id="em_copyto" name="em_copyto">,
3075 <ref id="em_load_driver" name="em_load_driver">
3081 <sect1>em_copyto<label id="em_copyto"><p>
3085 <tag/Function/Copy from normal into extended memory.
3086 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3087 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
3088 <tag/Description/Copy data from linear into extended memory. Source and
3089 target addresses as well as the number of bytes to transfer are specified in
3090 the <tt/em_copy/ structure that is passed as a parameter.
3091 <tag/Notes/<itemize>
3092 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
3093 made any changes to the data in the window, call <tt/<ref id="em_commit"
3094 name="em_commit">/ first, or the changes are lost.
3095 <item>The function is only available as fastcall function, so it may only be
3096 used in presence of a prototype.
3097 <item>The function produces undefined results if no extended memory driver is
3100 <tag/Availability/cc65
3102 <ref id="em_commit" name="em_commit">,
3103 <ref id="em_copyfrom" name="em_copyfrom">,
3104 <ref id="em_load_driver" name="em_load_driver">
3110 <sect1>em_install<label id="em_install"><p>
3114 <tag/Function/Install an already loaded extended memory driver.
3115 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3116 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
3117 <tag/Description/The function installs an already loaded extended memory driver
3118 and returns an error code. The function may be used to install a driver linked
3119 statically to the program.
3120 <tag/Notes/<itemize>
3121 <item>Not all drivers are able to detect if the supported hardware is really
3123 <item>The function is only available as fastcall function, so it may only be
3124 used in presence of a prototype.
3126 <tag/Availability/cc65
3128 <ref id="em_load_driver" name="em_load_driver">,
3129 <ref id="em_uninstall" name="em_uninstall">,
3130 <ref id="em_unload" name="em_unload">
3136 <sect1>em_load_driver<label id="em_load_driver"><p>
3140 <tag/Function/Load and initialize an extended memory driver.
3141 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3142 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
3143 <tag/Description/Load an extended memory driver into memory and initialize
3144 it. The function returns an error code that tells if all this has been
3146 <tag/Notes/<itemize>
3147 <item>Not all drivers are able to detect if the supported hardware is really
3149 <item>The function is only available as fastcall function, so it may only be
3150 used in presence of a prototype.
3151 <item>The driver is loaded by name, so currently you must know the type of
3152 extended memory that should be supported. There is no autodetect capability.
3154 <tag/Availability/cc65
3156 <ref id="em_unload" name="em_unload">
3162 <sect1>em_map<label id="em_map"><p>
3166 <tag/Function/Make a page of extended memory accessible.
3167 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3168 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
3169 <tag/Description/The function maps one page of extended memory into linear
3170 memory and returns a pointer to the page frame. Depending on the hardware
3171 and driver, the data is either mapped into the address space or transfered
3172 into a buffer. If you don't need the actual contents of the page (for example
3173 because you're going to overwrite it completely), it is better to call
3174 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
3175 data if it is possible to avoid that.
3176 <tag/Notes/<itemize>
3177 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
3178 made any changes to the data in the window, call <tt/<ref id="em_commit"
3179 name="em_commit">/ first, or the changes are lost.
3180 <item>The function is only available as fastcall function, so it may only be
3181 used in presence of a prototype.
3182 <item>The function produces undefined results if no extended memory driver is
3185 <tag/Availability/cc65
3187 <ref id="em_commit" name="em_commit">,
3188 <ref id="em_load_driver" name="em_load_driver">,
3189 <ref id="em_use" name="em_use">
3195 <sect1>em_pagecount<label id="em_pagecount"><p>
3199 <tag/Function/Return the number of available extended memory pages.
3200 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3201 <tag/Declaration/<tt/unsigned em_pagecount (void);/
3202 <tag/Description/The function returns the size of the extended memory supported
3203 by the driver in 256 byte pages.
3204 <tag/Notes/<itemize>
3205 <item>The function returns zero if no extended memory driver is loaded.
3206 <item>The function may return zero if the supported hardware was not detected.
3208 <tag/Availability/cc65
3210 <ref id="em_load_driver" name="em_load_driver">
3216 <sect1>em_uninstall<label id="em_uninstall"><p>
3220 <tag/Function/Uninstall an already loaded extended memory driver.
3221 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3222 <tag/Declaration/<tt/unsigned char em_uninstall (void);/
3223 <tag/Description/The function uninstalls an already loaded extended memory
3224 driver but doesn't remove it from memory.
3225 <tag/Notes/<itemize>
3226 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
3227 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
3228 should be used instead of <tt/em_uninstall/ so the driver is also removed
3231 <tag/Availability/cc65
3233 <ref id="em_install" name="em_install">,
3234 <ref id="em_load_driver" name="em_load_driver">,
3235 <ref id="em_unload" name="em_unload">
3241 <sect1>em_unload<label id="em_unload"><p>
3245 <tag/Function/Unload an extended memory driver.
3246 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3247 <tag/Declaration/<tt/unsigned char em_unload (void);/
3248 <tag/Description/The function unloads a loaded extended memory driver and
3249 frees all memory allocated for the driver.
3250 <tag/Notes/<itemize>
3251 <item>The function does nothing if no driver is loaded.
3253 <tag/Availability/cc65
3255 <ref id="em_load_driver" name="em_load_driver">
3261 <sect1>em_use<label id="em_use"><p>
3265 <tag/Function/Prepare an extended memory page for use.
3266 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3267 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
3268 <tag/Description/The function maps one page of extended memory into linear
3269 memory and returns a pointer to the page frame. This function is similar to
3270 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
3271 actual memory window in the assumption that the existing data is wrong or
3272 will get overwritten.
3273 <tag/Notes/<itemize>
3274 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
3275 made any changes to the data in the window, call <tt/<ref id="em_commit"
3276 name="em_commit">/ first, or the changes are lost.
3277 <item>The function is only available as fastcall function, so it may only be
3278 used in presence of a prototype.
3279 <item>The function produces undefined results if no extended memory driver is
3282 <tag/Availability/cc65
3284 <ref id="em_commit" name="em_commit">,
3285 <ref id="em_load_driver" name="em_load_driver">,
3286 <ref id="em_map" name="em_map">
3292 <sect1>exit<label id="exit"><p>
3296 <tag/Function/Terminate the program.
3297 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3298 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
3299 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
3300 return code of the program. Before termination, all files are closed, buffered
3301 output is written and any functions registered with <tt/<ref id="atexit"
3302 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
3303 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
3305 <tag/Notes/<itemize>
3306 <item>The function is only available as fastcall function, so it may only
3307 be used in presence of a prototype.
3308 <item>It depends on the host machine if the program return code can be
3309 evaluated or is ignored.
3311 <tag/Availability/ISO 9899
3313 <ref id="abort" name="abort">,
3314 <ref id="exit" name="exit">
3320 <sect1>exec<label id="exec"><p>
3324 <tag/Function/Execute a program file.
3325 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3326 <tag/Declaration/<tt/int __fastcall__ exec (const char* progname, const char* cmdline);/
3327 <tag/Description/<tt/exec/ replaces the currently running program by a new one.
3328 Calling <tt/exec()/ is identical to calling <tt/<ref id="exit" name="exit()">/,
3329 then loading and starting the program named in the first argument, passing
3330 the command line specified as second argument. Instead of an empty string,
3331 a <tt/NULL/ pointer may be passed as second parameter.
3332 On success, the function does not return. On failure, -1 is returned and
3333 <tt/errno/ contains an error code.
3334 <tag/Notes/<itemize>
3335 <item>The function is only available as fastcall function, so it may only
3336 be used in presence of a prototype.
3337 <item>On most platforms, the function needs to copy a small stub loader to
3338 some memory area outside the program space. This may collide with other
3339 programs. See the platform specific docs on this.
3340 <item>Because it is necessary to terminate the running program before the
3341 memory can be reused to load the new one, there is a high chance that the
3342 function may not be able to return on errors.
3343 <item>The command line is passed to the new program in the same way as cc65
3344 programs expect the command line. If the new program is not a cc65 generated
3345 program, it may not be able to read it.
3347 <tag/Availability/cc65
3349 <ref id="exit" name="exit">
3355 <sect1>fast<label id="fast"><p>
3359 <tag/Function/Switch the CPU into fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
3360 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
3361 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
3362 <tag/Declaration/<tt/void fast (void);/
3363 <tag/Description/The function will switch the clock of the CPU to fast mode. For the C128
3364 target it means switching the CPU into 2MHz mode. For the C16/Plus4 target it means
3365 switching the CPU into double clock mode.
3366 <tag/Notes/<itemize>
3367 <item>The function is specific to the C128, C16 and Plus4.
3368 <item>On the C128 the 2MHz clock will not work in 40 column mode.
3370 <tag/Availability/cc65 (not all platforms)
3372 <ref id="isfast" name="isfast">,
3373 <ref id="slow" name="slow">,
3379 <sect1>feof<label id="feof"><p>
3383 <tag/Function/Return the end-of-file indicator of a stream.
3384 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3385 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
3386 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
3387 <tt/f/, and returns a non zero value if it is set.
3388 <tag/Notes/<itemize>
3389 <item>The indicator is set only after a read past the end of a file is
3391 <item>The function is only available as fastcall function, so it may only be
3392 used in presence of a prototype.
3394 <tag/Availability/ISO 9899
3396 <ref id="feof" name="clearerr">,
3397 <ref id="ferror" name="ferror">
3403 <sect1>ferror<label id="ferror"><p>
3407 <tag/Function/Return the error indicator of a stream.
3408 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3409 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
3410 <tag/Description/<tt/ferror/ tests the error indicator of the stream
3411 <tt/f/, and returns a non zero value if it is set.
3412 <tag/Notes/<itemize>
3413 <item>The function is only available as fastcall function, so it may only be
3414 used in presence of a prototype.
3416 <tag/Availability/ISO 9899
3418 <ref id="feof" name="clearerr">,
3419 <ref id="ferror" name="feof">
3425 <sect1>fileno<label id="fileno"><p>
3429 <tag/Function/Return the file handle used by a stream.
3430 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3431 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
3432 <tag/Description/The <tt/fileno/ function returns the file handle used
3433 internally by a C stream. This file handle (an integer) can be used as a
3434 handle for the POSIX input/output functions.
3435 <tag/Notes/<itemize>
3436 <item>The function is only available as fastcall function, so it may only be
3437 used in presence of a prototype.
3438 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
3439 file may have unpredictable results.
3441 <tag/Availability/POSIX 1003.1
3443 <ref id="creat" name="creat">,
3444 <ref id="open" name="open"> <!-- , -->
3445 <!-- <ref id="read" name="read">, -->
3446 <!-- <ref id="write" name="write"> -->
3452 <sect1>free<label id="free"><p>
3456 <tag/Function/Free a block of dynamic memory.
3457 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3458 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
3459 <tag/Description/Free a block of dynamic memory previously allocated with
3460 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
3461 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
3462 pointer is <tt/NULL/, no action is performed.
3463 <tag/Notes/<itemize>
3464 <item>Passing an already free'd block to <tt/free/ again will cause undefined
3465 behaviour and may crash your program.
3466 <item>The function is only available as fastcall function, so it may only
3467 be used in presence of a prototype.
3469 <tag/Availability/ISO 9899
3471 <ref id="_heapadd" name="_heapadd">,
3472 <ref id="_heapblocksize" name="_heapblocksize">,
3473 <ref id="_heapmaxavail" name="_heapmaxavail">,
3474 <ref id="_heapmemavail" name="_heapmemavail">,
3475 <ref id="calloc" name="calloc">,
3476 <ref id="malloc" name="malloc">,
3477 <ref id="realloc" name="realloc">
3483 <sect1>get_ostype<label id="get_ostype"><p>
3487 <tag/Function/The function returns the operating system, the program runs on.
3488 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
3489 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
3490 <tag/Declaration/<tt/unsigned char get_ostype (void);/
3491 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
3492 all supported targets. If it exists, it returns a number that identifies the
3493 operating system or machine type, the program runs on. The machine dependent
3494 header files define constants that can be used to check the return code.
3495 <tag/Notes/<itemize>
3496 <item>The function does not exist on all platforms.
3497 <item>The return codes are platform dependent.
3499 <tag/Availability/cc65 (not all platforms)
3505 <sect1>get_c64dtv_speed<label id="get_c64dtv_speed"><p>
3509 <tag/Function/Get the current speed of the C64DTV.
3510 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3511 <tag/Declaration/<tt/unsigned char get_c64dtv_speed (void);/
3512 <tag/Description/The function returns the current speed of the C64DTV.
3513 <tag/Notes/<itemize>
3514 <item>The function is specific to the C64.
3515 <item>The function does not check for the presence of the C64DTV.
3516 <item>See the accelerator.h header for the speed definitions.
3518 <tag/Availability/cc65 (not all platforms)
3520 <ref id="detect_c64dtv" name="detect_c64dtv">,
3521 <ref id="set_c64dtv_speed" name="set_c64dtv_speed">,
3527 <sect1>get_scpu_speed<label id="get_scpu_speed"><p>
3531 <tag/Function/Get the current speed of the C64/C128 SuperCPU cartridge.
3532 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3533 <tag/Declaration/<tt/unsigned char get_scpu_speed (void);/
3534 <tag/Description/The function returns the current speed of the SuperCPU cartridge.
3535 <tag/Notes/<itemize>
3536 <item>The function is specific to the C128 and C64.
3537 <item>The function does not check for the presence of the cartridge.
3538 <item>See the accelerator.h header for the speed definitions.
3540 <tag/Availability/cc65 (not all platforms)
3542 <ref id="detect_scpu" name="detect_scpu">,
3543 <ref id="set_scpu_speed" name="set_scpu_speed">,
3549 <sect1>getcpu<label id="getcpu"><p>
3553 <tag/Function/Determine on which CPU the program is running.
3554 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3555 <tag/Declaration/<tt/unsigned char getcpu (void);/
3556 <tag/Description/The function checks on which CPU the code is running. It
3557 returns one of the constants<itemize>
3559 <item><tt/CPU_65C02/
3560 <item><tt/CPU_65816/
3562 <item><tt/CPU_65SC02/
3563 <item><tt/CPU_65CE02/
3564 <item><tt/CPU_HUC6280/
3567 <tag/Notes/<itemize>
3568 <item>Other, more exotic CPU types are not disinguished.
3570 <tag/Availability/cc65
3576 <sect1>getcurrentdevice<label id="getcurrentdevice"><p>
3580 <tag/Function/Get current device.
3581 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3582 <tag/Declaration/<tt/unsigned char getcurrentdevice (void);/
3583 <tag/Description/The function returns the current device.
3584 It allows to access the current device with the <ref id="dio.h"
3585 name="Low-level disk I/O API"> or <ref id="cbm.h" name="cbm_* I/O
3586 functions"> requiring a 'device' parameter.
3587 <tag/Availability/cc65
3589 <ref id="getdevicedir" name="getdevicedir">,
3590 <ref id="getfirstdevice" name="getfirstdevice">,
3591 <ref id="getnextdevice" name="getnextdevice">
3593 dio_open (getcurrentdevice ());
3599 <sect1>getcwd<label id="getcwd"><p>
3603 <tag/Function/Get current working directory.
3604 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3605 <tag/Declaration/<tt/char* __fastcall__ getcwd (char* buf, size_t size);/
3606 <tag/Description/The function will return the current working directory.
3607 <tag/Notes/<itemize>
3608 <item>The function is only available as fastcall function, so it may only
3609 be used in presence of a prototype.
3611 <tag/Availability/POSIX 1003.1
3617 <sect1>getdevicedir<label id="getdevicedir"><p>
3621 <tag/Function/Get device directory.
3622 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3623 <tag/Declaration/<tt/char* __fastcall__ getdevicedir (unsigned char device, char* buf, size_t size);/
3624 <tag/Description/The function returns the directory representing <tt/device/.
3625 It allows to access the device on filesystem level by calling chdir() with
3626 the directory returned.
3627 <tag/Notes/<itemize>
3628 <item>Calling getdevicedir() <em/does/ check for a (formatted) disk in a
3629 floppy-disk-type device and returns NULL if that check fails.
3630 <item>The function is only available as fastcall function, so it may only
3631 be used in presence of a prototype.
3633 <tag/Availability/cc65
3635 <ref id="getcwd" name="getcwd">,
3636 <ref id="getcurrentdevice" name="getcurrentdevice">,
3637 <ref id="getfirstdevice" name="getfirstdevice">,
3638 <ref id="getnextdevice" name="getnextdevice">
3640 chdir (getdevicedir (device, buf, sizeof buf));
3642 cf. <tt/samples/enumdevdir.c/
3647 <sect1>getenv<label id="getenv"><p>
3651 <tag/Function/Return a value from the environment.
3652 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3653 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
3654 <tag/Description/The function searches the environment for an entry that
3655 matches <tt/name/ and returns its value. The environment consists of a list
3656 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
3658 <tag/Notes/<itemize>
3659 <item>What exactly is stored in the environment depends on the machine the
3660 program is running on.
3661 <item>The function is only available as fastcall function, so it may only
3662 be used in presence of a prototype.
3664 <tag/Availability/ISO 9899
3670 <sect1>getfirstdevice<label id="getfirstdevice"><p>
3674 <tag/Function/Get first device.
3675 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3676 <tag/Declaration/<tt/unsigned char getfirstdevice (void);/
3677 <tag/Description/The function returns the first device.
3678 The constant <tt/INVALID_DEVICE/ indicates no device.
3679 <tag/Notes/<itemize>
3680 <item>Calling getfirstdevice() does <em/not/ turn on the motor of a
3681 drive-type device and does <em/not/ check for a disk in the drive.
3683 <tag/Availability/cc65
3685 <ref id="getcurrentdevice" name="getcurrentdevice">,
3686 <ref id="getdevicedir" name="getdevicedir">,
3687 <ref id="getnextdevice" name="getnextdevice">
3689 unsigned char dev = getfirstdevice ();
3690 while (dev != INVALID_DEVICE) {
3691 printf ("%d\n", dev);
3692 dev = getnextdevice (dev);
3699 <sect1>getnextdevice<label id="getnextdevice"><p>
3703 <tag/Function/Get next device.
3704 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3705 <tag/Declaration/<tt/unsigned char __fastcall__ getnextdevice (unsigned char device);/
3706 <tag/Description/The function returns the next device after <tt/device/.
3707 The constant <tt/INVALID_DEVICE/ indicates no further device.
3708 <tag/Notes/<itemize>
3709 <item>Calling getnextdevice() does <em/not/ turn on the motor of a
3710 drive-type device and does <em/not/ check for a disk in the drive.
3711 <item>The function is only available as fastcall function, so it may only
3712 be used in presence of a prototype.
3714 <tag/Availability/cc65
3716 <ref id="getcurrentdevice" name="getcurrentdevice">,
3717 <ref id="getdevicedir" name="getdevicedir">,
3718 <ref id="getfirstdevice" name="getfirstdevice">
3720 unsigned char dev = getfirstdevice ();
3721 while (dev != INVALID_DEVICE) {
3722 printf ("%d\n", dev);
3723 dev = getnextdevice (dev);
3730 <sect1>getopt<label id="getopt"><p>
3734 <tag/Function/Parse command line options.
3735 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3736 <tag/Declaration/<tt/int __fastcall__ getopt (int argc, char* const* argv,
3737 const char* optstring);/
3738 <tag/Description/The function parses command line arguments, <tt/argc/ and
3739 <tt/argv/ are the argument count and array passed to <tt/main/. <tt/optstring/
3740 is a string that contains command line option characters. If a character in
3741 <tt/optstring/ is followed by a colon, the option requires an argument. An
3742 option on the command line is recognized if it is one of the option characters
3744 <tt/getopt/ must be called repeatedly. It will return each option character
3745 found on the command line and <tt/EOF/ (-1) if there is no other option. An
3746 option argument is placed in <tt/optarg/, the index of the next element on the
3747 command line to be processed is placed in <tt/optind/.
3748 <tag/Notes/<itemize>
3749 <item>The implementation will not reorder options. A non option on the command
3750 line will terminate option processing. All remaining arguments are not
3751 recognized as options, even if the start with a '-' character.
3752 <item>The function is only available as fastcall function, so it may only
3753 be used in presence of a prototype.
3755 <tag/Availability/POSIX.2
3761 <sect1>gotox<label id="gotox"><p>
3765 <tag/Function/Move the text mode cursor to a new X position.
3766 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3767 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
3768 <tag/Description/The function moves the text mode cursor to the specified X
3769 position while leaving the Y position untouched. The leftmost position on the
3770 screen has the coordinate 0.
3771 <tag/Notes/<itemize>
3772 <item>The function is only available as fastcall function, so it may
3773 only be used in presence of a prototype.
3774 <item>Invalid values for the X position (out of screen coordinates) may
3775 lead to undefined behaviour.
3777 <tag/Availability/cc65
3779 <ref id="gotoy" name="gotoy">,
3780 <ref id="gotoxy" name="gotoxy">,
3781 <ref id="wherex" name="wherex">,
3782 <ref id="wherey" name="wherey">
3788 <sect1>gotoxy<label id="gotoxy"><p>
3792 <tag/Function/Move the text mode cursor to a new position.
3793 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3794 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
3795 <tag/Description/The function moves the text mode cursor to the specified
3796 position. The leftmost position on the screen has the X coordinate 0, the
3797 topmost line has the Y coordinate 0.
3798 <tag/Notes/<itemize>
3799 <item>The function is only available as fastcall function, so it may only be
3800 used in presence of a prototype.
3801 <item>Invalid values for any of both coordinates (out of screen positions) may
3802 lead to undefined behaviour.
3804 <tag/Availability/cc65
3806 <ref id="gotox" name="gotox">,
3807 <ref id="gotoy" name="gotoy">,
3808 <ref id="wherex" name="wherex">,
3809 <ref id="wherey" name="wherey">
3815 <sect1>gotoy<label id="gotoy"><p>
3819 <tag/Function/Move the text mode cursor to a new Y position.
3820 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3821 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
3822 <tag/Description/The function moves the text mode cursor to the specified Y
3823 position while leaving the X position untouched. The uppermost position on the
3824 screen has the coordinate 0.
3825 <tag/Notes/<itemize>
3826 <item>The function is only available as fastcall function, so it may
3827 only be used in presence of a prototype.
3828 <item>Invalid values for the Y position (out of screen coordinates) may lead
3829 to undefined behaviour.
3831 <tag/Availability/cc65
3833 <ref id="gotox" name="gotox">,
3834 <ref id="gotoxy" name="gotoxy">,
3835 <ref id="wherex" name="wherex">,
3836 <ref id="wherey" name="wherey">
3842 <sect1>isalnum<label id="isalnum"><p>
3846 <tag/Function/Check if a given character is a letter or digit.
3847 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3848 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
3849 <tag/Description/The function returns a non zero value if the given argument
3850 is a letter or digit. The return value is zero if the character is anything
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
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="isalpha" name="isalpha">,
3864 <ref id="isascii" name="isascii">,
3865 <ref id="isblank" name="isblank">,
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>isalpha<label id="isalpha"><p>
3884 <tag/Function/Check if a given character is a letter.
3885 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3886 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
3887 <tag/Description/The function returns a non zero value if the given argument
3888 is a letter. The return value is zero if the character is anything else.
3889 <tag/Notes/<itemize>
3890 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3891 inline sequence generated by the macro will not work correctly for values
3892 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3893 this range. The non inline function may be accessed by <tt/#undef/'ing the
3895 <item>When compiling without <tt/-Os/, the function is only available as
3896 fastcall function, so it may only be used in presence of a prototype.
3898 <tag/Availability/ISO 9899
3900 <ref id="isalnum" name="isalnum">,
3901 <ref id="isascii" name="isascii">,
3902 <ref id="isblank" name="isblank">,
3903 <ref id="iscntrl" name="iscntrl">,
3904 <ref id="isdigit" name="isdigit">,
3905 <ref id="isgraph" name="isgraph">,
3906 <ref id="islower" name="islower">,
3907 <ref id="isprint" name="isprint">,
3908 <ref id="ispunct" name="ispunct">,
3909 <ref id="isspace" name="isspace">,
3910 <ref id="isupper" name="isupper">,
3911 <ref id="isxdigit" name="isxdigit">
3917 <sect1>isascii<label id="isascii"><p>
3921 <tag/Function/Check if a given character is in the ASCII (0..127) range.
3922 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3923 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
3924 <tag/Description/The function returns a non zero value if the given argument
3925 is in the range 0..127 (the range of valid ASCII characters) and zero if not.
3926 <tag/Notes/<itemize>
3927 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3928 inline sequence generated by the macro will not work correctly for values
3929 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3930 this range. The non inline function may be accessed by <tt/#undef/'ing the
3932 <item>When compiling without <tt/-Os/, the function is only available as
3933 fastcall function, so it may only be used in presence of a prototype.
3935 <tag/Availability/ISO 9899
3937 <ref id="isalnum" name="isalnum">,
3938 <ref id="isalpha" name="isalpha">,
3939 <ref id="isblank" name="isblank">,
3940 <ref id="iscntrl" name="iscntrl">,
3941 <ref id="isdigit" name="isdigit">,
3942 <ref id="isgraph" name="isgraph">,
3943 <ref id="islower" name="islower">,
3944 <ref id="isprint" name="isprint">,
3945 <ref id="ispunct" name="ispunct">,
3946 <ref id="isspace" name="isspace">,
3947 <ref id="isupper" name="isupper">,
3948 <ref id="isxdigit" name="isxdigit">
3954 <sect1>isblank<label id="isblank"><p>
3958 <tag/Function/Check if a given character is a space or tab.
3959 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3960 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
3961 <tag/Description/The function returns a non zero value if the given argument
3962 is a space or tab character. The return value is zero if the character is
3964 <tag/Notes/<itemize>
3965 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3966 inline sequence generated by the macro will not work correctly for values
3967 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3968 this range. The non inline function may be accessed by <tt/#undef/'ing the
3970 <item>When compiling without <tt/-Os/, the function is only available as
3971 fastcall function, so it may only be used in presence of a prototype.
3973 <tag/Availability/ISO 9899
3975 <ref id="isalnum" name="isalnum">,
3976 <ref id="isalpha" name="isalpha">,
3977 <ref id="isascii" name="isascii">,
3978 <ref id="iscntrl" name="iscntrl">,
3979 <ref id="isdigit" name="isdigit">,
3980 <ref id="isgraph" name="isgraph">,
3981 <ref id="islower" name="islower">,
3982 <ref id="isprint" name="isprint">,
3983 <ref id="ispunct" name="ispunct">,
3984 <ref id="isspace" name="isspace">,
3985 <ref id="isupper" name="isupper">,
3986 <ref id="isxdigit" name="isxdigit">
3992 <sect1>iscntrl<label id="iscntrl"><p>
3996 <tag/Function/Check if a given character is a control character.
3997 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3998 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
3999 <tag/Description/The function returns a non zero value if the given argument
4000 is a control character. The return value is zero if the character is anything
4002 <tag/Notes/<itemize>
4003 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4004 inline sequence generated by the macro will not work correctly for values
4005 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4006 this range. The non inline function may be accessed by <tt/#undef/'ing the
4008 <item>When compiling without <tt/-Os/, the function is only available as
4009 fastcall function, so it may only be used in presence of a prototype.
4011 <tag/Availability/ISO 9899
4013 <ref id="isalnum" name="isalnum">,
4014 <ref id="isalpha" name="isalpha">,
4015 <ref id="isascii" name="isascii">,
4016 <ref id="isblank" name="isblank">,
4017 <ref id="isdigit" name="isdigit">,
4018 <ref id="isgraph" name="isgraph">,
4019 <ref id="islower" name="islower">,
4020 <ref id="isprint" name="isprint">,
4021 <ref id="ispunct" name="ispunct">,
4022 <ref id="isspace" name="isspace">,
4023 <ref id="isupper" name="isupper">,
4024 <ref id="isxdigit" name="isxdigit">
4030 <sect1>isdigit<label id="isdigit"><p>
4034 <tag/Function/Check if a given character is a digit.
4035 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4036 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
4037 <tag/Description/The function returns a non zero value if the given argument
4038 is a digit. The return value is zero if the character is anything else.
4039 <tag/Notes/<itemize>
4040 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4041 inline sequence generated by the macro will not work correctly for values
4042 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4043 this range. The non inline function may be accessed by <tt/#undef/'ing the
4045 <item>When compiling without <tt/-Os/, the function is only available as
4046 fastcall function, so it may only be used in presence of a prototype.
4048 <tag/Availability/ISO 9899
4050 <ref id="isalnum" name="isalnum">,
4051 <ref id="isalpha" name="isalpha">,
4052 <ref id="isascii" name="isascii">,
4053 <ref id="isblank" name="isblank">,
4054 <ref id="iscntrl" name="iscntrl">,
4055 <ref id="isgraph" name="isgraph">,
4056 <ref id="islower" name="islower">,
4057 <ref id="isprint" name="isprint">,
4058 <ref id="ispunct" name="ispunct">,
4059 <ref id="isspace" name="isspace">,
4060 <ref id="isupper" name="isupper">,
4061 <ref id="isxdigit" name="isxdigit">
4067 <sect1>isfast<label id="isfast"><p>
4071 <tag/Function/Check if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
4072 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
4073 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
4074 <tag/Declaration/<tt/unsigned char isfast (void);/
4075 <tag/Description/The function returns a 1 if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
4076 <tag/Notes/<itemize>
4077 <item>The function is specific to the C128, C16 and Plus4.
4079 <tag/Availability/cc65 (not all platforms)
4081 <ref id="fast" name="fast">,
4082 <ref id="slow" name="slow">,
4088 <sect1>isgraph<label id="isgraph"><p>
4092 <tag/Function/Check if a given character is a printable character (except
4094 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4095 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
4096 <tag/Description/The function returns a non zero value if the given argument
4097 is a printable character with the exception of space. The return value is zero
4098 if the character is anything else.
4099 <tag/Notes/<itemize>
4100 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4101 inline sequence generated by the macro will not work correctly for values
4102 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4103 this range. The non inline function may be accessed by <tt/#undef/'ing the
4105 <item>When compiling without <tt/-Os/, the function is only available as
4106 fastcall function, so it may only be used in presence of a prototype.
4108 <tag/Availability/ISO 9899
4110 <ref id="isalnum" name="isalnum">,
4111 <ref id="isalpha" name="isalpha">,
4112 <ref id="isascii" name="isascii">,
4113 <ref id="isblank" name="isblank">,
4114 <ref id="iscntrl" name="iscntrl">,
4115 <ref id="isdigit" name="isdigit">,
4116 <ref id="islower" name="islower">,
4117 <ref id="isprint" name="isprint">,
4118 <ref id="ispunct" name="ispunct">,
4119 <ref id="isspace" name="isspace">,
4120 <ref id="isupper" name="isupper">,
4121 <ref id="isxdigit" name="isxdigit">
4127 <sect1>islower<label id="islower"><p>
4131 <tag/Function/Check if a given character is a lower case letter.
4132 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4133 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
4134 <tag/Description/The function returns a non zero value if the given argument
4135 is a lower case letter. The return value is zero if the character is anything
4137 <tag/Notes/<itemize>
4138 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4139 inline sequence generated by the macro will not work correctly for values
4140 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4141 this range. The non inline function may be accessed by <tt/#undef/'ing the
4143 <item>When compiling without <tt/-Os/, the function is only available as
4144 fastcall function, so it may only be used in presence of a prototype.
4146 <tag/Availability/ISO 9899
4148 <ref id="isalnum" name="isalnum">,
4149 <ref id="isalpha" name="isalpha">,
4150 <ref id="isascii" name="isascii">,
4151 <ref id="isblank" name="isblank">,
4152 <ref id="iscntrl" name="iscntrl">,
4153 <ref id="isdigit" name="isdigit">,
4154 <ref id="isgraph" name="isgraph">,
4155 <ref id="isprint" name="isprint">,
4156 <ref id="ispunct" name="ispunct">,
4157 <ref id="isspace" name="isspace">,
4158 <ref id="isupper" name="isupper">,
4159 <ref id="isxdigit" name="isxdigit">
4165 <sect1>isprint<label id="isprint"><p>
4169 <tag/Function/Check if a given character is a printable character.
4170 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4171 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
4172 <tag/Description/The function returns a non zero value if the given argument
4173 is a printable character (this includes the space character). The return value
4174 is zero if the character is anything else.
4175 <tag/Notes/<itemize>
4176 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4177 inline sequence generated by the macro will not work correctly for values
4178 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4179 this range. The non inline function may be accessed by <tt/#undef/'ing the
4181 <item>When compiling without <tt/-Os/, the function is only available as
4182 fastcall function, so it may only be used in presence of a prototype.
4184 <tag/Availability/ISO 9899
4186 <ref id="isalnum" name="isalnum">,
4187 <ref id="isalpha" name="isalpha">,
4188 <ref id="isascii" name="isascii">,
4189 <ref id="isblank" name="isblank">,
4190 <ref id="iscntrl" name="iscntrl">,
4191 <ref id="isdigit" name="isdigit">,
4192 <ref id="isgraph" name="isgraph">,
4193 <ref id="islower" name="islower">,
4194 <ref id="ispunct" name="ispunct">,
4195 <ref id="isspace" name="isspace">,
4196 <ref id="isupper" name="isupper">,
4197 <ref id="isxdigit" name="isxdigit">
4203 <sect1>ispunct<label id="ispunct"><p>
4207 <tag/Function/Check if a given character is a printable character but not a
4208 space or an alphanumeric character.
4209 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4210 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
4211 <tag/Description/The function returns a non zero value if the given argument
4212 is a printable character, but not a space or anything alphanumeric. The return
4213 value is zero if the character is anything else.
4214 <tag/Notes/<itemize>
4215 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4216 inline sequence generated by the macro will not work correctly for values
4217 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4218 this range. The non inline function may be accessed by <tt/#undef/'ing the
4220 <item>When compiling without <tt/-Os/, the function is only available as
4221 fastcall function, so it may only be used in presence of a prototype.
4223 <tag/Availability/ISO 9899
4225 <ref id="isalnum" name="isalnum">,
4226 <ref id="isalpha" name="isalpha">,
4227 <ref id="isascii" name="isascii">,
4228 <ref id="isblank" name="isblank">,
4229 <ref id="iscntrl" name="iscntrl">,
4230 <ref id="isdigit" name="isdigit">,
4231 <ref id="isgraph" name="isgraph">,
4232 <ref id="islower" name="islower">,
4233 <ref id="isprint" name="isprint">,
4234 <ref id="isspace" name="isspace">,
4235 <ref id="isupper" name="isupper">,
4236 <ref id="isxdigit" name="isxdigit">
4242 <sect1>isspace<label id="isspace"><p>
4246 <tag/Function/Check if a given character is a white-space character.
4247 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4248 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
4249 <tag/Description/The function returns a non zero value if the given argument
4250 is a white space character. The return value is zero if the character is
4251 anything else. The standard white space characters are: space, formfeed ('\f'),
4252 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
4254 <tag/Notes/<itemize>
4255 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4256 inline sequence generated by the macro will not work correctly for values
4257 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4258 this range. The non inline function may be accessed by <tt/#undef/'ing the
4260 <item>When compiling without <tt/-Os/, the function is only available as
4261 fastcall function, so it may only be used in presence of a prototype.
4263 <tag/Availability/ISO 9899
4265 <ref id="isalnum" name="isalnum">,
4266 <ref id="isalpha" name="isalpha">,
4267 <ref id="isascii" name="isascii">,
4268 <ref id="isblank" name="isblank">,
4269 <ref id="iscntrl" name="iscntrl">,
4270 <ref id="isdigit" name="isdigit">,
4271 <ref id="isgraph" name="isgraph">,
4272 <ref id="islower" name="islower">,
4273 <ref id="isprint" name="isprint">,
4274 <ref id="ispunct" name="ispunct">,
4275 <ref id="isupper" name="isupper">,
4276 <ref id="isxdigit" name="isxdigit">
4282 <sect1>isupper<label id="isupper"><p>
4286 <tag/Function/Check if a given character is an upper case letter.
4287 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4288 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
4289 <tag/Description/The function returns a non zero value if the given argument
4290 is an upper case letter. The return value is zero if the character is anything
4292 <tag/Notes/<itemize>
4293 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4294 inline sequence generated by the macro will not work correctly for values
4295 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4296 this range. The non inline function may be accessed by <tt/#undef/'ing the
4298 <item>When compiling without <tt/-Os/, the function is only available as
4299 fastcall function, so it may only be used in presence of a prototype.
4301 <tag/Availability/ISO 9899
4303 <ref id="isalnum" name="isalnum">,
4304 <ref id="isalpha" name="isalpha">,
4305 <ref id="isascii" name="isascii">,
4306 <ref id="isblank" name="isblank">,
4307 <ref id="iscntrl" name="iscntrl">,
4308 <ref id="isdigit" name="isdigit">,
4309 <ref id="isgraph" name="isgraph">,
4310 <ref id="islower" name="islower">,
4311 <ref id="isprint" name="isprint">,
4312 <ref id="ispunct" name="ispunct">,
4313 <ref id="isspace" name="isspace">,
4314 <ref id="isxdigit" name="isxdigit">
4320 <sect1>isxdigit<label id="isxdigit"><p>
4324 <tag/Function/Check if a given character is a hexadecimal digit.
4325 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4326 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
4327 <tag/Description/The function returns a non zero value if the given argument
4328 is a hexadecimal digit (0..9, a..f and A..F). The return value is zero if the
4329 character is anything else.
4330 <tag/Notes/<itemize>
4331 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4332 inline sequence generated by the macro will not work correctly for values
4333 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4334 this range. The non inline function may be accessed by <tt/#undef/'ing the
4336 <item>When compiling without <tt/-Os/, the function is only available as
4337 fastcall function, so it may only be used in presence of a prototype.
4339 <tag/Availability/ISO 9899
4341 <ref id="isalnum" name="isalnum">,
4342 <ref id="isalpha" name="isalpha">,
4343 <ref id="isascii" name="isascii">,
4344 <ref id="isblank" name="isblank">,
4345 <ref id="iscntrl" name="iscntrl">,
4346 <ref id="isdigit" name="isdigit">,
4347 <ref id="isgraph" name="isgraph">,
4348 <ref id="islower" name="islower">,
4349 <ref id="isprint" name="isprint">,
4350 <ref id="ispunct" name="ispunct">,
4351 <ref id="isspace" name="isspace">,
4352 <ref id="isupper" name="isupper">
4358 <sect1>itoa<label id="itoa"><p>
4362 <tag/Function/Convert an integer into a string.
4363 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4364 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
4365 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
4366 <tt/radix/ as the base.
4367 <tag/Notes/<itemize>
4368 <item>There are no provisions to prevent a buffer overflow.
4369 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
4370 <item>The function is non standard, so it is not available in strict ANSI mode.
4371 You should probably use <tt/sprintf/ instead.
4372 <item>The function is only available as fastcall function, so it may only be
4373 used in presence of a prototype.
4375 <tag/Availability/cc65
4377 <ref id="atoi" name="atoi">,
4378 <ref id="atol" name="atol">,
4379 <ref id="ltoa" name="ltoa">,
4380 <ref id="ultoa" name="ultoa">,
4381 <ref id="utoa" name="utoa">
4387 <sect1>joy_count<label id="joy_count"><p>
4391 <tag/Function/Return the number of joysticks supported by the current driver.
4392 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4393 <tag/Declaration/<tt/unsigned char joy_count (void);/
4394 <tag/Description/The function returns a the number of joysticks supported
4395 by the current joystick driver.
4396 <tag/Notes/<itemize>
4397 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4398 name="joy_load_driver"> before calling this function.
4399 <item>The function returns the number of joysticks supported by the driver.
4400 There's no way to check for the number of actually connected joysticks.
4402 <tag/Availability/cc65
4404 <ref id="joy_load_driver" name="joy_load_driver">,
4405 <ref id="joy_read" name="joy_read">
4411 <sect1>joy_install<label id="joy_install"><p>
4415 <tag/Function/Install an already loaded driver and return an error code.
4416 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4417 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
4418 <tag/Description/The function installs a driver that was already loaded into
4419 memory (or linked statically to the program). It returns an error code
4420 (<tt/JOY_ERR_OK/ in case of success).
4421 <tag/Notes/<itemize>
4422 <item>The function is only available as fastcall function, so it may only be
4423 used in presence of a prototype.
4425 <tag/Availability/cc65
4427 <ref id="joy_load_driver" name="joy_load_driver">,
4428 <ref id="joy_uninstall" name="joy_uninstall">,
4429 <ref id="joy_unload" name="joy_unload">
4435 <sect1>joy_load_driver<label id="joy_load_driver"><p>
4439 <tag/Function/Load a driver from disk and install it.
4440 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4441 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
4442 <tag/Description/The function loads a driver with the given name from disk
4443 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
4444 driver was successfully loaded and installed.
4445 <tag/Notes/<itemize>
4446 <item>The function is only available as fastcall function, so it may only be
4447 used in presence of a prototype.
4449 <tag/Availability/cc65
4451 <ref id="joy_install" name="joy_install">,
4452 <ref id="joy_uninstall" name="joy_uninstall">,
4453 <ref id="joy_unload" name="joy_unload">
4459 <sect1>joy_read<label id="joy_read"><p>
4463 <tag/Function/Read the status of a joystick.
4464 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4465 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
4466 <tag/Description/The function reads the status bits for a joystick. The number
4467 of the joystick is passed as parameter. The result may be examined by using one
4468 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
4469 <tag/Notes/<itemize>
4470 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4471 name="joy_load_driver"> before calling this function.
4472 <item>The function is only available as fastcall function, so it may only be
4473 used in presence of a prototype.
4475 <tag/Availability/cc65
4477 <ref id="joy_count" name="joy_count">,
4478 <ref id="joy_load_driver" name="joy_load_driver">,
4479 <ref id="joy_unload" name="joy_unload">
4485 <sect1>joy_uninstall<label id="joy_uninstall"><p>
4489 <tag/Function/Uninstall the current joystick driver.
4490 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4491 <tag/Declaration/<tt/unsigned char joy_uninstall (void);/
4492 <tag/Description/The function uninstalls the currently installed joystick
4493 driver. It does not remove the driver from memory. The function returns an
4494 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4495 <tag/Notes/<itemize>
4496 <item>A joystick driver must be installed using <ref id="joy_install"
4497 name="joy_install"> before calling this function.
4499 <tag/Availability/cc65
4501 <ref id="joy_install" name="joy_install">,
4502 <ref id="joy_load_driver" name="joy_load_driver">,
4503 <ref id="joy_unload" name="joy_unload">
4509 <sect1>joy_unload<label id="joy_unload"><p>
4513 <tag/Function/Uninstall, then unload the current joystick driver.
4514 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4515 <tag/Declaration/<tt/unsigned char joy_unload (void);/
4516 <tag/Description/The function uninstalls the currently installed joystick
4517 driver and removes it from memory. An error code is returned, which is
4518 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4519 <tag/Notes/<itemize>
4520 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4521 name="joy_load_driver"> before calling this function.
4523 <tag/Availability/cc65
4525 <ref id="joy_load_driver" name="joy_load_driver">
4531 <sect1>kbhit<label id="kbhit"><p>
4535 <tag/Function/Check if there's a key waiting in the keyboard buffer.
4536 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4537 <tag/Declaration/<tt/unsigned char kbhit (void);/
4538 <tag/Description/The function returns a value of zero if there is no character
4539 waiting to be read from the keyboard. It returns non zero otherwise.
4540 <tag/Notes/<itemize>
4541 <item>If the system does not support a keyboard buffer (most systems
4542 do), the function is rather useless.
4544 <tag/Availability/cc65
4546 <ref id="cgetc" name="cgetc">,
4547 <ref id="cursor" name="cursor">
4553 <sect1>kbrepeat<label id="kbrepeat"><p>
4557 <tag/Function/Set the keyboard repeat mode.
4558 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
4559 <tag/Declaration/<tt/unsigned char __fastcall__ kbrepeat (unsigned char mode);/
4560 <tag/Description/This function changes which keys have automatic repeat when
4561 being held down for a certain time. Possible values are <tt/KBREPEAT_CURSOR/
4562 (repeat only cursor-related keys), <tt/KBREPEAT_NONE/ (no repeat for any
4563 keys), and <tt/KBREPEAT_ALL/ (repeat all keys). The old mode is returned, so
4564 it can be restored later.
4565 <tag/Notes/<itemize>
4566 <item>The function is available only as a fastcall function; so, it may be used
4567 only in the presence of a prototype.
4569 <tag/Availability/cc65
4575 <sect1>labs<label id="labs"><p>
4579 <tag/Function/Returns the absolute value of a long integer.
4580 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4581 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
4582 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
4584 <tag/Notes/<itemize>
4585 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
4586 <item>The function is only available as fastcall function, so it may only be
4587 used in presence of a prototype.
4589 <tag/Availability/ISO 9899
4591 <ref id="abs" name="abs">
4597 <sect1>ltoa<label id="ltoa"><p>
4601 <tag/Function/Convert a long integer into a string.
4602 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4603 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
4604 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
4605 using <tt/radix/ as the base.
4606 <tag/Notes/<itemize>
4607 <item>There are no provisions to prevent a buffer overflow.
4608 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
4609 <item>The function is non standard, so it is not available in strict ANSI mode.
4610 You should probably use <tt/sprintf/ instead.
4611 <item>The function is only available as fastcall function, so it may only be
4612 used in presence of a prototype.
4614 <tag/Availability/cc65
4616 <ref id="atoi" name="atoi">,
4617 <ref id="atol" name="atol">,
4618 <ref id="itoa" name="itoa">,
4619 <ref id="ultoa" name="ultoa">,
4620 <ref id="utoa" name="utoa">
4626 <sect1>localeconv<label id="localeconv"><p>
4630 <tag/Function/Returns a pointer to the current locale structure.
4631 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4632 <tag/Declaration/<tt/struct lconv* localeconv (void);/
4633 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
4635 <tag/Notes/<itemize>
4636 <item>cc65 supports only the "C" locale, so even after setting a new locale
4637 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
4640 <tag/Availability/ISO 9899
4642 <ref id="setlocale" name="setlocale">
4648 <sect1>longjmp<label id="longjmp"><p>
4652 <tag/Function/Non local goto.
4653 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4654 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
4655 <tag/Description/The <tt/longjmp/ function restores a program context from the
4656 data in <tt/buf/, which must have been set by a preceeding call to
4657 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
4658 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
4660 <tag/Notes/<itemize>
4661 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
4662 was called with a value of one.
4663 <item>The function is only available as fastcall function, so it may only
4664 be used in presence of a prototype.
4666 <tag/Availability/ISO 9899
4668 <ref id="setjmp" name="setjmp">
4674 <sect1>malloc<label id="malloc"><p>
4678 <tag/Function/Allocate dynamic memory.
4679 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4680 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
4681 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
4682 pointer to the allocated memory block. On error (not enough memory available),
4683 <tt/malloc/ returns <tt/NULL/.
4684 <tag/Notes/<itemize>
4685 <item>The function is only available as fastcall function, so it may only
4686 be used in presence of a prototype.
4688 <tag/Availability/ISO 9899
4690 <ref id="_heapadd" name="_heapadd">,
4691 <ref id="_heapblocksize" name="_heapblocksize">,
4692 <ref id="_heapmaxavail" name="_heapmaxavail">,
4693 <ref id="_heapmemavail" name="_heapmemavail">,
4694 <ref id="calloc" name="calloc">,
4695 <ref id="free" name="free">,
4696 <ref id="realloc" name="realloc">,
4697 <ref id="strdup" name="strdup">
4703 <sect1>memchr<label id="memchr"><p>
4707 <tag/Function/Search for a character in a block of raw memory.
4708 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4709 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
4710 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
4711 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
4712 that is of size <tt/count/. Upon completion, the function returns a pointer to
4713 the character found, or a null pointer if the character was not found.
4714 <tag/Notes/<itemize>
4715 <item>The function is only available as fastcall function, so it may only
4716 be used in presence of a prototype.
4718 <tag/Availability/ISO 9899
4720 <ref id="strchr" name="strchr">
4726 <sect1>memcmp<label id="memcmp"><p>
4730 <tag/Function/Compare two memory areas.
4731 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4732 <tag/Declaration/<tt/int __fastcall__ memcmp (const void* p1, const void* p2, size_t count);/
4733 <tag/Description/<tt/memcmp/ compares <tt/count/ bytes from the memory area
4734 pointed to by <tt/p1/ into the memory area pointed to by <tt/p2/. It returns a value that is less than
4735 zero if <tt/p1/ is less than <tt/p2/, zero if <tt/p1/ is the same as <tt/p2/,
4736 and a value greater than zero if <tt/p1/ is greater than <tt/p2/.
4737 <tag/Notes/<itemize>
4738 <item>The function is only available as fastcall function, so it may only
4739 be used in presence of a prototype.
4741 <tag/Availability/ISO 9899
4743 <ref id="strcmp" name="strcmp">,
4744 <ref id="memmove" name="memmove">,
4745 <ref id="memset" name="memset">
4751 <sect1>memcpy<label id="memcpy"><p>
4755 <tag/Function/Copy a memory area.
4756 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4757 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
4758 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
4759 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4761 <tag/Notes/<itemize>
4762 <item>The result is undefined if the memory areas do overlap. Use
4763 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
4764 <item>The function is only available as fastcall function, so it may only
4765 be used in presence of a prototype.
4767 <tag/Availability/ISO 9899
4769 <ref id="_swap" name="_swap">,
4770 <ref id="memmove" name="memmove">,
4771 <ref id="memset" name="memset">
4777 <sect1>memmove<label id="memmove"><p>
4781 <tag/Function/Copy a memory area.
4782 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4783 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
4784 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
4785 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4787 <tag/Notes/<itemize>
4788 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
4789 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
4790 <item>The function is only available as fastcall function, so it may only
4791 be used in presence of a prototype.
4793 <tag/Availability/ISO 9899
4795 <ref id="_swap" name="_swap">,
4796 <ref id="memcpy" name="memcpy">,
4797 <ref id="memset" name="memset">
4803 <sect1>memset<label id="memset"><p>
4807 <tag/Function/Fill a memory area.
4808 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4809 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
4810 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
4811 the value <tt/val/. The function returns <tt/p/.
4812 <tag/Notes/<itemize>
4813 <item>The function is only available as fastcall function, so it may only
4814 be used in presence of a prototype.
4816 <tag/Availability/ISO 9899
4818 <ref id="_swap" name="_swap">,
4819 <ref id="bzero" name="bzero">,
4820 <ref id="memcpy" name="memcpy">,
4821 <ref id="memmove" name="memmove">
4827 <sect1>mod_free<label id="mod_free"><p>
4831 <tag/Function/Free a relocatable module.
4832 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4833 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
4834 <tag/Description/The function will free a module loaded into memory by use of
4835 the <tt/<ref id="mod_load" name="mod_load">/ function.
4836 <tag/Notes/<itemize>
4837 <item>The pointer passed as parameter is the pointer to the module memory,
4838 not the pointer to the control structure.
4839 <item>The function is available only as a fastcall function; so, it may be used
4840 only in the presence of a prototype.
4842 <tag/Availability/cc65
4844 <ref id="mod_load" name="mod_load">
4850 <sect1>mod_load<label id="mod_load"><p>
4854 <tag/Function/Load a relocatable module.
4855 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4856 <tag/Declaration/<tt/unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl);/
4857 <tag/Description/The function will load a code module into memory and relocate
4858 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
4859 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
4860 the module just loaded. Possible error codes are:
4862 <item><tt/MLOAD_OK/ - Module load successful
4863 <item><tt/MLOAD_ERR_READ/ - Read error
4864 <item><tt/MLOAD_ERR_HDR/ - Header error
4865 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
4866 <item><tt/MLOAD_ERR_FMT/ - Data format error
4867 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
4869 <tag/Notes/<itemize>
4870 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
4871 relocatable o65 modules for use with this function.
4872 <item>The function is available only as a fastcall function; so, it may be used
4873 only in the presence of a prototype.
4875 <tag/Availability/cc65
4877 <ref id="mod_free" name="mod_free">
4883 <sect1>mouse_setbox<label id="mouse_setbox"><p>
4887 <tag/Function/Specify a bounding box for the mouse cursor.
4888 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4889 <tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
4890 <tag/Description/The function allows to set a bounding box for mouse movement.
4891 <tag/Notes/<itemize>
4892 <item>The function does not check if the mouse cursor is currently within the
4893 given rectangle. Placing the mouse cursor within the bounding box is the
4894 responsibility of the programmer.
4895 <item>While the bounding box may be larger than the actual screen size, the
4896 standard mouse cursor draw routines may fail to set the cursor to coordinates
4897 outside of the screen area. Depending on the platform, you may have to supply
4898 your own mouse cursor routines.
4899 <item>The function is only available as fastcall function, so it may only be
4900 used in presence of a prototype.
4902 <tag/Availability/cc65
4904 <ref id="mouse_getbox" name="mouse_getbox">,
4905 <ref id="mouse_move" name="mouse_move">
4911 <sect1>mouse_getbox<label id="mouse_getbox"><p>
4915 <tag/Function/Return the current bounding box for the mouse cursor.
4916 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4917 <tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
4918 <tag/Description/The function queries the current bounding box for mouse
4920 <tag/Notes/<itemize>
4921 <item>The function is only available as fastcall function, so it may only be
4922 used in presence of a prototype.
4924 <tag/Availability/cc65
4926 <ref id="mouse_move" name="mouse_move">,
4927 <ref id="mouse_setbox" name="mouse_setbox">
4933 <sect1>mouse_buttons<label id="mouse_buttons"><p>
4937 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
4938 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4939 <tag/Declaration/<tt/unsigned char mouse_buttons (void);/
4940 <tag/Description/The function returns a bit mask that encodes the state of the
4941 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
4943 <tag/Availability/cc65
4945 <ref id="mouse_info" name="mouse_info">,
4946 <ref id="mouse_pos" name="mouse_pos">
4952 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
4956 <tag/Function/Return a readable error message for an error code.
4957 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4958 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
4960 <tag/Description/The function returns an error message (in english) for the
4961 error code passed parameter.
4962 <tag/Notes/<itemize>
4963 <item>The function will return "Unknown error" for invalid error codes.
4964 <item>The function is only available as fastcall function, so it may only be
4965 used in presence of a prototype.
4967 <tag/Availability/cc65
4969 <ref id="mouse_load_driver" name="mouse_load_driver">,
4970 <ref id="mouse_uninstall" name="mouse_uninstall">,
4971 <ref id="mouse_unload" name="mouse_unload">
4977 <sect1>mouse_hide<label id="mouse_hide"><p>
4981 <tag/Function/Hide the mouse pointer.
4982 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4983 <tag/Declaration/<tt/void mouse_hide (void);/
4984 <tag/Description/The function hides the mouse pointer. It manages a counter
4985 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
4986 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
4987 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
4989 <tag/Availability/cc65
4991 <ref id="mouse_show" name="mouse_show">
4997 <sect1>mouse_info<label id="mouse_info"><p>
5001 <tag/Function/Return the state of the mouse buttons and the position of the
5003 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5004 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
5005 <tag/Description/The function returns the state of the mouse buttons and the
5006 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
5007 <tag/Notes/<itemize>
5008 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
5009 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
5010 name="mouse_pos">/ instead.
5011 <item>The function is only available as fastcall function, so it may only be
5012 used in presence of a prototype.
5014 <tag/Availability/cc65
5016 <ref id="mouse_buttons" name="mouse_buttons">,
5017 <ref id="mouse_pos" name="mouse_pos">
5023 <sect1>mouse_install<label id="mouse_install"><p>
5027 <tag/Function/Install an already loaded mouse driver.
5028 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5029 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
5030 mouse_callbacks* c, void* driver);/
5031 <tag/Description/The function installs an already loaded mouse driver and
5032 returns an error code. The <tt/mouse_callbacks/ structure passed as first
5033 parameter contains pointers to routines needed to move or hide/show the mouse
5034 pointer. Defaults for these routines are supplied by the library, so if you
5035 can live with these defaults (which are platform specific), just pass a
5036 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
5037 driver linked statically to the program.
5038 <tag/Notes/<itemize>
5039 <item>Not all drivers are able to detect if the supported hardware is really
5041 <item>After installing a driver, the mouse cursor is hidden.
5042 <item>The function is only available as fastcall function, so it may only be
5043 used in presence of a prototype.
5045 <tag/Availability/cc65
5047 <ref id="mouse_load_driver" name="mouse_load_driver">,
5048 <ref id="mouse_uninstall" name="mouse_uninstall">,
5049 <ref id="mouse_unload" name="mouse_unload">
5055 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
5059 <tag/Function/Call the driver specific ioctl function.
5060 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5061 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
5062 <tag/Description/The function calls the IOCTL entry in the mouse driver,
5063 which is driver specific. The <tt/code/ parameter will choose between
5064 different IOCTL functions, and the <tt/data/ depends on code. The
5065 function returns an error code. The purpose of this function is to allow
5066 for driver specific extensions. See the documentation for a specific mouse
5067 driver for supported ioctl calls.
5068 <tag/Notes/<itemize>
5069 <item>Calling this function is non portable, because each driver may
5070 implement different ioctl calls (or none at all).
5071 <item>The function is only available as fastcall function, so it may only be
5072 used in presence of a prototype.
5074 <tag/Availability/cc65
5080 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
5084 <tag/Function/Load and initialize a mouse driver.
5085 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5086 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
5087 mouse_callbacks* c, const char* driver);/
5088 <tag/Description/Load a mouse driver into memory and initialize it. The
5089 function returns an error code that tells if the call has been successful. The
5090 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
5091 routines needed to move or hide/show the mouse pointer. Defaults for these
5092 routines are supplied by the library, so if you can live with these defaults
5093 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
5094 <tag/Notes/<itemize>
5095 <item>The driver is loaded by name, so currently you must know the type of
5096 mouse that should be supported. There is no autodetect capability.
5097 <item>Not all drivers are able to detect if the supported hardware is really
5099 <item>After installing a driver, the mouse cursor is hidden.
5100 <item>The function is only available as fastcall function, so it may only be
5101 used in presence of a prototype.
5103 <tag/Availability/cc65
5105 <ref id="mouse_install" name="mouse_install">,
5106 <ref id="mouse_uninstall" name="mouse_uninstall">,
5107 <ref id="mouse_unload" name="mouse_unload">
5113 <sect1>mouse_move<label id="mouse_move"><p>
5117 <tag/Function/Move the mouse cursor to a specific position.
5118 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5119 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
5120 <tag/Description/The function updates the mouse position. If the mouse cursor
5121 is visible, it is shown at the new position.
5122 <tag/Notes/<itemize>
5123 <item>The function does not check if the new position is within the bounding
5124 box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
5125 <item>The function is only available as fastcall function, so it may only be
5126 used in presence of a prototype.
5128 <tag/Availability/cc65
5130 <ref id="mouse_getbox" name="mouse_getbox">,
5131 <ref id="mouse_setbox" name="mouse_setbox">
5137 <sect1>mouse_pos<label id="mouse_pos"><p>
5141 <tag/Function/Return the position of the mouse.
5142 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5143 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
5144 <tag/Description/The function returns the position of the mouse in the
5145 <tt/mouse_pos/ structure passed as parameter.
5146 <tag/Notes/<itemize>
5147 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
5148 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
5149 name="mouse_info">/ instead.
5150 <item>The function is only available as fastcall function, so it may only be
5151 used in presence of a prototype.
5153 <tag/Availability/cc65
5155 <ref id="mouse_buttons" name="mouse_buttons">,
5156 <ref id="mouse_info" name="mouse_info">
5162 <sect1>mouse_show<label id="mouse_show"><p>
5166 <tag/Function/Show the mouse pointer.
5167 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5168 <tag/Declaration/<tt/void mouse_show (void);/
5169 <tag/Description/The function shows the mouse pointer. It manages a counter
5170 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
5171 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
5172 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
5173 <tag/Availability/cc65
5175 <ref id="mouse_hide" name="mouse_hide">
5181 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
5185 <tag/Function/Uninstall an already loaded mouse driver.
5186 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5187 <tag/Declaration/<tt/unsigned char mouse_uninstall (void);/
5188 <tag/Description/The function uninstalls an already loaded mouse driver but
5189 don't removes it from memory.
5190 <tag/Notes/<itemize>
5191 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
5192 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
5193 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
5196 <tag/Availability/cc65
5198 <ref id="mouse_install" name="mouse_install">,
5199 <ref id="mouse_load_driver" name="mouse_load_driver">,
5200 <ref id="mouse_unload" name="mouse_unload">
5206 <sect1>mouse_unload<label id="mouse_unload"><p>
5210 <tag/Function/Unload a mouse driver.
5211 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5212 <tag/Declaration/<tt/unsigned char mouse_unload (void);/
5213 <tag/Description/The function unloads a loaded mouse driver and frees all
5214 memory allocated for the driver.
5215 <tag/Notes/<itemize>
5216 <item>The function does nothing if no driver is loaded.
5218 <tag/Availability/cc65
5220 <ref id="mouse_install" name="mouse_install">,
5221 <ref id="mouse_load_driver" name="mouse_load_driver">,
5222 <ref id="mouse_uninstall" name="mouse_uninstall">
5228 <sect1>offsetof<label id="offsetof"><p>
5232 <tag/Function/Calculate the offset of a struct or union member.
5233 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
5234 <tag/Declaration/<tt/size_t offsetof (type, member);/
5235 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
5236 or <tt/union/ member.
5237 <tag/Notes/<itemize>
5238 <item>The function is actually a macro.
5240 <tag/Availability/ISO 9899
5246 <sect1>open<label id="open"><p>
5250 <tag/Function/Open and possibly create a file.
5251 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
5252 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
5253 <tag/Description/<tt/open/ opens a file and returns the file descriptor
5254 associated with it. On error, -1 is returned and an error code is stored in
5255 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
5256 <tag/Notes/<itemize>
5257 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
5258 open, which is used as the permission mask when a new file is created. While
5259 cc65 allows to pass this argument, it is ignored.
5261 <tag/Availability/POSIX 1003.1
5263 <ref id="close" name="close">,
5264 <ref id="creat" name="creat">
5270 <sect1>opendir<label id="opendir"><p>
5274 <tag/Function/Open a directory.
5275 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5276 <tag/Declaration/<tt/DIR* __fastcall__ opendir (const char* name);/
5277 <tag/Description/<tt/opendir/ opens a directory and returns the direcory
5278 descriptor associated with it. On error, NULL is returned and an error code is
5279 stored in <tt/errno/.
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.
5284 <tag/Availability/POSIX 1003.1
5286 <ref id="closedir" name="closedir">,
5287 <ref id="readdir" name="readdir">
5293 <sect1>peekbsys<label id="peekbsys"><p>
5297 <tag/Function/Read one byte from a location in the system bank.
5298 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5299 <tt/<ref id="cbm510.h" name="cbm510.h">/
5300 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
5301 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
5302 system bank (bank 15) of the CBM PET-II machines and returns it.
5303 <tag/Notes/<itemize>
5304 <item>The function is only available as fastcall function, so it may only
5305 be used in presence of a prototype.
5306 <item>This function may be a macro depending on the compiler options. The
5307 actual function is accessible by #undef'ing the macro.
5309 <tag/Availability/cc65
5311 <ref id="PEEK" name="PEEK">,
5312 <ref id="PEEKW" name="PEEKW">,
5313 <ref id="peekwsys" name="peekwsys">,
5314 <ref id="pokebsys" name="pokebsys">,
5315 <ref id="pokewsys" name="pokewsys">
5321 <sect1>peekwsys<label id="peekwsys"><p>
5325 <tag/Function/Read one word from a location in the system bank.
5326 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5327 <tt/<ref id="cbm510.h" name="cbm510.h">/
5328 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
5329 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
5330 system bank (bank 15) of the CBM PET-II machines and returns it. Following
5331 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
5332 high byte is read from <tt/addr+1/.
5333 <tag/Notes/<itemize>
5334 <item>The function is only available as fastcall function, so it may only
5335 be used in presence of a prototype.
5336 <item>The order in which the two bytes are read is undefined.
5338 <tag/Availability/cc65
5340 <ref id="PEEK" name="PEEK">,
5341 <ref id="PEEKW" name="PEEKW">,
5342 <ref id="peekbsys" name="peekbsys">,
5343 <ref id="pokebsys" name="pokebsys">,
5344 <ref id="pokewsys" name="pokewsys">
5350 <sect1>perror<label id="perror"><p>
5354 <tag/Function/Print an error message for the error in <tt/errno/.
5355 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5356 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
5357 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
5358 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
5359 a blank. Then the error message for the current contents of <tt/errno/ is
5360 printed followed by a newline. The message output is the same as returned by
5361 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
5362 <tag/Notes/<itemize>
5363 <item>The function is only available as fastcall function, so it may only
5364 be used in presence of a prototype.
5366 <tag/Availability/ISO 9899
5368 <ref id="_poserror" name="_poserror">,
5369 <ref id="strerror" name="strerror">
5375 <sect1>pokebsys<label id="pokebsys"><p>
5379 <tag/Function/Write one byte to a location in the system bank.
5380 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5381 <tt/<ref id="cbm510.h" name="cbm510.h">/
5382 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
5383 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
5384 system bank (bank 15) of the CBM PET-II machines.
5385 <tag/Notes/<itemize>
5386 <item>The function is only available as fastcall function, so it may only
5387 be used in presence of a prototype.
5389 <tag/Availability/cc65
5391 <ref id="POKE" name="POKE">,
5392 <ref id="POKEW" name="POKEW">,
5393 <ref id="peekbsys" name="peekbsys">,
5394 <ref id="peekwsys" name="peekwsys">,
5395 <ref id="pokewsys" name="pokewsys">
5401 <sect1>pokewsys<label id="pokewsys"><p>
5405 <tag/Function/Write one word to a location in the system bank.
5406 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5407 <tt/<ref id="cbm510.h" name="cbm510.h">/
5408 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
5409 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
5410 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
5411 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
5412 high byte is written to <tt/addr+1/.
5413 <tag/Notes/<itemize>
5414 <item>The function is only available as fastcall function, so it may only
5415 be used in presence of a prototype.
5416 <item>The order in which the two bytes are written is undefined.
5418 <tag/Availability/cc65
5420 <ref id="POKE" name="POKE">,
5421 <ref id="POKEW" name="POKEW">,
5422 <ref id="peekbsys" name="peekbsys">,
5423 <ref id="peekwsys" name="peekwsys">,
5424 <ref id="pokebsys" name="pokebsys">
5430 <sect1>qsort<label id="qsort"><p>
5434 <tag/Function/Sort an array.
5435 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5436 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
5437 size_t size, int __fastcall__ (* compare) (const void*, const void*));/
5438 <tag/Description/<tt/qsort/ sorts an array according to a given compare
5439 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
5440 is the number of elements, <tt/size/ the size of an element and <tt/compare/
5441 the function used to compare the members.
5442 <tag/Notes/<itemize>
5443 <item>If there are multiple members with the same key, the order after calling
5444 the function is undefined.
5445 <item>The function is only available as fastcall function, so it may only
5446 be used in presence of a prototype.
5447 <item>The function to which <tt/compare/ points must have the <tt/fastcall/
5450 <tag/Availability/ISO 9899
5452 <ref id="bsearch" name="bsearch">
5458 <sect1>raise<label id="raise"><p>
5462 <tag/Function/Send a signal to the executing program.
5463 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
5464 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
5465 <tag/Description/<tt/raise/ sends the given signal to the program. If the
5466 program has installed a signal handler for the signal, this signal handler
5467 will be executed. If no handler has been installed, the default action for
5468 the raised signal will be taken. The function returns zero on success,
5470 <tag/Notes/<itemize>
5471 <item>The function is only available as fastcall function, so it may only
5472 be used in presence of a prototype.
5474 <tag/Availability/ISO 9899
5476 <ref id="abort" name="abort">,
5477 <ref id="signal" name="signal">
5483 <sect1>rand<label id="rand"><p>
5487 <tag/Function/Return a pseudo random number.
5488 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5489 <tag/Declaration/<tt/int rand (void);/
5490 <tag/Description/The function returns a pseudo random number
5491 between 0 and <tt/RAND_MAX/ (exclusive).
5492 <tag/Notes/<itemize>
5493 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
5494 flow of numbers is generated.
5495 <item>On startup, the function behaves as if <ref id="srand" name="srand">
5496 had been used with an argument of 1.
5498 <tag/Availability/ISO 9899
5500 <ref id="_randomize" name="_randomize">,
5501 <ref id="srand" name="srand">
5507 <sect1>readdir<label id="readdir"><p>
5511 <tag/Function/Read a directory.
5512 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5513 <tag/Declaration/<tt/struct dirent* __fastcall__ readdir (DIR* dir);/
5514 <tag/Description/<tt/readdir/ reads the next directory entry from the directory
5515 stream pointed to by <tt/dir/. It stores the data in a <tt/dirent/ structure
5516 and returns a pointer to it. If the end of directory is reached, or an error
5517 occurs, NULL is returned. In case of errors, an error code is stored into
5519 <tag/Notes/<itemize>
5520 <item>The function is only available as fastcall function, so it may only
5521 be used in presence of a prototype.
5522 <item>The returned pointer may point to a statically allocated instance of
5523 <tt/struct dirent/, so it may get overwritten by subsequent calls to
5525 <item>On several platforms, namely the CBMs and the Atari, the disk drives get
5526 confused when opening/closing files between directory reads. So for example a
5527 program that reads the list of files on a disk, and after each call to
5528 <tt/readdir/, opens the file to process it, will fail.<newline>
5529 Possible solutions are reading the directory into memory before processing the
5530 file list, or to reset the directory by seeking to the correct position after
5531 opening/closing a file:
5533 seekdir (DIR, telldir (DIR));
5535 Platforms known to work without problems are: Apple.
5537 <tag/Availability/POSIX 1003.1
5539 <ref id="closedir" name="closedir">,
5540 <ref id="opendir" name="opendir">
5546 <sect1>realloc<label id="realloc"><p>
5550 <tag/Function/Change the size of an allocated memory block.
5551 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5552 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
5553 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
5554 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
5555 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
5556 behaves as if <tt/free/ had been called. On error (not enough memory
5557 available), <tt/realloc/ returns <tt/NULL/.
5558 <tag/Notes/<itemize>
5559 <item>The part of the memory block that is returned will have its contents
5561 <item>This function is somewhat dangerous to use. Be careful to save the
5562 pointer you're passing somewhere else, otherwise
5564 ptr = realloc (ptr, size);
5566 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
5567 <item>The function is only available as fastcall function, so it may only
5568 be used in presence of a prototype.
5570 <tag/Availability/ISO 9899
5572 <ref id="_heapadd" name="_heapadd">,
5573 <ref id="_heapblocksize" name="_heapblocksize">,
5574 <ref id="_heapmaxavail" name="_heapmaxavail">,
5575 <ref id="_heapmemavail" name="_heapmemavail">,
5576 <ref id="calloc" name="calloc">,
5577 <ref id="free" name="free">,
5578 <ref id="realloc" name="realloc">
5584 <sect1>remove<label id="remove"><p>
5588 <tag/Function/Delete a file.
5589 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5590 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
5591 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
5592 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5593 code describing the reason for the failure.
5594 <tag/Notes/<itemize>
5595 <item>This function is not available on all cc65 targets (depends on the
5596 availability of file I/O).
5597 <item>The function is only available as fastcall function, so it may only
5598 be used in presence of a prototype.
5600 <tag/Availability/ISO 9899
5602 <ref id="rename" name="rename">,
5603 <ref id="unlink" name="unlink">
5606 #include <stdio.h>
5608 #define FILENAME "helloworld"
5610 if (remove (FILENAME) == 0) {
5611 printf ("We deleted %s successfully\n", FILENAME);
5613 printf ("There was a problem deleting %s\n", FILENAME);
5620 <sect1>rename<label id="rename"><p>
5624 <tag/Function/Rename a file.
5625 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5626 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
5627 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
5628 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5629 code describing the reason for the failure.
5630 <tag/Notes/<itemize>
5631 <item>This function is not available on all cc65 targets (depends on the
5632 capabilities of the storage devices).
5633 <item>The function is only available as fastcall function, so it may only
5634 be used in presence of a prototype.
5636 <tag/Availability/ISO 9899
5638 <ref id="remove" name="remove">
5641 #include <stdio.h>
5643 #define OLDNAME "textfile.txt"
5644 #define NEWNAME "textfile.bak"
5646 if (rename (OLDNAME, NEWNAME) == 0) {
5647 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
5649 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
5656 <sect1>reset_brk<label id="reset_brk"><p>
5660 <tag/Function/Resets the break vector to its original value.
5661 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5662 <tag/Declaration/<tt/void reset_brk (void);/
5663 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
5664 before a call to <tt/set_brk/.
5665 <tag/Notes/<itemize>
5666 <item>The break vector is reset on program termination, so it's not strictly
5667 necessary to call this function as a part of your clean-up when exitting the program.
5669 <tag/Availability/cc65
5671 <ref id="reset_irq" name="reset_irq">,
5672 <ref id="set_brk" name="set_brk">,
5673 <ref id="set_irq" name="set_irq">
5679 <sect1>reset_irq<label id="reset_irq"><p>
5683 <tag/Function/Resets the C level interrupt request vector.
5684 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5685 <tag/Declaration/<tt/void reset_irq (void);/
5686 <tag/Description/<tt/reset_irq/ resets the C level interrupt request vector.
5687 <tag/Notes/<itemize>
5688 <item>The interrupt vector is reset on program termination, so it's not strictly
5689 necessary to call this function as a part of your clean-up when exitting the program.
5691 <tag/Availability/cc65
5693 <ref id="reset_brk" name="reset_brk">,
5694 <ref id="set_brk" name="set_brk">,
5695 <ref id="set_irq" name="set_irq">
5701 <sect1>revers<label id="revers"><p>
5705 <tag/Function/Control revers character display.
5706 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5707 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
5708 <tag/Description/If the argument is non zero, the function enables reverse
5709 character display. If the argument is zero, reverse character display is
5710 switched off. The old value of the setting is returned.
5711 <tag/Notes/<itemize>
5712 <item>The function may not be supported by the hardware, in which case
5713 the call is ignored.
5714 <item>The function is only available as fastcall function, so it may only
5715 be used in presence of a prototype.
5717 <tag/Availability/cc65
5719 <ref id="textcolor" name="textcolor">
5725 <sect1>rewinddir<label id="rewinddir"><p>
5729 <tag/Function/Reset a directory stream.
5730 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5731 <tag/Declaration/<tt/void __fastcall__ rewinddir (DIR* dir);/
5732 <tag/Description/<tt/rewinddir/ sets the position of the directory stream
5733 pointed to by <tt/dir/ to the start of the directory.
5734 <tag/Notes/<itemize>
5735 <item>The function is only available as fastcall function, so it may only
5736 be used in presence of a prototype.
5738 <tag/Availability/POSIX 1003.1
5740 <ref id="seekdir" name="seekdir">,
5741 <ref id="telldir" name="telldir">
5747 <sect1>screensize<label id="screensize"><p>
5751 <tag/Function/Return the dimensions of the text mode screen.
5752 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5753 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
5754 <tag/Description/The function returns the dimensions of the text mode screen.
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.
5759 <tag/Availability/cc65
5761 <ref id="gotox" name="gotox">,
5762 <ref id="gotoxy" name="gotoxy">,
5763 <ref id="gotoy" name="gotoy">,
5764 <ref id="wherex" name="wherex">,
5765 <ref id="wherey" name="wherey">
5771 <sect1>seekdir<label id="seekdir"><p>
5775 <tag/Function/Set the position of a directory stream.
5776 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5777 <tag/Declaration/<tt/void __fastcall__ seekdir (DIR* dir, long offset);/
5778 <tag/Description/<tt/seekdir/ sets the position of the directory stream
5779 pointed to by <tt/dir/ to the value given in <tt/offset/, which should be a
5780 value returned by <tt/<ref id="telldir" name="telldir">/.
5781 <tag/Notes/<itemize>
5782 <item>The function is only available as fastcall function, so it may only
5783 be used in presence of a prototype.
5785 <tag/Availability/POSIX 1003.1
5787 <ref id="rewinddir" name="rewinddir">,
5788 <ref id="telldir" name="telldir">
5794 <sect1>ser_close<label id="ser_close"><p>
5798 <tag/Function/Close the port and disable interrupts
5799 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5800 <tag/Declaration/<tt/unsigned char ser_close (void);/
5801 <tag/Description/Close the port by clearing buffers and disable interrupts.
5802 <tag/Availability/cc65
5803 <tag/See also/Other serial functions.
5808 static void initialize(){
5809 struct ser_params params = {
5816 ser_install(lynx_comlynx); // This will activate the ComLynx
5818 ser_open(&params);
5825 <sect1>ser_get<label id="ser_get"><p>
5829 <tag/Function/Read a character from serial port.
5830 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5831 <tag/Declaration/<tt/unsigned char __fastcall__ ser_get (char* b);/
5832 <tag/Description/Get a character from the serial port. If no characters are
5833 available, the function will return SER_ERR_NO_DATA, so this is not a fatal
5835 <tag/Notes/<itemize>
5836 <item>The function is only available as fastcall function, so it may only
5837 be used in presence of a prototype.
5839 <tag/Availability/cc65
5840 <tag/See also/Other serial functions.
5842 Wait for a character to be available from a serial port.
5845 while (ser_get(&ch) == SER_ERR_NO_DATA)
5852 <sect1>ser_install<label id="ser_install"><p>
5856 <tag/Function/Install an already loaded driver and return an error code.
5857 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5858 <tag/Declaration/<tt/unsigned char __fastcall__ ser_install (void* driver);/
5859 <tag/Description/The function installs a driver that was already loaded into
5860 memory (or linked statically to the program). It returns an error code
5861 (<tt/SER_ERR_OK/ in case of success).
5862 <tag/Notes/<itemize>
5863 <item>The function is only available as fastcall function, so it may only be
5864 used in presence of a prototype.
5866 <tag/Availability/cc65
5868 <ref id="ser_load_driver" name="ser_load_driver">,
5869 <ref id="ser_uninstall" name="ser_uninstall">,
5870 <ref id="ser_unload" name="ser_unload">
5872 ser_install(lynx_comlynx); //Include the driver statically instead of loading it.
5878 <sect1>ser_ioctl<label id="ser_ioctl"><p>
5882 <tag/Function/Platform dependent code extensions.
5883 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5884 <tag/Declaration/<tt/unsigned __fastcall__ ser_ioctl (unsigned char code, void* data);/
5885 <tag/Description/Some platforms have extra serial functions that are not
5886 supported by standard serial driver functions. You can extend the driver to support
5887 this extra functionality bt using ser_ioctl functions.
5888 <tag/Notes/<itemize>
5889 <item>The function is only available as fastcall function, so it may only
5890 be used in presence of a prototype.
5891 <item>These functions are not easily portable to other cc65 platforms.
5893 <tag/Availability/cc65
5894 <tag/See also/Other serial functions.
5899 <sect1>ser_load_driver<label id="ser_load_driver"><p>
5903 <tag/Function/Load and install a serial driver.
5904 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5905 <tag/Declaration/<tt/unsigned char __fastcall__ ser_load_driver (const char *name);/
5906 <tag/Description/Load and install the driver by name.
5907 Will just load the driver and check if loading was successful.
5908 <tag/Notes/<itemize>
5909 <item>The function is only available as fastcall function, so it may only
5910 be used in presence of a prototype.
5912 <tag/Availability/cc65
5913 <tag/See also/Other serial functions.
5919 <sect1>ser_open<label id="ser_open"><p>
5923 <tag/Function/Open the port by setting the port parameters and enable interrupts
5924 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5925 <tag/Declaration/<tt/unsigned char __fastcall__ ser_open (const struct ser_params* params);/
5926 <tag/Description/Open the port by setting the port parameters and enable interrupts.
5927 <tag/Notes/<itemize>
5928 <item>The function is only available as fastcall function, so it may only
5929 be used in presence of a prototype.
5931 <tag/Availability/cc65
5932 <tag/See also/Other serial functions.
5937 static void initialize(){
5938 struct ser_params params = {
5945 ser_install(lynx_comlynx); // This will activate the ComLynx
5947 ser_open(&params);
5954 <sect1>ser_put<label id="ser_put"><p>
5958 <tag/Function/Write a character to a serial port.
5959 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5960 <tag/Declaration/<tt/unsigned char __fastcall__ ser_put (char b);/
5961 <tag/Description/Send a character via the serial port. There is a transmit
5962 buffer, but transmitting is not done via interrupt. The function returns
5963 SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
5964 <tag/Notes/<itemize>
5965 <item>The function is only available as fastcall function, so it may only
5966 be used in presence of a prototype.
5968 <tag/Availability/cc65
5969 <tag/See also/Other serial functions.
5978 <sect1>ser_status<label id="ser_status"><p>
5982 <tag/Function/Return the serial port status.
5983 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5984 <tag/Declaration/<tt/unsigned char __fastcall__ ser_status (unsigned char* status);/
5985 <tag/Description/Return the serial port status.
5986 <tag/Notes/<itemize>
5987 <item>The function is only available as fastcall function, so it may only
5988 be used in presence of a prototype.
5990 <tag/Availability/cc65
5991 <tag/See also/Other serial functions.
5997 <sect1>ser_uninstall<label id="ser_uninstall"><p>
6001 <tag/Function/Uninstall the currently loaded driver but do not unload it.
6002 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6003 <tag/Declaration/<tt/unsigned char ser_uninstall (void);/
6004 <tag/Description/Uninstall the currently loaded driver but do not unload it.
6005 <tag/Availability/cc65
6006 <tag/See also/Other serial functions.
6011 <sect1>ser_unload<label id="ser_unload"><p>
6015 <tag/Function/Uninstall, then unload the currently loaded driver.
6016 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6017 <tag/Declaration/<tt/unsigned char ser_unload (void);/
6018 <tag/Description/Uninstall, then unload the currently loaded driver.
6019 <tag/Availability/cc65
6020 <tag/See also/Other serial functions.
6026 <sect1>set_brk<label id="set_brk"><p>
6030 <tag/Function/Set the break vector to a user function.
6031 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
6032 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
6033 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
6034 program code by letting the vector point to a user written C function. The
6035 runtime library installs a small stub that saves the registers into global
6036 variables that may be accessed (and changed) by the break handler.
6037 <tag/Notes/<itemize>
6038 <item>The function is only available as fastcall function, so it may only
6039 be used in presence of a prototype.
6040 <item>The stub saves the zero page registers used by the C runtime and switches
6041 to a small break handler stack. This means that it is safe to execute C code,
6042 even if C code was interrupted. Be careful however not to use too many local
6043 variables, and do not enable stack checks for the handler function or any other
6044 function called from it.
6045 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
6046 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
6047 otherwise the <tt/BRK/ instruction will get executed over and over again.
6048 <item>The break vector is reset on program termination, so it's not strictly
6049 necessary to call <tt/<ref id="reset_brk" name="reset_brk">/ as a part of your
6050 clean-up when exitting the program.
6052 <tag/Availability/cc65
6054 <ref id="reset_brk" name="reset_brk">
6060 <sect1>set_irq<label id="set_irq"><p>
6064 <tag/Function/Set the C level interrupt request vector to the given address.
6065 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
6066 <tag/Declaration/<tt/void __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);/
6067 <tag/Description/<tt/set_irq/ allows a user program to handle interrupt requests
6068 (IRQs) within the program code by letting the vector point to a user written C
6069 function. The runtime library installs a small stub that saves the zero page
6070 registers used by the C runtime before calling the handler function and restores
6071 them after the handler function returns. Additionally the stub temporarily switches
6072 the C runtime stack to the stack area provided as parameter. If the handler function
6073 was set up to handle a "private", "exclusive" interrupt request source it must
6074 return the value <tt/IRQ_HANDLED/ if and only if it has verified that the current
6075 interrupt request actually stems from that source. In all other cases it must return
6076 the value <tt/IRQ_NOT_HANDLED/.
6077 <tag/Notes/<itemize>
6078 <item>The function is only available as fastcall function, so it may only
6079 be used in presence of a prototype.
6080 <item>The stub saves the registers and zero page locations used by the C runtime
6081 and switches to the provided stack area. As a consequence, there is some
6082 runtime overhead, but it it is safe to execute C code, even if other C code
6083 was interrupted. Be careful however not to call C library functions, and do not
6084 enable stack checks for the handler function or any other function called from
6086 <item>The interrupt vector is reset on program termination, so it's not strictly
6087 necessary to call <tt/<ref id="reset_irq" name="reset_irq">/ as a part of your
6088 clean-up when exitting the program.
6090 <tag/Availability/cc65
6092 <ref id="reset_brk" name="reset_brk">,
6093 <ref id="reset_irq" name="reset_irq">,
6094 <ref id="set_brk" name="set_brk">
6100 <sect1>set_c64dtv_speed<label id="set_c64dtv_speed"><p>
6104 <tag/Function/Set the current speed of the C64DTV.
6105 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6106 <tag/Declaration/<tt/unsigned char __fastcall__ set_c64dtv_speed (unsigned char speed);/
6107 <tag/Description/The function returns the speed after trying to set the speed of the C64DTV.
6108 <tag/Notes/<itemize>
6109 <item>The function is specific to the C64.
6110 <item>The function does not check for the presence of the C64DTV.
6111 <item>See the accelerator.h header for the speed definitions.
6113 <tag/Availability/cc65 (not all platforms)
6115 <ref id="detect_c64dtv" name="detect_c64dtv">,
6116 <ref id="get_c64dtv_speed" name="get_c64dtv_speed">,
6122 <sect1>set_scpu_speed<label id="set_scpu_speed"><p>
6126 <tag/Function/Set the current speed of the C64/C128 SuperCPU cartridge.
6127 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6128 <tag/Declaration/<tt/unsigned char __fastcall__ set_scpu_speed (unsigned char speed);/
6129 <tag/Description/The function returns the speed after trying to set the speed of the SuperCPU cartridge.
6130 <tag/Notes/<itemize>
6131 <item>The function is specific to the C128 and C64.
6132 <item>The function does not check for the presence of the cartridge.
6133 <item>See the accelerator.h header for the speed definitions.
6135 <tag/Availability/cc65 (not all platforms)
6137 <ref id="detect_scpu" name="detect_scpu">,
6138 <ref id="get_scpu_speed" name="get_scpu_speed">,
6144 <sect1>setjmp<label id="setjmp"><p>
6148 <tag/Function/Save the context for use with <tt/longjmp/.
6149 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
6150 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
6151 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
6152 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
6154 <tag/Notes/<itemize>
6155 <item>The function is only available as fastcall function, so it may only
6156 be used in presence of a prototype.
6157 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
6158 <item><tt/setjmp/ will not save the signal context.
6160 <tag/Availability/ISO 9899
6162 <ref id="longjmp" name="longjmp">
6168 <sect1>setlocale<label id="setlocale"><p>
6172 <tag/Function/Selects a locale.
6173 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
6174 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
6175 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
6176 <tag/Notes/<itemize>
6177 <item>The function is only available as fastcall function, so it may only
6178 be used in presence of a prototype.
6179 <item>cc65 supports only the "C" locale, so calling this function to set a
6180 different locale has no effect.
6182 <tag/Availability/ISO 9899
6184 <ref id="localeconv" name="localeconv">,
6185 <ref id="strcoll" name="strcoll">
6186 <ref id="strxfrm" name="strxfrm">
6192 <sect1>signal<label id="signal"><p>
6196 <tag/Function/Install a signal handler.
6197 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
6198 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
6199 <tag/Description/<tt/signal/ installs a handler for the given signal. The
6200 handler may either be a user supplied function, or one of the predefined
6201 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
6202 previous value if the signal , or the special function vector SIG_ERR in
6204 <tag/Notes/<itemize>
6205 <item>The function is only available as fastcall function, so it may only
6206 be used in presence of a prototype.
6208 <tag/Availability/ISO 9899
6210 <ref id="abort" name="abort">,
6211 <ref id="raise" name="raise">
6217 <sect1>sleep<label id="sleep"><p>
6221 <tag/Function/Sleep for a specified amount of time.
6222 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
6223 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
6224 <tag/Description/The function will return after the specified number of
6225 seconds have elapsed.
6226 <tag/Notes/<itemize>
6227 <item>The function is only available as fastcall function, so it may only
6228 be used in presence of a prototype.
6230 <tag/Availability/POSIX 1003.1
6236 <sect1>slow<label id="slow"><p>
6240 <tag/Function/Switch the CPU into slow mode (C128: 1MHz mode, C16/Plus4: single clock mode).
6241 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
6242 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
6243 <tag/Declaration/<tt/void slow (void);/
6244 <tag/Description/The function will switch the clock of the CPU to slow mode. for the C128
6245 target it means switching the CPU into 1MHz mode. for the C16/Plus4 target it means
6246 switching the CPU into single clock mode.
6247 <tag/Notes/<itemize>
6248 <item>The function is specific to the C128, C16 and Plus4.
6250 <tag/Availability/cc65 (not all platforms)
6252 <ref id="fast" name="fast">,
6253 <ref id="isfast" name="isfast">,
6259 <sect1>srand<label id="srand"><p>
6263 <tag/Function/Initialize the pseudo random number generator.
6264 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
6265 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
6266 <tag/Description/The function initializes the random number generator using
6267 the given seed. On program startup, the generator behaves as if <tt/srand/ has
6268 been called with an argument of 1.
6269 <tag/Notes/<itemize>
6270 <item>The function is only available as fastcall function, so it may only
6271 be used in presence of a prototype.
6273 <tag/Availability/ISO 9899
6275 <ref id="_randomize" name="_randomize">,
6276 <ref id="rand" name="rand">
6282 <sect1>strcasecmp<label id="strcasecmp"><p>
6286 <tag/Function/Compare two strings case insensitive.
6287 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6288 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
6289 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
6290 as parameters without case sensitivity. It returns a value that is less than
6291 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
6292 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
6293 <tag/Notes/<itemize>
6294 <item>The function is only available as fastcall function, so it may only
6295 be used in presence of a prototype.
6296 <item>The function is not available in strict ANSI mode.
6298 <tag/Availability/cc65
6300 <ref id="strcmp" name="strcmp">,
6301 <ref id="strcoll" name="strcoll">,
6302 <ref id="stricmp" name="stricmp">,
6303 <ref id="strncmp" name="strncmp">,
6304 <ref id="strxfrm" name="strxfrm">
6310 <sect1>strcat<label id="strcat"><p>
6314 <tag/Function/Concatentate two strings.
6315 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6316 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
6317 <tag/Description/The <tt/strcat/ function appends a copy of the string
6318 pointed to by s2 (including the terminating null byte) to the end of the
6319 string pointed to by s1. The initial byte of s2 overwrites the null byte at
6321 <tag/Notes/<itemize>
6322 <item>The function is only available as fastcall function, so it may only
6323 be used in presence of a prototype.
6324 <item>If copying takes place between objects that overlap, the behaviour
6327 <tag/Availability/ISO 9899
6329 <ref id="strcpy" name="strcpy">,
6330 <ref id="strncat" name="strncat">,
6331 <ref id="strncpy" name="strncpy">
6337 <sect1>strchr<label id="strchr"><p>
6341 <tag/Function/Search for a character in a string.
6342 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6343 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
6344 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
6345 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6346 byte is considered to be part of the string. Upon completion, the function
6347 returns a pointer to the byte, or a null pointer if the byte was not found.
6348 <tag/Notes/<itemize>
6349 <item>The function is only available as fastcall function, so it may only
6350 be used in presence of a prototype.
6352 <tag/Availability/ISO 9899
6354 <ref id="memchr" name="memchr">,
6355 <ref id="strrchr" name="strrchr">
6361 <sect1>strcmp<label id="strcmp"><p>
6365 <tag/Function/Compare two strings.
6366 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6367 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
6368 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
6369 parameters. It returns a value that is less than zero if <tt/s1/ is less than
6370 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
6371 if <tt/s1/ is greater than <tt/s2/.
6372 <tag/Notes/<itemize>
6373 <item>The function is only available as fastcall function, so it may only
6374 be used in presence of a prototype.
6376 <tag/Availability/ISO 9899
6378 <ref id="strcasecmp" name="strcasecmp">,
6379 <ref id="strcoll" name="strcoll">,
6380 <ref id="stricmp" name="stricmp">,
6381 <ref id="strncmp" name="strncmp">
6382 <ref id="strxfrm" name="strxfrm">
6388 <sect1>strcoll<label id="strcoll"><p>
6392 <tag/Function/Compare two strings.
6393 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6394 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
6395 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
6396 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
6397 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
6398 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
6399 than zero if <tt/s1/ is greater than <tt/s2/.
6400 <tag/Notes/<itemize>
6401 <item>The function is only available as fastcall function, so it may only
6402 be used in presence of a prototype.
6404 <tag/Availability/ISO 9899
6406 <ref id="setlocale" name="setlocale">,
6407 <ref id="strcasecmp" name="strcasecmp">,
6408 <ref id="strcmp" name="strcmp">,
6409 <ref id="stricmp" name="stricmp">,
6410 <ref id="strncmp" name="strncmp">,
6411 <ref id="strxfrm" name="strxfrm">
6417 <sect1>strcpy<label id="strcpy"><p>
6421 <tag/Function/Copy a string.
6422 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6423 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
6424 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
6425 <tt/s2/ (including the terminating null byte) into the array pointed to by
6426 <tt/s1/. The function will always return <tt/s1/.
6427 <tag/Notes/<itemize>
6428 <item>The function is only available as fastcall function, so it may only
6429 be used in presence of a prototype.
6430 <item>If copying takes place between objects that overlap, the behaviour
6433 <tag/Availability/ISO 9899
6435 <ref id="strcat" name="strcat">,
6436 <ref id="strncat" name="strncat">,
6437 <ref id="strncpy" name="strncpy">
6440 #include <string.h>
6442 static char hello[14];
6444 strcpy (hello, "Hello world!\n");
6450 <sect1>strcspn<label id="strcspn"><p>
6454 <tag/Function/Compute the length of a substring.
6455 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6456 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
6457 <tag/Description/The <tt/strcspn/ function computes and returns the length of
6458 the substring pointed to by <tt/s/ which does <em>not</em> consist of
6459 characters contained in the string <tt/set/.
6460 <tag/Notes/<itemize>
6461 <item>The function is only available as fastcall function, so it may only
6462 be used in presence of a prototype.
6464 <tag/Availability/ISO 9899
6466 <ref id="strqtok" name="strqtok">,
6467 <ref id="strspn" name="strspn">,
6468 <ref id="strstr" name="strstr">,
6469 <ref id="strtok" name="strtok">
6475 <sect1>strdup<label id="strdup"><p>
6479 <tag/Function/Allocate a copy of a string on the heap.
6480 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6481 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
6482 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
6483 to hold a copy of <tt/s/ including the terminating zero. If the allocation
6484 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
6485 memory block, and a pointer to the block is returned.
6486 <tag/Notes/<itemize>
6487 <item>The function is only available as fastcall function, so it may only
6488 be used in presence of a prototype.
6489 <item>It is up to the caller to free the allocated memory block.
6491 <tag/Availability/ISO 9899
6493 <ref id="free" name="free">,
6494 <ref id="malloc" name="malloc">
6500 <sect1>strerror<label id="strerror"><p>
6504 <tag/Function/Return a string describing an error code.
6505 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6506 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
6507 <tag/Description/The <tt/strerror/ function returns a string describing the
6508 given error code. If an invalid error code is passed, the string "Unknown
6509 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
6510 <tt/errno/ is left untouched.
6511 <tag/Notes/<itemize>
6512 <item>The function is only available as fastcall function, so it may only
6513 be used in presence of a prototype.
6514 <item>While the return type of the function is a <tt/char*/, the returned
6515 string must not be modified by the caller!
6517 <tag/Availability/ISO 9899
6519 <ref id="_stroserror" name="_stroserror">
6525 <sect1>stricmp<label id="stricmp"><p>
6529 <tag/Function/Compare two strings case insensitive.
6530 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6531 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
6532 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
6533 parameters without case sensitivity. It returns a value that is less than zero
6534 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
6535 value greater than zero if <tt/s1/ is greater than <tt/s2/.
6536 <tag/Notes/<itemize>
6537 <item>The function is only available as fastcall function, so it may only
6538 be used in presence of a prototype.
6539 <item>The function is not available in strict ANSI mode.
6541 <tag/Availability/cc65
6543 <ref id="strcasecmp" name="strcasecmp">,
6544 <ref id="strcmp" name="strcmp">,
6545 <ref id="strcoll" name="strcoll">,
6546 <ref id="strncmp" name="strncmp">,
6547 <ref id="strxfrm" name="strxfrm">
6553 <sect1>strlen<label id="strlen"><p>
6557 <tag/Function/Return the length of a string.
6558 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6559 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
6560 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
6561 string to which s points, not including the terminating null byte.
6562 <tag/Notes/<itemize>
6563 <item>The function is only available as fastcall function, so it may only
6564 be used in presence of a prototype.
6565 <item>When compiling with <tt/-Os/ (inline known standard functions), the
6566 function does not work correctly for strings with more than 255 characters.
6568 <tag/Availability/ISO 9899
6570 <ref id="strcpy" name="strcpy">
6576 <sect1>strlower<label id="strlower"><p>
6580 <tag/Function/Make a string lower case.
6581 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6582 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
6583 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
6584 function to each character of a string. The function will always return <tt/s/.
6585 <tag/Notes/<itemize>
6586 <item>The function is only available as fastcall function, so it may only
6587 be used in presence of a prototype.
6588 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6589 <item>An alias name for this function is <tt/strlwr/.
6591 <tag/Availability/cc65
6593 <ref id="strupper" name="strupper">,
6594 <ref id="tolower" name="tolower">
6600 <sect1>strlwr<label id="strlwr"><p>
6607 <sect1>strncasecmp<label id="strncasecmp"><p>
6611 <tag/Function/Compare two strings case insensitive.
6612 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6613 <tag/Declaration/<tt/int __fastcall__ strncasecmp (const char* s1, const char* s2, size_t count);/
6614 <tag/Description/The <tt/strncasecmp/ function compares the two strings passed
6615 as parameters without case sensitivity. It returns a value that is less than
6616 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
6617 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
6618 <tag/Notes/<itemize>
6619 <item>The function is only available as fastcall function, so it may only
6620 be used in presence of a prototype.
6621 <item>The function is not available in strict ANSI mode.
6623 <tag/Availability/cc65
6625 <ref id="strcmp" name="strcmp">,
6626 <ref id="strcoll" name="strcoll">,
6627 <ref id="stricmp" name="stricmp">,
6628 <ref id="strncmp" name="strncmp">,
6629 <ref id="strxfrm" name="strxfrm">
6635 <sect1>strncat<label id="strncat"><p>
6639 <tag/Function/Concatentate two strings.
6640 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6641 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
6642 <tag/Description/The <tt/strncat/ function appends not more than n characters
6643 of the string pointed to by s2 to the end of the string pointed to by s1. The
6644 terminating null character at the end of s1 is overwritten. A terminating null
6645 character is appended to the result, even if not all of s2 is appended to s1.
6646 <tag/Notes/<itemize>
6647 <item>The function is only available as fastcall function, so it may only
6648 be used in presence of a prototype.
6649 <item>If copying takes place between objects that overlap, the behaviour
6652 <tag/Availability/ISO 9899
6654 <ref id="strcpy" name="strcpy">,
6655 <ref id="strncat" name="strncat">,
6656 <ref id="strncpy" name="strncpy">
6662 <sect1>strncmp<label id="strncmp"><p>
6666 <tag/Function/Compare two strings.
6667 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6668 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
6669 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
6670 characters of the two strings passed as parameters. It returns a value that is
6671 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
6672 <tt/s2/, zero if they are identical, and a value greater than zero they are
6674 <tag/Notes/<itemize>
6675 <item>The function is only available as fastcall function, so it may only
6676 be used in presence of a prototype.
6678 <tag/Availability/ISO 9899
6680 <ref id="strcasecmp" name="strcasecmp">,
6681 <ref id="strcmp" name="strcmp">,
6682 <ref id="strcoll" name="strcoll">,
6683 <ref id="stricmp" name="stricmp">,
6684 <ref id="strxfrm" name="strxfrm">
6690 <sect1>strncpy<label id="strncpy"><p>
6694 <tag/Function/Copy part of a string.
6695 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6696 <tag/Declaration/<tt/char* __fastcall__ strncpy (char* s1, const char* s2, size_t n);/
6697 <tag/Description/The <tt/strncpy/ function copies not more than <tt/n/ bytes from
6698 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
6699 pointed to by <tt/s2/ is a string that is shorter than <tt/n/ bytes, null bytes are
6700 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
6701 written. The function always will return <tt/s1/.
6702 <tag/Notes/<itemize>
6703 <item>The function is available only as a fastcall function; so, it may be used
6704 only in the presence of a prototype.
6705 <item>If there is no null byte in the first <tt/n/ bytes of the array pointed
6706 to by <tt/s2/, the result is <em/not/ null-terminated!
6707 <item>If copying takes place between objects that overlap, the behaviour is
6710 <tag/Availability/ISO 9899
6712 <ref id="memcpy" name="memcpy">,
6713 <ref id="strcat" name="strcat">,
6714 <ref id="strcpy" name="strcpy">,
6715 <ref id="strncat" name="strncat">
6720 static char hello[6];
6722 strncpy (hello, "Hello world!\n", sizeof hello - 1)[5] = '\0';
6728 <sect1>strnicmp<label id="strnicmp"><p>
6732 <tag/Function/Compare two strings case insensitive.
6733 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6734 <tag/Declaration/<tt/int __fastcall__ strnicmp (const char* s1, const char* s2, size_t count);/
6735 <tag/Description/The <tt/strnicmp/ function compares the two strings passed as
6736 parameters without case sensitivity. It returns a value that is less than zero
6737 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
6738 value greater than zero if <tt/s1/ is greater than <tt/s2/.
6739 <tag/Notes/<itemize>
6740 <item>The function is only available as fastcall function, so it may only
6741 be used in presence of a prototype.
6742 <item>The function is not available in strict ANSI mode.
6744 <tag/Availability/cc65
6746 <ref id="strcasecmp" name="strcasecmp">,
6747 <ref id="strcmp" name="strcmp">,
6748 <ref id="strcoll" name="strcoll">,
6749 <ref id="strncmp" name="strncmp">,
6750 <ref id="strxfrm" name="strxfrm">
6756 <sect1>strqtok<label id="strqtok"><p>
6760 <tag/Function/Break a string into tokens.
6761 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6762 <tag/Declaration/<tt/char* __fastcall__ strqtok (char* s1, const char* s2);/
6763 <tag/Description/<tt/strqtok()/ will break the string <tt/s1/ into a sequence of
6764 tokens, which are delimited by either quotation marks or characters from the
6765 string <tt/s2/. Tokens inside quotation marks may contain characters from <tt/s2/
6766 (they aren't delimiters there). The first call to <tt/strqtok()/ will return a
6767 pointer to the first token in the string <tt/s1/. The following calls must pass
6768 a <tt/NULL/ pointer as <tt/s1/, in order to get the next token in the string.
6769 Different sets of delimiters may be used for the subsequent calls to <tt/strqtok()/.
6770 <tag/Notes/<itemize>
6771 <item>The function is available only as a fastcall function; so, it may be used
6772 only in the presence of a prototype.
6773 <item><tt/strqtok()/ will modify the string <tt/s1/.
6774 <item>The function will forget where it is in the <tt/s1/ string if it is given
6775 a second <tt/s1/ string before it finishes the first one.
6777 <tag/Availability/cc65
6779 <ref id="strcspn" name="strcspn">,
6780 <!-- <ref id="strpbrk" name="strpbrk">, -->
6781 <ref id="strspn" name="strspn">,
6782 <ref id="strtok" name="strtok">
6788 <sect1>strrchr<label id="strrchr"><p>
6792 <tag/Function/Search for a character in a string.
6793 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6794 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
6795 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
6796 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6797 byte is considered to be part of the string. Upon completion, the function
6798 returns a pointer to the byte, or a null pointer if the byte was not found.
6799 <tag/Notes/<itemize>
6800 <item>The function is only available as fastcall function, so it may only
6801 be used in presence of a prototype.
6803 <tag/Availability/ISO 9899
6805 <ref id="strchr" name="strchr">
6811 <sect1>strspn<label id="strspn"><p>
6815 <tag/Function/Compute the length of a substring.
6816 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6817 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
6818 <tag/Description/The <tt/strspn/ function computes and returns the length of
6819 the substring pointed to by <tt/s/ which does consist only of characters
6820 contained in the string <tt/set/.
6821 <tag/Notes/<itemize>
6822 <item>The function is only available as fastcall function, so it may only
6823 be used in presence of a prototype.
6825 <tag/Availability/ISO 9899
6827 <ref id="strcspn" name="strcspn">,
6828 <ref id="strstr" name="strstr">
6834 <sect1>strstr<label id="strstr"><p>
6838 <tag/Function/Find a substring.
6839 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6840 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
6841 <tag/Description/<tt/strstr/ searches for the first occurance of the string
6842 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
6843 otherwise it returns <tt/NULL/.
6844 <tag/Notes/<itemize>
6845 <item>The function is only available as fastcall function, so it may only
6846 be used in presence of a prototype.
6848 <tag/Availability/ISO 9899
6850 <ref id="strcspn" name="strcspn">,
6851 <ref id="strspn" name="strspn">
6857 <sect1>strtok<label id="strtok"><p>
6861 <tag/Function/Break a string into tokens.
6862 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6863 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
6864 <tag/Description/<tt/strtok()/ will break the string <tt/s1/ into a sequence of
6865 tokens, which are delimited by characters from the string <tt/s2/. The first call
6866 to <tt/strtok()/ will return a pointer to the first token in the string <tt/s1/.
6867 The following calls must pass a <tt/NULL/ pointer as <tt/s1/, in order to get
6868 the next token in the string. Different sets of delimiters may be used for the
6869 subsequent calls to <tt/strtok()/.
6870 <tag/Notes/<itemize>
6871 <item>The function is only available as fastcall function, so it may only
6872 be used in presence of a prototype.
6873 <item><tt/strtok()/ will modify the string <tt/s1/.
6874 <item>The function will forget where it is in the <tt/s1/ string if it is given
6875 a second <tt/s1/ string before it finishes the first one.
6877 <tag/Availability/ISO 9899
6879 <ref id="strcspn" name="strcspn">,
6880 <!-- <ref id="strpbrk" name="strpbrk">, -->
6881 <ref id="strqtok" name="strqtok">,
6882 <ref id="strspn" name="strspn">
6888 <sect1>strxfrm<label id="strxfrm"><p>
6892 <tag/Function/Transform a string.
6893 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6894 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
6895 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
6896 s2 and places the resulting string into the string pointed to by s1. The
6897 transformation is such that if the <tt/strcmp/ function is applied to two
6898 transformed strings, it returns a value greater than, equal to, or less than
6899 zero, corresponding to the result of the <tt/strcoll/ function applied to the
6900 same two original strings. No more than n characters are placed into the
6901 resulting array pointed to by s1, including the terminating null character.
6902 <tag/Notes/<itemize>
6903 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
6904 the behaviour is undefined.
6905 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
6906 <item>The function is only available as fastcall function, so it may only
6907 be used in presence of a prototype.
6908 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
6909 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
6911 <tag/Availability/ISO 9899
6913 <ref id="strcmp" name="strcmp">,
6914 <ref id="strcoll" name="strcoll">,
6915 <ref id="strncpy" name="strncpy">
6921 <sect1>strupper<label id="strupper"><p>
6925 <tag/Function/Make a string upper case.
6926 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6927 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
6928 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
6929 function to each character of a string. The function will always return <tt/s/.
6930 <tag/Notes/<itemize>
6931 <item>The function is only available as fastcall function, so it may only
6932 be used in presence of a prototype.
6933 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6934 <item>An alias name for this function is <tt/strupr/.
6936 <tag/Availability/cc65
6938 <ref id="strlower" name="strlower">
6939 <ref id="toupper" name="toupper">
6945 <sect1>strupr<label id="strupr"><p>
6952 <sect1>telldir<label id="telldir"><p>
6956 <tag/Function/Return the current position of a directory stream.
6957 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
6958 <tag/Declaration/<tt/long __fastcall__ telldir (DIR* dir);/
6959 <tag/Description/<tt/telldir/ returns the current position of a directory
6960 stream. The return value may be used in subsequent calls to
6961 <tt/<ref id="seekdir" name="seekdir">/.
6962 <tag/Notes/<itemize>
6963 <item>The function is only available as fastcall function, so it may only
6964 be used in presence of a prototype.
6966 <tag/Availability/POSIX 1003.1
6968 <ref id="seekdir" name="seekdir">,
6969 <ref id="telldir" name="telldir">
6975 <sect1>textcolor<label id="textcolor"><p>
6979 <tag/Function/Set the text color.
6980 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6981 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
6982 <tag/Description/The function will set a new text color. It returns the old
6983 (current) text color. Text output using any <tt/conio.h/ function will use
6984 the color set by this function.
6985 <tag/Notes/<itemize>
6986 <item>Text colors are system dependent. The function may have no effect
6987 on systems where the text color cannot be changed.
6988 <item>The function is only available as fastcall function, so it may only
6989 be used in presence of a prototype.
6991 <tag/Availability/cc65
6993 <ref id="bgcolor" name="bgcolor">,
6994 <ref id="bordercolor" name="bordercolor">
7000 <sect1>time<label id="time"><p>
7004 <tag/Function/Get the time.
7005 <tag/Header/<tt/<ref id="time.h" name="time.h">/
7006 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
7007 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
7008 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
7009 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
7010 returned and <tt/errno/ is set to <tt/ENOSYS/.
7011 <tag/Notes/<itemize>
7012 <item>The function is only available as fastcall function, so it may
7013 only be used in presence of a prototype.
7014 <item>Many platforms supported by cc65 do not have a realtime clock, so the
7015 returned value may not be valid.
7017 <tag/Availability/ISO 9899
7019 <ref id="clock" name="clock">
7025 <sect1>toggle_videomode<label id="toggle_videomode"><p>
7029 <tag/Function/Toggle between 40 and 80 column mode.
7030 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
7031 <tag/Declaration/<tt/void toggle_videomode (void);/
7032 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
7033 old mode (cursor position, color and so on) are saved and restored together
7035 <tag/Notes/<itemize>
7036 <item>The function is specific to the C128.
7037 <item>This function is deprecated. Please use <ref id="videomode"
7038 name="videomode"> instead!
7040 <tag/Availability/C128
7042 <ref id="fast" name="fast">,
7043 <ref id="isfast" name="isfast">,
7044 <ref id="slow" name="slow">,
7045 <ref id="videomode" name="videomode">
7051 <sect1>tolower<label id="tolower"><p>
7055 <tag/Function/Convert a character into its lower case representation.
7056 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7057 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
7058 <tag/Description/The function returns the given character converted to lower
7059 case. If the given character is not a letter, it is returned unchanged.
7060 <tag/Notes/<itemize>
7061 <item>The function is only available as fastcall function, so it may
7062 only be used in presence of a prototype.
7064 <tag/Availability/ISO 9899
7066 <ref id="islower" name="islower">,
7067 <ref id="isupper" name="isupper">,
7068 <ref id="toupper" name="toupper">
7074 <sect1>toupper<label id="toupper"><p>
7078 <tag/Function/Convert a character into its upper case representation.
7079 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7080 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
7081 <tag/Description/The function returns the given character converted to upper
7082 case. If the given character is not a letter, it is returned unchanged.
7083 <tag/Notes/<itemize>
7084 <item>The function is only available as fastcall function, so it may
7085 only be used in presence of a prototype.
7087 <tag/Availability/ISO 9899
7089 <ref id="islower" name="islower">,
7090 <ref id="isupper" name="isupper">,
7091 <ref id="tolower" name="tolower">
7097 <sect1>ultoa<label id="ultoa"><p>
7101 <tag/Function/Convert an unsigned long integer into a string.
7102 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7103 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
7104 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
7105 string using <tt/radix/ as the base.
7106 <tag/Notes/<itemize>
7107 <item>There are no provisions to prevent a buffer overflow.
7108 <item>The function is non standard, so it is not available in strict ANSI mode.
7109 You should probably use <tt/sprintf/ instead.
7110 <item>The function is only available as fastcall function, so it may only be
7111 used in presence of a prototype.
7113 <tag/Availability/cc65
7115 <ref id="atoi" name="atoi">,
7116 <ref id="atol" name="atol">,
7117 <ref id="itoa" name="itoa">,
7118 <ref id="ltoa" name="ltoa">,
7119 <ref id="utoa" name="utoa">
7125 <sect1>unlink<label id="unlink"><p>
7129 <tag/Function/Delete a file.
7130 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
7131 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
7132 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
7133 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
7134 code describing the reason for the failure.
7135 <tag/Notes/<itemize>
7136 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
7137 name="remove">/ instead, which is a native ANSI C function and does the same.
7138 <item>This function is not available on all cc65 targets (depends on the
7139 availability of file I/O).
7140 <item>The function is only available as fastcall function, so it may only
7141 be used in presence of a prototype.
7142 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
7143 used, which has the same semantics, but is more portable, because it conforms
7144 to the ISO C standard.
7146 <tag/Availability/POSIX 1003.1
7148 <ref id="remove" name="remove">
7151 #include <stdio.h>
7152 #include <unistd.h>
7154 #define FILENAME "helloworld"
7156 if (unlink (FILENAME) == 0) {
7157 printf ("We deleted %s successfully\n", FILENAME);
7159 printf ("There was a problem deleting %s\n", FILENAME);
7166 <sect1>utoa<label id="utoa"><p>
7170 <tag/Function/Convert an unsigned integer into a string.
7171 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7172 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
7173 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
7174 using <tt/radix/ as the base.
7175 <tag/Notes/<itemize>
7176 <item>There are no provisions to prevent a buffer overflow.
7177 <item>The function is non standard, so it is not available in strict ANSI mode.
7178 You should probably use <tt/sprintf/ instead.
7179 <item>The function is only available as fastcall function, so it may only be
7180 used in presence of a prototype.
7182 <tag/Availability/cc65
7184 <ref id="atoi" name="atoi">,
7185 <ref id="atol" name="atol">,
7186 <ref id="itoa" name="itoa">,
7187 <ref id="ltoa" name="ltoa">,
7188 <ref id="ultoa" name="ultoa">
7194 <sect1>vcprintf<label id="vcprintf"><p>
7198 <tag/Function/Formatted output to the console.
7199 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7200 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
7201 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
7202 text where necessary and formatted according to the format string given. The
7203 resulting string is output to the console. <tt/vcprintf/ supports the same
7204 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
7205 <tag/Notes/<itemize>
7206 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
7207 between <tt/\r/ and <tt/\n/.
7208 <item>The function is only available as fastcall function, so it may only be
7209 used in presence of a prototype.
7211 <tag/Availability/cc65
7213 <ref id="cprintf" name="cprintf">,
7214 <ref id="cputc" name="cputc">,
7215 <ref id="cputcxy" name="cputcxy">,
7216 <ref id="cputs" name="cputs">,
7217 <ref id="cputsxy" name="cputsxy">
7223 <sect1>videomode<label id="videomode"><p>
7227 <tag/Function/Switch to either 40 or 80 column mode.
7228 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
7229 <ref id="c128.h" name="c128.h">/
7230 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
7231 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
7232 the requested mode is already active, nothing happens. The old mode is returned
7234 <tag/Notes/<itemize>
7235 <item>The function is specific to the C128 and enhanced Apple //e.
7236 <item>This function replaces <ref id="toggle_videomode"
7237 name="toggle_videomode">.
7238 <item>The function is only available as fastcall function, so it may only be
7239 used in presence of a prototype.
7241 <tag/Availability/C128 and enhanced Apple //e
7243 <ref id="fast" name="fast">,
7244 <ref id="isfast" name="isfast">,
7245 <ref id="slow" name="slow">,
7246 <ref id="toggle_videomode" name="toggle_videomode">
7252 <sect1>waitvsync<label id="waitvsync"><p>
7256 <tag/Function/Wait until the start of the next frame.
7258 <tt/<ref id="cbm.h" name="cbm.h">/,
7259 <tt/<ref id="gamate.h" name="gamate.h">/,
7260 <tt/<ref id="nes.h" name="nes.h">/,
7261 <tt/<ref id="pce.h" name="pce.h">/
7262 <tag/Declaration/<tt/void waitvsync (void);/
7263 <tag/Description/Wait for vertical sync to reduce flickering.
7264 <tag/Availability/Platforms above
7270 <sect1>wherex<label id="wherex"><p>
7274 <tag/Function/Return the current X position of the text mode cursor.
7275 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7276 <tag/Declaration/<tt/unsigned char wherex (void);/
7277 <tag/Description/The function returns the current X position of the text mode
7278 cursor. Zero is returned for the leftmost screen position.
7279 <tag/Availability/cc65
7281 <ref id="gotox" name="gotox">,
7282 <ref id="gotoy" name="gotoy">,
7283 <ref id="gotoxy" name="gotoxy">,
7284 <ref id="wherey" name="wherey">
7290 <sect1>wherey<label id="wherey"><p>
7294 <tag/Function/Return the current Y position of the text mode cursor.
7295 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7296 <tag/Declaration/<tt/unsigned char wherey (void);/
7297 <tag/Description/The function returns the current Y position of the text mode
7298 cursor. Zero is returned for the uppermost screen position.
7299 <tag/Availability/cc65
7301 <ref id="gotox" name="gotox">,
7302 <ref id="gotoy" name="gotoy">,
7303 <ref id="gotoxy" name="gotoxy">,
7304 <ref id="wherex" name="wherex">