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_scpu" name="detect_scpu">
74 <item><ref id="get_c128_speed" name="get_c128_speed">
75 <item><ref id="get_c64dtv_speed" name="get_c64dtv_speed">
76 <item><ref id="get_scpu_speed" name="get_scpu_speed">
77 <item><ref id="set_c128_speed" name="set_c128_speed">
78 <item><ref id="set_c64dtv_speed" name="set_c64dtv_speed">
79 <item><ref id="set_scpu_speed" name="set_scpu_speed">
83 <sect1><tt/apple2.h/<label id="apple2.h"><p>
87 <item><ref id="get_ostype" name="get_ostype">
92 <sect1><tt/apple2enh.h/<label id="apple2enh.h"><p>
96 <item><ref id="get_ostype" name="get_ostype">
100 <item><ref id="videomode" name="videomode">
104 <sect1><tt/assert.h/<label id="assert.h"><p>
107 <item><ref id="assert" name="assert">
111 <sect1><tt/atari.h/<label id="atari.h"><p>
114 <!-- <item><ref id="_getcolor" name="_getcolor"> -->
115 <!-- <item><ref id="_getdefdev" name="_getdefdev"> -->
116 <!-- <item><ref id="_graphics" name="_graphics"> -->
117 <item><ref id="_is_cmdline_dos" name="_is_cmdline_dos">
118 <!-- <item><ref id="_rest_vecs" name="_rest_vecs"> -->
119 <!-- <item><ref id="_save_vecs" name="_save_vecs"> -->
120 <!-- <item><ref id="_scroll" name="_scroll"> -->
121 <!-- <item><ref id="_setcolor" name="_setcolor"> -->
122 <!-- <item><ref id="_setcolor_low" name="_setcolor_low"> -->
123 <item><ref id="get_ostype" name="get_ostype">
124 <!-- <item><ref id="get_tv" name="get_tv"> -->
130 <sect1><tt/atmos.h/<label id="atmos.h"><p>
133 <item><ref id="atmos_explode" name="atmos_explode">
134 <item><ref id="atmos_load" name="atmos_load">
135 <item><ref id="atmos_ping" name="atmos_ping">
136 <item><ref id="atmos_save" name="atmos_save">
137 <item><ref id="atmos_shoot" name="atmos_shoot">
138 <item><ref id="atmos_tick" name="atmos_tick">
139 <item><ref id="atmos_tock" name="atmos_tock">
140 <item><ref id="atmos_zap" name="atmos_zap">
144 <sect1><tt/c128.h/<label id="c128.h"><p>
147 <item><ref id="c64mode" name="c64mode">
148 <item><ref id="fast" name="fast">
149 <item><ref id="isfast" name="isfast">
150 <item><ref id="slow" name="slow">
151 <item><ref id="toggle_videomode" name="toggle_videomode">
152 <item><ref id="videomode" name="videomode">
156 <sect1><tt/c16.h/<label id="c16.h"><p>
159 <item><ref id="fast" name="fast">
160 <item><ref id="isfast" name="isfast">
161 <item><ref id="slow" name="slow">
167 <sect1><tt/c64.h/<label id="c64.h"><p>
170 <item><ref id="get_ostype" name="get_ostype">
174 <sect1><tt/cbm.h/<label id="cbm.h"><p>
177 <item><ref id="cbm_k_acptr" name="cbm_k_acptr">
178 <item><ref id="cbm_k_basin" name="cbm_k_basin">
179 <item><ref id="cbm_k_bsout" name="cbm_k_bsout">
180 <item><ref id="cbm_k_chkin" name="cbm_k_chkin">
181 <item><ref id="cbm_k_ciout" name="cbm_k_ciout">
182 <item><ref id="cbm_k_ckout" name="cbm_k_ckout">
183 <item><ref id="cbm_k_clall" name="cbm_k_clall">
184 <item><ref id="cbm_k_close" name="cbm_k_close">
185 <item><ref id="cbm_k_clrch" name="cbm_k_clrch">
186 <item><ref id="cbm_k_getin" name="cbm_k_getin">
187 <item><ref id="cbm_k_iobase" name="cbm_k_iobase">
188 <item><ref id="cbm_k_listen" name="cbm_k_listen">
189 <item><ref id="cbm_k_load" name="cbm_k_load">
190 <item><ref id="cbm_k_open" name="cbm_k_open">
191 <item><ref id="cbm_k_readst" name="cbm_k_readst">
192 <item><ref id="cbm_k_save" name="cbm_k_save">
193 <item><ref id="cbm_k_scnkey" name="cbm_k_scnkey">
194 <item><ref id="cbm_k_setlfs" name="cbm_k_setlfs">
195 <item><ref id="cbm_k_setnam" name="cbm_k_setnam">
196 <item><ref id="cbm_k_talk" name="cbm_k_talk">
197 <item><ref id="cbm_k_udtim" name="cbm_k_udtim">
198 <item><ref id="cbm_k_unlsn" name="cbm_k_unlsn">
199 <!-- <item><ref id="cbm_load" name="cbm_load"> -->
200 <!-- <item><ref id="cbm_open" name="cbm_open"> -->
201 <!-- <item><ref id="cbm_opendir" name="cbm_opendir"> -->
202 <!-- <item><ref id="cbm_read" name="cbm_read"> -->
203 <!-- <item><ref id="cbm_readdir" name="cbm_readdir"> -->
204 <!-- <item><ref id="cbm_save" name="cbm_save"> -->
205 <!-- <item><ref id="cbm_write" name="cbm_write"> -->
206 <!-- <item><ref id="get_tv" name="get_tv"> -->
207 <item><ref id="waitvsync" name="waitvsync">
208 <item><ref id="kbrepeat" name="kbrepeat">
214 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
217 <item><ref id="peekbsys" name="peekbsys">
218 <item><ref id="peekwsys" name="peekwsys">
219 <item><ref id="pokebsys" name="pokebsys">
220 <item><ref id="pokewsys" name="pokewsys">
224 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
227 <item><ref id="peekbsys" name="peekbsys">
228 <item><ref id="peekwsys" name="peekwsys">
229 <item><ref id="pokebsys" name="pokebsys">
230 <item><ref id="pokewsys" name="pokewsys">
234 <sect1><tt/cc65.h/<label id="cc65.h"><p>
237 <!-- <item><ref id="cc65_cos" name="cc65_cos"> -->
238 <!-- <item><ref id="cc65_idiv32by16r16" name="cc65_idiv32by16r16"> -->
239 <!-- <item><ref id="cc65_imul16x16r32" name="cc65_imul16x16r32"> -->
240 <!-- <item><ref id="cc65_imul8x8r16" name="cc65_imul8x8r16"> -->
241 <!-- <item><ref id="cc65_sin" name="cc65_sin"> -->
242 <!-- <item><ref id="cc65_udiv32by16r16" name="cc65_udiv32by16r16"> -->
243 <!-- <item><ref id="cc65_umul16x16r32" name="cc65_umul16x16r32"> -->
244 <!-- <item><ref id="cc65_umul16x8r32" name="cc65_umul16x8r32"> -->
245 <!-- <item><ref id="cc65_umul8x8r16" name="cc65_umul8x8r16"> -->
246 <item><ref id="doesclrscrafterexit" name="doesclrscrafterexit">
252 <sect1><tt/conio.h/<label id="conio.h"><p>
255 <item><ref id="bgcolor" name="bgcolor">
256 <item><ref id="bordercolor" name="bordercolor">
257 <item><ref id="cclear" name="cclear">
258 <item><ref id="cclearxy" name="cclearxy">
259 <item><ref id="cgetc" name="cgetc">
260 <item><ref id="chline" name="chline">
261 <item><ref id="chlinexy" name="chlinexy">
262 <item><ref id="clrscr" name="clrscr">
263 <item><ref id="cpeekc" name="cpeekc">
264 <item><ref id="cpeekcolor" name="cpeekcolor">
265 <item><ref id="cpeekrevers" name="cpeekrevers">
266 <item><ref id="cpeeks" name="cpeeks">
267 <item><ref id="cprintf" name="cprintf">
268 <item><ref id="cputc" name="cputc">
269 <item><ref id="cputcxy" name="cputcxy">
270 <item><ref id="cputs" name="cputs">
271 <item><ref id="cputsxy" name="cputsxy">
272 <item><ref id="cursor" name="cursor">
273 <item><ref id="cvline" name="cvline">
274 <item><ref id="cvlinexy" name="cvlinexy">
275 <item><ref id="gotox" name="gotox">
276 <item><ref id="gotoxy" name="gotoxy">
277 <item><ref id="gotoy" name="gotoy">
278 <item><ref id="kbhit" name="kbhit">
279 <item><ref id="revers" name="revers">
280 <item><ref id="screensize" name="screensize">
281 <item><ref id="textcolor" name="textcolor">
282 <item><ref id="vcprintf" name="vcprintf">
283 <item><ref id="wherex" name="wherex">
284 <item><ref id="wherey" name="wherey">
288 <sect1><tt/ctype.h/<label id="ctype.h"><p>
291 <item><ref id="isalnum" name="isalnum">
292 <item><ref id="isalpha" name="isalpha">
293 <item><ref id="isascii" name="isascii">
294 <item><ref id="isblank" name="isblank">
295 <item><ref id="iscntrl" name="iscntrl">
296 <item><ref id="isdigit" name="isdigit">
297 <item><ref id="isgraph" name="isgraph">
298 <item><ref id="islower" name="islower">
299 <item><ref id="isprint" name="isprint">
300 <item><ref id="ispunct" name="ispunct">
301 <item><ref id="isspace" name="isspace">
302 <item><ref id="isupper" name="isupper">
303 <item><ref id="isxdigit" name="isxdigit">
304 <item><ref id="tolower" name="tolower">
305 <item><ref id="toupper" name="toupper">
309 <sect1><tt/dbg.h/<label id="dbg.h"><p>
312 <!-- <item><ref id="DbgInit" name="DbgInit"> -->
318 <sect1><tt/device.h/<label id="device.h"><p>
321 <item><ref id="getcurrentdevice" name="getcurrentdevice">
322 <item><ref id="getdevicedir" name="getdevicedir">
323 <item><ref id="getfirstdevice" name="getfirstdevice">
324 <item><ref id="getnextdevice" name="getnextdevice">
328 <sect1><tt/dio.h/<label id="dio.h"><p>
330 <url url="dio.html" name="Low-level disk I/O API">.
333 <sect1><tt/dirent.h/<label id="dirent.h"><p>
336 <item><ref id="_DE_ISDIR" name="_DE_ISDIR">
337 <item><ref id="_DE_ISLBL" name="_DE_ISLBL">
338 <item><ref id="_DE_ISLNK" name="_DE_ISLNK">
339 <item><ref id="_DE_ISREG" name="_DE_ISREG">
340 <item><ref id="closedir" name="closedir">
341 <item><ref id="opendir" name="opendir">
342 <item><ref id="readdir" name="readdir">
343 <item><ref id="rewinddir" name="rewinddir">
344 <item><ref id="seekdir" name="seekdir">
345 <item><ref id="telldir" name="telldir">
349 <sect1><tt/em.h/<label id="em.h"><p>
352 <item><ref id="em_commit" name="em_commit">
353 <item><ref id="em_copyfrom" name="em_copyfrom">
354 <item><ref id="em_copyto" name="em_copyto">
355 <item><ref id="em_install" name="em_install">
356 <item><ref id="em_load_driver" name="em_load_driver">
357 <item><ref id="em_map" name="em_map">
358 <item><ref id="em_pagecount" name="em_pagecount">
359 <item><ref id="em_uninstall" name="em_uninstall">
360 <item><ref id="em_unload" name="em_unload">
361 <item><ref id="em_use" name="em_use">
365 <sect1><tt/errno.h/<label id="errno.h"><p>
368 <!-- <item><ref id="_directerrno" name="_directerrno"> -->
369 <!-- <item><ref id="_mappederrno" name="_mappederrno"> -->
370 <!-- <item><ref id="_osmaperrno" name="_osmaperrno"> -->
371 <!-- <item><ref id="_seterrno" name="_seterrno"> -->
377 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
380 <item><ref id="close" name="close">
381 <item><ref id="creat" name="creat">
382 <item><ref id="open" name="open">
386 <sect1><tt/gamate.h/<label id="gamate.h"><p>
389 <!-- <item><ref id="get_tv" name="get_tv"> -->
390 <item><ref id="waitvsync" name="waitvsync">
396 <sect1><tt/geos.h/<label id="geos.h"><p>
398 <url url="geos.html" name="GEOS API">.
401 <sect1><tt/joystick.h/<label id="joystick.h"><p>
404 <item><ref id="joy_count" name="joy_count">
405 <item><ref id="joy_install" name="joy_install">
406 <item><ref id="joy_load_driver" name="joy_load_driver">
407 <item><ref id="joy_read" name="joy_read">
408 <item><ref id="joy_uninstall" name="joy_uninstall">
409 <item><ref id="joy_unload" name="joy_unload">
413 <sect1><tt/locale.h/<label id="locale.h"><p>
416 <item><ref id="localeconv" name="localeconv">
417 <item><ref id="setlocale" name="setlocale">
421 <sect1><tt/lynx.h/<label id="lynx.h"><p>
424 <!-- <item><ref id="lynx_eeprom_erase" name="lynx_eeprom_erase"> -->
425 <!-- <item><ref id="lynx_eeprom_read" name="lynx_eeprom_read"> -->
426 <!-- <item><ref id="lynx_eeprom_write" name="lynx_eeprom_write"> -->
427 <!-- <item><ref id="lynx_eeread" name="lynx_eeread"> -->
428 <!-- <item><ref id="lynx_eewrite" name="lynx_eewrite"> -->
429 <!-- <item><ref id="lynx_exec" name="lynx_exec"> -->
430 <!-- <item><ref id="lynx_load" name="lynx_load"> -->
436 <sect1><tt/lz4.h/<label id="lz4.h"><p>
439 <item><ref id="decompress_lz4" name="decompress_lz4">
443 <sect1><tt/modload.h/<label id="modload.h"><p>
446 <item><ref id="mod_load" name="mod_load">
447 <item><ref id="mod_free" name="mod_free">
451 <sect1><tt/mouse.h/<label id="mouse.h"><p>
454 <item><ref id="mouse_buttons" name="mouse_buttons">
455 <item><ref id="mouse_getbox" name="mouse_getbox">
456 <item><ref id="mouse_geterrormsg" name="mouse_geterrormsg">
457 <item><ref id="mouse_hide" name="mouse_hide">
458 <item><ref id="mouse_info" name="mouse_info">
459 <item><ref id="mouse_install" name="mouse_install">
460 <item><ref id="mouse_ioctl" name="mouse_ioctl">
461 <item><ref id="mouse_load_driver" name="mouse_load_driver">
462 <item><ref id="mouse_move" name="mouse_move">
463 <item><ref id="mouse_pos" name="mouse_pos">
464 <item><ref id="mouse_setbox" name="mouse_setbox">
465 <item><ref id="mouse_show" name="mouse_show">
466 <item><ref id="mouse_uninstall" name="mouse_uninstall">
467 <item><ref id="mouse_unload" name="mouse_unload">
471 <sect1><tt/nes.h/<label id="nes.h"><p>
474 <!-- <item><ref id="get_tv" name="get_tv"> -->
475 <item><ref id="waitvsync" name="waitvsync">
481 <sect1><tt/o65.h/<label id="o65.h"><p>
483 The <tt/o65.h/ header file contains structure and constant definitions that
484 may be used when dealing with files in <url
485 url="http://www.6502.org/users/andre/o65/fileformat.html" name="the o65 format">.
486 It does not declare any functions.
489 <sect1><tt/pce.h/<label id="pce.h"><p>
492 <!-- <item><ref id="get_tv" name="get_tv"> -->
493 <item><ref id="waitvsync" name="waitvsync">
499 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
502 <item><ref id="PEEK" name="PEEK">
503 <item><ref id="PEEKW" name="PEEKW">
504 <item><ref id="POKE" name="POKE">
505 <item><ref id="POKEW" name="POKEW">
509 <sect1><tt/pen.h/<label id="pen.h"><p>
512 <!-- <item><ref id="pen_adjust" name="pen_adjust"> -->
513 <!-- <item><ref id="pen_calibrate" name="pen_calibrate"> -->
519 <sect1><tt/pet.h/<label id="pet.h"><p>
524 <sect1><tt/plus4.h/<label id="plus4.h"><p>
527 <item><ref id="fast" name="fast">
528 <item><ref id="isfast" name="isfast">
529 <item><ref id="slow" name="slow">
535 <sect1><tt/serial.h/<label id="serial.h"><p>
537 The <tt/serial.h/ header file contains definitions for initializing serial
541 <item><ref id="ser_close" name="ser_close">
542 <item><ref id="ser_get" name="ser_get">
543 <item><ref id="ser_install" name="ser_install">
544 <item><ref id="ser_ioctl" name="ser_ioctl">
545 <item><ref id="ser_load_driver" name="ser_load_driver">
546 <item><ref id="ser_open" name="ser_open">
547 <item><ref id="ser_put" name="ser_put">
548 <item><ref id="ser_status" name="ser_status">
549 <item><ref id="ser_uninstall" name="ser_uninstall">
550 <item><ref id="ser_unload" name="ser_unload">
554 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
557 <item><ref id="setjmp" name="setjmp">
558 <item><ref id="longjmp" name="longjmp">
562 <sect1><tt/signal.h/<label id="signal.h"><p>
565 <item><ref id="raise" name="raise">
566 <item><ref id="signal" name="signal">
570 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
575 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
580 <sect1><tt/stddef.h/<label id="stddef.h"><p>
583 <item><ref id="offsetof" name="offsetof">
587 <sect1><tt/stdio.h/<label id="stdio.h"><p>
590 <item><ref id="_poserror" name="_poserror">
591 <item><ref id="clearerr" name="clearerr">
592 <!-- <item><ref id="fclose" name="fclose"> -->
593 <!-- <item><ref id="fdopen" name="fdopen"> -->
594 <item><ref id="feof" name="feof">
595 <item><ref id="ferror" name="ferror">
596 <!-- <item><ref id="fflush" name="fflush"> -->
597 <!-- <item><ref id="fgetc" name="fgetc"> -->
598 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
599 <!-- <item><ref id="fgets" name="fgets"> -->
600 <item><ref id="fileno" name="fileno">
601 <!-- <item><ref id="fopen" name="fopen"> -->
602 <!-- <item><ref id="fprintf" name="fprintf"> -->
603 <!-- <item><ref id="fputc" name="fputc"> -->
604 <!-- <item><ref id="fputs" name="fputs"> -->
605 <!-- <item><ref id="fread" name="fread"> -->
606 <!-- <item><ref id="freopen" name="freopen"> -->
607 <!-- <item><ref id="fscanf" name="fscanf"> -->
608 <!-- <item><ref id="fseek" name="fseek"> -->
609 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
610 <!-- <item><ref id="ftell" name="ftell"> -->
611 <!-- <item><ref id="fwrite" name="fwrite"> -->
612 <!-- <item><ref id="getc" name="getc"> -->
613 <!-- <item><ref id="getchar" name="getchar"> -->
614 <!-- <item><ref id="gets" name="gets"> -->
615 <!-- <item><ref id="printf" name="printf"> -->
616 <!-- <item><ref id="putc" name="putc"> -->
617 <!-- <item><ref id="putchar" name="putchar"> -->
618 <!-- <item><ref id="puts" name="puts"> -->
619 <item><ref id="rename" name="rename">
620 <item><ref id="remove" name="remove">
621 <!-- <item><ref id="rewind" name="rewind"> -->
622 <!-- <item><ref id="scanf" name="scanf"> -->
623 <!-- <item><ref id="snprintf" name="snprintf"> -->
624 <!-- <item><ref id="sprintf" name="sprintf"> -->
625 <!-- <item><ref id="sscanf" name="sscanf"> -->
626 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
627 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
628 <!-- <item><ref id="vprintf" name="vprintf"> -->
629 <!-- <item><ref id="vscanf" name="vscanf"> -->
630 <!-- <item><ref id="vsnprintf" name="vsnprintf"> -->
631 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
632 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
638 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
641 <item><ref id="_heapadd" name="_heapadd">
642 <item><ref id="_heapblocksize" name="_heapblocksize">
643 <item><ref id="_heapmaxavail" name="_heapmaxavail">
644 <item><ref id="_heapmemavail" name="_heapmemavail">
645 <item><ref id="_randomize" name="_randomize">
646 <item><ref id="_swap" name="_swap">
647 <item><ref id="abort" name="abort">
648 <item><ref id="abs" name="abs">
649 <item><ref id="atexit" name="atexit">
650 <item><ref id="atoi" name="atoi">
651 <item><ref id="atol" name="atol">
652 <item><ref id="bsearch" name="bsearch">
653 <item><ref id="calloc" name="calloc">
654 <item><ref id="div" name="div">
655 <item><ref id="exit" name="exit">
656 <item><ref id="free" name="free">
657 <item><ref id="getenv" name="getenv">
658 <item><ref id="itoa" name="itoa">
659 <item><ref id="labs" name="labs">
660 <item><ref id="ltoa" name="ltoa">
661 <item><ref id="malloc" name="malloc">
662 <item><ref id="perror" name="perror">
663 <!-- <item><ref id="posix_memalign" name="posix_memalign"> -->
664 <!-- <item><ref id="putenv" name="putenv"> -->
665 <item><ref id="qsort" name="qsort">
666 <item><ref id="rand" name="rand">
667 <item><ref id="realloc" name="realloc">
668 <item><ref id="srand" name="srand">
669 <!-- <item><ref id="system" name="system"> -->
670 <item><ref id="ultoa" name="ultoa">
671 <item><ref id="utoa" name="utoa">
677 <sect1><tt/string.h/<label id="string.h"><p>
680 <item><ref id="_stroserror" name="_stroserror">
681 <item><ref id="bzero" name="bzero">
682 <item><ref id="memchr" name="memchr">
683 <item><ref id="memcmp" name="memcmp">
684 <item><ref id="memcpy" name="memcpy">
685 <item><ref id="memmove" name="memmove">
686 <item><ref id="memset" name="memset">
687 <item><ref id="strcasecmp" name="strcasecmp">
688 <item><ref id="strcat" name="strcat">
689 <item><ref id="strchr" name="strchr">
690 <item><ref id="strcmp" name="strcmp">
691 <item><ref id="strcoll" name="strcoll">
692 <item><ref id="strcpy" name="strcpy">
693 <item><ref id="strcspn" name="strcspn">
694 <item><ref id="strdup" name="strdup">
695 <item><ref id="strerror" name="strerror">
696 <item><ref id="stricmp" name="stricmp">
697 <item><ref id="strlen" name="strlen">
698 <item><ref id="strlower" name="strlower">
699 <item><ref id="strlwr" name="strlwr">
700 <item><ref id="strncasecmp" name="strncasecmp">
701 <item><ref id="strncat" name="strncat">
702 <item><ref id="strncmp" name="strncmp">
703 <item><ref id="strncpy" name="strncpy">
704 <item><ref id="strnicmp" name="strnicmp">
705 <item><ref id="strqtok" name="strqtok">
706 <item><ref id="strrchr" name="strrchr">
707 <item><ref id="strspn" name="strspn">
708 <item><ref id="strstr" name="strstr">
709 <item><ref id="strtok" name="strtok">
710 <item><ref id="strxfrm" name="strxfrm">
711 <item><ref id="strupper" name="strupper">
712 <item><ref id="strupr" name="strupr">
716 <sect1><tt/telestrat.h/<label id="telestrat.h"><p>
719 <item><ref id="atmos_explode" name="explode">
720 <item><ref id="atmos_ping" name="ping">
721 <item><ref id="atmos_shoot" name="shoot">
722 <item><ref id="atmos_zap" name="zap">
723 <!-- <item><ref id="kbdclick1" name="kbdclick1"> -->
724 <!-- <item><ref id="oups" name="oups"> -->
730 <sect1><tt/tgi.h/<label id="tgi.h"><p>
732 <url url="tgi.html" name="Tiny Graphics Interface">.
735 <sect1><tt/time.h/<label id="time.h"><p>
738 <!-- <item><ref id="_systime" name="_systime"> -->
739 <!-- <item><ref id="asctime" name="asctime"> -->
740 <item><ref id="clock" name="clock">
741 <!-- <item><ref id="ctime" name="ctime"> -->
742 <!-- <item><ref id="gmtime" name="gmtime"> -->
743 <!-- <item><ref id="localtime" name="localtime"> -->
744 <!-- <item><ref id="mktime" name="mktime"> -->
745 <!-- <item><ref id="strftime" name="strftime"> -->
746 <item><ref id="time" name="time">
752 <sect1><tt/unistd.h/<label id="unistd.h"><p>
755 <!-- <item><ref id="chdir" name="chdir"> -->
756 <item><ref id="exec" name="exec">
757 <item><ref id="getcwd" name="getcwd">
758 <item><ref id="getopt" name="getopt">
759 <!-- <item><ref id="lseek" name="lseek"> -->
760 <!-- <item><ref id="mkdir" name="mkdir"> -->
761 <!-- <item><ref id="read" name="read"> -->
762 <!-- <item><ref id="rmdir" name="rmdir"> -->
763 <item><ref id="sleep" name="sleep">
764 <item><ref id="unlink" name="unlink">
765 <!-- <item><ref id="write" name="write"> -->
771 <sect1><tt/vic20.h/<label id="vic20.h"><p>
776 <sect1><tt/zlib.h/<label id="zlib.h"><p>
779 <!-- <item><ref id="adler32" name="adler32"> -->
780 <!-- <item><ref id="crc32" name="crc32"> -->
781 <!-- <item><ref id="inflatemem" name="inflatemem"> -->
782 <!-- <item><ref id="uncompress" name="uncompress"> -->
788 <sect>Alphabetical function reference<p>
790 <sect1>_DE_ISDIR<label id="_DE_ISDIR"><p>
794 <tag/Function/Determine if a directory entry specifies a directory.
795 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
796 <tag/Declaration/<tt/int _DE_ISDIR(unsigned char type);/
797 <tag/Description/The function is called with the type of a directory entry
798 taken from a <tt/struct dirent/ and returns true if the entry designates
801 <item>The function is actually a macro.
803 <tag/Availability/cc65
805 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
806 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
807 <ref id="_DE_ISREG" name="_DE_ISREG">
813 <sect1>_DE_ISLBL<label id="_DE_ISLBL"><p>
817 <tag/Function/Determine if a directory entry specifies a disk label.
818 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
819 <tag/Declaration/<tt/int _DE_ISLBL(unsigned char type);/
820 <tag/Description/The function is called with the type of a directory entry
821 taken from a <tt/struct dirent/ and returns true if the entry designates
824 <item>The function is actually a macro.
826 <tag/Availability/cc65
828 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
829 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
830 <ref id="_DE_ISREG" name="_DE_ISREG">
836 <sect1>_DE_ISLNK<label id="_DE_ISLNK"><p>
840 <tag/Function/Determine if a directory entry specifies a link.
841 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
842 <tag/Declaration/<tt/int _DE_ISLNK(unsigned char type);/
843 <tag/Description/The function is called with the type of a directory entry
844 taken from a <tt/struct dirent/ and returns true if the entry designates
847 <item>The function is actually a macro.
849 <tag/Availability/cc65
851 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
852 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
853 <ref id="_DE_ISREG" name="_DE_ISREG">
859 <sect1>_DE_ISREG<label id="_DE_ISREG"><p>
863 <tag/Function/Determine if a directory entry specifies a regular file.
864 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
865 <tag/Declaration/<tt/int _DE_ISREG(unsigned char type);/
866 <tag/Description/The function is called with the type of a directory entry
867 taken from a <tt/struct dirent/ and returns true if the entry designates
870 <item>The function is actually a macro.
871 <item>A "regular file" means anything with data in it. This might still mean
872 that special processing is needed, when accessing the file. Relative files of
873 the CBM systems are classified as being "regular" files, for example.
875 <tag/Availability/cc65
877 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
878 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
879 <ref id="_DE_ISLNK" name="_DE_ISLNK">
885 <sect1>_heapadd<label id="_heapadd"><p>
889 <tag/Function/Add a block to the heap.
890 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
891 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
892 <tag/Description/The function adds a block of raw memory to the heap.
894 <item>The minimum blocksize that can be added is 6 bytes; the function will
895 ignore smaller blocks.
896 <item>The function is available only as a fastcall function; so, it may be used
897 only in the presence of a prototype.
899 <tag/Availability/cc65
901 <ref id="_heapblocksize" name="_heapblocksize">,
902 <ref id="_heapmaxavail" name="_heapmaxavail">,
903 <ref id="_heapmemavail" name="_heapmemavail">,
904 <ref id="calloc" name="calloc">,
905 <ref id="free" name="free">,
906 <ref id="malloc" name="malloc">,
907 <ref id="realloc" name="realloc">
913 <sect1>_heapblocksize<label id="_heapblocksize"><p>
917 <tag/Function/Return the size of an allocated block.
918 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
919 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
920 <tag/Description/The function returns the size of a block that must have
921 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
922 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
924 <item>Passing a pointer to a block that was is not the result of one of the
925 allocation functions, or that has been free'd will give unpredicable results.
926 <item>The function is available only as a fastcall function; so, it may be used
927 only in the presence of a prototype.
929 <tag/Availability/cc65
931 <ref id="_heapadd" name="_heapadd">,
932 <ref id="_heapmaxavail" name="_heapmaxavail">,
933 <ref id="_heapmemavail" name="_heapmemavail">,
934 <ref id="calloc" name="calloc">,
935 <ref id="free" name="free">,
936 <ref id="malloc" name="malloc">,
937 <ref id="realloc" name="realloc">
943 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
947 <tag/Function/Return the largest block that is available on the heap.
948 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
949 <tag/Declaration/<tt/size_t _heapmaxavail (void);/
950 <tag/Description/The function returns the size of the largest block that may
951 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
952 <tag/Availability/cc65
954 <ref id="_heapadd" name="_heapadd">,
955 <ref id="_heapblocksize" name="_heapblocksize">,
956 <ref id="_heapmemavail" name="_heapmemavail">,
957 <ref id="calloc" name="calloc">,
958 <ref id="free" name="free">,
959 <ref id="malloc" name="malloc">,
960 <ref id="realloc" name="realloc">
966 <sect1>_heapmemavail<label id="_heapmemavail"><p>
970 <tag/Function/Return the total available space on the heap.
971 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
972 <tag/Declaration/<tt/size_t _heapmemavail (void);/
973 <tag/Description/The function returns the total number of bytes available on
976 <item>This function is of less use than usually assumed, since the returned
977 heap space may be available but not in one block. So even if this function
978 says that several times more heap space is available than needed, <ref
979 id="malloc" name="malloc"> may still return <tt/NULL/.
981 <tag/Availability/cc65
983 <ref id="_heapadd" name="_heapadd">,
984 <ref id="_heapblocksize" name="_heapblocksize">,
985 <ref id="_heapmaxavail" name="_heapmaxavail">,
986 <ref id="calloc" name="calloc">,
987 <ref id="free" name="free">,
988 <ref id="malloc" name="malloc">,
989 <ref id="realloc" name="realloc">
995 <sect1>_is_cmdline_dos<label id="_is_cmdline_dos"><p>
999 <tag/Function/Determines whether the underlying DOS supports command line arguments.
1000 <tag/Header/<tt/<ref id="atari.h" name="atari.h">/
1001 <tag/Declaration/<tt/unsigned char _is_cmdline_dos (void);/
1002 <tag/Description/The function returns 0 if the DOS doesn't support command line arguments.
1003 It returns 1 if it does.
1004 <tag/Availability/cc65 (<tt/atari/ and <tt/atarixl/ platforms)
1009 <sect1>_poserror<label id="_poserror"><p>
1013 <tag/Function/Print an error message for the error in <tt/_oserror/.
1014 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1015 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
1016 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
1017 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
1018 a colon and a blank. Then the error message for the current contents of
1019 <tt/_oserror/ are printed followed by a newline. The message output is the
1020 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
1021 argument of <tt/_oserror/.
1022 <tag/Notes/<itemize>
1023 <item>Since operating system specific error code are - you guessed it -
1024 operating system specific, the value in <tt/_oserror/ and the message that is
1025 printed depends on the cc65 target.
1026 <item>The function is only available as fastcall function, so it may only
1027 be used in presence of a prototype.
1029 <tag/Availability/cc65
1031 <ref id="_stroserror" name="_stroserror">,
1032 <ref id="perror" name="perror">
1038 <sect1>_randomize<label id="_randomize"><p>
1042 <tag/Function/Initialize the pseudo random number generator.
1043 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1044 <tag/Declaration/<tt/void _randomize (void);/
1045 <tag/Description/The function initializes the random number generator with
1046 a seed derived from fast changing hardware events, so the seed itself can be
1047 considered random to a certain degree.
1048 <tag/Notes/<itemize>
1049 <item>The randomness of the seed depends on the machine hardware.
1051 <tag/Availability/cc65
1053 <ref id="rand" name="rand">,
1054 <ref id="srand" name="srand">
1060 <sect1>_stroserror<label id="_stroserror"><p>
1064 <tag/Function/Return a string describing an OS specific error code.
1065 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1066 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
1067 <tag/Description/<tt/_stroserror/ will return a string describing the given
1068 operating system specific error code.
1069 <tag/Notes/<itemize>
1070 <item>Since operating system specific error code are - you guessed it -
1071 operating system specific, the parameter and the string returned depend on the
1073 <item>The function is only available as fastcall function, so it may only be
1074 used in presence of a prototype.
1076 <tag/Availability/cc65
1078 <ref id="strerror" name="strerror">
1084 <sect1>_swap<label id="_swap"><p>
1088 <tag/Function/Swap the contents of memory areas.
1089 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1090 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
1091 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
1092 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
1093 <tt/size/ bytes in size.
1094 <tag/Notes/<itemize>
1095 <item>The memory areas may not overlap, otherwise the results are undefined.
1096 <item>The function is only available as fastcall function, so it may only be
1097 used in presence of a prototype.
1099 <tag/Availability/cc65
1101 <ref id="memcpy" name="memcpy">,
1102 <ref id="memmove" name="memmove">
1108 <sect1>_sys<label id="_sys"><p>
1112 <tag/Function/Call a subroutine passing register values.
1113 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1114 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
1115 <tag/Description/The function will call the subroutine at the address
1116 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
1117 registers and the CPU flags are set to the values given in the <tt/regs/
1118 structure. On return from the subroutine, the new values of the registers and
1119 flags are stored back overwriting the old values.
1120 <tag/Notes/<itemize>
1121 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
1122 when calling the subroutine (they are unchanged from their current values).
1123 <item>The function is only available as fastcall function, so it may only be
1124 used in presence of a prototype.
1126 <tag/Availability/cc65
1132 <sect1>BRK<label id="BRK"><p>
1136 <tag/Function/Insert a 6502 BRK instrunction into the code.
1137 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1138 <tag/Declaration/<tt/void BRK (void);/
1139 <tag/Description/The function will insert a 6502 BRK instruction into the code
1140 which may be used to trigger a debugger.
1141 <tag/Notes/<itemize>
1142 <item>The function is actually a macro.
1143 <item>The inserted instruction may lead to unexpected results if no debugger
1146 <tag/Availability/cc65
1148 <ref id="CLI" name="CLI">,
1149 <ref id="SEI" name="SEI">
1155 <sect1>CLI<label id="CLI"><p>
1159 <tag/Function/Insert a 6502 CLI instrunction into the code.
1160 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1161 <tag/Declaration/<tt/void CLI (void);/
1162 <tag/Description/The function will insert a 6502 CLI instruction into the code,
1163 so interrupts are enabled. Enabling interrupts has no effects if they are
1164 already enabled (the default).
1165 <tag/Notes/<itemize>
1166 <item>The function is actually a macro.
1167 <item>Disabling interrupts may lead to unexpected results.
1169 <tag/Availability/cc65
1171 <ref id="BRK" name="BRK">,
1172 <ref id="SEI" name="SEI">
1178 <sect1>PEEK<label id="PEEK"><p>
1182 <tag/Function/Read a byte from memory.
1183 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1184 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
1185 <tag/Description/The function will read the absolute memory given by <tt/addr/
1186 and return the value read.
1187 <tag/Notes/<itemize>
1188 <item>The function is actually a macro.
1189 <item>This function depends highly on the platform and environment.
1191 <tag/Availability/cc65
1193 <ref id="PEEKW" name="PEEKW">,
1194 <ref id="POKE" name="POKE">
1200 <sect1>PEEKW<label id="PEEKW"><p>
1204 <tag/Function/Read a word (two bytes) from memory.
1205 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1206 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
1207 <tag/Description/The function will read the absolute memory given by <tt/addr/
1208 and return the value read. The byte read from the higher address is the high
1209 byte of the return value.
1210 <tag/Notes/<itemize>
1211 <item>The function is actually a macro.
1212 <item>This function depends highly on the platform and environment.
1213 <item>The order in which the two bytes are read is unspecified and may
1214 depend of the address expression used.
1216 <tag/Availability/cc65
1218 <ref id="PEEK" name="PEEK">,
1219 <ref id="POKE" name="POKE">
1225 <sect1>POKE<label id="POKE"><p>
1229 <tag/Function/Write a byte to memory.
1230 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1231 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
1232 <tag/Description/The function writes the value <tt/val/ to the absolute
1233 memory address given by <tt/addr/.
1234 <tag/Notes/<itemize>
1235 <item>The function is actually a macro.
1236 <item>This function depends highly on the platform and environment.
1237 <item>Careless use will cause the program to act strange or may crash the
1240 <tag/Availability/cc65
1242 <ref id="PEEK" name="PEEK">,
1243 <ref id="POKEW" name="POKEW">
1249 <sect1>POKEW<label id="POKEW"><p>
1253 <tag/Function/Write a word (two bytes) to memory.
1254 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1255 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
1256 <tag/Description/The function writes the value <tt/val/ to the absolute
1257 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
1258 the <tt/addr/, the high byte is written to <tt/addr+1/.
1259 <tag/Notes/<itemize>
1260 <item>The function is actually a macro.
1261 <item>This function depends highly on the platform and environment.
1262 <item>Careless use will cause the program to act strange or may crash the
1264 <item>The order in which the two bytes are written is unspecified and may
1265 depend of the address expression used.
1267 <tag/Availability/cc65
1269 <ref id="PEEK" name="PEEK">,
1270 <ref id="POKE" name="POKE">
1276 <sect1>SEI<label id="SEI"><p>
1280 <tag/Function/Insert a 6502 SEI instrunction into the code.
1281 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1282 <tag/Declaration/<tt/void SEI (void);/
1283 <tag/Description/The function will insert a 6502 SEI instruction into the code,
1284 so interrupts are disabled. Note that non maskable interrupts cannot be
1286 <tag/Notes/<itemize>
1287 <item>The function is actually a macro.
1288 <item>Disabling interrupts may lead to unexpected results.
1290 <tag/Availability/cc65
1292 <ref id="BRK" name="BRK">,
1293 <ref id="CLI" name="CLI">
1299 <sect1>abort<label id="abort"><p>
1303 <tag/Function/Terminates a program abnormally.
1304 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1305 <tag/Declaration/<tt/void abort (void);/
1306 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
1307 on stderr, then terminates the program with an exit code of 3.
1308 <tag/Availability/ISO 9899
1310 <ref id="assert" name="assert">,
1311 <ref id="exit" name="exit">,
1312 <ref id="raise" name="raise">
1318 <sect1>abs<label id="abs"><p>
1322 <tag/Function/Returns the absolute value of an integer.
1323 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1324 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
1325 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
1327 <tag/Notes/<itemize>
1328 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
1329 <item>The function is only available as fastcall function, so it may only be
1330 used in presence of a prototype.
1332 <tag/Availability/ISO 9899
1334 <ref id="labs" name="labs">
1340 <sect1>assert<label id="assert"><p>
1344 <tag/Function/Test a condition and possibly abort.
1345 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
1346 <tag/Declaration/<tt/void assert (int cond);/
1347 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
1348 statement. If the condition evaluates t zero (false), assert prints a message
1349 on stderr and aborts the program.
1350 <tag/Notes/<itemize>
1351 <item>The function is actually a macro.
1353 <tag/Availability/ISO 9899
1355 <ref id="abort" name="abort">,
1356 <ref id="exit" name="exit">
1362 <sect1>atexit<label id="atexit"><p>
1366 <tag/Function/Register an exit function.
1367 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1368 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1369 <tag/Description/<tt/atexit/ registers the function pointed to by
1370 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1371 terminates, they are called in LIFO order (the last function registered is
1372 called first). <tt/atexit/ returns zero on success and a nonzero value on
1374 <tag/Notes/<itemize>
1375 <item>A maximum of 5 exit functions can be registered.
1376 <item>There is no way to unregister an exit function.
1377 <item>The function is only available as fastcall function, so it may only be
1378 used in presence of a prototype.
1380 <tag/Availability/ISO 9899
1382 <ref id="abort" name="abort">,
1383 <ref id="exit" name="exit">
1389 <sect1>atmos_explode<label id="atmos_explode"><p>
1393 <tag/Function/Bomb sound effect.
1394 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1395 <tag/Declaration/<tt/void __fastcall__ atmos_explode(void);/
1396 <tag/Description/<tt/atmos_explode/ plays the BASIC sound.
1397 <tag/Notes/<itemize>
1398 <item>The function is available only as a fastcall function; so, it may be used
1399 only in the presence of a prototype.
1401 <tag/Availability/cc65
1403 <ref id="atmos_ping" name="atmos_ping">,
1404 <ref id="atmos_shoot" name="atmos_shoot">,
1405 <ref id="atmos_tick" name="atmos_tick">,
1406 <ref id="atmos_tock" name="atmos_tock">,
1407 <ref id="atmos_zap" name="atmos_zap">
1413 <sect1>atmos_load<label id="atmos_load"><p>
1417 <tag/Function/Load Atmos tape.
1418 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1419 <tag/Declaration/<tt/void __fastcall__ atmos_load(const char* name);/
1420 <tag/Description/<tt/atmos_load/ reads a memory block from tape.
1421 <tag/Notes/<itemize>
1422 <item>The function is available only as a fastcall function; so, it may be used
1423 only in the presence of a prototype.
1425 <tag/Availability/cc65
1427 <ref id="atmos_save" name="atmos_save">
1433 <sect1>atmos_ping<label id="atmos_ping"><p>
1437 <tag/Function/Bell or ricochet sound effect.
1438 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1439 <tag/Declaration/<tt/void __fastcall__ atmos_ping(void);/
1440 <tag/Description/<tt/atmos_ping/ plays the BASIC sound.
1441 <tag/Notes/<itemize>
1442 <item>The function is available only as a fastcall function; so, it may be used
1443 only in the presence of a prototype.
1445 <tag/Availability/cc65
1447 <ref id="atmos_explode" name="atmos_explode">,
1448 <ref id="atmos_shoot" name="atmos_shoot">,
1449 <ref id="atmos_tick" name="atmos_tick">,
1450 <ref id="atmos_tock" name="atmos_tock">,
1451 <ref id="atmos_zap" name="atmos_zap">
1457 <sect1>atmos_save<label id="atmos_save"><p>
1461 <tag/Function/Save Atmos tape.
1462 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1463 <tag/Declaration/<tt/void __fastcall__ atmos_save(const char* name, const void* start, const void* end);/
1464 <tag/Description/<tt/atmos_save/ writes a memory block to tape.
1465 <tag/Notes/<itemize>
1466 <item>The function is available only as a fastcall function; so, it may be used
1467 only in the presence of a prototype.
1469 <tag/Availability/cc65
1471 <ref id="atmos_load" name="atmos_load">
1473 atmos_save("hires", 0xa000, 0xc000);
1479 <sect1>atmos_shoot<label id="atmos_shoot"><p>
1483 <tag/Function/Pistol sound effect.
1484 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1485 <tag/Declaration/<tt/void __fastcall__ atmos_shoot(void);/
1486 <tag/Description/<tt/atmos_shoot/ plays the BASIC sound.
1487 <tag/Notes/<itemize>
1488 <item>The function is available only as a fastcall function; so, it may be used
1489 only in the presence of a prototype.
1491 <tag/Availability/cc65
1493 <ref id="atmos_explode" name="atmos_explode">,
1494 <ref id="atmos_ping" name="atmos_ping">,
1495 <ref id="atmos_tick" name="atmos_tick">,
1496 <ref id="atmos_tock" name="atmos_tock">,
1497 <ref id="atmos_zap" name="atmos_zap">
1503 <sect1>atmos_tick<label id="atmos_tick"><p>
1507 <tag/Function/High-pitch click.
1508 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1509 <tag/Declaration/<tt/void __fastcall__ atmos_tick(void);/
1510 <tag/Description/<tt/atmos_tick/ plays the system sound.
1511 <tag/Notes/<itemize>
1512 <item>The function is available only as a fastcall function; so, it may be used
1513 only in the presence of a prototype.
1515 <tag/Availability/cc65
1517 <ref id="atmos_explode" name="atmos_explode">,
1518 <ref id="atmos_ping" name="atmos_ping">,
1519 <ref id="atmos_shoot" name="atmos_shoot">,
1520 <ref id="atmos_tock" name="atmos_tock">,
1521 <ref id="atmos_zap" name="atmos_zap">
1527 <sect1>atmos_tock<label id="atmos_tock"><p>
1531 <tag/Function/Low-pitch click.
1532 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1533 <tag/Declaration/<tt/void __fastcall__ atmos_tock(void);/
1534 <tag/Description/<tt/atmos_tock/ plays the system sound.
1535 <tag/Notes/<itemize>
1536 <item>The function is available only as a fastcall function; so, it may be used
1537 only in the presence of a prototype.
1539 <tag/Availability/cc65
1541 <ref id="atmos_explode" name="atmos_explode">,
1542 <ref id="atmos_ping" name="atmos_ping">,
1543 <ref id="atmos_shoot" name="atmos_shoot">,
1544 <ref id="atmos_tick" name="atmos_tick">,
1545 <ref id="atmos_zap" name="atmos_zap">
1551 <sect1>atmos_zap<label id="atmos_zap"><p>
1555 <tag/Function/Raygun sound effect.
1556 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1557 <tag/Declaration/<tt/void __fastcall__ atmos_zap(void);/
1558 <tag/Description/<tt/atmos_zap/ plays the BASIC sound.
1559 <tag/Notes/<itemize>
1560 <item>The function is available only as a fastcall function; so, it may be used
1561 only in the presence of a prototype.
1563 <tag/Availability/cc65
1565 <ref id="atmos_explode" name="atmos_explode">,
1566 <ref id="atmos_ping" name="atmos_ping">,
1567 <ref id="atmos_shoot" name="atmos_shoot">,
1568 <ref id="atmos_tick" name="atmos_tick">,
1569 <ref id="atmos_tock" name="atmos_tock">
1575 <sect1>atoi<label id="atoi"><p>
1579 <tag/Function/Convert a string to an integer.
1580 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1581 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1582 <tag/Description/<tt/atoi/ converts the given string into an integer.
1583 Conversion stops as soon as any invalid character is encountered.
1584 <tag/Notes/<itemize>
1585 <item>There is no way to detect any conversion errors.
1586 <item>The function does not check for an numerical overflow when converting.
1587 <item>The function is only available as fastcall function, so it may only be
1588 used in presence of a prototype.
1590 <tag/Availability/ISO 9899
1592 <ref id="atol" name="atol">,
1593 <ref id="itoa" name="itoa">,
1594 <ref id="ltoa" name="ltoa">,
1595 <ref id="ultoa" name="ultoa">,
1596 <ref id="utoa" name="utoa">
1602 <sect1>atol<label id="atol"><p>
1606 <tag/Function/Convert a string to a long integer.
1607 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1608 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1609 <tag/Description/<tt/atol/ converts the given string into a long integer.
1610 Conversion stops as soon as any invalid character is encountered.
1611 <tag/Notes/<itemize>
1612 <item>There is no way to detect any conversion errors.
1613 <item>The function does not check for an numerical overflow when converting.
1614 <item>The function is only available as fastcall function, so it may only be
1615 used in presence of a prototype.
1617 <tag/Availability/ISO 9899
1619 <ref id="atoi" name="atoi">,
1620 <ref id="itoa" name="itoa">,
1621 <ref id="ltoa" name="ltoa">,
1622 <ref id="ultoa" name="ultoa">,
1623 <ref id="utoa" name="utoa">
1629 <sect1>bgcolor<label id="bgcolor"><p>
1633 <tag/Function/Set the background text color.
1634 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1635 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1636 <tag/Description/The function will set a new background color and return the
1637 old (current) one. The background color is valid for the whole text output
1638 area of the screen, not just for new text.
1639 <tag/Notes/<itemize>
1640 <item>Background colors are system dependent. The function may have no effect
1641 on systems where the background color cannot be changed.
1642 <item>The function is only available as fastcall function, so it may only be
1643 used in presence of a prototype.
1645 <tag/Availability/cc65
1647 <ref id="bordercolor" name="bordercolor">,
1648 <ref id="textcolor" name="textcolor">
1654 <sect1>bordercolor<label id="bordercolor"><p>
1658 <tag/Function/Set the border (frame) color.
1659 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1660 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1661 <tag/Description/The function will set a new border color. It returns the old
1662 (current) border color.
1663 <tag/Notes/<itemize>
1664 <item>Border colors are system dependent. The function may have no effect
1665 on systems where the border color cannot be changed.
1666 <item>The function is only available as fastcall function, so it may only
1667 be used in presence of a prototype.
1669 <tag/Availability/cc65
1671 <ref id="bgcolor" name="bgcolor">,
1672 <ref id="textcolor" name="textcolor">
1678 <sect1>bsearch<label id="bsearch"><p>
1682 <tag/Function/Do a binary search in a sorted array.
1683 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1684 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1685 const void* base, size_t n, size_t size,
1686 int __fastcall__ (* cmp) (const void*, const void*));/
1687 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1688 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1689 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1690 the function used to compare the members against the key. The function returns
1691 a pointer to the member found, or <tt/NULL/ if there was no match.
1692 <tag/Notes/<itemize>
1693 <item>The contents of the array must be sorted in ascending order according to
1694 the compare function given.
1695 <item>If there are multiple members that match the key, the function will
1696 return one of the members.
1697 <item>The function is only available as fastcall function, so it may only
1698 be used in presence of a prototype.
1699 <item>The function to which <tt/cmp/ points must have the <tt/fastcall/ calling
1702 <tag/Availability/ISO 9899
1704 <ref id="qsort" name="qsort">
1710 <sect1>bzero<label id="bzero"><p>
1714 <tag/Function/Fill a memory area with zeroes.
1715 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1716 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1717 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1719 <tag/Notes/<itemize>
1720 <item>The function is non standard and therefore only available in non ANSI
1721 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1722 <item>The function is only available as fastcall function, so it may only
1723 be used in presence of a prototype.
1725 <tag/Availability/cc65
1727 <ref id="_swap" name="_swap">,
1728 <ref id="memcpy" name="memcpy">,
1729 <ref id="memmove" name="memmove">,
1730 <ref id="memset" name="memset">,
1736 <sect1>c64mode<label id="c64mode"><p>
1740 <tag/Function/Switch the C128 into C64 compatible mode.
1741 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1742 <tag/Declaration/<tt/void c64mode (void);/
1743 <tag/Description/The function will cause the machine to reboot into C64 mode.
1744 <tag/Notes/<itemize>
1745 <item>The function is specific to the C128.
1746 <item>The function will not return to the caller.
1748 <tag/Availability/C128
1754 <sect1>calloc<label id="calloc"><p>
1758 <tag/Function/Allocate and clear memory.
1759 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1760 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1761 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1762 of size <tt/size/, clears the whole block with binary zeroes and returns a
1763 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1765 <tag/Notes/<itemize>
1766 <item>Clearing the memory may not have the expected effect on all platforms:
1767 pointers in the block may not be <tt/NULL/ and floating point variables may
1768 not be zero (0.0). In other words: The "clearing" effect of this function
1769 should be used with care for portable programs.
1770 <item>The function is only available as fastcall function, so it may only
1771 be used in presence of a prototype.
1773 <tag/Availability/ISO 9899
1775 <ref id="_heapadd" name="_heapadd">,
1776 <ref id="_heapblocksize" name="_heapblocksize">,
1777 <ref id="_heapmaxavail" name="_heapmaxavail">,
1778 <ref id="_heapmemavail" name="_heapmemavail">,
1779 <ref id="free" name="free">,
1780 <ref id="malloc" name="malloc">,
1781 <ref id="realloc" name="realloc">
1787 <sect1>cbm_k_acptr<label id="cbm_k_acptr"><p>
1791 <tag/Function/Input byte from serial bus
1792 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1793 <tag/Declaration/<tt/unsigned char cbm_k_acptr (void);/
1794 <tag/Description/The function returns a byte of data, which it
1795 gets from the current TALKer on the serial bus.
1796 In order to receive the data, the device must have previously been
1797 sent a command to TALK and a secondary address if it needs one.
1798 <tag/Notes/<itemize>
1801 <tag/Availability/cc65
1803 <ref id="cbm_k_talk" name="cbm_k_talk">,
1809 <sect1>cbm_k_basin<label id="cbm_k_basin"><p>
1813 <tag/Function/Input a Character from the Current Device
1814 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1815 <tag/Declaration/<tt/unsigned char cbm_k_basin (void);/
1816 <tag/Description/The function returns a character from the current input device.
1817 Device must first have been OPENed and then designated as the input channel by the CHKIN routine.
1818 When this function is called, the next byte of data available from the device is returned.
1819 Exception is the routine for the keyboard device (which is the default input device).
1820 <tag/Notes/<itemize>
1823 <tag/Availability/cc65
1825 <ref id="cbm_k_open" name="cbm_k_open">,
1826 <ref id="cbm_k_chkin" name="cbm_k_chkin">
1832 <sect1>cbm_k_bsout<label id="cbm_k_bsout"><p>
1836 <tag/Function/Output a byte
1837 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1838 <tag/Declaration/<tt/void __fastcall__ cbm_k_bsout (unsigned char C);/
1839 <tag/Description/Function sends the character to the current output device.
1840 Unless a device has been OPENed and designated as the
1841 current output channel using the CHKOUT routine, the character is
1842 printed to the screen, which is the default output device. If the
1843 cassette is the current device, outputting a byte will only add it to
1844 the buffer. No actual transmission of data will occur until the
1845 192-byte buffer is full.
1846 <tag/Notes/<itemize>
1847 <item>The function is only available as fastcall function, so it may
1848 only be used in presence of a prototype.
1850 <tag/Availability/cc65
1852 <ref id="cbm_k_open" name="cbm_k_open">,
1853 <ref id="cbm_k_chkin" name="cbm_k_chkout">
1859 <sect1>cbm_k_chkin<label id="cbm_k_chkin"><p>
1863 <tag/Function/Designate a Logical File As the Current Input Channel
1864 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1865 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_chkin (unsigned char FN);/
1866 <tag/Description/If you wish to
1867 get data from any device other than the keyboard, this function must be
1868 called after OPENing the device, before you can get a data byte with
1869 the cbm_k_basin or cbm_k_getin routine. When called, the routine will designate
1870 the logical file whose file number was supplied as the
1871 current file, its device as the current device, and its secondary
1872 address as the current secondary address. If the device on the
1873 channel is a serial device, which requires a TALK command and
1874 sometimes a secondary address, function will send them over the
1876 <tag/Notes/<itemize>
1877 <item>The function is only available as fastcall function, so it may
1878 only be used in presence of a prototype.
1880 <tag/Availability/cc65
1882 <ref id="cbm_k_open" name="cbm_k_open">,
1883 <ref id="cbm_k_basin" name="cbm_k_basin">,
1884 <ref id="cbm_k_getin" name="cbm_k_getin">
1890 <sect1>cbm_k_ciout<label id="cbm_k_ciout"><p>
1894 <tag/Function/Transmit a byte over the serial bus
1895 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1896 <tag/Declaration/<tt/void __fastcall__ cbm_k_ciout (unsigned char C);/
1897 <tag/Description/Purpose of this function is to send a byte of data over
1898 the serial bus. In order for the data to be received, the serial
1899 device must have first been commanded to LISTEN and been given a
1900 secondary address if necessary. This routine always buffers the
1901 current character, and defers sending it until the next byte is
1902 buffered. When the UNLISTEN command is sent, the last byte will be
1903 sent with an End or Identify (EOI).
1904 <tag/Notes/<itemize>
1905 <item>The function is only available as fastcall function, so it may
1906 only be used in presence of a prototype.
1908 <tag/Availability/cc65
1910 <ref id="cbm_k_listen" name="cbm_k_listen">,
1911 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">
1917 <sect1>cbm_k_ckout<label id="cbm_k_ckout"><p>
1921 <tag/Function/Designate a Logical File As the Current Output Channel
1922 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1923 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_ckout (unsigned char FN);/
1924 <tag/Description/If you wish to
1925 output data to any device other than the screen, this routine must be
1926 called after OPENing the device, and before you output a data byte
1927 with the cbm_k_bsout() function. When called, the function will designate the
1928 logical file whose file number was supplied as the current
1929 file, its device as the current device, and its secondary address as
1930 the current secondary address. If the device on the channel uses the
1931 serial bus, and therefore requires a LISTEN command and possibly a
1932 secondary address, this information will be sent on the bus.
1933 <tag/Notes/<itemize>
1934 <item>The function is only available as fastcall function, so it may
1935 only be used in presence of a prototype.
1937 <tag/Availability/cc65
1939 <ref id="cbm_k_bsout" name="cbm_k_bsout">,
1940 <ref id="cbm_k_listen" name="cbm_k_listen">
1946 <sect1>cbm_k_clall<label id="cbm_k_clall"><p>
1950 <tag/Function/Close All Logical I/O Files
1951 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1952 <tag/Declaration/<tt/void cbm_k_clall (void);/
1953 <tag/Description/It closes all
1954 open files, by resetting the index into open files to
1955 zero and restores the default I/O devices.
1956 <tag/Notes/<itemize>
1959 <tag/Availability/cc65
1961 <ref id="cbm_k_open" name="cbm_k_open">,
1962 <ref id="cbm_k_close" name="cbm_k_close">
1968 <sect1>cbm_k_close<label id="cbm_k_close"><p>
1972 <tag/Function/Close a Logical I/O File
1973 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1974 <tag/Declaration/<tt/void __fastcall__ cbm_k_close (unsigned char FN);/
1975 <tag/Description/It is used to
1976 close a logical file after all I/O operations involving that file have
1978 <tag/Notes/<itemize>
1979 <item>The function is only available as fastcall function, so it may
1980 only be used in presence of a prototype.
1982 <tag/Availability/cc65
1984 <ref id="cbm_k_open" name="cbm_k_open">,
1985 <ref id="cbm_k_clall" name="cbm_k_clall">
1991 <sect1>cbm_k_clrch<label id="cbm_k_clrch"><p>
1995 <tag/Function/Restore Current Input and Output Devices to the Default Devices
1996 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1997 <tag/Declaration/<tt/void cbm_k_clrch (void);/
1998 <tag/Description/It sets the
1999 current input device to the keyboard, and the current output device to
2000 the screen. Also, if the current input device was formerly a serial
2001 device, the routine sends it an UNTALK command on the serial bus, and
2002 if a serial device was formerly the current output device, the routine
2003 sends it an UNLISTEN command.
2004 <tag/Notes/<itemize>
2007 <tag/Availability/cc65
2009 <ref id="cbm_k_chkin" name="cbm_k_chkin">,
2010 <ref id="cbm_k_ckout" name="cbm_k_ckout">
2016 <sect1>cbm_k_getin<label id="cbm_k_getin"><p>
2020 <tag/Function/Get One Byte from the Input Device
2021 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2022 <tag/Declaration/<tt/unsigned char cbm_k_getin (void);/
2023 <tag/Description/Function gets a character from the current input device.
2024 <tag/Notes/<itemize>
2027 <tag/Availability/cc65
2029 <ref id="cbm_k_basin" name="cbm_k_basin">
2035 <sect1>cbm_k_iobase<label id="cbm_k_iobase"><p>
2039 <tag/Function/Return Base Address of Memory-Mapped I/O Devices
2040 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2041 <tag/Declaration/<tt/unsigned cbm_k_iobase (void);/
2042 <tag/Description/This function returns the address of
2043 the memory section where the memory mapped I/O devices are located. This
2044 address can then be used with an offset to access the memory mapped I/O
2045 devices in the Commodore 64. The offset is the number of locations from
2046 the beginning of the page on which the I/O register you want is located.
2047 This function exists to provide compatibility between the Commodore 64,
2048 VIC-20, and future models of the Commodore 64. If the I/O locations for
2049 a program are set by a call to this function, they should
2050 still remain compatible with future versions of the Commodore 64, the
2052 <tag/Notes/<itemize>
2055 <tag/Availability/cc65
2063 <sect1>cbm_k_listen<label id="cbm_k_listen"><p>
2067 <tag/Function/Command a device on the serial bus to LISTEN
2068 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2069 <tag/Declaration/<tt/void __fastcall__ cbm_k_listen (unsigned char dev);/
2070 <tag/Description/This function will command a device on the serial bus to
2071 receive data. The KERNAL routine will OR the supplied device number bit by bit
2072 to convert it to a listen address, then transmits this data as a command on
2073 the serial bus. The specified device will then go into listen mode, and
2074 be ready to accept information.
2075 <tag/Notes/<itemize>
2076 <item>The function is only available as fastcall function, so it may
2077 only be used in presence of a prototype.
2079 <tag/Availability/cc65
2081 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">,
2087 <sect1>cbm_k_load<label id="cbm_k_load"><p>
2091 <tag/Function/Load RAM from a Device
2092 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2093 <tag/Declaration/<tt/unsigned int __fastcall__ cbm_k_load(unsigned char flag, unsigned addr);/
2094 <tag/Description/This function LOADs data bytes from any input device directly into the memory.
2095 It can also be used for a verify operation, comparing data from a device with the data already in
2096 memory, while leaving the data stored in RAM unchanged.
2097 The flag must be set to 0 for a LOAD operation, or 1 for a
2098 verify, If the input device is OPENed with a secondary address (SA) of 0
2099 the header information from the device is ignored. In this case, the starting address for the load must be supplied.
2100 If the device is addressed with a secondary address of 1, then the data is
2101 loaded into memory starting at the location specified by the header.
2102 Function returns the address of the highest RAM location loaded.
2103 Before this function can be called, the KERNAL SETLFS, and SETNAM
2104 routines must be called.
2105 <tag/Notes/<itemize>
2106 <item>The function is only available as fastcall function, so it may
2107 only be used in presence of a prototype.
2109 <tag/Availability/cc65
2111 <ref id="cbm_k_save" name="cbm_k_save">,
2112 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2113 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2119 <sect1>cbm_k_open<label id="cbm_k_open"><p>
2123 <tag/Function/Open a Logical I/O File
2124 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2125 <tag/Declaration/<tt/unsigned char cbm_k_open (void);/
2126 <tag/Description/This function assigns a logical file to a device, so that it can be used for
2127 Input/Output operations. In order to specify the logical file number,
2128 the device number, and the secondary address if any, the cbm_k_setlfs() function must first be called.
2129 Likewise, in order to designate the filename, the cbm_k_setnam() function must be used first. After these two
2130 functions are called, cbm_k_open() is then called.
2131 <tag/Notes/<itemize>
2134 <tag/Availability/cc65
2136 <ref id="cbm_k_close" name="cbm_k_close">,
2137 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2138 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2144 <sect1>cbm_k_readst<label id="cbm_k_readst"><p>
2148 <tag/Function/Read status word
2149 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2150 <tag/Declaration/<tt/unsigned char cbm_k_readst (void);/
2151 <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.
2152 <tag/Notes/<itemize>
2155 <tag/Availability/cc65
2163 <sect1>cbm_k_save<label id="cbm_k_save"><p>
2167 <tag/Function/Save RAM to a Device
2168 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2169 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_save(unsigned int start, unsigned int end)/
2170 <tag/Description/This function saves a section of memory. The cbm_k_setlfs() and cbm_k_setnam() functions must be
2171 used before calling this function. However, a file name is not required to
2172 SAVE to device 1 (the Datassette(TM) recorder). Any attempt to save to
2173 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.
2174 <tag/Notes/<itemize>
2175 <item>The function is only available as fastcall function, so it may
2176 only be used in presence of a prototype.
2178 <tag/Availability/cc65
2180 <ref id="cbm_k_load" name="cbm_k_load">,
2181 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2182 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2188 <sect1>cbm_k_scnkey<label id="cbm_k_scnkey"><p>
2192 <tag/Function/Scan the keyboard matrix.
2193 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2194 <tag/Declaration/<tt/void cbm_k_scnkey (void);/
2195 <tag/Description/This function looks at the switches in the keyboard, to see
2196 if any of them are being pressed. If they are, then code numbers for them are
2197 stored in RAM. Other functions use those numbers to input text. Normally,
2198 the keyboard is scanned by the Kernal's Interrupt Service Routine. But, if
2199 you divert the "Jiffy interrupt" to a C-code ISR, then that ISR must call this
2200 function, in order to provide input from the keyboard.
2201 <tag/Availability/cc65
2203 <ref id="cbm_k_getin" name="cbm_k_getin">,
2204 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2205 <ref id="cgetc" name="cgetc">,
2206 <!-- <ref id="getc" name="getc"> -->
2207 <!-- <ref id="getchar" name="getchar"> -->
2213 <sect1>cbm_k_setlfs<label id="cbm_k_setlfs"><p>
2217 <tag/Function/Set up a logical file
2218 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2219 <tag/Declaration/<tt/void __fastcall__ cbm_k_setlfs (unsigned char LFN, unsigned char DEV, unsigned char SA);/
2220 <tag/Description/This functions sets up the logical file by setting its number, device address,
2221 and secondary address.
2222 <tag/Notes/<itemize>
2223 <item>The function is only available as fastcall function, so it may
2224 only be used in presence of a prototype.
2226 <tag/Availability/cc65
2228 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2234 <sect1>cbm_k_setnam<label id="cbm_k_setnam"><p>
2238 <tag/Function/Set Filename Parameters
2239 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2240 <tag/Declaration/<tt/void __fastcall__ cbm_k_setnam (const char* Name);/
2241 <tag/Description/This function is used to set up the file name for the OPEN,
2242 SAVE, or LOAD operations.
2243 <tag/Notes/<itemize>
2244 <item>The function is only available as fastcall function, so it may
2245 only be used in presence of a prototype.
2247 <tag/Availability/cc65
2249 <ref id="cbm_k_open" name="cbm_k_open">,
2250 <ref id="cbm_k_load" name="cbm_k_load">,
2251 <ref id="cbm_k_save" name="cbm_k_save">
2257 <sect1>cbm_k_talk<label id="cbm_k_talk"><p>
2261 <tag/Function/Commands device to TALK
2262 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2263 <tag/Declaration/<tt/void __fastcall__ cbm_k_talk (unsigned char dev);/
2264 <tag/Description/When called, it ORs the device number with the TALK code (64, $40) and sends it on the serial
2265 bus. This commands the device to TALK.
2266 <tag/Notes/<itemize>
2267 <item>The function is only available as fastcall function, so it may
2268 only be used in presence of a prototype.
2270 <tag/Availability/cc65
2272 <ref id="cbm_k_acptr" name="cbm_k_acptr">
2278 <sect1>cbm_k_udtim<label id="cbm_k_udtim"><p>
2282 <tag/Function/Update the Jiffy clock.
2283 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2284 <tag/Declaration/<tt/void cbm_k_udtim (void);/
2285 <tag/Description/This function adds one count to the Jiffy clock. That clock
2286 counts sixtieths of a second. It is used by the library's <tt/clock()/
2287 function. Normally, the Jiffy clock is updated by the Kernal's Interrupt
2288 Service Routine. But, if you divert the "Jiffy interrupt" to a C-code ISR,
2289 then that ISR must call this function, in order to keep the clock valid.
2290 <tag/Availability/cc65
2292 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2293 <ref id="clock" name="clock">
2299 <sect1>cbm_k_unlsn<label id="cbm_k_unlsn"><p>
2303 <tag/Function/Send an UNLISTEN command
2304 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2305 <tag/Declaration/<tt/void cbm_k_unlsn (void);/
2306 <tag/Description/This function commands all devices on the serial bus to
2307 stop receiving data from the host computer (i.e., UNLISTEN). Calling this
2308 function results in an UNLISTEN command being transmitted on the serial
2309 bus. Only devices previously commanded to LISTEN are affected. This
2310 function is normally used after the host computer is finished sending data
2311 to external devices. Sending the UNLISTEN commands the listening devices
2312 to get off the serial bus so it can be used for other purposes.
2313 <tag/Notes/<itemize>
2316 <tag/Availability/cc65
2318 <ref id="cbm_k_listen" name="cbm_k_listen">
2324 <sect1>cclear<label id="cclear"><p>
2328 <tag/Function/Clear part of a line (write a given number of spaces).
2329 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2330 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
2331 <tag/Description/The function clears part of a line by writing <tt/length/
2332 spaces in the current text color.
2333 <tag/Notes/<itemize>
2334 <item>The function is only available as fastcall function, so it may
2335 only be used in presence of a prototype.
2337 <tag/Availability/cc65
2339 <ref id="cclearxy" name="cclearxy">,
2340 <ref id="clrscr" name="clrscr">
2346 <sect1>cclearxy<label id="cclearxy"><p>
2350 <tag/Function/Clear part of a line (write a given number of spaces) starting
2351 at a specific screen position.
2352 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2353 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
2354 <tag/Description/The function moves the cursor to a specific position, and
2355 will then clear part of the line by writing <tt/length/ spaces in the current
2357 <tag/Notes/<itemize>
2358 <item>The function is only available as fastcall function, so it may
2359 only be used in presence of a prototype.
2361 <tag/Availability/cc65
2363 <ref id="cclear" name="cclear">,
2364 <ref id="clrscr" name="clrscr">
2370 <sect1>cgetc<label id="cgetc"><p>
2374 <tag/Function/Read a character from the keyboard.
2375 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2376 <tag/Declaration/<tt/char cgetc (void);/
2377 <tag/Description/The function reads a character from the keyboard. If there is
2378 no character available, <tt/cgetc()/ waits until the user presses a key. If the
2379 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
2380 displayed while waiting.
2381 <tag/Notes/<itemize>
2382 <item>If the system supports a keyboard buffer, <tt/cgetc()/ will fetch a key
2383 from that buffer; and, wait only if the buffer is empty.
2384 <item>The keyboard must be scanned periodically, in order for this function to
2385 see anything that you type. (See the description of <tt/cbm_k_scnkey()/.)
2387 <tag/Availability/cc65
2389 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2390 <ref id="cursor" name="cursor">,
2391 <ref id="kbhit" name="kbhit">
2397 <sect1>chline<label id="chline"><p>
2401 <tag/Function/Output a horizontal line in text mode.
2402 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2403 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
2404 <tag/Description/The function outputs a horizontal line with the given length
2405 starting at the current cursor position.
2406 <tag/Notes/<itemize>
2407 <item>The character used to draw the horizontal line is system dependent.
2408 If available, a line drawing character is used. Drawing a line that is partially
2409 off screen leads to undefined behaviour.
2410 <item>The function is only available as fastcall function, so it may only be
2411 used in presence of a prototype.
2413 <tag/Availability/cc65
2415 <ref id="chlinexy" name="chlinexy">,
2416 <ref id="cvline" name="cvline">,
2417 <ref id="cvlinexy" name="cvlinexy">
2423 <sect1>chlinexy<label id="chlinexy"><p>
2427 <tag/Function/Output a horizontal line at a given position in text mode.
2428 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2429 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
2430 <tag/Description/The function outputs a horizontal line with the given length
2431 starting at a given position.
2432 <tag/Notes/<itemize>
2433 <item>The character used to draw the horizontal line is system dependent.
2434 If available, a line drawing character is used. Drawing a line that is partially
2435 off screen leads to undefined behaviour.
2436 <item>The function is only available as fastcall function, so it may only be
2437 used in presence of a prototype.
2439 <tag/Availability/cc65
2441 <ref id="chline" name="chline">,
2442 <ref id="cvline" name="cvline">,
2443 <ref id="cvlinexy" name="cvlinexy">
2449 <sect1>clearerr<label id="clearerr"><p>
2453 <tag/Function/Clear error and end-of-file status of a stream.
2454 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2455 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
2456 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
2457 indicators for the stream <tt/f/.
2458 <tag/Notes/<itemize>
2459 <item>The function is only available as fastcall function, so it may only be
2460 used in presence of a prototype.
2462 <tag/Availability/ISO 9899
2464 <ref id="feof" name="feof">,
2465 <ref id="ferror" name="ferror">
2471 <sect1>clock<label id="clock"><p>
2475 <tag/Function/Determine the processor time used.
2476 <tag/Header/<tt/<ref id="time.h" name="time.h">/
2477 <tag/Declaration/<tt/clock_t clock (void);/
2478 <tag/Description/The <tt/clock/ function returns an approximaton of processor
2479 time used by the program. The time is returned in implementation-defined
2480 units. It can be converted to seconds by dividing by the value of the macro
2481 <tt/CLOCKS_PER_SEC/.
2482 <tag/Notes/<itemize>
2483 <item>Since the machines that cc65-generated programs run on cannot run multiple
2484 processes, the function actually will return the time since some
2485 implementation-defined point in the past.
2486 <item>The Jiffy clock must be "running", in order for this function to return
2487 changing values. (See the description of <tt/cbm_k_udtim()/.)
2489 <tag/Availability/ISO 9899
2491 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2492 <ref id="time" name="time">
2498 <sect1>clrscr<label id="clrscr"><p>
2502 <tag/Function/Clear the text screen.
2503 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2504 <tag/Declaration/<tt/void clrscr (void);/
2505 <tag/Description/The function clears the text screen and moves the cursor to
2506 the upper left corner.
2507 <tag/Availability/cc65
2509 <ref id="cclear" name="cclear">,
2510 <ref id="cclearxy" name="cclearxy">
2516 <sect1>close<label id="close"><p>
2520 <tag/Function/Close a file descriptor.
2521 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2522 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
2523 <tag/Description/The function closes the given file descriptor. It returns zero
2524 on success and -1 on error. If an error occurs, the cause can be determined by
2525 reading the <tt/errno/ variable.
2526 <tag/Notes/<itemize>
2527 <item>The function is only available as fastcall function, so it may only
2528 be used in presence of a prototype.
2530 <tag/Availability/POSIX 1003.1
2532 <ref id="creat" name="creat">,
2533 <ref id="open" name="open">
2539 <sect1>closedir<label id="closedir"><p>
2543 <tag/Function/Close a directory.
2544 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
2545 <tag/Declaration/<tt/int __fastcall__ closedir (DIR* dir);/
2546 <tag/Description/The function closes the given directory descriptor. It returns
2547 zero on success and -1 on error. If an error occurs, the cause can be determined
2548 by reading the <tt/errno/ variable.
2549 <tag/Notes/<itemize>
2550 <item>The function is only available as fastcall function, so it may only
2551 be used in presence of a prototype.
2553 <tag/Availability/POSIX 1003.1
2555 <ref id="opendir" name="opendir">,
2556 <ref id="readdir" name="readdir">
2562 <sect1>cpeekc<label id="cpeekc"><p>
2566 <tag/Function/Get a character from the display memory.
2567 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2568 <tag/Declaration/<tt/char cpeekc (void);/
2569 <tag/Description/The function gets the character that's at the current location
2570 of the cursor in the display screen RAM. That character is converted, if
2571 needed, into the encoding that can be passed to <tt/cputc()/.
2572 <tag/Notes/<itemize>
2573 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2574 done to make it obvious that peeking doesn't move the cursor in any way. Your
2575 program must place the cursor where it wants to peek before it calls any of
2578 <tag/Availability/cc65
2580 <ref id="cpeekcolor" name="cpeekcolor">,
2581 <ref id="cpeekrevers" name="cpeekrevers">,
2582 <ref id="cpeeks" name="cpeeks">,
2583 <ref id="cputc" name="cputc">
2589 <sect1>cpeekcolor<label id="cpeekcolor"><p>
2593 <tag/Function/Get a color from the display memory.
2594 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2595 <tag/Declaration/<tt/unsigned char cpeekcolor (void);/
2596 <tag/Description/The function gets the color number that's at the current
2597 location of the cursor in the display screen RAM. That number can be passed to
2599 <tag/Notes/<itemize>
2600 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2601 done to make it obvious that peeking doesn't move the cursor in any way. Your
2602 program must place the cursor where it wants to peek before it calls any of
2605 <tag/Availability/cc65
2607 <ref id="cpeekc" name="cpeekc">,
2608 <ref id="cpeekrevers" name="cpeekrevers">,
2609 <ref id="cpeeks" name="cpeeks">,
2610 <ref id="cputc" name="cputc">,
2611 <ref id="textcolor" name="textcolor">
2617 <sect1>cpeekrevers<label id="cpeekrevers"><p>
2621 <tag/Function/Get a reverse-character attribute from the display memory.
2622 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2623 <tag/Declaration/<tt/unsigned char cpeekrevers (void);/
2624 <tag/Description/The function gets the "reverse-mode" attribute of the
2625 character that's at the current location of the cursor in the display screen
2626 RAM. It returns a boolean value (0/1) that can be passed to <tt/revers()/.
2627 <tag/Notes/<itemize>
2628 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2629 done to make it obvious that peeking doesn't move the cursor in any way. Your
2630 program must place the cursor where it wants to peek before it calls any of
2633 <tag/Availability/cc65
2635 <ref id="cpeekc" name="cpeekc">,
2636 <ref id="cpeekcolor" name="cpeekcolor">,
2637 <ref id="cpeeks" name="cpeeks">,
2638 <ref id="cputc" name="cputc">,
2639 <ref id="revers" name="revers">
2645 <sect1>cpeeks<label id="cpeeks"><p>
2649 <tag/Function/Get a string from the display memory.
2650 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2651 <tag/Declaration/<tt/void __fastcall__ cpeeks (char* s, unsigned length);/
2652 <tag/Description/The function gets a fixed-length string ('\0'-terminated) of
2653 characters that start at the current location of the cursor in the display
2654 screen RAM. Those characters are converted, if needed, into the encoding that
2655 can be passed to <tt/cputs()/. The first argument must point to a RAM area
2656 that's large enough to hold "length + 1" bytes.
2657 <tag/Notes/<itemize>
2658 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2659 done to make it obvious that peeking doesn't move the cursor in any way. Your
2660 program must place the cursor where it wants to peek before it calls any of
2662 <item>The function is available as only a fastcall function;
2663 so, it may be used only in the presence of a prototype.
2665 <tag/Availability/cc65
2667 <ref id="cpeekc" name="cpeekc">,
2668 <ref id="cpeekcolor" name="cpeekcolor">,
2669 <ref id="cpeekrevers" name="cpeekrevers">,
2670 <ref id="cputc" name="cputc">,
2671 <ref id="cputs" name="cputs">
2677 <sect1>creat<label id="creat"><p>
2681 <tag/Function/Create a file.
2682 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2683 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
2684 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
2685 associated with it. On error, -1 is returned and an error code is stored in
2687 <tag/Notes/<itemize>
2688 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
2689 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
2690 <item>The function is only available as fastcall function, so it may only
2691 be used in presence of a prototype.
2693 <tag/Availability/POSIX 1003.1
2695 <ref id="close" name="close">,
2696 <ref id="open" name="open">
2702 <sect1>cprintf<label id="cprintf"><p>
2706 <tag/Function/Formatted output to the console.
2707 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2708 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
2709 <tag/Description/The arguments are converted to text where necessary and
2710 formatted according to the format string given. The resulting string is output
2711 to the console. <tt/cprintf/ supports the same format specifiers as
2712 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
2713 <tag/Notes/<itemize>
2714 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
2715 between <tt/\r/ and <tt/\n/.
2717 <tag/Availability/cc65
2719 <ref id="cputc" name="cputc">,
2720 <ref id="cputcxy" name="cputcxy">,
2721 <ref id="cputs" name="cputs">,
2722 <ref id="cputsxy" name="cputsxy">,
2723 <ref id="vcprintf" name="vcprintf">
2729 <sect1>cputc<label id="cputc"><p>
2733 <tag/Function/Output a character directly to the console.
2734 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2735 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
2736 <tag/Description/Output one character to the console at the current cursor
2738 <tag/Notes/<itemize>
2739 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
2740 between <tt/\r/ and <tt/\n/.
2741 <item>The function is only available as fastcall function, so it may only
2742 be used in presence of a prototype.
2744 <tag/Availability/cc65
2746 <ref id="cprintf" name="cprintf">,
2747 <ref id="cputcxy" name="cputcxy">,
2748 <ref id="cputs" name="cputs">,
2749 <ref id="cputsxy" name="cputsxy">,
2750 <ref id="vcprintf" name="vcprintf">
2756 <sect1>cputcxy<label id="cputcxy"><p>
2760 <tag/Function/Output a character at a specific screen position.
2761 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2762 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
2763 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
2764 the screen and outputs one character.
2765 <tag/Notes/<itemize>
2766 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
2767 between <tt/\r/ and <tt/\n/.
2768 <item>The function is only available as fastcall function, so it may only
2769 be used in presence of a prototype.
2771 <tag/Availability/cc65
2773 <ref id="cprintf" name="cprintf">,
2774 <ref id="cputc" name="cputc">,
2775 <ref id="cputs" name="cputs">,
2776 <ref id="cputsxy" name="cputsxy">,
2777 <ref id="vcprintf" name="vcprintf">
2783 <sect1>cputs<label id="cputs"><p>
2787 <tag/Function/Output a string directly to the console.
2788 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2789 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
2790 <tag/Description/The function outputs the given string on the console at the
2791 current cursor position.
2792 <tag/Notes/<itemize>
2793 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
2794 between <tt/\r/ and <tt/\n/.
2795 <item>The function is only available as fastcall function, so it may only
2796 be used in presence of a prototype.
2798 <tag/Availability/cc65
2800 <ref id="cprintf" name="cprintf">,
2801 <ref id="cputc" name="cputc">,
2802 <ref id="cputcxy" name="cputcxy">,
2803 <ref id="cputsxy" name="cputsxy">,
2804 <ref id="vcprintf" name="vcprintf">
2810 <sect1>cputsxy<label id="cputsxy"><p>
2814 <tag/Function/Output a string to the console at a given position.
2815 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2816 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
2817 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
2818 and outputs the string <tt/s/.
2819 <tag/Notes/<itemize>
2820 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
2821 between <tt/\r/ and <tt/\n/.
2822 <item>The function is only available as fastcall function, so it may only
2823 be used in presence of a prototype.
2825 <tag/Availability/cc65
2827 <ref id="cprintf" name="cprintf">,
2828 <ref id="cputc" name="cputc">,
2829 <ref id="cputcxy" name="cputcxy">,
2830 <ref id="cputs" name="cputs">,
2831 <ref id="vcprintf" name="vcprintf">
2837 <sect1>cursor<label id="cursor"><p>
2841 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
2842 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2843 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
2844 <tag/Description/If the argument to the function is non zero, a blinking cursor
2845 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
2846 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
2847 <tag/Notes/<itemize>
2848 <item>The function is only available as fastcall function, so it may only
2849 be used in presence of a prototype.
2851 <tag/Availability/cc65
2853 <ref id="cgetc" name="cgetc">,
2854 <ref id="kbhit" name="kbhit">
2860 <sect1>cvline<label id="cvline"><p>
2864 <tag/Function/Output a vertical line in text mode.
2865 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2866 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
2867 <tag/Description/The function outputs a vertical line with the given length
2868 starting at the current cursor position.
2869 <tag/Notes/<itemize>
2870 <item>The character used to draw the vertical line is system dependent.
2871 If available, a line drawing character is used. Drawing a line that is partially
2872 off screen leads to undefined behaviour.
2873 <item>The function is only available as fastcall function, so it may only be
2874 used in presence of a prototype.
2876 <tag/Availability/cc65
2878 <ref id="chline" name="chline">,
2879 <ref id="chlinexy" name="chlinexy">,
2880 <ref id="cvlinexy" name="cvlinexy">
2886 <sect1>cvlinexy<label id="cvlinexy"><p>
2890 <tag/Function/Output a vertical line at a given position in text mode.
2891 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2892 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
2893 <tag/Description/The function outputs a vertical line with the given length
2894 starting at a given position.
2895 <tag/Notes/<itemize>
2896 <item>The character used to draw the vertical line is system dependent.
2897 If available, a line drawing character is used. Drawing a line that is partially
2898 off screen leads to undefined behaviour.
2899 <item>The function is only available as fastcall function, so it may only be
2900 used in presence of a prototype.
2902 <tag/Availability/cc65
2904 <ref id="chline" name="chline">,
2905 <ref id="chlinexy" name="chlinexy">,
2906 <ref id="cvline" name="cvline">
2912 <sect1>decompress_lz4<label id="decompress_lz4"><p>
2916 <tag/Function/Uncompress a LZ4-compressed buffer.
2917 <tag/Header/<tt/<ref id="lz4.h" name="lz4.h">/
2918 <tag/Declaration/<tt/void decompress_lz4 (const unsigned char* src, unsigned char* const dst, const unsigned short uncompressed_size);/
2919 <tag/Description/<tt/decompress_lz4/ uncompresses a LZ4-compressed buffer.
2920 <tag/Notes/<itemize>
2921 <item>Use LZ4_compress_HC with compression level 16 for best compression.
2923 <tag/Availability/cc65
2929 <sect1>detect_c128<label id="detect_c128"><p>
2933 <tag/Function/Check if a C128 CPU is the current CPU.
2934 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
2935 <tag/Declaration/<tt/unsigned char detect_c128 (void);/
2936 <tag/Description/The function returns a 1 if a C128 CPU is the current CPU.
2937 <tag/Notes/<itemize>
2938 <item>The function is specific to the C64 and C128.
2940 <tag/Availability/cc65 (not all platforms)
2942 <ref id="get_c128_speed" name="get_c128_speed">,
2943 <ref id="set_c128_speed" name="set_c128_speed">,
2949 <sect1>detect_c64dtv<label id="detect_c64dtv"><p>
2953 <tag/Function/Check for the presence of the C64DTV.
2954 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
2955 <tag/Declaration/<tt/unsigned char detect_c64dtv (void);/
2956 <tag/Description/The function returns a 1 if a C64DTV has been detected.
2957 <tag/Notes/<itemize>
2958 <item>The function is specific to the C64.
2960 <tag/Availability/cc65 (not all platforms)
2962 <ref id="get_c64dtv_speed" name="get_c64dtv_speed">,
2963 <ref id="set_c64dtv_speed" name="set_c64dtv_speed">,
2969 <sect1>detect_scpu<label id="detect_scpu"><p>
2973 <tag/Function/Check for the presence of the C64/C128 SuperCPU cartridge.
2974 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
2975 <tag/Declaration/<tt/unsigned char detect_scpu (void);/
2976 <tag/Description/The function returns a 1 if a SuperCPU cartridge has been detected.
2977 <tag/Notes/<itemize>
2978 <item>The function is specific to the C128 and C64.
2980 <tag/Availability/cc65 (not all platforms)
2982 <ref id="get_scpu_speed" name="get_scpu_speed">,
2983 <ref id="set_scpu_speed" name="set_scpu_speed">,
2989 <sect1>div<label id="div"><p>
2993 <tag/Function/Divide two ints and return quotient and remainder.
2994 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2995 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
2996 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
2997 quotient and remainder in a <tt/div_t/ structure.
2998 <tag/Notes/<itemize>
2999 <item>The function is only available as fastcall function, so it may only
3000 be used in presence of a prototype.
3002 <tag/Availability/ISO 9899
3010 <sect1>doesclrscrafterexit<label id="doesclrscrafterexit"><p>
3014 <tag/Function/Determines whether the screen is going to be cleared after program exit.
3015 <tag/Header/<tt/<ref id="cc65.h" name="cc65.h">/
3016 <tag/Declaration/<tt/unsigned char doesclrscrafterexit (void);/
3017 <tag/Description/The function returns zero if the screen won't be cleared immediately after
3018 program termination. It returns a non-zero value if it will.
3019 <tag/Notes/<itemize>
3020 <item>Some systems, maybe depending on configuration, immediately clear the screen
3021 after a program exits. Therefore it might be difficult to read
3022 the last messages printed by the program prior to its exit. This function can be used
3023 to decide if a delay or wait for a key press should be executed when then program
3026 <tag/Availability/cc65
3029 #include <stdio.h>
3030 #include <unistd.h>
3031 #include <cc65.h>
3034 printf("Hello World\n");
3035 if (doesclrscrafterexit())
3044 <sect1>em_commit<label id="em_commit"><p>
3048 <tag/Function/Commit changes into extended memory.
3049 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3050 <tag/Declaration/<tt/void em_commit (void);/
3051 <tag/Description/Commit changes in the memory window to extended storage. If
3052 the contents of the memory window have been changed, these changes may be lost
3053 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
3054 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
3055 name="em_copyto">/ are called without calling <tt/em_commit/ first.
3056 <tag/Notes/<itemize>
3057 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
3058 memory window are discarded, it does just mean that the drivers is allowed
3060 <item>The function is only available as fastcall function, so it may only be
3061 used in presence of a prototype.
3062 <item>The function produces undefined results if no extended memory driver is
3065 <tag/Availability/cc65
3067 <ref id="em_load_driver" name="em_load_driver">,
3068 <ref id="em_map" name="em_map">,
3069 <ref id="em_use" name="em_use">
3075 <sect1>em_copyfrom<label id="em_copyfrom"><p>
3079 <tag/Function/Copy from extended into normal memory.
3080 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3081 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
3082 <tag/Description/Copy data from extended memory into linear memory. Source and
3083 target addresses as well as the number of bytes to transfer are specified in
3084 the <tt/em_copy/ structure that is passed as a parameter.
3085 <tag/Notes/<itemize>
3086 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
3087 made any changes to the data in the window, call <tt/<ref id="em_commit"
3088 name="em_commit">/ first, or the changes are lost.
3089 <item>The function is only available as fastcall function, so it may only be
3090 used in presence of a prototype.
3091 <item>The function produces undefined results if no extended memory driver is
3094 <tag/Availability/cc65
3096 <ref id="em_commit" name="em_commit">,
3097 <ref id="em_copyto" name="em_copyto">,
3098 <ref id="em_load_driver" name="em_load_driver">
3104 <sect1>em_copyto<label id="em_copyto"><p>
3108 <tag/Function/Copy from normal into extended memory.
3109 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3110 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
3111 <tag/Description/Copy data from linear into extended memory. Source and
3112 target addresses as well as the number of bytes to transfer are specified in
3113 the <tt/em_copy/ structure that is passed as a parameter.
3114 <tag/Notes/<itemize>
3115 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
3116 made any changes to the data in the window, call <tt/<ref id="em_commit"
3117 name="em_commit">/ first, or the changes are lost.
3118 <item>The function is only available as fastcall function, so it may only be
3119 used in presence of a prototype.
3120 <item>The function produces undefined results if no extended memory driver is
3123 <tag/Availability/cc65
3125 <ref id="em_commit" name="em_commit">,
3126 <ref id="em_copyfrom" name="em_copyfrom">,
3127 <ref id="em_load_driver" name="em_load_driver">
3133 <sect1>em_install<label id="em_install"><p>
3137 <tag/Function/Install an already loaded extended memory driver.
3138 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3139 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
3140 <tag/Description/The function installs an already loaded extended memory driver
3141 and returns an error code. The function may be used to install a driver linked
3142 statically to the program.
3143 <tag/Notes/<itemize>
3144 <item>Not all drivers are able to detect if the supported hardware is really
3146 <item>The function is only available as fastcall function, so it may only be
3147 used in presence of a prototype.
3149 <tag/Availability/cc65
3151 <ref id="em_load_driver" name="em_load_driver">,
3152 <ref id="em_uninstall" name="em_uninstall">,
3153 <ref id="em_unload" name="em_unload">
3159 <sect1>em_load_driver<label id="em_load_driver"><p>
3163 <tag/Function/Load and initialize an extended memory driver.
3164 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3165 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
3166 <tag/Description/Load an extended memory driver into memory and initialize
3167 it. The function returns an error code that tells if all this has been
3169 <tag/Notes/<itemize>
3170 <item>Not all drivers are able to detect if the supported hardware is really
3172 <item>The function is only available as fastcall function, so it may only be
3173 used in presence of a prototype.
3174 <item>The driver is loaded by name, so currently you must know the type of
3175 extended memory that should be supported. There is no autodetect capability.
3177 <tag/Availability/cc65
3179 <ref id="em_unload" name="em_unload">
3185 <sect1>em_map<label id="em_map"><p>
3189 <tag/Function/Make a page of extended memory accessible.
3190 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3191 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
3192 <tag/Description/The function maps one page of extended memory into linear
3193 memory and returns a pointer to the page frame. Depending on the hardware
3194 and driver, the data is either mapped into the address space or transfered
3195 into a buffer. If you don't need the actual contents of the page (for example
3196 because you're going to overwrite it completely), it is better to call
3197 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
3198 data if it is possible to avoid that.
3199 <tag/Notes/<itemize>
3200 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
3201 made any changes to the data in the window, call <tt/<ref id="em_commit"
3202 name="em_commit">/ first, or the changes are lost.
3203 <item>The function is only available as fastcall function, so it may only be
3204 used in presence of a prototype.
3205 <item>The function produces undefined results if no extended memory driver is
3208 <tag/Availability/cc65
3210 <ref id="em_commit" name="em_commit">,
3211 <ref id="em_load_driver" name="em_load_driver">,
3212 <ref id="em_use" name="em_use">
3218 <sect1>em_pagecount<label id="em_pagecount"><p>
3222 <tag/Function/Return the number of available extended memory pages.
3223 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3224 <tag/Declaration/<tt/unsigned em_pagecount (void);/
3225 <tag/Description/The function returns the size of the extended memory supported
3226 by the driver in 256 byte pages.
3227 <tag/Notes/<itemize>
3228 <item>The function returns zero if no extended memory driver is loaded.
3229 <item>The function may return zero if the supported hardware was not detected.
3231 <tag/Availability/cc65
3233 <ref id="em_load_driver" name="em_load_driver">
3239 <sect1>em_uninstall<label id="em_uninstall"><p>
3243 <tag/Function/Uninstall an already loaded extended memory driver.
3244 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3245 <tag/Declaration/<tt/unsigned char em_uninstall (void);/
3246 <tag/Description/The function uninstalls an already loaded extended memory
3247 driver but doesn't remove it from memory.
3248 <tag/Notes/<itemize>
3249 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
3250 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
3251 should be used instead of <tt/em_uninstall/ so the driver is also removed
3254 <tag/Availability/cc65
3256 <ref id="em_install" name="em_install">,
3257 <ref id="em_load_driver" name="em_load_driver">,
3258 <ref id="em_unload" name="em_unload">
3264 <sect1>em_unload<label id="em_unload"><p>
3268 <tag/Function/Unload an extended memory driver.
3269 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3270 <tag/Declaration/<tt/unsigned char em_unload (void);/
3271 <tag/Description/The function unloads a loaded extended memory driver and
3272 frees all memory allocated for the driver.
3273 <tag/Notes/<itemize>
3274 <item>The function does nothing if no driver is loaded.
3276 <tag/Availability/cc65
3278 <ref id="em_load_driver" name="em_load_driver">
3284 <sect1>em_use<label id="em_use"><p>
3288 <tag/Function/Prepare an extended memory page for use.
3289 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3290 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
3291 <tag/Description/The function maps one page of extended memory into linear
3292 memory and returns a pointer to the page frame. This function is similar to
3293 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
3294 actual memory window in the assumption that the existing data is wrong or
3295 will get overwritten.
3296 <tag/Notes/<itemize>
3297 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
3298 made any changes to the data in the window, call <tt/<ref id="em_commit"
3299 name="em_commit">/ first, or the changes are lost.
3300 <item>The function is only available as fastcall function, so it may only be
3301 used in presence of a prototype.
3302 <item>The function produces undefined results if no extended memory driver is
3305 <tag/Availability/cc65
3307 <ref id="em_commit" name="em_commit">,
3308 <ref id="em_load_driver" name="em_load_driver">,
3309 <ref id="em_map" name="em_map">
3315 <sect1>exit<label id="exit"><p>
3319 <tag/Function/Terminate the program.
3320 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3321 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
3322 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
3323 return code of the program. Before termination, all files are closed, buffered
3324 output is written and any functions registered with <tt/<ref id="atexit"
3325 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
3326 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
3328 <tag/Notes/<itemize>
3329 <item>The function is only available as fastcall function, so it may only
3330 be used in presence of a prototype.
3331 <item>It depends on the host machine if the program return code can be
3332 evaluated or is ignored.
3334 <tag/Availability/ISO 9899
3336 <ref id="abort" name="abort">,
3337 <ref id="exit" name="exit">
3343 <sect1>exec<label id="exec"><p>
3347 <tag/Function/Execute a program file.
3348 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3349 <tag/Declaration/<tt/int __fastcall__ exec (const char* progname, const char* cmdline);/
3350 <tag/Description/<tt/exec/ replaces the currently running program by a new one.
3351 Calling <tt/exec()/ is identical to calling <tt/<ref id="exit" name="exit()">/,
3352 then loading and starting the program named in the first argument, passing
3353 the command line specified as second argument. Instead of an empty string,
3354 a <tt/NULL/ pointer may be passed as second parameter.
3355 On success, the function does not return. On failure, -1 is returned and
3356 <tt/errno/ contains an error code.
3357 <tag/Notes/<itemize>
3358 <item>The function is only available as fastcall function, so it may only
3359 be used in presence of a prototype.
3360 <item>On most platforms, the function needs to copy a small stub loader to
3361 some memory area outside the program space. This may collide with other
3362 programs. See the platform specific docs on this.
3363 <item>Because it is necessary to terminate the running program before the
3364 memory can be reused to load the new one, there is a high chance that the
3365 function may not be able to return on errors.
3366 <item>The command line is passed to the new program in the same way as cc65
3367 programs expect the command line. If the new program is not a cc65 generated
3368 program, it may not be able to read it.
3370 <tag/Availability/cc65
3372 <ref id="exit" name="exit">
3378 <sect1>fast<label id="fast"><p>
3382 <tag/Function/Switch the CPU into fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
3383 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
3384 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
3385 <tag/Declaration/<tt/void fast (void);/
3386 <tag/Description/The function will switch the clock of the CPU to fast mode. For the C128
3387 target it means switching the CPU into 2MHz mode. For the C16/Plus4 target it means
3388 switching the CPU into double clock mode.
3389 <tag/Notes/<itemize>
3390 <item>The function is specific to the C128, C16 and Plus4.
3391 <item>On the C128 the 2MHz clock will not work in 40 column mode.
3393 <tag/Availability/cc65 (not all platforms)
3395 <ref id="isfast" name="isfast">,
3396 <ref id="slow" name="slow">,
3402 <sect1>feof<label id="feof"><p>
3406 <tag/Function/Return the end-of-file indicator of a stream.
3407 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3408 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
3409 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
3410 <tt/f/, and returns a non zero value if it is set.
3411 <tag/Notes/<itemize>
3412 <item>The indicator is set only after a read past the end of a file is
3414 <item>The function is only available as fastcall function, so it may only be
3415 used in presence of a prototype.
3417 <tag/Availability/ISO 9899
3419 <ref id="feof" name="clearerr">,
3420 <ref id="ferror" name="ferror">
3426 <sect1>ferror<label id="ferror"><p>
3430 <tag/Function/Return the error indicator of a stream.
3431 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3432 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
3433 <tag/Description/<tt/ferror/ tests the error indicator of the stream
3434 <tt/f/, and returns a non zero value if it is set.
3435 <tag/Notes/<itemize>
3436 <item>The function is only available as fastcall function, so it may only be
3437 used in presence of a prototype.
3439 <tag/Availability/ISO 9899
3441 <ref id="feof" name="clearerr">,
3442 <ref id="ferror" name="feof">
3448 <sect1>fileno<label id="fileno"><p>
3452 <tag/Function/Return the file handle used by a stream.
3453 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3454 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
3455 <tag/Description/The <tt/fileno/ function returns the file handle used
3456 internally by a C stream. This file handle (an integer) can be used as a
3457 handle for the POSIX input/output functions.
3458 <tag/Notes/<itemize>
3459 <item>The function is only available as fastcall function, so it may only be
3460 used in presence of a prototype.
3461 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
3462 file may have unpredictable results.
3464 <tag/Availability/POSIX 1003.1
3466 <ref id="creat" name="creat">,
3467 <ref id="open" name="open"> <!-- , -->
3468 <!-- <ref id="read" name="read">, -->
3469 <!-- <ref id="write" name="write"> -->
3475 <sect1>free<label id="free"><p>
3479 <tag/Function/Free a block of dynamic memory.
3480 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3481 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
3482 <tag/Description/Free a block of dynamic memory previously allocated with
3483 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
3484 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
3485 pointer is <tt/NULL/, no action is performed.
3486 <tag/Notes/<itemize>
3487 <item>Passing an already free'd block to <tt/free/ again will cause undefined
3488 behaviour and may crash your program.
3489 <item>The function is only available as fastcall function, so it may only
3490 be used in presence of a prototype.
3492 <tag/Availability/ISO 9899
3494 <ref id="_heapadd" name="_heapadd">,
3495 <ref id="_heapblocksize" name="_heapblocksize">,
3496 <ref id="_heapmaxavail" name="_heapmaxavail">,
3497 <ref id="_heapmemavail" name="_heapmemavail">,
3498 <ref id="calloc" name="calloc">,
3499 <ref id="malloc" name="malloc">,
3500 <ref id="realloc" name="realloc">
3506 <sect1>get_ostype<label id="get_ostype"><p>
3510 <tag/Function/The function returns the operating system, the program runs on.
3511 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
3512 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
3513 <tag/Declaration/<tt/unsigned char get_ostype (void);/
3514 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
3515 all supported targets. If it exists, it returns a number that identifies the
3516 operating system or machine type, the program runs on. The machine dependent
3517 header files define constants that can be used to check the return code.
3518 <tag/Notes/<itemize>
3519 <item>The function does not exist on all platforms.
3520 <item>The return codes are platform dependent.
3522 <tag/Availability/cc65 (not all platforms)
3528 <sect1>get_c128_speed<label id="get_c128_speed"><p>
3532 <tag/Function/Get the current speed of the C128 CPU.
3533 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3534 <tag/Declaration/<tt/unsigned char get_c128_speed (void);/
3535 <tag/Description/The function returns the current speed of the C128 CPU.
3536 <tag/Notes/<itemize>
3537 <item>The function is specific to the C64 and C128.
3538 <item>The function does not check if the C128 CPU is the current CPU.
3539 <item>See the accelerator.h header for the speed definitions.
3541 <tag/Availability/cc65 (not all platforms)
3543 <ref id="detect_c128" name="detect_c128">,
3544 <ref id="set_c128_speed" name="set_c128_speed">,
3550 <sect1>get_c64dtv_speed<label id="get_c64dtv_speed"><p>
3554 <tag/Function/Get the current speed of the C64DTV.
3555 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3556 <tag/Declaration/<tt/unsigned char get_c64dtv_speed (void);/
3557 <tag/Description/The function returns the current speed of the C64DTV.
3558 <tag/Notes/<itemize>
3559 <item>The function is specific to the C64.
3560 <item>The function does not check for the presence of the C64DTV.
3561 <item>See the accelerator.h header for the speed definitions.
3563 <tag/Availability/cc65 (not all platforms)
3565 <ref id="detect_c64dtv" name="detect_c64dtv">,
3566 <ref id="set_c64dtv_speed" name="set_c64dtv_speed">,
3572 <sect1>get_scpu_speed<label id="get_scpu_speed"><p>
3576 <tag/Function/Get the current speed of the C64/C128 SuperCPU cartridge.
3577 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3578 <tag/Declaration/<tt/unsigned char get_scpu_speed (void);/
3579 <tag/Description/The function returns the current speed of the SuperCPU cartridge.
3580 <tag/Notes/<itemize>
3581 <item>The function is specific to the C128 and C64.
3582 <item>The function does not check for the presence of the cartridge.
3583 <item>See the accelerator.h header for the speed definitions.
3585 <tag/Availability/cc65 (not all platforms)
3587 <ref id="detect_scpu" name="detect_scpu">,
3588 <ref id="set_scpu_speed" name="set_scpu_speed">,
3594 <sect1>getcpu<label id="getcpu"><p>
3598 <tag/Function/Determine on which CPU the program is running.
3599 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3600 <tag/Declaration/<tt/unsigned char getcpu (void);/
3601 <tag/Description/The function checks on which CPU the code is running. It
3602 returns one of the constants<itemize>
3604 <item><tt/CPU_65C02/
3605 <item><tt/CPU_65816/
3607 <item><tt/CPU_65SC02/
3608 <item><tt/CPU_65CE02/
3609 <item><tt/CPU_HUC6280/
3612 <tag/Notes/<itemize>
3613 <item>Other, more exotic CPU types are not disinguished.
3615 <tag/Availability/cc65
3621 <sect1>getcurrentdevice<label id="getcurrentdevice"><p>
3625 <tag/Function/Get current device.
3626 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3627 <tag/Declaration/<tt/unsigned char getcurrentdevice (void);/
3628 <tag/Description/The function returns the current device.
3629 It allows to access the current device with the <ref id="dio.h"
3630 name="Low-level disk I/O API"> or <ref id="cbm.h" name="cbm_* I/O
3631 functions"> requiring a 'device' parameter.
3632 <tag/Availability/cc65
3634 <ref id="getdevicedir" name="getdevicedir">,
3635 <ref id="getfirstdevice" name="getfirstdevice">,
3636 <ref id="getnextdevice" name="getnextdevice">
3638 dio_open (getcurrentdevice ());
3644 <sect1>getcwd<label id="getcwd"><p>
3648 <tag/Function/Get current working directory.
3649 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3650 <tag/Declaration/<tt/char* __fastcall__ getcwd (char* buf, size_t size);/
3651 <tag/Description/The function will return the current working directory.
3652 <tag/Notes/<itemize>
3653 <item>The function is only available as fastcall function, so it may only
3654 be used in presence of a prototype.
3656 <tag/Availability/POSIX 1003.1
3662 <sect1>getdevicedir<label id="getdevicedir"><p>
3666 <tag/Function/Get device directory.
3667 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3668 <tag/Declaration/<tt/char* __fastcall__ getdevicedir (unsigned char device, char* buf, size_t size);/
3669 <tag/Description/The function returns the directory representing <tt/device/.
3670 It allows to access the device on filesystem level by calling chdir() with
3671 the directory returned.
3672 <tag/Notes/<itemize>
3673 <item>Calling getdevicedir() <em/does/ check for a (formatted) disk in a
3674 floppy-disk-type device and returns NULL if that check fails.
3675 <item>The function is only available as fastcall function, so it may only
3676 be used in presence of a prototype.
3678 <tag/Availability/cc65
3680 <ref id="getcwd" name="getcwd">,
3681 <ref id="getcurrentdevice" name="getcurrentdevice">,
3682 <ref id="getfirstdevice" name="getfirstdevice">,
3683 <ref id="getnextdevice" name="getnextdevice">
3685 chdir (getdevicedir (device, buf, sizeof buf));
3687 cf. <tt/samples/enumdevdir.c/
3692 <sect1>getenv<label id="getenv"><p>
3696 <tag/Function/Return a value from the environment.
3697 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3698 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
3699 <tag/Description/The function searches the environment for an entry that
3700 matches <tt/name/ and returns its value. The environment consists of a list
3701 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
3703 <tag/Notes/<itemize>
3704 <item>What exactly is stored in the environment depends on the machine the
3705 program is running on.
3706 <item>The function is only available as fastcall function, so it may only
3707 be used in presence of a prototype.
3709 <tag/Availability/ISO 9899
3715 <sect1>getfirstdevice<label id="getfirstdevice"><p>
3719 <tag/Function/Get first device.
3720 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3721 <tag/Declaration/<tt/unsigned char getfirstdevice (void);/
3722 <tag/Description/The function returns the first device.
3723 The constant <tt/INVALID_DEVICE/ indicates no device.
3724 <tag/Notes/<itemize>
3725 <item>Calling getfirstdevice() does <em/not/ turn on the motor of a
3726 drive-type device and does <em/not/ check for a disk in the drive.
3728 <tag/Availability/cc65
3730 <ref id="getcurrentdevice" name="getcurrentdevice">,
3731 <ref id="getdevicedir" name="getdevicedir">,
3732 <ref id="getnextdevice" name="getnextdevice">
3734 unsigned char dev = getfirstdevice ();
3735 while (dev != INVALID_DEVICE) {
3736 printf ("%d\n", dev);
3737 dev = getnextdevice (dev);
3744 <sect1>getnextdevice<label id="getnextdevice"><p>
3748 <tag/Function/Get next device.
3749 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3750 <tag/Declaration/<tt/unsigned char __fastcall__ getnextdevice (unsigned char device);/
3751 <tag/Description/The function returns the next device after <tt/device/.
3752 The constant <tt/INVALID_DEVICE/ indicates no further device.
3753 <tag/Notes/<itemize>
3754 <item>Calling getnextdevice() does <em/not/ turn on the motor of a
3755 drive-type device and does <em/not/ check for a disk in the drive.
3756 <item>The function is only available as fastcall function, so it may only
3757 be used in presence of a prototype.
3759 <tag/Availability/cc65
3761 <ref id="getcurrentdevice" name="getcurrentdevice">,
3762 <ref id="getdevicedir" name="getdevicedir">,
3763 <ref id="getfirstdevice" name="getfirstdevice">
3765 unsigned char dev = getfirstdevice ();
3766 while (dev != INVALID_DEVICE) {
3767 printf ("%d\n", dev);
3768 dev = getnextdevice (dev);
3775 <sect1>getopt<label id="getopt"><p>
3779 <tag/Function/Parse command line options.
3780 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3781 <tag/Declaration/<tt/int __fastcall__ getopt (int argc, char* const* argv,
3782 const char* optstring);/
3783 <tag/Description/The function parses command line arguments, <tt/argc/ and
3784 <tt/argv/ are the argument count and array passed to <tt/main/. <tt/optstring/
3785 is a string that contains command line option characters. If a character in
3786 <tt/optstring/ is followed by a colon, the option requires an argument. An
3787 option on the command line is recognized if it is one of the option characters
3789 <tt/getopt/ must be called repeatedly. It will return each option character
3790 found on the command line and <tt/EOF/ (-1) if there is no other option. An
3791 option argument is placed in <tt/optarg/, the index of the next element on the
3792 command line to be processed is placed in <tt/optind/.
3793 <tag/Notes/<itemize>
3794 <item>The implementation will not reorder options. A non option on the command
3795 line will terminate option processing. All remaining arguments are not
3796 recognized as options, even if the start with a '-' character.
3797 <item>The function is only available as fastcall function, so it may only
3798 be used in presence of a prototype.
3800 <tag/Availability/POSIX.2
3806 <sect1>gotox<label id="gotox"><p>
3810 <tag/Function/Move the text mode cursor to a new X position.
3811 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3812 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
3813 <tag/Description/The function moves the text mode cursor to the specified X
3814 position while leaving the Y position untouched. The leftmost position on the
3815 screen has the coordinate 0.
3816 <tag/Notes/<itemize>
3817 <item>The function is only available as fastcall function, so it may
3818 only be used in presence of a prototype.
3819 <item>Invalid values for the X position (out of screen coordinates) may
3820 lead to undefined behaviour.
3822 <tag/Availability/cc65
3824 <ref id="gotoy" name="gotoy">,
3825 <ref id="gotoxy" name="gotoxy">,
3826 <ref id="wherex" name="wherex">,
3827 <ref id="wherey" name="wherey">
3833 <sect1>gotoxy<label id="gotoxy"><p>
3837 <tag/Function/Move the text mode cursor to a new position.
3838 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3839 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
3840 <tag/Description/The function moves the text mode cursor to the specified
3841 position. The leftmost position on the screen has the X coordinate 0, the
3842 topmost line has the Y coordinate 0.
3843 <tag/Notes/<itemize>
3844 <item>The function is only available as fastcall function, so it may only be
3845 used in presence of a prototype.
3846 <item>Invalid values for any of both coordinates (out of screen positions) may
3847 lead to undefined behaviour.
3849 <tag/Availability/cc65
3851 <ref id="gotox" name="gotox">,
3852 <ref id="gotoy" name="gotoy">,
3853 <ref id="wherex" name="wherex">,
3854 <ref id="wherey" name="wherey">
3860 <sect1>gotoy<label id="gotoy"><p>
3864 <tag/Function/Move the text mode cursor to a new Y position.
3865 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3866 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
3867 <tag/Description/The function moves the text mode cursor to the specified Y
3868 position while leaving the X position untouched. The uppermost position on the
3869 screen has the coordinate 0.
3870 <tag/Notes/<itemize>
3871 <item>The function is only available as fastcall function, so it may
3872 only be used in presence of a prototype.
3873 <item>Invalid values for the Y position (out of screen coordinates) may lead
3874 to undefined behaviour.
3876 <tag/Availability/cc65
3878 <ref id="gotox" name="gotox">,
3879 <ref id="gotoxy" name="gotoxy">,
3880 <ref id="wherex" name="wherex">,
3881 <ref id="wherey" name="wherey">
3887 <sect1>isalnum<label id="isalnum"><p>
3891 <tag/Function/Check if a given character is a letter or digit.
3892 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3893 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
3894 <tag/Description/The function returns a non zero value if the given argument
3895 is a letter or digit. The return value is zero if the character is anything
3897 <tag/Notes/<itemize>
3898 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3899 inline sequence generated by the macro will not work correctly for values
3900 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3901 this range. The non inline function may be accessed by <tt/#undef/'ing
3903 <item>When compiling without <tt/-Os/, the function is only available as
3904 fastcall function, so it may only be used in presence of a prototype.
3906 <tag/Availability/ISO 9899
3908 <ref id="isalpha" name="isalpha">,
3909 <ref id="isascii" name="isascii">,
3910 <ref id="isblank" name="isblank">,
3911 <ref id="iscntrl" name="iscntrl">,
3912 <ref id="isdigit" name="isdigit">,
3913 <ref id="isgraph" name="isgraph">,
3914 <ref id="islower" name="islower">,
3915 <ref id="isprint" name="isprint">,
3916 <ref id="ispunct" name="ispunct">,
3917 <ref id="isspace" name="isspace">,
3918 <ref id="isupper" name="isupper">,
3919 <ref id="isxdigit" name="isxdigit">
3925 <sect1>isalpha<label id="isalpha"><p>
3929 <tag/Function/Check if a given character is a letter.
3930 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3931 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
3932 <tag/Description/The function returns a non zero value if the given argument
3933 is a letter. The return value is zero if the character is anything else.
3934 <tag/Notes/<itemize>
3935 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3936 inline sequence generated by the macro will not work correctly for values
3937 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3938 this range. The non inline function may be accessed by <tt/#undef/'ing the
3940 <item>When compiling without <tt/-Os/, the function is only available as
3941 fastcall function, so it may only be used in presence of a prototype.
3943 <tag/Availability/ISO 9899
3945 <ref id="isalnum" name="isalnum">,
3946 <ref id="isascii" name="isascii">,
3947 <ref id="isblank" name="isblank">,
3948 <ref id="iscntrl" name="iscntrl">,
3949 <ref id="isdigit" name="isdigit">,
3950 <ref id="isgraph" name="isgraph">,
3951 <ref id="islower" name="islower">,
3952 <ref id="isprint" name="isprint">,
3953 <ref id="ispunct" name="ispunct">,
3954 <ref id="isspace" name="isspace">,
3955 <ref id="isupper" name="isupper">,
3956 <ref id="isxdigit" name="isxdigit">
3962 <sect1>isascii<label id="isascii"><p>
3966 <tag/Function/Check if a given character is in the ASCII (0..127) range.
3967 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3968 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
3969 <tag/Description/The function returns a non zero value if the given argument
3970 is in the range 0..127 (the range of valid ASCII characters) and zero if not.
3971 <tag/Notes/<itemize>
3972 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3973 inline sequence generated by the macro will not work correctly for values
3974 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3975 this range. The non inline function may be accessed by <tt/#undef/'ing the
3977 <item>When compiling without <tt/-Os/, the function is only available as
3978 fastcall function, so it may only be used in presence of a prototype.
3980 <tag/Availability/ISO 9899
3982 <ref id="isalnum" name="isalnum">,
3983 <ref id="isalpha" name="isalpha">,
3984 <ref id="isblank" name="isblank">,
3985 <ref id="iscntrl" name="iscntrl">,
3986 <ref id="isdigit" name="isdigit">,
3987 <ref id="isgraph" name="isgraph">,
3988 <ref id="islower" name="islower">,
3989 <ref id="isprint" name="isprint">,
3990 <ref id="ispunct" name="ispunct">,
3991 <ref id="isspace" name="isspace">,
3992 <ref id="isupper" name="isupper">,
3993 <ref id="isxdigit" name="isxdigit">
3999 <sect1>isblank<label id="isblank"><p>
4003 <tag/Function/Check if a given character is a space or tab.
4004 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4005 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
4006 <tag/Description/The function returns a non zero value if the given argument
4007 is a space or tab character. The return value is zero if the character is
4009 <tag/Notes/<itemize>
4010 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4011 inline sequence generated by the macro will not work correctly for values
4012 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4013 this range. The non inline function may be accessed by <tt/#undef/'ing the
4015 <item>When compiling without <tt/-Os/, the function is only available as
4016 fastcall function, so it may only be used in presence of a prototype.
4018 <tag/Availability/ISO 9899
4020 <ref id="isalnum" name="isalnum">,
4021 <ref id="isalpha" name="isalpha">,
4022 <ref id="isascii" name="isascii">,
4023 <ref id="iscntrl" name="iscntrl">,
4024 <ref id="isdigit" name="isdigit">,
4025 <ref id="isgraph" name="isgraph">,
4026 <ref id="islower" name="islower">,
4027 <ref id="isprint" name="isprint">,
4028 <ref id="ispunct" name="ispunct">,
4029 <ref id="isspace" name="isspace">,
4030 <ref id="isupper" name="isupper">,
4031 <ref id="isxdigit" name="isxdigit">
4037 <sect1>iscntrl<label id="iscntrl"><p>
4041 <tag/Function/Check if a given character is a control character.
4042 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4043 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
4044 <tag/Description/The function returns a non zero value if the given argument
4045 is a control character. The return value is zero if the character is anything
4047 <tag/Notes/<itemize>
4048 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4049 inline sequence generated by the macro will not work correctly for values
4050 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4051 this range. The non inline function may be accessed by <tt/#undef/'ing the
4053 <item>When compiling without <tt/-Os/, the function is only available as
4054 fastcall function, so it may only be used in presence of a prototype.
4056 <tag/Availability/ISO 9899
4058 <ref id="isalnum" name="isalnum">,
4059 <ref id="isalpha" name="isalpha">,
4060 <ref id="isascii" name="isascii">,
4061 <ref id="isblank" name="isblank">,
4062 <ref id="isdigit" name="isdigit">,
4063 <ref id="isgraph" name="isgraph">,
4064 <ref id="islower" name="islower">,
4065 <ref id="isprint" name="isprint">,
4066 <ref id="ispunct" name="ispunct">,
4067 <ref id="isspace" name="isspace">,
4068 <ref id="isupper" name="isupper">,
4069 <ref id="isxdigit" name="isxdigit">
4075 <sect1>isdigit<label id="isdigit"><p>
4079 <tag/Function/Check if a given character is a digit.
4080 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4081 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
4082 <tag/Description/The function returns a non zero value if the given argument
4083 is a digit. The return value is zero if the character is anything else.
4084 <tag/Notes/<itemize>
4085 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4086 inline sequence generated by the macro will not work correctly for values
4087 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4088 this range. The non inline function may be accessed by <tt/#undef/'ing the
4090 <item>When compiling without <tt/-Os/, the function is only available as
4091 fastcall function, so it may only be used in presence of a prototype.
4093 <tag/Availability/ISO 9899
4095 <ref id="isalnum" name="isalnum">,
4096 <ref id="isalpha" name="isalpha">,
4097 <ref id="isascii" name="isascii">,
4098 <ref id="isblank" name="isblank">,
4099 <ref id="iscntrl" name="iscntrl">,
4100 <ref id="isgraph" name="isgraph">,
4101 <ref id="islower" name="islower">,
4102 <ref id="isprint" name="isprint">,
4103 <ref id="ispunct" name="ispunct">,
4104 <ref id="isspace" name="isspace">,
4105 <ref id="isupper" name="isupper">,
4106 <ref id="isxdigit" name="isxdigit">
4112 <sect1>isfast<label id="isfast"><p>
4116 <tag/Function/Check if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
4117 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
4118 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
4119 <tag/Declaration/<tt/unsigned char isfast (void);/
4120 <tag/Description/The function returns a 1 if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
4121 <tag/Notes/<itemize>
4122 <item>The function is specific to the C128, C16 and Plus4.
4124 <tag/Availability/cc65 (not all platforms)
4126 <ref id="fast" name="fast">,
4127 <ref id="slow" name="slow">,
4133 <sect1>isgraph<label id="isgraph"><p>
4137 <tag/Function/Check if a given character is a printable character (except
4139 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4140 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
4141 <tag/Description/The function returns a non zero value if the given argument
4142 is a printable character with the exception of space. The return value is zero
4143 if the character is anything else.
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="isblank" name="isblank">,
4159 <ref id="iscntrl" name="iscntrl">,
4160 <ref id="isdigit" name="isdigit">,
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>islower<label id="islower"><p>
4176 <tag/Function/Check if a given character is a lower case letter.
4177 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4178 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
4179 <tag/Description/The function returns a non zero value if the given argument
4180 is a lower case letter. 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="iscntrl" name="iscntrl">,
4198 <ref id="isdigit" name="isdigit">,
4199 <ref id="isgraph" name="isgraph">,
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>isprint<label id="isprint"><p>
4214 <tag/Function/Check if a given character is a printable character.
4215 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4216 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
4217 <tag/Description/The function returns a non zero value if the given argument
4218 is a printable character (this includes the space character). The return value
4219 is zero if the character is anything else.
4220 <tag/Notes/<itemize>
4221 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4222 inline sequence generated by the macro will not work correctly for values
4223 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4224 this range. The non inline function may be accessed by <tt/#undef/'ing the
4226 <item>When compiling without <tt/-Os/, the function is only available as
4227 fastcall function, so it may only be used in presence of a prototype.
4229 <tag/Availability/ISO 9899
4231 <ref id="isalnum" name="isalnum">,
4232 <ref id="isalpha" name="isalpha">,
4233 <ref id="isascii" name="isascii">,
4234 <ref id="isblank" name="isblank">,
4235 <ref id="iscntrl" name="iscntrl">,
4236 <ref id="isdigit" name="isdigit">,
4237 <ref id="isgraph" name="isgraph">,
4238 <ref id="islower" name="islower">,
4239 <ref id="ispunct" name="ispunct">,
4240 <ref id="isspace" name="isspace">,
4241 <ref id="isupper" name="isupper">,
4242 <ref id="isxdigit" name="isxdigit">
4248 <sect1>ispunct<label id="ispunct"><p>
4252 <tag/Function/Check if a given character is a printable character but not a
4253 space or an alphanumeric character.
4254 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4255 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
4256 <tag/Description/The function returns a non zero value if the given argument
4257 is a printable character, but not a space or anything alphanumeric. The return
4258 value is zero if the character is anything else.
4259 <tag/Notes/<itemize>
4260 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4261 inline sequence generated by the macro will not work correctly for values
4262 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4263 this range. The non inline function may be accessed by <tt/#undef/'ing the
4265 <item>When compiling without <tt/-Os/, the function is only available as
4266 fastcall function, so it may only be used in presence of a prototype.
4268 <tag/Availability/ISO 9899
4270 <ref id="isalnum" name="isalnum">,
4271 <ref id="isalpha" name="isalpha">,
4272 <ref id="isascii" name="isascii">,
4273 <ref id="isblank" name="isblank">,
4274 <ref id="iscntrl" name="iscntrl">,
4275 <ref id="isdigit" name="isdigit">,
4276 <ref id="isgraph" name="isgraph">,
4277 <ref id="islower" name="islower">,
4278 <ref id="isprint" name="isprint">,
4279 <ref id="isspace" name="isspace">,
4280 <ref id="isupper" name="isupper">,
4281 <ref id="isxdigit" name="isxdigit">
4287 <sect1>isspace<label id="isspace"><p>
4291 <tag/Function/Check if a given character is a white-space character.
4292 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4293 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
4294 <tag/Description/The function returns a non zero value if the given argument
4295 is a white space character. The return value is zero if the character is
4296 anything else. The standard white space characters are: space, formfeed ('\f'),
4297 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
4299 <tag/Notes/<itemize>
4300 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4301 inline sequence generated by the macro will not work correctly for values
4302 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4303 this range. The non inline function may be accessed by <tt/#undef/'ing the
4305 <item>When compiling without <tt/-Os/, the function is only available as
4306 fastcall function, so it may only be used in presence of a prototype.
4308 <tag/Availability/ISO 9899
4310 <ref id="isalnum" name="isalnum">,
4311 <ref id="isalpha" name="isalpha">,
4312 <ref id="isascii" name="isascii">,
4313 <ref id="isblank" name="isblank">,
4314 <ref id="iscntrl" name="iscntrl">,
4315 <ref id="isdigit" name="isdigit">,
4316 <ref id="isgraph" name="isgraph">,
4317 <ref id="islower" name="islower">,
4318 <ref id="isprint" name="isprint">,
4319 <ref id="ispunct" name="ispunct">,
4320 <ref id="isupper" name="isupper">,
4321 <ref id="isxdigit" name="isxdigit">
4327 <sect1>isupper<label id="isupper"><p>
4331 <tag/Function/Check if a given character is an upper case letter.
4332 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4333 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
4334 <tag/Description/The function returns a non zero value if the given argument
4335 is an upper case letter. The return value is zero if the character is anything
4337 <tag/Notes/<itemize>
4338 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4339 inline sequence generated by the macro will not work correctly for values
4340 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4341 this range. The non inline function may be accessed by <tt/#undef/'ing the
4343 <item>When compiling without <tt/-Os/, the function is only available as
4344 fastcall function, so it may only be used in presence of a prototype.
4346 <tag/Availability/ISO 9899
4348 <ref id="isalnum" name="isalnum">,
4349 <ref id="isalpha" name="isalpha">,
4350 <ref id="isascii" name="isascii">,
4351 <ref id="isblank" name="isblank">,
4352 <ref id="iscntrl" name="iscntrl">,
4353 <ref id="isdigit" name="isdigit">,
4354 <ref id="isgraph" name="isgraph">,
4355 <ref id="islower" name="islower">,
4356 <ref id="isprint" name="isprint">,
4357 <ref id="ispunct" name="ispunct">,
4358 <ref id="isspace" name="isspace">,
4359 <ref id="isxdigit" name="isxdigit">
4365 <sect1>isxdigit<label id="isxdigit"><p>
4369 <tag/Function/Check if a given character is a hexadecimal digit.
4370 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4371 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
4372 <tag/Description/The function returns a non zero value if the given argument
4373 is a hexadecimal digit (0..9, a..f and A..F). The return value is zero if the
4374 character is anything else.
4375 <tag/Notes/<itemize>
4376 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4377 inline sequence generated by the macro will not work correctly for values
4378 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4379 this range. The non inline function may be accessed by <tt/#undef/'ing the
4381 <item>When compiling without <tt/-Os/, the function is only available as
4382 fastcall function, so it may only be used in presence of a prototype.
4384 <tag/Availability/ISO 9899
4386 <ref id="isalnum" name="isalnum">,
4387 <ref id="isalpha" name="isalpha">,
4388 <ref id="isascii" name="isascii">,
4389 <ref id="isblank" name="isblank">,
4390 <ref id="iscntrl" name="iscntrl">,
4391 <ref id="isdigit" name="isdigit">,
4392 <ref id="isgraph" name="isgraph">,
4393 <ref id="islower" name="islower">,
4394 <ref id="isprint" name="isprint">,
4395 <ref id="ispunct" name="ispunct">,
4396 <ref id="isspace" name="isspace">,
4397 <ref id="isupper" name="isupper">
4403 <sect1>itoa<label id="itoa"><p>
4407 <tag/Function/Convert an integer into a string.
4408 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4409 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
4410 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
4411 <tt/radix/ as the base.
4412 <tag/Notes/<itemize>
4413 <item>There are no provisions to prevent a buffer overflow.
4414 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
4415 <item>The function is non standard, so it is not available in strict ANSI mode.
4416 You should probably use <tt/sprintf/ instead.
4417 <item>The function is only available as fastcall function, so it may only be
4418 used in presence of a prototype.
4420 <tag/Availability/cc65
4422 <ref id="atoi" name="atoi">,
4423 <ref id="atol" name="atol">,
4424 <ref id="ltoa" name="ltoa">,
4425 <ref id="ultoa" name="ultoa">,
4426 <ref id="utoa" name="utoa">
4432 <sect1>joy_count<label id="joy_count"><p>
4436 <tag/Function/Return the number of joysticks supported by the current driver.
4437 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4438 <tag/Declaration/<tt/unsigned char joy_count (void);/
4439 <tag/Description/The function returns a the number of joysticks supported
4440 by the current joystick driver.
4441 <tag/Notes/<itemize>
4442 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4443 name="joy_load_driver"> before calling this function.
4444 <item>The function returns the number of joysticks supported by the driver.
4445 There's no way to check for the number of actually connected joysticks.
4447 <tag/Availability/cc65
4449 <ref id="joy_load_driver" name="joy_load_driver">,
4450 <ref id="joy_read" name="joy_read">
4456 <sect1>joy_install<label id="joy_install"><p>
4460 <tag/Function/Install an already loaded driver and return an error code.
4461 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4462 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
4463 <tag/Description/The function installs a driver that was already loaded into
4464 memory (or linked statically to the program). It returns an error code
4465 (<tt/JOY_ERR_OK/ in case of success).
4466 <tag/Notes/<itemize>
4467 <item>The function is only available as fastcall function, so it may only be
4468 used in presence of a prototype.
4470 <tag/Availability/cc65
4472 <ref id="joy_load_driver" name="joy_load_driver">,
4473 <ref id="joy_uninstall" name="joy_uninstall">,
4474 <ref id="joy_unload" name="joy_unload">
4480 <sect1>joy_load_driver<label id="joy_load_driver"><p>
4484 <tag/Function/Load a driver from disk and install it.
4485 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4486 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
4487 <tag/Description/The function loads a driver with the given name from disk
4488 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
4489 driver was successfully loaded and installed.
4490 <tag/Notes/<itemize>
4491 <item>The function is only available as fastcall function, so it may only be
4492 used in presence of a prototype.
4494 <tag/Availability/cc65
4496 <ref id="joy_install" name="joy_install">,
4497 <ref id="joy_uninstall" name="joy_uninstall">,
4498 <ref id="joy_unload" name="joy_unload">
4504 <sect1>joy_read<label id="joy_read"><p>
4508 <tag/Function/Read the status of a joystick.
4509 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4510 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
4511 <tag/Description/The function reads the status bits for a joystick. The number
4512 of the joystick is passed as parameter. The result may be examined by using one
4513 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
4514 <tag/Notes/<itemize>
4515 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4516 name="joy_load_driver"> before calling this function.
4517 <item>The function is only available as fastcall function, so it may only be
4518 used in presence of a prototype.
4520 <tag/Availability/cc65
4522 <ref id="joy_count" name="joy_count">,
4523 <ref id="joy_load_driver" name="joy_load_driver">,
4524 <ref id="joy_unload" name="joy_unload">
4530 <sect1>joy_uninstall<label id="joy_uninstall"><p>
4534 <tag/Function/Uninstall the current joystick driver.
4535 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4536 <tag/Declaration/<tt/unsigned char joy_uninstall (void);/
4537 <tag/Description/The function uninstalls the currently installed joystick
4538 driver. It does not remove the driver from memory. The function returns an
4539 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4540 <tag/Notes/<itemize>
4541 <item>A joystick driver must be installed using <ref id="joy_install"
4542 name="joy_install"> before calling this function.
4544 <tag/Availability/cc65
4546 <ref id="joy_install" name="joy_install">,
4547 <ref id="joy_load_driver" name="joy_load_driver">,
4548 <ref id="joy_unload" name="joy_unload">
4554 <sect1>joy_unload<label id="joy_unload"><p>
4558 <tag/Function/Uninstall, then unload the current joystick driver.
4559 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4560 <tag/Declaration/<tt/unsigned char joy_unload (void);/
4561 <tag/Description/The function uninstalls the currently installed joystick
4562 driver and removes it from memory. An error code is returned, which is
4563 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4564 <tag/Notes/<itemize>
4565 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4566 name="joy_load_driver"> before calling this function.
4568 <tag/Availability/cc65
4570 <ref id="joy_load_driver" name="joy_load_driver">
4576 <sect1>kbhit<label id="kbhit"><p>
4580 <tag/Function/Check if there's a key waiting in the keyboard buffer.
4581 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4582 <tag/Declaration/<tt/unsigned char kbhit (void);/
4583 <tag/Description/The function returns a value of zero if there is no character
4584 waiting to be read from the keyboard. It returns non zero otherwise.
4585 <tag/Notes/<itemize>
4586 <item>If the system does not support a keyboard buffer (most systems
4587 do), the function is rather useless.
4589 <tag/Availability/cc65
4591 <ref id="cgetc" name="cgetc">,
4592 <ref id="cursor" name="cursor">
4598 <sect1>kbrepeat<label id="kbrepeat"><p>
4602 <tag/Function/Set the keyboard repeat mode.
4603 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
4604 <tag/Declaration/<tt/unsigned char __fastcall__ kbrepeat (unsigned char mode);/
4605 <tag/Description/This function changes which keys have automatic repeat when
4606 being held down for a certain time. Possible values are <tt/KBREPEAT_CURSOR/
4607 (repeat only cursor-related keys), <tt/KBREPEAT_NONE/ (no repeat for any
4608 keys), and <tt/KBREPEAT_ALL/ (repeat all keys). The old mode is returned, so
4609 it can be restored later.
4610 <tag/Notes/<itemize>
4611 <item>The function is available only as a fastcall function; so, it may be used
4612 only in the presence of a prototype.
4614 <tag/Availability/cc65
4620 <sect1>labs<label id="labs"><p>
4624 <tag/Function/Returns the absolute value of a long integer.
4625 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4626 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
4627 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
4629 <tag/Notes/<itemize>
4630 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
4631 <item>The function is only available as fastcall function, so it may only be
4632 used in presence of a prototype.
4634 <tag/Availability/ISO 9899
4636 <ref id="abs" name="abs">
4642 <sect1>ltoa<label id="ltoa"><p>
4646 <tag/Function/Convert a long integer into a string.
4647 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4648 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
4649 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
4650 using <tt/radix/ as the base.
4651 <tag/Notes/<itemize>
4652 <item>There are no provisions to prevent a buffer overflow.
4653 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
4654 <item>The function is non standard, so it is not available in strict ANSI mode.
4655 You should probably use <tt/sprintf/ instead.
4656 <item>The function is only available as fastcall function, so it may only be
4657 used in presence of a prototype.
4659 <tag/Availability/cc65
4661 <ref id="atoi" name="atoi">,
4662 <ref id="atol" name="atol">,
4663 <ref id="itoa" name="itoa">,
4664 <ref id="ultoa" name="ultoa">,
4665 <ref id="utoa" name="utoa">
4671 <sect1>localeconv<label id="localeconv"><p>
4675 <tag/Function/Returns a pointer to the current locale structure.
4676 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4677 <tag/Declaration/<tt/struct lconv* localeconv (void);/
4678 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
4680 <tag/Notes/<itemize>
4681 <item>cc65 supports only the "C" locale, so even after setting a new locale
4682 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
4685 <tag/Availability/ISO 9899
4687 <ref id="setlocale" name="setlocale">
4693 <sect1>longjmp<label id="longjmp"><p>
4697 <tag/Function/Non local goto.
4698 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4699 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
4700 <tag/Description/The <tt/longjmp/ function restores a program context from the
4701 data in <tt/buf/, which must have been set by a preceeding call to
4702 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
4703 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
4705 <tag/Notes/<itemize>
4706 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
4707 was called with a value of one.
4708 <item>The function is only available as fastcall function, so it may only
4709 be used in presence of a prototype.
4711 <tag/Availability/ISO 9899
4713 <ref id="setjmp" name="setjmp">
4719 <sect1>malloc<label id="malloc"><p>
4723 <tag/Function/Allocate dynamic memory.
4724 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4725 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
4726 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
4727 pointer to the allocated memory block. On error (not enough memory available),
4728 <tt/malloc/ returns <tt/NULL/.
4729 <tag/Notes/<itemize>
4730 <item>The function is only available as fastcall function, so it may only
4731 be used in presence of a prototype.
4733 <tag/Availability/ISO 9899
4735 <ref id="_heapadd" name="_heapadd">,
4736 <ref id="_heapblocksize" name="_heapblocksize">,
4737 <ref id="_heapmaxavail" name="_heapmaxavail">,
4738 <ref id="_heapmemavail" name="_heapmemavail">,
4739 <ref id="calloc" name="calloc">,
4740 <ref id="free" name="free">,
4741 <ref id="realloc" name="realloc">,
4742 <ref id="strdup" name="strdup">
4748 <sect1>memchr<label id="memchr"><p>
4752 <tag/Function/Search for a character in a block of raw memory.
4753 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4754 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
4755 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
4756 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
4757 that is of size <tt/count/. Upon completion, the function returns a pointer to
4758 the character found, or a null pointer if the character was not found.
4759 <tag/Notes/<itemize>
4760 <item>The function is only available as fastcall function, so it may only
4761 be used in presence of a prototype.
4763 <tag/Availability/ISO 9899
4765 <ref id="strchr" name="strchr">
4771 <sect1>memcmp<label id="memcmp"><p>
4775 <tag/Function/Compare two memory areas.
4776 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4777 <tag/Declaration/<tt/int __fastcall__ memcmp (const void* p1, const void* p2, size_t count);/
4778 <tag/Description/<tt/memcmp/ compares <tt/count/ bytes from the memory area
4779 pointed to by <tt/p1/ into the memory area pointed to by <tt/p2/. It returns a value that is less than
4780 zero if <tt/p1/ is less than <tt/p2/, zero if <tt/p1/ is the same as <tt/p2/,
4781 and a value greater than zero if <tt/p1/ is greater than <tt/p2/.
4782 <tag/Notes/<itemize>
4783 <item>The function is only available as fastcall function, so it may only
4784 be used in presence of a prototype.
4786 <tag/Availability/ISO 9899
4788 <ref id="strcmp" name="strcmp">,
4789 <ref id="memmove" name="memmove">,
4790 <ref id="memset" name="memset">
4796 <sect1>memcpy<label id="memcpy"><p>
4800 <tag/Function/Copy a memory area.
4801 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4802 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
4803 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
4804 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4806 <tag/Notes/<itemize>
4807 <item>The result is undefined if the memory areas do overlap. Use
4808 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
4809 <item>The function is only available as fastcall function, so it may only
4810 be used in presence of a prototype.
4812 <tag/Availability/ISO 9899
4814 <ref id="_swap" name="_swap">,
4815 <ref id="memmove" name="memmove">,
4816 <ref id="memset" name="memset">
4822 <sect1>memmove<label id="memmove"><p>
4826 <tag/Function/Copy a memory area.
4827 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4828 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
4829 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
4830 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4832 <tag/Notes/<itemize>
4833 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
4834 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
4835 <item>The function is only available as fastcall function, so it may only
4836 be used in presence of a prototype.
4838 <tag/Availability/ISO 9899
4840 <ref id="_swap" name="_swap">,
4841 <ref id="memcpy" name="memcpy">,
4842 <ref id="memset" name="memset">
4848 <sect1>memset<label id="memset"><p>
4852 <tag/Function/Fill a memory area.
4853 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4854 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
4855 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
4856 the value <tt/val/. The function returns <tt/p/.
4857 <tag/Notes/<itemize>
4858 <item>The function is only available as fastcall function, so it may only
4859 be used in presence of a prototype.
4861 <tag/Availability/ISO 9899
4863 <ref id="_swap" name="_swap">,
4864 <ref id="bzero" name="bzero">,
4865 <ref id="memcpy" name="memcpy">,
4866 <ref id="memmove" name="memmove">
4872 <sect1>mod_free<label id="mod_free"><p>
4876 <tag/Function/Free a relocatable module.
4877 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4878 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
4879 <tag/Description/The function will free a module loaded into memory by use of
4880 the <tt/<ref id="mod_load" name="mod_load">/ function.
4881 <tag/Notes/<itemize>
4882 <item>The pointer passed as parameter is the pointer to the module memory,
4883 not the pointer to the control structure.
4884 <item>The function is available only as a fastcall function; so, it may be used
4885 only in the presence of a prototype.
4887 <tag/Availability/cc65
4889 <ref id="mod_load" name="mod_load">
4895 <sect1>mod_load<label id="mod_load"><p>
4899 <tag/Function/Load a relocatable module.
4900 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4901 <tag/Declaration/<tt/unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl);/
4902 <tag/Description/The function will load a code module into memory and relocate
4903 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
4904 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
4905 the module just loaded. Possible error codes are:
4907 <item><tt/MLOAD_OK/ - Module load successful
4908 <item><tt/MLOAD_ERR_READ/ - Read error
4909 <item><tt/MLOAD_ERR_HDR/ - Header error
4910 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
4911 <item><tt/MLOAD_ERR_FMT/ - Data format error
4912 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
4914 <tag/Notes/<itemize>
4915 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
4916 relocatable o65 modules for use with this function.
4917 <item>The function is available only as a fastcall function; so, it may be used
4918 only in the presence of a prototype.
4920 <tag/Availability/cc65
4922 <ref id="mod_free" name="mod_free">
4928 <sect1>mouse_setbox<label id="mouse_setbox"><p>
4932 <tag/Function/Specify a bounding box for the mouse cursor.
4933 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4934 <tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
4935 <tag/Description/The function allows to set a bounding box for mouse movement.
4936 <tag/Notes/<itemize>
4937 <item>The function does not check if the mouse cursor is currently within the
4938 given rectangle. Placing the mouse cursor within the bounding box is the
4939 responsibility of the programmer.
4940 <item>While the bounding box may be larger than the actual screen size, the
4941 standard mouse cursor draw routines may fail to set the cursor to coordinates
4942 outside of the screen area. Depending on the platform, you may have to supply
4943 your own mouse cursor routines.
4944 <item>The function is only available as fastcall function, so it may only be
4945 used in presence of a prototype.
4947 <tag/Availability/cc65
4949 <ref id="mouse_getbox" name="mouse_getbox">,
4950 <ref id="mouse_move" name="mouse_move">
4956 <sect1>mouse_getbox<label id="mouse_getbox"><p>
4960 <tag/Function/Return the current bounding box for the mouse cursor.
4961 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4962 <tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
4963 <tag/Description/The function queries the current bounding box for mouse
4965 <tag/Notes/<itemize>
4966 <item>The function is only available as fastcall function, so it may only be
4967 used in presence of a prototype.
4969 <tag/Availability/cc65
4971 <ref id="mouse_move" name="mouse_move">,
4972 <ref id="mouse_setbox" name="mouse_setbox">
4978 <sect1>mouse_buttons<label id="mouse_buttons"><p>
4982 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
4983 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4984 <tag/Declaration/<tt/unsigned char mouse_buttons (void);/
4985 <tag/Description/The function returns a bit mask that encodes the state of the
4986 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
4988 <tag/Availability/cc65
4990 <ref id="mouse_info" name="mouse_info">,
4991 <ref id="mouse_pos" name="mouse_pos">
4997 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
5001 <tag/Function/Return a readable error message for an error code.
5002 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5003 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
5005 <tag/Description/The function returns an error message (in english) for the
5006 error code passed parameter.
5007 <tag/Notes/<itemize>
5008 <item>The function will return "Unknown error" for invalid error codes.
5009 <item>The function is only available as fastcall function, so it may only be
5010 used in presence of a prototype.
5012 <tag/Availability/cc65
5014 <ref id="mouse_load_driver" name="mouse_load_driver">,
5015 <ref id="mouse_uninstall" name="mouse_uninstall">,
5016 <ref id="mouse_unload" name="mouse_unload">
5022 <sect1>mouse_hide<label id="mouse_hide"><p>
5026 <tag/Function/Hide the mouse pointer.
5027 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5028 <tag/Declaration/<tt/void mouse_hide (void);/
5029 <tag/Description/The function hides the mouse pointer. It manages a counter
5030 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
5031 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
5032 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
5034 <tag/Availability/cc65
5036 <ref id="mouse_show" name="mouse_show">
5042 <sect1>mouse_info<label id="mouse_info"><p>
5046 <tag/Function/Return the state of the mouse buttons and the position of the
5048 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5049 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
5050 <tag/Description/The function returns the state of the mouse buttons and the
5051 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
5052 <tag/Notes/<itemize>
5053 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
5054 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
5055 name="mouse_pos">/ instead.
5056 <item>The function is only available as fastcall function, so it may only be
5057 used in presence of a prototype.
5059 <tag/Availability/cc65
5061 <ref id="mouse_buttons" name="mouse_buttons">,
5062 <ref id="mouse_pos" name="mouse_pos">
5068 <sect1>mouse_install<label id="mouse_install"><p>
5072 <tag/Function/Install an already loaded mouse driver.
5073 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5074 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
5075 mouse_callbacks* c, void* driver);/
5076 <tag/Description/The function installs an already loaded mouse driver and
5077 returns an error code. The <tt/mouse_callbacks/ structure passed as first
5078 parameter contains pointers to routines needed to move or hide/show the mouse
5079 pointer. Defaults for these routines are supplied by the library, so if you
5080 can live with these defaults (which are platform specific), just pass a
5081 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
5082 driver linked statically to the program.
5083 <tag/Notes/<itemize>
5084 <item>Not all drivers are able to detect if the supported hardware is really
5086 <item>After installing a driver, the mouse cursor is hidden.
5087 <item>The function is only available as fastcall function, so it may only be
5088 used in presence of a prototype.
5090 <tag/Availability/cc65
5092 <ref id="mouse_load_driver" name="mouse_load_driver">,
5093 <ref id="mouse_uninstall" name="mouse_uninstall">,
5094 <ref id="mouse_unload" name="mouse_unload">
5100 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
5104 <tag/Function/Call the driver specific ioctl function.
5105 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5106 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
5107 <tag/Description/The function calls the IOCTL entry in the mouse driver,
5108 which is driver specific. The <tt/code/ parameter will choose between
5109 different IOCTL functions, and the <tt/data/ depends on code. The
5110 function returns an error code. The purpose of this function is to allow
5111 for driver specific extensions. See the documentation for a specific mouse
5112 driver for supported ioctl calls.
5113 <tag/Notes/<itemize>
5114 <item>Calling this function is non portable, because each driver may
5115 implement different ioctl calls (or none at all).
5116 <item>The function is only available as fastcall function, so it may only be
5117 used in presence of a prototype.
5119 <tag/Availability/cc65
5125 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
5129 <tag/Function/Load and initialize a mouse driver.
5130 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5131 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
5132 mouse_callbacks* c, const char* driver);/
5133 <tag/Description/Load a mouse driver into memory and initialize it. The
5134 function returns an error code that tells if the call has been successful. The
5135 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
5136 routines needed to move or hide/show the mouse pointer. Defaults for these
5137 routines are supplied by the library, so if you can live with these defaults
5138 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
5139 <tag/Notes/<itemize>
5140 <item>The driver is loaded by name, so currently you must know the type of
5141 mouse that should be supported. There is no autodetect capability.
5142 <item>Not all drivers are able to detect if the supported hardware is really
5144 <item>After installing a driver, the mouse cursor is hidden.
5145 <item>The function is only available as fastcall function, so it may only be
5146 used in presence of a prototype.
5148 <tag/Availability/cc65
5150 <ref id="mouse_install" name="mouse_install">,
5151 <ref id="mouse_uninstall" name="mouse_uninstall">,
5152 <ref id="mouse_unload" name="mouse_unload">
5158 <sect1>mouse_move<label id="mouse_move"><p>
5162 <tag/Function/Move the mouse cursor to a specific position.
5163 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5164 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
5165 <tag/Description/The function updates the mouse position. If the mouse cursor
5166 is visible, it is shown at the new position.
5167 <tag/Notes/<itemize>
5168 <item>The function does not check if the new position is within the bounding
5169 box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
5170 <item>The function is only available as fastcall function, so it may only be
5171 used in presence of a prototype.
5173 <tag/Availability/cc65
5175 <ref id="mouse_getbox" name="mouse_getbox">,
5176 <ref id="mouse_setbox" name="mouse_setbox">
5182 <sect1>mouse_pos<label id="mouse_pos"><p>
5186 <tag/Function/Return the position of the mouse.
5187 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5188 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
5189 <tag/Description/The function returns the position of the mouse in the
5190 <tt/mouse_pos/ structure passed as parameter.
5191 <tag/Notes/<itemize>
5192 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
5193 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
5194 name="mouse_info">/ instead.
5195 <item>The function is only available as fastcall function, so it may only be
5196 used in presence of a prototype.
5198 <tag/Availability/cc65
5200 <ref id="mouse_buttons" name="mouse_buttons">,
5201 <ref id="mouse_info" name="mouse_info">
5207 <sect1>mouse_show<label id="mouse_show"><p>
5211 <tag/Function/Show the mouse pointer.
5212 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5213 <tag/Declaration/<tt/void mouse_show (void);/
5214 <tag/Description/The function shows the mouse pointer. It manages a counter
5215 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
5216 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
5217 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
5218 <tag/Availability/cc65
5220 <ref id="mouse_hide" name="mouse_hide">
5226 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
5230 <tag/Function/Uninstall an already loaded mouse driver.
5231 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5232 <tag/Declaration/<tt/unsigned char mouse_uninstall (void);/
5233 <tag/Description/The function uninstalls an already loaded mouse driver but
5234 don't removes it from memory.
5235 <tag/Notes/<itemize>
5236 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
5237 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
5238 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
5241 <tag/Availability/cc65
5243 <ref id="mouse_install" name="mouse_install">,
5244 <ref id="mouse_load_driver" name="mouse_load_driver">,
5245 <ref id="mouse_unload" name="mouse_unload">
5251 <sect1>mouse_unload<label id="mouse_unload"><p>
5255 <tag/Function/Unload a mouse driver.
5256 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5257 <tag/Declaration/<tt/unsigned char mouse_unload (void);/
5258 <tag/Description/The function unloads a loaded mouse driver and frees all
5259 memory allocated for the driver.
5260 <tag/Notes/<itemize>
5261 <item>The function does nothing if no driver is loaded.
5263 <tag/Availability/cc65
5265 <ref id="mouse_install" name="mouse_install">,
5266 <ref id="mouse_load_driver" name="mouse_load_driver">,
5267 <ref id="mouse_uninstall" name="mouse_uninstall">
5273 <sect1>offsetof<label id="offsetof"><p>
5277 <tag/Function/Calculate the offset of a struct or union member.
5278 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
5279 <tag/Declaration/<tt/size_t offsetof (type, member);/
5280 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
5281 or <tt/union/ member.
5282 <tag/Notes/<itemize>
5283 <item>The function is actually a macro.
5285 <tag/Availability/ISO 9899
5291 <sect1>open<label id="open"><p>
5295 <tag/Function/Open and possibly create a file.
5296 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
5297 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
5298 <tag/Description/<tt/open/ opens a file and returns the file descriptor
5299 associated with it. On error, -1 is returned and an error code is stored in
5300 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
5301 <tag/Notes/<itemize>
5302 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
5303 open, which is used as the permission mask when a new file is created. While
5304 cc65 allows to pass this argument, it is ignored.
5306 <tag/Availability/POSIX 1003.1
5308 <ref id="close" name="close">,
5309 <ref id="creat" name="creat">
5315 <sect1>opendir<label id="opendir"><p>
5319 <tag/Function/Open a directory.
5320 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5321 <tag/Declaration/<tt/DIR* __fastcall__ opendir (const char* name);/
5322 <tag/Description/<tt/opendir/ opens a directory and returns the direcory
5323 descriptor associated with it. On error, NULL is returned and an error code is
5324 stored in <tt/errno/.
5325 <tag/Notes/<itemize>
5326 <item>The function is only available as fastcall function, so it may only
5327 be used in presence of a prototype.
5329 <tag/Availability/POSIX 1003.1
5331 <ref id="closedir" name="closedir">,
5332 <ref id="readdir" name="readdir">
5338 <sect1>peekbsys<label id="peekbsys"><p>
5342 <tag/Function/Read one byte from a location in the system bank.
5343 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5344 <tt/<ref id="cbm510.h" name="cbm510.h">/
5345 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
5346 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
5347 system bank (bank 15) of the CBM PET-II machines and returns it.
5348 <tag/Notes/<itemize>
5349 <item>The function is only available as fastcall function, so it may only
5350 be used in presence of a prototype.
5351 <item>This function may be a macro depending on the compiler options. The
5352 actual function is accessible by #undef'ing the macro.
5354 <tag/Availability/cc65
5356 <ref id="PEEK" name="PEEK">,
5357 <ref id="PEEKW" name="PEEKW">,
5358 <ref id="peekwsys" name="peekwsys">,
5359 <ref id="pokebsys" name="pokebsys">,
5360 <ref id="pokewsys" name="pokewsys">
5366 <sect1>peekwsys<label id="peekwsys"><p>
5370 <tag/Function/Read one word from a location in the system bank.
5371 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5372 <tt/<ref id="cbm510.h" name="cbm510.h">/
5373 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
5374 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
5375 system bank (bank 15) of the CBM PET-II machines and returns it. Following
5376 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
5377 high byte is read from <tt/addr+1/.
5378 <tag/Notes/<itemize>
5379 <item>The function is only available as fastcall function, so it may only
5380 be used in presence of a prototype.
5381 <item>The order in which the two bytes are read is undefined.
5383 <tag/Availability/cc65
5385 <ref id="PEEK" name="PEEK">,
5386 <ref id="PEEKW" name="PEEKW">,
5387 <ref id="peekbsys" name="peekbsys">,
5388 <ref id="pokebsys" name="pokebsys">,
5389 <ref id="pokewsys" name="pokewsys">
5395 <sect1>perror<label id="perror"><p>
5399 <tag/Function/Print an error message for the error in <tt/errno/.
5400 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5401 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
5402 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
5403 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
5404 a blank. Then the error message for the current contents of <tt/errno/ is
5405 printed followed by a newline. The message output is the same as returned by
5406 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
5407 <tag/Notes/<itemize>
5408 <item>The function is only available as fastcall function, so it may only
5409 be used in presence of a prototype.
5411 <tag/Availability/ISO 9899
5413 <ref id="_poserror" name="_poserror">,
5414 <ref id="strerror" name="strerror">
5420 <sect1>pokebsys<label id="pokebsys"><p>
5424 <tag/Function/Write one byte to a location in the system bank.
5425 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5426 <tt/<ref id="cbm510.h" name="cbm510.h">/
5427 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
5428 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
5429 system bank (bank 15) of the CBM PET-II machines.
5430 <tag/Notes/<itemize>
5431 <item>The function is only available as fastcall function, so it may only
5432 be used in presence of a prototype.
5434 <tag/Availability/cc65
5436 <ref id="POKE" name="POKE">,
5437 <ref id="POKEW" name="POKEW">,
5438 <ref id="peekbsys" name="peekbsys">,
5439 <ref id="peekwsys" name="peekwsys">,
5440 <ref id="pokewsys" name="pokewsys">
5446 <sect1>pokewsys<label id="pokewsys"><p>
5450 <tag/Function/Write one word to a location in the system bank.
5451 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5452 <tt/<ref id="cbm510.h" name="cbm510.h">/
5453 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
5454 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
5455 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
5456 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
5457 high byte is written to <tt/addr+1/.
5458 <tag/Notes/<itemize>
5459 <item>The function is only available as fastcall function, so it may only
5460 be used in presence of a prototype.
5461 <item>The order in which the two bytes are written is undefined.
5463 <tag/Availability/cc65
5465 <ref id="POKE" name="POKE">,
5466 <ref id="POKEW" name="POKEW">,
5467 <ref id="peekbsys" name="peekbsys">,
5468 <ref id="peekwsys" name="peekwsys">,
5469 <ref id="pokebsys" name="pokebsys">
5475 <sect1>qsort<label id="qsort"><p>
5479 <tag/Function/Sort an array.
5480 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5481 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
5482 size_t size, int __fastcall__ (* compare) (const void*, const void*));/
5483 <tag/Description/<tt/qsort/ sorts an array according to a given compare
5484 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
5485 is the number of elements, <tt/size/ the size of an element and <tt/compare/
5486 the function used to compare the members.
5487 <tag/Notes/<itemize>
5488 <item>If there are multiple members with the same key, the order after calling
5489 the function is undefined.
5490 <item>The function is only available as fastcall function, so it may only
5491 be used in presence of a prototype.
5492 <item>The function to which <tt/compare/ points must have the <tt/fastcall/
5495 <tag/Availability/ISO 9899
5497 <ref id="bsearch" name="bsearch">
5503 <sect1>raise<label id="raise"><p>
5507 <tag/Function/Send a signal to the executing program.
5508 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
5509 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
5510 <tag/Description/<tt/raise/ sends the given signal to the program. If the
5511 program has installed a signal handler for the signal, this signal handler
5512 will be executed. If no handler has been installed, the default action for
5513 the raised signal will be taken. The function returns zero on success,
5515 <tag/Notes/<itemize>
5516 <item>The function is only available as fastcall function, so it may only
5517 be used in presence of a prototype.
5519 <tag/Availability/ISO 9899
5521 <ref id="abort" name="abort">,
5522 <ref id="signal" name="signal">
5528 <sect1>rand<label id="rand"><p>
5532 <tag/Function/Return a pseudo random number.
5533 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5534 <tag/Declaration/<tt/int rand (void);/
5535 <tag/Description/The function returns a pseudo random number
5536 between 0 and <tt/RAND_MAX/ (exclusive).
5537 <tag/Notes/<itemize>
5538 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
5539 flow of numbers is generated.
5540 <item>On startup, the function behaves as if <ref id="srand" name="srand">
5541 had been used with an argument of 1.
5543 <tag/Availability/ISO 9899
5545 <ref id="_randomize" name="_randomize">,
5546 <ref id="srand" name="srand">
5552 <sect1>readdir<label id="readdir"><p>
5556 <tag/Function/Read a directory.
5557 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5558 <tag/Declaration/<tt/struct dirent* __fastcall__ readdir (DIR* dir);/
5559 <tag/Description/<tt/readdir/ reads the next directory entry from the directory
5560 stream pointed to by <tt/dir/. It stores the data in a <tt/dirent/ structure
5561 and returns a pointer to it. If the end of directory is reached, or an error
5562 occurs, NULL is returned. In case of errors, an error code is stored into
5564 <tag/Notes/<itemize>
5565 <item>The function is only available as fastcall function, so it may only
5566 be used in presence of a prototype.
5567 <item>The returned pointer may point to a statically allocated instance of
5568 <tt/struct dirent/, so it may get overwritten by subsequent calls to
5570 <item>On several platforms, namely the CBMs and the Atari, the disk drives get
5571 confused when opening/closing files between directory reads. So for example a
5572 program that reads the list of files on a disk, and after each call to
5573 <tt/readdir/, opens the file to process it, will fail.<newline>
5574 Possible solutions are reading the directory into memory before processing the
5575 file list, or to reset the directory by seeking to the correct position after
5576 opening/closing a file:
5578 seekdir (DIR, telldir (DIR));
5580 Platforms known to work without problems are: Apple.
5582 <tag/Availability/POSIX 1003.1
5584 <ref id="closedir" name="closedir">,
5585 <ref id="opendir" name="opendir">
5591 <sect1>realloc<label id="realloc"><p>
5595 <tag/Function/Change the size of an allocated memory block.
5596 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5597 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
5598 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
5599 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
5600 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
5601 behaves as if <tt/free/ had been called. On error (not enough memory
5602 available), <tt/realloc/ returns <tt/NULL/.
5603 <tag/Notes/<itemize>
5604 <item>The part of the memory block that is returned will have its contents
5606 <item>This function is somewhat dangerous to use. Be careful to save the
5607 pointer you're passing somewhere else, otherwise
5609 ptr = realloc (ptr, size);
5611 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
5612 <item>The function is only available as fastcall function, so it may only
5613 be used in presence of a prototype.
5615 <tag/Availability/ISO 9899
5617 <ref id="_heapadd" name="_heapadd">,
5618 <ref id="_heapblocksize" name="_heapblocksize">,
5619 <ref id="_heapmaxavail" name="_heapmaxavail">,
5620 <ref id="_heapmemavail" name="_heapmemavail">,
5621 <ref id="calloc" name="calloc">,
5622 <ref id="free" name="free">,
5623 <ref id="realloc" name="realloc">
5629 <sect1>remove<label id="remove"><p>
5633 <tag/Function/Delete a file.
5634 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5635 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
5636 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
5637 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5638 code describing the reason for the failure.
5639 <tag/Notes/<itemize>
5640 <item>This function is not available on all cc65 targets (depends on the
5641 availability of file I/O).
5642 <item>The function is only available as fastcall function, so it may only
5643 be used in presence of a prototype.
5645 <tag/Availability/ISO 9899
5647 <ref id="rename" name="rename">,
5648 <ref id="unlink" name="unlink">
5651 #include <stdio.h>
5653 #define FILENAME "helloworld"
5655 if (remove (FILENAME) == 0) {
5656 printf ("We deleted %s successfully\n", FILENAME);
5658 printf ("There was a problem deleting %s\n", FILENAME);
5665 <sect1>rename<label id="rename"><p>
5669 <tag/Function/Rename a file.
5670 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5671 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
5672 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
5673 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5674 code describing the reason for the failure.
5675 <tag/Notes/<itemize>
5676 <item>This function is not available on all cc65 targets (depends on the
5677 capabilities of the storage devices).
5678 <item>The function is only available as fastcall function, so it may only
5679 be used in presence of a prototype.
5681 <tag/Availability/ISO 9899
5683 <ref id="remove" name="remove">
5686 #include <stdio.h>
5688 #define OLDNAME "textfile.txt"
5689 #define NEWNAME "textfile.bak"
5691 if (rename (OLDNAME, NEWNAME) == 0) {
5692 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
5694 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
5701 <sect1>reset_brk<label id="reset_brk"><p>
5705 <tag/Function/Resets the break vector to its original value.
5706 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5707 <tag/Declaration/<tt/void reset_brk (void);/
5708 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
5709 before a call to <tt/set_brk/.
5710 <tag/Notes/<itemize>
5711 <item>The break vector is reset on program termination, so it's not strictly
5712 necessary to call this function as a part of your clean-up when exitting the program.
5714 <tag/Availability/cc65
5716 <ref id="reset_irq" name="reset_irq">,
5717 <ref id="set_brk" name="set_brk">,
5718 <ref id="set_irq" name="set_irq">
5724 <sect1>reset_irq<label id="reset_irq"><p>
5728 <tag/Function/Resets the C level interrupt request vector.
5729 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5730 <tag/Declaration/<tt/void reset_irq (void);/
5731 <tag/Description/<tt/reset_irq/ resets the C level interrupt request vector.
5732 <tag/Notes/<itemize>
5733 <item>The interrupt vector is reset on program termination, so it's not strictly
5734 necessary to call this function as a part of your clean-up when exitting the program.
5736 <tag/Availability/cc65
5738 <ref id="reset_brk" name="reset_brk">,
5739 <ref id="set_brk" name="set_brk">,
5740 <ref id="set_irq" name="set_irq">
5746 <sect1>revers<label id="revers"><p>
5750 <tag/Function/Control revers character display.
5751 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5752 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
5753 <tag/Description/If the argument is non zero, the function enables reverse
5754 character display. If the argument is zero, reverse character display is
5755 switched off. The old value of the setting is returned.
5756 <tag/Notes/<itemize>
5757 <item>The function may not be supported by the hardware, in which case
5758 the call is ignored.
5759 <item>The function is only available as fastcall function, so it may only
5760 be used in presence of a prototype.
5762 <tag/Availability/cc65
5764 <ref id="textcolor" name="textcolor">
5770 <sect1>rewinddir<label id="rewinddir"><p>
5774 <tag/Function/Reset a directory stream.
5775 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5776 <tag/Declaration/<tt/void __fastcall__ rewinddir (DIR* dir);/
5777 <tag/Description/<tt/rewinddir/ sets the position of the directory stream
5778 pointed to by <tt/dir/ to the start of the directory.
5779 <tag/Notes/<itemize>
5780 <item>The function is only available as fastcall function, so it may only
5781 be used in presence of a prototype.
5783 <tag/Availability/POSIX 1003.1
5785 <ref id="seekdir" name="seekdir">,
5786 <ref id="telldir" name="telldir">
5792 <sect1>screensize<label id="screensize"><p>
5796 <tag/Function/Return the dimensions of the text mode screen.
5797 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5798 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
5799 <tag/Description/The function returns the dimensions of the text mode screen.
5800 <tag/Notes/<itemize>
5801 <item>The function is only available as fastcall function, so it may only
5802 be used in presence of a prototype.
5804 <tag/Availability/cc65
5806 <ref id="gotox" name="gotox">,
5807 <ref id="gotoxy" name="gotoxy">,
5808 <ref id="gotoy" name="gotoy">,
5809 <ref id="wherex" name="wherex">,
5810 <ref id="wherey" name="wherey">
5816 <sect1>seekdir<label id="seekdir"><p>
5820 <tag/Function/Set the position of a directory stream.
5821 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5822 <tag/Declaration/<tt/void __fastcall__ seekdir (DIR* dir, long offset);/
5823 <tag/Description/<tt/seekdir/ sets the position of the directory stream
5824 pointed to by <tt/dir/ to the value given in <tt/offset/, which should be a
5825 value returned by <tt/<ref id="telldir" name="telldir">/.
5826 <tag/Notes/<itemize>
5827 <item>The function is only available as fastcall function, so it may only
5828 be used in presence of a prototype.
5830 <tag/Availability/POSIX 1003.1
5832 <ref id="rewinddir" name="rewinddir">,
5833 <ref id="telldir" name="telldir">
5839 <sect1>ser_close<label id="ser_close"><p>
5843 <tag/Function/Close the port and disable interrupts
5844 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5845 <tag/Declaration/<tt/unsigned char ser_close (void);/
5846 <tag/Description/Close the port by clearing buffers and disable interrupts.
5847 <tag/Availability/cc65
5848 <tag/See also/Other serial functions.
5853 static void initialize(){
5854 struct ser_params params = {
5861 ser_install(lynx_comlynx); // This will activate the ComLynx
5863 ser_open(&params);
5870 <sect1>ser_get<label id="ser_get"><p>
5874 <tag/Function/Read a character from serial port.
5875 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5876 <tag/Declaration/<tt/unsigned char __fastcall__ ser_get (char* b);/
5877 <tag/Description/Get a character from the serial port. If no characters are
5878 available, the function will return SER_ERR_NO_DATA, so this is not a fatal
5880 <tag/Notes/<itemize>
5881 <item>The function is only available as fastcall function, so it may only
5882 be used in presence of a prototype.
5884 <tag/Availability/cc65
5885 <tag/See also/Other serial functions.
5887 Wait for a character to be available from a serial port.
5890 while (ser_get(&ch) == SER_ERR_NO_DATA)
5897 <sect1>ser_install<label id="ser_install"><p>
5901 <tag/Function/Install an already loaded driver and return an error code.
5902 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5903 <tag/Declaration/<tt/unsigned char __fastcall__ ser_install (void* driver);/
5904 <tag/Description/The function installs a driver that was already loaded into
5905 memory (or linked statically to the program). It returns an error code
5906 (<tt/SER_ERR_OK/ in case of success).
5907 <tag/Notes/<itemize>
5908 <item>The function is only available as fastcall function, so it may only be
5909 used in presence of a prototype.
5911 <tag/Availability/cc65
5913 <ref id="ser_load_driver" name="ser_load_driver">,
5914 <ref id="ser_uninstall" name="ser_uninstall">,
5915 <ref id="ser_unload" name="ser_unload">
5917 ser_install(lynx_comlynx); //Include the driver statically instead of loading it.
5923 <sect1>ser_ioctl<label id="ser_ioctl"><p>
5927 <tag/Function/Platform dependent code extensions.
5928 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5929 <tag/Declaration/<tt/unsigned __fastcall__ ser_ioctl (unsigned char code, void* data);/
5930 <tag/Description/Some platforms have extra serial functions that are not
5931 supported by standard serial driver functions. You can extend the driver to support
5932 this extra functionality bt using ser_ioctl functions.
5933 <tag/Notes/<itemize>
5934 <item>The function is only available as fastcall function, so it may only
5935 be used in presence of a prototype.
5936 <item>These functions are not easily portable to other cc65 platforms.
5938 <tag/Availability/cc65
5939 <tag/See also/Other serial functions.
5944 <sect1>ser_load_driver<label id="ser_load_driver"><p>
5948 <tag/Function/Load and install a serial driver.
5949 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5950 <tag/Declaration/<tt/unsigned char __fastcall__ ser_load_driver (const char *name);/
5951 <tag/Description/Load and install the driver by name.
5952 Will just load the driver and check if loading was successful.
5953 <tag/Notes/<itemize>
5954 <item>The function is only available as fastcall function, so it may only
5955 be used in presence of a prototype.
5957 <tag/Availability/cc65
5958 <tag/See also/Other serial functions.
5964 <sect1>ser_open<label id="ser_open"><p>
5968 <tag/Function/Open the port by setting the port parameters and enable interrupts
5969 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5970 <tag/Declaration/<tt/unsigned char __fastcall__ ser_open (const struct ser_params* params);/
5971 <tag/Description/Open the port by setting the port parameters and enable interrupts.
5972 <tag/Notes/<itemize>
5973 <item>The function is only available as fastcall function, so it may only
5974 be used in presence of a prototype.
5976 <tag/Availability/cc65
5977 <tag/See also/Other serial functions.
5982 static void initialize(){
5983 struct ser_params params = {
5990 ser_install(lynx_comlynx); // This will activate the ComLynx
5992 ser_open(&params);
5999 <sect1>ser_put<label id="ser_put"><p>
6003 <tag/Function/Write a character to a serial port.
6004 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6005 <tag/Declaration/<tt/unsigned char __fastcall__ ser_put (char b);/
6006 <tag/Description/Send a character via the serial port. There is a transmit
6007 buffer, but transmitting is not done via interrupt. The function returns
6008 SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
6009 <tag/Notes/<itemize>
6010 <item>The function is only available as fastcall function, so it may only
6011 be used in presence of a prototype.
6013 <tag/Availability/cc65
6014 <tag/See also/Other serial functions.
6023 <sect1>ser_status<label id="ser_status"><p>
6027 <tag/Function/Return the serial port status.
6028 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6029 <tag/Declaration/<tt/unsigned char __fastcall__ ser_status (unsigned char* status);/
6030 <tag/Description/Return the serial port status.
6031 <tag/Notes/<itemize>
6032 <item>The function is only available as fastcall function, so it may only
6033 be used in presence of a prototype.
6035 <tag/Availability/cc65
6036 <tag/See also/Other serial functions.
6042 <sect1>ser_uninstall<label id="ser_uninstall"><p>
6046 <tag/Function/Uninstall the currently loaded driver but do not unload it.
6047 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6048 <tag/Declaration/<tt/unsigned char ser_uninstall (void);/
6049 <tag/Description/Uninstall the currently loaded driver but do not unload it.
6050 <tag/Availability/cc65
6051 <tag/See also/Other serial functions.
6056 <sect1>ser_unload<label id="ser_unload"><p>
6060 <tag/Function/Uninstall, then unload the currently loaded driver.
6061 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6062 <tag/Declaration/<tt/unsigned char ser_unload (void);/
6063 <tag/Description/Uninstall, then unload the currently loaded driver.
6064 <tag/Availability/cc65
6065 <tag/See also/Other serial functions.
6071 <sect1>set_brk<label id="set_brk"><p>
6075 <tag/Function/Set the break vector to a user function.
6076 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
6077 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
6078 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
6079 program code by letting the vector point to a user written C function. The
6080 runtime library installs a small stub that saves the registers into global
6081 variables that may be accessed (and changed) by the break handler.
6082 <tag/Notes/<itemize>
6083 <item>The function is only available as fastcall function, so it may only
6084 be used in presence of a prototype.
6085 <item>The stub saves the zero page registers used by the C runtime and switches
6086 to a small break handler stack. This means that it is safe to execute C code,
6087 even if C code was interrupted. Be careful however not to use too many local
6088 variables, and do not enable stack checks for the handler function or any other
6089 function called from it.
6090 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
6091 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
6092 otherwise the <tt/BRK/ instruction will get executed over and over again.
6093 <item>The break vector is reset on program termination, so it's not strictly
6094 necessary to call <tt/<ref id="reset_brk" name="reset_brk">/ as a part of your
6095 clean-up when exitting the program.
6097 <tag/Availability/cc65
6099 <ref id="reset_brk" name="reset_brk">
6105 <sect1>set_irq<label id="set_irq"><p>
6109 <tag/Function/Set the C level interrupt request vector to the given address.
6110 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
6111 <tag/Declaration/<tt/void __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);/
6112 <tag/Description/<tt/set_irq/ allows a user program to handle interrupt requests
6113 (IRQs) within the program code by letting the vector point to a user written C
6114 function. The runtime library installs a small stub that saves the zero page
6115 registers used by the C runtime before calling the handler function and restores
6116 them after the handler function returns. Additionally the stub temporarily switches
6117 the C runtime stack to the stack area provided as parameter. If the handler function
6118 was set up to handle a "private", "exclusive" interrupt request source it must
6119 return the value <tt/IRQ_HANDLED/ if and only if it has verified that the current
6120 interrupt request actually stems from that source. In all other cases it must return
6121 the value <tt/IRQ_NOT_HANDLED/.
6122 <tag/Notes/<itemize>
6123 <item>The function is only available as fastcall function, so it may only
6124 be used in presence of a prototype.
6125 <item>The stub saves the registers and zero page locations used by the C runtime
6126 and switches to the provided stack area. As a consequence, there is some
6127 runtime overhead, but it it is safe to execute C code, even if other C code
6128 was interrupted. Be careful however not to call C library functions, and do not
6129 enable stack checks for the handler function or any other function called from
6131 <item>The interrupt vector is reset on program termination, so it's not strictly
6132 necessary to call <tt/<ref id="reset_irq" name="reset_irq">/ as a part of your
6133 clean-up when exitting the program.
6135 <tag/Availability/cc65
6137 <ref id="reset_brk" name="reset_brk">,
6138 <ref id="reset_irq" name="reset_irq">,
6139 <ref id="set_brk" name="set_brk">
6145 <sect1>set_c128_speed<label id="set_c128_speed"><p>
6149 <tag/Function/Set the current speed of a C128 CPU.
6150 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6151 <tag/Declaration/<tt/unsigned char __fastcall__ set_c128_speed (unsigned char speed);/
6152 <tag/Description/The function returns the speed after trying to set the speed of the C128 CPU.
6153 <tag/Notes/<itemize>
6154 <item>The function is specific to the C64 and C128.
6155 <item>The function does not check if the C128 CPU is the current CPU.
6156 <item>See the accelerator.h header for the speed definitions.
6158 <tag/Availability/cc65 (not all platforms)
6160 <ref id="detect_c128" name="detect_c128">,
6161 <ref id="get_c128_speed" name="get_c128_speed">,
6167 <sect1>set_c64dtv_speed<label id="set_c64dtv_speed"><p>
6171 <tag/Function/Set the current speed of the C64DTV.
6172 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6173 <tag/Declaration/<tt/unsigned char __fastcall__ set_c64dtv_speed (unsigned char speed);/
6174 <tag/Description/The function returns the speed after trying to set the speed of the C64DTV.
6175 <tag/Notes/<itemize>
6176 <item>The function is specific to the C64.
6177 <item>The function does not check for the presence of the C64DTV.
6178 <item>See the accelerator.h header for the speed definitions.
6180 <tag/Availability/cc65 (not all platforms)
6182 <ref id="detect_c64dtv" name="detect_c64dtv">,
6183 <ref id="get_c64dtv_speed" name="get_c64dtv_speed">,
6189 <sect1>set_scpu_speed<label id="set_scpu_speed"><p>
6193 <tag/Function/Set the current speed of the C64/C128 SuperCPU cartridge.
6194 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6195 <tag/Declaration/<tt/unsigned char __fastcall__ set_scpu_speed (unsigned char speed);/
6196 <tag/Description/The function returns the speed after trying to set the speed of the SuperCPU cartridge.
6197 <tag/Notes/<itemize>
6198 <item>The function is specific to the C128 and C64.
6199 <item>The function does not check for the presence of the cartridge.
6200 <item>See the accelerator.h header for the speed definitions.
6202 <tag/Availability/cc65 (not all platforms)
6204 <ref id="detect_scpu" name="detect_scpu">,
6205 <ref id="get_scpu_speed" name="get_scpu_speed">,
6211 <sect1>setjmp<label id="setjmp"><p>
6215 <tag/Function/Save the context for use with <tt/longjmp/.
6216 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
6217 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
6218 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
6219 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
6221 <tag/Notes/<itemize>
6222 <item>The function is only available as fastcall function, so it may only
6223 be used in presence of a prototype.
6224 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
6225 <item><tt/setjmp/ will not save the signal context.
6227 <tag/Availability/ISO 9899
6229 <ref id="longjmp" name="longjmp">
6235 <sect1>setlocale<label id="setlocale"><p>
6239 <tag/Function/Selects a locale.
6240 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
6241 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
6242 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
6243 <tag/Notes/<itemize>
6244 <item>The function is only available as fastcall function, so it may only
6245 be used in presence of a prototype.
6246 <item>cc65 supports only the "C" locale, so calling this function to set a
6247 different locale has no effect.
6249 <tag/Availability/ISO 9899
6251 <ref id="localeconv" name="localeconv">,
6252 <ref id="strcoll" name="strcoll">
6253 <ref id="strxfrm" name="strxfrm">
6259 <sect1>signal<label id="signal"><p>
6263 <tag/Function/Install a signal handler.
6264 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
6265 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
6266 <tag/Description/<tt/signal/ installs a handler for the given signal. The
6267 handler may either be a user supplied function, or one of the predefined
6268 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
6269 previous value if the signal , or the special function vector SIG_ERR in
6271 <tag/Notes/<itemize>
6272 <item>The function is only available as fastcall function, so it may only
6273 be used in presence of a prototype.
6275 <tag/Availability/ISO 9899
6277 <ref id="abort" name="abort">,
6278 <ref id="raise" name="raise">
6284 <sect1>sleep<label id="sleep"><p>
6288 <tag/Function/Sleep for a specified amount of time.
6289 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
6290 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
6291 <tag/Description/The function will return after the specified number of
6292 seconds have elapsed.
6293 <tag/Notes/<itemize>
6294 <item>The function is only available as fastcall function, so it may only
6295 be used in presence of a prototype.
6297 <tag/Availability/POSIX 1003.1
6303 <sect1>slow<label id="slow"><p>
6307 <tag/Function/Switch the CPU into slow mode (C128: 1MHz mode, C16/Plus4: single clock mode).
6308 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
6309 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
6310 <tag/Declaration/<tt/void slow (void);/
6311 <tag/Description/The function will switch the clock of the CPU to slow mode. for the C128
6312 target it means switching the CPU into 1MHz mode. for the C16/Plus4 target it means
6313 switching the CPU into single clock mode.
6314 <tag/Notes/<itemize>
6315 <item>The function is specific to the C128, C16 and Plus4.
6317 <tag/Availability/cc65 (not all platforms)
6319 <ref id="fast" name="fast">,
6320 <ref id="isfast" name="isfast">,
6326 <sect1>srand<label id="srand"><p>
6330 <tag/Function/Initialize the pseudo random number generator.
6331 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
6332 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
6333 <tag/Description/The function initializes the random number generator using
6334 the given seed. On program startup, the generator behaves as if <tt/srand/ has
6335 been called with an argument of 1.
6336 <tag/Notes/<itemize>
6337 <item>The function is only available as fastcall function, so it may only
6338 be used in presence of a prototype.
6340 <tag/Availability/ISO 9899
6342 <ref id="_randomize" name="_randomize">,
6343 <ref id="rand" name="rand">
6349 <sect1>strcasecmp<label id="strcasecmp"><p>
6353 <tag/Function/Compare two strings case insensitive.
6354 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6355 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
6356 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
6357 as parameters without case sensitivity. It returns a value that is less than
6358 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
6359 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
6360 <tag/Notes/<itemize>
6361 <item>The function is only available as fastcall function, so it may only
6362 be used in presence of a prototype.
6363 <item>The function is not available in strict ANSI mode.
6365 <tag/Availability/cc65
6367 <ref id="strcmp" name="strcmp">,
6368 <ref id="strcoll" name="strcoll">,
6369 <ref id="stricmp" name="stricmp">,
6370 <ref id="strncmp" name="strncmp">,
6371 <ref id="strxfrm" name="strxfrm">
6377 <sect1>strcat<label id="strcat"><p>
6381 <tag/Function/Concatentate two strings.
6382 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6383 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
6384 <tag/Description/The <tt/strcat/ function appends a copy of the string
6385 pointed to by s2 (including the terminating null byte) to the end of the
6386 string pointed to by s1. The initial byte of s2 overwrites the null byte at
6388 <tag/Notes/<itemize>
6389 <item>The function is only available as fastcall function, so it may only
6390 be used in presence of a prototype.
6391 <item>If copying takes place between objects that overlap, the behaviour
6394 <tag/Availability/ISO 9899
6396 <ref id="strcpy" name="strcpy">,
6397 <ref id="strncat" name="strncat">,
6398 <ref id="strncpy" name="strncpy">
6404 <sect1>strchr<label id="strchr"><p>
6408 <tag/Function/Search for a character in a string.
6409 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6410 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
6411 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
6412 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6413 byte is considered to be part of the string. Upon completion, the function
6414 returns a pointer to the byte, or a null pointer if the byte was not found.
6415 <tag/Notes/<itemize>
6416 <item>The function is only available as fastcall function, so it may only
6417 be used in presence of a prototype.
6419 <tag/Availability/ISO 9899
6421 <ref id="memchr" name="memchr">,
6422 <ref id="strrchr" name="strrchr">
6428 <sect1>strcmp<label id="strcmp"><p>
6432 <tag/Function/Compare two strings.
6433 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6434 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
6435 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
6436 parameters. It returns a value that is less than zero if <tt/s1/ is less than
6437 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
6438 if <tt/s1/ is greater than <tt/s2/.
6439 <tag/Notes/<itemize>
6440 <item>The function is only available as fastcall function, so it may only
6441 be used in presence of a prototype.
6443 <tag/Availability/ISO 9899
6445 <ref id="strcasecmp" name="strcasecmp">,
6446 <ref id="strcoll" name="strcoll">,
6447 <ref id="stricmp" name="stricmp">,
6448 <ref id="strncmp" name="strncmp">
6449 <ref id="strxfrm" name="strxfrm">
6455 <sect1>strcoll<label id="strcoll"><p>
6459 <tag/Function/Compare two strings.
6460 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6461 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
6462 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
6463 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
6464 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
6465 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
6466 than zero if <tt/s1/ is greater than <tt/s2/.
6467 <tag/Notes/<itemize>
6468 <item>The function is only available as fastcall function, so it may only
6469 be used in presence of a prototype.
6471 <tag/Availability/ISO 9899
6473 <ref id="setlocale" name="setlocale">,
6474 <ref id="strcasecmp" name="strcasecmp">,
6475 <ref id="strcmp" name="strcmp">,
6476 <ref id="stricmp" name="stricmp">,
6477 <ref id="strncmp" name="strncmp">,
6478 <ref id="strxfrm" name="strxfrm">
6484 <sect1>strcpy<label id="strcpy"><p>
6488 <tag/Function/Copy a string.
6489 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6490 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
6491 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
6492 <tt/s2/ (including the terminating null byte) into the array pointed to by
6493 <tt/s1/. The function will always return <tt/s1/.
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.
6497 <item>If copying takes place between objects that overlap, the behaviour
6500 <tag/Availability/ISO 9899
6502 <ref id="strcat" name="strcat">,
6503 <ref id="strncat" name="strncat">,
6504 <ref id="strncpy" name="strncpy">
6507 #include <string.h>
6509 static char hello[14];
6511 strcpy (hello, "Hello world!\n");
6517 <sect1>strcspn<label id="strcspn"><p>
6521 <tag/Function/Compute the length of a substring.
6522 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6523 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
6524 <tag/Description/The <tt/strcspn/ function computes and returns the length of
6525 the substring pointed to by <tt/s/ which does <em>not</em> consist of
6526 characters contained in the string <tt/set/.
6527 <tag/Notes/<itemize>
6528 <item>The function is only available as fastcall function, so it may only
6529 be used in presence of a prototype.
6531 <tag/Availability/ISO 9899
6533 <ref id="strqtok" name="strqtok">,
6534 <ref id="strspn" name="strspn">,
6535 <ref id="strstr" name="strstr">,
6536 <ref id="strtok" name="strtok">
6542 <sect1>strdup<label id="strdup"><p>
6546 <tag/Function/Allocate a copy of a string on the heap.
6547 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6548 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
6549 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
6550 to hold a copy of <tt/s/ including the terminating zero. If the allocation
6551 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
6552 memory block, and a pointer to the block is returned.
6553 <tag/Notes/<itemize>
6554 <item>The function is only available as fastcall function, so it may only
6555 be used in presence of a prototype.
6556 <item>It is up to the caller to free the allocated memory block.
6558 <tag/Availability/ISO 9899
6560 <ref id="free" name="free">,
6561 <ref id="malloc" name="malloc">
6567 <sect1>strerror<label id="strerror"><p>
6571 <tag/Function/Return a string describing an error code.
6572 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6573 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
6574 <tag/Description/The <tt/strerror/ function returns a string describing the
6575 given error code. If an invalid error code is passed, the string "Unknown
6576 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
6577 <tt/errno/ is left untouched.
6578 <tag/Notes/<itemize>
6579 <item>The function is only available as fastcall function, so it may only
6580 be used in presence of a prototype.
6581 <item>While the return type of the function is a <tt/char*/, the returned
6582 string must not be modified by the caller!
6584 <tag/Availability/ISO 9899
6586 <ref id="_stroserror" name="_stroserror">
6592 <sect1>stricmp<label id="stricmp"><p>
6596 <tag/Function/Compare two strings case insensitive.
6597 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6598 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
6599 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
6600 parameters without case sensitivity. It returns a value that is less than zero
6601 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
6602 value greater than zero if <tt/s1/ is greater than <tt/s2/.
6603 <tag/Notes/<itemize>
6604 <item>The function is only available as fastcall function, so it may only
6605 be used in presence of a prototype.
6606 <item>The function is not available in strict ANSI mode.
6608 <tag/Availability/cc65
6610 <ref id="strcasecmp" name="strcasecmp">,
6611 <ref id="strcmp" name="strcmp">,
6612 <ref id="strcoll" name="strcoll">,
6613 <ref id="strncmp" name="strncmp">,
6614 <ref id="strxfrm" name="strxfrm">
6620 <sect1>strlen<label id="strlen"><p>
6624 <tag/Function/Return the length of a string.
6625 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6626 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
6627 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
6628 string to which s points, not including the terminating null byte.
6629 <tag/Notes/<itemize>
6630 <item>The function is only available as fastcall function, so it may only
6631 be used in presence of a prototype.
6632 <item>When compiling with <tt/-Os/ (inline known standard functions), the
6633 function does not work correctly for strings with more than 255 characters.
6635 <tag/Availability/ISO 9899
6637 <ref id="strcpy" name="strcpy">
6643 <sect1>strlower<label id="strlower"><p>
6647 <tag/Function/Make a string lower case.
6648 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6649 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
6650 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
6651 function to each character of a string. The function will always return <tt/s/.
6652 <tag/Notes/<itemize>
6653 <item>The function is only available as fastcall function, so it may only
6654 be used in presence of a prototype.
6655 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6656 <item>An alias name for this function is <tt/strlwr/.
6658 <tag/Availability/cc65
6660 <ref id="strupper" name="strupper">,
6661 <ref id="tolower" name="tolower">
6667 <sect1>strlwr<label id="strlwr"><p>
6674 <sect1>strncasecmp<label id="strncasecmp"><p>
6678 <tag/Function/Compare two strings case insensitive.
6679 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6680 <tag/Declaration/<tt/int __fastcall__ strncasecmp (const char* s1, const char* s2, size_t count);/
6681 <tag/Description/The <tt/strncasecmp/ function compares the two strings passed
6682 as parameters without case sensitivity. It returns a value that is less than
6683 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
6684 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
6685 <tag/Notes/<itemize>
6686 <item>The function is only available as fastcall function, so it may only
6687 be used in presence of a prototype.
6688 <item>The function is not available in strict ANSI mode.
6690 <tag/Availability/cc65
6692 <ref id="strcmp" name="strcmp">,
6693 <ref id="strcoll" name="strcoll">,
6694 <ref id="stricmp" name="stricmp">,
6695 <ref id="strncmp" name="strncmp">,
6696 <ref id="strxfrm" name="strxfrm">
6702 <sect1>strncat<label id="strncat"><p>
6706 <tag/Function/Concatentate two strings.
6707 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6708 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
6709 <tag/Description/The <tt/strncat/ function appends not more than n characters
6710 of the string pointed to by s2 to the end of the string pointed to by s1. The
6711 terminating null character at the end of s1 is overwritten. A terminating null
6712 character is appended to the result, even if not all of s2 is appended to s1.
6713 <tag/Notes/<itemize>
6714 <item>The function is only available as fastcall function, so it may only
6715 be used in presence of a prototype.
6716 <item>If copying takes place between objects that overlap, the behaviour
6719 <tag/Availability/ISO 9899
6721 <ref id="strcpy" name="strcpy">,
6722 <ref id="strncat" name="strncat">,
6723 <ref id="strncpy" name="strncpy">
6729 <sect1>strncmp<label id="strncmp"><p>
6733 <tag/Function/Compare two strings.
6734 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6735 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
6736 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
6737 characters of the two strings passed as parameters. It returns a value that is
6738 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
6739 <tt/s2/, zero if they are identical, and a value greater than zero they are
6741 <tag/Notes/<itemize>
6742 <item>The function is only available as fastcall function, so it may only
6743 be used in presence of a prototype.
6745 <tag/Availability/ISO 9899
6747 <ref id="strcasecmp" name="strcasecmp">,
6748 <ref id="strcmp" name="strcmp">,
6749 <ref id="strcoll" name="strcoll">,
6750 <ref id="stricmp" name="stricmp">,
6751 <ref id="strxfrm" name="strxfrm">
6757 <sect1>strncpy<label id="strncpy"><p>
6761 <tag/Function/Copy part of a string.
6762 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6763 <tag/Declaration/<tt/char* __fastcall__ strncpy (char* s1, const char* s2, size_t n);/
6764 <tag/Description/The <tt/strncpy/ function copies not more than <tt/n/ bytes from
6765 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
6766 pointed to by <tt/s2/ is a string that is shorter than <tt/n/ bytes, null bytes are
6767 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
6768 written. The function always will return <tt/s1/.
6769 <tag/Notes/<itemize>
6770 <item>The function is available only as a fastcall function; so, it may be used
6771 only in the presence of a prototype.
6772 <item>If there is no null byte in the first <tt/n/ bytes of the array pointed
6773 to by <tt/s2/, the result is <em/not/ null-terminated!
6774 <item>If copying takes place between objects that overlap, the behaviour is
6777 <tag/Availability/ISO 9899
6779 <ref id="memcpy" name="memcpy">,
6780 <ref id="strcat" name="strcat">,
6781 <ref id="strcpy" name="strcpy">,
6782 <ref id="strncat" name="strncat">
6787 static char hello[6];
6789 strncpy (hello, "Hello world!\n", sizeof hello - 1)[5] = '\0';
6795 <sect1>strnicmp<label id="strnicmp"><p>
6799 <tag/Function/Compare two strings case insensitive.
6800 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6801 <tag/Declaration/<tt/int __fastcall__ strnicmp (const char* s1, const char* s2, size_t count);/
6802 <tag/Description/The <tt/strnicmp/ function compares the two strings passed as
6803 parameters without case sensitivity. It returns a value that is less than zero
6804 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
6805 value greater than zero if <tt/s1/ is greater than <tt/s2/.
6806 <tag/Notes/<itemize>
6807 <item>The function is only available as fastcall function, so it may only
6808 be used in presence of a prototype.
6809 <item>The function is not available in strict ANSI mode.
6811 <tag/Availability/cc65
6813 <ref id="strcasecmp" name="strcasecmp">,
6814 <ref id="strcmp" name="strcmp">,
6815 <ref id="strcoll" name="strcoll">,
6816 <ref id="strncmp" name="strncmp">,
6817 <ref id="strxfrm" name="strxfrm">
6823 <sect1>strqtok<label id="strqtok"><p>
6827 <tag/Function/Break a string into tokens.
6828 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6829 <tag/Declaration/<tt/char* __fastcall__ strqtok (char* s1, const char* s2);/
6830 <tag/Description/<tt/strqtok()/ will break the string <tt/s1/ into a sequence of
6831 tokens, which are delimited by either quotation marks or characters from the
6832 string <tt/s2/. Tokens inside quotation marks may contain characters from <tt/s2/
6833 (they aren't delimiters there). The first call to <tt/strqtok()/ will return a
6834 pointer to the first token in the string <tt/s1/. The following calls must pass
6835 a <tt/NULL/ pointer as <tt/s1/, in order to get the next token in the string.
6836 Different sets of delimiters may be used for the subsequent calls to <tt/strqtok()/.
6837 <tag/Notes/<itemize>
6838 <item>The function is available only as a fastcall function; so, it may be used
6839 only in the presence of a prototype.
6840 <item><tt/strqtok()/ will modify the string <tt/s1/.
6841 <item>The function will forget where it is in the <tt/s1/ string if it is given
6842 a second <tt/s1/ string before it finishes the first one.
6844 <tag/Availability/cc65
6846 <ref id="strcspn" name="strcspn">,
6847 <!-- <ref id="strpbrk" name="strpbrk">, -->
6848 <ref id="strspn" name="strspn">,
6849 <ref id="strtok" name="strtok">
6855 <sect1>strrchr<label id="strrchr"><p>
6859 <tag/Function/Search for a character in a string.
6860 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6861 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
6862 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
6863 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6864 byte is considered to be part of the string. Upon completion, the function
6865 returns a pointer to the byte, or a null pointer if the byte was not found.
6866 <tag/Notes/<itemize>
6867 <item>The function is only available as fastcall function, so it may only
6868 be used in presence of a prototype.
6870 <tag/Availability/ISO 9899
6872 <ref id="strchr" name="strchr">
6878 <sect1>strspn<label id="strspn"><p>
6882 <tag/Function/Compute the length of a substring.
6883 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6884 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
6885 <tag/Description/The <tt/strspn/ function computes and returns the length of
6886 the substring pointed to by <tt/s/ which does consist only of characters
6887 contained in the string <tt/set/.
6888 <tag/Notes/<itemize>
6889 <item>The function is only available as fastcall function, so it may only
6890 be used in presence of a prototype.
6892 <tag/Availability/ISO 9899
6894 <ref id="strcspn" name="strcspn">,
6895 <ref id="strstr" name="strstr">
6901 <sect1>strstr<label id="strstr"><p>
6905 <tag/Function/Find a substring.
6906 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6907 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
6908 <tag/Description/<tt/strstr/ searches for the first occurance of the string
6909 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
6910 otherwise it returns <tt/NULL/.
6911 <tag/Notes/<itemize>
6912 <item>The function is only available as fastcall function, so it may only
6913 be used in presence of a prototype.
6915 <tag/Availability/ISO 9899
6917 <ref id="strcspn" name="strcspn">,
6918 <ref id="strspn" name="strspn">
6924 <sect1>strtok<label id="strtok"><p>
6928 <tag/Function/Break a string into tokens.
6929 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6930 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
6931 <tag/Description/<tt/strtok()/ will break the string <tt/s1/ into a sequence of
6932 tokens, which are delimited by characters from the string <tt/s2/. The first call
6933 to <tt/strtok()/ will return a pointer to the first token in the string <tt/s1/.
6934 The following calls must pass a <tt/NULL/ pointer as <tt/s1/, in order to get
6935 the next token in the string. Different sets of delimiters may be used for the
6936 subsequent calls to <tt/strtok()/.
6937 <tag/Notes/<itemize>
6938 <item>The function is only available as fastcall function, so it may only
6939 be used in presence of a prototype.
6940 <item><tt/strtok()/ will modify the string <tt/s1/.
6941 <item>The function will forget where it is in the <tt/s1/ string if it is given
6942 a second <tt/s1/ string before it finishes the first one.
6944 <tag/Availability/ISO 9899
6946 <ref id="strcspn" name="strcspn">,
6947 <!-- <ref id="strpbrk" name="strpbrk">, -->
6948 <ref id="strqtok" name="strqtok">,
6949 <ref id="strspn" name="strspn">
6955 <sect1>strxfrm<label id="strxfrm"><p>
6959 <tag/Function/Transform a string.
6960 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6961 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
6962 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
6963 s2 and places the resulting string into the string pointed to by s1. The
6964 transformation is such that if the <tt/strcmp/ function is applied to two
6965 transformed strings, it returns a value greater than, equal to, or less than
6966 zero, corresponding to the result of the <tt/strcoll/ function applied to the
6967 same two original strings. No more than n characters are placed into the
6968 resulting array pointed to by s1, including the terminating null character.
6969 <tag/Notes/<itemize>
6970 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
6971 the behaviour is undefined.
6972 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
6973 <item>The function is only available as fastcall function, so it may only
6974 be used in presence of a prototype.
6975 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
6976 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
6978 <tag/Availability/ISO 9899
6980 <ref id="strcmp" name="strcmp">,
6981 <ref id="strcoll" name="strcoll">,
6982 <ref id="strncpy" name="strncpy">
6988 <sect1>strupper<label id="strupper"><p>
6992 <tag/Function/Make a string upper case.
6993 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6994 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
6995 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
6996 function to each character of a string. The function will always return <tt/s/.
6997 <tag/Notes/<itemize>
6998 <item>The function is only available as fastcall function, so it may only
6999 be used in presence of a prototype.
7000 <item>The function prototype is unavailable when compiling in strict ANSI mode.
7001 <item>An alias name for this function is <tt/strupr/.
7003 <tag/Availability/cc65
7005 <ref id="strlower" name="strlower">
7006 <ref id="toupper" name="toupper">
7012 <sect1>strupr<label id="strupr"><p>
7019 <sect1>telldir<label id="telldir"><p>
7023 <tag/Function/Return the current position of a directory stream.
7024 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
7025 <tag/Declaration/<tt/long __fastcall__ telldir (DIR* dir);/
7026 <tag/Description/<tt/telldir/ returns the current position of a directory
7027 stream. The return value may be used in subsequent calls to
7028 <tt/<ref id="seekdir" name="seekdir">/.
7029 <tag/Notes/<itemize>
7030 <item>The function is only available as fastcall function, so it may only
7031 be used in presence of a prototype.
7033 <tag/Availability/POSIX 1003.1
7035 <ref id="seekdir" name="seekdir">,
7036 <ref id="telldir" name="telldir">
7042 <sect1>textcolor<label id="textcolor"><p>
7046 <tag/Function/Set the text color.
7047 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7048 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
7049 <tag/Description/The function will set a new text color. It returns the old
7050 (current) text color. Text output using any <tt/conio.h/ function will use
7051 the color set by this function.
7052 <tag/Notes/<itemize>
7053 <item>Text colors are system dependent. The function may have no effect
7054 on systems where the text color cannot be changed.
7055 <item>The function is only available as fastcall function, so it may only
7056 be used in presence of a prototype.
7058 <tag/Availability/cc65
7060 <ref id="bgcolor" name="bgcolor">,
7061 <ref id="bordercolor" name="bordercolor">
7067 <sect1>time<label id="time"><p>
7071 <tag/Function/Get the time.
7072 <tag/Header/<tt/<ref id="time.h" name="time.h">/
7073 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
7074 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
7075 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
7076 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
7077 returned and <tt/errno/ is set to <tt/ENOSYS/.
7078 <tag/Notes/<itemize>
7079 <item>The function is only available as fastcall function, so it may
7080 only be used in presence of a prototype.
7081 <item>Many platforms supported by cc65 do not have a realtime clock, so the
7082 returned value may not be valid.
7084 <tag/Availability/ISO 9899
7086 <ref id="clock" name="clock">
7092 <sect1>toggle_videomode<label id="toggle_videomode"><p>
7096 <tag/Function/Toggle between 40 and 80 column mode.
7097 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
7098 <tag/Declaration/<tt/void toggle_videomode (void);/
7099 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
7100 old mode (cursor position, color and so on) are saved and restored together
7102 <tag/Notes/<itemize>
7103 <item>The function is specific to the C128.
7104 <item>This function is deprecated. Please use <ref id="videomode"
7105 name="videomode"> instead!
7107 <tag/Availability/C128
7109 <ref id="fast" name="fast">,
7110 <ref id="isfast" name="isfast">,
7111 <ref id="slow" name="slow">,
7112 <ref id="videomode" name="videomode">
7118 <sect1>tolower<label id="tolower"><p>
7122 <tag/Function/Convert a character into its lower case representation.
7123 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7124 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
7125 <tag/Description/The function returns the given character converted to lower
7126 case. If the given character is not a letter, it is returned unchanged.
7127 <tag/Notes/<itemize>
7128 <item>The function is only available as fastcall function, so it may
7129 only be used in presence of a prototype.
7131 <tag/Availability/ISO 9899
7133 <ref id="islower" name="islower">,
7134 <ref id="isupper" name="isupper">,
7135 <ref id="toupper" name="toupper">
7141 <sect1>toupper<label id="toupper"><p>
7145 <tag/Function/Convert a character into its upper case representation.
7146 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7147 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
7148 <tag/Description/The function returns the given character converted to upper
7149 case. If the given character is not a letter, it is returned unchanged.
7150 <tag/Notes/<itemize>
7151 <item>The function is only available as fastcall function, so it may
7152 only be used in presence of a prototype.
7154 <tag/Availability/ISO 9899
7156 <ref id="islower" name="islower">,
7157 <ref id="isupper" name="isupper">,
7158 <ref id="tolower" name="tolower">
7164 <sect1>ultoa<label id="ultoa"><p>
7168 <tag/Function/Convert an unsigned long integer into a string.
7169 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7170 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
7171 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
7172 string using <tt/radix/ as the base.
7173 <tag/Notes/<itemize>
7174 <item>There are no provisions to prevent a buffer overflow.
7175 <item>The function is non standard, so it is not available in strict ANSI mode.
7176 You should probably use <tt/sprintf/ instead.
7177 <item>The function is only available as fastcall function, so it may only be
7178 used in presence of a prototype.
7180 <tag/Availability/cc65
7182 <ref id="atoi" name="atoi">,
7183 <ref id="atol" name="atol">,
7184 <ref id="itoa" name="itoa">,
7185 <ref id="ltoa" name="ltoa">,
7186 <ref id="utoa" name="utoa">
7192 <sect1>unlink<label id="unlink"><p>
7196 <tag/Function/Delete a file.
7197 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
7198 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
7199 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
7200 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
7201 code describing the reason for the failure.
7202 <tag/Notes/<itemize>
7203 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
7204 name="remove">/ instead, which is a native ANSI C function and does the same.
7205 <item>This function is not available on all cc65 targets (depends on the
7206 availability of file I/O).
7207 <item>The function is only available as fastcall function, so it may only
7208 be used in presence of a prototype.
7209 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
7210 used, which has the same semantics, but is more portable, because it conforms
7211 to the ISO C standard.
7213 <tag/Availability/POSIX 1003.1
7215 <ref id="remove" name="remove">
7218 #include <stdio.h>
7219 #include <unistd.h>
7221 #define FILENAME "helloworld"
7223 if (unlink (FILENAME) == 0) {
7224 printf ("We deleted %s successfully\n", FILENAME);
7226 printf ("There was a problem deleting %s\n", FILENAME);
7233 <sect1>utoa<label id="utoa"><p>
7237 <tag/Function/Convert an unsigned integer into a string.
7238 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7239 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
7240 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
7241 using <tt/radix/ as the base.
7242 <tag/Notes/<itemize>
7243 <item>There are no provisions to prevent a buffer overflow.
7244 <item>The function is non standard, so it is not available in strict ANSI mode.
7245 You should probably use <tt/sprintf/ instead.
7246 <item>The function is only available as fastcall function, so it may only be
7247 used in presence of a prototype.
7249 <tag/Availability/cc65
7251 <ref id="atoi" name="atoi">,
7252 <ref id="atol" name="atol">,
7253 <ref id="itoa" name="itoa">,
7254 <ref id="ltoa" name="ltoa">,
7255 <ref id="ultoa" name="ultoa">
7261 <sect1>vcprintf<label id="vcprintf"><p>
7265 <tag/Function/Formatted output to the console.
7266 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7267 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
7268 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
7269 text where necessary and formatted according to the format string given. The
7270 resulting string is output to the console. <tt/vcprintf/ supports the same
7271 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
7272 <tag/Notes/<itemize>
7273 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
7274 between <tt/\r/ and <tt/\n/.
7275 <item>The function is only available as fastcall function, so it may only be
7276 used in presence of a prototype.
7278 <tag/Availability/cc65
7280 <ref id="cprintf" name="cprintf">,
7281 <ref id="cputc" name="cputc">,
7282 <ref id="cputcxy" name="cputcxy">,
7283 <ref id="cputs" name="cputs">,
7284 <ref id="cputsxy" name="cputsxy">
7290 <sect1>videomode<label id="videomode"><p>
7294 <tag/Function/Switch to either 40 or 80 column mode.
7295 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
7296 <ref id="c128.h" name="c128.h">/
7297 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
7298 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
7299 the requested mode is already active, nothing happens. The old mode is returned
7301 <tag/Notes/<itemize>
7302 <item>The function is specific to the C128 and enhanced Apple //e.
7303 <item>This function replaces <ref id="toggle_videomode"
7304 name="toggle_videomode">.
7305 <item>The function is only available as fastcall function, so it may only be
7306 used in presence of a prototype.
7308 <tag/Availability/C128 and enhanced Apple //e
7310 <ref id="fast" name="fast">,
7311 <ref id="isfast" name="isfast">,
7312 <ref id="slow" name="slow">,
7313 <ref id="toggle_videomode" name="toggle_videomode">
7319 <sect1>waitvsync<label id="waitvsync"><p>
7323 <tag/Function/Wait until the start of the next frame.
7325 <tt/<ref id="cbm.h" name="cbm.h">/,
7326 <tt/<ref id="gamate.h" name="gamate.h">/,
7327 <tt/<ref id="nes.h" name="nes.h">/,
7328 <tt/<ref id="pce.h" name="pce.h">/
7329 <tag/Declaration/<tt/void waitvsync (void);/
7330 <tag/Description/Wait for vertical sync to reduce flickering.
7331 <tag/Availability/Platforms above
7337 <sect1>wherex<label id="wherex"><p>
7341 <tag/Function/Return the current X position of the text mode cursor.
7342 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7343 <tag/Declaration/<tt/unsigned char wherex (void);/
7344 <tag/Description/The function returns the current X position of the text mode
7345 cursor. Zero is returned for the leftmost screen position.
7346 <tag/Availability/cc65
7348 <ref id="gotox" name="gotox">,
7349 <ref id="gotoy" name="gotoy">,
7350 <ref id="gotoxy" name="gotoxy">,
7351 <ref id="wherey" name="wherey">
7357 <sect1>wherey<label id="wherey"><p>
7361 <tag/Function/Return the current Y position of the text mode cursor.
7362 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7363 <tag/Declaration/<tt/unsigned char wherey (void);/
7364 <tag/Description/The function returns the current Y position of the text mode
7365 cursor. Zero is returned for the uppermost screen position.
7366 <tag/Availability/cc65
7368 <ref id="gotox" name="gotox">,
7369 <ref id="gotoy" name="gotoy">,
7370 <ref id="gotoxy" name="gotoxy">,
7371 <ref id="wherex" name="wherex">