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_c128" name="detect_c128">
72 <item><ref id="detect_c64dtv" name="detect_c64dtv">
73 <item><ref id="detect_c65" name="detect_c65">
74 <item><ref id="detect_chameleon" name="detect_chameleon">
75 <item><ref id="detect_scpu" name="detect_scpu">
76 <item><ref id="detect_turbomaster" name="detect_turbomaster">
77 <item><ref id="get_c128_speed" name="get_c128_speed">
78 <item><ref id="get_c64dtv_speed" name="get_c64dtv_speed">
79 <item><ref id="get_c65_speed" name="get_c65_speed">
80 <item><ref id="get_chameleon_speed" name="get_chameleon_speed">
81 <item><ref id="get_scpu_speed" name="get_scpu_speed">
82 <item><ref id="get_turbomaster_speed" name="get_turbomaster_speed">
83 <item><ref id="set_c128_speed" name="set_c128_speed">
84 <item><ref id="set_c64dtv_speed" name="set_c64dtv_speed">
85 <item><ref id="set_c65_speed" name="set_c65_speed">
86 <item><ref id="set_chameleon_speed" name="set_chameleon_speed">
87 <item><ref id="set_scpu_speed" name="set_scpu_speed">
88 <item><ref id="set_turbomaster_speed" name="set_turbomaster_speed">
92 <sect1><tt/apple2.h/<label id="apple2.h"><p>
96 <item><ref id="get_ostype" name="get_ostype">
101 <sect1><tt/apple2enh.h/<label id="apple2enh.h"><p>
105 <item><ref id="get_ostype" name="get_ostype">
106 <item>rebootafterexit
109 <item><ref id="videomode" name="videomode">
113 <sect1><tt/assert.h/<label id="assert.h"><p>
116 <item><ref id="assert" name="assert">
120 <sect1><tt/atari.h/<label id="atari.h"><p>
123 <!-- <item><ref id="_getcolor" name="_getcolor"> -->
124 <!-- <item><ref id="_getdefdev" name="_getdefdev"> -->
125 <!-- <item><ref id="_graphics" name="_graphics"> -->
126 <item><ref id="_is_cmdline_dos" name="_is_cmdline_dos">
127 <!-- <item><ref id="_rest_vecs" name="_rest_vecs"> -->
128 <!-- <item><ref id="_save_vecs" name="_save_vecs"> -->
129 <!-- <item><ref id="_scroll" name="_scroll"> -->
130 <!-- <item><ref id="_setcolor" name="_setcolor"> -->
131 <!-- <item><ref id="_setcolor_low" name="_setcolor_low"> -->
132 <item><ref id="get_ostype" name="get_ostype">
133 <!-- <item><ref id="get_tv" name="get_tv"> -->
139 <sect1><tt/atmos.h/<label id="atmos.h"><p>
142 <item><ref id="atmos_explode" name="atmos_explode">
143 <item><ref id="atmos_load" name="atmos_load">
144 <item><ref id="atmos_ping" name="atmos_ping">
145 <item><ref id="atmos_save" name="atmos_save">
146 <item><ref id="atmos_shoot" name="atmos_shoot">
147 <item><ref id="atmos_tick" name="atmos_tick">
148 <item><ref id="atmos_tock" name="atmos_tock">
149 <item><ref id="atmos_zap" name="atmos_zap">
153 <sect1><tt/c128.h/<label id="c128.h"><p>
156 <item><ref id="c64mode" name="c64mode">
157 <item><ref id="fast" name="fast">
158 <item><ref id="isfast" name="isfast">
159 <item><ref id="slow" name="slow">
160 <item><ref id="toggle_videomode" name="toggle_videomode">
161 <item><ref id="videomode" name="videomode">
165 <sect1><tt/c16.h/<label id="c16.h"><p>
168 <item><ref id="fast" name="fast">
169 <item><ref id="isfast" name="isfast">
170 <item><ref id="slow" name="slow">
176 <sect1><tt/c64.h/<label id="c64.h"><p>
179 <item><ref id="get_ostype" name="get_ostype">
183 <sect1><tt/cbm.h/<label id="cbm.h"><p>
186 <item><ref id="cbm_k_acptr" name="cbm_k_acptr">
187 <item><ref id="cbm_k_basin" name="cbm_k_basin">
188 <item><ref id="cbm_k_bsout" name="cbm_k_bsout">
189 <item><ref id="cbm_k_chkin" name="cbm_k_chkin">
190 <item><ref id="cbm_k_ciout" name="cbm_k_ciout">
191 <item><ref id="cbm_k_ckout" name="cbm_k_ckout">
192 <item><ref id="cbm_k_clall" name="cbm_k_clall">
193 <item><ref id="cbm_k_close" name="cbm_k_close">
194 <item><ref id="cbm_k_clrch" name="cbm_k_clrch">
195 <item><ref id="cbm_k_getin" name="cbm_k_getin">
196 <item><ref id="cbm_k_iobase" name="cbm_k_iobase">
197 <item><ref id="cbm_k_listen" name="cbm_k_listen">
198 <item><ref id="cbm_k_load" name="cbm_k_load">
199 <item><ref id="cbm_k_open" name="cbm_k_open">
200 <item><ref id="cbm_k_readst" name="cbm_k_readst">
201 <item><ref id="cbm_k_save" name="cbm_k_save">
202 <item><ref id="cbm_k_scnkey" name="cbm_k_scnkey">
203 <item><ref id="cbm_k_setlfs" name="cbm_k_setlfs">
204 <item><ref id="cbm_k_setnam" name="cbm_k_setnam">
205 <item><ref id="cbm_k_talk" name="cbm_k_talk">
206 <item><ref id="cbm_k_udtim" name="cbm_k_udtim">
207 <item><ref id="cbm_k_unlsn" name="cbm_k_unlsn">
208 <!-- <item><ref id="cbm_load" name="cbm_load"> -->
209 <!-- <item><ref id="cbm_open" name="cbm_open"> -->
210 <!-- <item><ref id="cbm_opendir" name="cbm_opendir"> -->
211 <!-- <item><ref id="cbm_read" name="cbm_read"> -->
212 <!-- <item><ref id="cbm_readdir" name="cbm_readdir"> -->
213 <!-- <item><ref id="cbm_save" name="cbm_save"> -->
214 <!-- <item><ref id="cbm_write" name="cbm_write"> -->
215 <!-- <item><ref id="get_tv" name="get_tv"> -->
216 <item><ref id="waitvsync" name="waitvsync">
217 <item><ref id="kbrepeat" name="kbrepeat">
223 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
226 <item><ref id="peekbsys" name="peekbsys">
227 <item><ref id="peekwsys" name="peekwsys">
228 <item><ref id="pokebsys" name="pokebsys">
229 <item><ref id="pokewsys" name="pokewsys">
233 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
236 <item><ref id="peekbsys" name="peekbsys">
237 <item><ref id="peekwsys" name="peekwsys">
238 <item><ref id="pokebsys" name="pokebsys">
239 <item><ref id="pokewsys" name="pokewsys">
243 <sect1><tt/cc65.h/<label id="cc65.h"><p>
246 <!-- <item><ref id="cc65_cos" name="cc65_cos"> -->
247 <!-- <item><ref id="cc65_idiv32by16r16" name="cc65_idiv32by16r16"> -->
248 <!-- <item><ref id="cc65_imul16x16r32" name="cc65_imul16x16r32"> -->
249 <!-- <item><ref id="cc65_imul8x8r16" name="cc65_imul8x8r16"> -->
250 <!-- <item><ref id="cc65_sin" name="cc65_sin"> -->
251 <!-- <item><ref id="cc65_udiv32by16r16" name="cc65_udiv32by16r16"> -->
252 <!-- <item><ref id="cc65_umul16x16r32" name="cc65_umul16x16r32"> -->
253 <!-- <item><ref id="cc65_umul16x8r32" name="cc65_umul16x8r32"> -->
254 <!-- <item><ref id="cc65_umul8x8r16" name="cc65_umul8x8r16"> -->
255 <item><ref id="doesclrscrafterexit" name="doesclrscrafterexit">
261 <sect1><tt/conio.h/<label id="conio.h"><p>
264 <item><ref id="bgcolor" name="bgcolor">
265 <item><ref id="bordercolor" name="bordercolor">
266 <item><ref id="cclear" name="cclear">
267 <item><ref id="cclearxy" name="cclearxy">
268 <item><ref id="cgetc" name="cgetc">
269 <item><ref id="chline" name="chline">
270 <item><ref id="chlinexy" name="chlinexy">
271 <item><ref id="clrscr" name="clrscr">
272 <item><ref id="cpeekc" name="cpeekc">
273 <item><ref id="cpeekcolor" name="cpeekcolor">
274 <item><ref id="cpeekrevers" name="cpeekrevers">
275 <item><ref id="cpeeks" name="cpeeks">
276 <item><ref id="cprintf" name="cprintf">
277 <item><ref id="cputc" name="cputc">
278 <item><ref id="cputcxy" name="cputcxy">
279 <item><ref id="cputs" name="cputs">
280 <item><ref id="cputsxy" name="cputsxy">
281 <item><ref id="cursor" name="cursor">
282 <item><ref id="cvline" name="cvline">
283 <item><ref id="cvlinexy" name="cvlinexy">
284 <item><ref id="gotox" name="gotox">
285 <item><ref id="gotoxy" name="gotoxy">
286 <item><ref id="gotoy" name="gotoy">
287 <item><ref id="kbhit" name="kbhit">
288 <item><ref id="revers" name="revers">
289 <item><ref id="screensize" name="screensize">
290 <item><ref id="textcolor" name="textcolor">
291 <item><ref id="vcprintf" name="vcprintf">
292 <item><ref id="wherex" name="wherex">
293 <item><ref id="wherey" name="wherey">
297 <sect1><tt/ctype.h/<label id="ctype.h"><p>
300 <item><ref id="isalnum" name="isalnum">
301 <item><ref id="isalpha" name="isalpha">
302 <item><ref id="isascii" name="isascii">
303 <item><ref id="isblank" name="isblank">
304 <item><ref id="iscntrl" name="iscntrl">
305 <item><ref id="isdigit" name="isdigit">
306 <item><ref id="isgraph" name="isgraph">
307 <item><ref id="islower" name="islower">
308 <item><ref id="isprint" name="isprint">
309 <item><ref id="ispunct" name="ispunct">
310 <item><ref id="isspace" name="isspace">
311 <item><ref id="isupper" name="isupper">
312 <item><ref id="isxdigit" name="isxdigit">
313 <item><ref id="tolower" name="tolower">
314 <item><ref id="toupper" name="toupper">
318 <sect1><tt/dbg.h/<label id="dbg.h"><p>
321 <!-- <item><ref id="DbgInit" name="DbgInit"> -->
327 <sect1><tt/device.h/<label id="device.h"><p>
330 <item><ref id="getcurrentdevice" name="getcurrentdevice">
331 <item><ref id="getdevicedir" name="getdevicedir">
332 <item><ref id="getfirstdevice" name="getfirstdevice">
333 <item><ref id="getnextdevice" name="getnextdevice">
337 <sect1><tt/dio.h/<label id="dio.h"><p>
339 <url url="dio.html" name="Low-level disk I/O API">.
342 <sect1><tt/dirent.h/<label id="dirent.h"><p>
345 <item><ref id="_DE_ISDIR" name="_DE_ISDIR">
346 <item><ref id="_DE_ISLBL" name="_DE_ISLBL">
347 <item><ref id="_DE_ISLNK" name="_DE_ISLNK">
348 <item><ref id="_DE_ISREG" name="_DE_ISREG">
349 <item><ref id="closedir" name="closedir">
350 <item><ref id="opendir" name="opendir">
351 <item><ref id="readdir" name="readdir">
352 <item><ref id="rewinddir" name="rewinddir">
353 <item><ref id="seekdir" name="seekdir">
354 <item><ref id="telldir" name="telldir">
358 <sect1><tt/em.h/<label id="em.h"><p>
361 <item><ref id="em_commit" name="em_commit">
362 <item><ref id="em_copyfrom" name="em_copyfrom">
363 <item><ref id="em_copyto" name="em_copyto">
364 <item><ref id="em_install" name="em_install">
365 <item><ref id="em_load_driver" name="em_load_driver">
366 <item><ref id="em_map" name="em_map">
367 <item><ref id="em_pagecount" name="em_pagecount">
368 <item><ref id="em_uninstall" name="em_uninstall">
369 <item><ref id="em_unload" name="em_unload">
370 <item><ref id="em_use" name="em_use">
374 <sect1><tt/errno.h/<label id="errno.h"><p>
377 <!-- <item><ref id="_directerrno" name="_directerrno"> -->
378 <!-- <item><ref id="_mappederrno" name="_mappederrno"> -->
379 <!-- <item><ref id="_osmaperrno" name="_osmaperrno"> -->
380 <!-- <item><ref id="_seterrno" name="_seterrno"> -->
386 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
389 <item><ref id="close" name="close">
390 <item><ref id="creat" name="creat">
391 <item><ref id="open" name="open">
395 <sect1><tt/gamate.h/<label id="gamate.h"><p>
398 <!-- <item><ref id="get_tv" name="get_tv"> -->
399 <item><ref id="waitvsync" name="waitvsync">
405 <sect1><tt/geos.h/<label id="geos.h"><p>
407 <url url="geos.html" name="GEOS API">.
410 <sect1><tt/joystick.h/<label id="joystick.h"><p>
413 <item><ref id="joy_count" name="joy_count">
414 <item><ref id="joy_install" name="joy_install">
415 <item><ref id="joy_load_driver" name="joy_load_driver">
416 <item><ref id="joy_read" name="joy_read">
417 <item><ref id="joy_uninstall" name="joy_uninstall">
418 <item><ref id="joy_unload" name="joy_unload">
422 <sect1><tt/locale.h/<label id="locale.h"><p>
425 <item><ref id="localeconv" name="localeconv">
426 <item><ref id="setlocale" name="setlocale">
430 <sect1><tt/lynx.h/<label id="lynx.h"><p>
433 <!-- <item><ref id="lynx_eeprom_erase" name="lynx_eeprom_erase"> -->
434 <!-- <item><ref id="lynx_eeprom_read" name="lynx_eeprom_read"> -->
435 <!-- <item><ref id="lynx_eeprom_write" name="lynx_eeprom_write"> -->
436 <!-- <item><ref id="lynx_eeread" name="lynx_eeread"> -->
437 <!-- <item><ref id="lynx_eewrite" name="lynx_eewrite"> -->
438 <!-- <item><ref id="lynx_exec" name="lynx_exec"> -->
439 <!-- <item><ref id="lynx_load" name="lynx_load"> -->
445 <sect1><tt/lz4.h/<label id="lz4.h"><p>
448 <item><ref id="decompress_lz4" name="decompress_lz4">
452 <sect1><tt/modload.h/<label id="modload.h"><p>
455 <item><ref id="mod_load" name="mod_load">
456 <item><ref id="mod_free" name="mod_free">
460 <sect1><tt/mouse.h/<label id="mouse.h"><p>
463 <item><ref id="mouse_buttons" name="mouse_buttons">
464 <item><ref id="mouse_getbox" name="mouse_getbox">
465 <item><ref id="mouse_geterrormsg" name="mouse_geterrormsg">
466 <item><ref id="mouse_hide" name="mouse_hide">
467 <item><ref id="mouse_info" name="mouse_info">
468 <item><ref id="mouse_install" name="mouse_install">
469 <item><ref id="mouse_ioctl" name="mouse_ioctl">
470 <item><ref id="mouse_load_driver" name="mouse_load_driver">
471 <item><ref id="mouse_move" name="mouse_move">
472 <item><ref id="mouse_pos" name="mouse_pos">
473 <item><ref id="mouse_setbox" name="mouse_setbox">
474 <item><ref id="mouse_show" name="mouse_show">
475 <item><ref id="mouse_uninstall" name="mouse_uninstall">
476 <item><ref id="mouse_unload" name="mouse_unload">
480 <sect1><tt/nes.h/<label id="nes.h"><p>
483 <!-- <item><ref id="get_tv" name="get_tv"> -->
484 <item><ref id="waitvsync" name="waitvsync">
490 <sect1><tt/o65.h/<label id="o65.h"><p>
492 The <tt/o65.h/ header file contains structure and constant definitions that
493 may be used when dealing with files in <url
494 url="http://www.6502.org/users/andre/o65/fileformat.html" name="the o65 format">.
495 It does not declare any functions.
498 <sect1><tt/pce.h/<label id="pce.h"><p>
501 <!-- <item><ref id="get_tv" name="get_tv"> -->
502 <item><ref id="waitvsync" name="waitvsync">
508 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
511 <item><ref id="PEEK" name="PEEK">
512 <item><ref id="PEEKW" name="PEEKW">
513 <item><ref id="POKE" name="POKE">
514 <item><ref id="POKEW" name="POKEW">
518 <sect1><tt/pen.h/<label id="pen.h"><p>
521 <!-- <item><ref id="pen_adjust" name="pen_adjust"> -->
522 <!-- <item><ref id="pen_calibrate" name="pen_calibrate"> -->
528 <sect1><tt/pet.h/<label id="pet.h"><p>
533 <sect1><tt/plus4.h/<label id="plus4.h"><p>
536 <item><ref id="fast" name="fast">
537 <item><ref id="isfast" name="isfast">
538 <item><ref id="slow" name="slow">
544 <sect1><tt/serial.h/<label id="serial.h"><p>
546 The <tt/serial.h/ header file contains definitions for initializing serial
550 <item><ref id="ser_close" name="ser_close">
551 <item><ref id="ser_get" name="ser_get">
552 <item><ref id="ser_install" name="ser_install">
553 <item><ref id="ser_ioctl" name="ser_ioctl">
554 <item><ref id="ser_load_driver" name="ser_load_driver">
555 <item><ref id="ser_open" name="ser_open">
556 <item><ref id="ser_put" name="ser_put">
557 <item><ref id="ser_status" name="ser_status">
558 <item><ref id="ser_uninstall" name="ser_uninstall">
559 <item><ref id="ser_unload" name="ser_unload">
563 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
566 <item><ref id="setjmp" name="setjmp">
567 <item><ref id="longjmp" name="longjmp">
571 <sect1><tt/signal.h/<label id="signal.h"><p>
574 <item><ref id="raise" name="raise">
575 <item><ref id="signal" name="signal">
579 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
584 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
589 <sect1><tt/stddef.h/<label id="stddef.h"><p>
592 <item><ref id="offsetof" name="offsetof">
596 <sect1><tt/stdio.h/<label id="stdio.h"><p>
599 <item><ref id="_poserror" name="_poserror">
600 <item><ref id="clearerr" name="clearerr">
601 <!-- <item><ref id="fclose" name="fclose"> -->
602 <!-- <item><ref id="fdopen" name="fdopen"> -->
603 <item><ref id="feof" name="feof">
604 <item><ref id="ferror" name="ferror">
605 <!-- <item><ref id="fflush" name="fflush"> -->
606 <!-- <item><ref id="fgetc" name="fgetc"> -->
607 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
608 <!-- <item><ref id="fgets" name="fgets"> -->
609 <item><ref id="fileno" name="fileno">
610 <!-- <item><ref id="fopen" name="fopen"> -->
611 <!-- <item><ref id="fprintf" name="fprintf"> -->
612 <!-- <item><ref id="fputc" name="fputc"> -->
613 <!-- <item><ref id="fputs" name="fputs"> -->
614 <!-- <item><ref id="fread" name="fread"> -->
615 <!-- <item><ref id="freopen" name="freopen"> -->
616 <!-- <item><ref id="fscanf" name="fscanf"> -->
617 <!-- <item><ref id="fseek" name="fseek"> -->
618 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
619 <!-- <item><ref id="ftell" name="ftell"> -->
620 <!-- <item><ref id="fwrite" name="fwrite"> -->
621 <!-- <item><ref id="getc" name="getc"> -->
622 <!-- <item><ref id="getchar" name="getchar"> -->
623 <!-- <item><ref id="gets" name="gets"> -->
624 <!-- <item><ref id="printf" name="printf"> -->
625 <!-- <item><ref id="putc" name="putc"> -->
626 <!-- <item><ref id="putchar" name="putchar"> -->
627 <!-- <item><ref id="puts" name="puts"> -->
628 <item><ref id="rename" name="rename">
629 <item><ref id="remove" name="remove">
630 <!-- <item><ref id="rewind" name="rewind"> -->
631 <!-- <item><ref id="scanf" name="scanf"> -->
632 <!-- <item><ref id="snprintf" name="snprintf"> -->
633 <!-- <item><ref id="sprintf" name="sprintf"> -->
634 <!-- <item><ref id="sscanf" name="sscanf"> -->
635 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
636 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
637 <!-- <item><ref id="vprintf" name="vprintf"> -->
638 <!-- <item><ref id="vscanf" name="vscanf"> -->
639 <!-- <item><ref id="vsnprintf" name="vsnprintf"> -->
640 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
641 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
647 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
650 <item><ref id="_heapadd" name="_heapadd">
651 <item><ref id="_heapblocksize" name="_heapblocksize">
652 <item><ref id="_heapmaxavail" name="_heapmaxavail">
653 <item><ref id="_heapmemavail" name="_heapmemavail">
654 <item><ref id="_randomize" name="_randomize">
655 <item><ref id="_swap" name="_swap">
656 <item><ref id="abort" name="abort">
657 <item><ref id="abs" name="abs">
658 <item><ref id="atexit" name="atexit">
659 <item><ref id="atoi" name="atoi">
660 <item><ref id="atol" name="atol">
661 <item><ref id="bsearch" name="bsearch">
662 <item><ref id="calloc" name="calloc">
663 <item><ref id="div" name="div">
664 <item><ref id="exit" name="exit">
665 <item><ref id="free" name="free">
666 <item><ref id="getenv" name="getenv">
667 <item><ref id="itoa" name="itoa">
668 <item><ref id="labs" name="labs">
669 <item><ref id="ltoa" name="ltoa">
670 <item><ref id="malloc" name="malloc">
671 <item><ref id="perror" name="perror">
672 <!-- <item><ref id="posix_memalign" name="posix_memalign"> -->
673 <!-- <item><ref id="putenv" name="putenv"> -->
674 <item><ref id="qsort" name="qsort">
675 <item><ref id="rand" name="rand">
676 <item><ref id="realloc" name="realloc">
677 <item><ref id="srand" name="srand">
678 <!-- <item><ref id="system" name="system"> -->
679 <item><ref id="ultoa" name="ultoa">
680 <item><ref id="utoa" name="utoa">
686 <sect1><tt/string.h/<label id="string.h"><p>
689 <item><ref id="_stroserror" name="_stroserror">
690 <item><ref id="bzero" name="bzero">
691 <item><ref id="memchr" name="memchr">
692 <item><ref id="memcmp" name="memcmp">
693 <item><ref id="memcpy" name="memcpy">
694 <item><ref id="memmove" name="memmove">
695 <item><ref id="memset" name="memset">
696 <item><ref id="strcasecmp" name="strcasecmp">
697 <item><ref id="strcat" name="strcat">
698 <item><ref id="strchr" name="strchr">
699 <item><ref id="strcmp" name="strcmp">
700 <item><ref id="strcoll" name="strcoll">
701 <item><ref id="strcpy" name="strcpy">
702 <item><ref id="strcspn" name="strcspn">
703 <item><ref id="strdup" name="strdup">
704 <item><ref id="strerror" name="strerror">
705 <item><ref id="stricmp" name="stricmp">
706 <item><ref id="strlen" name="strlen">
707 <item><ref id="strlower" name="strlower">
708 <item><ref id="strlwr" name="strlwr">
709 <item><ref id="strncasecmp" name="strncasecmp">
710 <item><ref id="strncat" name="strncat">
711 <item><ref id="strncmp" name="strncmp">
712 <item><ref id="strncpy" name="strncpy">
713 <item><ref id="strnicmp" name="strnicmp">
714 <item><ref id="strqtok" name="strqtok">
715 <item><ref id="strrchr" name="strrchr">
716 <item><ref id="strspn" name="strspn">
717 <item><ref id="strstr" name="strstr">
718 <item><ref id="strtok" name="strtok">
719 <item><ref id="strxfrm" name="strxfrm">
720 <item><ref id="strupper" name="strupper">
721 <item><ref id="strupr" name="strupr">
725 <sect1><tt/telestrat.h/<label id="telestrat.h"><p>
728 <item><ref id="atmos_explode" name="explode">
729 <item><ref id="atmos_ping" name="ping">
730 <item><ref id="atmos_shoot" name="shoot">
731 <item><ref id="atmos_zap" name="zap">
732 <!-- <item><ref id="kbdclick1" name="kbdclick1"> -->
733 <!-- <item><ref id="oups" name="oups"> -->
739 <sect1><tt/tgi.h/<label id="tgi.h"><p>
741 <url url="tgi.html" name="Tiny Graphics Interface">.
744 <sect1><tt/time.h/<label id="time.h"><p>
747 <!-- <item><ref id="_systime" name="_systime"> -->
748 <!-- <item><ref id="asctime" name="asctime"> -->
749 <item><ref id="clock" name="clock">
750 <!-- <item><ref id="ctime" name="ctime"> -->
751 <!-- <item><ref id="gmtime" name="gmtime"> -->
752 <!-- <item><ref id="localtime" name="localtime"> -->
753 <!-- <item><ref id="mktime" name="mktime"> -->
754 <!-- <item><ref id="strftime" name="strftime"> -->
755 <item><ref id="time" name="time">
761 <sect1><tt/unistd.h/<label id="unistd.h"><p>
764 <!-- <item><ref id="chdir" name="chdir"> -->
765 <item><ref id="exec" name="exec">
766 <item><ref id="getcwd" name="getcwd">
767 <item><ref id="getopt" name="getopt">
768 <!-- <item><ref id="lseek" name="lseek"> -->
769 <!-- <item><ref id="mkdir" name="mkdir"> -->
770 <!-- <item><ref id="read" name="read"> -->
771 <!-- <item><ref id="rmdir" name="rmdir"> -->
772 <item><ref id="sleep" name="sleep">
773 <item><ref id="unlink" name="unlink">
774 <!-- <item><ref id="write" name="write"> -->
780 <sect1><tt/vic20.h/<label id="vic20.h"><p>
785 <sect1><tt/zlib.h/<label id="zlib.h"><p>
788 <!-- <item><ref id="adler32" name="adler32"> -->
789 <!-- <item><ref id="crc32" name="crc32"> -->
790 <!-- <item><ref id="inflatemem" name="inflatemem"> -->
791 <!-- <item><ref id="uncompress" name="uncompress"> -->
797 <sect>Alphabetical function reference<p>
799 <sect1>_DE_ISDIR<label id="_DE_ISDIR"><p>
803 <tag/Function/Determine if a directory entry specifies a directory.
804 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
805 <tag/Declaration/<tt/int _DE_ISDIR(unsigned char type);/
806 <tag/Description/The function is called with the type of a directory entry
807 taken from a <tt/struct dirent/ and returns true if the entry designates
810 <item>The function is actually a macro.
812 <tag/Availability/cc65
814 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
815 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
816 <ref id="_DE_ISREG" name="_DE_ISREG">
822 <sect1>_DE_ISLBL<label id="_DE_ISLBL"><p>
826 <tag/Function/Determine if a directory entry specifies a disk label.
827 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
828 <tag/Declaration/<tt/int _DE_ISLBL(unsigned char type);/
829 <tag/Description/The function is called with the type of a directory entry
830 taken from a <tt/struct dirent/ and returns true if the entry designates
833 <item>The function is actually a macro.
835 <tag/Availability/cc65
837 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
838 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
839 <ref id="_DE_ISREG" name="_DE_ISREG">
845 <sect1>_DE_ISLNK<label id="_DE_ISLNK"><p>
849 <tag/Function/Determine if a directory entry specifies a link.
850 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
851 <tag/Declaration/<tt/int _DE_ISLNK(unsigned char type);/
852 <tag/Description/The function is called with the type of a directory entry
853 taken from a <tt/struct dirent/ and returns true if the entry designates
856 <item>The function is actually a macro.
858 <tag/Availability/cc65
860 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
861 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
862 <ref id="_DE_ISREG" name="_DE_ISREG">
868 <sect1>_DE_ISREG<label id="_DE_ISREG"><p>
872 <tag/Function/Determine if a directory entry specifies a regular file.
873 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
874 <tag/Declaration/<tt/int _DE_ISREG(unsigned char type);/
875 <tag/Description/The function is called with the type of a directory entry
876 taken from a <tt/struct dirent/ and returns true if the entry designates
879 <item>The function is actually a macro.
880 <item>A "regular file" means anything with data in it. This might still mean
881 that special processing is needed, when accessing the file. Relative files of
882 the CBM systems are classified as being "regular" files, for example.
884 <tag/Availability/cc65
886 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
887 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
888 <ref id="_DE_ISLNK" name="_DE_ISLNK">
894 <sect1>_heapadd<label id="_heapadd"><p>
898 <tag/Function/Add a block to the heap.
899 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
900 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
901 <tag/Description/The function adds a block of raw memory to the heap.
903 <item>The minimum blocksize that can be added is 6 bytes; the function will
904 ignore smaller blocks.
905 <item>The function is available only as a fastcall function; so, it may be used
906 only in the presence of a prototype.
908 <tag/Availability/cc65
910 <ref id="_heapblocksize" name="_heapblocksize">,
911 <ref id="_heapmaxavail" name="_heapmaxavail">,
912 <ref id="_heapmemavail" name="_heapmemavail">,
913 <ref id="calloc" name="calloc">,
914 <ref id="free" name="free">,
915 <ref id="malloc" name="malloc">,
916 <ref id="realloc" name="realloc">
922 <sect1>_heapblocksize<label id="_heapblocksize"><p>
926 <tag/Function/Return the size of an allocated block.
927 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
928 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
929 <tag/Description/The function returns the size of a block that must have
930 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
931 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
933 <item>Passing a pointer to a block that was is not the result of one of the
934 allocation functions, or that has been free'd will give unpredicable results.
935 <item>The function is available only as a fastcall function; so, it may be used
936 only in the presence of a prototype.
938 <tag/Availability/cc65
940 <ref id="_heapadd" name="_heapadd">,
941 <ref id="_heapmaxavail" name="_heapmaxavail">,
942 <ref id="_heapmemavail" name="_heapmemavail">,
943 <ref id="calloc" name="calloc">,
944 <ref id="free" name="free">,
945 <ref id="malloc" name="malloc">,
946 <ref id="realloc" name="realloc">
952 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
956 <tag/Function/Return the largest block that is available on the heap.
957 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
958 <tag/Declaration/<tt/size_t _heapmaxavail (void);/
959 <tag/Description/The function returns the size of the largest block that may
960 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
961 <tag/Availability/cc65
963 <ref id="_heapadd" name="_heapadd">,
964 <ref id="_heapblocksize" name="_heapblocksize">,
965 <ref id="_heapmemavail" name="_heapmemavail">,
966 <ref id="calloc" name="calloc">,
967 <ref id="free" name="free">,
968 <ref id="malloc" name="malloc">,
969 <ref id="realloc" name="realloc">
975 <sect1>_heapmemavail<label id="_heapmemavail"><p>
979 <tag/Function/Return the total available space on the heap.
980 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
981 <tag/Declaration/<tt/size_t _heapmemavail (void);/
982 <tag/Description/The function returns the total number of bytes available on
985 <item>This function is of less use than usually assumed, since the returned
986 heap space may be available but not in one block. So even if this function
987 says that several times more heap space is available than needed, <ref
988 id="malloc" name="malloc"> may still return <tt/NULL/.
990 <tag/Availability/cc65
992 <ref id="_heapadd" name="_heapadd">,
993 <ref id="_heapblocksize" name="_heapblocksize">,
994 <ref id="_heapmaxavail" name="_heapmaxavail">,
995 <ref id="calloc" name="calloc">,
996 <ref id="free" name="free">,
997 <ref id="malloc" name="malloc">,
998 <ref id="realloc" name="realloc">
1004 <sect1>_is_cmdline_dos<label id="_is_cmdline_dos"><p>
1008 <tag/Function/Determines whether the underlying DOS supports command line arguments.
1009 <tag/Header/<tt/<ref id="atari.h" name="atari.h">/
1010 <tag/Declaration/<tt/unsigned char _is_cmdline_dos (void);/
1011 <tag/Description/The function returns 0 if the DOS doesn't support command line arguments.
1012 It returns 1 if it does.
1013 <tag/Availability/cc65 (<tt/atari/ and <tt/atarixl/ platforms)
1018 <sect1>_poserror<label id="_poserror"><p>
1022 <tag/Function/Print an error message for the error in <tt/_oserror/.
1023 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1024 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
1025 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
1026 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
1027 a colon and a blank. Then the error message for the current contents of
1028 <tt/_oserror/ are printed followed by a newline. The message output is the
1029 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
1030 argument of <tt/_oserror/.
1031 <tag/Notes/<itemize>
1032 <item>Since operating system specific error code are - you guessed it -
1033 operating system specific, the value in <tt/_oserror/ and the message that is
1034 printed depends on the cc65 target.
1035 <item>The function is only available as fastcall function, so it may only
1036 be used in presence of a prototype.
1038 <tag/Availability/cc65
1040 <ref id="_stroserror" name="_stroserror">,
1041 <ref id="perror" name="perror">
1047 <sect1>_randomize<label id="_randomize"><p>
1051 <tag/Function/Initialize the pseudo random number generator.
1052 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1053 <tag/Declaration/<tt/void _randomize (void);/
1054 <tag/Description/The function initializes the random number generator with
1055 a seed derived from fast changing hardware events, so the seed itself can be
1056 considered random to a certain degree.
1057 <tag/Notes/<itemize>
1058 <item>The randomness of the seed depends on the machine hardware.
1060 <tag/Availability/cc65
1062 <ref id="rand" name="rand">,
1063 <ref id="srand" name="srand">
1069 <sect1>_stroserror<label id="_stroserror"><p>
1073 <tag/Function/Return a string describing an OS specific error code.
1074 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1075 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
1076 <tag/Description/<tt/_stroserror/ will return a string describing the given
1077 operating system specific error code.
1078 <tag/Notes/<itemize>
1079 <item>Since operating system specific error code are - you guessed it -
1080 operating system specific, the parameter and the string returned depend on the
1082 <item>The function is only available as fastcall function, so it may only be
1083 used in presence of a prototype.
1085 <tag/Availability/cc65
1087 <ref id="strerror" name="strerror">
1093 <sect1>_swap<label id="_swap"><p>
1097 <tag/Function/Swap the contents of memory areas.
1098 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1099 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
1100 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
1101 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
1102 <tt/size/ bytes in size.
1103 <tag/Notes/<itemize>
1104 <item>The memory areas may not overlap, otherwise the results are undefined.
1105 <item>The function is only available as fastcall function, so it may only be
1106 used in presence of a prototype.
1108 <tag/Availability/cc65
1110 <ref id="memcpy" name="memcpy">,
1111 <ref id="memmove" name="memmove">
1117 <sect1>_sys<label id="_sys"><p>
1121 <tag/Function/Call a subroutine passing register values.
1122 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1123 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
1124 <tag/Description/The function will call the subroutine at the address
1125 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
1126 registers and the CPU flags are set to the values given in the <tt/regs/
1127 structure. On return from the subroutine, the new values of the registers and
1128 flags are stored back overwriting the old values.
1129 <tag/Notes/<itemize>
1130 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
1131 when calling the subroutine (they are unchanged from their current values).
1132 <item>The function is only available as fastcall function, so it may only be
1133 used in presence of a prototype.
1135 <tag/Availability/cc65
1141 <sect1>BRK<label id="BRK"><p>
1145 <tag/Function/Insert a 6502 BRK instrunction into the code.
1146 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1147 <tag/Declaration/<tt/void BRK (void);/
1148 <tag/Description/The function will insert a 6502 BRK instruction into the code
1149 which may be used to trigger a debugger.
1150 <tag/Notes/<itemize>
1151 <item>The function is actually a macro.
1152 <item>The inserted instruction may lead to unexpected results if no debugger
1155 <tag/Availability/cc65
1157 <ref id="CLI" name="CLI">,
1158 <ref id="SEI" name="SEI">
1164 <sect1>CLI<label id="CLI"><p>
1168 <tag/Function/Insert a 6502 CLI instrunction into the code.
1169 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1170 <tag/Declaration/<tt/void CLI (void);/
1171 <tag/Description/The function will insert a 6502 CLI instruction into the code,
1172 so interrupts are enabled. Enabling interrupts has no effects if they are
1173 already enabled (the default).
1174 <tag/Notes/<itemize>
1175 <item>The function is actually a macro.
1176 <item>Disabling interrupts may lead to unexpected results.
1178 <tag/Availability/cc65
1180 <ref id="BRK" name="BRK">,
1181 <ref id="SEI" name="SEI">
1187 <sect1>PEEK<label id="PEEK"><p>
1191 <tag/Function/Read a byte from memory.
1192 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1193 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
1194 <tag/Description/The function will read the absolute memory given by <tt/addr/
1195 and return the value read.
1196 <tag/Notes/<itemize>
1197 <item>The function is actually a macro.
1198 <item>This function depends highly on the platform and environment.
1200 <tag/Availability/cc65
1202 <ref id="PEEKW" name="PEEKW">,
1203 <ref id="POKE" name="POKE">
1209 <sect1>PEEKW<label id="PEEKW"><p>
1213 <tag/Function/Read a word (two bytes) from memory.
1214 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1215 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
1216 <tag/Description/The function will read the absolute memory given by <tt/addr/
1217 and return the value read. The byte read from the higher address is the high
1218 byte of the return value.
1219 <tag/Notes/<itemize>
1220 <item>The function is actually a macro.
1221 <item>This function depends highly on the platform and environment.
1222 <item>The order in which the two bytes are read is unspecified and may
1223 depend of the address expression used.
1225 <tag/Availability/cc65
1227 <ref id="PEEK" name="PEEK">,
1228 <ref id="POKE" name="POKE">
1234 <sect1>POKE<label id="POKE"><p>
1238 <tag/Function/Write a byte to memory.
1239 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1240 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
1241 <tag/Description/The function writes the value <tt/val/ to the absolute
1242 memory address given by <tt/addr/.
1243 <tag/Notes/<itemize>
1244 <item>The function is actually a macro.
1245 <item>This function depends highly on the platform and environment.
1246 <item>Careless use will cause the program to act strange or may crash the
1249 <tag/Availability/cc65
1251 <ref id="PEEK" name="PEEK">,
1252 <ref id="POKEW" name="POKEW">
1258 <sect1>POKEW<label id="POKEW"><p>
1262 <tag/Function/Write a word (two bytes) to memory.
1263 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1264 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
1265 <tag/Description/The function writes the value <tt/val/ to the absolute
1266 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
1267 the <tt/addr/, the high byte is written to <tt/addr+1/.
1268 <tag/Notes/<itemize>
1269 <item>The function is actually a macro.
1270 <item>This function depends highly on the platform and environment.
1271 <item>Careless use will cause the program to act strange or may crash the
1273 <item>The order in which the two bytes are written is unspecified and may
1274 depend of the address expression used.
1276 <tag/Availability/cc65
1278 <ref id="PEEK" name="PEEK">,
1279 <ref id="POKE" name="POKE">
1285 <sect1>SEI<label id="SEI"><p>
1289 <tag/Function/Insert a 6502 SEI instrunction into the code.
1290 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1291 <tag/Declaration/<tt/void SEI (void);/
1292 <tag/Description/The function will insert a 6502 SEI instruction into the code,
1293 so interrupts are disabled. Note that non maskable interrupts cannot be
1295 <tag/Notes/<itemize>
1296 <item>The function is actually a macro.
1297 <item>Disabling interrupts may lead to unexpected results.
1299 <tag/Availability/cc65
1301 <ref id="BRK" name="BRK">,
1302 <ref id="CLI" name="CLI">
1308 <sect1>abort<label id="abort"><p>
1312 <tag/Function/Terminates a program abnormally.
1313 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1314 <tag/Declaration/<tt/void abort (void);/
1315 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
1316 on stderr, then terminates the program with an exit code of 3.
1317 <tag/Availability/ISO 9899
1319 <ref id="assert" name="assert">,
1320 <ref id="exit" name="exit">,
1321 <ref id="raise" name="raise">
1327 <sect1>abs<label id="abs"><p>
1331 <tag/Function/Returns the absolute value of an integer.
1332 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1333 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
1334 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
1336 <tag/Notes/<itemize>
1337 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
1338 <item>The function is only available as fastcall function, so it may only be
1339 used in presence of a prototype.
1341 <tag/Availability/ISO 9899
1343 <ref id="labs" name="labs">
1349 <sect1>assert<label id="assert"><p>
1353 <tag/Function/Test a condition and possibly abort.
1354 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
1355 <tag/Declaration/<tt/void assert (int cond);/
1356 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
1357 statement. If the condition evaluates t zero (false), assert prints a message
1358 on stderr and aborts the program.
1359 <tag/Notes/<itemize>
1360 <item>The function is actually a macro.
1362 <tag/Availability/ISO 9899
1364 <ref id="abort" name="abort">,
1365 <ref id="exit" name="exit">
1371 <sect1>atexit<label id="atexit"><p>
1375 <tag/Function/Register an exit function.
1376 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1377 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1378 <tag/Description/<tt/atexit/ registers the function pointed to by
1379 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1380 terminates, they are called in LIFO order (the last function registered is
1381 called first). <tt/atexit/ returns zero on success and a nonzero value on
1383 <tag/Notes/<itemize>
1384 <item>A maximum of 5 exit functions can be registered.
1385 <item>There is no way to unregister an exit function.
1386 <item>The function is only available as fastcall function, so it may only be
1387 used in presence of a prototype.
1389 <tag/Availability/ISO 9899
1391 <ref id="abort" name="abort">,
1392 <ref id="exit" name="exit">
1398 <sect1>atmos_explode<label id="atmos_explode"><p>
1402 <tag/Function/Bomb sound effect.
1403 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1404 <tag/Declaration/<tt/void __fastcall__ atmos_explode(void);/
1405 <tag/Description/<tt/atmos_explode/ plays the BASIC sound.
1406 <tag/Notes/<itemize>
1407 <item>The function is available only as a fastcall function; so, it may be used
1408 only in the presence of a prototype.
1410 <tag/Availability/cc65
1412 <ref id="atmos_ping" name="atmos_ping">,
1413 <ref id="atmos_shoot" name="atmos_shoot">,
1414 <ref id="atmos_tick" name="atmos_tick">,
1415 <ref id="atmos_tock" name="atmos_tock">,
1416 <ref id="atmos_zap" name="atmos_zap">
1422 <sect1>atmos_load<label id="atmos_load"><p>
1426 <tag/Function/Load Atmos tape.
1427 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1428 <tag/Declaration/<tt/void __fastcall__ atmos_load(const char* name);/
1429 <tag/Description/<tt/atmos_load/ reads a memory block from tape.
1430 <tag/Notes/<itemize>
1431 <item>The function is available only as a fastcall function; so, it may be used
1432 only in the presence of a prototype.
1434 <tag/Availability/cc65
1436 <ref id="atmos_save" name="atmos_save">
1442 <sect1>atmos_ping<label id="atmos_ping"><p>
1446 <tag/Function/Bell or ricochet sound effect.
1447 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1448 <tag/Declaration/<tt/void __fastcall__ atmos_ping(void);/
1449 <tag/Description/<tt/atmos_ping/ plays the BASIC sound.
1450 <tag/Notes/<itemize>
1451 <item>The function is available only as a fastcall function; so, it may be used
1452 only in the presence of a prototype.
1454 <tag/Availability/cc65
1456 <ref id="atmos_explode" name="atmos_explode">,
1457 <ref id="atmos_shoot" name="atmos_shoot">,
1458 <ref id="atmos_tick" name="atmos_tick">,
1459 <ref id="atmos_tock" name="atmos_tock">,
1460 <ref id="atmos_zap" name="atmos_zap">
1466 <sect1>atmos_save<label id="atmos_save"><p>
1470 <tag/Function/Save Atmos tape.
1471 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1472 <tag/Declaration/<tt/void __fastcall__ atmos_save(const char* name, const void* start, const void* end);/
1473 <tag/Description/<tt/atmos_save/ writes a memory block to tape.
1474 <tag/Notes/<itemize>
1475 <item>The function is available only as a fastcall function; so, it may be used
1476 only in the presence of a prototype.
1478 <tag/Availability/cc65
1480 <ref id="atmos_load" name="atmos_load">
1482 atmos_save("hires", 0xa000, 0xc000);
1488 <sect1>atmos_shoot<label id="atmos_shoot"><p>
1492 <tag/Function/Pistol sound effect.
1493 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1494 <tag/Declaration/<tt/void __fastcall__ atmos_shoot(void);/
1495 <tag/Description/<tt/atmos_shoot/ plays the BASIC sound.
1496 <tag/Notes/<itemize>
1497 <item>The function is available only as a fastcall function; so, it may be used
1498 only in the presence of a prototype.
1500 <tag/Availability/cc65
1502 <ref id="atmos_explode" name="atmos_explode">,
1503 <ref id="atmos_ping" name="atmos_ping">,
1504 <ref id="atmos_tick" name="atmos_tick">,
1505 <ref id="atmos_tock" name="atmos_tock">,
1506 <ref id="atmos_zap" name="atmos_zap">
1512 <sect1>atmos_tick<label id="atmos_tick"><p>
1516 <tag/Function/High-pitch click.
1517 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1518 <tag/Declaration/<tt/void __fastcall__ atmos_tick(void);/
1519 <tag/Description/<tt/atmos_tick/ plays the system sound.
1520 <tag/Notes/<itemize>
1521 <item>The function is available only as a fastcall function; so, it may be used
1522 only in the presence of a prototype.
1524 <tag/Availability/cc65
1526 <ref id="atmos_explode" name="atmos_explode">,
1527 <ref id="atmos_ping" name="atmos_ping">,
1528 <ref id="atmos_shoot" name="atmos_shoot">,
1529 <ref id="atmos_tock" name="atmos_tock">,
1530 <ref id="atmos_zap" name="atmos_zap">
1536 <sect1>atmos_tock<label id="atmos_tock"><p>
1540 <tag/Function/Low-pitch click.
1541 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1542 <tag/Declaration/<tt/void __fastcall__ atmos_tock(void);/
1543 <tag/Description/<tt/atmos_tock/ plays the system sound.
1544 <tag/Notes/<itemize>
1545 <item>The function is available only as a fastcall function; so, it may be used
1546 only in the presence of a prototype.
1548 <tag/Availability/cc65
1550 <ref id="atmos_explode" name="atmos_explode">,
1551 <ref id="atmos_ping" name="atmos_ping">,
1552 <ref id="atmos_shoot" name="atmos_shoot">,
1553 <ref id="atmos_tick" name="atmos_tick">,
1554 <ref id="atmos_zap" name="atmos_zap">
1560 <sect1>atmos_zap<label id="atmos_zap"><p>
1564 <tag/Function/Raygun sound effect.
1565 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1566 <tag/Declaration/<tt/void __fastcall__ atmos_zap(void);/
1567 <tag/Description/<tt/atmos_zap/ plays the BASIC sound.
1568 <tag/Notes/<itemize>
1569 <item>The function is available only as a fastcall function; so, it may be used
1570 only in the presence of a prototype.
1572 <tag/Availability/cc65
1574 <ref id="atmos_explode" name="atmos_explode">,
1575 <ref id="atmos_ping" name="atmos_ping">,
1576 <ref id="atmos_shoot" name="atmos_shoot">,
1577 <ref id="atmos_tick" name="atmos_tick">,
1578 <ref id="atmos_tock" name="atmos_tock">
1584 <sect1>atoi<label id="atoi"><p>
1588 <tag/Function/Convert a string to an integer.
1589 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1590 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1591 <tag/Description/<tt/atoi/ converts the given string into an integer.
1592 Conversion stops as soon as any invalid character is encountered.
1593 <tag/Notes/<itemize>
1594 <item>There is no way to detect any conversion errors.
1595 <item>The function does not check for an numerical overflow when converting.
1596 <item>The function is only available as fastcall function, so it may only be
1597 used in presence of a prototype.
1599 <tag/Availability/ISO 9899
1601 <ref id="atol" name="atol">,
1602 <ref id="itoa" name="itoa">,
1603 <ref id="ltoa" name="ltoa">,
1604 <ref id="ultoa" name="ultoa">,
1605 <ref id="utoa" name="utoa">
1611 <sect1>atol<label id="atol"><p>
1615 <tag/Function/Convert a string to a long integer.
1616 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1617 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1618 <tag/Description/<tt/atol/ converts the given string into a long integer.
1619 Conversion stops as soon as any invalid character is encountered.
1620 <tag/Notes/<itemize>
1621 <item>There is no way to detect any conversion errors.
1622 <item>The function does not check for an numerical overflow when converting.
1623 <item>The function is only available as fastcall function, so it may only be
1624 used in presence of a prototype.
1626 <tag/Availability/ISO 9899
1628 <ref id="atoi" name="atoi">,
1629 <ref id="itoa" name="itoa">,
1630 <ref id="ltoa" name="ltoa">,
1631 <ref id="ultoa" name="ultoa">,
1632 <ref id="utoa" name="utoa">
1638 <sect1>bgcolor<label id="bgcolor"><p>
1642 <tag/Function/Set the background text color.
1643 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1644 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1645 <tag/Description/The function will set a new background color and return the
1646 old (current) one. The background color is valid for the whole text output
1647 area of the screen, not just for new text.
1648 <tag/Notes/<itemize>
1649 <item>Background colors are system dependent. The function may have no effect
1650 on systems where the background color cannot be changed.
1651 <item>The function is only available as fastcall function, so it may only be
1652 used in presence of a prototype.
1654 <tag/Availability/cc65
1656 <ref id="bordercolor" name="bordercolor">,
1657 <ref id="textcolor" name="textcolor">
1663 <sect1>bordercolor<label id="bordercolor"><p>
1667 <tag/Function/Set the border (frame) color.
1668 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1669 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1670 <tag/Description/The function will set a new border color. It returns the old
1671 (current) border color.
1672 <tag/Notes/<itemize>
1673 <item>Border colors are system dependent. The function may have no effect
1674 on systems where the border color cannot be changed.
1675 <item>The function is only available as fastcall function, so it may only
1676 be used in presence of a prototype.
1678 <tag/Availability/cc65
1680 <ref id="bgcolor" name="bgcolor">,
1681 <ref id="textcolor" name="textcolor">
1687 <sect1>bsearch<label id="bsearch"><p>
1691 <tag/Function/Do a binary search in a sorted array.
1692 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1693 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1694 const void* base, size_t n, size_t size,
1695 int __fastcall__ (* cmp) (const void*, const void*));/
1696 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1697 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1698 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1699 the function used to compare the members against the key. The function returns
1700 a pointer to the member found, or <tt/NULL/ if there was no match.
1701 <tag/Notes/<itemize>
1702 <item>The contents of the array must be sorted in ascending order according to
1703 the compare function given.
1704 <item>If there are multiple members that match the key, the function will
1705 return one of the members.
1706 <item>The function is only available as fastcall function, so it may only
1707 be used in presence of a prototype.
1708 <item>The function to which <tt/cmp/ points must have the <tt/fastcall/ calling
1711 <tag/Availability/ISO 9899
1713 <ref id="qsort" name="qsort">
1719 <sect1>bzero<label id="bzero"><p>
1723 <tag/Function/Fill a memory area with zeroes.
1724 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1725 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1726 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1728 <tag/Notes/<itemize>
1729 <item>The function is non standard and therefore only available in non ANSI
1730 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1731 <item>The function is only available as fastcall function, so it may only
1732 be used in presence of a prototype.
1734 <tag/Availability/cc65
1736 <ref id="_swap" name="_swap">,
1737 <ref id="memcpy" name="memcpy">,
1738 <ref id="memmove" name="memmove">,
1739 <ref id="memset" name="memset">,
1745 <sect1>c64mode<label id="c64mode"><p>
1749 <tag/Function/Switch the C128 into C64 compatible mode.
1750 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1751 <tag/Declaration/<tt/void c64mode (void);/
1752 <tag/Description/The function will cause the machine to reboot into C64 mode.
1753 <tag/Notes/<itemize>
1754 <item>The function is specific to the C128.
1755 <item>The function will not return to the caller.
1757 <tag/Availability/C128
1763 <sect1>calloc<label id="calloc"><p>
1767 <tag/Function/Allocate and clear memory.
1768 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1769 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1770 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1771 of size <tt/size/, clears the whole block with binary zeroes and returns a
1772 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1774 <tag/Notes/<itemize>
1775 <item>Clearing the memory may not have the expected effect on all platforms:
1776 pointers in the block may not be <tt/NULL/ and floating point variables may
1777 not be zero (0.0). In other words: The "clearing" effect of this function
1778 should be used with care for portable programs.
1779 <item>The function is only available as fastcall function, so it may only
1780 be used in presence of a prototype.
1782 <tag/Availability/ISO 9899
1784 <ref id="_heapadd" name="_heapadd">,
1785 <ref id="_heapblocksize" name="_heapblocksize">,
1786 <ref id="_heapmaxavail" name="_heapmaxavail">,
1787 <ref id="_heapmemavail" name="_heapmemavail">,
1788 <ref id="free" name="free">,
1789 <ref id="malloc" name="malloc">,
1790 <ref id="realloc" name="realloc">
1796 <sect1>cbm_k_acptr<label id="cbm_k_acptr"><p>
1800 <tag/Function/Input byte from serial bus
1801 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1802 <tag/Declaration/<tt/unsigned char cbm_k_acptr (void);/
1803 <tag/Description/The function returns a byte of data, which it
1804 gets from the current TALKer on the serial bus.
1805 In order to receive the data, the device must have previously been
1806 sent a command to TALK and a secondary address if it needs one.
1807 <tag/Notes/<itemize>
1810 <tag/Availability/cc65
1812 <ref id="cbm_k_talk" name="cbm_k_talk">,
1818 <sect1>cbm_k_basin<label id="cbm_k_basin"><p>
1822 <tag/Function/Input a Character from the Current Device
1823 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1824 <tag/Declaration/<tt/unsigned char cbm_k_basin (void);/
1825 <tag/Description/The function returns a character from the current input device.
1826 Device must first have been OPENed and then designated as the input channel by the CHKIN routine.
1827 When this function is called, the next byte of data available from the device is returned.
1828 Exception is the routine for the keyboard device (which is the default input device).
1829 <tag/Notes/<itemize>
1832 <tag/Availability/cc65
1834 <ref id="cbm_k_open" name="cbm_k_open">,
1835 <ref id="cbm_k_chkin" name="cbm_k_chkin">
1841 <sect1>cbm_k_bsout<label id="cbm_k_bsout"><p>
1845 <tag/Function/Output a byte
1846 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1847 <tag/Declaration/<tt/void __fastcall__ cbm_k_bsout (unsigned char C);/
1848 <tag/Description/Function sends the character to the current output device.
1849 Unless a device has been OPENed and designated as the
1850 current output channel using the CHKOUT routine, the character is
1851 printed to the screen, which is the default output device. If the
1852 cassette is the current device, outputting a byte will only add it to
1853 the buffer. No actual transmission of data will occur until the
1854 192-byte buffer is full.
1855 <tag/Notes/<itemize>
1856 <item>The function is only available as fastcall function, so it may
1857 only be used in presence of a prototype.
1859 <tag/Availability/cc65
1861 <ref id="cbm_k_open" name="cbm_k_open">,
1862 <ref id="cbm_k_chkin" name="cbm_k_chkout">
1868 <sect1>cbm_k_chkin<label id="cbm_k_chkin"><p>
1872 <tag/Function/Designate a Logical File As the Current Input Channel
1873 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1874 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_chkin (unsigned char FN);/
1875 <tag/Description/If you wish to
1876 get data from any device other than the keyboard, this function must be
1877 called after OPENing the device, before you can get a data byte with
1878 the cbm_k_basin or cbm_k_getin routine. When called, the routine will designate
1879 the logical file whose file number was supplied as the
1880 current file, its device as the current device, and its secondary
1881 address as the current secondary address. If the device on the
1882 channel is a serial device, which requires a TALK command and
1883 sometimes a secondary address, function will send them over the
1885 <tag/Notes/<itemize>
1886 <item>The function is only available as fastcall function, so it may
1887 only be used in presence of a prototype.
1889 <tag/Availability/cc65
1891 <ref id="cbm_k_open" name="cbm_k_open">,
1892 <ref id="cbm_k_basin" name="cbm_k_basin">,
1893 <ref id="cbm_k_getin" name="cbm_k_getin">
1899 <sect1>cbm_k_ciout<label id="cbm_k_ciout"><p>
1903 <tag/Function/Transmit a byte over the serial bus
1904 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1905 <tag/Declaration/<tt/void __fastcall__ cbm_k_ciout (unsigned char C);/
1906 <tag/Description/Purpose of this function is to send a byte of data over
1907 the serial bus. In order for the data to be received, the serial
1908 device must have first been commanded to LISTEN and been given a
1909 secondary address if necessary. This routine always buffers the
1910 current character, and defers sending it until the next byte is
1911 buffered. When the UNLISTEN command is sent, the last byte will be
1912 sent with an End or Identify (EOI).
1913 <tag/Notes/<itemize>
1914 <item>The function is only available as fastcall function, so it may
1915 only be used in presence of a prototype.
1917 <tag/Availability/cc65
1919 <ref id="cbm_k_listen" name="cbm_k_listen">,
1920 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">
1926 <sect1>cbm_k_ckout<label id="cbm_k_ckout"><p>
1930 <tag/Function/Designate a Logical File As the Current Output Channel
1931 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1932 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_ckout (unsigned char FN);/
1933 <tag/Description/If you wish to
1934 output data to any device other than the screen, this routine must be
1935 called after OPENing the device, and before you output a data byte
1936 with the cbm_k_bsout() function. When called, the function will designate the
1937 logical file whose file number was supplied as the current
1938 file, its device as the current device, and its secondary address as
1939 the current secondary address. If the device on the channel uses the
1940 serial bus, and therefore requires a LISTEN command and possibly a
1941 secondary address, this information will be sent on the bus.
1942 <tag/Notes/<itemize>
1943 <item>The function is only available as fastcall function, so it may
1944 only be used in presence of a prototype.
1946 <tag/Availability/cc65
1948 <ref id="cbm_k_bsout" name="cbm_k_bsout">,
1949 <ref id="cbm_k_listen" name="cbm_k_listen">
1955 <sect1>cbm_k_clall<label id="cbm_k_clall"><p>
1959 <tag/Function/Close All Logical I/O Files
1960 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1961 <tag/Declaration/<tt/void cbm_k_clall (void);/
1962 <tag/Description/It closes all
1963 open files, by resetting the index into open files to
1964 zero and restores the default I/O devices.
1965 <tag/Notes/<itemize>
1968 <tag/Availability/cc65
1970 <ref id="cbm_k_open" name="cbm_k_open">,
1971 <ref id="cbm_k_close" name="cbm_k_close">
1977 <sect1>cbm_k_close<label id="cbm_k_close"><p>
1981 <tag/Function/Close a Logical I/O File
1982 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1983 <tag/Declaration/<tt/void __fastcall__ cbm_k_close (unsigned char FN);/
1984 <tag/Description/It is used to
1985 close a logical file after all I/O operations involving that file have
1987 <tag/Notes/<itemize>
1988 <item>The function is only available as fastcall function, so it may
1989 only be used in presence of a prototype.
1991 <tag/Availability/cc65
1993 <ref id="cbm_k_open" name="cbm_k_open">,
1994 <ref id="cbm_k_clall" name="cbm_k_clall">
2000 <sect1>cbm_k_clrch<label id="cbm_k_clrch"><p>
2004 <tag/Function/Restore Current Input and Output Devices to the Default Devices
2005 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2006 <tag/Declaration/<tt/void cbm_k_clrch (void);/
2007 <tag/Description/It sets the
2008 current input device to the keyboard, and the current output device to
2009 the screen. Also, if the current input device was formerly a serial
2010 device, the routine sends it an UNTALK command on the serial bus, and
2011 if a serial device was formerly the current output device, the routine
2012 sends it an UNLISTEN command.
2013 <tag/Notes/<itemize>
2016 <tag/Availability/cc65
2018 <ref id="cbm_k_chkin" name="cbm_k_chkin">,
2019 <ref id="cbm_k_ckout" name="cbm_k_ckout">
2025 <sect1>cbm_k_getin<label id="cbm_k_getin"><p>
2029 <tag/Function/Get One Byte from the Input Device
2030 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2031 <tag/Declaration/<tt/unsigned char cbm_k_getin (void);/
2032 <tag/Description/Function gets a character from the current input device.
2033 <tag/Notes/<itemize>
2036 <tag/Availability/cc65
2038 <ref id="cbm_k_basin" name="cbm_k_basin">
2044 <sect1>cbm_k_iobase<label id="cbm_k_iobase"><p>
2048 <tag/Function/Return Base Address of Memory-Mapped I/O Devices
2049 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2050 <tag/Declaration/<tt/unsigned cbm_k_iobase (void);/
2051 <tag/Description/This function returns the address of
2052 the memory section where the memory mapped I/O devices are located. This
2053 address can then be used with an offset to access the memory mapped I/O
2054 devices in the Commodore 64. The offset is the number of locations from
2055 the beginning of the page on which the I/O register you want is located.
2056 This function exists to provide compatibility between the Commodore 64,
2057 VIC-20, and future models of the Commodore 64. If the I/O locations for
2058 a program are set by a call to this function, they should
2059 still remain compatible with future versions of the Commodore 64, the
2061 <tag/Notes/<itemize>
2064 <tag/Availability/cc65
2072 <sect1>cbm_k_listen<label id="cbm_k_listen"><p>
2076 <tag/Function/Command a device on the serial bus to LISTEN
2077 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2078 <tag/Declaration/<tt/void __fastcall__ cbm_k_listen (unsigned char dev);/
2079 <tag/Description/This function will command a device on the serial bus to
2080 receive data. The KERNAL routine will OR the supplied device number bit by bit
2081 to convert it to a listen address, then transmits this data as a command on
2082 the serial bus. The specified device will then go into listen mode, and
2083 be ready to accept information.
2084 <tag/Notes/<itemize>
2085 <item>The function is only available as fastcall function, so it may
2086 only be used in presence of a prototype.
2088 <tag/Availability/cc65
2090 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">,
2096 <sect1>cbm_k_load<label id="cbm_k_load"><p>
2100 <tag/Function/Load RAM from a Device
2101 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2102 <tag/Declaration/<tt/unsigned int __fastcall__ cbm_k_load(unsigned char flag, unsigned addr);/
2103 <tag/Description/This function LOADs data bytes from any input device directly into the memory.
2104 It can also be used for a verify operation, comparing data from a device with the data already in
2105 memory, while leaving the data stored in RAM unchanged.
2106 The flag must be set to 0 for a LOAD operation, or 1 for a
2107 verify, If the input device is OPENed with a secondary address (SA) of 0
2108 the header information from the device is ignored. In this case, the starting address for the load must be supplied.
2109 If the device is addressed with a secondary address of 1, then the data is
2110 loaded into memory starting at the location specified by the header.
2111 Function returns the address of the highest RAM location loaded.
2112 Before this function can be called, the KERNAL SETLFS, and SETNAM
2113 routines must be called.
2114 <tag/Notes/<itemize>
2115 <item>The function is only available as fastcall function, so it may
2116 only be used in presence of a prototype.
2118 <tag/Availability/cc65
2120 <ref id="cbm_k_save" name="cbm_k_save">,
2121 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2122 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2128 <sect1>cbm_k_open<label id="cbm_k_open"><p>
2132 <tag/Function/Open a Logical I/O File
2133 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2134 <tag/Declaration/<tt/unsigned char cbm_k_open (void);/
2135 <tag/Description/This function assigns a logical file to a device, so that it can be used for
2136 Input/Output operations. In order to specify the logical file number,
2137 the device number, and the secondary address if any, the cbm_k_setlfs() function must first be called.
2138 Likewise, in order to designate the filename, the cbm_k_setnam() function must be used first. After these two
2139 functions are called, cbm_k_open() is then called.
2140 <tag/Notes/<itemize>
2143 <tag/Availability/cc65
2145 <ref id="cbm_k_close" name="cbm_k_close">,
2146 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2147 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2153 <sect1>cbm_k_readst<label id="cbm_k_readst"><p>
2157 <tag/Function/Read status word
2158 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2159 <tag/Declaration/<tt/unsigned char cbm_k_readst (void);/
2160 <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.
2161 <tag/Notes/<itemize>
2164 <tag/Availability/cc65
2172 <sect1>cbm_k_save<label id="cbm_k_save"><p>
2176 <tag/Function/Save RAM to a Device
2177 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2178 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_save(unsigned int start, unsigned int end)/
2179 <tag/Description/This function saves a section of memory. The cbm_k_setlfs() and cbm_k_setnam() functions must be
2180 used before calling this function. However, a file name is not required to
2181 SAVE to device 1 (the Datassette(TM) recorder). Any attempt to save to
2182 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.
2183 <tag/Notes/<itemize>
2184 <item>The function is only available as fastcall function, so it may
2185 only be used in presence of a prototype.
2187 <tag/Availability/cc65
2189 <ref id="cbm_k_load" name="cbm_k_load">,
2190 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2191 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2197 <sect1>cbm_k_scnkey<label id="cbm_k_scnkey"><p>
2201 <tag/Function/Scan the keyboard matrix.
2202 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2203 <tag/Declaration/<tt/void cbm_k_scnkey (void);/
2204 <tag/Description/This function looks at the switches in the keyboard, to see
2205 if any of them are being pressed. If they are, then code numbers for them are
2206 stored in RAM. Other functions use those numbers to input text. Normally,
2207 the keyboard is scanned by the Kernal's Interrupt Service Routine. But, if
2208 you divert the "Jiffy interrupt" to a C-code ISR, then that ISR must call this
2209 function, in order to provide input from the keyboard.
2210 <tag/Availability/cc65
2212 <ref id="cbm_k_getin" name="cbm_k_getin">,
2213 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2214 <ref id="cgetc" name="cgetc">,
2215 <!-- <ref id="getc" name="getc"> -->
2216 <!-- <ref id="getchar" name="getchar"> -->
2222 <sect1>cbm_k_setlfs<label id="cbm_k_setlfs"><p>
2226 <tag/Function/Set up a logical file
2227 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2228 <tag/Declaration/<tt/void __fastcall__ cbm_k_setlfs (unsigned char LFN, unsigned char DEV, unsigned char SA);/
2229 <tag/Description/This functions sets up the logical file by setting its number, device address,
2230 and secondary address.
2231 <tag/Notes/<itemize>
2232 <item>The function is only available as fastcall function, so it may
2233 only be used in presence of a prototype.
2235 <tag/Availability/cc65
2237 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2243 <sect1>cbm_k_setnam<label id="cbm_k_setnam"><p>
2247 <tag/Function/Set Filename Parameters
2248 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2249 <tag/Declaration/<tt/void __fastcall__ cbm_k_setnam (const char* Name);/
2250 <tag/Description/This function is used to set up the file name for the OPEN,
2251 SAVE, or LOAD operations.
2252 <tag/Notes/<itemize>
2253 <item>The function is only available as fastcall function, so it may
2254 only be used in presence of a prototype.
2256 <tag/Availability/cc65
2258 <ref id="cbm_k_open" name="cbm_k_open">,
2259 <ref id="cbm_k_load" name="cbm_k_load">,
2260 <ref id="cbm_k_save" name="cbm_k_save">
2266 <sect1>cbm_k_talk<label id="cbm_k_talk"><p>
2270 <tag/Function/Commands device to TALK
2271 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2272 <tag/Declaration/<tt/void __fastcall__ cbm_k_talk (unsigned char dev);/
2273 <tag/Description/When called, it ORs the device number with the TALK code (64, $40) and sends it on the serial
2274 bus. This commands the device to TALK.
2275 <tag/Notes/<itemize>
2276 <item>The function is only available as fastcall function, so it may
2277 only be used in presence of a prototype.
2279 <tag/Availability/cc65
2281 <ref id="cbm_k_acptr" name="cbm_k_acptr">
2287 <sect1>cbm_k_udtim<label id="cbm_k_udtim"><p>
2291 <tag/Function/Update the Jiffy clock.
2292 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2293 <tag/Declaration/<tt/void cbm_k_udtim (void);/
2294 <tag/Description/This function adds one count to the Jiffy clock. That clock
2295 counts sixtieths of a second. It is used by the library's <tt/clock()/
2296 function. Normally, the Jiffy clock is updated by the Kernal's Interrupt
2297 Service Routine. But, if you divert the "Jiffy interrupt" to a C-code ISR,
2298 then that ISR must call this function, in order to keep the clock valid.
2299 <tag/Availability/cc65
2301 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2302 <ref id="clock" name="clock">
2308 <sect1>cbm_k_unlsn<label id="cbm_k_unlsn"><p>
2312 <tag/Function/Send an UNLISTEN command
2313 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2314 <tag/Declaration/<tt/void cbm_k_unlsn (void);/
2315 <tag/Description/This function commands all devices on the serial bus to
2316 stop receiving data from the host computer (i.e., UNLISTEN). Calling this
2317 function results in an UNLISTEN command being transmitted on the serial
2318 bus. Only devices previously commanded to LISTEN are affected. This
2319 function is normally used after the host computer is finished sending data
2320 to external devices. Sending the UNLISTEN commands the listening devices
2321 to get off the serial bus so it can be used for other purposes.
2322 <tag/Notes/<itemize>
2325 <tag/Availability/cc65
2327 <ref id="cbm_k_listen" name="cbm_k_listen">
2333 <sect1>cclear<label id="cclear"><p>
2337 <tag/Function/Clear part of a line (write a given number of spaces).
2338 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2339 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
2340 <tag/Description/The function clears part of a line by writing <tt/length/
2341 spaces in the current text color.
2342 <tag/Notes/<itemize>
2343 <item>The function is only available as fastcall function, so it may
2344 only be used in presence of a prototype.
2346 <tag/Availability/cc65
2348 <ref id="cclearxy" name="cclearxy">,
2349 <ref id="clrscr" name="clrscr">
2355 <sect1>cclearxy<label id="cclearxy"><p>
2359 <tag/Function/Clear part of a line (write a given number of spaces) starting
2360 at a specific screen position.
2361 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2362 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
2363 <tag/Description/The function moves the cursor to a specific position, and
2364 will then clear part of the line by writing <tt/length/ spaces in the current
2366 <tag/Notes/<itemize>
2367 <item>The function is only available as fastcall function, so it may
2368 only be used in presence of a prototype.
2370 <tag/Availability/cc65
2372 <ref id="cclear" name="cclear">,
2373 <ref id="clrscr" name="clrscr">
2379 <sect1>cgetc<label id="cgetc"><p>
2383 <tag/Function/Read a character from the keyboard.
2384 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2385 <tag/Declaration/<tt/char cgetc (void);/
2386 <tag/Description/The function reads a character from the keyboard. If there is
2387 no character available, <tt/cgetc()/ waits until the user presses a key. If the
2388 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
2389 displayed while waiting.
2390 <tag/Notes/<itemize>
2391 <item>If the system supports a keyboard buffer, <tt/cgetc()/ will fetch a key
2392 from that buffer; and, wait only if the buffer is empty.
2393 <item>The keyboard must be scanned periodically, in order for this function to
2394 see anything that you type. (See the description of <tt/cbm_k_scnkey()/.)
2396 <tag/Availability/cc65
2398 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2399 <ref id="cursor" name="cursor">,
2400 <ref id="kbhit" name="kbhit">
2406 <sect1>chline<label id="chline"><p>
2410 <tag/Function/Output a horizontal line in text mode.
2411 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2412 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
2413 <tag/Description/The function outputs a horizontal line with the given length
2414 starting at the current cursor position.
2415 <tag/Notes/<itemize>
2416 <item>The character used to draw the horizontal line is system dependent.
2417 If available, a line drawing character is used. Drawing a line that is partially
2418 off screen leads to undefined behaviour.
2419 <item>The function is only available as fastcall function, so it may only be
2420 used in presence of a prototype.
2422 <tag/Availability/cc65
2424 <ref id="chlinexy" name="chlinexy">,
2425 <ref id="cvline" name="cvline">,
2426 <ref id="cvlinexy" name="cvlinexy">
2432 <sect1>chlinexy<label id="chlinexy"><p>
2436 <tag/Function/Output a horizontal line at a given position in text mode.
2437 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2438 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
2439 <tag/Description/The function outputs a horizontal line with the given length
2440 starting at a given position.
2441 <tag/Notes/<itemize>
2442 <item>The character used to draw the horizontal line is system dependent.
2443 If available, a line drawing character is used. Drawing a line that is partially
2444 off screen leads to undefined behaviour.
2445 <item>The function is only available as fastcall function, so it may only be
2446 used in presence of a prototype.
2448 <tag/Availability/cc65
2450 <ref id="chline" name="chline">,
2451 <ref id="cvline" name="cvline">,
2452 <ref id="cvlinexy" name="cvlinexy">
2458 <sect1>clearerr<label id="clearerr"><p>
2462 <tag/Function/Clear error and end-of-file status of a stream.
2463 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2464 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
2465 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
2466 indicators for the stream <tt/f/.
2467 <tag/Notes/<itemize>
2468 <item>The function is only available as fastcall function, so it may only be
2469 used in presence of a prototype.
2471 <tag/Availability/ISO 9899
2473 <ref id="feof" name="feof">,
2474 <ref id="ferror" name="ferror">
2480 <sect1>clock<label id="clock"><p>
2484 <tag/Function/Determine the processor time used.
2485 <tag/Header/<tt/<ref id="time.h" name="time.h">/
2486 <tag/Declaration/<tt/clock_t clock (void);/
2487 <tag/Description/The <tt/clock/ function returns an approximaton of processor
2488 time used by the program. The time is returned in implementation-defined
2489 units. It can be converted to seconds by dividing by the value of the macro
2490 <tt/CLOCKS_PER_SEC/.
2491 <tag/Notes/<itemize>
2492 <item>Since the machines that cc65-generated programs run on cannot run multiple
2493 processes, the function actually will return the time since some
2494 implementation-defined point in the past.
2495 <item>The Jiffy clock must be "running", in order for this function to return
2496 changing values. (See the description of <tt/cbm_k_udtim()/.)
2498 <tag/Availability/ISO 9899
2500 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2501 <ref id="time" name="time">
2507 <sect1>clrscr<label id="clrscr"><p>
2511 <tag/Function/Clear the text screen.
2512 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2513 <tag/Declaration/<tt/void clrscr (void);/
2514 <tag/Description/The function clears the text screen and moves the cursor to
2515 the upper left corner.
2516 <tag/Availability/cc65
2518 <ref id="cclear" name="cclear">,
2519 <ref id="cclearxy" name="cclearxy">
2525 <sect1>close<label id="close"><p>
2529 <tag/Function/Close a file descriptor.
2530 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2531 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
2532 <tag/Description/The function closes the given file descriptor. It returns zero
2533 on success and -1 on error. If an error occurs, the cause can be determined by
2534 reading the <tt/errno/ variable.
2535 <tag/Notes/<itemize>
2536 <item>The function is only available as fastcall function, so it may only
2537 be used in presence of a prototype.
2539 <tag/Availability/POSIX 1003.1
2541 <ref id="creat" name="creat">,
2542 <ref id="open" name="open">
2548 <sect1>closedir<label id="closedir"><p>
2552 <tag/Function/Close a directory.
2553 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
2554 <tag/Declaration/<tt/int __fastcall__ closedir (DIR* dir);/
2555 <tag/Description/The function closes the given directory descriptor. It returns
2556 zero on success and -1 on error. If an error occurs, the cause can be determined
2557 by reading the <tt/errno/ variable.
2558 <tag/Notes/<itemize>
2559 <item>The function is only available as fastcall function, so it may only
2560 be used in presence of a prototype.
2562 <tag/Availability/POSIX 1003.1
2564 <ref id="opendir" name="opendir">,
2565 <ref id="readdir" name="readdir">
2571 <sect1>cpeekc<label id="cpeekc"><p>
2575 <tag/Function/Get a character from the display memory.
2576 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2577 <tag/Declaration/<tt/char cpeekc (void);/
2578 <tag/Description/The function gets the character that's at the current location
2579 of the cursor in the display screen RAM. That character is converted, if
2580 needed, into the encoding that can be passed to <tt/cputc()/.
2581 <tag/Notes/<itemize>
2582 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2583 done to make it obvious that peeking doesn't move the cursor in any way. Your
2584 program must place the cursor where it wants to peek before it calls any of
2587 <tag/Availability/cc65
2589 <ref id="cpeekcolor" name="cpeekcolor">,
2590 <ref id="cpeekrevers" name="cpeekrevers">,
2591 <ref id="cpeeks" name="cpeeks">,
2592 <ref id="cputc" name="cputc">
2598 <sect1>cpeekcolor<label id="cpeekcolor"><p>
2602 <tag/Function/Get a color from the display memory.
2603 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2604 <tag/Declaration/<tt/unsigned char cpeekcolor (void);/
2605 <tag/Description/The function gets the color number that's at the current
2606 location of the cursor in the display screen RAM. That number can be passed to
2608 <tag/Notes/<itemize>
2609 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2610 done to make it obvious that peeking doesn't move the cursor in any way. Your
2611 program must place the cursor where it wants to peek before it calls any of
2614 <tag/Availability/cc65
2616 <ref id="cpeekc" name="cpeekc">,
2617 <ref id="cpeekrevers" name="cpeekrevers">,
2618 <ref id="cpeeks" name="cpeeks">,
2619 <ref id="cputc" name="cputc">,
2620 <ref id="textcolor" name="textcolor">
2626 <sect1>cpeekrevers<label id="cpeekrevers"><p>
2630 <tag/Function/Get a reverse-character attribute from the display memory.
2631 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2632 <tag/Declaration/<tt/unsigned char cpeekrevers (void);/
2633 <tag/Description/The function gets the "reverse-mode" attribute of the
2634 character that's at the current location of the cursor in the display screen
2635 RAM. It returns a boolean value (0/1) that can be passed to <tt/revers()/.
2636 <tag/Notes/<itemize>
2637 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2638 done to make it obvious that peeking doesn't move the cursor in any way. Your
2639 program must place the cursor where it wants to peek before it calls any of
2642 <tag/Availability/cc65
2644 <ref id="cpeekc" name="cpeekc">,
2645 <ref id="cpeekcolor" name="cpeekcolor">,
2646 <ref id="cpeeks" name="cpeeks">,
2647 <ref id="cputc" name="cputc">,
2648 <ref id="revers" name="revers">
2654 <sect1>cpeeks<label id="cpeeks"><p>
2658 <tag/Function/Get a string from the display memory.
2659 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2660 <tag/Declaration/<tt/void __fastcall__ cpeeks (char* s, unsigned length);/
2661 <tag/Description/The function gets a fixed-length string ('\0'-terminated) of
2662 characters that start at the current location of the cursor in the display
2663 screen RAM. Those characters are converted, if needed, into the encoding that
2664 can be passed to <tt/cputs()/. The first argument must point to a RAM area
2665 that's large enough to hold "length + 1" bytes.
2666 <tag/Notes/<itemize>
2667 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2668 done to make it obvious that peeking doesn't move the cursor in any way. Your
2669 program must place the cursor where it wants to peek before it calls any of
2671 <item>The function is available as only a fastcall function;
2672 so, it may be used only in the presence of a prototype.
2674 <tag/Availability/cc65
2676 <ref id="cpeekc" name="cpeekc">,
2677 <ref id="cpeekcolor" name="cpeekcolor">,
2678 <ref id="cpeekrevers" name="cpeekrevers">,
2679 <ref id="cputc" name="cputc">,
2680 <ref id="cputs" name="cputs">
2686 <sect1>creat<label id="creat"><p>
2690 <tag/Function/Create a file.
2691 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2692 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
2693 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
2694 associated with it. On error, -1 is returned and an error code is stored in
2696 <tag/Notes/<itemize>
2697 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
2698 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
2699 <item>The function is only available as fastcall function, so it may only
2700 be used in presence of a prototype.
2702 <tag/Availability/POSIX 1003.1
2704 <ref id="close" name="close">,
2705 <ref id="open" name="open">
2711 <sect1>cprintf<label id="cprintf"><p>
2715 <tag/Function/Formatted output to the console.
2716 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2717 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
2718 <tag/Description/The arguments are converted to text where necessary and
2719 formatted according to the format string given. The resulting string is output
2720 to the console. <tt/cprintf/ supports the same format specifiers as
2721 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
2722 <tag/Notes/<itemize>
2723 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
2724 between <tt/\r/ and <tt/\n/.
2726 <tag/Availability/cc65
2728 <ref id="cputc" name="cputc">,
2729 <ref id="cputcxy" name="cputcxy">,
2730 <ref id="cputs" name="cputs">,
2731 <ref id="cputsxy" name="cputsxy">,
2732 <ref id="vcprintf" name="vcprintf">
2738 <sect1>cputc<label id="cputc"><p>
2742 <tag/Function/Output a character directly to the console.
2743 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2744 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
2745 <tag/Description/Output one character to the console at the current cursor
2747 <tag/Notes/<itemize>
2748 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
2749 between <tt/\r/ and <tt/\n/.
2750 <item>The function is only available as fastcall function, so it may only
2751 be used in presence of a prototype.
2753 <tag/Availability/cc65
2755 <ref id="cprintf" name="cprintf">,
2756 <ref id="cputcxy" name="cputcxy">,
2757 <ref id="cputs" name="cputs">,
2758 <ref id="cputsxy" name="cputsxy">,
2759 <ref id="vcprintf" name="vcprintf">
2765 <sect1>cputcxy<label id="cputcxy"><p>
2769 <tag/Function/Output a character at a specific screen position.
2770 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2771 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
2772 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
2773 the screen and outputs one character.
2774 <tag/Notes/<itemize>
2775 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
2776 between <tt/\r/ and <tt/\n/.
2777 <item>The function is only available as fastcall function, so it may only
2778 be used in presence of a prototype.
2780 <tag/Availability/cc65
2782 <ref id="cprintf" name="cprintf">,
2783 <ref id="cputc" name="cputc">,
2784 <ref id="cputs" name="cputs">,
2785 <ref id="cputsxy" name="cputsxy">,
2786 <ref id="vcprintf" name="vcprintf">
2792 <sect1>cputs<label id="cputs"><p>
2796 <tag/Function/Output a string directly to the console.
2797 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2798 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
2799 <tag/Description/The function outputs the given string on the console at the
2800 current cursor position.
2801 <tag/Notes/<itemize>
2802 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
2803 between <tt/\r/ and <tt/\n/.
2804 <item>The function is only available as fastcall function, so it may only
2805 be used in presence of a prototype.
2807 <tag/Availability/cc65
2809 <ref id="cprintf" name="cprintf">,
2810 <ref id="cputc" name="cputc">,
2811 <ref id="cputcxy" name="cputcxy">,
2812 <ref id="cputsxy" name="cputsxy">,
2813 <ref id="vcprintf" name="vcprintf">
2819 <sect1>cputsxy<label id="cputsxy"><p>
2823 <tag/Function/Output a string to the console at a given position.
2824 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2825 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
2826 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
2827 and outputs the string <tt/s/.
2828 <tag/Notes/<itemize>
2829 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
2830 between <tt/\r/ and <tt/\n/.
2831 <item>The function is only available as fastcall function, so it may only
2832 be used in presence of a prototype.
2834 <tag/Availability/cc65
2836 <ref id="cprintf" name="cprintf">,
2837 <ref id="cputc" name="cputc">,
2838 <ref id="cputcxy" name="cputcxy">,
2839 <ref id="cputs" name="cputs">,
2840 <ref id="vcprintf" name="vcprintf">
2846 <sect1>cursor<label id="cursor"><p>
2850 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
2851 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2852 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
2853 <tag/Description/If the argument to the function is non zero, a blinking cursor
2854 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
2855 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
2856 <tag/Notes/<itemize>
2857 <item>The function is only available as fastcall function, so it may only
2858 be used in presence of a prototype.
2860 <tag/Availability/cc65
2862 <ref id="cgetc" name="cgetc">,
2863 <ref id="kbhit" name="kbhit">
2869 <sect1>cvline<label id="cvline"><p>
2873 <tag/Function/Output a vertical line in text mode.
2874 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2875 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
2876 <tag/Description/The function outputs a vertical line with the given length
2877 starting at the current cursor position.
2878 <tag/Notes/<itemize>
2879 <item>The character used to draw the vertical line is system dependent.
2880 If available, a line drawing character is used. Drawing a line that is partially
2881 off screen leads to undefined behaviour.
2882 <item>The function is only available as fastcall function, so it may only be
2883 used in presence of a prototype.
2885 <tag/Availability/cc65
2887 <ref id="chline" name="chline">,
2888 <ref id="chlinexy" name="chlinexy">,
2889 <ref id="cvlinexy" name="cvlinexy">
2895 <sect1>cvlinexy<label id="cvlinexy"><p>
2899 <tag/Function/Output a vertical line at a given position in text mode.
2900 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2901 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
2902 <tag/Description/The function outputs a vertical line with the given length
2903 starting at a given position.
2904 <tag/Notes/<itemize>
2905 <item>The character used to draw the vertical line is system dependent.
2906 If available, a line drawing character is used. Drawing a line that is partially
2907 off screen leads to undefined behaviour.
2908 <item>The function is only available as fastcall function, so it may only be
2909 used in presence of a prototype.
2911 <tag/Availability/cc65
2913 <ref id="chline" name="chline">,
2914 <ref id="chlinexy" name="chlinexy">,
2915 <ref id="cvline" name="cvline">
2921 <sect1>decompress_lz4<label id="decompress_lz4"><p>
2925 <tag/Function/Uncompress a LZ4-compressed buffer.
2926 <tag/Header/<tt/<ref id="lz4.h" name="lz4.h">/
2927 <tag/Declaration/<tt/void decompress_lz4 (const unsigned char* src, unsigned char* const dst, const unsigned short uncompressed_size);/
2928 <tag/Description/<tt/decompress_lz4/ uncompresses a LZ4-compressed buffer.
2929 <tag/Notes/<itemize>
2930 <item>Use LZ4_compress_HC with compression level 16 for best compression.
2932 <tag/Availability/cc65
2938 <sect1>detect_c128<label id="detect_c128"><p>
2942 <tag/Function/Check if a C128 CPU is the current CPU.
2943 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
2944 <tag/Declaration/<tt/unsigned char detect_c128 (void);/
2945 <tag/Description/The function returns a 1 if a C128 CPU is the current CPU.
2946 <tag/Notes/<itemize>
2947 <item>The function is specific to the C64 and C128.
2949 <tag/Availability/cc65 (not all platforms)
2951 <ref id="get_c128_speed" name="get_c128_speed">,
2952 <ref id="set_c128_speed" name="set_c128_speed">,
2958 <sect1>detect_c64dtv<label id="detect_c64dtv"><p>
2962 <tag/Function/Check for the presence of the C64DTV.
2963 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
2964 <tag/Declaration/<tt/unsigned char detect_c64dtv (void);/
2965 <tag/Description/The function returns a 1 if a C64DTV has been detected.
2966 <tag/Notes/<itemize>
2967 <item>The function is specific to the C64.
2969 <tag/Availability/cc65 (not all platforms)
2971 <ref id="get_c64dtv_speed" name="get_c64dtv_speed">,
2972 <ref id="set_c64dtv_speed" name="set_c64dtv_speed">,
2978 <sect1>detect_c65<label id="detect_c65"><p>
2982 <tag/Function/Check for the presence of a C65/C64DX in C64 mode.
2983 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
2984 <tag/Declaration/<tt/unsigned char detect_c65 (void);/
2985 <tag/Description/The function returns a 1 if a C65/C64DX in C64 mode has been detected.
2986 <tag/Notes/<itemize>
2987 <item>The function is specific to the C64.
2989 <tag/Availability/cc65 (not all platforms)
2991 <ref id="get_c65_speed" name="get_c65_speed">,
2992 <ref id="set_c65_speed" name="set_c65_speed">,
2998 <sect1>detect_chameleon<label id="detect_chameleon"><p>
3002 <tag/Function/Check for the presence of the C64 Chameleon cartridge.
3003 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3004 <tag/Declaration/<tt/unsigned char detect_chameleon (void);/
3005 <tag/Description/The function returns a 1 if a C64 Chameleon cartridge has been detected.
3006 <tag/Notes/<itemize>
3007 <item>The function is specific to the C64.
3009 <tag/Availability/cc65 (not all platforms)
3011 <ref id="get_chameleon_speed" name="get_chameleon_speed">,
3012 <ref id="set_chameleon_speed" name="set_chameleon_speed">,
3018 <sect1>detect_scpu<label id="detect_scpu"><p>
3022 <tag/Function/Check for the presence of the C64/C128 SuperCPU cartridge.
3023 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3024 <tag/Declaration/<tt/unsigned char detect_scpu (void);/
3025 <tag/Description/The function returns a 1 if a SuperCPU cartridge has been detected.
3026 <tag/Notes/<itemize>
3027 <item>The function is specific to the C128 and C64.
3029 <tag/Availability/cc65 (not all platforms)
3031 <ref id="get_scpu_speed" name="get_scpu_speed">,
3032 <ref id="set_scpu_speed" name="set_scpu_speed">,
3038 <sect1>detect_turbomaster<label id="detect_turbomaster"><p>
3042 <tag/Function/Check for the presence of the C64 Turbo Master cartridge.
3043 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3044 <tag/Declaration/<tt/unsigned char detect_turbomaster (void);/
3045 <tag/Description/The function returns a 1 if a C64 Turbo Master cartridge has been detected.
3046 <tag/Notes/<itemize>
3047 <item>The function is specific to the C64.
3049 <tag/Availability/cc65 (not all platforms)
3051 <ref id="get_turbomaster_speed" name="get_turbomaster_speed">,
3052 <ref id="set_turbomaster_speed" name="set_turbomaster_speed">,
3058 <sect1>div<label id="div"><p>
3062 <tag/Function/Divide two ints and return quotient and remainder.
3063 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3064 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
3065 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
3066 quotient and remainder in a <tt/div_t/ structure.
3067 <tag/Notes/<itemize>
3068 <item>The function is only available as fastcall function, so it may only
3069 be used in presence of a prototype.
3071 <tag/Availability/ISO 9899
3079 <sect1>doesclrscrafterexit<label id="doesclrscrafterexit"><p>
3083 <tag/Function/Determines whether the screen is going to be cleared after program exit.
3084 <tag/Header/<tt/<ref id="cc65.h" name="cc65.h">/
3085 <tag/Declaration/<tt/unsigned char doesclrscrafterexit (void);/
3086 <tag/Description/The function returns zero if the screen won't be cleared immediately after
3087 program termination. It returns a non-zero value if it will.
3088 <tag/Notes/<itemize>
3089 <item>Some systems, maybe depending on configuration, immediately clear the screen
3090 after a program exits. Therefore it might be difficult to read
3091 the last messages printed by the program prior to its exit. This function can be used
3092 to decide if a delay or wait for a key press should be executed when then program
3095 <tag/Availability/cc65
3098 #include <stdio.h>
3099 #include <unistd.h>
3100 #include <cc65.h>
3103 printf("Hello World\n");
3104 if (doesclrscrafterexit())
3113 <sect1>em_commit<label id="em_commit"><p>
3117 <tag/Function/Commit changes into extended memory.
3118 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3119 <tag/Declaration/<tt/void em_commit (void);/
3120 <tag/Description/Commit changes in the memory window to extended storage. If
3121 the contents of the memory window have been changed, these changes may be lost
3122 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
3123 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
3124 name="em_copyto">/ are called without calling <tt/em_commit/ first.
3125 <tag/Notes/<itemize>
3126 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
3127 memory window are discarded, it does just mean that the drivers is allowed
3129 <item>The function is only available as fastcall function, so it may only be
3130 used in presence of a prototype.
3131 <item>The function produces undefined results if no extended memory driver is
3134 <tag/Availability/cc65
3136 <ref id="em_load_driver" name="em_load_driver">,
3137 <ref id="em_map" name="em_map">,
3138 <ref id="em_use" name="em_use">
3144 <sect1>em_copyfrom<label id="em_copyfrom"><p>
3148 <tag/Function/Copy from extended into normal memory.
3149 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3150 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
3151 <tag/Description/Copy data from extended memory into linear memory. Source and
3152 target addresses as well as the number of bytes to transfer are specified in
3153 the <tt/em_copy/ structure that is passed as a parameter.
3154 <tag/Notes/<itemize>
3155 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
3156 made any changes to the data in the window, call <tt/<ref id="em_commit"
3157 name="em_commit">/ first, or the changes are lost.
3158 <item>The function is only available as fastcall function, so it may only be
3159 used in presence of a prototype.
3160 <item>The function produces undefined results if no extended memory driver is
3163 <tag/Availability/cc65
3165 <ref id="em_commit" name="em_commit">,
3166 <ref id="em_copyto" name="em_copyto">,
3167 <ref id="em_load_driver" name="em_load_driver">
3173 <sect1>em_copyto<label id="em_copyto"><p>
3177 <tag/Function/Copy from normal into extended memory.
3178 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3179 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
3180 <tag/Description/Copy data from linear into extended memory. Source and
3181 target addresses as well as the number of bytes to transfer are specified in
3182 the <tt/em_copy/ structure that is passed as a parameter.
3183 <tag/Notes/<itemize>
3184 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
3185 made any changes to the data in the window, call <tt/<ref id="em_commit"
3186 name="em_commit">/ first, or the changes are lost.
3187 <item>The function is only available as fastcall function, so it may only be
3188 used in presence of a prototype.
3189 <item>The function produces undefined results if no extended memory driver is
3192 <tag/Availability/cc65
3194 <ref id="em_commit" name="em_commit">,
3195 <ref id="em_copyfrom" name="em_copyfrom">,
3196 <ref id="em_load_driver" name="em_load_driver">
3202 <sect1>em_install<label id="em_install"><p>
3206 <tag/Function/Install an already loaded extended memory driver.
3207 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3208 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
3209 <tag/Description/The function installs an already loaded extended memory driver
3210 and returns an error code. The function may be used to install a driver linked
3211 statically to the program.
3212 <tag/Notes/<itemize>
3213 <item>Not all drivers are able to detect if the supported hardware is really
3215 <item>The function is only available as fastcall function, so it may only be
3216 used in presence of a prototype.
3218 <tag/Availability/cc65
3220 <ref id="em_load_driver" name="em_load_driver">,
3221 <ref id="em_uninstall" name="em_uninstall">,
3222 <ref id="em_unload" name="em_unload">
3228 <sect1>em_load_driver<label id="em_load_driver"><p>
3232 <tag/Function/Load and initialize an extended memory driver.
3233 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3234 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
3235 <tag/Description/Load an extended memory driver into memory and initialize
3236 it. The function returns an error code that tells if all this has been
3238 <tag/Notes/<itemize>
3239 <item>Not all drivers are able to detect if the supported hardware is really
3241 <item>The function is only available as fastcall function, so it may only be
3242 used in presence of a prototype.
3243 <item>The driver is loaded by name, so currently you must know the type of
3244 extended memory that should be supported. There is no autodetect capability.
3246 <tag/Availability/cc65
3248 <ref id="em_unload" name="em_unload">
3254 <sect1>em_map<label id="em_map"><p>
3258 <tag/Function/Make a page of extended memory accessible.
3259 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3260 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
3261 <tag/Description/The function maps one page of extended memory into linear
3262 memory and returns a pointer to the page frame. Depending on the hardware
3263 and driver, the data is either mapped into the address space or transfered
3264 into a buffer. If you don't need the actual contents of the page (for example
3265 because you're going to overwrite it completely), it is better to call
3266 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
3267 data if it is possible to avoid that.
3268 <tag/Notes/<itemize>
3269 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
3270 made any changes to the data in the window, call <tt/<ref id="em_commit"
3271 name="em_commit">/ first, or the changes are lost.
3272 <item>The function is only available as fastcall function, so it may only be
3273 used in presence of a prototype.
3274 <item>The function produces undefined results if no extended memory driver is
3277 <tag/Availability/cc65
3279 <ref id="em_commit" name="em_commit">,
3280 <ref id="em_load_driver" name="em_load_driver">,
3281 <ref id="em_use" name="em_use">
3287 <sect1>em_pagecount<label id="em_pagecount"><p>
3291 <tag/Function/Return the number of available extended memory pages.
3292 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3293 <tag/Declaration/<tt/unsigned em_pagecount (void);/
3294 <tag/Description/The function returns the size of the extended memory supported
3295 by the driver in 256 byte pages.
3296 <tag/Notes/<itemize>
3297 <item>The function returns zero if no extended memory driver is loaded.
3298 <item>The function may return zero if the supported hardware was not detected.
3300 <tag/Availability/cc65
3302 <ref id="em_load_driver" name="em_load_driver">
3308 <sect1>em_uninstall<label id="em_uninstall"><p>
3312 <tag/Function/Uninstall an already loaded extended memory driver.
3313 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3314 <tag/Declaration/<tt/unsigned char em_uninstall (void);/
3315 <tag/Description/The function uninstalls an already loaded extended memory
3316 driver but doesn't remove it from memory.
3317 <tag/Notes/<itemize>
3318 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
3319 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
3320 should be used instead of <tt/em_uninstall/ so the driver is also removed
3323 <tag/Availability/cc65
3325 <ref id="em_install" name="em_install">,
3326 <ref id="em_load_driver" name="em_load_driver">,
3327 <ref id="em_unload" name="em_unload">
3333 <sect1>em_unload<label id="em_unload"><p>
3337 <tag/Function/Unload an extended memory driver.
3338 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3339 <tag/Declaration/<tt/unsigned char em_unload (void);/
3340 <tag/Description/The function unloads a loaded extended memory driver and
3341 frees all memory allocated for the driver.
3342 <tag/Notes/<itemize>
3343 <item>The function does nothing if no driver is loaded.
3345 <tag/Availability/cc65
3347 <ref id="em_load_driver" name="em_load_driver">
3353 <sect1>em_use<label id="em_use"><p>
3357 <tag/Function/Prepare an extended memory page for use.
3358 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3359 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
3360 <tag/Description/The function maps one page of extended memory into linear
3361 memory and returns a pointer to the page frame. This function is similar to
3362 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
3363 actual memory window in the assumption that the existing data is wrong or
3364 will get overwritten.
3365 <tag/Notes/<itemize>
3366 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
3367 made any changes to the data in the window, call <tt/<ref id="em_commit"
3368 name="em_commit">/ first, or the changes are lost.
3369 <item>The function is only available as fastcall function, so it may only be
3370 used in presence of a prototype.
3371 <item>The function produces undefined results if no extended memory driver is
3374 <tag/Availability/cc65
3376 <ref id="em_commit" name="em_commit">,
3377 <ref id="em_load_driver" name="em_load_driver">,
3378 <ref id="em_map" name="em_map">
3384 <sect1>exit<label id="exit"><p>
3388 <tag/Function/Terminate the program.
3389 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3390 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
3391 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
3392 return code of the program. Before termination, all files are closed, buffered
3393 output is written and any functions registered with <tt/<ref id="atexit"
3394 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
3395 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
3397 <tag/Notes/<itemize>
3398 <item>The function is only available as fastcall function, so it may only
3399 be used in presence of a prototype.
3400 <item>It depends on the host machine if the program return code can be
3401 evaluated or is ignored.
3403 <tag/Availability/ISO 9899
3405 <ref id="abort" name="abort">,
3406 <ref id="exit" name="exit">
3412 <sect1>exec<label id="exec"><p>
3416 <tag/Function/Execute a program file.
3417 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3418 <tag/Declaration/<tt/int __fastcall__ exec (const char* progname, const char* cmdline);/
3419 <tag/Description/<tt/exec/ replaces the currently running program by a new one.
3420 Calling <tt/exec()/ is identical to calling <tt/<ref id="exit" name="exit()">/,
3421 then loading and starting the program named in the first argument, passing
3422 the command line specified as second argument. Instead of an empty string,
3423 a <tt/NULL/ pointer may be passed as second parameter.
3424 On success, the function does not return. On failure, -1 is returned and
3425 <tt/errno/ contains an error code.
3426 <tag/Notes/<itemize>
3427 <item>The function is only available as fastcall function, so it may only
3428 be used in presence of a prototype.
3429 <item>On most platforms, the function needs to copy a small stub loader to
3430 some memory area outside the program space. This may collide with other
3431 programs. See the platform specific docs on this.
3432 <item>Because it is necessary to terminate the running program before the
3433 memory can be reused to load the new one, there is a high chance that the
3434 function may not be able to return on errors.
3435 <item>The command line is passed to the new program in the same way as cc65
3436 programs expect the command line. If the new program is not a cc65 generated
3437 program, it may not be able to read it.
3439 <tag/Availability/cc65
3441 <ref id="exit" name="exit">
3447 <sect1>fast<label id="fast"><p>
3451 <tag/Function/Switch the CPU into fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
3452 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
3453 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
3454 <tag/Declaration/<tt/void fast (void);/
3455 <tag/Description/The function will switch the clock of the CPU to fast mode. For the C128
3456 target it means switching the CPU into 2MHz mode. For the C16/Plus4 target it means
3457 switching the CPU into double clock mode.
3458 <tag/Notes/<itemize>
3459 <item>The function is specific to the C128, C16 and Plus4.
3460 <item>On the C128 the 2MHz clock will not work in 40 column mode.
3462 <tag/Availability/cc65 (not all platforms)
3464 <ref id="isfast" name="isfast">,
3465 <ref id="slow" name="slow">,
3471 <sect1>feof<label id="feof"><p>
3475 <tag/Function/Return the end-of-file indicator of a stream.
3476 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3477 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
3478 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
3479 <tt/f/, and returns a non zero value if it is set.
3480 <tag/Notes/<itemize>
3481 <item>The indicator is set only after a read past the end of a file is
3483 <item>The function is only available as fastcall function, so it may only be
3484 used in presence of a prototype.
3486 <tag/Availability/ISO 9899
3488 <ref id="feof" name="clearerr">,
3489 <ref id="ferror" name="ferror">
3495 <sect1>ferror<label id="ferror"><p>
3499 <tag/Function/Return the error indicator of a stream.
3500 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3501 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
3502 <tag/Description/<tt/ferror/ tests the error indicator of the stream
3503 <tt/f/, and returns a non zero value if it is set.
3504 <tag/Notes/<itemize>
3505 <item>The function is only available as fastcall function, so it may only be
3506 used in presence of a prototype.
3508 <tag/Availability/ISO 9899
3510 <ref id="feof" name="clearerr">,
3511 <ref id="ferror" name="feof">
3517 <sect1>fileno<label id="fileno"><p>
3521 <tag/Function/Return the file handle used by a stream.
3522 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3523 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
3524 <tag/Description/The <tt/fileno/ function returns the file handle used
3525 internally by a C stream. This file handle (an integer) can be used as a
3526 handle for the POSIX input/output functions.
3527 <tag/Notes/<itemize>
3528 <item>The function is only available as fastcall function, so it may only be
3529 used in presence of a prototype.
3530 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
3531 file may have unpredictable results.
3533 <tag/Availability/POSIX 1003.1
3535 <ref id="creat" name="creat">,
3536 <ref id="open" name="open"> <!-- , -->
3537 <!-- <ref id="read" name="read">, -->
3538 <!-- <ref id="write" name="write"> -->
3544 <sect1>free<label id="free"><p>
3548 <tag/Function/Free a block of dynamic memory.
3549 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3550 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
3551 <tag/Description/Free a block of dynamic memory previously allocated with
3552 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
3553 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
3554 pointer is <tt/NULL/, no action is performed.
3555 <tag/Notes/<itemize>
3556 <item>Passing an already free'd block to <tt/free/ again will cause undefined
3557 behaviour and may crash your program.
3558 <item>The function is only available as fastcall function, so it may only
3559 be used in presence of a prototype.
3561 <tag/Availability/ISO 9899
3563 <ref id="_heapadd" name="_heapadd">,
3564 <ref id="_heapblocksize" name="_heapblocksize">,
3565 <ref id="_heapmaxavail" name="_heapmaxavail">,
3566 <ref id="_heapmemavail" name="_heapmemavail">,
3567 <ref id="calloc" name="calloc">,
3568 <ref id="malloc" name="malloc">,
3569 <ref id="realloc" name="realloc">
3575 <sect1>get_ostype<label id="get_ostype"><p>
3579 <tag/Function/The function returns the operating system, the program runs on.
3580 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
3581 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
3582 <tag/Declaration/<tt/unsigned char get_ostype (void);/
3583 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
3584 all supported targets. If it exists, it returns a number that identifies the
3585 operating system or machine type, the program runs on. The machine dependent
3586 header files define constants that can be used to check the return code.
3587 <tag/Notes/<itemize>
3588 <item>The function does not exist on all platforms.
3589 <item>The return codes are platform dependent.
3591 <tag/Availability/cc65 (not all platforms)
3597 <sect1>get_c128_speed<label id="get_c128_speed"><p>
3601 <tag/Function/Get the current speed of the C128 CPU.
3602 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3603 <tag/Declaration/<tt/unsigned char get_c128_speed (void);/
3604 <tag/Description/The function returns the current speed of the C128 CPU.
3605 <tag/Notes/<itemize>
3606 <item>The function is specific to the C64 and C128.
3607 <item>The function does not check if the C128 CPU is the current CPU.
3608 <item>See the accelerator.h header for the speed definitions.
3610 <tag/Availability/cc65 (not all platforms)
3612 <ref id="detect_c128" name="detect_c128">,
3613 <ref id="set_c128_speed" name="set_c128_speed">,
3619 <sect1>get_c64dtv_speed<label id="get_c64dtv_speed"><p>
3623 <tag/Function/Get the current speed of the C64DTV.
3624 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3625 <tag/Declaration/<tt/unsigned char get_c64dtv_speed (void);/
3626 <tag/Description/The function returns the current speed of the C64DTV.
3627 <tag/Notes/<itemize>
3628 <item>The function is specific to the C64.
3629 <item>The function does not check for the presence of the C64DTV.
3630 <item>See the accelerator.h header for the speed definitions.
3632 <tag/Availability/cc65 (not all platforms)
3634 <ref id="detect_c64dtv" name="detect_c64dtv">,
3635 <ref id="set_c64dtv_speed" name="set_c64dtv_speed">,
3641 <sect1>get_c65_speed<label id="get_c65_speed"><p>
3645 <tag/Function/Get the current speed of the C65/C64DX in C64 mode.
3646 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3647 <tag/Declaration/<tt/unsigned char get_c65_speed (void);/
3648 <tag/Description/The function returns the current speed of the C65/C64DX in C64 mode.
3649 <tag/Notes/<itemize>
3650 <item>The function is specific to the C64.
3651 <item>The function does not check for the presence of a C65/C64DX in C64 mode.
3652 <item>See the accelerator.h header for the speed definitions.
3654 <tag/Availability/cc65 (not all platforms)
3656 <ref id="detect_c65" name="detect_c65">,
3657 <ref id="set_c65_speed" name="set_c65_speed">,
3663 <sect1>get_chameleon_speed<label id="get_chameleon_speed"><p>
3667 <tag/Function/Get the current speed of the C64 Chameleon cartridge.
3668 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3669 <tag/Declaration/<tt/unsigned char get_chameleon_speed (void);/
3670 <tag/Description/The function returns the current speed of the C64 Chameleon cartridge.
3671 <tag/Notes/<itemize>
3672 <item>The function is specific to the C64.
3673 <item>The function does not check for the presence of the C64 Chameleon cartridge.
3674 <item>See the accelerator.h header for the speed definitions.
3676 <tag/Availability/cc65 (not all platforms)
3678 <ref id="detect_chameleon" name="detect_chameleon">,
3679 <ref id="set_chameleon_speed" name="set_chameleon_speed">,
3685 <sect1>get_scpu_speed<label id="get_scpu_speed"><p>
3689 <tag/Function/Get the current speed of the C64/C128 SuperCPU cartridge.
3690 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3691 <tag/Declaration/<tt/unsigned char get_scpu_speed (void);/
3692 <tag/Description/The function returns the current speed of the SuperCPU cartridge.
3693 <tag/Notes/<itemize>
3694 <item>The function is specific to the C128 and C64.
3695 <item>The function does not check for the presence of the cartridge.
3696 <item>See the accelerator.h header for the speed definitions.
3698 <tag/Availability/cc65 (not all platforms)
3700 <ref id="detect_scpu" name="detect_scpu">,
3701 <ref id="set_scpu_speed" name="set_scpu_speed">,
3707 <sect1>get_turbomaster_speed<label id="get_turbomaster_speed"><p>
3711 <tag/Function/Get the current speed of the C64 Turbo Master cartridge.
3712 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3713 <tag/Declaration/<tt/unsigned char get_turbomaster_speed (void);/
3714 <tag/Description/The function returns the current speed of the C64 Turbo Master cartridge.
3715 <tag/Notes/<itemize>
3716 <item>The function is specific to the C64.
3717 <item>The function does not check for the presence of the C64 Turbo Master cartridge.
3718 <item>See the accelerator.h header for the speed definitions.
3720 <tag/Availability/cc65 (not all platforms)
3722 <ref id="detect_turbomaster" name="detect_turbomaster">,
3723 <ref id="set_turbomaster_speed" name="set_turbomaster_speed">,
3728 <sect1>getcpu<label id="getcpu"><p>
3732 <tag/Function/Determine on which CPU the program is running.
3733 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3734 <tag/Declaration/<tt/unsigned char getcpu (void);/
3735 <tag/Description/The function checks on which CPU the code is running. It
3736 returns one of the constants<itemize>
3738 <item><tt/CPU_65C02/
3739 <item><tt/CPU_65816/
3741 <item><tt/CPU_65SC02/
3742 <item><tt/CPU_65CE02/
3743 <item><tt/CPU_HUC6280/
3746 <tag/Notes/<itemize>
3747 <item>Other, more exotic CPU types are not disinguished.
3749 <tag/Availability/cc65
3755 <sect1>getcurrentdevice<label id="getcurrentdevice"><p>
3759 <tag/Function/Get current device.
3760 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3761 <tag/Declaration/<tt/unsigned char getcurrentdevice (void);/
3762 <tag/Description/The function returns the current device.
3763 It allows to access the current device with the <ref id="dio.h"
3764 name="Low-level disk I/O API"> or <ref id="cbm.h" name="cbm_* I/O
3765 functions"> requiring a 'device' parameter.
3766 <tag/Availability/cc65
3768 <ref id="getdevicedir" name="getdevicedir">,
3769 <ref id="getfirstdevice" name="getfirstdevice">,
3770 <ref id="getnextdevice" name="getnextdevice">
3772 dio_open (getcurrentdevice ());
3778 <sect1>getcwd<label id="getcwd"><p>
3782 <tag/Function/Get current working directory.
3783 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3784 <tag/Declaration/<tt/char* __fastcall__ getcwd (char* buf, size_t size);/
3785 <tag/Description/The function will return the current working directory.
3786 <tag/Notes/<itemize>
3787 <item>The function is only available as fastcall function, so it may only
3788 be used in presence of a prototype.
3790 <tag/Availability/POSIX 1003.1
3796 <sect1>getdevicedir<label id="getdevicedir"><p>
3800 <tag/Function/Get device directory.
3801 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3802 <tag/Declaration/<tt/char* __fastcall__ getdevicedir (unsigned char device, char* buf, size_t size);/
3803 <tag/Description/The function returns the directory representing <tt/device/.
3804 It allows to access the device on filesystem level by calling chdir() with
3805 the directory returned.
3806 <tag/Notes/<itemize>
3807 <item>Calling getdevicedir() <em/does/ check for a (formatted) disk in a
3808 floppy-disk-type device and returns NULL if that check fails.
3809 <item>The function is only available as fastcall function, so it may only
3810 be used in presence of a prototype.
3812 <tag/Availability/cc65
3814 <ref id="getcwd" name="getcwd">,
3815 <ref id="getcurrentdevice" name="getcurrentdevice">,
3816 <ref id="getfirstdevice" name="getfirstdevice">,
3817 <ref id="getnextdevice" name="getnextdevice">
3819 chdir (getdevicedir (device, buf, sizeof buf));
3821 cf. <tt/samples/enumdevdir.c/
3826 <sect1>getenv<label id="getenv"><p>
3830 <tag/Function/Return a value from the environment.
3831 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3832 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
3833 <tag/Description/The function searches the environment for an entry that
3834 matches <tt/name/ and returns its value. The environment consists of a list
3835 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
3837 <tag/Notes/<itemize>
3838 <item>What exactly is stored in the environment depends on the machine the
3839 program is running on.
3840 <item>The function is only available as fastcall function, so it may only
3841 be used in presence of a prototype.
3843 <tag/Availability/ISO 9899
3849 <sect1>getfirstdevice<label id="getfirstdevice"><p>
3853 <tag/Function/Get first device.
3854 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3855 <tag/Declaration/<tt/unsigned char getfirstdevice (void);/
3856 <tag/Description/The function returns the first device.
3857 The constant <tt/INVALID_DEVICE/ indicates no device.
3858 <tag/Notes/<itemize>
3859 <item>Calling getfirstdevice() does <em/not/ turn on the motor of a
3860 drive-type device and does <em/not/ check for a disk in the drive.
3862 <tag/Availability/cc65
3864 <ref id="getcurrentdevice" name="getcurrentdevice">,
3865 <ref id="getdevicedir" name="getdevicedir">,
3866 <ref id="getnextdevice" name="getnextdevice">
3868 unsigned char dev = getfirstdevice ();
3869 while (dev != INVALID_DEVICE) {
3870 printf ("%d\n", dev);
3871 dev = getnextdevice (dev);
3878 <sect1>getnextdevice<label id="getnextdevice"><p>
3882 <tag/Function/Get next device.
3883 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3884 <tag/Declaration/<tt/unsigned char __fastcall__ getnextdevice (unsigned char device);/
3885 <tag/Description/The function returns the next device after <tt/device/.
3886 The constant <tt/INVALID_DEVICE/ indicates no further device.
3887 <tag/Notes/<itemize>
3888 <item>Calling getnextdevice() does <em/not/ turn on the motor of a
3889 drive-type device and does <em/not/ check for a disk in the drive.
3890 <item>The function is only available as fastcall function, so it may only
3891 be used in presence of a prototype.
3893 <tag/Availability/cc65
3895 <ref id="getcurrentdevice" name="getcurrentdevice">,
3896 <ref id="getdevicedir" name="getdevicedir">,
3897 <ref id="getfirstdevice" name="getfirstdevice">
3899 unsigned char dev = getfirstdevice ();
3900 while (dev != INVALID_DEVICE) {
3901 printf ("%d\n", dev);
3902 dev = getnextdevice (dev);
3909 <sect1>getopt<label id="getopt"><p>
3913 <tag/Function/Parse command line options.
3914 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3915 <tag/Declaration/<tt/int __fastcall__ getopt (int argc, char* const* argv,
3916 const char* optstring);/
3917 <tag/Description/The function parses command line arguments, <tt/argc/ and
3918 <tt/argv/ are the argument count and array passed to <tt/main/. <tt/optstring/
3919 is a string that contains command line option characters. If a character in
3920 <tt/optstring/ is followed by a colon, the option requires an argument. An
3921 option on the command line is recognized if it is one of the option characters
3923 <tt/getopt/ must be called repeatedly. It will return each option character
3924 found on the command line and <tt/EOF/ (-1) if there is no other option. An
3925 option argument is placed in <tt/optarg/, the index of the next element on the
3926 command line to be processed is placed in <tt/optind/.
3927 <tag/Notes/<itemize>
3928 <item>The implementation will not reorder options. A non option on the command
3929 line will terminate option processing. All remaining arguments are not
3930 recognized as options, even if the start with a '-' character.
3931 <item>The function is only available as fastcall function, so it may only
3932 be used in presence of a prototype.
3934 <tag/Availability/POSIX.2
3940 <sect1>gotox<label id="gotox"><p>
3944 <tag/Function/Move the text mode cursor to a new X position.
3945 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3946 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
3947 <tag/Description/The function moves the text mode cursor to the specified X
3948 position while leaving the Y position untouched. The leftmost position on the
3949 screen has the coordinate 0.
3950 <tag/Notes/<itemize>
3951 <item>The function is only available as fastcall function, so it may
3952 only be used in presence of a prototype.
3953 <item>Invalid values for the X position (out of screen coordinates) may
3954 lead to undefined behaviour.
3956 <tag/Availability/cc65
3958 <ref id="gotoy" name="gotoy">,
3959 <ref id="gotoxy" name="gotoxy">,
3960 <ref id="wherex" name="wherex">,
3961 <ref id="wherey" name="wherey">
3967 <sect1>gotoxy<label id="gotoxy"><p>
3971 <tag/Function/Move the text mode cursor to a new position.
3972 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3973 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
3974 <tag/Description/The function moves the text mode cursor to the specified
3975 position. The leftmost position on the screen has the X coordinate 0, the
3976 topmost line has the Y coordinate 0.
3977 <tag/Notes/<itemize>
3978 <item>The function is only available as fastcall function, so it may only be
3979 used in presence of a prototype.
3980 <item>Invalid values for any of both coordinates (out of screen positions) may
3981 lead to undefined behaviour.
3983 <tag/Availability/cc65
3985 <ref id="gotox" name="gotox">,
3986 <ref id="gotoy" name="gotoy">,
3987 <ref id="wherex" name="wherex">,
3988 <ref id="wherey" name="wherey">
3994 <sect1>gotoy<label id="gotoy"><p>
3998 <tag/Function/Move the text mode cursor to a new Y position.
3999 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4000 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
4001 <tag/Description/The function moves the text mode cursor to the specified Y
4002 position while leaving the X position untouched. The uppermost position on the
4003 screen has the coordinate 0.
4004 <tag/Notes/<itemize>
4005 <item>The function is only available as fastcall function, so it may
4006 only be used in presence of a prototype.
4007 <item>Invalid values for the Y position (out of screen coordinates) may lead
4008 to undefined behaviour.
4010 <tag/Availability/cc65
4012 <ref id="gotox" name="gotox">,
4013 <ref id="gotoxy" name="gotoxy">,
4014 <ref id="wherex" name="wherex">,
4015 <ref id="wherey" name="wherey">
4021 <sect1>isalnum<label id="isalnum"><p>
4025 <tag/Function/Check if a given character is a letter or digit.
4026 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4027 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
4028 <tag/Description/The function returns a non zero value if the given argument
4029 is a letter or digit. The return value is zero if the character is anything
4031 <tag/Notes/<itemize>
4032 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4033 inline sequence generated by the macro will not work correctly for values
4034 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4035 this range. The non inline function may be accessed by <tt/#undef/'ing
4037 <item>When compiling without <tt/-Os/, the function is only available as
4038 fastcall function, so it may only be used in presence of a prototype.
4040 <tag/Availability/ISO 9899
4042 <ref id="isalpha" name="isalpha">,
4043 <ref id="isascii" name="isascii">,
4044 <ref id="isblank" name="isblank">,
4045 <ref id="iscntrl" name="iscntrl">,
4046 <ref id="isdigit" name="isdigit">,
4047 <ref id="isgraph" name="isgraph">,
4048 <ref id="islower" name="islower">,
4049 <ref id="isprint" name="isprint">,
4050 <ref id="ispunct" name="ispunct">,
4051 <ref id="isspace" name="isspace">,
4052 <ref id="isupper" name="isupper">,
4053 <ref id="isxdigit" name="isxdigit">
4059 <sect1>isalpha<label id="isalpha"><p>
4063 <tag/Function/Check if a given character is a letter.
4064 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4065 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
4066 <tag/Description/The function returns a non zero value if the given argument
4067 is a letter. The return value is zero if the character is anything else.
4068 <tag/Notes/<itemize>
4069 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4070 inline sequence generated by the macro will not work correctly for values
4071 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4072 this range. The non inline function may be accessed by <tt/#undef/'ing the
4074 <item>When compiling without <tt/-Os/, the function is only available as
4075 fastcall function, so it may only be used in presence of a prototype.
4077 <tag/Availability/ISO 9899
4079 <ref id="isalnum" name="isalnum">,
4080 <ref id="isascii" name="isascii">,
4081 <ref id="isblank" name="isblank">,
4082 <ref id="iscntrl" name="iscntrl">,
4083 <ref id="isdigit" name="isdigit">,
4084 <ref id="isgraph" name="isgraph">,
4085 <ref id="islower" name="islower">,
4086 <ref id="isprint" name="isprint">,
4087 <ref id="ispunct" name="ispunct">,
4088 <ref id="isspace" name="isspace">,
4089 <ref id="isupper" name="isupper">,
4090 <ref id="isxdigit" name="isxdigit">
4096 <sect1>isascii<label id="isascii"><p>
4100 <tag/Function/Check if a given character is in the ASCII (0..127) range.
4101 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4102 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
4103 <tag/Description/The function returns a non zero value if the given argument
4104 is in the range 0..127 (the range of valid ASCII characters) and zero if not.
4105 <tag/Notes/<itemize>
4106 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4107 inline sequence generated by the macro will not work correctly for values
4108 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4109 this range. The non inline function may be accessed by <tt/#undef/'ing the
4111 <item>When compiling without <tt/-Os/, the function is only available as
4112 fastcall function, so it may only be used in presence of a prototype.
4114 <tag/Availability/ISO 9899
4116 <ref id="isalnum" name="isalnum">,
4117 <ref id="isalpha" name="isalpha">,
4118 <ref id="isblank" name="isblank">,
4119 <ref id="iscntrl" name="iscntrl">,
4120 <ref id="isdigit" name="isdigit">,
4121 <ref id="isgraph" name="isgraph">,
4122 <ref id="islower" name="islower">,
4123 <ref id="isprint" name="isprint">,
4124 <ref id="ispunct" name="ispunct">,
4125 <ref id="isspace" name="isspace">,
4126 <ref id="isupper" name="isupper">,
4127 <ref id="isxdigit" name="isxdigit">
4133 <sect1>isblank<label id="isblank"><p>
4137 <tag/Function/Check if a given character is a space or tab.
4138 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4139 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
4140 <tag/Description/The function returns a non zero value if the given argument
4141 is a space or tab character. The return value is zero if the character is
4143 <tag/Notes/<itemize>
4144 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4145 inline sequence generated by the macro will not work correctly for values
4146 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4147 this range. The non inline function may be accessed by <tt/#undef/'ing the
4149 <item>When compiling without <tt/-Os/, the function is only available as
4150 fastcall function, so it may only be used in presence of a prototype.
4152 <tag/Availability/ISO 9899
4154 <ref id="isalnum" name="isalnum">,
4155 <ref id="isalpha" name="isalpha">,
4156 <ref id="isascii" name="isascii">,
4157 <ref id="iscntrl" name="iscntrl">,
4158 <ref id="isdigit" name="isdigit">,
4159 <ref id="isgraph" name="isgraph">,
4160 <ref id="islower" name="islower">,
4161 <ref id="isprint" name="isprint">,
4162 <ref id="ispunct" name="ispunct">,
4163 <ref id="isspace" name="isspace">,
4164 <ref id="isupper" name="isupper">,
4165 <ref id="isxdigit" name="isxdigit">
4171 <sect1>iscntrl<label id="iscntrl"><p>
4175 <tag/Function/Check if a given character is a control character.
4176 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4177 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
4178 <tag/Description/The function returns a non zero value if the given argument
4179 is a control character. The return value is zero if the character is anything
4181 <tag/Notes/<itemize>
4182 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4183 inline sequence generated by the macro will not work correctly for values
4184 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4185 this range. The non inline function may be accessed by <tt/#undef/'ing the
4187 <item>When compiling without <tt/-Os/, the function is only available as
4188 fastcall function, so it may only be used in presence of a prototype.
4190 <tag/Availability/ISO 9899
4192 <ref id="isalnum" name="isalnum">,
4193 <ref id="isalpha" name="isalpha">,
4194 <ref id="isascii" name="isascii">,
4195 <ref id="isblank" name="isblank">,
4196 <ref id="isdigit" name="isdigit">,
4197 <ref id="isgraph" name="isgraph">,
4198 <ref id="islower" name="islower">,
4199 <ref id="isprint" name="isprint">,
4200 <ref id="ispunct" name="ispunct">,
4201 <ref id="isspace" name="isspace">,
4202 <ref id="isupper" name="isupper">,
4203 <ref id="isxdigit" name="isxdigit">
4209 <sect1>isdigit<label id="isdigit"><p>
4213 <tag/Function/Check if a given character is a digit.
4214 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4215 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
4216 <tag/Description/The function returns a non zero value if the given argument
4217 is a digit. The return value is zero if the character is anything else.
4218 <tag/Notes/<itemize>
4219 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4220 inline sequence generated by the macro will not work correctly for values
4221 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4222 this range. The non inline function may be accessed by <tt/#undef/'ing the
4224 <item>When compiling without <tt/-Os/, the function is only available as
4225 fastcall function, so it may only be used in presence of a prototype.
4227 <tag/Availability/ISO 9899
4229 <ref id="isalnum" name="isalnum">,
4230 <ref id="isalpha" name="isalpha">,
4231 <ref id="isascii" name="isascii">,
4232 <ref id="isblank" name="isblank">,
4233 <ref id="iscntrl" name="iscntrl">,
4234 <ref id="isgraph" name="isgraph">,
4235 <ref id="islower" name="islower">,
4236 <ref id="isprint" name="isprint">,
4237 <ref id="ispunct" name="ispunct">,
4238 <ref id="isspace" name="isspace">,
4239 <ref id="isupper" name="isupper">,
4240 <ref id="isxdigit" name="isxdigit">
4246 <sect1>isfast<label id="isfast"><p>
4250 <tag/Function/Check if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
4251 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
4252 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
4253 <tag/Declaration/<tt/unsigned char isfast (void);/
4254 <tag/Description/The function returns a 1 if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
4255 <tag/Notes/<itemize>
4256 <item>The function is specific to the C128, C16 and Plus4.
4258 <tag/Availability/cc65 (not all platforms)
4260 <ref id="fast" name="fast">,
4261 <ref id="slow" name="slow">,
4267 <sect1>isgraph<label id="isgraph"><p>
4271 <tag/Function/Check if a given character is a printable character (except
4273 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4274 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
4275 <tag/Description/The function returns a non zero value if the given argument
4276 is a printable character with the exception of space. The return value is zero
4277 if the character is anything else.
4278 <tag/Notes/<itemize>
4279 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4280 inline sequence generated by the macro will not work correctly for values
4281 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4282 this range. The non inline function may be accessed by <tt/#undef/'ing the
4284 <item>When compiling without <tt/-Os/, the function is only available as
4285 fastcall function, so it may only be used in presence of a prototype.
4287 <tag/Availability/ISO 9899
4289 <ref id="isalnum" name="isalnum">,
4290 <ref id="isalpha" name="isalpha">,
4291 <ref id="isascii" name="isascii">,
4292 <ref id="isblank" name="isblank">,
4293 <ref id="iscntrl" name="iscntrl">,
4294 <ref id="isdigit" name="isdigit">,
4295 <ref id="islower" name="islower">,
4296 <ref id="isprint" name="isprint">,
4297 <ref id="ispunct" name="ispunct">,
4298 <ref id="isspace" name="isspace">,
4299 <ref id="isupper" name="isupper">,
4300 <ref id="isxdigit" name="isxdigit">
4306 <sect1>islower<label id="islower"><p>
4310 <tag/Function/Check if a given character is a lower case letter.
4311 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4312 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
4313 <tag/Description/The function returns a non zero value if the given argument
4314 is a lower case letter. The return value is zero if the character is anything
4316 <tag/Notes/<itemize>
4317 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4318 inline sequence generated by the macro will not work correctly for values
4319 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4320 this range. The non inline function may be accessed by <tt/#undef/'ing the
4322 <item>When compiling without <tt/-Os/, the function is only available as
4323 fastcall function, so it may only be used in presence of a prototype.
4325 <tag/Availability/ISO 9899
4327 <ref id="isalnum" name="isalnum">,
4328 <ref id="isalpha" name="isalpha">,
4329 <ref id="isascii" name="isascii">,
4330 <ref id="isblank" name="isblank">,
4331 <ref id="iscntrl" name="iscntrl">,
4332 <ref id="isdigit" name="isdigit">,
4333 <ref id="isgraph" name="isgraph">,
4334 <ref id="isprint" name="isprint">,
4335 <ref id="ispunct" name="ispunct">,
4336 <ref id="isspace" name="isspace">,
4337 <ref id="isupper" name="isupper">,
4338 <ref id="isxdigit" name="isxdigit">
4344 <sect1>isprint<label id="isprint"><p>
4348 <tag/Function/Check if a given character is a printable character.
4349 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4350 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
4351 <tag/Description/The function returns a non zero value if the given argument
4352 is a printable character (this includes the space character). The return value
4353 is zero if the character is anything else.
4354 <tag/Notes/<itemize>
4355 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4356 inline sequence generated by the macro will not work correctly for values
4357 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4358 this range. The non inline function may be accessed by <tt/#undef/'ing the
4360 <item>When compiling without <tt/-Os/, the function is only available as
4361 fastcall function, so it may only be used in presence of a prototype.
4363 <tag/Availability/ISO 9899
4365 <ref id="isalnum" name="isalnum">,
4366 <ref id="isalpha" name="isalpha">,
4367 <ref id="isascii" name="isascii">,
4368 <ref id="isblank" name="isblank">,
4369 <ref id="iscntrl" name="iscntrl">,
4370 <ref id="isdigit" name="isdigit">,
4371 <ref id="isgraph" name="isgraph">,
4372 <ref id="islower" name="islower">,
4373 <ref id="ispunct" name="ispunct">,
4374 <ref id="isspace" name="isspace">,
4375 <ref id="isupper" name="isupper">,
4376 <ref id="isxdigit" name="isxdigit">
4382 <sect1>ispunct<label id="ispunct"><p>
4386 <tag/Function/Check if a given character is a printable character but not a
4387 space or an alphanumeric character.
4388 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4389 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
4390 <tag/Description/The function returns a non zero value if the given argument
4391 is a printable character, but not a space or anything alphanumeric. The return
4392 value is zero if the character is anything else.
4393 <tag/Notes/<itemize>
4394 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4395 inline sequence generated by the macro will not work correctly for values
4396 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4397 this range. The non inline function may be accessed by <tt/#undef/'ing the
4399 <item>When compiling without <tt/-Os/, the function is only available as
4400 fastcall function, so it may only be used in presence of a prototype.
4402 <tag/Availability/ISO 9899
4404 <ref id="isalnum" name="isalnum">,
4405 <ref id="isalpha" name="isalpha">,
4406 <ref id="isascii" name="isascii">,
4407 <ref id="isblank" name="isblank">,
4408 <ref id="iscntrl" name="iscntrl">,
4409 <ref id="isdigit" name="isdigit">,
4410 <ref id="isgraph" name="isgraph">,
4411 <ref id="islower" name="islower">,
4412 <ref id="isprint" name="isprint">,
4413 <ref id="isspace" name="isspace">,
4414 <ref id="isupper" name="isupper">,
4415 <ref id="isxdigit" name="isxdigit">
4421 <sect1>isspace<label id="isspace"><p>
4425 <tag/Function/Check if a given character is a white-space character.
4426 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4427 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
4428 <tag/Description/The function returns a non zero value if the given argument
4429 is a white space character. The return value is zero if the character is
4430 anything else. The standard white space characters are: space, formfeed ('\f'),
4431 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
4433 <tag/Notes/<itemize>
4434 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4435 inline sequence generated by the macro will not work correctly for values
4436 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4437 this range. The non inline function may be accessed by <tt/#undef/'ing the
4439 <item>When compiling without <tt/-Os/, the function is only available as
4440 fastcall function, so it may only be used in presence of a prototype.
4442 <tag/Availability/ISO 9899
4444 <ref id="isalnum" name="isalnum">,
4445 <ref id="isalpha" name="isalpha">,
4446 <ref id="isascii" name="isascii">,
4447 <ref id="isblank" name="isblank">,
4448 <ref id="iscntrl" name="iscntrl">,
4449 <ref id="isdigit" name="isdigit">,
4450 <ref id="isgraph" name="isgraph">,
4451 <ref id="islower" name="islower">,
4452 <ref id="isprint" name="isprint">,
4453 <ref id="ispunct" name="ispunct">,
4454 <ref id="isupper" name="isupper">,
4455 <ref id="isxdigit" name="isxdigit">
4461 <sect1>isupper<label id="isupper"><p>
4465 <tag/Function/Check if a given character is an upper case letter.
4466 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4467 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
4468 <tag/Description/The function returns a non zero value if the given argument
4469 is an upper case letter. The return value is zero if the character is anything
4471 <tag/Notes/<itemize>
4472 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4473 inline sequence generated by the macro will not work correctly for values
4474 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4475 this range. The non inline function may be accessed by <tt/#undef/'ing the
4477 <item>When compiling without <tt/-Os/, the function is only available as
4478 fastcall function, so it may only be used in presence of a prototype.
4480 <tag/Availability/ISO 9899
4482 <ref id="isalnum" name="isalnum">,
4483 <ref id="isalpha" name="isalpha">,
4484 <ref id="isascii" name="isascii">,
4485 <ref id="isblank" name="isblank">,
4486 <ref id="iscntrl" name="iscntrl">,
4487 <ref id="isdigit" name="isdigit">,
4488 <ref id="isgraph" name="isgraph">,
4489 <ref id="islower" name="islower">,
4490 <ref id="isprint" name="isprint">,
4491 <ref id="ispunct" name="ispunct">,
4492 <ref id="isspace" name="isspace">,
4493 <ref id="isxdigit" name="isxdigit">
4499 <sect1>isxdigit<label id="isxdigit"><p>
4503 <tag/Function/Check if a given character is a hexadecimal digit.
4504 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4505 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
4506 <tag/Description/The function returns a non zero value if the given argument
4507 is a hexadecimal digit (0..9, a..f and A..F). The return value is zero if the
4508 character is anything else.
4509 <tag/Notes/<itemize>
4510 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4511 inline sequence generated by the macro will not work correctly for values
4512 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4513 this range. The non inline function may be accessed by <tt/#undef/'ing the
4515 <item>When compiling without <tt/-Os/, the function is only available as
4516 fastcall function, so it may only be used in presence of a prototype.
4518 <tag/Availability/ISO 9899
4520 <ref id="isalnum" name="isalnum">,
4521 <ref id="isalpha" name="isalpha">,
4522 <ref id="isascii" name="isascii">,
4523 <ref id="isblank" name="isblank">,
4524 <ref id="iscntrl" name="iscntrl">,
4525 <ref id="isdigit" name="isdigit">,
4526 <ref id="isgraph" name="isgraph">,
4527 <ref id="islower" name="islower">,
4528 <ref id="isprint" name="isprint">,
4529 <ref id="ispunct" name="ispunct">,
4530 <ref id="isspace" name="isspace">,
4531 <ref id="isupper" name="isupper">
4537 <sect1>itoa<label id="itoa"><p>
4541 <tag/Function/Convert an integer into a string.
4542 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4543 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
4544 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
4545 <tt/radix/ as the base.
4546 <tag/Notes/<itemize>
4547 <item>There are no provisions to prevent a buffer overflow.
4548 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
4549 <item>The function is non standard, so it is not available in strict ANSI mode.
4550 You should probably use <tt/sprintf/ instead.
4551 <item>The function is only available as fastcall function, so it may only be
4552 used in presence of a prototype.
4554 <tag/Availability/cc65
4556 <ref id="atoi" name="atoi">,
4557 <ref id="atol" name="atol">,
4558 <ref id="ltoa" name="ltoa">,
4559 <ref id="ultoa" name="ultoa">,
4560 <ref id="utoa" name="utoa">
4566 <sect1>joy_count<label id="joy_count"><p>
4570 <tag/Function/Return the number of joysticks supported by the current driver.
4571 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4572 <tag/Declaration/<tt/unsigned char joy_count (void);/
4573 <tag/Description/The function returns a the number of joysticks supported
4574 by the current joystick driver.
4575 <tag/Notes/<itemize>
4576 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4577 name="joy_load_driver"> before calling this function.
4578 <item>The function returns the number of joysticks supported by the driver.
4579 There's no way to check for the number of actually connected joysticks.
4581 <tag/Availability/cc65
4583 <ref id="joy_load_driver" name="joy_load_driver">,
4584 <ref id="joy_read" name="joy_read">
4590 <sect1>joy_install<label id="joy_install"><p>
4594 <tag/Function/Install an already loaded driver and return an error code.
4595 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4596 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
4597 <tag/Description/The function installs a driver that was already loaded into
4598 memory (or linked statically to the program). It returns an error code
4599 (<tt/JOY_ERR_OK/ in case of success).
4600 <tag/Notes/<itemize>
4601 <item>The function is only available as fastcall function, so it may only be
4602 used in presence of a prototype.
4604 <tag/Availability/cc65
4606 <ref id="joy_load_driver" name="joy_load_driver">,
4607 <ref id="joy_uninstall" name="joy_uninstall">,
4608 <ref id="joy_unload" name="joy_unload">
4614 <sect1>joy_load_driver<label id="joy_load_driver"><p>
4618 <tag/Function/Load a driver from disk and install it.
4619 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4620 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
4621 <tag/Description/The function loads a driver with the given name from disk
4622 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
4623 driver was successfully loaded and installed.
4624 <tag/Notes/<itemize>
4625 <item>The function is only available as fastcall function, so it may only be
4626 used in presence of a prototype.
4628 <tag/Availability/cc65
4630 <ref id="joy_install" name="joy_install">,
4631 <ref id="joy_uninstall" name="joy_uninstall">,
4632 <ref id="joy_unload" name="joy_unload">
4638 <sect1>joy_read<label id="joy_read"><p>
4642 <tag/Function/Read the status of a joystick.
4643 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4644 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
4645 <tag/Description/The function reads the status bits for a joystick. The number
4646 of the joystick is passed as parameter. The result may be examined by using one
4647 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
4648 <tag/Notes/<itemize>
4649 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4650 name="joy_load_driver"> before calling this function.
4651 <item>The function is only available as fastcall function, so it may only be
4652 used in presence of a prototype.
4654 <tag/Availability/cc65
4656 <ref id="joy_count" name="joy_count">,
4657 <ref id="joy_load_driver" name="joy_load_driver">,
4658 <ref id="joy_unload" name="joy_unload">
4664 <sect1>joy_uninstall<label id="joy_uninstall"><p>
4668 <tag/Function/Uninstall the current joystick driver.
4669 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4670 <tag/Declaration/<tt/unsigned char joy_uninstall (void);/
4671 <tag/Description/The function uninstalls the currently installed joystick
4672 driver. It does not remove the driver from memory. The function returns an
4673 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4674 <tag/Notes/<itemize>
4675 <item>A joystick driver must be installed using <ref id="joy_install"
4676 name="joy_install"> before calling this function.
4678 <tag/Availability/cc65
4680 <ref id="joy_install" name="joy_install">,
4681 <ref id="joy_load_driver" name="joy_load_driver">,
4682 <ref id="joy_unload" name="joy_unload">
4688 <sect1>joy_unload<label id="joy_unload"><p>
4692 <tag/Function/Uninstall, then unload the current joystick driver.
4693 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4694 <tag/Declaration/<tt/unsigned char joy_unload (void);/
4695 <tag/Description/The function uninstalls the currently installed joystick
4696 driver and removes it from memory. An error code is returned, which is
4697 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4698 <tag/Notes/<itemize>
4699 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4700 name="joy_load_driver"> before calling this function.
4702 <tag/Availability/cc65
4704 <ref id="joy_load_driver" name="joy_load_driver">
4710 <sect1>kbhit<label id="kbhit"><p>
4714 <tag/Function/Check if there's a key waiting in the keyboard buffer.
4715 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4716 <tag/Declaration/<tt/unsigned char kbhit (void);/
4717 <tag/Description/The function returns a value of zero if there is no character
4718 waiting to be read from the keyboard. It returns non zero otherwise.
4719 <tag/Notes/<itemize>
4720 <item>If the system does not support a keyboard buffer (most systems
4721 do), the function is rather useless.
4723 <tag/Availability/cc65
4725 <ref id="cgetc" name="cgetc">,
4726 <ref id="cursor" name="cursor">
4732 <sect1>kbrepeat<label id="kbrepeat"><p>
4736 <tag/Function/Set the keyboard repeat mode.
4737 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
4738 <tag/Declaration/<tt/unsigned char __fastcall__ kbrepeat (unsigned char mode);/
4739 <tag/Description/This function changes which keys have automatic repeat when
4740 being held down for a certain time. Possible values are <tt/KBREPEAT_CURSOR/
4741 (repeat only cursor-related keys), <tt/KBREPEAT_NONE/ (no repeat for any
4742 keys), and <tt/KBREPEAT_ALL/ (repeat all keys). The old mode is returned, so
4743 it can be restored later.
4744 <tag/Notes/<itemize>
4745 <item>The function is available only as a fastcall function; so, it may be used
4746 only in the presence of a prototype.
4748 <tag/Availability/cc65
4754 <sect1>labs<label id="labs"><p>
4758 <tag/Function/Returns the absolute value of a long integer.
4759 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4760 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
4761 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
4763 <tag/Notes/<itemize>
4764 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
4765 <item>The function is only available as fastcall function, so it may only be
4766 used in presence of a prototype.
4768 <tag/Availability/ISO 9899
4770 <ref id="abs" name="abs">
4776 <sect1>ltoa<label id="ltoa"><p>
4780 <tag/Function/Convert a long integer into a string.
4781 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4782 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
4783 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
4784 using <tt/radix/ as the base.
4785 <tag/Notes/<itemize>
4786 <item>There are no provisions to prevent a buffer overflow.
4787 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
4788 <item>The function is non standard, so it is not available in strict ANSI mode.
4789 You should probably use <tt/sprintf/ instead.
4790 <item>The function is only available as fastcall function, so it may only be
4791 used in presence of a prototype.
4793 <tag/Availability/cc65
4795 <ref id="atoi" name="atoi">,
4796 <ref id="atol" name="atol">,
4797 <ref id="itoa" name="itoa">,
4798 <ref id="ultoa" name="ultoa">,
4799 <ref id="utoa" name="utoa">
4805 <sect1>localeconv<label id="localeconv"><p>
4809 <tag/Function/Returns a pointer to the current locale structure.
4810 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4811 <tag/Declaration/<tt/struct lconv* localeconv (void);/
4812 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
4814 <tag/Notes/<itemize>
4815 <item>cc65 supports only the "C" locale, so even after setting a new locale
4816 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
4819 <tag/Availability/ISO 9899
4821 <ref id="setlocale" name="setlocale">
4827 <sect1>longjmp<label id="longjmp"><p>
4831 <tag/Function/Non local goto.
4832 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4833 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
4834 <tag/Description/The <tt/longjmp/ function restores a program context from the
4835 data in <tt/buf/, which must have been set by a preceeding call to
4836 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
4837 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
4839 <tag/Notes/<itemize>
4840 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
4841 was called with a value of one.
4842 <item>The function is only available as fastcall function, so it may only
4843 be used in presence of a prototype.
4845 <tag/Availability/ISO 9899
4847 <ref id="setjmp" name="setjmp">
4853 <sect1>malloc<label id="malloc"><p>
4857 <tag/Function/Allocate dynamic memory.
4858 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4859 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
4860 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
4861 pointer to the allocated memory block. On error (not enough memory available),
4862 <tt/malloc/ returns <tt/NULL/.
4863 <tag/Notes/<itemize>
4864 <item>The function is only available as fastcall function, so it may only
4865 be used in presence of a prototype.
4867 <tag/Availability/ISO 9899
4869 <ref id="_heapadd" name="_heapadd">,
4870 <ref id="_heapblocksize" name="_heapblocksize">,
4871 <ref id="_heapmaxavail" name="_heapmaxavail">,
4872 <ref id="_heapmemavail" name="_heapmemavail">,
4873 <ref id="calloc" name="calloc">,
4874 <ref id="free" name="free">,
4875 <ref id="realloc" name="realloc">,
4876 <ref id="strdup" name="strdup">
4882 <sect1>memchr<label id="memchr"><p>
4886 <tag/Function/Search for a character in a block of raw memory.
4887 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4888 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
4889 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
4890 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
4891 that is of size <tt/count/. Upon completion, the function returns a pointer to
4892 the character found, or a null pointer if the character was not found.
4893 <tag/Notes/<itemize>
4894 <item>The function is only available as fastcall function, so it may only
4895 be used in presence of a prototype.
4897 <tag/Availability/ISO 9899
4899 <ref id="strchr" name="strchr">
4905 <sect1>memcmp<label id="memcmp"><p>
4909 <tag/Function/Compare two memory areas.
4910 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4911 <tag/Declaration/<tt/int __fastcall__ memcmp (const void* p1, const void* p2, size_t count);/
4912 <tag/Description/<tt/memcmp/ compares <tt/count/ bytes from the memory area
4913 pointed to by <tt/p1/ into the memory area pointed to by <tt/p2/. It returns a value that is less than
4914 zero if <tt/p1/ is less than <tt/p2/, zero if <tt/p1/ is the same as <tt/p2/,
4915 and a value greater than zero if <tt/p1/ is greater than <tt/p2/.
4916 <tag/Notes/<itemize>
4917 <item>The function is only available as fastcall function, so it may only
4918 be used in presence of a prototype.
4920 <tag/Availability/ISO 9899
4922 <ref id="strcmp" name="strcmp">,
4923 <ref id="memmove" name="memmove">,
4924 <ref id="memset" name="memset">
4930 <sect1>memcpy<label id="memcpy"><p>
4934 <tag/Function/Copy a memory area.
4935 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4936 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
4937 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
4938 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4940 <tag/Notes/<itemize>
4941 <item>The result is undefined if the memory areas do overlap. Use
4942 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
4943 <item>The function is only available as fastcall function, so it may only
4944 be used in presence of a prototype.
4946 <tag/Availability/ISO 9899
4948 <ref id="_swap" name="_swap">,
4949 <ref id="memmove" name="memmove">,
4950 <ref id="memset" name="memset">
4956 <sect1>memmove<label id="memmove"><p>
4960 <tag/Function/Copy a memory area.
4961 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4962 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
4963 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
4964 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4966 <tag/Notes/<itemize>
4967 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
4968 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
4969 <item>The function is only available as fastcall function, so it may only
4970 be used in presence of a prototype.
4972 <tag/Availability/ISO 9899
4974 <ref id="_swap" name="_swap">,
4975 <ref id="memcpy" name="memcpy">,
4976 <ref id="memset" name="memset">
4982 <sect1>memset<label id="memset"><p>
4986 <tag/Function/Fill a memory area.
4987 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4988 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
4989 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
4990 the value <tt/val/. The function returns <tt/p/.
4991 <tag/Notes/<itemize>
4992 <item>The function is only available as fastcall function, so it may only
4993 be used in presence of a prototype.
4995 <tag/Availability/ISO 9899
4997 <ref id="_swap" name="_swap">,
4998 <ref id="bzero" name="bzero">,
4999 <ref id="memcpy" name="memcpy">,
5000 <ref id="memmove" name="memmove">
5006 <sect1>mod_free<label id="mod_free"><p>
5010 <tag/Function/Free a relocatable module.
5011 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
5012 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
5013 <tag/Description/The function will free a module loaded into memory by use of
5014 the <tt/<ref id="mod_load" name="mod_load">/ function.
5015 <tag/Notes/<itemize>
5016 <item>The pointer passed as parameter is the pointer to the module memory,
5017 not the pointer to the control structure.
5018 <item>The function is available only as a fastcall function; so, it may be used
5019 only in the presence of a prototype.
5021 <tag/Availability/cc65
5023 <ref id="mod_load" name="mod_load">
5029 <sect1>mod_load<label id="mod_load"><p>
5033 <tag/Function/Load a relocatable module.
5034 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
5035 <tag/Declaration/<tt/unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl);/
5036 <tag/Description/The function will load a code module into memory and relocate
5037 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
5038 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
5039 the module just loaded. Possible error codes are:
5041 <item><tt/MLOAD_OK/ - Module load successful
5042 <item><tt/MLOAD_ERR_READ/ - Read error
5043 <item><tt/MLOAD_ERR_HDR/ - Header error
5044 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
5045 <item><tt/MLOAD_ERR_FMT/ - Data format error
5046 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
5048 <tag/Notes/<itemize>
5049 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
5050 relocatable o65 modules for use with this function.
5051 <item>The function is available only as a fastcall function; so, it may be used
5052 only in the presence of a prototype.
5054 <tag/Availability/cc65
5056 <ref id="mod_free" name="mod_free">
5062 <sect1>mouse_setbox<label id="mouse_setbox"><p>
5066 <tag/Function/Specify a bounding box for the mouse cursor.
5067 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5068 <tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
5069 <tag/Description/The function allows to set a bounding box for mouse movement.
5070 <tag/Notes/<itemize>
5071 <item>The function does not check if the mouse cursor is currently within the
5072 given rectangle. Placing the mouse cursor within the bounding box is the
5073 responsibility of the programmer.
5074 <item>While the bounding box may be larger than the actual screen size, the
5075 standard mouse cursor draw routines may fail to set the cursor to coordinates
5076 outside of the screen area. Depending on the platform, you may have to supply
5077 your own mouse cursor routines.
5078 <item>The function is only available as fastcall function, so it may only be
5079 used in presence of a prototype.
5081 <tag/Availability/cc65
5083 <ref id="mouse_getbox" name="mouse_getbox">,
5084 <ref id="mouse_move" name="mouse_move">
5090 <sect1>mouse_getbox<label id="mouse_getbox"><p>
5094 <tag/Function/Return the current bounding box for the mouse cursor.
5095 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5096 <tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
5097 <tag/Description/The function queries the current bounding box for mouse
5099 <tag/Notes/<itemize>
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_move" name="mouse_move">,
5106 <ref id="mouse_setbox" name="mouse_setbox">
5112 <sect1>mouse_buttons<label id="mouse_buttons"><p>
5116 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
5117 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5118 <tag/Declaration/<tt/unsigned char mouse_buttons (void);/
5119 <tag/Description/The function returns a bit mask that encodes the state of the
5120 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
5122 <tag/Availability/cc65
5124 <ref id="mouse_info" name="mouse_info">,
5125 <ref id="mouse_pos" name="mouse_pos">
5131 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
5135 <tag/Function/Return a readable error message for an error code.
5136 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5137 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
5139 <tag/Description/The function returns an error message (in english) for the
5140 error code passed parameter.
5141 <tag/Notes/<itemize>
5142 <item>The function will return "Unknown error" for invalid error codes.
5143 <item>The function is only available as fastcall function, so it may only be
5144 used in presence of a prototype.
5146 <tag/Availability/cc65
5148 <ref id="mouse_load_driver" name="mouse_load_driver">,
5149 <ref id="mouse_uninstall" name="mouse_uninstall">,
5150 <ref id="mouse_unload" name="mouse_unload">
5156 <sect1>mouse_hide<label id="mouse_hide"><p>
5160 <tag/Function/Hide the mouse pointer.
5161 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5162 <tag/Declaration/<tt/void mouse_hide (void);/
5163 <tag/Description/The function hides the mouse pointer. It manages a counter
5164 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
5165 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
5166 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
5168 <tag/Availability/cc65
5170 <ref id="mouse_show" name="mouse_show">
5176 <sect1>mouse_info<label id="mouse_info"><p>
5180 <tag/Function/Return the state of the mouse buttons and the position of the
5182 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5183 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
5184 <tag/Description/The function returns the state of the mouse buttons and the
5185 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
5186 <tag/Notes/<itemize>
5187 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
5188 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
5189 name="mouse_pos">/ instead.
5190 <item>The function is only available as fastcall function, so it may only be
5191 used in presence of a prototype.
5193 <tag/Availability/cc65
5195 <ref id="mouse_buttons" name="mouse_buttons">,
5196 <ref id="mouse_pos" name="mouse_pos">
5202 <sect1>mouse_install<label id="mouse_install"><p>
5206 <tag/Function/Install an already loaded mouse driver.
5207 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5208 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
5209 mouse_callbacks* c, void* driver);/
5210 <tag/Description/The function installs an already loaded mouse driver and
5211 returns an error code. The <tt/mouse_callbacks/ structure passed as first
5212 parameter contains pointers to routines needed to move or hide/show the mouse
5213 pointer. Defaults for these routines are supplied by the library, so if you
5214 can live with these defaults (which are platform specific), just pass a
5215 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
5216 driver linked statically to the program.
5217 <tag/Notes/<itemize>
5218 <item>Not all drivers are able to detect if the supported hardware is really
5220 <item>After installing a driver, the mouse cursor is hidden.
5221 <item>The function is only available as fastcall function, so it may only be
5222 used in presence of a prototype.
5224 <tag/Availability/cc65
5226 <ref id="mouse_load_driver" name="mouse_load_driver">,
5227 <ref id="mouse_uninstall" name="mouse_uninstall">,
5228 <ref id="mouse_unload" name="mouse_unload">
5234 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
5238 <tag/Function/Call the driver specific ioctl function.
5239 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5240 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
5241 <tag/Description/The function calls the IOCTL entry in the mouse driver,
5242 which is driver specific. The <tt/code/ parameter will choose between
5243 different IOCTL functions, and the <tt/data/ depends on code. The
5244 function returns an error code. The purpose of this function is to allow
5245 for driver specific extensions. See the documentation for a specific mouse
5246 driver for supported ioctl calls.
5247 <tag/Notes/<itemize>
5248 <item>Calling this function is non portable, because each driver may
5249 implement different ioctl calls (or none at all).
5250 <item>The function is only available as fastcall function, so it may only be
5251 used in presence of a prototype.
5253 <tag/Availability/cc65
5259 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
5263 <tag/Function/Load and initialize a mouse driver.
5264 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5265 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
5266 mouse_callbacks* c, const char* driver);/
5267 <tag/Description/Load a mouse driver into memory and initialize it. The
5268 function returns an error code that tells if the call has been successful. The
5269 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
5270 routines needed to move or hide/show the mouse pointer. Defaults for these
5271 routines are supplied by the library, so if you can live with these defaults
5272 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
5273 <tag/Notes/<itemize>
5274 <item>The driver is loaded by name, so currently you must know the type of
5275 mouse that should be supported. There is no autodetect capability.
5276 <item>Not all drivers are able to detect if the supported hardware is really
5278 <item>After installing a driver, the mouse cursor is hidden.
5279 <item>The function is only available as fastcall function, so it may only be
5280 used in presence of a prototype.
5282 <tag/Availability/cc65
5284 <ref id="mouse_install" name="mouse_install">,
5285 <ref id="mouse_uninstall" name="mouse_uninstall">,
5286 <ref id="mouse_unload" name="mouse_unload">
5292 <sect1>mouse_move<label id="mouse_move"><p>
5296 <tag/Function/Move the mouse cursor to a specific position.
5297 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5298 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
5299 <tag/Description/The function updates the mouse position. If the mouse cursor
5300 is visible, it is shown at the new position.
5301 <tag/Notes/<itemize>
5302 <item>The function does not check if the new position is within the bounding
5303 box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
5304 <item>The function is only available as fastcall function, so it may only be
5305 used in presence of a prototype.
5307 <tag/Availability/cc65
5309 <ref id="mouse_getbox" name="mouse_getbox">,
5310 <ref id="mouse_setbox" name="mouse_setbox">
5316 <sect1>mouse_pos<label id="mouse_pos"><p>
5320 <tag/Function/Return the position of the mouse.
5321 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5322 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
5323 <tag/Description/The function returns the position of the mouse in the
5324 <tt/mouse_pos/ structure passed as parameter.
5325 <tag/Notes/<itemize>
5326 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
5327 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
5328 name="mouse_info">/ instead.
5329 <item>The function is only available as fastcall function, so it may only be
5330 used in presence of a prototype.
5332 <tag/Availability/cc65
5334 <ref id="mouse_buttons" name="mouse_buttons">,
5335 <ref id="mouse_info" name="mouse_info">
5341 <sect1>mouse_show<label id="mouse_show"><p>
5345 <tag/Function/Show the mouse pointer.
5346 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5347 <tag/Declaration/<tt/void mouse_show (void);/
5348 <tag/Description/The function shows the mouse pointer. It manages a counter
5349 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
5350 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
5351 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
5352 <tag/Availability/cc65
5354 <ref id="mouse_hide" name="mouse_hide">
5360 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
5364 <tag/Function/Uninstall an already loaded mouse driver.
5365 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5366 <tag/Declaration/<tt/unsigned char mouse_uninstall (void);/
5367 <tag/Description/The function uninstalls an already loaded mouse driver but
5368 don't removes it from memory.
5369 <tag/Notes/<itemize>
5370 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
5371 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
5372 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
5375 <tag/Availability/cc65
5377 <ref id="mouse_install" name="mouse_install">,
5378 <ref id="mouse_load_driver" name="mouse_load_driver">,
5379 <ref id="mouse_unload" name="mouse_unload">
5385 <sect1>mouse_unload<label id="mouse_unload"><p>
5389 <tag/Function/Unload a mouse driver.
5390 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5391 <tag/Declaration/<tt/unsigned char mouse_unload (void);/
5392 <tag/Description/The function unloads a loaded mouse driver and frees all
5393 memory allocated for the driver.
5394 <tag/Notes/<itemize>
5395 <item>The function does nothing if no driver is loaded.
5397 <tag/Availability/cc65
5399 <ref id="mouse_install" name="mouse_install">,
5400 <ref id="mouse_load_driver" name="mouse_load_driver">,
5401 <ref id="mouse_uninstall" name="mouse_uninstall">
5407 <sect1>offsetof<label id="offsetof"><p>
5411 <tag/Function/Calculate the offset of a struct or union member.
5412 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
5413 <tag/Declaration/<tt/size_t offsetof (type, member);/
5414 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
5415 or <tt/union/ member.
5416 <tag/Notes/<itemize>
5417 <item>The function is actually a macro.
5419 <tag/Availability/ISO 9899
5425 <sect1>open<label id="open"><p>
5429 <tag/Function/Open and possibly create a file.
5430 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
5431 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
5432 <tag/Description/<tt/open/ opens a file and returns the file descriptor
5433 associated with it. On error, -1 is returned and an error code is stored in
5434 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
5435 <tag/Notes/<itemize>
5436 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
5437 open, which is used as the permission mask when a new file is created. While
5438 cc65 allows to pass this argument, it is ignored.
5440 <tag/Availability/POSIX 1003.1
5442 <ref id="close" name="close">,
5443 <ref id="creat" name="creat">
5449 <sect1>opendir<label id="opendir"><p>
5453 <tag/Function/Open a directory.
5454 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5455 <tag/Declaration/<tt/DIR* __fastcall__ opendir (const char* name);/
5456 <tag/Description/<tt/opendir/ opens a directory and returns the direcory
5457 descriptor associated with it. On error, NULL is returned and an error code is
5458 stored in <tt/errno/.
5459 <tag/Notes/<itemize>
5460 <item>The function is only available as fastcall function, so it may only
5461 be used in presence of a prototype.
5463 <tag/Availability/POSIX 1003.1
5465 <ref id="closedir" name="closedir">,
5466 <ref id="readdir" name="readdir">
5472 <sect1>peekbsys<label id="peekbsys"><p>
5476 <tag/Function/Read one byte from a location in the system bank.
5477 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5478 <tt/<ref id="cbm510.h" name="cbm510.h">/
5479 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
5480 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
5481 system bank (bank 15) of the CBM PET-II machines and returns it.
5482 <tag/Notes/<itemize>
5483 <item>The function is only available as fastcall function, so it may only
5484 be used in presence of a prototype.
5485 <item>This function may be a macro depending on the compiler options. The
5486 actual function is accessible by #undef'ing the macro.
5488 <tag/Availability/cc65
5490 <ref id="PEEK" name="PEEK">,
5491 <ref id="PEEKW" name="PEEKW">,
5492 <ref id="peekwsys" name="peekwsys">,
5493 <ref id="pokebsys" name="pokebsys">,
5494 <ref id="pokewsys" name="pokewsys">
5500 <sect1>peekwsys<label id="peekwsys"><p>
5504 <tag/Function/Read one word from a location in the system bank.
5505 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5506 <tt/<ref id="cbm510.h" name="cbm510.h">/
5507 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
5508 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
5509 system bank (bank 15) of the CBM PET-II machines and returns it. Following
5510 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
5511 high byte is read from <tt/addr+1/.
5512 <tag/Notes/<itemize>
5513 <item>The function is only available as fastcall function, so it may only
5514 be used in presence of a prototype.
5515 <item>The order in which the two bytes are read is undefined.
5517 <tag/Availability/cc65
5519 <ref id="PEEK" name="PEEK">,
5520 <ref id="PEEKW" name="PEEKW">,
5521 <ref id="peekbsys" name="peekbsys">,
5522 <ref id="pokebsys" name="pokebsys">,
5523 <ref id="pokewsys" name="pokewsys">
5529 <sect1>perror<label id="perror"><p>
5533 <tag/Function/Print an error message for the error in <tt/errno/.
5534 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5535 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
5536 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
5537 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
5538 a blank. Then the error message for the current contents of <tt/errno/ is
5539 printed followed by a newline. The message output is the same as returned by
5540 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
5541 <tag/Notes/<itemize>
5542 <item>The function is only available as fastcall function, so it may only
5543 be used in presence of a prototype.
5545 <tag/Availability/ISO 9899
5547 <ref id="_poserror" name="_poserror">,
5548 <ref id="strerror" name="strerror">
5554 <sect1>pokebsys<label id="pokebsys"><p>
5558 <tag/Function/Write one byte to a location in the system bank.
5559 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5560 <tt/<ref id="cbm510.h" name="cbm510.h">/
5561 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
5562 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
5563 system bank (bank 15) of the CBM PET-II machines.
5564 <tag/Notes/<itemize>
5565 <item>The function is only available as fastcall function, so it may only
5566 be used in presence of a prototype.
5568 <tag/Availability/cc65
5570 <ref id="POKE" name="POKE">,
5571 <ref id="POKEW" name="POKEW">,
5572 <ref id="peekbsys" name="peekbsys">,
5573 <ref id="peekwsys" name="peekwsys">,
5574 <ref id="pokewsys" name="pokewsys">
5580 <sect1>pokewsys<label id="pokewsys"><p>
5584 <tag/Function/Write one word to a location in the system bank.
5585 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5586 <tt/<ref id="cbm510.h" name="cbm510.h">/
5587 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
5588 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
5589 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
5590 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
5591 high byte is written to <tt/addr+1/.
5592 <tag/Notes/<itemize>
5593 <item>The function is only available as fastcall function, so it may only
5594 be used in presence of a prototype.
5595 <item>The order in which the two bytes are written is undefined.
5597 <tag/Availability/cc65
5599 <ref id="POKE" name="POKE">,
5600 <ref id="POKEW" name="POKEW">,
5601 <ref id="peekbsys" name="peekbsys">,
5602 <ref id="peekwsys" name="peekwsys">,
5603 <ref id="pokebsys" name="pokebsys">
5609 <sect1>qsort<label id="qsort"><p>
5613 <tag/Function/Sort an array.
5614 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5615 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
5616 size_t size, int __fastcall__ (* compare) (const void*, const void*));/
5617 <tag/Description/<tt/qsort/ sorts an array according to a given compare
5618 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
5619 is the number of elements, <tt/size/ the size of an element and <tt/compare/
5620 the function used to compare the members.
5621 <tag/Notes/<itemize>
5622 <item>If there are multiple members with the same key, the order after calling
5623 the function is undefined.
5624 <item>The function is only available as fastcall function, so it may only
5625 be used in presence of a prototype.
5626 <item>The function to which <tt/compare/ points must have the <tt/fastcall/
5629 <tag/Availability/ISO 9899
5631 <ref id="bsearch" name="bsearch">
5637 <sect1>raise<label id="raise"><p>
5641 <tag/Function/Send a signal to the executing program.
5642 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
5643 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
5644 <tag/Description/<tt/raise/ sends the given signal to the program. If the
5645 program has installed a signal handler for the signal, this signal handler
5646 will be executed. If no handler has been installed, the default action for
5647 the raised signal will be taken. The function returns zero on success,
5649 <tag/Notes/<itemize>
5650 <item>The function is only available as fastcall function, so it may only
5651 be used in presence of a prototype.
5653 <tag/Availability/ISO 9899
5655 <ref id="abort" name="abort">,
5656 <ref id="signal" name="signal">
5662 <sect1>rand<label id="rand"><p>
5666 <tag/Function/Return a pseudo random number.
5667 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5668 <tag/Declaration/<tt/int rand (void);/
5669 <tag/Description/The function returns a pseudo random number
5670 between 0 and <tt/RAND_MAX/ (exclusive).
5671 <tag/Notes/<itemize>
5672 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
5673 flow of numbers is generated.
5674 <item>On startup, the function behaves as if <ref id="srand" name="srand">
5675 had been used with an argument of 1.
5677 <tag/Availability/ISO 9899
5679 <ref id="_randomize" name="_randomize">,
5680 <ref id="srand" name="srand">
5686 <sect1>readdir<label id="readdir"><p>
5690 <tag/Function/Read a directory.
5691 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5692 <tag/Declaration/<tt/struct dirent* __fastcall__ readdir (DIR* dir);/
5693 <tag/Description/<tt/readdir/ reads the next directory entry from the directory
5694 stream pointed to by <tt/dir/. It stores the data in a <tt/dirent/ structure
5695 and returns a pointer to it. If the end of directory is reached, or an error
5696 occurs, NULL is returned. In case of errors, an error code is stored into
5698 <tag/Notes/<itemize>
5699 <item>The function is only available as fastcall function, so it may only
5700 be used in presence of a prototype.
5701 <item>The returned pointer may point to a statically allocated instance of
5702 <tt/struct dirent/, so it may get overwritten by subsequent calls to
5704 <item>On several platforms, namely the CBMs and the Atari, the disk drives get
5705 confused when opening/closing files between directory reads. So for example a
5706 program that reads the list of files on a disk, and after each call to
5707 <tt/readdir/, opens the file to process it, will fail.<newline>
5708 Possible solutions are reading the directory into memory before processing the
5709 file list, or to reset the directory by seeking to the correct position after
5710 opening/closing a file:
5712 seekdir (DIR, telldir (DIR));
5714 Platforms known to work without problems are: Apple.
5716 <tag/Availability/POSIX 1003.1
5718 <ref id="closedir" name="closedir">,
5719 <ref id="opendir" name="opendir">
5725 <sect1>realloc<label id="realloc"><p>
5729 <tag/Function/Change the size of an allocated memory block.
5730 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5731 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
5732 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
5733 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
5734 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
5735 behaves as if <tt/free/ had been called. On error (not enough memory
5736 available), <tt/realloc/ returns <tt/NULL/.
5737 <tag/Notes/<itemize>
5738 <item>The part of the memory block that is returned will have its contents
5740 <item>This function is somewhat dangerous to use. Be careful to save the
5741 pointer you're passing somewhere else, otherwise
5743 ptr = realloc (ptr, size);
5745 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
5746 <item>The function is only available as fastcall function, so it may only
5747 be used in presence of a prototype.
5749 <tag/Availability/ISO 9899
5751 <ref id="_heapadd" name="_heapadd">,
5752 <ref id="_heapblocksize" name="_heapblocksize">,
5753 <ref id="_heapmaxavail" name="_heapmaxavail">,
5754 <ref id="_heapmemavail" name="_heapmemavail">,
5755 <ref id="calloc" name="calloc">,
5756 <ref id="free" name="free">,
5757 <ref id="realloc" name="realloc">
5763 <sect1>remove<label id="remove"><p>
5767 <tag/Function/Delete a file.
5768 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5769 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
5770 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
5771 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5772 code describing the reason for the failure.
5773 <tag/Notes/<itemize>
5774 <item>This function is not available on all cc65 targets (depends on the
5775 availability of file I/O).
5776 <item>The function is only available as fastcall function, so it may only
5777 be used in presence of a prototype.
5779 <tag/Availability/ISO 9899
5781 <ref id="rename" name="rename">,
5782 <ref id="unlink" name="unlink">
5785 #include <stdio.h>
5787 #define FILENAME "helloworld"
5789 if (remove (FILENAME) == 0) {
5790 printf ("We deleted %s successfully\n", FILENAME);
5792 printf ("There was a problem deleting %s\n", FILENAME);
5799 <sect1>rename<label id="rename"><p>
5803 <tag/Function/Rename a file.
5804 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5805 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
5806 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
5807 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5808 code describing the reason for the failure.
5809 <tag/Notes/<itemize>
5810 <item>This function is not available on all cc65 targets (depends on the
5811 capabilities of the storage devices).
5812 <item>The function is only available as fastcall function, so it may only
5813 be used in presence of a prototype.
5815 <tag/Availability/ISO 9899
5817 <ref id="remove" name="remove">
5820 #include <stdio.h>
5822 #define OLDNAME "textfile.txt"
5823 #define NEWNAME "textfile.bak"
5825 if (rename (OLDNAME, NEWNAME) == 0) {
5826 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
5828 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
5835 <sect1>reset_brk<label id="reset_brk"><p>
5839 <tag/Function/Resets the break vector to its original value.
5840 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5841 <tag/Declaration/<tt/void reset_brk (void);/
5842 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
5843 before a call to <tt/set_brk/.
5844 <tag/Notes/<itemize>
5845 <item>The break vector is reset on program termination, so it's not strictly
5846 necessary to call this function as a part of your clean-up when exitting the program.
5848 <tag/Availability/cc65
5850 <ref id="reset_irq" name="reset_irq">,
5851 <ref id="set_brk" name="set_brk">,
5852 <ref id="set_irq" name="set_irq">
5858 <sect1>reset_irq<label id="reset_irq"><p>
5862 <tag/Function/Resets the C level interrupt request vector.
5863 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5864 <tag/Declaration/<tt/void reset_irq (void);/
5865 <tag/Description/<tt/reset_irq/ resets the C level interrupt request vector.
5866 <tag/Notes/<itemize>
5867 <item>The interrupt vector is reset on program termination, so it's not strictly
5868 necessary to call this function as a part of your clean-up when exitting the program.
5870 <tag/Availability/cc65
5872 <ref id="reset_brk" name="reset_brk">,
5873 <ref id="set_brk" name="set_brk">,
5874 <ref id="set_irq" name="set_irq">
5880 <sect1>revers<label id="revers"><p>
5884 <tag/Function/Control revers character display.
5885 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5886 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
5887 <tag/Description/If the argument is non zero, the function enables reverse
5888 character display. If the argument is zero, reverse character display is
5889 switched off. The old value of the setting is returned.
5890 <tag/Notes/<itemize>
5891 <item>The function may not be supported by the hardware, in which case
5892 the call is ignored.
5893 <item>The function is only available as fastcall function, so it may only
5894 be used in presence of a prototype.
5896 <tag/Availability/cc65
5898 <ref id="textcolor" name="textcolor">
5904 <sect1>rewinddir<label id="rewinddir"><p>
5908 <tag/Function/Reset a directory stream.
5909 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5910 <tag/Declaration/<tt/void __fastcall__ rewinddir (DIR* dir);/
5911 <tag/Description/<tt/rewinddir/ sets the position of the directory stream
5912 pointed to by <tt/dir/ to the start of the directory.
5913 <tag/Notes/<itemize>
5914 <item>The function is only available as fastcall function, so it may only
5915 be used in presence of a prototype.
5917 <tag/Availability/POSIX 1003.1
5919 <ref id="seekdir" name="seekdir">,
5920 <ref id="telldir" name="telldir">
5926 <sect1>screensize<label id="screensize"><p>
5930 <tag/Function/Return the dimensions of the text mode screen.
5931 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5932 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
5933 <tag/Description/The function returns the dimensions of the text mode screen.
5934 <tag/Notes/<itemize>
5935 <item>The function is only available as fastcall function, so it may only
5936 be used in presence of a prototype.
5938 <tag/Availability/cc65
5940 <ref id="gotox" name="gotox">,
5941 <ref id="gotoxy" name="gotoxy">,
5942 <ref id="gotoy" name="gotoy">,
5943 <ref id="wherex" name="wherex">,
5944 <ref id="wherey" name="wherey">
5950 <sect1>seekdir<label id="seekdir"><p>
5954 <tag/Function/Set the position of a directory stream.
5955 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5956 <tag/Declaration/<tt/void __fastcall__ seekdir (DIR* dir, long offset);/
5957 <tag/Description/<tt/seekdir/ sets the position of the directory stream
5958 pointed to by <tt/dir/ to the value given in <tt/offset/, which should be a
5959 value returned by <tt/<ref id="telldir" name="telldir">/.
5960 <tag/Notes/<itemize>
5961 <item>The function is only available as fastcall function, so it may only
5962 be used in presence of a prototype.
5964 <tag/Availability/POSIX 1003.1
5966 <ref id="rewinddir" name="rewinddir">,
5967 <ref id="telldir" name="telldir">
5973 <sect1>ser_close<label id="ser_close"><p>
5977 <tag/Function/Close the port and disable interrupts
5978 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5979 <tag/Declaration/<tt/unsigned char ser_close (void);/
5980 <tag/Description/Close the port by clearing buffers and disable interrupts.
5981 <tag/Availability/cc65
5982 <tag/See also/Other serial functions.
5987 static void initialize(){
5988 struct ser_params params = {
5995 ser_install(lynx_comlynx); // This will activate the ComLynx
5997 ser_open(&params);
6004 <sect1>ser_get<label id="ser_get"><p>
6008 <tag/Function/Read a character from serial port.
6009 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6010 <tag/Declaration/<tt/unsigned char __fastcall__ ser_get (char* b);/
6011 <tag/Description/Get a character from the serial port. If no characters are
6012 available, the function will return SER_ERR_NO_DATA, so this is not a fatal
6014 <tag/Notes/<itemize>
6015 <item>The function is only available as fastcall function, so it may only
6016 be used in presence of a prototype.
6018 <tag/Availability/cc65
6019 <tag/See also/Other serial functions.
6021 Wait for a character to be available from a serial port.
6024 while (ser_get(&ch) == SER_ERR_NO_DATA)
6031 <sect1>ser_install<label id="ser_install"><p>
6035 <tag/Function/Install an already loaded driver and return an error code.
6036 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6037 <tag/Declaration/<tt/unsigned char __fastcall__ ser_install (void* driver);/
6038 <tag/Description/The function installs a driver that was already loaded into
6039 memory (or linked statically to the program). It returns an error code
6040 (<tt/SER_ERR_OK/ in case of success).
6041 <tag/Notes/<itemize>
6042 <item>The function is only available as fastcall function, so it may only be
6043 used in presence of a prototype.
6045 <tag/Availability/cc65
6047 <ref id="ser_load_driver" name="ser_load_driver">,
6048 <ref id="ser_uninstall" name="ser_uninstall">,
6049 <ref id="ser_unload" name="ser_unload">
6051 ser_install(lynx_comlynx); //Include the driver statically instead of loading it.
6057 <sect1>ser_ioctl<label id="ser_ioctl"><p>
6061 <tag/Function/Platform dependent code extensions.
6062 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6063 <tag/Declaration/<tt/unsigned __fastcall__ ser_ioctl (unsigned char code, void* data);/
6064 <tag/Description/Some platforms have extra serial functions that are not
6065 supported by standard serial driver functions. You can extend the driver to support
6066 this extra functionality bt using ser_ioctl functions.
6067 <tag/Notes/<itemize>
6068 <item>The function is only available as fastcall function, so it may only
6069 be used in presence of a prototype.
6070 <item>These functions are not easily portable to other cc65 platforms.
6072 <tag/Availability/cc65
6073 <tag/See also/Other serial functions.
6078 <sect1>ser_load_driver<label id="ser_load_driver"><p>
6082 <tag/Function/Load and install a serial driver.
6083 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6084 <tag/Declaration/<tt/unsigned char __fastcall__ ser_load_driver (const char *name);/
6085 <tag/Description/Load and install the driver by name.
6086 Will just load the driver and check if loading was successful.
6087 <tag/Notes/<itemize>
6088 <item>The function is only available as fastcall function, so it may only
6089 be used in presence of a prototype.
6091 <tag/Availability/cc65
6092 <tag/See also/Other serial functions.
6098 <sect1>ser_open<label id="ser_open"><p>
6102 <tag/Function/Open the port by setting the port parameters and enable interrupts
6103 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6104 <tag/Declaration/<tt/unsigned char __fastcall__ ser_open (const struct ser_params* params);/
6105 <tag/Description/Open the port by setting the port parameters and enable interrupts.
6106 <tag/Notes/<itemize>
6107 <item>The function is only available as fastcall function, so it may only
6108 be used in presence of a prototype.
6110 <tag/Availability/cc65
6111 <tag/See also/Other serial functions.
6116 static void initialize(){
6117 struct ser_params params = {
6124 ser_install(lynx_comlynx); // This will activate the ComLynx
6126 ser_open(&params);
6133 <sect1>ser_put<label id="ser_put"><p>
6137 <tag/Function/Write a character to a serial port.
6138 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6139 <tag/Declaration/<tt/unsigned char __fastcall__ ser_put (char b);/
6140 <tag/Description/Send a character via the serial port. There is a transmit
6141 buffer, but transmitting is not done via interrupt. The function returns
6142 SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
6143 <tag/Notes/<itemize>
6144 <item>The function is only available as fastcall function, so it may only
6145 be used in presence of a prototype.
6147 <tag/Availability/cc65
6148 <tag/See also/Other serial functions.
6157 <sect1>ser_status<label id="ser_status"><p>
6161 <tag/Function/Return the serial port status.
6162 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6163 <tag/Declaration/<tt/unsigned char __fastcall__ ser_status (unsigned char* status);/
6164 <tag/Description/Return the serial port status.
6165 <tag/Notes/<itemize>
6166 <item>The function is only available as fastcall function, so it may only
6167 be used in presence of a prototype.
6169 <tag/Availability/cc65
6170 <tag/See also/Other serial functions.
6176 <sect1>ser_uninstall<label id="ser_uninstall"><p>
6180 <tag/Function/Uninstall the currently loaded driver but do not unload it.
6181 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6182 <tag/Declaration/<tt/unsigned char ser_uninstall (void);/
6183 <tag/Description/Uninstall the currently loaded driver but do not unload it.
6184 <tag/Availability/cc65
6185 <tag/See also/Other serial functions.
6190 <sect1>ser_unload<label id="ser_unload"><p>
6194 <tag/Function/Uninstall, then unload the currently loaded driver.
6195 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6196 <tag/Declaration/<tt/unsigned char ser_unload (void);/
6197 <tag/Description/Uninstall, then unload the currently loaded driver.
6198 <tag/Availability/cc65
6199 <tag/See also/Other serial functions.
6205 <sect1>set_brk<label id="set_brk"><p>
6209 <tag/Function/Set the break vector to a user function.
6210 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
6211 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
6212 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
6213 program code by letting the vector point to a user written C function. The
6214 runtime library installs a small stub that saves the registers into global
6215 variables that may be accessed (and changed) by the break handler.
6216 <tag/Notes/<itemize>
6217 <item>The function is only available as fastcall function, so it may only
6218 be used in presence of a prototype.
6219 <item>The stub saves the zero page registers used by the C runtime and switches
6220 to a small break handler stack. This means that it is safe to execute C code,
6221 even if C code was interrupted. Be careful however not to use too many local
6222 variables, and do not enable stack checks for the handler function or any other
6223 function called from it.
6224 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
6225 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
6226 otherwise the <tt/BRK/ instruction will get executed over and over again.
6227 <item>The break vector is reset on program termination, so it's not strictly
6228 necessary to call <tt/<ref id="reset_brk" name="reset_brk">/ as a part of your
6229 clean-up when exitting the program.
6231 <tag/Availability/cc65
6233 <ref id="reset_brk" name="reset_brk">
6239 <sect1>set_irq<label id="set_irq"><p>
6243 <tag/Function/Set the C level interrupt request vector to the given address.
6244 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
6245 <tag/Declaration/<tt/void __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);/
6246 <tag/Description/<tt/set_irq/ allows a user program to handle interrupt requests
6247 (IRQs) within the program code by letting the vector point to a user written C
6248 function. The runtime library installs a small stub that saves the zero page
6249 registers used by the C runtime before calling the handler function and restores
6250 them after the handler function returns. Additionally the stub temporarily switches
6251 the C runtime stack to the stack area provided as parameter. If the handler function
6252 was set up to handle a "private", "exclusive" interrupt request source it must
6253 return the value <tt/IRQ_HANDLED/ if and only if it has verified that the current
6254 interrupt request actually stems from that source. In all other cases it must return
6255 the value <tt/IRQ_NOT_HANDLED/.
6256 <tag/Notes/<itemize>
6257 <item>The function is only available as fastcall function, so it may only
6258 be used in presence of a prototype.
6259 <item>The stub saves the registers and zero page locations used by the C runtime
6260 and switches to the provided stack area. As a consequence, there is some
6261 runtime overhead, but it it is safe to execute C code, even if other C code
6262 was interrupted. Be careful however not to call C library functions, and do not
6263 enable stack checks for the handler function or any other function called from
6265 <item>The interrupt vector is reset on program termination, so it's not strictly
6266 necessary to call <tt/<ref id="reset_irq" name="reset_irq">/ as a part of your
6267 clean-up when exitting the program.
6269 <tag/Availability/cc65
6271 <ref id="reset_brk" name="reset_brk">,
6272 <ref id="reset_irq" name="reset_irq">,
6273 <ref id="set_brk" name="set_brk">
6279 <sect1>set_c128_speed<label id="set_c128_speed"><p>
6283 <tag/Function/Set the current speed of a C128 CPU.
6284 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6285 <tag/Declaration/<tt/unsigned char __fastcall__ set_c128_speed (unsigned char speed);/
6286 <tag/Description/The function returns the speed after trying to set the speed of the C128 CPU.
6287 <tag/Notes/<itemize>
6288 <item>The function is specific to the C64 and C128.
6289 <item>The function does not check if the C128 CPU is the current CPU.
6290 <item>See the accelerator.h header for the speed definitions.
6292 <tag/Availability/cc65 (not all platforms)
6294 <ref id="detect_c128" name="detect_c128">,
6295 <ref id="get_c128_speed" name="get_c128_speed">,
6301 <sect1>set_c64dtv_speed<label id="set_c64dtv_speed"><p>
6305 <tag/Function/Set the current speed of the C64DTV.
6306 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6307 <tag/Declaration/<tt/unsigned char __fastcall__ set_c64dtv_speed (unsigned char speed);/
6308 <tag/Description/The function returns the speed after trying to set the speed of the C64DTV.
6309 <tag/Notes/<itemize>
6310 <item>The function is specific to the C64.
6311 <item>The function does not check for the presence of the C64DTV.
6312 <item>See the accelerator.h header for the speed definitions.
6314 <tag/Availability/cc65 (not all platforms)
6316 <ref id="detect_c64dtv" name="detect_c64dtv">,
6317 <ref id="get_c64dtv_speed" name="get_c64dtv_speed">,
6323 <sect1>set_c65_speed<label id="set_c65_speed"><p>
6327 <tag/Function/Set the current speed of the C65/C64DX in C64 mode.
6328 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6329 <tag/Declaration/<tt/unsigned char __fastcall__ set_c65_speed (unsigned char speed);/
6330 <tag/Description/The function returns the speed after trying to set the speed of the C65/C64DX in C64 mode.
6331 <tag/Notes/<itemize>
6332 <item>The function is specific to the C64.
6333 <item>The function does not check for the presence of a C65/C64DX in C64 mode.
6334 <item>See the accelerator.h header for the speed definitions.
6336 <tag/Availability/cc65 (not all platforms)
6338 <ref id="detect_c65" name="detect_c65">,
6339 <ref id="get_c65_speed" name="get_c65_speed">,
6345 <sect1>set_chameleon_speed<label id="set_chameleon_speed"><p>
6349 <tag/Function/Set the current speed of the C64 Chameleon cartridge.
6350 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6351 <tag/Declaration/<tt/unsigned char __fastcall__ set_chameleon_speed (unsigned char speed);/
6352 <tag/Description/The function returns the speed after trying to set the speed of the C64 Chameleon cartridge.
6353 <tag/Notes/<itemize>
6354 <item>The function is specific to the C64.
6355 <item>The function does not check for the presence of the C64 Chameleon cartridge.
6356 <item>See the accelerator.h header for the speed definitions.
6358 <tag/Availability/cc65 (not all platforms)
6360 <ref id="detect_chameleon" name="detect_chameleon">,
6361 <ref id="get_chameleon_speed" name="get_chameleon_speed">,
6367 <sect1>set_turbomaster_speed<label id="set_turbomaster_speed"><p>
6371 <tag/Function/Set the current speed of the C64 Turbo Master cartridge.
6372 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6373 <tag/Declaration/<tt/unsigned char __fastcall__ set_turbomaster_speed (unsigned char speed);/
6374 <tag/Description/The function returns the speed after trying to set the speed of the C64 Turbo Master cartridge.
6375 <tag/Notes/<itemize>
6376 <item>The function is specific to the C64.
6377 <item>The function does not check for the presence of the C64 Turbo Master cartridge.
6378 <item>See the accelerator.h header for the speed definitions.
6380 <tag/Availability/cc65 (not all platforms)
6382 <ref id="detect_turbomaster" name="detect_turbomaster">,
6383 <ref id="get_turbomaster_speed" name="get_turbomaster_speed">,
6389 <sect1>set_scpu_speed<label id="set_scpu_speed"><p>
6393 <tag/Function/Set the current speed of the C64/C128 SuperCPU cartridge.
6394 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6395 <tag/Declaration/<tt/unsigned char __fastcall__ set_scpu_speed (unsigned char speed);/
6396 <tag/Description/The function returns the speed after trying to set the speed of the SuperCPU cartridge.
6397 <tag/Notes/<itemize>
6398 <item>The function is specific to the C128 and C64.
6399 <item>The function does not check for the presence of the cartridge.
6400 <item>See the accelerator.h header for the speed definitions.
6402 <tag/Availability/cc65 (not all platforms)
6404 <ref id="detect_scpu" name="detect_scpu">,
6405 <ref id="get_scpu_speed" name="get_scpu_speed">,
6411 <sect1>setjmp<label id="setjmp"><p>
6415 <tag/Function/Save the context for use with <tt/longjmp/.
6416 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
6417 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
6418 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
6419 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
6421 <tag/Notes/<itemize>
6422 <item>The function is only available as fastcall function, so it may only
6423 be used in presence of a prototype.
6424 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
6425 <item><tt/setjmp/ will not save the signal context.
6427 <tag/Availability/ISO 9899
6429 <ref id="longjmp" name="longjmp">
6435 <sect1>setlocale<label id="setlocale"><p>
6439 <tag/Function/Selects a locale.
6440 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
6441 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
6442 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
6443 <tag/Notes/<itemize>
6444 <item>The function is only available as fastcall function, so it may only
6445 be used in presence of a prototype.
6446 <item>cc65 supports only the "C" locale, so calling this function to set a
6447 different locale has no effect.
6449 <tag/Availability/ISO 9899
6451 <ref id="localeconv" name="localeconv">,
6452 <ref id="strcoll" name="strcoll">
6453 <ref id="strxfrm" name="strxfrm">
6459 <sect1>signal<label id="signal"><p>
6463 <tag/Function/Install a signal handler.
6464 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
6465 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
6466 <tag/Description/<tt/signal/ installs a handler for the given signal. The
6467 handler may either be a user supplied function, or one of the predefined
6468 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
6469 previous value if the signal , or the special function vector SIG_ERR in
6471 <tag/Notes/<itemize>
6472 <item>The function is only available as fastcall function, so it may only
6473 be used in presence of a prototype.
6475 <tag/Availability/ISO 9899
6477 <ref id="abort" name="abort">,
6478 <ref id="raise" name="raise">
6484 <sect1>sleep<label id="sleep"><p>
6488 <tag/Function/Sleep for a specified amount of time.
6489 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
6490 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
6491 <tag/Description/The function will return after the specified number of
6492 seconds have elapsed.
6493 <tag/Notes/<itemize>
6494 <item>The function is only available as fastcall function, so it may only
6495 be used in presence of a prototype.
6497 <tag/Availability/POSIX 1003.1
6503 <sect1>slow<label id="slow"><p>
6507 <tag/Function/Switch the CPU into slow mode (C128: 1MHz mode, C16/Plus4: single clock mode).
6508 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
6509 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
6510 <tag/Declaration/<tt/void slow (void);/
6511 <tag/Description/The function will switch the clock of the CPU to slow mode. for the C128
6512 target it means switching the CPU into 1MHz mode. for the C16/Plus4 target it means
6513 switching the CPU into single clock mode.
6514 <tag/Notes/<itemize>
6515 <item>The function is specific to the C128, C16 and Plus4.
6517 <tag/Availability/cc65 (not all platforms)
6519 <ref id="fast" name="fast">,
6520 <ref id="isfast" name="isfast">,
6526 <sect1>srand<label id="srand"><p>
6530 <tag/Function/Initialize the pseudo random number generator.
6531 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
6532 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
6533 <tag/Description/The function initializes the random number generator using
6534 the given seed. On program startup, the generator behaves as if <tt/srand/ has
6535 been called with an argument of 1.
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.
6540 <tag/Availability/ISO 9899
6542 <ref id="_randomize" name="_randomize">,
6543 <ref id="rand" name="rand">
6549 <sect1>strcasecmp<label id="strcasecmp"><p>
6553 <tag/Function/Compare two strings case insensitive.
6554 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6555 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
6556 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
6557 as parameters without case sensitivity. It returns a value that is less than
6558 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
6559 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
6560 <tag/Notes/<itemize>
6561 <item>The function is only available as fastcall function, so it may only
6562 be used in presence of a prototype.
6563 <item>The function is not available in strict ANSI mode.
6565 <tag/Availability/cc65
6567 <ref id="strcmp" name="strcmp">,
6568 <ref id="strcoll" name="strcoll">,
6569 <ref id="stricmp" name="stricmp">,
6570 <ref id="strncmp" name="strncmp">,
6571 <ref id="strxfrm" name="strxfrm">
6577 <sect1>strcat<label id="strcat"><p>
6581 <tag/Function/Concatentate two strings.
6582 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6583 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
6584 <tag/Description/The <tt/strcat/ function appends a copy of the string
6585 pointed to by s2 (including the terminating null byte) to the end of the
6586 string pointed to by s1. The initial byte of s2 overwrites the null byte at
6588 <tag/Notes/<itemize>
6589 <item>The function is only available as fastcall function, so it may only
6590 be used in presence of a prototype.
6591 <item>If copying takes place between objects that overlap, the behaviour
6594 <tag/Availability/ISO 9899
6596 <ref id="strcpy" name="strcpy">,
6597 <ref id="strncat" name="strncat">,
6598 <ref id="strncpy" name="strncpy">
6604 <sect1>strchr<label id="strchr"><p>
6608 <tag/Function/Search for a character in a string.
6609 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6610 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
6611 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
6612 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6613 byte is considered to be part of the string. Upon completion, the function
6614 returns a pointer to the byte, or a null pointer if the byte was not found.
6615 <tag/Notes/<itemize>
6616 <item>The function is only available as fastcall function, so it may only
6617 be used in presence of a prototype.
6619 <tag/Availability/ISO 9899
6621 <ref id="memchr" name="memchr">,
6622 <ref id="strrchr" name="strrchr">
6628 <sect1>strcmp<label id="strcmp"><p>
6632 <tag/Function/Compare two strings.
6633 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6634 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
6635 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
6636 parameters. It returns a value that is less than zero if <tt/s1/ is less than
6637 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
6638 if <tt/s1/ is greater than <tt/s2/.
6639 <tag/Notes/<itemize>
6640 <item>The function is only available as fastcall function, so it may only
6641 be used in presence of a prototype.
6643 <tag/Availability/ISO 9899
6645 <ref id="strcasecmp" name="strcasecmp">,
6646 <ref id="strcoll" name="strcoll">,
6647 <ref id="stricmp" name="stricmp">,
6648 <ref id="strncmp" name="strncmp">
6649 <ref id="strxfrm" name="strxfrm">
6655 <sect1>strcoll<label id="strcoll"><p>
6659 <tag/Function/Compare two strings.
6660 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6661 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
6662 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
6663 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
6664 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
6665 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
6666 than zero if <tt/s1/ is greater than <tt/s2/.
6667 <tag/Notes/<itemize>
6668 <item>The function is only available as fastcall function, so it may only
6669 be used in presence of a prototype.
6671 <tag/Availability/ISO 9899
6673 <ref id="setlocale" name="setlocale">,
6674 <ref id="strcasecmp" name="strcasecmp">,
6675 <ref id="strcmp" name="strcmp">,
6676 <ref id="stricmp" name="stricmp">,
6677 <ref id="strncmp" name="strncmp">,
6678 <ref id="strxfrm" name="strxfrm">
6684 <sect1>strcpy<label id="strcpy"><p>
6688 <tag/Function/Copy a string.
6689 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6690 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
6691 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
6692 <tt/s2/ (including the terminating null byte) into the array pointed to by
6693 <tt/s1/. The function will always return <tt/s1/.
6694 <tag/Notes/<itemize>
6695 <item>The function is only available as fastcall function, so it may only
6696 be used in presence of a prototype.
6697 <item>If copying takes place between objects that overlap, the behaviour
6700 <tag/Availability/ISO 9899
6702 <ref id="strcat" name="strcat">,
6703 <ref id="strncat" name="strncat">,
6704 <ref id="strncpy" name="strncpy">
6707 #include <string.h>
6709 static char hello[14];
6711 strcpy (hello, "Hello world!\n");
6717 <sect1>strcspn<label id="strcspn"><p>
6721 <tag/Function/Compute the length of a substring.
6722 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6723 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
6724 <tag/Description/The <tt/strcspn/ function computes and returns the length of
6725 the substring pointed to by <tt/s/ which does <em>not</em> consist of
6726 characters contained in the string <tt/set/.
6727 <tag/Notes/<itemize>
6728 <item>The function is only available as fastcall function, so it may only
6729 be used in presence of a prototype.
6731 <tag/Availability/ISO 9899
6733 <ref id="strqtok" name="strqtok">,
6734 <ref id="strspn" name="strspn">,
6735 <ref id="strstr" name="strstr">,
6736 <ref id="strtok" name="strtok">
6742 <sect1>strdup<label id="strdup"><p>
6746 <tag/Function/Allocate a copy of a string on the heap.
6747 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6748 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
6749 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
6750 to hold a copy of <tt/s/ including the terminating zero. If the allocation
6751 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
6752 memory block, and a pointer to the block is returned.
6753 <tag/Notes/<itemize>
6754 <item>The function is only available as fastcall function, so it may only
6755 be used in presence of a prototype.
6756 <item>It is up to the caller to free the allocated memory block.
6758 <tag/Availability/ISO 9899
6760 <ref id="free" name="free">,
6761 <ref id="malloc" name="malloc">
6767 <sect1>strerror<label id="strerror"><p>
6771 <tag/Function/Return a string describing an error code.
6772 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6773 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
6774 <tag/Description/The <tt/strerror/ function returns a string describing the
6775 given error code. If an invalid error code is passed, the string "Unknown
6776 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
6777 <tt/errno/ is left untouched.
6778 <tag/Notes/<itemize>
6779 <item>The function is only available as fastcall function, so it may only
6780 be used in presence of a prototype.
6781 <item>While the return type of the function is a <tt/char*/, the returned
6782 string must not be modified by the caller!
6784 <tag/Availability/ISO 9899
6786 <ref id="_stroserror" name="_stroserror">
6792 <sect1>stricmp<label id="stricmp"><p>
6796 <tag/Function/Compare two strings case insensitive.
6797 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6798 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
6799 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
6800 parameters without case sensitivity. It returns a value that is less than zero
6801 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
6802 value greater than zero if <tt/s1/ is greater than <tt/s2/.
6803 <tag/Notes/<itemize>
6804 <item>The function is only available as fastcall function, so it may only
6805 be used in presence of a prototype.
6806 <item>The function is not available in strict ANSI mode.
6808 <tag/Availability/cc65
6810 <ref id="strcasecmp" name="strcasecmp">,
6811 <ref id="strcmp" name="strcmp">,
6812 <ref id="strcoll" name="strcoll">,
6813 <ref id="strncmp" name="strncmp">,
6814 <ref id="strxfrm" name="strxfrm">
6820 <sect1>strlen<label id="strlen"><p>
6824 <tag/Function/Return the length of a string.
6825 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6826 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
6827 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
6828 string to which s points, not including the terminating null byte.
6829 <tag/Notes/<itemize>
6830 <item>The function is only available as fastcall function, so it may only
6831 be used in presence of a prototype.
6832 <item>When compiling with <tt/-Os/ (inline known standard functions), the
6833 function does not work correctly for strings with more than 255 characters.
6835 <tag/Availability/ISO 9899
6837 <ref id="strcpy" name="strcpy">
6843 <sect1>strlower<label id="strlower"><p>
6847 <tag/Function/Make a string lower case.
6848 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6849 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
6850 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
6851 function to each character of a string. The function will always return <tt/s/.
6852 <tag/Notes/<itemize>
6853 <item>The function is only available as fastcall function, so it may only
6854 be used in presence of a prototype.
6855 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6856 <item>An alias name for this function is <tt/strlwr/.
6858 <tag/Availability/cc65
6860 <ref id="strupper" name="strupper">,
6861 <ref id="tolower" name="tolower">
6867 <sect1>strlwr<label id="strlwr"><p>
6874 <sect1>strncasecmp<label id="strncasecmp"><p>
6878 <tag/Function/Compare two strings case insensitive.
6879 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6880 <tag/Declaration/<tt/int __fastcall__ strncasecmp (const char* s1, const char* s2, size_t count);/
6881 <tag/Description/The <tt/strncasecmp/ function compares the two strings passed
6882 as parameters without case sensitivity. It returns a value that is less than
6883 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
6884 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
6885 <tag/Notes/<itemize>
6886 <item>The function is only available as fastcall function, so it may only
6887 be used in presence of a prototype.
6888 <item>The function is not available in strict ANSI mode.
6890 <tag/Availability/cc65
6892 <ref id="strcmp" name="strcmp">,
6893 <ref id="strcoll" name="strcoll">,
6894 <ref id="stricmp" name="stricmp">,
6895 <ref id="strncmp" name="strncmp">,
6896 <ref id="strxfrm" name="strxfrm">
6902 <sect1>strncat<label id="strncat"><p>
6906 <tag/Function/Concatentate two strings.
6907 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6908 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
6909 <tag/Description/The <tt/strncat/ function appends not more than n characters
6910 of the string pointed to by s2 to the end of the string pointed to by s1. The
6911 terminating null character at the end of s1 is overwritten. A terminating null
6912 character is appended to the result, even if not all of s2 is appended to s1.
6913 <tag/Notes/<itemize>
6914 <item>The function is only available as fastcall function, so it may only
6915 be used in presence of a prototype.
6916 <item>If copying takes place between objects that overlap, the behaviour
6919 <tag/Availability/ISO 9899
6921 <ref id="strcpy" name="strcpy">,
6922 <ref id="strncat" name="strncat">,
6923 <ref id="strncpy" name="strncpy">
6929 <sect1>strncmp<label id="strncmp"><p>
6933 <tag/Function/Compare two strings.
6934 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6935 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
6936 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
6937 characters of the two strings passed as parameters. It returns a value that is
6938 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
6939 <tt/s2/, zero if they are identical, and a value greater than zero they are
6941 <tag/Notes/<itemize>
6942 <item>The function is only available as fastcall function, so it may only
6943 be used in presence of a prototype.
6945 <tag/Availability/ISO 9899
6947 <ref id="strcasecmp" name="strcasecmp">,
6948 <ref id="strcmp" name="strcmp">,
6949 <ref id="strcoll" name="strcoll">,
6950 <ref id="stricmp" name="stricmp">,
6951 <ref id="strxfrm" name="strxfrm">
6957 <sect1>strncpy<label id="strncpy"><p>
6961 <tag/Function/Copy part of a string.
6962 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6963 <tag/Declaration/<tt/char* __fastcall__ strncpy (char* s1, const char* s2, size_t n);/
6964 <tag/Description/The <tt/strncpy/ function copies not more than <tt/n/ bytes from
6965 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
6966 pointed to by <tt/s2/ is a string that is shorter than <tt/n/ bytes, null bytes are
6967 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
6968 written. The function always will return <tt/s1/.
6969 <tag/Notes/<itemize>
6970 <item>The function is available only as a fastcall function; so, it may be used
6971 only in the presence of a prototype.
6972 <item>If there is no null byte in the first <tt/n/ bytes of the array pointed
6973 to by <tt/s2/, the result is <em/not/ null-terminated!
6974 <item>If copying takes place between objects that overlap, the behaviour is
6977 <tag/Availability/ISO 9899
6979 <ref id="memcpy" name="memcpy">,
6980 <ref id="strcat" name="strcat">,
6981 <ref id="strcpy" name="strcpy">,
6982 <ref id="strncat" name="strncat">
6987 static char hello[6];
6989 strncpy (hello, "Hello world!\n", sizeof hello - 1)[5] = '\0';
6995 <sect1>strnicmp<label id="strnicmp"><p>
6999 <tag/Function/Compare two strings case insensitive.
7000 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7001 <tag/Declaration/<tt/int __fastcall__ strnicmp (const char* s1, const char* s2, size_t count);/
7002 <tag/Description/The <tt/strnicmp/ function compares the two strings passed as
7003 parameters without case sensitivity. It returns a value that is less than zero
7004 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
7005 value greater than zero if <tt/s1/ is greater than <tt/s2/.
7006 <tag/Notes/<itemize>
7007 <item>The function is only available as fastcall function, so it may only
7008 be used in presence of a prototype.
7009 <item>The function is not available in strict ANSI mode.
7011 <tag/Availability/cc65
7013 <ref id="strcasecmp" name="strcasecmp">,
7014 <ref id="strcmp" name="strcmp">,
7015 <ref id="strcoll" name="strcoll">,
7016 <ref id="strncmp" name="strncmp">,
7017 <ref id="strxfrm" name="strxfrm">
7023 <sect1>strqtok<label id="strqtok"><p>
7027 <tag/Function/Break a string into tokens.
7028 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7029 <tag/Declaration/<tt/char* __fastcall__ strqtok (char* s1, const char* s2);/
7030 <tag/Description/<tt/strqtok()/ will break the string <tt/s1/ into a sequence of
7031 tokens, which are delimited by either quotation marks or characters from the
7032 string <tt/s2/. Tokens inside quotation marks may contain characters from <tt/s2/
7033 (they aren't delimiters there). The first call to <tt/strqtok()/ will return a
7034 pointer to the first token in the string <tt/s1/. The following calls must pass
7035 a <tt/NULL/ pointer as <tt/s1/, in order to get the next token in the string.
7036 Different sets of delimiters may be used for the subsequent calls to <tt/strqtok()/.
7037 <tag/Notes/<itemize>
7038 <item>The function is available only as a fastcall function; so, it may be used
7039 only in the presence of a prototype.
7040 <item><tt/strqtok()/ will modify the string <tt/s1/.
7041 <item>The function will forget where it is in the <tt/s1/ string if it is given
7042 a second <tt/s1/ string before it finishes the first one.
7044 <tag/Availability/cc65
7046 <ref id="strcspn" name="strcspn">,
7047 <!-- <ref id="strpbrk" name="strpbrk">, -->
7048 <ref id="strspn" name="strspn">,
7049 <ref id="strtok" name="strtok">
7055 <sect1>strrchr<label id="strrchr"><p>
7059 <tag/Function/Search for a character in a string.
7060 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7061 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
7062 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
7063 (converted to a char) in the string pointed to by <tt/s/. The terminating null
7064 byte is considered to be part of the string. Upon completion, the function
7065 returns a pointer to the byte, or a null pointer if the byte was not found.
7066 <tag/Notes/<itemize>
7067 <item>The function is only available as fastcall function, so it may only
7068 be used in presence of a prototype.
7070 <tag/Availability/ISO 9899
7072 <ref id="strchr" name="strchr">
7078 <sect1>strspn<label id="strspn"><p>
7082 <tag/Function/Compute the length of a substring.
7083 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7084 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
7085 <tag/Description/The <tt/strspn/ function computes and returns the length of
7086 the substring pointed to by <tt/s/ which does consist only of characters
7087 contained in the string <tt/set/.
7088 <tag/Notes/<itemize>
7089 <item>The function is only available as fastcall function, so it may only
7090 be used in presence of a prototype.
7092 <tag/Availability/ISO 9899
7094 <ref id="strcspn" name="strcspn">,
7095 <ref id="strstr" name="strstr">
7101 <sect1>strstr<label id="strstr"><p>
7105 <tag/Function/Find a substring.
7106 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7107 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
7108 <tag/Description/<tt/strstr/ searches for the first occurance of the string
7109 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
7110 otherwise it returns <tt/NULL/.
7111 <tag/Notes/<itemize>
7112 <item>The function is only available as fastcall function, so it may only
7113 be used in presence of a prototype.
7115 <tag/Availability/ISO 9899
7117 <ref id="strcspn" name="strcspn">,
7118 <ref id="strspn" name="strspn">
7124 <sect1>strtok<label id="strtok"><p>
7128 <tag/Function/Break a string into tokens.
7129 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7130 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
7131 <tag/Description/<tt/strtok()/ will break the string <tt/s1/ into a sequence of
7132 tokens, which are delimited by characters from the string <tt/s2/. The first call
7133 to <tt/strtok()/ will return a pointer to the first token in the string <tt/s1/.
7134 The following calls must pass a <tt/NULL/ pointer as <tt/s1/, in order to get
7135 the next token in the string. Different sets of delimiters may be used for the
7136 subsequent calls to <tt/strtok()/.
7137 <tag/Notes/<itemize>
7138 <item>The function is only available as fastcall function, so it may only
7139 be used in presence of a prototype.
7140 <item><tt/strtok()/ will modify the string <tt/s1/.
7141 <item>The function will forget where it is in the <tt/s1/ string if it is given
7142 a second <tt/s1/ string before it finishes the first one.
7144 <tag/Availability/ISO 9899
7146 <ref id="strcspn" name="strcspn">,
7147 <!-- <ref id="strpbrk" name="strpbrk">, -->
7148 <ref id="strqtok" name="strqtok">,
7149 <ref id="strspn" name="strspn">
7155 <sect1>strxfrm<label id="strxfrm"><p>
7159 <tag/Function/Transform a string.
7160 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7161 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
7162 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
7163 s2 and places the resulting string into the string pointed to by s1. The
7164 transformation is such that if the <tt/strcmp/ function is applied to two
7165 transformed strings, it returns a value greater than, equal to, or less than
7166 zero, corresponding to the result of the <tt/strcoll/ function applied to the
7167 same two original strings. No more than n characters are placed into the
7168 resulting array pointed to by s1, including the terminating null character.
7169 <tag/Notes/<itemize>
7170 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
7171 the behaviour is undefined.
7172 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
7173 <item>The function is only available as fastcall function, so it may only
7174 be used in presence of a prototype.
7175 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
7176 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
7178 <tag/Availability/ISO 9899
7180 <ref id="strcmp" name="strcmp">,
7181 <ref id="strcoll" name="strcoll">,
7182 <ref id="strncpy" name="strncpy">
7188 <sect1>strupper<label id="strupper"><p>
7192 <tag/Function/Make a string upper case.
7193 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7194 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
7195 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
7196 function to each character of a string. The function will always return <tt/s/.
7197 <tag/Notes/<itemize>
7198 <item>The function is only available as fastcall function, so it may only
7199 be used in presence of a prototype.
7200 <item>The function prototype is unavailable when compiling in strict ANSI mode.
7201 <item>An alias name for this function is <tt/strupr/.
7203 <tag/Availability/cc65
7205 <ref id="strlower" name="strlower">
7206 <ref id="toupper" name="toupper">
7212 <sect1>strupr<label id="strupr"><p>
7219 <sect1>telldir<label id="telldir"><p>
7223 <tag/Function/Return the current position of a directory stream.
7224 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
7225 <tag/Declaration/<tt/long __fastcall__ telldir (DIR* dir);/
7226 <tag/Description/<tt/telldir/ returns the current position of a directory
7227 stream. The return value may be used in subsequent calls to
7228 <tt/<ref id="seekdir" name="seekdir">/.
7229 <tag/Notes/<itemize>
7230 <item>The function is only available as fastcall function, so it may only
7231 be used in presence of a prototype.
7233 <tag/Availability/POSIX 1003.1
7235 <ref id="seekdir" name="seekdir">,
7236 <ref id="telldir" name="telldir">
7242 <sect1>textcolor<label id="textcolor"><p>
7246 <tag/Function/Set the text color.
7247 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7248 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
7249 <tag/Description/The function will set a new text color. It returns the old
7250 (current) text color. Text output using any <tt/conio.h/ function will use
7251 the color set by this function.
7252 <tag/Notes/<itemize>
7253 <item>Text colors are system dependent. The function may have no effect
7254 on systems where the text color cannot be changed.
7255 <item>The function is only available as fastcall function, so it may only
7256 be used in presence of a prototype.
7258 <tag/Availability/cc65
7260 <ref id="bgcolor" name="bgcolor">,
7261 <ref id="bordercolor" name="bordercolor">
7267 <sect1>time<label id="time"><p>
7271 <tag/Function/Get the time.
7272 <tag/Header/<tt/<ref id="time.h" name="time.h">/
7273 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
7274 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
7275 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
7276 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
7277 returned and <tt/errno/ is set to <tt/ENOSYS/.
7278 <tag/Notes/<itemize>
7279 <item>The function is only available as fastcall function, so it may
7280 only be used in presence of a prototype.
7281 <item>Many platforms supported by cc65 do not have a realtime clock, so the
7282 returned value may not be valid.
7284 <tag/Availability/ISO 9899
7286 <ref id="clock" name="clock">
7292 <sect1>toggle_videomode<label id="toggle_videomode"><p>
7296 <tag/Function/Toggle between 40 and 80 column mode.
7297 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
7298 <tag/Declaration/<tt/void toggle_videomode (void);/
7299 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
7300 old mode (cursor position, color and so on) are saved and restored together
7302 <tag/Notes/<itemize>
7303 <item>The function is specific to the C128.
7304 <item>This function is deprecated. Please use <ref id="videomode"
7305 name="videomode"> instead!
7307 <tag/Availability/C128
7309 <ref id="fast" name="fast">,
7310 <ref id="isfast" name="isfast">,
7311 <ref id="slow" name="slow">,
7312 <ref id="videomode" name="videomode">
7318 <sect1>tolower<label id="tolower"><p>
7322 <tag/Function/Convert a character into its lower case representation.
7323 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7324 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
7325 <tag/Description/The function returns the given character converted to lower
7326 case. If the given character is not a letter, it is returned unchanged.
7327 <tag/Notes/<itemize>
7328 <item>The function is only available as fastcall function, so it may
7329 only be used in presence of a prototype.
7331 <tag/Availability/ISO 9899
7333 <ref id="islower" name="islower">,
7334 <ref id="isupper" name="isupper">,
7335 <ref id="toupper" name="toupper">
7341 <sect1>toupper<label id="toupper"><p>
7345 <tag/Function/Convert a character into its upper case representation.
7346 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7347 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
7348 <tag/Description/The function returns the given character converted to upper
7349 case. If the given character is not a letter, it is returned unchanged.
7350 <tag/Notes/<itemize>
7351 <item>The function is only available as fastcall function, so it may
7352 only be used in presence of a prototype.
7354 <tag/Availability/ISO 9899
7356 <ref id="islower" name="islower">,
7357 <ref id="isupper" name="isupper">,
7358 <ref id="tolower" name="tolower">
7364 <sect1>ultoa<label id="ultoa"><p>
7368 <tag/Function/Convert an unsigned long integer into a string.
7369 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7370 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
7371 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
7372 string using <tt/radix/ as the base.
7373 <tag/Notes/<itemize>
7374 <item>There are no provisions to prevent a buffer overflow.
7375 <item>The function is non standard, so it is not available in strict ANSI mode.
7376 You should probably use <tt/sprintf/ instead.
7377 <item>The function is only available as fastcall function, so it may only be
7378 used in presence of a prototype.
7380 <tag/Availability/cc65
7382 <ref id="atoi" name="atoi">,
7383 <ref id="atol" name="atol">,
7384 <ref id="itoa" name="itoa">,
7385 <ref id="ltoa" name="ltoa">,
7386 <ref id="utoa" name="utoa">
7392 <sect1>unlink<label id="unlink"><p>
7396 <tag/Function/Delete a file.
7397 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
7398 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
7399 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
7400 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
7401 code describing the reason for the failure.
7402 <tag/Notes/<itemize>
7403 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
7404 name="remove">/ instead, which is a native ANSI C function and does the same.
7405 <item>This function is not available on all cc65 targets (depends on the
7406 availability of file I/O).
7407 <item>The function is only available as fastcall function, so it may only
7408 be used in presence of a prototype.
7409 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
7410 used, which has the same semantics, but is more portable, because it conforms
7411 to the ISO C standard.
7413 <tag/Availability/POSIX 1003.1
7415 <ref id="remove" name="remove">
7418 #include <stdio.h>
7419 #include <unistd.h>
7421 #define FILENAME "helloworld"
7423 if (unlink (FILENAME) == 0) {
7424 printf ("We deleted %s successfully\n", FILENAME);
7426 printf ("There was a problem deleting %s\n", FILENAME);
7433 <sect1>utoa<label id="utoa"><p>
7437 <tag/Function/Convert an unsigned integer into a string.
7438 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7439 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
7440 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
7441 using <tt/radix/ as the base.
7442 <tag/Notes/<itemize>
7443 <item>There are no provisions to prevent a buffer overflow.
7444 <item>The function is non standard, so it is not available in strict ANSI mode.
7445 You should probably use <tt/sprintf/ instead.
7446 <item>The function is only available as fastcall function, so it may only be
7447 used in presence of a prototype.
7449 <tag/Availability/cc65
7451 <ref id="atoi" name="atoi">,
7452 <ref id="atol" name="atol">,
7453 <ref id="itoa" name="itoa">,
7454 <ref id="ltoa" name="ltoa">,
7455 <ref id="ultoa" name="ultoa">
7461 <sect1>vcprintf<label id="vcprintf"><p>
7465 <tag/Function/Formatted output to the console.
7466 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7467 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
7468 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
7469 text where necessary and formatted according to the format string given. The
7470 resulting string is output to the console. <tt/vcprintf/ supports the same
7471 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
7472 <tag/Notes/<itemize>
7473 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
7474 between <tt/\r/ and <tt/\n/.
7475 <item>The function is only available as fastcall function, so it may only be
7476 used in presence of a prototype.
7478 <tag/Availability/cc65
7480 <ref id="cprintf" name="cprintf">,
7481 <ref id="cputc" name="cputc">,
7482 <ref id="cputcxy" name="cputcxy">,
7483 <ref id="cputs" name="cputs">,
7484 <ref id="cputsxy" name="cputsxy">
7490 <sect1>videomode<label id="videomode"><p>
7494 <tag/Function/Switch to either 40 or 80 column mode.
7495 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
7496 <ref id="c128.h" name="c128.h">/
7497 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
7498 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
7499 the requested mode is already active, nothing happens. The old mode is returned
7501 <tag/Notes/<itemize>
7502 <item>The function is specific to the C128 and enhanced Apple //e.
7503 <item>This function replaces <ref id="toggle_videomode"
7504 name="toggle_videomode">.
7505 <item>The function is only available as fastcall function, so it may only be
7506 used in presence of a prototype.
7508 <tag/Availability/C128 and enhanced Apple //e
7510 <ref id="fast" name="fast">,
7511 <ref id="isfast" name="isfast">,
7512 <ref id="slow" name="slow">,
7513 <ref id="toggle_videomode" name="toggle_videomode">
7519 <sect1>waitvsync<label id="waitvsync"><p>
7523 <tag/Function/Wait until the start of the next frame.
7525 <tt/<ref id="cbm.h" name="cbm.h">/,
7526 <tt/<ref id="gamate.h" name="gamate.h">/,
7527 <tt/<ref id="nes.h" name="nes.h">/,
7528 <tt/<ref id="pce.h" name="pce.h">/
7529 <tag/Declaration/<tt/void waitvsync (void);/
7530 <tag/Description/Wait for vertical sync to reduce flickering.
7531 <tag/Availability/Platforms above
7537 <sect1>wherex<label id="wherex"><p>
7541 <tag/Function/Return the current X position of the text mode cursor.
7542 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7543 <tag/Declaration/<tt/unsigned char wherex (void);/
7544 <tag/Description/The function returns the current X position of the text mode
7545 cursor. Zero is returned for the leftmost screen position.
7546 <tag/Availability/cc65
7548 <ref id="gotox" name="gotox">,
7549 <ref id="gotoy" name="gotoy">,
7550 <ref id="gotoxy" name="gotoxy">,
7551 <ref id="wherey" name="wherey">
7557 <sect1>wherey<label id="wherey"><p>
7561 <tag/Function/Return the current Y position of the text mode cursor.
7562 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7563 <tag/Declaration/<tt/unsigned char wherey (void);/
7564 <tag/Description/The function returns the current Y position of the text mode
7565 cursor. Zero is returned for the uppermost screen position.
7566 <tag/Availability/cc65
7568 <ref id="gotox" name="gotox">,
7569 <ref id="gotoy" name="gotoy">,
7570 <ref id="gotoxy" name="gotoxy">,
7571 <ref id="wherex" name="wherex">