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_scpu" name="detect_scpu">
72 <item><ref id="get_scpu_speed" name="get_scpu_speed">
73 <item><ref id="set_scpu_speed" name="set_scpu_speed">
77 <sect1><tt/apple2.h/<label id="apple2.h"><p>
81 <item><ref id="get_ostype" name="get_ostype">
86 <sect1><tt/apple2enh.h/<label id="apple2enh.h"><p>
90 <item><ref id="get_ostype" name="get_ostype">
94 <item><ref id="videomode" name="videomode">
98 <sect1><tt/assert.h/<label id="assert.h"><p>
101 <item><ref id="assert" name="assert">
105 <sect1><tt/atari.h/<label id="atari.h"><p>
108 <!-- <item><ref id="_getcolor" name="_getcolor"> -->
109 <!-- <item><ref id="_getdefdev" name="_getdefdev"> -->
110 <!-- <item><ref id="_graphics" name="_graphics"> -->
111 <item><ref id="_is_cmdline_dos" name="_is_cmdline_dos">
112 <!-- <item><ref id="_rest_vecs" name="_rest_vecs"> -->
113 <!-- <item><ref id="_save_vecs" name="_save_vecs"> -->
114 <!-- <item><ref id="_scroll" name="_scroll"> -->
115 <!-- <item><ref id="_setcolor" name="_setcolor"> -->
116 <!-- <item><ref id="_setcolor_low" name="_setcolor_low"> -->
117 <item><ref id="get_ostype" name="get_ostype">
118 <!-- <item><ref id="get_tv" name="get_tv"> -->
124 <sect1><tt/atmos.h/<label id="atmos.h"><p>
127 <item><ref id="atmos_explode" name="atmos_explode">
128 <item><ref id="atmos_load" name="atmos_load">
129 <item><ref id="atmos_ping" name="atmos_ping">
130 <item><ref id="atmos_save" name="atmos_save">
131 <item><ref id="atmos_shoot" name="atmos_shoot">
132 <item><ref id="atmos_tick" name="atmos_tick">
133 <item><ref id="atmos_tock" name="atmos_tock">
134 <item><ref id="atmos_zap" name="atmos_zap">
138 <sect1><tt/c128.h/<label id="c128.h"><p>
141 <item><ref id="c64mode" name="c64mode">
142 <item><ref id="fast" name="fast">
143 <item><ref id="isfast" name="isfast">
144 <item><ref id="slow" name="slow">
145 <item><ref id="toggle_videomode" name="toggle_videomode">
146 <item><ref id="videomode" name="videomode">
150 <sect1><tt/c16.h/<label id="c16.h"><p>
153 <item><ref id="fast" name="fast">
154 <item><ref id="isfast" name="isfast">
155 <item><ref id="slow" name="slow">
161 <sect1><tt/c64.h/<label id="c64.h"><p>
164 <item><ref id="get_ostype" name="get_ostype">
168 <sect1><tt/cbm.h/<label id="cbm.h"><p>
171 <item><ref id="cbm_k_acptr" name="cbm_k_acptr">
172 <item><ref id="cbm_k_basin" name="cbm_k_basin">
173 <item><ref id="cbm_k_bsout" name="cbm_k_bsout">
174 <item><ref id="cbm_k_chkin" name="cbm_k_chkin">
175 <item><ref id="cbm_k_ciout" name="cbm_k_ciout">
176 <item><ref id="cbm_k_ckout" name="cbm_k_ckout">
177 <item><ref id="cbm_k_clall" name="cbm_k_clall">
178 <item><ref id="cbm_k_close" name="cbm_k_close">
179 <item><ref id="cbm_k_clrch" name="cbm_k_clrch">
180 <item><ref id="cbm_k_getin" name="cbm_k_getin">
181 <item><ref id="cbm_k_iobase" name="cbm_k_iobase">
182 <item><ref id="cbm_k_listen" name="cbm_k_listen">
183 <item><ref id="cbm_k_load" name="cbm_k_load">
184 <item><ref id="cbm_k_open" name="cbm_k_open">
185 <item><ref id="cbm_k_readst" name="cbm_k_readst">
186 <item><ref id="cbm_k_save" name="cbm_k_save">
187 <item><ref id="cbm_k_scnkey" name="cbm_k_scnkey">
188 <item><ref id="cbm_k_setlfs" name="cbm_k_setlfs">
189 <item><ref id="cbm_k_setnam" name="cbm_k_setnam">
190 <item><ref id="cbm_k_talk" name="cbm_k_talk">
191 <item><ref id="cbm_k_udtim" name="cbm_k_udtim">
192 <item><ref id="cbm_k_unlsn" name="cbm_k_unlsn">
193 <!-- <item><ref id="cbm_load" name="cbm_load"> -->
194 <!-- <item><ref id="cbm_open" name="cbm_open"> -->
195 <!-- <item><ref id="cbm_opendir" name="cbm_opendir"> -->
196 <!-- <item><ref id="cbm_read" name="cbm_read"> -->
197 <!-- <item><ref id="cbm_readdir" name="cbm_readdir"> -->
198 <!-- <item><ref id="cbm_save" name="cbm_save"> -->
199 <!-- <item><ref id="cbm_write" name="cbm_write"> -->
200 <!-- <item><ref id="get_tv" name="get_tv"> -->
201 <item><ref id="waitvsync" name="waitvsync">
202 <item><ref id="kbrepeat" name="kbrepeat">
208 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
211 <item><ref id="peekbsys" name="peekbsys">
212 <item><ref id="peekwsys" name="peekwsys">
213 <item><ref id="pokebsys" name="pokebsys">
214 <item><ref id="pokewsys" name="pokewsys">
218 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
221 <item><ref id="peekbsys" name="peekbsys">
222 <item><ref id="peekwsys" name="peekwsys">
223 <item><ref id="pokebsys" name="pokebsys">
224 <item><ref id="pokewsys" name="pokewsys">
228 <sect1><tt/cc65.h/<label id="cc65.h"><p>
231 <!-- <item><ref id="cc65_cos" name="cc65_cos"> -->
232 <!-- <item><ref id="cc65_idiv32by16r16" name="cc65_idiv32by16r16"> -->
233 <!-- <item><ref id="cc65_imul16x16r32" name="cc65_imul16x16r32"> -->
234 <!-- <item><ref id="cc65_imul8x8r16" name="cc65_imul8x8r16"> -->
235 <!-- <item><ref id="cc65_sin" name="cc65_sin"> -->
236 <!-- <item><ref id="cc65_udiv32by16r16" name="cc65_udiv32by16r16"> -->
237 <!-- <item><ref id="cc65_umul16x16r32" name="cc65_umul16x16r32"> -->
238 <!-- <item><ref id="cc65_umul16x8r32" name="cc65_umul16x8r32"> -->
239 <!-- <item><ref id="cc65_umul8x8r16" name="cc65_umul8x8r16"> -->
240 <item><ref id="doesclrscrafterexit" name="doesclrscrafterexit">
246 <sect1><tt/conio.h/<label id="conio.h"><p>
249 <item><ref id="bgcolor" name="bgcolor">
250 <item><ref id="bordercolor" name="bordercolor">
251 <item><ref id="cclear" name="cclear">
252 <item><ref id="cclearxy" name="cclearxy">
253 <item><ref id="cgetc" name="cgetc">
254 <item><ref id="chline" name="chline">
255 <item><ref id="chlinexy" name="chlinexy">
256 <item><ref id="clrscr" name="clrscr">
257 <item><ref id="cpeekc" name="cpeekc">
258 <item><ref id="cpeekcolor" name="cpeekcolor">
259 <item><ref id="cpeekrevers" name="cpeekrevers">
260 <item><ref id="cpeeks" name="cpeeks">
261 <item><ref id="cprintf" name="cprintf">
262 <item><ref id="cputc" name="cputc">
263 <item><ref id="cputcxy" name="cputcxy">
264 <item><ref id="cputs" name="cputs">
265 <item><ref id="cputsxy" name="cputsxy">
266 <item><ref id="cursor" name="cursor">
267 <item><ref id="cvline" name="cvline">
268 <item><ref id="cvlinexy" name="cvlinexy">
269 <item><ref id="gotox" name="gotox">
270 <item><ref id="gotoxy" name="gotoxy">
271 <item><ref id="gotoy" name="gotoy">
272 <item><ref id="kbhit" name="kbhit">
273 <item><ref id="revers" name="revers">
274 <item><ref id="screensize" name="screensize">
275 <item><ref id="textcolor" name="textcolor">
276 <item><ref id="vcprintf" name="vcprintf">
277 <item><ref id="wherex" name="wherex">
278 <item><ref id="wherey" name="wherey">
282 <sect1><tt/ctype.h/<label id="ctype.h"><p>
285 <item><ref id="isalnum" name="isalnum">
286 <item><ref id="isalpha" name="isalpha">
287 <item><ref id="isascii" name="isascii">
288 <item><ref id="isblank" name="isblank">
289 <item><ref id="iscntrl" name="iscntrl">
290 <item><ref id="isdigit" name="isdigit">
291 <item><ref id="isgraph" name="isgraph">
292 <item><ref id="islower" name="islower">
293 <item><ref id="isprint" name="isprint">
294 <item><ref id="ispunct" name="ispunct">
295 <item><ref id="isspace" name="isspace">
296 <item><ref id="isupper" name="isupper">
297 <item><ref id="isxdigit" name="isxdigit">
298 <item><ref id="tolower" name="tolower">
299 <item><ref id="toupper" name="toupper">
303 <sect1><tt/dbg.h/<label id="dbg.h"><p>
306 <!-- <item><ref id="DbgInit" name="DbgInit"> -->
312 <sect1><tt/device.h/<label id="device.h"><p>
315 <item><ref id="getcurrentdevice" name="getcurrentdevice">
316 <item><ref id="getdevicedir" name="getdevicedir">
317 <item><ref id="getfirstdevice" name="getfirstdevice">
318 <item><ref id="getnextdevice" name="getnextdevice">
322 <sect1><tt/dio.h/<label id="dio.h"><p>
324 <url url="dio.html" name="Low-level disk I/O API">.
327 <sect1><tt/dirent.h/<label id="dirent.h"><p>
330 <item><ref id="_DE_ISDIR" name="_DE_ISDIR">
331 <item><ref id="_DE_ISLBL" name="_DE_ISLBL">
332 <item><ref id="_DE_ISLNK" name="_DE_ISLNK">
333 <item><ref id="_DE_ISREG" name="_DE_ISREG">
334 <item><ref id="closedir" name="closedir">
335 <item><ref id="opendir" name="opendir">
336 <item><ref id="readdir" name="readdir">
337 <item><ref id="rewinddir" name="rewinddir">
338 <item><ref id="seekdir" name="seekdir">
339 <item><ref id="telldir" name="telldir">
343 <sect1><tt/em.h/<label id="em.h"><p>
346 <item><ref id="em_commit" name="em_commit">
347 <item><ref id="em_copyfrom" name="em_copyfrom">
348 <item><ref id="em_copyto" name="em_copyto">
349 <item><ref id="em_install" name="em_install">
350 <item><ref id="em_load_driver" name="em_load_driver">
351 <item><ref id="em_map" name="em_map">
352 <item><ref id="em_pagecount" name="em_pagecount">
353 <item><ref id="em_uninstall" name="em_uninstall">
354 <item><ref id="em_unload" name="em_unload">
355 <item><ref id="em_use" name="em_use">
359 <sect1><tt/errno.h/<label id="errno.h"><p>
362 <!-- <item><ref id="_directerrno" name="_directerrno"> -->
363 <!-- <item><ref id="_mappederrno" name="_mappederrno"> -->
364 <!-- <item><ref id="_osmaperrno" name="_osmaperrno"> -->
365 <!-- <item><ref id="_seterrno" name="_seterrno"> -->
371 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
374 <item><ref id="close" name="close">
375 <item><ref id="creat" name="creat">
376 <item><ref id="open" name="open">
380 <sect1><tt/gamate.h/<label id="gamate.h"><p>
383 <!-- <item><ref id="get_tv" name="get_tv"> -->
384 <item><ref id="waitvsync" name="waitvsync">
390 <sect1><tt/geos.h/<label id="geos.h"><p>
392 <url url="geos.html" name="GEOS API">.
395 <sect1><tt/joystick.h/<label id="joystick.h"><p>
398 <item><ref id="joy_count" name="joy_count">
399 <item><ref id="joy_install" name="joy_install">
400 <item><ref id="joy_load_driver" name="joy_load_driver">
401 <item><ref id="joy_read" name="joy_read">
402 <item><ref id="joy_uninstall" name="joy_uninstall">
403 <item><ref id="joy_unload" name="joy_unload">
407 <sect1><tt/locale.h/<label id="locale.h"><p>
410 <item><ref id="localeconv" name="localeconv">
411 <item><ref id="setlocale" name="setlocale">
415 <sect1><tt/lynx.h/<label id="lynx.h"><p>
418 <!-- <item><ref id="lynx_eeprom_erase" name="lynx_eeprom_erase"> -->
419 <!-- <item><ref id="lynx_eeprom_read" name="lynx_eeprom_read"> -->
420 <!-- <item><ref id="lynx_eeprom_write" name="lynx_eeprom_write"> -->
421 <!-- <item><ref id="lynx_eeread" name="lynx_eeread"> -->
422 <!-- <item><ref id="lynx_eewrite" name="lynx_eewrite"> -->
423 <!-- <item><ref id="lynx_exec" name="lynx_exec"> -->
424 <!-- <item><ref id="lynx_load" name="lynx_load"> -->
430 <sect1><tt/lz4.h/<label id="lz4.h"><p>
433 <item><ref id="decompress_lz4" name="decompress_lz4">
437 <sect1><tt/modload.h/<label id="modload.h"><p>
440 <item><ref id="mod_load" name="mod_load">
441 <item><ref id="mod_free" name="mod_free">
445 <sect1><tt/mouse.h/<label id="mouse.h"><p>
448 <item><ref id="mouse_buttons" name="mouse_buttons">
449 <item><ref id="mouse_getbox" name="mouse_getbox">
450 <item><ref id="mouse_geterrormsg" name="mouse_geterrormsg">
451 <item><ref id="mouse_hide" name="mouse_hide">
452 <item><ref id="mouse_info" name="mouse_info">
453 <item><ref id="mouse_install" name="mouse_install">
454 <item><ref id="mouse_ioctl" name="mouse_ioctl">
455 <item><ref id="mouse_load_driver" name="mouse_load_driver">
456 <item><ref id="mouse_move" name="mouse_move">
457 <item><ref id="mouse_pos" name="mouse_pos">
458 <item><ref id="mouse_setbox" name="mouse_setbox">
459 <item><ref id="mouse_show" name="mouse_show">
460 <item><ref id="mouse_uninstall" name="mouse_uninstall">
461 <item><ref id="mouse_unload" name="mouse_unload">
465 <sect1><tt/nes.h/<label id="nes.h"><p>
468 <!-- <item><ref id="get_tv" name="get_tv"> -->
469 <item><ref id="waitvsync" name="waitvsync">
475 <sect1><tt/o65.h/<label id="o65.h"><p>
477 The <tt/o65.h/ header file contains structure and constant definitions that
478 may be used when dealing with files in <url
479 url="http://www.6502.org/users/andre/o65/fileformat.html" name="the o65 format">.
480 It does not declare any functions.
483 <sect1><tt/pce.h/<label id="pce.h"><p>
486 <!-- <item><ref id="get_tv" name="get_tv"> -->
487 <item><ref id="waitvsync" name="waitvsync">
493 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
496 <item><ref id="PEEK" name="PEEK">
497 <item><ref id="PEEKW" name="PEEKW">
498 <item><ref id="POKE" name="POKE">
499 <item><ref id="POKEW" name="POKEW">
503 <sect1><tt/pen.h/<label id="pen.h"><p>
506 <!-- <item><ref id="pen_adjust" name="pen_adjust"> -->
507 <!-- <item><ref id="pen_calibrate" name="pen_calibrate"> -->
513 <sect1><tt/pet.h/<label id="pet.h"><p>
518 <sect1><tt/plus4.h/<label id="plus4.h"><p>
521 <item><ref id="fast" name="fast">
522 <item><ref id="isfast" name="isfast">
523 <item><ref id="slow" name="slow">
529 <sect1><tt/serial.h/<label id="serial.h"><p>
531 The <tt/serial.h/ header file contains definitions for initializing serial
535 <item><ref id="ser_close" name="ser_close">
536 <item><ref id="ser_get" name="ser_get">
537 <item><ref id="ser_install" name="ser_install">
538 <item><ref id="ser_ioctl" name="ser_ioctl">
539 <item><ref id="ser_load_driver" name="ser_load_driver">
540 <item><ref id="ser_open" name="ser_open">
541 <item><ref id="ser_put" name="ser_put">
542 <item><ref id="ser_status" name="ser_status">
543 <item><ref id="ser_uninstall" name="ser_uninstall">
544 <item><ref id="ser_unload" name="ser_unload">
548 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
551 <item><ref id="setjmp" name="setjmp">
552 <item><ref id="longjmp" name="longjmp">
556 <sect1><tt/signal.h/<label id="signal.h"><p>
559 <item><ref id="raise" name="raise">
560 <item><ref id="signal" name="signal">
564 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
569 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
574 <sect1><tt/stddef.h/<label id="stddef.h"><p>
577 <item><ref id="offsetof" name="offsetof">
581 <sect1><tt/stdio.h/<label id="stdio.h"><p>
584 <item><ref id="_poserror" name="_poserror">
585 <item><ref id="clearerr" name="clearerr">
586 <!-- <item><ref id="fclose" name="fclose"> -->
587 <!-- <item><ref id="fdopen" name="fdopen"> -->
588 <item><ref id="feof" name="feof">
589 <item><ref id="ferror" name="ferror">
590 <!-- <item><ref id="fflush" name="fflush"> -->
591 <!-- <item><ref id="fgetc" name="fgetc"> -->
592 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
593 <!-- <item><ref id="fgets" name="fgets"> -->
594 <item><ref id="fileno" name="fileno">
595 <!-- <item><ref id="fopen" name="fopen"> -->
596 <!-- <item><ref id="fprintf" name="fprintf"> -->
597 <!-- <item><ref id="fputc" name="fputc"> -->
598 <!-- <item><ref id="fputs" name="fputs"> -->
599 <!-- <item><ref id="fread" name="fread"> -->
600 <!-- <item><ref id="freopen" name="freopen"> -->
601 <!-- <item><ref id="fscanf" name="fscanf"> -->
602 <!-- <item><ref id="fseek" name="fseek"> -->
603 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
604 <!-- <item><ref id="ftell" name="ftell"> -->
605 <!-- <item><ref id="fwrite" name="fwrite"> -->
606 <!-- <item><ref id="getc" name="getc"> -->
607 <!-- <item><ref id="getchar" name="getchar"> -->
608 <!-- <item><ref id="gets" name="gets"> -->
609 <!-- <item><ref id="printf" name="printf"> -->
610 <!-- <item><ref id="putc" name="putc"> -->
611 <!-- <item><ref id="putchar" name="putchar"> -->
612 <!-- <item><ref id="puts" name="puts"> -->
613 <item><ref id="rename" name="rename">
614 <item><ref id="remove" name="remove">
615 <!-- <item><ref id="rewind" name="rewind"> -->
616 <!-- <item><ref id="scanf" name="scanf"> -->
617 <!-- <item><ref id="snprintf" name="snprintf"> -->
618 <!-- <item><ref id="sprintf" name="sprintf"> -->
619 <!-- <item><ref id="sscanf" name="sscanf"> -->
620 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
621 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
622 <!-- <item><ref id="vprintf" name="vprintf"> -->
623 <!-- <item><ref id="vscanf" name="vscanf"> -->
624 <!-- <item><ref id="vsnprintf" name="vsnprintf"> -->
625 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
626 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
632 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
635 <item><ref id="_heapadd" name="_heapadd">
636 <item><ref id="_heapblocksize" name="_heapblocksize">
637 <item><ref id="_heapmaxavail" name="_heapmaxavail">
638 <item><ref id="_heapmemavail" name="_heapmemavail">
639 <item><ref id="_randomize" name="_randomize">
640 <item><ref id="_swap" name="_swap">
641 <item><ref id="abort" name="abort">
642 <item><ref id="abs" name="abs">
643 <item><ref id="atexit" name="atexit">
644 <item><ref id="atoi" name="atoi">
645 <item><ref id="atol" name="atol">
646 <item><ref id="bsearch" name="bsearch">
647 <item><ref id="calloc" name="calloc">
648 <item><ref id="div" name="div">
649 <item><ref id="exit" name="exit">
650 <item><ref id="free" name="free">
651 <item><ref id="getenv" name="getenv">
652 <item><ref id="itoa" name="itoa">
653 <item><ref id="labs" name="labs">
654 <item><ref id="ltoa" name="ltoa">
655 <item><ref id="malloc" name="malloc">
656 <item><ref id="perror" name="perror">
657 <!-- <item><ref id="posix_memalign" name="posix_memalign"> -->
658 <!-- <item><ref id="putenv" name="putenv"> -->
659 <item><ref id="qsort" name="qsort">
660 <item><ref id="rand" name="rand">
661 <item><ref id="realloc" name="realloc">
662 <item><ref id="srand" name="srand">
663 <!-- <item><ref id="system" name="system"> -->
664 <item><ref id="ultoa" name="ultoa">
665 <item><ref id="utoa" name="utoa">
671 <sect1><tt/string.h/<label id="string.h"><p>
674 <item><ref id="_stroserror" name="_stroserror">
675 <item><ref id="bzero" name="bzero">
676 <item><ref id="memchr" name="memchr">
677 <item><ref id="memcmp" name="memcmp">
678 <item><ref id="memcpy" name="memcpy">
679 <item><ref id="memmove" name="memmove">
680 <item><ref id="memset" name="memset">
681 <item><ref id="strcasecmp" name="strcasecmp">
682 <item><ref id="strcat" name="strcat">
683 <item><ref id="strchr" name="strchr">
684 <item><ref id="strcmp" name="strcmp">
685 <item><ref id="strcoll" name="strcoll">
686 <item><ref id="strcpy" name="strcpy">
687 <item><ref id="strcspn" name="strcspn">
688 <item><ref id="strdup" name="strdup">
689 <item><ref id="strerror" name="strerror">
690 <item><ref id="stricmp" name="stricmp">
691 <item><ref id="strlen" name="strlen">
692 <item><ref id="strlower" name="strlower">
693 <item><ref id="strlwr" name="strlwr">
694 <item><ref id="strncasecmp" name="strncasecmp">
695 <item><ref id="strncat" name="strncat">
696 <item><ref id="strncmp" name="strncmp">
697 <item><ref id="strncpy" name="strncpy">
698 <item><ref id="strnicmp" name="strnicmp">
699 <item><ref id="strqtok" name="strqtok">
700 <item><ref id="strrchr" name="strrchr">
701 <item><ref id="strspn" name="strspn">
702 <item><ref id="strstr" name="strstr">
703 <item><ref id="strtok" name="strtok">
704 <item><ref id="strxfrm" name="strxfrm">
705 <item><ref id="strupper" name="strupper">
706 <item><ref id="strupr" name="strupr">
710 <sect1><tt/telestrat.h/<label id="telestrat.h"><p>
713 <item><ref id="atmos_explode" name="explode">
714 <item><ref id="atmos_ping" name="ping">
715 <item><ref id="atmos_shoot" name="shoot">
716 <item><ref id="atmos_zap" name="zap">
717 <!-- <item><ref id="kbdclick1" name="kbdclick1"> -->
718 <!-- <item><ref id="oups" name="oups"> -->
724 <sect1><tt/tgi.h/<label id="tgi.h"><p>
726 <url url="tgi.html" name="Tiny Graphics Interface">.
729 <sect1><tt/time.h/<label id="time.h"><p>
732 <!-- <item><ref id="_systime" name="_systime"> -->
733 <!-- <item><ref id="asctime" name="asctime"> -->
734 <item><ref id="clock" name="clock">
735 <!-- <item><ref id="ctime" name="ctime"> -->
736 <!-- <item><ref id="gmtime" name="gmtime"> -->
737 <!-- <item><ref id="localtime" name="localtime"> -->
738 <!-- <item><ref id="mktime" name="mktime"> -->
739 <!-- <item><ref id="strftime" name="strftime"> -->
740 <item><ref id="time" name="time">
746 <sect1><tt/unistd.h/<label id="unistd.h"><p>
749 <!-- <item><ref id="chdir" name="chdir"> -->
750 <item><ref id="exec" name="exec">
751 <item><ref id="getcwd" name="getcwd">
752 <item><ref id="getopt" name="getopt">
753 <!-- <item><ref id="lseek" name="lseek"> -->
754 <!-- <item><ref id="mkdir" name="mkdir"> -->
755 <!-- <item><ref id="read" name="read"> -->
756 <!-- <item><ref id="rmdir" name="rmdir"> -->
757 <item><ref id="sleep" name="sleep">
758 <item><ref id="unlink" name="unlink">
759 <!-- <item><ref id="write" name="write"> -->
765 <sect1><tt/vic20.h/<label id="vic20.h"><p>
770 <sect1><tt/zlib.h/<label id="zlib.h"><p>
773 <!-- <item><ref id="adler32" name="adler32"> -->
774 <!-- <item><ref id="crc32" name="crc32"> -->
775 <!-- <item><ref id="inflatemem" name="inflatemem"> -->
776 <!-- <item><ref id="uncompress" name="uncompress"> -->
782 <sect>Alphabetical function reference<p>
784 <sect1>_DE_ISDIR<label id="_DE_ISDIR"><p>
788 <tag/Function/Determine if a directory entry specifies a directory.
789 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
790 <tag/Declaration/<tt/int _DE_ISDIR(unsigned char type);/
791 <tag/Description/The function is called with the type of a directory entry
792 taken from a <tt/struct dirent/ and returns true if the entry designates
795 <item>The function is actually a macro.
797 <tag/Availability/cc65
799 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
800 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
801 <ref id="_DE_ISREG" name="_DE_ISREG">
807 <sect1>_DE_ISLBL<label id="_DE_ISLBL"><p>
811 <tag/Function/Determine if a directory entry specifies a disk label.
812 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
813 <tag/Declaration/<tt/int _DE_ISLBL(unsigned char type);/
814 <tag/Description/The function is called with the type of a directory entry
815 taken from a <tt/struct dirent/ and returns true if the entry designates
818 <item>The function is actually a macro.
820 <tag/Availability/cc65
822 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
823 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
824 <ref id="_DE_ISREG" name="_DE_ISREG">
830 <sect1>_DE_ISLNK<label id="_DE_ISLNK"><p>
834 <tag/Function/Determine if a directory entry specifies a link.
835 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
836 <tag/Declaration/<tt/int _DE_ISLNK(unsigned char type);/
837 <tag/Description/The function is called with the type of a directory entry
838 taken from a <tt/struct dirent/ and returns true if the entry designates
841 <item>The function is actually a macro.
843 <tag/Availability/cc65
845 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
846 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
847 <ref id="_DE_ISREG" name="_DE_ISREG">
853 <sect1>_DE_ISREG<label id="_DE_ISREG"><p>
857 <tag/Function/Determine if a directory entry specifies a regular file.
858 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
859 <tag/Declaration/<tt/int _DE_ISREG(unsigned char type);/
860 <tag/Description/The function is called with the type of a directory entry
861 taken from a <tt/struct dirent/ and returns true if the entry designates
864 <item>The function is actually a macro.
865 <item>A "regular file" means anything with data in it. This might still mean
866 that special processing is needed, when accessing the file. Relative files of
867 the CBM systems are classified as being "regular" files, for example.
869 <tag/Availability/cc65
871 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
872 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
873 <ref id="_DE_ISLNK" name="_DE_ISLNK">
879 <sect1>_heapadd<label id="_heapadd"><p>
883 <tag/Function/Add a block to the heap.
884 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
885 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
886 <tag/Description/The function adds a block of raw memory to the heap.
888 <item>The minimum blocksize that can be added is 6 bytes; the function will
889 ignore smaller blocks.
890 <item>The function is available only as a fastcall function; so, it may be used
891 only in the presence of a prototype.
893 <tag/Availability/cc65
895 <ref id="_heapblocksize" name="_heapblocksize">,
896 <ref id="_heapmaxavail" name="_heapmaxavail">,
897 <ref id="_heapmemavail" name="_heapmemavail">,
898 <ref id="calloc" name="calloc">,
899 <ref id="free" name="free">,
900 <ref id="malloc" name="malloc">,
901 <ref id="realloc" name="realloc">
907 <sect1>_heapblocksize<label id="_heapblocksize"><p>
911 <tag/Function/Return the size of an allocated block.
912 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
913 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
914 <tag/Description/The function returns the size of a block that must have
915 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
916 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
918 <item>Passing a pointer to a block that was is not the result of one of the
919 allocation functions, or that has been free'd will give unpredicable results.
920 <item>The function is available only as a fastcall function; so, it may be used
921 only in the presence of a prototype.
923 <tag/Availability/cc65
925 <ref id="_heapadd" name="_heapadd">,
926 <ref id="_heapmaxavail" name="_heapmaxavail">,
927 <ref id="_heapmemavail" name="_heapmemavail">,
928 <ref id="calloc" name="calloc">,
929 <ref id="free" name="free">,
930 <ref id="malloc" name="malloc">,
931 <ref id="realloc" name="realloc">
937 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
941 <tag/Function/Return the largest block that is available on the heap.
942 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
943 <tag/Declaration/<tt/size_t _heapmaxavail (void);/
944 <tag/Description/The function returns the size of the largest block that may
945 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
946 <tag/Availability/cc65
948 <ref id="_heapadd" name="_heapadd">,
949 <ref id="_heapblocksize" name="_heapblocksize">,
950 <ref id="_heapmemavail" name="_heapmemavail">,
951 <ref id="calloc" name="calloc">,
952 <ref id="free" name="free">,
953 <ref id="malloc" name="malloc">,
954 <ref id="realloc" name="realloc">
960 <sect1>_heapmemavail<label id="_heapmemavail"><p>
964 <tag/Function/Return the total available space on the heap.
965 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
966 <tag/Declaration/<tt/size_t _heapmemavail (void);/
967 <tag/Description/The function returns the total number of bytes available on
970 <item>This function is of less use than usually assumed, since the returned
971 heap space may be available but not in one block. So even if this function
972 says that several times more heap space is available than needed, <ref
973 id="malloc" name="malloc"> may still return <tt/NULL/.
975 <tag/Availability/cc65
977 <ref id="_heapadd" name="_heapadd">,
978 <ref id="_heapblocksize" name="_heapblocksize">,
979 <ref id="_heapmaxavail" name="_heapmaxavail">,
980 <ref id="calloc" name="calloc">,
981 <ref id="free" name="free">,
982 <ref id="malloc" name="malloc">,
983 <ref id="realloc" name="realloc">
989 <sect1>_is_cmdline_dos<label id="_is_cmdline_dos"><p>
993 <tag/Function/Determines whether the underlying DOS supports command line arguments.
994 <tag/Header/<tt/<ref id="atari.h" name="atari.h">/
995 <tag/Declaration/<tt/unsigned char _is_cmdline_dos (void);/
996 <tag/Description/The function returns 0 if the DOS doesn't support command line arguments.
997 It returns 1 if it does.
998 <tag/Availability/cc65 (<tt/atari/ and <tt/atarixl/ platforms)
1003 <sect1>_poserror<label id="_poserror"><p>
1007 <tag/Function/Print an error message for the error in <tt/_oserror/.
1008 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1009 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
1010 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
1011 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
1012 a colon and a blank. Then the error message for the current contents of
1013 <tt/_oserror/ are printed followed by a newline. The message output is the
1014 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
1015 argument of <tt/_oserror/.
1016 <tag/Notes/<itemize>
1017 <item>Since operating system specific error code are - you guessed it -
1018 operating system specific, the value in <tt/_oserror/ and the message that is
1019 printed depends on the cc65 target.
1020 <item>The function is only available as fastcall function, so it may only
1021 be used in presence of a prototype.
1023 <tag/Availability/cc65
1025 <ref id="_stroserror" name="_stroserror">,
1026 <ref id="perror" name="perror">
1032 <sect1>_randomize<label id="_randomize"><p>
1036 <tag/Function/Initialize the pseudo random number generator.
1037 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1038 <tag/Declaration/<tt/void _randomize (void);/
1039 <tag/Description/The function initializes the random number generator with
1040 a seed derived from fast changing hardware events, so the seed itself can be
1041 considered random to a certain degree.
1042 <tag/Notes/<itemize>
1043 <item>The randomness of the seed depends on the machine hardware.
1045 <tag/Availability/cc65
1047 <ref id="rand" name="rand">,
1048 <ref id="srand" name="srand">
1054 <sect1>_stroserror<label id="_stroserror"><p>
1058 <tag/Function/Return a string describing an OS specific error code.
1059 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1060 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
1061 <tag/Description/<tt/_stroserror/ will return a string describing the given
1062 operating system specific error code.
1063 <tag/Notes/<itemize>
1064 <item>Since operating system specific error code are - you guessed it -
1065 operating system specific, the parameter and the string returned depend on the
1067 <item>The function is only available as fastcall function, so it may only be
1068 used in presence of a prototype.
1070 <tag/Availability/cc65
1072 <ref id="strerror" name="strerror">
1078 <sect1>_swap<label id="_swap"><p>
1082 <tag/Function/Swap the contents of memory areas.
1083 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1084 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
1085 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
1086 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
1087 <tt/size/ bytes in size.
1088 <tag/Notes/<itemize>
1089 <item>The memory areas may not overlap, otherwise the results are undefined.
1090 <item>The function is only available as fastcall function, so it may only be
1091 used in presence of a prototype.
1093 <tag/Availability/cc65
1095 <ref id="memcpy" name="memcpy">,
1096 <ref id="memmove" name="memmove">
1102 <sect1>_sys<label id="_sys"><p>
1106 <tag/Function/Call a subroutine passing register values.
1107 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1108 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
1109 <tag/Description/The function will call the subroutine at the address
1110 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
1111 registers and the CPU flags are set to the values given in the <tt/regs/
1112 structure. On return from the subroutine, the new values of the registers and
1113 flags are stored back overwriting the old values.
1114 <tag/Notes/<itemize>
1115 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
1116 when calling the subroutine (they are unchanged from their current values).
1117 <item>The function is only available as fastcall function, so it may only be
1118 used in presence of a prototype.
1120 <tag/Availability/cc65
1126 <sect1>BRK<label id="BRK"><p>
1130 <tag/Function/Insert a 6502 BRK instrunction into the code.
1131 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1132 <tag/Declaration/<tt/void BRK (void);/
1133 <tag/Description/The function will insert a 6502 BRK instruction into the code
1134 which may be used to trigger a debugger.
1135 <tag/Notes/<itemize>
1136 <item>The function is actually a macro.
1137 <item>The inserted instruction may lead to unexpected results if no debugger
1140 <tag/Availability/cc65
1142 <ref id="CLI" name="CLI">,
1143 <ref id="SEI" name="SEI">
1149 <sect1>CLI<label id="CLI"><p>
1153 <tag/Function/Insert a 6502 CLI instrunction into the code.
1154 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1155 <tag/Declaration/<tt/void CLI (void);/
1156 <tag/Description/The function will insert a 6502 CLI instruction into the code,
1157 so interrupts are enabled. Enabling interrupts has no effects if they are
1158 already enabled (the default).
1159 <tag/Notes/<itemize>
1160 <item>The function is actually a macro.
1161 <item>Disabling interrupts may lead to unexpected results.
1163 <tag/Availability/cc65
1165 <ref id="BRK" name="BRK">,
1166 <ref id="SEI" name="SEI">
1172 <sect1>PEEK<label id="PEEK"><p>
1176 <tag/Function/Read a byte from memory.
1177 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1178 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
1179 <tag/Description/The function will read the absolute memory given by <tt/addr/
1180 and return the value read.
1181 <tag/Notes/<itemize>
1182 <item>The function is actually a macro.
1183 <item>This function depends highly on the platform and environment.
1185 <tag/Availability/cc65
1187 <ref id="PEEKW" name="PEEKW">,
1188 <ref id="POKE" name="POKE">
1194 <sect1>PEEKW<label id="PEEKW"><p>
1198 <tag/Function/Read a word (two bytes) from memory.
1199 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1200 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
1201 <tag/Description/The function will read the absolute memory given by <tt/addr/
1202 and return the value read. The byte read from the higher address is the high
1203 byte of the return value.
1204 <tag/Notes/<itemize>
1205 <item>The function is actually a macro.
1206 <item>This function depends highly on the platform and environment.
1207 <item>The order in which the two bytes are read is unspecified and may
1208 depend of the address expression used.
1210 <tag/Availability/cc65
1212 <ref id="PEEK" name="PEEK">,
1213 <ref id="POKE" name="POKE">
1219 <sect1>POKE<label id="POKE"><p>
1223 <tag/Function/Write a byte to memory.
1224 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1225 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
1226 <tag/Description/The function writes the value <tt/val/ to the absolute
1227 memory address given by <tt/addr/.
1228 <tag/Notes/<itemize>
1229 <item>The function is actually a macro.
1230 <item>This function depends highly on the platform and environment.
1231 <item>Careless use will cause the program to act strange or may crash the
1234 <tag/Availability/cc65
1236 <ref id="PEEK" name="PEEK">,
1237 <ref id="POKEW" name="POKEW">
1243 <sect1>POKEW<label id="POKEW"><p>
1247 <tag/Function/Write a word (two bytes) to memory.
1248 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1249 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
1250 <tag/Description/The function writes the value <tt/val/ to the absolute
1251 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
1252 the <tt/addr/, the high byte is written to <tt/addr+1/.
1253 <tag/Notes/<itemize>
1254 <item>The function is actually a macro.
1255 <item>This function depends highly on the platform and environment.
1256 <item>Careless use will cause the program to act strange or may crash the
1258 <item>The order in which the two bytes are written is unspecified and may
1259 depend of the address expression used.
1261 <tag/Availability/cc65
1263 <ref id="PEEK" name="PEEK">,
1264 <ref id="POKE" name="POKE">
1270 <sect1>SEI<label id="SEI"><p>
1274 <tag/Function/Insert a 6502 SEI instrunction into the code.
1275 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1276 <tag/Declaration/<tt/void SEI (void);/
1277 <tag/Description/The function will insert a 6502 SEI instruction into the code,
1278 so interrupts are disabled. Note that non maskable interrupts cannot be
1280 <tag/Notes/<itemize>
1281 <item>The function is actually a macro.
1282 <item>Disabling interrupts may lead to unexpected results.
1284 <tag/Availability/cc65
1286 <ref id="BRK" name="BRK">,
1287 <ref id="CLI" name="CLI">
1293 <sect1>abort<label id="abort"><p>
1297 <tag/Function/Terminates a program abnormally.
1298 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1299 <tag/Declaration/<tt/void abort (void);/
1300 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
1301 on stderr, then terminates the program with an exit code of 3.
1302 <tag/Availability/ISO 9899
1304 <ref id="assert" name="assert">,
1305 <ref id="exit" name="exit">,
1306 <ref id="raise" name="raise">
1312 <sect1>abs<label id="abs"><p>
1316 <tag/Function/Returns the absolute value of an integer.
1317 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1318 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
1319 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
1321 <tag/Notes/<itemize>
1322 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
1323 <item>The function is only available as fastcall function, so it may only be
1324 used in presence of a prototype.
1326 <tag/Availability/ISO 9899
1328 <ref id="labs" name="labs">
1334 <sect1>assert<label id="assert"><p>
1338 <tag/Function/Test a condition and possibly abort.
1339 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
1340 <tag/Declaration/<tt/void assert (int cond);/
1341 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
1342 statement. If the condition evaluates t zero (false), assert prints a message
1343 on stderr and aborts the program.
1344 <tag/Notes/<itemize>
1345 <item>The function is actually a macro.
1347 <tag/Availability/ISO 9899
1349 <ref id="abort" name="abort">,
1350 <ref id="exit" name="exit">
1356 <sect1>atexit<label id="atexit"><p>
1360 <tag/Function/Register an exit function.
1361 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1362 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1363 <tag/Description/<tt/atexit/ registers the function pointed to by
1364 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1365 terminates, they are called in LIFO order (the last function registered is
1366 called first). <tt/atexit/ returns zero on success and a nonzero value on
1368 <tag/Notes/<itemize>
1369 <item>A maximum of 5 exit functions can be registered.
1370 <item>There is no way to unregister an exit function.
1371 <item>The function is only available as fastcall function, so it may only be
1372 used in presence of a prototype.
1374 <tag/Availability/ISO 9899
1376 <ref id="abort" name="abort">,
1377 <ref id="exit" name="exit">
1383 <sect1>atmos_explode<label id="atmos_explode"><p>
1387 <tag/Function/Bomb sound effect.
1388 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1389 <tag/Declaration/<tt/void __fastcall__ atmos_explode(void);/
1390 <tag/Description/<tt/atmos_explode/ plays the BASIC sound.
1391 <tag/Notes/<itemize>
1392 <item>The function is available only as a fastcall function; so, it may be used
1393 only in the presence of a prototype.
1395 <tag/Availability/cc65
1397 <ref id="atmos_ping" name="atmos_ping">,
1398 <ref id="atmos_shoot" name="atmos_shoot">,
1399 <ref id="atmos_tick" name="atmos_tick">,
1400 <ref id="atmos_tock" name="atmos_tock">,
1401 <ref id="atmos_zap" name="atmos_zap">
1407 <sect1>atmos_load<label id="atmos_load"><p>
1411 <tag/Function/Load Atmos tape.
1412 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1413 <tag/Declaration/<tt/void __fastcall__ atmos_load(const char* name);/
1414 <tag/Description/<tt/atmos_load/ reads a memory block from tape.
1415 <tag/Notes/<itemize>
1416 <item>The function is available only as a fastcall function; so, it may be used
1417 only in the presence of a prototype.
1419 <tag/Availability/cc65
1421 <ref id="atmos_save" name="atmos_save">
1427 <sect1>atmos_ping<label id="atmos_ping"><p>
1431 <tag/Function/Bell or ricochet sound effect.
1432 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1433 <tag/Declaration/<tt/void __fastcall__ atmos_ping(void);/
1434 <tag/Description/<tt/atmos_ping/ plays the BASIC sound.
1435 <tag/Notes/<itemize>
1436 <item>The function is available only as a fastcall function; so, it may be used
1437 only in the presence of a prototype.
1439 <tag/Availability/cc65
1441 <ref id="atmos_explode" name="atmos_explode">,
1442 <ref id="atmos_shoot" name="atmos_shoot">,
1443 <ref id="atmos_tick" name="atmos_tick">,
1444 <ref id="atmos_tock" name="atmos_tock">,
1445 <ref id="atmos_zap" name="atmos_zap">
1451 <sect1>atmos_save<label id="atmos_save"><p>
1455 <tag/Function/Save Atmos tape.
1456 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1457 <tag/Declaration/<tt/void __fastcall__ atmos_save(const char* name, const void* start, const void* end);/
1458 <tag/Description/<tt/atmos_save/ writes a memory block to tape.
1459 <tag/Notes/<itemize>
1460 <item>The function is available only as a fastcall function; so, it may be used
1461 only in the presence of a prototype.
1463 <tag/Availability/cc65
1465 <ref id="atmos_load" name="atmos_load">
1467 atmos_save("hires", 0xa000, 0xc000);
1473 <sect1>atmos_shoot<label id="atmos_shoot"><p>
1477 <tag/Function/Pistol sound effect.
1478 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1479 <tag/Declaration/<tt/void __fastcall__ atmos_shoot(void);/
1480 <tag/Description/<tt/atmos_shoot/ plays the BASIC sound.
1481 <tag/Notes/<itemize>
1482 <item>The function is available only as a fastcall function; so, it may be used
1483 only in the presence of a prototype.
1485 <tag/Availability/cc65
1487 <ref id="atmos_explode" name="atmos_explode">,
1488 <ref id="atmos_ping" name="atmos_ping">,
1489 <ref id="atmos_tick" name="atmos_tick">,
1490 <ref id="atmos_tock" name="atmos_tock">,
1491 <ref id="atmos_zap" name="atmos_zap">
1497 <sect1>atmos_tick<label id="atmos_tick"><p>
1501 <tag/Function/High-pitch click.
1502 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1503 <tag/Declaration/<tt/void __fastcall__ atmos_tick(void);/
1504 <tag/Description/<tt/atmos_tick/ plays the system sound.
1505 <tag/Notes/<itemize>
1506 <item>The function is available only as a fastcall function; so, it may be used
1507 only in the presence of a prototype.
1509 <tag/Availability/cc65
1511 <ref id="atmos_explode" name="atmos_explode">,
1512 <ref id="atmos_ping" name="atmos_ping">,
1513 <ref id="atmos_shoot" name="atmos_shoot">,
1514 <ref id="atmos_tock" name="atmos_tock">,
1515 <ref id="atmos_zap" name="atmos_zap">
1521 <sect1>atmos_tock<label id="atmos_tock"><p>
1525 <tag/Function/Low-pitch click.
1526 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1527 <tag/Declaration/<tt/void __fastcall__ atmos_tock(void);/
1528 <tag/Description/<tt/atmos_tock/ plays the system sound.
1529 <tag/Notes/<itemize>
1530 <item>The function is available only as a fastcall function; so, it may be used
1531 only in the presence of a prototype.
1533 <tag/Availability/cc65
1535 <ref id="atmos_explode" name="atmos_explode">,
1536 <ref id="atmos_ping" name="atmos_ping">,
1537 <ref id="atmos_shoot" name="atmos_shoot">,
1538 <ref id="atmos_tick" name="atmos_tick">,
1539 <ref id="atmos_zap" name="atmos_zap">
1545 <sect1>atmos_zap<label id="atmos_zap"><p>
1549 <tag/Function/Raygun sound effect.
1550 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1551 <tag/Declaration/<tt/void __fastcall__ atmos_zap(void);/
1552 <tag/Description/<tt/atmos_zap/ plays the BASIC sound.
1553 <tag/Notes/<itemize>
1554 <item>The function is available only as a fastcall function; so, it may be used
1555 only in the presence of a prototype.
1557 <tag/Availability/cc65
1559 <ref id="atmos_explode" name="atmos_explode">,
1560 <ref id="atmos_ping" name="atmos_ping">,
1561 <ref id="atmos_shoot" name="atmos_shoot">,
1562 <ref id="atmos_tick" name="atmos_tick">,
1563 <ref id="atmos_tock" name="atmos_tock">
1569 <sect1>atoi<label id="atoi"><p>
1573 <tag/Function/Convert a string to an integer.
1574 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1575 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1576 <tag/Description/<tt/atoi/ converts the given string into an integer.
1577 Conversion stops as soon as any invalid character is encountered.
1578 <tag/Notes/<itemize>
1579 <item>There is no way to detect any conversion errors.
1580 <item>The function does not check for an numerical overflow when converting.
1581 <item>The function is only available as fastcall function, so it may only be
1582 used in presence of a prototype.
1584 <tag/Availability/ISO 9899
1586 <ref id="atol" name="atol">,
1587 <ref id="itoa" name="itoa">,
1588 <ref id="ltoa" name="ltoa">,
1589 <ref id="ultoa" name="ultoa">,
1590 <ref id="utoa" name="utoa">
1596 <sect1>atol<label id="atol"><p>
1600 <tag/Function/Convert a string to a long integer.
1601 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1602 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1603 <tag/Description/<tt/atol/ converts the given string into a long integer.
1604 Conversion stops as soon as any invalid character is encountered.
1605 <tag/Notes/<itemize>
1606 <item>There is no way to detect any conversion errors.
1607 <item>The function does not check for an numerical overflow when converting.
1608 <item>The function is only available as fastcall function, so it may only be
1609 used in presence of a prototype.
1611 <tag/Availability/ISO 9899
1613 <ref id="atoi" name="atoi">,
1614 <ref id="itoa" name="itoa">,
1615 <ref id="ltoa" name="ltoa">,
1616 <ref id="ultoa" name="ultoa">,
1617 <ref id="utoa" name="utoa">
1623 <sect1>bgcolor<label id="bgcolor"><p>
1627 <tag/Function/Set the background text color.
1628 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1629 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1630 <tag/Description/The function will set a new background color and return the
1631 old (current) one. The background color is valid for the whole text output
1632 area of the screen, not just for new text.
1633 <tag/Notes/<itemize>
1634 <item>Background colors are system dependent. The function may have no effect
1635 on systems where the background color cannot be changed.
1636 <item>The function is only available as fastcall function, so it may only be
1637 used in presence of a prototype.
1639 <tag/Availability/cc65
1641 <ref id="bordercolor" name="bordercolor">,
1642 <ref id="textcolor" name="textcolor">
1648 <sect1>bordercolor<label id="bordercolor"><p>
1652 <tag/Function/Set the border (frame) color.
1653 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1654 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1655 <tag/Description/The function will set a new border color. It returns the old
1656 (current) border color.
1657 <tag/Notes/<itemize>
1658 <item>Border colors are system dependent. The function may have no effect
1659 on systems where the border color cannot be changed.
1660 <item>The function is only available as fastcall function, so it may only
1661 be used in presence of a prototype.
1663 <tag/Availability/cc65
1665 <ref id="bgcolor" name="bgcolor">,
1666 <ref id="textcolor" name="textcolor">
1672 <sect1>bsearch<label id="bsearch"><p>
1676 <tag/Function/Do a binary search in a sorted array.
1677 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1678 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1679 const void* base, size_t n, size_t size,
1680 int __fastcall__ (* cmp) (const void*, const void*));/
1681 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1682 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1683 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1684 the function used to compare the members against the key. The function returns
1685 a pointer to the member found, or <tt/NULL/ if there was no match.
1686 <tag/Notes/<itemize>
1687 <item>The contents of the array must be sorted in ascending order according to
1688 the compare function given.
1689 <item>If there are multiple members that match the key, the function will
1690 return one of the members.
1691 <item>The function is only available as fastcall function, so it may only
1692 be used in presence of a prototype.
1693 <item>The function to which <tt/cmp/ points must have the <tt/fastcall/ calling
1696 <tag/Availability/ISO 9899
1698 <ref id="qsort" name="qsort">
1704 <sect1>bzero<label id="bzero"><p>
1708 <tag/Function/Fill a memory area with zeroes.
1709 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1710 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1711 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1713 <tag/Notes/<itemize>
1714 <item>The function is non standard and therefore only available in non ANSI
1715 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1716 <item>The function is only available as fastcall function, so it may only
1717 be used in presence of a prototype.
1719 <tag/Availability/cc65
1721 <ref id="_swap" name="_swap">,
1722 <ref id="memcpy" name="memcpy">,
1723 <ref id="memmove" name="memmove">,
1724 <ref id="memset" name="memset">,
1730 <sect1>c64mode<label id="c64mode"><p>
1734 <tag/Function/Switch the C128 into C64 compatible mode.
1735 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1736 <tag/Declaration/<tt/void c64mode (void);/
1737 <tag/Description/The function will cause the machine to reboot into C64 mode.
1738 <tag/Notes/<itemize>
1739 <item>The function is specific to the C128.
1740 <item>The function will not return to the caller.
1742 <tag/Availability/C128
1748 <sect1>calloc<label id="calloc"><p>
1752 <tag/Function/Allocate and clear memory.
1753 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1754 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1755 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1756 of size <tt/size/, clears the whole block with binary zeroes and returns a
1757 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1759 <tag/Notes/<itemize>
1760 <item>Clearing the memory may not have the expected effect on all platforms:
1761 pointers in the block may not be <tt/NULL/ and floating point variables may
1762 not be zero (0.0). In other words: The "clearing" effect of this function
1763 should be used with care for portable programs.
1764 <item>The function is only available as fastcall function, so it may only
1765 be used in presence of a prototype.
1767 <tag/Availability/ISO 9899
1769 <ref id="_heapadd" name="_heapadd">,
1770 <ref id="_heapblocksize" name="_heapblocksize">,
1771 <ref id="_heapmaxavail" name="_heapmaxavail">,
1772 <ref id="_heapmemavail" name="_heapmemavail">,
1773 <ref id="free" name="free">,
1774 <ref id="malloc" name="malloc">,
1775 <ref id="realloc" name="realloc">
1781 <sect1>cbm_k_acptr<label id="cbm_k_acptr"><p>
1785 <tag/Function/Input byte from serial bus
1786 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1787 <tag/Declaration/<tt/unsigned char cbm_k_acptr (void);/
1788 <tag/Description/The function returns a byte of data, which it
1789 gets from the current TALKer on the serial bus.
1790 In order to receive the data, the device must have previously been
1791 sent a command to TALK and a secondary address if it needs one.
1792 <tag/Notes/<itemize>
1795 <tag/Availability/cc65
1797 <ref id="cbm_k_talk" name="cbm_k_talk">,
1803 <sect1>cbm_k_basin<label id="cbm_k_basin"><p>
1807 <tag/Function/Input a Character from the Current Device
1808 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1809 <tag/Declaration/<tt/unsigned char cbm_k_basin (void);/
1810 <tag/Description/The function returns a character from the current input device.
1811 Device must first have been OPENed and then designated as the input channel by the CHKIN routine.
1812 When this function is called, the next byte of data available from the device is returned.
1813 Exception is the routine for the keyboard device (which is the default input device).
1814 <tag/Notes/<itemize>
1817 <tag/Availability/cc65
1819 <ref id="cbm_k_open" name="cbm_k_open">,
1820 <ref id="cbm_k_chkin" name="cbm_k_chkin">
1826 <sect1>cbm_k_bsout<label id="cbm_k_bsout"><p>
1830 <tag/Function/Output a byte
1831 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1832 <tag/Declaration/<tt/void __fastcall__ cbm_k_bsout (unsigned char C);/
1833 <tag/Description/Function sends the character to the current output device.
1834 Unless a device has been OPENed and designated as the
1835 current output channel using the CHKOUT routine, the character is
1836 printed to the screen, which is the default output device. If the
1837 cassette is the current device, outputting a byte will only add it to
1838 the buffer. No actual transmission of data will occur until the
1839 192-byte buffer is full.
1840 <tag/Notes/<itemize>
1841 <item>The function is only available as fastcall function, so it may
1842 only be used in presence of a prototype.
1844 <tag/Availability/cc65
1846 <ref id="cbm_k_open" name="cbm_k_open">,
1847 <ref id="cbm_k_chkin" name="cbm_k_chkout">
1853 <sect1>cbm_k_chkin<label id="cbm_k_chkin"><p>
1857 <tag/Function/Designate a Logical File As the Current Input Channel
1858 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1859 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_chkin (unsigned char FN);/
1860 <tag/Description/If you wish to
1861 get data from any device other than the keyboard, this function must be
1862 called after OPENing the device, before you can get a data byte with
1863 the cbm_k_basin or cbm_k_getin routine. When called, the routine will designate
1864 the logical file whose file number was supplied as the
1865 current file, its device as the current device, and its secondary
1866 address as the current secondary address. If the device on the
1867 channel is a serial device, which requires a TALK command and
1868 sometimes a secondary address, function will send them over the
1870 <tag/Notes/<itemize>
1871 <item>The function is only available as fastcall function, so it may
1872 only be used in presence of a prototype.
1874 <tag/Availability/cc65
1876 <ref id="cbm_k_open" name="cbm_k_open">,
1877 <ref id="cbm_k_basin" name="cbm_k_basin">,
1878 <ref id="cbm_k_getin" name="cbm_k_getin">
1884 <sect1>cbm_k_ciout<label id="cbm_k_ciout"><p>
1888 <tag/Function/Transmit a byte over the serial bus
1889 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1890 <tag/Declaration/<tt/void __fastcall__ cbm_k_ciout (unsigned char C);/
1891 <tag/Description/Purpose of this function is to send a byte of data over
1892 the serial bus. In order for the data to be received, the serial
1893 device must have first been commanded to LISTEN and been given a
1894 secondary address if necessary. This routine always buffers the
1895 current character, and defers sending it until the next byte is
1896 buffered. When the UNLISTEN command is sent, the last byte will be
1897 sent with an End or Identify (EOI).
1898 <tag/Notes/<itemize>
1899 <item>The function is only available as fastcall function, so it may
1900 only be used in presence of a prototype.
1902 <tag/Availability/cc65
1904 <ref id="cbm_k_listen" name="cbm_k_listen">,
1905 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">
1911 <sect1>cbm_k_ckout<label id="cbm_k_ckout"><p>
1915 <tag/Function/Designate a Logical File As the Current Output Channel
1916 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1917 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_ckout (unsigned char FN);/
1918 <tag/Description/If you wish to
1919 output data to any device other than the screen, this routine must be
1920 called after OPENing the device, and before you output a data byte
1921 with the cbm_k_bsout() function. When called, the function will designate the
1922 logical file whose file number was supplied as the current
1923 file, its device as the current device, and its secondary address as
1924 the current secondary address. If the device on the channel uses the
1925 serial bus, and therefore requires a LISTEN command and possibly a
1926 secondary address, this information will be sent on the bus.
1927 <tag/Notes/<itemize>
1928 <item>The function is only available as fastcall function, so it may
1929 only be used in presence of a prototype.
1931 <tag/Availability/cc65
1933 <ref id="cbm_k_bsout" name="cbm_k_bsout">,
1934 <ref id="cbm_k_listen" name="cbm_k_listen">
1940 <sect1>cbm_k_clall<label id="cbm_k_clall"><p>
1944 <tag/Function/Close All Logical I/O Files
1945 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1946 <tag/Declaration/<tt/void cbm_k_clall (void);/
1947 <tag/Description/It closes all
1948 open files, by resetting the index into open files to
1949 zero and restores the default I/O devices.
1950 <tag/Notes/<itemize>
1953 <tag/Availability/cc65
1955 <ref id="cbm_k_open" name="cbm_k_open">,
1956 <ref id="cbm_k_close" name="cbm_k_close">
1962 <sect1>cbm_k_close<label id="cbm_k_close"><p>
1966 <tag/Function/Close a Logical I/O File
1967 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1968 <tag/Declaration/<tt/void __fastcall__ cbm_k_close (unsigned char FN);/
1969 <tag/Description/It is used to
1970 close a logical file after all I/O operations involving that file have
1972 <tag/Notes/<itemize>
1973 <item>The function is only available as fastcall function, so it may
1974 only be used in presence of a prototype.
1976 <tag/Availability/cc65
1978 <ref id="cbm_k_open" name="cbm_k_open">,
1979 <ref id="cbm_k_clall" name="cbm_k_clall">
1985 <sect1>cbm_k_clrch<label id="cbm_k_clrch"><p>
1989 <tag/Function/Restore Current Input and Output Devices to the Default Devices
1990 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1991 <tag/Declaration/<tt/void cbm_k_clrch (void);/
1992 <tag/Description/It sets the
1993 current input device to the keyboard, and the current output device to
1994 the screen. Also, if the current input device was formerly a serial
1995 device, the routine sends it an UNTALK command on the serial bus, and
1996 if a serial device was formerly the current output device, the routine
1997 sends it an UNLISTEN command.
1998 <tag/Notes/<itemize>
2001 <tag/Availability/cc65
2003 <ref id="cbm_k_chkin" name="cbm_k_chkin">,
2004 <ref id="cbm_k_ckout" name="cbm_k_ckout">
2010 <sect1>cbm_k_getin<label id="cbm_k_getin"><p>
2014 <tag/Function/Get One Byte from the Input Device
2015 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2016 <tag/Declaration/<tt/unsigned char cbm_k_getin (void);/
2017 <tag/Description/Function gets a character from the current input device.
2018 <tag/Notes/<itemize>
2021 <tag/Availability/cc65
2023 <ref id="cbm_k_basin" name="cbm_k_basin">
2029 <sect1>cbm_k_iobase<label id="cbm_k_iobase"><p>
2033 <tag/Function/Return Base Address of Memory-Mapped I/O Devices
2034 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2035 <tag/Declaration/<tt/unsigned cbm_k_iobase (void);/
2036 <tag/Description/This function returns the address of
2037 the memory section where the memory mapped I/O devices are located. This
2038 address can then be used with an offset to access the memory mapped I/O
2039 devices in the Commodore 64. The offset is the number of locations from
2040 the beginning of the page on which the I/O register you want is located.
2041 This function exists to provide compatibility between the Commodore 64,
2042 VIC-20, and future models of the Commodore 64. If the I/O locations for
2043 a program are set by a call to this function, they should
2044 still remain compatible with future versions of the Commodore 64, the
2046 <tag/Notes/<itemize>
2049 <tag/Availability/cc65
2057 <sect1>cbm_k_listen<label id="cbm_k_listen"><p>
2061 <tag/Function/Command a device on the serial bus to LISTEN
2062 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2063 <tag/Declaration/<tt/void __fastcall__ cbm_k_listen (unsigned char dev);/
2064 <tag/Description/This function will command a device on the serial bus to
2065 receive data. The KERNAL routine will OR the supplied device number bit by bit
2066 to convert it to a listen address, then transmits this data as a command on
2067 the serial bus. The specified device will then go into listen mode, and
2068 be ready to accept information.
2069 <tag/Notes/<itemize>
2070 <item>The function is only available as fastcall function, so it may
2071 only be used in presence of a prototype.
2073 <tag/Availability/cc65
2075 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">,
2081 <sect1>cbm_k_load<label id="cbm_k_load"><p>
2085 <tag/Function/Load RAM from a Device
2086 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2087 <tag/Declaration/<tt/unsigned int __fastcall__ cbm_k_load(unsigned char flag, unsigned addr);/
2088 <tag/Description/This function LOADs data bytes from any input device directly into the memory.
2089 It can also be used for a verify operation, comparing data from a device with the data already in
2090 memory, while leaving the data stored in RAM unchanged.
2091 The flag must be set to 0 for a LOAD operation, or 1 for a
2092 verify, If the input device is OPENed with a secondary address (SA) of 0
2093 the header information from the device is ignored. In this case, the starting address for the load must be supplied.
2094 If the device is addressed with a secondary address of 1, then the data is
2095 loaded into memory starting at the location specified by the header.
2096 Function returns the address of the highest RAM location loaded.
2097 Before this function can be called, the KERNAL SETLFS, and SETNAM
2098 routines must be called.
2099 <tag/Notes/<itemize>
2100 <item>The function is only available as fastcall function, so it may
2101 only be used in presence of a prototype.
2103 <tag/Availability/cc65
2105 <ref id="cbm_k_save" name="cbm_k_save">,
2106 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2107 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2113 <sect1>cbm_k_open<label id="cbm_k_open"><p>
2117 <tag/Function/Open a Logical I/O File
2118 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2119 <tag/Declaration/<tt/unsigned char cbm_k_open (void);/
2120 <tag/Description/This function assigns a logical file to a device, so that it can be used for
2121 Input/Output operations. In order to specify the logical file number,
2122 the device number, and the secondary address if any, the cbm_k_setlfs() function must first be called.
2123 Likewise, in order to designate the filename, the cbm_k_setnam() function must be used first. After these two
2124 functions are called, cbm_k_open() is then called.
2125 <tag/Notes/<itemize>
2128 <tag/Availability/cc65
2130 <ref id="cbm_k_close" name="cbm_k_close">,
2131 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2132 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2138 <sect1>cbm_k_readst<label id="cbm_k_readst"><p>
2142 <tag/Function/Read status word
2143 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2144 <tag/Declaration/<tt/unsigned char cbm_k_readst (void);/
2145 <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.
2146 <tag/Notes/<itemize>
2149 <tag/Availability/cc65
2157 <sect1>cbm_k_save<label id="cbm_k_save"><p>
2161 <tag/Function/Save RAM to a Device
2162 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2163 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_save(unsigned int start, unsigned int end)/
2164 <tag/Description/This function saves a section of memory. The cbm_k_setlfs() and cbm_k_setnam() functions must be
2165 used before calling this function. However, a file name is not required to
2166 SAVE to device 1 (the Datassette(TM) recorder). Any attempt to save to
2167 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.
2168 <tag/Notes/<itemize>
2169 <item>The function is only available as fastcall function, so it may
2170 only be used in presence of a prototype.
2172 <tag/Availability/cc65
2174 <ref id="cbm_k_load" name="cbm_k_load">,
2175 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2176 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2182 <sect1>cbm_k_scnkey<label id="cbm_k_scnkey"><p>
2186 <tag/Function/Scan the keyboard matrix.
2187 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2188 <tag/Declaration/<tt/void cbm_k_scnkey (void);/
2189 <tag/Description/This function looks at the switches in the keyboard, to see
2190 if any of them are being pressed. If they are, then code numbers for them are
2191 stored in RAM. Other functions use those numbers to input text. Normally,
2192 the keyboard is scanned by the Kernal's Interrupt Service Routine. But, if
2193 you divert the "Jiffy interrupt" to a C-code ISR, then that ISR must call this
2194 function, in order to provide input from the keyboard.
2195 <tag/Availability/cc65
2197 <ref id="cbm_k_getin" name="cbm_k_getin">,
2198 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2199 <ref id="cgetc" name="cgetc">,
2200 <!-- <ref id="getc" name="getc"> -->
2201 <!-- <ref id="getchar" name="getchar"> -->
2207 <sect1>cbm_k_setlfs<label id="cbm_k_setlfs"><p>
2211 <tag/Function/Set up a logical file
2212 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2213 <tag/Declaration/<tt/void __fastcall__ cbm_k_setlfs (unsigned char LFN, unsigned char DEV, unsigned char SA);/
2214 <tag/Description/This functions sets up the logical file by setting its number, device address,
2215 and secondary address.
2216 <tag/Notes/<itemize>
2217 <item>The function is only available as fastcall function, so it may
2218 only be used in presence of a prototype.
2220 <tag/Availability/cc65
2222 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2228 <sect1>cbm_k_setnam<label id="cbm_k_setnam"><p>
2232 <tag/Function/Set Filename Parameters
2233 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2234 <tag/Declaration/<tt/void __fastcall__ cbm_k_setnam (const char* Name);/
2235 <tag/Description/This function is used to set up the file name for the OPEN,
2236 SAVE, or LOAD operations.
2237 <tag/Notes/<itemize>
2238 <item>The function is only available as fastcall function, so it may
2239 only be used in presence of a prototype.
2241 <tag/Availability/cc65
2243 <ref id="cbm_k_open" name="cbm_k_open">,
2244 <ref id="cbm_k_load" name="cbm_k_load">,
2245 <ref id="cbm_k_save" name="cbm_k_save">
2251 <sect1>cbm_k_talk<label id="cbm_k_talk"><p>
2255 <tag/Function/Commands device to TALK
2256 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2257 <tag/Declaration/<tt/void __fastcall__ cbm_k_talk (unsigned char dev);/
2258 <tag/Description/When called, it ORs the device number with the TALK code (64, $40) and sends it on the serial
2259 bus. This commands the device to TALK.
2260 <tag/Notes/<itemize>
2261 <item>The function is only available as fastcall function, so it may
2262 only be used in presence of a prototype.
2264 <tag/Availability/cc65
2266 <ref id="cbm_k_acptr" name="cbm_k_acptr">
2272 <sect1>cbm_k_udtim<label id="cbm_k_udtim"><p>
2276 <tag/Function/Update the Jiffy clock.
2277 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2278 <tag/Declaration/<tt/void cbm_k_udtim (void);/
2279 <tag/Description/This function adds one count to the Jiffy clock. That clock
2280 counts sixtieths of a second. It is used by the library's <tt/clock()/
2281 function. Normally, the Jiffy clock is updated by the Kernal's Interrupt
2282 Service Routine. But, if you divert the "Jiffy interrupt" to a C-code ISR,
2283 then that ISR must call this function, in order to keep the clock valid.
2284 <tag/Availability/cc65
2286 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2287 <ref id="clock" name="clock">
2293 <sect1>cbm_k_unlsn<label id="cbm_k_unlsn"><p>
2297 <tag/Function/Send an UNLISTEN command
2298 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2299 <tag/Declaration/<tt/void cbm_k_unlsn (void);/
2300 <tag/Description/This function commands all devices on the serial bus to
2301 stop receiving data from the host computer (i.e., UNLISTEN). Calling this
2302 function results in an UNLISTEN command being transmitted on the serial
2303 bus. Only devices previously commanded to LISTEN are affected. This
2304 function is normally used after the host computer is finished sending data
2305 to external devices. Sending the UNLISTEN commands the listening devices
2306 to get off the serial bus so it can be used for other purposes.
2307 <tag/Notes/<itemize>
2310 <tag/Availability/cc65
2312 <ref id="cbm_k_listen" name="cbm_k_listen">
2318 <sect1>cclear<label id="cclear"><p>
2322 <tag/Function/Clear part of a line (write a given number of spaces).
2323 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2324 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
2325 <tag/Description/The function clears part of a line by writing <tt/length/
2326 spaces in the current text color.
2327 <tag/Notes/<itemize>
2328 <item>The function is only available as fastcall function, so it may
2329 only be used in presence of a prototype.
2331 <tag/Availability/cc65
2333 <ref id="cclearxy" name="cclearxy">,
2334 <ref id="clrscr" name="clrscr">
2340 <sect1>cclearxy<label id="cclearxy"><p>
2344 <tag/Function/Clear part of a line (write a given number of spaces) starting
2345 at a specific screen position.
2346 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2347 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
2348 <tag/Description/The function moves the cursor to a specific position, and
2349 will then clear part of the line by writing <tt/length/ spaces in the current
2351 <tag/Notes/<itemize>
2352 <item>The function is only available as fastcall function, so it may
2353 only be used in presence of a prototype.
2355 <tag/Availability/cc65
2357 <ref id="cclear" name="cclear">,
2358 <ref id="clrscr" name="clrscr">
2364 <sect1>cgetc<label id="cgetc"><p>
2368 <tag/Function/Read a character from the keyboard.
2369 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2370 <tag/Declaration/<tt/char cgetc (void);/
2371 <tag/Description/The function reads a character from the keyboard. If there is
2372 no character available, <tt/cgetc()/ waits until the user presses a key. If the
2373 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
2374 displayed while waiting.
2375 <tag/Notes/<itemize>
2376 <item>If the system supports a keyboard buffer, <tt/cgetc()/ will fetch a key
2377 from that buffer; and, wait only if the buffer is empty.
2378 <item>The keyboard must be scanned periodically, in order for this function to
2379 see anything that you type. (See the description of <tt/cbm_k_scnkey()/.)
2381 <tag/Availability/cc65
2383 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2384 <ref id="cursor" name="cursor">,
2385 <ref id="kbhit" name="kbhit">
2391 <sect1>chline<label id="chline"><p>
2395 <tag/Function/Output a horizontal line in text mode.
2396 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2397 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
2398 <tag/Description/The function outputs a horizontal line with the given length
2399 starting at the current cursor position.
2400 <tag/Notes/<itemize>
2401 <item>The character used to draw the horizontal line is system dependent.
2402 If available, a line drawing character is used. Drawing a line that is partially
2403 off screen leads to undefined behaviour.
2404 <item>The function is only available as fastcall function, so it may only be
2405 used in presence of a prototype.
2407 <tag/Availability/cc65
2409 <ref id="chlinexy" name="chlinexy">,
2410 <ref id="cvline" name="cvline">,
2411 <ref id="cvlinexy" name="cvlinexy">
2417 <sect1>chlinexy<label id="chlinexy"><p>
2421 <tag/Function/Output a horizontal line at a given position in text mode.
2422 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2423 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
2424 <tag/Description/The function outputs a horizontal line with the given length
2425 starting at a given position.
2426 <tag/Notes/<itemize>
2427 <item>The character used to draw the horizontal line is system dependent.
2428 If available, a line drawing character is used. Drawing a line that is partially
2429 off screen leads to undefined behaviour.
2430 <item>The function is only available as fastcall function, so it may only be
2431 used in presence of a prototype.
2433 <tag/Availability/cc65
2435 <ref id="chline" name="chline">,
2436 <ref id="cvline" name="cvline">,
2437 <ref id="cvlinexy" name="cvlinexy">
2443 <sect1>clearerr<label id="clearerr"><p>
2447 <tag/Function/Clear error and end-of-file status of a stream.
2448 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2449 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
2450 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
2451 indicators for the stream <tt/f/.
2452 <tag/Notes/<itemize>
2453 <item>The function is only available as fastcall function, so it may only be
2454 used in presence of a prototype.
2456 <tag/Availability/ISO 9899
2458 <ref id="feof" name="feof">,
2459 <ref id="ferror" name="ferror">
2465 <sect1>clock<label id="clock"><p>
2469 <tag/Function/Determine the processor time used.
2470 <tag/Header/<tt/<ref id="time.h" name="time.h">/
2471 <tag/Declaration/<tt/clock_t clock (void);/
2472 <tag/Description/The <tt/clock/ function returns an approximaton of processor
2473 time used by the program. The time is returned in implementation-defined
2474 units. It can be converted to seconds by dividing by the value of the macro
2475 <tt/CLOCKS_PER_SEC/.
2476 <tag/Notes/<itemize>
2477 <item>Since the machines that cc65-generated programs run on cannot run multiple
2478 processes, the function actually will return the time since some
2479 implementation-defined point in the past.
2480 <item>The Jiffy clock must be "running", in order for this function to return
2481 changing values. (See the description of <tt/cbm_k_udtim()/.)
2483 <tag/Availability/ISO 9899
2485 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2486 <ref id="time" name="time">
2492 <sect1>clrscr<label id="clrscr"><p>
2496 <tag/Function/Clear the text screen.
2497 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2498 <tag/Declaration/<tt/void clrscr (void);/
2499 <tag/Description/The function clears the text screen and moves the cursor to
2500 the upper left corner.
2501 <tag/Availability/cc65
2503 <ref id="cclear" name="cclear">,
2504 <ref id="cclearxy" name="cclearxy">
2510 <sect1>close<label id="close"><p>
2514 <tag/Function/Close a file descriptor.
2515 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2516 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
2517 <tag/Description/The function closes the given file descriptor. It returns zero
2518 on success and -1 on error. If an error occurs, the cause can be determined by
2519 reading the <tt/errno/ variable.
2520 <tag/Notes/<itemize>
2521 <item>The function is only available as fastcall function, so it may only
2522 be used in presence of a prototype.
2524 <tag/Availability/POSIX 1003.1
2526 <ref id="creat" name="creat">,
2527 <ref id="open" name="open">
2533 <sect1>closedir<label id="closedir"><p>
2537 <tag/Function/Close a directory.
2538 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
2539 <tag/Declaration/<tt/int __fastcall__ closedir (DIR* dir);/
2540 <tag/Description/The function closes the given directory descriptor. It returns
2541 zero on success and -1 on error. If an error occurs, the cause can be determined
2542 by reading the <tt/errno/ variable.
2543 <tag/Notes/<itemize>
2544 <item>The function is only available as fastcall function, so it may only
2545 be used in presence of a prototype.
2547 <tag/Availability/POSIX 1003.1
2549 <ref id="opendir" name="opendir">,
2550 <ref id="readdir" name="readdir">
2556 <sect1>cpeekc<label id="cpeekc"><p>
2560 <tag/Function/Get a character from the display memory.
2561 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2562 <tag/Declaration/<tt/char cpeekc (void);/
2563 <tag/Description/The function gets the character that's at the current location
2564 of the cursor in the display screen RAM. That character is converted, if
2565 needed, into the encoding that can be passed to <tt/cputc()/.
2566 <tag/Notes/<itemize>
2567 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2568 done to make it obvious that peeking doesn't move the cursor in any way. Your
2569 program must place the cursor where it wants to peek before it calls any of
2572 <tag/Availability/cc65
2574 <ref id="cpeekcolor" name="cpeekcolor">,
2575 <ref id="cpeekrevers" name="cpeekrevers">,
2576 <ref id="cpeeks" name="cpeeks">,
2577 <ref id="cputc" name="cputc">
2583 <sect1>cpeekcolor<label id="cpeekcolor"><p>
2587 <tag/Function/Get a color from the display memory.
2588 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2589 <tag/Declaration/<tt/unsigned char cpeekcolor (void);/
2590 <tag/Description/The function gets the color number that's at the current
2591 location of the cursor in the display screen RAM. That number can be passed to
2593 <tag/Notes/<itemize>
2594 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2595 done to make it obvious that peeking doesn't move the cursor in any way. Your
2596 program must place the cursor where it wants to peek before it calls any of
2599 <tag/Availability/cc65
2601 <ref id="cpeekc" name="cpeekc">,
2602 <ref id="cpeekrevers" name="cpeekrevers">,
2603 <ref id="cpeeks" name="cpeeks">,
2604 <ref id="cputc" name="cputc">,
2605 <ref id="textcolor" name="textcolor">
2611 <sect1>cpeekrevers<label id="cpeekrevers"><p>
2615 <tag/Function/Get a reverse-character attribute from the display memory.
2616 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2617 <tag/Declaration/<tt/unsigned char cpeekrevers (void);/
2618 <tag/Description/The function gets the "reverse-mode" attribute of the
2619 character that's at the current location of the cursor in the display screen
2620 RAM. It returns a boolean value (0/1) that can be passed to <tt/revers()/.
2621 <tag/Notes/<itemize>
2622 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2623 done to make it obvious that peeking doesn't move the cursor in any way. Your
2624 program must place the cursor where it wants to peek before it calls any of
2627 <tag/Availability/cc65
2629 <ref id="cpeekc" name="cpeekc">,
2630 <ref id="cpeekcolor" name="cpeekcolor">,
2631 <ref id="cpeeks" name="cpeeks">,
2632 <ref id="cputc" name="cputc">,
2633 <ref id="revers" name="revers">
2639 <sect1>cpeeks<label id="cpeeks"><p>
2643 <tag/Function/Get a string from the display memory.
2644 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2645 <tag/Declaration/<tt/void __fastcall__ cpeeks (char* s, unsigned length);/
2646 <tag/Description/The function gets a fixed-length string ('\0'-terminated) of
2647 characters that start at the current location of the cursor in the display
2648 screen RAM. Those characters are converted, if needed, into the encoding that
2649 can be passed to <tt/cputs()/. The first argument must point to a RAM area
2650 that's large enough to hold "length + 1" bytes.
2651 <tag/Notes/<itemize>
2652 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2653 done to make it obvious that peeking doesn't move the cursor in any way. Your
2654 program must place the cursor where it wants to peek before it calls any of
2656 <item>The function is available as only a fastcall function;
2657 so, it may be used only in the presence of a prototype.
2659 <tag/Availability/cc65
2661 <ref id="cpeekc" name="cpeekc">,
2662 <ref id="cpeekcolor" name="cpeekcolor">,
2663 <ref id="cpeekrevers" name="cpeekrevers">,
2664 <ref id="cputc" name="cputc">,
2665 <ref id="cputs" name="cputs">
2671 <sect1>creat<label id="creat"><p>
2675 <tag/Function/Create a file.
2676 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2677 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
2678 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
2679 associated with it. On error, -1 is returned and an error code is stored in
2681 <tag/Notes/<itemize>
2682 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
2683 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
2684 <item>The function is only available as fastcall function, so it may only
2685 be used in presence of a prototype.
2687 <tag/Availability/POSIX 1003.1
2689 <ref id="close" name="close">,
2690 <ref id="open" name="open">
2696 <sect1>cprintf<label id="cprintf"><p>
2700 <tag/Function/Formatted output to the console.
2701 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2702 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
2703 <tag/Description/The arguments are converted to text where necessary and
2704 formatted according to the format string given. The resulting string is output
2705 to the console. <tt/cprintf/ supports the same format specifiers as
2706 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
2707 <tag/Notes/<itemize>
2708 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
2709 between <tt/\r/ and <tt/\n/.
2711 <tag/Availability/cc65
2713 <ref id="cputc" name="cputc">,
2714 <ref id="cputcxy" name="cputcxy">,
2715 <ref id="cputs" name="cputs">,
2716 <ref id="cputsxy" name="cputsxy">,
2717 <ref id="vcprintf" name="vcprintf">
2723 <sect1>cputc<label id="cputc"><p>
2727 <tag/Function/Output a character directly to the console.
2728 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2729 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
2730 <tag/Description/Output one character to the console at the current cursor
2732 <tag/Notes/<itemize>
2733 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
2734 between <tt/\r/ and <tt/\n/.
2735 <item>The function is only available as fastcall function, so it may only
2736 be used in presence of a prototype.
2738 <tag/Availability/cc65
2740 <ref id="cprintf" name="cprintf">,
2741 <ref id="cputcxy" name="cputcxy">,
2742 <ref id="cputs" name="cputs">,
2743 <ref id="cputsxy" name="cputsxy">,
2744 <ref id="vcprintf" name="vcprintf">
2750 <sect1>cputcxy<label id="cputcxy"><p>
2754 <tag/Function/Output a character at a specific screen position.
2755 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2756 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
2757 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
2758 the screen and outputs one character.
2759 <tag/Notes/<itemize>
2760 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
2761 between <tt/\r/ and <tt/\n/.
2762 <item>The function is only available as fastcall function, so it may only
2763 be used in presence of a prototype.
2765 <tag/Availability/cc65
2767 <ref id="cprintf" name="cprintf">,
2768 <ref id="cputc" name="cputc">,
2769 <ref id="cputs" name="cputs">,
2770 <ref id="cputsxy" name="cputsxy">,
2771 <ref id="vcprintf" name="vcprintf">
2777 <sect1>cputs<label id="cputs"><p>
2781 <tag/Function/Output a string directly to the console.
2782 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2783 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
2784 <tag/Description/The function outputs the given string on the console at the
2785 current cursor position.
2786 <tag/Notes/<itemize>
2787 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
2788 between <tt/\r/ and <tt/\n/.
2789 <item>The function is only available as fastcall function, so it may only
2790 be used in presence of a prototype.
2792 <tag/Availability/cc65
2794 <ref id="cprintf" name="cprintf">,
2795 <ref id="cputc" name="cputc">,
2796 <ref id="cputcxy" name="cputcxy">,
2797 <ref id="cputsxy" name="cputsxy">,
2798 <ref id="vcprintf" name="vcprintf">
2804 <sect1>cputsxy<label id="cputsxy"><p>
2808 <tag/Function/Output a string to the console at a given position.
2809 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2810 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
2811 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
2812 and outputs the string <tt/s/.
2813 <tag/Notes/<itemize>
2814 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
2815 between <tt/\r/ and <tt/\n/.
2816 <item>The function is only available as fastcall function, so it may only
2817 be used in presence of a prototype.
2819 <tag/Availability/cc65
2821 <ref id="cprintf" name="cprintf">,
2822 <ref id="cputc" name="cputc">,
2823 <ref id="cputcxy" name="cputcxy">,
2824 <ref id="cputs" name="cputs">,
2825 <ref id="vcprintf" name="vcprintf">
2831 <sect1>cursor<label id="cursor"><p>
2835 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
2836 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2837 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
2838 <tag/Description/If the argument to the function is non zero, a blinking cursor
2839 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
2840 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
2841 <tag/Notes/<itemize>
2842 <item>The function is only available as fastcall function, so it may only
2843 be used in presence of a prototype.
2845 <tag/Availability/cc65
2847 <ref id="cgetc" name="cgetc">,
2848 <ref id="kbhit" name="kbhit">
2854 <sect1>cvline<label id="cvline"><p>
2858 <tag/Function/Output a vertical line in text mode.
2859 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2860 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
2861 <tag/Description/The function outputs a vertical line with the given length
2862 starting at the current cursor position.
2863 <tag/Notes/<itemize>
2864 <item>The character used to draw the vertical line is system dependent.
2865 If available, a line drawing character is used. Drawing a line that is partially
2866 off screen leads to undefined behaviour.
2867 <item>The function is only available as fastcall function, so it may only be
2868 used in presence of a prototype.
2870 <tag/Availability/cc65
2872 <ref id="chline" name="chline">,
2873 <ref id="chlinexy" name="chlinexy">,
2874 <ref id="cvlinexy" name="cvlinexy">
2880 <sect1>cvlinexy<label id="cvlinexy"><p>
2884 <tag/Function/Output a vertical line at a given position in text mode.
2885 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2886 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
2887 <tag/Description/The function outputs a vertical line with the given length
2888 starting at a given position.
2889 <tag/Notes/<itemize>
2890 <item>The character used to draw the vertical line is system dependent.
2891 If available, a line drawing character is used. Drawing a line that is partially
2892 off screen leads to undefined behaviour.
2893 <item>The function is only available as fastcall function, so it may only be
2894 used in presence of a prototype.
2896 <tag/Availability/cc65
2898 <ref id="chline" name="chline">,
2899 <ref id="chlinexy" name="chlinexy">,
2900 <ref id="cvline" name="cvline">
2906 <sect1>decompress_lz4<label id="decompress_lz4"><p>
2910 <tag/Function/Uncompress a LZ4-compressed buffer.
2911 <tag/Header/<tt/<ref id="lz4.h" name="lz4.h">/
2912 <tag/Declaration/<tt/void decompress_lz4 (const unsigned char* src, unsigned char* const dst, const unsigned short uncompressed_size);/
2913 <tag/Description/<tt/decompress_lz4/ uncompresses a LZ4-compressed buffer.
2914 <tag/Notes/<itemize>
2915 <item>Use LZ4_compress_HC with compression level 16 for best compression.
2917 <tag/Availability/cc65
2923 <sect1>detect_scpu<label id="detect_scpu"><p>
2927 <tag/Function/Check for the presence of the C64/C128 SuperCPU cartridge.
2928 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
2929 <tag/Declaration/<tt/unsigned char detect_scpu (void);/
2930 <tag/Description/The function returns a 1 if a SuperCPU cartridge has been detected.
2931 <tag/Notes/<itemize>
2932 <item>The function is specific to the C128 and C64.
2934 <tag/Availability/cc65 (not all platforms)
2936 <ref id="get_scpu_speed" name="get_scpu_speed">,
2937 <ref id="set_scpu_speed" name="set_scpu_speed">,
2943 <sect1>div<label id="div"><p>
2947 <tag/Function/Divide two ints and return quotient and remainder.
2948 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2949 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
2950 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
2951 quotient and remainder in a <tt/div_t/ structure.
2952 <tag/Notes/<itemize>
2953 <item>The function is only available as fastcall function, so it may only
2954 be used in presence of a prototype.
2956 <tag/Availability/ISO 9899
2964 <sect1>doesclrscrafterexit<label id="doesclrscrafterexit"><p>
2968 <tag/Function/Determines whether the screen is going to be cleared after program exit.
2969 <tag/Header/<tt/<ref id="cc65.h" name="cc65.h">/
2970 <tag/Declaration/<tt/unsigned char doesclrscrafterexit (void);/
2971 <tag/Description/The function returns zero if the screen won't be cleared immediately after
2972 program termination. It returns a non-zero value if it will.
2973 <tag/Notes/<itemize>
2974 <item>Some systems, maybe depending on configuration, immediately clear the screen
2975 after a program exits. Therefore it might be difficult to read
2976 the last messages printed by the program prior to its exit. This function can be used
2977 to decide if a delay or wait for a key press should be executed when then program
2980 <tag/Availability/cc65
2983 #include <stdio.h>
2984 #include <unistd.h>
2985 #include <cc65.h>
2988 printf("Hello World\n");
2989 if (doesclrscrafterexit())
2998 <sect1>em_commit<label id="em_commit"><p>
3002 <tag/Function/Commit changes into extended memory.
3003 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3004 <tag/Declaration/<tt/void em_commit (void);/
3005 <tag/Description/Commit changes in the memory window to extended storage. If
3006 the contents of the memory window have been changed, these changes may be lost
3007 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
3008 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
3009 name="em_copyto">/ are called without calling <tt/em_commit/ first.
3010 <tag/Notes/<itemize>
3011 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
3012 memory window are discarded, it does just mean that the drivers is allowed
3014 <item>The function is only available as fastcall function, so it may only be
3015 used in presence of a prototype.
3016 <item>The function produces undefined results if no extended memory driver is
3019 <tag/Availability/cc65
3021 <ref id="em_load_driver" name="em_load_driver">,
3022 <ref id="em_map" name="em_map">,
3023 <ref id="em_use" name="em_use">
3029 <sect1>em_copyfrom<label id="em_copyfrom"><p>
3033 <tag/Function/Copy from extended into normal memory.
3034 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3035 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
3036 <tag/Description/Copy data from extended memory into linear memory. Source and
3037 target addresses as well as the number of bytes to transfer are specified in
3038 the <tt/em_copy/ structure that is passed as a parameter.
3039 <tag/Notes/<itemize>
3040 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
3041 made any changes to the data in the window, call <tt/<ref id="em_commit"
3042 name="em_commit">/ first, or the changes are lost.
3043 <item>The function is only available as fastcall function, so it may only be
3044 used in presence of a prototype.
3045 <item>The function produces undefined results if no extended memory driver is
3048 <tag/Availability/cc65
3050 <ref id="em_commit" name="em_commit">,
3051 <ref id="em_copyto" name="em_copyto">,
3052 <ref id="em_load_driver" name="em_load_driver">
3058 <sect1>em_copyto<label id="em_copyto"><p>
3062 <tag/Function/Copy from normal into extended memory.
3063 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3064 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
3065 <tag/Description/Copy data from linear into extended memory. Source and
3066 target addresses as well as the number of bytes to transfer are specified in
3067 the <tt/em_copy/ structure that is passed as a parameter.
3068 <tag/Notes/<itemize>
3069 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
3070 made any changes to the data in the window, call <tt/<ref id="em_commit"
3071 name="em_commit">/ first, or the changes are lost.
3072 <item>The function is only available as fastcall function, so it may only be
3073 used in presence of a prototype.
3074 <item>The function produces undefined results if no extended memory driver is
3077 <tag/Availability/cc65
3079 <ref id="em_commit" name="em_commit">,
3080 <ref id="em_copyfrom" name="em_copyfrom">,
3081 <ref id="em_load_driver" name="em_load_driver">
3087 <sect1>em_install<label id="em_install"><p>
3091 <tag/Function/Install an already loaded extended memory driver.
3092 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3093 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
3094 <tag/Description/The function installs an already loaded extended memory driver
3095 and returns an error code. The function may be used to install a driver linked
3096 statically to the program.
3097 <tag/Notes/<itemize>
3098 <item>Not all drivers are able to detect if the supported hardware is really
3100 <item>The function is only available as fastcall function, so it may only be
3101 used in presence of a prototype.
3103 <tag/Availability/cc65
3105 <ref id="em_load_driver" name="em_load_driver">,
3106 <ref id="em_uninstall" name="em_uninstall">,
3107 <ref id="em_unload" name="em_unload">
3113 <sect1>em_load_driver<label id="em_load_driver"><p>
3117 <tag/Function/Load and initialize an extended memory driver.
3118 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3119 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
3120 <tag/Description/Load an extended memory driver into memory and initialize
3121 it. The function returns an error code that tells if all this has been
3123 <tag/Notes/<itemize>
3124 <item>Not all drivers are able to detect if the supported hardware is really
3126 <item>The function is only available as fastcall function, so it may only be
3127 used in presence of a prototype.
3128 <item>The driver is loaded by name, so currently you must know the type of
3129 extended memory that should be supported. There is no autodetect capability.
3131 <tag/Availability/cc65
3133 <ref id="em_unload" name="em_unload">
3139 <sect1>em_map<label id="em_map"><p>
3143 <tag/Function/Make a page of extended memory accessible.
3144 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3145 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
3146 <tag/Description/The function maps one page of extended memory into linear
3147 memory and returns a pointer to the page frame. Depending on the hardware
3148 and driver, the data is either mapped into the address space or transfered
3149 into a buffer. If you don't need the actual contents of the page (for example
3150 because you're going to overwrite it completely), it is better to call
3151 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
3152 data if it is possible to avoid that.
3153 <tag/Notes/<itemize>
3154 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
3155 made any changes to the data in the window, call <tt/<ref id="em_commit"
3156 name="em_commit">/ first, or the changes are lost.
3157 <item>The function is only available as fastcall function, so it may only be
3158 used in presence of a prototype.
3159 <item>The function produces undefined results if no extended memory driver is
3162 <tag/Availability/cc65
3164 <ref id="em_commit" name="em_commit">,
3165 <ref id="em_load_driver" name="em_load_driver">,
3166 <ref id="em_use" name="em_use">
3172 <sect1>em_pagecount<label id="em_pagecount"><p>
3176 <tag/Function/Return the number of available extended memory pages.
3177 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3178 <tag/Declaration/<tt/unsigned em_pagecount (void);/
3179 <tag/Description/The function returns the size of the extended memory supported
3180 by the driver in 256 byte pages.
3181 <tag/Notes/<itemize>
3182 <item>The function returns zero if no extended memory driver is loaded.
3183 <item>The function may return zero if the supported hardware was not detected.
3185 <tag/Availability/cc65
3187 <ref id="em_load_driver" name="em_load_driver">
3193 <sect1>em_uninstall<label id="em_uninstall"><p>
3197 <tag/Function/Uninstall an already loaded extended memory driver.
3198 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3199 <tag/Declaration/<tt/unsigned char em_uninstall (void);/
3200 <tag/Description/The function uninstalls an already loaded extended memory
3201 driver but doesn't remove it from memory.
3202 <tag/Notes/<itemize>
3203 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
3204 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
3205 should be used instead of <tt/em_uninstall/ so the driver is also removed
3208 <tag/Availability/cc65
3210 <ref id="em_install" name="em_install">,
3211 <ref id="em_load_driver" name="em_load_driver">,
3212 <ref id="em_unload" name="em_unload">
3218 <sect1>em_unload<label id="em_unload"><p>
3222 <tag/Function/Unload an extended memory driver.
3223 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3224 <tag/Declaration/<tt/unsigned char em_unload (void);/
3225 <tag/Description/The function unloads a loaded extended memory driver and
3226 frees all memory allocated for the driver.
3227 <tag/Notes/<itemize>
3228 <item>The function does nothing if no driver is loaded.
3230 <tag/Availability/cc65
3232 <ref id="em_load_driver" name="em_load_driver">
3238 <sect1>em_use<label id="em_use"><p>
3242 <tag/Function/Prepare an extended memory page for use.
3243 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3244 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
3245 <tag/Description/The function maps one page of extended memory into linear
3246 memory and returns a pointer to the page frame. This function is similar to
3247 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
3248 actual memory window in the assumption that the existing data is wrong or
3249 will get overwritten.
3250 <tag/Notes/<itemize>
3251 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
3252 made any changes to the data in the window, call <tt/<ref id="em_commit"
3253 name="em_commit">/ first, or the changes are lost.
3254 <item>The function is only available as fastcall function, so it may only be
3255 used in presence of a prototype.
3256 <item>The function produces undefined results if no extended memory driver is
3259 <tag/Availability/cc65
3261 <ref id="em_commit" name="em_commit">,
3262 <ref id="em_load_driver" name="em_load_driver">,
3263 <ref id="em_map" name="em_map">
3269 <sect1>exit<label id="exit"><p>
3273 <tag/Function/Terminate the program.
3274 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3275 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
3276 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
3277 return code of the program. Before termination, all files are closed, buffered
3278 output is written and any functions registered with <tt/<ref id="atexit"
3279 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
3280 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
3282 <tag/Notes/<itemize>
3283 <item>The function is only available as fastcall function, so it may only
3284 be used in presence of a prototype.
3285 <item>It depends on the host machine if the program return code can be
3286 evaluated or is ignored.
3288 <tag/Availability/ISO 9899
3290 <ref id="abort" name="abort">,
3291 <ref id="exit" name="exit">
3297 <sect1>exec<label id="exec"><p>
3301 <tag/Function/Execute a program file.
3302 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3303 <tag/Declaration/<tt/int __fastcall__ exec (const char* progname, const char* cmdline);/
3304 <tag/Description/<tt/exec/ replaces the currently running program by a new one.
3305 Calling <tt/exec()/ is identical to calling <tt/<ref id="exit" name="exit()">/,
3306 then loading and starting the program named in the first argument, passing
3307 the command line specified as second argument. Instead of an empty string,
3308 a <tt/NULL/ pointer may be passed as second parameter.
3309 On success, the function does not return. On failure, -1 is returned and
3310 <tt/errno/ contains an error code.
3311 <tag/Notes/<itemize>
3312 <item>The function is only available as fastcall function, so it may only
3313 be used in presence of a prototype.
3314 <item>On most platforms, the function needs to copy a small stub loader to
3315 some memory area outside the program space. This may collide with other
3316 programs. See the platform specific docs on this.
3317 <item>Because it is necessary to terminate the running program before the
3318 memory can be reused to load the new one, there is a high chance that the
3319 function may not be able to return on errors.
3320 <item>The command line is passed to the new program in the same way as cc65
3321 programs expect the command line. If the new program is not a cc65 generated
3322 program, it may not be able to read it.
3324 <tag/Availability/cc65
3326 <ref id="exit" name="exit">
3332 <sect1>fast<label id="fast"><p>
3336 <tag/Function/Switch the CPU into fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
3337 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
3338 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
3339 <tag/Declaration/<tt/void fast (void);/
3340 <tag/Description/The function will switch the clock of the CPU to fast mode. For the C128
3341 target it means switching the CPU into 2MHz mode. For the C16/Plus4 target it means
3342 switching the CPU into double clock mode.
3343 <tag/Notes/<itemize>
3344 <item>The function is specific to the C128, C16 and Plus4.
3345 <item>On the C128 the 2MHz clock will not work in 40 column mode.
3347 <tag/Availability/cc65 (not all platforms)
3349 <ref id="isfast" name="isfast">,
3350 <ref id="slow" name="slow">,
3356 <sect1>feof<label id="feof"><p>
3360 <tag/Function/Return the end-of-file indicator of a stream.
3361 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3362 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
3363 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
3364 <tt/f/, and returns a non zero value if it is set.
3365 <tag/Notes/<itemize>
3366 <item>The indicator is set only after a read past the end of a file is
3368 <item>The function is only available as fastcall function, so it may only be
3369 used in presence of a prototype.
3371 <tag/Availability/ISO 9899
3373 <ref id="feof" name="clearerr">,
3374 <ref id="ferror" name="ferror">
3380 <sect1>ferror<label id="ferror"><p>
3384 <tag/Function/Return the error indicator of a stream.
3385 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3386 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
3387 <tag/Description/<tt/ferror/ tests the error indicator of the stream
3388 <tt/f/, and returns a non zero value if it is set.
3389 <tag/Notes/<itemize>
3390 <item>The function is only available as fastcall function, so it may only be
3391 used in presence of a prototype.
3393 <tag/Availability/ISO 9899
3395 <ref id="feof" name="clearerr">,
3396 <ref id="ferror" name="feof">
3402 <sect1>fileno<label id="fileno"><p>
3406 <tag/Function/Return the file handle used by a stream.
3407 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3408 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
3409 <tag/Description/The <tt/fileno/ function returns the file handle used
3410 internally by a C stream. This file handle (an integer) can be used as a
3411 handle for the POSIX input/output functions.
3412 <tag/Notes/<itemize>
3413 <item>The function is only available as fastcall function, so it may only be
3414 used in presence of a prototype.
3415 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
3416 file may have unpredictable results.
3418 <tag/Availability/POSIX 1003.1
3420 <ref id="creat" name="creat">,
3421 <ref id="open" name="open"> <!-- , -->
3422 <!-- <ref id="read" name="read">, -->
3423 <!-- <ref id="write" name="write"> -->
3429 <sect1>free<label id="free"><p>
3433 <tag/Function/Free a block of dynamic memory.
3434 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3435 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
3436 <tag/Description/Free a block of dynamic memory previously allocated with
3437 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
3438 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
3439 pointer is <tt/NULL/, no action is performed.
3440 <tag/Notes/<itemize>
3441 <item>Passing an already free'd block to <tt/free/ again will cause undefined
3442 behaviour and may crash your program.
3443 <item>The function is only available as fastcall function, so it may only
3444 be used in presence of a prototype.
3446 <tag/Availability/ISO 9899
3448 <ref id="_heapadd" name="_heapadd">,
3449 <ref id="_heapblocksize" name="_heapblocksize">,
3450 <ref id="_heapmaxavail" name="_heapmaxavail">,
3451 <ref id="_heapmemavail" name="_heapmemavail">,
3452 <ref id="calloc" name="calloc">,
3453 <ref id="malloc" name="malloc">,
3454 <ref id="realloc" name="realloc">
3460 <sect1>get_ostype<label id="get_ostype"><p>
3464 <tag/Function/The function returns the operating system, the program runs on.
3465 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
3466 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
3467 <tag/Declaration/<tt/unsigned char get_ostype (void);/
3468 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
3469 all supported targets. If it exists, it returns a number that identifies the
3470 operating system or machine type, the program runs on. The machine dependent
3471 header files define constants that can be used to check the return code.
3472 <tag/Notes/<itemize>
3473 <item>The function does not exist on all platforms.
3474 <item>The return codes are platform dependent.
3476 <tag/Availability/cc65 (not all platforms)
3482 <sect1>get_scpu_speed<label id="get_scpu_speed"><p>
3486 <tag/Function/Get the current speed of the C64/C128 SuperCPU cartridge.
3487 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3488 <tag/Declaration/<tt/unsigned char get_scpu_speed (void);/
3489 <tag/Description/The function returns the current speed of the SuperCPU cartridge.
3490 <tag/Notes/<itemize>
3491 <item>The function is specific to the C128 and C64.
3492 <item>The function does not check for the presence of the cartridge.
3493 <item>See the accelerator.h header for the speed definitions.
3495 <tag/Availability/cc65 (not all platforms)
3497 <ref id="detect_scpu" name="detect_scpu">,
3498 <ref id="set_scpu_speed" name="set_scpu_speed">,
3504 <sect1>getcpu<label id="getcpu"><p>
3508 <tag/Function/Determine on which CPU the program is running.
3509 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3510 <tag/Declaration/<tt/unsigned char getcpu (void);/
3511 <tag/Description/The function checks on which CPU the code is running. It
3512 returns one of the constants<itemize>
3514 <item><tt/CPU_65C02/
3515 <item><tt/CPU_65816/
3517 <item><tt/CPU_65SC02/
3518 <item><tt/CPU_65CE02/
3519 <item><tt/CPU_HUC6280/
3522 <tag/Notes/<itemize>
3523 <item>Other, more exotic CPU types are not disinguished.
3525 <tag/Availability/cc65
3531 <sect1>getcurrentdevice<label id="getcurrentdevice"><p>
3535 <tag/Function/Get current device.
3536 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3537 <tag/Declaration/<tt/unsigned char getcurrentdevice (void);/
3538 <tag/Description/The function returns the current device.
3539 It allows to access the current device with the <ref id="dio.h"
3540 name="Low-level disk I/O API"> or <ref id="cbm.h" name="cbm_* I/O
3541 functions"> requiring a 'device' parameter.
3542 <tag/Availability/cc65
3544 <ref id="getdevicedir" name="getdevicedir">,
3545 <ref id="getfirstdevice" name="getfirstdevice">,
3546 <ref id="getnextdevice" name="getnextdevice">
3548 dio_open (getcurrentdevice ());
3554 <sect1>getcwd<label id="getcwd"><p>
3558 <tag/Function/Get current working directory.
3559 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3560 <tag/Declaration/<tt/char* __fastcall__ getcwd (char* buf, size_t size);/
3561 <tag/Description/The function will return the current working directory.
3562 <tag/Notes/<itemize>
3563 <item>The function is only available as fastcall function, so it may only
3564 be used in presence of a prototype.
3566 <tag/Availability/POSIX 1003.1
3572 <sect1>getdevicedir<label id="getdevicedir"><p>
3576 <tag/Function/Get device directory.
3577 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3578 <tag/Declaration/<tt/char* __fastcall__ getdevicedir (unsigned char device, char* buf, size_t size);/
3579 <tag/Description/The function returns the directory representing <tt/device/.
3580 It allows to access the device on filesystem level by calling chdir() with
3581 the directory returned.
3582 <tag/Notes/<itemize>
3583 <item>Calling getdevicedir() <em/does/ check for a (formatted) disk in a
3584 floppy-disk-type device and returns NULL if that check fails.
3585 <item>The function is only available as fastcall function, so it may only
3586 be used in presence of a prototype.
3588 <tag/Availability/cc65
3590 <ref id="getcwd" name="getcwd">,
3591 <ref id="getcurrentdevice" name="getcurrentdevice">,
3592 <ref id="getfirstdevice" name="getfirstdevice">,
3593 <ref id="getnextdevice" name="getnextdevice">
3595 chdir (getdevicedir (device, buf, sizeof buf));
3597 cf. <tt/samples/enumdevdir.c/
3602 <sect1>getenv<label id="getenv"><p>
3606 <tag/Function/Return a value from the environment.
3607 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3608 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
3609 <tag/Description/The function searches the environment for an entry that
3610 matches <tt/name/ and returns its value. The environment consists of a list
3611 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
3613 <tag/Notes/<itemize>
3614 <item>What exactly is stored in the environment depends on the machine the
3615 program is running on.
3616 <item>The function is only available as fastcall function, so it may only
3617 be used in presence of a prototype.
3619 <tag/Availability/ISO 9899
3625 <sect1>getfirstdevice<label id="getfirstdevice"><p>
3629 <tag/Function/Get first device.
3630 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3631 <tag/Declaration/<tt/unsigned char getfirstdevice (void);/
3632 <tag/Description/The function returns the first device.
3633 The constant <tt/INVALID_DEVICE/ indicates no device.
3634 <tag/Notes/<itemize>
3635 <item>Calling getfirstdevice() does <em/not/ turn on the motor of a
3636 drive-type device and does <em/not/ check for a disk in the drive.
3638 <tag/Availability/cc65
3640 <ref id="getcurrentdevice" name="getcurrentdevice">,
3641 <ref id="getdevicedir" name="getdevicedir">,
3642 <ref id="getnextdevice" name="getnextdevice">
3644 unsigned char dev = getfirstdevice ();
3645 while (dev != INVALID_DEVICE) {
3646 printf ("%d\n", dev);
3647 dev = getnextdevice (dev);
3654 <sect1>getnextdevice<label id="getnextdevice"><p>
3658 <tag/Function/Get next device.
3659 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3660 <tag/Declaration/<tt/unsigned char __fastcall__ getnextdevice (unsigned char device);/
3661 <tag/Description/The function returns the next device after <tt/device/.
3662 The constant <tt/INVALID_DEVICE/ indicates no further device.
3663 <tag/Notes/<itemize>
3664 <item>Calling getnextdevice() does <em/not/ turn on the motor of a
3665 drive-type device and does <em/not/ check for a disk in the drive.
3666 <item>The function is only available as fastcall function, so it may only
3667 be used in presence of a prototype.
3669 <tag/Availability/cc65
3671 <ref id="getcurrentdevice" name="getcurrentdevice">,
3672 <ref id="getdevicedir" name="getdevicedir">,
3673 <ref id="getfirstdevice" name="getfirstdevice">
3675 unsigned char dev = getfirstdevice ();
3676 while (dev != INVALID_DEVICE) {
3677 printf ("%d\n", dev);
3678 dev = getnextdevice (dev);
3685 <sect1>getopt<label id="getopt"><p>
3689 <tag/Function/Parse command line options.
3690 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3691 <tag/Declaration/<tt/int __fastcall__ getopt (int argc, char* const* argv,
3692 const char* optstring);/
3693 <tag/Description/The function parses command line arguments, <tt/argc/ and
3694 <tt/argv/ are the argument count and array passed to <tt/main/. <tt/optstring/
3695 is a string that contains command line option characters. If a character in
3696 <tt/optstring/ is followed by a colon, the option requires an argument. An
3697 option on the command line is recognized if it is one of the option characters
3699 <tt/getopt/ must be called repeatedly. It will return each option character
3700 found on the command line and <tt/EOF/ (-1) if there is no other option. An
3701 option argument is placed in <tt/optarg/, the index of the next element on the
3702 command line to be processed is placed in <tt/optind/.
3703 <tag/Notes/<itemize>
3704 <item>The implementation will not reorder options. A non option on the command
3705 line will terminate option processing. All remaining arguments are not
3706 recognized as options, even if the start with a '-' character.
3707 <item>The function is only available as fastcall function, so it may only
3708 be used in presence of a prototype.
3710 <tag/Availability/POSIX.2
3716 <sect1>gotox<label id="gotox"><p>
3720 <tag/Function/Move the text mode cursor to a new X position.
3721 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3722 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
3723 <tag/Description/The function moves the text mode cursor to the specified X
3724 position while leaving the Y position untouched. The leftmost position on the
3725 screen has the coordinate 0.
3726 <tag/Notes/<itemize>
3727 <item>The function is only available as fastcall function, so it may
3728 only be used in presence of a prototype.
3729 <item>Invalid values for the X position (out of screen coordinates) may
3730 lead to undefined behaviour.
3732 <tag/Availability/cc65
3734 <ref id="gotoy" name="gotoy">,
3735 <ref id="gotoxy" name="gotoxy">,
3736 <ref id="wherex" name="wherex">,
3737 <ref id="wherey" name="wherey">
3743 <sect1>gotoxy<label id="gotoxy"><p>
3747 <tag/Function/Move the text mode cursor to a new position.
3748 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3749 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
3750 <tag/Description/The function moves the text mode cursor to the specified
3751 position. The leftmost position on the screen has the X coordinate 0, the
3752 topmost line has the Y coordinate 0.
3753 <tag/Notes/<itemize>
3754 <item>The function is only available as fastcall function, so it may only be
3755 used in presence of a prototype.
3756 <item>Invalid values for any of both coordinates (out of screen positions) may
3757 lead to undefined behaviour.
3759 <tag/Availability/cc65
3761 <ref id="gotox" name="gotox">,
3762 <ref id="gotoy" name="gotoy">,
3763 <ref id="wherex" name="wherex">,
3764 <ref id="wherey" name="wherey">
3770 <sect1>gotoy<label id="gotoy"><p>
3774 <tag/Function/Move the text mode cursor to a new Y position.
3775 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3776 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
3777 <tag/Description/The function moves the text mode cursor to the specified Y
3778 position while leaving the X position untouched. The uppermost position on the
3779 screen has the coordinate 0.
3780 <tag/Notes/<itemize>
3781 <item>The function is only available as fastcall function, so it may
3782 only be used in presence of a prototype.
3783 <item>Invalid values for the Y position (out of screen coordinates) may lead
3784 to undefined behaviour.
3786 <tag/Availability/cc65
3788 <ref id="gotox" name="gotox">,
3789 <ref id="gotoxy" name="gotoxy">,
3790 <ref id="wherex" name="wherex">,
3791 <ref id="wherey" name="wherey">
3797 <sect1>isalnum<label id="isalnum"><p>
3801 <tag/Function/Check if a given character is a letter or digit.
3802 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3803 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
3804 <tag/Description/The function returns a non zero value if the given argument
3805 is a letter or digit. The return value is zero if the character is anything
3807 <tag/Notes/<itemize>
3808 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3809 inline sequence generated by the macro will not work correctly for values
3810 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3811 this range. The non inline function may be accessed by <tt/#undef/'ing
3813 <item>When compiling without <tt/-Os/, the function is only available as
3814 fastcall function, so it may only be used in presence of a prototype.
3816 <tag/Availability/ISO 9899
3818 <ref id="isalpha" name="isalpha">,
3819 <ref id="isascii" name="isascii">,
3820 <ref id="isblank" name="isblank">,
3821 <ref id="iscntrl" name="iscntrl">,
3822 <ref id="isdigit" name="isdigit">,
3823 <ref id="isgraph" name="isgraph">,
3824 <ref id="islower" name="islower">,
3825 <ref id="isprint" name="isprint">,
3826 <ref id="ispunct" name="ispunct">,
3827 <ref id="isspace" name="isspace">,
3828 <ref id="isupper" name="isupper">,
3829 <ref id="isxdigit" name="isxdigit">
3835 <sect1>isalpha<label id="isalpha"><p>
3839 <tag/Function/Check if a given character is a letter.
3840 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3841 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
3842 <tag/Description/The function returns a non zero value if the given argument
3843 is a letter. The return value is zero if the character is anything else.
3844 <tag/Notes/<itemize>
3845 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3846 inline sequence generated by the macro will not work correctly for values
3847 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3848 this range. The non inline function may be accessed by <tt/#undef/'ing the
3850 <item>When compiling without <tt/-Os/, the function is only available as
3851 fastcall function, so it may only be used in presence of a prototype.
3853 <tag/Availability/ISO 9899
3855 <ref id="isalnum" name="isalnum">,
3856 <ref id="isascii" name="isascii">,
3857 <ref id="isblank" name="isblank">,
3858 <ref id="iscntrl" name="iscntrl">,
3859 <ref id="isdigit" name="isdigit">,
3860 <ref id="isgraph" name="isgraph">,
3861 <ref id="islower" name="islower">,
3862 <ref id="isprint" name="isprint">,
3863 <ref id="ispunct" name="ispunct">,
3864 <ref id="isspace" name="isspace">,
3865 <ref id="isupper" name="isupper">,
3866 <ref id="isxdigit" name="isxdigit">
3872 <sect1>isascii<label id="isascii"><p>
3876 <tag/Function/Check if a given character is in the ASCII (0..127) range.
3877 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3878 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
3879 <tag/Description/The function returns a non zero value if the given argument
3880 is in the range 0..127 (the range of valid ASCII characters) and zero if not.
3881 <tag/Notes/<itemize>
3882 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3883 inline sequence generated by the macro will not work correctly for values
3884 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3885 this range. The non inline function may be accessed by <tt/#undef/'ing the
3887 <item>When compiling without <tt/-Os/, the function is only available as
3888 fastcall function, so it may only be used in presence of a prototype.
3890 <tag/Availability/ISO 9899
3892 <ref id="isalnum" name="isalnum">,
3893 <ref id="isalpha" name="isalpha">,
3894 <ref id="isblank" name="isblank">,
3895 <ref id="iscntrl" name="iscntrl">,
3896 <ref id="isdigit" name="isdigit">,
3897 <ref id="isgraph" name="isgraph">,
3898 <ref id="islower" name="islower">,
3899 <ref id="isprint" name="isprint">,
3900 <ref id="ispunct" name="ispunct">,
3901 <ref id="isspace" name="isspace">,
3902 <ref id="isupper" name="isupper">,
3903 <ref id="isxdigit" name="isxdigit">
3909 <sect1>isblank<label id="isblank"><p>
3913 <tag/Function/Check if a given character is a space or tab.
3914 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3915 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
3916 <tag/Description/The function returns a non zero value if the given argument
3917 is a space or tab character. The return value is zero if the character is
3919 <tag/Notes/<itemize>
3920 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3921 inline sequence generated by the macro will not work correctly for values
3922 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3923 this range. The non inline function may be accessed by <tt/#undef/'ing the
3925 <item>When compiling without <tt/-Os/, the function is only available as
3926 fastcall function, so it may only be used in presence of a prototype.
3928 <tag/Availability/ISO 9899
3930 <ref id="isalnum" name="isalnum">,
3931 <ref id="isalpha" name="isalpha">,
3932 <ref id="isascii" name="isascii">,
3933 <ref id="iscntrl" name="iscntrl">,
3934 <ref id="isdigit" name="isdigit">,
3935 <ref id="isgraph" name="isgraph">,
3936 <ref id="islower" name="islower">,
3937 <ref id="isprint" name="isprint">,
3938 <ref id="ispunct" name="ispunct">,
3939 <ref id="isspace" name="isspace">,
3940 <ref id="isupper" name="isupper">,
3941 <ref id="isxdigit" name="isxdigit">
3947 <sect1>iscntrl<label id="iscntrl"><p>
3951 <tag/Function/Check if a given character is a control character.
3952 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3953 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
3954 <tag/Description/The function returns a non zero value if the given argument
3955 is a control character. The return value is zero if the character is anything
3957 <tag/Notes/<itemize>
3958 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3959 inline sequence generated by the macro will not work correctly for values
3960 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3961 this range. The non inline function may be accessed by <tt/#undef/'ing the
3963 <item>When compiling without <tt/-Os/, the function is only available as
3964 fastcall function, so it may only be used in presence of a prototype.
3966 <tag/Availability/ISO 9899
3968 <ref id="isalnum" name="isalnum">,
3969 <ref id="isalpha" name="isalpha">,
3970 <ref id="isascii" name="isascii">,
3971 <ref id="isblank" name="isblank">,
3972 <ref id="isdigit" name="isdigit">,
3973 <ref id="isgraph" name="isgraph">,
3974 <ref id="islower" name="islower">,
3975 <ref id="isprint" name="isprint">,
3976 <ref id="ispunct" name="ispunct">,
3977 <ref id="isspace" name="isspace">,
3978 <ref id="isupper" name="isupper">,
3979 <ref id="isxdigit" name="isxdigit">
3985 <sect1>isdigit<label id="isdigit"><p>
3989 <tag/Function/Check if a given character is a digit.
3990 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3991 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
3992 <tag/Description/The function returns a non zero value if the given argument
3993 is a digit. The return value is zero if the character is anything else.
3994 <tag/Notes/<itemize>
3995 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3996 inline sequence generated by the macro will not work correctly for values
3997 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3998 this range. The non inline function may be accessed by <tt/#undef/'ing the
4000 <item>When compiling without <tt/-Os/, the function is only available as
4001 fastcall function, so it may only be used in presence of a prototype.
4003 <tag/Availability/ISO 9899
4005 <ref id="isalnum" name="isalnum">,
4006 <ref id="isalpha" name="isalpha">,
4007 <ref id="isascii" name="isascii">,
4008 <ref id="isblank" name="isblank">,
4009 <ref id="iscntrl" name="iscntrl">,
4010 <ref id="isgraph" name="isgraph">,
4011 <ref id="islower" name="islower">,
4012 <ref id="isprint" name="isprint">,
4013 <ref id="ispunct" name="ispunct">,
4014 <ref id="isspace" name="isspace">,
4015 <ref id="isupper" name="isupper">,
4016 <ref id="isxdigit" name="isxdigit">
4022 <sect1>isfast<label id="isfast"><p>
4026 <tag/Function/Check if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
4027 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
4028 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
4029 <tag/Declaration/<tt/unsigned char isfast (void);/
4030 <tag/Description/The function returns a 1 if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
4031 <tag/Notes/<itemize>
4032 <item>The function is specific to the C128, C16 and Plus4.
4034 <tag/Availability/cc65 (not all platforms)
4036 <ref id="fast" name="fast">,
4037 <ref id="slow" name="slow">,
4043 <sect1>isgraph<label id="isgraph"><p>
4047 <tag/Function/Check if a given character is a printable character (except
4049 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4050 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
4051 <tag/Description/The function returns a non zero value if the given argument
4052 is a printable character with the exception of space. The return value is zero
4053 if the character is anything else.
4054 <tag/Notes/<itemize>
4055 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4056 inline sequence generated by the macro will not work correctly for values
4057 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4058 this range. The non inline function may be accessed by <tt/#undef/'ing the
4060 <item>When compiling without <tt/-Os/, the function is only available as
4061 fastcall function, so it may only be used in presence of a prototype.
4063 <tag/Availability/ISO 9899
4065 <ref id="isalnum" name="isalnum">,
4066 <ref id="isalpha" name="isalpha">,
4067 <ref id="isascii" name="isascii">,
4068 <ref id="isblank" name="isblank">,
4069 <ref id="iscntrl" name="iscntrl">,
4070 <ref id="isdigit" name="isdigit">,
4071 <ref id="islower" name="islower">,
4072 <ref id="isprint" name="isprint">,
4073 <ref id="ispunct" name="ispunct">,
4074 <ref id="isspace" name="isspace">,
4075 <ref id="isupper" name="isupper">,
4076 <ref id="isxdigit" name="isxdigit">
4082 <sect1>islower<label id="islower"><p>
4086 <tag/Function/Check if a given character is a lower case letter.
4087 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4088 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
4089 <tag/Description/The function returns a non zero value if the given argument
4090 is a lower case letter. The return value is zero if the character is anything
4092 <tag/Notes/<itemize>
4093 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4094 inline sequence generated by the macro will not work correctly for values
4095 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4096 this range. The non inline function may be accessed by <tt/#undef/'ing the
4098 <item>When compiling without <tt/-Os/, the function is only available as
4099 fastcall function, so it may only be used in presence of a prototype.
4101 <tag/Availability/ISO 9899
4103 <ref id="isalnum" name="isalnum">,
4104 <ref id="isalpha" name="isalpha">,
4105 <ref id="isascii" name="isascii">,
4106 <ref id="isblank" name="isblank">,
4107 <ref id="iscntrl" name="iscntrl">,
4108 <ref id="isdigit" name="isdigit">,
4109 <ref id="isgraph" name="isgraph">,
4110 <ref id="isprint" name="isprint">,
4111 <ref id="ispunct" name="ispunct">,
4112 <ref id="isspace" name="isspace">,
4113 <ref id="isupper" name="isupper">,
4114 <ref id="isxdigit" name="isxdigit">
4120 <sect1>isprint<label id="isprint"><p>
4124 <tag/Function/Check if a given character is a printable character.
4125 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4126 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
4127 <tag/Description/The function returns a non zero value if the given argument
4128 is a printable character (this includes the space character). The return value
4129 is zero if the character is anything else.
4130 <tag/Notes/<itemize>
4131 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4132 inline sequence generated by the macro will not work correctly for values
4133 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4134 this range. The non inline function may be accessed by <tt/#undef/'ing the
4136 <item>When compiling without <tt/-Os/, the function is only available as
4137 fastcall function, so it may only be used in presence of a prototype.
4139 <tag/Availability/ISO 9899
4141 <ref id="isalnum" name="isalnum">,
4142 <ref id="isalpha" name="isalpha">,
4143 <ref id="isascii" name="isascii">,
4144 <ref id="isblank" name="isblank">,
4145 <ref id="iscntrl" name="iscntrl">,
4146 <ref id="isdigit" name="isdigit">,
4147 <ref id="isgraph" name="isgraph">,
4148 <ref id="islower" name="islower">,
4149 <ref id="ispunct" name="ispunct">,
4150 <ref id="isspace" name="isspace">,
4151 <ref id="isupper" name="isupper">,
4152 <ref id="isxdigit" name="isxdigit">
4158 <sect1>ispunct<label id="ispunct"><p>
4162 <tag/Function/Check if a given character is a printable character but not a
4163 space or an alphanumeric character.
4164 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4165 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
4166 <tag/Description/The function returns a non zero value if the given argument
4167 is a printable character, but not a space or anything alphanumeric. The return
4168 value is zero if the character is anything else.
4169 <tag/Notes/<itemize>
4170 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4171 inline sequence generated by the macro will not work correctly for values
4172 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4173 this range. The non inline function may be accessed by <tt/#undef/'ing the
4175 <item>When compiling without <tt/-Os/, the function is only available as
4176 fastcall function, so it may only be used in presence of a prototype.
4178 <tag/Availability/ISO 9899
4180 <ref id="isalnum" name="isalnum">,
4181 <ref id="isalpha" name="isalpha">,
4182 <ref id="isascii" name="isascii">,
4183 <ref id="isblank" name="isblank">,
4184 <ref id="iscntrl" name="iscntrl">,
4185 <ref id="isdigit" name="isdigit">,
4186 <ref id="isgraph" name="isgraph">,
4187 <ref id="islower" name="islower">,
4188 <ref id="isprint" name="isprint">,
4189 <ref id="isspace" name="isspace">,
4190 <ref id="isupper" name="isupper">,
4191 <ref id="isxdigit" name="isxdigit">
4197 <sect1>isspace<label id="isspace"><p>
4201 <tag/Function/Check if a given character is a white-space character.
4202 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4203 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
4204 <tag/Description/The function returns a non zero value if the given argument
4205 is a white space character. The return value is zero if the character is
4206 anything else. The standard white space characters are: space, formfeed ('\f'),
4207 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
4209 <tag/Notes/<itemize>
4210 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4211 inline sequence generated by the macro will not work correctly for values
4212 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4213 this range. The non inline function may be accessed by <tt/#undef/'ing the
4215 <item>When compiling without <tt/-Os/, the function is only available as
4216 fastcall function, so it may only be used in presence of a prototype.
4218 <tag/Availability/ISO 9899
4220 <ref id="isalnum" name="isalnum">,
4221 <ref id="isalpha" name="isalpha">,
4222 <ref id="isascii" name="isascii">,
4223 <ref id="isblank" name="isblank">,
4224 <ref id="iscntrl" name="iscntrl">,
4225 <ref id="isdigit" name="isdigit">,
4226 <ref id="isgraph" name="isgraph">,
4227 <ref id="islower" name="islower">,
4228 <ref id="isprint" name="isprint">,
4229 <ref id="ispunct" name="ispunct">,
4230 <ref id="isupper" name="isupper">,
4231 <ref id="isxdigit" name="isxdigit">
4237 <sect1>isupper<label id="isupper"><p>
4241 <tag/Function/Check if a given character is an upper case letter.
4242 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4243 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
4244 <tag/Description/The function returns a non zero value if the given argument
4245 is an upper case letter. The return value is zero if the character is anything
4247 <tag/Notes/<itemize>
4248 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4249 inline sequence generated by the macro will not work correctly for values
4250 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4251 this range. The non inline function may be accessed by <tt/#undef/'ing the
4253 <item>When compiling without <tt/-Os/, the function is only available as
4254 fastcall function, so it may only be used in presence of a prototype.
4256 <tag/Availability/ISO 9899
4258 <ref id="isalnum" name="isalnum">,
4259 <ref id="isalpha" name="isalpha">,
4260 <ref id="isascii" name="isascii">,
4261 <ref id="isblank" name="isblank">,
4262 <ref id="iscntrl" name="iscntrl">,
4263 <ref id="isdigit" name="isdigit">,
4264 <ref id="isgraph" name="isgraph">,
4265 <ref id="islower" name="islower">,
4266 <ref id="isprint" name="isprint">,
4267 <ref id="ispunct" name="ispunct">,
4268 <ref id="isspace" name="isspace">,
4269 <ref id="isxdigit" name="isxdigit">
4275 <sect1>isxdigit<label id="isxdigit"><p>
4279 <tag/Function/Check if a given character is a hexadecimal digit.
4280 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4281 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
4282 <tag/Description/The function returns a non zero value if the given argument
4283 is a hexadecimal digit (0..9, a..f and A..F). The return value is zero if the
4284 character is anything else.
4285 <tag/Notes/<itemize>
4286 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4287 inline sequence generated by the macro will not work correctly for values
4288 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4289 this range. The non inline function may be accessed by <tt/#undef/'ing the
4291 <item>When compiling without <tt/-Os/, the function is only available as
4292 fastcall function, so it may only be used in presence of a prototype.
4294 <tag/Availability/ISO 9899
4296 <ref id="isalnum" name="isalnum">,
4297 <ref id="isalpha" name="isalpha">,
4298 <ref id="isascii" name="isascii">,
4299 <ref id="isblank" name="isblank">,
4300 <ref id="iscntrl" name="iscntrl">,
4301 <ref id="isdigit" name="isdigit">,
4302 <ref id="isgraph" name="isgraph">,
4303 <ref id="islower" name="islower">,
4304 <ref id="isprint" name="isprint">,
4305 <ref id="ispunct" name="ispunct">,
4306 <ref id="isspace" name="isspace">,
4307 <ref id="isupper" name="isupper">
4313 <sect1>itoa<label id="itoa"><p>
4317 <tag/Function/Convert an integer into a string.
4318 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4319 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
4320 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
4321 <tt/radix/ as the base.
4322 <tag/Notes/<itemize>
4323 <item>There are no provisions to prevent a buffer overflow.
4324 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
4325 <item>The function is non standard, so it is not available in strict ANSI mode.
4326 You should probably use <tt/sprintf/ instead.
4327 <item>The function is only available as fastcall function, so it may only be
4328 used in presence of a prototype.
4330 <tag/Availability/cc65
4332 <ref id="atoi" name="atoi">,
4333 <ref id="atol" name="atol">,
4334 <ref id="ltoa" name="ltoa">,
4335 <ref id="ultoa" name="ultoa">,
4336 <ref id="utoa" name="utoa">
4342 <sect1>joy_count<label id="joy_count"><p>
4346 <tag/Function/Return the number of joysticks supported by the current driver.
4347 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4348 <tag/Declaration/<tt/unsigned char joy_count (void);/
4349 <tag/Description/The function returns a the number of joysticks supported
4350 by the current joystick driver.
4351 <tag/Notes/<itemize>
4352 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4353 name="joy_load_driver"> before calling this function.
4354 <item>The function returns the number of joysticks supported by the driver.
4355 There's no way to check for the number of actually connected joysticks.
4357 <tag/Availability/cc65
4359 <ref id="joy_load_driver" name="joy_load_driver">,
4360 <ref id="joy_read" name="joy_read">
4366 <sect1>joy_install<label id="joy_install"><p>
4370 <tag/Function/Install an already loaded driver and return an error code.
4371 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4372 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
4373 <tag/Description/The function installs a driver that was already loaded into
4374 memory (or linked statically to the program). It returns an error code
4375 (<tt/JOY_ERR_OK/ in case of success).
4376 <tag/Notes/<itemize>
4377 <item>The function is only available as fastcall function, so it may only be
4378 used in presence of a prototype.
4380 <tag/Availability/cc65
4382 <ref id="joy_load_driver" name="joy_load_driver">,
4383 <ref id="joy_uninstall" name="joy_uninstall">,
4384 <ref id="joy_unload" name="joy_unload">
4390 <sect1>joy_load_driver<label id="joy_load_driver"><p>
4394 <tag/Function/Load a driver from disk and install it.
4395 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4396 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
4397 <tag/Description/The function loads a driver with the given name from disk
4398 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
4399 driver was successfully loaded and installed.
4400 <tag/Notes/<itemize>
4401 <item>The function is only available as fastcall function, so it may only be
4402 used in presence of a prototype.
4404 <tag/Availability/cc65
4406 <ref id="joy_install" name="joy_install">,
4407 <ref id="joy_uninstall" name="joy_uninstall">,
4408 <ref id="joy_unload" name="joy_unload">
4414 <sect1>joy_read<label id="joy_read"><p>
4418 <tag/Function/Read the status of a joystick.
4419 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4420 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
4421 <tag/Description/The function reads the status bits for a joystick. The number
4422 of the joystick is passed as parameter. The result may be examined by using one
4423 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
4424 <tag/Notes/<itemize>
4425 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4426 name="joy_load_driver"> before calling this function.
4427 <item>The function is only available as fastcall function, so it may only be
4428 used in presence of a prototype.
4430 <tag/Availability/cc65
4432 <ref id="joy_count" name="joy_count">,
4433 <ref id="joy_load_driver" name="joy_load_driver">,
4434 <ref id="joy_unload" name="joy_unload">
4440 <sect1>joy_uninstall<label id="joy_uninstall"><p>
4444 <tag/Function/Uninstall the current joystick driver.
4445 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4446 <tag/Declaration/<tt/unsigned char joy_uninstall (void);/
4447 <tag/Description/The function uninstalls the currently installed joystick
4448 driver. It does not remove the driver from memory. The function returns an
4449 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4450 <tag/Notes/<itemize>
4451 <item>A joystick driver must be installed using <ref id="joy_install"
4452 name="joy_install"> before calling this function.
4454 <tag/Availability/cc65
4456 <ref id="joy_install" name="joy_install">,
4457 <ref id="joy_load_driver" name="joy_load_driver">,
4458 <ref id="joy_unload" name="joy_unload">
4464 <sect1>joy_unload<label id="joy_unload"><p>
4468 <tag/Function/Uninstall, then unload the current joystick driver.
4469 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4470 <tag/Declaration/<tt/unsigned char joy_unload (void);/
4471 <tag/Description/The function uninstalls the currently installed joystick
4472 driver and removes it from memory. An error code is returned, which is
4473 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4474 <tag/Notes/<itemize>
4475 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4476 name="joy_load_driver"> before calling this function.
4478 <tag/Availability/cc65
4480 <ref id="joy_load_driver" name="joy_load_driver">
4486 <sect1>kbhit<label id="kbhit"><p>
4490 <tag/Function/Check if there's a key waiting in the keyboard buffer.
4491 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4492 <tag/Declaration/<tt/unsigned char kbhit (void);/
4493 <tag/Description/The function returns a value of zero if there is no character
4494 waiting to be read from the keyboard. It returns non zero otherwise.
4495 <tag/Notes/<itemize>
4496 <item>If the system does not support a keyboard buffer (most systems
4497 do), the function is rather useless.
4499 <tag/Availability/cc65
4501 <ref id="cgetc" name="cgetc">,
4502 <ref id="cursor" name="cursor">
4508 <sect1>kbrepeat<label id="kbrepeat"><p>
4512 <tag/Function/Set the keyboard repeat mode.
4513 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
4514 <tag/Declaration/<tt/unsigned char __fastcall__ kbrepeat (unsigned char mode);/
4515 <tag/Description/This function changes which keys have automatic repeat when
4516 being held down for a certain time. Possible values are <tt/KBREPEAT_CURSOR/
4517 (repeat only cursor-related keys), <tt/KBREPEAT_NONE/ (no repeat for any
4518 keys), and <tt/KBREPEAT_ALL/ (repeat all keys). The old mode is returned, so
4519 it can be restored later.
4520 <tag/Notes/<itemize>
4521 <item>The function is available only as a fastcall function; so, it may be used
4522 only in the presence of a prototype.
4524 <tag/Availability/cc65
4530 <sect1>labs<label id="labs"><p>
4534 <tag/Function/Returns the absolute value of a long integer.
4535 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4536 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
4537 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
4539 <tag/Notes/<itemize>
4540 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
4541 <item>The function is only available as fastcall function, so it may only be
4542 used in presence of a prototype.
4544 <tag/Availability/ISO 9899
4546 <ref id="abs" name="abs">
4552 <sect1>ltoa<label id="ltoa"><p>
4556 <tag/Function/Convert a long integer into a string.
4557 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4558 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
4559 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
4560 using <tt/radix/ as the base.
4561 <tag/Notes/<itemize>
4562 <item>There are no provisions to prevent a buffer overflow.
4563 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
4564 <item>The function is non standard, so it is not available in strict ANSI mode.
4565 You should probably use <tt/sprintf/ instead.
4566 <item>The function is only available as fastcall function, so it may only be
4567 used in presence of a prototype.
4569 <tag/Availability/cc65
4571 <ref id="atoi" name="atoi">,
4572 <ref id="atol" name="atol">,
4573 <ref id="itoa" name="itoa">,
4574 <ref id="ultoa" name="ultoa">,
4575 <ref id="utoa" name="utoa">
4581 <sect1>localeconv<label id="localeconv"><p>
4585 <tag/Function/Returns a pointer to the current locale structure.
4586 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4587 <tag/Declaration/<tt/struct lconv* localeconv (void);/
4588 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
4590 <tag/Notes/<itemize>
4591 <item>cc65 supports only the "C" locale, so even after setting a new locale
4592 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
4595 <tag/Availability/ISO 9899
4597 <ref id="setlocale" name="setlocale">
4603 <sect1>longjmp<label id="longjmp"><p>
4607 <tag/Function/Non local goto.
4608 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4609 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
4610 <tag/Description/The <tt/longjmp/ function restores a program context from the
4611 data in <tt/buf/, which must have been set by a preceeding call to
4612 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
4613 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
4615 <tag/Notes/<itemize>
4616 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
4617 was called with a value of one.
4618 <item>The function is only available as fastcall function, so it may only
4619 be used in presence of a prototype.
4621 <tag/Availability/ISO 9899
4623 <ref id="setjmp" name="setjmp">
4629 <sect1>malloc<label id="malloc"><p>
4633 <tag/Function/Allocate dynamic memory.
4634 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4635 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
4636 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
4637 pointer to the allocated memory block. On error (not enough memory available),
4638 <tt/malloc/ returns <tt/NULL/.
4639 <tag/Notes/<itemize>
4640 <item>The function is only available as fastcall function, so it may only
4641 be used in presence of a prototype.
4643 <tag/Availability/ISO 9899
4645 <ref id="_heapadd" name="_heapadd">,
4646 <ref id="_heapblocksize" name="_heapblocksize">,
4647 <ref id="_heapmaxavail" name="_heapmaxavail">,
4648 <ref id="_heapmemavail" name="_heapmemavail">,
4649 <ref id="calloc" name="calloc">,
4650 <ref id="free" name="free">,
4651 <ref id="realloc" name="realloc">,
4652 <ref id="strdup" name="strdup">
4658 <sect1>memchr<label id="memchr"><p>
4662 <tag/Function/Search for a character in a block of raw memory.
4663 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4664 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
4665 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
4666 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
4667 that is of size <tt/count/. Upon completion, the function returns a pointer to
4668 the character found, or a null pointer if the character was not found.
4669 <tag/Notes/<itemize>
4670 <item>The function is only available as fastcall function, so it may only
4671 be used in presence of a prototype.
4673 <tag/Availability/ISO 9899
4675 <ref id="strchr" name="strchr">
4681 <sect1>memcmp<label id="memcmp"><p>
4685 <tag/Function/Compare two memory areas.
4686 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4687 <tag/Declaration/<tt/int __fastcall__ memcmp (const void* p1, const void* p2, size_t count);/
4688 <tag/Description/<tt/memcmp/ compares <tt/count/ bytes from the memory area
4689 pointed to by <tt/p1/ into the memory area pointed to by <tt/p2/. It returns a value that is less than
4690 zero if <tt/p1/ is less than <tt/p2/, zero if <tt/p1/ is the same as <tt/p2/,
4691 and a value greater than zero if <tt/p1/ is greater than <tt/p2/.
4692 <tag/Notes/<itemize>
4693 <item>The function is only available as fastcall function, so it may only
4694 be used in presence of a prototype.
4696 <tag/Availability/ISO 9899
4698 <ref id="strcmp" name="strcmp">,
4699 <ref id="memmove" name="memmove">,
4700 <ref id="memset" name="memset">
4706 <sect1>memcpy<label id="memcpy"><p>
4710 <tag/Function/Copy a memory area.
4711 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4712 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
4713 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
4714 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4716 <tag/Notes/<itemize>
4717 <item>The result is undefined if the memory areas do overlap. Use
4718 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
4719 <item>The function is only available as fastcall function, so it may only
4720 be used in presence of a prototype.
4722 <tag/Availability/ISO 9899
4724 <ref id="_swap" name="_swap">,
4725 <ref id="memmove" name="memmove">,
4726 <ref id="memset" name="memset">
4732 <sect1>memmove<label id="memmove"><p>
4736 <tag/Function/Copy a memory area.
4737 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4738 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
4739 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
4740 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4742 <tag/Notes/<itemize>
4743 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
4744 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
4745 <item>The function is only available as fastcall function, so it may only
4746 be used in presence of a prototype.
4748 <tag/Availability/ISO 9899
4750 <ref id="_swap" name="_swap">,
4751 <ref id="memcpy" name="memcpy">,
4752 <ref id="memset" name="memset">
4758 <sect1>memset<label id="memset"><p>
4762 <tag/Function/Fill a memory area.
4763 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4764 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
4765 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
4766 the value <tt/val/. The function returns <tt/p/.
4767 <tag/Notes/<itemize>
4768 <item>The function is only available as fastcall function, so it may only
4769 be used in presence of a prototype.
4771 <tag/Availability/ISO 9899
4773 <ref id="_swap" name="_swap">,
4774 <ref id="bzero" name="bzero">,
4775 <ref id="memcpy" name="memcpy">,
4776 <ref id="memmove" name="memmove">
4782 <sect1>mod_free<label id="mod_free"><p>
4786 <tag/Function/Free a relocatable module.
4787 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4788 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
4789 <tag/Description/The function will free a module loaded into memory by use of
4790 the <tt/<ref id="mod_load" name="mod_load">/ function.
4791 <tag/Notes/<itemize>
4792 <item>The pointer passed as parameter is the pointer to the module memory,
4793 not the pointer to the control structure.
4794 <item>The function is available only as a fastcall function; so, it may be used
4795 only in the presence of a prototype.
4797 <tag/Availability/cc65
4799 <ref id="mod_load" name="mod_load">
4805 <sect1>mod_load<label id="mod_load"><p>
4809 <tag/Function/Load a relocatable module.
4810 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4811 <tag/Declaration/<tt/unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl);/
4812 <tag/Description/The function will load a code module into memory and relocate
4813 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
4814 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
4815 the module just loaded. Possible error codes are:
4817 <item><tt/MLOAD_OK/ - Module load successful
4818 <item><tt/MLOAD_ERR_READ/ - Read error
4819 <item><tt/MLOAD_ERR_HDR/ - Header error
4820 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
4821 <item><tt/MLOAD_ERR_FMT/ - Data format error
4822 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
4824 <tag/Notes/<itemize>
4825 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
4826 relocatable o65 modules for use with this function.
4827 <item>The function is available only as a fastcall function; so, it may be used
4828 only in the presence of a prototype.
4830 <tag/Availability/cc65
4832 <ref id="mod_free" name="mod_free">
4838 <sect1>mouse_setbox<label id="mouse_setbox"><p>
4842 <tag/Function/Specify a bounding box for the mouse cursor.
4843 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4844 <tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
4845 <tag/Description/The function allows to set a bounding box for mouse movement.
4846 <tag/Notes/<itemize>
4847 <item>The function does not check if the mouse cursor is currently within the
4848 given rectangle. Placing the mouse cursor within the bounding box is the
4849 responsibility of the programmer.
4850 <item>While the bounding box may be larger than the actual screen size, the
4851 standard mouse cursor draw routines may fail to set the cursor to coordinates
4852 outside of the screen area. Depending on the platform, you may have to supply
4853 your own mouse cursor routines.
4854 <item>The function is only available as fastcall function, so it may only be
4855 used in presence of a prototype.
4857 <tag/Availability/cc65
4859 <ref id="mouse_getbox" name="mouse_getbox">,
4860 <ref id="mouse_move" name="mouse_move">
4866 <sect1>mouse_getbox<label id="mouse_getbox"><p>
4870 <tag/Function/Return the current bounding box for the mouse cursor.
4871 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4872 <tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
4873 <tag/Description/The function queries the current bounding box for mouse
4875 <tag/Notes/<itemize>
4876 <item>The function is only available as fastcall function, so it may only be
4877 used in presence of a prototype.
4879 <tag/Availability/cc65
4881 <ref id="mouse_move" name="mouse_move">,
4882 <ref id="mouse_setbox" name="mouse_setbox">
4888 <sect1>mouse_buttons<label id="mouse_buttons"><p>
4892 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
4893 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4894 <tag/Declaration/<tt/unsigned char mouse_buttons (void);/
4895 <tag/Description/The function returns a bit mask that encodes the state of the
4896 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
4898 <tag/Availability/cc65
4900 <ref id="mouse_info" name="mouse_info">,
4901 <ref id="mouse_pos" name="mouse_pos">
4907 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
4911 <tag/Function/Return a readable error message for an error code.
4912 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4913 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
4915 <tag/Description/The function returns an error message (in english) for the
4916 error code passed parameter.
4917 <tag/Notes/<itemize>
4918 <item>The function will return "Unknown error" for invalid error codes.
4919 <item>The function is only available as fastcall function, so it may only be
4920 used in presence of a prototype.
4922 <tag/Availability/cc65
4924 <ref id="mouse_load_driver" name="mouse_load_driver">,
4925 <ref id="mouse_uninstall" name="mouse_uninstall">,
4926 <ref id="mouse_unload" name="mouse_unload">
4932 <sect1>mouse_hide<label id="mouse_hide"><p>
4936 <tag/Function/Hide the mouse pointer.
4937 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4938 <tag/Declaration/<tt/void mouse_hide (void);/
4939 <tag/Description/The function hides the mouse pointer. It manages a counter
4940 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
4941 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
4942 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
4944 <tag/Availability/cc65
4946 <ref id="mouse_show" name="mouse_show">
4952 <sect1>mouse_info<label id="mouse_info"><p>
4956 <tag/Function/Return the state of the mouse buttons and the position of the
4958 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4959 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
4960 <tag/Description/The function returns the state of the mouse buttons and the
4961 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
4962 <tag/Notes/<itemize>
4963 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
4964 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
4965 name="mouse_pos">/ instead.
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_buttons" name="mouse_buttons">,
4972 <ref id="mouse_pos" name="mouse_pos">
4978 <sect1>mouse_install<label id="mouse_install"><p>
4982 <tag/Function/Install an already loaded mouse driver.
4983 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4984 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
4985 mouse_callbacks* c, void* driver);/
4986 <tag/Description/The function installs an already loaded mouse driver and
4987 returns an error code. The <tt/mouse_callbacks/ structure passed as first
4988 parameter contains pointers to routines needed to move or hide/show the mouse
4989 pointer. Defaults for these routines are supplied by the library, so if you
4990 can live with these defaults (which are platform specific), just pass a
4991 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
4992 driver linked statically to the program.
4993 <tag/Notes/<itemize>
4994 <item>Not all drivers are able to detect if the supported hardware is really
4996 <item>After installing a driver, the mouse cursor is hidden.
4997 <item>The function is only available as fastcall function, so it may only be
4998 used in presence of a prototype.
5000 <tag/Availability/cc65
5002 <ref id="mouse_load_driver" name="mouse_load_driver">,
5003 <ref id="mouse_uninstall" name="mouse_uninstall">,
5004 <ref id="mouse_unload" name="mouse_unload">
5010 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
5014 <tag/Function/Call the driver specific ioctl function.
5015 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5016 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
5017 <tag/Description/The function calls the IOCTL entry in the mouse driver,
5018 which is driver specific. The <tt/code/ parameter will choose between
5019 different IOCTL functions, and the <tt/data/ depends on code. The
5020 function returns an error code. The purpose of this function is to allow
5021 for driver specific extensions. See the documentation for a specific mouse
5022 driver for supported ioctl calls.
5023 <tag/Notes/<itemize>
5024 <item>Calling this function is non portable, because each driver may
5025 implement different ioctl calls (or none at all).
5026 <item>The function is only available as fastcall function, so it may only be
5027 used in presence of a prototype.
5029 <tag/Availability/cc65
5035 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
5039 <tag/Function/Load and initialize a mouse driver.
5040 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5041 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
5042 mouse_callbacks* c, const char* driver);/
5043 <tag/Description/Load a mouse driver into memory and initialize it. The
5044 function returns an error code that tells if the call has been successful. The
5045 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
5046 routines needed to move or hide/show the mouse pointer. Defaults for these
5047 routines are supplied by the library, so if you can live with these defaults
5048 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
5049 <tag/Notes/<itemize>
5050 <item>The driver is loaded by name, so currently you must know the type of
5051 mouse that should be supported. There is no autodetect capability.
5052 <item>Not all drivers are able to detect if the supported hardware is really
5054 <item>After installing a driver, the mouse cursor is hidden.
5055 <item>The function is only available as fastcall function, so it may only be
5056 used in presence of a prototype.
5058 <tag/Availability/cc65
5060 <ref id="mouse_install" name="mouse_install">,
5061 <ref id="mouse_uninstall" name="mouse_uninstall">,
5062 <ref id="mouse_unload" name="mouse_unload">
5068 <sect1>mouse_move<label id="mouse_move"><p>
5072 <tag/Function/Move the mouse cursor to a specific position.
5073 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5074 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
5075 <tag/Description/The function updates the mouse position. If the mouse cursor
5076 is visible, it is shown at the new position.
5077 <tag/Notes/<itemize>
5078 <item>The function does not check if the new position is within the bounding
5079 box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
5080 <item>The function is only available as fastcall function, so it may only be
5081 used in presence of a prototype.
5083 <tag/Availability/cc65
5085 <ref id="mouse_getbox" name="mouse_getbox">,
5086 <ref id="mouse_setbox" name="mouse_setbox">
5092 <sect1>mouse_pos<label id="mouse_pos"><p>
5096 <tag/Function/Return the position of the mouse.
5097 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5098 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
5099 <tag/Description/The function returns the position of the mouse in the
5100 <tt/mouse_pos/ structure passed as parameter.
5101 <tag/Notes/<itemize>
5102 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
5103 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
5104 name="mouse_info">/ instead.
5105 <item>The function is only available as fastcall function, so it may only be
5106 used in presence of a prototype.
5108 <tag/Availability/cc65
5110 <ref id="mouse_buttons" name="mouse_buttons">,
5111 <ref id="mouse_info" name="mouse_info">
5117 <sect1>mouse_show<label id="mouse_show"><p>
5121 <tag/Function/Show the mouse pointer.
5122 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5123 <tag/Declaration/<tt/void mouse_show (void);/
5124 <tag/Description/The function shows the mouse pointer. It manages a counter
5125 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
5126 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
5127 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
5128 <tag/Availability/cc65
5130 <ref id="mouse_hide" name="mouse_hide">
5136 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
5140 <tag/Function/Uninstall an already loaded mouse driver.
5141 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5142 <tag/Declaration/<tt/unsigned char mouse_uninstall (void);/
5143 <tag/Description/The function uninstalls an already loaded mouse driver but
5144 don't removes it from memory.
5145 <tag/Notes/<itemize>
5146 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
5147 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
5148 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
5151 <tag/Availability/cc65
5153 <ref id="mouse_install" name="mouse_install">,
5154 <ref id="mouse_load_driver" name="mouse_load_driver">,
5155 <ref id="mouse_unload" name="mouse_unload">
5161 <sect1>mouse_unload<label id="mouse_unload"><p>
5165 <tag/Function/Unload a mouse driver.
5166 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5167 <tag/Declaration/<tt/unsigned char mouse_unload (void);/
5168 <tag/Description/The function unloads a loaded mouse driver and frees all
5169 memory allocated for the driver.
5170 <tag/Notes/<itemize>
5171 <item>The function does nothing if no driver is loaded.
5173 <tag/Availability/cc65
5175 <ref id="mouse_install" name="mouse_install">,
5176 <ref id="mouse_load_driver" name="mouse_load_driver">,
5177 <ref id="mouse_uninstall" name="mouse_uninstall">
5183 <sect1>offsetof<label id="offsetof"><p>
5187 <tag/Function/Calculate the offset of a struct or union member.
5188 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
5189 <tag/Declaration/<tt/size_t offsetof (type, member);/
5190 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
5191 or <tt/union/ member.
5192 <tag/Notes/<itemize>
5193 <item>The function is actually a macro.
5195 <tag/Availability/ISO 9899
5201 <sect1>open<label id="open"><p>
5205 <tag/Function/Open and possibly create a file.
5206 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
5207 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
5208 <tag/Description/<tt/open/ opens a file and returns the file descriptor
5209 associated with it. On error, -1 is returned and an error code is stored in
5210 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
5211 <tag/Notes/<itemize>
5212 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
5213 open, which is used as the permission mask when a new file is created. While
5214 cc65 allows to pass this argument, it is ignored.
5216 <tag/Availability/POSIX 1003.1
5218 <ref id="close" name="close">,
5219 <ref id="creat" name="creat">
5225 <sect1>opendir<label id="opendir"><p>
5229 <tag/Function/Open a directory.
5230 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5231 <tag/Declaration/<tt/DIR* __fastcall__ opendir (const char* name);/
5232 <tag/Description/<tt/opendir/ opens a directory and returns the direcory
5233 descriptor associated with it. On error, NULL is returned and an error code is
5234 stored in <tt/errno/.
5235 <tag/Notes/<itemize>
5236 <item>The function is only available as fastcall function, so it may only
5237 be used in presence of a prototype.
5239 <tag/Availability/POSIX 1003.1
5241 <ref id="closedir" name="closedir">,
5242 <ref id="readdir" name="readdir">
5248 <sect1>peekbsys<label id="peekbsys"><p>
5252 <tag/Function/Read one byte from a location in the system bank.
5253 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5254 <tt/<ref id="cbm510.h" name="cbm510.h">/
5255 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
5256 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
5257 system bank (bank 15) of the CBM PET-II machines and returns it.
5258 <tag/Notes/<itemize>
5259 <item>The function is only available as fastcall function, so it may only
5260 be used in presence of a prototype.
5261 <item>This function may be a macro depending on the compiler options. The
5262 actual function is accessible by #undef'ing the macro.
5264 <tag/Availability/cc65
5266 <ref id="PEEK" name="PEEK">,
5267 <ref id="PEEKW" name="PEEKW">,
5268 <ref id="peekwsys" name="peekwsys">,
5269 <ref id="pokebsys" name="pokebsys">,
5270 <ref id="pokewsys" name="pokewsys">
5276 <sect1>peekwsys<label id="peekwsys"><p>
5280 <tag/Function/Read one word from a location in the system bank.
5281 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5282 <tt/<ref id="cbm510.h" name="cbm510.h">/
5283 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
5284 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
5285 system bank (bank 15) of the CBM PET-II machines and returns it. Following
5286 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
5287 high byte is read from <tt/addr+1/.
5288 <tag/Notes/<itemize>
5289 <item>The function is only available as fastcall function, so it may only
5290 be used in presence of a prototype.
5291 <item>The order in which the two bytes are read is undefined.
5293 <tag/Availability/cc65
5295 <ref id="PEEK" name="PEEK">,
5296 <ref id="PEEKW" name="PEEKW">,
5297 <ref id="peekbsys" name="peekbsys">,
5298 <ref id="pokebsys" name="pokebsys">,
5299 <ref id="pokewsys" name="pokewsys">
5305 <sect1>perror<label id="perror"><p>
5309 <tag/Function/Print an error message for the error in <tt/errno/.
5310 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5311 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
5312 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
5313 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
5314 a blank. Then the error message for the current contents of <tt/errno/ is
5315 printed followed by a newline. The message output is the same as returned by
5316 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
5317 <tag/Notes/<itemize>
5318 <item>The function is only available as fastcall function, so it may only
5319 be used in presence of a prototype.
5321 <tag/Availability/ISO 9899
5323 <ref id="_poserror" name="_poserror">,
5324 <ref id="strerror" name="strerror">
5330 <sect1>pokebsys<label id="pokebsys"><p>
5334 <tag/Function/Write one byte to a location in the system bank.
5335 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5336 <tt/<ref id="cbm510.h" name="cbm510.h">/
5337 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
5338 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
5339 system bank (bank 15) of the CBM PET-II machines.
5340 <tag/Notes/<itemize>
5341 <item>The function is only available as fastcall function, so it may only
5342 be used in presence of a prototype.
5344 <tag/Availability/cc65
5346 <ref id="POKE" name="POKE">,
5347 <ref id="POKEW" name="POKEW">,
5348 <ref id="peekbsys" name="peekbsys">,
5349 <ref id="peekwsys" name="peekwsys">,
5350 <ref id="pokewsys" name="pokewsys">
5356 <sect1>pokewsys<label id="pokewsys"><p>
5360 <tag/Function/Write one word to a location in the system bank.
5361 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5362 <tt/<ref id="cbm510.h" name="cbm510.h">/
5363 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
5364 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
5365 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
5366 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
5367 high byte is written to <tt/addr+1/.
5368 <tag/Notes/<itemize>
5369 <item>The function is only available as fastcall function, so it may only
5370 be used in presence of a prototype.
5371 <item>The order in which the two bytes are written is undefined.
5373 <tag/Availability/cc65
5375 <ref id="POKE" name="POKE">,
5376 <ref id="POKEW" name="POKEW">,
5377 <ref id="peekbsys" name="peekbsys">,
5378 <ref id="peekwsys" name="peekwsys">,
5379 <ref id="pokebsys" name="pokebsys">
5385 <sect1>qsort<label id="qsort"><p>
5389 <tag/Function/Sort an array.
5390 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5391 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
5392 size_t size, int __fastcall__ (* compare) (const void*, const void*));/
5393 <tag/Description/<tt/qsort/ sorts an array according to a given compare
5394 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
5395 is the number of elements, <tt/size/ the size of an element and <tt/compare/
5396 the function used to compare the members.
5397 <tag/Notes/<itemize>
5398 <item>If there are multiple members with the same key, the order after calling
5399 the function is undefined.
5400 <item>The function is only available as fastcall function, so it may only
5401 be used in presence of a prototype.
5402 <item>The function to which <tt/compare/ points must have the <tt/fastcall/
5405 <tag/Availability/ISO 9899
5407 <ref id="bsearch" name="bsearch">
5413 <sect1>raise<label id="raise"><p>
5417 <tag/Function/Send a signal to the executing program.
5418 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
5419 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
5420 <tag/Description/<tt/raise/ sends the given signal to the program. If the
5421 program has installed a signal handler for the signal, this signal handler
5422 will be executed. If no handler has been installed, the default action for
5423 the raised signal will be taken. The function returns zero on success,
5425 <tag/Notes/<itemize>
5426 <item>The function is only available as fastcall function, so it may only
5427 be used in presence of a prototype.
5429 <tag/Availability/ISO 9899
5431 <ref id="abort" name="abort">,
5432 <ref id="signal" name="signal">
5438 <sect1>rand<label id="rand"><p>
5442 <tag/Function/Return a pseudo random number.
5443 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5444 <tag/Declaration/<tt/int rand (void);/
5445 <tag/Description/The function returns a pseudo random number
5446 between 0 and <tt/RAND_MAX/ (exclusive).
5447 <tag/Notes/<itemize>
5448 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
5449 flow of numbers is generated.
5450 <item>On startup, the function behaves as if <ref id="srand" name="srand">
5451 had been used with an argument of 1.
5453 <tag/Availability/ISO 9899
5455 <ref id="_randomize" name="_randomize">,
5456 <ref id="srand" name="srand">
5462 <sect1>readdir<label id="readdir"><p>
5466 <tag/Function/Read a directory.
5467 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5468 <tag/Declaration/<tt/struct dirent* __fastcall__ readdir (DIR* dir);/
5469 <tag/Description/<tt/readdir/ reads the next directory entry from the directory
5470 stream pointed to by <tt/dir/. It stores the data in a <tt/dirent/ structure
5471 and returns a pointer to it. If the end of directory is reached, or an error
5472 occurs, NULL is returned. In case of errors, an error code is stored into
5474 <tag/Notes/<itemize>
5475 <item>The function is only available as fastcall function, so it may only
5476 be used in presence of a prototype.
5477 <item>The returned pointer may point to a statically allocated instance of
5478 <tt/struct dirent/, so it may get overwritten by subsequent calls to
5480 <item>On several platforms, namely the CBMs and the Atari, the disk drives get
5481 confused when opening/closing files between directory reads. So for example a
5482 program that reads the list of files on a disk, and after each call to
5483 <tt/readdir/, opens the file to process it, will fail.<newline>
5484 Possible solutions are reading the directory into memory before processing the
5485 file list, or to reset the directory by seeking to the correct position after
5486 opening/closing a file:
5488 seekdir (DIR, telldir (DIR));
5490 Platforms known to work without problems are: Apple.
5492 <tag/Availability/POSIX 1003.1
5494 <ref id="closedir" name="closedir">,
5495 <ref id="opendir" name="opendir">
5501 <sect1>realloc<label id="realloc"><p>
5505 <tag/Function/Change the size of an allocated memory block.
5506 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5507 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
5508 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
5509 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
5510 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
5511 behaves as if <tt/free/ had been called. On error (not enough memory
5512 available), <tt/realloc/ returns <tt/NULL/.
5513 <tag/Notes/<itemize>
5514 <item>The part of the memory block that is returned will have its contents
5516 <item>This function is somewhat dangerous to use. Be careful to save the
5517 pointer you're passing somewhere else, otherwise
5519 ptr = realloc (ptr, size);
5521 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
5522 <item>The function is only available as fastcall function, so it may only
5523 be used in presence of a prototype.
5525 <tag/Availability/ISO 9899
5527 <ref id="_heapadd" name="_heapadd">,
5528 <ref id="_heapblocksize" name="_heapblocksize">,
5529 <ref id="_heapmaxavail" name="_heapmaxavail">,
5530 <ref id="_heapmemavail" name="_heapmemavail">,
5531 <ref id="calloc" name="calloc">,
5532 <ref id="free" name="free">,
5533 <ref id="realloc" name="realloc">
5539 <sect1>remove<label id="remove"><p>
5543 <tag/Function/Delete a file.
5544 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5545 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
5546 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
5547 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5548 code describing the reason for the failure.
5549 <tag/Notes/<itemize>
5550 <item>This function is not available on all cc65 targets (depends on the
5551 availability of file I/O).
5552 <item>The function is only available as fastcall function, so it may only
5553 be used in presence of a prototype.
5555 <tag/Availability/ISO 9899
5557 <ref id="rename" name="rename">,
5558 <ref id="unlink" name="unlink">
5561 #include <stdio.h>
5563 #define FILENAME "helloworld"
5565 if (remove (FILENAME) == 0) {
5566 printf ("We deleted %s successfully\n", FILENAME);
5568 printf ("There was a problem deleting %s\n", FILENAME);
5575 <sect1>rename<label id="rename"><p>
5579 <tag/Function/Rename a file.
5580 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5581 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
5582 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
5583 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5584 code describing the reason for the failure.
5585 <tag/Notes/<itemize>
5586 <item>This function is not available on all cc65 targets (depends on the
5587 capabilities of the storage devices).
5588 <item>The function is only available as fastcall function, so it may only
5589 be used in presence of a prototype.
5591 <tag/Availability/ISO 9899
5593 <ref id="remove" name="remove">
5596 #include <stdio.h>
5598 #define OLDNAME "textfile.txt"
5599 #define NEWNAME "textfile.bak"
5601 if (rename (OLDNAME, NEWNAME) == 0) {
5602 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
5604 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
5611 <sect1>reset_brk<label id="reset_brk"><p>
5615 <tag/Function/Resets the break vector to its original value.
5616 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5617 <tag/Declaration/<tt/void reset_brk (void);/
5618 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
5619 before a call to <tt/set_brk/.
5620 <tag/Notes/<itemize>
5621 <item>The break vector is reset on program termination, so it's not strictly
5622 necessary to call this function as a part of your clean-up when exitting the program.
5624 <tag/Availability/cc65
5626 <ref id="reset_irq" name="reset_irq">,
5627 <ref id="set_brk" name="set_brk">,
5628 <ref id="set_irq" name="set_irq">
5634 <sect1>reset_irq<label id="reset_irq"><p>
5638 <tag/Function/Resets the C level interrupt request vector.
5639 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5640 <tag/Declaration/<tt/void reset_irq (void);/
5641 <tag/Description/<tt/reset_irq/ resets the C level interrupt request vector.
5642 <tag/Notes/<itemize>
5643 <item>The interrupt vector is reset on program termination, so it's not strictly
5644 necessary to call this function as a part of your clean-up when exitting the program.
5646 <tag/Availability/cc65
5648 <ref id="reset_brk" name="reset_brk">,
5649 <ref id="set_brk" name="set_brk">,
5650 <ref id="set_irq" name="set_irq">
5656 <sect1>revers<label id="revers"><p>
5660 <tag/Function/Control revers character display.
5661 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5662 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
5663 <tag/Description/If the argument is non zero, the function enables reverse
5664 character display. If the argument is zero, reverse character display is
5665 switched off. The old value of the setting is returned.
5666 <tag/Notes/<itemize>
5667 <item>The function may not be supported by the hardware, in which case
5668 the call is ignored.
5669 <item>The function is only available as fastcall function, so it may only
5670 be used in presence of a prototype.
5672 <tag/Availability/cc65
5674 <ref id="textcolor" name="textcolor">
5680 <sect1>rewinddir<label id="rewinddir"><p>
5684 <tag/Function/Reset a directory stream.
5685 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5686 <tag/Declaration/<tt/void __fastcall__ rewinddir (DIR* dir);/
5687 <tag/Description/<tt/rewinddir/ sets the position of the directory stream
5688 pointed to by <tt/dir/ to the start of the directory.
5689 <tag/Notes/<itemize>
5690 <item>The function is only available as fastcall function, so it may only
5691 be used in presence of a prototype.
5693 <tag/Availability/POSIX 1003.1
5695 <ref id="seekdir" name="seekdir">,
5696 <ref id="telldir" name="telldir">
5702 <sect1>screensize<label id="screensize"><p>
5706 <tag/Function/Return the dimensions of the text mode screen.
5707 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5708 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
5709 <tag/Description/The function returns the dimensions of the text mode screen.
5710 <tag/Notes/<itemize>
5711 <item>The function is only available as fastcall function, so it may only
5712 be used in presence of a prototype.
5714 <tag/Availability/cc65
5716 <ref id="gotox" name="gotox">,
5717 <ref id="gotoxy" name="gotoxy">,
5718 <ref id="gotoy" name="gotoy">,
5719 <ref id="wherex" name="wherex">,
5720 <ref id="wherey" name="wherey">
5726 <sect1>seekdir<label id="seekdir"><p>
5730 <tag/Function/Set the position of a directory stream.
5731 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5732 <tag/Declaration/<tt/void __fastcall__ seekdir (DIR* dir, long offset);/
5733 <tag/Description/<tt/seekdir/ sets the position of the directory stream
5734 pointed to by <tt/dir/ to the value given in <tt/offset/, which should be a
5735 value returned by <tt/<ref id="telldir" name="telldir">/.
5736 <tag/Notes/<itemize>
5737 <item>The function is only available as fastcall function, so it may only
5738 be used in presence of a prototype.
5740 <tag/Availability/POSIX 1003.1
5742 <ref id="rewinddir" name="rewinddir">,
5743 <ref id="telldir" name="telldir">
5749 <sect1>ser_close<label id="ser_close"><p>
5753 <tag/Function/Close the port and disable interrupts
5754 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5755 <tag/Declaration/<tt/unsigned char ser_close (void);/
5756 <tag/Description/Close the port by clearing buffers and disable interrupts.
5757 <tag/Availability/cc65
5758 <tag/See also/Other serial functions.
5763 static void initialize(){
5764 struct ser_params params = {
5771 ser_install(lynx_comlynx); // This will activate the ComLynx
5773 ser_open(&params);
5780 <sect1>ser_get<label id="ser_get"><p>
5784 <tag/Function/Read a character from serial port.
5785 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5786 <tag/Declaration/<tt/unsigned char __fastcall__ ser_get (char* b);/
5787 <tag/Description/Get a character from the serial port. If no characters are
5788 available, the function will return SER_ERR_NO_DATA, so this is not a fatal
5790 <tag/Notes/<itemize>
5791 <item>The function is only available as fastcall function, so it may only
5792 be used in presence of a prototype.
5794 <tag/Availability/cc65
5795 <tag/See also/Other serial functions.
5797 Wait for a character to be available from a serial port.
5800 while (ser_get(&ch) == SER_ERR_NO_DATA)
5807 <sect1>ser_install<label id="ser_install"><p>
5811 <tag/Function/Install an already loaded driver and return an error code.
5812 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5813 <tag/Declaration/<tt/unsigned char __fastcall__ ser_install (void* driver);/
5814 <tag/Description/The function installs a driver that was already loaded into
5815 memory (or linked statically to the program). It returns an error code
5816 (<tt/SER_ERR_OK/ in case of success).
5817 <tag/Notes/<itemize>
5818 <item>The function is only available as fastcall function, so it may only be
5819 used in presence of a prototype.
5821 <tag/Availability/cc65
5823 <ref id="ser_load_driver" name="ser_load_driver">,
5824 <ref id="ser_uninstall" name="ser_uninstall">,
5825 <ref id="ser_unload" name="ser_unload">
5827 ser_install(lynx_comlynx); //Include the driver statically instead of loading it.
5833 <sect1>ser_ioctl<label id="ser_ioctl"><p>
5837 <tag/Function/Platform dependent code extensions.
5838 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5839 <tag/Declaration/<tt/unsigned __fastcall__ ser_ioctl (unsigned char code, void* data);/
5840 <tag/Description/Some platforms have extra serial functions that are not
5841 supported by standard serial driver functions. You can extend the driver to support
5842 this extra functionality bt using ser_ioctl functions.
5843 <tag/Notes/<itemize>
5844 <item>The function is only available as fastcall function, so it may only
5845 be used in presence of a prototype.
5846 <item>These functions are not easily portable to other cc65 platforms.
5848 <tag/Availability/cc65
5849 <tag/See also/Other serial functions.
5854 <sect1>ser_load_driver<label id="ser_load_driver"><p>
5858 <tag/Function/Load and install a serial driver.
5859 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5860 <tag/Declaration/<tt/unsigned char __fastcall__ ser_load_driver (const char *name);/
5861 <tag/Description/Load and install the driver by name.
5862 Will just load the driver and check if loading was successful.
5863 <tag/Notes/<itemize>
5864 <item>The function is only available as fastcall function, so it may only
5865 be used in presence of a prototype.
5867 <tag/Availability/cc65
5868 <tag/See also/Other serial functions.
5874 <sect1>ser_open<label id="ser_open"><p>
5878 <tag/Function/Open the port by setting the port parameters and enable interrupts
5879 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5880 <tag/Declaration/<tt/unsigned char __fastcall__ ser_open (const struct ser_params* params);/
5881 <tag/Description/Open the port by setting the port parameters and enable interrupts.
5882 <tag/Notes/<itemize>
5883 <item>The function is only available as fastcall function, so it may only
5884 be used in presence of a prototype.
5886 <tag/Availability/cc65
5887 <tag/See also/Other serial functions.
5892 static void initialize(){
5893 struct ser_params params = {
5900 ser_install(lynx_comlynx); // This will activate the ComLynx
5902 ser_open(&params);
5909 <sect1>ser_put<label id="ser_put"><p>
5913 <tag/Function/Write a character to a serial port.
5914 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5915 <tag/Declaration/<tt/unsigned char __fastcall__ ser_put (char b);/
5916 <tag/Description/Send a character via the serial port. There is a transmit
5917 buffer, but transmitting is not done via interrupt. The function returns
5918 SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
5919 <tag/Notes/<itemize>
5920 <item>The function is only available as fastcall function, so it may only
5921 be used in presence of a prototype.
5923 <tag/Availability/cc65
5924 <tag/See also/Other serial functions.
5933 <sect1>ser_status<label id="ser_status"><p>
5937 <tag/Function/Return the serial port status.
5938 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5939 <tag/Declaration/<tt/unsigned char __fastcall__ ser_status (unsigned char* status);/
5940 <tag/Description/Return the serial port status.
5941 <tag/Notes/<itemize>
5942 <item>The function is only available as fastcall function, so it may only
5943 be used in presence of a prototype.
5945 <tag/Availability/cc65
5946 <tag/See also/Other serial functions.
5952 <sect1>ser_uninstall<label id="ser_uninstall"><p>
5956 <tag/Function/Uninstall the currently loaded driver but do not unload it.
5957 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5958 <tag/Declaration/<tt/unsigned char ser_uninstall (void);/
5959 <tag/Description/Uninstall the currently loaded driver but do not unload it.
5960 <tag/Availability/cc65
5961 <tag/See also/Other serial functions.
5966 <sect1>ser_unload<label id="ser_unload"><p>
5970 <tag/Function/Uninstall, then unload the currently loaded driver.
5971 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5972 <tag/Declaration/<tt/unsigned char ser_unload (void);/
5973 <tag/Description/Uninstall, then unload the currently loaded driver.
5974 <tag/Availability/cc65
5975 <tag/See also/Other serial functions.
5981 <sect1>set_brk<label id="set_brk"><p>
5985 <tag/Function/Set the break vector to a user function.
5986 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5987 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
5988 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
5989 program code by letting the vector point to a user written C function. The
5990 runtime library installs a small stub that saves the registers into global
5991 variables that may be accessed (and changed) by the break handler.
5992 <tag/Notes/<itemize>
5993 <item>The function is only available as fastcall function, so it may only
5994 be used in presence of a prototype.
5995 <item>The stub saves the zero page registers used by the C runtime and switches
5996 to a small break handler stack. This means that it is safe to execute C code,
5997 even if C code was interrupted. Be careful however not to use too many local
5998 variables, and do not enable stack checks for the handler function or any other
5999 function called from it.
6000 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
6001 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
6002 otherwise the <tt/BRK/ instruction will get executed over and over again.
6003 <item>The break vector is reset on program termination, so it's not strictly
6004 necessary to call <tt/<ref id="reset_brk" name="reset_brk">/ as a part of your
6005 clean-up when exitting the program.
6007 <tag/Availability/cc65
6009 <ref id="reset_brk" name="reset_brk">
6015 <sect1>set_irq<label id="set_irq"><p>
6019 <tag/Function/Set the C level interrupt request vector to the given address.
6020 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
6021 <tag/Declaration/<tt/void __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);/
6022 <tag/Description/<tt/set_irq/ allows a user program to handle interrupt requests
6023 (IRQs) within the program code by letting the vector point to a user written C
6024 function. The runtime library installs a small stub that saves the zero page
6025 registers used by the C runtime before calling the handler function and restores
6026 them after the handler function returns. Additionally the stub temporarily switches
6027 the C runtime stack to the stack area provided as parameter. If the handler function
6028 was set up to handle a "private", "exclusive" interrupt request source it must
6029 return the value <tt/IRQ_HANDLED/ if and only if it has verified that the current
6030 interrupt request actually stems from that source. In all other cases it must return
6031 the value <tt/IRQ_NOT_HANDLED/.
6032 <tag/Notes/<itemize>
6033 <item>The function is only available as fastcall function, so it may only
6034 be used in presence of a prototype.
6035 <item>The stub saves the registers and zero page locations used by the C runtime
6036 and switches to the provided stack area. As a consequence, there is some
6037 runtime overhead, but it it is safe to execute C code, even if other C code
6038 was interrupted. Be careful however not to call C library functions, and do not
6039 enable stack checks for the handler function or any other function called from
6041 <item>The interrupt vector is reset on program termination, so it's not strictly
6042 necessary to call <tt/<ref id="reset_irq" name="reset_irq">/ as a part of your
6043 clean-up when exitting the program.
6045 <tag/Availability/cc65
6047 <ref id="reset_brk" name="reset_brk">,
6048 <ref id="reset_irq" name="reset_irq">,
6049 <ref id="set_brk" name="set_brk">
6055 <sect1>set_scpu_speed<label id="set_scpu_speed"><p>
6059 <tag/Function/Set the current speed of the C64/C128 SuperCPU cartridge.
6060 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6061 <tag/Declaration/<tt/unsigned char set_scpu_speed (unsigned char speed);/
6062 <tag/Description/The function returns the speed after trying to set the speed of the SuperCPU cartridge.
6063 <tag/Notes/<itemize>
6064 <item>The function is specific to the C128 and C64.
6065 <item>The function does not check for the presence of the cartridge.
6066 <item>See the accelerator.h header for the speed definitions.
6068 <tag/Availability/cc65 (not all platforms)
6070 <ref id="detect_scpu" name="detect_scpu">,
6071 <ref id="get_scpu_speed" name="get_scpu_speed">,
6077 <sect1>setjmp<label id="setjmp"><p>
6081 <tag/Function/Save the context for use with <tt/longjmp/.
6082 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
6083 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
6084 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
6085 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
6087 <tag/Notes/<itemize>
6088 <item>The function is only available as fastcall function, so it may only
6089 be used in presence of a prototype.
6090 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
6091 <item><tt/setjmp/ will not save the signal context.
6093 <tag/Availability/ISO 9899
6095 <ref id="longjmp" name="longjmp">
6101 <sect1>setlocale<label id="setlocale"><p>
6105 <tag/Function/Selects a locale.
6106 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
6107 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
6108 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
6109 <tag/Notes/<itemize>
6110 <item>The function is only available as fastcall function, so it may only
6111 be used in presence of a prototype.
6112 <item>cc65 supports only the "C" locale, so calling this function to set a
6113 different locale has no effect.
6115 <tag/Availability/ISO 9899
6117 <ref id="localeconv" name="localeconv">,
6118 <ref id="strcoll" name="strcoll">
6119 <ref id="strxfrm" name="strxfrm">
6125 <sect1>signal<label id="signal"><p>
6129 <tag/Function/Install a signal handler.
6130 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
6131 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
6132 <tag/Description/<tt/signal/ installs a handler for the given signal. The
6133 handler may either be a user supplied function, or one of the predefined
6134 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
6135 previous value if the signal , or the special function vector SIG_ERR in
6137 <tag/Notes/<itemize>
6138 <item>The function is only available as fastcall function, so it may only
6139 be used in presence of a prototype.
6141 <tag/Availability/ISO 9899
6143 <ref id="abort" name="abort">,
6144 <ref id="raise" name="raise">
6150 <sect1>sleep<label id="sleep"><p>
6154 <tag/Function/Sleep for a specified amount of time.
6155 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
6156 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
6157 <tag/Description/The function will return after the specified number of
6158 seconds have elapsed.
6159 <tag/Notes/<itemize>
6160 <item>The function is only available as fastcall function, so it may only
6161 be used in presence of a prototype.
6163 <tag/Availability/POSIX 1003.1
6169 <sect1>slow<label id="slow"><p>
6173 <tag/Function/Switch the CPU into slow mode (C128: 1MHz mode, C16/Plus4: single clock mode).
6174 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
6175 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
6176 <tag/Declaration/<tt/void slow (void);/
6177 <tag/Description/The function will switch the clock of the CPU to slow mode. for the C128
6178 target it means switching the CPU into 1MHz mode. for the C16/Plus4 target it means
6179 switching the CPU into single clock mode.
6180 <tag/Notes/<itemize>
6181 <item>The function is specific to the C128, C16 and Plus4.
6183 <tag/Availability/cc65 (not all platforms)
6185 <ref id="fast" name="fast">,
6186 <ref id="isfast" name="isfast">,
6192 <sect1>srand<label id="srand"><p>
6196 <tag/Function/Initialize the pseudo random number generator.
6197 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
6198 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
6199 <tag/Description/The function initializes the random number generator using
6200 the given seed. On program startup, the generator behaves as if <tt/srand/ has
6201 been called with an argument of 1.
6202 <tag/Notes/<itemize>
6203 <item>The function is only available as fastcall function, so it may only
6204 be used in presence of a prototype.
6206 <tag/Availability/ISO 9899
6208 <ref id="_randomize" name="_randomize">,
6209 <ref id="rand" name="rand">
6215 <sect1>strcasecmp<label id="strcasecmp"><p>
6219 <tag/Function/Compare two strings case insensitive.
6220 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6221 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
6222 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
6223 as parameters without case sensitivity. It returns a value that is less than
6224 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
6225 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
6226 <tag/Notes/<itemize>
6227 <item>The function is only available as fastcall function, so it may only
6228 be used in presence of a prototype.
6229 <item>The function is not available in strict ANSI mode.
6231 <tag/Availability/cc65
6233 <ref id="strcmp" name="strcmp">,
6234 <ref id="strcoll" name="strcoll">,
6235 <ref id="stricmp" name="stricmp">,
6236 <ref id="strncmp" name="strncmp">,
6237 <ref id="strxfrm" name="strxfrm">
6243 <sect1>strcat<label id="strcat"><p>
6247 <tag/Function/Concatentate two strings.
6248 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6249 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
6250 <tag/Description/The <tt/strcat/ function appends a copy of the string
6251 pointed to by s2 (including the terminating null byte) to the end of the
6252 string pointed to by s1. The initial byte of s2 overwrites the null byte at
6254 <tag/Notes/<itemize>
6255 <item>The function is only available as fastcall function, so it may only
6256 be used in presence of a prototype.
6257 <item>If copying takes place between objects that overlap, the behaviour
6260 <tag/Availability/ISO 9899
6262 <ref id="strcpy" name="strcpy">,
6263 <ref id="strncat" name="strncat">,
6264 <ref id="strncpy" name="strncpy">
6270 <sect1>strchr<label id="strchr"><p>
6274 <tag/Function/Search for a character in a string.
6275 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6276 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
6277 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
6278 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6279 byte is considered to be part of the string. Upon completion, the function
6280 returns a pointer to the byte, or a null pointer if the byte was not found.
6281 <tag/Notes/<itemize>
6282 <item>The function is only available as fastcall function, so it may only
6283 be used in presence of a prototype.
6285 <tag/Availability/ISO 9899
6287 <ref id="memchr" name="memchr">,
6288 <ref id="strrchr" name="strrchr">
6294 <sect1>strcmp<label id="strcmp"><p>
6298 <tag/Function/Compare two strings.
6299 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6300 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
6301 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
6302 parameters. It returns a value that is less than zero if <tt/s1/ is less than
6303 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
6304 if <tt/s1/ is greater than <tt/s2/.
6305 <tag/Notes/<itemize>
6306 <item>The function is only available as fastcall function, so it may only
6307 be used in presence of a prototype.
6309 <tag/Availability/ISO 9899
6311 <ref id="strcasecmp" name="strcasecmp">,
6312 <ref id="strcoll" name="strcoll">,
6313 <ref id="stricmp" name="stricmp">,
6314 <ref id="strncmp" name="strncmp">
6315 <ref id="strxfrm" name="strxfrm">
6321 <sect1>strcoll<label id="strcoll"><p>
6325 <tag/Function/Compare two strings.
6326 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6327 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
6328 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
6329 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
6330 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
6331 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
6332 than zero if <tt/s1/ is greater than <tt/s2/.
6333 <tag/Notes/<itemize>
6334 <item>The function is only available as fastcall function, so it may only
6335 be used in presence of a prototype.
6337 <tag/Availability/ISO 9899
6339 <ref id="setlocale" name="setlocale">,
6340 <ref id="strcasecmp" name="strcasecmp">,
6341 <ref id="strcmp" name="strcmp">,
6342 <ref id="stricmp" name="stricmp">,
6343 <ref id="strncmp" name="strncmp">,
6344 <ref id="strxfrm" name="strxfrm">
6350 <sect1>strcpy<label id="strcpy"><p>
6354 <tag/Function/Copy a string.
6355 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6356 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
6357 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
6358 <tt/s2/ (including the terminating null byte) into the array pointed to by
6359 <tt/s1/. The function will always return <tt/s1/.
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>If copying takes place between objects that overlap, the behaviour
6366 <tag/Availability/ISO 9899
6368 <ref id="strcat" name="strcat">,
6369 <ref id="strncat" name="strncat">,
6370 <ref id="strncpy" name="strncpy">
6373 #include <string.h>
6375 static char hello[14];
6377 strcpy (hello, "Hello world!\n");
6383 <sect1>strcspn<label id="strcspn"><p>
6387 <tag/Function/Compute the length of a substring.
6388 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6389 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
6390 <tag/Description/The <tt/strcspn/ function computes and returns the length of
6391 the substring pointed to by <tt/s/ which does <em>not</em> consist of
6392 characters contained in the string <tt/set/.
6393 <tag/Notes/<itemize>
6394 <item>The function is only available as fastcall function, so it may only
6395 be used in presence of a prototype.
6397 <tag/Availability/ISO 9899
6399 <ref id="strqtok" name="strqtok">,
6400 <ref id="strspn" name="strspn">,
6401 <ref id="strstr" name="strstr">,
6402 <ref id="strtok" name="strtok">
6408 <sect1>strdup<label id="strdup"><p>
6412 <tag/Function/Allocate a copy of a string on the heap.
6413 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6414 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
6415 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
6416 to hold a copy of <tt/s/ including the terminating zero. If the allocation
6417 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
6418 memory block, and a pointer to the block is returned.
6419 <tag/Notes/<itemize>
6420 <item>The function is only available as fastcall function, so it may only
6421 be used in presence of a prototype.
6422 <item>It is up to the caller to free the allocated memory block.
6424 <tag/Availability/ISO 9899
6426 <ref id="free" name="free">,
6427 <ref id="malloc" name="malloc">
6433 <sect1>strerror<label id="strerror"><p>
6437 <tag/Function/Return a string describing an error code.
6438 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6439 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
6440 <tag/Description/The <tt/strerror/ function returns a string describing the
6441 given error code. If an invalid error code is passed, the string "Unknown
6442 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
6443 <tt/errno/ is left untouched.
6444 <tag/Notes/<itemize>
6445 <item>The function is only available as fastcall function, so it may only
6446 be used in presence of a prototype.
6447 <item>While the return type of the function is a <tt/char*/, the returned
6448 string must not be modified by the caller!
6450 <tag/Availability/ISO 9899
6452 <ref id="_stroserror" name="_stroserror">
6458 <sect1>stricmp<label id="stricmp"><p>
6462 <tag/Function/Compare two strings case insensitive.
6463 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6464 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
6465 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
6466 parameters without case sensitivity. It returns a value that is less than zero
6467 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
6468 value greater than zero if <tt/s1/ is greater than <tt/s2/.
6469 <tag/Notes/<itemize>
6470 <item>The function is only available as fastcall function, so it may only
6471 be used in presence of a prototype.
6472 <item>The function is not available in strict ANSI mode.
6474 <tag/Availability/cc65
6476 <ref id="strcasecmp" name="strcasecmp">,
6477 <ref id="strcmp" name="strcmp">,
6478 <ref id="strcoll" name="strcoll">,
6479 <ref id="strncmp" name="strncmp">,
6480 <ref id="strxfrm" name="strxfrm">
6486 <sect1>strlen<label id="strlen"><p>
6490 <tag/Function/Return the length of a string.
6491 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6492 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
6493 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
6494 string to which s points, not including the terminating null byte.
6495 <tag/Notes/<itemize>
6496 <item>The function is only available as fastcall function, so it may only
6497 be used in presence of a prototype.
6498 <item>When compiling with <tt/-Os/ (inline known standard functions), the
6499 function does not work correctly for strings with more than 255 characters.
6501 <tag/Availability/ISO 9899
6503 <ref id="strcpy" name="strcpy">
6509 <sect1>strlower<label id="strlower"><p>
6513 <tag/Function/Make a string lower case.
6514 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6515 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
6516 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
6517 function to each character of a string. The function will always return <tt/s/.
6518 <tag/Notes/<itemize>
6519 <item>The function is only available as fastcall function, so it may only
6520 be used in presence of a prototype.
6521 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6522 <item>An alias name for this function is <tt/strlwr/.
6524 <tag/Availability/cc65
6526 <ref id="strupper" name="strupper">,
6527 <ref id="tolower" name="tolower">
6533 <sect1>strlwr<label id="strlwr"><p>
6540 <sect1>strncasecmp<label id="strncasecmp"><p>
6544 <tag/Function/Compare two strings case insensitive.
6545 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6546 <tag/Declaration/<tt/int __fastcall__ strncasecmp (const char* s1, const char* s2, size_t count);/
6547 <tag/Description/The <tt/strncasecmp/ function compares the two strings passed
6548 as parameters without case sensitivity. It returns a value that is less than
6549 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
6550 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
6551 <tag/Notes/<itemize>
6552 <item>The function is only available as fastcall function, so it may only
6553 be used in presence of a prototype.
6554 <item>The function is not available in strict ANSI mode.
6556 <tag/Availability/cc65
6558 <ref id="strcmp" name="strcmp">,
6559 <ref id="strcoll" name="strcoll">,
6560 <ref id="stricmp" name="stricmp">,
6561 <ref id="strncmp" name="strncmp">,
6562 <ref id="strxfrm" name="strxfrm">
6568 <sect1>strncat<label id="strncat"><p>
6572 <tag/Function/Concatentate two strings.
6573 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6574 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
6575 <tag/Description/The <tt/strncat/ function appends not more than n characters
6576 of the string pointed to by s2 to the end of the string pointed to by s1. The
6577 terminating null character at the end of s1 is overwritten. A terminating null
6578 character is appended to the result, even if not all of s2 is appended to s1.
6579 <tag/Notes/<itemize>
6580 <item>The function is only available as fastcall function, so it may only
6581 be used in presence of a prototype.
6582 <item>If copying takes place between objects that overlap, the behaviour
6585 <tag/Availability/ISO 9899
6587 <ref id="strcpy" name="strcpy">,
6588 <ref id="strncat" name="strncat">,
6589 <ref id="strncpy" name="strncpy">
6595 <sect1>strncmp<label id="strncmp"><p>
6599 <tag/Function/Compare two strings.
6600 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6601 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
6602 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
6603 characters of the two strings passed as parameters. It returns a value that is
6604 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
6605 <tt/s2/, zero if they are identical, and a value greater than zero they are
6607 <tag/Notes/<itemize>
6608 <item>The function is only available as fastcall function, so it may only
6609 be used in presence of a prototype.
6611 <tag/Availability/ISO 9899
6613 <ref id="strcasecmp" name="strcasecmp">,
6614 <ref id="strcmp" name="strcmp">,
6615 <ref id="strcoll" name="strcoll">,
6616 <ref id="stricmp" name="stricmp">,
6617 <ref id="strxfrm" name="strxfrm">
6623 <sect1>strncpy<label id="strncpy"><p>
6627 <tag/Function/Copy part of a string.
6628 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6629 <tag/Declaration/<tt/char* __fastcall__ strncpy (char* s1, const char* s2, size_t n);/
6630 <tag/Description/The <tt/strncpy/ function copies not more than <tt/n/ bytes from
6631 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
6632 pointed to by <tt/s2/ is a string that is shorter than <tt/n/ bytes, null bytes are
6633 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
6634 written. The function always will return <tt/s1/.
6635 <tag/Notes/<itemize>
6636 <item>The function is available only as a fastcall function; so, it may be used
6637 only in the presence of a prototype.
6638 <item>If there is no null byte in the first <tt/n/ bytes of the array pointed
6639 to by <tt/s2/, the result is <em/not/ null-terminated!
6640 <item>If copying takes place between objects that overlap, the behaviour is
6643 <tag/Availability/ISO 9899
6645 <ref id="memcpy" name="memcpy">,
6646 <ref id="strcat" name="strcat">,
6647 <ref id="strcpy" name="strcpy">,
6648 <ref id="strncat" name="strncat">
6653 static char hello[6];
6655 strncpy (hello, "Hello world!\n", sizeof hello - 1)[5] = '\0';
6661 <sect1>strnicmp<label id="strnicmp"><p>
6665 <tag/Function/Compare two strings case insensitive.
6666 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6667 <tag/Declaration/<tt/int __fastcall__ strnicmp (const char* s1, const char* s2, size_t count);/
6668 <tag/Description/The <tt/strnicmp/ function compares the two strings passed as
6669 parameters without case sensitivity. It returns a value that is less than zero
6670 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
6671 value greater than zero if <tt/s1/ is greater than <tt/s2/.
6672 <tag/Notes/<itemize>
6673 <item>The function is only available as fastcall function, so it may only
6674 be used in presence of a prototype.
6675 <item>The function is not available in strict ANSI mode.
6677 <tag/Availability/cc65
6679 <ref id="strcasecmp" name="strcasecmp">,
6680 <ref id="strcmp" name="strcmp">,
6681 <ref id="strcoll" name="strcoll">,
6682 <ref id="strncmp" name="strncmp">,
6683 <ref id="strxfrm" name="strxfrm">
6689 <sect1>strqtok<label id="strqtok"><p>
6693 <tag/Function/Break a string into tokens.
6694 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6695 <tag/Declaration/<tt/char* __fastcall__ strqtok (char* s1, const char* s2);/
6696 <tag/Description/<tt/strqtok()/ will break the string <tt/s1/ into a sequence of
6697 tokens, which are delimited by either quotation marks or characters from the
6698 string <tt/s2/. Tokens inside quotation marks may contain characters from <tt/s2/
6699 (they aren't delimiters there). The first call to <tt/strqtok()/ will return a
6700 pointer to the first token in the string <tt/s1/. The following calls must pass
6701 a <tt/NULL/ pointer as <tt/s1/, in order to get the next token in the string.
6702 Different sets of delimiters may be used for the subsequent calls to <tt/strqtok()/.
6703 <tag/Notes/<itemize>
6704 <item>The function is available only as a fastcall function; so, it may be used
6705 only in the presence of a prototype.
6706 <item><tt/strqtok()/ will modify the string <tt/s1/.
6707 <item>The function will forget where it is in the <tt/s1/ string if it is given
6708 a second <tt/s1/ string before it finishes the first one.
6710 <tag/Availability/cc65
6712 <ref id="strcspn" name="strcspn">,
6713 <!-- <ref id="strpbrk" name="strpbrk">, -->
6714 <ref id="strspn" name="strspn">,
6715 <ref id="strtok" name="strtok">
6721 <sect1>strrchr<label id="strrchr"><p>
6725 <tag/Function/Search for a character in a string.
6726 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6727 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
6728 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
6729 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6730 byte is considered to be part of the string. Upon completion, the function
6731 returns a pointer to the byte, or a null pointer if the byte was not found.
6732 <tag/Notes/<itemize>
6733 <item>The function is only available as fastcall function, so it may only
6734 be used in presence of a prototype.
6736 <tag/Availability/ISO 9899
6738 <ref id="strchr" name="strchr">
6744 <sect1>strspn<label id="strspn"><p>
6748 <tag/Function/Compute the length of a substring.
6749 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6750 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
6751 <tag/Description/The <tt/strspn/ function computes and returns the length of
6752 the substring pointed to by <tt/s/ which does consist only of characters
6753 contained in the string <tt/set/.
6754 <tag/Notes/<itemize>
6755 <item>The function is only available as fastcall function, so it may only
6756 be used in presence of a prototype.
6758 <tag/Availability/ISO 9899
6760 <ref id="strcspn" name="strcspn">,
6761 <ref id="strstr" name="strstr">
6767 <sect1>strstr<label id="strstr"><p>
6771 <tag/Function/Find a substring.
6772 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6773 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
6774 <tag/Description/<tt/strstr/ searches for the first occurance of the string
6775 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
6776 otherwise it returns <tt/NULL/.
6777 <tag/Notes/<itemize>
6778 <item>The function is only available as fastcall function, so it may only
6779 be used in presence of a prototype.
6781 <tag/Availability/ISO 9899
6783 <ref id="strcspn" name="strcspn">,
6784 <ref id="strspn" name="strspn">
6790 <sect1>strtok<label id="strtok"><p>
6794 <tag/Function/Break a string into tokens.
6795 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6796 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
6797 <tag/Description/<tt/strtok()/ will break the string <tt/s1/ into a sequence of
6798 tokens, which are delimited by characters from the string <tt/s2/. The first call
6799 to <tt/strtok()/ will return a pointer to the first token in the string <tt/s1/.
6800 The following calls must pass a <tt/NULL/ pointer as <tt/s1/, in order to get
6801 the next token in the string. Different sets of delimiters may be used for the
6802 subsequent calls to <tt/strtok()/.
6803 <tag/Notes/<itemize>
6804 <item>The function is only available as fastcall function, so it may only
6805 be used in presence of a prototype.
6806 <item><tt/strtok()/ will modify the string <tt/s1/.
6807 <item>The function will forget where it is in the <tt/s1/ string if it is given
6808 a second <tt/s1/ string before it finishes the first one.
6810 <tag/Availability/ISO 9899
6812 <ref id="strcspn" name="strcspn">,
6813 <!-- <ref id="strpbrk" name="strpbrk">, -->
6814 <ref id="strqtok" name="strqtok">,
6815 <ref id="strspn" name="strspn">
6821 <sect1>strxfrm<label id="strxfrm"><p>
6825 <tag/Function/Transform a string.
6826 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6827 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
6828 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
6829 s2 and places the resulting string into the string pointed to by s1. The
6830 transformation is such that if the <tt/strcmp/ function is applied to two
6831 transformed strings, it returns a value greater than, equal to, or less than
6832 zero, corresponding to the result of the <tt/strcoll/ function applied to the
6833 same two original strings. No more than n characters are placed into the
6834 resulting array pointed to by s1, including the terminating null character.
6835 <tag/Notes/<itemize>
6836 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
6837 the behaviour is undefined.
6838 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
6839 <item>The function is only available as fastcall function, so it may only
6840 be used in presence of a prototype.
6841 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
6842 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
6844 <tag/Availability/ISO 9899
6846 <ref id="strcmp" name="strcmp">,
6847 <ref id="strcoll" name="strcoll">,
6848 <ref id="strncpy" name="strncpy">
6854 <sect1>strupper<label id="strupper"><p>
6858 <tag/Function/Make a string upper case.
6859 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6860 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
6861 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
6862 function to each character of a string. The function will always return <tt/s/.
6863 <tag/Notes/<itemize>
6864 <item>The function is only available as fastcall function, so it may only
6865 be used in presence of a prototype.
6866 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6867 <item>An alias name for this function is <tt/strupr/.
6869 <tag/Availability/cc65
6871 <ref id="strlower" name="strlower">
6872 <ref id="toupper" name="toupper">
6878 <sect1>strupr<label id="strupr"><p>
6885 <sect1>telldir<label id="telldir"><p>
6889 <tag/Function/Return the current position of a directory stream.
6890 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
6891 <tag/Declaration/<tt/long __fastcall__ telldir (DIR* dir);/
6892 <tag/Description/<tt/telldir/ returns the current position of a directory
6893 stream. The return value may be used in subsequent calls to
6894 <tt/<ref id="seekdir" name="seekdir">/.
6895 <tag/Notes/<itemize>
6896 <item>The function is only available as fastcall function, so it may only
6897 be used in presence of a prototype.
6899 <tag/Availability/POSIX 1003.1
6901 <ref id="seekdir" name="seekdir">,
6902 <ref id="telldir" name="telldir">
6908 <sect1>textcolor<label id="textcolor"><p>
6912 <tag/Function/Set the text color.
6913 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6914 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
6915 <tag/Description/The function will set a new text color. It returns the old
6916 (current) text color. Text output using any <tt/conio.h/ function will use
6917 the color set by this function.
6918 <tag/Notes/<itemize>
6919 <item>Text colors are system dependent. The function may have no effect
6920 on systems where the text color cannot be changed.
6921 <item>The function is only available as fastcall function, so it may only
6922 be used in presence of a prototype.
6924 <tag/Availability/cc65
6926 <ref id="bgcolor" name="bgcolor">,
6927 <ref id="bordercolor" name="bordercolor">
6933 <sect1>time<label id="time"><p>
6937 <tag/Function/Get the time.
6938 <tag/Header/<tt/<ref id="time.h" name="time.h">/
6939 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
6940 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
6941 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
6942 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
6943 returned and <tt/errno/ is set to <tt/ENOSYS/.
6944 <tag/Notes/<itemize>
6945 <item>The function is only available as fastcall function, so it may
6946 only be used in presence of a prototype.
6947 <item>Many platforms supported by cc65 do not have a realtime clock, so the
6948 returned value may not be valid.
6950 <tag/Availability/ISO 9899
6952 <ref id="clock" name="clock">
6958 <sect1>toggle_videomode<label id="toggle_videomode"><p>
6962 <tag/Function/Toggle between 40 and 80 column mode.
6963 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
6964 <tag/Declaration/<tt/void toggle_videomode (void);/
6965 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
6966 old mode (cursor position, color and so on) are saved and restored together
6968 <tag/Notes/<itemize>
6969 <item>The function is specific to the C128.
6970 <item>This function is deprecated. Please use <ref id="videomode"
6971 name="videomode"> instead!
6973 <tag/Availability/C128
6975 <ref id="fast" name="fast">,
6976 <ref id="isfast" name="isfast">,
6977 <ref id="slow" name="slow">,
6978 <ref id="videomode" name="videomode">
6984 <sect1>tolower<label id="tolower"><p>
6988 <tag/Function/Convert a character into its lower case representation.
6989 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
6990 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
6991 <tag/Description/The function returns the given character converted to lower
6992 case. If the given character is not a letter, it is returned unchanged.
6993 <tag/Notes/<itemize>
6994 <item>The function is only available as fastcall function, so it may
6995 only be used in presence of a prototype.
6997 <tag/Availability/ISO 9899
6999 <ref id="islower" name="islower">,
7000 <ref id="isupper" name="isupper">,
7001 <ref id="toupper" name="toupper">
7007 <sect1>toupper<label id="toupper"><p>
7011 <tag/Function/Convert a character into its upper case representation.
7012 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7013 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
7014 <tag/Description/The function returns the given character converted to upper
7015 case. If the given character is not a letter, it is returned unchanged.
7016 <tag/Notes/<itemize>
7017 <item>The function is only available as fastcall function, so it may
7018 only be used in presence of a prototype.
7020 <tag/Availability/ISO 9899
7022 <ref id="islower" name="islower">,
7023 <ref id="isupper" name="isupper">,
7024 <ref id="tolower" name="tolower">
7030 <sect1>ultoa<label id="ultoa"><p>
7034 <tag/Function/Convert an unsigned long integer into a string.
7035 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7036 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
7037 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
7038 string using <tt/radix/ as the base.
7039 <tag/Notes/<itemize>
7040 <item>There are no provisions to prevent a buffer overflow.
7041 <item>The function is non standard, so it is not available in strict ANSI mode.
7042 You should probably use <tt/sprintf/ instead.
7043 <item>The function is only available as fastcall function, so it may only be
7044 used in presence of a prototype.
7046 <tag/Availability/cc65
7048 <ref id="atoi" name="atoi">,
7049 <ref id="atol" name="atol">,
7050 <ref id="itoa" name="itoa">,
7051 <ref id="ltoa" name="ltoa">,
7052 <ref id="utoa" name="utoa">
7058 <sect1>unlink<label id="unlink"><p>
7062 <tag/Function/Delete a file.
7063 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
7064 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
7065 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
7066 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
7067 code describing the reason for the failure.
7068 <tag/Notes/<itemize>
7069 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
7070 name="remove">/ instead, which is a native ANSI C function and does the same.
7071 <item>This function is not available on all cc65 targets (depends on the
7072 availability of file I/O).
7073 <item>The function is only available as fastcall function, so it may only
7074 be used in presence of a prototype.
7075 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
7076 used, which has the same semantics, but is more portable, because it conforms
7077 to the ISO C standard.
7079 <tag/Availability/POSIX 1003.1
7081 <ref id="remove" name="remove">
7084 #include <stdio.h>
7085 #include <unistd.h>
7087 #define FILENAME "helloworld"
7089 if (unlink (FILENAME) == 0) {
7090 printf ("We deleted %s successfully\n", FILENAME);
7092 printf ("There was a problem deleting %s\n", FILENAME);
7099 <sect1>utoa<label id="utoa"><p>
7103 <tag/Function/Convert an unsigned integer into a string.
7104 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7105 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
7106 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
7107 using <tt/radix/ as the base.
7108 <tag/Notes/<itemize>
7109 <item>There are no provisions to prevent a buffer overflow.
7110 <item>The function is non standard, so it is not available in strict ANSI mode.
7111 You should probably use <tt/sprintf/ instead.
7112 <item>The function is only available as fastcall function, so it may only be
7113 used in presence of a prototype.
7115 <tag/Availability/cc65
7117 <ref id="atoi" name="atoi">,
7118 <ref id="atol" name="atol">,
7119 <ref id="itoa" name="itoa">,
7120 <ref id="ltoa" name="ltoa">,
7121 <ref id="ultoa" name="ultoa">
7127 <sect1>vcprintf<label id="vcprintf"><p>
7131 <tag/Function/Formatted output to the console.
7132 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7133 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
7134 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
7135 text where necessary and formatted according to the format string given. The
7136 resulting string is output to the console. <tt/vcprintf/ supports the same
7137 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
7138 <tag/Notes/<itemize>
7139 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
7140 between <tt/\r/ and <tt/\n/.
7141 <item>The function is only available as fastcall function, so it may only be
7142 used in presence of a prototype.
7144 <tag/Availability/cc65
7146 <ref id="cprintf" name="cprintf">,
7147 <ref id="cputc" name="cputc">,
7148 <ref id="cputcxy" name="cputcxy">,
7149 <ref id="cputs" name="cputs">,
7150 <ref id="cputsxy" name="cputsxy">
7156 <sect1>videomode<label id="videomode"><p>
7160 <tag/Function/Switch to either 40 or 80 column mode.
7161 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
7162 <ref id="c128.h" name="c128.h">/
7163 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
7164 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
7165 the requested mode is already active, nothing happens. The old mode is returned
7167 <tag/Notes/<itemize>
7168 <item>The function is specific to the C128 and enhanced Apple //e.
7169 <item>This function replaces <ref id="toggle_videomode"
7170 name="toggle_videomode">.
7171 <item>The function is only available as fastcall function, so it may only be
7172 used in presence of a prototype.
7174 <tag/Availability/C128 and enhanced Apple //e
7176 <ref id="fast" name="fast">,
7177 <ref id="isfast" name="isfast">,
7178 <ref id="slow" name="slow">,
7179 <ref id="toggle_videomode" name="toggle_videomode">
7185 <sect1>waitvsync<label id="waitvsync"><p>
7189 <tag/Function/Wait until the start of the next frame.
7191 <tt/<ref id="cbm.h" name="cbm.h">/,
7192 <tt/<ref id="gamate.h" name="gamate.h">/,
7193 <tt/<ref id="nes.h" name="nes.h">/,
7194 <tt/<ref id="pce.h" name="pce.h">/
7195 <tag/Declaration/<tt/void waitvsync (void);/
7196 <tag/Description/Wait for vertical sync to reduce flickering.
7197 <tag/Availability/Platforms above
7203 <sect1>wherex<label id="wherex"><p>
7207 <tag/Function/Return the current X position of the text mode cursor.
7208 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7209 <tag/Declaration/<tt/unsigned char wherex (void);/
7210 <tag/Description/The function returns the current X position of the text mode
7211 cursor. Zero is returned for the leftmost screen position.
7212 <tag/Availability/cc65
7214 <ref id="gotox" name="gotox">,
7215 <ref id="gotoy" name="gotoy">,
7216 <ref id="gotoxy" name="gotoxy">,
7217 <ref id="wherey" name="wherey">
7223 <sect1>wherey<label id="wherey"><p>
7227 <tag/Function/Return the current Y position of the text mode cursor.
7228 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7229 <tag/Declaration/<tt/unsigned char wherey (void);/
7230 <tag/Description/The function returns the current Y position of the text mode
7231 cursor. Zero is returned for the uppermost screen position.
7232 <tag/Availability/cc65
7234 <ref id="gotox" name="gotox">,
7235 <ref id="gotoy" name="gotoy">,
7236 <ref id="gotoxy" name="gotoxy">,
7237 <ref id="wherex" name="wherex">