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/apple2.h/<label id="apple2.h"><p>
72 <item><ref id="get_ostype" name="get_ostype">
77 <sect1><tt/apple2enh.h/<label id="apple2enh.h"><p>
81 <item><ref id="get_ostype" name="get_ostype">
85 <item><ref id="videomode" name="videomode">
89 <sect1><tt/assert.h/<label id="assert.h"><p>
92 <item><ref id="assert" name="assert">
96 <sect1><tt/atari.h/<label id="atari.h"><p>
99 <!-- <item><ref id="_getcolor" name="_getcolor"> -->
100 <!-- <item><ref id="_getdefdev" name="_getdefdev"> -->
101 <!-- <item><ref id="_graphics" name="_graphics"> -->
102 <item><ref id="_is_cmdline_dos" name="_is_cmdline_dos">
103 <!-- <item><ref id="_rest_vecs" name="_rest_vecs"> -->
104 <!-- <item><ref id="_save_vecs" name="_save_vecs"> -->
105 <!-- <item><ref id="_scroll" name="_scroll"> -->
106 <!-- <item><ref id="_setcolor" name="_setcolor"> -->
107 <!-- <item><ref id="_setcolor_low" name="_setcolor_low"> -->
108 <item><ref id="get_ostype" name="get_ostype">
109 <!-- <item><ref id="get_tv" name="get_tv"> -->
115 <sect1><tt/atmos.h/<label id="atmos.h"><p>
118 <item><ref id="atmos_load" name="atmos_load">
119 <item><ref id="atmos_save" name="atmos_save">
120 <!-- <item><ref id="atmos_explode" name="atmos_explode"> -->
121 <!-- <item><ref id="atmos_ping" name="atmos_ping"> -->
122 <!-- <item><ref id="atmos_shoot" name="atmos_shoot"> -->
123 <!-- <item><ref id="atmos_tick" name="atmos_tick"> -->
124 <!-- <item><ref id="atmos_tock" name="atmos_tock"> -->
125 <!-- <item><ref id="atmos_zap" name="atmos_zap"> -->
131 <sect1><tt/c128.h/<label id="c128.h"><p>
134 <item><ref id="c64mode" name="c64mode">
135 <item><ref id="fast" name="fast">
136 <item><ref id="slow" name="slow">
137 <item><ref id="toggle_videomode" name="toggle_videomode">
138 <item><ref id="videomode" name="videomode">
142 <sect1><tt/c16.h/<label id="c16.h"><p>
147 <sect1><tt/c64.h/<label id="c64.h"><p>
150 <item><ref id="get_ostype" name="get_ostype">
154 <sect1><tt/cbm.h/<label id="cbm.h"><p>
157 <item><ref id="cbm_k_acptr" name="cbm_k_acptr">
158 <item><ref id="cbm_k_basin" name="cbm_k_basin">
159 <item><ref id="cbm_k_bsout" name="cbm_k_bsout">
160 <item><ref id="cbm_k_chkin" name="cbm_k_chkin">
161 <item><ref id="cbm_k_ciout" name="cbm_k_ciout">
162 <item><ref id="cbm_k_ckout" name="cbm_k_ckout">
163 <item><ref id="cbm_k_clall" name="cbm_k_clall">
164 <item><ref id="cbm_k_close" name="cbm_k_close">
165 <item><ref id="cbm_k_clrch" name="cbm_k_clrch">
166 <item><ref id="cbm_k_getin" name="cbm_k_getin">
167 <item><ref id="cbm_k_iobase" name="cbm_k_iobase">
168 <item><ref id="cbm_k_listen" name="cbm_k_listen">
169 <item><ref id="cbm_k_load" name="cbm_k_load">
170 <item><ref id="cbm_k_open" name="cbm_k_open">
171 <item><ref id="cbm_k_readst" name="cbm_k_readst">
172 <item><ref id="cbm_k_save" name="cbm_k_save">
173 <item><ref id="cbm_k_scnkey" name="cbm_k_scnkey">
174 <item><ref id="cbm_k_setlfs" name="cbm_k_setlfs">
175 <item><ref id="cbm_k_setnam" name="cbm_k_setnam">
176 <item><ref id="cbm_k_talk" name="cbm_k_talk">
177 <item><ref id="cbm_k_udtim" name="cbm_k_udtim">
178 <item><ref id="cbm_k_unlsn" name="cbm_k_unlsn">
179 <!-- <item><ref id="cbm_load" name="cbm_load"> -->
180 <!-- <item><ref id="cbm_open" name="cbm_open"> -->
181 <!-- <item><ref id="cbm_opendir" name="cbm_opendir"> -->
182 <!-- <item><ref id="cbm_read" name="cbm_read"> -->
183 <!-- <item><ref id="cbm_readdir" name="cbm_readdir"> -->
184 <!-- <item><ref id="cbm_save" name="cbm_save"> -->
185 <!-- <item><ref id="cbm_write" name="cbm_write"> -->
186 <!-- <item><ref id="get_tv" name="get_tv"> -->
187 <item><ref id="waitvsync" name="waitvsync">
188 <item><ref id="kbrepeat" name="kbrepeat">
194 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
197 <item><ref id="peekbsys" name="peekbsys">
198 <item><ref id="peekwsys" name="peekwsys">
199 <item><ref id="pokebsys" name="pokebsys">
200 <item><ref id="pokewsys" name="pokewsys">
204 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
207 <item><ref id="peekbsys" name="peekbsys">
208 <item><ref id="peekwsys" name="peekwsys">
209 <item><ref id="pokebsys" name="pokebsys">
210 <item><ref id="pokewsys" name="pokewsys">
214 <sect1><tt/cc65.h/<label id="cc65.h"><p>
217 <!-- <item><ref id="cc65_cos" name="cc65_cos"> -->
218 <!-- <item><ref id="cc65_idiv32by16r16" name="cc65_idiv32by16r16"> -->
219 <!-- <item><ref id="cc65_imul16x16r32" name="cc65_imul16x16r32"> -->
220 <!-- <item><ref id="cc65_imul8x8r16" name="cc65_imul8x8r16"> -->
221 <!-- <item><ref id="cc65_sin" name="cc65_sin"> -->
222 <!-- <item><ref id="cc65_udiv32by16r16" name="cc65_udiv32by16r16"> -->
223 <!-- <item><ref id="cc65_umul16x16r32" name="cc65_umul16x16r32"> -->
224 <!-- <item><ref id="cc65_umul16x8r32" name="cc65_umul16x8r32"> -->
225 <!-- <item><ref id="cc65_umul8x8r16" name="cc65_umul8x8r16"> -->
226 <item><ref id="doesclrscrafterexit" name="doesclrscrafterexit">
232 <sect1><tt/conio.h/<label id="conio.h"><p>
235 <item><ref id="bgcolor" name="bgcolor">
236 <item><ref id="bordercolor" name="bordercolor">
237 <item><ref id="cclear" name="cclear">
238 <item><ref id="cclearxy" name="cclearxy">
239 <item><ref id="cgetc" name="cgetc">
240 <item><ref id="chline" name="chline">
241 <item><ref id="chlinexy" name="chlinexy">
242 <item><ref id="clrscr" name="clrscr">
243 <item><ref id="cprintf" name="cprintf">
244 <item><ref id="cputc" name="cputc">
245 <item><ref id="cputcxy" name="cputcxy">
246 <item><ref id="cputs" name="cputs">
247 <item><ref id="cputsxy" name="cputsxy">
248 <item><ref id="cursor" name="cursor">
249 <item><ref id="cvline" name="cvline">
250 <item><ref id="cvlinexy" name="cvlinexy">
251 <item><ref id="gotox" name="gotox">
252 <item><ref id="gotoxy" name="gotoxy">
253 <item><ref id="gotoy" name="gotoy">
254 <item><ref id="kbhit" name="kbhit">
255 <item><ref id="revers" name="revers">
256 <item><ref id="screensize" name="screensize">
257 <item><ref id="textcolor" name="textcolor">
258 <item><ref id="vcprintf" name="vcprintf">
259 <item><ref id="wherex" name="wherex">
260 <item><ref id="wherey" name="wherey">
264 <sect1><tt/ctype.h/<label id="ctype.h"><p>
267 <item><ref id="isalnum" name="isalnum">
268 <item><ref id="isalpha" name="isalpha">
269 <item><ref id="isascii" name="isascii">
270 <item><ref id="isblank" name="isblank">
271 <item><ref id="iscntrl" name="iscntrl">
272 <item><ref id="isdigit" name="isdigit">
273 <item><ref id="isgraph" name="isgraph">
274 <item><ref id="islower" name="islower">
275 <item><ref id="isprint" name="isprint">
276 <item><ref id="ispunct" name="ispunct">
277 <item><ref id="isspace" name="isspace">
278 <item><ref id="isupper" name="isupper">
279 <item><ref id="isxdigit" name="isxdigit">
280 <item><ref id="tolower" name="tolower">
281 <item><ref id="toupper" name="toupper">
285 <sect1><tt/dbg.h/<label id="dbg.h"><p>
288 <!-- <item><ref id="DbgInit" name="DbgInit"> -->
294 <sect1><tt/dio.h/<label id="dio.h"><p>
296 <url url="dio.html" name="Low-level disk I/O API">.
299 <sect1><tt/dirent.h/<label id="dirent.h"><p>
302 <item><ref id="_DE_ISDIR" name="_DE_ISDIR">
303 <item><ref id="_DE_ISLBL" name="_DE_ISLBL">
304 <item><ref id="_DE_ISLNK" name="_DE_ISLNK">
305 <item><ref id="_DE_ISREG" name="_DE_ISREG">
306 <item><ref id="closedir" name="closedir">
307 <item><ref id="opendir" name="opendir">
308 <item><ref id="readdir" name="readdir">
309 <item><ref id="rewinddir" name="rewinddir">
310 <item><ref id="seekdir" name="seekdir">
311 <item><ref id="telldir" name="telldir">
317 <sect1><tt/em.h/<label id="em.h"><p>
320 <item><ref id="em_commit" name="em_commit">
321 <item><ref id="em_copyfrom" name="em_copyfrom">
322 <item><ref id="em_copyto" name="em_copyto">
323 <item><ref id="em_install" name="em_install">
324 <item><ref id="em_load_driver" name="em_load_driver">
325 <item><ref id="em_map" name="em_map">
326 <item><ref id="em_pagecount" name="em_pagecount">
327 <item><ref id="em_uninstall" name="em_uninstall">
328 <item><ref id="em_unload" name="em_unload">
329 <item><ref id="em_use" name="em_use">
333 <sect1><tt/errno.h/<label id="errno.h"><p>
336 <!-- <item><ref id="_directerrno" name="_directerrno"> -->
337 <!-- <item><ref id="_mappederrno" name="_mappederrno"> -->
338 <!-- <item><ref id="_osmaperrno" name="_osmaperrno"> -->
339 <!-- <item><ref id="_seterrno" name="_seterrno"> -->
345 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
348 <item><ref id="close" name="close">
349 <item><ref id="creat" name="creat">
350 <item><ref id="open" name="open">
354 <sect1><tt/gamate.h/<label id="gamate.h"><p>
357 <!-- <item><ref id="get_tv" name="get_tv"> -->
358 <item><ref id="waitvsync" name="waitvsync">
364 <sect1><tt/geos.h/<label id="geos.h"><p>
366 <url url="geos.html" name="GEOS API">.
369 <sect1><tt/joystick.h/<label id="joystick.h"><p>
372 <item><ref id="joy_count" name="joy_count">
373 <item><ref id="joy_install" name="joy_install">
374 <item><ref id="joy_load_driver" name="joy_load_driver">
375 <item><ref id="joy_read" name="joy_read">
376 <item><ref id="joy_uninstall" name="joy_uninstall">
377 <item><ref id="joy_unload" name="joy_unload">
381 <sect1><tt/locale.h/<label id="locale.h"><p>
384 <item><ref id="localeconv" name="localeconv">
385 <item><ref id="setlocale" name="setlocale">
389 <sect1><tt/lynx.h/<label id="lynx.h"><p>
392 <!-- <item><ref id="lynx_eeprom_erase" name="lynx_eeprom_erase"> -->
393 <!-- <item><ref id="lynx_eeprom_read" name="lynx_eeprom_read"> -->
394 <!-- <item><ref id="lynx_eeprom_write" name="lynx_eeprom_write"> -->
395 <!-- <item><ref id="lynx_eeread" name="lynx_eeread"> -->
396 <!-- <item><ref id="lynx_eewrite" name="lynx_eewrite"> -->
397 <!-- <item><ref id="lynx_exec" name="lynx_exec"> -->
398 <!-- <item><ref id="lynx_load" name="lynx_load"> -->
404 <sect1><tt/lz4.h/<label id="lz4.h"><p>
407 <item><ref id="decompress_lz4" name="decompress_lz4">
411 <sect1><tt/modload.h/<label id="modload.h"><p>
414 <item><ref id="mod_load" name="mod_load">
415 <item><ref id="mod_free" name="mod_free">
419 <sect1><tt/mouse.h/<label id="mouse.h"><p>
422 <item><ref id="mouse_buttons" name="mouse_buttons">
423 <item><ref id="mouse_getbox" name="mouse_getbox">
424 <item><ref id="mouse_geterrormsg" name="mouse_geterrormsg">
425 <item><ref id="mouse_hide" name="mouse_hide">
426 <item><ref id="mouse_info" name="mouse_info">
427 <item><ref id="mouse_install" name="mouse_install">
428 <item><ref id="mouse_ioctl" name="mouse_ioctl">
429 <item><ref id="mouse_load_driver" name="mouse_load_driver">
430 <item><ref id="mouse_move" name="mouse_move">
431 <item><ref id="mouse_pos" name="mouse_pos">
432 <item><ref id="mouse_setbox" name="mouse_setbox">
433 <item><ref id="mouse_show" name="mouse_show">
434 <item><ref id="mouse_uninstall" name="mouse_uninstall">
435 <item><ref id="mouse_unload" name="mouse_unload">
439 <sect1><tt/nes.h/<label id="nes.h"><p>
442 <!-- <item><ref id="get_tv" name="get_tv"> -->
443 <item><ref id="waitvsync" name="waitvsync">
449 <sect1><tt/o65.h/<label id="o65.h"><p>
451 The <tt/o65.h/ header file contains structure and constant definitions that
452 may be used when dealing with files in <url
453 url="http://www.6502.org/users/andre/o65/fileformat.html" name="the o65 format">.
454 It does not declare any functions.
457 <sect1><tt/pce.h/<label id="pce.h"><p>
460 <!-- <item><ref id="get_tv" name="get_tv"> -->
461 <item><ref id="waitvsync" name="waitvsync">
467 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
470 <item><ref id="PEEK" name="PEEK">
471 <item><ref id="PEEKW" name="PEEKW">
472 <item><ref id="POKE" name="POKE">
473 <item><ref id="POKEW" name="POKEW">
477 <sect1><tt/pen.h/<label id="pen.h"><p>
480 <!-- <item><ref id="pen_adjust" name="pen_adjust"> -->
481 <!-- <item><ref id="pen_calibrate" name="pen_calibrate"> -->
487 <sect1><tt/pet.h/<label id="pet.h"><p>
492 <sect1><tt/plus4.h/<label id="plus4.h"><p>
497 <sect1><tt/serial.h/<label id="serial.h"><p>
499 The <tt/serial.h/ header file contains definitions for initializing serial
503 <item><ref id="ser_close" name="ser_close">
504 <item><ref id="ser_get" name="ser_get">
505 <item><ref id="ser_install" name="ser_install">
506 <item><ref id="ser_ioctl" name="ser_ioctl">
507 <item><ref id="ser_load_driver" name="ser_load_driver">
508 <item><ref id="ser_open" name="ser_open">
509 <item><ref id="ser_put" name="ser_put">
510 <item><ref id="ser_status" name="ser_status">
511 <item><ref id="ser_uninstall" name="ser_uninstall">
512 <item><ref id="ser_unload" name="ser_unload">
516 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
519 <item><ref id="setjmp" name="setjmp">
520 <item><ref id="longjmp" name="longjmp">
524 <sect1><tt/signal.h/<label id="signal.h"><p>
527 <item><ref id="raise" name="raise">
528 <item><ref id="signal" name="signal">
532 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
537 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
542 <sect1><tt/stddef.h/<label id="stddef.h"><p>
545 <item><ref id="offsetof" name="offsetof">
549 <sect1><tt/stdio.h/<label id="stdio.h"><p>
552 <item><ref id="_poserror" name="_poserror">
553 <item><ref id="clearerr" name="clearerr">
554 <!-- <item><ref id="fclose" name="fclose"> -->
555 <!-- <item><ref id="fdopen" name="fdopen"> -->
556 <item><ref id="feof" name="feof">
557 <item><ref id="ferror" name="ferror">
558 <!-- <item><ref id="fflush" name="fflush"> -->
559 <!-- <item><ref id="fgetc" name="fgetc"> -->
560 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
561 <!-- <item><ref id="fgets" name="fgets"> -->
562 <item><ref id="fileno" name="fileno">
563 <!-- <item><ref id="fopen" name="fopen"> -->
564 <!-- <item><ref id="fprintf" name="fprintf"> -->
565 <!-- <item><ref id="fputc" name="fputc"> -->
566 <!-- <item><ref id="fputs" name="fputs"> -->
567 <!-- <item><ref id="fread" name="fread"> -->
568 <!-- <item><ref id="freopen" name="freopen"> -->
569 <!-- <item><ref id="fscanf" name="fscanf"> -->
570 <!-- <item><ref id="fseek" name="fseek"> -->
571 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
572 <!-- <item><ref id="ftell" name="ftell"> -->
573 <!-- <item><ref id="fwrite" name="fwrite"> -->
574 <!-- <item><ref id="getc" name="getc"> -->
575 <!-- <item><ref id="getchar" name="getchar"> -->
576 <!-- <item><ref id="gets" name="gets"> -->
577 <!-- <item><ref id="printf" name="printf"> -->
578 <!-- <item><ref id="putc" name="putc"> -->
579 <!-- <item><ref id="putchar" name="putchar"> -->
580 <!-- <item><ref id="puts" name="puts"> -->
581 <item><ref id="rename" name="rename">
582 <item><ref id="remove" name="remove">
583 <!-- <item><ref id="rewind" name="rewind"> -->
584 <!-- <item><ref id="scanf" name="scanf"> -->
585 <!-- <item><ref id="snprintf" name="snprintf"> -->
586 <!-- <item><ref id="sprintf" name="sprintf"> -->
587 <!-- <item><ref id="sscanf" name="sscanf"> -->
588 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
589 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
590 <!-- <item><ref id="vprintf" name="vprintf"> -->
591 <!-- <item><ref id="vscanf" name="vscanf"> -->
592 <!-- <item><ref id="vsnprintf" name="vsnprintf"> -->
593 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
594 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
600 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
603 <item><ref id="_heapadd" name="_heapadd">
604 <item><ref id="_heapblocksize" name="_heapblocksize">
605 <item><ref id="_heapmaxavail" name="_heapmaxavail">
606 <item><ref id="_heapmemavail" name="_heapmemavail">
607 <item><ref id="_randomize" name="_randomize">
608 <item><ref id="_swap" name="_swap">
609 <item><ref id="abort" name="abort">
610 <item><ref id="abs" name="abs">
611 <item><ref id="atexit" name="atexit">
612 <item><ref id="atoi" name="atoi">
613 <item><ref id="atol" name="atol">
614 <item><ref id="bsearch" name="bsearch">
615 <item><ref id="calloc" name="calloc">
616 <item><ref id="div" name="div">
617 <item><ref id="exit" name="exit">
618 <item><ref id="free" name="free">
619 <item><ref id="getenv" name="getenv">
620 <item><ref id="itoa" name="itoa">
621 <item><ref id="labs" name="labs">
622 <item><ref id="ltoa" name="ltoa">
623 <item><ref id="malloc" name="malloc">
624 <item><ref id="perror" name="perror">
625 <!-- <item><ref id="posix_memalign" name="posix_memalign"> -->
626 <!-- <item><ref id="putenv" name="putenv"> -->
627 <item><ref id="qsort" name="qsort">
628 <item><ref id="rand" name="rand">
629 <item><ref id="realloc" name="realloc">
630 <item><ref id="srand" name="srand">
631 <!-- <item><ref id="system" name="system"> -->
632 <item><ref id="ultoa" name="ultoa">
633 <item><ref id="utoa" name="utoa">
639 <sect1><tt/string.h/<label id="string.h"><p>
642 <item><ref id="_stroserror" name="_stroserror">
643 <item><ref id="bzero" name="bzero">
644 <item><ref id="memchr" name="memchr">
645 <item><ref id="memcmp" name="memcmp">
646 <item><ref id="memcpy" name="memcpy">
647 <item><ref id="memmove" name="memmove">
648 <item><ref id="memset" name="memset">
649 <item><ref id="strcasecmp" name="strcasecmp">
650 <item><ref id="strcat" name="strcat">
651 <item><ref id="strchr" name="strchr">
652 <item><ref id="strcmp" name="strcmp">
653 <item><ref id="strcoll" name="strcoll">
654 <item><ref id="strcpy" name="strcpy">
655 <item><ref id="strcspn" name="strcspn">
656 <item><ref id="strdup" name="strdup">
657 <item><ref id="strerror" name="strerror">
658 <item><ref id="stricmp" name="stricmp">
659 <item><ref id="strlen" name="strlen">
660 <item><ref id="strlower" name="strlower">
661 <item><ref id="strlwr" name="strlwr">
662 <item><ref id="strncat" name="strncat">
663 <item><ref id="strncmp" name="strncmp">
664 <item><ref id="strncpy" name="strncpy">
665 <item><ref id="strqtok" name="strqtok">
666 <item><ref id="strrchr" name="strrchr">
667 <item><ref id="strspn" name="strspn">
668 <item><ref id="strstr" name="strstr">
669 <item><ref id="strtok" name="strtok">
670 <item><ref id="strxfrm" name="strxfrm">
671 <item><ref id="strupper" name="strupper">
672 <item><ref id="strupr" name="strupr">
678 <sect1><tt/tgi.h/<label id="tgi.h"><p>
680 <url url="tgi.html" name="Tiny Graphics Interface">.
683 <sect1><tt/time.h/<label id="time.h"><p>
686 <!-- <item><ref id="_systime" name="_systime"> -->
687 <!-- <item><ref id="asctime" name="asctime"> -->
688 <item><ref id="clock" name="clock">
689 <!-- <item><ref id="ctime" name="ctime"> -->
690 <!-- <item><ref id="gmtime" name="gmtime"> -->
691 <!-- <item><ref id="localtime" name="localtime"> -->
692 <!-- <item><ref id="mktime" name="mktime"> -->
693 <!-- <item><ref id="strftime" name="strftime"> -->
694 <item><ref id="time" name="time">
700 <sect1><tt/unistd.h/<label id="unistd.h"><p>
703 <!-- <item><ref id="chdir" name="chdir"> -->
704 <item><ref id="exec" name="exec">
705 <!-- <item><ref id="getcwd" name="getcwd"> -->
706 <item><ref id="getopt" name="getopt">
707 <!-- <item><ref id="lseek" name="lseek"> -->
708 <!-- <item><ref id="mkdir" name="mkdir"> -->
709 <!-- <item><ref id="read" name="read"> -->
710 <!-- <item><ref id="rmdir" name="rmdir"> -->
711 <item><ref id="sleep" name="sleep">
712 <item><ref id="unlink" name="unlink">
713 <!-- <item><ref id="write" name="write"> -->
719 <sect1><tt/vic20.h/<label id="vic20.h"><p>
724 <sect1><tt/zlib.h/<label id="zlib.h"><p>
727 <!-- <item><ref id="adler32" name="adler32"> -->
728 <!-- <item><ref id="crc32" name="crc32"> -->
729 <!-- <item><ref id="inflatemem" name="inflatemem"> -->
730 <!-- <item><ref id="uncompress" name="uncompress"> -->
736 <sect>Alphabetical function reference<p>
738 <sect1>_DE_ISDIR<label id="_DE_ISDIR"><p>
742 <tag/Function/Determine if a directory entry specifies a directory.
743 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
744 <tag/Declaration/<tt/int _DE_ISDIR(unsigned char type);/
745 <tag/Description/The function is called with the type of a directory entry
746 taken from a <tt/struct dirent/ and returns true if the entry designates
749 <item>The function is actually a macro.
751 <tag/Availability/cc65
753 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
754 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
755 <ref id="_DE_ISREG" name="_DE_ISREG">
761 <sect1>_DE_ISLBL<label id="_DE_ISLBL"><p>
765 <tag/Function/Determine if a directory entry specifies a disk label.
766 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
767 <tag/Declaration/<tt/int _DE_ISLBL(unsigned char type);/
768 <tag/Description/The function is called with the type of a directory entry
769 taken from a <tt/struct dirent/ and returns true if the entry designates
772 <item>The function is actually a macro.
774 <tag/Availability/cc65
776 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
777 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
778 <ref id="_DE_ISREG" name="_DE_ISREG">
784 <sect1>_DE_ISLNK<label id="_DE_ISLNK"><p>
788 <tag/Function/Determine if a directory entry specifies a link.
789 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
790 <tag/Declaration/<tt/int _DE_ISLNK(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_ISDIR" name="_DE_ISDIR">,
800 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
801 <ref id="_DE_ISREG" name="_DE_ISREG">
807 <sect1>_DE_ISREG<label id="_DE_ISREG"><p>
811 <tag/Function/Determine if a directory entry specifies a regular file.
812 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
813 <tag/Declaration/<tt/int _DE_ISREG(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.
819 <item>A "regular file" means anything with data in it. This might still mean
820 that special processing is needed, when accessing the file. Relative files of
821 the CBM systems are classified as being "regular" files, for example.
823 <tag/Availability/cc65
825 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
826 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
827 <ref id="_DE_ISLNK" name="_DE_ISLNK">
833 <sect1>_heapadd<label id="_heapadd"><p>
837 <tag/Function/Add a block to the heap.
838 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
839 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
840 <tag/Description/The function adds a block of raw memory to the heap.
842 <item>The minimum blocksize that can be added is 6 bytes; the function will
843 ignore smaller blocks.
844 <item>The function is available only as a fastcall function; so, it may be used
845 only in the presence of a prototype.
847 <tag/Availability/cc65
849 <ref id="_heapblocksize" name="_heapblocksize">,
850 <ref id="_heapmaxavail" name="_heapmaxavail">,
851 <ref id="_heapmemavail" name="_heapmemavail">,
852 <ref id="calloc" name="calloc">,
853 <ref id="free" name="free">,
854 <ref id="malloc" name="malloc">,
855 <ref id="realloc" name="realloc">
861 <sect1>_heapblocksize<label id="_heapblocksize"><p>
865 <tag/Function/Return the size of an allocated block.
866 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
867 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
868 <tag/Description/The function returns the size of a block that must have
869 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
870 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
872 <item>Passing a pointer to a block that was is not the result of one of the
873 allocation functions, or that has been free'd will give unpredicable results.
874 <item>The function is available only as a fastcall function; so, it may be used
875 only in the presence of a prototype.
877 <tag/Availability/cc65
879 <ref id="_heapadd" name="_heapadd">,
880 <ref id="_heapmaxavail" name="_heapmaxavail">,
881 <ref id="_heapmemavail" name="_heapmemavail">,
882 <ref id="calloc" name="calloc">,
883 <ref id="free" name="free">,
884 <ref id="malloc" name="malloc">,
885 <ref id="realloc" name="realloc">
891 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
895 <tag/Function/Return the largest block that is available on the heap.
896 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
897 <tag/Declaration/<tt/size_t _heapmaxavail (void);/
898 <tag/Description/The function returns the size of the largest block that may
899 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
900 <tag/Availability/cc65
902 <ref id="_heapadd" name="_heapadd">,
903 <ref id="_heapblocksize" name="_heapblocksize">,
904 <ref id="_heapmemavail" name="_heapmemavail">,
905 <ref id="calloc" name="calloc">,
906 <ref id="free" name="free">,
907 <ref id="malloc" name="malloc">,
908 <ref id="realloc" name="realloc">
914 <sect1>_heapmemavail<label id="_heapmemavail"><p>
918 <tag/Function/Return the total available space on the heap.
919 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
920 <tag/Declaration/<tt/size_t _heapmemavail (void);/
921 <tag/Description/The function returns the total number of bytes available on
924 <item>This function is of less use than usually assumed, since the returned
925 heap space may be available but not in one block. So even if this function
926 says that several times more heap space is available than needed, <ref
927 id="malloc" name="malloc"> may still return <tt/NULL/.
929 <tag/Availability/cc65
931 <ref id="_heapadd" name="_heapadd">,
932 <ref id="_heapblocksize" name="_heapblocksize">,
933 <ref id="_heapmaxavail" name="_heapmaxavail">,
934 <ref id="calloc" name="calloc">,
935 <ref id="free" name="free">,
936 <ref id="malloc" name="malloc">,
937 <ref id="realloc" name="realloc">
943 <sect1>_is_cmdline_dos<label id="_is_cmdline_dos"><p>
947 <tag/Function/Determines whether the underlying DOS supports command line arguments.
948 <tag/Header/<tt/<ref id="atari.h" name="atari.h">/
949 <tag/Declaration/<tt/unsigned char _is_cmdline_dos (void);/
950 <tag/Description/The function returns 0 if the DOS doesn't support command line arguments.
951 It returns 1 if it does.
952 <tag/Availability/cc65 (<tt/atari/ and <tt/atarixl/ platforms)
957 <sect1>_poserror<label id="_poserror"><p>
961 <tag/Function/Print an error message for the error in <tt/_oserror/.
962 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
963 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
964 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
965 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
966 a colon and a blank. Then the error message for the current contents of
967 <tt/_oserror/ are printed followed by a newline. The message output is the
968 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
969 argument of <tt/_oserror/.
971 <item>Since operating system specific error code are - you guessed it -
972 operating system specific, the value in <tt/_oserror/ and the message that is
973 printed depends on the cc65 target.
974 <item>The function is only available as fastcall function, so it may only
975 be used in presence of a prototype.
977 <tag/Availability/cc65
979 <ref id="_stroserror" name="_stroserror">,
980 <ref id="perror" name="perror">
986 <sect1>_randomize<label id="_randomize"><p>
990 <tag/Function/Initialize the pseudo random number generator.
991 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
992 <tag/Declaration/<tt/void _randomize (void);/
993 <tag/Description/The function initializes the random number generator with
994 a seed derived from fast changing hardware events, so the seed itself can be
995 considered random to a certain degree.
997 <item>The randomness of the seed depends on the machine hardware.
999 <tag/Availability/cc65
1001 <ref id="rand" name="rand">,
1002 <ref id="srand" name="srand">
1008 <sect1>_stroserror<label id="_stroserror"><p>
1012 <tag/Function/Return a string describing an OS specific error code.
1013 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1014 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
1015 <tag/Description/<tt/_stroserror/ will return a string describing the given
1016 operating system specific error code.
1017 <tag/Notes/<itemize>
1018 <item>Since operating system specific error code are - you guessed it -
1019 operating system specific, the parameter and the string returned depend on the
1021 <item>The function is only available as fastcall function, so it may only be
1022 used in presence of a prototype.
1024 <tag/Availability/cc65
1026 <ref id="strerror" name="strerror">
1032 <sect1>_swap<label id="_swap"><p>
1036 <tag/Function/Swap the contents of memory areas.
1037 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1038 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
1039 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
1040 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
1041 <tt/size/ bytes in size.
1042 <tag/Notes/<itemize>
1043 <item>The memory areas may not overlap, otherwise the results are undefined.
1044 <item>The function is only available as fastcall function, so it may only be
1045 used in presence of a prototype.
1047 <tag/Availability/cc65
1049 <ref id="memcpy" name="memcpy">,
1050 <ref id="memmove" name="memmove">
1056 <sect1>_sys<label id="_sys"><p>
1060 <tag/Function/Call a subroutine passing register values.
1061 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1062 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
1063 <tag/Description/The function will call the subroutine at the address
1064 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
1065 registers and the CPU flags are set to the values given in the <tt/regs/
1066 structure. On return from the subroutine, the new values of the registers and
1067 flags are stored back overwriting the old values.
1068 <tag/Notes/<itemize>
1069 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
1070 when calling the subroutine (they are unchanged from their current values).
1071 <item>The function is only available as fastcall function, so it may only be
1072 used in presence of a prototype.
1074 <tag/Availability/cc65
1080 <sect1>BRK<label id="BRK"><p>
1084 <tag/Function/Insert a 6502 BRK instrunction into the code.
1085 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1086 <tag/Declaration/<tt/void BRK (void);/
1087 <tag/Description/The function will insert a 6502 BRK instruction into the code
1088 which may be used to trigger a debugger.
1089 <tag/Notes/<itemize>
1090 <item>The function is actually a macro.
1091 <item>The inserted instruction may lead to unexpected results if no debugger
1094 <tag/Availability/cc65
1096 <ref id="CLI" name="CLI">,
1097 <ref id="SEI" name="SEI">
1103 <sect1>CLI<label id="CLI"><p>
1107 <tag/Function/Insert a 6502 CLI instrunction into the code.
1108 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1109 <tag/Declaration/<tt/void CLI (void);/
1110 <tag/Description/The function will insert a 6502 CLI instruction into the code,
1111 so interrupts are enabled. Enabling interrupts has no effects if they are
1112 already enabled (the default).
1113 <tag/Notes/<itemize>
1114 <item>The function is actually a macro.
1115 <item>Disabling interrupts may lead to unexpected results.
1117 <tag/Availability/cc65
1119 <ref id="BRK" name="BRK">,
1120 <ref id="SEI" name="SEI">
1126 <sect1>PEEK<label id="PEEK"><p>
1130 <tag/Function/Read a byte from memory.
1131 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1132 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
1133 <tag/Description/The function will read the absolute memory given by <tt/addr/
1134 and return the value read.
1135 <tag/Notes/<itemize>
1136 <item>The function is actually a macro.
1137 <item>This function depends highly on the platform and environment.
1139 <tag/Availability/cc65
1141 <ref id="PEEKW" name="PEEKW">,
1142 <ref id="POKE" name="POKE">
1148 <sect1>PEEKW<label id="PEEKW"><p>
1152 <tag/Function/Read a word (two bytes) from memory.
1153 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1154 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
1155 <tag/Description/The function will read the absolute memory given by <tt/addr/
1156 and return the value read. The byte read from the higher address is the high
1157 byte of the return value.
1158 <tag/Notes/<itemize>
1159 <item>The function is actually a macro.
1160 <item>This function depends highly on the platform and environment.
1161 <item>The order in which the two bytes are read is unspecified and may
1162 depend of the address expression used.
1164 <tag/Availability/cc65
1166 <ref id="PEEK" name="PEEK">,
1167 <ref id="POKE" name="POKE">
1173 <sect1>POKE<label id="POKE"><p>
1177 <tag/Function/Write a byte to memory.
1178 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1179 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
1180 <tag/Description/The function writes the value <tt/val/ to the absolute
1181 memory address given by <tt/addr/.
1182 <tag/Notes/<itemize>
1183 <item>The function is actually a macro.
1184 <item>This function depends highly on the platform and environment.
1185 <item>Careless use will cause the program to act strange or may crash the
1188 <tag/Availability/cc65
1190 <ref id="PEEK" name="PEEK">,
1191 <ref id="POKEW" name="POKEW">
1197 <sect1>POKEW<label id="POKEW"><p>
1201 <tag/Function/Write a word (two bytes) to memory.
1202 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1203 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
1204 <tag/Description/The function writes the value <tt/val/ to the absolute
1205 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
1206 the <tt/addr/, the high byte is written to <tt/addr+1/.
1207 <tag/Notes/<itemize>
1208 <item>The function is actually a macro.
1209 <item>This function depends highly on the platform and environment.
1210 <item>Careless use will cause the program to act strange or may crash the
1212 <item>The order in which the two bytes are written is unspecified and may
1213 depend of the address expression used.
1215 <tag/Availability/cc65
1217 <ref id="PEEK" name="PEEK">,
1218 <ref id="POKE" name="POKE">
1224 <sect1>SEI<label id="SEI"><p>
1228 <tag/Function/Insert a 6502 SEI instrunction into the code.
1229 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1230 <tag/Declaration/<tt/void SEI (void);/
1231 <tag/Description/The function will insert a 6502 SEI instruction into the code,
1232 so interrupts are disabled. Note that non maskable interrupts cannot be
1234 <tag/Notes/<itemize>
1235 <item>The function is actually a macro.
1236 <item>Disabling interrupts may lead to unexpected results.
1238 <tag/Availability/cc65
1240 <ref id="BRK" name="BRK">,
1241 <ref id="CLI" name="CLI">
1247 <sect1>abort<label id="abort"><p>
1251 <tag/Function/Terminates a program abnormally.
1252 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1253 <tag/Declaration/<tt/void abort (void);/
1254 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
1255 on stderr, then terminates the program with an exit code of 3.
1256 <tag/Availability/ISO 9899
1258 <ref id="assert" name="assert">,
1259 <ref id="exit" name="exit">,
1260 <ref id="raise" name="raise">
1266 <sect1>abs<label id="abs"><p>
1270 <tag/Function/Returns the absolute value of an integer.
1271 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1272 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
1273 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
1275 <tag/Notes/<itemize>
1276 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
1277 <item>The function is only available as fastcall function, so it may only be
1278 used in presence of a prototype.
1280 <tag/Availability/ISO 9899
1282 <ref id="labs" name="labs">
1288 <sect1>assert<label id="assert"><p>
1292 <tag/Function/Test a condition and possibly abort.
1293 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
1294 <tag/Declaration/<tt/void assert (int cond);/
1295 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
1296 statement. If the condition evaluates t zero (false), assert prints a message
1297 on stderr and aborts the program.
1298 <tag/Notes/<itemize>
1299 <item>The function is actually a macro.
1301 <tag/Availability/ISO 9899
1303 <ref id="abort" name="abort">,
1304 <ref id="exit" name="exit">
1310 <sect1>atexit<label id="atexit"><p>
1314 <tag/Function/Register an exit function.
1315 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1316 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1317 <tag/Description/<tt/atexit/ registers the function pointed to by
1318 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1319 terminates, they are called in LIFO order (the last function registered is
1320 called first). <tt/atexit/ returns zero on success and a nonzero value on
1322 <tag/Notes/<itemize>
1323 <item>A maximum of 5 exit functions can be registered.
1324 <item>There is no way to unregister an exit function.
1325 <item>The function is only available as fastcall function, so it may only be
1326 used in presence of a prototype.
1328 <tag/Availability/ISO 9899
1330 <ref id="abort" name="abort">,
1331 <ref id="exit" name="exit">
1337 <sect1>atmos_load<label id="atmos_load"><p>
1341 <tag/Function/Load Atmos tape.
1342 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1343 <tag/Declaration/<tt/void __fastcall__ atmos_load(const char* name);/
1344 <tag/Description/<tt/atmos_load/ reads a memory block from tape.
1345 <tag/Notes/<itemize>
1346 <item>The function is available only as a fastcall function; so, it may be used
1347 only in the presence of a prototype.
1349 <tag/Availability/cc65
1351 <ref id="atmos_save" name="atmos_save">
1357 <sect1>atmos_save<label id="atmos_save"><p>
1361 <tag/Function/Save Atmos tape.
1362 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1363 <tag/Declaration/<tt/void __fastcall__ atmos_save(const char* name, const void* start, const void* end);/
1364 <tag/Description/<tt/atmos_save/ writes a memory block to tape.
1365 <tag/Notes/<itemize>
1366 <item>The function is available only as a fastcall function; so, it may be used
1367 only in the presence of a prototype.
1369 <tag/Availability/cc65
1371 <ref id="atmos_load" name="atmos_load">
1373 atmos_save("hires", 0xa000, 0xc000);
1379 <sect1>atoi<label id="atoi"><p>
1383 <tag/Function/Convert a string to an integer.
1384 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1385 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1386 <tag/Description/<tt/atoi/ converts the given string into an integer.
1387 Conversion stops as soon as any invalid character is encountered.
1388 <tag/Notes/<itemize>
1389 <item>There is no way to detect any conversion errors.
1390 <item>The function does not check for an numerical overflow when converting.
1391 <item>The function is only available as fastcall function, so it may only be
1392 used in presence of a prototype.
1394 <tag/Availability/ISO 9899
1396 <ref id="atol" name="atol">,
1397 <ref id="itoa" name="itoa">,
1398 <ref id="ltoa" name="ltoa">,
1399 <ref id="ultoa" name="ultoa">,
1400 <ref id="utoa" name="utoa">
1406 <sect1>atol<label id="atol"><p>
1410 <tag/Function/Convert a string to a long integer.
1411 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1412 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1413 <tag/Description/<tt/atol/ converts the given string into a long integer.
1414 Conversion stops as soon as any invalid character is encountered.
1415 <tag/Notes/<itemize>
1416 <item>There is no way to detect any conversion errors.
1417 <item>The function does not check for an numerical overflow when converting.
1418 <item>The function is only available as fastcall function, so it may only be
1419 used in presence of a prototype.
1421 <tag/Availability/ISO 9899
1423 <ref id="atoi" name="atoi">,
1424 <ref id="itoa" name="itoa">,
1425 <ref id="ltoa" name="ltoa">,
1426 <ref id="ultoa" name="ultoa">,
1427 <ref id="utoa" name="utoa">
1433 <sect1>bgcolor<label id="bgcolor"><p>
1437 <tag/Function/Set the background text color.
1438 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1439 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1440 <tag/Description/The function will set a new background color and return the
1441 old (current) one. The background color is valid for the whole text output
1442 area of the screen, not just for new text.
1443 <tag/Notes/<itemize>
1444 <item>Background colors are system dependent. The function may have no effect
1445 on systems where the background color cannot be changed.
1446 <item>The function is only available as fastcall function, so it may only be
1447 used in presence of a prototype.
1449 <tag/Availability/cc65
1451 <ref id="bordercolor" name="bordercolor">,
1452 <ref id="textcolor" name="textcolor">
1458 <sect1>bordercolor<label id="bordercolor"><p>
1462 <tag/Function/Set the border (frame) color.
1463 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1464 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1465 <tag/Description/The function will set a new border color. It returns the old
1466 (current) border color.
1467 <tag/Notes/<itemize>
1468 <item>Border colors are system dependent. The function may have no effect
1469 on systems where the border color cannot be changed.
1470 <item>The function is only available as fastcall function, so it may only
1471 be used in presence of a prototype.
1473 <tag/Availability/cc65
1475 <ref id="bgcolor" name="bgcolor">,
1476 <ref id="textcolor" name="textcolor">
1482 <sect1>bsearch<label id="bsearch"><p>
1486 <tag/Function/Do a binary search in a sorted array.
1487 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1488 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1489 const void* base, size_t n, size_t size,
1490 int __fastcall__ (* cmp) (const void*, const void*));/
1491 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1492 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1493 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1494 the function used to compare the members against the key. The function returns
1495 a pointer to the member found, or <tt/NULL/ if there was no match.
1496 <tag/Notes/<itemize>
1497 <item>The contents of the array must be sorted in ascending order according to
1498 the compare function given.
1499 <item>If there are multiple members that match the key, the function will
1500 return one of the members.
1501 <item>The function is only available as fastcall function, so it may only
1502 be used in presence of a prototype.
1503 <item>The function to which <tt/cmp/ points must have the <tt/fastcall/ calling
1506 <tag/Availability/ISO 9899
1508 <ref id="qsort" name="qsort">
1514 <sect1>bzero<label id="bzero"><p>
1518 <tag/Function/Fill a memory area with zeroes.
1519 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1520 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1521 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1523 <tag/Notes/<itemize>
1524 <item>The function is non standard and therefore only available in non ANSI
1525 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1526 <item>The function is only available as fastcall function, so it may only
1527 be used in presence of a prototype.
1529 <tag/Availability/cc65
1531 <ref id="_swap" name="_swap">,
1532 <ref id="memcpy" name="memcpy">,
1533 <ref id="memmove" name="memmove">,
1534 <ref id="memset" name="memset">,
1540 <sect1>c64mode<label id="c64mode"><p>
1544 <tag/Function/Switch the C128 into C64 compatible mode.
1545 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1546 <tag/Declaration/<tt/void c64mode (void);/
1547 <tag/Description/The function will cause the machine to reboot into C64 mode.
1548 <tag/Notes/<itemize>
1549 <item>The function is specific to the C128.
1550 <item>The function will not return to the caller.
1552 <tag/Availability/C128
1558 <sect1>calloc<label id="calloc"><p>
1562 <tag/Function/Allocate and clear memory.
1563 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1564 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1565 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1566 of size <tt/size/, clears the whole block with binary zeroes and returns a
1567 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1569 <tag/Notes/<itemize>
1570 <item>Clearing the memory may not have the expected effect on all platforms:
1571 pointers in the block may not be <tt/NULL/ and floating point variables may
1572 not be zero (0.0). In other words: The "clearing" effect of this function
1573 should be used with care for portable programs.
1574 <item>The function is only available as fastcall function, so it may only
1575 be used in presence of a prototype.
1577 <tag/Availability/ISO 9899
1579 <ref id="_heapadd" name="_heapadd">,
1580 <ref id="_heapblocksize" name="_heapblocksize">,
1581 <ref id="_heapmaxavail" name="_heapmaxavail">,
1582 <ref id="_heapmemavail" name="_heapmemavail">,
1583 <ref id="free" name="free">,
1584 <ref id="malloc" name="malloc">,
1585 <ref id="realloc" name="realloc">
1591 <sect1>cbm_k_acptr<label id="cbm_k_acptr"><p>
1595 <tag/Function/Input byte from serial bus
1596 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1597 <tag/Declaration/<tt/unsigned char cbm_k_acptr (void);/
1598 <tag/Description/The function returns a byte of data, which it
1599 gets from the current TALKer on the serial bus.
1600 In order to receive the data, the device must have previously been
1601 sent a command to TALK and a secondary address if it needs one.
1602 <tag/Notes/<itemize>
1605 <tag/Availability/cc65
1607 <ref id="cbm_k_talk" name="cbm_k_talk">,
1613 <sect1>cbm_k_basin<label id="cbm_k_basin"><p>
1617 <tag/Function/Input a Character from the Current Device
1618 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1619 <tag/Declaration/<tt/unsigned char cbm_k_basin (void);/
1620 <tag/Description/The function returns a character from the current input device.
1621 Device must first have been OPENed and then designated as the input channel by the CHKIN routine.
1622 When this function is called, the next byte of data available from the device is returned.
1623 Exception is the routine for the keyboard device (which is the default input device).
1624 <tag/Notes/<itemize>
1627 <tag/Availability/cc65
1629 <ref id="cbm_k_open" name="cbm_k_open">,
1630 <ref id="cbm_k_chkin" name="cbm_k_chkin">
1636 <sect1>cbm_k_bsout<label id="cbm_k_bsout"><p>
1640 <tag/Function/Output a byte
1641 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1642 <tag/Declaration/<tt/void __fastcall__ cbm_k_bsout (unsigned char C);/
1643 <tag/Description/Function sends the character to the current output device.
1644 Unless a device has been OPENed and designated as the
1645 current output channel using the CHKOUT routine, the character is
1646 printed to the screen, which is the default output device. If the
1647 cassette is the current device, outputting a byte will only add it to
1648 the buffer. No actual transmission of data will occur until the
1649 192-byte buffer is full.
1650 <tag/Notes/<itemize>
1651 <item>The function is only available as fastcall function, so it may
1652 only be used in presence of a prototype.
1654 <tag/Availability/cc65
1656 <ref id="cbm_k_open" name="cbm_k_open">,
1657 <ref id="cbm_k_chkin" name="cbm_k_chkout">
1663 <sect1>cbm_k_chkin<label id="cbm_k_chkin"><p>
1667 <tag/Function/Designate a Logical File As the Current Input Channel
1668 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1669 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_chkin (unsigned char FN);/
1670 <tag/Description/If you wish to
1671 get data from any device other than the keyboard, this function must be
1672 called after OPENing the device, before you can get a data byte with
1673 the cbm_k_basin or cbm_k_getin routine. When called, the routine will designate
1674 the logical file whose file number was supplied as the
1675 current file, its device as the current device, and its secondary
1676 address as the current secondary address. If the device on the
1677 channel is a serial device, which requires a TALK command and
1678 sometimes a secondary address, function will send them over the
1680 <tag/Notes/<itemize>
1681 <item>The function is only available as fastcall function, so it may
1682 only be used in presence of a prototype.
1684 <tag/Availability/cc65
1686 <ref id="cbm_k_open" name="cbm_k_open">,
1687 <ref id="cbm_k_basin" name="cbm_k_basin">,
1688 <ref id="cbm_k_getin" name="cbm_k_getin">
1694 <sect1>cbm_k_ciout<label id="cbm_k_ciout"><p>
1698 <tag/Function/Transmit a byte over the serial bus
1699 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1700 <tag/Declaration/<tt/void __fastcall__ cbm_k_ciout (unsigned char C);/
1701 <tag/Description/Purpose of this function is to send a byte of data over
1702 the serial bus. In order for the data to be received, the serial
1703 device must have first been commanded to LISTEN and been given a
1704 secondary address if necessary. This routine always buffers the
1705 current character, and defers sending it until the next byte is
1706 buffered. When the UNLISTEN command is sent, the last byte will be
1707 sent with an End or Identify (EOI).
1708 <tag/Notes/<itemize>
1709 <item>The function is only available as fastcall function, so it may
1710 only be used in presence of a prototype.
1712 <tag/Availability/cc65
1714 <ref id="cbm_k_listen" name="cbm_k_listen">,
1715 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">
1721 <sect1>cbm_k_ckout<label id="cbm_k_ckout"><p>
1725 <tag/Function/Designate a Logical File As the Current Output Channel
1726 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1727 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_ckout (unsigned char FN);/
1728 <tag/Description/If you wish to
1729 output data to any device other than the screen, this routine must be
1730 called after OPENing the device, and before you output a data byte
1731 with the cbm_k_bsout() function. When called, the function will designate the
1732 logical file whose file number was supplied as the current
1733 file, its device as the current device, and its secondary address as
1734 the current secondary address. If the device on the channel uses the
1735 serial bus, and therefore requires a LISTEN command and possibly a
1736 secondary address, this information will be sent on the bus.
1737 <tag/Notes/<itemize>
1738 <item>The function is only available as fastcall function, so it may
1739 only be used in presence of a prototype.
1741 <tag/Availability/cc65
1743 <ref id="cbm_k_bsout" name="cbm_k_bsout">,
1744 <ref id="cbm_k_listen" name="cbm_k_listen">
1750 <sect1>cbm_k_clall<label id="cbm_k_clall"><p>
1754 <tag/Function/Close All Logical I/O Files
1755 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1756 <tag/Declaration/<tt/void cbm_k_clall (void);/
1757 <tag/Description/It closes all
1758 open files, by resetting the index into open files to
1759 zero and restores the default I/O devices.
1760 <tag/Notes/<itemize>
1763 <tag/Availability/cc65
1765 <ref id="cbm_k_open" name="cbm_k_open">,
1766 <ref id="cbm_k_close" name="cbm_k_close">
1772 <sect1>cbm_k_close<label id="cbm_k_close"><p>
1776 <tag/Function/Close a Logical I/O File
1777 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1778 <tag/Declaration/<tt/void __fastcall__ cbm_k_close (unsigned char FN);/
1779 <tag/Description/It is used to
1780 close a logical file after all I/O operations involving that file have
1782 <tag/Notes/<itemize>
1783 <item>The function is only available as fastcall function, so it may
1784 only be used in presence of a prototype.
1786 <tag/Availability/cc65
1788 <ref id="cbm_k_open" name="cbm_k_open">,
1789 <ref id="cbm_k_clall" name="cbm_k_clall">
1795 <sect1>cbm_k_clrch<label id="cbm_k_clrch"><p>
1799 <tag/Function/Restore Current Input and Output Devices to the Default Devices
1800 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1801 <tag/Declaration/<tt/void cbm_k_clrch (void);/
1802 <tag/Description/It sets the
1803 current input device to the keyboard, and the current output device to
1804 the screen. Also, if the current input device was formerly a serial
1805 device, the routine sends it an UNTALK command on the serial bus, and
1806 if a serial device was formerly the current output device, the routine
1807 sends it an UNLISTEN command.
1808 <tag/Notes/<itemize>
1811 <tag/Availability/cc65
1813 <ref id="cbm_k_chkin" name="cbm_k_chkin">,
1814 <ref id="cbm_k_ckout" name="cbm_k_ckout">
1820 <sect1>cbm_k_getin<label id="cbm_k_getin"><p>
1824 <tag/Function/Get One Byte from the Input Device
1825 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1826 <tag/Declaration/<tt/unsigned char cbm_k_getin (void);/
1827 <tag/Description/Function gets a character from the current input device.
1828 <tag/Notes/<itemize>
1831 <tag/Availability/cc65
1833 <ref id="cbm_k_basin" name="cbm_k_basin">
1839 <sect1>cbm_k_iobase<label id="cbm_k_iobase"><p>
1843 <tag/Function/Return Base Address of Memory-Mapped I/O Devices
1844 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1845 <tag/Declaration/<tt/unsigned cbm_k_iobase (void);/
1846 <tag/Description/This function returns the address of
1847 the memory section where the memory mapped I/O devices are located. This
1848 address can then be used with an offset to access the memory mapped I/O
1849 devices in the Commodore 64. The offset is the number of locations from
1850 the beginning of the page on which the I/O register you want is located.
1851 This function exists to provide compatibility between the Commodore 64,
1852 VIC-20, and future models of the Commodore 64. If the I/O locations for
1853 a program are set by a call to this function, they should
1854 still remain compatible with future versions of the Commodore 64, the
1856 <tag/Notes/<itemize>
1859 <tag/Availability/cc65
1867 <sect1>cbm_k_listen<label id="cbm_k_listen"><p>
1871 <tag/Function/Command a device on the serial bus to LISTEN
1872 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1873 <tag/Declaration/<tt/void __fastcall__ cbm_k_listen (unsigned char dev);/
1874 <tag/Description/This function will command a device on the serial bus to
1875 receive data. The KERNAL routine will OR the supplied device number bit by bit
1876 to convert it to a listen address, then transmits this data as a command on
1877 the serial bus. The specified device will then go into listen mode, and
1878 be ready to accept information.
1879 <tag/Notes/<itemize>
1880 <item>The function is only available as fastcall function, so it may
1881 only be used in presence of a prototype.
1883 <tag/Availability/cc65
1885 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">,
1891 <sect1>cbm_k_load<label id="cbm_k_load"><p>
1895 <tag/Function/Load RAM from a Device
1896 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1897 <tag/Declaration/<tt/unsigned int __fastcall__ cbm_k_load(unsigned char flag, unsigned addr);/
1898 <tag/Description/This function LOADs data bytes from any input device directly into the memory.
1899 It can also be used for a verify operation, comparing data from a device with the data already in
1900 memory, while leaving the data stored in RAM unchanged.
1901 The flag must be set to 0 for a LOAD operation, or 1 for a
1902 verify, If the input device is OPENed with a secondary address (SA) of 0
1903 the header information from the device is ignored. In this case, the starting address for the load must be supplied.
1904 If the device is addressed with a secondary address of 1, then the data is
1905 loaded into memory starting at the location specified by the header.
1906 Function returns the address of the highest RAM location loaded.
1907 Before this function can be called, the KERNAL SETLFS, and SETNAM
1908 routines must be called.
1909 <tag/Notes/<itemize>
1910 <item>The function is only available as fastcall function, so it may
1911 only be used in presence of a prototype.
1913 <tag/Availability/cc65
1915 <ref id="cbm_k_save" name="cbm_k_save">,
1916 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
1917 <ref id="cbm_k_setnam" name="cbm_k_setnam">
1923 <sect1>cbm_k_open<label id="cbm_k_open"><p>
1927 <tag/Function/Open a Logical I/O File
1928 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1929 <tag/Declaration/<tt/unsigned char cbm_k_open (void);/
1930 <tag/Description/This function assigns a logical file to a device, so that it can be used for
1931 Input/Output operations. In order to specify the logical file number,
1932 the device number, and the secondary address if any, the cbm_k_setlfs() function must first be called.
1933 Likewise, in order to designate the filename, the cbm_k_setnam() function must be used first. After these two
1934 functions are called, cbm_k_open() is then called.
1935 <tag/Notes/<itemize>
1938 <tag/Availability/cc65
1940 <ref id="cbm_k_close" name="cbm_k_close">,
1941 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
1942 <ref id="cbm_k_setnam" name="cbm_k_setnam">
1948 <sect1>cbm_k_readst<label id="cbm_k_readst"><p>
1952 <tag/Function/Read status word
1953 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1954 <tag/Declaration/<tt/unsigned char cbm_k_readst (void);/
1955 <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.
1956 <tag/Notes/<itemize>
1959 <tag/Availability/cc65
1967 <sect1>cbm_k_save<label id="cbm_k_save"><p>
1971 <tag/Function/Save RAM to a Device
1972 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1973 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_save(unsigned int start, unsigned int end)/
1974 <tag/Description/This function saves a section of memory. The cbm_k_setlfs() and cbm_k_setnam() functions must be
1975 used before calling this function. However, a file name is not required to
1976 SAVE to device 1 (the Datassette(TM) recorder). Any attempt to save to
1977 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.
1978 <tag/Notes/<itemize>
1979 <item>The function is only available as fastcall function, so it may
1980 only be used in presence of a prototype.
1982 <tag/Availability/cc65
1984 <ref id="cbm_k_load" name="cbm_k_load">,
1985 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
1986 <ref id="cbm_k_setnam" name="cbm_k_setnam">
1992 <sect1>cbm_k_scnkey<label id="cbm_k_scnkey"><p>
1996 <tag/Function/Scan the keyboard matrix.
1997 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1998 <tag/Declaration/<tt/void cbm_k_scnkey (void);/
1999 <tag/Description/This function looks at the switches in the keyboard, to see
2000 if any of them are being pressed. If they are, then code numbers for them are
2001 stored in RAM. Other functions use those numbers to input text. Normally,
2002 the keyboard is scanned by the Kernal's Interrupt Service Routine. But, if
2003 you divert the "Jiffy interrupt" to a C-code ISR, then that ISR must call this
2004 function, in order to provide input from the keyboard.
2005 <tag/Availability/cc65
2007 <ref id="cbm_k_getin" name="cbm_k_getin">,
2008 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2009 <ref id="cgetc" name="cgetc">,
2010 <!-- <ref id="getc" name="getc"> -->
2011 <!-- <ref id="getchar" name="getchar"> -->
2017 <sect1>cbm_k_setlfs<label id="cbm_k_setlfs"><p>
2021 <tag/Function/Set up a logical file
2022 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2023 <tag/Declaration/<tt/void __fastcall__ cbm_k_setlfs (unsigned char LFN, unsigned char DEV, unsigned char SA);/
2024 <tag/Description/This functions sets up the logical file by setting its number, device address,
2025 and secondary address.
2026 <tag/Notes/<itemize>
2027 <item>The function is only available as fastcall function, so it may
2028 only be used in presence of a prototype.
2030 <tag/Availability/cc65
2032 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2038 <sect1>cbm_k_setnam<label id="cbm_k_setnam"><p>
2042 <tag/Function/Set Filename Parameters
2043 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2044 <tag/Declaration/<tt/void __fastcall__ cbm_k_setnam (const char* Name);/
2045 <tag/Description/This function is used to set up the file name for the OPEN,
2046 SAVE, or LOAD operations.
2047 <tag/Notes/<itemize>
2048 <item>The function is only available as fastcall function, so it may
2049 only be used in presence of a prototype.
2051 <tag/Availability/cc65
2053 <ref id="cbm_k_open" name="cbm_k_open">,
2054 <ref id="cbm_k_load" name="cbm_k_load">,
2055 <ref id="cbm_k_save" name="cbm_k_save">
2061 <sect1>cbm_k_talk<label id="cbm_k_talk"><p>
2065 <tag/Function/Commands device to TALK
2066 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2067 <tag/Declaration/<tt/void __fastcall__ cbm_k_talk (unsigned char dev);/
2068 <tag/Description/When called, it ORs the device number with the TALK code (64, $40) and sends it on the serial
2069 bus. This commands the device to TALK.
2070 <tag/Notes/<itemize>
2071 <item>The function is only available as fastcall function, so it may
2072 only be used in presence of a prototype.
2074 <tag/Availability/cc65
2076 <ref id="cbm_k_acptr" name="cbm_k_acptr">
2082 <sect1>cbm_k_udtim<label id="cbm_k_udtim"><p>
2086 <tag/Function/Update the Jiffy clock.
2087 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2088 <tag/Declaration/<tt/void cbm_k_udtim (void);/
2089 <tag/Description/This function adds one count to the Jiffy clock. That clock
2090 counts sixtieths of a second. It is used by the library's <tt/clock()/
2091 function. Normally, the Jiffy clock is updated by the Kernal's Interrupt
2092 Service Routine. But, if you divert the "Jiffy interrupt" to a C-code ISR,
2093 then that ISR must call this function, in order to keep the clock valid.
2094 <tag/Availability/cc65
2096 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2097 <ref id="clock" name="clock">
2103 <sect1>cbm_k_unlsn<label id="cbm_k_unlsn"><p>
2107 <tag/Function/Send an UNLISTEN command
2108 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2109 <tag/Declaration/<tt/void cbm_k_unlsn (void);/
2110 <tag/Description/This function commands all devices on the serial bus to
2111 stop receiving data from the host computer (i.e., UNLISTEN). Calling this
2112 function results in an UNLISTEN command being transmitted on the serial
2113 bus. Only devices previously commanded to LISTEN are affected. This
2114 function is normally used after the host computer is finished sending data
2115 to external devices. Sending the UNLISTEN commands the listening devices
2116 to get off the serial bus so it can be used for other purposes.
2117 <tag/Notes/<itemize>
2120 <tag/Availability/cc65
2122 <ref id="cbm_k_listen" name="cbm_k_listen">
2128 <sect1>cclear<label id="cclear"><p>
2132 <tag/Function/Clear part of a line (write a given number of spaces).
2133 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2134 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
2135 <tag/Description/The function clears part of a line by writing <tt/length/
2136 spaces in the current text color.
2137 <tag/Notes/<itemize>
2138 <item>The function is only available as fastcall function, so it may
2139 only be used in presence of a prototype.
2141 <tag/Availability/cc65
2143 <ref id="cclearxy" name="cclearxy">,
2144 <ref id="clrscr" name="clrscr">
2150 <sect1>cclearxy<label id="cclearxy"><p>
2154 <tag/Function/Clear part of a line (write a given number of spaces) starting
2155 at a specific screen position.
2156 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2157 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
2158 <tag/Description/The function moves the cursor to a specific position, and
2159 will then clear part of the line by writing <tt/length/ spaces in the current
2161 <tag/Notes/<itemize>
2162 <item>The function is only available as fastcall function, so it may
2163 only be used in presence of a prototype.
2165 <tag/Availability/cc65
2167 <ref id="cclear" name="cclear">,
2168 <ref id="clrscr" name="clrscr">
2174 <sect1>cgetc<label id="cgetc"><p>
2178 <tag/Function/Read a character from the keyboard.
2179 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2180 <tag/Declaration/<tt/char cgetc (void);/
2181 <tag/Description/The function reads a character from the keyboard. If there is
2182 no character available, <tt/cgetc()/ waits until the user presses a key. If the
2183 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
2184 displayed while waiting.
2185 <tag/Notes/<itemize>
2186 <item>If the system supports a keyboard buffer, <tt/cgetc()/ will fetch a key
2187 from that buffer; and, wait only if the buffer is empty.
2188 <item>The keyboard must be scanned periodically, in order for this function to
2189 see anything that you type. (See the description of <tt/cbm_k_scnkey()/.)
2191 <tag/Availability/cc65
2193 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2194 <ref id="cursor" name="cursor">,
2195 <ref id="kbhit" name="kbhit">
2201 <sect1>chline<label id="chline"><p>
2205 <tag/Function/Output a horizontal line in text mode.
2206 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2207 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
2208 <tag/Description/The function outputs a horizontal line with the given length
2209 starting at the current cursor position.
2210 <tag/Notes/<itemize>
2211 <item>The character used to draw the horizontal line is system dependent.
2212 If available, a line drawing character is used. Drawing a line that is partially
2213 off screen leads to undefined behaviour.
2214 <item>The function is only available as fastcall function, so it may only be
2215 used in presence of a prototype.
2217 <tag/Availability/cc65
2219 <ref id="chlinexy" name="chlinexy">,
2220 <ref id="cvline" name="cvline">,
2221 <ref id="cvlinexy" name="cvlinexy">
2227 <sect1>chlinexy<label id="chlinexy"><p>
2231 <tag/Function/Output a horizontal line at a given position in text mode.
2232 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2233 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
2234 <tag/Description/The function outputs a horizontal line with the given length
2235 starting at a given position.
2236 <tag/Notes/<itemize>
2237 <item>The character used to draw the horizontal line is system dependent.
2238 If available, a line drawing character is used. Drawing a line that is partially
2239 off screen leads to undefined behaviour.
2240 <item>The function is only available as fastcall function, so it may only be
2241 used in presence of a prototype.
2243 <tag/Availability/cc65
2245 <ref id="chline" name="chline">,
2246 <ref id="cvline" name="cvline">,
2247 <ref id="cvlinexy" name="cvlinexy">
2253 <sect1>clearerr<label id="clearerr"><p>
2257 <tag/Function/Clear error and end-of-file status of a stream.
2258 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2259 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
2260 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
2261 indicators for the stream <tt/f/.
2262 <tag/Notes/<itemize>
2263 <item>The function is only available as fastcall function, so it may only be
2264 used in presence of a prototype.
2266 <tag/Availability/ISO 9899
2268 <ref id="feof" name="feof">,
2269 <ref id="ferror" name="ferror">
2275 <sect1>clock<label id="clock"><p>
2279 <tag/Function/Determine the processor time used.
2280 <tag/Header/<tt/<ref id="time.h" name="time.h">/
2281 <tag/Declaration/<tt/clock_t clock (void);/
2282 <tag/Description/The <tt/clock/ function returns an approximaton of processor
2283 time used by the program. The time is returned in implementation-defined
2284 units. It can be converted to seconds by dividing by the value of the macro
2285 <tt/CLOCKS_PER_SEC/.
2286 <tag/Notes/<itemize>
2287 <item>Since the machines that cc65-generated programs run on cannot run multiple
2288 processes, the function actually will return the time since some
2289 implementation-defined point in the past.
2290 <item>The Jiffy clock must be "running", in order for this function to return
2291 changing values. (See the description of <tt/cbm_k_udtim()/.)
2293 <tag/Availability/ISO 9899
2295 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2296 <ref id="time" name="time">
2302 <sect1>clrscr<label id="clrscr"><p>
2306 <tag/Function/Clear the text screen.
2307 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2308 <tag/Declaration/<tt/void clrscr (void);/
2309 <tag/Description/The function clears the text screen and moves the cursor to
2310 the upper left corner.
2311 <tag/Availability/cc65
2313 <ref id="cclear" name="cclear">,
2314 <ref id="cclearxy" name="cclearxy">
2320 <sect1>close<label id="close"><p>
2324 <tag/Function/Close a file descriptor.
2325 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2326 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
2327 <tag/Description/The function closes the given file descriptor. It returns zero
2328 on success and -1 on error. If an error occurs, the cause can be determined by
2329 reading the <tt/errno/ variable.
2330 <tag/Notes/<itemize>
2331 <item>The function is only available as fastcall function, so it may only
2332 be used in presence of a prototype.
2334 <tag/Availability/POSIX 1003.1
2336 <ref id="creat" name="creat">,
2337 <ref id="open" name="open">
2343 <sect1>closedir<label id="closedir"><p>
2347 <tag/Function/Close a directory.
2348 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
2349 <tag/Declaration/<tt/int __fastcall__ closedir (DIR* dir);/
2350 <tag/Description/The function closes the given directory descriptor. It returns
2351 zero on success and -1 on error. If an error occurs, the cause can be determined
2352 by reading the <tt/errno/ variable.
2353 <tag/Notes/<itemize>
2354 <item>The function is only available as fastcall function, so it may only
2355 be used in presence of a prototype.
2357 <tag/Availability/POSIX 1003.1
2359 <ref id="opendir" name="opendir">,
2360 <ref id="readdir" name="readdir">
2366 <sect1>creat<label id="creat"><p>
2370 <tag/Function/Create a file.
2371 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2372 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
2373 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
2374 associated with it. On error, -1 is returned and an error code is stored in
2376 <tag/Notes/<itemize>
2377 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
2378 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
2379 <item>The function is only available as fastcall function, so it may only
2380 be used in presence of a prototype.
2382 <tag/Availability/POSIX 1003.1
2384 <ref id="close" name="close">,
2385 <ref id="open" name="open">
2391 <sect1>cprintf<label id="cprintf"><p>
2395 <tag/Function/Formatted output to the console.
2396 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2397 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
2398 <tag/Description/The arguments are converted to text where necessary and
2399 formatted according to the format string given. The resulting string is output
2400 to the console. <tt/cprintf/ supports the same format specifiers as
2401 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
2402 <tag/Notes/<itemize>
2403 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
2404 between <tt/\r/ and <tt/\n/.
2406 <tag/Availability/cc65
2408 <ref id="cputc" name="cputc">,
2409 <ref id="cputcxy" name="cputcxy">,
2410 <ref id="cputs" name="cputs">,
2411 <ref id="cputsxy" name="cputsxy">,
2412 <ref id="vcprintf" name="vcprintf">
2418 <sect1>cputc<label id="cputc"><p>
2422 <tag/Function/Output a character directly to the console.
2423 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2424 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
2425 <tag/Description/Output one character to the console at the current cursor
2427 <tag/Notes/<itemize>
2428 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
2429 between <tt/\r/ and <tt/\n/.
2430 <item>The function is only available as fastcall function, so it may only
2431 be used in presence of a prototype.
2433 <tag/Availability/cc65
2435 <ref id="cprintf" name="cprintf">,
2436 <ref id="cputcxy" name="cputcxy">,
2437 <ref id="cputs" name="cputs">,
2438 <ref id="cputsxy" name="cputsxy">,
2439 <ref id="vcprintf" name="vcprintf">
2445 <sect1>cputcxy<label id="cputcxy"><p>
2449 <tag/Function/Output a character at a specific screen position.
2450 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2451 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
2452 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
2453 the screen and outputs one character.
2454 <tag/Notes/<itemize>
2455 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
2456 between <tt/\r/ and <tt/\n/.
2457 <item>The function is only available as fastcall function, so it may only
2458 be used in presence of a prototype.
2460 <tag/Availability/cc65
2462 <ref id="cprintf" name="cprintf">,
2463 <ref id="cputc" name="cputc">,
2464 <ref id="cputs" name="cputs">,
2465 <ref id="cputsxy" name="cputsxy">,
2466 <ref id="vcprintf" name="vcprintf">
2472 <sect1>cputs<label id="cputs"><p>
2476 <tag/Function/Output a string directly to the console.
2477 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2478 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
2479 <tag/Description/The function outputs the given string on the console at the
2480 current cursor position.
2481 <tag/Notes/<itemize>
2482 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
2483 between <tt/\r/ and <tt/\n/.
2484 <item>The function is only available as fastcall function, so it may only
2485 be used in presence of a prototype.
2487 <tag/Availability/cc65
2489 <ref id="cprintf" name="cprintf">,
2490 <ref id="cputc" name="cputc">,
2491 <ref id="cputcxy" name="cputcxy">,
2492 <ref id="cputsxy" name="cputsxy">,
2493 <ref id="vcprintf" name="vcprintf">
2499 <sect1>cputsxy<label id="cputsxy"><p>
2503 <tag/Function/Output a string to the console at a given position.
2504 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2505 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
2506 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
2507 and outputs the string <tt/s/.
2508 <tag/Notes/<itemize>
2509 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
2510 between <tt/\r/ and <tt/\n/.
2511 <item>The function is only available as fastcall function, so it may only
2512 be used in presence of a prototype.
2514 <tag/Availability/cc65
2516 <ref id="cprintf" name="cprintf">,
2517 <ref id="cputc" name="cputc">,
2518 <ref id="cputcxy" name="cputcxy">,
2519 <ref id="cputs" name="cputs">,
2520 <ref id="vcprintf" name="vcprintf">
2526 <sect1>cursor<label id="cursor"><p>
2530 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
2531 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2532 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
2533 <tag/Description/If the argument to the function is non zero, a blinking cursor
2534 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
2535 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
2536 <tag/Notes/<itemize>
2537 <item>The function is only available as fastcall function, so it may only
2538 be used in presence of a prototype.
2540 <tag/Availability/cc65
2542 <ref id="cgetc" name="cgetc">,
2543 <ref id="kbhit" name="kbhit">
2549 <sect1>cvline<label id="cvline"><p>
2553 <tag/Function/Output a vertical line in text mode.
2554 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2555 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
2556 <tag/Description/The function outputs a vertical line with the given length
2557 starting at the current cursor position.
2558 <tag/Notes/<itemize>
2559 <item>The character used to draw the vertical line is system dependent.
2560 If available, a line drawing character is used. Drawing a line that is partially
2561 off screen leads to undefined behaviour.
2562 <item>The function is only available as fastcall function, so it may only be
2563 used in presence of a prototype.
2565 <tag/Availability/cc65
2567 <ref id="chline" name="chline">,
2568 <ref id="chlinexy" name="chlinexy">,
2569 <ref id="cvlinexy" name="cvlinexy">
2575 <sect1>cvlinexy<label id="cvlinexy"><p>
2579 <tag/Function/Output a vertical line at a given position in text mode.
2580 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2581 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
2582 <tag/Description/The function outputs a vertical line with the given length
2583 starting at a given position.
2584 <tag/Notes/<itemize>
2585 <item>The character used to draw the vertical line is system dependent.
2586 If available, a line drawing character is used. Drawing a line that is partially
2587 off screen leads to undefined behaviour.
2588 <item>The function is only available as fastcall function, so it may only be
2589 used in presence of a prototype.
2591 <tag/Availability/cc65
2593 <ref id="chline" name="chline">,
2594 <ref id="chlinexy" name="chlinexy">,
2595 <ref id="cvline" name="cvline">
2601 <sect1>decompress_lz4<label id="decompress_lz4"><p>
2605 <tag/Function/Uncompress a LZ4-compressed buffer.
2606 <tag/Header/<tt/<ref id="lz4.h" name="lz4.h">/
2607 <tag/Declaration/<tt/void decompress_lz4 (const unsigned char* src, unsigned char* const dst, const unsigned short uncompressed_size);/
2608 <tag/Description/<tt/decompress_lz4/ uncompresses a LZ4-compressed buffer.
2609 <tag/Notes/<itemize>
2610 <item>Use LZ4_compress_HC with compression level 16 for best compression.
2612 <tag/Availability/cc65
2618 <sect1>div<label id="div"><p>
2622 <tag/Function/Divide two ints and return quotient and remainder.
2623 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2624 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
2625 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
2626 quotient and remainder in a <tt/div_t/ structure.
2627 <tag/Notes/<itemize>
2628 <item>The function is only available as fastcall function, so it may only
2629 be used in presence of a prototype.
2631 <tag/Availability/ISO 9899
2639 <sect1>doesclrscrafterexit<label id="doesclrscrafterexit"><p>
2643 <tag/Function/Determines whether the screen is going to be cleared after program exit.
2644 <tag/Header/<tt/<ref id="cc65.h" name="cc65.h">/
2645 <tag/Declaration/<tt/unsigned char doesclrscrafterexit (void);/
2646 <tag/Description/The function returns zero if the screen won't be cleared immediately after
2647 program termination. It returns a non-zero value if it will.
2648 <tag/Notes/<itemize>
2649 <item>Some systems, maybe depending on configuration, immediately clear the screen
2650 after a program exits. Therefore it might be difficult to read
2651 the last messages printed by the program prior to its exit. This function can be used
2652 to decide if a delay or wait for a key press should be executed when then program
2655 <tag/Availability/cc65
2663 printf("Hello World\n");
2664 if (doesclrscrafterexit())
2673 <sect1>em_commit<label id="em_commit"><p>
2677 <tag/Function/Commit changes into extended memory.
2678 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2679 <tag/Declaration/<tt/void em_commit (void);/
2680 <tag/Description/Commit changes in the memory window to extended storage. If
2681 the contents of the memory window have been changed, these changes may be lost
2682 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
2683 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
2684 name="em_copyto">/ are called without calling <tt/em_commit/ first.
2685 <tag/Notes/<itemize>
2686 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
2687 memory window are discarded, it does just mean that the drivers is allowed
2689 <item>The function is only available as fastcall function, so it may only be
2690 used in presence of a prototype.
2691 <item>The function produces undefined results if no extended memory driver is
2694 <tag/Availability/cc65
2696 <ref id="em_load_driver" name="em_load_driver">,
2697 <ref id="em_map" name="em_map">,
2698 <ref id="em_use" name="em_use">
2704 <sect1>em_copyfrom<label id="em_copyfrom"><p>
2708 <tag/Function/Copy from extended into normal memory.
2709 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2710 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
2711 <tag/Description/Copy data from extended memory into linear memory. Source and
2712 target addresses as well as the number of bytes to transfer are specified in
2713 the <tt/em_copy/ structure that is passed as a parameter.
2714 <tag/Notes/<itemize>
2715 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
2716 made any changes to the data in the window, call <tt/<ref id="em_commit"
2717 name="em_commit">/ first, or the changes are lost.
2718 <item>The function is only available as fastcall function, so it may only be
2719 used in presence of a prototype.
2720 <item>The function produces undefined results if no extended memory driver is
2723 <tag/Availability/cc65
2725 <ref id="em_commit" name="em_commit">,
2726 <ref id="em_copyto" name="em_copyto">,
2727 <ref id="em_load_driver" name="em_load_driver">
2733 <sect1>em_copyto<label id="em_copyto"><p>
2737 <tag/Function/Copy from normal into extended memory.
2738 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2739 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
2740 <tag/Description/Copy data from linear into extended memory. Source and
2741 target addresses as well as the number of bytes to transfer are specified in
2742 the <tt/em_copy/ structure that is passed as a parameter.
2743 <tag/Notes/<itemize>
2744 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
2745 made any changes to the data in the window, call <tt/<ref id="em_commit"
2746 name="em_commit">/ first, or the changes are lost.
2747 <item>The function is only available as fastcall function, so it may only be
2748 used in presence of a prototype.
2749 <item>The function produces undefined results if no extended memory driver is
2752 <tag/Availability/cc65
2754 <ref id="em_commit" name="em_commit">,
2755 <ref id="em_copyfrom" name="em_copyfrom">,
2756 <ref id="em_load_driver" name="em_load_driver">
2762 <sect1>em_install<label id="em_install"><p>
2766 <tag/Function/Install an already loaded extended memory driver.
2767 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2768 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
2769 <tag/Description/The function installs an already loaded extended memory driver
2770 and returns an error code. The function may be used to install a driver linked
2771 statically to the program.
2772 <tag/Notes/<itemize>
2773 <item>Not all drivers are able to detect if the supported hardware is really
2775 <item>The function is only available as fastcall function, so it may only be
2776 used in presence of a prototype.
2778 <tag/Availability/cc65
2780 <ref id="em_load_driver" name="em_load_driver">,
2781 <ref id="em_uninstall" name="em_uninstall">,
2782 <ref id="em_unload" name="em_unload">
2788 <sect1>em_load_driver<label id="em_load_driver"><p>
2792 <tag/Function/Load and initialize an extended memory driver.
2793 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2794 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
2795 <tag/Description/Load an extended memory driver into memory and initialize
2796 it. The function returns an error code that tells if all this has been
2798 <tag/Notes/<itemize>
2799 <item>Not all drivers are able to detect if the supported hardware is really
2801 <item>The function is only available as fastcall function, so it may only be
2802 used in presence of a prototype.
2803 <item>The driver is loaded by name, so currently you must know the type of
2804 extended memory that should be supported. There is no autodetect capability.
2806 <tag/Availability/cc65
2808 <ref id="em_unload" name="em_unload">
2814 <sect1>em_map<label id="em_map"><p>
2818 <tag/Function/Make a page of extended memory accessible.
2819 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2820 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
2821 <tag/Description/The function maps one page of extended memory into linear
2822 memory and returns a pointer to the page frame. Depending on the hardware
2823 and driver, the data is either mapped into the address space or transfered
2824 into a buffer. If you don't need the actual contents of the page (for example
2825 because you're going to overwrite it completely), it is better to call
2826 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
2827 data if it is possible to avoid that.
2828 <tag/Notes/<itemize>
2829 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
2830 made any changes to the data in the window, call <tt/<ref id="em_commit"
2831 name="em_commit">/ first, or the changes are lost.
2832 <item>The function is only available as fastcall function, so it may only be
2833 used in presence of a prototype.
2834 <item>The function produces undefined results if no extended memory driver is
2837 <tag/Availability/cc65
2839 <ref id="em_commit" name="em_commit">,
2840 <ref id="em_load_driver" name="em_load_driver">,
2841 <ref id="em_use" name="em_use">
2847 <sect1>em_pagecount<label id="em_pagecount"><p>
2851 <tag/Function/Return the number of available extended memory pages.
2852 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2853 <tag/Declaration/<tt/unsigned em_pagecount (void);/
2854 <tag/Description/The function returns the size of the extended memory supported
2855 by the driver in 256 byte pages.
2856 <tag/Notes/<itemize>
2857 <item>The function returns zero if no extended memory driver is loaded.
2858 <item>The function may return zero if the supported hardware was not detected.
2860 <tag/Availability/cc65
2862 <ref id="em_load_driver" name="em_load_driver">
2868 <sect1>em_uninstall<label id="em_uninstall"><p>
2872 <tag/Function/Uninstall an already loaded extended memory driver.
2873 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2874 <tag/Declaration/<tt/unsigned char em_uninstall (void);/
2875 <tag/Description/The function uninstalls an already loaded extended memory
2876 driver but doesn't remove it from memory.
2877 <tag/Notes/<itemize>
2878 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
2879 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
2880 should be used instead of <tt/em_uninstall/ so the driver is also removed
2883 <tag/Availability/cc65
2885 <ref id="em_install" name="em_install">,
2886 <ref id="em_load_driver" name="em_load_driver">,
2887 <ref id="em_unload" name="em_unload">
2893 <sect1>em_unload<label id="em_unload"><p>
2897 <tag/Function/Unload an extended memory driver.
2898 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2899 <tag/Declaration/<tt/unsigned char em_unload (void);/
2900 <tag/Description/The function unloads a loaded extended memory driver and
2901 frees all memory allocated for the driver.
2902 <tag/Notes/<itemize>
2903 <item>The function does nothing if no driver is loaded.
2905 <tag/Availability/cc65
2907 <ref id="em_load_driver" name="em_load_driver">
2913 <sect1>em_use<label id="em_use"><p>
2917 <tag/Function/Prepare an extended memory page for use.
2918 <tag/Header/<tt/<ref id="em.h" name="em.h">/
2919 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
2920 <tag/Description/The function maps one page of extended memory into linear
2921 memory and returns a pointer to the page frame. This function is similar to
2922 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
2923 actual memory window in the assumption that the existing data is wrong or
2924 will get overwritten.
2925 <tag/Notes/<itemize>
2926 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
2927 made any changes to the data in the window, call <tt/<ref id="em_commit"
2928 name="em_commit">/ first, or the changes are lost.
2929 <item>The function is only available as fastcall function, so it may only be
2930 used in presence of a prototype.
2931 <item>The function produces undefined results if no extended memory driver is
2934 <tag/Availability/cc65
2936 <ref id="em_commit" name="em_commit">,
2937 <ref id="em_load_driver" name="em_load_driver">,
2938 <ref id="em_map" name="em_map">
2944 <sect1>exit<label id="exit"><p>
2948 <tag/Function/Terminate the program.
2949 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
2950 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
2951 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
2952 return code of the program. Before termination, all files are closed, buffered
2953 output is written and any functions registered with <tt/<ref id="atexit"
2954 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
2955 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
2957 <tag/Notes/<itemize>
2958 <item>The function is only available as fastcall function, so it may only
2959 be used in presence of a prototype.
2960 <item>It depends on the host machine if the program return code can be
2961 evaluated or is ignored.
2963 <tag/Availability/ISO 9899
2965 <ref id="abort" name="abort">,
2966 <ref id="exit" name="exit">
2972 <sect1>exec<label id="exec"><p>
2976 <tag/Function/Execute a program file.
2977 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
2978 <tag/Declaration/<tt/int __fastcall__ exec (const char* progname, const char* cmdline);/
2979 <tag/Description/<tt/exec/ replaces the currently running program by a new one.
2980 Calling <tt/exec()/ is identical to calling <tt/<ref id="exit" name="exit()">/,
2981 then loading and starting the program named in the first argument, passing
2982 the command line specified as second argument. Instead of an empty string,
2983 a <tt/NULL/ pointer may be passed as second parameter.
2984 On success, the function does not return. On failure, -1 is returned and
2985 <tt/errno/ contains an error code.
2986 <tag/Notes/<itemize>
2987 <item>The function is only available as fastcall function, so it may only
2988 be used in presence of a prototype.
2989 <item>On most platforms, the function needs to copy a small stub loader to
2990 some memory area outside the program space. This may collide with other
2991 programs. See the platform specific docs on this.
2992 <item>Because it is necessary to terminate the running program before the
2993 memory can be reused to load the new one, there is a high chance that the
2994 function may not be able to return on errors.
2995 <item>The command line is passed to the new program in the same way as cc65
2996 programs expect the command line. If the new program is not a cc65 generated
2997 program, it may not be able to read it.
2999 <tag/Availability/cc65
3001 <ref id="exit" name="exit">
3007 <sect1>fast<label id="fast"><p>
3011 <tag/Function/Switch the C128 into 2MHz mode.
3012 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
3013 <tag/Declaration/<tt/void fast (void);/
3014 <tag/Description/The function will switch the clock of the C128 to 2MHz. This
3015 will nearly double the speed compared to slow mode.
3016 <tag/Notes/<itemize>
3017 <item>The function is specific to the C128.
3018 <item>2MHz clock will not work in 40 column mode.
3020 <tag/Availability/C128
3022 <ref id="slow" name="slow">,
3023 <ref id="toggle_videomode" name="toggle_videomode">,
3024 <ref id="videomode" name="videomode">
3030 <sect1>feof<label id="feof"><p>
3034 <tag/Function/Return the end-of-file indicator of a stream.
3035 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3036 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
3037 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
3038 <tt/f/, and returns a non zero value if it is set.
3039 <tag/Notes/<itemize>
3040 <item>The indicator is set only after a read past the end of a file is
3042 <item>The function is only available as fastcall function, so it may only be
3043 used in presence of a prototype.
3045 <tag/Availability/ISO 9899
3047 <ref id="feof" name="clearerr">,
3048 <ref id="ferror" name="ferror">
3054 <sect1>ferror<label id="ferror"><p>
3058 <tag/Function/Return the error indicator of a stream.
3059 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3060 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
3061 <tag/Description/<tt/ferror/ tests the error indicator of the stream
3062 <tt/f/, and returns a non zero value if it is set.
3063 <tag/Notes/<itemize>
3064 <item>The function is only available as fastcall function, so it may only be
3065 used in presence of a prototype.
3067 <tag/Availability/ISO 9899
3069 <ref id="feof" name="clearerr">,
3070 <ref id="ferror" name="feof">
3076 <sect1>fileno<label id="fileno"><p>
3080 <tag/Function/Return the file handle used by a stream.
3081 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3082 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
3083 <tag/Description/The <tt/fileno/ function returns the file handle used
3084 internally by a C stream. This file handle (an integer) can be used as a
3085 handle for the POSIX input/output functions.
3086 <tag/Notes/<itemize>
3087 <item>The function is only available as fastcall function, so it may only be
3088 used in presence of a prototype.
3089 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
3090 file may have unpredictable results.
3092 <tag/Availability/POSIX 1003.1
3094 <ref id="creat" name="creat">,
3095 <ref id="open" name="open"> <!-- , -->
3096 <!-- <ref id="read" name="read">, -->
3097 <!-- <ref id="write" name="write"> -->
3103 <sect1>free<label id="free"><p>
3107 <tag/Function/Free a block of dynamic memory.
3108 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3109 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
3110 <tag/Description/Free a block of dynamic memory previously allocated with
3111 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
3112 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
3113 pointer is <tt/NULL/, no action is performed.
3114 <tag/Notes/<itemize>
3115 <item>Passing an already free'd block to <tt/free/ again will cause undefined
3116 behaviour and may crash your program.
3117 <item>The function is only available as fastcall function, so it may only
3118 be used in presence of a prototype.
3120 <tag/Availability/ISO 9899
3122 <ref id="_heapadd" name="_heapadd">,
3123 <ref id="_heapblocksize" name="_heapblocksize">,
3124 <ref id="_heapmaxavail" name="_heapmaxavail">,
3125 <ref id="_heapmemavail" name="_heapmemavail">,
3126 <ref id="calloc" name="calloc">,
3127 <ref id="malloc" name="malloc">,
3128 <ref id="realloc" name="realloc">
3134 <sect1>get_ostype<label id="get_ostype"><p>
3138 <tag/Function/The function returns the operating system, the program runs on.
3139 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
3140 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
3141 <tag/Declaration/<tt/unsigned char get_ostype (void);/
3142 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
3143 all supported targets. If it exists, it returns a number that identifies the
3144 operating system or machine type, the program runs on. The machine dependent
3145 header files define constants that can be used to check the return code.
3146 <tag/Notes/<itemize>
3147 <item>The function does not exist on all platforms.
3148 <item>The return codes are platform dependent.
3150 <tag/Availability/cc65 (not all platforms)
3156 <sect1>getcpu<label id="getcpu"><p>
3160 <tag/Function/Determine on which CPU the program is running.
3161 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3162 <tag/Declaration/<tt/unsigned char getcpu (void);/
3163 <tag/Description/The function checks on which CPU the code is running. It
3164 returns one of the constants<itemize>
3166 <item><tt/CPU_65C02/
3167 <item><tt/CPU_65816/
3169 <tag/Notes/<itemize>
3170 <item>Other, more exotic CPU types are not disinguished.
3172 <tag/Availability/cc65
3178 <sect1>getenv<label id="getenv"><p>
3182 <tag/Function/Return a value from the environment.
3183 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3184 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
3185 <tag/Description/The function searches the environment for an entry that
3186 matches <tt/name/ and returns its value. The environment consists of a list
3187 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
3189 <tag/Notes/<itemize>
3190 <item>What exactly is stored in the environment depends on the machine the
3191 program is running on.
3192 <item>The function is only available as fastcall function, so it may only
3193 be used in presence of a prototype.
3195 <tag/Availability/ISO 9899
3201 <sect1>getopt<label id="getopt"><p>
3205 <tag/Function/Parse command line options.
3206 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3207 <tag/Declaration/<tt/int __fastcall__ getopt (int argc, char* const* argv,
3208 const char* optstring);/
3209 <tag/Description/The function parses command line arguments, <tt/argc/ and
3210 <tt/argv/ are the argument count and array passed to <tt/main/. <tt/optstring/
3211 is a string that contains command line option characters. If a character in
3212 <tt/optstring/ is followed by a colon, the option requires an argument. An
3213 option on the command line is recognized if it is one of the option characters
3215 <tt/getopt/ must be called repeatedly. It will return each option character
3216 found on the command line and <tt/EOF/ (-1) if there is no other option. An
3217 option argument is placed in <tt/optarg/, the index of the next element on the
3218 command line to be processed is placed in <tt/optind/.
3219 <tag/Notes/<itemize>
3220 <item>The implementation will not reorder options. A non option on the command
3221 line will terminate option processing. All remaining arguments are not
3222 recognized as options, even if the start with a '-' character.
3223 <item>The function is only available as fastcall function, so it may only
3224 be used in presence of a prototype.
3226 <tag/Availability/POSIX.2
3232 <sect1>gotox<label id="gotox"><p>
3236 <tag/Function/Move the text mode cursor to a new X position.
3237 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3238 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
3239 <tag/Description/The function moves the text mode cursor to the specified X
3240 position while leaving the Y position untouched. The leftmost position on the
3241 screen has the coordinate 0.
3242 <tag/Notes/<itemize>
3243 <item>The function is only available as fastcall function, so it may
3244 only be used in presence of a prototype.
3245 <item>Invalid values for the X position (out of screen coordinates) may
3246 lead to undefined behaviour.
3248 <tag/Availability/cc65
3250 <ref id="gotoy" name="gotoy">,
3251 <ref id="gotoxy" name="gotoxy">,
3252 <ref id="wherex" name="wherex">,
3253 <ref id="wherey" name="wherey">
3259 <sect1>gotoxy<label id="gotoxy"><p>
3263 <tag/Function/Move the text mode cursor to a new position.
3264 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3265 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
3266 <tag/Description/The function moves the text mode cursor to the specified
3267 position. The leftmost position on the screen has the X coordinate 0, the
3268 topmost line has the Y coordinate 0.
3269 <tag/Notes/<itemize>
3270 <item>The function is only available as fastcall function, so it may only be
3271 used in presence of a prototype.
3272 <item>Invalid values for any of both coordinates (out of screen positions) may
3273 lead to undefined behaviour.
3275 <tag/Availability/cc65
3277 <ref id="gotox" name="gotox">,
3278 <ref id="gotoy" name="gotoy">,
3279 <ref id="wherex" name="wherex">,
3280 <ref id="wherey" name="wherey">
3286 <sect1>gotoy<label id="gotoy"><p>
3290 <tag/Function/Move the text mode cursor to a new Y position.
3291 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3292 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
3293 <tag/Description/The function moves the text mode cursor to the specified Y
3294 position while leaving the X position untouched. The uppermost position on the
3295 screen has the coordinate 0.
3296 <tag/Notes/<itemize>
3297 <item>The function is only available as fastcall function, so it may
3298 only be used in presence of a prototype.
3299 <item>Invalid values for the Y position (out of screen coordinates) may lead
3300 to undefined behaviour.
3302 <tag/Availability/cc65
3304 <ref id="gotox" name="gotox">,
3305 <ref id="gotoxy" name="gotoxy">,
3306 <ref id="wherex" name="wherex">,
3307 <ref id="wherey" name="wherey">
3313 <sect1>isalnum<label id="isalnum"><p>
3317 <tag/Function/Check if a given character is a letter or digit.
3318 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3319 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
3320 <tag/Description/The function returns a non zero value if the given argument
3321 is a letter or digit. The return value is zero if the character is anything
3323 <tag/Notes/<itemize>
3324 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3325 inline sequence generated by the macro will not work correctly for values
3326 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3327 this range. The non inline function may be accessed by <tt/#undef/'ing
3329 <item>When compiling without <tt/-Os/, the function is only available as
3330 fastcall function, so it may only be used in presence of a prototype.
3332 <tag/Availability/ISO 9899
3334 <ref id="isalpha" name="isalpha">,
3335 <ref id="isascii" name="isascii">,
3336 <ref id="isblank" name="isblank">,
3337 <ref id="iscntrl" name="iscntrl">,
3338 <ref id="isdigit" name="isdigit">,
3339 <ref id="isgraph" name="isgraph">,
3340 <ref id="islower" name="islower">,
3341 <ref id="isprint" name="isprint">,
3342 <ref id="ispunct" name="ispunct">,
3343 <ref id="isspace" name="isspace">,
3344 <ref id="isupper" name="isupper">,
3345 <ref id="isxdigit" name="isxdigit">
3351 <sect1>isalpha<label id="isalpha"><p>
3355 <tag/Function/Check if a given character is a letter.
3356 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3357 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
3358 <tag/Description/The function returns a non zero value if the given argument
3359 is a letter. The return value is zero if the character is anything else.
3360 <tag/Notes/<itemize>
3361 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3362 inline sequence generated by the macro will not work correctly for values
3363 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3364 this range. The non inline function may be accessed by <tt/#undef/'ing the
3366 <item>When compiling without <tt/-Os/, the function is only available as
3367 fastcall function, so it may only be used in presence of a prototype.
3369 <tag/Availability/ISO 9899
3371 <ref id="isalnum" name="isalnum">,
3372 <ref id="isascii" name="isascii">,
3373 <ref id="isblank" name="isblank">,
3374 <ref id="iscntrl" name="iscntrl">,
3375 <ref id="isdigit" name="isdigit">,
3376 <ref id="isgraph" name="isgraph">,
3377 <ref id="islower" name="islower">,
3378 <ref id="isprint" name="isprint">,
3379 <ref id="ispunct" name="ispunct">,
3380 <ref id="isspace" name="isspace">,
3381 <ref id="isupper" name="isupper">,
3382 <ref id="isxdigit" name="isxdigit">
3388 <sect1>isascii<label id="isascii"><p>
3392 <tag/Function/Check if a given character is in the ASCII (0..127) range.
3393 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3394 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
3395 <tag/Description/The function returns a non zero value if the given argument
3396 is in the range 0..127 (the range of valid ASCII characters) and zero if not.
3397 <tag/Notes/<itemize>
3398 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3399 inline sequence generated by the macro will not work correctly for values
3400 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3401 this range. The non inline function may be accessed by <tt/#undef/'ing the
3403 <item>When compiling without <tt/-Os/, the function is only available as
3404 fastcall function, so it may only be used in presence of a prototype.
3406 <tag/Availability/ISO 9899
3408 <ref id="isalnum" name="isalnum">,
3409 <ref id="isalpha" name="isalpha">,
3410 <ref id="isblank" name="isblank">,
3411 <ref id="iscntrl" name="iscntrl">,
3412 <ref id="isdigit" name="isdigit">,
3413 <ref id="isgraph" name="isgraph">,
3414 <ref id="islower" name="islower">,
3415 <ref id="isprint" name="isprint">,
3416 <ref id="ispunct" name="ispunct">,
3417 <ref id="isspace" name="isspace">,
3418 <ref id="isupper" name="isupper">,
3419 <ref id="isxdigit" name="isxdigit">
3425 <sect1>isblank<label id="isblank"><p>
3429 <tag/Function/Check if a given character is a space or tab.
3430 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3431 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
3432 <tag/Description/The function returns a non zero value if the given argument
3433 is a space or tab character. The return value is zero if the character is
3435 <tag/Notes/<itemize>
3436 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3437 inline sequence generated by the macro will not work correctly for values
3438 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3439 this range. The non inline function may be accessed by <tt/#undef/'ing the
3441 <item>When compiling without <tt/-Os/, the function is only available as
3442 fastcall function, so it may only be used in presence of a prototype.
3444 <tag/Availability/ISO 9899
3446 <ref id="isalnum" name="isalnum">,
3447 <ref id="isalpha" name="isalpha">,
3448 <ref id="isascii" name="isascii">,
3449 <ref id="iscntrl" name="iscntrl">,
3450 <ref id="isdigit" name="isdigit">,
3451 <ref id="isgraph" name="isgraph">,
3452 <ref id="islower" name="islower">,
3453 <ref id="isprint" name="isprint">,
3454 <ref id="ispunct" name="ispunct">,
3455 <ref id="isspace" name="isspace">,
3456 <ref id="isupper" name="isupper">,
3457 <ref id="isxdigit" name="isxdigit">
3463 <sect1>iscntrl<label id="iscntrl"><p>
3467 <tag/Function/Check if a given character is a control character.
3468 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3469 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
3470 <tag/Description/The function returns a non zero value if the given argument
3471 is a control character. The return value is zero if the character is anything
3473 <tag/Notes/<itemize>
3474 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3475 inline sequence generated by the macro will not work correctly for values
3476 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3477 this range. The non inline function may be accessed by <tt/#undef/'ing the
3479 <item>When compiling without <tt/-Os/, the function is only available as
3480 fastcall function, so it may only be used in presence of a prototype.
3482 <tag/Availability/ISO 9899
3484 <ref id="isalnum" name="isalnum">,
3485 <ref id="isalpha" name="isalpha">,
3486 <ref id="isascii" name="isascii">,
3487 <ref id="isblank" name="isblank">,
3488 <ref id="isdigit" name="isdigit">,
3489 <ref id="isgraph" name="isgraph">,
3490 <ref id="islower" name="islower">,
3491 <ref id="isprint" name="isprint">,
3492 <ref id="ispunct" name="ispunct">,
3493 <ref id="isspace" name="isspace">,
3494 <ref id="isupper" name="isupper">,
3495 <ref id="isxdigit" name="isxdigit">
3501 <sect1>isdigit<label id="isdigit"><p>
3505 <tag/Function/Check if a given character is a digit.
3506 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3507 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
3508 <tag/Description/The function returns a non zero value if the given argument
3509 is a digit. The return value is zero if the character is anything else.
3510 <tag/Notes/<itemize>
3511 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3512 inline sequence generated by the macro will not work correctly for values
3513 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3514 this range. The non inline function may be accessed by <tt/#undef/'ing the
3516 <item>When compiling without <tt/-Os/, the function is only available as
3517 fastcall function, so it may only be used in presence of a prototype.
3519 <tag/Availability/ISO 9899
3521 <ref id="isalnum" name="isalnum">,
3522 <ref id="isalpha" name="isalpha">,
3523 <ref id="isascii" name="isascii">,
3524 <ref id="isblank" name="isblank">,
3525 <ref id="iscntrl" name="iscntrl">,
3526 <ref id="isgraph" name="isgraph">,
3527 <ref id="islower" name="islower">,
3528 <ref id="isprint" name="isprint">,
3529 <ref id="ispunct" name="ispunct">,
3530 <ref id="isspace" name="isspace">,
3531 <ref id="isupper" name="isupper">,
3532 <ref id="isxdigit" name="isxdigit">
3538 <sect1>isgraph<label id="isgraph"><p>
3542 <tag/Function/Check if a given character is a printable character (except
3544 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3545 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
3546 <tag/Description/The function returns a non zero value if the given argument
3547 is a printable character with the exception of space. The return value is zero
3548 if the character is anything else.
3549 <tag/Notes/<itemize>
3550 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3551 inline sequence generated by the macro will not work correctly for values
3552 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3553 this range. The non inline function may be accessed by <tt/#undef/'ing the
3555 <item>When compiling without <tt/-Os/, the function is only available as
3556 fastcall function, so it may only be used in presence of a prototype.
3558 <tag/Availability/ISO 9899
3560 <ref id="isalnum" name="isalnum">,
3561 <ref id="isalpha" name="isalpha">,
3562 <ref id="isascii" name="isascii">,
3563 <ref id="isblank" name="isblank">,
3564 <ref id="iscntrl" name="iscntrl">,
3565 <ref id="isdigit" name="isdigit">,
3566 <ref id="islower" name="islower">,
3567 <ref id="isprint" name="isprint">,
3568 <ref id="ispunct" name="ispunct">,
3569 <ref id="isspace" name="isspace">,
3570 <ref id="isupper" name="isupper">,
3571 <ref id="isxdigit" name="isxdigit">
3577 <sect1>islower<label id="islower"><p>
3581 <tag/Function/Check if a given character is a lower case letter.
3582 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3583 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
3584 <tag/Description/The function returns a non zero value if the given argument
3585 is a lower case letter. The return value is zero if the character is anything
3587 <tag/Notes/<itemize>
3588 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3589 inline sequence generated by the macro will not work correctly for values
3590 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3591 this range. The non inline function may be accessed by <tt/#undef/'ing the
3593 <item>When compiling without <tt/-Os/, the function is only available as
3594 fastcall function, so it may only be used in presence of a prototype.
3596 <tag/Availability/ISO 9899
3598 <ref id="isalnum" name="isalnum">,
3599 <ref id="isalpha" name="isalpha">,
3600 <ref id="isascii" name="isascii">,
3601 <ref id="isblank" name="isblank">,
3602 <ref id="iscntrl" name="iscntrl">,
3603 <ref id="isdigit" name="isdigit">,
3604 <ref id="isgraph" name="isgraph">,
3605 <ref id="isprint" name="isprint">,
3606 <ref id="ispunct" name="ispunct">,
3607 <ref id="isspace" name="isspace">,
3608 <ref id="isupper" name="isupper">,
3609 <ref id="isxdigit" name="isxdigit">
3615 <sect1>isprint<label id="isprint"><p>
3619 <tag/Function/Check if a given character is a printable character.
3620 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3621 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
3622 <tag/Description/The function returns a non zero value if the given argument
3623 is a printable character (this includes the space character). The return value
3624 is zero if the character is anything else.
3625 <tag/Notes/<itemize>
3626 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3627 inline sequence generated by the macro will not work correctly for values
3628 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3629 this range. The non inline function may be accessed by <tt/#undef/'ing the
3631 <item>When compiling without <tt/-Os/, the function is only available as
3632 fastcall function, so it may only be used in presence of a prototype.
3634 <tag/Availability/ISO 9899
3636 <ref id="isalnum" name="isalnum">,
3637 <ref id="isalpha" name="isalpha">,
3638 <ref id="isascii" name="isascii">,
3639 <ref id="isblank" name="isblank">,
3640 <ref id="iscntrl" name="iscntrl">,
3641 <ref id="isdigit" name="isdigit">,
3642 <ref id="isgraph" name="isgraph">,
3643 <ref id="islower" name="islower">,
3644 <ref id="ispunct" name="ispunct">,
3645 <ref id="isspace" name="isspace">,
3646 <ref id="isupper" name="isupper">,
3647 <ref id="isxdigit" name="isxdigit">
3653 <sect1>ispunct<label id="ispunct"><p>
3657 <tag/Function/Check if a given character is a printable character but not a
3658 space or an alphanumeric character.
3659 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3660 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
3661 <tag/Description/The function returns a non zero value if the given argument
3662 is a printable character, but not a space or anything alphanumeric. The return
3663 value is zero if the character is anything else.
3664 <tag/Notes/<itemize>
3665 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3666 inline sequence generated by the macro will not work correctly for values
3667 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3668 this range. The non inline function may be accessed by <tt/#undef/'ing the
3670 <item>When compiling without <tt/-Os/, the function is only available as
3671 fastcall function, so it may only be used in presence of a prototype.
3673 <tag/Availability/ISO 9899
3675 <ref id="isalnum" name="isalnum">,
3676 <ref id="isalpha" name="isalpha">,
3677 <ref id="isascii" name="isascii">,
3678 <ref id="isblank" name="isblank">,
3679 <ref id="iscntrl" name="iscntrl">,
3680 <ref id="isdigit" name="isdigit">,
3681 <ref id="isgraph" name="isgraph">,
3682 <ref id="islower" name="islower">,
3683 <ref id="isprint" name="isprint">,
3684 <ref id="isspace" name="isspace">,
3685 <ref id="isupper" name="isupper">,
3686 <ref id="isxdigit" name="isxdigit">
3692 <sect1>isspace<label id="isspace"><p>
3696 <tag/Function/Check if a given character is a white-space character.
3697 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3698 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
3699 <tag/Description/The function returns a non zero value if the given argument
3700 is a white space character. The return value is zero if the character is
3701 anything else. The standard white space characters are: space, formfeed ('\f'),
3702 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
3704 <tag/Notes/<itemize>
3705 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3706 inline sequence generated by the macro will not work correctly for values
3707 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3708 this range. The non inline function may be accessed by <tt/#undef/'ing the
3710 <item>When compiling without <tt/-Os/, the function is only available as
3711 fastcall function, so it may only be used in presence of a prototype.
3713 <tag/Availability/ISO 9899
3715 <ref id="isalnum" name="isalnum">,
3716 <ref id="isalpha" name="isalpha">,
3717 <ref id="isascii" name="isascii">,
3718 <ref id="isblank" name="isblank">,
3719 <ref id="iscntrl" name="iscntrl">,
3720 <ref id="isdigit" name="isdigit">,
3721 <ref id="isgraph" name="isgraph">,
3722 <ref id="islower" name="islower">,
3723 <ref id="isprint" name="isprint">,
3724 <ref id="ispunct" name="ispunct">,
3725 <ref id="isupper" name="isupper">,
3726 <ref id="isxdigit" name="isxdigit">
3732 <sect1>isupper<label id="isupper"><p>
3736 <tag/Function/Check if a given character is an upper case letter.
3737 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3738 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
3739 <tag/Description/The function returns a non zero value if the given argument
3740 is an upper case letter. The return value is zero if the character is anything
3742 <tag/Notes/<itemize>
3743 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3744 inline sequence generated by the macro will not work correctly for values
3745 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3746 this range. The non inline function may be accessed by <tt/#undef/'ing the
3748 <item>When compiling without <tt/-Os/, the function is only available as
3749 fastcall function, so it may only be used in presence of a prototype.
3751 <tag/Availability/ISO 9899
3753 <ref id="isalnum" name="isalnum">,
3754 <ref id="isalpha" name="isalpha">,
3755 <ref id="isascii" name="isascii">,
3756 <ref id="isblank" name="isblank">,
3757 <ref id="iscntrl" name="iscntrl">,
3758 <ref id="isdigit" name="isdigit">,
3759 <ref id="isgraph" name="isgraph">,
3760 <ref id="islower" name="islower">,
3761 <ref id="isprint" name="isprint">,
3762 <ref id="ispunct" name="ispunct">,
3763 <ref id="isspace" name="isspace">,
3764 <ref id="isxdigit" name="isxdigit">
3770 <sect1>isxdigit<label id="isxdigit"><p>
3774 <tag/Function/Check if a given character is a hexadecimal digit.
3775 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
3776 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
3777 <tag/Description/The function returns a non zero value if the given argument
3778 is a hexadecimal digit (0..9, a..f and A..F). The return value is zero if the
3779 character is anything else.
3780 <tag/Notes/<itemize>
3781 <item>When compiling with <tt/-Os/ the function is actually a macro. The
3782 inline sequence generated by the macro will not work correctly for values
3783 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
3784 this range. The non inline function may be accessed by <tt/#undef/'ing the
3786 <item>When compiling without <tt/-Os/, the function is only available as
3787 fastcall function, so it may only be used in presence of a prototype.
3789 <tag/Availability/ISO 9899
3791 <ref id="isalnum" name="isalnum">,
3792 <ref id="isalpha" name="isalpha">,
3793 <ref id="isascii" name="isascii">,
3794 <ref id="isblank" name="isblank">,
3795 <ref id="iscntrl" name="iscntrl">,
3796 <ref id="isdigit" name="isdigit">,
3797 <ref id="isgraph" name="isgraph">,
3798 <ref id="islower" name="islower">,
3799 <ref id="isprint" name="isprint">,
3800 <ref id="ispunct" name="ispunct">,
3801 <ref id="isspace" name="isspace">,
3802 <ref id="isupper" name="isupper">
3808 <sect1>itoa<label id="itoa"><p>
3812 <tag/Function/Convert an integer into a string.
3813 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3814 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
3815 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
3816 <tt/radix/ as the base.
3817 <tag/Notes/<itemize>
3818 <item>There are no provisions to prevent a buffer overflow.
3819 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
3820 <item>The function is non standard, so it is not available in strict ANSI mode.
3821 You should probably use <tt/sprintf/ instead.
3822 <item>The function is only available as fastcall function, so it may only be
3823 used in presence of a prototype.
3825 <tag/Availability/cc65
3827 <ref id="atoi" name="atoi">,
3828 <ref id="atol" name="atol">,
3829 <ref id="ltoa" name="ltoa">,
3830 <ref id="ultoa" name="ultoa">,
3831 <ref id="utoa" name="utoa">
3837 <sect1>joy_count<label id="joy_count"><p>
3841 <tag/Function/Return the number of joysticks supported by the current driver.
3842 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3843 <tag/Declaration/<tt/unsigned char joy_count (void);/
3844 <tag/Description/The function returns a the number of joysticks supported
3845 by the current joystick driver.
3846 <tag/Notes/<itemize>
3847 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
3848 name="joy_load_driver"> before calling this function.
3849 <item>The function returns the number of joysticks supported by the driver.
3850 There's no way to check for the number of actually connected joysticks.
3852 <tag/Availability/cc65
3854 <ref id="joy_load_driver" name="joy_load_driver">,
3855 <ref id="joy_read" name="joy_read">
3861 <sect1>joy_install<label id="joy_install"><p>
3865 <tag/Function/Install an already loaded driver and return an error code.
3866 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3867 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
3868 <tag/Description/The function installs a driver that was already loaded into
3869 memory (or linked statically to the program). It returns an error code
3870 (<tt/JOY_ERR_OK/ in case of success).
3871 <tag/Notes/<itemize>
3872 <item>The function is only available as fastcall function, so it may only be
3873 used in presence of a prototype.
3875 <tag/Availability/cc65
3877 <ref id="joy_load_driver" name="joy_load_driver">,
3878 <ref id="joy_uninstall" name="joy_uninstall">,
3879 <ref id="joy_unload" name="joy_unload">
3885 <sect1>joy_load_driver<label id="joy_load_driver"><p>
3889 <tag/Function/Load a driver from disk and install it.
3890 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3891 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
3892 <tag/Description/The function loads a driver with the given name from disk
3893 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
3894 driver was successfully loaded and installed.
3895 <tag/Notes/<itemize>
3896 <item>The function is only available as fastcall function, so it may only be
3897 used in presence of a prototype.
3899 <tag/Availability/cc65
3901 <ref id="joy_install" name="joy_install">,
3902 <ref id="joy_uninstall" name="joy_uninstall">,
3903 <ref id="joy_unload" name="joy_unload">
3909 <sect1>joy_read<label id="joy_read"><p>
3913 <tag/Function/Read the status of a joystick.
3914 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3915 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
3916 <tag/Description/The function reads the status bits for a joystick. The number
3917 of the joystick is passed as parameter. The result may be examined by using one
3918 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
3919 <tag/Notes/<itemize>
3920 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
3921 name="joy_load_driver"> before calling this function.
3922 <item>The function is only available as fastcall function, so it may only be
3923 used in presence of a prototype.
3925 <tag/Availability/cc65
3927 <ref id="joy_count" name="joy_count">,
3928 <ref id="joy_load_driver" name="joy_load_driver">,
3929 <ref id="joy_unload" name="joy_unload">
3935 <sect1>joy_uninstall<label id="joy_uninstall"><p>
3939 <tag/Function/Uninstall the current joystick driver.
3940 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3941 <tag/Declaration/<tt/unsigned char joy_uninstall (void);/
3942 <tag/Description/The function uninstalls the currently installed joystick
3943 driver. It does not remove the driver from memory. The function returns an
3944 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
3945 <tag/Notes/<itemize>
3946 <item>A joystick driver must be installed using <ref id="joy_install"
3947 name="joy_install"> before calling this function.
3949 <tag/Availability/cc65
3951 <ref id="joy_install" name="joy_install">,
3952 <ref id="joy_load_driver" name="joy_load_driver">,
3953 <ref id="joy_unload" name="joy_unload">
3959 <sect1>joy_unload<label id="joy_unload"><p>
3963 <tag/Function/Uninstall, then unload the current joystick driver.
3964 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
3965 <tag/Declaration/<tt/unsigned char joy_unload (void);/
3966 <tag/Description/The function uninstalls the currently installed joystick
3967 driver and removes it from memory. An error code is returned, which is
3968 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
3969 <tag/Notes/<itemize>
3970 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
3971 name="joy_load_driver"> before calling this function.
3973 <tag/Availability/cc65
3975 <ref id="joy_load_driver" name="joy_load_driver">
3981 <sect1>kbhit<label id="kbhit"><p>
3985 <tag/Function/Check if there's a key waiting in the keyboard buffer.
3986 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3987 <tag/Declaration/<tt/unsigned char kbhit (void);/
3988 <tag/Description/The function returns a value of zero if there is no character
3989 waiting to be read from the keyboard. It returns non zero otherwise.
3990 <tag/Notes/<itemize>
3991 <item>If the system does not support a keyboard buffer (most systems
3992 do), the function is rather useless.
3994 <tag/Availability/cc65
3996 <ref id="cgetc" name="cgetc">,
3997 <ref id="cursor" name="cursor">
4003 <sect1>kbrepeat<label id="kbrepeat"><p>
4007 <tag/Function/Set the keyboard repeat mode.
4008 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
4009 <tag/Declaration/<tt/unsigned char __fastcall__ kbrepeat (unsigned char mode);/
4010 <tag/Description/This function changes which keys have automatic repeat when
4011 being held down for a certain time. Possible values are <tt/KBREPEAT_CURSOR/
4012 (repeat only cursor-related keys), <tt/KBREPEAT_NONE/ (no repeat for any
4013 keys), and <tt/KBREPEAT_ALL/ (repeat all keys). The old mode is returned, so
4014 it can be restored later.
4015 <tag/Notes/<itemize>
4016 <item>The function is available only as a fastcall function; so, it may be used
4017 only in the presence of a prototype.
4019 <tag/Availability/cc65
4025 <sect1>labs<label id="labs"><p>
4029 <tag/Function/Returns the absolute value of a long integer.
4030 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4031 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
4032 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
4034 <tag/Notes/<itemize>
4035 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
4036 <item>The function is only available as fastcall function, so it may only be
4037 used in presence of a prototype.
4039 <tag/Availability/ISO 9899
4041 <ref id="abs" name="abs">
4047 <sect1>ltoa<label id="ltoa"><p>
4051 <tag/Function/Convert a long integer into a string.
4052 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4053 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
4054 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
4055 using <tt/radix/ as the base.
4056 <tag/Notes/<itemize>
4057 <item>There are no provisions to prevent a buffer overflow.
4058 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
4059 <item>The function is non standard, so it is not available in strict ANSI mode.
4060 You should probably use <tt/sprintf/ instead.
4061 <item>The function is only available as fastcall function, so it may only be
4062 used in presence of a prototype.
4064 <tag/Availability/cc65
4066 <ref id="atoi" name="atoi">,
4067 <ref id="atol" name="atol">,
4068 <ref id="itoa" name="itoa">,
4069 <ref id="ultoa" name="ultoa">,
4070 <ref id="utoa" name="utoa">
4076 <sect1>localeconv<label id="localeconv"><p>
4080 <tag/Function/Returns a pointer to the current locale structure.
4081 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4082 <tag/Declaration/<tt/struct lconv* localeconv (void);/
4083 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
4085 <tag/Notes/<itemize>
4086 <item>cc65 supports only the "C" locale, so even after setting a new locale
4087 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
4090 <tag/Availability/ISO 9899
4092 <ref id="setlocale" name="setlocale">
4098 <sect1>longjmp<label id="longjmp"><p>
4102 <tag/Function/Non local goto.
4103 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4104 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
4105 <tag/Description/The <tt/longjmp/ function restores a program context from the
4106 data in <tt/buf/, which must have been set by a preceeding call to
4107 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
4108 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
4110 <tag/Notes/<itemize>
4111 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
4112 was called with a value of one.
4113 <item>The function is only available as fastcall function, so it may only
4114 be used in presence of a prototype.
4116 <tag/Availability/ISO 9899
4118 <ref id="setjmp" name="setjmp">
4124 <sect1>malloc<label id="malloc"><p>
4128 <tag/Function/Allocate dynamic memory.
4129 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4130 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
4131 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
4132 pointer to the allocated memory block. On error (not enough memory available),
4133 <tt/malloc/ returns <tt/NULL/.
4134 <tag/Notes/<itemize>
4135 <item>The function is only available as fastcall function, so it may only
4136 be used in presence of a prototype.
4138 <tag/Availability/ISO 9899
4140 <ref id="_heapadd" name="_heapadd">,
4141 <ref id="_heapblocksize" name="_heapblocksize">,
4142 <ref id="_heapmaxavail" name="_heapmaxavail">,
4143 <ref id="_heapmemavail" name="_heapmemavail">,
4144 <ref id="calloc" name="calloc">,
4145 <ref id="free" name="free">,
4146 <ref id="realloc" name="realloc">,
4147 <ref id="strdup" name="strdup">
4153 <sect1>memchr<label id="memchr"><p>
4157 <tag/Function/Search for a character in a block of raw memory.
4158 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4159 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
4160 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
4161 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
4162 that is of size <tt/count/. Upon completion, the function returns a pointer to
4163 the character found, or a null pointer if the character was not found.
4164 <tag/Notes/<itemize>
4165 <item>The function is only available as fastcall function, so it may only
4166 be used in presence of a prototype.
4168 <tag/Availability/ISO 9899
4170 <ref id="strchr" name="strchr">
4176 <sect1>memcmp<label id="memcmp"><p>
4180 <tag/Function/Compare two memory areas.
4181 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4182 <tag/Declaration/<tt/int __fastcall__ memcmp (const void* p1, const void* p2, size_t count);/
4183 <tag/Description/<tt/memcmp/ compares <tt/count/ bytes from the memory area
4184 pointed to by <tt/p1/ into the memory area pointed to by <tt/p2/. It returns a value that is less than
4185 zero if <tt/p1/ is less than <tt/p2/, zero if <tt/p1/ is the same as <tt/p2/,
4186 and a value greater than zero if <tt/p1/ is greater than <tt/p2/.
4187 <tag/Notes/<itemize>
4188 <item>The function is only available as fastcall function, so it may only
4189 be used in presence of a prototype.
4191 <tag/Availability/ISO 9899
4193 <ref id="strcmp" name="strcmp">,
4194 <ref id="memmove" name="memmove">,
4195 <ref id="memset" name="memset">
4201 <sect1>memcpy<label id="memcpy"><p>
4205 <tag/Function/Copy a memory area.
4206 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4207 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
4208 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
4209 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4211 <tag/Notes/<itemize>
4212 <item>The result is undefined if the memory areas do overlap. Use
4213 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
4214 <item>The function is only available as fastcall function, so it may only
4215 be used in presence of a prototype.
4217 <tag/Availability/ISO 9899
4219 <ref id="_swap" name="_swap">,
4220 <ref id="memmove" name="memmove">,
4221 <ref id="memset" name="memset">
4227 <sect1>memmove<label id="memmove"><p>
4231 <tag/Function/Copy a memory area.
4232 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4233 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
4234 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
4235 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
4237 <tag/Notes/<itemize>
4238 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
4239 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
4240 <item>The function is only available as fastcall function, so it may only
4241 be used in presence of a prototype.
4243 <tag/Availability/ISO 9899
4245 <ref id="_swap" name="_swap">,
4246 <ref id="memcpy" name="memcpy">,
4247 <ref id="memset" name="memset">
4253 <sect1>memset<label id="memset"><p>
4257 <tag/Function/Fill a memory area.
4258 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4259 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
4260 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
4261 the value <tt/val/. The function returns <tt/p/.
4262 <tag/Notes/<itemize>
4263 <item>The function is only available as fastcall function, so it may only
4264 be used in presence of a prototype.
4266 <tag/Availability/ISO 9899
4268 <ref id="_swap" name="_swap">,
4269 <ref id="bzero" name="bzero">,
4270 <ref id="memcpy" name="memcpy">,
4271 <ref id="memmove" name="memmove">
4277 <sect1>mod_free<label id="mod_free"><p>
4281 <tag/Function/Free a relocatable module.
4282 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4283 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
4284 <tag/Description/The function will free a module loaded into memory by use of
4285 the <tt/<ref id="mod_load" name="mod_load">/ function.
4286 <tag/Notes/<itemize>
4287 <item>The pointer passed as parameter is the pointer to the module memory,
4288 not the pointer to the control structure.
4289 <item>The function is available only as a fastcall function; so, it may be used
4290 only in the presence of a prototype.
4292 <tag/Availability/cc65
4294 <ref id="mod_load" name="mod_load">
4300 <sect1>mod_load<label id="mod_load"><p>
4304 <tag/Function/Load a relocatable module.
4305 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
4306 <tag/Declaration/<tt/unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl);/
4307 <tag/Description/The function will load a code module into memory and relocate
4308 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
4309 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
4310 the module just loaded. Possible error codes are:
4312 <item><tt/MLOAD_OK/ - Module load successful
4313 <item><tt/MLOAD_ERR_READ/ - Read error
4314 <item><tt/MLOAD_ERR_HDR/ - Header error
4315 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
4316 <item><tt/MLOAD_ERR_FMT/ - Data format error
4317 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
4319 <tag/Notes/<itemize>
4320 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
4321 relocatable o65 modules for use with this function.
4322 <item>The function is available only as a fastcall function; so, it may be used
4323 only in the presence of a prototype.
4325 <tag/Availability/cc65
4327 <ref id="mod_free" name="mod_free">
4333 <sect1>mouse_setbox<label id="mouse_setbox"><p>
4337 <tag/Function/Specify a bounding box for the mouse cursor.
4338 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4339 <tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
4340 <tag/Description/The function allows to set a bounding box for mouse movement.
4341 <tag/Notes/<itemize>
4342 <item>The function does not check if the mouse cursor is currently within the
4343 given rectangle. Placing the mouse cursor within the bounding box is the
4344 responsibility of the programmer.
4345 <item>While the bounding box may be larger than the actual screen size, the
4346 standard mouse cursor draw routines may fail to set the cursor to coordinates
4347 outside of the screen area. Depending on the platform, you may have to supply
4348 your own mouse cursor routines.
4349 <item>The function is only available as fastcall function, so it may only be
4350 used in presence of a prototype.
4352 <tag/Availability/cc65
4354 <ref id="mouse_getbox" name="mouse_getbox">,
4355 <ref id="mouse_move" name="mouse_move">
4361 <sect1>mouse_getbox<label id="mouse_getbox"><p>
4365 <tag/Function/Return the current bounding box for the mouse cursor.
4366 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4367 <tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
4368 <tag/Description/The function queries the current bounding box for mouse
4370 <tag/Notes/<itemize>
4371 <item>The function is only available as fastcall function, so it may only be
4372 used in presence of a prototype.
4374 <tag/Availability/cc65
4376 <ref id="mouse_move" name="mouse_move">,
4377 <ref id="mouse_setbox" name="mouse_setbox">
4383 <sect1>mouse_buttons<label id="mouse_buttons"><p>
4387 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
4388 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4389 <tag/Declaration/<tt/unsigned char mouse_buttons (void);/
4390 <tag/Description/The function returns a bit mask that encodes the state of the
4391 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
4393 <tag/Availability/cc65
4395 <ref id="mouse_info" name="mouse_info">,
4396 <ref id="mouse_pos" name="mouse_pos">
4402 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
4406 <tag/Function/Return a readable error message for an error code.
4407 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4408 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
4410 <tag/Description/The function returns an error message (in english) for the
4411 error code passed parameter.
4412 <tag/Notes/<itemize>
4413 <item>The function will return "Unknown error" for invalid error codes.
4414 <item>The function is only available as fastcall function, so it may only be
4415 used in presence of a prototype.
4417 <tag/Availability/cc65
4419 <ref id="mouse_load_driver" name="mouse_load_driver">,
4420 <ref id="mouse_uninstall" name="mouse_uninstall">,
4421 <ref id="mouse_unload" name="mouse_unload">
4427 <sect1>mouse_hide<label id="mouse_hide"><p>
4431 <tag/Function/Hide the mouse pointer.
4432 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4433 <tag/Declaration/<tt/void mouse_hide (void);/
4434 <tag/Description/The function hides the mouse pointer. It manages a counter
4435 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
4436 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
4437 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
4439 <tag/Availability/cc65
4441 <ref id="mouse_show" name="mouse_show">
4447 <sect1>mouse_info<label id="mouse_info"><p>
4451 <tag/Function/Return the state of the mouse buttons and the position of the
4453 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4454 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
4455 <tag/Description/The function returns the state of the mouse buttons and the
4456 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
4457 <tag/Notes/<itemize>
4458 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
4459 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
4460 name="mouse_pos">/ instead.
4461 <item>The function is only available as fastcall function, so it may only be
4462 used in presence of a prototype.
4464 <tag/Availability/cc65
4466 <ref id="mouse_buttons" name="mouse_buttons">,
4467 <ref id="mouse_pos" name="mouse_pos">
4473 <sect1>mouse_install<label id="mouse_install"><p>
4477 <tag/Function/Install an already loaded mouse driver.
4478 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4479 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
4480 mouse_callbacks* c, void* driver);/
4481 <tag/Description/The function installs an already loaded mouse driver and
4482 returns an error code. The <tt/mouse_callbacks/ structure passed as first
4483 parameter contains pointers to routines needed to move or hide/show the mouse
4484 pointer. Defaults for these routines are supplied by the library, so if you
4485 can live with these defaults (which are platform specific), just pass a
4486 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
4487 driver linked statically to the program.
4488 <tag/Notes/<itemize>
4489 <item>Not all drivers are able to detect if the supported hardware is really
4491 <item>After installing a driver, the mouse cursor is hidden.
4492 <item>The function is only available as fastcall function, so it may only be
4493 used in presence of a prototype.
4495 <tag/Availability/cc65
4497 <ref id="mouse_load_driver" name="mouse_load_driver">,
4498 <ref id="mouse_uninstall" name="mouse_uninstall">,
4499 <ref id="mouse_unload" name="mouse_unload">
4505 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
4509 <tag/Function/Call the driver specific ioctl function.
4510 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4511 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
4512 <tag/Description/The function calls the IOCTL entry in the mouse driver,
4513 which is driver specific. The <tt/code/ parameter will choose between
4514 different IOCTL functions, and the <tt/data/ depends on code. The
4515 function returns an error code. The purpose of this function is to allow
4516 for driver specific extensions. See the documentation for a specific mouse
4517 driver for supported ioctl calls.
4518 <tag/Notes/<itemize>
4519 <item>Calling this function is non portable, because each driver may
4520 implement different ioctl calls (or none at all).
4521 <item>The function is only available as fastcall function, so it may only be
4522 used in presence of a prototype.
4524 <tag/Availability/cc65
4530 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
4534 <tag/Function/Load and initialize a mouse driver.
4535 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4536 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
4537 mouse_callbacks* c, const char* driver);/
4538 <tag/Description/Load a mouse driver into memory and initialize it. The
4539 function returns an error code that tells if the call has been successful. The
4540 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
4541 routines needed to move or hide/show the mouse pointer. Defaults for these
4542 routines are supplied by the library, so if you can live with these defaults
4543 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
4544 <tag/Notes/<itemize>
4545 <item>The driver is loaded by name, so currently you must know the type of
4546 mouse that should be supported. There is no autodetect capability.
4547 <item>Not all drivers are able to detect if the supported hardware is really
4549 <item>After installing a driver, the mouse cursor is hidden.
4550 <item>The function is only available as fastcall function, so it may only be
4551 used in presence of a prototype.
4553 <tag/Availability/cc65
4555 <ref id="mouse_install" name="mouse_install">,
4556 <ref id="mouse_uninstall" name="mouse_uninstall">,
4557 <ref id="mouse_unload" name="mouse_unload">
4563 <sect1>mouse_move<label id="mouse_move"><p>
4567 <tag/Function/Move the mouse cursor to a specific position.
4568 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4569 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
4570 <tag/Description/The function updates the mouse position. If the mouse cursor
4571 is visible, it is shown at the new position.
4572 <tag/Notes/<itemize>
4573 <item>The function does not check if the new position is within the bounding
4574 box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
4575 <item>The function is only available as fastcall function, so it may only be
4576 used in presence of a prototype.
4578 <tag/Availability/cc65
4580 <ref id="mouse_getbox" name="mouse_getbox">,
4581 <ref id="mouse_setbox" name="mouse_setbox">
4587 <sect1>mouse_pos<label id="mouse_pos"><p>
4591 <tag/Function/Return the position of the mouse.
4592 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4593 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
4594 <tag/Description/The function returns the position of the mouse in the
4595 <tt/mouse_pos/ structure passed as parameter.
4596 <tag/Notes/<itemize>
4597 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
4598 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
4599 name="mouse_info">/ instead.
4600 <item>The function is only available as fastcall function, so it may only be
4601 used in presence of a prototype.
4603 <tag/Availability/cc65
4605 <ref id="mouse_buttons" name="mouse_buttons">,
4606 <ref id="mouse_info" name="mouse_info">
4612 <sect1>mouse_show<label id="mouse_show"><p>
4616 <tag/Function/Show the mouse pointer.
4617 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4618 <tag/Declaration/<tt/void mouse_show (void);/
4619 <tag/Description/The function shows the mouse pointer. It manages a counter
4620 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
4621 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
4622 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
4623 <tag/Availability/cc65
4625 <ref id="mouse_hide" name="mouse_hide">
4631 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
4635 <tag/Function/Uninstall an already loaded mouse driver.
4636 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4637 <tag/Declaration/<tt/unsigned char mouse_uninstall (void);/
4638 <tag/Description/The function uninstalls an already loaded mouse driver but
4639 don't removes it from memory.
4640 <tag/Notes/<itemize>
4641 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
4642 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
4643 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
4646 <tag/Availability/cc65
4648 <ref id="mouse_install" name="mouse_install">,
4649 <ref id="mouse_load_driver" name="mouse_load_driver">,
4650 <ref id="mouse_unload" name="mouse_unload">
4656 <sect1>mouse_unload<label id="mouse_unload"><p>
4660 <tag/Function/Unload a mouse driver.
4661 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
4662 <tag/Declaration/<tt/unsigned char mouse_unload (void);/
4663 <tag/Description/The function unloads a loaded mouse driver and frees all
4664 memory allocated for the driver.
4665 <tag/Notes/<itemize>
4666 <item>The function does nothing if no driver is loaded.
4668 <tag/Availability/cc65
4670 <ref id="mouse_install" name="mouse_install">,
4671 <ref id="mouse_load_driver" name="mouse_load_driver">,
4672 <ref id="mouse_uninstall" name="mouse_uninstall">
4678 <sect1>offsetof<label id="offsetof"><p>
4682 <tag/Function/Calculate the offset of a struct or union member.
4683 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
4684 <tag/Declaration/<tt/size_t offsetof (type, member);/
4685 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
4686 or <tt/union/ member.
4687 <tag/Notes/<itemize>
4688 <item>The function is actually a macro.
4690 <tag/Availability/ISO 9899
4696 <sect1>open<label id="open"><p>
4700 <tag/Function/Open and possibly create a file.
4701 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
4702 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
4703 <tag/Description/<tt/open/ opens a file and returns the file descriptor
4704 associated with it. On error, -1 is returned and an error code is stored in
4705 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
4706 <tag/Notes/<itemize>
4707 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
4708 open, which is used as the permission mask when a new file is created. While
4709 cc65 allows to pass this argument, it is ignored.
4711 <tag/Availability/POSIX 1003.1
4713 <ref id="close" name="close">,
4714 <ref id="creat" name="creat">
4720 <sect1>opendir<label id="opendir"><p>
4724 <tag/Function/Open a directory.
4725 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
4726 <tag/Declaration/<tt/DIR* __fastcall__ opendir (const char* name);/
4727 <tag/Description/<tt/opendir/ opens a directory and returns the direcory
4728 descriptor associated with it. On error, NULL is returned and an error code is
4729 stored in <tt/errno/.
4730 <tag/Notes/<itemize>
4731 <item>The function is only available as fastcall function, so it may only
4732 be used in presence of a prototype.
4734 <tag/Availability/POSIX 1003.1
4736 <ref id="closedir" name="closedir">,
4737 <ref id="readdir" name="readdir">
4743 <sect1>peekbsys<label id="peekbsys"><p>
4747 <tag/Function/Read one byte from a location in the system bank.
4748 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4749 <tt/<ref id="cbm510.h" name="cbm510.h">/
4750 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
4751 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
4752 system bank (bank 15) of the CBM PET-II machines and returns it.
4753 <tag/Notes/<itemize>
4754 <item>The function is only available as fastcall function, so it may only
4755 be used in presence of a prototype.
4756 <item>This function may be a macro depending on the compiler options. The
4757 actual function is accessible by #undef'ing the macro.
4759 <tag/Availability/cc65
4761 <ref id="PEEK" name="PEEK">,
4762 <ref id="PEEKW" name="PEEKW">,
4763 <ref id="peekwsys" name="peekwsys">,
4764 <ref id="pokebsys" name="pokebsys">,
4765 <ref id="pokewsys" name="pokewsys">
4771 <sect1>peekwsys<label id="peekwsys"><p>
4775 <tag/Function/Read one word from a location in the system bank.
4776 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4777 <tt/<ref id="cbm510.h" name="cbm510.h">/
4778 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
4779 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
4780 system bank (bank 15) of the CBM PET-II machines and returns it. Following
4781 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
4782 high byte is read from <tt/addr+1/.
4783 <tag/Notes/<itemize>
4784 <item>The function is only available as fastcall function, so it may only
4785 be used in presence of a prototype.
4786 <item>The order in which the two bytes are read is undefined.
4788 <tag/Availability/cc65
4790 <ref id="PEEK" name="PEEK">,
4791 <ref id="PEEKW" name="PEEKW">,
4792 <ref id="peekbsys" name="peekbsys">,
4793 <ref id="pokebsys" name="pokebsys">,
4794 <ref id="pokewsys" name="pokewsys">
4800 <sect1>perror<label id="perror"><p>
4804 <tag/Function/Print an error message for the error in <tt/errno/.
4805 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
4806 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
4807 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
4808 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
4809 a blank. Then the error message for the current contents of <tt/errno/ is
4810 printed followed by a newline. The message output is the same as returned by
4811 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
4812 <tag/Notes/<itemize>
4813 <item>The function is only available as fastcall function, so it may only
4814 be used in presence of a prototype.
4816 <tag/Availability/ISO 9899
4818 <ref id="_poserror" name="_poserror">,
4819 <ref id="strerror" name="strerror">
4825 <sect1>pokebsys<label id="pokebsys"><p>
4829 <tag/Function/Write one byte to a location in the system bank.
4830 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4831 <tt/<ref id="cbm510.h" name="cbm510.h">/
4832 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
4833 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
4834 system bank (bank 15) of the CBM PET-II machines.
4835 <tag/Notes/<itemize>
4836 <item>The function is only available as fastcall function, so it may only
4837 be used in presence of a prototype.
4839 <tag/Availability/cc65
4841 <ref id="POKE" name="POKE">,
4842 <ref id="POKEW" name="POKEW">,
4843 <ref id="peekbsys" name="peekbsys">,
4844 <ref id="peekwsys" name="peekwsys">,
4845 <ref id="pokewsys" name="pokewsys">
4851 <sect1>pokewsys<label id="pokewsys"><p>
4855 <tag/Function/Write one word to a location in the system bank.
4856 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
4857 <tt/<ref id="cbm510.h" name="cbm510.h">/
4858 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
4859 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
4860 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
4861 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
4862 high byte is written to <tt/addr+1/.
4863 <tag/Notes/<itemize>
4864 <item>The function is only available as fastcall function, so it may only
4865 be used in presence of a prototype.
4866 <item>The order in which the two bytes are written is undefined.
4868 <tag/Availability/cc65
4870 <ref id="POKE" name="POKE">,
4871 <ref id="POKEW" name="POKEW">,
4872 <ref id="peekbsys" name="peekbsys">,
4873 <ref id="peekwsys" name="peekwsys">,
4874 <ref id="pokebsys" name="pokebsys">
4880 <sect1>qsort<label id="qsort"><p>
4884 <tag/Function/Sort an array.
4885 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4886 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
4887 size_t size, int __fastcall__ (* compare) (const void*, const void*));/
4888 <tag/Description/<tt/qsort/ sorts an array according to a given compare
4889 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
4890 is the number of elements, <tt/size/ the size of an element and <tt/compare/
4891 the function used to compare the members.
4892 <tag/Notes/<itemize>
4893 <item>If there are multiple members with the same key, the order after calling
4894 the function is undefined.
4895 <item>The function is only available as fastcall function, so it may only
4896 be used in presence of a prototype.
4897 <item>The function to which <tt/compare/ points must have the <tt/fastcall/
4900 <tag/Availability/ISO 9899
4902 <ref id="bsearch" name="bsearch">
4908 <sect1>raise<label id="raise"><p>
4912 <tag/Function/Send a signal to the executing program.
4913 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
4914 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
4915 <tag/Description/<tt/raise/ sends the given signal to the program. If the
4916 program has installed a signal handler for the signal, this signal handler
4917 will be executed. If no handler has been installed, the default action for
4918 the raised signal will be taken. The function returns zero on success,
4920 <tag/Notes/<itemize>
4921 <item>The function is only available as fastcall function, so it may only
4922 be used in presence of a prototype.
4924 <tag/Availability/ISO 9899
4926 <ref id="abort" name="abort">,
4927 <ref id="signal" name="signal">
4933 <sect1>rand<label id="rand"><p>
4937 <tag/Function/Return a pseudo random number.
4938 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4939 <tag/Declaration/<tt/int rand (void);/
4940 <tag/Description/The function returns a pseudo random number
4941 between 0 and <tt/RAND_MAX/ (exclusive).
4942 <tag/Notes/<itemize>
4943 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
4944 flow of numbers is generated.
4945 <item>On startup, the function behaves as if <ref id="srand" name="srand">
4946 had been used with an argument of 1.
4948 <tag/Availability/ISO 9899
4950 <ref id="_randomize" name="_randomize">,
4951 <ref id="srand" name="srand">
4957 <sect1>readdir<label id="readdir"><p>
4961 <tag/Function/Read a directory.
4962 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
4963 <tag/Declaration/<tt/struct dirent* __fastcall__ readdir (DIR* dir);/
4964 <tag/Description/<tt/readdir/ reads the next directory entry from the directory
4965 stream pointed to by <tt/dir/. It stores the data in a <tt/dirent/ structure
4966 and returns a pointer to it. If the end of directory is reached, or an error
4967 occurs, NULL is returned. In case of errors, an error code is stored into
4969 <tag/Notes/<itemize>
4970 <item>The function is only available as fastcall function, so it may only
4971 be used in presence of a prototype.
4972 <item>The returned pointer may point to a statically allocated instance of
4973 <tt/struct dirent/, so it may get overwritten by subsequent calls to
4975 <item>On several platforms, namely the CBMs and the Atari, the disk drives get
4976 confused when opening/closing files between directory reads. So for example a
4977 program that reads the list of files on a disk, and after each call to
4978 <tt/readdir/, opens the file to process it, will fail.<newline>
4979 Possible solutions are reading the directory into memory before processing the
4980 file list, or to reset the directory by seeking to the correct position after
4981 opening/closing a file:
4983 seekdir (DIR, telldir (DIR));
4985 Platforms known to work without problems are: Apple.
4987 <tag/Availability/POSIX 1003.1
4989 <ref id="closedir" name="closedir">,
4990 <ref id="opendir" name="opendir">
4996 <sect1>realloc<label id="realloc"><p>
5000 <tag/Function/Change the size of an allocated memory block.
5001 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5002 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
5003 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
5004 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
5005 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
5006 behaves as if <tt/free/ had been called. On error (not enough memory
5007 available), <tt/realloc/ returns <tt/NULL/.
5008 <tag/Notes/<itemize>
5009 <item>The part of the memory block that is returned will have its contents
5011 <item>This function is somewhat dangerous to use. Be careful to save the
5012 pointer you're passing somewhere else, otherwise
5014 ptr = realloc (ptr, size);
5016 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
5017 <item>The function is only available as fastcall function, so it may only
5018 be used in presence of a prototype.
5020 <tag/Availability/ISO 9899
5022 <ref id="_heapadd" name="_heapadd">,
5023 <ref id="_heapblocksize" name="_heapblocksize">,
5024 <ref id="_heapmaxavail" name="_heapmaxavail">,
5025 <ref id="_heapmemavail" name="_heapmemavail">,
5026 <ref id="calloc" name="calloc">,
5027 <ref id="free" name="free">,
5028 <ref id="realloc" name="realloc">
5034 <sect1>remove<label id="remove"><p>
5038 <tag/Function/Delete a file.
5039 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5040 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
5041 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
5042 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5043 code describing the reason for the failure.
5044 <tag/Notes/<itemize>
5045 <item>This function is not available on all cc65 targets (depends on the
5046 availability of file I/O).
5047 <item>The function is only available as fastcall function, so it may only
5048 be used in presence of a prototype.
5050 <tag/Availability/ISO 9899
5052 <ref id="rename" name="rename">,
5053 <ref id="unlink" name="unlink">
5056 #include <stdio.h>
5058 #define FILENAME "helloworld"
5060 if (remove (FILENAME) == 0) {
5061 printf ("We deleted %s successfully\n", FILENAME);
5063 printf ("There was a problem deleting %s\n", FILENAME);
5070 <sect1>rename<label id="rename"><p>
5074 <tag/Function/Rename a file.
5075 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5076 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
5077 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
5078 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5079 code describing the reason for the failure.
5080 <tag/Notes/<itemize>
5081 <item>This function is not available on all cc65 targets (depends on the
5082 capabilities of the storage devices).
5083 <item>The function is only available as fastcall function, so it may only
5084 be used in presence of a prototype.
5086 <tag/Availability/ISO 9899
5088 <ref id="remove" name="remove">
5091 #include <stdio.h>
5093 #define OLDNAME "textfile.txt"
5094 #define NEWNAME "textfile.bak"
5096 if (rename (OLDNAME, NEWNAME) == 0) {
5097 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
5099 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
5106 <sect1>reset_brk<label id="reset_brk"><p>
5110 <tag/Function/Resets the break vector to its original value.
5111 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5112 <tag/Declaration/<tt/void reset_brk (void);/
5113 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
5114 before a call to <tt/set_brk/.
5115 <tag/Notes/<itemize>
5116 <item>The break vector is reset on program termination, so it's not strictly
5117 necessary to call this function as a part of your clean-up when exitting the program.
5119 <tag/Availability/cc65
5121 <ref id="reset_irq" name="reset_irq">,
5122 <ref id="set_brk" name="set_brk">,
5123 <ref id="set_irq" name="set_irq">
5129 <sect1>reset_irq<label id="reset_irq"><p>
5133 <tag/Function/Resets the C level interrupt request vector.
5134 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5135 <tag/Declaration/<tt/void reset_irq (void);/
5136 <tag/Description/<tt/reset_irq/ resets the C level interrupt request vector.
5137 <tag/Notes/<itemize>
5138 <item>The interrupt vector is reset on program termination, so it's not strictly
5139 necessary to call this function as a part of your clean-up when exitting the program.
5141 <tag/Availability/cc65
5143 <ref id="reset_brk" name="reset_brk">,
5144 <ref id="set_brk" name="set_brk">,
5145 <ref id="set_irq" name="set_irq">
5151 <sect1>revers<label id="revers"><p>
5155 <tag/Function/Control revers character display.
5156 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5157 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
5158 <tag/Description/If the argument is non zero, the function enables reverse
5159 character display. If the argument is zero, reverse character display is
5160 switched off. The old value of the setting is returned.
5161 <tag/Notes/<itemize>
5162 <item>The function may not be supported by the hardware, in which case
5163 the call is ignored.
5164 <item>The function is only available as fastcall function, so it may only
5165 be used in presence of a prototype.
5167 <tag/Availability/cc65
5169 <ref id="textcolor" name="textcolor">
5175 <sect1>rewinddir<label id="rewinddir"><p>
5179 <tag/Function/Reset a directory stream.
5180 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5181 <tag/Declaration/<tt/void __fastcall__ rewinddir (DIR* dir);/
5182 <tag/Description/<tt/rewinddir/ sets the position of the directory stream
5183 pointed to by <tt/dir/ to the start of the directory.
5184 <tag/Notes/<itemize>
5185 <item>The function is only available as fastcall function, so it may only
5186 be used in presence of a prototype.
5188 <tag/Availability/POSIX 1003.1
5190 <ref id="seekdir" name="seekdir">,
5191 <ref id="telldir" name="telldir">
5197 <sect1>screensize<label id="screensize"><p>
5201 <tag/Function/Return the dimensions of the text mode screen.
5202 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5203 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
5204 <tag/Description/The function returns the dimensions of the text mode screen.
5205 <tag/Notes/<itemize>
5206 <item>The function is only available as fastcall function, so it may only
5207 be used in presence of a prototype.
5209 <tag/Availability/cc65
5211 <ref id="gotox" name="gotox">,
5212 <ref id="gotoxy" name="gotoxy">,
5213 <ref id="gotoy" name="gotoy">,
5214 <ref id="wherex" name="wherex">,
5215 <ref id="wherey" name="wherey">
5221 <sect1>seekdir<label id="seekdir"><p>
5225 <tag/Function/Set the position of a directory stream.
5226 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5227 <tag/Declaration/<tt/void __fastcall__ seekdir (DIR* dir, long offset);/
5228 <tag/Description/<tt/seekdir/ sets the position of the directory stream
5229 pointed to by <tt/dir/ to the value given in <tt/offset/, which should be a
5230 value returned by <tt/<ref id="telldir" name="telldir">/.
5231 <tag/Notes/<itemize>
5232 <item>The function is only available as fastcall function, so it may only
5233 be used in presence of a prototype.
5235 <tag/Availability/POSIX 1003.1
5237 <ref id="rewinddir" name="rewinddir">,
5238 <ref id="telldir" name="telldir">
5244 <sect1>ser_close<label id="ser_close"><p>
5248 <tag/Function/Close the port and disable interrupts
5249 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5250 <tag/Declaration/<tt/unsigned char ser_close (void);/
5251 <tag/Description/Close the port by clearing buffers and disable interrupts.
5252 <tag/Availability/cc65
5253 <tag/See also/Other serial functions.
5258 static void initialize(){
5259 struct ser_params params = {
5266 ser_install(lynx_comlynx); // This will activate the ComLynx
5268 ser_open(&params);
5275 <sect1>ser_get<label id="ser_get"><p>
5279 <tag/Function/Read a character from serial port.
5280 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5281 <tag/Declaration/<tt/unsigned char __fastcall__ ser_get (char* b);/
5282 <tag/Description/Get a character from the serial port. If no characters are
5283 available, the function will return SER_ERR_NO_DATA, so this is not a fatal
5285 <tag/Notes/<itemize>
5286 <item>The function is only available as fastcall function, so it may only
5287 be used in presence of a prototype.
5289 <tag/Availability/cc65
5290 <tag/See also/Other serial functions.
5292 Wait for a character to be available from a serial port.
5295 while (ser_get(&ch) == SER_ERR_NO_DATA)
5302 <sect1>ser_install<label id="ser_install"><p>
5306 <tag/Function/Install an already loaded driver and return an error code.
5307 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5308 <tag/Declaration/<tt/unsigned char __fastcall__ ser_install (void* driver);/
5309 <tag/Description/The function installs a driver that was already loaded into
5310 memory (or linked statically to the program). It returns an error code
5311 (<tt/SER_ERR_OK/ in case of success).
5312 <tag/Notes/<itemize>
5313 <item>The function is only available as fastcall function, so it may only be
5314 used in presence of a prototype.
5316 <tag/Availability/cc65
5318 <ref id="ser_load_driver" name="ser_load_driver">,
5319 <ref id="ser_uninstall" name="ser_uninstall">,
5320 <ref id="ser_unload" name="ser_unload">
5322 ser_install(lynx_comlynx); //Include the driver statically instead of loading it.
5328 <sect1>ser_ioctl<label id="ser_ioctl"><p>
5332 <tag/Function/Platform dependent code extensions.
5333 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5334 <tag/Declaration/<tt/unsigned __fastcall__ ser_ioctl (unsigned char code, void* data);/
5335 <tag/Description/Some platforms have extra serial functions that are not
5336 supported by standard serial driver functions. You can extend the driver to support
5337 this extra functionality bt using ser_ioctl functions.
5338 <tag/Notes/<itemize>
5339 <item>The function is only available as fastcall function, so it may only
5340 be used in presence of a prototype.
5341 <item>These functions are not easily portable to other cc65 platforms.
5343 <tag/Availability/cc65
5344 <tag/See also/Other serial functions.
5349 <sect1>ser_load_driver<label id="ser_load_driver"><p>
5353 <tag/Function/Load and install a serial driver.
5354 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5355 <tag/Declaration/<tt/unsigned char __fastcall__ ser_load_driver (const char *name);/
5356 <tag/Description/Load and install the driver by name.
5357 Will just load the driver and check if loading was successful.
5358 <tag/Notes/<itemize>
5359 <item>The function is only available as fastcall function, so it may only
5360 be used in presence of a prototype.
5362 <tag/Availability/cc65
5363 <tag/See also/Other serial functions.
5369 <sect1>ser_open<label id="ser_open"><p>
5373 <tag/Function/Open the port by setting the port parameters and enable interrupts
5374 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5375 <tag/Declaration/<tt/unsigned char __fastcall__ ser_open (const struct ser_params* params);/
5376 <tag/Description/Open the port by setting the port parameters and enable interrupts.
5377 <tag/Notes/<itemize>
5378 <item>The function is only available as fastcall function, so it may only
5379 be used in presence of a prototype.
5381 <tag/Availability/cc65
5382 <tag/See also/Other serial functions.
5387 static void initialize(){
5388 struct ser_params params = {
5395 ser_install(lynx_comlynx); // This will activate the ComLynx
5397 ser_open(&params);
5404 <sect1>ser_put<label id="ser_put"><p>
5408 <tag/Function/Write a character to a serial port.
5409 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5410 <tag/Declaration/<tt/unsigned char __fastcall__ ser_put (char b);/
5411 <tag/Description/Send a character via the serial port. There is a transmit
5412 buffer, but transmitting is not done via interrupt. The function returns
5413 SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
5414 <tag/Notes/<itemize>
5415 <item>The function is only available as fastcall function, so it may only
5416 be used in presence of a prototype.
5418 <tag/Availability/cc65
5419 <tag/See also/Other serial functions.
5428 <sect1>ser_status<label id="ser_status"><p>
5432 <tag/Function/Return the serial port status.
5433 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5434 <tag/Declaration/<tt/unsigned char __fastcall__ ser_status (unsigned char* status);/
5435 <tag/Description/Return the serial port status.
5436 <tag/Notes/<itemize>
5437 <item>The function is only available as fastcall function, so it may only
5438 be used in presence of a prototype.
5440 <tag/Availability/cc65
5441 <tag/See also/Other serial functions.
5447 <sect1>ser_uninstall<label id="ser_uninstall"><p>
5451 <tag/Function/Uninstall the currently loaded driver but do not unload it.
5452 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5453 <tag/Declaration/<tt/unsigned char ser_uninstall (void);/
5454 <tag/Description/Uninstall the currently loaded driver but do not unload it.
5455 <tag/Availability/cc65
5456 <tag/See also/Other serial functions.
5461 <sect1>ser_unload<label id="ser_unload"><p>
5465 <tag/Function/Uninstall, then unload the currently loaded driver.
5466 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
5467 <tag/Declaration/<tt/unsigned char ser_unload (void);/
5468 <tag/Description/Uninstall, then unload the currently loaded driver.
5469 <tag/Availability/cc65
5470 <tag/See also/Other serial functions.
5476 <sect1>set_brk<label id="set_brk"><p>
5480 <tag/Function/Set the break vector to a user function.
5481 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5482 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
5483 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
5484 program code by letting the vector point to a user written C function. The
5485 runtime library installs a small stub that saves the registers into global
5486 variables that may be accessed (and changed) by the break handler.
5487 <tag/Notes/<itemize>
5488 <item>The function is only available as fastcall function, so it may only
5489 be used in presence of a prototype.
5490 <item>The stub saves the zero page registers used by the C runtime and switches
5491 to a small break handler stack. This means that it is safe to execute C code,
5492 even if C code was interrupted. Be careful however not to use too many local
5493 variables, and do not enable stack checks for the handler function or any other
5494 function called from it.
5495 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
5496 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
5497 otherwise the <tt/BRK/ instruction will get executed over and over again.
5498 <item>The break vector is reset on program termination, so it's not strictly
5499 necessary to call <tt/<ref id="reset_brk" name="reset_brk">/ as a part of your
5500 clean-up when exitting the program.
5502 <tag/Availability/cc65
5504 <ref id="reset_brk" name="reset_brk">
5510 <sect1>set_irq<label id="set_irq"><p>
5514 <tag/Function/Set the C level interrupt request vector to the given address.
5515 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5516 <tag/Declaration/<tt/void __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);/
5517 <tag/Description/<tt/set_irq/ allows a user program to handle interrupt requests
5518 (IRQs) within the program code by letting the vector point to a user written C
5519 function. The runtime library installs a small stub that saves the zero page
5520 registers used by the C runtime before calling the handler function and restores
5521 them after the handler function returns. Additionally the stub temporarily switches
5522 the C runtime stack to the stack area provided as parameter. If the handler function
5523 was set up to handle a "private", "exclusive" interrupt request source it must
5524 return the value <tt/IRQ_HANDLED/ if and only if it has verified that the current
5525 interrupt request actually stems from that source. In all other cases it must return
5526 the value <tt/IRQ_NOT_HANDLED/.
5527 <tag/Notes/<itemize>
5528 <item>The function is only available as fastcall function, so it may only
5529 be used in presence of a prototype.
5530 <item>The stub saves the registers and zero page locations used by the C runtime
5531 and switches to the provided stack area. As a consequence, there is some
5532 runtime overhead, but it it is safe to execute C code, even if other C code
5533 was interrupted. Be careful however not to call C library functions, and do not
5534 enable stack checks for the handler function or any other function called from
5536 <item>The interrupt vector is reset on program termination, so it's not strictly
5537 necessary to call <tt/<ref id="reset_irq" name="reset_irq">/ as a part of your
5538 clean-up when exitting the program.
5540 <tag/Availability/cc65
5542 <ref id="reset_brk" name="reset_brk">,
5543 <ref id="reset_irq" name="reset_irq">,
5544 <ref id="set_brk" name="set_brk">
5550 <sect1>setjmp<label id="setjmp"><p>
5554 <tag/Function/Save the context for use with <tt/longjmp/.
5555 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
5556 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
5557 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
5558 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
5560 <tag/Notes/<itemize>
5561 <item>The function is only available as fastcall function, so it may only
5562 be used in presence of a prototype.
5563 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
5564 <item><tt/setjmp/ will not save the signal context.
5566 <tag/Availability/ISO 9899
5568 <ref id="longjmp" name="longjmp">
5574 <sect1>setlocale<label id="setlocale"><p>
5578 <tag/Function/Selects a locale.
5579 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
5580 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
5581 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
5582 <tag/Notes/<itemize>
5583 <item>The function is only available as fastcall function, so it may only
5584 be used in presence of a prototype.
5585 <item>cc65 supports only the "C" locale, so calling this function to set a
5586 different locale has no effect.
5588 <tag/Availability/ISO 9899
5590 <ref id="localeconv" name="localeconv">,
5591 <ref id="strcoll" name="strcoll">
5592 <ref id="strxfrm" name="strxfrm">
5598 <sect1>signal<label id="signal"><p>
5602 <tag/Function/Install a signal handler.
5603 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
5604 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
5605 <tag/Description/<tt/signal/ installs a handler for the given signal. The
5606 handler may either be a user supplied function, or one of the predefined
5607 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
5608 previous value if the signal , or the special function vector SIG_ERR in
5610 <tag/Notes/<itemize>
5611 <item>The function is only available as fastcall function, so it may only
5612 be used in presence of a prototype.
5614 <tag/Availability/ISO 9899
5616 <ref id="abort" name="abort">,
5617 <ref id="raise" name="raise">
5623 <sect1>sleep<label id="sleep"><p>
5627 <tag/Function/Sleep for a specified amount of time.
5628 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
5629 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
5630 <tag/Description/The function will return after the specified number of
5631 seconds have elapsed.
5632 <tag/Notes/<itemize>
5633 <item>The function is only available as fastcall function, so it may only
5634 be used in presence of a prototype.
5636 <tag/Availability/POSIX 1003.1
5642 <sect1>slow<label id="slow"><p>
5646 <tag/Function/Switch the C128 into 1MHz mode.
5647 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
5648 <tag/Declaration/<tt/void slow (void);/
5649 <tag/Description/The function will switch the clock of the C128 to 1MHz. This
5650 will halve the speed compared to fast mode.
5651 <tag/Notes/<itemize>
5652 <item>The function is specific to the C128.
5654 <tag/Availability/C128
5656 <ref id="fast" name="fast">,
5657 <ref id="toggle_videomode" name="toggle_videomode">,
5658 <ref id="videomode" name="videomode">
5664 <sect1>srand<label id="srand"><p>
5668 <tag/Function/Initialize the pseudo random number generator.
5669 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5670 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
5671 <tag/Description/The function initializes the random number generator using
5672 the given seed. On program startup, the generator behaves as if <tt/srand/ has
5673 been called with an argument of 1.
5674 <tag/Notes/<itemize>
5675 <item>The function is only available as fastcall function, so it may only
5676 be used in presence of a prototype.
5678 <tag/Availability/ISO 9899
5680 <ref id="_randomize" name="_randomize">,
5681 <ref id="rand" name="rand">
5687 <sect1>strcasecmp<label id="strcasecmp"><p>
5691 <tag/Function/Compare two strings case insensitive.
5692 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5693 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
5694 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
5695 as parameters without case sensitivity. It returns a value that is less than
5696 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
5697 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
5698 <tag/Notes/<itemize>
5699 <item>The function is only available as fastcall function, so it may only
5700 be used in presence of a prototype.
5701 <item>The function is not available in strict ANSI mode.
5703 <tag/Availability/cc65
5705 <ref id="strcmp" name="strcmp">,
5706 <ref id="strcoll" name="strcoll">,
5707 <ref id="stricmp" name="stricmp">,
5708 <ref id="strncmp" name="strncmp">,
5709 <ref id="strxfrm" name="strxfrm">
5715 <sect1>strcat<label id="strcat"><p>
5719 <tag/Function/Concatentate two strings.
5720 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5721 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
5722 <tag/Description/The <tt/strcat/ function appends a copy of the string
5723 pointed to by s2 (including the terminating null byte) to the end of the
5724 string pointed to by s1. The initial byte of s2 overwrites the null byte at
5726 <tag/Notes/<itemize>
5727 <item>The function is only available as fastcall function, so it may only
5728 be used in presence of a prototype.
5729 <item>If copying takes place between objects that overlap, the behaviour
5732 <tag/Availability/ISO 9899
5734 <ref id="strcpy" name="strcpy">,
5735 <ref id="strncat" name="strncat">,
5736 <ref id="strncpy" name="strncpy">
5742 <sect1>strchr<label id="strchr"><p>
5746 <tag/Function/Search for a character in a string.
5747 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5748 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
5749 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
5750 (converted to a char) in the string pointed to by <tt/s/. The terminating null
5751 byte is considered to be part of the string. Upon completion, the function
5752 returns a pointer to the byte, or a null pointer if the byte was not found.
5753 <tag/Notes/<itemize>
5754 <item>The function is only available as fastcall function, so it may only
5755 be used in presence of a prototype.
5757 <tag/Availability/ISO 9899
5759 <ref id="memchr" name="memchr">,
5760 <ref id="strrchr" name="strrchr">
5766 <sect1>strcmp<label id="strcmp"><p>
5770 <tag/Function/Compare two strings.
5771 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5772 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
5773 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
5774 parameters. It returns a value that is less than zero if <tt/s1/ is less than
5775 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
5776 if <tt/s1/ is greater than <tt/s2/.
5777 <tag/Notes/<itemize>
5778 <item>The function is only available as fastcall function, so it may only
5779 be used in presence of a prototype.
5781 <tag/Availability/ISO 9899
5783 <ref id="strcasecmp" name="strcasecmp">,
5784 <ref id="strcoll" name="strcoll">,
5785 <ref id="stricmp" name="stricmp">,
5786 <ref id="strncmp" name="strncmp">
5787 <ref id="strxfrm" name="strxfrm">
5793 <sect1>strcoll<label id="strcoll"><p>
5797 <tag/Function/Compare two strings.
5798 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5799 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
5800 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
5801 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
5802 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
5803 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
5804 than zero if <tt/s1/ is greater than <tt/s2/.
5805 <tag/Notes/<itemize>
5806 <item>The function is only available as fastcall function, so it may only
5807 be used in presence of a prototype.
5809 <tag/Availability/ISO 9899
5811 <ref id="setlocale" name="setlocale">,
5812 <ref id="strcasecmp" name="strcasecmp">,
5813 <ref id="strcmp" name="strcmp">,
5814 <ref id="stricmp" name="stricmp">,
5815 <ref id="strncmp" name="strncmp">,
5816 <ref id="strxfrm" name="strxfrm">
5822 <sect1>strcpy<label id="strcpy"><p>
5826 <tag/Function/Copy a string.
5827 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5828 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
5829 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
5830 <tt/s2/ (including the terminating null byte) into the array pointed to by
5831 <tt/s1/. The function will always return <tt/s1/.
5832 <tag/Notes/<itemize>
5833 <item>The function is only available as fastcall function, so it may only
5834 be used in presence of a prototype.
5835 <item>If copying takes place between objects that overlap, the behaviour
5838 <tag/Availability/ISO 9899
5840 <ref id="strcat" name="strcat">,
5841 <ref id="strncat" name="strncat">,
5842 <ref id="strncpy" name="strncpy">
5845 #include <string.h>
5847 static char hello[14];
5849 strcpy (hello, "Hello world!\n");
5855 <sect1>strcspn<label id="strcspn"><p>
5859 <tag/Function/Compute the length of a substring.
5860 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5861 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
5862 <tag/Description/The <tt/strcspn/ function computes and returns the length of
5863 the substring pointed to by <tt/s/ which does <em>not</em> consist of
5864 characters contained in the string <tt/set/.
5865 <tag/Notes/<itemize>
5866 <item>The function is only available as fastcall function, so it may only
5867 be used in presence of a prototype.
5869 <tag/Availability/ISO 9899
5871 <ref id="strqtok" name="strqtok">,
5872 <ref id="strspn" name="strspn">,
5873 <ref id="strstr" name="strstr">,
5874 <ref id="strtok" name="strtok">
5880 <sect1>strdup<label id="strdup"><p>
5884 <tag/Function/Allocate a copy of a string on the heap.
5885 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5886 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
5887 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
5888 to hold a copy of <tt/s/ including the terminating zero. If the allocation
5889 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
5890 memory block, and a pointer to the block is returned.
5891 <tag/Notes/<itemize>
5892 <item>The function is only available as fastcall function, so it may only
5893 be used in presence of a prototype.
5894 <item>It is up to the caller to free the allocated memory block.
5896 <tag/Availability/ISO 9899
5898 <ref id="free" name="free">,
5899 <ref id="malloc" name="malloc">
5905 <sect1>strerror<label id="strerror"><p>
5909 <tag/Function/Return a string describing an error code.
5910 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5911 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
5912 <tag/Description/The <tt/strerror/ function returns a string describing the
5913 given error code. If an invalid error code is passed, the string "Unknown
5914 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
5915 <tt/errno/ is left untouched.
5916 <tag/Notes/<itemize>
5917 <item>The function is only available as fastcall function, so it may only
5918 be used in presence of a prototype.
5919 <item>While the return type of the function is a <tt/char*/, the returned
5920 string must not be modified by the caller!
5922 <tag/Availability/ISO 9899
5924 <ref id="_stroserror" name="_stroserror">
5930 <sect1>stricmp<label id="stricmp"><p>
5934 <tag/Function/Compare two strings case insensitive.
5935 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5936 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
5937 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
5938 parameters without case sensitivity. It returns a value that is less than zero
5939 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
5940 value greater than zero if <tt/s1/ is greater than <tt/s2/.
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.
5944 <item>The function is not available in strict ANSI mode.
5946 <tag/Availability/cc65
5948 <ref id="strcasecmp" name="strcasecmp">,
5949 <ref id="strcmp" name="strcmp">,
5950 <ref id="strcoll" name="strcoll">,
5951 <ref id="strncmp" name="strncmp">,
5952 <ref id="strxfrm" name="strxfrm">
5958 <sect1>strlen<label id="strlen"><p>
5962 <tag/Function/Return the length of a string.
5963 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5964 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
5965 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
5966 string to which s points, not including the terminating null byte.
5967 <tag/Notes/<itemize>
5968 <item>The function is only available as fastcall function, so it may only
5969 be used in presence of a prototype.
5970 <item>When compiling with <tt/-Os/ (inline known standard functions), the
5971 function does not work correctly for strings with more than 255 characters.
5973 <tag/Availability/ISO 9899
5975 <ref id="strcpy" name="strcpy">
5981 <sect1>strlower<label id="strlower"><p>
5985 <tag/Function/Make a string lower case.
5986 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5987 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
5988 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
5989 function to each character of a string. The function will always return <tt/s/.
5990 <tag/Notes/<itemize>
5991 <item>The function is only available as fastcall function, so it may only
5992 be used in presence of a prototype.
5993 <item>The function prototype is unavailable when compiling in strict ANSI mode.
5994 <item>An alias name for this function is <tt/strlwr/.
5996 <tag/Availability/cc65
5998 <ref id="strupper" name="strupper">,
5999 <ref id="tolower" name="tolower">
6005 <sect1>strlwr<label id="strlwr"><p>
6012 <sect1>strncat<label id="strncat"><p>
6016 <tag/Function/Concatentate two strings.
6017 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6018 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
6019 <tag/Description/The <tt/strncat/ function appends not more than n characters
6020 of the string pointed to by s2 to the end of the string pointed to by s1. The
6021 terminating null character at the end of s1 is overwritten. A terminating null
6022 character is appended to the result, even if not all of s2 is appended to s1.
6023 <tag/Notes/<itemize>
6024 <item>The function is only available as fastcall function, so it may only
6025 be used in presence of a prototype.
6026 <item>If copying takes place between objects that overlap, the behaviour
6029 <tag/Availability/ISO 9899
6031 <ref id="strcpy" name="strcpy">,
6032 <ref id="strncat" name="strncat">,
6033 <ref id="strncpy" name="strncpy">
6039 <sect1>strncmp<label id="strncmp"><p>
6043 <tag/Function/Compare two strings.
6044 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6045 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
6046 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
6047 characters of the two strings passed as parameters. It returns a value that is
6048 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
6049 <tt/s2/, zero if they are identical, and a value greater than zero they are
6051 <tag/Notes/<itemize>
6052 <item>The function is only available as fastcall function, so it may only
6053 be used in presence of a prototype.
6055 <tag/Availability/ISO 9899
6057 <ref id="strcasecmp" name="strcasecmp">,
6058 <ref id="strcmp" name="strcmp">,
6059 <ref id="strcoll" name="strcoll">,
6060 <ref id="stricmp" name="stricmp">,
6061 <ref id="strxfrm" name="strxfrm">
6067 <sect1>strncpy<label id="strncpy"><p>
6071 <tag/Function/Copy part of a string.
6072 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6073 <tag/Declaration/<tt/char* __fastcall__ strncpy (char* s1, const char* s2, size_t n);/
6074 <tag/Description/The <tt/strncpy/ function copies not more than <tt/n/ bytes from
6075 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
6076 pointed to by <tt/s2/ is a string that is shorter than <tt/n/ bytes, null bytes are
6077 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
6078 written. The function always will return <tt/s1/.
6079 <tag/Notes/<itemize>
6080 <item>The function is available only as a fastcall function; so, it may be used
6081 only in the presence of a prototype.
6082 <item>If there is no null byte in the first <tt/n/ bytes of the array pointed
6083 to by <tt/s2/, the result is <em/not/ null-terminated!
6084 <item>If copying takes place between objects that overlap, the behaviour is
6087 <tag/Availability/ISO 9899
6089 <ref id="memcpy" name="memcpy">,
6090 <ref id="strcat" name="strcat">,
6091 <ref id="strcpy" name="strcpy">,
6092 <ref id="strncat" name="strncat">
6097 static char hello[6];
6099 strncpy (hello, "Hello world!\n", sizeof hello - 1)[5] = '\0';
6105 <sect1>strqtok<label id="strqtok"><p>
6109 <tag/Function/Break a string into tokens.
6110 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6111 <tag/Declaration/<tt/char* __fastcall__ strqtok (char* s1, const char* s2);/
6112 <tag/Description/<tt/strqtok()/ will break the string <tt/s1/ into a sequence of
6113 tokens, which are delimited by either quotation marks or characters from the
6114 string <tt/s2/. Tokens inside quotation marks may contain characters from <tt/s2/
6115 (they aren't delimiters there). The first call to <tt/strqtok()/ will return a
6116 pointer to the first token in the string <tt/s1/. The following calls must pass
6117 a <tt/NULL/ pointer as <tt/s1/, in order to get the next token in the string.
6118 Different sets of delimiters may be used for the subsequent calls to <tt/strqtok()/.
6119 <tag/Notes/<itemize>
6120 <item>The function is available only as a fastcall function; so, it may be used
6121 only in the presence of a prototype.
6122 <item><tt/strqtok()/ will modify the string <tt/s1/.
6123 <item>The function will forget where it is in the <tt/s1/ string if it is given
6124 a second <tt/s1/ string before it finishes the first one.
6126 <tag/Availability/cc65
6128 <ref id="strcspn" name="strcspn">,
6129 <!-- <ref id="strpbrk" name="strpbrk">, -->
6130 <ref id="strspn" name="strspn">,
6131 <ref id="strtok" name="strtok">
6137 <sect1>strrchr<label id="strrchr"><p>
6141 <tag/Function/Search for a character in a string.
6142 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6143 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
6144 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
6145 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6146 byte is considered to be part of the string. Upon completion, the function
6147 returns a pointer to the byte, or a null pointer if the byte was not found.
6148 <tag/Notes/<itemize>
6149 <item>The function is only available as fastcall function, so it may only
6150 be used in presence of a prototype.
6152 <tag/Availability/ISO 9899
6154 <ref id="strchr" name="strchr">
6160 <sect1>strspn<label id="strspn"><p>
6164 <tag/Function/Compute the length of a substring.
6165 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6166 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
6167 <tag/Description/The <tt/strspn/ function computes and returns the length of
6168 the substring pointed to by <tt/s/ which does consist only of characters
6169 contained in the string <tt/set/.
6170 <tag/Notes/<itemize>
6171 <item>The function is only available as fastcall function, so it may only
6172 be used in presence of a prototype.
6174 <tag/Availability/ISO 9899
6176 <ref id="strcspn" name="strcspn">,
6177 <ref id="strstr" name="strstr">
6183 <sect1>strstr<label id="strstr"><p>
6187 <tag/Function/Find a substring.
6188 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6189 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
6190 <tag/Description/<tt/strstr/ searches for the first occurance of the string
6191 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
6192 otherwise it returns <tt/NULL/.
6193 <tag/Notes/<itemize>
6194 <item>The function is only available as fastcall function, so it may only
6195 be used in presence of a prototype.
6197 <tag/Availability/ISO 9899
6199 <ref id="strcspn" name="strcspn">,
6200 <ref id="strspn" name="strspn">
6206 <sect1>strtok<label id="strtok"><p>
6210 <tag/Function/Break a string into tokens.
6211 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6212 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
6213 <tag/Description/<tt/strtok()/ will break the string <tt/s1/ into a sequence of
6214 tokens, which are delimited by characters from the string <tt/s2/. The first call
6215 to <tt/strtok()/ will return a pointer to the first token in the string <tt/s1/.
6216 The following calls must pass a <tt/NULL/ pointer as <tt/s1/, in order to get
6217 the next token in the string. Different sets of delimiters may be used for the
6218 subsequent calls to <tt/strtok()/.
6219 <tag/Notes/<itemize>
6220 <item>The function is only available as fastcall function, so it may only
6221 be used in presence of a prototype.
6222 <item><tt/strtok()/ will modify the string <tt/s1/.
6223 <item>The function will forget where it is in the <tt/s1/ string if it is given
6224 a second <tt/s1/ string before it finishes the first one.
6226 <tag/Availability/ISO 9899
6228 <ref id="strcspn" name="strcspn">,
6229 <!-- <ref id="strpbrk" name="strpbrk">, -->
6230 <ref id="strqtok" name="strqtok">,
6231 <ref id="strspn" name="strspn">
6237 <sect1>strxfrm<label id="strxfrm"><p>
6241 <tag/Function/Transform a string.
6242 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6243 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
6244 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
6245 s2 and places the resulting string into the string pointed to by s1. The
6246 transformation is such that if the <tt/strcmp/ function is applied to two
6247 transformed strings, it returns a value greater than, equal to, or less than
6248 zero, corresponding to the result of the <tt/strcoll/ function applied to the
6249 same two original strings. No more than n characters are placed into the
6250 resulting array pointed to by s1, including the terminating null character.
6251 <tag/Notes/<itemize>
6252 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
6253 the behaviour is undefined.
6254 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
6255 <item>The function is only available as fastcall function, so it may only
6256 be used in presence of a prototype.
6257 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
6258 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
6260 <tag/Availability/ISO 9899
6262 <ref id="strcmp" name="strcmp">,
6263 <ref id="strcoll" name="strcoll">,
6264 <ref id="strncpy" name="strncpy">
6270 <sect1>strupper<label id="strupper"><p>
6274 <tag/Function/Make a string upper case.
6275 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6276 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
6277 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
6278 function to each character of a string. The function will always return <tt/s/.
6279 <tag/Notes/<itemize>
6280 <item>The function is only available as fastcall function, so it may only
6281 be used in presence of a prototype.
6282 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6283 <item>An alias name for this function is <tt/strupr/.
6285 <tag/Availability/cc65
6287 <ref id="strlower" name="strlower">
6288 <ref id="toupper" name="toupper">
6294 <sect1>strupr<label id="strupr"><p>
6301 <sect1>telldir<label id="telldir"><p>
6305 <tag/Function/Return the current position of a directory stream.
6306 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
6307 <tag/Declaration/<tt/long __fastcall__ telldir (DIR* dir);/
6308 <tag/Description/<tt/telldir/ returns the current position of a directory
6309 stream. The return value may be used in subsequent calls to
6310 <tt/<ref id="seekdir" name="seekdir">/.
6311 <tag/Notes/<itemize>
6312 <item>The function is only available as fastcall function, so it may only
6313 be used in presence of a prototype.
6315 <tag/Availability/POSIX 1003.1
6317 <ref id="seekdir" name="seekdir">,
6318 <ref id="telldir" name="telldir">
6324 <sect1>textcolor<label id="textcolor"><p>
6328 <tag/Function/Set the text color.
6329 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6330 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
6331 <tag/Description/The function will set a new text color. It returns the old
6332 (current) text color. Text output using any <tt/conio.h/ function will use
6333 the color set by this function.
6334 <tag/Notes/<itemize>
6335 <item>Text colors are system dependent. The function may have no effect
6336 on systems where the text color cannot be changed.
6337 <item>The function is only available as fastcall function, so it may only
6338 be used in presence of a prototype.
6340 <tag/Availability/cc65
6342 <ref id="bgcolor" name="bgcolor">,
6343 <ref id="bordercolor" name="bordercolor">
6349 <sect1>time<label id="time"><p>
6353 <tag/Function/Get the time.
6354 <tag/Header/<tt/<ref id="time.h" name="time.h">/
6355 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
6356 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
6357 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
6358 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
6359 returned and <tt/errno/ is set to <tt/ENOSYS/.
6360 <tag/Notes/<itemize>
6361 <item>The function is only available as fastcall function, so it may
6362 only be used in presence of a prototype.
6363 <item>Many platforms supported by cc65 do not have a realtime clock, so the
6364 returned value may not be valid.
6366 <tag/Availability/ISO 9899
6368 <ref id="clock" name="clock">
6374 <sect1>toggle_videomode<label id="toggle_videomode"><p>
6378 <tag/Function/Toggle between 40 and 80 column mode.
6379 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
6380 <tag/Declaration/<tt/void toggle_videomode (void);/
6381 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
6382 old mode (cursor position, color and so on) are saved and restored together
6384 <tag/Notes/<itemize>
6385 <item>The function is specific to the C128.
6386 <item>This function is deprecated. Please use <ref id="videomode"
6387 name="videomode"> instead!
6389 <tag/Availability/C128
6391 <ref id="fast" name="fast">,
6392 <ref id="slow" name="slow">,
6393 <ref id="videomode" name="videomode">
6399 <sect1>tolower<label id="tolower"><p>
6403 <tag/Function/Convert a character into its lower case representation.
6404 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
6405 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
6406 <tag/Description/The function returns the given character converted to lower
6407 case. If the given character is not a letter, it is returned unchanged.
6408 <tag/Notes/<itemize>
6409 <item>The function is only available as fastcall function, so it may
6410 only be used in presence of a prototype.
6412 <tag/Availability/ISO 9899
6414 <ref id="islower" name="islower">,
6415 <ref id="isupper" name="isupper">,
6416 <ref id="toupper" name="toupper">
6422 <sect1>toupper<label id="toupper"><p>
6426 <tag/Function/Convert a character into its upper case representation.
6427 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
6428 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
6429 <tag/Description/The function returns the given character converted to upper
6430 case. If the given character is not a letter, it is returned unchanged.
6431 <tag/Notes/<itemize>
6432 <item>The function is only available as fastcall function, so it may
6433 only be used in presence of a prototype.
6435 <tag/Availability/ISO 9899
6437 <ref id="islower" name="islower">,
6438 <ref id="isupper" name="isupper">,
6439 <ref id="tolower" name="tolower">
6445 <sect1>ultoa<label id="ultoa"><p>
6449 <tag/Function/Convert an unsigned long integer into a string.
6450 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
6451 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
6452 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
6453 string using <tt/radix/ as the base.
6454 <tag/Notes/<itemize>
6455 <item>There are no provisions to prevent a buffer overflow.
6456 <item>The function is non standard, so it is not available in strict ANSI mode.
6457 You should probably use <tt/sprintf/ instead.
6458 <item>The function is only available as fastcall function, so it may only be
6459 used in presence of a prototype.
6461 <tag/Availability/cc65
6463 <ref id="atoi" name="atoi">,
6464 <ref id="atol" name="atol">,
6465 <ref id="itoa" name="itoa">,
6466 <ref id="ltoa" name="ltoa">,
6467 <ref id="utoa" name="utoa">
6473 <sect1>unlink<label id="unlink"><p>
6477 <tag/Function/Delete a file.
6478 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
6479 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
6480 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
6481 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
6482 code describing the reason for the failure.
6483 <tag/Notes/<itemize>
6484 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
6485 name="remove">/ instead, which is a native ANSI C function and does the same.
6486 <item>This function is not available on all cc65 targets (depends on the
6487 availability of file I/O).
6488 <item>The function is only available as fastcall function, so it may only
6489 be used in presence of a prototype.
6490 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
6491 used, which has the same semantics, but is more portable, because it conforms
6492 to the ISO C standard.
6494 <tag/Availability/POSIX 1003.1
6496 <ref id="remove" name="remove">
6499 #include <stdio.h>
6500 #include <unistd.h>
6502 #define FILENAME "helloworld"
6504 if (unlink (FILENAME) == 0) {
6505 printf ("We deleted %s successfully\n", FILENAME);
6507 printf ("There was a problem deleting %s\n", FILENAME);
6514 <sect1>utoa<label id="utoa"><p>
6518 <tag/Function/Convert an unsigned integer into a string.
6519 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
6520 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
6521 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
6522 using <tt/radix/ as the base.
6523 <tag/Notes/<itemize>
6524 <item>There are no provisions to prevent a buffer overflow.
6525 <item>The function is non standard, so it is not available in strict ANSI mode.
6526 You should probably use <tt/sprintf/ instead.
6527 <item>The function is only available as fastcall function, so it may only be
6528 used in presence of a prototype.
6530 <tag/Availability/cc65
6532 <ref id="atoi" name="atoi">,
6533 <ref id="atol" name="atol">,
6534 <ref id="itoa" name="itoa">,
6535 <ref id="ltoa" name="ltoa">,
6536 <ref id="ultoa" name="ultoa">
6542 <sect1>vcprintf<label id="vcprintf"><p>
6546 <tag/Function/Formatted output to the console.
6547 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6548 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
6549 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
6550 text where necessary and formatted according to the format string given. The
6551 resulting string is output to the console. <tt/vcprintf/ supports the same
6552 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
6553 <tag/Notes/<itemize>
6554 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
6555 between <tt/\r/ and <tt/\n/.
6556 <item>The function is only available as fastcall function, so it may only be
6557 used in presence of a prototype.
6559 <tag/Availability/cc65
6561 <ref id="cprintf" name="cprintf">,
6562 <ref id="cputc" name="cputc">,
6563 <ref id="cputcxy" name="cputcxy">,
6564 <ref id="cputs" name="cputs">,
6565 <ref id="cputsxy" name="cputsxy">
6571 <sect1>videomode<label id="videomode"><p>
6575 <tag/Function/Switch to either 40 or 80 column mode.
6576 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
6577 <ref id="c128.h" name="c128.h">/
6578 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
6579 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
6580 the requested mode is already active, nothing happens. The old mode is returned
6582 <tag/Notes/<itemize>
6583 <item>The function is specific to the C128 and enhanced Apple //e.
6584 <item>This function replaces <ref id="toggle_videomode"
6585 name="toggle_videomode">.
6586 <item>The function is only available as fastcall function, so it may only be
6587 used in presence of a prototype.
6589 <tag/Availability/C128 and enhanced Apple //e
6591 <ref id="fast" name="fast">,
6592 <ref id="slow" name="slow">,
6593 <ref id="toggle_videomode" name="toggle_videomode">
6599 <sect1>waitvsync<label id="waitvsync"><p>
6603 <tag/Function/Wait until the start of the next frame.
6605 <tt/<ref id="cbm.h" name="cbm.h">/,
6606 <tt/<ref id="gamate.h" name="gamate.h">/,
6607 <tt/<ref id="nes.h" name="nes.h">/,
6608 <tt/<ref id="pce.h" name="pce.h">/
6609 <tag/Declaration/<tt/void waitvsync (void);/
6610 <tag/Description/Wait for vertical sync to reduce flickering.
6611 <tag/Availability/Platforms above
6617 <sect1>wherex<label id="wherex"><p>
6621 <tag/Function/Return the current X position of the text mode cursor.
6622 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6623 <tag/Declaration/<tt/unsigned char wherex (void);/
6624 <tag/Description/The function returns the current X position of the text mode
6625 cursor. Zero is returned for the leftmost screen position.
6626 <tag/Availability/cc65
6628 <ref id="gotox" name="gotox">,
6629 <ref id="gotoy" name="gotoy">,
6630 <ref id="gotoxy" name="gotoxy">,
6631 <ref id="wherey" name="wherey">
6637 <sect1>wherey<label id="wherey"><p>
6641 <tag/Function/Return the current Y position of the text mode cursor.
6642 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6643 <tag/Declaration/<tt/unsigned char wherey (void);/
6644 <tag/Description/The function returns the current Y position of the text mode
6645 cursor. Zero is returned for the uppermost screen position.
6646 <tag/Availability/cc65
6648 <ref id="gotox" name="gotox">,
6649 <ref id="gotoy" name="gotoy">,
6650 <ref id="gotoxy" name="gotoxy">,
6651 <ref id="wherex" name="wherex">