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_turbomaster_speed<label id="get_turbomaster_speed"><p>
3689 <tag/Function/Get the current speed of the C64 Turbo Master cartridge.
3690 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3691 <tag/Declaration/<tt/unsigned char get_turbomaster_speed (void);/
3692 <tag/Description/The function returns the current speed of the C64 Turbo Master cartridge.
3693 <tag/Notes/<itemize>
3694 <item>The function is specific to the C64.
3695 <item>The function does not check for the presence of the C64 Turbo Master cartridge.
3696 <item>See the accelerator.h header for the speed definitions.
3698 <tag/Availability/cc65 (not all platforms)
3700 <ref id="detect_turbomaster" name="detect_turbomaster">,
3701 <ref id="set_turbomaster_speed" name="set_turbomaster_speed">,
3707 <sect1>get_scpu_speed<label id="get_scpu_speed"><p>
3711 <tag/Function/Get the current speed of the C64/C128 SuperCPU cartridge.
3712 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3713 <tag/Declaration/<tt/unsigned char get_scpu_speed (void);/
3714 <tag/Description/The function returns the current speed of the SuperCPU cartridge.
3715 <tag/Notes/<itemize>
3716 <item>The function is specific to the C128 and C64.
3717 <item>The function does not check for the presence of the cartridge.
3718 <item>See the accelerator.h header for the speed definitions.
3720 <tag/Availability/cc65 (not all platforms)
3722 <ref id="detect_scpu" name="detect_scpu">,
3723 <ref id="set_scpu_speed" name="set_scpu_speed">,
3729 <sect1>getcpu<label id="getcpu"><p>
3733 <tag/Function/Determine on which CPU the program is running.
3734 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3735 <tag/Declaration/<tt/unsigned char getcpu (void);/
3736 <tag/Description/The function checks on which CPU the code is running. It
3737 returns one of the constants<itemize>
3739 <item><tt/CPU_65C02/
3740 <item><tt/CPU_65816/
3742 <item><tt/CPU_65SC02/
3743 <item><tt/CPU_65CE02/
3744 <item><tt/CPU_HUC6280/
3747 <tag/Notes/<itemize>
3748 <item>Other, more exotic CPU types are not disinguished.
3750 <tag/Availability/cc65
3756 <sect1>getcurrentdevice<label id="getcurrentdevice"><p>
3760 <tag/Function/Get current device.
3761 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3762 <tag/Declaration/<tt/unsigned char getcurrentdevice (void);/
3763 <tag/Description/The function returns the current device.
3764 It allows to access the current device with the <ref id="dio.h"
3765 name="Low-level disk I/O API"> or <ref id="cbm.h" name="cbm_* I/O
3766 functions"> requiring a 'device' parameter.
3767 <tag/Availability/cc65
3769 <ref id="getdevicedir" name="getdevicedir">,
3770 <ref id="getfirstdevice" name="getfirstdevice">,
3771 <ref id="getnextdevice" name="getnextdevice">
3773 dio_open (getcurrentdevice ());
3779 <sect1>getcwd<label id="getcwd"><p>
3783 <tag/Function/Get current working directory.
3784 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3785 <tag/Declaration/<tt/char* __fastcall__ getcwd (char* buf, size_t size);/
3786 <tag/Description/The function will return the current working directory.
3787 <tag/Notes/<itemize>
3788 <item>The function is only available as fastcall function, so it may only
3789 be used in presence of a prototype.
3791 <tag/Availability/POSIX 1003.1
3797 <sect1>getdevicedir<label id="getdevicedir"><p>
3801 <tag/Function/Get device directory.
3802 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3803 <tag/Declaration/<tt/char* __fastcall__ getdevicedir (unsigned char device, char* buf, size_t size);/
3804 <tag/Description/The function returns the directory representing <tt/device/.
3805 It allows to access the device on filesystem level by calling chdir() with
3806 the directory returned.
3807 <tag/Notes/<itemize>
3808 <item>Calling getdevicedir() <em/does/ check for a (formatted) disk in a
3809 floppy-disk-type device and returns NULL if that check fails.
3810 <item>The function is only available as fastcall function, so it may only
3811 be used in presence of a prototype.
3813 <tag/Availability/cc65
3815 <ref id="getcwd" name="getcwd">,
3816 <ref id="getcurrentdevice" name="getcurrentdevice">,
3817 <ref id="getfirstdevice" name="getfirstdevice">,
3818 <ref id="getnextdevice" name="getnextdevice">
3820 chdir (getdevicedir (device, buf, sizeof buf));
3822 cf. <tt/samples/enumdevdir.c/
3827 <sect1>getenv<label id="getenv"><p>
3831 <tag/Function/Return a value from the environment.
3832 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3833 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
3834 <tag/Description/The function searches the environment for an entry that
3835 matches <tt/name/ and returns its value. The environment consists of a list
3836 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
3838 <tag/Notes/<itemize>
3839 <item>What exactly is stored in the environment depends on the machine the
3840 program is running on.
3841 <item>The function is only available as fastcall function, so it may only
3842 be used in presence of a prototype.
3844 <tag/Availability/ISO 9899
3850 <sect1>getfirstdevice<label id="getfirstdevice"><p>
3854 <tag/Function/Get first device.
3855 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3856 <tag/Declaration/<tt/unsigned char getfirstdevice (void);/
3857 <tag/Description/The function returns the first device.
3858 The constant <tt/INVALID_DEVICE/ indicates no device.
3859 <tag/Notes/<itemize>
3860 <item>Calling getfirstdevice() does <em/not/ turn on the motor of a
3861 drive-type device and does <em/not/ check for a disk in the drive.
3863 <tag/Availability/cc65
3865 <ref id="getcurrentdevice" name="getcurrentdevice">,
3866 <ref id="getdevicedir" name="getdevicedir">,
3867 <ref id="getnextdevice" name="getnextdevice">
3869 unsigned char dev = getfirstdevice ();
3870 while (dev != INVALID_DEVICE) {
3871 printf ("%d\n", dev);
3872 dev = getnextdevice (dev);
3879 <sect1>getnextdevice<label id="getnextdevice"><p>
3883 <tag/Function/Get next device.
3884 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3885 <tag/Declaration/<tt/unsigned char __fastcall__ getnextdevice (unsigned char device);/
3886 <tag/Description/The function returns the next device after <tt/device/.
3887 The constant <tt/INVALID_DEVICE/ indicates no further device.
3888 <tag/Notes/<itemize>
3889 <item>Calling getnextdevice() does <em/not/ turn on the motor of a
3890 drive-type device and does <em/not/ check for a disk in the drive.
3891 <item>The function is only available as fastcall function, so it may only
3892 be used in presence of a prototype.
3894 <tag/Availability/cc65
3896 <ref id="getcurrentdevice" name="getcurrentdevice">,
3897 <ref id="getdevicedir" name="getdevicedir">,
3898 <ref id="getfirstdevice" name="getfirstdevice">
3900 unsigned char dev = getfirstdevice ();
3901 while (dev != INVALID_DEVICE) {
3902 printf ("%d\n", dev);
3903 dev = getnextdevice (dev);
3910 <sect1>getopt<label id="getopt"><p>
3914 <tag/Function/Parse command line options.
3915 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3916 <tag/Declaration/<tt/int __fastcall__ getopt (int argc, char* const* argv,
3917 const char* optstring);/
3918 <tag/Description/The function parses command line arguments, <tt/argc/ and
3919 <tt/argv/ are the argument count and array passed to <tt/main/. <tt/optstring/
3920 is a string that contains command line option characters. If a character in
3921 <tt/optstring/ is followed by a colon, the option requires an argument. An
3922 option on the command line is recognized if it is one of the option characters
3924 <tt/getopt/ must be called repeatedly. It will return each option character
3925 found on the command line and <tt/EOF/ (-1) if there is no other option. An
3926 option argument is placed in <tt/optarg/, the index of the next element on the
3927 command line to be processed is placed in <tt/optind/.
3928 <tag/Notes/<itemize>
3929 <item>The implementation will not reorder options. A non option on the command
3930 line will terminate option processing. All remaining arguments are not
3931 recognized as options, even if the start with a '-' character.
3932 <item>The function is only available as fastcall function, so it may only
3933 be used in presence of a prototype.
3935 <tag/Availability/POSIX.2
3941 <sect1>gotox<label id="gotox"><p>
3945 <tag/Function/Move the text mode cursor to a new X position.
3946 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3947 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
3948 <tag/Description/The function moves the text mode cursor to the specified X
3949 position while leaving the Y position untouched. The leftmost position on the
3950 screen has the coordinate 0.
3951 <tag/Notes/<itemize>
3952 <item>The function is only available as fastcall function, so it may
3953 only be used in presence of a prototype.
3954 <item>Invalid values for the X position (out of screen coordinates) may
3955 lead to undefined behaviour.
3957 <tag/Availability/cc65
3959 <ref id="gotoy" name="gotoy">,
3960 <ref id="gotoxy" name="gotoxy">,
3961 <ref id="wherex" name="wherex">,
3962 <ref id="wherey" name="wherey">
3968 <sect1>gotoxy<label id="gotoxy"><p>
3972 <tag/Function/Move the text mode cursor to a new position.
3973 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3974 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
3975 <tag/Description/The function moves the text mode cursor to the specified
3976 position. The leftmost position on the screen has the X coordinate 0, the
3977 topmost line has the Y coordinate 0.
3978 <tag/Notes/<itemize>
3979 <item>The function is only available as fastcall function, so it may only be
3980 used in presence of a prototype.
3981 <item>Invalid values for any of both coordinates (out of screen positions) may
3982 lead to undefined behaviour.
3984 <tag/Availability/cc65
3986 <ref id="gotox" name="gotox">,
3987 <ref id="gotoy" name="gotoy">,
3988 <ref id="wherex" name="wherex">,
3989 <ref id="wherey" name="wherey">
3995 <sect1>gotoy<label id="gotoy"><p>
3999 <tag/Function/Move the text mode cursor to a new Y position.
4000 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4001 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
4002 <tag/Description/The function moves the text mode cursor to the specified Y
4003 position while leaving the X position untouched. The uppermost position on the
4004 screen has the coordinate 0.
4005 <tag/Notes/<itemize>
4006 <item>The function is only available as fastcall function, so it may
4007 only be used in presence of a prototype.
4008 <item>Invalid values for the Y position (out of screen coordinates) may lead
4009 to undefined behaviour.
4011 <tag/Availability/cc65
4013 <ref id="gotox" name="gotox">,
4014 <ref id="gotoxy" name="gotoxy">,
4015 <ref id="wherex" name="wherex">,
4016 <ref id="wherey" name="wherey">
4022 <sect1>isalnum<label id="isalnum"><p>
4026 <tag/Function/Check if a given character is a letter or digit.
4027 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4028 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
4029 <tag/Description/The function returns a non zero value if the given argument
4030 is a letter or digit. The return value is zero if the character is anything
4032 <tag/Notes/<itemize>
4033 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4034 inline sequence generated by the macro will not work correctly for values
4035 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4036 this range. The non inline function may be accessed by <tt/#undef/'ing
4038 <item>When compiling without <tt/-Os/, the function is only available as
4039 fastcall function, so it may only be used in presence of a prototype.
4041 <tag/Availability/ISO 9899
4043 <ref id="isalpha" name="isalpha">,
4044 <ref id="isascii" name="isascii">,
4045 <ref id="isblank" name="isblank">,
4046 <ref id="iscntrl" name="iscntrl">,
4047 <ref id="isdigit" name="isdigit">,
4048 <ref id="isgraph" name="isgraph">,
4049 <ref id="islower" name="islower">,
4050 <ref id="isprint" name="isprint">,
4051 <ref id="ispunct" name="ispunct">,
4052 <ref id="isspace" name="isspace">,
4053 <ref id="isupper" name="isupper">,
4054 <ref id="isxdigit" name="isxdigit">
4060 <sect1>isalpha<label id="isalpha"><p>
4064 <tag/Function/Check if a given character is a letter.
4065 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4066 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
4067 <tag/Description/The function returns a non zero value if the given argument
4068 is a letter. The return value is zero if the character is anything else.
4069 <tag/Notes/<itemize>
4070 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4071 inline sequence generated by the macro will not work correctly for values
4072 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4073 this range. The non inline function may be accessed by <tt/#undef/'ing the
4075 <item>When compiling without <tt/-Os/, the function is only available as
4076 fastcall function, so it may only be used in presence of a prototype.
4078 <tag/Availability/ISO 9899
4080 <ref id="isalnum" name="isalnum">,
4081 <ref id="isascii" name="isascii">,
4082 <ref id="isblank" name="isblank">,
4083 <ref id="iscntrl" name="iscntrl">,
4084 <ref id="isdigit" name="isdigit">,
4085 <ref id="isgraph" name="isgraph">,
4086 <ref id="islower" name="islower">,
4087 <ref id="isprint" name="isprint">,
4088 <ref id="ispunct" name="ispunct">,
4089 <ref id="isspace" name="isspace">,
4090 <ref id="isupper" name="isupper">,
4091 <ref id="isxdigit" name="isxdigit">
4097 <sect1>isascii<label id="isascii"><p>
4101 <tag/Function/Check if a given character is in the ASCII (0..127) range.
4102 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4103 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
4104 <tag/Description/The function returns a non zero value if the given argument
4105 is in the range 0..127 (the range of valid ASCII characters) and zero if not.
4106 <tag/Notes/<itemize>
4107 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4108 inline sequence generated by the macro will not work correctly for values
4109 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4110 this range. The non inline function may be accessed by <tt/#undef/'ing the
4112 <item>When compiling without <tt/-Os/, the function is only available as
4113 fastcall function, so it may only be used in presence of a prototype.
4115 <tag/Availability/ISO 9899
4117 <ref id="isalnum" name="isalnum">,
4118 <ref id="isalpha" name="isalpha">,
4119 <ref id="isblank" name="isblank">,
4120 <ref id="iscntrl" name="iscntrl">,
4121 <ref id="isdigit" name="isdigit">,
4122 <ref id="isgraph" name="isgraph">,
4123 <ref id="islower" name="islower">,
4124 <ref id="isprint" name="isprint">,
4125 <ref id="ispunct" name="ispunct">,
4126 <ref id="isspace" name="isspace">,
4127 <ref id="isupper" name="isupper">,
4128 <ref id="isxdigit" name="isxdigit">
4134 <sect1>isblank<label id="isblank"><p>
4138 <tag/Function/Check if a given character is a space or tab.
4139 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4140 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
4141 <tag/Description/The function returns a non zero value if the given argument
4142 is a space or tab character. The return value is zero if the character is
4144 <tag/Notes/<itemize>
4145 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4146 inline sequence generated by the macro will not work correctly for values
4147 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4148 this range. The non inline function may be accessed by <tt/#undef/'ing the
4150 <item>When compiling without <tt/-Os/, the function is only available as
4151 fastcall function, so it may only be used in presence of a prototype.
4153 <tag/Availability/ISO 9899
4155 <ref id="isalnum" name="isalnum">,
4156 <ref id="isalpha" name="isalpha">,
4157 <ref id="isascii" name="isascii">,
4158 <ref id="iscntrl" name="iscntrl">,
4159 <ref id="isdigit" name="isdigit">,
4160 <ref id="isgraph" name="isgraph">,
4161 <ref id="islower" name="islower">,
4162 <ref id="isprint" name="isprint">,
4163 <ref id="ispunct" name="ispunct">,
4164 <ref id="isspace" name="isspace">,
4165 <ref id="isupper" name="isupper">,
4166 <ref id="isxdigit" name="isxdigit">
4172 <sect1>iscntrl<label id="iscntrl"><p>
4176 <tag/Function/Check if a given character is a control character.
4177 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4178 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
4179 <tag/Description/The function returns a non zero value if the given argument
4180 is a control character. The return value is zero if the character is anything
4182 <tag/Notes/<itemize>
4183 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4184 inline sequence generated by the macro will not work correctly for values
4185 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4186 this range. The non inline function may be accessed by <tt/#undef/'ing the
4188 <item>When compiling without <tt/-Os/, the function is only available as
4189 fastcall function, so it may only be used in presence of a prototype.
4191 <tag/Availability/ISO 9899
4193 <ref id="isalnum" name="isalnum">,
4194 <ref id="isalpha" name="isalpha">,
4195 <ref id="isascii" name="isascii">,
4196 <ref id="isblank" name="isblank">,
4197 <ref id="isdigit" name="isdigit">,
4198 <ref id="isgraph" name="isgraph">,
4199 <ref id="islower" name="islower">,
4200 <ref id="isprint" name="isprint">,
4201 <ref id="ispunct" name="ispunct">,
4202 <ref id="isspace" name="isspace">,
4203 <ref id="isupper" name="isupper">,
4204 <ref id="isxdigit" name="isxdigit">
4210 <sect1>isdigit<label id="isdigit"><p>
4214 <tag/Function/Check if a given character is a digit.
4215 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4216 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
4217 <tag/Description/The function returns a non zero value if the given argument
4218 is a digit. The return value is zero if the character is anything else.
4219 <tag/Notes/<itemize>
4220 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4221 inline sequence generated by the macro will not work correctly for values
4222 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4223 this range. The non inline function may be accessed by <tt/#undef/'ing the
4225 <item>When compiling without <tt/-Os/, the function is only available as
4226 fastcall function, so it may only be used in presence of a prototype.
4228 <tag/Availability/ISO 9899
4230 <ref id="isalnum" name="isalnum">,
4231 <ref id="isalpha" name="isalpha">,
4232 <ref id="isascii" name="isascii">,
4233 <ref id="isblank" name="isblank">,
4234 <ref id="iscntrl" name="iscntrl">,
4235 <ref id="isgraph" name="isgraph">,
4236 <ref id="islower" name="islower">,
4237 <ref id="isprint" name="isprint">,
4238 <ref id="ispunct" name="ispunct">,
4239 <ref id="isspace" name="isspace">,
4240 <ref id="isupper" name="isupper">,
4241 <ref id="isxdigit" name="isxdigit">
4247 <sect1>isfast<label id="isfast"><p>
4251 <tag/Function/Check if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
4252 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
4253 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
4254 <tag/Declaration/<tt/unsigned char isfast (void);/
4255 <tag/Description/The function returns a 1 if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
4256 <tag/Notes/<itemize>
4257 <item>The function is specific to the C128, C16 and Plus4.
4259 <tag/Availability/cc65 (not all platforms)
4261 <ref id="fast" name="fast">,
4262 <ref id="slow" name="slow">,
4268 <sect1>isgraph<label id="isgraph"><p>
4272 <tag/Function/Check if a given character is a printable character (except
4274 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4275 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
4276 <tag/Description/The function returns a non zero value if the given argument
4277 is a printable character with the exception of space. The return value is zero
4278 if the character is anything else.
4279 <tag/Notes/<itemize>
4280 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4281 inline sequence generated by the macro will not work correctly for values
4282 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4283 this range. The non inline function may be accessed by <tt/#undef/'ing the
4285 <item>When compiling without <tt/-Os/, the function is only available as
4286 fastcall function, so it may only be used in presence of a prototype.
4288 <tag/Availability/ISO 9899
4290 <ref id="isalnum" name="isalnum">,
4291 <ref id="isalpha" name="isalpha">,
4292 <ref id="isascii" name="isascii">,
4293 <ref id="isblank" name="isblank">,
4294 <ref id="iscntrl" name="iscntrl">,
4295 <ref id="isdigit" name="isdigit">,
4296 <ref id="islower" name="islower">,
4297 <ref id="isprint" name="isprint">,
4298 <ref id="ispunct" name="ispunct">,
4299 <ref id="isspace" name="isspace">,
4300 <ref id="isupper" name="isupper">,
4301 <ref id="isxdigit" name="isxdigit">
4307 <sect1>islower<label id="islower"><p>
4311 <tag/Function/Check if a given character is a lower case letter.
4312 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4313 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
4314 <tag/Description/The function returns a non zero value if the given argument
4315 is a lower case letter. The return value is zero if the character is anything
4317 <tag/Notes/<itemize>
4318 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4319 inline sequence generated by the macro will not work correctly for values
4320 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4321 this range. The non inline function may be accessed by <tt/#undef/'ing the
4323 <item>When compiling without <tt/-Os/, the function is only available as
4324 fastcall function, so it may only be used in presence of a prototype.
4326 <tag/Availability/ISO 9899
4328 <ref id="isalnum" name="isalnum">,
4329 <ref id="isalpha" name="isalpha">,
4330 <ref id="isascii" name="isascii">,
4331 <ref id="isblank" name="isblank">,
4332 <ref id="iscntrl" name="iscntrl">,
4333 <ref id="isdigit" name="isdigit">,
4334 <ref id="isgraph" name="isgraph">,
4335 <ref id="isprint" name="isprint">,
4336 <ref id="ispunct" name="ispunct">,
4337 <ref id="isspace" name="isspace">,
4338 <ref id="isupper" name="isupper">,
4339 <ref id="isxdigit" name="isxdigit">
4345 <sect1>isprint<label id="isprint"><p>
4349 <tag/Function/Check if a given character is a printable character.
4350 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4351 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
4352 <tag/Description/The function returns a non zero value if the given argument
4353 is a printable character (this includes the space character). The return value
4354 is zero if the character is anything else.
4355 <tag/Notes/<itemize>
4356 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4357 inline sequence generated by the macro will not work correctly for values
4358 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4359 this range. The non inline function may be accessed by <tt/#undef/'ing the
4361 <item>When compiling without <tt/-Os/, the function is only available as
4362 fastcall function, so it may only be used in presence of a prototype.
4364 <tag/Availability/ISO 9899
4366 <ref id="isalnum" name="isalnum">,
4367 <ref id="isalpha" name="isalpha">,
4368 <ref id="isascii" name="isascii">,
4369 <ref id="isblank" name="isblank">,
4370 <ref id="iscntrl" name="iscntrl">,
4371 <ref id="isdigit" name="isdigit">,
4372 <ref id="isgraph" name="isgraph">,
4373 <ref id="islower" name="islower">,
4374 <ref id="ispunct" name="ispunct">,
4375 <ref id="isspace" name="isspace">,
4376 <ref id="isupper" name="isupper">,
4377 <ref id="isxdigit" name="isxdigit">
4383 <sect1>ispunct<label id="ispunct"><p>
4387 <tag/Function/Check if a given character is a printable character but not a
4388 space or an alphanumeric character.
4389 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4390 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
4391 <tag/Description/The function returns a non zero value if the given argument
4392 is a printable character, but not a space or anything alphanumeric. The return
4393 value is zero if the character is anything else.
4394 <tag/Notes/<itemize>
4395 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4396 inline sequence generated by the macro will not work correctly for values
4397 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4398 this range. The non inline function may be accessed by <tt/#undef/'ing the
4400 <item>When compiling without <tt/-Os/, the function is only available as
4401 fastcall function, so it may only be used in presence of a prototype.
4403 <tag/Availability/ISO 9899
4405 <ref id="isalnum" name="isalnum">,
4406 <ref id="isalpha" name="isalpha">,
4407 <ref id="isascii" name="isascii">,
4408 <ref id="isblank" name="isblank">,
4409 <ref id="iscntrl" name="iscntrl">,
4410 <ref id="isdigit" name="isdigit">,
4411 <ref id="isgraph" name="isgraph">,
4412 <ref id="islower" name="islower">,
4413 <ref id="isprint" name="isprint">,
4414 <ref id="isspace" name="isspace">,
4415 <ref id="isupper" name="isupper">,
4416 <ref id="isxdigit" name="isxdigit">
4422 <sect1>isspace<label id="isspace"><p>
4426 <tag/Function/Check if a given character is a white-space character.
4427 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4428 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
4429 <tag/Description/The function returns a non zero value if the given argument
4430 is a white space character. The return value is zero if the character is
4431 anything else. The standard white space characters are: space, formfeed ('\f'),
4432 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
4434 <tag/Notes/<itemize>
4435 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4436 inline sequence generated by the macro will not work correctly for values
4437 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4438 this range. The non inline function may be accessed by <tt/#undef/'ing the
4440 <item>When compiling without <tt/-Os/, the function is only available as
4441 fastcall function, so it may only be used in presence of a prototype.
4443 <tag/Availability/ISO 9899
4445 <ref id="isalnum" name="isalnum">,
4446 <ref id="isalpha" name="isalpha">,
4447 <ref id="isascii" name="isascii">,
4448 <ref id="isblank" name="isblank">,
4449 <ref id="iscntrl" name="iscntrl">,
4450 <ref id="isdigit" name="isdigit">,
4451 <ref id="isgraph" name="isgraph">,
4452 <ref id="islower" name="islower">,
4453 <ref id="isprint" name="isprint">,
4454 <ref id="ispunct" name="ispunct">,
4455 <ref id="isupper" name="isupper">,
4456 <ref id="isxdigit" name="isxdigit">
4462 <sect1>isupper<label id="isupper"><p>
4466 <tag/Function/Check if a given character is an upper case letter.
4467 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4468 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
4469 <tag/Description/The function returns a non zero value if the given argument
4470 is an upper case letter. The return value is zero if the character is anything
4472 <tag/Notes/<itemize>
4473 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4474 inline sequence generated by the macro will not work correctly for values
4475 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4476 this range. The non inline function may be accessed by <tt/#undef/'ing the
4478 <item>When compiling without <tt/-Os/, the function is only available as
4479 fastcall function, so it may only be used in presence of a prototype.
4481 <tag/Availability/ISO 9899
4483 <ref id="isalnum" name="isalnum">,
4484 <ref id="isalpha" name="isalpha">,
4485 <ref id="isascii" name="isascii">,
4486 <ref id="isblank" name="isblank">,
4487 <ref id="iscntrl" name="iscntrl">,
4488 <ref id="isdigit" name="isdigit">,
4489 <ref id="isgraph" name="isgraph">,
4490 <ref id="islower" name="islower">,
4491 <ref id="isprint" name="isprint">,
4492 <ref id="ispunct" name="ispunct">,
4493 <ref id="isspace" name="isspace">,
4494 <ref id="isxdigit" name="isxdigit">
4500 <sect1>isxdigit<label id="isxdigit"><p>
4504 <tag/Function/Check if a given character is a hexadecimal digit.
4505 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4506 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
4507 <tag/Description/The function returns a non zero value if the given argument
4508 is a hexadecimal digit (0..9, a..f and A..F). The return value is zero if the
4509 character is anything else.
4510 <tag/Notes/<itemize>
4511 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4512 inline sequence generated by the macro will not work correctly for values
4513 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4514 this range. The non inline function may be accessed by <tt/#undef/'ing the
4516 <item>When compiling without <tt/-Os/, the function is only available as
4517 fastcall function, so it may only be used in presence of a prototype.
4519 <tag/Availability/ISO 9899
4521 <ref id="isalnum" name="isalnum">,
4522 <ref id="isalpha" name="isalpha">,
4523 <ref id="isascii" name="isascii">,
4524 <ref id="isblank" name="isblank">,
4525 <ref id="iscntrl" name="iscntrl">,
4526 <ref id="isdigit" name="isdigit">,
4527 <ref id="isgraph" name="isgraph">,
4528 <ref id="islower" name="islower">,
4529 <ref id="isprint" name="isprint">,
4530 <ref id="ispunct" name="ispunct">,
4531 <ref id="isspace" name="isspace">,
4532 <ref id="isupper" name="isupper">
4538 <sect1>itoa<label id="itoa"><p>
4542 <tag/Function/Convert an integer into a string.
4543 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4544 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
4545 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
4546 <tt/radix/ as the base.
4547 <tag/Notes/<itemize>
4548 <item>There are no provisions to prevent a buffer overflow.
4549 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
4550 <item>The function is non standard, so it is not available in strict ANSI mode.
4551 You should probably use <tt/sprintf/ instead.
4552 <item>The function is only available as fastcall function, so it may only be
4553 used in presence of a prototype.
4555 <tag/Availability/cc65
4557 <ref id="atoi" name="atoi">,
4558 <ref id="atol" name="atol">,
4559 <ref id="ltoa" name="ltoa">,
4560 <ref id="ultoa" name="ultoa">,
4561 <ref id="utoa" name="utoa">
4567 <sect1>joy_count<label id="joy_count"><p>
4571 <tag/Function/Return the number of joysticks supported by the current driver.
4572 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4573 <tag/Declaration/<tt/unsigned char joy_count (void);/
4574 <tag/Description/The function returns a the number of joysticks supported
4575 by the current joystick driver.
4576 <tag/Notes/<itemize>
4577 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4578 name="joy_load_driver"> before calling this function.
4579 <item>The function returns the number of joysticks supported by the driver.
4580 There's no way to check for the number of actually connected joysticks.
4582 <tag/Availability/cc65
4584 <ref id="joy_load_driver" name="joy_load_driver">,
4585 <ref id="joy_read" name="joy_read">
4591 <sect1>joy_install<label id="joy_install"><p>
4595 <tag/Function/Install an already loaded driver and return an error code.
4596 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4597 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
4598 <tag/Description/The function installs a driver that was already loaded into
4599 memory (or linked statically to the program). It returns an error code
4600 (<tt/JOY_ERR_OK/ in case of success).
4601 <tag/Notes/<itemize>
4602 <item>The function is only available as fastcall function, so it may only be
4603 used in presence of a prototype.
4605 <tag/Availability/cc65
4607 <ref id="joy_load_driver" name="joy_load_driver">,
4608 <ref id="joy_uninstall" name="joy_uninstall">,
4609 <ref id="joy_unload" name="joy_unload">
4615 <sect1>joy_load_driver<label id="joy_load_driver"><p>
4619 <tag/Function/Load a driver from disk and install it.
4620 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4621 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
4622 <tag/Description/The function loads a driver with the given name from disk
4623 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
4624 driver was successfully loaded and installed.
4625 <tag/Notes/<itemize>
4626 <item>The function is only available as fastcall function, so it may only be
4627 used in presence of a prototype.
4629 <tag/Availability/cc65
4631 <ref id="joy_install" name="joy_install">,
4632 <ref id="joy_uninstall" name="joy_uninstall">,
4633 <ref id="joy_unload" name="joy_unload">
4639 <sect1>joy_read<label id="joy_read"><p>
4643 <tag/Function/Read the status of a joystick.
4644 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4645 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
4646 <tag/Description/The function reads the status bits for a joystick. The number
4647 of the joystick is passed as parameter. The result may be examined by using one
4648 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
4649 <tag/Notes/<itemize>
4650 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4651 name="joy_load_driver"> before calling this function.
4652 <item>The function is only available as fastcall function, so it may only be
4653 used in presence of a prototype.
4655 <tag/Availability/cc65
4657 <ref id="joy_count" name="joy_count">,
4658 <ref id="joy_load_driver" name="joy_load_driver">,
4659 <ref id="joy_unload" name="joy_unload">
4665 <sect1>joy_uninstall<label id="joy_uninstall"><p>
4669 <tag/Function/Uninstall the current joystick driver.
4670 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4671 <tag/Declaration/<tt/unsigned char joy_uninstall (void);/
4672 <tag/Description/The function uninstalls the currently installed joystick
4673 driver. It does not remove the driver from memory. The function returns an
4674 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4675 <tag/Notes/<itemize>
4676 <item>A joystick driver must be installed using <ref id="joy_install"
4677 name="joy_install"> before calling this function.
4679 <tag/Availability/cc65
4681 <ref id="joy_install" name="joy_install">,
4682 <ref id="joy_load_driver" name="joy_load_driver">,
4683 <ref id="joy_unload" name="joy_unload">
4689 <sect1>joy_unload<label id="joy_unload"><p>
4693 <tag/Function/Uninstall, then unload the current joystick driver.
4694 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4695 <tag/Declaration/<tt/unsigned char joy_unload (void);/
4696 <tag/Description/The function uninstalls the currently installed joystick
4697 driver and removes it from memory. An error code is returned, which is
4698 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4699 <tag/Notes/<itemize>
4700 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4701 name="joy_load_driver"> before calling this function.
4703 <tag/Availability/cc65
4705 <ref id="joy_load_driver" name="joy_load_driver">
4711 <sect1>kbhit<label id="kbhit"><p>
4715 <tag/Function/Check if there's a key waiting in the keyboard buffer.
4716 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4717 <tag/Declaration/<tt/unsigned char kbhit (void);/
4718 <tag/Description/The function returns a value of zero if there is no character
4719 waiting to be read from the keyboard. It returns non zero otherwise.
4720 <tag/Notes/<itemize>
4721 <item>If the system does not support a keyboard buffer (most systems
4722 do), the function is rather useless.
4724 <tag/Availability/cc65
4726 <ref id="cgetc" name="cgetc">,
4727 <ref id="cursor" name="cursor">
4733 <sect1>kbrepeat<label id="kbrepeat"><p>
4737 <tag/Function/Set the keyboard repeat mode.
4738 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
4739 <tag/Declaration/<tt/unsigned char __fastcall__ kbrepeat (unsigned char mode);/
4740 <tag/Description/This function changes which keys have automatic repeat when
4741 being held down for a certain time. Possible values are <tt/KBREPEAT_CURSOR/
4742 (repeat only cursor-related keys), <tt/KBREPEAT_NONE/ (no repeat for any
4743 keys), and <tt/KBREPEAT_ALL/ (repeat all keys). The old mode is returned, so
4744 it can be restored later.
4745 <tag/Notes/<itemize>
4746 <item>The function is available only as a fastcall function; so, it may be used
4747 only in the presence of a prototype.
4749 <tag/Availability/cc65
4755 <sect1>labs<label id="labs"><p>
4759 <tag/Function/Returns the absolute value of a long integer.
4760 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4761 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
4762 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
4764 <tag/Notes/<itemize>
4765 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
4766 <item>The function is only available as fastcall function, so it may only be
4767 used in presence of a prototype.
4769 <tag/Availability/ISO 9899
4771 <ref id="abs" name="abs">
4777 <sect1>ltoa<label id="ltoa"><p>
4781 <tag/Function/Convert a long integer into a string.
4782 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4783 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
4784 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
4785 using <tt/radix/ as the base.
4786 <tag/Notes/<itemize>
4787 <item>There are no provisions to prevent a buffer overflow.
4788 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
4789 <item>The function is non standard, so it is not available in strict ANSI mode.
4790 You should probably use <tt/sprintf/ instead.
4791 <item>The function is only available as fastcall function, so it may only be
4792 used in presence of a prototype.
4794 <tag/Availability/cc65
4796 <ref id="atoi" name="atoi">,
4797 <ref id="atol" name="atol">,
4798 <ref id="itoa" name="itoa">,
4799 <ref id="ultoa" name="ultoa">,
4800 <ref id="utoa" name="utoa">
4806 <sect1>localeconv<label id="localeconv"><p>
4810 <tag/Function/Returns a pointer to the current locale structure.
4811 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4812 <tag/Declaration/<tt/struct lconv* localeconv (void);/
4813 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
4815 <tag/Notes/<itemize>
4816 <item>cc65 supports only the "C" locale, so even after setting a new locale
4817 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
4820 <tag/Availability/ISO 9899
4822 <ref id="setlocale" name="setlocale">
4828 <sect1>longjmp<label id="longjmp"><p>
4832 <tag/Function/Non local goto.
4833 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4834 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
4835 <tag/Description/The <tt/longjmp/ function restores a program context from the
4836 data in <tt/buf/, which must have been set by a preceeding call to
4837 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
4838 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
4840 <tag/Notes/<itemize>
4841 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
4842 was called with a value of one.
4843 <item>The function is only available as fastcall function, so it may only
4844 be used in presence of a prototype.
4846 <tag/Availability/ISO 9899
4848 <ref id="setjmp" name="setjmp">
4854 <sect1>malloc<label id="malloc"><p>
4858 <tag/Function/Allocate dynamic memory.
4859 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4860 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
4861 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
4862 pointer to the allocated memory block. On error (not enough memory available),
4863 <tt/malloc/ returns <tt/NULL/.
4864 <tag/Notes/<itemize>
4865 <item>The function is only available as fastcall function, so it may only
4866 be used in presence of a prototype.
4868 <tag/Availability/ISO 9899
4870 <ref id="_heapadd" name="_heapadd">,
4871 <ref id="_heapblocksize" name="_heapblocksize">,
4872 <ref id="_heapmaxavail" name="_heapmaxavail">,
4873 <ref id="_heapmemavail" name="_heapmemavail">,
4874 <ref id="calloc" name="calloc">,
4875 <ref id="free" name="free">,
4876 <ref id="realloc" name="realloc">,
4877 <ref id="strdup" name="strdup">
4883 <sect1>memchr<label id="memchr"><p>
4887 <tag/Function/Search for a character in a block of raw memory.
4888 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4889 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
4890 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
4891 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
4892 that is of size <tt/count/. Upon completion, the function returns a pointer to
4893 the character found, or a null pointer if the character was not found.
4894 <tag/Notes/<itemize>
4895 <item>The function is only available as fastcall function, so it may only
4896 be used in presence of a prototype.
4898 <tag/Availability/ISO 9899
4900 <ref id="strchr" name="strchr">
4906 <sect1>memcmp<label id="memcmp"><p>
4910 <tag/Function/Compare two memory areas.
4911 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4912 <tag/Declaration/<tt/int __fastcall__ memcmp (const void* p1, const void* p2, size_t count);/
4913 <tag/Description/<tt/memcmp/ compares <tt/count/ bytes from the memory area
4914 pointed to by <tt/p1/ into the memory area pointed to by <tt/p2/. It returns a value that is less than
4915 zero if <tt/p1/ is less than <tt/p2/, zero if <tt/p1/ is the same as <tt/p2/,
4916 and a value greater than zero if <tt/p1/ is greater than <tt/p2/.
4917 <tag/Notes/<itemize>
4918 <item>The function is only available as fastcall function, so it may only
4919 be used in presence of a prototype.
4921 <tag/Availability/ISO 9899
4923 <ref id="strcmp" name="strcmp">,
4924 <ref id="memmove" name="memmove">,
4925 <ref id="memset" name="memset">
4931 <sect1>memcpy<label id="memcpy"><p>
4935 <tag/Function/Copy a memory area.
4936 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4937 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
4938 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
4939 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4941 <tag/Notes/<itemize>
4942 <item>The result is undefined if the memory areas do overlap. Use
4943 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
4944 <item>The function is only available as fastcall function, so it may only
4945 be used in presence of a prototype.
4947 <tag/Availability/ISO 9899
4949 <ref id="_swap" name="_swap">,
4950 <ref id="memmove" name="memmove">,
4951 <ref id="memset" name="memset">
4957 <sect1>memmove<label id="memmove"><p>
4961 <tag/Function/Copy a memory area.
4962 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4963 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
4964 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
4965 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4967 <tag/Notes/<itemize>
4968 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
4969 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
4970 <item>The function is only available as fastcall function, so it may only
4971 be used in presence of a prototype.
4973 <tag/Availability/ISO 9899
4975 <ref id="_swap" name="_swap">,
4976 <ref id="memcpy" name="memcpy">,
4977 <ref id="memset" name="memset">
4983 <sect1>memset<label id="memset"><p>
4987 <tag/Function/Fill a memory area.
4988 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4989 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
4990 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
4991 the value <tt/val/. The function returns <tt/p/.
4992 <tag/Notes/<itemize>
4993 <item>The function is only available as fastcall function, so it may only
4994 be used in presence of a prototype.
4996 <tag/Availability/ISO 9899
4998 <ref id="_swap" name="_swap">,
4999 <ref id="bzero" name="bzero">,
5000 <ref id="memcpy" name="memcpy">,
5001 <ref id="memmove" name="memmove">
5007 <sect1>mod_free<label id="mod_free"><p>
5011 <tag/Function/Free a relocatable module.
5012 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
5013 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
5014 <tag/Description/The function will free a module loaded into memory by use of
5015 the <tt/<ref id="mod_load" name="mod_load">/ function.
5016 <tag/Notes/<itemize>
5017 <item>The pointer passed as parameter is the pointer to the module memory,
5018 not the pointer to the control structure.
5019 <item>The function is available only as a fastcall function; so, it may be used
5020 only in the presence of a prototype.
5022 <tag/Availability/cc65
5024 <ref id="mod_load" name="mod_load">
5030 <sect1>mod_load<label id="mod_load"><p>
5034 <tag/Function/Load a relocatable module.
5035 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
5036 <tag/Declaration/<tt/unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl);/
5037 <tag/Description/The function will load a code module into memory and relocate
5038 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
5039 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
5040 the module just loaded. Possible error codes are:
5042 <item><tt/MLOAD_OK/ - Module load successful
5043 <item><tt/MLOAD_ERR_READ/ - Read error
5044 <item><tt/MLOAD_ERR_HDR/ - Header error
5045 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
5046 <item><tt/MLOAD_ERR_FMT/ - Data format error
5047 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
5049 <tag/Notes/<itemize>
5050 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
5051 relocatable o65 modules for use with this function.
5052 <item>The function is available only as a fastcall function; so, it may be used
5053 only in the presence of a prototype.
5055 <tag/Availability/cc65
5057 <ref id="mod_free" name="mod_free">
5063 <sect1>mouse_setbox<label id="mouse_setbox"><p>
5067 <tag/Function/Specify a bounding box for the mouse cursor.
5068 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5069 <tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
5070 <tag/Description/The function allows to set a bounding box for mouse movement.
5071 <tag/Notes/<itemize>
5072 <item>The function does not check if the mouse cursor is currently within the
5073 given rectangle. Placing the mouse cursor within the bounding box is the
5074 responsibility of the programmer.
5075 <item>While the bounding box may be larger than the actual screen size, the
5076 standard mouse cursor draw routines may fail to set the cursor to coordinates
5077 outside of the screen area. Depending on the platform, you may have to supply
5078 your own mouse cursor routines.
5079 <item>The function is only available as fastcall function, so it may only be
5080 used in presence of a prototype.
5082 <tag/Availability/cc65
5084 <ref id="mouse_getbox" name="mouse_getbox">,
5085 <ref id="mouse_move" name="mouse_move">
5091 <sect1>mouse_getbox<label id="mouse_getbox"><p>
5095 <tag/Function/Return the current bounding box for the mouse cursor.
5096 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5097 <tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
5098 <tag/Description/The function queries the current bounding box for mouse
5100 <tag/Notes/<itemize>
5101 <item>The function is only available as fastcall function, so it may only be
5102 used in presence of a prototype.
5104 <tag/Availability/cc65
5106 <ref id="mouse_move" name="mouse_move">,
5107 <ref id="mouse_setbox" name="mouse_setbox">
5113 <sect1>mouse_buttons<label id="mouse_buttons"><p>
5117 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
5118 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5119 <tag/Declaration/<tt/unsigned char mouse_buttons (void);/
5120 <tag/Description/The function returns a bit mask that encodes the state of the
5121 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
5123 <tag/Availability/cc65
5125 <ref id="mouse_info" name="mouse_info">,
5126 <ref id="mouse_pos" name="mouse_pos">
5132 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
5136 <tag/Function/Return a readable error message for an error code.
5137 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5138 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
5140 <tag/Description/The function returns an error message (in english) for the
5141 error code passed parameter.
5142 <tag/Notes/<itemize>
5143 <item>The function will return "Unknown error" for invalid error codes.
5144 <item>The function is only available as fastcall function, so it may only be
5145 used in presence of a prototype.
5147 <tag/Availability/cc65
5149 <ref id="mouse_load_driver" name="mouse_load_driver">,
5150 <ref id="mouse_uninstall" name="mouse_uninstall">,
5151 <ref id="mouse_unload" name="mouse_unload">
5157 <sect1>mouse_hide<label id="mouse_hide"><p>
5161 <tag/Function/Hide the mouse pointer.
5162 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5163 <tag/Declaration/<tt/void mouse_hide (void);/
5164 <tag/Description/The function hides the mouse pointer. It manages a counter
5165 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
5166 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
5167 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
5169 <tag/Availability/cc65
5171 <ref id="mouse_show" name="mouse_show">
5177 <sect1>mouse_info<label id="mouse_info"><p>
5181 <tag/Function/Return the state of the mouse buttons and the position of the
5183 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5184 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
5185 <tag/Description/The function returns the state of the mouse buttons and the
5186 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
5187 <tag/Notes/<itemize>
5188 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
5189 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
5190 name="mouse_pos">/ instead.
5191 <item>The function is only available as fastcall function, so it may only be
5192 used in presence of a prototype.
5194 <tag/Availability/cc65
5196 <ref id="mouse_buttons" name="mouse_buttons">,
5197 <ref id="mouse_pos" name="mouse_pos">
5203 <sect1>mouse_install<label id="mouse_install"><p>
5207 <tag/Function/Install an already loaded mouse driver.
5208 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5209 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
5210 mouse_callbacks* c, void* driver);/
5211 <tag/Description/The function installs an already loaded mouse driver and
5212 returns an error code. The <tt/mouse_callbacks/ structure passed as first
5213 parameter contains pointers to routines needed to move or hide/show the mouse
5214 pointer. Defaults for these routines are supplied by the library, so if you
5215 can live with these defaults (which are platform specific), just pass a
5216 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
5217 driver linked statically to the program.
5218 <tag/Notes/<itemize>
5219 <item>Not all drivers are able to detect if the supported hardware is really
5221 <item>After installing a driver, the mouse cursor is hidden.
5222 <item>The function is only available as fastcall function, so it may only be
5223 used in presence of a prototype.
5225 <tag/Availability/cc65
5227 <ref id="mouse_load_driver" name="mouse_load_driver">,
5228 <ref id="mouse_uninstall" name="mouse_uninstall">,
5229 <ref id="mouse_unload" name="mouse_unload">
5235 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
5239 <tag/Function/Call the driver specific ioctl function.
5240 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5241 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
5242 <tag/Description/The function calls the IOCTL entry in the mouse driver,
5243 which is driver specific. The <tt/code/ parameter will choose between
5244 different IOCTL functions, and the <tt/data/ depends on code. The
5245 function returns an error code. The purpose of this function is to allow
5246 for driver specific extensions. See the documentation for a specific mouse
5247 driver for supported ioctl calls.
5248 <tag/Notes/<itemize>
5249 <item>Calling this function is non portable, because each driver may
5250 implement different ioctl calls (or none at all).
5251 <item>The function is only available as fastcall function, so it may only be
5252 used in presence of a prototype.
5254 <tag/Availability/cc65
5260 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
5264 <tag/Function/Load and initialize a mouse driver.
5265 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5266 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
5267 mouse_callbacks* c, const char* driver);/
5268 <tag/Description/Load a mouse driver into memory and initialize it. The
5269 function returns an error code that tells if the call has been successful. The
5270 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
5271 routines needed to move or hide/show the mouse pointer. Defaults for these
5272 routines are supplied by the library, so if you can live with these defaults
5273 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
5274 <tag/Notes/<itemize>
5275 <item>The driver is loaded by name, so currently you must know the type of
5276 mouse that should be supported. There is no autodetect capability.
5277 <item>Not all drivers are able to detect if the supported hardware is really
5279 <item>After installing a driver, the mouse cursor is hidden.
5280 <item>The function is only available as fastcall function, so it may only be
5281 used in presence of a prototype.
5283 <tag/Availability/cc65
5285 <ref id="mouse_install" name="mouse_install">,
5286 <ref id="mouse_uninstall" name="mouse_uninstall">,
5287 <ref id="mouse_unload" name="mouse_unload">
5293 <sect1>mouse_move<label id="mouse_move"><p>
5297 <tag/Function/Move the mouse cursor to a specific position.
5298 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5299 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
5300 <tag/Description/The function updates the mouse position. If the mouse cursor
5301 is visible, it is shown at the new position.
5302 <tag/Notes/<itemize>
5303 <item>The function does not check if the new position is within the bounding
5304 box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
5305 <item>The function is only available as fastcall function, so it may only be
5306 used in presence of a prototype.
5308 <tag/Availability/cc65
5310 <ref id="mouse_getbox" name="mouse_getbox">,
5311 <ref id="mouse_setbox" name="mouse_setbox">
5317 <sect1>mouse_pos<label id="mouse_pos"><p>
5321 <tag/Function/Return the position of the mouse.
5322 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5323 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
5324 <tag/Description/The function returns the position of the mouse in the
5325 <tt/mouse_pos/ structure passed as parameter.
5326 <tag/Notes/<itemize>
5327 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
5328 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
5329 name="mouse_info">/ instead.
5330 <item>The function is only available as fastcall function, so it may only be
5331 used in presence of a prototype.
5333 <tag/Availability/cc65
5335 <ref id="mouse_buttons" name="mouse_buttons">,
5336 <ref id="mouse_info" name="mouse_info">
5342 <sect1>mouse_show<label id="mouse_show"><p>
5346 <tag/Function/Show the mouse pointer.
5347 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5348 <tag/Declaration/<tt/void mouse_show (void);/
5349 <tag/Description/The function shows the mouse pointer. It manages a counter
5350 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
5351 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
5352 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
5353 <tag/Availability/cc65
5355 <ref id="mouse_hide" name="mouse_hide">
5361 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
5365 <tag/Function/Uninstall an already loaded mouse driver.
5366 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5367 <tag/Declaration/<tt/unsigned char mouse_uninstall (void);/
5368 <tag/Description/The function uninstalls an already loaded mouse driver but
5369 don't removes it from memory.
5370 <tag/Notes/<itemize>
5371 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
5372 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
5373 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
5376 <tag/Availability/cc65
5378 <ref id="mouse_install" name="mouse_install">,
5379 <ref id="mouse_load_driver" name="mouse_load_driver">,
5380 <ref id="mouse_unload" name="mouse_unload">
5386 <sect1>mouse_unload<label id="mouse_unload"><p>
5390 <tag/Function/Unload a mouse driver.
5391 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5392 <tag/Declaration/<tt/unsigned char mouse_unload (void);/
5393 <tag/Description/The function unloads a loaded mouse driver and frees all
5394 memory allocated for the driver.
5395 <tag/Notes/<itemize>
5396 <item>The function does nothing if no driver is loaded.
5398 <tag/Availability/cc65
5400 <ref id="mouse_install" name="mouse_install">,
5401 <ref id="mouse_load_driver" name="mouse_load_driver">,
5402 <ref id="mouse_uninstall" name="mouse_uninstall">
5408 <sect1>offsetof<label id="offsetof"><p>
5412 <tag/Function/Calculate the offset of a struct or union member.
5413 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
5414 <tag/Declaration/<tt/size_t offsetof (type, member);/
5415 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
5416 or <tt/union/ member.
5417 <tag/Notes/<itemize>
5418 <item>The function is actually a macro.
5420 <tag/Availability/ISO 9899
5426 <sect1>open<label id="open"><p>
5430 <tag/Function/Open and possibly create a file.
5431 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
5432 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
5433 <tag/Description/<tt/open/ opens a file and returns the file descriptor
5434 associated with it. On error, -1 is returned and an error code is stored in
5435 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
5436 <tag/Notes/<itemize>
5437 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
5438 open, which is used as the permission mask when a new file is created. While
5439 cc65 allows to pass this argument, it is ignored.
5441 <tag/Availability/POSIX 1003.1
5443 <ref id="close" name="close">,
5444 <ref id="creat" name="creat">
5450 <sect1>opendir<label id="opendir"><p>
5454 <tag/Function/Open a directory.
5455 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5456 <tag/Declaration/<tt/DIR* __fastcall__ opendir (const char* name);/
5457 <tag/Description/<tt/opendir/ opens a directory and returns the direcory
5458 descriptor associated with it. On error, NULL is returned and an error code is
5459 stored in <tt/errno/.
5460 <tag/Notes/<itemize>
5461 <item>The function is only available as fastcall function, so it may only
5462 be used in presence of a prototype.
5464 <tag/Availability/POSIX 1003.1
5466 <ref id="closedir" name="closedir">,
5467 <ref id="readdir" name="readdir">
5473 <sect1>peekbsys<label id="peekbsys"><p>
5477 <tag/Function/Read one byte from a location in the system bank.
5478 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5479 <tt/<ref id="cbm510.h" name="cbm510.h">/
5480 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
5481 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
5482 system bank (bank 15) of the CBM PET-II machines and returns it.
5483 <tag/Notes/<itemize>
5484 <item>The function is only available as fastcall function, so it may only
5485 be used in presence of a prototype.
5486 <item>This function may be a macro depending on the compiler options. The
5487 actual function is accessible by #undef'ing the macro.
5489 <tag/Availability/cc65
5491 <ref id="PEEK" name="PEEK">,
5492 <ref id="PEEKW" name="PEEKW">,
5493 <ref id="peekwsys" name="peekwsys">,
5494 <ref id="pokebsys" name="pokebsys">,
5495 <ref id="pokewsys" name="pokewsys">
5501 <sect1>peekwsys<label id="peekwsys"><p>
5505 <tag/Function/Read one word from a location in the system bank.
5506 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5507 <tt/<ref id="cbm510.h" name="cbm510.h">/
5508 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
5509 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
5510 system bank (bank 15) of the CBM PET-II machines and returns it. Following
5511 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
5512 high byte is read from <tt/addr+1/.
5513 <tag/Notes/<itemize>
5514 <item>The function is only available as fastcall function, so it may only
5515 be used in presence of a prototype.
5516 <item>The order in which the two bytes are read is undefined.
5518 <tag/Availability/cc65
5520 <ref id="PEEK" name="PEEK">,
5521 <ref id="PEEKW" name="PEEKW">,
5522 <ref id="peekbsys" name="peekbsys">,
5523 <ref id="pokebsys" name="pokebsys">,
5524 <ref id="pokewsys" name="pokewsys">
5530 <sect1>perror<label id="perror"><p>
5534 <tag/Function/Print an error message for the error in <tt/errno/.
5535 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5536 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
5537 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
5538 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
5539 a blank. Then the error message for the current contents of <tt/errno/ is
5540 printed followed by a newline. The message output is the same as returned by
5541 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
5542 <tag/Notes/<itemize>
5543 <item>The function is only available as fastcall function, so it may only
5544 be used in presence of a prototype.
5546 <tag/Availability/ISO 9899
5548 <ref id="_poserror" name="_poserror">,
5549 <ref id="strerror" name="strerror">
5555 <sect1>pokebsys<label id="pokebsys"><p>
5559 <tag/Function/Write one byte to a location in the system bank.
5560 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5561 <tt/<ref id="cbm510.h" name="cbm510.h">/
5562 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
5563 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
5564 system bank (bank 15) of the CBM PET-II machines.
5565 <tag/Notes/<itemize>
5566 <item>The function is only available as fastcall function, so it may only
5567 be used in presence of a prototype.
5569 <tag/Availability/cc65
5571 <ref id="POKE" name="POKE">,
5572 <ref id="POKEW" name="POKEW">,
5573 <ref id="peekbsys" name="peekbsys">,
5574 <ref id="peekwsys" name="peekwsys">,
5575 <ref id="pokewsys" name="pokewsys">
5581 <sect1>pokewsys<label id="pokewsys"><p>
5585 <tag/Function/Write one word to a location in the system bank.
5586 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5587 <tt/<ref id="cbm510.h" name="cbm510.h">/
5588 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
5589 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
5590 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
5591 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
5592 high byte is written to <tt/addr+1/.
5593 <tag/Notes/<itemize>
5594 <item>The function is only available as fastcall function, so it may only
5595 be used in presence of a prototype.
5596 <item>The order in which the two bytes are written is undefined.
5598 <tag/Availability/cc65
5600 <ref id="POKE" name="POKE">,
5601 <ref id="POKEW" name="POKEW">,
5602 <ref id="peekbsys" name="peekbsys">,
5603 <ref id="peekwsys" name="peekwsys">,
5604 <ref id="pokebsys" name="pokebsys">
5610 <sect1>qsort<label id="qsort"><p>
5614 <tag/Function/Sort an array.
5615 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5616 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
5617 size_t size, int __fastcall__ (* compare) (const void*, const void*));/
5618 <tag/Description/<tt/qsort/ sorts an array according to a given compare
5619 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
5620 is the number of elements, <tt/size/ the size of an element and <tt/compare/
5621 the function used to compare the members.
5622 <tag/Notes/<itemize>
5623 <item>If there are multiple members with the same key, the order after calling
5624 the function is undefined.
5625 <item>The function is only available as fastcall function, so it may only
5626 be used in presence of a prototype.
5627 <item>The function to which <tt/compare/ points must have the <tt/fastcall/
5630 <tag/Availability/ISO 9899
5632 <ref id="bsearch" name="bsearch">
5638 <sect1>raise<label id="raise"><p>
5642 <tag/Function/Send a signal to the executing program.
5643 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
5644 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
5645 <tag/Description/<tt/raise/ sends the given signal to the program. If the
5646 program has installed a signal handler for the signal, this signal handler
5647 will be executed. If no handler has been installed, the default action for
5648 the raised signal will be taken. The function returns zero on success,
5650 <tag/Notes/<itemize>
5651 <item>The function is only available as fastcall function, so it may only
5652 be used in presence of a prototype.
5654 <tag/Availability/ISO 9899
5656 <ref id="abort" name="abort">,
5657 <ref id="signal" name="signal">
5663 <sect1>rand<label id="rand"><p>
5667 <tag/Function/Return a pseudo random number.
5668 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5669 <tag/Declaration/<tt/int rand (void);/
5670 <tag/Description/The function returns a pseudo random number
5671 between 0 and <tt/RAND_MAX/ (exclusive).
5672 <tag/Notes/<itemize>
5673 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
5674 flow of numbers is generated.
5675 <item>On startup, the function behaves as if <ref id="srand" name="srand">
5676 had been used with an argument of 1.
5678 <tag/Availability/ISO 9899
5680 <ref id="_randomize" name="_randomize">,
5681 <ref id="srand" name="srand">
5687 <sect1>readdir<label id="readdir"><p>
5691 <tag/Function/Read a directory.
5692 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5693 <tag/Declaration/<tt/struct dirent* __fastcall__ readdir (DIR* dir);/
5694 <tag/Description/<tt/readdir/ reads the next directory entry from the directory
5695 stream pointed to by <tt/dir/. It stores the data in a <tt/dirent/ structure
5696 and returns a pointer to it. If the end of directory is reached, or an error
5697 occurs, NULL is returned. In case of errors, an error code is stored into
5699 <tag/Notes/<itemize>
5700 <item>The function is only available as fastcall function, so it may only
5701 be used in presence of a prototype.
5702 <item>The returned pointer may point to a statically allocated instance of
5703 <tt/struct dirent/, so it may get overwritten by subsequent calls to
5705 <item>On several platforms, namely the CBMs and the Atari, the disk drives get
5706 confused when opening/closing files between directory reads. So for example a
5707 program that reads the list of files on a disk, and after each call to
5708 <tt/readdir/, opens the file to process it, will fail.<newline>
5709 Possible solutions are reading the directory into memory before processing the
5710 file list, or to reset the directory by seeking to the correct position after
5711 opening/closing a file:
5713 seekdir (DIR, telldir (DIR));
5715 Platforms known to work without problems are: Apple.
5717 <tag/Availability/POSIX 1003.1
5719 <ref id="closedir" name="closedir">,
5720 <ref id="opendir" name="opendir">
5726 <sect1>realloc<label id="realloc"><p>
5730 <tag/Function/Change the size of an allocated memory block.
5731 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5732 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
5733 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
5734 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
5735 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
5736 behaves as if <tt/free/ had been called. On error (not enough memory
5737 available), <tt/realloc/ returns <tt/NULL/.
5738 <tag/Notes/<itemize>
5739 <item>The part of the memory block that is returned will have its contents
5741 <item>This function is somewhat dangerous to use. Be careful to save the
5742 pointer you're passing somewhere else, otherwise
5744 ptr = realloc (ptr, size);
5746 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
5747 <item>The function is only available as fastcall function, so it may only
5748 be used in presence of a prototype.
5750 <tag/Availability/ISO 9899
5752 <ref id="_heapadd" name="_heapadd">,
5753 <ref id="_heapblocksize" name="_heapblocksize">,
5754 <ref id="_heapmaxavail" name="_heapmaxavail">,
5755 <ref id="_heapmemavail" name="_heapmemavail">,
5756 <ref id="calloc" name="calloc">,
5757 <ref id="free" name="free">,
5758 <ref id="realloc" name="realloc">
5764 <sect1>remove<label id="remove"><p>
5768 <tag/Function/Delete a file.
5769 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5770 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
5771 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
5772 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5773 code describing the reason for the failure.
5774 <tag/Notes/<itemize>
5775 <item>This function is not available on all cc65 targets (depends on the
5776 availability of file I/O).
5777 <item>The function is only available as fastcall function, so it may only
5778 be used in presence of a prototype.
5780 <tag/Availability/ISO 9899
5782 <ref id="rename" name="rename">,
5783 <ref id="unlink" name="unlink">
5786 #include <stdio.h>
5788 #define FILENAME "helloworld"
5790 if (remove (FILENAME) == 0) {
5791 printf ("We deleted %s successfully\n", FILENAME);
5793 printf ("There was a problem deleting %s\n", FILENAME);
5800 <sect1>rename<label id="rename"><p>
5804 <tag/Function/Rename a file.
5805 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5806 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
5807 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
5808 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5809 code describing the reason for the failure.
5810 <tag/Notes/<itemize>
5811 <item>This function is not available on all cc65 targets (depends on the
5812 capabilities of the storage devices).
5813 <item>The function is only available as fastcall function, so it may only
5814 be used in presence of a prototype.
5816 <tag/Availability/ISO 9899
5818 <ref id="remove" name="remove">
5821 #include <stdio.h>
5823 #define OLDNAME "textfile.txt"
5824 #define NEWNAME "textfile.bak"
5826 if (rename (OLDNAME, NEWNAME) == 0) {
5827 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
5829 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
5836 <sect1>reset_brk<label id="reset_brk"><p>
5840 <tag/Function/Resets the break vector to its original value.
5841 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5842 <tag/Declaration/<tt/void reset_brk (void);/
5843 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
5844 before a call to <tt/set_brk/.
5845 <tag/Notes/<itemize>
5846 <item>The break vector is reset on program termination, so it's not strictly
5847 necessary to call this function as a part of your clean-up when exitting the program.
5849 <tag/Availability/cc65
5851 <ref id="reset_irq" name="reset_irq">,
5852 <ref id="set_brk" name="set_brk">,
5853 <ref id="set_irq" name="set_irq">
5859 <sect1>reset_irq<label id="reset_irq"><p>
5863 <tag/Function/Resets the C level interrupt request vector.
5864 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5865 <tag/Declaration/<tt/void reset_irq (void);/
5866 <tag/Description/<tt/reset_irq/ resets the C level interrupt request vector.
5867 <tag/Notes/<itemize>
5868 <item>The interrupt vector is reset on program termination, so it's not strictly
5869 necessary to call this function as a part of your clean-up when exitting the program.
5871 <tag/Availability/cc65
5873 <ref id="reset_brk" name="reset_brk">,
5874 <ref id="set_brk" name="set_brk">,
5875 <ref id="set_irq" name="set_irq">
5881 <sect1>revers<label id="revers"><p>
5885 <tag/Function/Control revers character display.
5886 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5887 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
5888 <tag/Description/If the argument is non zero, the function enables reverse
5889 character display. If the argument is zero, reverse character display is
5890 switched off. The old value of the setting is returned.
5891 <tag/Notes/<itemize>
5892 <item>The function may not be supported by the hardware, in which case
5893 the call is ignored.
5894 <item>The function is only available as fastcall function, so it may only
5895 be used in presence of a prototype.
5897 <tag/Availability/cc65
5899 <ref id="textcolor" name="textcolor">
5905 <sect1>rewinddir<label id="rewinddir"><p>
5909 <tag/Function/Reset a directory stream.
5910 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5911 <tag/Declaration/<tt/void __fastcall__ rewinddir (DIR* dir);/
5912 <tag/Description/<tt/rewinddir/ sets the position of the directory stream
5913 pointed to by <tt/dir/ to the start of the directory.
5914 <tag/Notes/<itemize>
5915 <item>The function is only available as fastcall function, so it may only
5916 be used in presence of a prototype.
5918 <tag/Availability/POSIX 1003.1
5920 <ref id="seekdir" name="seekdir">,
5921 <ref id="telldir" name="telldir">
5927 <sect1>screensize<label id="screensize"><p>
5931 <tag/Function/Return the dimensions of the text mode screen.
5932 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5933 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
5934 <tag/Description/The function returns the dimensions of the text mode screen.
5935 <tag/Notes/<itemize>
5936 <item>The function is only available as fastcall function, so it may only
5937 be used in presence of a prototype.
5939 <tag/Availability/cc65
5941 <ref id="gotox" name="gotox">,
5942 <ref id="gotoxy" name="gotoxy">,
5943 <ref id="gotoy" name="gotoy">,
5944 <ref id="wherex" name="wherex">,
5945 <ref id="wherey" name="wherey">
5951 <sect1>seekdir<label id="seekdir"><p>
5955 <tag/Function/Set the position of a directory stream.
5956 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5957 <tag/Declaration/<tt/void __fastcall__ seekdir (DIR* dir, long offset);/
5958 <tag/Description/<tt/seekdir/ sets the position of the directory stream
5959 pointed to by <tt/dir/ to the value given in <tt/offset/, which should be a
5960 value returned by <tt/<ref id="telldir" name="telldir">/.
5961 <tag/Notes/<itemize>
5962 <item>The function is only available as fastcall function, so it may only
5963 be used in presence of a prototype.
5965 <tag/Availability/POSIX 1003.1
5967 <ref id="rewinddir" name="rewinddir">,
5968 <ref id="telldir" name="telldir">
5974 <sect1>ser_close<label id="ser_close"><p>
5978 <tag/Function/Close the port and disable interrupts
5979 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5980 <tag/Declaration/<tt/unsigned char ser_close (void);/
5981 <tag/Description/Close the port by clearing buffers and disable interrupts.
5982 <tag/Availability/cc65
5983 <tag/See also/Other serial functions.
5988 static void initialize(){
5989 struct ser_params params = {
5996 ser_install(lynx_comlynx); // This will activate the ComLynx
5998 ser_open(&params);
6005 <sect1>ser_get<label id="ser_get"><p>
6009 <tag/Function/Read a character from serial port.
6010 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6011 <tag/Declaration/<tt/unsigned char __fastcall__ ser_get (char* b);/
6012 <tag/Description/Get a character from the serial port. If no characters are
6013 available, the function will return SER_ERR_NO_DATA, so this is not a fatal
6015 <tag/Notes/<itemize>
6016 <item>The function is only available as fastcall function, so it may only
6017 be used in presence of a prototype.
6019 <tag/Availability/cc65
6020 <tag/See also/Other serial functions.
6022 Wait for a character to be available from a serial port.
6025 while (ser_get(&ch) == SER_ERR_NO_DATA)
6032 <sect1>ser_install<label id="ser_install"><p>
6036 <tag/Function/Install an already loaded driver and return an error code.
6037 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6038 <tag/Declaration/<tt/unsigned char __fastcall__ ser_install (void* driver);/
6039 <tag/Description/The function installs a driver that was already loaded into
6040 memory (or linked statically to the program). It returns an error code
6041 (<tt/SER_ERR_OK/ in case of success).
6042 <tag/Notes/<itemize>
6043 <item>The function is only available as fastcall function, so it may only be
6044 used in presence of a prototype.
6046 <tag/Availability/cc65
6048 <ref id="ser_load_driver" name="ser_load_driver">,
6049 <ref id="ser_uninstall" name="ser_uninstall">,
6050 <ref id="ser_unload" name="ser_unload">
6052 ser_install(lynx_comlynx); //Include the driver statically instead of loading it.
6058 <sect1>ser_ioctl<label id="ser_ioctl"><p>
6062 <tag/Function/Platform dependent code extensions.
6063 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6064 <tag/Declaration/<tt/unsigned __fastcall__ ser_ioctl (unsigned char code, void* data);/
6065 <tag/Description/Some platforms have extra serial functions that are not
6066 supported by standard serial driver functions. You can extend the driver to support
6067 this extra functionality bt using ser_ioctl functions.
6068 <tag/Notes/<itemize>
6069 <item>The function is only available as fastcall function, so it may only
6070 be used in presence of a prototype.
6071 <item>These functions are not easily portable to other cc65 platforms.
6073 <tag/Availability/cc65
6074 <tag/See also/Other serial functions.
6079 <sect1>ser_load_driver<label id="ser_load_driver"><p>
6083 <tag/Function/Load and install a serial driver.
6084 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6085 <tag/Declaration/<tt/unsigned char __fastcall__ ser_load_driver (const char *name);/
6086 <tag/Description/Load and install the driver by name.
6087 Will just load the driver and check if loading was successful.
6088 <tag/Notes/<itemize>
6089 <item>The function is only available as fastcall function, so it may only
6090 be used in presence of a prototype.
6092 <tag/Availability/cc65
6093 <tag/See also/Other serial functions.
6099 <sect1>ser_open<label id="ser_open"><p>
6103 <tag/Function/Open the port by setting the port parameters and enable interrupts
6104 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6105 <tag/Declaration/<tt/unsigned char __fastcall__ ser_open (const struct ser_params* params);/
6106 <tag/Description/Open the port by setting the port parameters and enable interrupts.
6107 <tag/Notes/<itemize>
6108 <item>The function is only available as fastcall function, so it may only
6109 be used in presence of a prototype.
6111 <tag/Availability/cc65
6112 <tag/See also/Other serial functions.
6117 static void initialize(){
6118 struct ser_params params = {
6125 ser_install(lynx_comlynx); // This will activate the ComLynx
6127 ser_open(&params);
6134 <sect1>ser_put<label id="ser_put"><p>
6138 <tag/Function/Write a character to a serial port.
6139 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6140 <tag/Declaration/<tt/unsigned char __fastcall__ ser_put (char b);/
6141 <tag/Description/Send a character via the serial port. There is a transmit
6142 buffer, but transmitting is not done via interrupt. The function returns
6143 SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
6144 <tag/Notes/<itemize>
6145 <item>The function is only available as fastcall function, so it may only
6146 be used in presence of a prototype.
6148 <tag/Availability/cc65
6149 <tag/See also/Other serial functions.
6158 <sect1>ser_status<label id="ser_status"><p>
6162 <tag/Function/Return the serial port status.
6163 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6164 <tag/Declaration/<tt/unsigned char __fastcall__ ser_status (unsigned char* status);/
6165 <tag/Description/Return the serial port status.
6166 <tag/Notes/<itemize>
6167 <item>The function is only available as fastcall function, so it may only
6168 be used in presence of a prototype.
6170 <tag/Availability/cc65
6171 <tag/See also/Other serial functions.
6177 <sect1>ser_uninstall<label id="ser_uninstall"><p>
6181 <tag/Function/Uninstall the currently loaded driver but do not unload it.
6182 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6183 <tag/Declaration/<tt/unsigned char ser_uninstall (void);/
6184 <tag/Description/Uninstall the currently loaded driver but do not unload it.
6185 <tag/Availability/cc65
6186 <tag/See also/Other serial functions.
6191 <sect1>ser_unload<label id="ser_unload"><p>
6195 <tag/Function/Uninstall, then unload the currently loaded driver.
6196 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6197 <tag/Declaration/<tt/unsigned char ser_unload (void);/
6198 <tag/Description/Uninstall, then unload the currently loaded driver.
6199 <tag/Availability/cc65
6200 <tag/See also/Other serial functions.
6206 <sect1>set_brk<label id="set_brk"><p>
6210 <tag/Function/Set the break vector to a user function.
6211 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
6212 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
6213 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
6214 program code by letting the vector point to a user written C function. The
6215 runtime library installs a small stub that saves the registers into global
6216 variables that may be accessed (and changed) by the break handler.
6217 <tag/Notes/<itemize>
6218 <item>The function is only available as fastcall function, so it may only
6219 be used in presence of a prototype.
6220 <item>The stub saves the zero page registers used by the C runtime and switches
6221 to a small break handler stack. This means that it is safe to execute C code,
6222 even if C code was interrupted. Be careful however not to use too many local
6223 variables, and do not enable stack checks for the handler function or any other
6224 function called from it.
6225 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
6226 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
6227 otherwise the <tt/BRK/ instruction will get executed over and over again.
6228 <item>The break vector is reset on program termination, so it's not strictly
6229 necessary to call <tt/<ref id="reset_brk" name="reset_brk">/ as a part of your
6230 clean-up when exitting the program.
6232 <tag/Availability/cc65
6234 <ref id="reset_brk" name="reset_brk">
6240 <sect1>set_irq<label id="set_irq"><p>
6244 <tag/Function/Set the C level interrupt request vector to the given address.
6245 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
6246 <tag/Declaration/<tt/void __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);/
6247 <tag/Description/<tt/set_irq/ allows a user program to handle interrupt requests
6248 (IRQs) within the program code by letting the vector point to a user written C
6249 function. The runtime library installs a small stub that saves the zero page
6250 registers used by the C runtime before calling the handler function and restores
6251 them after the handler function returns. Additionally the stub temporarily switches
6252 the C runtime stack to the stack area provided as parameter. If the handler function
6253 was set up to handle a "private", "exclusive" interrupt request source it must
6254 return the value <tt/IRQ_HANDLED/ if and only if it has verified that the current
6255 interrupt request actually stems from that source. In all other cases it must return
6256 the value <tt/IRQ_NOT_HANDLED/.
6257 <tag/Notes/<itemize>
6258 <item>The function is only available as fastcall function, so it may only
6259 be used in presence of a prototype.
6260 <item>The stub saves the registers and zero page locations used by the C runtime
6261 and switches to the provided stack area. As a consequence, there is some
6262 runtime overhead, but it it is safe to execute C code, even if other C code
6263 was interrupted. Be careful however not to call C library functions, and do not
6264 enable stack checks for the handler function or any other function called from
6266 <item>The interrupt vector is reset on program termination, so it's not strictly
6267 necessary to call <tt/<ref id="reset_irq" name="reset_irq">/ as a part of your
6268 clean-up when exitting the program.
6270 <tag/Availability/cc65
6272 <ref id="reset_brk" name="reset_brk">,
6273 <ref id="reset_irq" name="reset_irq">,
6274 <ref id="set_brk" name="set_brk">
6280 <sect1>set_c128_speed<label id="set_c128_speed"><p>
6284 <tag/Function/Set the current speed of a C128 CPU.
6285 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6286 <tag/Declaration/<tt/unsigned char __fastcall__ set_c128_speed (unsigned char speed);/
6287 <tag/Description/The function returns the speed after trying to set the speed of the C128 CPU.
6288 <tag/Notes/<itemize>
6289 <item>The function is specific to the C64 and C128.
6290 <item>The function does not check if the C128 CPU is the current CPU.
6291 <item>See the accelerator.h header for the speed definitions.
6293 <tag/Availability/cc65 (not all platforms)
6295 <ref id="detect_c128" name="detect_c128">,
6296 <ref id="get_c128_speed" name="get_c128_speed">,
6302 <sect1>set_c64dtv_speed<label id="set_c64dtv_speed"><p>
6306 <tag/Function/Set the current speed of the C64DTV.
6307 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6308 <tag/Declaration/<tt/unsigned char __fastcall__ set_c64dtv_speed (unsigned char speed);/
6309 <tag/Description/The function returns the speed after trying to set the speed of the C64DTV.
6310 <tag/Notes/<itemize>
6311 <item>The function is specific to the C64.
6312 <item>The function does not check for the presence of the C64DTV.
6313 <item>See the accelerator.h header for the speed definitions.
6315 <tag/Availability/cc65 (not all platforms)
6317 <ref id="detect_c64dtv" name="detect_c64dtv">,
6318 <ref id="get_c64dtv_speed" name="get_c64dtv_speed">,
6324 <sect1>set_c65_speed<label id="set_c65_speed"><p>
6328 <tag/Function/Set the current speed of the C65/C64DX in C64 mode.
6329 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6330 <tag/Declaration/<tt/unsigned char __fastcall__ set_c65_speed (unsigned char speed);/
6331 <tag/Description/The function returns the speed after trying to set the speed of the C65/C64DX in C64 mode.
6332 <tag/Notes/<itemize>
6333 <item>The function is specific to the C64.
6334 <item>The function does not check for the presence of a C65/C64DX in C64 mode.
6335 <item>See the accelerator.h header for the speed definitions.
6337 <tag/Availability/cc65 (not all platforms)
6339 <ref id="detect_c65" name="detect_c65">,
6340 <ref id="get_c65_speed" name="get_c65_speed">,
6346 <sect1>set_chameleon_speed<label id="set_chameleon_speed"><p>
6350 <tag/Function/Set the current speed of the C64 Chameleon cartridge.
6351 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6352 <tag/Declaration/<tt/unsigned char __fastcall__ set_chameleon_speed (unsigned char speed);/
6353 <tag/Description/The function returns the speed after trying to set the speed of the C64 Chameleon cartridge.
6354 <tag/Notes/<itemize>
6355 <item>The function is specific to the C64.
6356 <item>The function does not check for the presence of the C64 Chameleon cartridge.
6357 <item>See the accelerator.h header for the speed definitions.
6359 <tag/Availability/cc65 (not all platforms)
6361 <ref id="detect_chameleon" name="detect_chameleon">,
6362 <ref id="get_chameleon_speed" name="get_chameleon_speed">,
6368 <sect1>set_turbomaster_speed<label id="set_turbomaster_speed"><p>
6372 <tag/Function/Set the current speed of the C64 Turbo Master cartridge.
6373 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6374 <tag/Declaration/<tt/unsigned char __fastcall__ set_turbomaster_speed (unsigned char speed);/
6375 <tag/Description/The function returns the speed after trying to set the speed of the C64 Turbo Master cartridge.
6376 <tag/Notes/<itemize>
6377 <item>The function is specific to the C64.
6378 <item>The function does not check for the presence of the C64 Turbo Master cartridge.
6379 <item>See the accelerator.h header for the speed definitions.
6381 <tag/Availability/cc65 (not all platforms)
6383 <ref id="detect_turbomaster" name="detect_turbomaster">,
6384 <ref id="get_turbomaster_speed" name="get_turbomaster_speed">,
6390 <sect1>set_scpu_speed<label id="set_scpu_speed"><p>
6394 <tag/Function/Set the current speed of the C64/C128 SuperCPU cartridge.
6395 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6396 <tag/Declaration/<tt/unsigned char __fastcall__ set_scpu_speed (unsigned char speed);/
6397 <tag/Description/The function returns the speed after trying to set the speed of the SuperCPU cartridge.
6398 <tag/Notes/<itemize>
6399 <item>The function is specific to the C128 and C64.
6400 <item>The function does not check for the presence of the cartridge.
6401 <item>See the accelerator.h header for the speed definitions.
6403 <tag/Availability/cc65 (not all platforms)
6405 <ref id="detect_scpu" name="detect_scpu">,
6406 <ref id="get_scpu_speed" name="get_scpu_speed">,
6412 <sect1>setjmp<label id="setjmp"><p>
6416 <tag/Function/Save the context for use with <tt/longjmp/.
6417 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
6418 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
6419 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
6420 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
6422 <tag/Notes/<itemize>
6423 <item>The function is only available as fastcall function, so it may only
6424 be used in presence of a prototype.
6425 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
6426 <item><tt/setjmp/ will not save the signal context.
6428 <tag/Availability/ISO 9899
6430 <ref id="longjmp" name="longjmp">
6436 <sect1>setlocale<label id="setlocale"><p>
6440 <tag/Function/Selects a locale.
6441 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
6442 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
6443 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
6444 <tag/Notes/<itemize>
6445 <item>The function is only available as fastcall function, so it may only
6446 be used in presence of a prototype.
6447 <item>cc65 supports only the "C" locale, so calling this function to set a
6448 different locale has no effect.
6450 <tag/Availability/ISO 9899
6452 <ref id="localeconv" name="localeconv">,
6453 <ref id="strcoll" name="strcoll">
6454 <ref id="strxfrm" name="strxfrm">
6460 <sect1>signal<label id="signal"><p>
6464 <tag/Function/Install a signal handler.
6465 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
6466 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
6467 <tag/Description/<tt/signal/ installs a handler for the given signal. The
6468 handler may either be a user supplied function, or one of the predefined
6469 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
6470 previous value if the signal , or the special function vector SIG_ERR in
6472 <tag/Notes/<itemize>
6473 <item>The function is only available as fastcall function, so it may only
6474 be used in presence of a prototype.
6476 <tag/Availability/ISO 9899
6478 <ref id="abort" name="abort">,
6479 <ref id="raise" name="raise">
6485 <sect1>sleep<label id="sleep"><p>
6489 <tag/Function/Sleep for a specified amount of time.
6490 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
6491 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
6492 <tag/Description/The function will return after the specified number of
6493 seconds have elapsed.
6494 <tag/Notes/<itemize>
6495 <item>The function is only available as fastcall function, so it may only
6496 be used in presence of a prototype.
6498 <tag/Availability/POSIX 1003.1
6504 <sect1>slow<label id="slow"><p>
6508 <tag/Function/Switch the CPU into slow mode (C128: 1MHz mode, C16/Plus4: single clock mode).
6509 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
6510 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
6511 <tag/Declaration/<tt/void slow (void);/
6512 <tag/Description/The function will switch the clock of the CPU to slow mode. for the C128
6513 target it means switching the CPU into 1MHz mode. for the C16/Plus4 target it means
6514 switching the CPU into single clock mode.
6515 <tag/Notes/<itemize>
6516 <item>The function is specific to the C128, C16 and Plus4.
6518 <tag/Availability/cc65 (not all platforms)
6520 <ref id="fast" name="fast">,
6521 <ref id="isfast" name="isfast">,
6527 <sect1>srand<label id="srand"><p>
6531 <tag/Function/Initialize the pseudo random number generator.
6532 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
6533 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
6534 <tag/Description/The function initializes the random number generator using
6535 the given seed. On program startup, the generator behaves as if <tt/srand/ has
6536 been called with an argument of 1.
6537 <tag/Notes/<itemize>
6538 <item>The function is only available as fastcall function, so it may only
6539 be used in presence of a prototype.
6541 <tag/Availability/ISO 9899
6543 <ref id="_randomize" name="_randomize">,
6544 <ref id="rand" name="rand">
6550 <sect1>strcasecmp<label id="strcasecmp"><p>
6554 <tag/Function/Compare two strings case insensitive.
6555 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6556 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
6557 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
6558 as parameters without case sensitivity. It returns a value that is less than
6559 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
6560 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
6561 <tag/Notes/<itemize>
6562 <item>The function is only available as fastcall function, so it may only
6563 be used in presence of a prototype.
6564 <item>The function is not available in strict ANSI mode.
6566 <tag/Availability/cc65
6568 <ref id="strcmp" name="strcmp">,
6569 <ref id="strcoll" name="strcoll">,
6570 <ref id="stricmp" name="stricmp">,
6571 <ref id="strncmp" name="strncmp">,
6572 <ref id="strxfrm" name="strxfrm">
6578 <sect1>strcat<label id="strcat"><p>
6582 <tag/Function/Concatentate two strings.
6583 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6584 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
6585 <tag/Description/The <tt/strcat/ function appends a copy of the string
6586 pointed to by s2 (including the terminating null byte) to the end of the
6587 string pointed to by s1. The initial byte of s2 overwrites the null byte at
6589 <tag/Notes/<itemize>
6590 <item>The function is only available as fastcall function, so it may only
6591 be used in presence of a prototype.
6592 <item>If copying takes place between objects that overlap, the behaviour
6595 <tag/Availability/ISO 9899
6597 <ref id="strcpy" name="strcpy">,
6598 <ref id="strncat" name="strncat">,
6599 <ref id="strncpy" name="strncpy">
6605 <sect1>strchr<label id="strchr"><p>
6609 <tag/Function/Search for a character in a string.
6610 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6611 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
6612 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
6613 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6614 byte is considered to be part of the string. Upon completion, the function
6615 returns a pointer to the byte, or a null pointer if the byte was not found.
6616 <tag/Notes/<itemize>
6617 <item>The function is only available as fastcall function, so it may only
6618 be used in presence of a prototype.
6620 <tag/Availability/ISO 9899
6622 <ref id="memchr" name="memchr">,
6623 <ref id="strrchr" name="strrchr">
6629 <sect1>strcmp<label id="strcmp"><p>
6633 <tag/Function/Compare two strings.
6634 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6635 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
6636 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
6637 parameters. It returns a value that is less than zero if <tt/s1/ is less than
6638 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
6639 if <tt/s1/ is greater than <tt/s2/.
6640 <tag/Notes/<itemize>
6641 <item>The function is only available as fastcall function, so it may only
6642 be used in presence of a prototype.
6644 <tag/Availability/ISO 9899
6646 <ref id="strcasecmp" name="strcasecmp">,
6647 <ref id="strcoll" name="strcoll">,
6648 <ref id="stricmp" name="stricmp">,
6649 <ref id="strncmp" name="strncmp">
6650 <ref id="strxfrm" name="strxfrm">
6656 <sect1>strcoll<label id="strcoll"><p>
6660 <tag/Function/Compare two strings.
6661 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6662 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
6663 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
6664 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
6665 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
6666 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
6667 than zero if <tt/s1/ is greater than <tt/s2/.
6668 <tag/Notes/<itemize>
6669 <item>The function is only available as fastcall function, so it may only
6670 be used in presence of a prototype.
6672 <tag/Availability/ISO 9899
6674 <ref id="setlocale" name="setlocale">,
6675 <ref id="strcasecmp" name="strcasecmp">,
6676 <ref id="strcmp" name="strcmp">,
6677 <ref id="stricmp" name="stricmp">,
6678 <ref id="strncmp" name="strncmp">,
6679 <ref id="strxfrm" name="strxfrm">
6685 <sect1>strcpy<label id="strcpy"><p>
6689 <tag/Function/Copy a string.
6690 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6691 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
6692 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
6693 <tt/s2/ (including the terminating null byte) into the array pointed to by
6694 <tt/s1/. The function will always return <tt/s1/.
6695 <tag/Notes/<itemize>
6696 <item>The function is only available as fastcall function, so it may only
6697 be used in presence of a prototype.
6698 <item>If copying takes place between objects that overlap, the behaviour
6701 <tag/Availability/ISO 9899
6703 <ref id="strcat" name="strcat">,
6704 <ref id="strncat" name="strncat">,
6705 <ref id="strncpy" name="strncpy">
6708 #include <string.h>
6710 static char hello[14];
6712 strcpy (hello, "Hello world!\n");
6718 <sect1>strcspn<label id="strcspn"><p>
6722 <tag/Function/Compute the length of a substring.
6723 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6724 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
6725 <tag/Description/The <tt/strcspn/ function computes and returns the length of
6726 the substring pointed to by <tt/s/ which does <em>not</em> consist of
6727 characters contained in the string <tt/set/.
6728 <tag/Notes/<itemize>
6729 <item>The function is only available as fastcall function, so it may only
6730 be used in presence of a prototype.
6732 <tag/Availability/ISO 9899
6734 <ref id="strqtok" name="strqtok">,
6735 <ref id="strspn" name="strspn">,
6736 <ref id="strstr" name="strstr">,
6737 <ref id="strtok" name="strtok">
6743 <sect1>strdup<label id="strdup"><p>
6747 <tag/Function/Allocate a copy of a string on the heap.
6748 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6749 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
6750 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
6751 to hold a copy of <tt/s/ including the terminating zero. If the allocation
6752 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
6753 memory block, and a pointer to the block is returned.
6754 <tag/Notes/<itemize>
6755 <item>The function is only available as fastcall function, so it may only
6756 be used in presence of a prototype.
6757 <item>It is up to the caller to free the allocated memory block.
6759 <tag/Availability/ISO 9899
6761 <ref id="free" name="free">,
6762 <ref id="malloc" name="malloc">
6768 <sect1>strerror<label id="strerror"><p>
6772 <tag/Function/Return a string describing an error code.
6773 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6774 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
6775 <tag/Description/The <tt/strerror/ function returns a string describing the
6776 given error code. If an invalid error code is passed, the string "Unknown
6777 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
6778 <tt/errno/ is left untouched.
6779 <tag/Notes/<itemize>
6780 <item>The function is only available as fastcall function, so it may only
6781 be used in presence of a prototype.
6782 <item>While the return type of the function is a <tt/char*/, the returned
6783 string must not be modified by the caller!
6785 <tag/Availability/ISO 9899
6787 <ref id="_stroserror" name="_stroserror">
6793 <sect1>stricmp<label id="stricmp"><p>
6797 <tag/Function/Compare two strings case insensitive.
6798 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6799 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
6800 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
6801 parameters without case sensitivity. It returns a value that is less than zero
6802 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
6803 value greater than zero if <tt/s1/ is greater than <tt/s2/.
6804 <tag/Notes/<itemize>
6805 <item>The function is only available as fastcall function, so it may only
6806 be used in presence of a prototype.
6807 <item>The function is not available in strict ANSI mode.
6809 <tag/Availability/cc65
6811 <ref id="strcasecmp" name="strcasecmp">,
6812 <ref id="strcmp" name="strcmp">,
6813 <ref id="strcoll" name="strcoll">,
6814 <ref id="strncmp" name="strncmp">,
6815 <ref id="strxfrm" name="strxfrm">
6821 <sect1>strlen<label id="strlen"><p>
6825 <tag/Function/Return the length of a string.
6826 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6827 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
6828 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
6829 string to which s points, not including the terminating null byte.
6830 <tag/Notes/<itemize>
6831 <item>The function is only available as fastcall function, so it may only
6832 be used in presence of a prototype.
6833 <item>When compiling with <tt/-Os/ (inline known standard functions), the
6834 function does not work correctly for strings with more than 255 characters.
6836 <tag/Availability/ISO 9899
6838 <ref id="strcpy" name="strcpy">
6844 <sect1>strlower<label id="strlower"><p>
6848 <tag/Function/Make a string lower case.
6849 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6850 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
6851 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
6852 function to each character of a string. The function will always return <tt/s/.
6853 <tag/Notes/<itemize>
6854 <item>The function is only available as fastcall function, so it may only
6855 be used in presence of a prototype.
6856 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6857 <item>An alias name for this function is <tt/strlwr/.
6859 <tag/Availability/cc65
6861 <ref id="strupper" name="strupper">,
6862 <ref id="tolower" name="tolower">
6868 <sect1>strlwr<label id="strlwr"><p>
6875 <sect1>strncasecmp<label id="strncasecmp"><p>
6879 <tag/Function/Compare two strings case insensitive.
6880 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6881 <tag/Declaration/<tt/int __fastcall__ strncasecmp (const char* s1, const char* s2, size_t count);/
6882 <tag/Description/The <tt/strncasecmp/ function compares the two strings passed
6883 as parameters without case sensitivity. It returns a value that is less than
6884 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
6885 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
6886 <tag/Notes/<itemize>
6887 <item>The function is only available as fastcall function, so it may only
6888 be used in presence of a prototype.
6889 <item>The function is not available in strict ANSI mode.
6891 <tag/Availability/cc65
6893 <ref id="strcmp" name="strcmp">,
6894 <ref id="strcoll" name="strcoll">,
6895 <ref id="stricmp" name="stricmp">,
6896 <ref id="strncmp" name="strncmp">,
6897 <ref id="strxfrm" name="strxfrm">
6903 <sect1>strncat<label id="strncat"><p>
6907 <tag/Function/Concatentate two strings.
6908 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6909 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
6910 <tag/Description/The <tt/strncat/ function appends not more than n characters
6911 of the string pointed to by s2 to the end of the string pointed to by s1. The
6912 terminating null character at the end of s1 is overwritten. A terminating null
6913 character is appended to the result, even if not all of s2 is appended to s1.
6914 <tag/Notes/<itemize>
6915 <item>The function is only available as fastcall function, so it may only
6916 be used in presence of a prototype.
6917 <item>If copying takes place between objects that overlap, the behaviour
6920 <tag/Availability/ISO 9899
6922 <ref id="strcpy" name="strcpy">,
6923 <ref id="strncat" name="strncat">,
6924 <ref id="strncpy" name="strncpy">
6930 <sect1>strncmp<label id="strncmp"><p>
6934 <tag/Function/Compare two strings.
6935 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6936 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
6937 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
6938 characters of the two strings passed as parameters. It returns a value that is
6939 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
6940 <tt/s2/, zero if they are identical, and a value greater than zero they are
6942 <tag/Notes/<itemize>
6943 <item>The function is only available as fastcall function, so it may only
6944 be used in presence of a prototype.
6946 <tag/Availability/ISO 9899
6948 <ref id="strcasecmp" name="strcasecmp">,
6949 <ref id="strcmp" name="strcmp">,
6950 <ref id="strcoll" name="strcoll">,
6951 <ref id="stricmp" name="stricmp">,
6952 <ref id="strxfrm" name="strxfrm">
6958 <sect1>strncpy<label id="strncpy"><p>
6962 <tag/Function/Copy part of a string.
6963 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6964 <tag/Declaration/<tt/char* __fastcall__ strncpy (char* s1, const char* s2, size_t n);/
6965 <tag/Description/The <tt/strncpy/ function copies not more than <tt/n/ bytes from
6966 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
6967 pointed to by <tt/s2/ is a string that is shorter than <tt/n/ bytes, null bytes are
6968 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
6969 written. The function always will return <tt/s1/.
6970 <tag/Notes/<itemize>
6971 <item>The function is available only as a fastcall function; so, it may be used
6972 only in the presence of a prototype.
6973 <item>If there is no null byte in the first <tt/n/ bytes of the array pointed
6974 to by <tt/s2/, the result is <em/not/ null-terminated!
6975 <item>If copying takes place between objects that overlap, the behaviour is
6978 <tag/Availability/ISO 9899
6980 <ref id="memcpy" name="memcpy">,
6981 <ref id="strcat" name="strcat">,
6982 <ref id="strcpy" name="strcpy">,
6983 <ref id="strncat" name="strncat">
6988 static char hello[6];
6990 strncpy (hello, "Hello world!\n", sizeof hello - 1)[5] = '\0';
6996 <sect1>strnicmp<label id="strnicmp"><p>
7000 <tag/Function/Compare two strings case insensitive.
7001 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7002 <tag/Declaration/<tt/int __fastcall__ strnicmp (const char* s1, const char* s2, size_t count);/
7003 <tag/Description/The <tt/strnicmp/ function compares the two strings passed as
7004 parameters without case sensitivity. It returns a value that is less than zero
7005 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
7006 value greater than zero if <tt/s1/ is greater than <tt/s2/.
7007 <tag/Notes/<itemize>
7008 <item>The function is only available as fastcall function, so it may only
7009 be used in presence of a prototype.
7010 <item>The function is not available in strict ANSI mode.
7012 <tag/Availability/cc65
7014 <ref id="strcasecmp" name="strcasecmp">,
7015 <ref id="strcmp" name="strcmp">,
7016 <ref id="strcoll" name="strcoll">,
7017 <ref id="strncmp" name="strncmp">,
7018 <ref id="strxfrm" name="strxfrm">
7024 <sect1>strqtok<label id="strqtok"><p>
7028 <tag/Function/Break a string into tokens.
7029 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7030 <tag/Declaration/<tt/char* __fastcall__ strqtok (char* s1, const char* s2);/
7031 <tag/Description/<tt/strqtok()/ will break the string <tt/s1/ into a sequence of
7032 tokens, which are delimited by either quotation marks or characters from the
7033 string <tt/s2/. Tokens inside quotation marks may contain characters from <tt/s2/
7034 (they aren't delimiters there). The first call to <tt/strqtok()/ will return a
7035 pointer to the first token in the string <tt/s1/. The following calls must pass
7036 a <tt/NULL/ pointer as <tt/s1/, in order to get the next token in the string.
7037 Different sets of delimiters may be used for the subsequent calls to <tt/strqtok()/.
7038 <tag/Notes/<itemize>
7039 <item>The function is available only as a fastcall function; so, it may be used
7040 only in the presence of a prototype.
7041 <item><tt/strqtok()/ will modify the string <tt/s1/.
7042 <item>The function will forget where it is in the <tt/s1/ string if it is given
7043 a second <tt/s1/ string before it finishes the first one.
7045 <tag/Availability/cc65
7047 <ref id="strcspn" name="strcspn">,
7048 <!-- <ref id="strpbrk" name="strpbrk">, -->
7049 <ref id="strspn" name="strspn">,
7050 <ref id="strtok" name="strtok">
7056 <sect1>strrchr<label id="strrchr"><p>
7060 <tag/Function/Search for a character in a string.
7061 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7062 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
7063 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
7064 (converted to a char) in the string pointed to by <tt/s/. The terminating null
7065 byte is considered to be part of the string. Upon completion, the function
7066 returns a pointer to the byte, or a null pointer if the byte was not found.
7067 <tag/Notes/<itemize>
7068 <item>The function is only available as fastcall function, so it may only
7069 be used in presence of a prototype.
7071 <tag/Availability/ISO 9899
7073 <ref id="strchr" name="strchr">
7079 <sect1>strspn<label id="strspn"><p>
7083 <tag/Function/Compute the length of a substring.
7084 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7085 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
7086 <tag/Description/The <tt/strspn/ function computes and returns the length of
7087 the substring pointed to by <tt/s/ which does consist only of characters
7088 contained in the string <tt/set/.
7089 <tag/Notes/<itemize>
7090 <item>The function is only available as fastcall function, so it may only
7091 be used in presence of a prototype.
7093 <tag/Availability/ISO 9899
7095 <ref id="strcspn" name="strcspn">,
7096 <ref id="strstr" name="strstr">
7102 <sect1>strstr<label id="strstr"><p>
7106 <tag/Function/Find a substring.
7107 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7108 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
7109 <tag/Description/<tt/strstr/ searches for the first occurance of the string
7110 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
7111 otherwise it returns <tt/NULL/.
7112 <tag/Notes/<itemize>
7113 <item>The function is only available as fastcall function, so it may only
7114 be used in presence of a prototype.
7116 <tag/Availability/ISO 9899
7118 <ref id="strcspn" name="strcspn">,
7119 <ref id="strspn" name="strspn">
7125 <sect1>strtok<label id="strtok"><p>
7129 <tag/Function/Break a string into tokens.
7130 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7131 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
7132 <tag/Description/<tt/strtok()/ will break the string <tt/s1/ into a sequence of
7133 tokens, which are delimited by characters from the string <tt/s2/. The first call
7134 to <tt/strtok()/ will return a pointer to the first token in the string <tt/s1/.
7135 The following calls must pass a <tt/NULL/ pointer as <tt/s1/, in order to get
7136 the next token in the string. Different sets of delimiters may be used for the
7137 subsequent calls to <tt/strtok()/.
7138 <tag/Notes/<itemize>
7139 <item>The function is only available as fastcall function, so it may only
7140 be used in presence of a prototype.
7141 <item><tt/strtok()/ will modify the string <tt/s1/.
7142 <item>The function will forget where it is in the <tt/s1/ string if it is given
7143 a second <tt/s1/ string before it finishes the first one.
7145 <tag/Availability/ISO 9899
7147 <ref id="strcspn" name="strcspn">,
7148 <!-- <ref id="strpbrk" name="strpbrk">, -->
7149 <ref id="strqtok" name="strqtok">,
7150 <ref id="strspn" name="strspn">
7156 <sect1>strxfrm<label id="strxfrm"><p>
7160 <tag/Function/Transform a string.
7161 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7162 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
7163 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
7164 s2 and places the resulting string into the string pointed to by s1. The
7165 transformation is such that if the <tt/strcmp/ function is applied to two
7166 transformed strings, it returns a value greater than, equal to, or less than
7167 zero, corresponding to the result of the <tt/strcoll/ function applied to the
7168 same two original strings. No more than n characters are placed into the
7169 resulting array pointed to by s1, including the terminating null character.
7170 <tag/Notes/<itemize>
7171 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
7172 the behaviour is undefined.
7173 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
7174 <item>The function is only available as fastcall function, so it may only
7175 be used in presence of a prototype.
7176 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
7177 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
7179 <tag/Availability/ISO 9899
7181 <ref id="strcmp" name="strcmp">,
7182 <ref id="strcoll" name="strcoll">,
7183 <ref id="strncpy" name="strncpy">
7189 <sect1>strupper<label id="strupper"><p>
7193 <tag/Function/Make a string upper case.
7194 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7195 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
7196 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
7197 function to each character of a string. The function will always return <tt/s/.
7198 <tag/Notes/<itemize>
7199 <item>The function is only available as fastcall function, so it may only
7200 be used in presence of a prototype.
7201 <item>The function prototype is unavailable when compiling in strict ANSI mode.
7202 <item>An alias name for this function is <tt/strupr/.
7204 <tag/Availability/cc65
7206 <ref id="strlower" name="strlower">
7207 <ref id="toupper" name="toupper">
7213 <sect1>strupr<label id="strupr"><p>
7220 <sect1>telldir<label id="telldir"><p>
7224 <tag/Function/Return the current position of a directory stream.
7225 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
7226 <tag/Declaration/<tt/long __fastcall__ telldir (DIR* dir);/
7227 <tag/Description/<tt/telldir/ returns the current position of a directory
7228 stream. The return value may be used in subsequent calls to
7229 <tt/<ref id="seekdir" name="seekdir">/.
7230 <tag/Notes/<itemize>
7231 <item>The function is only available as fastcall function, so it may only
7232 be used in presence of a prototype.
7234 <tag/Availability/POSIX 1003.1
7236 <ref id="seekdir" name="seekdir">,
7237 <ref id="telldir" name="telldir">
7243 <sect1>textcolor<label id="textcolor"><p>
7247 <tag/Function/Set the text color.
7248 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7249 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
7250 <tag/Description/The function will set a new text color. It returns the old
7251 (current) text color. Text output using any <tt/conio.h/ function will use
7252 the color set by this function.
7253 <tag/Notes/<itemize>
7254 <item>Text colors are system dependent. The function may have no effect
7255 on systems where the text color cannot be changed.
7256 <item>The function is only available as fastcall function, so it may only
7257 be used in presence of a prototype.
7259 <tag/Availability/cc65
7261 <ref id="bgcolor" name="bgcolor">,
7262 <ref id="bordercolor" name="bordercolor">
7268 <sect1>time<label id="time"><p>
7272 <tag/Function/Get the time.
7273 <tag/Header/<tt/<ref id="time.h" name="time.h">/
7274 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
7275 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
7276 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
7277 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
7278 returned and <tt/errno/ is set to <tt/ENOSYS/.
7279 <tag/Notes/<itemize>
7280 <item>The function is only available as fastcall function, so it may
7281 only be used in presence of a prototype.
7282 <item>Many platforms supported by cc65 do not have a realtime clock, so the
7283 returned value may not be valid.
7285 <tag/Availability/ISO 9899
7287 <ref id="clock" name="clock">
7293 <sect1>toggle_videomode<label id="toggle_videomode"><p>
7297 <tag/Function/Toggle between 40 and 80 column mode.
7298 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
7299 <tag/Declaration/<tt/void toggle_videomode (void);/
7300 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
7301 old mode (cursor position, color and so on) are saved and restored together
7303 <tag/Notes/<itemize>
7304 <item>The function is specific to the C128.
7305 <item>This function is deprecated. Please use <ref id="videomode"
7306 name="videomode"> instead!
7308 <tag/Availability/C128
7310 <ref id="fast" name="fast">,
7311 <ref id="isfast" name="isfast">,
7312 <ref id="slow" name="slow">,
7313 <ref id="videomode" name="videomode">
7319 <sect1>tolower<label id="tolower"><p>
7323 <tag/Function/Convert a character into its lower case representation.
7324 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7325 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
7326 <tag/Description/The function returns the given character converted to lower
7327 case. If the given character is not a letter, it is returned unchanged.
7328 <tag/Notes/<itemize>
7329 <item>The function is only available as fastcall function, so it may
7330 only be used in presence of a prototype.
7332 <tag/Availability/ISO 9899
7334 <ref id="islower" name="islower">,
7335 <ref id="isupper" name="isupper">,
7336 <ref id="toupper" name="toupper">
7342 <sect1>toupper<label id="toupper"><p>
7346 <tag/Function/Convert a character into its upper case representation.
7347 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7348 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
7349 <tag/Description/The function returns the given character converted to upper
7350 case. If the given character is not a letter, it is returned unchanged.
7351 <tag/Notes/<itemize>
7352 <item>The function is only available as fastcall function, so it may
7353 only be used in presence of a prototype.
7355 <tag/Availability/ISO 9899
7357 <ref id="islower" name="islower">,
7358 <ref id="isupper" name="isupper">,
7359 <ref id="tolower" name="tolower">
7365 <sect1>ultoa<label id="ultoa"><p>
7369 <tag/Function/Convert an unsigned long integer into a string.
7370 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7371 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
7372 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
7373 string using <tt/radix/ as the base.
7374 <tag/Notes/<itemize>
7375 <item>There are no provisions to prevent a buffer overflow.
7376 <item>The function is non standard, so it is not available in strict ANSI mode.
7377 You should probably use <tt/sprintf/ instead.
7378 <item>The function is only available as fastcall function, so it may only be
7379 used in presence of a prototype.
7381 <tag/Availability/cc65
7383 <ref id="atoi" name="atoi">,
7384 <ref id="atol" name="atol">,
7385 <ref id="itoa" name="itoa">,
7386 <ref id="ltoa" name="ltoa">,
7387 <ref id="utoa" name="utoa">
7393 <sect1>unlink<label id="unlink"><p>
7397 <tag/Function/Delete a file.
7398 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
7399 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
7400 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
7401 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
7402 code describing the reason for the failure.
7403 <tag/Notes/<itemize>
7404 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
7405 name="remove">/ instead, which is a native ANSI C function and does the same.
7406 <item>This function is not available on all cc65 targets (depends on the
7407 availability of file I/O).
7408 <item>The function is only available as fastcall function, so it may only
7409 be used in presence of a prototype.
7410 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
7411 used, which has the same semantics, but is more portable, because it conforms
7412 to the ISO C standard.
7414 <tag/Availability/POSIX 1003.1
7416 <ref id="remove" name="remove">
7419 #include <stdio.h>
7420 #include <unistd.h>
7422 #define FILENAME "helloworld"
7424 if (unlink (FILENAME) == 0) {
7425 printf ("We deleted %s successfully\n", FILENAME);
7427 printf ("There was a problem deleting %s\n", FILENAME);
7434 <sect1>utoa<label id="utoa"><p>
7438 <tag/Function/Convert an unsigned integer into a string.
7439 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7440 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
7441 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
7442 using <tt/radix/ as the base.
7443 <tag/Notes/<itemize>
7444 <item>There are no provisions to prevent a buffer overflow.
7445 <item>The function is non standard, so it is not available in strict ANSI mode.
7446 You should probably use <tt/sprintf/ instead.
7447 <item>The function is only available as fastcall function, so it may only be
7448 used in presence of a prototype.
7450 <tag/Availability/cc65
7452 <ref id="atoi" name="atoi">,
7453 <ref id="atol" name="atol">,
7454 <ref id="itoa" name="itoa">,
7455 <ref id="ltoa" name="ltoa">,
7456 <ref id="ultoa" name="ultoa">
7462 <sect1>vcprintf<label id="vcprintf"><p>
7466 <tag/Function/Formatted output to the console.
7467 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7468 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
7469 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
7470 text where necessary and formatted according to the format string given. The
7471 resulting string is output to the console. <tt/vcprintf/ supports the same
7472 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
7473 <tag/Notes/<itemize>
7474 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
7475 between <tt/\r/ and <tt/\n/.
7476 <item>The function is only available as fastcall function, so it may only be
7477 used in presence of a prototype.
7479 <tag/Availability/cc65
7481 <ref id="cprintf" name="cprintf">,
7482 <ref id="cputc" name="cputc">,
7483 <ref id="cputcxy" name="cputcxy">,
7484 <ref id="cputs" name="cputs">,
7485 <ref id="cputsxy" name="cputsxy">
7491 <sect1>videomode<label id="videomode"><p>
7495 <tag/Function/Switch to either 40 or 80 column mode.
7496 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
7497 <ref id="c128.h" name="c128.h">/
7498 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
7499 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
7500 the requested mode is already active, nothing happens. The old mode is returned
7502 <tag/Notes/<itemize>
7503 <item>The function is specific to the C128 and enhanced Apple //e.
7504 <item>This function replaces <ref id="toggle_videomode"
7505 name="toggle_videomode">.
7506 <item>The function is only available as fastcall function, so it may only be
7507 used in presence of a prototype.
7509 <tag/Availability/C128 and enhanced Apple //e
7511 <ref id="fast" name="fast">,
7512 <ref id="isfast" name="isfast">,
7513 <ref id="slow" name="slow">,
7514 <ref id="toggle_videomode" name="toggle_videomode">
7520 <sect1>waitvsync<label id="waitvsync"><p>
7524 <tag/Function/Wait until the start of the next frame.
7526 <tt/<ref id="cbm.h" name="cbm.h">/,
7527 <tt/<ref id="gamate.h" name="gamate.h">/,
7528 <tt/<ref id="nes.h" name="nes.h">/,
7529 <tt/<ref id="pce.h" name="pce.h">/
7530 <tag/Declaration/<tt/void waitvsync (void);/
7531 <tag/Description/Wait for vertical sync to reduce flickering.
7532 <tag/Availability/Platforms above
7538 <sect1>wherex<label id="wherex"><p>
7542 <tag/Function/Return the current X position of the text mode cursor.
7543 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7544 <tag/Declaration/<tt/unsigned char wherex (void);/
7545 <tag/Description/The function returns the current X position of the text mode
7546 cursor. Zero is returned for the leftmost screen position.
7547 <tag/Availability/cc65
7549 <ref id="gotox" name="gotox">,
7550 <ref id="gotoy" name="gotoy">,
7551 <ref id="gotoxy" name="gotoxy">,
7552 <ref id="wherey" name="wherey">
7558 <sect1>wherey<label id="wherey"><p>
7562 <tag/Function/Return the current Y position of the text mode cursor.
7563 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7564 <tag/Declaration/<tt/unsigned char wherey (void);/
7565 <tag/Description/The function returns the current Y position of the text mode
7566 cursor. Zero is returned for the uppermost screen position.
7567 <tag/Availability/cc65
7569 <ref id="gotox" name="gotox">,
7570 <ref id="gotoy" name="gotoy">,
7571 <ref id="gotoxy" name="gotoxy">,
7572 <ref id="wherex" name="wherex">