1 <!doctype linuxdoc system> <!-- -*- text-mode -*- -->
4 <title>cc65 function reference
5 <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
6 <url url="mailto:greg.king5@verizon.net" name="Greg King">
10 cc65 is a C compiler for 6502 based systems. This function reference describes
11 the C functions available in the standard library.
14 <!-- Table of contents -->
17 <!-- Begin the document -->
21 cc65 is a C compiler for 6502 based systems. It implements a subset of the ISO
22 C standard plus additional functions specially crafted for 6502 systems or
23 just some of the supported machines. This function refrence describes the
24 available functions together with any limitations.
26 For an overview about the available libraries, their purpose, and any
27 differences to the ISO standard, please have a look at the <url
28 url="library.html" name="cc65 Library Overview">.
30 <em/Note:/ Standard C functions are listed here, but not described in detail.
31 Since these functions behave identical on all standard compliant systems, they
32 are described in any book covering standard C.
34 Each entry for a function contains a detailed description
38 <tag/Function/Summary of what <bf/function/ does.
39 <tag/Header/The header file that contains the declaration.
40 <tag/Declaration/Describes the needed header files and declaration of the
42 <tag/Description/Description of the function.
43 <tag/Notes/Notes on the function.
44 <tag/Availability/The availability of the function.
45 <tag/See also/Other related functions.
46 <tag/Example/A piece of actual code using the function.
51 <sect>Functions by header file<p>
53 <sect1><tt/6502.h/<label id="6502.h"><p>
56 <item><ref id="BRK" name="BRK">
57 <item><ref id="CLI" name="CLI">
58 <item><ref id="SEI" name="SEI">
59 <item><ref id="_sys" name="_sys">
60 <item><ref id="getcpu" name="getcpu">
61 <item><ref id="reset_brk" name="reset_brk">
62 <item><ref id="reset_irq" name="reset_irq">
63 <item><ref id="set_brk" name="set_brk">
64 <item><ref id="set_irq" name="set_irq">
68 <sect1><tt/accelerator.h/<label id="accelerator.h"><p>
71 <item><ref id="detect_c128" name="detect_c128">
72 <item><ref id="detect_c64dtv" name="detect_c64dtv">
73 <item><ref id="detect_c65" name="detect_c65">
74 <item><ref id="detect_chameleon" name="detect_chameleon">
75 <item><ref id="detect_scpu" name="detect_scpu">
76 <item><ref id="detect_turbomaster" name="detect_turbomaster">
77 <item><ref id="get_c128_speed" name="get_c128_speed">
78 <item><ref id="get_c64dtv_speed" name="get_c64dtv_speed">
79 <item><ref id="get_c65_speed" name="get_c65_speed">
80 <item><ref id="get_chameleon_speed" name="get_chameleon_speed">
81 <item><ref id="get_scpu_speed" name="get_scpu_speed">
82 <item><ref id="get_turbomaster_speed" name="get_turbomaster_speed">
83 <item><ref id="set_c128_speed" name="set_c128_speed">
84 <item><ref id="set_c64dtv_speed" name="set_c64dtv_speed">
85 <item><ref id="set_c65_speed" name="set_c65_speed">
86 <item><ref id="set_chameleon_speed" name="set_chameleon_speed">
87 <item><ref id="set_scpu_speed" name="set_scpu_speed">
88 <item><ref id="set_turbomaster_speed" name="set_turbomaster_speed">
92 <sect1><tt/apple2.h/<label id="apple2.h"><p>
96 <item><ref id="get_ostype" name="get_ostype">
101 <sect1><tt/apple2enh.h/<label id="apple2enh.h"><p>
105 <item><ref id="get_ostype" name="get_ostype">
106 <item>rebootafterexit
109 <item><ref id="videomode" name="videomode">
113 <sect1><tt/assert.h/<label id="assert.h"><p>
116 <item><ref id="assert" name="assert">
120 <sect1><tt/atari.h/<label id="atari.h"><p>
123 <!-- <item><ref id="_getcolor" name="_getcolor"> -->
124 <!-- <item><ref id="_getdefdev" name="_getdefdev"> -->
125 <!-- <item><ref id="_graphics" name="_graphics"> -->
126 <item><ref id="_is_cmdline_dos" name="_is_cmdline_dos">
127 <!-- <item><ref id="_rest_vecs" name="_rest_vecs"> -->
128 <!-- <item><ref id="_save_vecs" name="_save_vecs"> -->
129 <!-- <item><ref id="_scroll" name="_scroll"> -->
130 <!-- <item><ref id="_setcolor" name="_setcolor"> -->
131 <!-- <item><ref id="_setcolor_low" name="_setcolor_low"> -->
132 <item><ref id="get_ostype" name="get_ostype">
133 <!-- <item><ref id="get_tv" name="get_tv"> -->
139 <sect1><tt/atmos.h/<label id="atmos.h"><p>
142 <item><ref id="atmos_explode" name="atmos_explode">
143 <item><ref id="atmos_load" name="atmos_load">
144 <item><ref id="atmos_ping" name="atmos_ping">
145 <item><ref id="atmos_save" name="atmos_save">
146 <item><ref id="atmos_shoot" name="atmos_shoot">
147 <item><ref id="atmos_tick" name="atmos_tick">
148 <item><ref id="atmos_tock" name="atmos_tock">
149 <item><ref id="atmos_zap" name="atmos_zap">
153 <sect1><tt/c128.h/<label id="c128.h"><p>
156 <item><ref id="c64mode" name="c64mode">
157 <item><ref id="fast" name="fast">
158 <item><ref id="isfast" name="isfast">
159 <item><ref id="slow" name="slow">
160 <item><ref id="toggle_videomode" name="toggle_videomode">
161 <item><ref id="videomode" name="videomode">
165 <sect1><tt/c16.h/<label id="c16.h"><p>
168 <item><ref id="fast" name="fast">
169 <item><ref id="isfast" name="isfast">
170 <item><ref id="slow" name="slow">
176 <sect1><tt/c64.h/<label id="c64.h"><p>
179 <item><ref id="get_ostype" name="get_ostype">
183 <sect1><tt/cbm.h/<label id="cbm.h"><p>
186 <item><ref id="cbm_k_acptr" name="cbm_k_acptr">
187 <item><ref id="cbm_k_basin" name="cbm_k_basin">
188 <item><ref id="cbm_k_bsout" name="cbm_k_bsout">
189 <item><ref id="cbm_k_chkin" name="cbm_k_chkin">
190 <item><ref id="cbm_k_ciout" name="cbm_k_ciout">
191 <item><ref id="cbm_k_ckout" name="cbm_k_ckout">
192 <item><ref id="cbm_k_clall" name="cbm_k_clall">
193 <item><ref id="cbm_k_close" name="cbm_k_close">
194 <item><ref id="cbm_k_clrch" name="cbm_k_clrch">
195 <item><ref id="cbm_k_getin" name="cbm_k_getin">
196 <item><ref id="cbm_k_iobase" name="cbm_k_iobase">
197 <item><ref id="cbm_k_listen" name="cbm_k_listen">
198 <item><ref id="cbm_k_load" name="cbm_k_load">
199 <item><ref id="cbm_k_open" name="cbm_k_open">
200 <item><ref id="cbm_k_readst" name="cbm_k_readst">
201 <item><ref id="cbm_k_save" name="cbm_k_save">
202 <item><ref id="cbm_k_scnkey" name="cbm_k_scnkey">
203 <item><ref id="cbm_k_second" name="cbm_k_second">
204 <item><ref id="cbm_k_setlfs" name="cbm_k_setlfs">
205 <item><ref id="cbm_k_setnam" name="cbm_k_setnam">
206 <item><ref id="cbm_k_talk" name="cbm_k_talk">
207 <item><ref id="cbm_k_tksa" name="cbm_k_tksa">
208 <item><ref id="cbm_k_udtim" name="cbm_k_udtim">
209 <item><ref id="cbm_k_unlsn" name="cbm_k_unlsn">
210 <item><ref id="cbm_k_untlk" name="cbm_k_untlk">
211 <!-- <item><ref id="cbm_load" name="cbm_load"> -->
212 <!-- <item><ref id="cbm_open" name="cbm_open"> -->
213 <!-- <item><ref id="cbm_opendir" name="cbm_opendir"> -->
214 <!-- <item><ref id="cbm_read" name="cbm_read"> -->
215 <!-- <item><ref id="cbm_readdir" name="cbm_readdir"> -->
216 <!-- <item><ref id="cbm_save" name="cbm_save"> -->
217 <!-- <item><ref id="cbm_write" name="cbm_write"> -->
218 <!-- <item><ref id="get_tv" name="get_tv"> -->
219 <item><ref id="waitvsync" name="waitvsync">
220 <item><ref id="kbrepeat" name="kbrepeat">
226 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
229 <item><ref id="peekbsys" name="peekbsys">
230 <item><ref id="peekwsys" name="peekwsys">
231 <item><ref id="pokebsys" name="pokebsys">
232 <item><ref id="pokewsys" name="pokewsys">
236 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
239 <item><ref id="peekbsys" name="peekbsys">
240 <item><ref id="peekwsys" name="peekwsys">
241 <item><ref id="pokebsys" name="pokebsys">
242 <item><ref id="pokewsys" name="pokewsys">
246 <sect1><tt/cc65.h/<label id="cc65.h"><p>
249 <!-- <item><ref id="cc65_cos" name="cc65_cos"> -->
250 <!-- <item><ref id="cc65_idiv32by16r16" name="cc65_idiv32by16r16"> -->
251 <!-- <item><ref id="cc65_imul16x16r32" name="cc65_imul16x16r32"> -->
252 <!-- <item><ref id="cc65_imul8x8r16" name="cc65_imul8x8r16"> -->
253 <!-- <item><ref id="cc65_sin" name="cc65_sin"> -->
254 <!-- <item><ref id="cc65_udiv32by16r16" name="cc65_udiv32by16r16"> -->
255 <!-- <item><ref id="cc65_umul16x16r32" name="cc65_umul16x16r32"> -->
256 <!-- <item><ref id="cc65_umul16x8r32" name="cc65_umul16x8r32"> -->
257 <!-- <item><ref id="cc65_umul8x8r16" name="cc65_umul8x8r16"> -->
258 <item><ref id="doesclrscrafterexit" name="doesclrscrafterexit">
264 <sect1><tt/conio.h/<label id="conio.h"><p>
267 <item><ref id="bgcolor" name="bgcolor">
268 <item><ref id="bordercolor" name="bordercolor">
269 <item><ref id="cclear" name="cclear">
270 <item><ref id="cclearxy" name="cclearxy">
271 <item><ref id="cgetc" name="cgetc">
272 <item><ref id="chline" name="chline">
273 <item><ref id="chlinexy" name="chlinexy">
274 <item><ref id="clrscr" name="clrscr">
275 <item><ref id="cpeekc" name="cpeekc">
276 <item><ref id="cpeekcolor" name="cpeekcolor">
277 <item><ref id="cpeekrevers" name="cpeekrevers">
278 <item><ref id="cpeeks" name="cpeeks">
279 <item><ref id="cprintf" name="cprintf">
280 <item><ref id="cputc" name="cputc">
281 <item><ref id="cputcxy" name="cputcxy">
282 <item><ref id="cputs" name="cputs">
283 <item><ref id="cputsxy" name="cputsxy">
284 <item><ref id="cursor" name="cursor">
285 <item><ref id="cvline" name="cvline">
286 <item><ref id="cvlinexy" name="cvlinexy">
287 <item><ref id="gotox" name="gotox">
288 <item><ref id="gotoxy" name="gotoxy">
289 <item><ref id="gotoy" name="gotoy">
290 <item><ref id="kbhit" name="kbhit">
291 <item><ref id="revers" name="revers">
292 <item><ref id="screensize" name="screensize">
293 <item><ref id="textcolor" name="textcolor">
294 <item><ref id="vcprintf" name="vcprintf">
295 <item><ref id="wherex" name="wherex">
296 <item><ref id="wherey" name="wherey">
300 <sect1><tt/ctype.h/<label id="ctype.h"><p>
303 <item><ref id="isalnum" name="isalnum">
304 <item><ref id="isalpha" name="isalpha">
305 <item><ref id="isascii" name="isascii">
306 <item><ref id="isblank" name="isblank">
307 <item><ref id="iscntrl" name="iscntrl">
308 <item><ref id="isdigit" name="isdigit">
309 <item><ref id="isgraph" name="isgraph">
310 <item><ref id="islower" name="islower">
311 <item><ref id="isprint" name="isprint">
312 <item><ref id="ispunct" name="ispunct">
313 <item><ref id="isspace" name="isspace">
314 <item><ref id="isupper" name="isupper">
315 <item><ref id="isxdigit" name="isxdigit">
316 <item><ref id="tolower" name="tolower">
317 <item><ref id="toupper" name="toupper">
321 <sect1><tt/dbg.h/<label id="dbg.h"><p>
324 <!-- <item><ref id="DbgInit" name="DbgInit"> -->
330 <sect1><tt/device.h/<label id="device.h"><p>
333 <item><ref id="getcurrentdevice" name="getcurrentdevice">
334 <item><ref id="getdevicedir" name="getdevicedir">
335 <item><ref id="getfirstdevice" name="getfirstdevice">
336 <item><ref id="getnextdevice" name="getnextdevice">
340 <sect1><tt/dio.h/<label id="dio.h"><p>
342 <url url="dio.html" name="Low-level disk I/O API">.
345 <sect1><tt/dirent.h/<label id="dirent.h"><p>
348 <item><ref id="_DE_ISDIR" name="_DE_ISDIR">
349 <item><ref id="_DE_ISLBL" name="_DE_ISLBL">
350 <item><ref id="_DE_ISLNK" name="_DE_ISLNK">
351 <item><ref id="_DE_ISREG" name="_DE_ISREG">
352 <item><ref id="closedir" name="closedir">
353 <item><ref id="opendir" name="opendir">
354 <item><ref id="readdir" name="readdir">
355 <item><ref id="rewinddir" name="rewinddir">
356 <item><ref id="seekdir" name="seekdir">
357 <item><ref id="telldir" name="telldir">
361 <sect1><tt/em.h/<label id="em.h"><p>
363 This header file contains definitions for extended memory access,
364 see also <tt>testcode/lib/em-test.c</tt> and <tt>samples/multidemo.c</tt>.
367 <item><ref id="em_commit" name="em_commit">
368 <item><ref id="em_copyfrom" name="em_copyfrom">
369 <item><ref id="em_copyto" name="em_copyto">
370 <item><ref id="em_install" name="em_install">
371 <item><ref id="em_load_driver" name="em_load_driver">
372 <item><ref id="em_map" name="em_map">
373 <item><ref id="em_pagecount" name="em_pagecount">
374 <item><ref id="em_uninstall" name="em_uninstall">
375 <item><ref id="em_unload" name="em_unload">
376 <item><ref id="em_use" name="em_use">
380 <sect1><tt/errno.h/<label id="errno.h"><p>
383 <!-- <item><ref id="_directerrno" name="_directerrno"> -->
384 <!-- <item><ref id="_mappederrno" name="_mappederrno"> -->
385 <!-- <item><ref id="_osmaperrno" name="_osmaperrno"> -->
386 <!-- <item><ref id="_seterrno" name="_seterrno"> -->
392 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
395 <item><ref id="close" name="close">
396 <item><ref id="creat" name="creat">
397 <item><ref id="open" name="open">
401 <sect1><tt/gamate.h/<label id="gamate.h"><p>
404 <!-- <item><ref id="get_tv" name="get_tv"> -->
405 <item><ref id="waitvsync" name="waitvsync">
411 <sect1><tt/geos.h/<label id="geos.h"><p>
413 <url url="geos.html" name="GEOS API">.
416 <sect1><tt/joystick.h/<label id="joystick.h"><p>
419 <item><ref id="joy_count" name="joy_count">
420 <item><ref id="joy_install" name="joy_install">
421 <item><ref id="joy_load_driver" name="joy_load_driver">
422 <item><ref id="joy_read" name="joy_read">
423 <item><ref id="joy_uninstall" name="joy_uninstall">
424 <item><ref id="joy_unload" name="joy_unload">
428 <sect1><tt/locale.h/<label id="locale.h"><p>
431 <item><ref id="localeconv" name="localeconv">
432 <item><ref id="setlocale" name="setlocale">
436 <sect1><tt/lynx.h/<label id="lynx.h"><p>
439 <!-- <item><ref id="lynx_eeprom_erase" name="lynx_eeprom_erase"> -->
440 <!-- <item><ref id="lynx_eeprom_read" name="lynx_eeprom_read"> -->
441 <!-- <item><ref id="lynx_eeprom_write" name="lynx_eeprom_write"> -->
442 <!-- <item><ref id="lynx_eeread" name="lynx_eeread"> -->
443 <!-- <item><ref id="lynx_eewrite" name="lynx_eewrite"> -->
444 <!-- <item><ref id="lynx_exec" name="lynx_exec"> -->
445 <!-- <item><ref id="lynx_load" name="lynx_load"> -->
451 <sect1><tt/lz4.h/<label id="lz4.h"><p>
454 <item><ref id="decompress_lz4" name="decompress_lz4">
458 <sect1><tt/modload.h/<label id="modload.h"><p>
461 <item><ref id="mod_load" name="mod_load">
462 <item><ref id="mod_free" name="mod_free">
466 <sect1><tt/mouse.h/<label id="mouse.h"><p>
469 <item><ref id="mouse_buttons" name="mouse_buttons">
470 <item><ref id="mouse_getbox" name="mouse_getbox">
471 <item><ref id="mouse_geterrormsg" name="mouse_geterrormsg">
472 <item><ref id="mouse_hide" name="mouse_hide">
473 <item><ref id="mouse_info" name="mouse_info">
474 <item><ref id="mouse_install" name="mouse_install">
475 <item><ref id="mouse_ioctl" name="mouse_ioctl">
476 <item><ref id="mouse_load_driver" name="mouse_load_driver">
477 <item><ref id="mouse_move" name="mouse_move">
478 <item><ref id="mouse_pos" name="mouse_pos">
479 <item><ref id="mouse_setbox" name="mouse_setbox">
480 <item><ref id="mouse_show" name="mouse_show">
481 <item><ref id="mouse_uninstall" name="mouse_uninstall">
482 <item><ref id="mouse_unload" name="mouse_unload">
486 <sect1><tt/nes.h/<label id="nes.h"><p>
489 <!-- <item><ref id="get_tv" name="get_tv"> -->
490 <item><ref id="waitvsync" name="waitvsync">
496 <sect1><tt/o65.h/<label id="o65.h"><p>
498 The <tt/o65.h/ header file contains structure and constant definitions that
499 may be used when dealing with files in <url
500 url="http://www.6502.org/users/andre/o65/fileformat.html" name="the o65 format">.
501 It does not declare any functions.
504 <sect1><tt/pce.h/<label id="pce.h"><p>
507 <!-- <item><ref id="get_tv" name="get_tv"> -->
508 <item><ref id="waitvsync" name="waitvsync">
514 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
517 <item><ref id="PEEK" name="PEEK">
518 <item><ref id="PEEKW" name="PEEKW">
519 <item><ref id="POKE" name="POKE">
520 <item><ref id="POKEW" name="POKEW">
524 <sect1><tt/pen.h/<label id="pen.h"><p>
527 <!-- <item><ref id="pen_adjust" name="pen_adjust"> -->
528 <!-- <item><ref id="pen_calibrate" name="pen_calibrate"> -->
534 <sect1><tt/pet.h/<label id="pet.h"><p>
539 <sect1><tt/plus4.h/<label id="plus4.h"><p>
542 <item><ref id="fast" name="fast">
543 <item><ref id="isfast" name="isfast">
544 <item><ref id="slow" name="slow">
550 <sect1><tt/serial.h/<label id="serial.h"><p>
552 This header file contains definitions for initializing serial
553 communication, see also <tt>testcode/lib/ser-test.c</tt>.
556 <item><ref id="ser_close" name="ser_close">
557 <item><ref id="ser_get" name="ser_get">
558 <item><ref id="ser_install" name="ser_install">
559 <item><ref id="ser_ioctl" name="ser_ioctl">
560 <item><ref id="ser_load_driver" name="ser_load_driver">
561 <item><ref id="ser_open" name="ser_open">
562 <item><ref id="ser_put" name="ser_put">
563 <item><ref id="ser_status" name="ser_status">
564 <item><ref id="ser_uninstall" name="ser_uninstall">
565 <item><ref id="ser_unload" name="ser_unload">
569 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
572 <item><ref id="setjmp" name="setjmp">
573 <item><ref id="longjmp" name="longjmp">
577 <sect1><tt/signal.h/<label id="signal.h"><p>
580 <item><ref id="raise" name="raise">
581 <item><ref id="signal" name="signal">
585 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
590 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
595 <sect1><tt/stddef.h/<label id="stddef.h"><p>
598 <item><ref id="offsetof" name="offsetof">
602 <sect1><tt/stdio.h/<label id="stdio.h"><p>
605 <item><ref id="_poserror" name="_poserror">
606 <item><ref id="clearerr" name="clearerr">
607 <!-- <item><ref id="fclose" name="fclose"> -->
608 <!-- <item><ref id="fdopen" name="fdopen"> -->
609 <item><ref id="feof" name="feof">
610 <item><ref id="ferror" name="ferror">
611 <!-- <item><ref id="fflush" name="fflush"> -->
612 <!-- <item><ref id="fgetc" name="fgetc"> -->
613 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
614 <!-- <item><ref id="fgets" name="fgets"> -->
615 <item><ref id="fileno" name="fileno">
616 <!-- <item><ref id="fopen" name="fopen"> -->
617 <!-- <item><ref id="fprintf" name="fprintf"> -->
618 <!-- <item><ref id="fputc" name="fputc"> -->
619 <!-- <item><ref id="fputs" name="fputs"> -->
620 <!-- <item><ref id="fread" name="fread"> -->
621 <!-- <item><ref id="freopen" name="freopen"> -->
622 <!-- <item><ref id="fscanf" name="fscanf"> -->
623 <!-- <item><ref id="fseek" name="fseek"> -->
624 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
625 <!-- <item><ref id="ftell" name="ftell"> -->
626 <!-- <item><ref id="fwrite" name="fwrite"> -->
627 <!-- <item><ref id="getc" name="getc"> -->
628 <!-- <item><ref id="getchar" name="getchar"> -->
629 <!-- <item><ref id="gets" name="gets"> -->
630 <!-- <item><ref id="printf" name="printf"> -->
631 <!-- <item><ref id="putc" name="putc"> -->
632 <!-- <item><ref id="putchar" name="putchar"> -->
633 <!-- <item><ref id="puts" name="puts"> -->
634 <item><ref id="rename" name="rename">
635 <item><ref id="remove" name="remove">
636 <!-- <item><ref id="rewind" name="rewind"> -->
637 <!-- <item><ref id="scanf" name="scanf"> -->
638 <!-- <item><ref id="snprintf" name="snprintf"> -->
639 <!-- <item><ref id="sprintf" name="sprintf"> -->
640 <!-- <item><ref id="sscanf" name="sscanf"> -->
641 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
642 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
643 <!-- <item><ref id="vprintf" name="vprintf"> -->
644 <!-- <item><ref id="vscanf" name="vscanf"> -->
645 <!-- <item><ref id="vsnprintf" name="vsnprintf"> -->
646 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
647 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
653 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
656 <item><ref id="_heapadd" name="_heapadd">
657 <item><ref id="_heapblocksize" name="_heapblocksize">
658 <item><ref id="_heapmaxavail" name="_heapmaxavail">
659 <item><ref id="_heapmemavail" name="_heapmemavail">
660 <item><ref id="_randomize" name="_randomize">
661 <item><ref id="_swap" name="_swap">
662 <item><ref id="abort" name="abort">
663 <item><ref id="abs" name="abs">
664 <item><ref id="atexit" name="atexit">
665 <item><ref id="atoi" name="atoi">
666 <item><ref id="atol" name="atol">
667 <item><ref id="bsearch" name="bsearch">
668 <item><ref id="calloc" name="calloc">
669 <item><ref id="div" name="div">
670 <item><ref id="exit" name="exit">
671 <item><ref id="free" name="free">
672 <item><ref id="getenv" name="getenv">
673 <item><ref id="itoa" name="itoa">
674 <item><ref id="labs" name="labs">
675 <item><ref id="ltoa" name="ltoa">
676 <item><ref id="malloc" name="malloc">
677 <item><ref id="perror" name="perror">
678 <!-- <item><ref id="posix_memalign" name="posix_memalign"> -->
679 <!-- <item><ref id="putenv" name="putenv"> -->
680 <item><ref id="qsort" name="qsort">
681 <item><ref id="rand" name="rand">
682 <item><ref id="realloc" name="realloc">
683 <item><ref id="srand" name="srand">
684 <!-- <item><ref id="system" name="system"> -->
685 <item><ref id="ultoa" name="ultoa">
686 <item><ref id="utoa" name="utoa">
692 <sect1><tt/string.h/<label id="string.h"><p>
695 <item><ref id="_stroserror" name="_stroserror">
696 <item><ref id="bzero" name="bzero">
697 <item><ref id="memchr" name="memchr">
698 <item><ref id="memcmp" name="memcmp">
699 <item><ref id="memcpy" name="memcpy">
700 <item><ref id="memmove" name="memmove">
701 <item><ref id="memset" name="memset">
702 <item><ref id="strcasecmp" name="strcasecmp">
703 <item><ref id="strcat" name="strcat">
704 <item><ref id="strchr" name="strchr">
705 <item><ref id="strcmp" name="strcmp">
706 <item><ref id="strcoll" name="strcoll">
707 <item><ref id="strcpy" name="strcpy">
708 <item><ref id="strcspn" name="strcspn">
709 <item><ref id="strdup" name="strdup">
710 <item><ref id="strerror" name="strerror">
711 <item><ref id="stricmp" name="stricmp">
712 <item><ref id="strlen" name="strlen">
713 <item><ref id="strlower" name="strlower">
714 <item><ref id="strlwr" name="strlwr">
715 <item><ref id="strncasecmp" name="strncasecmp">
716 <item><ref id="strncat" name="strncat">
717 <item><ref id="strncmp" name="strncmp">
718 <item><ref id="strncpy" name="strncpy">
719 <item><ref id="strnicmp" name="strnicmp">
720 <item><ref id="strqtok" name="strqtok">
721 <item><ref id="strrchr" name="strrchr">
722 <item><ref id="strspn" name="strspn">
723 <item><ref id="strstr" name="strstr">
724 <item><ref id="strtok" name="strtok">
725 <item><ref id="strxfrm" name="strxfrm">
726 <item><ref id="strupper" name="strupper">
727 <item><ref id="strupr" name="strupr">
731 <sect1><tt/telestrat.h/<label id="telestrat.h"><p>
734 <item><ref id="atmos_explode" name="explode">
735 <item><ref id="atmos_ping" name="ping">
736 <item><ref id="atmos_shoot" name="shoot">
737 <item><ref id="atmos_zap" name="zap">
738 <!-- <item><ref id="kbdclick1" name="kbdclick1"> -->
739 <!-- <item><ref id="oups" name="oups"> -->
745 <sect1><tt/tgi.h/<label id="tgi.h"><p>
747 <url url="tgi.html" name="Tiny Graphics Interface">.
750 <sect1><tt/time.h/<label id="time.h"><p>
753 <!-- <item><ref id="_systime" name="_systime"> -->
754 <!-- <item><ref id="asctime" name="asctime"> -->
755 <item><ref id="clock" name="clock">
756 <!-- <item><ref id="ctime" name="ctime"> -->
757 <!-- <item><ref id="gmtime" name="gmtime"> -->
758 <!-- <item><ref id="localtime" name="localtime"> -->
759 <!-- <item><ref id="mktime" name="mktime"> -->
760 <!-- <item><ref id="strftime" name="strftime"> -->
761 <item><ref id="time" name="time">
767 <sect1><tt/unistd.h/<label id="unistd.h"><p>
770 <!-- <item><ref id="chdir" name="chdir"> -->
771 <item><ref id="exec" name="exec">
772 <item><ref id="getcwd" name="getcwd">
773 <item><ref id="getopt" name="getopt">
774 <!-- <item><ref id="lseek" name="lseek"> -->
775 <!-- <item><ref id="mkdir" name="mkdir"> -->
776 <!-- <item><ref id="read" name="read"> -->
777 <!-- <item><ref id="rmdir" name="rmdir"> -->
778 <item><ref id="sleep" name="sleep">
779 <item><ref id="unlink" name="unlink">
780 <!-- <item><ref id="write" name="write"> -->
786 <sect1><tt/vic20.h/<label id="vic20.h"><p>
791 <sect1><tt/zlib.h/<label id="zlib.h"><p>
794 <!-- <item><ref id="adler32" name="adler32"> -->
795 <!-- <item><ref id="crc32" name="crc32"> -->
796 <!-- <item><ref id="inflatemem" name="inflatemem"> -->
797 <!-- <item><ref id="uncompress" name="uncompress"> -->
803 <sect>Alphabetical function reference<p>
805 <sect1>_DE_ISDIR<label id="_DE_ISDIR"><p>
809 <tag/Function/Determine if a directory entry specifies a directory.
810 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
811 <tag/Declaration/<tt/int _DE_ISDIR(unsigned char type);/
812 <tag/Description/The function is called with the type of a directory entry
813 taken from a <tt/struct dirent/ and returns true if the entry designates
816 <item>The function is actually a macro.
818 <tag/Availability/cc65
820 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
821 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
822 <ref id="_DE_ISREG" name="_DE_ISREG">
828 <sect1>_DE_ISLBL<label id="_DE_ISLBL"><p>
832 <tag/Function/Determine if a directory entry specifies a disk label.
833 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
834 <tag/Declaration/<tt/int _DE_ISLBL(unsigned char type);/
835 <tag/Description/The function is called with the type of a directory entry
836 taken from a <tt/struct dirent/ and returns true if the entry designates
839 <item>The function is actually a macro.
841 <tag/Availability/cc65
843 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
844 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
845 <ref id="_DE_ISREG" name="_DE_ISREG">
851 <sect1>_DE_ISLNK<label id="_DE_ISLNK"><p>
855 <tag/Function/Determine if a directory entry specifies a link.
856 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
857 <tag/Declaration/<tt/int _DE_ISLNK(unsigned char type);/
858 <tag/Description/The function is called with the type of a directory entry
859 taken from a <tt/struct dirent/ and returns true if the entry designates
862 <item>The function is actually a macro.
864 <tag/Availability/cc65
866 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
867 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
868 <ref id="_DE_ISREG" name="_DE_ISREG">
874 <sect1>_DE_ISREG<label id="_DE_ISREG"><p>
878 <tag/Function/Determine if a directory entry specifies a regular file.
879 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
880 <tag/Declaration/<tt/int _DE_ISREG(unsigned char type);/
881 <tag/Description/The function is called with the type of a directory entry
882 taken from a <tt/struct dirent/ and returns true if the entry designates
885 <item>The function is actually a macro.
886 <item>A "regular file" means anything with data in it. This might still mean
887 that special processing is needed, when accessing the file. Relative files of
888 the CBM systems are classified as being "regular" files, for example.
890 <tag/Availability/cc65
892 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
893 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
894 <ref id="_DE_ISLNK" name="_DE_ISLNK">
900 <sect1>_heapadd<label id="_heapadd"><p>
904 <tag/Function/Add a block to the heap.
905 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
906 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
907 <tag/Description/The function adds a block of raw memory to the heap.
909 <item>The minimum blocksize that can be added is 6 bytes; the function will
910 ignore smaller blocks.
911 <item>The function is available only as a fastcall function; so, it may be used
912 only in the presence of a prototype.
914 <tag/Availability/cc65
916 <ref id="_heapblocksize" name="_heapblocksize">,
917 <ref id="_heapmaxavail" name="_heapmaxavail">,
918 <ref id="_heapmemavail" name="_heapmemavail">,
919 <ref id="calloc" name="calloc">,
920 <ref id="free" name="free">,
921 <ref id="malloc" name="malloc">,
922 <ref id="realloc" name="realloc">
928 <sect1>_heapblocksize<label id="_heapblocksize"><p>
932 <tag/Function/Return the size of an allocated block.
933 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
934 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
935 <tag/Description/The function returns the size of a block that must have
936 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
937 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
939 <item>Passing a pointer to a block that was is not the result of one of the
940 allocation functions, or that has been free'd will give unpredicable results.
941 <item>The function is available only as a fastcall function; so, it may be used
942 only in the presence of a prototype.
944 <tag/Availability/cc65
946 <ref id="_heapadd" name="_heapadd">,
947 <ref id="_heapmaxavail" name="_heapmaxavail">,
948 <ref id="_heapmemavail" name="_heapmemavail">,
949 <ref id="calloc" name="calloc">,
950 <ref id="free" name="free">,
951 <ref id="malloc" name="malloc">,
952 <ref id="realloc" name="realloc">
958 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
962 <tag/Function/Return the largest block that is available on the heap.
963 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
964 <tag/Declaration/<tt/size_t _heapmaxavail (void);/
965 <tag/Description/The function returns the size of the largest block that may
966 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
967 <tag/Availability/cc65
969 <ref id="_heapadd" name="_heapadd">,
970 <ref id="_heapblocksize" name="_heapblocksize">,
971 <ref id="_heapmemavail" name="_heapmemavail">,
972 <ref id="calloc" name="calloc">,
973 <ref id="free" name="free">,
974 <ref id="malloc" name="malloc">,
975 <ref id="realloc" name="realloc">
981 <sect1>_heapmemavail<label id="_heapmemavail"><p>
985 <tag/Function/Return the total available space on the heap.
986 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
987 <tag/Declaration/<tt/size_t _heapmemavail (void);/
988 <tag/Description/The function returns the total number of bytes available on
991 <item>This function is of less use than usually assumed, since the returned
992 heap space may be available but not in one block. So even if this function
993 says that several times more heap space is available than needed, <ref
994 id="malloc" name="malloc"> may still return <tt/NULL/.
996 <tag/Availability/cc65
998 <ref id="_heapadd" name="_heapadd">,
999 <ref id="_heapblocksize" name="_heapblocksize">,
1000 <ref id="_heapmaxavail" name="_heapmaxavail">,
1001 <ref id="calloc" name="calloc">,
1002 <ref id="free" name="free">,
1003 <ref id="malloc" name="malloc">,
1004 <ref id="realloc" name="realloc">
1010 <sect1>_is_cmdline_dos<label id="_is_cmdline_dos"><p>
1014 <tag/Function/Determines whether the underlying DOS supports command line arguments.
1015 <tag/Header/<tt/<ref id="atari.h" name="atari.h">/
1016 <tag/Declaration/<tt/unsigned char _is_cmdline_dos (void);/
1017 <tag/Description/The function returns 0 if the DOS doesn't support command line arguments.
1018 It returns 1 if it does.
1019 <tag/Availability/cc65 (<tt/atari/ and <tt/atarixl/ platforms)
1024 <sect1>_poserror<label id="_poserror"><p>
1028 <tag/Function/Print an error message for the error in <tt/_oserror/.
1029 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1030 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
1031 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
1032 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
1033 a colon and a blank. Then the error message for the current contents of
1034 <tt/_oserror/ are printed followed by a newline. The message output is the
1035 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
1036 argument of <tt/_oserror/.
1037 <tag/Notes/<itemize>
1038 <item>Since operating system specific error code are - you guessed it -
1039 operating system specific, the value in <tt/_oserror/ and the message that is
1040 printed depends on the cc65 target.
1041 <item>The function is only available as fastcall function, so it may only
1042 be used in presence of a prototype.
1044 <tag/Availability/cc65
1046 <ref id="_stroserror" name="_stroserror">,
1047 <ref id="perror" name="perror">
1053 <sect1>_randomize<label id="_randomize"><p>
1057 <tag/Function/Initialize the pseudo random number generator.
1058 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1059 <tag/Declaration/<tt/void _randomize (void);/
1060 <tag/Description/The function initializes the random number generator with
1061 a seed derived from fast changing hardware events, so the seed itself can be
1062 considered random to a certain degree.
1063 <tag/Notes/<itemize>
1064 <item>The randomness of the seed depends on the machine hardware.
1066 <tag/Availability/cc65
1068 <ref id="rand" name="rand">,
1069 <ref id="srand" name="srand">
1075 <sect1>_stroserror<label id="_stroserror"><p>
1079 <tag/Function/Return a string describing an OS specific error code.
1080 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1081 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
1082 <tag/Description/<tt/_stroserror/ will return a string describing the given
1083 operating system specific error code.
1084 <tag/Notes/<itemize>
1085 <item>Since operating system specific error code are - you guessed it -
1086 operating system specific, the parameter and the string returned depend on the
1088 <item>The function is only available as fastcall function, so it may only be
1089 used in presence of a prototype.
1091 <tag/Availability/cc65
1093 <ref id="strerror" name="strerror">
1099 <sect1>_swap<label id="_swap"><p>
1103 <tag/Function/Swap the contents of memory areas.
1104 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1105 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
1106 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
1107 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
1108 <tt/size/ bytes in size.
1109 <tag/Notes/<itemize>
1110 <item>The memory areas may not overlap, otherwise the results are undefined.
1111 <item>The function is only available as fastcall function, so it may only be
1112 used in presence of a prototype.
1114 <tag/Availability/cc65
1116 <ref id="memcpy" name="memcpy">,
1117 <ref id="memmove" name="memmove">
1123 <sect1>_sys<label id="_sys"><p>
1127 <tag/Function/Call a subroutine passing register values.
1128 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1129 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
1130 <tag/Description/The function will call the subroutine at the address
1131 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
1132 registers and the CPU flags are set to the values given in the <tt/regs/
1133 structure. On return from the subroutine, the new values of the registers and
1134 flags are stored back overwriting the old values.
1135 <tag/Notes/<itemize>
1136 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
1137 when calling the subroutine (they are unchanged from their current values).
1138 <item>The function is only available as fastcall function, so it may only be
1139 used in presence of a prototype.
1141 <tag/Availability/cc65
1147 <sect1>BRK<label id="BRK"><p>
1151 <tag/Function/Insert a 6502 BRK instrunction into the code.
1152 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1153 <tag/Declaration/<tt/void BRK (void);/
1154 <tag/Description/The function will insert a 6502 BRK instruction into the code
1155 which may be used to trigger a debugger.
1156 <tag/Notes/<itemize>
1157 <item>The function is actually a macro.
1158 <item>The inserted instruction may lead to unexpected results if no debugger
1161 <tag/Availability/cc65
1163 <ref id="CLI" name="CLI">,
1164 <ref id="SEI" name="SEI">
1170 <sect1>CLI<label id="CLI"><p>
1174 <tag/Function/Insert a 6502 CLI instrunction into the code.
1175 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1176 <tag/Declaration/<tt/void CLI (void);/
1177 <tag/Description/The function will insert a 6502 CLI instruction into the code,
1178 so interrupts are enabled. Enabling interrupts has no effects if they are
1179 already enabled (the default).
1180 <tag/Notes/<itemize>
1181 <item>The function is actually a macro.
1182 <item>Disabling interrupts may lead to unexpected results.
1184 <tag/Availability/cc65
1186 <ref id="BRK" name="BRK">,
1187 <ref id="SEI" name="SEI">
1193 <sect1>PEEK<label id="PEEK"><p>
1197 <tag/Function/Read a byte from memory.
1198 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1199 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
1200 <tag/Description/The function will read the absolute memory given by <tt/addr/
1201 and return the value read.
1202 <tag/Notes/<itemize>
1203 <item>The function is actually a macro.
1204 <item>This function depends highly on the platform and environment.
1206 <tag/Availability/cc65
1208 <ref id="PEEKW" name="PEEKW">,
1209 <ref id="POKE" name="POKE">
1215 <sect1>PEEKW<label id="PEEKW"><p>
1219 <tag/Function/Read a word (two bytes) from memory.
1220 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1221 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
1222 <tag/Description/The function will read the absolute memory given by <tt/addr/
1223 and return the value read. The byte read from the higher address is the high
1224 byte of the return value.
1225 <tag/Notes/<itemize>
1226 <item>The function is actually a macro.
1227 <item>This function depends highly on the platform and environment.
1228 <item>The order in which the two bytes are read is unspecified and may
1229 depend of the address expression used.
1231 <tag/Availability/cc65
1233 <ref id="PEEK" name="PEEK">,
1234 <ref id="POKE" name="POKE">
1240 <sect1>POKE<label id="POKE"><p>
1244 <tag/Function/Write a byte to memory.
1245 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1246 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
1247 <tag/Description/The function writes the value <tt/val/ to the absolute
1248 memory address given by <tt/addr/.
1249 <tag/Notes/<itemize>
1250 <item>The function is actually a macro.
1251 <item>This function depends highly on the platform and environment.
1252 <item>Careless use will cause the program to act strange or may crash the
1255 <tag/Availability/cc65
1257 <ref id="PEEK" name="PEEK">,
1258 <ref id="POKEW" name="POKEW">
1264 <sect1>POKEW<label id="POKEW"><p>
1268 <tag/Function/Write a word (two bytes) to memory.
1269 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1270 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
1271 <tag/Description/The function writes the value <tt/val/ to the absolute
1272 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
1273 the <tt/addr/, the high byte is written to <tt/addr+1/.
1274 <tag/Notes/<itemize>
1275 <item>The function is actually a macro.
1276 <item>This function depends highly on the platform and environment.
1277 <item>Careless use will cause the program to act strange or may crash the
1279 <item>The order in which the two bytes are written is unspecified and may
1280 depend of the address expression used.
1282 <tag/Availability/cc65
1284 <ref id="PEEK" name="PEEK">,
1285 <ref id="POKE" name="POKE">
1291 <sect1>SEI<label id="SEI"><p>
1295 <tag/Function/Insert a 6502 SEI instrunction into the code.
1296 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1297 <tag/Declaration/<tt/void SEI (void);/
1298 <tag/Description/The function will insert a 6502 SEI instruction into the code,
1299 so interrupts are disabled. Note that non maskable interrupts cannot be
1301 <tag/Notes/<itemize>
1302 <item>The function is actually a macro.
1303 <item>Disabling interrupts may lead to unexpected results.
1305 <tag/Availability/cc65
1307 <ref id="BRK" name="BRK">,
1308 <ref id="CLI" name="CLI">
1314 <sect1>abort<label id="abort"><p>
1318 <tag/Function/Terminates a program abnormally.
1319 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1320 <tag/Declaration/<tt/void abort (void);/
1321 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
1322 on stderr, then terminates the program with an exit code of 3.
1323 <tag/Availability/ISO 9899
1325 <ref id="assert" name="assert">,
1326 <ref id="exit" name="exit">,
1327 <ref id="raise" name="raise">
1333 <sect1>abs<label id="abs"><p>
1337 <tag/Function/Returns the absolute value of an integer.
1338 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1339 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
1340 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
1342 <tag/Notes/<itemize>
1343 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
1344 <item>The function is only available as fastcall function, so it may only be
1345 used in presence of a prototype.
1347 <tag/Availability/ISO 9899
1349 <ref id="labs" name="labs">
1355 <sect1>assert<label id="assert"><p>
1359 <tag/Function/Test a condition and possibly abort.
1360 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
1361 <tag/Declaration/<tt/void assert (int cond);/
1362 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
1363 statement. If the condition evaluates t zero (false), assert prints a message
1364 on stderr and aborts the program.
1365 <tag/Notes/<itemize>
1366 <item>The function is actually a macro.
1368 <tag/Availability/ISO 9899
1370 <ref id="abort" name="abort">,
1371 <ref id="exit" name="exit">
1377 <sect1>atexit<label id="atexit"><p>
1381 <tag/Function/Register an exit function.
1382 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1383 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1384 <tag/Description/<tt/atexit/ registers the function pointed to by
1385 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1386 terminates, they are called in LIFO order (the last function registered is
1387 called first). <tt/atexit/ returns zero on success and a nonzero value on
1389 <tag/Notes/<itemize>
1390 <item>A maximum of 5 exit functions can be registered.
1391 <item>There is no way to unregister an exit function.
1392 <item>The function is only available as fastcall function, so it may only be
1393 used in presence of a prototype.
1395 <tag/Availability/ISO 9899
1397 <ref id="abort" name="abort">,
1398 <ref id="exit" name="exit">
1404 <sect1>atmos_explode<label id="atmos_explode"><p>
1408 <tag/Function/Bomb sound effect.
1409 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1410 <tag/Declaration/<tt/void __fastcall__ atmos_explode(void);/
1411 <tag/Description/<tt/atmos_explode/ plays the BASIC sound.
1412 <tag/Notes/<itemize>
1413 <item>The function is available only as a fastcall function; so, it may be used
1414 only in the presence of a prototype.
1416 <tag/Availability/cc65
1418 <ref id="atmos_ping" name="atmos_ping">,
1419 <ref id="atmos_shoot" name="atmos_shoot">,
1420 <ref id="atmos_tick" name="atmos_tick">,
1421 <ref id="atmos_tock" name="atmos_tock">,
1422 <ref id="atmos_zap" name="atmos_zap">
1428 <sect1>atmos_load<label id="atmos_load"><p>
1432 <tag/Function/Load Atmos tape.
1433 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1434 <tag/Declaration/<tt/void __fastcall__ atmos_load(const char* name);/
1435 <tag/Description/<tt/atmos_load/ reads a memory block from tape.
1436 <tag/Notes/<itemize>
1437 <item>The function is available only as a fastcall function; so, it may be used
1438 only in the presence of a prototype.
1440 <tag/Availability/cc65
1442 <ref id="atmos_save" name="atmos_save">
1448 <sect1>atmos_ping<label id="atmos_ping"><p>
1452 <tag/Function/Bell or ricochet sound effect.
1453 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1454 <tag/Declaration/<tt/void __fastcall__ atmos_ping(void);/
1455 <tag/Description/<tt/atmos_ping/ plays the BASIC sound.
1456 <tag/Notes/<itemize>
1457 <item>The function is available only as a fastcall function; so, it may be used
1458 only in the presence of a prototype.
1460 <tag/Availability/cc65
1462 <ref id="atmos_explode" name="atmos_explode">,
1463 <ref id="atmos_shoot" name="atmos_shoot">,
1464 <ref id="atmos_tick" name="atmos_tick">,
1465 <ref id="atmos_tock" name="atmos_tock">,
1466 <ref id="atmos_zap" name="atmos_zap">
1472 <sect1>atmos_save<label id="atmos_save"><p>
1476 <tag/Function/Save Atmos tape.
1477 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1478 <tag/Declaration/<tt/void __fastcall__ atmos_save(const char* name, const void* start, const void* end);/
1479 <tag/Description/<tt/atmos_save/ writes a memory block to tape.
1480 <tag/Notes/<itemize>
1481 <item>The function is available only as a fastcall function; so, it may be used
1482 only in the presence of a prototype.
1484 <tag/Availability/cc65
1486 <ref id="atmos_load" name="atmos_load">
1488 atmos_save("hires", 0xa000, 0xc000);
1494 <sect1>atmos_shoot<label id="atmos_shoot"><p>
1498 <tag/Function/Pistol sound effect.
1499 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1500 <tag/Declaration/<tt/void __fastcall__ atmos_shoot(void);/
1501 <tag/Description/<tt/atmos_shoot/ plays the BASIC sound.
1502 <tag/Notes/<itemize>
1503 <item>The function is available only as a fastcall function; so, it may be used
1504 only in the presence of a prototype.
1506 <tag/Availability/cc65
1508 <ref id="atmos_explode" name="atmos_explode">,
1509 <ref id="atmos_ping" name="atmos_ping">,
1510 <ref id="atmos_tick" name="atmos_tick">,
1511 <ref id="atmos_tock" name="atmos_tock">,
1512 <ref id="atmos_zap" name="atmos_zap">
1518 <sect1>atmos_tick<label id="atmos_tick"><p>
1522 <tag/Function/High-pitch click.
1523 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1524 <tag/Declaration/<tt/void __fastcall__ atmos_tick(void);/
1525 <tag/Description/<tt/atmos_tick/ plays the system sound.
1526 <tag/Notes/<itemize>
1527 <item>The function is available only as a fastcall function; so, it may be used
1528 only in the presence of a prototype.
1530 <tag/Availability/cc65
1532 <ref id="atmos_explode" name="atmos_explode">,
1533 <ref id="atmos_ping" name="atmos_ping">,
1534 <ref id="atmos_shoot" name="atmos_shoot">,
1535 <ref id="atmos_tock" name="atmos_tock">,
1536 <ref id="atmos_zap" name="atmos_zap">
1542 <sect1>atmos_tock<label id="atmos_tock"><p>
1546 <tag/Function/Low-pitch click.
1547 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1548 <tag/Declaration/<tt/void __fastcall__ atmos_tock(void);/
1549 <tag/Description/<tt/atmos_tock/ plays the system sound.
1550 <tag/Notes/<itemize>
1551 <item>The function is available only as a fastcall function; so, it may be used
1552 only in the presence of a prototype.
1554 <tag/Availability/cc65
1556 <ref id="atmos_explode" name="atmos_explode">,
1557 <ref id="atmos_ping" name="atmos_ping">,
1558 <ref id="atmos_shoot" name="atmos_shoot">,
1559 <ref id="atmos_tick" name="atmos_tick">,
1560 <ref id="atmos_zap" name="atmos_zap">
1566 <sect1>atmos_zap<label id="atmos_zap"><p>
1570 <tag/Function/Raygun sound effect.
1571 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1572 <tag/Declaration/<tt/void __fastcall__ atmos_zap(void);/
1573 <tag/Description/<tt/atmos_zap/ plays the BASIC sound.
1574 <tag/Notes/<itemize>
1575 <item>The function is available only as a fastcall function; so, it may be used
1576 only in the presence of a prototype.
1578 <tag/Availability/cc65
1580 <ref id="atmos_explode" name="atmos_explode">,
1581 <ref id="atmos_ping" name="atmos_ping">,
1582 <ref id="atmos_shoot" name="atmos_shoot">,
1583 <ref id="atmos_tick" name="atmos_tick">,
1584 <ref id="atmos_tock" name="atmos_tock">
1590 <sect1>atoi<label id="atoi"><p>
1594 <tag/Function/Convert a string to an integer.
1595 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1596 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1597 <tag/Description/<tt/atoi/ converts the given string into an integer.
1598 Conversion stops as soon as any invalid character is encountered.
1599 <tag/Notes/<itemize>
1600 <item>There is no way to detect any conversion errors.
1601 <item>The function does not check for an numerical overflow when converting.
1602 <item>The function is only available as fastcall function, so it may only be
1603 used in presence of a prototype.
1605 <tag/Availability/ISO 9899
1607 <ref id="atol" name="atol">,
1608 <ref id="itoa" name="itoa">,
1609 <ref id="ltoa" name="ltoa">,
1610 <ref id="ultoa" name="ultoa">,
1611 <ref id="utoa" name="utoa">
1617 <sect1>atol<label id="atol"><p>
1621 <tag/Function/Convert a string to a long integer.
1622 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1623 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1624 <tag/Description/<tt/atol/ converts the given string into a long integer.
1625 Conversion stops as soon as any invalid character is encountered.
1626 <tag/Notes/<itemize>
1627 <item>There is no way to detect any conversion errors.
1628 <item>The function does not check for an numerical overflow when converting.
1629 <item>The function is only available as fastcall function, so it may only be
1630 used in presence of a prototype.
1632 <tag/Availability/ISO 9899
1634 <ref id="atoi" name="atoi">,
1635 <ref id="itoa" name="itoa">,
1636 <ref id="ltoa" name="ltoa">,
1637 <ref id="ultoa" name="ultoa">,
1638 <ref id="utoa" name="utoa">
1644 <sect1>bgcolor<label id="bgcolor"><p>
1648 <tag/Function/Set the background text color.
1649 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1650 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1651 <tag/Description/The function will set a new background color and return the
1652 old (current) one. The background color is valid for the whole text output
1653 area of the screen, not just for new text.
1654 <tag/Notes/<itemize>
1655 <item>Background colors are system dependent. The function may have no effect
1656 on systems where the background color cannot be changed.
1657 <item>The function is only available as fastcall function, so it may only be
1658 used in presence of a prototype.
1660 <tag/Availability/cc65
1662 <ref id="bordercolor" name="bordercolor">,
1663 <ref id="textcolor" name="textcolor">
1669 <sect1>bordercolor<label id="bordercolor"><p>
1673 <tag/Function/Set the border (frame) color.
1674 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1675 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1676 <tag/Description/The function will set a new border color. It returns the old
1677 (current) border color.
1678 <tag/Notes/<itemize>
1679 <item>Border colors are system dependent. The function may have no effect
1680 on systems where the border color cannot be changed.
1681 <item>The function is only available as fastcall function, so it may only
1682 be used in presence of a prototype.
1684 <tag/Availability/cc65
1686 <ref id="bgcolor" name="bgcolor">,
1687 <ref id="textcolor" name="textcolor">
1693 <sect1>bsearch<label id="bsearch"><p>
1697 <tag/Function/Do a binary search in a sorted array.
1698 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1699 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1700 const void* base, size_t n, size_t size,
1701 int __fastcall__ (* cmp) (const void*, const void*));/
1702 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1703 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1704 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1705 the function used to compare the members against the key. The function returns
1706 a pointer to the member found, or <tt/NULL/ if there was no match.
1707 <tag/Notes/<itemize>
1708 <item>The contents of the array must be sorted in ascending order according to
1709 the compare function given.
1710 <item>If there are multiple members that match the key, the function will
1711 return one of the members.
1712 <item>The function is only available as fastcall function, so it may only
1713 be used in presence of a prototype.
1714 <item>The function to which <tt/cmp/ points must have the <tt/fastcall/ calling
1717 <tag/Availability/ISO 9899
1719 <ref id="qsort" name="qsort">
1725 <sect1>bzero<label id="bzero"><p>
1729 <tag/Function/Fill a memory area with zeroes.
1730 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1731 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1732 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1734 <tag/Notes/<itemize>
1735 <item>The function is non standard and therefore only available in non ANSI
1736 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1737 <item>The function is only available as fastcall function, so it may only
1738 be used in presence of a prototype.
1740 <tag/Availability/cc65
1742 <ref id="_swap" name="_swap">,
1743 <ref id="memcpy" name="memcpy">,
1744 <ref id="memmove" name="memmove">,
1745 <ref id="memset" name="memset">,
1751 <sect1>c64mode<label id="c64mode"><p>
1755 <tag/Function/Switch the C128 into C64 compatible mode.
1756 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1757 <tag/Declaration/<tt/void c64mode (void);/
1758 <tag/Description/The function will cause the machine to reboot into C64 mode.
1759 <tag/Notes/<itemize>
1760 <item>The function is specific to the C128.
1761 <item>The function will not return to the caller.
1763 <tag/Availability/C128
1769 <sect1>calloc<label id="calloc"><p>
1773 <tag/Function/Allocate and clear memory.
1774 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1775 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1776 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1777 of size <tt/size/, clears the whole block with binary zeroes and returns a
1778 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1780 <tag/Notes/<itemize>
1781 <item>Clearing the memory may not have the expected effect on all platforms:
1782 pointers in the block may not be <tt/NULL/ and floating point variables may
1783 not be zero (0.0). In other words: The "clearing" effect of this function
1784 should be used with care for portable programs.
1785 <item>The function is only available as fastcall function, so it may only
1786 be used in presence of a prototype.
1788 <tag/Availability/ISO 9899
1790 <ref id="_heapadd" name="_heapadd">,
1791 <ref id="_heapblocksize" name="_heapblocksize">,
1792 <ref id="_heapmaxavail" name="_heapmaxavail">,
1793 <ref id="_heapmemavail" name="_heapmemavail">,
1794 <ref id="free" name="free">,
1795 <ref id="malloc" name="malloc">,
1796 <ref id="realloc" name="realloc">
1802 <sect1>cbm_k_acptr<label id="cbm_k_acptr"><p>
1806 <tag/Function/Input byte from serial bus
1807 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1808 <tag/Declaration/<tt/unsigned char cbm_k_acptr (void);/
1809 <tag/Description/The function returns a byte of data, which it
1810 gets from the current TALKer on the serial bus.
1811 In order to receive the data, the device must have previously been
1812 sent a command to TALK and a secondary address if it needs one.
1813 <tag/Notes/<itemize>
1816 <tag/Availability/cc65
1818 <ref id="cbm_k_talk" name="cbm_k_talk">,
1824 <sect1>cbm_k_basin<label id="cbm_k_basin"><p>
1828 <tag/Function/Input a Character from the Current Device
1829 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1830 <tag/Declaration/<tt/unsigned char cbm_k_basin (void);/
1831 <tag/Description/The function returns a character from the current input device.
1832 Device must first have been OPENed and then designated as the input channel by the CHKIN routine.
1833 When this function is called, the next byte of data available from the device is returned.
1834 Exception is the routine for the keyboard device (which is the default input device).
1835 <tag/Notes/<itemize>
1838 <tag/Availability/cc65
1840 <ref id="cbm_k_open" name="cbm_k_open">,
1841 <ref id="cbm_k_chkin" name="cbm_k_chkin">
1847 <sect1>cbm_k_bsout<label id="cbm_k_bsout"><p>
1851 <tag/Function/Output a byte
1852 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1853 <tag/Declaration/<tt/void __fastcall__ cbm_k_bsout (unsigned char C);/
1854 <tag/Description/Function sends the character to the current output device.
1855 Unless a device has been OPENed and designated as the
1856 current output channel using the CHKOUT routine, the character is
1857 printed to the screen, which is the default output device. If the
1858 cassette is the current device, outputting a byte will only add it to
1859 the buffer. No actual transmission of data will occur until the
1860 192-byte buffer is full.
1861 <tag/Notes/<itemize>
1862 <item>The function is only available as fastcall function, so it may
1863 only be used in presence of a prototype.
1865 <tag/Availability/cc65
1867 <ref id="cbm_k_open" name="cbm_k_open">,
1868 <ref id="cbm_k_chkin" name="cbm_k_chkout">
1874 <sect1>cbm_k_chkin<label id="cbm_k_chkin"><p>
1878 <tag/Function/Designate a Logical File As the Current Input Channel
1879 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1880 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_chkin (unsigned char FN);/
1881 <tag/Description/If you wish to
1882 get data from any device other than the keyboard, this function must be
1883 called after OPENing the device, before you can get a data byte with
1884 the cbm_k_basin or cbm_k_getin routine. When called, the routine will designate
1885 the logical file whose file number was supplied as the
1886 current file, its device as the current device, and its secondary
1887 address as the current secondary address. If the device on the
1888 channel is a serial device, which requires a TALK command and
1889 sometimes a secondary address, function will send them over the
1891 <tag/Notes/<itemize>
1892 <item>The function is only available as fastcall function, so it may
1893 only be used in presence of a prototype.
1895 <tag/Availability/cc65
1897 <ref id="cbm_k_open" name="cbm_k_open">,
1898 <ref id="cbm_k_basin" name="cbm_k_basin">,
1899 <ref id="cbm_k_getin" name="cbm_k_getin">
1905 <sect1>cbm_k_ciout<label id="cbm_k_ciout"><p>
1909 <tag/Function/Transmit a byte over the serial bus
1910 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1911 <tag/Declaration/<tt/void __fastcall__ cbm_k_ciout (unsigned char C);/
1912 <tag/Description/Purpose of this function is to send a byte of data over
1913 the serial bus. In order for the data to be received, the serial
1914 device must have first been commanded to LISTEN and been given a
1915 secondary address if necessary. This routine always buffers the
1916 current character, and defers sending it until the next byte is
1917 buffered. When the UNLISTEN command is sent, the last byte will be
1918 sent with an End or Identify (EOI).
1919 <tag/Notes/<itemize>
1920 <item>The function is only available as fastcall function, so it may
1921 only be used in presence of a prototype.
1923 <tag/Availability/cc65
1925 <ref id="cbm_k_listen" name="cbm_k_listen">,
1926 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">
1932 <sect1>cbm_k_ckout<label id="cbm_k_ckout"><p>
1936 <tag/Function/Designate a Logical File As the Current Output Channel
1937 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1938 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_ckout (unsigned char FN);/
1939 <tag/Description/If you wish to
1940 output data to any device other than the screen, this routine must be
1941 called after OPENing the device, and before you output a data byte
1942 with the cbm_k_bsout() function. When called, the function will designate the
1943 logical file whose file number was supplied as the current
1944 file, its device as the current device, and its secondary address as
1945 the current secondary address. If the device on the channel uses the
1946 serial bus, and therefore requires a LISTEN command and possibly a
1947 secondary address, this information will be sent on the bus.
1948 <tag/Notes/<itemize>
1949 <item>The function is only available as fastcall function, so it may
1950 only be used in presence of a prototype.
1952 <tag/Availability/cc65
1954 <ref id="cbm_k_bsout" name="cbm_k_bsout">,
1955 <ref id="cbm_k_listen" name="cbm_k_listen">
1961 <sect1>cbm_k_clall<label id="cbm_k_clall"><p>
1965 <tag/Function/Close All Logical I/O Files
1966 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1967 <tag/Declaration/<tt/void cbm_k_clall (void);/
1968 <tag/Description/It closes all
1969 open files, by resetting the index into open files to
1970 zero and restores the default I/O devices.
1971 <tag/Notes/<itemize>
1974 <tag/Availability/cc65
1976 <ref id="cbm_k_open" name="cbm_k_open">,
1977 <ref id="cbm_k_close" name="cbm_k_close">
1983 <sect1>cbm_k_close<label id="cbm_k_close"><p>
1987 <tag/Function/Close a Logical I/O File
1988 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1989 <tag/Declaration/<tt/void __fastcall__ cbm_k_close (unsigned char FN);/
1990 <tag/Description/It is used to
1991 close a logical file after all I/O operations involving that file have
1993 <tag/Notes/<itemize>
1994 <item>The function is only available as fastcall function, so it may
1995 only be used in presence of a prototype.
1997 <tag/Availability/cc65
1999 <ref id="cbm_k_open" name="cbm_k_open">,
2000 <ref id="cbm_k_clall" name="cbm_k_clall">
2006 <sect1>cbm_k_clrch<label id="cbm_k_clrch"><p>
2010 <tag/Function/Restore Current Input and Output Devices to the Default Devices
2011 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2012 <tag/Declaration/<tt/void cbm_k_clrch (void);/
2013 <tag/Description/It sets the
2014 current input device to the keyboard, and the current output device to
2015 the screen. Also, if the current input device was formerly a serial
2016 device, the routine sends it an UNTALK command on the serial bus, and
2017 if a serial device was formerly the current output device, the routine
2018 sends it an UNLISTEN command.
2019 <tag/Notes/<itemize>
2022 <tag/Availability/cc65
2024 <ref id="cbm_k_chkin" name="cbm_k_chkin">,
2025 <ref id="cbm_k_ckout" name="cbm_k_ckout">
2031 <sect1>cbm_k_getin<label id="cbm_k_getin"><p>
2035 <tag/Function/Get One Byte from the Input Device
2036 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2037 <tag/Declaration/<tt/unsigned char cbm_k_getin (void);/
2038 <tag/Description/Function gets a character from the current input device.
2039 <tag/Notes/<itemize>
2042 <tag/Availability/cc65
2044 <ref id="cbm_k_basin" name="cbm_k_basin">
2050 <sect1>cbm_k_iobase<label id="cbm_k_iobase"><p>
2054 <tag/Function/Return Base Address of Memory-Mapped I/O Devices
2055 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2056 <tag/Declaration/<tt/unsigned cbm_k_iobase (void);/
2057 <tag/Description/This function returns the address of
2058 the memory section where the memory mapped I/O devices are located. This
2059 address can then be used with an offset to access the memory mapped I/O
2060 devices in the Commodore 64. The offset is the number of locations from
2061 the beginning of the page on which the I/O register you want is located.
2062 This function exists to provide compatibility between the Commodore 64,
2063 VIC-20, and future models of the Commodore 64. If the I/O locations for
2064 a program are set by a call to this function, they should
2065 still remain compatible with future versions of the Commodore 64, the
2067 <tag/Notes/<itemize>
2070 <tag/Availability/cc65
2078 <sect1>cbm_k_listen<label id="cbm_k_listen"><p>
2082 <tag/Function/Command a device on the serial bus to LISTEN
2083 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2084 <tag/Declaration/<tt/void __fastcall__ cbm_k_listen (unsigned char dev);/
2085 <tag/Description/This function will command a device on the serial bus to
2086 receive data. The KERNAL routine will OR the supplied device number bit by bit
2087 to convert it to a listen address, then transmits this data as a command on
2088 the serial bus. The specified device will then go into listen mode, and
2089 be ready to accept information.
2090 <tag/Notes/<itemize>
2091 <item>The function is only available as fastcall function, so it may
2092 only be used in presence of a prototype.
2094 <tag/Availability/cc65
2096 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">
2102 <sect1>cbm_k_load<label id="cbm_k_load"><p>
2106 <tag/Function/Load RAM from a Device
2107 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2108 <tag/Declaration/<tt/unsigned int __fastcall__ cbm_k_load(unsigned char flag, unsigned addr);/
2109 <tag/Description/This function LOADs data bytes from any input device directly into the memory.
2110 It can also be used for a verify operation, comparing data from a device with the data already in
2111 memory, while leaving the data stored in RAM unchanged.
2112 The flag must be set to 0 for a LOAD operation, or 1 for a
2113 verify, If the input device is OPENed with a secondary address (SA) of 0
2114 the header information from the device is ignored. In this case, the starting address for the load must be supplied.
2115 If the device is addressed with a secondary address of 1, then the data is
2116 loaded into memory starting at the location specified by the header.
2117 Function returns the address of the highest RAM location loaded.
2118 Before this function can be called, the KERNAL SETLFS, and SETNAM
2119 routines must be called.
2120 <tag/Notes/<itemize>
2121 <item>The function is only available as fastcall function, so it may
2122 only be used in presence of a prototype.
2124 <tag/Availability/cc65
2126 <ref id="cbm_k_save" name="cbm_k_save">,
2127 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2128 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2134 <sect1>cbm_k_open<label id="cbm_k_open"><p>
2138 <tag/Function/Open a Logical I/O File
2139 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2140 <tag/Declaration/<tt/unsigned char cbm_k_open (void);/
2141 <tag/Description/This function assigns a logical file to a device, so that it can be used for
2142 Input/Output operations. In order to specify the logical file number,
2143 the device number, and the secondary address if any, the cbm_k_setlfs() function must first be called.
2144 Likewise, in order to designate the filename, the cbm_k_setnam() function must be used first. After these two
2145 functions are called, cbm_k_open() is then called.
2146 <tag/Notes/<itemize>
2149 <tag/Availability/cc65
2151 <ref id="cbm_k_close" name="cbm_k_close">,
2152 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2153 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2159 <sect1>cbm_k_readst<label id="cbm_k_readst"><p>
2163 <tag/Function/Read status word
2164 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2165 <tag/Declaration/<tt/unsigned char cbm_k_readst (void);/
2166 <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.
2167 <tag/Notes/<itemize>
2170 <tag/Availability/cc65
2178 <sect1>cbm_k_save<label id="cbm_k_save"><p>
2182 <tag/Function/Save RAM to a Device
2183 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2184 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_save(unsigned int start, unsigned int end)/
2185 <tag/Description/This function saves a section of memory. The cbm_k_setlfs() and cbm_k_setnam() functions must be
2186 used before calling this function. However, a file name is not required to
2187 SAVE to device 1 (the Datassette(TM) recorder). Any attempt to save to
2188 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.
2189 <tag/Notes/<itemize>
2190 <item>The function is only available as fastcall function, so it may
2191 only be used in presence of a prototype.
2193 <tag/Availability/cc65
2195 <ref id="cbm_k_load" name="cbm_k_load">,
2196 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2197 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2203 <sect1>cbm_k_scnkey<label id="cbm_k_scnkey"><p>
2207 <tag/Function/Scan the keyboard matrix.
2208 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2209 <tag/Declaration/<tt/void cbm_k_scnkey (void);/
2210 <tag/Description/This function looks at the switches in the keyboard, to see
2211 if any of them are being pressed. If they are, then code numbers for them are
2212 stored in RAM. Other functions use those numbers to input text. Normally,
2213 the keyboard is scanned by the Kernal's Interrupt Service Routine. But, if
2214 you divert the "Jiffy interrupt" to a C-code ISR, then that ISR must call this
2215 function, in order to provide input from the keyboard.
2216 <tag/Availability/cc65
2218 <ref id="cbm_k_getin" name="cbm_k_getin">,
2219 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2220 <ref id="cgetc" name="cgetc">,
2221 <!-- <ref id="getc" name="getc"> -->
2222 <!-- <ref id="getchar" name="getchar"> -->
2228 <sect1>cmb_k_second<label id="cbm_k_second"><p>
2232 <tag/Function/Send secondary address for LISTEN.
2233 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2234 <tag/Declaration/<tt/void __fastcall__ cbm_k_second (unsigned char addr);/
2235 <tag/Description/This function is used to send a secondary address to an I/O
2236 device after a call to LISTEN is made, and the device is commanded to LISTEN.
2237 <tag/Notes/<itemize>
2238 <item>The function is only available as fastcall function, so it may
2239 only be used in presence of a prototype.
2240 <item>The function can only be called after a call to LISTEN.
2241 <item>The function will not work after a TALK.
2242 <item>When a secondary address is to be sent to a device on the serial bus,
2243 the address must first be ORed with $60.
2245 <tag/Availability/cc65
2247 <ref id="cbm_k_listen" name="cbm_k_listen">
2253 <sect1>cbm_k_setlfs<label id="cbm_k_setlfs"><p>
2257 <tag/Function/Set up a logical file
2258 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2259 <tag/Declaration/<tt/void __fastcall__ cbm_k_setlfs (unsigned char LFN, unsigned char DEV, unsigned char SA);/
2260 <tag/Description/This functions sets up the logical file by setting its number, device address,
2261 and secondary address.
2262 <tag/Notes/<itemize>
2263 <item>The function is only available as fastcall function, so it may
2264 only be used in presence of a prototype.
2266 <tag/Availability/cc65
2268 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2274 <sect1>cbm_k_setnam<label id="cbm_k_setnam"><p>
2278 <tag/Function/Set Filename Parameters
2279 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2280 <tag/Declaration/<tt/void __fastcall__ cbm_k_setnam (const char* Name);/
2281 <tag/Description/This function is used to set up the file name for the OPEN,
2282 SAVE, or LOAD operations.
2283 <tag/Notes/<itemize>
2284 <item>The function is only available as fastcall function, so it may
2285 only be used in presence of a prototype.
2287 <tag/Availability/cc65
2289 <ref id="cbm_k_open" name="cbm_k_open">,
2290 <ref id="cbm_k_load" name="cbm_k_load">,
2291 <ref id="cbm_k_save" name="cbm_k_save">
2297 <sect1>cbm_k_talk<label id="cbm_k_talk"><p>
2301 <tag/Function/Commands device to TALK
2302 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2303 <tag/Declaration/<tt/void __fastcall__ cbm_k_talk (unsigned char dev);/
2304 <tag/Description/When called, it ORs the device number with the TALK code (64, $40) and sends it on the serial
2305 bus. This commands the device to TALK.
2306 <tag/Notes/<itemize>
2307 <item>The function is only available as fastcall function, so it may
2308 only be used in presence of a prototype.
2310 <tag/Availability/cc65
2312 <ref id="cbm_k_acptr" name="cbm_k_acptr">
2318 <sect1>cbm_k_tksa<label id="cbm_k_tksa"><p>
2322 <tag/Function/Send TALK secondary address to serial bus
2323 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2324 <tag/Declaration/<tt/void __fastcall__ cbm_k_tksa (unsigned char addr);/
2325 <tag/Description/This function transmits a secondary address on the serial bus for a TALK device.
2326 <tag/Notes/<itemize>
2327 <item>The function is only available as fastcall function, so it may
2328 only be used in presence of a prototype.
2329 <item>The function can only be called after a call to TALK.
2330 <item>The function will not work after a LISTEN.
2332 <tag/Availability/cc65
2334 <ref id="cbm_k_talk" name="cbm_k_talk">
2340 <sect1>cbm_k_udtim<label id="cbm_k_udtim"><p>
2344 <tag/Function/Update the Jiffy clock.
2345 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2346 <tag/Declaration/<tt/void cbm_k_udtim (void);/
2347 <tag/Description/This function adds one count to the Jiffy clock. That clock
2348 counts sixtieths of a second. It is used by the library's <tt/clock()/
2349 function. Normally, the Jiffy clock is updated by the Kernal's Interrupt
2350 Service Routine. But, if you divert the "Jiffy interrupt" to a C-code ISR,
2351 then that ISR must call this function, in order to keep the clock valid.
2352 <tag/Availability/cc65
2354 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2355 <ref id="clock" name="clock">
2361 <sect1>cbm_k_unlsn<label id="cbm_k_unlsn"><p>
2365 <tag/Function/Send an UNLISTEN command
2366 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2367 <tag/Declaration/<tt/void cbm_k_unlsn (void);/
2368 <tag/Description/This function commands all devices on the serial bus to
2369 stop receiving data from the host computer (i.e., UNLISTEN). Calling this
2370 function results in an UNLISTEN command being transmitted on the serial
2371 bus. Only devices previously commanded to LISTEN are affected. This
2372 function is normally used after the host computer is finished sending data
2373 to external devices. Sending the UNLISTEN commands the listening devices
2374 to get off the serial bus so it can be used for other purposes.
2375 <tag/Availability/cc65
2377 <ref id="cbm_k_listen" name="cbm_k_listen">
2383 <sect1>cbm_k_untlk<label id="cbm_k_untlk"><p>
2387 <tag/Function/Send an UNTALK command
2388 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2389 <tag/Declaration/<tt/void cbm_k_untlk (void);/
2390 <tag/Description/This function commands all devices on the serial bus to
2391 stop sending data to the host computer (i.e., UNTALK). Calling this
2392 function results in an UNTALK command being transmitted on the serial
2393 bus. Only devices previously commanded to TALK are affected. This
2394 function is normally used after the host computer is finished listening to data
2395 from an external device. Sending the UNTALK commands the sending devices
2396 to get off the serial bus so it can be used for other purposes.
2397 <tag/Availability/cc65
2399 <ref id="cbm_k_talk" name="cbm_k_talk">
2405 <sect1>cclear<label id="cclear"><p>
2409 <tag/Function/Clear part of a line (write a given number of spaces).
2410 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2411 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
2412 <tag/Description/The function clears part of a line by writing <tt/length/
2413 spaces in the current text color.
2414 <tag/Notes/<itemize>
2415 <item>The function is only available as fastcall function, so it may
2416 only be used in presence of a prototype.
2418 <tag/Availability/cc65
2420 <ref id="cclearxy" name="cclearxy">,
2421 <ref id="clrscr" name="clrscr">
2427 <sect1>cclearxy<label id="cclearxy"><p>
2431 <tag/Function/Clear part of a line (write a given number of spaces) starting
2432 at a specific screen position.
2433 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2434 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
2435 <tag/Description/The function moves the cursor to a specific position, and
2436 will then clear part of the line by writing <tt/length/ spaces in the current
2438 <tag/Notes/<itemize>
2439 <item>The function is only available as fastcall function, so it may
2440 only be used in presence of a prototype.
2442 <tag/Availability/cc65
2444 <ref id="cclear" name="cclear">,
2445 <ref id="clrscr" name="clrscr">
2451 <sect1>cgetc<label id="cgetc"><p>
2455 <tag/Function/Read a character from the keyboard.
2456 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2457 <tag/Declaration/<tt/char cgetc (void);/
2458 <tag/Description/The function reads a character from the keyboard. If there is
2459 no character available, <tt/cgetc()/ waits until the user presses a key. If the
2460 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
2461 displayed while waiting.
2462 <tag/Notes/<itemize>
2463 <item>If the system supports a keyboard buffer, <tt/cgetc()/ will fetch a key
2464 from that buffer; and, wait only if the buffer is empty.
2465 <item>The keyboard must be scanned periodically, in order for this function to
2466 see anything that you type. (See the description of <tt/cbm_k_scnkey()/.)
2468 <tag/Availability/cc65
2470 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2471 <ref id="cursor" name="cursor">,
2472 <ref id="kbhit" name="kbhit">
2478 <sect1>chline<label id="chline"><p>
2482 <tag/Function/Output a horizontal line in text mode.
2483 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2484 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
2485 <tag/Description/The function outputs a horizontal line with the given length
2486 starting at the current cursor position.
2487 <tag/Notes/<itemize>
2488 <item>The character used to draw the horizontal line is system dependent.
2489 If available, a line drawing character is used. Drawing a line that is partially
2490 off screen leads to undefined behaviour.
2491 <item>The function is only available as fastcall function, so it may only be
2492 used in presence of a prototype.
2494 <tag/Availability/cc65
2496 <ref id="chlinexy" name="chlinexy">,
2497 <ref id="cvline" name="cvline">,
2498 <ref id="cvlinexy" name="cvlinexy">
2504 <sect1>chlinexy<label id="chlinexy"><p>
2508 <tag/Function/Output a horizontal line at a given position in text mode.
2509 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2510 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
2511 <tag/Description/The function outputs a horizontal line with the given length
2512 starting at a given position.
2513 <tag/Notes/<itemize>
2514 <item>The character used to draw the horizontal line is system dependent.
2515 If available, a line drawing character is used. Drawing a line that is partially
2516 off screen leads to undefined behaviour.
2517 <item>The function is only available as fastcall function, so it may only be
2518 used in presence of a prototype.
2520 <tag/Availability/cc65
2522 <ref id="chline" name="chline">,
2523 <ref id="cvline" name="cvline">,
2524 <ref id="cvlinexy" name="cvlinexy">
2530 <sect1>clearerr<label id="clearerr"><p>
2534 <tag/Function/Clear error and end-of-file status of a stream.
2535 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2536 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
2537 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
2538 indicators for the stream <tt/f/.
2539 <tag/Notes/<itemize>
2540 <item>The function is only available as fastcall function, so it may only be
2541 used in presence of a prototype.
2543 <tag/Availability/ISO 9899
2545 <ref id="feof" name="feof">,
2546 <ref id="ferror" name="ferror">
2552 <sect1>clock<label id="clock"><p>
2556 <tag/Function/Determine the processor time used.
2557 <tag/Header/<tt/<ref id="time.h" name="time.h">/
2558 <tag/Declaration/<tt/clock_t clock (void);/
2559 <tag/Description/The <tt/clock/ function returns an approximaton of processor
2560 time used by the program. The time is returned in implementation-defined
2561 units. It can be converted to seconds by dividing by the value of the macro
2562 <tt/CLOCKS_PER_SEC/.
2563 <tag/Notes/<itemize>
2564 <item>Since the machines that cc65-generated programs run on cannot run multiple
2565 processes, the function actually will return the time since some
2566 implementation-defined point in the past.
2567 <item>The Jiffy clock must be "running", in order for this function to return
2568 changing values. (See the description of <tt/cbm_k_udtim()/.)
2570 <tag/Availability/ISO 9899
2572 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2573 <ref id="time" name="time">
2579 <sect1>clrscr<label id="clrscr"><p>
2583 <tag/Function/Clear the text screen.
2584 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2585 <tag/Declaration/<tt/void clrscr (void);/
2586 <tag/Description/The function clears the text screen and moves the cursor to
2587 the upper left corner.
2588 <tag/Availability/cc65
2590 <ref id="cclear" name="cclear">,
2591 <ref id="cclearxy" name="cclearxy">
2597 <sect1>close<label id="close"><p>
2601 <tag/Function/Close a file descriptor.
2602 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2603 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
2604 <tag/Description/The function closes the given file descriptor. It returns zero
2605 on success and -1 on error. If an error occurs, the cause can be determined by
2606 reading the <tt/errno/ variable.
2607 <tag/Notes/<itemize>
2608 <item>The function is only available as fastcall function, so it may only
2609 be used in presence of a prototype.
2611 <tag/Availability/POSIX 1003.1
2613 <ref id="creat" name="creat">,
2614 <ref id="open" name="open">
2620 <sect1>closedir<label id="closedir"><p>
2624 <tag/Function/Close a directory.
2625 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
2626 <tag/Declaration/<tt/int __fastcall__ closedir (DIR* dir);/
2627 <tag/Description/The function closes the given directory descriptor. It returns
2628 zero on success and -1 on error. If an error occurs, the cause can be determined
2629 by reading the <tt/errno/ variable.
2630 <tag/Notes/<itemize>
2631 <item>The function is only available as fastcall function, so it may only
2632 be used in presence of a prototype.
2634 <tag/Availability/POSIX 1003.1
2636 <ref id="opendir" name="opendir">,
2637 <ref id="readdir" name="readdir">
2643 <sect1>cpeekc<label id="cpeekc"><p>
2647 <tag/Function/Get a character from the display memory.
2648 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2649 <tag/Declaration/<tt/char cpeekc (void);/
2650 <tag/Description/The function gets the character that's at the current location
2651 of the cursor in the display screen RAM. That character is converted, if
2652 needed, into the encoding that can be passed to <tt/cputc()/.
2653 <tag/Notes/<itemize>
2654 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2655 done to make it obvious that peeking doesn't move the cursor in any way. Your
2656 program must place the cursor where it wants to peek before it calls any of
2659 <tag/Availability/cc65
2661 <ref id="cpeekcolor" name="cpeekcolor">,
2662 <ref id="cpeekrevers" name="cpeekrevers">,
2663 <ref id="cpeeks" name="cpeeks">,
2664 <ref id="cputc" name="cputc">
2670 <sect1>cpeekcolor<label id="cpeekcolor"><p>
2674 <tag/Function/Get a color from the display memory.
2675 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2676 <tag/Declaration/<tt/unsigned char cpeekcolor (void);/
2677 <tag/Description/The function gets the color number that's at the current
2678 location of the cursor in the display screen RAM. That number can be passed to
2680 <tag/Notes/<itemize>
2681 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2682 done to make it obvious that peeking doesn't move the cursor in any way. Your
2683 program must place the cursor where it wants to peek before it calls any of
2686 <tag/Availability/cc65
2688 <ref id="cpeekc" name="cpeekc">,
2689 <ref id="cpeekrevers" name="cpeekrevers">,
2690 <ref id="cpeeks" name="cpeeks">,
2691 <ref id="cputc" name="cputc">,
2692 <ref id="textcolor" name="textcolor">
2698 <sect1>cpeekrevers<label id="cpeekrevers"><p>
2702 <tag/Function/Get a reverse-character attribute from the display memory.
2703 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2704 <tag/Declaration/<tt/unsigned char cpeekrevers (void);/
2705 <tag/Description/The function gets the "reverse-mode" attribute of the
2706 character that's at the current location of the cursor in the display screen
2707 RAM. It returns a boolean value (0/1) that can be passed to <tt/revers()/.
2708 <tag/Notes/<itemize>
2709 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2710 done to make it obvious that peeking doesn't move the cursor in any way. Your
2711 program must place the cursor where it wants to peek before it calls any of
2714 <tag/Availability/cc65
2716 <ref id="cpeekc" name="cpeekc">,
2717 <ref id="cpeekcolor" name="cpeekcolor">,
2718 <ref id="cpeeks" name="cpeeks">,
2719 <ref id="cputc" name="cputc">,
2720 <ref id="revers" name="revers">
2726 <sect1>cpeeks<label id="cpeeks"><p>
2730 <tag/Function/Get a string from the display memory.
2731 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2732 <tag/Declaration/<tt/void __fastcall__ cpeeks (char* s, unsigned length);/
2733 <tag/Description/The function gets a fixed-length string ('\0'-terminated) of
2734 characters that start at the current location of the cursor in the display
2735 screen RAM. Those characters are converted, if needed, into the encoding that
2736 can be passed to <tt/cputs()/. The first argument must point to a RAM area
2737 that's large enough to hold "length + 1" bytes.
2738 <tag/Notes/<itemize>
2739 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2740 done to make it obvious that peeking doesn't move the cursor in any way. Your
2741 program must place the cursor where it wants to peek before it calls any of
2743 <item>The function is available as only a fastcall function;
2744 so, it may be used only in the presence of a prototype.
2746 <tag/Availability/cc65
2748 <ref id="cpeekc" name="cpeekc">,
2749 <ref id="cpeekcolor" name="cpeekcolor">,
2750 <ref id="cpeekrevers" name="cpeekrevers">,
2751 <ref id="cputc" name="cputc">,
2752 <ref id="cputs" name="cputs">
2758 <sect1>creat<label id="creat"><p>
2762 <tag/Function/Create a file.
2763 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2764 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
2765 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
2766 associated with it. On error, -1 is returned and an error code is stored in
2768 <tag/Notes/<itemize>
2769 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
2770 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
2771 <item>The function is only available as fastcall function, so it may only
2772 be used in presence of a prototype.
2774 <tag/Availability/POSIX 1003.1
2776 <ref id="close" name="close">,
2777 <ref id="open" name="open">
2783 <sect1>cprintf<label id="cprintf"><p>
2787 <tag/Function/Formatted output to the console.
2788 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2789 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
2790 <tag/Description/The arguments are converted to text where necessary and
2791 formatted according to the format string given. The resulting string is output
2792 to the console. <tt/cprintf/ supports the same format specifiers as
2793 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
2794 <tag/Notes/<itemize>
2795 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
2796 between <tt/\r/ and <tt/\n/.
2798 <tag/Availability/cc65
2800 <ref id="cputc" name="cputc">,
2801 <ref id="cputcxy" name="cputcxy">,
2802 <ref id="cputs" name="cputs">,
2803 <ref id="cputsxy" name="cputsxy">,
2804 <ref id="vcprintf" name="vcprintf">
2810 <sect1>cputc<label id="cputc"><p>
2814 <tag/Function/Output a character directly to the console.
2815 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2816 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
2817 <tag/Description/Output one character to the console at the current cursor
2819 <tag/Notes/<itemize>
2820 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
2821 between <tt/\r/ and <tt/\n/.
2822 <item>The function is only available as fastcall function, so it may only
2823 be used in presence of a prototype.
2825 <tag/Availability/cc65
2827 <ref id="cprintf" name="cprintf">,
2828 <ref id="cputcxy" name="cputcxy">,
2829 <ref id="cputs" name="cputs">,
2830 <ref id="cputsxy" name="cputsxy">,
2831 <ref id="vcprintf" name="vcprintf">
2837 <sect1>cputcxy<label id="cputcxy"><p>
2841 <tag/Function/Output a character at a specific screen position.
2842 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2843 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
2844 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
2845 the screen and outputs one character.
2846 <tag/Notes/<itemize>
2847 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
2848 between <tt/\r/ and <tt/\n/.
2849 <item>The function is only available as fastcall function, so it may only
2850 be used in presence of a prototype.
2852 <tag/Availability/cc65
2854 <ref id="cprintf" name="cprintf">,
2855 <ref id="cputc" name="cputc">,
2856 <ref id="cputs" name="cputs">,
2857 <ref id="cputsxy" name="cputsxy">,
2858 <ref id="vcprintf" name="vcprintf">
2864 <sect1>cputs<label id="cputs"><p>
2868 <tag/Function/Output a string directly to the console.
2869 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2870 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
2871 <tag/Description/The function outputs the given string on the console at the
2872 current cursor position.
2873 <tag/Notes/<itemize>
2874 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
2875 between <tt/\r/ and <tt/\n/.
2876 <item>The function is only available as fastcall function, so it may only
2877 be used in presence of a prototype.
2879 <tag/Availability/cc65
2881 <ref id="cprintf" name="cprintf">,
2882 <ref id="cputc" name="cputc">,
2883 <ref id="cputcxy" name="cputcxy">,
2884 <ref id="cputsxy" name="cputsxy">,
2885 <ref id="vcprintf" name="vcprintf">
2891 <sect1>cputsxy<label id="cputsxy"><p>
2895 <tag/Function/Output a string to the console at a given position.
2896 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2897 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
2898 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
2899 and outputs the string <tt/s/.
2900 <tag/Notes/<itemize>
2901 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
2902 between <tt/\r/ and <tt/\n/.
2903 <item>The function is only available as fastcall function, so it may only
2904 be used in presence of a prototype.
2906 <tag/Availability/cc65
2908 <ref id="cprintf" name="cprintf">,
2909 <ref id="cputc" name="cputc">,
2910 <ref id="cputcxy" name="cputcxy">,
2911 <ref id="cputs" name="cputs">,
2912 <ref id="vcprintf" name="vcprintf">
2918 <sect1>cursor<label id="cursor"><p>
2922 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
2923 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2924 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
2925 <tag/Description/If the argument to the function is non zero, a blinking cursor
2926 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
2927 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
2928 <tag/Notes/<itemize>
2929 <item>The function is only available as fastcall function, so it may only
2930 be used in presence of a prototype.
2932 <tag/Availability/cc65
2934 <ref id="cgetc" name="cgetc">,
2935 <ref id="kbhit" name="kbhit">
2941 <sect1>cvline<label id="cvline"><p>
2945 <tag/Function/Output a vertical line in text mode.
2946 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2947 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
2948 <tag/Description/The function outputs a vertical line with the given length
2949 starting at the current cursor position.
2950 <tag/Notes/<itemize>
2951 <item>The character used to draw the vertical line is system dependent.
2952 If available, a line drawing character is used. Drawing a line that is partially
2953 off screen leads to undefined behaviour.
2954 <item>The function is only available as fastcall function, so it may only be
2955 used in presence of a prototype.
2957 <tag/Availability/cc65
2959 <ref id="chline" name="chline">,
2960 <ref id="chlinexy" name="chlinexy">,
2961 <ref id="cvlinexy" name="cvlinexy">
2967 <sect1>cvlinexy<label id="cvlinexy"><p>
2971 <tag/Function/Output a vertical line at a given position in text mode.
2972 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2973 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
2974 <tag/Description/The function outputs a vertical line with the given length
2975 starting at a given position.
2976 <tag/Notes/<itemize>
2977 <item>The character used to draw the vertical line is system dependent.
2978 If available, a line drawing character is used. Drawing a line that is partially
2979 off screen leads to undefined behaviour.
2980 <item>The function is only available as fastcall function, so it may only be
2981 used in presence of a prototype.
2983 <tag/Availability/cc65
2985 <ref id="chline" name="chline">,
2986 <ref id="chlinexy" name="chlinexy">,
2987 <ref id="cvline" name="cvline">
2993 <sect1>decompress_lz4<label id="decompress_lz4"><p>
2997 <tag/Function/Uncompress a LZ4-compressed buffer.
2998 <tag/Header/<tt/<ref id="lz4.h" name="lz4.h">/
2999 <tag/Declaration/<tt/void decompress_lz4 (const unsigned char* src, unsigned char* const dst, const unsigned short uncompressed_size);/
3000 <tag/Description/<tt/decompress_lz4/ uncompresses a LZ4-compressed buffer.
3001 <tag/Notes/<itemize>
3002 <item>Use LZ4_compress_HC with compression level 16 for best compression.
3004 <tag/Availability/cc65
3010 <sect1>detect_c128<label id="detect_c128"><p>
3014 <tag/Function/Check if a C128 CPU is the current CPU.
3015 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3016 <tag/Declaration/<tt/unsigned char detect_c128 (void);/
3017 <tag/Description/The function returns a 1 if a C128 CPU is the current CPU.
3018 <tag/Notes/<itemize>
3019 <item>The function is specific to the C64 and C128.
3021 <tag/Availability/cc65 (not all platforms)
3023 <ref id="get_c128_speed" name="get_c128_speed">,
3024 <ref id="set_c128_speed" name="set_c128_speed">,
3030 <sect1>detect_c64dtv<label id="detect_c64dtv"><p>
3034 <tag/Function/Check for the presence of the C64DTV.
3035 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3036 <tag/Declaration/<tt/unsigned char detect_c64dtv (void);/
3037 <tag/Description/The function returns a 1 if a C64DTV has been detected.
3038 <tag/Notes/<itemize>
3039 <item>The function is specific to the C64.
3041 <tag/Availability/cc65 (not all platforms)
3043 <ref id="get_c64dtv_speed" name="get_c64dtv_speed">,
3044 <ref id="set_c64dtv_speed" name="set_c64dtv_speed">,
3050 <sect1>detect_c65<label id="detect_c65"><p>
3054 <tag/Function/Check for the presence of a C65/C64DX in C64 mode.
3055 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3056 <tag/Declaration/<tt/unsigned char detect_c65 (void);/
3057 <tag/Description/The function returns a 1 if a C65/C64DX in C64 mode has been detected.
3058 <tag/Notes/<itemize>
3059 <item>The function is specific to the C64.
3061 <tag/Availability/cc65 (not all platforms)
3063 <ref id="get_c65_speed" name="get_c65_speed">,
3064 <ref id="set_c65_speed" name="set_c65_speed">,
3070 <sect1>detect_chameleon<label id="detect_chameleon"><p>
3074 <tag/Function/Check for the presence of the C64 Chameleon cartridge.
3075 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3076 <tag/Declaration/<tt/unsigned char detect_chameleon (void);/
3077 <tag/Description/The function returns a 1 if a C64 Chameleon cartridge has been detected.
3078 <tag/Notes/<itemize>
3079 <item>The function is specific to the C64.
3081 <tag/Availability/cc65 (not all platforms)
3083 <ref id="get_chameleon_speed" name="get_chameleon_speed">,
3084 <ref id="set_chameleon_speed" name="set_chameleon_speed">,
3090 <sect1>detect_scpu<label id="detect_scpu"><p>
3094 <tag/Function/Check for the presence of the C64/C128 SuperCPU cartridge.
3095 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3096 <tag/Declaration/<tt/unsigned char detect_scpu (void);/
3097 <tag/Description/The function returns a 1 if a SuperCPU cartridge has been detected.
3098 <tag/Notes/<itemize>
3099 <item>The function is specific to the C128 and C64.
3101 <tag/Availability/cc65 (not all platforms)
3103 <ref id="get_scpu_speed" name="get_scpu_speed">,
3104 <ref id="set_scpu_speed" name="set_scpu_speed">,
3110 <sect1>detect_turbomaster<label id="detect_turbomaster"><p>
3114 <tag/Function/Check for the presence of the C64 Turbo Master cartridge.
3115 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3116 <tag/Declaration/<tt/unsigned char detect_turbomaster (void);/
3117 <tag/Description/The function returns a 1 if a C64 Turbo Master cartridge has been detected.
3118 <tag/Notes/<itemize>
3119 <item>The function is specific to the C64.
3121 <tag/Availability/cc65 (not all platforms)
3123 <ref id="get_turbomaster_speed" name="get_turbomaster_speed">,
3124 <ref id="set_turbomaster_speed" name="set_turbomaster_speed">,
3130 <sect1>div<label id="div"><p>
3134 <tag/Function/Divide two ints and return quotient and remainder.
3135 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3136 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
3137 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
3138 quotient and remainder in a <tt/div_t/ structure.
3139 <tag/Notes/<itemize>
3140 <item>The function is only available as fastcall function, so it may only
3141 be used in presence of a prototype.
3143 <tag/Availability/ISO 9899
3151 <sect1>doesclrscrafterexit<label id="doesclrscrafterexit"><p>
3155 <tag/Function/Determines whether the screen is going to be cleared after program exit.
3156 <tag/Header/<tt/<ref id="cc65.h" name="cc65.h">/
3157 <tag/Declaration/<tt/unsigned char doesclrscrafterexit (void);/
3158 <tag/Description/The function returns zero if the screen won't be cleared immediately after
3159 program termination. It returns a non-zero value if it will.
3160 <tag/Notes/<itemize>
3161 <item>Some systems, maybe depending on configuration, immediately clear the screen
3162 after a program exits. Therefore it might be difficult to read
3163 the last messages printed by the program prior to its exit. This function can be used
3164 to decide if a delay or wait for a key press should be executed when then program
3167 <tag/Availability/cc65
3170 #include <stdio.h>
3171 #include <unistd.h>
3172 #include <cc65.h>
3175 printf("Hello World\n");
3176 if (doesclrscrafterexit())
3185 <sect1>em_commit<label id="em_commit"><p>
3189 <tag/Function/Commit changes into extended memory.
3190 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3191 <tag/Declaration/<tt/void em_commit (void);/
3192 <tag/Description/Commit changes in the memory window to extended storage. If
3193 the contents of the memory window have been changed, these changes may be lost
3194 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
3195 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
3196 name="em_copyto">/ are called without calling <tt/em_commit/ first.
3197 <tag/Notes/<itemize>
3198 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
3199 memory window are discarded, it does just mean that the drivers is allowed
3201 <item>The function is only available as fastcall function, so it may only be
3202 used in presence of a prototype.
3203 <item>The function produces undefined results if no extended memory driver is
3206 <tag/Availability/cc65
3208 <ref id="em_load_driver" name="em_load_driver">,
3209 <ref id="em_map" name="em_map">,
3210 <ref id="em_use" name="em_use">
3216 <sect1>em_copyfrom<label id="em_copyfrom"><p>
3220 <tag/Function/Copy from extended into normal memory.
3221 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3222 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
3223 <tag/Description/Copy data from extended memory into linear memory. Source and
3224 target addresses as well as the number of bytes to transfer are specified in
3225 the <tt/em_copy/ structure that is passed as a parameter.
3226 <tag/Notes/<itemize>
3227 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
3228 made any changes to the data in the window, call <tt/<ref id="em_commit"
3229 name="em_commit">/ first, or the changes are lost.
3230 <item>The function is only available as fastcall function, so it may only be
3231 used in presence of a prototype.
3232 <item>The function produces undefined results if no extended memory driver is
3235 <tag/Availability/cc65
3237 <ref id="em_commit" name="em_commit">,
3238 <ref id="em_copyto" name="em_copyto">,
3239 <ref id="em_load_driver" name="em_load_driver">
3245 <sect1>em_copyto<label id="em_copyto"><p>
3249 <tag/Function/Copy from normal into extended memory.
3250 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3251 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
3252 <tag/Description/Copy data from linear into extended memory. Source and
3253 target addresses as well as the number of bytes to transfer are specified in
3254 the <tt/em_copy/ structure that is passed as a parameter.
3255 <tag/Notes/<itemize>
3256 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
3257 made any changes to the data in the window, call <tt/<ref id="em_commit"
3258 name="em_commit">/ first, or the changes are lost.
3259 <item>The function is only available as fastcall function, so it may only be
3260 used in presence of a prototype.
3261 <item>The function produces undefined results if no extended memory driver is
3264 <tag/Availability/cc65
3266 <ref id="em_commit" name="em_commit">,
3267 <ref id="em_copyfrom" name="em_copyfrom">,
3268 <ref id="em_load_driver" name="em_load_driver">
3274 <sect1>em_install<label id="em_install"><p>
3278 <tag/Function/Install an already loaded extended memory driver.
3279 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3280 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
3281 <tag/Description/The function installs an already loaded extended memory driver
3282 and returns an error code. The function may be used to install a driver linked
3283 statically to the program.
3284 <tag/Notes/<itemize>
3285 <item>Not all drivers are able to detect if the supported hardware is really
3287 <item>The function is only available as fastcall function, so it may only be
3288 used in presence of a prototype.
3290 <tag/Availability/cc65
3292 <ref id="em_load_driver" name="em_load_driver">,
3293 <ref id="em_uninstall" name="em_uninstall">,
3294 <ref id="em_unload" name="em_unload">
3300 <sect1>em_load_driver<label id="em_load_driver"><p>
3304 <tag/Function/Load and initialize an extended memory driver.
3305 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3306 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
3307 <tag/Description/Load an extended memory driver into memory and initialize
3308 it. The function returns an error code that tells if all this has been
3310 <tag/Notes/<itemize>
3311 <item>Not all drivers are able to detect if the supported hardware is really
3313 <item>The function is only available as fastcall function, so it may only be
3314 used in presence of a prototype.
3315 <item>The driver is loaded by name, so currently you must know the type of
3316 extended memory that should be supported. There is no autodetect capability.
3318 <tag/Availability/cc65
3320 <ref id="em_unload" name="em_unload">
3326 <sect1>em_map<label id="em_map"><p>
3330 <tag/Function/Make a page of extended memory accessible.
3331 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3332 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
3333 <tag/Description/The function maps one page of extended memory into linear
3334 memory and returns a pointer to the page frame. Depending on the hardware
3335 and driver, the data is either mapped into the address space or transfered
3336 into a buffer. If you don't need the actual contents of the page (for example
3337 because you're going to overwrite it completely), it is better to call
3338 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
3339 data if it is possible to avoid that.
3340 <tag/Notes/<itemize>
3341 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
3342 made any changes to the data in the window, call <tt/<ref id="em_commit"
3343 name="em_commit">/ first, or the changes are lost.
3344 <item>The function is only available as fastcall function, so it may only be
3345 used in presence of a prototype.
3346 <item>The function produces undefined results if no extended memory driver is
3349 <tag/Availability/cc65
3351 <ref id="em_commit" name="em_commit">,
3352 <ref id="em_load_driver" name="em_load_driver">,
3353 <ref id="em_use" name="em_use">
3359 <sect1>em_pagecount<label id="em_pagecount"><p>
3363 <tag/Function/Return the number of available extended memory pages.
3364 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3365 <tag/Declaration/<tt/unsigned em_pagecount (void);/
3366 <tag/Description/The function returns the size of the extended memory supported
3367 by the driver in 256 byte pages.
3368 <tag/Notes/<itemize>
3369 <item>The function returns zero if no extended memory driver is loaded.
3370 <item>The function may return zero if the supported hardware was not detected.
3372 <tag/Availability/cc65
3374 <ref id="em_load_driver" name="em_load_driver">
3380 <sect1>em_uninstall<label id="em_uninstall"><p>
3384 <tag/Function/Uninstall an already loaded extended memory driver.
3385 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3386 <tag/Declaration/<tt/unsigned char em_uninstall (void);/
3387 <tag/Description/The function uninstalls an already loaded extended memory
3388 driver but doesn't remove it from memory.
3389 <tag/Notes/<itemize>
3390 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
3391 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
3392 should be used instead of <tt/em_uninstall/ so the driver is also removed
3395 <tag/Availability/cc65
3397 <ref id="em_install" name="em_install">,
3398 <ref id="em_load_driver" name="em_load_driver">,
3399 <ref id="em_unload" name="em_unload">
3405 <sect1>em_unload<label id="em_unload"><p>
3409 <tag/Function/Unload an extended memory driver.
3410 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3411 <tag/Declaration/<tt/unsigned char em_unload (void);/
3412 <tag/Description/The function unloads a loaded extended memory driver and
3413 frees all memory allocated for the driver.
3414 <tag/Notes/<itemize>
3415 <item>The function does nothing if no driver is loaded.
3417 <tag/Availability/cc65
3419 <ref id="em_load_driver" name="em_load_driver">
3425 <sect1>em_use<label id="em_use"><p>
3429 <tag/Function/Prepare an extended memory page for use.
3430 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3431 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
3432 <tag/Description/The function maps one page of extended memory into linear
3433 memory and returns a pointer to the page frame. This function is similar to
3434 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
3435 actual memory window in the assumption that the existing data is wrong or
3436 will get overwritten.
3437 <tag/Notes/<itemize>
3438 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
3439 made any changes to the data in the window, call <tt/<ref id="em_commit"
3440 name="em_commit">/ first, or the changes are lost.
3441 <item>The function is only available as fastcall function, so it may only be
3442 used in presence of a prototype.
3443 <item>The function produces undefined results if no extended memory driver is
3446 <tag/Availability/cc65
3448 <ref id="em_commit" name="em_commit">,
3449 <ref id="em_load_driver" name="em_load_driver">,
3450 <ref id="em_map" name="em_map">
3456 <sect1>exit<label id="exit"><p>
3460 <tag/Function/Terminate the program.
3461 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3462 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
3463 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
3464 return code of the program. Before termination, all files are closed, buffered
3465 output is written and any functions registered with <tt/<ref id="atexit"
3466 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
3467 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
3469 <tag/Notes/<itemize>
3470 <item>The function is only available as fastcall function, so it may only
3471 be used in presence of a prototype.
3472 <item>It depends on the host machine if the program return code can be
3473 evaluated or is ignored.
3475 <tag/Availability/ISO 9899
3477 <ref id="abort" name="abort">,
3478 <ref id="exit" name="exit">
3484 <sect1>exec<label id="exec"><p>
3488 <tag/Function/Execute a program file.
3489 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3490 <tag/Declaration/<tt/int __fastcall__ exec (const char* progname, const char* cmdline);/
3491 <tag/Description/<tt/exec/ replaces the currently running program by a new one.
3492 Calling <tt/exec()/ is identical to calling <tt/<ref id="exit" name="exit()">/,
3493 then loading and starting the program named in the first argument, passing
3494 the command line specified as second argument. Instead of an empty string,
3495 a <tt/NULL/ pointer may be passed as second parameter.
3496 On success, the function does not return. On failure, -1 is returned and
3497 <tt/errno/ contains an error code.
3498 <tag/Notes/<itemize>
3499 <item>The function is only available as fastcall function, so it may only
3500 be used in presence of a prototype.
3501 <item>On most platforms, the function needs to copy a small stub loader to
3502 some memory area outside the program space. This may collide with other
3503 programs. See the platform specific docs on this.
3504 <item>Because it is necessary to terminate the running program before the
3505 memory can be reused to load the new one, there is a high chance that the
3506 function may not be able to return on errors.
3507 <item>The command line is passed to the new program in the same way as cc65
3508 programs expect the command line. If the new program is not a cc65 generated
3509 program, it may not be able to read it.
3511 <tag/Availability/cc65
3513 <ref id="exit" name="exit">
3519 <sect1>fast<label id="fast"><p>
3523 <tag/Function/Switch the CPU into fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
3524 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
3525 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
3526 <tag/Declaration/<tt/void fast (void);/
3527 <tag/Description/The function will switch the clock of the CPU to fast mode. For the C128
3528 target it means switching the CPU into 2MHz mode. For the C16/Plus4 target it means
3529 switching the CPU into double clock mode.
3530 <tag/Notes/<itemize>
3531 <item>The function is specific to the C128, C16 and Plus4.
3532 <item>On the C128 the 2MHz clock will not work in 40 column mode.
3534 <tag/Availability/cc65 (not all platforms)
3536 <ref id="isfast" name="isfast">,
3537 <ref id="slow" name="slow">,
3543 <sect1>feof<label id="feof"><p>
3547 <tag/Function/Return the end-of-file indicator of a stream.
3548 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3549 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
3550 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
3551 <tt/f/, and returns a non zero value if it is set.
3552 <tag/Notes/<itemize>
3553 <item>The indicator is set only after a read past the end of a file is
3555 <item>The function is only available as fastcall function, so it may only be
3556 used in presence of a prototype.
3558 <tag/Availability/ISO 9899
3560 <ref id="feof" name="clearerr">,
3561 <ref id="ferror" name="ferror">
3567 <sect1>ferror<label id="ferror"><p>
3571 <tag/Function/Return the error indicator of a stream.
3572 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3573 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
3574 <tag/Description/<tt/ferror/ tests the error indicator of the stream
3575 <tt/f/, and returns a non zero value if it is set.
3576 <tag/Notes/<itemize>
3577 <item>The function is only available as fastcall function, so it may only be
3578 used in presence of a prototype.
3580 <tag/Availability/ISO 9899
3582 <ref id="feof" name="clearerr">,
3583 <ref id="ferror" name="feof">
3589 <sect1>fileno<label id="fileno"><p>
3593 <tag/Function/Return the file handle used by a stream.
3594 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3595 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
3596 <tag/Description/The <tt/fileno/ function returns the file handle used
3597 internally by a C stream. This file handle (an integer) can be used as a
3598 handle for the POSIX input/output functions.
3599 <tag/Notes/<itemize>
3600 <item>The function is only available as fastcall function, so it may only be
3601 used in presence of a prototype.
3602 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
3603 file may have unpredictable results.
3605 <tag/Availability/POSIX 1003.1
3607 <ref id="creat" name="creat">,
3608 <ref id="open" name="open"> <!-- , -->
3609 <!-- <ref id="read" name="read">, -->
3610 <!-- <ref id="write" name="write"> -->
3616 <sect1>free<label id="free"><p>
3620 <tag/Function/Free a block of dynamic memory.
3621 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3622 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
3623 <tag/Description/Free a block of dynamic memory previously allocated with
3624 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
3625 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
3626 pointer is <tt/NULL/, no action is performed.
3627 <tag/Notes/<itemize>
3628 <item>Passing an already free'd block to <tt/free/ again will cause undefined
3629 behaviour and may crash your program.
3630 <item>The function is only available as fastcall function, so it may only
3631 be used in presence of a prototype.
3633 <tag/Availability/ISO 9899
3635 <ref id="_heapadd" name="_heapadd">,
3636 <ref id="_heapblocksize" name="_heapblocksize">,
3637 <ref id="_heapmaxavail" name="_heapmaxavail">,
3638 <ref id="_heapmemavail" name="_heapmemavail">,
3639 <ref id="calloc" name="calloc">,
3640 <ref id="malloc" name="malloc">,
3641 <ref id="realloc" name="realloc">
3647 <sect1>get_ostype<label id="get_ostype"><p>
3651 <tag/Function/The function returns the operating system, the program runs on.
3652 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
3653 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
3654 <tag/Declaration/<tt/unsigned char get_ostype (void);/
3655 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
3656 all supported targets. If it exists, it returns a number that identifies the
3657 operating system or machine type, the program runs on. The machine dependent
3658 header files define constants that can be used to check the return code.
3659 <tag/Notes/<itemize>
3660 <item>The function does not exist on all platforms.
3661 <item>The return codes are platform dependent.
3663 <tag/Availability/cc65 (not all platforms)
3669 <sect1>get_c128_speed<label id="get_c128_speed"><p>
3673 <tag/Function/Get the current speed of the C128 CPU.
3674 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3675 <tag/Declaration/<tt/unsigned char get_c128_speed (void);/
3676 <tag/Description/The function returns the current speed of the C128 CPU.
3677 <tag/Notes/<itemize>
3678 <item>The function is specific to the C64 and C128.
3679 <item>The function does not check if the C128 CPU is the current CPU.
3680 <item>See the accelerator.h header for the speed definitions.
3682 <tag/Availability/cc65 (not all platforms)
3684 <ref id="detect_c128" name="detect_c128">,
3685 <ref id="set_c128_speed" name="set_c128_speed">,
3691 <sect1>get_c64dtv_speed<label id="get_c64dtv_speed"><p>
3695 <tag/Function/Get the current speed of the C64DTV.
3696 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3697 <tag/Declaration/<tt/unsigned char get_c64dtv_speed (void);/
3698 <tag/Description/The function returns the current speed of the C64DTV.
3699 <tag/Notes/<itemize>
3700 <item>The function is specific to the C64.
3701 <item>The function does not check for the presence of the C64DTV.
3702 <item>See the accelerator.h header for the speed definitions.
3704 <tag/Availability/cc65 (not all platforms)
3706 <ref id="detect_c64dtv" name="detect_c64dtv">,
3707 <ref id="set_c64dtv_speed" name="set_c64dtv_speed">,
3713 <sect1>get_c65_speed<label id="get_c65_speed"><p>
3717 <tag/Function/Get the current speed of the C65/C64DX in C64 mode.
3718 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3719 <tag/Declaration/<tt/unsigned char get_c65_speed (void);/
3720 <tag/Description/The function returns the current speed of the C65/C64DX in C64 mode.
3721 <tag/Notes/<itemize>
3722 <item>The function is specific to the C64.
3723 <item>The function does not check for the presence of a C65/C64DX in C64 mode.
3724 <item>See the accelerator.h header for the speed definitions.
3726 <tag/Availability/cc65 (not all platforms)
3728 <ref id="detect_c65" name="detect_c65">,
3729 <ref id="set_c65_speed" name="set_c65_speed">,
3735 <sect1>get_chameleon_speed<label id="get_chameleon_speed"><p>
3739 <tag/Function/Get the current speed of the C64 Chameleon cartridge.
3740 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3741 <tag/Declaration/<tt/unsigned char get_chameleon_speed (void);/
3742 <tag/Description/The function returns the current speed of the C64 Chameleon cartridge.
3743 <tag/Notes/<itemize>
3744 <item>The function is specific to the C64.
3745 <item>The function does not check for the presence of the C64 Chameleon cartridge.
3746 <item>See the accelerator.h header for the speed definitions.
3748 <tag/Availability/cc65 (not all platforms)
3750 <ref id="detect_chameleon" name="detect_chameleon">,
3751 <ref id="set_chameleon_speed" name="set_chameleon_speed">,
3757 <sect1>get_scpu_speed<label id="get_scpu_speed"><p>
3761 <tag/Function/Get the current speed of the C64/C128 SuperCPU cartridge.
3762 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3763 <tag/Declaration/<tt/unsigned char get_scpu_speed (void);/
3764 <tag/Description/The function returns the current speed of the SuperCPU cartridge.
3765 <tag/Notes/<itemize>
3766 <item>The function is specific to the C128 and C64.
3767 <item>The function does not check for the presence of the cartridge.
3768 <item>See the accelerator.h header for the speed definitions.
3770 <tag/Availability/cc65 (not all platforms)
3772 <ref id="detect_scpu" name="detect_scpu">,
3773 <ref id="set_scpu_speed" name="set_scpu_speed">,
3779 <sect1>get_turbomaster_speed<label id="get_turbomaster_speed"><p>
3783 <tag/Function/Get the current speed of the C64 Turbo Master cartridge.
3784 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3785 <tag/Declaration/<tt/unsigned char get_turbomaster_speed (void);/
3786 <tag/Description/The function returns the current speed of the C64 Turbo Master cartridge.
3787 <tag/Notes/<itemize>
3788 <item>The function is specific to the C64.
3789 <item>The function does not check for the presence of the C64 Turbo Master cartridge.
3790 <item>See the accelerator.h header for the speed definitions.
3792 <tag/Availability/cc65 (not all platforms)
3794 <ref id="detect_turbomaster" name="detect_turbomaster">,
3795 <ref id="set_turbomaster_speed" name="set_turbomaster_speed">,
3800 <sect1>getcpu<label id="getcpu"><p>
3804 <tag/Function/Determine on which CPU the program is running.
3805 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3806 <tag/Declaration/<tt/unsigned char getcpu (void);/
3807 <tag/Description/The function checks on which CPU the code is running. It
3808 returns one of the constants<itemize>
3810 <item><tt/CPU_65C02/
3811 <item><tt/CPU_65816/
3813 <item><tt/CPU_65SC02/
3814 <item><tt/CPU_65CE02/
3815 <item><tt/CPU_HUC6280/
3818 <tag/Notes/<itemize>
3819 <item>Other, more exotic CPU types are not disinguished.
3821 <tag/Availability/cc65
3827 <sect1>getcurrentdevice<label id="getcurrentdevice"><p>
3831 <tag/Function/Get current device.
3832 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3833 <tag/Declaration/<tt/unsigned char getcurrentdevice (void);/
3834 <tag/Description/The function returns the current device.
3835 It allows to access the current device with the <ref id="dio.h"
3836 name="Low-level disk I/O API"> or <ref id="cbm.h" name="cbm_* I/O
3837 functions"> requiring a 'device' parameter.
3838 <tag/Availability/cc65
3840 <ref id="getdevicedir" name="getdevicedir">,
3841 <ref id="getfirstdevice" name="getfirstdevice">,
3842 <ref id="getnextdevice" name="getnextdevice">
3844 dio_open (getcurrentdevice ());
3850 <sect1>getcwd<label id="getcwd"><p>
3854 <tag/Function/Get current working directory.
3855 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3856 <tag/Declaration/<tt/char* __fastcall__ getcwd (char* buf, size_t size);/
3857 <tag/Description/The function will return the current working directory.
3858 <tag/Notes/<itemize>
3859 <item>The function is only available as fastcall function, so it may only
3860 be used in presence of a prototype.
3862 <tag/Availability/POSIX 1003.1
3868 <sect1>getdevicedir<label id="getdevicedir"><p>
3872 <tag/Function/Get device directory.
3873 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3874 <tag/Declaration/<tt/char* __fastcall__ getdevicedir (unsigned char device, char* buf, size_t size);/
3875 <tag/Description/The function returns the directory representing <tt/device/.
3876 It allows to access the device on filesystem level by calling chdir() with
3877 the directory returned.
3878 <tag/Notes/<itemize>
3879 <item>Calling getdevicedir() <em/does/ check for a (formatted) disk in a
3880 floppy-disk-type device and returns NULL if that check fails.
3881 <item>The function is only available as fastcall function, so it may only
3882 be used in presence of a prototype.
3884 <tag/Availability/cc65
3886 <ref id="getcwd" name="getcwd">,
3887 <ref id="getcurrentdevice" name="getcurrentdevice">,
3888 <ref id="getfirstdevice" name="getfirstdevice">,
3889 <ref id="getnextdevice" name="getnextdevice">
3891 chdir (getdevicedir (device, buf, sizeof buf));
3893 cf. <tt/samples/enumdevdir.c/
3898 <sect1>getenv<label id="getenv"><p>
3902 <tag/Function/Return a value from the environment.
3903 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3904 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
3905 <tag/Description/The function searches the environment for an entry that
3906 matches <tt/name/ and returns its value. The environment consists of a list
3907 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
3909 <tag/Notes/<itemize>
3910 <item>What exactly is stored in the environment depends on the machine the
3911 program is running on.
3912 <item>The function is only available as fastcall function, so it may only
3913 be used in presence of a prototype.
3915 <tag/Availability/ISO 9899
3921 <sect1>getfirstdevice<label id="getfirstdevice"><p>
3925 <tag/Function/Get first device.
3926 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3927 <tag/Declaration/<tt/unsigned char getfirstdevice (void);/
3928 <tag/Description/The function returns the first device.
3929 The constant <tt/INVALID_DEVICE/ indicates no device.
3930 <tag/Notes/<itemize>
3931 <item>Calling getfirstdevice() does <em/not/ turn on the motor of a
3932 drive-type device and does <em/not/ check for a disk in the drive.
3934 <tag/Availability/cc65
3936 <ref id="getcurrentdevice" name="getcurrentdevice">,
3937 <ref id="getdevicedir" name="getdevicedir">,
3938 <ref id="getnextdevice" name="getnextdevice">
3940 unsigned char dev = getfirstdevice ();
3941 while (dev != INVALID_DEVICE) {
3942 printf ("%d\n", dev);
3943 dev = getnextdevice (dev);
3950 <sect1>getnextdevice<label id="getnextdevice"><p>
3954 <tag/Function/Get next device.
3955 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3956 <tag/Declaration/<tt/unsigned char __fastcall__ getnextdevice (unsigned char device);/
3957 <tag/Description/The function returns the next device after <tt/device/.
3958 The constant <tt/INVALID_DEVICE/ indicates no further device.
3959 <tag/Notes/<itemize>
3960 <item>Calling getnextdevice() does <em/not/ turn on the motor of a
3961 drive-type device and does <em/not/ check for a disk in the drive.
3962 <item>The function is only available as fastcall function, so it may only
3963 be used in presence of a prototype.
3965 <tag/Availability/cc65
3967 <ref id="getcurrentdevice" name="getcurrentdevice">,
3968 <ref id="getdevicedir" name="getdevicedir">,
3969 <ref id="getfirstdevice" name="getfirstdevice">
3971 unsigned char dev = getfirstdevice ();
3972 while (dev != INVALID_DEVICE) {
3973 printf ("%d\n", dev);
3974 dev = getnextdevice (dev);
3981 <sect1>getopt<label id="getopt"><p>
3985 <tag/Function/Parse command line options.
3986 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3987 <tag/Declaration/<tt/int __fastcall__ getopt (int argc, char* const* argv,
3988 const char* optstring);/
3989 <tag/Description/The function parses command line arguments, <tt/argc/ and
3990 <tt/argv/ are the argument count and array passed to <tt/main/. <tt/optstring/
3991 is a string that contains command line option characters. If a character in
3992 <tt/optstring/ is followed by a colon, the option requires an argument. An
3993 option on the command line is recognized if it is one of the option characters
3995 <tt/getopt/ must be called repeatedly. It will return each option character
3996 found on the command line and <tt/EOF/ (-1) if there is no other option. An
3997 option argument is placed in <tt/optarg/, the index of the next element on the
3998 command line to be processed is placed in <tt/optind/.
3999 <tag/Notes/<itemize>
4000 <item>The implementation will not reorder options. A non option on the command
4001 line will terminate option processing. All remaining arguments are not
4002 recognized as options, even if the start with a '-' character.
4003 <item>The function is only available as fastcall function, so it may only
4004 be used in presence of a prototype.
4006 <tag/Availability/POSIX.2
4012 <sect1>gotox<label id="gotox"><p>
4016 <tag/Function/Move the text mode cursor to a new X position.
4017 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4018 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
4019 <tag/Description/The function moves the text mode cursor to the specified X
4020 position while leaving the Y position untouched. The leftmost position on the
4021 screen has the coordinate 0.
4022 <tag/Notes/<itemize>
4023 <item>The function is only available as fastcall function, so it may
4024 only be used in presence of a prototype.
4025 <item>Invalid values for the X position (out of screen coordinates) may
4026 lead to undefined behaviour.
4028 <tag/Availability/cc65
4030 <ref id="gotoy" name="gotoy">,
4031 <ref id="gotoxy" name="gotoxy">,
4032 <ref id="wherex" name="wherex">,
4033 <ref id="wherey" name="wherey">
4039 <sect1>gotoxy<label id="gotoxy"><p>
4043 <tag/Function/Move the text mode cursor to a new position.
4044 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4045 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
4046 <tag/Description/The function moves the text mode cursor to the specified
4047 position. The leftmost position on the screen has the X coordinate 0, the
4048 topmost line has the Y coordinate 0.
4049 <tag/Notes/<itemize>
4050 <item>The function is only available as fastcall function, so it may only be
4051 used in presence of a prototype.
4052 <item>Invalid values for any of both coordinates (out of screen positions) may
4053 lead to undefined behaviour.
4055 <tag/Availability/cc65
4057 <ref id="gotox" name="gotox">,
4058 <ref id="gotoy" name="gotoy">,
4059 <ref id="wherex" name="wherex">,
4060 <ref id="wherey" name="wherey">
4066 <sect1>gotoy<label id="gotoy"><p>
4070 <tag/Function/Move the text mode cursor to a new Y position.
4071 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4072 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
4073 <tag/Description/The function moves the text mode cursor to the specified Y
4074 position while leaving the X position untouched. The uppermost position on the
4075 screen has the coordinate 0.
4076 <tag/Notes/<itemize>
4077 <item>The function is only available as fastcall function, so it may
4078 only be used in presence of a prototype.
4079 <item>Invalid values for the Y position (out of screen coordinates) may lead
4080 to undefined behaviour.
4082 <tag/Availability/cc65
4084 <ref id="gotox" name="gotox">,
4085 <ref id="gotoxy" name="gotoxy">,
4086 <ref id="wherex" name="wherex">,
4087 <ref id="wherey" name="wherey">
4093 <sect1>isalnum<label id="isalnum"><p>
4097 <tag/Function/Check if a given character is a letter or digit.
4098 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4099 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
4100 <tag/Description/The function returns a non zero value if the given argument
4101 is a letter or digit. The return value is zero if the character is anything
4103 <tag/Notes/<itemize>
4104 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4105 inline sequence generated by the macro will not work correctly for values
4106 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4107 this range. The non inline function may be accessed by <tt/#undef/'ing
4109 <item>When compiling without <tt/-Os/, the function is only available as
4110 fastcall function, so it may only be used in presence of a prototype.
4112 <tag/Availability/ISO 9899
4114 <ref id="isalpha" name="isalpha">,
4115 <ref id="isascii" name="isascii">,
4116 <ref id="isblank" name="isblank">,
4117 <ref id="iscntrl" name="iscntrl">,
4118 <ref id="isdigit" name="isdigit">,
4119 <ref id="isgraph" name="isgraph">,
4120 <ref id="islower" name="islower">,
4121 <ref id="isprint" name="isprint">,
4122 <ref id="ispunct" name="ispunct">,
4123 <ref id="isspace" name="isspace">,
4124 <ref id="isupper" name="isupper">,
4125 <ref id="isxdigit" name="isxdigit">
4131 <sect1>isalpha<label id="isalpha"><p>
4135 <tag/Function/Check if a given character is a letter.
4136 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4137 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
4138 <tag/Description/The function returns a non zero value if the given argument
4139 is a letter. The return value is zero if the character is anything else.
4140 <tag/Notes/<itemize>
4141 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4142 inline sequence generated by the macro will not work correctly for values
4143 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4144 this range. The non inline function may be accessed by <tt/#undef/'ing the
4146 <item>When compiling without <tt/-Os/, the function is only available as
4147 fastcall function, so it may only be used in presence of a prototype.
4149 <tag/Availability/ISO 9899
4151 <ref id="isalnum" name="isalnum">,
4152 <ref id="isascii" name="isascii">,
4153 <ref id="isblank" name="isblank">,
4154 <ref id="iscntrl" name="iscntrl">,
4155 <ref id="isdigit" name="isdigit">,
4156 <ref id="isgraph" name="isgraph">,
4157 <ref id="islower" name="islower">,
4158 <ref id="isprint" name="isprint">,
4159 <ref id="ispunct" name="ispunct">,
4160 <ref id="isspace" name="isspace">,
4161 <ref id="isupper" name="isupper">,
4162 <ref id="isxdigit" name="isxdigit">
4168 <sect1>isascii<label id="isascii"><p>
4172 <tag/Function/Check if a given character is in the ASCII (0..127) range.
4173 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4174 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
4175 <tag/Description/The function returns a non zero value if the given argument
4176 is in the range 0..127 (the range of valid ASCII characters) and zero if not.
4177 <tag/Notes/<itemize>
4178 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4179 inline sequence generated by the macro will not work correctly for values
4180 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4181 this range. The non inline function may be accessed by <tt/#undef/'ing the
4183 <item>When compiling without <tt/-Os/, the function is only available as
4184 fastcall function, so it may only be used in presence of a prototype.
4186 <tag/Availability/ISO 9899
4188 <ref id="isalnum" name="isalnum">,
4189 <ref id="isalpha" name="isalpha">,
4190 <ref id="isblank" name="isblank">,
4191 <ref id="iscntrl" name="iscntrl">,
4192 <ref id="isdigit" name="isdigit">,
4193 <ref id="isgraph" name="isgraph">,
4194 <ref id="islower" name="islower">,
4195 <ref id="isprint" name="isprint">,
4196 <ref id="ispunct" name="ispunct">,
4197 <ref id="isspace" name="isspace">,
4198 <ref id="isupper" name="isupper">,
4199 <ref id="isxdigit" name="isxdigit">
4205 <sect1>isblank<label id="isblank"><p>
4209 <tag/Function/Check if a given character is a space or tab.
4210 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4211 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
4212 <tag/Description/The function returns a non zero value if the given argument
4213 is a space or tab character. The return value is zero if the character is
4215 <tag/Notes/<itemize>
4216 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4217 inline sequence generated by the macro will not work correctly for values
4218 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4219 this range. The non inline function may be accessed by <tt/#undef/'ing the
4221 <item>When compiling without <tt/-Os/, the function is only available as
4222 fastcall function, so it may only be used in presence of a prototype.
4224 <tag/Availability/ISO 9899
4226 <ref id="isalnum" name="isalnum">,
4227 <ref id="isalpha" name="isalpha">,
4228 <ref id="isascii" name="isascii">,
4229 <ref id="iscntrl" name="iscntrl">,
4230 <ref id="isdigit" name="isdigit">,
4231 <ref id="isgraph" name="isgraph">,
4232 <ref id="islower" name="islower">,
4233 <ref id="isprint" name="isprint">,
4234 <ref id="ispunct" name="ispunct">,
4235 <ref id="isspace" name="isspace">,
4236 <ref id="isupper" name="isupper">,
4237 <ref id="isxdigit" name="isxdigit">
4243 <sect1>iscntrl<label id="iscntrl"><p>
4247 <tag/Function/Check if a given character is a control character.
4248 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4249 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
4250 <tag/Description/The function returns a non zero value if the given argument
4251 is a control character. The return value is zero if the character is anything
4253 <tag/Notes/<itemize>
4254 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4255 inline sequence generated by the macro will not work correctly for values
4256 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4257 this range. The non inline function may be accessed by <tt/#undef/'ing the
4259 <item>When compiling without <tt/-Os/, the function is only available as
4260 fastcall function, so it may only be used in presence of a prototype.
4262 <tag/Availability/ISO 9899
4264 <ref id="isalnum" name="isalnum">,
4265 <ref id="isalpha" name="isalpha">,
4266 <ref id="isascii" name="isascii">,
4267 <ref id="isblank" name="isblank">,
4268 <ref id="isdigit" name="isdigit">,
4269 <ref id="isgraph" name="isgraph">,
4270 <ref id="islower" name="islower">,
4271 <ref id="isprint" name="isprint">,
4272 <ref id="ispunct" name="ispunct">,
4273 <ref id="isspace" name="isspace">,
4274 <ref id="isupper" name="isupper">,
4275 <ref id="isxdigit" name="isxdigit">
4281 <sect1>isdigit<label id="isdigit"><p>
4285 <tag/Function/Check if a given character is a digit.
4286 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4287 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
4288 <tag/Description/The function returns a non zero value if the given argument
4289 is a digit. The return value is zero if the character is anything else.
4290 <tag/Notes/<itemize>
4291 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4292 inline sequence generated by the macro will not work correctly for values
4293 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4294 this range. The non inline function may be accessed by <tt/#undef/'ing the
4296 <item>When compiling without <tt/-Os/, the function is only available as
4297 fastcall function, so it may only be used in presence of a prototype.
4299 <tag/Availability/ISO 9899
4301 <ref id="isalnum" name="isalnum">,
4302 <ref id="isalpha" name="isalpha">,
4303 <ref id="isascii" name="isascii">,
4304 <ref id="isblank" name="isblank">,
4305 <ref id="iscntrl" name="iscntrl">,
4306 <ref id="isgraph" name="isgraph">,
4307 <ref id="islower" name="islower">,
4308 <ref id="isprint" name="isprint">,
4309 <ref id="ispunct" name="ispunct">,
4310 <ref id="isspace" name="isspace">,
4311 <ref id="isupper" name="isupper">,
4312 <ref id="isxdigit" name="isxdigit">
4318 <sect1>isfast<label id="isfast"><p>
4322 <tag/Function/Check if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
4323 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
4324 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
4325 <tag/Declaration/<tt/unsigned char isfast (void);/
4326 <tag/Description/The function returns a 1 if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
4327 <tag/Notes/<itemize>
4328 <item>The function is specific to the C128, C16 and Plus4.
4330 <tag/Availability/cc65 (not all platforms)
4332 <ref id="fast" name="fast">,
4333 <ref id="slow" name="slow">,
4339 <sect1>isgraph<label id="isgraph"><p>
4343 <tag/Function/Check if a given character is a printable character (except
4345 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4346 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
4347 <tag/Description/The function returns a non zero value if the given argument
4348 is a printable character with the exception of space. The return value is zero
4349 if the character is anything else.
4350 <tag/Notes/<itemize>
4351 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4352 inline sequence generated by the macro will not work correctly for values
4353 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4354 this range. The non inline function may be accessed by <tt/#undef/'ing the
4356 <item>When compiling without <tt/-Os/, the function is only available as
4357 fastcall function, so it may only be used in presence of a prototype.
4359 <tag/Availability/ISO 9899
4361 <ref id="isalnum" name="isalnum">,
4362 <ref id="isalpha" name="isalpha">,
4363 <ref id="isascii" name="isascii">,
4364 <ref id="isblank" name="isblank">,
4365 <ref id="iscntrl" name="iscntrl">,
4366 <ref id="isdigit" name="isdigit">,
4367 <ref id="islower" name="islower">,
4368 <ref id="isprint" name="isprint">,
4369 <ref id="ispunct" name="ispunct">,
4370 <ref id="isspace" name="isspace">,
4371 <ref id="isupper" name="isupper">,
4372 <ref id="isxdigit" name="isxdigit">
4378 <sect1>islower<label id="islower"><p>
4382 <tag/Function/Check if a given character is a lower case letter.
4383 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4384 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
4385 <tag/Description/The function returns a non zero value if the given argument
4386 is a lower case letter. The return value is zero if the character is anything
4388 <tag/Notes/<itemize>
4389 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4390 inline sequence generated by the macro will not work correctly for values
4391 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4392 this range. The non inline function may be accessed by <tt/#undef/'ing the
4394 <item>When compiling without <tt/-Os/, the function is only available as
4395 fastcall function, so it may only be used in presence of a prototype.
4397 <tag/Availability/ISO 9899
4399 <ref id="isalnum" name="isalnum">,
4400 <ref id="isalpha" name="isalpha">,
4401 <ref id="isascii" name="isascii">,
4402 <ref id="isblank" name="isblank">,
4403 <ref id="iscntrl" name="iscntrl">,
4404 <ref id="isdigit" name="isdigit">,
4405 <ref id="isgraph" name="isgraph">,
4406 <ref id="isprint" name="isprint">,
4407 <ref id="ispunct" name="ispunct">,
4408 <ref id="isspace" name="isspace">,
4409 <ref id="isupper" name="isupper">,
4410 <ref id="isxdigit" name="isxdigit">
4416 <sect1>isprint<label id="isprint"><p>
4420 <tag/Function/Check if a given character is a printable character.
4421 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4422 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
4423 <tag/Description/The function returns a non zero value if the given argument
4424 is a printable character (this includes the space character). The return value
4425 is zero if the character is anything else.
4426 <tag/Notes/<itemize>
4427 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4428 inline sequence generated by the macro will not work correctly for values
4429 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4430 this range. The non inline function may be accessed by <tt/#undef/'ing the
4432 <item>When compiling without <tt/-Os/, the function is only available as
4433 fastcall function, so it may only be used in presence of a prototype.
4435 <tag/Availability/ISO 9899
4437 <ref id="isalnum" name="isalnum">,
4438 <ref id="isalpha" name="isalpha">,
4439 <ref id="isascii" name="isascii">,
4440 <ref id="isblank" name="isblank">,
4441 <ref id="iscntrl" name="iscntrl">,
4442 <ref id="isdigit" name="isdigit">,
4443 <ref id="isgraph" name="isgraph">,
4444 <ref id="islower" name="islower">,
4445 <ref id="ispunct" name="ispunct">,
4446 <ref id="isspace" name="isspace">,
4447 <ref id="isupper" name="isupper">,
4448 <ref id="isxdigit" name="isxdigit">
4454 <sect1>ispunct<label id="ispunct"><p>
4458 <tag/Function/Check if a given character is a printable character but not a
4459 space or an alphanumeric character.
4460 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4461 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
4462 <tag/Description/The function returns a non zero value if the given argument
4463 is a printable character, but not a space or anything alphanumeric. The return
4464 value is zero if the character is anything else.
4465 <tag/Notes/<itemize>
4466 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4467 inline sequence generated by the macro will not work correctly for values
4468 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4469 this range. The non inline function may be accessed by <tt/#undef/'ing the
4471 <item>When compiling without <tt/-Os/, the function is only available as
4472 fastcall function, so it may only be used in presence of a prototype.
4474 <tag/Availability/ISO 9899
4476 <ref id="isalnum" name="isalnum">,
4477 <ref id="isalpha" name="isalpha">,
4478 <ref id="isascii" name="isascii">,
4479 <ref id="isblank" name="isblank">,
4480 <ref id="iscntrl" name="iscntrl">,
4481 <ref id="isdigit" name="isdigit">,
4482 <ref id="isgraph" name="isgraph">,
4483 <ref id="islower" name="islower">,
4484 <ref id="isprint" name="isprint">,
4485 <ref id="isspace" name="isspace">,
4486 <ref id="isupper" name="isupper">,
4487 <ref id="isxdigit" name="isxdigit">
4493 <sect1>isspace<label id="isspace"><p>
4497 <tag/Function/Check if a given character is a white-space character.
4498 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4499 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
4500 <tag/Description/The function returns a non zero value if the given argument
4501 is a white space character. The return value is zero if the character is
4502 anything else. The standard white space characters are: space, formfeed ('\f'),
4503 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
4505 <tag/Notes/<itemize>
4506 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4507 inline sequence generated by the macro will not work correctly for values
4508 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4509 this range. The non inline function may be accessed by <tt/#undef/'ing the
4511 <item>When compiling without <tt/-Os/, the function is only available as
4512 fastcall function, so it may only be used in presence of a prototype.
4514 <tag/Availability/ISO 9899
4516 <ref id="isalnum" name="isalnum">,
4517 <ref id="isalpha" name="isalpha">,
4518 <ref id="isascii" name="isascii">,
4519 <ref id="isblank" name="isblank">,
4520 <ref id="iscntrl" name="iscntrl">,
4521 <ref id="isdigit" name="isdigit">,
4522 <ref id="isgraph" name="isgraph">,
4523 <ref id="islower" name="islower">,
4524 <ref id="isprint" name="isprint">,
4525 <ref id="ispunct" name="ispunct">,
4526 <ref id="isupper" name="isupper">,
4527 <ref id="isxdigit" name="isxdigit">
4533 <sect1>isupper<label id="isupper"><p>
4537 <tag/Function/Check if a given character is an upper case letter.
4538 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4539 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
4540 <tag/Description/The function returns a non zero value if the given argument
4541 is an upper case letter. The return value is zero if the character is anything
4543 <tag/Notes/<itemize>
4544 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4545 inline sequence generated by the macro will not work correctly for values
4546 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4547 this range. The non inline function may be accessed by <tt/#undef/'ing the
4549 <item>When compiling without <tt/-Os/, the function is only available as
4550 fastcall function, so it may only be used in presence of a prototype.
4552 <tag/Availability/ISO 9899
4554 <ref id="isalnum" name="isalnum">,
4555 <ref id="isalpha" name="isalpha">,
4556 <ref id="isascii" name="isascii">,
4557 <ref id="isblank" name="isblank">,
4558 <ref id="iscntrl" name="iscntrl">,
4559 <ref id="isdigit" name="isdigit">,
4560 <ref id="isgraph" name="isgraph">,
4561 <ref id="islower" name="islower">,
4562 <ref id="isprint" name="isprint">,
4563 <ref id="ispunct" name="ispunct">,
4564 <ref id="isspace" name="isspace">,
4565 <ref id="isxdigit" name="isxdigit">
4571 <sect1>isxdigit<label id="isxdigit"><p>
4575 <tag/Function/Check if a given character is a hexadecimal digit.
4576 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4577 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
4578 <tag/Description/The function returns a non zero value if the given argument
4579 is a hexadecimal digit (0..9, a..f and A..F). The return value is zero if the
4580 character is anything else.
4581 <tag/Notes/<itemize>
4582 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4583 inline sequence generated by the macro will not work correctly for values
4584 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4585 this range. The non inline function may be accessed by <tt/#undef/'ing the
4587 <item>When compiling without <tt/-Os/, the function is only available as
4588 fastcall function, so it may only be used in presence of a prototype.
4590 <tag/Availability/ISO 9899
4592 <ref id="isalnum" name="isalnum">,
4593 <ref id="isalpha" name="isalpha">,
4594 <ref id="isascii" name="isascii">,
4595 <ref id="isblank" name="isblank">,
4596 <ref id="iscntrl" name="iscntrl">,
4597 <ref id="isdigit" name="isdigit">,
4598 <ref id="isgraph" name="isgraph">,
4599 <ref id="islower" name="islower">,
4600 <ref id="isprint" name="isprint">,
4601 <ref id="ispunct" name="ispunct">,
4602 <ref id="isspace" name="isspace">,
4603 <ref id="isupper" name="isupper">
4609 <sect1>itoa<label id="itoa"><p>
4613 <tag/Function/Convert an integer into a string.
4614 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4615 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
4616 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
4617 <tt/radix/ as the base.
4618 <tag/Notes/<itemize>
4619 <item>There are no provisions to prevent a buffer overflow.
4620 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
4621 <item>The function is non standard, so it is not available in strict ANSI mode.
4622 You should probably use <tt/sprintf/ instead.
4623 <item>The function is only available as fastcall function, so it may only be
4624 used in presence of a prototype.
4626 <tag/Availability/cc65
4628 <ref id="atoi" name="atoi">,
4629 <ref id="atol" name="atol">,
4630 <ref id="ltoa" name="ltoa">,
4631 <ref id="ultoa" name="ultoa">,
4632 <ref id="utoa" name="utoa">
4638 <sect1>joy_count<label id="joy_count"><p>
4642 <tag/Function/Return the number of joysticks supported by the current driver.
4643 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4644 <tag/Declaration/<tt/unsigned char joy_count (void);/
4645 <tag/Description/The function returns a the number of joysticks supported
4646 by the current joystick driver.
4647 <tag/Notes/<itemize>
4648 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4649 name="joy_load_driver"> before calling this function.
4650 <item>The function returns the number of joysticks supported by the driver.
4651 There's no way to check for the number of actually connected joysticks.
4653 <tag/Availability/cc65
4655 <ref id="joy_load_driver" name="joy_load_driver">,
4656 <ref id="joy_read" name="joy_read">
4662 <sect1>joy_install<label id="joy_install"><p>
4666 <tag/Function/Install an already loaded driver and return an error code.
4667 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4668 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
4669 <tag/Description/The function installs a driver that was already loaded into
4670 memory (or linked statically to the program). It returns an error code
4671 (<tt/JOY_ERR_OK/ in case of success).
4672 <tag/Notes/<itemize>
4673 <item>The function is only available as fastcall function, so it may only be
4674 used in presence of a prototype.
4676 <tag/Availability/cc65
4678 <ref id="joy_load_driver" name="joy_load_driver">,
4679 <ref id="joy_uninstall" name="joy_uninstall">,
4680 <ref id="joy_unload" name="joy_unload">
4686 <sect1>joy_load_driver<label id="joy_load_driver"><p>
4690 <tag/Function/Load a driver from disk and install it.
4691 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4692 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
4693 <tag/Description/The function loads a driver with the given name from disk
4694 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
4695 driver was successfully loaded and installed.
4696 <tag/Notes/<itemize>
4697 <item>The function is only available as fastcall function, so it may only be
4698 used in presence of a prototype.
4700 <tag/Availability/cc65
4702 <ref id="joy_install" name="joy_install">,
4703 <ref id="joy_uninstall" name="joy_uninstall">,
4704 <ref id="joy_unload" name="joy_unload">
4710 <sect1>joy_read<label id="joy_read"><p>
4714 <tag/Function/Read the status of a joystick.
4715 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4716 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
4717 <tag/Description/The function reads the status bits for a joystick. The number
4718 of the joystick is passed as parameter. The result may be examined by using one
4719 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
4720 <tag/Notes/<itemize>
4721 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4722 name="joy_load_driver"> before calling this function.
4723 <item>The function is only available as fastcall function, so it may only be
4724 used in presence of a prototype.
4726 <tag/Availability/cc65
4728 <ref id="joy_count" name="joy_count">,
4729 <ref id="joy_load_driver" name="joy_load_driver">,
4730 <ref id="joy_unload" name="joy_unload">
4736 <sect1>joy_uninstall<label id="joy_uninstall"><p>
4740 <tag/Function/Uninstall the current joystick driver.
4741 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4742 <tag/Declaration/<tt/unsigned char joy_uninstall (void);/
4743 <tag/Description/The function uninstalls the currently installed joystick
4744 driver. It does not remove the driver from memory. The function returns an
4745 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4746 <tag/Notes/<itemize>
4747 <item>A joystick driver must be installed using <ref id="joy_install"
4748 name="joy_install"> before calling this function.
4750 <tag/Availability/cc65
4752 <ref id="joy_install" name="joy_install">,
4753 <ref id="joy_load_driver" name="joy_load_driver">,
4754 <ref id="joy_unload" name="joy_unload">
4760 <sect1>joy_unload<label id="joy_unload"><p>
4764 <tag/Function/Uninstall, then unload the current joystick driver.
4765 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4766 <tag/Declaration/<tt/unsigned char joy_unload (void);/
4767 <tag/Description/The function uninstalls the currently installed joystick
4768 driver and removes it from memory. An error code is returned, which is
4769 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4770 <tag/Notes/<itemize>
4771 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4772 name="joy_load_driver"> before calling this function.
4774 <tag/Availability/cc65
4776 <ref id="joy_load_driver" name="joy_load_driver">
4782 <sect1>kbhit<label id="kbhit"><p>
4786 <tag/Function/Check if there's a key waiting in the keyboard buffer.
4787 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4788 <tag/Declaration/<tt/unsigned char kbhit (void);/
4789 <tag/Description/The function returns a value of zero if there is no character
4790 waiting to be read from the keyboard. It returns non zero otherwise.
4791 <tag/Notes/<itemize>
4792 <item>If the system does not support a keyboard buffer (most systems
4793 do), the function is rather useless.
4795 <tag/Availability/cc65
4797 <ref id="cgetc" name="cgetc">,
4798 <ref id="cursor" name="cursor">
4804 <sect1>kbrepeat<label id="kbrepeat"><p>
4808 <tag/Function/Set the keyboard repeat mode.
4809 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
4810 <tag/Declaration/<tt/unsigned char __fastcall__ kbrepeat (unsigned char mode);/
4811 <tag/Description/This function changes which keys have automatic repeat when
4812 being held down for a certain time. Possible values are <tt/KBREPEAT_CURSOR/
4813 (repeat only cursor-related keys), <tt/KBREPEAT_NONE/ (no repeat for any
4814 keys), and <tt/KBREPEAT_ALL/ (repeat all keys). The old mode is returned, so
4815 it can be restored later.
4816 <tag/Notes/<itemize>
4817 <item>The function is available only as a fastcall function; so, it may be used
4818 only in the presence of a prototype.
4820 <tag/Availability/cc65
4826 <sect1>labs<label id="labs"><p>
4830 <tag/Function/Returns the absolute value of a long integer.
4831 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4832 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
4833 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
4835 <tag/Notes/<itemize>
4836 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
4837 <item>The function is only available as fastcall function, so it may only be
4838 used in presence of a prototype.
4840 <tag/Availability/ISO 9899
4842 <ref id="abs" name="abs">
4848 <sect1>ltoa<label id="ltoa"><p>
4852 <tag/Function/Convert a long integer into a string.
4853 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4854 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
4855 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
4856 using <tt/radix/ as the base.
4857 <tag/Notes/<itemize>
4858 <item>There are no provisions to prevent a buffer overflow.
4859 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
4860 <item>The function is non standard, so it is not available in strict ANSI mode.
4861 You should probably use <tt/sprintf/ instead.
4862 <item>The function is only available as fastcall function, so it may only be
4863 used in presence of a prototype.
4865 <tag/Availability/cc65
4867 <ref id="atoi" name="atoi">,
4868 <ref id="atol" name="atol">,
4869 <ref id="itoa" name="itoa">,
4870 <ref id="ultoa" name="ultoa">,
4871 <ref id="utoa" name="utoa">
4877 <sect1>localeconv<label id="localeconv"><p>
4881 <tag/Function/Returns a pointer to the current locale structure.
4882 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4883 <tag/Declaration/<tt/struct lconv* localeconv (void);/
4884 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
4886 <tag/Notes/<itemize>
4887 <item>cc65 supports only the "C" locale, so even after setting a new locale
4888 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
4891 <tag/Availability/ISO 9899
4893 <ref id="setlocale" name="setlocale">
4899 <sect1>longjmp<label id="longjmp"><p>
4903 <tag/Function/Non local goto.
4904 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4905 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
4906 <tag/Description/The <tt/longjmp/ function restores a program context from the
4907 data in <tt/buf/, which must have been set by a preceeding call to
4908 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
4909 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
4911 <tag/Notes/<itemize>
4912 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
4913 was called with a value of one.
4914 <item>The function is only available as fastcall function, so it may only
4915 be used in presence of a prototype.
4917 <tag/Availability/ISO 9899
4919 <ref id="setjmp" name="setjmp">
4925 <sect1>malloc<label id="malloc"><p>
4929 <tag/Function/Allocate dynamic memory.
4930 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4931 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
4932 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
4933 pointer to the allocated memory block. On error (not enough memory available),
4934 <tt/malloc/ returns <tt/NULL/.
4935 <tag/Notes/<itemize>
4936 <item>The function is only available as fastcall function, so it may only
4937 be used in presence of a prototype.
4939 <tag/Availability/ISO 9899
4941 <ref id="_heapadd" name="_heapadd">,
4942 <ref id="_heapblocksize" name="_heapblocksize">,
4943 <ref id="_heapmaxavail" name="_heapmaxavail">,
4944 <ref id="_heapmemavail" name="_heapmemavail">,
4945 <ref id="calloc" name="calloc">,
4946 <ref id="free" name="free">,
4947 <ref id="realloc" name="realloc">,
4948 <ref id="strdup" name="strdup">
4954 <sect1>memchr<label id="memchr"><p>
4958 <tag/Function/Search for a character in a block of raw memory.
4959 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4960 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
4961 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
4962 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
4963 that is of size <tt/count/. Upon completion, the function returns a pointer to
4964 the character found, or a null pointer if the character was not found.
4965 <tag/Notes/<itemize>
4966 <item>The function is only available as fastcall function, so it may only
4967 be used in presence of a prototype.
4969 <tag/Availability/ISO 9899
4971 <ref id="strchr" name="strchr">
4977 <sect1>memcmp<label id="memcmp"><p>
4981 <tag/Function/Compare two memory areas.
4982 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4983 <tag/Declaration/<tt/int __fastcall__ memcmp (const void* p1, const void* p2, size_t count);/
4984 <tag/Description/<tt/memcmp/ compares <tt/count/ bytes from the memory area
4985 pointed to by <tt/p1/ into the memory area pointed to by <tt/p2/. It returns a value that is less than
4986 zero if <tt/p1/ is less than <tt/p2/, zero if <tt/p1/ is the same as <tt/p2/,
4987 and a value greater than zero if <tt/p1/ is greater than <tt/p2/.
4988 <tag/Notes/<itemize>
4989 <item>The function is only available as fastcall function, so it may only
4990 be used in presence of a prototype.
4992 <tag/Availability/ISO 9899
4994 <ref id="strcmp" name="strcmp">,
4995 <ref id="memmove" name="memmove">,
4996 <ref id="memset" name="memset">
5002 <sect1>memcpy<label id="memcpy"><p>
5006 <tag/Function/Copy a memory area.
5007 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5008 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
5009 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
5010 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
5012 <tag/Notes/<itemize>
5013 <item>The result is undefined if the memory areas do overlap. Use
5014 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
5015 <item>The function is only available as fastcall function, so it may only
5016 be used in presence of a prototype.
5018 <tag/Availability/ISO 9899
5020 <ref id="_swap" name="_swap">,
5021 <ref id="memmove" name="memmove">,
5022 <ref id="memset" name="memset">
5028 <sect1>memmove<label id="memmove"><p>
5032 <tag/Function/Copy a memory area.
5033 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5034 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
5035 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
5036 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
5038 <tag/Notes/<itemize>
5039 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
5040 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
5041 <item>The function is only available as fastcall function, so it may only
5042 be used in presence of a prototype.
5044 <tag/Availability/ISO 9899
5046 <ref id="_swap" name="_swap">,
5047 <ref id="memcpy" name="memcpy">,
5048 <ref id="memset" name="memset">
5054 <sect1>memset<label id="memset"><p>
5058 <tag/Function/Fill a memory area.
5059 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5060 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
5061 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
5062 the value <tt/val/. The function returns <tt/p/.
5063 <tag/Notes/<itemize>
5064 <item>The function is only available as fastcall function, so it may only
5065 be used in presence of a prototype.
5067 <tag/Availability/ISO 9899
5069 <ref id="_swap" name="_swap">,
5070 <ref id="bzero" name="bzero">,
5071 <ref id="memcpy" name="memcpy">,
5072 <ref id="memmove" name="memmove">
5078 <sect1>mod_free<label id="mod_free"><p>
5082 <tag/Function/Free a relocatable module.
5083 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
5084 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
5085 <tag/Description/The function will free a module loaded into memory by use of
5086 the <tt/<ref id="mod_load" name="mod_load">/ function.
5087 <tag/Notes/<itemize>
5088 <item>The pointer passed as parameter is the pointer to the module memory,
5089 not the pointer to the control structure.
5090 <item>The function is available only as a fastcall function; so, it may be used
5091 only in the presence of a prototype.
5093 <tag/Availability/cc65
5095 <ref id="mod_load" name="mod_load">
5101 <sect1>mod_load<label id="mod_load"><p>
5105 <tag/Function/Load a relocatable module.
5106 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
5107 <tag/Declaration/<tt/unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl);/
5108 <tag/Description/The function will load a code module into memory and relocate
5109 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
5110 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
5111 the module just loaded. Possible error codes are:
5113 <item><tt/MLOAD_OK/ - Module load successful
5114 <item><tt/MLOAD_ERR_READ/ - Read error
5115 <item><tt/MLOAD_ERR_HDR/ - Header error
5116 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
5117 <item><tt/MLOAD_ERR_FMT/ - Data format error
5118 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
5120 <tag/Notes/<itemize>
5121 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
5122 relocatable o65 modules for use with this function.
5123 <item>The function is available only as a fastcall function; so, it may be used
5124 only in the presence of a prototype.
5126 <tag/Availability/cc65
5128 <ref id="mod_free" name="mod_free">
5134 <sect1>mouse_setbox<label id="mouse_setbox"><p>
5138 <tag/Function/Specify a bounding box for the mouse cursor.
5139 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5140 <tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
5141 <tag/Description/The function allows to set a bounding box for mouse movement.
5142 <tag/Notes/<itemize>
5143 <item>The function does not check if the mouse cursor is currently within the
5144 given rectangle. Placing the mouse cursor within the bounding box is the
5145 responsibility of the programmer.
5146 <item>While the bounding box may be larger than the actual screen size, the
5147 standard mouse cursor draw routines may fail to set the cursor to coordinates
5148 outside of the screen area. Depending on the platform, you may have to supply
5149 your own mouse cursor routines.
5150 <item>The function is only available as fastcall function, so it may only be
5151 used in presence of a prototype.
5153 <tag/Availability/cc65
5155 <ref id="mouse_getbox" name="mouse_getbox">,
5156 <ref id="mouse_move" name="mouse_move">
5162 <sect1>mouse_getbox<label id="mouse_getbox"><p>
5166 <tag/Function/Return the current bounding box for the mouse cursor.
5167 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5168 <tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
5169 <tag/Description/The function queries the current bounding box for mouse
5171 <tag/Notes/<itemize>
5172 <item>The function is only available as fastcall function, so it may only be
5173 used in presence of a prototype.
5175 <tag/Availability/cc65
5177 <ref id="mouse_move" name="mouse_move">,
5178 <ref id="mouse_setbox" name="mouse_setbox">
5184 <sect1>mouse_buttons<label id="mouse_buttons"><p>
5188 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
5189 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5190 <tag/Declaration/<tt/unsigned char mouse_buttons (void);/
5191 <tag/Description/The function returns a bit mask that encodes the state of the
5192 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
5194 <tag/Availability/cc65
5196 <ref id="mouse_info" name="mouse_info">,
5197 <ref id="mouse_pos" name="mouse_pos">
5203 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
5207 <tag/Function/Return a readable error message for an error code.
5208 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5209 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
5211 <tag/Description/The function returns an error message (in english) for the
5212 error code passed parameter.
5213 <tag/Notes/<itemize>
5214 <item>The function will return "Unknown error" for invalid error codes.
5215 <item>The function is only available as fastcall function, so it may only be
5216 used in presence of a prototype.
5218 <tag/Availability/cc65
5220 <ref id="mouse_load_driver" name="mouse_load_driver">,
5221 <ref id="mouse_uninstall" name="mouse_uninstall">,
5222 <ref id="mouse_unload" name="mouse_unload">
5228 <sect1>mouse_hide<label id="mouse_hide"><p>
5232 <tag/Function/Hide the mouse pointer.
5233 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5234 <tag/Declaration/<tt/void mouse_hide (void);/
5235 <tag/Description/The function hides the mouse pointer. It manages a counter
5236 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
5237 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
5238 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
5240 <tag/Availability/cc65
5242 <ref id="mouse_show" name="mouse_show">
5248 <sect1>mouse_info<label id="mouse_info"><p>
5252 <tag/Function/Return the state of the mouse buttons and the position of the
5254 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5255 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
5256 <tag/Description/The function returns the state of the mouse buttons and the
5257 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
5258 <tag/Notes/<itemize>
5259 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
5260 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
5261 name="mouse_pos">/ instead.
5262 <item>The function is only available as fastcall function, so it may only be
5263 used in presence of a prototype.
5265 <tag/Availability/cc65
5267 <ref id="mouse_buttons" name="mouse_buttons">,
5268 <ref id="mouse_pos" name="mouse_pos">
5274 <sect1>mouse_install<label id="mouse_install"><p>
5278 <tag/Function/Install an already loaded mouse driver.
5279 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5280 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
5281 mouse_callbacks* c, void* driver);/
5282 <tag/Description/The function installs an already loaded mouse driver and
5283 returns an error code. The <tt/mouse_callbacks/ structure passed as first
5284 parameter contains pointers to routines needed to move or hide/show the mouse
5285 pointer. Defaults for these routines are supplied by the library, so if you
5286 can live with these defaults (which are platform specific), just pass a
5287 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
5288 driver linked statically to the program.
5289 <tag/Notes/<itemize>
5290 <item>Not all drivers are able to detect if the supported hardware is really
5292 <item>After installing a driver, the mouse cursor is hidden.
5293 <item>The function is only available as fastcall function, so it may only be
5294 used in presence of a prototype.
5296 <tag/Availability/cc65
5298 <ref id="mouse_load_driver" name="mouse_load_driver">,
5299 <ref id="mouse_uninstall" name="mouse_uninstall">,
5300 <ref id="mouse_unload" name="mouse_unload">
5306 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
5310 <tag/Function/Call the driver specific ioctl function.
5311 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5312 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
5313 <tag/Description/The function calls the IOCTL entry in the mouse driver,
5314 which is driver specific. The <tt/code/ parameter will choose between
5315 different IOCTL functions, and the <tt/data/ depends on code. The
5316 function returns an error code. The purpose of this function is to allow
5317 for driver specific extensions. See the documentation for a specific mouse
5318 driver for supported ioctl calls.
5319 <tag/Notes/<itemize>
5320 <item>Calling this function is non portable, because each driver may
5321 implement different ioctl calls (or none at all).
5322 <item>The function is only available as fastcall function, so it may only be
5323 used in presence of a prototype.
5325 <tag/Availability/cc65
5331 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
5335 <tag/Function/Load and initialize a mouse driver.
5336 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5337 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
5338 mouse_callbacks* c, const char* driver);/
5339 <tag/Description/Load a mouse driver into memory and initialize it. The
5340 function returns an error code that tells if the call has been successful. The
5341 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
5342 routines needed to move or hide/show the mouse pointer. Defaults for these
5343 routines are supplied by the library, so if you can live with these defaults
5344 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
5345 <tag/Notes/<itemize>
5346 <item>The driver is loaded by name, so currently you must know the type of
5347 mouse that should be supported. There is no autodetect capability.
5348 <item>Not all drivers are able to detect if the supported hardware is really
5350 <item>After installing a driver, the mouse cursor is hidden.
5351 <item>The function is only available as fastcall function, so it may only be
5352 used in presence of a prototype.
5354 <tag/Availability/cc65
5356 <ref id="mouse_install" name="mouse_install">,
5357 <ref id="mouse_uninstall" name="mouse_uninstall">,
5358 <ref id="mouse_unload" name="mouse_unload">
5364 <sect1>mouse_move<label id="mouse_move"><p>
5368 <tag/Function/Move the mouse cursor to a specific position.
5369 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5370 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
5371 <tag/Description/The function updates the mouse position. If the mouse cursor
5372 is visible, it is shown at the new position.
5373 <tag/Notes/<itemize>
5374 <item>The function does not check if the new position is within the bounding
5375 box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
5376 <item>The function is only available as fastcall function, so it may only be
5377 used in presence of a prototype.
5379 <tag/Availability/cc65
5381 <ref id="mouse_getbox" name="mouse_getbox">,
5382 <ref id="mouse_setbox" name="mouse_setbox">
5388 <sect1>mouse_pos<label id="mouse_pos"><p>
5392 <tag/Function/Return the position of the mouse.
5393 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5394 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
5395 <tag/Description/The function returns the position of the mouse in the
5396 <tt/mouse_pos/ structure passed as parameter.
5397 <tag/Notes/<itemize>
5398 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
5399 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
5400 name="mouse_info">/ instead.
5401 <item>The function is only available as fastcall function, so it may only be
5402 used in presence of a prototype.
5404 <tag/Availability/cc65
5406 <ref id="mouse_buttons" name="mouse_buttons">,
5407 <ref id="mouse_info" name="mouse_info">
5413 <sect1>mouse_show<label id="mouse_show"><p>
5417 <tag/Function/Show the mouse pointer.
5418 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5419 <tag/Declaration/<tt/void mouse_show (void);/
5420 <tag/Description/The function shows the mouse pointer. It manages a counter
5421 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
5422 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
5423 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
5424 <tag/Availability/cc65
5426 <ref id="mouse_hide" name="mouse_hide">
5432 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
5436 <tag/Function/Uninstall an already loaded mouse driver.
5437 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5438 <tag/Declaration/<tt/unsigned char mouse_uninstall (void);/
5439 <tag/Description/The function uninstalls an already loaded mouse driver but
5440 don't removes it from memory.
5441 <tag/Notes/<itemize>
5442 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
5443 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
5444 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
5447 <tag/Availability/cc65
5449 <ref id="mouse_install" name="mouse_install">,
5450 <ref id="mouse_load_driver" name="mouse_load_driver">,
5451 <ref id="mouse_unload" name="mouse_unload">
5457 <sect1>mouse_unload<label id="mouse_unload"><p>
5461 <tag/Function/Unload a mouse driver.
5462 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5463 <tag/Declaration/<tt/unsigned char mouse_unload (void);/
5464 <tag/Description/The function unloads a loaded mouse driver and frees all
5465 memory allocated for the driver.
5466 <tag/Notes/<itemize>
5467 <item>The function does nothing if no driver is loaded.
5469 <tag/Availability/cc65
5471 <ref id="mouse_install" name="mouse_install">,
5472 <ref id="mouse_load_driver" name="mouse_load_driver">,
5473 <ref id="mouse_uninstall" name="mouse_uninstall">
5479 <sect1>offsetof<label id="offsetof"><p>
5483 <tag/Function/Calculate the offset of a struct or union member.
5484 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
5485 <tag/Declaration/<tt/size_t offsetof (type, member);/
5486 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
5487 or <tt/union/ member.
5488 <tag/Notes/<itemize>
5489 <item>The function is actually a macro.
5491 <tag/Availability/ISO 9899
5497 <sect1>open<label id="open"><p>
5501 <tag/Function/Open and possibly create a file.
5502 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
5503 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
5504 <tag/Description/<tt/open/ opens a file and returns the file descriptor
5505 associated with it. On error, -1 is returned and an error code is stored in
5506 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
5507 <tag/Notes/<itemize>
5508 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
5509 open, which is used as the permission mask when a new file is created. While
5510 cc65 allows to pass this argument, it is ignored.
5512 <tag/Availability/POSIX 1003.1
5514 <ref id="close" name="close">,
5515 <ref id="creat" name="creat">
5521 <sect1>opendir<label id="opendir"><p>
5525 <tag/Function/Open a directory.
5526 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5527 <tag/Declaration/<tt/DIR* __fastcall__ opendir (const char* name);/
5528 <tag/Description/<tt/opendir/ opens a directory and returns the direcory
5529 descriptor associated with it. On error, NULL is returned and an error code is
5530 stored in <tt/errno/.
5531 <tag/Notes/<itemize>
5532 <item>The function is only available as fastcall function, so it may only
5533 be used in presence of a prototype.
5535 <tag/Availability/POSIX 1003.1
5537 <ref id="closedir" name="closedir">,
5538 <ref id="readdir" name="readdir">
5544 <sect1>peekbsys<label id="peekbsys"><p>
5548 <tag/Function/Read one byte from a location in the system bank.
5549 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5550 <tt/<ref id="cbm510.h" name="cbm510.h">/
5551 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
5552 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
5553 system bank (bank 15) of the CBM PET-II machines and returns it.
5554 <tag/Notes/<itemize>
5555 <item>The function is only available as fastcall function, so it may only
5556 be used in presence of a prototype.
5557 <item>This function may be a macro depending on the compiler options. The
5558 actual function is accessible by #undef'ing the macro.
5560 <tag/Availability/cc65
5562 <ref id="PEEK" name="PEEK">,
5563 <ref id="PEEKW" name="PEEKW">,
5564 <ref id="peekwsys" name="peekwsys">,
5565 <ref id="pokebsys" name="pokebsys">,
5566 <ref id="pokewsys" name="pokewsys">
5572 <sect1>peekwsys<label id="peekwsys"><p>
5576 <tag/Function/Read one word from a location in the system bank.
5577 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5578 <tt/<ref id="cbm510.h" name="cbm510.h">/
5579 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
5580 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
5581 system bank (bank 15) of the CBM PET-II machines and returns it. Following
5582 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
5583 high byte is read from <tt/addr+1/.
5584 <tag/Notes/<itemize>
5585 <item>The function is only available as fastcall function, so it may only
5586 be used in presence of a prototype.
5587 <item>The order in which the two bytes are read is undefined.
5589 <tag/Availability/cc65
5591 <ref id="PEEK" name="PEEK">,
5592 <ref id="PEEKW" name="PEEKW">,
5593 <ref id="peekbsys" name="peekbsys">,
5594 <ref id="pokebsys" name="pokebsys">,
5595 <ref id="pokewsys" name="pokewsys">
5601 <sect1>perror<label id="perror"><p>
5605 <tag/Function/Print an error message for the error in <tt/errno/.
5606 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5607 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
5608 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
5609 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
5610 a blank. Then the error message for the current contents of <tt/errno/ is
5611 printed followed by a newline. The message output is the same as returned by
5612 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
5613 <tag/Notes/<itemize>
5614 <item>The function is only available as fastcall function, so it may only
5615 be used in presence of a prototype.
5617 <tag/Availability/ISO 9899
5619 <ref id="_poserror" name="_poserror">,
5620 <ref id="strerror" name="strerror">
5626 <sect1>pokebsys<label id="pokebsys"><p>
5630 <tag/Function/Write one byte to a location in the system bank.
5631 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5632 <tt/<ref id="cbm510.h" name="cbm510.h">/
5633 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
5634 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
5635 system bank (bank 15) of the CBM PET-II machines.
5636 <tag/Notes/<itemize>
5637 <item>The function is only available as fastcall function, so it may only
5638 be used in presence of a prototype.
5640 <tag/Availability/cc65
5642 <ref id="POKE" name="POKE">,
5643 <ref id="POKEW" name="POKEW">,
5644 <ref id="peekbsys" name="peekbsys">,
5645 <ref id="peekwsys" name="peekwsys">,
5646 <ref id="pokewsys" name="pokewsys">
5652 <sect1>pokewsys<label id="pokewsys"><p>
5656 <tag/Function/Write one word to a location in the system bank.
5657 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5658 <tt/<ref id="cbm510.h" name="cbm510.h">/
5659 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
5660 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
5661 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
5662 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
5663 high byte is written to <tt/addr+1/.
5664 <tag/Notes/<itemize>
5665 <item>The function is only available as fastcall function, so it may only
5666 be used in presence of a prototype.
5667 <item>The order in which the two bytes are written is undefined.
5669 <tag/Availability/cc65
5671 <ref id="POKE" name="POKE">,
5672 <ref id="POKEW" name="POKEW">,
5673 <ref id="peekbsys" name="peekbsys">,
5674 <ref id="peekwsys" name="peekwsys">,
5675 <ref id="pokebsys" name="pokebsys">
5681 <sect1>qsort<label id="qsort"><p>
5685 <tag/Function/Sort an array.
5686 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5687 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
5688 size_t size, int __fastcall__ (* compare) (const void*, const void*));/
5689 <tag/Description/<tt/qsort/ sorts an array according to a given compare
5690 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
5691 is the number of elements, <tt/size/ the size of an element and <tt/compare/
5692 the function used to compare the members.
5693 <tag/Notes/<itemize>
5694 <item>If there are multiple members with the same key, the order after calling
5695 the function is undefined.
5696 <item>The function is only available as fastcall function, so it may only
5697 be used in presence of a prototype.
5698 <item>The function to which <tt/compare/ points must have the <tt/fastcall/
5701 <tag/Availability/ISO 9899
5703 <ref id="bsearch" name="bsearch">
5709 <sect1>raise<label id="raise"><p>
5713 <tag/Function/Send a signal to the executing program.
5714 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
5715 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
5716 <tag/Description/<tt/raise/ sends the given signal to the program. If the
5717 program has installed a signal handler for the signal, this signal handler
5718 will be executed. If no handler has been installed, the default action for
5719 the raised signal will be taken. The function returns zero on success,
5721 <tag/Notes/<itemize>
5722 <item>The function is only available as fastcall function, so it may only
5723 be used in presence of a prototype.
5725 <tag/Availability/ISO 9899
5727 <ref id="abort" name="abort">,
5728 <ref id="signal" name="signal">
5734 <sect1>rand<label id="rand"><p>
5738 <tag/Function/Return a pseudo random number.
5739 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5740 <tag/Declaration/<tt/int rand (void);/
5741 <tag/Description/The function returns a pseudo random number
5742 between 0 and <tt/RAND_MAX/ (exclusive).
5743 <tag/Notes/<itemize>
5744 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
5745 flow of numbers is generated.
5746 <item>On startup, the function behaves as if <ref id="srand" name="srand">
5747 had been used with an argument of 1.
5749 <tag/Availability/ISO 9899
5751 <ref id="_randomize" name="_randomize">,
5752 <ref id="srand" name="srand">
5758 <sect1>readdir<label id="readdir"><p>
5762 <tag/Function/Read a directory.
5763 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5764 <tag/Declaration/<tt/struct dirent* __fastcall__ readdir (DIR* dir);/
5765 <tag/Description/<tt/readdir/ reads the next directory entry from the directory
5766 stream pointed to by <tt/dir/. It stores the data in a <tt/dirent/ structure
5767 and returns a pointer to it. If the end of directory is reached, or an error
5768 occurs, NULL is returned. In case of errors, an error code is stored into
5770 <tag/Notes/<itemize>
5771 <item>The function is only available as fastcall function, so it may only
5772 be used in presence of a prototype.
5773 <item>The returned pointer may point to a statically allocated instance of
5774 <tt/struct dirent/, so it may get overwritten by subsequent calls to
5776 <item>On several platforms, namely the CBMs and the Atari, the disk drives get
5777 confused when opening/closing files between directory reads. So for example a
5778 program that reads the list of files on a disk, and after each call to
5779 <tt/readdir/, opens the file to process it, will fail.<newline>
5780 Possible solutions are reading the directory into memory before processing the
5781 file list, or to reset the directory by seeking to the correct position after
5782 opening/closing a file:
5784 seekdir (DIR, telldir (DIR));
5786 Platforms known to work without problems are: Apple.
5788 <tag/Availability/POSIX 1003.1
5790 <ref id="closedir" name="closedir">,
5791 <ref id="opendir" name="opendir">
5797 <sect1>realloc<label id="realloc"><p>
5801 <tag/Function/Change the size of an allocated memory block.
5802 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5803 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
5804 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
5805 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
5806 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
5807 behaves as if <tt/free/ had been called. On error (not enough memory
5808 available), <tt/realloc/ returns <tt/NULL/.
5809 <tag/Notes/<itemize>
5810 <item>The part of the memory block that is returned will have its contents
5812 <item>This function is somewhat dangerous to use. Be careful to save the
5813 pointer you're passing somewhere else, otherwise
5815 ptr = realloc (ptr, size);
5817 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
5818 <item>The function is only available as fastcall function, so it may only
5819 be used in presence of a prototype.
5821 <tag/Availability/ISO 9899
5823 <ref id="_heapadd" name="_heapadd">,
5824 <ref id="_heapblocksize" name="_heapblocksize">,
5825 <ref id="_heapmaxavail" name="_heapmaxavail">,
5826 <ref id="_heapmemavail" name="_heapmemavail">,
5827 <ref id="calloc" name="calloc">,
5828 <ref id="free" name="free">,
5829 <ref id="realloc" name="realloc">
5835 <sect1>remove<label id="remove"><p>
5839 <tag/Function/Delete a file.
5840 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5841 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
5842 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
5843 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5844 code describing the reason for the failure.
5845 <tag/Notes/<itemize>
5846 <item>This function is not available on all cc65 targets (depends on the
5847 availability of file I/O).
5848 <item>The function is only available as fastcall function, so it may only
5849 be used in presence of a prototype.
5851 <tag/Availability/ISO 9899
5853 <ref id="rename" name="rename">,
5854 <ref id="unlink" name="unlink">
5857 #include <stdio.h>
5859 #define FILENAME "helloworld"
5861 if (remove (FILENAME) == 0) {
5862 printf ("We deleted %s successfully\n", FILENAME);
5864 printf ("There was a problem deleting %s\n", FILENAME);
5871 <sect1>rename<label id="rename"><p>
5875 <tag/Function/Rename a file.
5876 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5877 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
5878 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
5879 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5880 code describing the reason for the failure.
5881 <tag/Notes/<itemize>
5882 <item>This function is not available on all cc65 targets (depends on the
5883 capabilities of the storage devices).
5884 <item>The function is only available as fastcall function, so it may only
5885 be used in presence of a prototype.
5887 <tag/Availability/ISO 9899
5889 <ref id="remove" name="remove">
5892 #include <stdio.h>
5894 #define OLDNAME "textfile.txt"
5895 #define NEWNAME "textfile.bak"
5897 if (rename (OLDNAME, NEWNAME) == 0) {
5898 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
5900 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
5907 <sect1>reset_brk<label id="reset_brk"><p>
5911 <tag/Function/Resets the break vector to its original value.
5912 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5913 <tag/Declaration/<tt/void reset_brk (void);/
5914 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
5915 before a call to <tt/set_brk/.
5916 <tag/Notes/<itemize>
5917 <item>The break vector is reset on program termination, so it's not strictly
5918 necessary to call this function as a part of your clean-up when exiting the program.
5920 <tag/Availability/cc65
5922 <ref id="reset_irq" name="reset_irq">,
5923 <ref id="set_brk" name="set_brk">,
5924 <ref id="set_irq" name="set_irq">
5930 <sect1>reset_irq<label id="reset_irq"><p>
5934 <tag/Function/Resets the C level interrupt request vector.
5935 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5936 <tag/Declaration/<tt/void reset_irq (void);/
5937 <tag/Description/<tt/reset_irq/ resets the C level interrupt request vector.
5938 <tag/Notes/<itemize>
5939 <item>The interrupt vector is reset on program termination, so it's not strictly
5940 necessary to call this function as a part of your clean-up when exiting the program.
5942 <tag/Availability/cc65
5944 <ref id="reset_brk" name="reset_brk">,
5945 <ref id="set_brk" name="set_brk">,
5946 <ref id="set_irq" name="set_irq">
5952 <sect1>revers<label id="revers"><p>
5956 <tag/Function/Control revers character display.
5957 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5958 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
5959 <tag/Description/If the argument is non zero, the function enables reverse
5960 character display. If the argument is zero, reverse character display is
5961 switched off. The old value of the setting is returned.
5962 <tag/Notes/<itemize>
5963 <item>The function may not be supported by the hardware, in which case
5964 the call is ignored.
5965 <item>The function is only available as fastcall function, so it may only
5966 be used in presence of a prototype.
5968 <tag/Availability/cc65
5970 <ref id="textcolor" name="textcolor">
5976 <sect1>rewinddir<label id="rewinddir"><p>
5980 <tag/Function/Reset a directory stream.
5981 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5982 <tag/Declaration/<tt/void __fastcall__ rewinddir (DIR* dir);/
5983 <tag/Description/<tt/rewinddir/ sets the position of the directory stream
5984 pointed to by <tt/dir/ to the start of the directory.
5985 <tag/Notes/<itemize>
5986 <item>The function is only available as fastcall function, so it may only
5987 be used in presence of a prototype.
5989 <tag/Availability/POSIX 1003.1
5991 <ref id="seekdir" name="seekdir">,
5992 <ref id="telldir" name="telldir">
5998 <sect1>screensize<label id="screensize"><p>
6002 <tag/Function/Return the dimensions of the text mode screen.
6003 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6004 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
6005 <tag/Description/The function returns the dimensions of the text mode screen.
6006 <tag/Notes/<itemize>
6007 <item>The function is only available as fastcall function, so it may only
6008 be used in presence of a prototype.
6010 <tag/Availability/cc65
6012 <ref id="gotox" name="gotox">,
6013 <ref id="gotoxy" name="gotoxy">,
6014 <ref id="gotoy" name="gotoy">,
6015 <ref id="wherex" name="wherex">,
6016 <ref id="wherey" name="wherey">
6022 <sect1>seekdir<label id="seekdir"><p>
6026 <tag/Function/Set the position of a directory stream.
6027 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
6028 <tag/Declaration/<tt/void __fastcall__ seekdir (DIR* dir, long offset);/
6029 <tag/Description/<tt/seekdir/ sets the position of the directory stream
6030 pointed to by <tt/dir/ to the value given in <tt/offset/, which should be a
6031 value returned by <tt/<ref id="telldir" name="telldir">/.
6032 <tag/Notes/<itemize>
6033 <item>The function is only available as fastcall function, so it may only
6034 be used in presence of a prototype.
6036 <tag/Availability/POSIX 1003.1
6038 <ref id="rewinddir" name="rewinddir">,
6039 <ref id="telldir" name="telldir">
6045 <sect1>ser_close<label id="ser_close"><p>
6049 <tag/Function/Close the port and disable interrupts
6050 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6051 <tag/Declaration/<tt/unsigned char ser_close (void);/
6052 <tag/Description/Close the port by clearing buffers and disable interrupts.
6053 <tag/Availability/cc65
6054 <tag/See also/Other serial functions.
6059 static void initialize(){
6060 struct ser_params params = {
6067 ser_install(lynx_comlynx); // This will activate the ComLynx
6069 ser_open(&params);
6076 <sect1>ser_get<label id="ser_get"><p>
6080 <tag/Function/Read a character from serial port.
6081 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6082 <tag/Declaration/<tt/unsigned char __fastcall__ ser_get (char* b);/
6083 <tag/Description/Get a character from the serial port. If no characters are
6084 available, the function will return SER_ERR_NO_DATA, so this is not a fatal
6086 <tag/Notes/<itemize>
6087 <item>The function is only available as fastcall function, so it may only
6088 be used in presence of a prototype.
6090 <tag/Availability/cc65
6091 <tag/See also/Other serial functions.
6093 Wait for a character to be available from a serial port.
6096 while (ser_get(&ch) == SER_ERR_NO_DATA)
6103 <sect1>ser_install<label id="ser_install"><p>
6107 <tag/Function/Install an already loaded driver and return an error code.
6108 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6109 <tag/Declaration/<tt/unsigned char __fastcall__ ser_install (void* driver);/
6110 <tag/Description/The function installs a driver that was already loaded into
6111 memory (or linked statically to the program). It returns an error code
6112 (<tt/SER_ERR_OK/ in case of success).
6113 <tag/Notes/<itemize>
6114 <item>The function is only available as fastcall function, so it may only be
6115 used in presence of a prototype.
6117 <tag/Availability/cc65
6119 <ref id="ser_load_driver" name="ser_load_driver">,
6120 <ref id="ser_uninstall" name="ser_uninstall">,
6121 <ref id="ser_unload" name="ser_unload">
6123 ser_install(lynx_comlynx); //Include the driver statically instead of loading it.
6129 <sect1>ser_ioctl<label id="ser_ioctl"><p>
6133 <tag/Function/Platform dependent code extensions.
6134 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6135 <tag/Declaration/<tt/unsigned __fastcall__ ser_ioctl (unsigned char code, void* data);/
6136 <tag/Description/Some platforms have extra serial functions that are not
6137 supported by standard serial driver functions. You can extend the driver to support
6138 this extra functionality bt using ser_ioctl functions.
6139 <tag/Notes/<itemize>
6140 <item>The function is only available as fastcall function, so it may only
6141 be used in presence of a prototype.
6142 <item>These functions are not easily portable to other cc65 platforms.
6144 <tag/Availability/cc65
6145 <tag/See also/Other serial functions.
6150 <sect1>ser_load_driver<label id="ser_load_driver"><p>
6154 <tag/Function/Load and install a serial driver.
6155 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6156 <tag/Declaration/<tt/unsigned char __fastcall__ ser_load_driver (const char *name);/
6157 <tag/Description/Load and install the driver by name.
6158 Will just load the driver and check if loading was successful.
6159 <tag/Notes/<itemize>
6160 <item>The function is only available as fastcall function, so it may only
6161 be used in presence of a prototype.
6163 <tag/Availability/cc65
6164 <tag/See also/Other serial functions.
6170 <sect1>ser_open<label id="ser_open"><p>
6174 <tag/Function/Open the port by setting the port parameters and enable interrupts
6175 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6176 <tag/Declaration/<tt/unsigned char __fastcall__ ser_open (const struct ser_params* params);/
6177 <tag/Description/Open the port by setting the port parameters and enable interrupts.
6178 <tag/Notes/<itemize>
6179 <item>The function is only available as fastcall function, so it may only
6180 be used in presence of a prototype.
6182 <tag/Availability/cc65
6183 <tag/See also/Other serial functions.
6188 static void initialize(){
6189 struct ser_params params = {
6196 ser_install(lynx_comlynx); // This will activate the ComLynx
6198 ser_open(&params);
6205 <sect1>ser_put<label id="ser_put"><p>
6209 <tag/Function/Write a character to a serial port.
6210 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6211 <tag/Declaration/<tt/unsigned char __fastcall__ ser_put (char b);/
6212 <tag/Description/Send a character via the serial port. There is a transmit
6213 buffer, but transmitting is not done via interrupt. The function returns
6214 SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
6215 <tag/Notes/<itemize>
6216 <item>The function is only available as fastcall function, so it may only
6217 be used in presence of a prototype.
6219 <tag/Availability/cc65
6220 <tag/See also/Other serial functions.
6229 <sect1>ser_status<label id="ser_status"><p>
6233 <tag/Function/Return the serial port status.
6234 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6235 <tag/Declaration/<tt/unsigned char __fastcall__ ser_status (unsigned char* status);/
6236 <tag/Description/Return the serial port status.
6237 <tag/Notes/<itemize>
6238 <item>The function is only available as fastcall function, so it may only
6239 be used in presence of a prototype.
6241 <tag/Availability/cc65
6242 <tag/See also/Other serial functions.
6248 <sect1>ser_uninstall<label id="ser_uninstall"><p>
6252 <tag/Function/Uninstall the currently loaded driver but do not unload it.
6253 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6254 <tag/Declaration/<tt/unsigned char ser_uninstall (void);/
6255 <tag/Description/Uninstall the currently loaded driver but do not unload it.
6256 <tag/Availability/cc65
6257 <tag/See also/Other serial functions.
6262 <sect1>ser_unload<label id="ser_unload"><p>
6266 <tag/Function/Uninstall, then unload the currently loaded driver.
6267 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6268 <tag/Declaration/<tt/unsigned char ser_unload (void);/
6269 <tag/Description/Uninstall, then unload the currently loaded driver.
6270 <tag/Availability/cc65
6271 <tag/See also/Other serial functions.
6277 <sect1>set_brk<label id="set_brk"><p>
6281 <tag/Function/Set the break vector to a user function.
6282 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
6283 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
6284 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
6285 program code by letting the vector point to a user written C function. The
6286 runtime library installs a small stub that saves the registers into global
6287 variables that may be accessed (and changed) by the break handler.
6288 <tag/Notes/<itemize>
6289 <item>The function is only available as fastcall function, so it may only
6290 be used in presence of a prototype.
6291 <item>The stub saves the zero page registers used by the C runtime and switches
6292 to a small break handler stack. This means that it is safe to execute C code,
6293 even if C code was interrupted. Be careful however not to use too many local
6294 variables, and do not enable stack checks for the handler function or any other
6295 function called from it.
6296 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
6297 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
6298 otherwise the <tt/BRK/ instruction will get executed over and over again.
6299 <item>The break vector is reset on program termination, so it's not strictly
6300 necessary to call <tt/<ref id="reset_brk" name="reset_brk">/ as a part of your
6301 clean-up when exiting the program.
6303 <tag/Availability/cc65
6305 <ref id="reset_brk" name="reset_brk">
6311 <sect1>set_irq<label id="set_irq"><p>
6315 <tag/Function/Set the C level interrupt request vector to the given address.
6316 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
6317 <tag/Declaration/<tt/void __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);/
6318 <tag/Description/<tt/set_irq/ allows a user program to handle interrupt requests
6319 (IRQs) within the program code by letting the vector point to a user written C
6320 function. The runtime library installs a small stub that saves the zero page
6321 registers used by the C runtime before calling the handler function and restores
6322 them after the handler function returns. Additionally the stub temporarily switches
6323 the C runtime stack to the stack area provided as parameter. If the handler function
6324 was set up to handle a "private", "exclusive" interrupt request source it must
6325 return the value <tt/IRQ_HANDLED/ if and only if it has verified that the current
6326 interrupt request actually stems from that source. In all other cases it must return
6327 the value <tt/IRQ_NOT_HANDLED/.
6328 <tag/Notes/<itemize>
6329 <item>The function is only available as fastcall function, so it may only
6330 be used in presence of a prototype.
6331 <item>The stub saves the registers and zero page locations used by the C runtime
6332 and switches to the provided stack area. As a consequence, there is some
6333 runtime overhead, but it it is safe to execute C code, even if other C code
6334 was interrupted. Be careful however not to call C library functions, and do not
6335 enable stack checks for the handler function or any other function called from
6337 <item>The interrupt vector is reset on program termination, so it's not strictly
6338 necessary to call <tt/<ref id="reset_irq" name="reset_irq">/ as a part of your
6339 clean-up when exiting the program.
6341 <tag/Availability/cc65
6343 <ref id="reset_brk" name="reset_brk">,
6344 <ref id="reset_irq" name="reset_irq">,
6345 <ref id="set_brk" name="set_brk">
6351 <sect1>set_c128_speed<label id="set_c128_speed"><p>
6355 <tag/Function/Set the current speed of a C128 CPU.
6356 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6357 <tag/Declaration/<tt/unsigned char __fastcall__ set_c128_speed (unsigned char speed);/
6358 <tag/Description/The function returns the speed after trying to set the speed of the C128 CPU.
6359 <tag/Notes/<itemize>
6360 <item>The function is specific to the C64 and C128.
6361 <item>The function does not check if the C128 CPU is the current CPU.
6362 <item>See the accelerator.h header for the speed definitions.
6364 <tag/Availability/cc65 (not all platforms)
6366 <ref id="detect_c128" name="detect_c128">,
6367 <ref id="get_c128_speed" name="get_c128_speed">,
6373 <sect1>set_c64dtv_speed<label id="set_c64dtv_speed"><p>
6377 <tag/Function/Set the current speed of the C64DTV.
6378 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6379 <tag/Declaration/<tt/unsigned char __fastcall__ set_c64dtv_speed (unsigned char speed);/
6380 <tag/Description/The function returns the speed after trying to set the speed of the C64DTV.
6381 <tag/Notes/<itemize>
6382 <item>The function is specific to the C64.
6383 <item>The function does not check for the presence of the C64DTV.
6384 <item>See the accelerator.h header for the speed definitions.
6386 <tag/Availability/cc65 (not all platforms)
6388 <ref id="detect_c64dtv" name="detect_c64dtv">,
6389 <ref id="get_c64dtv_speed" name="get_c64dtv_speed">,
6395 <sect1>set_c65_speed<label id="set_c65_speed"><p>
6399 <tag/Function/Set the current speed of the C65/C64DX in C64 mode.
6400 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6401 <tag/Declaration/<tt/unsigned char __fastcall__ set_c65_speed (unsigned char speed);/
6402 <tag/Description/The function returns the speed after trying to set the speed of the C65/C64DX in C64 mode.
6403 <tag/Notes/<itemize>
6404 <item>The function is specific to the C64.
6405 <item>The function does not check for the presence of a C65/C64DX in C64 mode.
6406 <item>See the accelerator.h header for the speed definitions.
6408 <tag/Availability/cc65 (not all platforms)
6410 <ref id="detect_c65" name="detect_c65">,
6411 <ref id="get_c65_speed" name="get_c65_speed">,
6417 <sect1>set_chameleon_speed<label id="set_chameleon_speed"><p>
6421 <tag/Function/Set the current speed of the C64 Chameleon cartridge.
6422 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6423 <tag/Declaration/<tt/unsigned char __fastcall__ set_chameleon_speed (unsigned char speed);/
6424 <tag/Description/The function returns the speed after trying to set the speed of the C64 Chameleon cartridge.
6425 <tag/Notes/<itemize>
6426 <item>The function is specific to the C64.
6427 <item>The function does not check for the presence of the C64 Chameleon cartridge.
6428 <item>See the accelerator.h header for the speed definitions.
6430 <tag/Availability/cc65 (not all platforms)
6432 <ref id="detect_chameleon" name="detect_chameleon">,
6433 <ref id="get_chameleon_speed" name="get_chameleon_speed">,
6439 <sect1>set_scpu_speed<label id="set_scpu_speed"><p>
6443 <tag/Function/Set the current speed of the C64/C128 SuperCPU cartridge.
6444 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6445 <tag/Declaration/<tt/unsigned char __fastcall__ set_scpu_speed (unsigned char speed);/
6446 <tag/Description/The function returns the speed after trying to set the speed of the SuperCPU cartridge.
6447 <tag/Notes/<itemize>
6448 <item>The function is specific to the C128 and C64.
6449 <item>The function does not check for the presence of the cartridge.
6450 <item>See the accelerator.h header for the speed definitions.
6452 <tag/Availability/cc65 (not all platforms)
6454 <ref id="detect_scpu" name="detect_scpu">,
6455 <ref id="get_scpu_speed" name="get_scpu_speed">,
6461 <sect1>set_turbomaster_speed<label id="set_turbomaster_speed"><p>
6465 <tag/Function/Set the current speed of the C64 Turbo Master cartridge.
6466 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6467 <tag/Declaration/<tt/unsigned char __fastcall__ set_turbomaster_speed (unsigned char speed);/
6468 <tag/Description/The function returns the speed after trying to set the speed of the C64 Turbo Master cartridge.
6469 <tag/Notes/<itemize>
6470 <item>The function is specific to the C64.
6471 <item>The function does not check for the presence of the C64 Turbo Master cartridge.
6472 <item>See the accelerator.h header for the speed definitions.
6474 <tag/Availability/cc65 (not all platforms)
6476 <ref id="detect_turbomaster" name="detect_turbomaster">,
6477 <ref id="get_turbomaster_speed" name="get_turbomaster_speed">,
6483 <sect1>setjmp<label id="setjmp"><p>
6487 <tag/Function/Save the context for use with <tt/longjmp/.
6488 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
6489 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
6490 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
6491 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
6493 <tag/Notes/<itemize>
6494 <item>The function is only available as fastcall function, so it may only
6495 be used in presence of a prototype.
6496 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
6497 <item><tt/setjmp/ will not save the signal context.
6499 <tag/Availability/ISO 9899
6501 <ref id="longjmp" name="longjmp">
6507 <sect1>setlocale<label id="setlocale"><p>
6511 <tag/Function/Selects a locale.
6512 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
6513 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
6514 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
6515 <tag/Notes/<itemize>
6516 <item>The function is only available as fastcall function, so it may only
6517 be used in presence of a prototype.
6518 <item>cc65 supports only the "C" locale, so calling this function to set a
6519 different locale has no effect.
6521 <tag/Availability/ISO 9899
6523 <ref id="localeconv" name="localeconv">,
6524 <ref id="strcoll" name="strcoll">
6525 <ref id="strxfrm" name="strxfrm">
6531 <sect1>signal<label id="signal"><p>
6535 <tag/Function/Install a signal handler.
6536 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
6537 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
6538 <tag/Description/<tt/signal/ installs a handler for the given signal. The
6539 handler may either be a user supplied function, or one of the predefined
6540 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
6541 previous value if the signal , or the special function vector SIG_ERR in
6543 <tag/Notes/<itemize>
6544 <item>The function is only available as fastcall function, so it may only
6545 be used in presence of a prototype.
6547 <tag/Availability/ISO 9899
6549 <ref id="abort" name="abort">,
6550 <ref id="raise" name="raise">
6556 <sect1>sleep<label id="sleep"><p>
6560 <tag/Function/Sleep for a specified amount of time.
6561 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
6562 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
6563 <tag/Description/The function will return after the specified number of
6564 seconds have elapsed.
6565 <tag/Notes/<itemize>
6566 <item>The function is only available as fastcall function, so it may only
6567 be used in presence of a prototype.
6569 <tag/Availability/POSIX 1003.1
6575 <sect1>slow<label id="slow"><p>
6579 <tag/Function/Switch the CPU into slow mode (C128: 1MHz mode, C16/Plus4: single clock mode).
6580 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
6581 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
6582 <tag/Declaration/<tt/void slow (void);/
6583 <tag/Description/The function will switch the clock of the CPU to slow mode. for the C128
6584 target it means switching the CPU into 1MHz mode. for the C16/Plus4 target it means
6585 switching the CPU into single clock mode.
6586 <tag/Notes/<itemize>
6587 <item>The function is specific to the C128, C16 and Plus4.
6589 <tag/Availability/cc65 (not all platforms)
6591 <ref id="fast" name="fast">,
6592 <ref id="isfast" name="isfast">,
6598 <sect1>srand<label id="srand"><p>
6602 <tag/Function/Initialize the pseudo random number generator.
6603 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
6604 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
6605 <tag/Description/The function initializes the random number generator using
6606 the given seed. On program startup, the generator behaves as if <tt/srand/ has
6607 been called with an argument of 1.
6608 <tag/Notes/<itemize>
6609 <item>The function is only available as fastcall function, so it may only
6610 be used in presence of a prototype.
6612 <tag/Availability/ISO 9899
6614 <ref id="_randomize" name="_randomize">,
6615 <ref id="rand" name="rand">
6621 <sect1>strcasecmp<label id="strcasecmp"><p>
6625 <tag/Function/Compare two strings case insensitive.
6626 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6627 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
6628 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
6629 as parameters without case sensitivity. It returns a value that is less than
6630 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
6631 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
6632 <tag/Notes/<itemize>
6633 <item>The function is only available as fastcall function, so it may only
6634 be used in presence of a prototype.
6635 <item>The function is not available in strict ANSI mode.
6637 <tag/Availability/cc65
6639 <ref id="strcmp" name="strcmp">,
6640 <ref id="strcoll" name="strcoll">,
6641 <ref id="stricmp" name="stricmp">,
6642 <ref id="strncmp" name="strncmp">,
6643 <ref id="strxfrm" name="strxfrm">
6649 <sect1>strcat<label id="strcat"><p>
6653 <tag/Function/Concatentate two strings.
6654 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6655 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
6656 <tag/Description/The <tt/strcat/ function appends a copy of the string
6657 pointed to by s2 (including the terminating null byte) to the end of the
6658 string pointed to by s1. The initial byte of s2 overwrites the null byte at
6660 <tag/Notes/<itemize>
6661 <item>The function is only available as fastcall function, so it may only
6662 be used in presence of a prototype.
6663 <item>If copying takes place between objects that overlap, the behaviour
6666 <tag/Availability/ISO 9899
6668 <ref id="strcpy" name="strcpy">,
6669 <ref id="strncat" name="strncat">,
6670 <ref id="strncpy" name="strncpy">
6676 <sect1>strchr<label id="strchr"><p>
6680 <tag/Function/Search for a character in a string.
6681 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6682 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
6683 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
6684 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6685 byte is considered to be part of the string. Upon completion, the function
6686 returns a pointer to the byte, or a null pointer if the byte was not found.
6687 <tag/Notes/<itemize>
6688 <item>The function is only available as fastcall function, so it may only
6689 be used in presence of a prototype.
6691 <tag/Availability/ISO 9899
6693 <ref id="memchr" name="memchr">,
6694 <ref id="strrchr" name="strrchr">
6700 <sect1>strcmp<label id="strcmp"><p>
6704 <tag/Function/Compare two strings.
6705 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6706 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
6707 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
6708 parameters. It returns a value that is less than zero if <tt/s1/ is less than
6709 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
6710 if <tt/s1/ is greater than <tt/s2/.
6711 <tag/Notes/<itemize>
6712 <item>The function is only available as fastcall function, so it may only
6713 be used in presence of a prototype.
6715 <tag/Availability/ISO 9899
6717 <ref id="strcasecmp" name="strcasecmp">,
6718 <ref id="strcoll" name="strcoll">,
6719 <ref id="stricmp" name="stricmp">,
6720 <ref id="strncmp" name="strncmp">
6721 <ref id="strxfrm" name="strxfrm">
6727 <sect1>strcoll<label id="strcoll"><p>
6731 <tag/Function/Compare two strings.
6732 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6733 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
6734 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
6735 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
6736 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
6737 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
6738 than zero if <tt/s1/ is greater than <tt/s2/.
6739 <tag/Notes/<itemize>
6740 <item>The function is only available as fastcall function, so it may only
6741 be used in presence of a prototype.
6743 <tag/Availability/ISO 9899
6745 <ref id="setlocale" name="setlocale">,
6746 <ref id="strcasecmp" name="strcasecmp">,
6747 <ref id="strcmp" name="strcmp">,
6748 <ref id="stricmp" name="stricmp">,
6749 <ref id="strncmp" name="strncmp">,
6750 <ref id="strxfrm" name="strxfrm">
6756 <sect1>strcpy<label id="strcpy"><p>
6760 <tag/Function/Copy a string.
6761 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6762 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
6763 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
6764 <tt/s2/ (including the terminating null byte) into the array pointed to by
6765 <tt/s1/. The function will always return <tt/s1/.
6766 <tag/Notes/<itemize>
6767 <item>The function is only available as fastcall function, so it may only
6768 be used in presence of a prototype.
6769 <item>If copying takes place between objects that overlap, the behaviour
6772 <tag/Availability/ISO 9899
6774 <ref id="strcat" name="strcat">,
6775 <ref id="strncat" name="strncat">,
6776 <ref id="strncpy" name="strncpy">
6779 #include <string.h>
6781 static char hello[14];
6783 strcpy (hello, "Hello world!\n");
6789 <sect1>strcspn<label id="strcspn"><p>
6793 <tag/Function/Compute the length of a substring.
6794 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6795 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
6796 <tag/Description/The <tt/strcspn/ function computes and returns the length of
6797 the substring pointed to by <tt/s/ which does <em>not</em> consist of
6798 characters contained in the string <tt/set/.
6799 <tag/Notes/<itemize>
6800 <item>The function is only available as fastcall function, so it may only
6801 be used in presence of a prototype.
6803 <tag/Availability/ISO 9899
6805 <ref id="strqtok" name="strqtok">,
6806 <ref id="strspn" name="strspn">,
6807 <ref id="strstr" name="strstr">,
6808 <ref id="strtok" name="strtok">
6814 <sect1>strdup<label id="strdup"><p>
6818 <tag/Function/Allocate a copy of a string on the heap.
6819 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6820 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
6821 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
6822 to hold a copy of <tt/s/ including the terminating zero. If the allocation
6823 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
6824 memory block, and a pointer to the block is returned.
6825 <tag/Notes/<itemize>
6826 <item>The function is only available as fastcall function, so it may only
6827 be used in presence of a prototype.
6828 <item>It is up to the caller to free the allocated memory block.
6830 <tag/Availability/ISO 9899
6832 <ref id="free" name="free">,
6833 <ref id="malloc" name="malloc">
6839 <sect1>strerror<label id="strerror"><p>
6843 <tag/Function/Return a string describing an error code.
6844 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6845 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
6846 <tag/Description/The <tt/strerror/ function returns a string describing the
6847 given error code. If an invalid error code is passed, the string "Unknown
6848 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
6849 <tt/errno/ is left untouched.
6850 <tag/Notes/<itemize>
6851 <item>The function is only available as fastcall function, so it may only
6852 be used in presence of a prototype.
6853 <item>While the return type of the function is a <tt/char*/, the returned
6854 string must not be modified by the caller!
6856 <tag/Availability/ISO 9899
6858 <ref id="_stroserror" name="_stroserror">
6864 <sect1>stricmp<label id="stricmp"><p>
6868 <tag/Function/Compare two strings case insensitive.
6869 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6870 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
6871 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
6872 parameters without case sensitivity. It returns a value that is less than zero
6873 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
6874 value greater than zero if <tt/s1/ is greater than <tt/s2/.
6875 <tag/Notes/<itemize>
6876 <item>The function is only available as fastcall function, so it may only
6877 be used in presence of a prototype.
6878 <item>The function is not available in strict ANSI mode.
6880 <tag/Availability/cc65
6882 <ref id="strcasecmp" name="strcasecmp">,
6883 <ref id="strcmp" name="strcmp">,
6884 <ref id="strcoll" name="strcoll">,
6885 <ref id="strncmp" name="strncmp">,
6886 <ref id="strxfrm" name="strxfrm">
6892 <sect1>strlen<label id="strlen"><p>
6896 <tag/Function/Return the length of a string.
6897 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6898 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
6899 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
6900 string to which s points, not including the terminating null byte.
6901 <tag/Notes/<itemize>
6902 <item>The function is only available as fastcall function, so it may only
6903 be used in presence of a prototype.
6904 <item>When compiling with <tt/-Os/ (inline known standard functions), the
6905 function does not work correctly for strings with more than 255 characters.
6907 <tag/Availability/ISO 9899
6909 <ref id="strcpy" name="strcpy">
6915 <sect1>strlower<label id="strlower"><p>
6919 <tag/Function/Make a string lower case.
6920 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6921 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
6922 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
6923 function to each character of a string. The function will always return <tt/s/.
6924 <tag/Notes/<itemize>
6925 <item>The function is only available as fastcall function, so it may only
6926 be used in presence of a prototype.
6927 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6928 <item>An alias name for this function is <tt/strlwr/.
6930 <tag/Availability/cc65
6932 <ref id="strupper" name="strupper">,
6933 <ref id="tolower" name="tolower">
6939 <sect1>strlwr<label id="strlwr"><p>
6946 <sect1>strncasecmp<label id="strncasecmp"><p>
6950 <tag/Function/Compare two strings case insensitive.
6951 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6952 <tag/Declaration/<tt/int __fastcall__ strncasecmp (const char* s1, const char* s2, size_t count);/
6953 <tag/Description/The <tt/strncasecmp/ function compares the two strings passed
6954 as parameters without case sensitivity. It returns a value that is less than
6955 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
6956 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
6957 <tag/Notes/<itemize>
6958 <item>The function is only available as fastcall function, so it may only
6959 be used in presence of a prototype.
6960 <item>The function is not available in strict ANSI mode.
6962 <tag/Availability/cc65
6964 <ref id="strcmp" name="strcmp">,
6965 <ref id="strcoll" name="strcoll">,
6966 <ref id="stricmp" name="stricmp">,
6967 <ref id="strncmp" name="strncmp">,
6968 <ref id="strxfrm" name="strxfrm">
6974 <sect1>strncat<label id="strncat"><p>
6978 <tag/Function/Concatentate two strings.
6979 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6980 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
6981 <tag/Description/The <tt/strncat/ function appends not more than n characters
6982 of the string pointed to by s2 to the end of the string pointed to by s1. The
6983 terminating null character at the end of s1 is overwritten. A terminating null
6984 character is appended to the result, even if not all of s2 is appended to s1.
6985 <tag/Notes/<itemize>
6986 <item>The function is only available as fastcall function, so it may only
6987 be used in presence of a prototype.
6988 <item>If copying takes place between objects that overlap, the behaviour
6991 <tag/Availability/ISO 9899
6993 <ref id="strcpy" name="strcpy">,
6994 <ref id="strncat" name="strncat">,
6995 <ref id="strncpy" name="strncpy">
7001 <sect1>strncmp<label id="strncmp"><p>
7005 <tag/Function/Compare two strings.
7006 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7007 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
7008 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
7009 characters of the two strings passed as parameters. It returns a value that is
7010 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
7011 <tt/s2/, zero if they are identical, and a value greater than zero they are
7013 <tag/Notes/<itemize>
7014 <item>The function is only available as fastcall function, so it may only
7015 be used in presence of a prototype.
7017 <tag/Availability/ISO 9899
7019 <ref id="strcasecmp" name="strcasecmp">,
7020 <ref id="strcmp" name="strcmp">,
7021 <ref id="strcoll" name="strcoll">,
7022 <ref id="stricmp" name="stricmp">,
7023 <ref id="strxfrm" name="strxfrm">
7029 <sect1>strncpy<label id="strncpy"><p>
7033 <tag/Function/Copy part of a string.
7034 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7035 <tag/Declaration/<tt/char* __fastcall__ strncpy (char* s1, const char* s2, size_t n);/
7036 <tag/Description/The <tt/strncpy/ function copies not more than <tt/n/ bytes from
7037 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
7038 pointed to by <tt/s2/ is a string that is shorter than <tt/n/ bytes, null bytes are
7039 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
7040 written. The function always will return <tt/s1/.
7041 <tag/Notes/<itemize>
7042 <item>The function is available only as a fastcall function; so, it may be used
7043 only in the presence of a prototype.
7044 <item>If there is no null byte in the first <tt/n/ bytes of the array pointed
7045 to by <tt/s2/, the result is <em/not/ null-terminated!
7046 <item>If copying takes place between objects that overlap, the behaviour is
7049 <tag/Availability/ISO 9899
7051 <ref id="memcpy" name="memcpy">,
7052 <ref id="strcat" name="strcat">,
7053 <ref id="strcpy" name="strcpy">,
7054 <ref id="strncat" name="strncat">
7059 static char hello[6];
7061 strncpy (hello, "Hello world!\n", sizeof hello - 1)[5] = '\0';
7067 <sect1>strnicmp<label id="strnicmp"><p>
7071 <tag/Function/Compare two strings case insensitive.
7072 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7073 <tag/Declaration/<tt/int __fastcall__ strnicmp (const char* s1, const char* s2, size_t count);/
7074 <tag/Description/The <tt/strnicmp/ function compares the two strings passed as
7075 parameters without case sensitivity. It returns a value that is less than zero
7076 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
7077 value greater than zero if <tt/s1/ is greater than <tt/s2/.
7078 <tag/Notes/<itemize>
7079 <item>The function is only available as fastcall function, so it may only
7080 be used in presence of a prototype.
7081 <item>The function is not available in strict ANSI mode.
7083 <tag/Availability/cc65
7085 <ref id="strcasecmp" name="strcasecmp">,
7086 <ref id="strcmp" name="strcmp">,
7087 <ref id="strcoll" name="strcoll">,
7088 <ref id="strncmp" name="strncmp">,
7089 <ref id="strxfrm" name="strxfrm">
7095 <sect1>strqtok<label id="strqtok"><p>
7099 <tag/Function/Break a string into tokens.
7100 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7101 <tag/Declaration/<tt/char* __fastcall__ strqtok (char* s1, const char* s2);/
7102 <tag/Description/<tt/strqtok()/ will break the string <tt/s1/ into a sequence of
7103 tokens, which are delimited by either quotation marks or characters from the
7104 string <tt/s2/. Tokens inside quotation marks may contain characters from <tt/s2/
7105 (they aren't delimiters there). The first call to <tt/strqtok()/ will return a
7106 pointer to the first token in the string <tt/s1/. The following calls must pass
7107 a <tt/NULL/ pointer as <tt/s1/, in order to get the next token in the string.
7108 Different sets of delimiters may be used for the subsequent calls to <tt/strqtok()/.
7109 <tag/Notes/<itemize>
7110 <item>The function is available only as a fastcall function; so, it may be used
7111 only in the presence of a prototype.
7112 <item><tt/strqtok()/ will modify the string <tt/s1/.
7113 <item>The function will forget where it is in the <tt/s1/ string if it is given
7114 a second <tt/s1/ string before it finishes the first one.
7116 <tag/Availability/cc65
7118 <ref id="strcspn" name="strcspn">,
7119 <!-- <ref id="strpbrk" name="strpbrk">, -->
7120 <ref id="strspn" name="strspn">,
7121 <ref id="strtok" name="strtok">
7127 <sect1>strrchr<label id="strrchr"><p>
7131 <tag/Function/Search for a character in a string.
7132 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7133 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
7134 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
7135 (converted to a char) in the string pointed to by <tt/s/. The terminating null
7136 byte is considered to be part of the string. Upon completion, the function
7137 returns a pointer to the byte, or a null pointer if the byte was not found.
7138 <tag/Notes/<itemize>
7139 <item>The function is only available as fastcall function, so it may only
7140 be used in presence of a prototype.
7142 <tag/Availability/ISO 9899
7144 <ref id="strchr" name="strchr">
7150 <sect1>strspn<label id="strspn"><p>
7154 <tag/Function/Compute the length of a substring.
7155 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7156 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
7157 <tag/Description/The <tt/strspn/ function computes and returns the length of
7158 the substring pointed to by <tt/s/ which does consist only of characters
7159 contained in the string <tt/set/.
7160 <tag/Notes/<itemize>
7161 <item>The function is only available as fastcall function, so it may only
7162 be used in presence of a prototype.
7164 <tag/Availability/ISO 9899
7166 <ref id="strcspn" name="strcspn">,
7167 <ref id="strstr" name="strstr">
7173 <sect1>strstr<label id="strstr"><p>
7177 <tag/Function/Find a substring.
7178 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7179 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
7180 <tag/Description/<tt/strstr/ searches for the first occurance of the string
7181 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
7182 otherwise it returns <tt/NULL/.
7183 <tag/Notes/<itemize>
7184 <item>The function is only available as fastcall function, so it may only
7185 be used in presence of a prototype.
7187 <tag/Availability/ISO 9899
7189 <ref id="strcspn" name="strcspn">,
7190 <ref id="strspn" name="strspn">
7196 <sect1>strtok<label id="strtok"><p>
7200 <tag/Function/Break a string into tokens.
7201 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7202 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
7203 <tag/Description/<tt/strtok()/ will break the string <tt/s1/ into a sequence of
7204 tokens, which are delimited by characters from the string <tt/s2/. The first call
7205 to <tt/strtok()/ will return a pointer to the first token in the string <tt/s1/.
7206 The following calls must pass a <tt/NULL/ pointer as <tt/s1/, in order to get
7207 the next token in the string. Different sets of delimiters may be used for the
7208 subsequent calls to <tt/strtok()/.
7209 <tag/Notes/<itemize>
7210 <item>The function is only available as fastcall function, so it may only
7211 be used in presence of a prototype.
7212 <item><tt/strtok()/ will modify the string <tt/s1/.
7213 <item>The function will forget where it is in the <tt/s1/ string if it is given
7214 a second <tt/s1/ string before it finishes the first one.
7216 <tag/Availability/ISO 9899
7218 <ref id="strcspn" name="strcspn">,
7219 <!-- <ref id="strpbrk" name="strpbrk">, -->
7220 <ref id="strqtok" name="strqtok">,
7221 <ref id="strspn" name="strspn">
7227 <sect1>strxfrm<label id="strxfrm"><p>
7231 <tag/Function/Transform a string.
7232 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7233 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
7234 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
7235 s2 and places the resulting string into the string pointed to by s1. The
7236 transformation is such that if the <tt/strcmp/ function is applied to two
7237 transformed strings, it returns a value greater than, equal to, or less than
7238 zero, corresponding to the result of the <tt/strcoll/ function applied to the
7239 same two original strings. No more than n characters are placed into the
7240 resulting array pointed to by s1, including the terminating null character.
7241 <tag/Notes/<itemize>
7242 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
7243 the behaviour is undefined.
7244 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
7245 <item>The function is only available as fastcall function, so it may only
7246 be used in presence of a prototype.
7247 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
7248 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
7250 <tag/Availability/ISO 9899
7252 <ref id="strcmp" name="strcmp">,
7253 <ref id="strcoll" name="strcoll">,
7254 <ref id="strncpy" name="strncpy">
7260 <sect1>strupper<label id="strupper"><p>
7264 <tag/Function/Make a string upper case.
7265 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7266 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
7267 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
7268 function to each character of a string. The function will always return <tt/s/.
7269 <tag/Notes/<itemize>
7270 <item>The function is only available as fastcall function, so it may only
7271 be used in presence of a prototype.
7272 <item>The function prototype is unavailable when compiling in strict ANSI mode.
7273 <item>An alias name for this function is <tt/strupr/.
7275 <tag/Availability/cc65
7277 <ref id="strlower" name="strlower">
7278 <ref id="toupper" name="toupper">
7284 <sect1>strupr<label id="strupr"><p>
7291 <sect1>telldir<label id="telldir"><p>
7295 <tag/Function/Return the current position of a directory stream.
7296 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
7297 <tag/Declaration/<tt/long __fastcall__ telldir (DIR* dir);/
7298 <tag/Description/<tt/telldir/ returns the current position of a directory
7299 stream. The return value may be used in subsequent calls to
7300 <tt/<ref id="seekdir" name="seekdir">/.
7301 <tag/Notes/<itemize>
7302 <item>The function is only available as fastcall function, so it may only
7303 be used in presence of a prototype.
7305 <tag/Availability/POSIX 1003.1
7307 <ref id="seekdir" name="seekdir">,
7308 <ref id="telldir" name="telldir">
7314 <sect1>textcolor<label id="textcolor"><p>
7318 <tag/Function/Set the text color.
7319 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7320 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
7321 <tag/Description/The function will set a new text color. It returns the old
7322 (current) text color. Text output using any <tt/conio.h/ function will use
7323 the color set by this function.
7324 <tag/Notes/<itemize>
7325 <item>Text colors are system dependent. The function may have no effect
7326 on systems where the text color cannot be changed.
7327 <item>The function is only available as fastcall function, so it may only
7328 be used in presence of a prototype.
7330 <tag/Availability/cc65
7332 <ref id="bgcolor" name="bgcolor">,
7333 <ref id="bordercolor" name="bordercolor">
7339 <sect1>time<label id="time"><p>
7343 <tag/Function/Get the time.
7344 <tag/Header/<tt/<ref id="time.h" name="time.h">/
7345 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
7346 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
7347 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
7348 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
7349 returned and <tt/errno/ is set to <tt/ENOSYS/.
7350 <tag/Notes/<itemize>
7351 <item>The function is only available as fastcall function, so it may
7352 only be used in presence of a prototype.
7353 <item>Many platforms supported by cc65 do not have a realtime clock, so the
7354 returned value may not be valid.
7356 <tag/Availability/ISO 9899
7358 <ref id="clock" name="clock">
7364 <sect1>toggle_videomode<label id="toggle_videomode"><p>
7368 <tag/Function/Toggle between 40 and 80 column mode.
7369 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
7370 <tag/Declaration/<tt/void toggle_videomode (void);/
7371 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
7372 old mode (cursor position, color and so on) are saved and restored together
7374 <tag/Notes/<itemize>
7375 <item>The function is specific to the C128.
7376 <item>This function is deprecated. Please use <ref id="videomode"
7377 name="videomode"> instead!
7379 <tag/Availability/C128
7381 <ref id="fast" name="fast">,
7382 <ref id="isfast" name="isfast">,
7383 <ref id="slow" name="slow">,
7384 <ref id="videomode" name="videomode">
7390 <sect1>tolower<label id="tolower"><p>
7394 <tag/Function/Convert a character into its lower case representation.
7395 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7396 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
7397 <tag/Description/The function returns the given character converted to lower
7398 case. If the given character is not a letter, it is returned unchanged.
7399 <tag/Notes/<itemize>
7400 <item>The function is only available as fastcall function, so it may
7401 only be used in presence of a prototype.
7403 <tag/Availability/ISO 9899
7405 <ref id="islower" name="islower">,
7406 <ref id="isupper" name="isupper">,
7407 <ref id="toupper" name="toupper">
7413 <sect1>toupper<label id="toupper"><p>
7417 <tag/Function/Convert a character into its upper case representation.
7418 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7419 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
7420 <tag/Description/The function returns the given character converted to upper
7421 case. If the given character is not a letter, it is returned unchanged.
7422 <tag/Notes/<itemize>
7423 <item>The function is only available as fastcall function, so it may
7424 only be used in presence of a prototype.
7426 <tag/Availability/ISO 9899
7428 <ref id="islower" name="islower">,
7429 <ref id="isupper" name="isupper">,
7430 <ref id="tolower" name="tolower">
7436 <sect1>ultoa<label id="ultoa"><p>
7440 <tag/Function/Convert an unsigned long integer into a string.
7441 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7442 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
7443 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
7444 string using <tt/radix/ as the base.
7445 <tag/Notes/<itemize>
7446 <item>There are no provisions to prevent a buffer overflow.
7447 <item>The function is non standard, so it is not available in strict ANSI mode.
7448 You should probably use <tt/sprintf/ instead.
7449 <item>The function is only available as fastcall function, so it may only be
7450 used in presence of a prototype.
7452 <tag/Availability/cc65
7454 <ref id="atoi" name="atoi">,
7455 <ref id="atol" name="atol">,
7456 <ref id="itoa" name="itoa">,
7457 <ref id="ltoa" name="ltoa">,
7458 <ref id="utoa" name="utoa">
7464 <sect1>unlink<label id="unlink"><p>
7468 <tag/Function/Delete a file.
7469 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
7470 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
7471 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
7472 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
7473 code describing the reason for the failure.
7474 <tag/Notes/<itemize>
7475 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
7476 name="remove">/ instead, which is a native ANSI C function and does the same.
7477 <item>This function is not available on all cc65 targets (depends on the
7478 availability of file I/O).
7479 <item>The function is only available as fastcall function, so it may only
7480 be used in presence of a prototype.
7481 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
7482 used, which has the same semantics, but is more portable, because it conforms
7483 to the ISO C standard.
7485 <tag/Availability/POSIX 1003.1
7487 <ref id="remove" name="remove">
7490 #include <stdio.h>
7491 #include <unistd.h>
7493 #define FILENAME "helloworld"
7495 if (unlink (FILENAME) == 0) {
7496 printf ("We deleted %s successfully\n", FILENAME);
7498 printf ("There was a problem deleting %s\n", FILENAME);
7505 <sect1>utoa<label id="utoa"><p>
7509 <tag/Function/Convert an unsigned integer into a string.
7510 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7511 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
7512 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
7513 using <tt/radix/ as the base.
7514 <tag/Notes/<itemize>
7515 <item>There are no provisions to prevent a buffer overflow.
7516 <item>The function is non standard, so it is not available in strict ANSI mode.
7517 You should probably use <tt/sprintf/ instead.
7518 <item>The function is only available as fastcall function, so it may only be
7519 used in presence of a prototype.
7521 <tag/Availability/cc65
7523 <ref id="atoi" name="atoi">,
7524 <ref id="atol" name="atol">,
7525 <ref id="itoa" name="itoa">,
7526 <ref id="ltoa" name="ltoa">,
7527 <ref id="ultoa" name="ultoa">
7533 <sect1>vcprintf<label id="vcprintf"><p>
7537 <tag/Function/Formatted output to the console.
7538 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7539 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
7540 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
7541 text where necessary and formatted according to the format string given. The
7542 resulting string is output to the console. <tt/vcprintf/ supports the same
7543 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
7544 <tag/Notes/<itemize>
7545 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
7546 between <tt/\r/ and <tt/\n/.
7547 <item>The function is only available as fastcall function, so it may only be
7548 used in presence of a prototype.
7550 <tag/Availability/cc65
7552 <ref id="cprintf" name="cprintf">,
7553 <ref id="cputc" name="cputc">,
7554 <ref id="cputcxy" name="cputcxy">,
7555 <ref id="cputs" name="cputs">,
7556 <ref id="cputsxy" name="cputsxy">
7562 <sect1>videomode<label id="videomode"><p>
7566 <tag/Function/Switch to either 40 or 80 column mode.
7567 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
7568 <ref id="c128.h" name="c128.h">/
7569 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
7570 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
7571 the requested mode is already active, nothing happens. The old mode is returned
7573 <tag/Notes/<itemize>
7574 <item>The function is specific to the C128 and enhanced Apple //e.
7575 <item>This function replaces <ref id="toggle_videomode"
7576 name="toggle_videomode">.
7577 <item>The function is only available as fastcall function, so it may only be
7578 used in presence of a prototype.
7580 <tag/Availability/C128 and enhanced Apple //e
7582 <ref id="fast" name="fast">,
7583 <ref id="isfast" name="isfast">,
7584 <ref id="slow" name="slow">,
7585 <ref id="toggle_videomode" name="toggle_videomode">
7591 <sect1>waitvsync<label id="waitvsync"><p>
7595 <tag/Function/Wait until the start of the next frame.
7597 <tt/<ref id="cbm.h" name="cbm.h">/,
7598 <tt/<ref id="gamate.h" name="gamate.h">/,
7599 <tt/<ref id="nes.h" name="nes.h">/,
7600 <tt/<ref id="pce.h" name="pce.h">/
7601 <tag/Declaration/<tt/void waitvsync (void);/
7602 <tag/Description/Wait for vertical sync to reduce flickering.
7603 <tag/Availability/Platforms above
7609 <sect1>wherex<label id="wherex"><p>
7613 <tag/Function/Return the current X position of the text mode cursor.
7614 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7615 <tag/Declaration/<tt/unsigned char wherex (void);/
7616 <tag/Description/The function returns the current X position of the text mode
7617 cursor. Zero is returned for the leftmost screen position.
7618 <tag/Availability/cc65
7620 <ref id="gotox" name="gotox">,
7621 <ref id="gotoy" name="gotoy">,
7622 <ref id="gotoxy" name="gotoxy">,
7623 <ref id="wherey" name="wherey">
7629 <sect1>wherey<label id="wherey"><p>
7633 <tag/Function/Return the current Y position of the text mode cursor.
7634 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7635 <tag/Declaration/<tt/unsigned char wherey (void);/
7636 <tag/Description/The function returns the current Y position of the text mode
7637 cursor. Zero is returned for the uppermost screen position.
7638 <tag/Availability/cc65
7640 <ref id="gotox" name="gotox">,
7641 <ref id="gotoy" name="gotoy">,
7642 <ref id="gotoxy" name="gotoxy">,
7643 <ref id="wherex" name="wherex">