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="strpbrk" name="strpbrk">
721 <item><ref id="strqtok" name="strqtok">
722 <item><ref id="strrchr" name="strrchr">
723 <item><ref id="strspn" name="strspn">
724 <item><ref id="strstr" name="strstr">
725 <item><ref id="strtok" name="strtok">
726 <item><ref id="strxfrm" name="strxfrm">
727 <item><ref id="strupper" name="strupper">
728 <item><ref id="strupr" name="strupr">
732 <sect1><tt/telestrat.h/<label id="telestrat.h"><p>
735 <item><ref id="atmos_explode" name="explode">
736 <item><ref id="atmos_ping" name="ping">
737 <item><ref id="atmos_shoot" name="shoot">
738 <item><ref id="atmos_zap" name="zap">
739 <!-- <item><ref id="kbdclick1" name="kbdclick1"> -->
740 <!-- <item><ref id="oups" name="oups"> -->
746 <sect1><tt/tgi.h/<label id="tgi.h"><p>
748 <url url="tgi.html" name="Tiny Graphics Interface">.
751 <sect1><tt/time.h/<label id="time.h"><p>
754 <!-- <item><ref id="_systime" name="_systime"> -->
755 <!-- <item><ref id="asctime" name="asctime"> -->
756 <item><ref id="clock" name="clock">
757 <!-- <item><ref id="ctime" name="ctime"> -->
758 <!-- <item><ref id="gmtime" name="gmtime"> -->
759 <!-- <item><ref id="localtime" name="localtime"> -->
760 <!-- <item><ref id="mktime" name="mktime"> -->
761 <!-- <item><ref id="strftime" name="strftime"> -->
762 <item><ref id="time" name="time">
768 <sect1><tt/unistd.h/<label id="unistd.h"><p>
771 <!-- <item><ref id="chdir" name="chdir"> -->
772 <item><ref id="exec" name="exec">
773 <item><ref id="getcwd" name="getcwd">
774 <item><ref id="getopt" name="getopt">
775 <!-- <item><ref id="lseek" name="lseek"> -->
776 <!-- <item><ref id="mkdir" name="mkdir"> -->
777 <!-- <item><ref id="read" name="read"> -->
778 <!-- <item><ref id="rmdir" name="rmdir"> -->
779 <item><ref id="sleep" name="sleep">
780 <item><ref id="unlink" name="unlink">
781 <!-- <item><ref id="write" name="write"> -->
787 <sect1><tt/vic20.h/<label id="vic20.h"><p>
792 <sect1><tt/zlib.h/<label id="zlib.h"><p>
795 <!-- <item><ref id="adler32" name="adler32"> -->
796 <!-- <item><ref id="crc32" name="crc32"> -->
797 <!-- <item><ref id="inflatemem" name="inflatemem"> -->
798 <!-- <item><ref id="uncompress" name="uncompress"> -->
804 <sect>Alphabetical function reference<p>
806 <sect1>_DE_ISDIR<label id="_DE_ISDIR"><p>
810 <tag/Function/Determine if a directory entry specifies a directory.
811 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
812 <tag/Declaration/<tt/int _DE_ISDIR(unsigned char type);/
813 <tag/Description/The function is called with the type of a directory entry
814 taken from a <tt/struct dirent/ and returns true if the entry designates
817 <item>The function is actually a macro.
819 <tag/Availability/cc65
821 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
822 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
823 <ref id="_DE_ISREG" name="_DE_ISREG">
829 <sect1>_DE_ISLBL<label id="_DE_ISLBL"><p>
833 <tag/Function/Determine if a directory entry specifies a disk label.
834 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
835 <tag/Declaration/<tt/int _DE_ISLBL(unsigned char type);/
836 <tag/Description/The function is called with the type of a directory entry
837 taken from a <tt/struct dirent/ and returns true if the entry designates
840 <item>The function is actually a macro.
842 <tag/Availability/cc65
844 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
845 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
846 <ref id="_DE_ISREG" name="_DE_ISREG">
852 <sect1>_DE_ISLNK<label id="_DE_ISLNK"><p>
856 <tag/Function/Determine if a directory entry specifies a link.
857 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
858 <tag/Declaration/<tt/int _DE_ISLNK(unsigned char type);/
859 <tag/Description/The function is called with the type of a directory entry
860 taken from a <tt/struct dirent/ and returns true if the entry designates
863 <item>The function is actually a macro.
865 <tag/Availability/cc65
867 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
868 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
869 <ref id="_DE_ISREG" name="_DE_ISREG">
875 <sect1>_DE_ISREG<label id="_DE_ISREG"><p>
879 <tag/Function/Determine if a directory entry specifies a regular file.
880 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
881 <tag/Declaration/<tt/int _DE_ISREG(unsigned char type);/
882 <tag/Description/The function is called with the type of a directory entry
883 taken from a <tt/struct dirent/ and returns true if the entry designates
886 <item>The function is actually a macro.
887 <item>A "regular file" means anything with data in it. This might still mean
888 that special processing is needed, when accessing the file. Relative files of
889 the CBM systems are classified as being "regular" files, for example.
891 <tag/Availability/cc65
893 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
894 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
895 <ref id="_DE_ISLNK" name="_DE_ISLNK">
901 <sect1>_heapadd<label id="_heapadd"><p>
905 <tag/Function/Add a block to the heap.
906 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
907 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
908 <tag/Description/The function adds a block of raw memory to the heap.
910 <item>The minimum blocksize that can be added is 6 bytes; the function will
911 ignore smaller blocks.
912 <item>The function is available only as a fastcall function; so, it may be used
913 only in the presence of a prototype.
915 <tag/Availability/cc65
917 <ref id="_heapblocksize" name="_heapblocksize">,
918 <ref id="_heapmaxavail" name="_heapmaxavail">,
919 <ref id="_heapmemavail" name="_heapmemavail">,
920 <ref id="calloc" name="calloc">,
921 <ref id="free" name="free">,
922 <ref id="malloc" name="malloc">,
923 <ref id="realloc" name="realloc">
929 <sect1>_heapblocksize<label id="_heapblocksize"><p>
933 <tag/Function/Return the size of an allocated block.
934 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
935 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
936 <tag/Description/The function returns the size of a block that must have
937 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
938 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
940 <item>Passing a pointer to a block that was is not the result of one of the
941 allocation functions, or that has been free'd will give unpredicable results.
942 <item>The function is available only as a fastcall function; so, it may be used
943 only in the presence of a prototype.
945 <tag/Availability/cc65
947 <ref id="_heapadd" name="_heapadd">,
948 <ref id="_heapmaxavail" name="_heapmaxavail">,
949 <ref id="_heapmemavail" name="_heapmemavail">,
950 <ref id="calloc" name="calloc">,
951 <ref id="free" name="free">,
952 <ref id="malloc" name="malloc">,
953 <ref id="realloc" name="realloc">
959 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
963 <tag/Function/Return the largest block that is available on the heap.
964 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
965 <tag/Declaration/<tt/size_t _heapmaxavail (void);/
966 <tag/Description/The function returns the size of the largest block that may
967 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
968 <tag/Availability/cc65
970 <ref id="_heapadd" name="_heapadd">,
971 <ref id="_heapblocksize" name="_heapblocksize">,
972 <ref id="_heapmemavail" name="_heapmemavail">,
973 <ref id="calloc" name="calloc">,
974 <ref id="free" name="free">,
975 <ref id="malloc" name="malloc">,
976 <ref id="realloc" name="realloc">
982 <sect1>_heapmemavail<label id="_heapmemavail"><p>
986 <tag/Function/Return the total available space on the heap.
987 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
988 <tag/Declaration/<tt/size_t _heapmemavail (void);/
989 <tag/Description/The function returns the total number of bytes available on
992 <item>This function is of less use than usually assumed, since the returned
993 heap space may be available but not in one block. So even if this function
994 says that several times more heap space is available than needed, <ref
995 id="malloc" name="malloc"> may still return <tt/NULL/.
997 <tag/Availability/cc65
999 <ref id="_heapadd" name="_heapadd">,
1000 <ref id="_heapblocksize" name="_heapblocksize">,
1001 <ref id="_heapmaxavail" name="_heapmaxavail">,
1002 <ref id="calloc" name="calloc">,
1003 <ref id="free" name="free">,
1004 <ref id="malloc" name="malloc">,
1005 <ref id="realloc" name="realloc">
1011 <sect1>_is_cmdline_dos<label id="_is_cmdline_dos"><p>
1015 <tag/Function/Determines whether the underlying DOS supports command line arguments.
1016 <tag/Header/<tt/<ref id="atari.h" name="atari.h">/
1017 <tag/Declaration/<tt/unsigned char _is_cmdline_dos (void);/
1018 <tag/Description/The function returns 0 if the DOS doesn't support command line arguments.
1019 It returns 1 if it does.
1020 <tag/Availability/cc65 (<tt/atari/ and <tt/atarixl/ platforms)
1025 <sect1>_poserror<label id="_poserror"><p>
1029 <tag/Function/Print an error message for the error in <tt/_oserror/.
1030 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1031 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
1032 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
1033 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
1034 a colon and a blank. Then the error message for the current contents of
1035 <tt/_oserror/ are printed followed by a newline. The message output is the
1036 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
1037 argument of <tt/_oserror/.
1038 <tag/Notes/<itemize>
1039 <item>Since operating system specific error code are - you guessed it -
1040 operating system specific, the value in <tt/_oserror/ and the message that is
1041 printed depends on the cc65 target.
1042 <item>The function is only available as fastcall function, so it may only
1043 be used in presence of a prototype.
1045 <tag/Availability/cc65
1047 <ref id="_stroserror" name="_stroserror">,
1048 <ref id="perror" name="perror">
1054 <sect1>_randomize<label id="_randomize"><p>
1058 <tag/Function/Initialize the pseudo random number generator.
1059 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1060 <tag/Declaration/<tt/void _randomize (void);/
1061 <tag/Description/The function initializes the random number generator with
1062 a seed derived from fast changing hardware events, so the seed itself can be
1063 considered random to a certain degree.
1064 <tag/Notes/<itemize>
1065 <item>The randomness of the seed depends on the machine hardware.
1067 <tag/Availability/cc65
1069 <ref id="rand" name="rand">,
1070 <ref id="srand" name="srand">
1076 <sect1>_stroserror<label id="_stroserror"><p>
1080 <tag/Function/Return a string describing an OS specific error code.
1081 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1082 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
1083 <tag/Description/<tt/_stroserror/ will return a string describing the given
1084 operating system specific error code.
1085 <tag/Notes/<itemize>
1086 <item>Since operating system specific error code are - you guessed it -
1087 operating system specific, the parameter and the string returned depend on the
1089 <item>The function is only available as fastcall function, so it may only be
1090 used in presence of a prototype.
1092 <tag/Availability/cc65
1094 <ref id="strerror" name="strerror">
1100 <sect1>_swap<label id="_swap"><p>
1104 <tag/Function/Swap the contents of memory areas.
1105 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1106 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
1107 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
1108 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
1109 <tt/size/ bytes in size.
1110 <tag/Notes/<itemize>
1111 <item>The memory areas may not overlap, otherwise the results are undefined.
1112 <item>The function is only available as fastcall function, so it may only be
1113 used in presence of a prototype.
1115 <tag/Availability/cc65
1117 <ref id="memcpy" name="memcpy">,
1118 <ref id="memmove" name="memmove">
1124 <sect1>_sys<label id="_sys"><p>
1128 <tag/Function/Call a subroutine passing register values.
1129 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1130 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
1131 <tag/Description/The function will call the subroutine at the address
1132 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
1133 registers and the CPU flags are set to the values given in the <tt/regs/
1134 structure. On return from the subroutine, the new values of the registers and
1135 flags are stored back overwriting the old values.
1136 <tag/Notes/<itemize>
1137 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
1138 when calling the subroutine (they are unchanged from their current values).
1139 <item>The function is only available as fastcall function, so it may only be
1140 used in presence of a prototype.
1142 <tag/Availability/cc65
1148 <sect1>BRK<label id="BRK"><p>
1152 <tag/Function/Insert a 6502 BRK instrunction into the code.
1153 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1154 <tag/Declaration/<tt/void BRK (void);/
1155 <tag/Description/The function will insert a 6502 BRK instruction into the code
1156 which may be used to trigger a debugger.
1157 <tag/Notes/<itemize>
1158 <item>The function is actually a macro.
1159 <item>The inserted instruction may lead to unexpected results if no debugger
1162 <tag/Availability/cc65
1164 <ref id="CLI" name="CLI">,
1165 <ref id="SEI" name="SEI">
1171 <sect1>CLI<label id="CLI"><p>
1175 <tag/Function/Insert a 6502 CLI instrunction into the code.
1176 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1177 <tag/Declaration/<tt/void CLI (void);/
1178 <tag/Description/The function will insert a 6502 CLI instruction into the code,
1179 so interrupts are enabled. Enabling interrupts has no effects if they are
1180 already enabled (the default).
1181 <tag/Notes/<itemize>
1182 <item>The function is actually a macro.
1183 <item>Disabling interrupts may lead to unexpected results.
1185 <tag/Availability/cc65
1187 <ref id="BRK" name="BRK">,
1188 <ref id="SEI" name="SEI">
1194 <sect1>PEEK<label id="PEEK"><p>
1198 <tag/Function/Read a byte from memory.
1199 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1200 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
1201 <tag/Description/The function will read the absolute memory given by <tt/addr/
1202 and return the value read.
1203 <tag/Notes/<itemize>
1204 <item>The function is actually a macro.
1205 <item>This function depends highly on the platform and environment.
1207 <tag/Availability/cc65
1209 <ref id="PEEKW" name="PEEKW">,
1210 <ref id="POKE" name="POKE">
1216 <sect1>PEEKW<label id="PEEKW"><p>
1220 <tag/Function/Read a word (two bytes) from memory.
1221 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1222 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
1223 <tag/Description/The function will read the absolute memory given by <tt/addr/
1224 and return the value read. The byte read from the higher address is the high
1225 byte of the return value.
1226 <tag/Notes/<itemize>
1227 <item>The function is actually a macro.
1228 <item>This function depends highly on the platform and environment.
1229 <item>The order in which the two bytes are read is unspecified and may
1230 depend of the address expression used.
1232 <tag/Availability/cc65
1234 <ref id="PEEK" name="PEEK">,
1235 <ref id="POKE" name="POKE">
1241 <sect1>POKE<label id="POKE"><p>
1245 <tag/Function/Write a byte to memory.
1246 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1247 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
1248 <tag/Description/The function writes the value <tt/val/ to the absolute
1249 memory address given by <tt/addr/.
1250 <tag/Notes/<itemize>
1251 <item>The function is actually a macro.
1252 <item>This function depends highly on the platform and environment.
1253 <item>Careless use will cause the program to act strange or may crash the
1256 <tag/Availability/cc65
1258 <ref id="PEEK" name="PEEK">,
1259 <ref id="POKEW" name="POKEW">
1265 <sect1>POKEW<label id="POKEW"><p>
1269 <tag/Function/Write a word (two bytes) to memory.
1270 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1271 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
1272 <tag/Description/The function writes the value <tt/val/ to the absolute
1273 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
1274 the <tt/addr/, the high byte is written to <tt/addr+1/.
1275 <tag/Notes/<itemize>
1276 <item>The function is actually a macro.
1277 <item>This function depends highly on the platform and environment.
1278 <item>Careless use will cause the program to act strange or may crash the
1280 <item>The order in which the two bytes are written is unspecified and may
1281 depend of the address expression used.
1283 <tag/Availability/cc65
1285 <ref id="PEEK" name="PEEK">,
1286 <ref id="POKE" name="POKE">
1292 <sect1>SEI<label id="SEI"><p>
1296 <tag/Function/Insert a 6502 SEI instrunction into the code.
1297 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1298 <tag/Declaration/<tt/void SEI (void);/
1299 <tag/Description/The function will insert a 6502 SEI instruction into the code,
1300 so interrupts are disabled. Note that non maskable interrupts cannot be
1302 <tag/Notes/<itemize>
1303 <item>The function is actually a macro.
1304 <item>Disabling interrupts may lead to unexpected results.
1306 <tag/Availability/cc65
1308 <ref id="BRK" name="BRK">,
1309 <ref id="CLI" name="CLI">
1315 <sect1>abort<label id="abort"><p>
1319 <tag/Function/Terminates a program abnormally.
1320 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1321 <tag/Declaration/<tt/void abort (void);/
1322 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
1323 on stderr, then terminates the program with an exit code of 3.
1324 <tag/Availability/ISO 9899
1326 <ref id="assert" name="assert">,
1327 <ref id="exit" name="exit">,
1328 <ref id="raise" name="raise">
1334 <sect1>abs<label id="abs"><p>
1338 <tag/Function/Returns the absolute value of an integer.
1339 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1340 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
1341 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
1343 <tag/Notes/<itemize>
1344 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
1345 <item>The function is only available as fastcall function, so it may only be
1346 used in presence of a prototype.
1348 <tag/Availability/ISO 9899
1350 <ref id="labs" name="labs">
1356 <sect1>assert<label id="assert"><p>
1360 <tag/Function/Test a condition and possibly abort.
1361 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
1362 <tag/Declaration/<tt/void assert (int cond);/
1363 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
1364 statement. If the condition evaluates t zero (false), assert prints a message
1365 on stderr and aborts the program.
1366 <tag/Notes/<itemize>
1367 <item>The function is actually a macro.
1369 <tag/Availability/ISO 9899
1371 <ref id="abort" name="abort">,
1372 <ref id="exit" name="exit">
1378 <sect1>atexit<label id="atexit"><p>
1382 <tag/Function/Register an exit function.
1383 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1384 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1385 <tag/Description/<tt/atexit/ registers the function pointed to by
1386 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1387 terminates, they are called in LIFO order (the last function registered is
1388 called first). <tt/atexit/ returns zero on success and a nonzero value on
1390 <tag/Notes/<itemize>
1391 <item>A maximum of 5 exit functions can be registered.
1392 <item>There is no way to unregister an exit function.
1393 <item>The function is only available as fastcall function, so it may only be
1394 used in presence of a prototype.
1396 <tag/Availability/ISO 9899
1398 <ref id="abort" name="abort">,
1399 <ref id="exit" name="exit">
1405 <sect1>atmos_explode<label id="atmos_explode"><p>
1409 <tag/Function/Bomb sound effect.
1410 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1411 <tag/Declaration/<tt/void __fastcall__ atmos_explode(void);/
1412 <tag/Description/<tt/atmos_explode/ plays the BASIC sound.
1413 <tag/Notes/<itemize>
1414 <item>The function is available only as a fastcall function; so, it may be used
1415 only in the presence of a prototype.
1417 <tag/Availability/cc65
1419 <ref id="atmos_ping" name="atmos_ping">,
1420 <ref id="atmos_shoot" name="atmos_shoot">,
1421 <ref id="atmos_tick" name="atmos_tick">,
1422 <ref id="atmos_tock" name="atmos_tock">,
1423 <ref id="atmos_zap" name="atmos_zap">
1429 <sect1>atmos_load<label id="atmos_load"><p>
1433 <tag/Function/Load Atmos tape.
1434 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1435 <tag/Declaration/<tt/void __fastcall__ atmos_load(const char* name);/
1436 <tag/Description/<tt/atmos_load/ reads a memory block from tape.
1437 <tag/Notes/<itemize>
1438 <item>The function is available only as a fastcall function; so, it may be used
1439 only in the presence of a prototype.
1441 <tag/Availability/cc65
1443 <ref id="atmos_save" name="atmos_save">
1449 <sect1>atmos_ping<label id="atmos_ping"><p>
1453 <tag/Function/Bell or ricochet sound effect.
1454 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1455 <tag/Declaration/<tt/void __fastcall__ atmos_ping(void);/
1456 <tag/Description/<tt/atmos_ping/ plays the BASIC sound.
1457 <tag/Notes/<itemize>
1458 <item>The function is available only as a fastcall function; so, it may be used
1459 only in the presence of a prototype.
1461 <tag/Availability/cc65
1463 <ref id="atmos_explode" name="atmos_explode">,
1464 <ref id="atmos_shoot" name="atmos_shoot">,
1465 <ref id="atmos_tick" name="atmos_tick">,
1466 <ref id="atmos_tock" name="atmos_tock">,
1467 <ref id="atmos_zap" name="atmos_zap">
1473 <sect1>atmos_save<label id="atmos_save"><p>
1477 <tag/Function/Save Atmos tape.
1478 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1479 <tag/Declaration/<tt/void __fastcall__ atmos_save(const char* name, const void* start, const void* end);/
1480 <tag/Description/<tt/atmos_save/ writes a memory block to tape.
1481 <tag/Notes/<itemize>
1482 <item>The function is available only as a fastcall function; so, it may be used
1483 only in the presence of a prototype.
1485 <tag/Availability/cc65
1487 <ref id="atmos_load" name="atmos_load">
1489 atmos_save("hires", 0xa000, 0xc000);
1495 <sect1>atmos_shoot<label id="atmos_shoot"><p>
1499 <tag/Function/Pistol sound effect.
1500 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1501 <tag/Declaration/<tt/void __fastcall__ atmos_shoot(void);/
1502 <tag/Description/<tt/atmos_shoot/ plays the BASIC sound.
1503 <tag/Notes/<itemize>
1504 <item>The function is available only as a fastcall function; so, it may be used
1505 only in the presence of a prototype.
1507 <tag/Availability/cc65
1509 <ref id="atmos_explode" name="atmos_explode">,
1510 <ref id="atmos_ping" name="atmos_ping">,
1511 <ref id="atmos_tick" name="atmos_tick">,
1512 <ref id="atmos_tock" name="atmos_tock">,
1513 <ref id="atmos_zap" name="atmos_zap">
1519 <sect1>atmos_tick<label id="atmos_tick"><p>
1523 <tag/Function/High-pitch click.
1524 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1525 <tag/Declaration/<tt/void __fastcall__ atmos_tick(void);/
1526 <tag/Description/<tt/atmos_tick/ plays the system sound.
1527 <tag/Notes/<itemize>
1528 <item>The function is available only as a fastcall function; so, it may be used
1529 only in the presence of a prototype.
1531 <tag/Availability/cc65
1533 <ref id="atmos_explode" name="atmos_explode">,
1534 <ref id="atmos_ping" name="atmos_ping">,
1535 <ref id="atmos_shoot" name="atmos_shoot">,
1536 <ref id="atmos_tock" name="atmos_tock">,
1537 <ref id="atmos_zap" name="atmos_zap">
1543 <sect1>atmos_tock<label id="atmos_tock"><p>
1547 <tag/Function/Low-pitch click.
1548 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1549 <tag/Declaration/<tt/void __fastcall__ atmos_tock(void);/
1550 <tag/Description/<tt/atmos_tock/ plays the system sound.
1551 <tag/Notes/<itemize>
1552 <item>The function is available only as a fastcall function; so, it may be used
1553 only in the presence of a prototype.
1555 <tag/Availability/cc65
1557 <ref id="atmos_explode" name="atmos_explode">,
1558 <ref id="atmos_ping" name="atmos_ping">,
1559 <ref id="atmos_shoot" name="atmos_shoot">,
1560 <ref id="atmos_tick" name="atmos_tick">,
1561 <ref id="atmos_zap" name="atmos_zap">
1567 <sect1>atmos_zap<label id="atmos_zap"><p>
1571 <tag/Function/Raygun sound effect.
1572 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1573 <tag/Declaration/<tt/void __fastcall__ atmos_zap(void);/
1574 <tag/Description/<tt/atmos_zap/ plays the BASIC sound.
1575 <tag/Notes/<itemize>
1576 <item>The function is available only as a fastcall function; so, it may be used
1577 only in the presence of a prototype.
1579 <tag/Availability/cc65
1581 <ref id="atmos_explode" name="atmos_explode">,
1582 <ref id="atmos_ping" name="atmos_ping">,
1583 <ref id="atmos_shoot" name="atmos_shoot">,
1584 <ref id="atmos_tick" name="atmos_tick">,
1585 <ref id="atmos_tock" name="atmos_tock">
1591 <sect1>atoi<label id="atoi"><p>
1595 <tag/Function/Convert a string to an integer.
1596 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1597 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1598 <tag/Description/<tt/atoi/ converts the given string into an integer.
1599 Conversion stops as soon as any invalid character is encountered.
1600 <tag/Notes/<itemize>
1601 <item>There is no way to detect any conversion errors.
1602 <item>The function does not check for an numerical overflow when converting.
1603 <item>The function is only available as fastcall function, so it may only be
1604 used in presence of a prototype.
1606 <tag/Availability/ISO 9899
1608 <ref id="atol" name="atol">,
1609 <ref id="itoa" name="itoa">,
1610 <ref id="ltoa" name="ltoa">,
1611 <ref id="ultoa" name="ultoa">,
1612 <ref id="utoa" name="utoa">
1618 <sect1>atol<label id="atol"><p>
1622 <tag/Function/Convert a string to a long integer.
1623 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1624 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1625 <tag/Description/<tt/atol/ converts the given string into a long integer.
1626 Conversion stops as soon as any invalid character is encountered.
1627 <tag/Notes/<itemize>
1628 <item>There is no way to detect any conversion errors.
1629 <item>The function does not check for an numerical overflow when converting.
1630 <item>The function is only available as fastcall function, so it may only be
1631 used in presence of a prototype.
1633 <tag/Availability/ISO 9899
1635 <ref id="atoi" name="atoi">,
1636 <ref id="itoa" name="itoa">,
1637 <ref id="ltoa" name="ltoa">,
1638 <ref id="ultoa" name="ultoa">,
1639 <ref id="utoa" name="utoa">
1645 <sect1>bgcolor<label id="bgcolor"><p>
1649 <tag/Function/Set the background text color.
1650 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1651 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1652 <tag/Description/The function will set a new background color and return the
1653 old (current) one. The background color is valid for the whole text output
1654 area of the screen, not just for new text.
1655 <tag/Notes/<itemize>
1656 <item>Background colors are system dependent. The function may have no effect
1657 on systems where the background color cannot be changed.
1658 <item>The function is only available as fastcall function, so it may only be
1659 used in presence of a prototype.
1661 <tag/Availability/cc65
1663 <ref id="bordercolor" name="bordercolor">,
1664 <ref id="textcolor" name="textcolor">
1670 <sect1>bordercolor<label id="bordercolor"><p>
1674 <tag/Function/Set the border (frame) color.
1675 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1676 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1677 <tag/Description/The function will set a new border color. It returns the old
1678 (current) border color.
1679 <tag/Notes/<itemize>
1680 <item>Border colors are system dependent. The function may have no effect
1681 on systems where the border color cannot be changed.
1682 <item>The function is only available as fastcall function, so it may only
1683 be used in presence of a prototype.
1685 <tag/Availability/cc65
1687 <ref id="bgcolor" name="bgcolor">,
1688 <ref id="textcolor" name="textcolor">
1694 <sect1>bsearch<label id="bsearch"><p>
1698 <tag/Function/Do a binary search in a sorted array.
1699 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1700 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1701 const void* base, size_t n, size_t size,
1702 int __fastcall__ (* cmp) (const void*, const void*));/
1703 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1704 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1705 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1706 the function used to compare the members against the key. The function returns
1707 a pointer to the member found, or <tt/NULL/ if there was no match.
1708 <tag/Notes/<itemize>
1709 <item>The contents of the array must be sorted in ascending order according to
1710 the compare function given.
1711 <item>If there are multiple members that match the key, the function will
1712 return one of the members.
1713 <item>The function is only available as fastcall function, so it may only
1714 be used in presence of a prototype.
1715 <item>The function to which <tt/cmp/ points must have the <tt/fastcall/ calling
1718 <tag/Availability/ISO 9899
1720 <ref id="qsort" name="qsort">
1726 <sect1>bzero<label id="bzero"><p>
1730 <tag/Function/Fill a memory area with zeroes.
1731 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1732 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1733 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1735 <tag/Notes/<itemize>
1736 <item>The function is non standard and therefore only available in non ANSI
1737 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1738 <item>The function is only available as fastcall function, so it may only
1739 be used in presence of a prototype.
1741 <tag/Availability/cc65
1743 <ref id="_swap" name="_swap">,
1744 <ref id="memcpy" name="memcpy">,
1745 <ref id="memmove" name="memmove">,
1746 <ref id="memset" name="memset">,
1752 <sect1>c64mode<label id="c64mode"><p>
1756 <tag/Function/Switch the C128 into C64 compatible mode.
1757 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1758 <tag/Declaration/<tt/void c64mode (void);/
1759 <tag/Description/The function will cause the machine to reboot into C64 mode.
1760 <tag/Notes/<itemize>
1761 <item>The function is specific to the C128.
1762 <item>The function will not return to the caller.
1764 <tag/Availability/C128
1770 <sect1>calloc<label id="calloc"><p>
1774 <tag/Function/Allocate and clear memory.
1775 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1776 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1777 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1778 of size <tt/size/, clears the whole block with binary zeroes and returns a
1779 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1781 <tag/Notes/<itemize>
1782 <item>Clearing the memory may not have the expected effect on all platforms:
1783 pointers in the block may not be <tt/NULL/ and floating point variables may
1784 not be zero (0.0). In other words: The "clearing" effect of this function
1785 should be used with care for portable programs.
1786 <item>The function is only available as fastcall function, so it may only
1787 be used in presence of a prototype.
1789 <tag/Availability/ISO 9899
1791 <ref id="_heapadd" name="_heapadd">,
1792 <ref id="_heapblocksize" name="_heapblocksize">,
1793 <ref id="_heapmaxavail" name="_heapmaxavail">,
1794 <ref id="_heapmemavail" name="_heapmemavail">,
1795 <ref id="free" name="free">,
1796 <ref id="malloc" name="malloc">,
1797 <ref id="realloc" name="realloc">
1803 <sect1>cbm_k_acptr<label id="cbm_k_acptr"><p>
1807 <tag/Function/Input byte from serial bus
1808 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1809 <tag/Declaration/<tt/unsigned char cbm_k_acptr (void);/
1810 <tag/Description/The function returns a byte of data, which it
1811 gets from the current TALKer on the serial bus.
1812 In order to receive the data, the device must have previously been
1813 sent a command to TALK and a secondary address if it needs one.
1814 <tag/Notes/<itemize>
1817 <tag/Availability/cc65
1819 <ref id="cbm_k_talk" name="cbm_k_talk">,
1825 <sect1>cbm_k_basin<label id="cbm_k_basin"><p>
1829 <tag/Function/Input a Character from the Current Device
1830 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1831 <tag/Declaration/<tt/unsigned char cbm_k_basin (void);/
1832 <tag/Description/The function returns a character from the current input device.
1833 Device must first have been OPENed and then designated as the input channel by the CHKIN routine.
1834 When this function is called, the next byte of data available from the device is returned.
1835 Exception is the routine for the keyboard device (which is the default input device).
1836 <tag/Notes/<itemize>
1839 <tag/Availability/cc65
1841 <ref id="cbm_k_open" name="cbm_k_open">,
1842 <ref id="cbm_k_chkin" name="cbm_k_chkin">
1848 <sect1>cbm_k_bsout<label id="cbm_k_bsout"><p>
1852 <tag/Function/Output a byte
1853 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1854 <tag/Declaration/<tt/void __fastcall__ cbm_k_bsout (unsigned char C);/
1855 <tag/Description/Function sends the character to the current output device.
1856 Unless a device has been OPENed and designated as the
1857 current output channel using the CHKOUT routine, the character is
1858 printed to the screen, which is the default output device. If the
1859 cassette is the current device, outputting a byte will only add it to
1860 the buffer. No actual transmission of data will occur until the
1861 192-byte buffer is full.
1862 <tag/Notes/<itemize>
1863 <item>The function is only available as fastcall function, so it may
1864 only be used in presence of a prototype.
1866 <tag/Availability/cc65
1868 <ref id="cbm_k_open" name="cbm_k_open">,
1869 <ref id="cbm_k_chkin" name="cbm_k_chkout">
1875 <sect1>cbm_k_chkin<label id="cbm_k_chkin"><p>
1879 <tag/Function/Designate a Logical File As the Current Input Channel
1880 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1881 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_chkin (unsigned char FN);/
1882 <tag/Description/If you wish to
1883 get data from any device other than the keyboard, this function must be
1884 called after OPENing the device, before you can get a data byte with
1885 the cbm_k_basin or cbm_k_getin routine. When called, the routine will designate
1886 the logical file whose file number was supplied as the
1887 current file, its device as the current device, and its secondary
1888 address as the current secondary address. If the device on the
1889 channel is a serial device, which requires a TALK command and
1890 sometimes a secondary address, function will send them over the
1892 <tag/Notes/<itemize>
1893 <item>The function is only available as fastcall function, so it may
1894 only be used in presence of a prototype.
1896 <tag/Availability/cc65
1898 <ref id="cbm_k_open" name="cbm_k_open">,
1899 <ref id="cbm_k_basin" name="cbm_k_basin">,
1900 <ref id="cbm_k_getin" name="cbm_k_getin">
1906 <sect1>cbm_k_ciout<label id="cbm_k_ciout"><p>
1910 <tag/Function/Transmit a byte over the serial bus
1911 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1912 <tag/Declaration/<tt/void __fastcall__ cbm_k_ciout (unsigned char C);/
1913 <tag/Description/Purpose of this function is to send a byte of data over
1914 the serial bus. In order for the data to be received, the serial
1915 device must have first been commanded to LISTEN and been given a
1916 secondary address if necessary. This routine always buffers the
1917 current character, and defers sending it until the next byte is
1918 buffered. When the UNLISTEN command is sent, the last byte will be
1919 sent with an End or Identify (EOI).
1920 <tag/Notes/<itemize>
1921 <item>The function is only available as fastcall function, so it may
1922 only be used in presence of a prototype.
1924 <tag/Availability/cc65
1926 <ref id="cbm_k_listen" name="cbm_k_listen">,
1927 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">
1933 <sect1>cbm_k_ckout<label id="cbm_k_ckout"><p>
1937 <tag/Function/Designate a Logical File As the Current Output Channel
1938 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1939 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_ckout (unsigned char FN);/
1940 <tag/Description/If you wish to
1941 output data to any device other than the screen, this routine must be
1942 called after OPENing the device, and before you output a data byte
1943 with the cbm_k_bsout() function. When called, the function will designate the
1944 logical file whose file number was supplied as the current
1945 file, its device as the current device, and its secondary address as
1946 the current secondary address. If the device on the channel uses the
1947 serial bus, and therefore requires a LISTEN command and possibly a
1948 secondary address, this information will be sent on the bus.
1949 <tag/Notes/<itemize>
1950 <item>The function is only available as fastcall function, so it may
1951 only be used in presence of a prototype.
1953 <tag/Availability/cc65
1955 <ref id="cbm_k_bsout" name="cbm_k_bsout">,
1956 <ref id="cbm_k_listen" name="cbm_k_listen">
1962 <sect1>cbm_k_clall<label id="cbm_k_clall"><p>
1966 <tag/Function/Close All Logical I/O Files
1967 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1968 <tag/Declaration/<tt/void cbm_k_clall (void);/
1969 <tag/Description/It closes all
1970 open files, by resetting the index into open files to
1971 zero and restores the default I/O devices.
1972 <tag/Notes/<itemize>
1975 <tag/Availability/cc65
1977 <ref id="cbm_k_open" name="cbm_k_open">,
1978 <ref id="cbm_k_close" name="cbm_k_close">
1984 <sect1>cbm_k_close<label id="cbm_k_close"><p>
1988 <tag/Function/Close a Logical I/O File
1989 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1990 <tag/Declaration/<tt/void __fastcall__ cbm_k_close (unsigned char FN);/
1991 <tag/Description/It is used to
1992 close a logical file after all I/O operations involving that file have
1994 <tag/Notes/<itemize>
1995 <item>The function is only available as fastcall function, so it may
1996 only be used in presence of a prototype.
1998 <tag/Availability/cc65
2000 <ref id="cbm_k_open" name="cbm_k_open">,
2001 <ref id="cbm_k_clall" name="cbm_k_clall">
2007 <sect1>cbm_k_clrch<label id="cbm_k_clrch"><p>
2011 <tag/Function/Restore Current Input and Output Devices to the Default Devices
2012 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2013 <tag/Declaration/<tt/void cbm_k_clrch (void);/
2014 <tag/Description/It sets the
2015 current input device to the keyboard, and the current output device to
2016 the screen. Also, if the current input device was formerly a serial
2017 device, the routine sends it an UNTALK command on the serial bus, and
2018 if a serial device was formerly the current output device, the routine
2019 sends it an UNLISTEN command.
2020 <tag/Notes/<itemize>
2023 <tag/Availability/cc65
2025 <ref id="cbm_k_chkin" name="cbm_k_chkin">,
2026 <ref id="cbm_k_ckout" name="cbm_k_ckout">
2032 <sect1>cbm_k_getin<label id="cbm_k_getin"><p>
2036 <tag/Function/Get One Byte from the Input Device
2037 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2038 <tag/Declaration/<tt/unsigned char cbm_k_getin (void);/
2039 <tag/Description/Function gets a character from the current input device.
2040 <tag/Notes/<itemize>
2043 <tag/Availability/cc65
2045 <ref id="cbm_k_basin" name="cbm_k_basin">
2051 <sect1>cbm_k_iobase<label id="cbm_k_iobase"><p>
2055 <tag/Function/Return Base Address of Memory-Mapped I/O Devices
2056 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2057 <tag/Declaration/<tt/unsigned cbm_k_iobase (void);/
2058 <tag/Description/This function returns the address of
2059 the memory section where the memory mapped I/O devices are located. This
2060 address can then be used with an offset to access the memory mapped I/O
2061 devices in the Commodore 64. The offset is the number of locations from
2062 the beginning of the page on which the I/O register you want is located.
2063 This function exists to provide compatibility between the Commodore 64,
2064 VIC-20, and future models of the Commodore 64. If the I/O locations for
2065 a program are set by a call to this function, they should
2066 still remain compatible with future versions of the Commodore 64, the
2068 <tag/Notes/<itemize>
2071 <tag/Availability/cc65
2079 <sect1>cbm_k_listen<label id="cbm_k_listen"><p>
2083 <tag/Function/Command a device on the serial bus to LISTEN
2084 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2085 <tag/Declaration/<tt/void __fastcall__ cbm_k_listen (unsigned char dev);/
2086 <tag/Description/This function will command a device on the serial bus to
2087 receive data. The KERNAL routine will OR the supplied device number bit by bit
2088 to convert it to a listen address, then transmits this data as a command on
2089 the serial bus. The specified device will then go into listen mode, and
2090 be ready to accept information.
2091 <tag/Notes/<itemize>
2092 <item>The function is only available as fastcall function, so it may
2093 only be used in presence of a prototype.
2095 <tag/Availability/cc65
2097 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">
2103 <sect1>cbm_k_load<label id="cbm_k_load"><p>
2107 <tag/Function/Load RAM from a Device
2108 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2109 <tag/Declaration/<tt/unsigned int __fastcall__ cbm_k_load(unsigned char flag, unsigned addr);/
2110 <tag/Description/This function LOADs data bytes from any input device directly into the memory.
2111 It can also be used for a verify operation, comparing data from a device with the data already in
2112 memory, while leaving the data stored in RAM unchanged.
2113 The flag must be set to 0 for a LOAD operation, or 1 for a
2114 verify, If the input device is OPENed with a secondary address (SA) of 0
2115 the header information from the device is ignored. In this case, the starting address for the load must be supplied.
2116 If the device is addressed with a secondary address of 1, then the data is
2117 loaded into memory starting at the location specified by the header.
2118 Function returns the address of the highest RAM location loaded.
2119 Before this function can be called, the KERNAL SETLFS, and SETNAM
2120 routines must be called.
2121 <tag/Notes/<itemize>
2122 <item>The function is only available as fastcall function, so it may
2123 only be used in presence of a prototype.
2125 <tag/Availability/cc65
2127 <ref id="cbm_k_save" name="cbm_k_save">,
2128 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2129 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2135 <sect1>cbm_k_open<label id="cbm_k_open"><p>
2139 <tag/Function/Open a Logical I/O File
2140 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2141 <tag/Declaration/<tt/unsigned char cbm_k_open (void);/
2142 <tag/Description/This function assigns a logical file to a device, so that it can be used for
2143 Input/Output operations. In order to specify the logical file number,
2144 the device number, and the secondary address if any, the cbm_k_setlfs() function must first be called.
2145 Likewise, in order to designate the filename, the cbm_k_setnam() function must be used first. After these two
2146 functions are called, cbm_k_open() is then called.
2147 <tag/Notes/<itemize>
2150 <tag/Availability/cc65
2152 <ref id="cbm_k_close" name="cbm_k_close">,
2153 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2154 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2160 <sect1>cbm_k_readst<label id="cbm_k_readst"><p>
2164 <tag/Function/Read status word
2165 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2166 <tag/Declaration/<tt/unsigned char cbm_k_readst (void);/
2167 <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.
2168 <tag/Notes/<itemize>
2171 <tag/Availability/cc65
2179 <sect1>cbm_k_save<label id="cbm_k_save"><p>
2183 <tag/Function/Save RAM to a Device
2184 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2185 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_save(unsigned int start, unsigned int end)/
2186 <tag/Description/This function saves a section of memory. The cbm_k_setlfs() and cbm_k_setnam() functions must be
2187 used before calling this function. However, a file name is not required to
2188 SAVE to device 1 (the Datassette(TM) recorder). Any attempt to save to
2189 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.
2190 <tag/Notes/<itemize>
2191 <item>The function is only available as fastcall function, so it may
2192 only be used in presence of a prototype.
2194 <tag/Availability/cc65
2196 <ref id="cbm_k_load" name="cbm_k_load">,
2197 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2198 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2204 <sect1>cbm_k_scnkey<label id="cbm_k_scnkey"><p>
2208 <tag/Function/Scan the keyboard matrix.
2209 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2210 <tag/Declaration/<tt/void cbm_k_scnkey (void);/
2211 <tag/Description/This function looks at the switches in the keyboard, to see
2212 if any of them are being pressed. If they are, then code numbers for them are
2213 stored in RAM. Other functions use those numbers to input text. Normally,
2214 the keyboard is scanned by the Kernal's Interrupt Service Routine. But, if
2215 you divert the "Jiffy interrupt" to a C-code ISR, then that ISR must call this
2216 function, in order to provide input from the keyboard.
2217 <tag/Availability/cc65
2219 <ref id="cbm_k_getin" name="cbm_k_getin">,
2220 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2221 <ref id="cgetc" name="cgetc">,
2222 <!-- <ref id="getc" name="getc"> -->
2223 <!-- <ref id="getchar" name="getchar"> -->
2229 <sect1>cmb_k_second<label id="cbm_k_second"><p>
2233 <tag/Function/Send secondary address for LISTEN.
2234 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2235 <tag/Declaration/<tt/void __fastcall__ cbm_k_second (unsigned char addr);/
2236 <tag/Description/This function is used to send a secondary address to an I/O
2237 device after a call to LISTEN is made, and the device is commanded to LISTEN.
2238 <tag/Notes/<itemize>
2239 <item>The function is only available as fastcall function, so it may
2240 only be used in presence of a prototype.
2241 <item>The function can only be called after a call to LISTEN.
2242 <item>The function will not work after a TALK.
2243 <item>When a secondary address is to be sent to a device on the serial bus,
2244 the address must first be ORed with $60.
2246 <tag/Availability/cc65
2248 <ref id="cbm_k_listen" name="cbm_k_listen">
2254 <sect1>cbm_k_setlfs<label id="cbm_k_setlfs"><p>
2258 <tag/Function/Set up a logical file
2259 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2260 <tag/Declaration/<tt/void __fastcall__ cbm_k_setlfs (unsigned char LFN, unsigned char DEV, unsigned char SA);/
2261 <tag/Description/This functions sets up the logical file by setting its number, device address,
2262 and secondary address.
2263 <tag/Notes/<itemize>
2264 <item>The function is only available as fastcall function, so it may
2265 only be used in presence of a prototype.
2267 <tag/Availability/cc65
2269 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2275 <sect1>cbm_k_setnam<label id="cbm_k_setnam"><p>
2279 <tag/Function/Set Filename Parameters
2280 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2281 <tag/Declaration/<tt/void __fastcall__ cbm_k_setnam (const char* Name);/
2282 <tag/Description/This function is used to set up the file name for the OPEN,
2283 SAVE, or LOAD operations.
2284 <tag/Notes/<itemize>
2285 <item>The function is only available as fastcall function, so it may
2286 only be used in presence of a prototype.
2288 <tag/Availability/cc65
2290 <ref id="cbm_k_open" name="cbm_k_open">,
2291 <ref id="cbm_k_load" name="cbm_k_load">,
2292 <ref id="cbm_k_save" name="cbm_k_save">
2298 <sect1>cbm_k_talk<label id="cbm_k_talk"><p>
2302 <tag/Function/Commands device to TALK
2303 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2304 <tag/Declaration/<tt/void __fastcall__ cbm_k_talk (unsigned char dev);/
2305 <tag/Description/When called, it ORs the device number with the TALK code (64, $40) and sends it on the serial
2306 bus. This commands the device to TALK.
2307 <tag/Notes/<itemize>
2308 <item>The function is only available as fastcall function, so it may
2309 only be used in presence of a prototype.
2311 <tag/Availability/cc65
2313 <ref id="cbm_k_acptr" name="cbm_k_acptr">
2319 <sect1>cbm_k_tksa<label id="cbm_k_tksa"><p>
2323 <tag/Function/Send TALK secondary address to serial bus
2324 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2325 <tag/Declaration/<tt/void __fastcall__ cbm_k_tksa (unsigned char addr);/
2326 <tag/Description/This function transmits a secondary address on the serial bus for a TALK device.
2327 <tag/Notes/<itemize>
2328 <item>The function is only available as fastcall function, so it may
2329 only be used in presence of a prototype.
2330 <item>The function can only be called after a call to TALK.
2331 <item>The function will not work after a LISTEN.
2333 <tag/Availability/cc65
2335 <ref id="cbm_k_talk" name="cbm_k_talk">
2341 <sect1>cbm_k_udtim<label id="cbm_k_udtim"><p>
2345 <tag/Function/Update the Jiffy clock.
2346 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2347 <tag/Declaration/<tt/void cbm_k_udtim (void);/
2348 <tag/Description/This function adds one count to the Jiffy clock. That clock
2349 counts sixtieths of a second. It is used by the library's <tt/clock()/
2350 function. Normally, the Jiffy clock is updated by the Kernal's Interrupt
2351 Service Routine. But, if you divert the "Jiffy interrupt" to a C-code ISR,
2352 then that ISR must call this function, in order to keep the clock valid.
2353 <tag/Availability/cc65
2355 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2356 <ref id="clock" name="clock">
2362 <sect1>cbm_k_unlsn<label id="cbm_k_unlsn"><p>
2366 <tag/Function/Send an UNLISTEN command
2367 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2368 <tag/Declaration/<tt/void cbm_k_unlsn (void);/
2369 <tag/Description/This function commands all devices on the serial bus to
2370 stop receiving data from the host computer (i.e., UNLISTEN). Calling this
2371 function results in an UNLISTEN command being transmitted on the serial
2372 bus. Only devices previously commanded to LISTEN are affected. This
2373 function is normally used after the host computer is finished sending data
2374 to external devices. Sending the UNLISTEN commands the listening devices
2375 to get off the serial bus so it can be used for other purposes.
2376 <tag/Availability/cc65
2378 <ref id="cbm_k_listen" name="cbm_k_listen">
2384 <sect1>cbm_k_untlk<label id="cbm_k_untlk"><p>
2388 <tag/Function/Send an UNTALK command
2389 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2390 <tag/Declaration/<tt/void cbm_k_untlk (void);/
2391 <tag/Description/This function commands all devices on the serial bus to
2392 stop sending data to the host computer (i.e., UNTALK). Calling this
2393 function results in an UNTALK command being transmitted on the serial
2394 bus. Only devices previously commanded to TALK are affected. This
2395 function is normally used after the host computer is finished listening to data
2396 from an external device. Sending the UNTALK commands the sending devices
2397 to get off the serial bus so it can be used for other purposes.
2398 <tag/Availability/cc65
2400 <ref id="cbm_k_talk" name="cbm_k_talk">
2406 <sect1>cclear<label id="cclear"><p>
2410 <tag/Function/Clear part of a line (write a given number of spaces).
2411 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2412 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
2413 <tag/Description/The function clears part of a line by writing <tt/length/
2414 spaces in the current text color.
2415 <tag/Notes/<itemize>
2416 <item>The function is only available as fastcall function, so it may
2417 only be used in presence of a prototype.
2419 <tag/Availability/cc65
2421 <ref id="cclearxy" name="cclearxy">,
2422 <ref id="clrscr" name="clrscr">
2428 <sect1>cclearxy<label id="cclearxy"><p>
2432 <tag/Function/Clear part of a line (write a given number of spaces) starting
2433 at a specific screen position.
2434 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2435 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
2436 <tag/Description/The function moves the cursor to a specific position, and
2437 will then clear part of the line by writing <tt/length/ spaces in the current
2439 <tag/Notes/<itemize>
2440 <item>The function is only available as fastcall function, so it may
2441 only be used in presence of a prototype.
2443 <tag/Availability/cc65
2445 <ref id="cclear" name="cclear">,
2446 <ref id="clrscr" name="clrscr">
2452 <sect1>cgetc<label id="cgetc"><p>
2456 <tag/Function/Read a character from the keyboard.
2457 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2458 <tag/Declaration/<tt/char cgetc (void);/
2459 <tag/Description/The function reads a character from the keyboard. If there is
2460 no character available, <tt/cgetc()/ waits until the user presses a key. If the
2461 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
2462 displayed while waiting.
2463 <tag/Notes/<itemize>
2464 <item>If the system supports a keyboard buffer, <tt/cgetc()/ will fetch a key
2465 from that buffer; and, wait only if the buffer is empty.
2466 <item>The keyboard must be scanned periodically, in order for this function to
2467 see anything that you type. (See the description of <tt/cbm_k_scnkey()/.)
2469 <tag/Availability/cc65
2471 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2472 <ref id="cursor" name="cursor">,
2473 <ref id="kbhit" name="kbhit">
2479 <sect1>chline<label id="chline"><p>
2483 <tag/Function/Output a horizontal line in text mode.
2484 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2485 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
2486 <tag/Description/The function outputs a horizontal line with the given length
2487 starting at the current cursor position.
2488 <tag/Notes/<itemize>
2489 <item>The character used to draw the horizontal line is system dependent.
2490 If available, a line drawing character is used. Drawing a line that is partially
2491 off screen leads to undefined behaviour.
2492 <item>The function is only available as fastcall function, so it may only be
2493 used in presence of a prototype.
2495 <tag/Availability/cc65
2497 <ref id="chlinexy" name="chlinexy">,
2498 <ref id="cvline" name="cvline">,
2499 <ref id="cvlinexy" name="cvlinexy">
2505 <sect1>chlinexy<label id="chlinexy"><p>
2509 <tag/Function/Output a horizontal line at a given position in text mode.
2510 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2511 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
2512 <tag/Description/The function outputs a horizontal line with the given length
2513 starting at a given position.
2514 <tag/Notes/<itemize>
2515 <item>The character used to draw the horizontal line is system dependent.
2516 If available, a line drawing character is used. Drawing a line that is partially
2517 off screen leads to undefined behaviour.
2518 <item>The function is only available as fastcall function, so it may only be
2519 used in presence of a prototype.
2521 <tag/Availability/cc65
2523 <ref id="chline" name="chline">,
2524 <ref id="cvline" name="cvline">,
2525 <ref id="cvlinexy" name="cvlinexy">
2531 <sect1>clearerr<label id="clearerr"><p>
2535 <tag/Function/Clear error and end-of-file status of a stream.
2536 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2537 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
2538 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
2539 indicators for the stream <tt/f/.
2540 <tag/Notes/<itemize>
2541 <item>The function is only available as fastcall function, so it may only be
2542 used in presence of a prototype.
2544 <tag/Availability/ISO 9899
2546 <ref id="feof" name="feof">,
2547 <ref id="ferror" name="ferror">
2553 <sect1>clock<label id="clock"><p>
2557 <tag/Function/Determine the processor time used.
2558 <tag/Header/<tt/<ref id="time.h" name="time.h">/
2559 <tag/Declaration/<tt/clock_t clock (void);/
2560 <tag/Description/The <tt/clock/ function returns an approximaton of processor
2561 time used by the program. The time is returned in implementation-defined
2562 units. It can be converted to seconds by dividing by the value of the macro
2563 <tt/CLOCKS_PER_SEC/.
2564 <tag/Notes/<itemize>
2565 <item>Since the machines that cc65-generated programs run on cannot run multiple
2566 processes, the function actually will return the time since some
2567 implementation-defined point in the past.
2568 <item>The Jiffy clock must be "running", in order for this function to return
2569 changing values. (See the description of <tt/cbm_k_udtim()/.)
2571 <tag/Availability/ISO 9899
2573 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2574 <ref id="time" name="time">
2580 <sect1>clrscr<label id="clrscr"><p>
2584 <tag/Function/Clear the text screen.
2585 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2586 <tag/Declaration/<tt/void clrscr (void);/
2587 <tag/Description/The function clears the text screen and moves the cursor to
2588 the upper left corner.
2589 <tag/Availability/cc65
2591 <ref id="cclear" name="cclear">,
2592 <ref id="cclearxy" name="cclearxy">
2598 <sect1>close<label id="close"><p>
2602 <tag/Function/Close a file descriptor.
2603 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2604 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
2605 <tag/Description/The function closes the given file descriptor. It returns zero
2606 on success and -1 on error. If an error occurs, the cause can be determined by
2607 reading the <tt/errno/ variable.
2608 <tag/Notes/<itemize>
2609 <item>The function is only available as fastcall function, so it may only
2610 be used in presence of a prototype.
2612 <tag/Availability/POSIX 1003.1
2614 <ref id="creat" name="creat">,
2615 <ref id="open" name="open">
2621 <sect1>closedir<label id="closedir"><p>
2625 <tag/Function/Close a directory.
2626 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
2627 <tag/Declaration/<tt/int __fastcall__ closedir (DIR* dir);/
2628 <tag/Description/The function closes the given directory descriptor. It returns
2629 zero on success and -1 on error. If an error occurs, the cause can be determined
2630 by reading the <tt/errno/ variable.
2631 <tag/Notes/<itemize>
2632 <item>The function is only available as fastcall function, so it may only
2633 be used in presence of a prototype.
2635 <tag/Availability/POSIX 1003.1
2637 <ref id="opendir" name="opendir">,
2638 <ref id="readdir" name="readdir">
2644 <sect1>cpeekc<label id="cpeekc"><p>
2648 <tag/Function/Get a character from the display memory.
2649 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2650 <tag/Declaration/<tt/char cpeekc (void);/
2651 <tag/Description/The function gets the character that's at the current location
2652 of the cursor in the display screen RAM. That character is converted, if
2653 needed, into the encoding that can be passed to <tt/cputc()/.
2654 <tag/Notes/<itemize>
2655 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2656 done to make it obvious that peeking doesn't move the cursor in any way. Your
2657 program must place the cursor where it wants to peek before it calls any of
2660 <tag/Availability/cc65
2662 <ref id="cpeekcolor" name="cpeekcolor">,
2663 <ref id="cpeekrevers" name="cpeekrevers">,
2664 <ref id="cpeeks" name="cpeeks">,
2665 <ref id="cputc" name="cputc">
2671 <sect1>cpeekcolor<label id="cpeekcolor"><p>
2675 <tag/Function/Get a color from the display memory.
2676 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2677 <tag/Declaration/<tt/unsigned char cpeekcolor (void);/
2678 <tag/Description/The function gets the color number that's at the current
2679 location of the cursor in the display screen RAM. That number can be passed to
2681 <tag/Notes/<itemize>
2682 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2683 done to make it obvious that peeking doesn't move the cursor in any way. Your
2684 program must place the cursor where it wants to peek before it calls any of
2687 <tag/Availability/cc65
2689 <ref id="cpeekc" name="cpeekc">,
2690 <ref id="cpeekrevers" name="cpeekrevers">,
2691 <ref id="cpeeks" name="cpeeks">,
2692 <ref id="cputc" name="cputc">,
2693 <ref id="textcolor" name="textcolor">
2699 <sect1>cpeekrevers<label id="cpeekrevers"><p>
2703 <tag/Function/Get a reverse-character attribute from the display memory.
2704 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2705 <tag/Declaration/<tt/unsigned char cpeekrevers (void);/
2706 <tag/Description/The function gets the "reverse-mode" attribute of the
2707 character that's at the current location of the cursor in the display screen
2708 RAM. It returns a boolean value (0/1) that can be passed to <tt/revers()/.
2709 <tag/Notes/<itemize>
2710 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2711 done to make it obvious that peeking doesn't move the cursor in any way. Your
2712 program must place the cursor where it wants to peek before it calls any of
2715 <tag/Availability/cc65
2717 <ref id="cpeekc" name="cpeekc">,
2718 <ref id="cpeekcolor" name="cpeekcolor">,
2719 <ref id="cpeeks" name="cpeeks">,
2720 <ref id="cputc" name="cputc">,
2721 <ref id="revers" name="revers">
2727 <sect1>cpeeks<label id="cpeeks"><p>
2731 <tag/Function/Get a string from the display memory.
2732 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2733 <tag/Declaration/<tt/void __fastcall__ cpeeks (char* s, unsigned length);/
2734 <tag/Description/The function gets a fixed-length string ('\0'-terminated) of
2735 characters that start at the current location of the cursor in the display
2736 screen RAM. Those characters are converted, if needed, into the encoding that
2737 can be passed to <tt/cputs()/. The first argument must point to a RAM area
2738 that's large enough to hold "length + 1" bytes.
2739 <tag/Notes/<itemize>
2740 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2741 done to make it obvious that peeking doesn't move the cursor in any way. Your
2742 program must place the cursor where it wants to peek before it calls any of
2744 <item>The function is available as only a fastcall function;
2745 so, it may be used only in the presence of a prototype.
2747 <tag/Availability/cc65
2749 <ref id="cpeekc" name="cpeekc">,
2750 <ref id="cpeekcolor" name="cpeekcolor">,
2751 <ref id="cpeekrevers" name="cpeekrevers">,
2752 <ref id="cputc" name="cputc">,
2753 <ref id="cputs" name="cputs">
2759 <sect1>creat<label id="creat"><p>
2763 <tag/Function/Create a file.
2764 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2765 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
2766 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
2767 associated with it. On error, -1 is returned and an error code is stored in
2769 <tag/Notes/<itemize>
2770 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
2771 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
2772 <item>The function is only available as fastcall function, so it may only
2773 be used in presence of a prototype.
2775 <tag/Availability/POSIX 1003.1
2777 <ref id="close" name="close">,
2778 <ref id="open" name="open">
2784 <sect1>cprintf<label id="cprintf"><p>
2788 <tag/Function/Formatted output to the console.
2789 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2790 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
2791 <tag/Description/The arguments are converted to text where necessary and
2792 formatted according to the format string given. The resulting string is output
2793 to the console. <tt/cprintf/ supports the same format specifiers as
2794 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
2795 <tag/Notes/<itemize>
2796 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
2797 between <tt/\r/ and <tt/\n/.
2799 <tag/Availability/cc65
2801 <ref id="cputc" name="cputc">,
2802 <ref id="cputcxy" name="cputcxy">,
2803 <ref id="cputs" name="cputs">,
2804 <ref id="cputsxy" name="cputsxy">,
2805 <ref id="vcprintf" name="vcprintf">
2811 <sect1>cputc<label id="cputc"><p>
2815 <tag/Function/Output a character directly to the console.
2816 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2817 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
2818 <tag/Description/Output one character to the console at the current cursor
2820 <tag/Notes/<itemize>
2821 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
2822 between <tt/\r/ and <tt/\n/.
2823 <item>The function is only available as fastcall function, so it may only
2824 be used in presence of a prototype.
2826 <tag/Availability/cc65
2828 <ref id="cprintf" name="cprintf">,
2829 <ref id="cputcxy" name="cputcxy">,
2830 <ref id="cputs" name="cputs">,
2831 <ref id="cputsxy" name="cputsxy">,
2832 <ref id="vcprintf" name="vcprintf">
2838 <sect1>cputcxy<label id="cputcxy"><p>
2842 <tag/Function/Output a character at a specific screen position.
2843 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2844 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
2845 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
2846 the screen and outputs one character.
2847 <tag/Notes/<itemize>
2848 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
2849 between <tt/\r/ and <tt/\n/.
2850 <item>The function is only available as fastcall function, so it may only
2851 be used in presence of a prototype.
2853 <tag/Availability/cc65
2855 <ref id="cprintf" name="cprintf">,
2856 <ref id="cputc" name="cputc">,
2857 <ref id="cputs" name="cputs">,
2858 <ref id="cputsxy" name="cputsxy">,
2859 <ref id="vcprintf" name="vcprintf">
2865 <sect1>cputs<label id="cputs"><p>
2869 <tag/Function/Output a string directly to the console.
2870 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2871 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
2872 <tag/Description/The function outputs the given string on the console at the
2873 current cursor position.
2874 <tag/Notes/<itemize>
2875 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
2876 between <tt/\r/ and <tt/\n/.
2877 <item>The function is only available as fastcall function, so it may only
2878 be used in presence of a prototype.
2880 <tag/Availability/cc65
2882 <ref id="cprintf" name="cprintf">,
2883 <ref id="cputc" name="cputc">,
2884 <ref id="cputcxy" name="cputcxy">,
2885 <ref id="cputsxy" name="cputsxy">,
2886 <ref id="vcprintf" name="vcprintf">
2892 <sect1>cputsxy<label id="cputsxy"><p>
2896 <tag/Function/Output a string to the console at a given position.
2897 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2898 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
2899 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
2900 and outputs the string <tt/s/.
2901 <tag/Notes/<itemize>
2902 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
2903 between <tt/\r/ and <tt/\n/.
2904 <item>The function is only available as fastcall function, so it may only
2905 be used in presence of a prototype.
2907 <tag/Availability/cc65
2909 <ref id="cprintf" name="cprintf">,
2910 <ref id="cputc" name="cputc">,
2911 <ref id="cputcxy" name="cputcxy">,
2912 <ref id="cputs" name="cputs">,
2913 <ref id="vcprintf" name="vcprintf">
2919 <sect1>cursor<label id="cursor"><p>
2923 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
2924 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2925 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
2926 <tag/Description/If the argument to the function is non zero, a blinking cursor
2927 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
2928 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
2929 <tag/Notes/<itemize>
2930 <item>The function is only available as fastcall function, so it may only
2931 be used in presence of a prototype.
2933 <tag/Availability/cc65
2935 <ref id="cgetc" name="cgetc">,
2936 <ref id="kbhit" name="kbhit">
2942 <sect1>cvline<label id="cvline"><p>
2946 <tag/Function/Output a vertical line in text mode.
2947 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2948 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
2949 <tag/Description/The function outputs a vertical line with the given length
2950 starting at the current cursor position.
2951 <tag/Notes/<itemize>
2952 <item>The character used to draw the vertical line is system dependent.
2953 If available, a line drawing character is used. Drawing a line that is partially
2954 off screen leads to undefined behaviour.
2955 <item>The function is only available as fastcall function, so it may only be
2956 used in presence of a prototype.
2958 <tag/Availability/cc65
2960 <ref id="chline" name="chline">,
2961 <ref id="chlinexy" name="chlinexy">,
2962 <ref id="cvlinexy" name="cvlinexy">
2968 <sect1>cvlinexy<label id="cvlinexy"><p>
2972 <tag/Function/Output a vertical line at a given position in text mode.
2973 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2974 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
2975 <tag/Description/The function outputs a vertical line with the given length
2976 starting at a given position.
2977 <tag/Notes/<itemize>
2978 <item>The character used to draw the vertical line is system dependent.
2979 If available, a line drawing character is used. Drawing a line that is partially
2980 off screen leads to undefined behaviour.
2981 <item>The function is only available as fastcall function, so it may only be
2982 used in presence of a prototype.
2984 <tag/Availability/cc65
2986 <ref id="chline" name="chline">,
2987 <ref id="chlinexy" name="chlinexy">,
2988 <ref id="cvline" name="cvline">
2994 <sect1>decompress_lz4<label id="decompress_lz4"><p>
2998 <tag/Function/Uncompress a LZ4-compressed buffer.
2999 <tag/Header/<tt/<ref id="lz4.h" name="lz4.h">/
3000 <tag/Declaration/<tt/void decompress_lz4 (const unsigned char* src, unsigned char* const dst, const unsigned short uncompressed_size);/
3001 <tag/Description/<tt/decompress_lz4/ uncompresses a LZ4-compressed buffer.
3002 <tag/Notes/<itemize>
3003 <item>Use LZ4_compress_HC with compression level 16 for best compression.
3005 <tag/Availability/cc65
3011 <sect1>detect_c128<label id="detect_c128"><p>
3015 <tag/Function/Check if a C128 CPU is the current CPU.
3016 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3017 <tag/Declaration/<tt/unsigned char detect_c128 (void);/
3018 <tag/Description/The function returns a 1 if a C128 CPU is the current CPU.
3019 <tag/Notes/<itemize>
3020 <item>The function is specific to the C64 and C128.
3022 <tag/Availability/cc65 (not all platforms)
3024 <ref id="get_c128_speed" name="get_c128_speed">,
3025 <ref id="set_c128_speed" name="set_c128_speed">,
3031 <sect1>detect_c64dtv<label id="detect_c64dtv"><p>
3035 <tag/Function/Check for the presence of the C64DTV.
3036 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3037 <tag/Declaration/<tt/unsigned char detect_c64dtv (void);/
3038 <tag/Description/The function returns a 1 if a C64DTV has been detected.
3039 <tag/Notes/<itemize>
3040 <item>The function is specific to the C64.
3042 <tag/Availability/cc65 (not all platforms)
3044 <ref id="get_c64dtv_speed" name="get_c64dtv_speed">,
3045 <ref id="set_c64dtv_speed" name="set_c64dtv_speed">,
3051 <sect1>detect_c65<label id="detect_c65"><p>
3055 <tag/Function/Check for the presence of a C65/C64DX in C64 mode.
3056 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3057 <tag/Declaration/<tt/unsigned char detect_c65 (void);/
3058 <tag/Description/The function returns a 1 if a C65/C64DX in C64 mode has been detected.
3059 <tag/Notes/<itemize>
3060 <item>The function is specific to the C64.
3062 <tag/Availability/cc65 (not all platforms)
3064 <ref id="get_c65_speed" name="get_c65_speed">,
3065 <ref id="set_c65_speed" name="set_c65_speed">,
3071 <sect1>detect_chameleon<label id="detect_chameleon"><p>
3075 <tag/Function/Check for the presence of the C64 Chameleon cartridge.
3076 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3077 <tag/Declaration/<tt/unsigned char detect_chameleon (void);/
3078 <tag/Description/The function returns a 1 if a C64 Chameleon cartridge has been detected.
3079 <tag/Notes/<itemize>
3080 <item>The function is specific to the C64.
3082 <tag/Availability/cc65 (not all platforms)
3084 <ref id="get_chameleon_speed" name="get_chameleon_speed">,
3085 <ref id="set_chameleon_speed" name="set_chameleon_speed">,
3091 <sect1>detect_scpu<label id="detect_scpu"><p>
3095 <tag/Function/Check for the presence of the C64/C128 SuperCPU cartridge.
3096 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3097 <tag/Declaration/<tt/unsigned char detect_scpu (void);/
3098 <tag/Description/The function returns a 1 if a SuperCPU cartridge has been detected.
3099 <tag/Notes/<itemize>
3100 <item>The function is specific to the C128 and C64.
3102 <tag/Availability/cc65 (not all platforms)
3104 <ref id="get_scpu_speed" name="get_scpu_speed">,
3105 <ref id="set_scpu_speed" name="set_scpu_speed">,
3111 <sect1>detect_turbomaster<label id="detect_turbomaster"><p>
3115 <tag/Function/Check for the presence of the C64 Turbo Master cartridge.
3116 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3117 <tag/Declaration/<tt/unsigned char detect_turbomaster (void);/
3118 <tag/Description/The function returns a 1 if a C64 Turbo Master cartridge has been detected.
3119 <tag/Notes/<itemize>
3120 <item>The function is specific to the C64.
3122 <tag/Availability/cc65 (not all platforms)
3124 <ref id="get_turbomaster_speed" name="get_turbomaster_speed">,
3125 <ref id="set_turbomaster_speed" name="set_turbomaster_speed">,
3131 <sect1>div<label id="div"><p>
3135 <tag/Function/Divide two ints and return quotient and remainder.
3136 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3137 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
3138 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
3139 quotient and remainder in a <tt/div_t/ structure.
3140 <tag/Notes/<itemize>
3141 <item>The function is only available as fastcall function, so it may only
3142 be used in presence of a prototype.
3144 <tag/Availability/ISO 9899
3152 <sect1>doesclrscrafterexit<label id="doesclrscrafterexit"><p>
3156 <tag/Function/Determines whether the screen is going to be cleared after program exit.
3157 <tag/Header/<tt/<ref id="cc65.h" name="cc65.h">/
3158 <tag/Declaration/<tt/unsigned char doesclrscrafterexit (void);/
3159 <tag/Description/The function returns zero if the screen won't be cleared immediately after
3160 program termination. It returns a non-zero value if it will.
3161 <tag/Notes/<itemize>
3162 <item>Some systems, maybe depending on configuration, immediately clear the screen
3163 after a program exits. Therefore it might be difficult to read
3164 the last messages printed by the program prior to its exit. This function can be used
3165 to decide if a delay or wait for a key press should be executed when then program
3168 <tag/Availability/cc65
3171 #include <stdio.h>
3172 #include <unistd.h>
3173 #include <cc65.h>
3176 printf("Hello World\n");
3177 if (doesclrscrafterexit())
3186 <sect1>em_commit<label id="em_commit"><p>
3190 <tag/Function/Commit changes into extended memory.
3191 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3192 <tag/Declaration/<tt/void em_commit (void);/
3193 <tag/Description/Commit changes in the memory window to extended storage. If
3194 the contents of the memory window have been changed, these changes may be lost
3195 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
3196 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
3197 name="em_copyto">/ are called without calling <tt/em_commit/ first.
3198 <tag/Notes/<itemize>
3199 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
3200 memory window are discarded, it does just mean that the drivers is allowed
3202 <item>The function is only available as fastcall function, so it may only be
3203 used in presence of a prototype.
3204 <item>The function produces undefined results if no extended memory driver is
3207 <tag/Availability/cc65
3209 <ref id="em_load_driver" name="em_load_driver">,
3210 <ref id="em_map" name="em_map">,
3211 <ref id="em_use" name="em_use">
3217 <sect1>em_copyfrom<label id="em_copyfrom"><p>
3221 <tag/Function/Copy from extended into normal memory.
3222 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3223 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
3224 <tag/Description/Copy data from extended memory into linear memory. Source and
3225 target addresses as well as the number of bytes to transfer are specified in
3226 the <tt/em_copy/ structure that is passed as a parameter.
3227 <tag/Notes/<itemize>
3228 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
3229 made any changes to the data in the window, call <tt/<ref id="em_commit"
3230 name="em_commit">/ first, or the changes are lost.
3231 <item>The function is only available as fastcall function, so it may only be
3232 used in presence of a prototype.
3233 <item>The function produces undefined results if no extended memory driver is
3236 <tag/Availability/cc65
3238 <ref id="em_commit" name="em_commit">,
3239 <ref id="em_copyto" name="em_copyto">,
3240 <ref id="em_load_driver" name="em_load_driver">
3246 <sect1>em_copyto<label id="em_copyto"><p>
3250 <tag/Function/Copy from normal into extended memory.
3251 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3252 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
3253 <tag/Description/Copy data from linear into extended memory. Source and
3254 target addresses as well as the number of bytes to transfer are specified in
3255 the <tt/em_copy/ structure that is passed as a parameter.
3256 <tag/Notes/<itemize>
3257 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
3258 made any changes to the data in the window, call <tt/<ref id="em_commit"
3259 name="em_commit">/ first, or the changes are lost.
3260 <item>The function is only available as fastcall function, so it may only be
3261 used in presence of a prototype.
3262 <item>The function produces undefined results if no extended memory driver is
3265 <tag/Availability/cc65
3267 <ref id="em_commit" name="em_commit">,
3268 <ref id="em_copyfrom" name="em_copyfrom">,
3269 <ref id="em_load_driver" name="em_load_driver">
3275 <sect1>em_install<label id="em_install"><p>
3279 <tag/Function/Install an already loaded extended memory driver.
3280 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3281 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
3282 <tag/Description/The function installs an already loaded extended memory driver
3283 and returns an error code. The function may be used to install a driver linked
3284 statically to the program.
3285 <tag/Notes/<itemize>
3286 <item>Not all drivers are able to detect if the supported hardware is really
3288 <item>The function is only available as fastcall function, so it may only be
3289 used in presence of a prototype.
3291 <tag/Availability/cc65
3293 <ref id="em_load_driver" name="em_load_driver">,
3294 <ref id="em_uninstall" name="em_uninstall">,
3295 <ref id="em_unload" name="em_unload">
3301 <sect1>em_load_driver<label id="em_load_driver"><p>
3305 <tag/Function/Load and initialize an extended memory driver.
3306 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3307 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
3308 <tag/Description/Load an extended memory driver into memory and initialize
3309 it. The function returns an error code that tells if all this has been
3311 <tag/Notes/<itemize>
3312 <item>Not all drivers are able to detect if the supported hardware is really
3314 <item>The function is only available as fastcall function, so it may only be
3315 used in presence of a prototype.
3316 <item>The driver is loaded by name, so currently you must know the type of
3317 extended memory that should be supported. There is no autodetect capability.
3319 <tag/Availability/cc65
3321 <ref id="em_unload" name="em_unload">
3327 <sect1>em_map<label id="em_map"><p>
3331 <tag/Function/Make a page of extended memory accessible.
3332 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3333 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
3334 <tag/Description/The function maps one page of extended memory into linear
3335 memory and returns a pointer to the page frame. Depending on the hardware
3336 and driver, the data is either mapped into the address space or transfered
3337 into a buffer. If you don't need the actual contents of the page (for example
3338 because you're going to overwrite it completely), it is better to call
3339 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
3340 data if it is possible to avoid that.
3341 <tag/Notes/<itemize>
3342 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
3343 made any changes to the data in the window, call <tt/<ref id="em_commit"
3344 name="em_commit">/ first, or the changes are lost.
3345 <item>The function is only available as fastcall function, so it may only be
3346 used in presence of a prototype.
3347 <item>The function produces undefined results if no extended memory driver is
3350 <tag/Availability/cc65
3352 <ref id="em_commit" name="em_commit">,
3353 <ref id="em_load_driver" name="em_load_driver">,
3354 <ref id="em_use" name="em_use">
3360 <sect1>em_pagecount<label id="em_pagecount"><p>
3364 <tag/Function/Return the number of available extended memory pages.
3365 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3366 <tag/Declaration/<tt/unsigned em_pagecount (void);/
3367 <tag/Description/The function returns the size of the extended memory supported
3368 by the driver in 256 byte pages.
3369 <tag/Notes/<itemize>
3370 <item>The function returns zero if no extended memory driver is loaded.
3371 <item>The function may return zero if the supported hardware was not detected.
3373 <tag/Availability/cc65
3375 <ref id="em_load_driver" name="em_load_driver">
3381 <sect1>em_uninstall<label id="em_uninstall"><p>
3385 <tag/Function/Uninstall an already loaded extended memory driver.
3386 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3387 <tag/Declaration/<tt/unsigned char em_uninstall (void);/
3388 <tag/Description/The function uninstalls an already loaded extended memory
3389 driver but doesn't remove it from memory.
3390 <tag/Notes/<itemize>
3391 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
3392 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
3393 should be used instead of <tt/em_uninstall/ so the driver is also removed
3396 <tag/Availability/cc65
3398 <ref id="em_install" name="em_install">,
3399 <ref id="em_load_driver" name="em_load_driver">,
3400 <ref id="em_unload" name="em_unload">
3406 <sect1>em_unload<label id="em_unload"><p>
3410 <tag/Function/Unload an extended memory driver.
3411 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3412 <tag/Declaration/<tt/unsigned char em_unload (void);/
3413 <tag/Description/The function unloads a loaded extended memory driver and
3414 frees all memory allocated for the driver.
3415 <tag/Notes/<itemize>
3416 <item>The function does nothing if no driver is loaded.
3418 <tag/Availability/cc65
3420 <ref id="em_load_driver" name="em_load_driver">
3426 <sect1>em_use<label id="em_use"><p>
3430 <tag/Function/Prepare an extended memory page for use.
3431 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3432 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
3433 <tag/Description/The function maps one page of extended memory into linear
3434 memory and returns a pointer to the page frame. This function is similar to
3435 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
3436 actual memory window in the assumption that the existing data is wrong or
3437 will get overwritten.
3438 <tag/Notes/<itemize>
3439 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
3440 made any changes to the data in the window, call <tt/<ref id="em_commit"
3441 name="em_commit">/ first, or the changes are lost.
3442 <item>The function is only available as fastcall function, so it may only be
3443 used in presence of a prototype.
3444 <item>The function produces undefined results if no extended memory driver is
3447 <tag/Availability/cc65
3449 <ref id="em_commit" name="em_commit">,
3450 <ref id="em_load_driver" name="em_load_driver">,
3451 <ref id="em_map" name="em_map">
3457 <sect1>exit<label id="exit"><p>
3461 <tag/Function/Terminate the program.
3462 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3463 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
3464 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
3465 return code of the program. Before termination, all files are closed, buffered
3466 output is written and any functions registered with <tt/<ref id="atexit"
3467 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
3468 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
3470 <tag/Notes/<itemize>
3471 <item>The function is only available as fastcall function, so it may only
3472 be used in presence of a prototype.
3473 <item>It depends on the host machine if the program return code can be
3474 evaluated or is ignored.
3476 <tag/Availability/ISO 9899
3478 <ref id="abort" name="abort">,
3479 <ref id="exit" name="exit">
3485 <sect1>exec<label id="exec"><p>
3489 <tag/Function/Execute a program file.
3490 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3491 <tag/Declaration/<tt/int __fastcall__ exec (const char* progname, const char* cmdline);/
3492 <tag/Description/<tt/exec/ replaces the currently running program by a new one.
3493 Calling <tt/exec()/ is identical to calling <tt/<ref id="exit" name="exit()">/,
3494 then loading and starting the program named in the first argument, passing
3495 the command line specified as second argument. Instead of an empty string,
3496 a <tt/NULL/ pointer may be passed as second parameter.
3497 On success, the function does not return. On failure, -1 is returned and
3498 <tt/errno/ contains an error code.
3499 <tag/Notes/<itemize>
3500 <item>The function is only available as fastcall function, so it may only
3501 be used in presence of a prototype.
3502 <item>On most platforms, the function needs to copy a small stub loader to
3503 some memory area outside the program space. This may collide with other
3504 programs. See the platform specific docs on this.
3505 <item>Because it is necessary to terminate the running program before the
3506 memory can be reused to load the new one, there is a high chance that the
3507 function may not be able to return on errors.
3508 <item>The command line is passed to the new program in the same way as cc65
3509 programs expect the command line. If the new program is not a cc65 generated
3510 program, it may not be able to read it.
3512 <tag/Availability/cc65
3514 <ref id="exit" name="exit">
3520 <sect1>fast<label id="fast"><p>
3524 <tag/Function/Switch the CPU into fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
3525 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
3526 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
3527 <tag/Declaration/<tt/void fast (void);/
3528 <tag/Description/The function will switch the clock of the CPU to fast mode. For the C128
3529 target it means switching the CPU into 2MHz mode. For the C16/Plus4 target it means
3530 switching the CPU into double clock mode.
3531 <tag/Notes/<itemize>
3532 <item>The function is specific to the C128, C16 and Plus4.
3533 <item>On the C128 the 2MHz clock will not work in 40 column mode.
3535 <tag/Availability/cc65 (not all platforms)
3537 <ref id="isfast" name="isfast">,
3538 <ref id="slow" name="slow">,
3544 <sect1>feof<label id="feof"><p>
3548 <tag/Function/Return the end-of-file indicator of a stream.
3549 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3550 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
3551 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
3552 <tt/f/, and returns a non zero value if it is set.
3553 <tag/Notes/<itemize>
3554 <item>The indicator is set only after a read past the end of a file is
3556 <item>The function is only available as fastcall function, so it may only be
3557 used in presence of a prototype.
3559 <tag/Availability/ISO 9899
3561 <ref id="feof" name="clearerr">,
3562 <ref id="ferror" name="ferror">
3568 <sect1>ferror<label id="ferror"><p>
3572 <tag/Function/Return the error indicator of a stream.
3573 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3574 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
3575 <tag/Description/<tt/ferror/ tests the error indicator of the stream
3576 <tt/f/, and returns a non zero value if it is set.
3577 <tag/Notes/<itemize>
3578 <item>The function is only available as fastcall function, so it may only be
3579 used in presence of a prototype.
3581 <tag/Availability/ISO 9899
3583 <ref id="feof" name="clearerr">,
3584 <ref id="ferror" name="feof">
3590 <sect1>fileno<label id="fileno"><p>
3594 <tag/Function/Return the file handle used by a stream.
3595 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3596 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
3597 <tag/Description/The <tt/fileno/ function returns the file handle used
3598 internally by a C stream. This file handle (an integer) can be used as a
3599 handle for the POSIX input/output functions.
3600 <tag/Notes/<itemize>
3601 <item>The function is only available as fastcall function, so it may only be
3602 used in presence of a prototype.
3603 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
3604 file may have unpredictable results.
3606 <tag/Availability/POSIX 1003.1
3608 <ref id="creat" name="creat">,
3609 <ref id="open" name="open"> <!-- , -->
3610 <!-- <ref id="read" name="read">, -->
3611 <!-- <ref id="write" name="write"> -->
3617 <sect1>free<label id="free"><p>
3621 <tag/Function/Free a block of dynamic memory.
3622 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3623 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
3624 <tag/Description/Free a block of dynamic memory previously allocated with
3625 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
3626 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
3627 pointer is <tt/NULL/, no action is performed.
3628 <tag/Notes/<itemize>
3629 <item>Passing an already free'd block to <tt/free/ again will cause undefined
3630 behaviour and may crash your program.
3631 <item>The function is only available as fastcall function, so it may only
3632 be used in presence of a prototype.
3634 <tag/Availability/ISO 9899
3636 <ref id="_heapadd" name="_heapadd">,
3637 <ref id="_heapblocksize" name="_heapblocksize">,
3638 <ref id="_heapmaxavail" name="_heapmaxavail">,
3639 <ref id="_heapmemavail" name="_heapmemavail">,
3640 <ref id="calloc" name="calloc">,
3641 <ref id="malloc" name="malloc">,
3642 <ref id="realloc" name="realloc">
3648 <sect1>get_ostype<label id="get_ostype"><p>
3652 <tag/Function/The function returns the operating system, the program runs on.
3653 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
3654 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
3655 <tag/Declaration/<tt/unsigned char get_ostype (void);/
3656 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
3657 all supported targets. If it exists, it returns a number that identifies the
3658 operating system or machine type, the program runs on. The machine dependent
3659 header files define constants that can be used to check the return code.
3660 <tag/Notes/<itemize>
3661 <item>The function does not exist on all platforms.
3662 <item>The return codes are platform dependent.
3664 <tag/Availability/cc65 (not all platforms)
3670 <sect1>get_c128_speed<label id="get_c128_speed"><p>
3674 <tag/Function/Get the current speed of the C128 CPU.
3675 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3676 <tag/Declaration/<tt/unsigned char get_c128_speed (void);/
3677 <tag/Description/The function returns the current speed of the C128 CPU.
3678 <tag/Notes/<itemize>
3679 <item>The function is specific to the C64 and C128.
3680 <item>The function does not check if the C128 CPU is the current CPU.
3681 <item>See the accelerator.h header for the speed definitions.
3683 <tag/Availability/cc65 (not all platforms)
3685 <ref id="detect_c128" name="detect_c128">,
3686 <ref id="set_c128_speed" name="set_c128_speed">,
3692 <sect1>get_c64dtv_speed<label id="get_c64dtv_speed"><p>
3696 <tag/Function/Get the current speed of the C64DTV.
3697 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3698 <tag/Declaration/<tt/unsigned char get_c64dtv_speed (void);/
3699 <tag/Description/The function returns the current speed of the C64DTV.
3700 <tag/Notes/<itemize>
3701 <item>The function is specific to the C64.
3702 <item>The function does not check for the presence of the C64DTV.
3703 <item>See the accelerator.h header for the speed definitions.
3705 <tag/Availability/cc65 (not all platforms)
3707 <ref id="detect_c64dtv" name="detect_c64dtv">,
3708 <ref id="set_c64dtv_speed" name="set_c64dtv_speed">,
3714 <sect1>get_c65_speed<label id="get_c65_speed"><p>
3718 <tag/Function/Get the current speed of the C65/C64DX in C64 mode.
3719 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3720 <tag/Declaration/<tt/unsigned char get_c65_speed (void);/
3721 <tag/Description/The function returns the current speed of the C65/C64DX in C64 mode.
3722 <tag/Notes/<itemize>
3723 <item>The function is specific to the C64.
3724 <item>The function does not check for the presence of a C65/C64DX in C64 mode.
3725 <item>See the accelerator.h header for the speed definitions.
3727 <tag/Availability/cc65 (not all platforms)
3729 <ref id="detect_c65" name="detect_c65">,
3730 <ref id="set_c65_speed" name="set_c65_speed">,
3736 <sect1>get_chameleon_speed<label id="get_chameleon_speed"><p>
3740 <tag/Function/Get the current speed of the C64 Chameleon cartridge.
3741 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3742 <tag/Declaration/<tt/unsigned char get_chameleon_speed (void);/
3743 <tag/Description/The function returns the current speed of the C64 Chameleon cartridge.
3744 <tag/Notes/<itemize>
3745 <item>The function is specific to the C64.
3746 <item>The function does not check for the presence of the C64 Chameleon cartridge.
3747 <item>See the accelerator.h header for the speed definitions.
3749 <tag/Availability/cc65 (not all platforms)
3751 <ref id="detect_chameleon" name="detect_chameleon">,
3752 <ref id="set_chameleon_speed" name="set_chameleon_speed">,
3758 <sect1>get_scpu_speed<label id="get_scpu_speed"><p>
3762 <tag/Function/Get the current speed of the C64/C128 SuperCPU cartridge.
3763 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3764 <tag/Declaration/<tt/unsigned char get_scpu_speed (void);/
3765 <tag/Description/The function returns the current speed of the SuperCPU cartridge.
3766 <tag/Notes/<itemize>
3767 <item>The function is specific to the C128 and C64.
3768 <item>The function does not check for the presence of the cartridge.
3769 <item>See the accelerator.h header for the speed definitions.
3771 <tag/Availability/cc65 (not all platforms)
3773 <ref id="detect_scpu" name="detect_scpu">,
3774 <ref id="set_scpu_speed" name="set_scpu_speed">,
3780 <sect1>get_turbomaster_speed<label id="get_turbomaster_speed"><p>
3784 <tag/Function/Get the current speed of the C64 Turbo Master cartridge.
3785 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3786 <tag/Declaration/<tt/unsigned char get_turbomaster_speed (void);/
3787 <tag/Description/The function returns the current speed of the C64 Turbo Master cartridge.
3788 <tag/Notes/<itemize>
3789 <item>The function is specific to the C64.
3790 <item>The function does not check for the presence of the C64 Turbo Master cartridge.
3791 <item>See the accelerator.h header for the speed definitions.
3793 <tag/Availability/cc65 (not all platforms)
3795 <ref id="detect_turbomaster" name="detect_turbomaster">,
3796 <ref id="set_turbomaster_speed" name="set_turbomaster_speed">,
3801 <sect1>getcpu<label id="getcpu"><p>
3805 <tag/Function/Determine on which CPU the program is running.
3806 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3807 <tag/Declaration/<tt/unsigned char getcpu (void);/
3808 <tag/Description/The function checks on which CPU the code is running. It
3809 returns one of the constants<itemize>
3811 <item><tt/CPU_65C02/
3812 <item><tt/CPU_65816/
3814 <item><tt/CPU_65SC02/
3815 <item><tt/CPU_65CE02/
3816 <item><tt/CPU_HUC6280/
3819 <tag/Notes/<itemize>
3820 <item>Other, more exotic CPU types are not disinguished.
3822 <tag/Availability/cc65
3828 <sect1>getcurrentdevice<label id="getcurrentdevice"><p>
3832 <tag/Function/Get current device.
3833 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3834 <tag/Declaration/<tt/unsigned char getcurrentdevice (void);/
3835 <tag/Description/The function returns the current device.
3836 It allows to access the current device with the <ref id="dio.h"
3837 name="Low-level disk I/O API"> or <ref id="cbm.h" name="cbm_* I/O
3838 functions"> requiring a 'device' parameter.
3839 <tag/Availability/cc65
3841 <ref id="getdevicedir" name="getdevicedir">,
3842 <ref id="getfirstdevice" name="getfirstdevice">,
3843 <ref id="getnextdevice" name="getnextdevice">
3845 dio_open (getcurrentdevice ());
3851 <sect1>getcwd<label id="getcwd"><p>
3855 <tag/Function/Get current working directory.
3856 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3857 <tag/Declaration/<tt/char* __fastcall__ getcwd (char* buf, size_t size);/
3858 <tag/Description/The function will return the current working directory.
3859 <tag/Notes/<itemize>
3860 <item>The function is only available as fastcall function, so it may only
3861 be used in presence of a prototype.
3863 <tag/Availability/POSIX 1003.1
3869 <sect1>getdevicedir<label id="getdevicedir"><p>
3873 <tag/Function/Get device directory.
3874 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3875 <tag/Declaration/<tt/char* __fastcall__ getdevicedir (unsigned char device, char* buf, size_t size);/
3876 <tag/Description/The function returns the directory representing <tt/device/.
3877 It allows to access the device on filesystem level by calling chdir() with
3878 the directory returned.
3879 <tag/Notes/<itemize>
3880 <item>Calling getdevicedir() <em/does/ check for a (formatted) disk in a
3881 floppy-disk-type device and returns NULL if that check fails.
3882 <item>The function is only available as fastcall function, so it may only
3883 be used in presence of a prototype.
3885 <tag/Availability/cc65
3887 <ref id="getcwd" name="getcwd">,
3888 <ref id="getcurrentdevice" name="getcurrentdevice">,
3889 <ref id="getfirstdevice" name="getfirstdevice">,
3890 <ref id="getnextdevice" name="getnextdevice">
3892 chdir (getdevicedir (device, buf, sizeof buf));
3894 cf. <tt/samples/enumdevdir.c/
3899 <sect1>getenv<label id="getenv"><p>
3903 <tag/Function/Return a value from the environment.
3904 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3905 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
3906 <tag/Description/The function searches the environment for an entry that
3907 matches <tt/name/ and returns its value. The environment consists of a list
3908 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
3910 <tag/Notes/<itemize>
3911 <item>What exactly is stored in the environment depends on the machine the
3912 program is running on.
3913 <item>The function is only available as fastcall function, so it may only
3914 be used in presence of a prototype.
3916 <tag/Availability/ISO 9899
3922 <sect1>getfirstdevice<label id="getfirstdevice"><p>
3926 <tag/Function/Get first device.
3927 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3928 <tag/Declaration/<tt/unsigned char getfirstdevice (void);/
3929 <tag/Description/The function returns the first device.
3930 The constant <tt/INVALID_DEVICE/ indicates no device.
3931 <tag/Notes/<itemize>
3932 <item>Calling getfirstdevice() does <em/not/ turn on the motor of a
3933 drive-type device and does <em/not/ check for a disk in the drive.
3935 <tag/Availability/cc65
3937 <ref id="getcurrentdevice" name="getcurrentdevice">,
3938 <ref id="getdevicedir" name="getdevicedir">,
3939 <ref id="getnextdevice" name="getnextdevice">
3941 unsigned char dev = getfirstdevice ();
3942 while (dev != INVALID_DEVICE) {
3943 printf ("%d\n", dev);
3944 dev = getnextdevice (dev);
3951 <sect1>getnextdevice<label id="getnextdevice"><p>
3955 <tag/Function/Get next device.
3956 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3957 <tag/Declaration/<tt/unsigned char __fastcall__ getnextdevice (unsigned char device);/
3958 <tag/Description/The function returns the next device after <tt/device/.
3959 The constant <tt/INVALID_DEVICE/ indicates no further device.
3960 <tag/Notes/<itemize>
3961 <item>Calling getnextdevice() does <em/not/ turn on the motor of a
3962 drive-type device and does <em/not/ check for a disk in the drive.
3963 <item>The function is only available as fastcall function, so it may only
3964 be used in presence of a prototype.
3966 <tag/Availability/cc65
3968 <ref id="getcurrentdevice" name="getcurrentdevice">,
3969 <ref id="getdevicedir" name="getdevicedir">,
3970 <ref id="getfirstdevice" name="getfirstdevice">
3972 unsigned char dev = getfirstdevice ();
3973 while (dev != INVALID_DEVICE) {
3974 printf ("%d\n", dev);
3975 dev = getnextdevice (dev);
3982 <sect1>getopt<label id="getopt"><p>
3986 <tag/Function/Parse command line options.
3987 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3988 <tag/Declaration/<tt/int __fastcall__ getopt (int argc, char* const* argv,
3989 const char* optstring);/
3990 <tag/Description/The function parses command line arguments, <tt/argc/ and
3991 <tt/argv/ are the argument count and array passed to <tt/main/. <tt/optstring/
3992 is a string that contains command line option characters. If a character in
3993 <tt/optstring/ is followed by a colon, the option requires an argument. An
3994 option on the command line is recognized if it is one of the option characters
3996 <tt/getopt/ must be called repeatedly. It will return each option character
3997 found on the command line and <tt/EOF/ (-1) if there is no other option. An
3998 option argument is placed in <tt/optarg/, the index of the next element on the
3999 command line to be processed is placed in <tt/optind/.
4000 <tag/Notes/<itemize>
4001 <item>The implementation will not reorder options. A non option on the command
4002 line will terminate option processing. All remaining arguments are not
4003 recognized as options, even if the start with a '-' character.
4004 <item>The function is only available as fastcall function, so it may only
4005 be used in presence of a prototype.
4007 <tag/Availability/POSIX.2
4013 <sect1>gotox<label id="gotox"><p>
4017 <tag/Function/Move the text mode cursor to a new X position.
4018 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4019 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
4020 <tag/Description/The function moves the text mode cursor to the specified X
4021 position while leaving the Y position untouched. The leftmost position on the
4022 screen has the coordinate 0.
4023 <tag/Notes/<itemize>
4024 <item>The function is only available as fastcall function, so it may
4025 only be used in presence of a prototype.
4026 <item>Invalid values for the X position (out of screen coordinates) may
4027 lead to undefined behaviour.
4029 <tag/Availability/cc65
4031 <ref id="gotoy" name="gotoy">,
4032 <ref id="gotoxy" name="gotoxy">,
4033 <ref id="wherex" name="wherex">,
4034 <ref id="wherey" name="wherey">
4040 <sect1>gotoxy<label id="gotoxy"><p>
4044 <tag/Function/Move the text mode cursor to a new position.
4045 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4046 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
4047 <tag/Description/The function moves the text mode cursor to the specified
4048 position. The leftmost position on the screen has the X coordinate 0, the
4049 topmost line has the Y coordinate 0.
4050 <tag/Notes/<itemize>
4051 <item>The function is only available as fastcall function, so it may only be
4052 used in presence of a prototype.
4053 <item>Invalid values for any of both coordinates (out of screen positions) may
4054 lead to undefined behaviour.
4056 <tag/Availability/cc65
4058 <ref id="gotox" name="gotox">,
4059 <ref id="gotoy" name="gotoy">,
4060 <ref id="wherex" name="wherex">,
4061 <ref id="wherey" name="wherey">
4067 <sect1>gotoy<label id="gotoy"><p>
4071 <tag/Function/Move the text mode cursor to a new Y position.
4072 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4073 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
4074 <tag/Description/The function moves the text mode cursor to the specified Y
4075 position while leaving the X position untouched. The uppermost position on the
4076 screen has the coordinate 0.
4077 <tag/Notes/<itemize>
4078 <item>The function is only available as fastcall function, so it may
4079 only be used in presence of a prototype.
4080 <item>Invalid values for the Y position (out of screen coordinates) may lead
4081 to undefined behaviour.
4083 <tag/Availability/cc65
4085 <ref id="gotox" name="gotox">,
4086 <ref id="gotoxy" name="gotoxy">,
4087 <ref id="wherex" name="wherex">,
4088 <ref id="wherey" name="wherey">
4094 <sect1>isalnum<label id="isalnum"><p>
4098 <tag/Function/Check if a given character is a letter or digit.
4099 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4100 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
4101 <tag/Description/The function returns a non zero value if the given argument
4102 is a letter or digit. The return value is zero if the character is anything
4104 <tag/Notes/<itemize>
4105 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4106 inline sequence generated by the macro will not work correctly for values
4107 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4108 this range. The non inline function may be accessed by <tt/#undef/'ing
4110 <item>When compiling without <tt/-Os/, the function is only available as
4111 fastcall function, so it may only be used in presence of a prototype.
4113 <tag/Availability/ISO 9899
4115 <ref id="isalpha" name="isalpha">,
4116 <ref id="isascii" name="isascii">,
4117 <ref id="isblank" name="isblank">,
4118 <ref id="iscntrl" name="iscntrl">,
4119 <ref id="isdigit" name="isdigit">,
4120 <ref id="isgraph" name="isgraph">,
4121 <ref id="islower" name="islower">,
4122 <ref id="isprint" name="isprint">,
4123 <ref id="ispunct" name="ispunct">,
4124 <ref id="isspace" name="isspace">,
4125 <ref id="isupper" name="isupper">,
4126 <ref id="isxdigit" name="isxdigit">
4132 <sect1>isalpha<label id="isalpha"><p>
4136 <tag/Function/Check if a given character is a letter.
4137 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4138 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
4139 <tag/Description/The function returns a non zero value if the given argument
4140 is a letter. The return value is zero if the character is anything else.
4141 <tag/Notes/<itemize>
4142 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4143 inline sequence generated by the macro will not work correctly for values
4144 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4145 this range. The non inline function may be accessed by <tt/#undef/'ing the
4147 <item>When compiling without <tt/-Os/, the function is only available as
4148 fastcall function, so it may only be used in presence of a prototype.
4150 <tag/Availability/ISO 9899
4152 <ref id="isalnum" name="isalnum">,
4153 <ref id="isascii" name="isascii">,
4154 <ref id="isblank" name="isblank">,
4155 <ref id="iscntrl" name="iscntrl">,
4156 <ref id="isdigit" name="isdigit">,
4157 <ref id="isgraph" name="isgraph">,
4158 <ref id="islower" name="islower">,
4159 <ref id="isprint" name="isprint">,
4160 <ref id="ispunct" name="ispunct">,
4161 <ref id="isspace" name="isspace">,
4162 <ref id="isupper" name="isupper">,
4163 <ref id="isxdigit" name="isxdigit">
4169 <sect1>isascii<label id="isascii"><p>
4173 <tag/Function/Check if a given character is in the ASCII (0..127) range.
4174 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4175 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
4176 <tag/Description/The function returns a non zero value if the given argument
4177 is in the range 0..127 (the range of valid ASCII characters) and zero if not.
4178 <tag/Notes/<itemize>
4179 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4180 inline sequence generated by the macro will not work correctly for values
4181 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4182 this range. The non inline function may be accessed by <tt/#undef/'ing the
4184 <item>When compiling without <tt/-Os/, the function is only available as
4185 fastcall function, so it may only be used in presence of a prototype.
4187 <tag/Availability/ISO 9899
4189 <ref id="isalnum" name="isalnum">,
4190 <ref id="isalpha" name="isalpha">,
4191 <ref id="isblank" name="isblank">,
4192 <ref id="iscntrl" name="iscntrl">,
4193 <ref id="isdigit" name="isdigit">,
4194 <ref id="isgraph" name="isgraph">,
4195 <ref id="islower" name="islower">,
4196 <ref id="isprint" name="isprint">,
4197 <ref id="ispunct" name="ispunct">,
4198 <ref id="isspace" name="isspace">,
4199 <ref id="isupper" name="isupper">,
4200 <ref id="isxdigit" name="isxdigit">
4206 <sect1>isblank<label id="isblank"><p>
4210 <tag/Function/Check if a given character is a space or tab.
4211 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4212 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
4213 <tag/Description/The function returns a non zero value if the given argument
4214 is a space or tab character. The return value is zero if the character is
4216 <tag/Notes/<itemize>
4217 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4218 inline sequence generated by the macro will not work correctly for values
4219 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4220 this range. The non inline function may be accessed by <tt/#undef/'ing the
4222 <item>When compiling without <tt/-Os/, the function is only available as
4223 fastcall function, so it may only be used in presence of a prototype.
4225 <tag/Availability/ISO 9899
4227 <ref id="isalnum" name="isalnum">,
4228 <ref id="isalpha" name="isalpha">,
4229 <ref id="isascii" name="isascii">,
4230 <ref id="iscntrl" name="iscntrl">,
4231 <ref id="isdigit" name="isdigit">,
4232 <ref id="isgraph" name="isgraph">,
4233 <ref id="islower" name="islower">,
4234 <ref id="isprint" name="isprint">,
4235 <ref id="ispunct" name="ispunct">,
4236 <ref id="isspace" name="isspace">,
4237 <ref id="isupper" name="isupper">,
4238 <ref id="isxdigit" name="isxdigit">
4244 <sect1>iscntrl<label id="iscntrl"><p>
4248 <tag/Function/Check if a given character is a control character.
4249 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4250 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
4251 <tag/Description/The function returns a non zero value if the given argument
4252 is a control character. The return value is zero if the character is anything
4254 <tag/Notes/<itemize>
4255 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4256 inline sequence generated by the macro will not work correctly for values
4257 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4258 this range. The non inline function may be accessed by <tt/#undef/'ing the
4260 <item>When compiling without <tt/-Os/, the function is only available as
4261 fastcall function, so it may only be used in presence of a prototype.
4263 <tag/Availability/ISO 9899
4265 <ref id="isalnum" name="isalnum">,
4266 <ref id="isalpha" name="isalpha">,
4267 <ref id="isascii" name="isascii">,
4268 <ref id="isblank" name="isblank">,
4269 <ref id="isdigit" name="isdigit">,
4270 <ref id="isgraph" name="isgraph">,
4271 <ref id="islower" name="islower">,
4272 <ref id="isprint" name="isprint">,
4273 <ref id="ispunct" name="ispunct">,
4274 <ref id="isspace" name="isspace">,
4275 <ref id="isupper" name="isupper">,
4276 <ref id="isxdigit" name="isxdigit">
4282 <sect1>isdigit<label id="isdigit"><p>
4286 <tag/Function/Check if a given character is a digit.
4287 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4288 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
4289 <tag/Description/The function returns a non zero value if the given argument
4290 is a digit. The return value is zero if the character is anything else.
4291 <tag/Notes/<itemize>
4292 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4293 inline sequence generated by the macro will not work correctly for values
4294 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4295 this range. The non inline function may be accessed by <tt/#undef/'ing the
4297 <item>When compiling without <tt/-Os/, the function is only available as
4298 fastcall function, so it may only be used in presence of a prototype.
4300 <tag/Availability/ISO 9899
4302 <ref id="isalnum" name="isalnum">,
4303 <ref id="isalpha" name="isalpha">,
4304 <ref id="isascii" name="isascii">,
4305 <ref id="isblank" name="isblank">,
4306 <ref id="iscntrl" name="iscntrl">,
4307 <ref id="isgraph" name="isgraph">,
4308 <ref id="islower" name="islower">,
4309 <ref id="isprint" name="isprint">,
4310 <ref id="ispunct" name="ispunct">,
4311 <ref id="isspace" name="isspace">,
4312 <ref id="isupper" name="isupper">,
4313 <ref id="isxdigit" name="isxdigit">
4319 <sect1>isfast<label id="isfast"><p>
4323 <tag/Function/Check if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
4324 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
4325 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
4326 <tag/Declaration/<tt/unsigned char isfast (void);/
4327 <tag/Description/The function returns a 1 if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
4328 <tag/Notes/<itemize>
4329 <item>The function is specific to the C128, C16 and Plus4.
4331 <tag/Availability/cc65 (not all platforms)
4333 <ref id="fast" name="fast">,
4334 <ref id="slow" name="slow">,
4340 <sect1>isgraph<label id="isgraph"><p>
4344 <tag/Function/Check if a given character is a printable character (except
4346 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4347 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
4348 <tag/Description/The function returns a non zero value if the given argument
4349 is a printable character with the exception of space. The return value is zero
4350 if the character is anything else.
4351 <tag/Notes/<itemize>
4352 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4353 inline sequence generated by the macro will not work correctly for values
4354 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4355 this range. The non inline function may be accessed by <tt/#undef/'ing the
4357 <item>When compiling without <tt/-Os/, the function is only available as
4358 fastcall function, so it may only be used in presence of a prototype.
4360 <tag/Availability/ISO 9899
4362 <ref id="isalnum" name="isalnum">,
4363 <ref id="isalpha" name="isalpha">,
4364 <ref id="isascii" name="isascii">,
4365 <ref id="isblank" name="isblank">,
4366 <ref id="iscntrl" name="iscntrl">,
4367 <ref id="isdigit" name="isdigit">,
4368 <ref id="islower" name="islower">,
4369 <ref id="isprint" name="isprint">,
4370 <ref id="ispunct" name="ispunct">,
4371 <ref id="isspace" name="isspace">,
4372 <ref id="isupper" name="isupper">,
4373 <ref id="isxdigit" name="isxdigit">
4379 <sect1>islower<label id="islower"><p>
4383 <tag/Function/Check if a given character is a lower case letter.
4384 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4385 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
4386 <tag/Description/The function returns a non zero value if the given argument
4387 is a lower case letter. The return value is zero if the character is anything
4389 <tag/Notes/<itemize>
4390 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4391 inline sequence generated by the macro will not work correctly for values
4392 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4393 this range. The non inline function may be accessed by <tt/#undef/'ing the
4395 <item>When compiling without <tt/-Os/, the function is only available as
4396 fastcall function, so it may only be used in presence of a prototype.
4398 <tag/Availability/ISO 9899
4400 <ref id="isalnum" name="isalnum">,
4401 <ref id="isalpha" name="isalpha">,
4402 <ref id="isascii" name="isascii">,
4403 <ref id="isblank" name="isblank">,
4404 <ref id="iscntrl" name="iscntrl">,
4405 <ref id="isdigit" name="isdigit">,
4406 <ref id="isgraph" name="isgraph">,
4407 <ref id="isprint" name="isprint">,
4408 <ref id="ispunct" name="ispunct">,
4409 <ref id="isspace" name="isspace">,
4410 <ref id="isupper" name="isupper">,
4411 <ref id="isxdigit" name="isxdigit">
4417 <sect1>isprint<label id="isprint"><p>
4421 <tag/Function/Check if a given character is a printable character.
4422 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4423 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
4424 <tag/Description/The function returns a non zero value if the given argument
4425 is a printable character (this includes the space character). The return value
4426 is zero if the character is anything else.
4427 <tag/Notes/<itemize>
4428 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4429 inline sequence generated by the macro will not work correctly for values
4430 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4431 this range. The non inline function may be accessed by <tt/#undef/'ing the
4433 <item>When compiling without <tt/-Os/, the function is only available as
4434 fastcall function, so it may only be used in presence of a prototype.
4436 <tag/Availability/ISO 9899
4438 <ref id="isalnum" name="isalnum">,
4439 <ref id="isalpha" name="isalpha">,
4440 <ref id="isascii" name="isascii">,
4441 <ref id="isblank" name="isblank">,
4442 <ref id="iscntrl" name="iscntrl">,
4443 <ref id="isdigit" name="isdigit">,
4444 <ref id="isgraph" name="isgraph">,
4445 <ref id="islower" name="islower">,
4446 <ref id="ispunct" name="ispunct">,
4447 <ref id="isspace" name="isspace">,
4448 <ref id="isupper" name="isupper">,
4449 <ref id="isxdigit" name="isxdigit">
4455 <sect1>ispunct<label id="ispunct"><p>
4459 <tag/Function/Check if a given character is a printable character but not a
4460 space or an alphanumeric character.
4461 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4462 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
4463 <tag/Description/The function returns a non zero value if the given argument
4464 is a printable character, but not a space or anything alphanumeric. The return
4465 value is zero if the character is anything else.
4466 <tag/Notes/<itemize>
4467 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4468 inline sequence generated by the macro will not work correctly for values
4469 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4470 this range. The non inline function may be accessed by <tt/#undef/'ing the
4472 <item>When compiling without <tt/-Os/, the function is only available as
4473 fastcall function, so it may only be used in presence of a prototype.
4475 <tag/Availability/ISO 9899
4477 <ref id="isalnum" name="isalnum">,
4478 <ref id="isalpha" name="isalpha">,
4479 <ref id="isascii" name="isascii">,
4480 <ref id="isblank" name="isblank">,
4481 <ref id="iscntrl" name="iscntrl">,
4482 <ref id="isdigit" name="isdigit">,
4483 <ref id="isgraph" name="isgraph">,
4484 <ref id="islower" name="islower">,
4485 <ref id="isprint" name="isprint">,
4486 <ref id="isspace" name="isspace">,
4487 <ref id="isupper" name="isupper">,
4488 <ref id="isxdigit" name="isxdigit">
4494 <sect1>isspace<label id="isspace"><p>
4498 <tag/Function/Check if a given character is a white-space character.
4499 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4500 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
4501 <tag/Description/The function returns a non zero value if the given argument
4502 is a white space character. The return value is zero if the character is
4503 anything else. The standard white space characters are: space, formfeed ('\f'),
4504 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
4506 <tag/Notes/<itemize>
4507 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4508 inline sequence generated by the macro will not work correctly for values
4509 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4510 this range. The non inline function may be accessed by <tt/#undef/'ing the
4512 <item>When compiling without <tt/-Os/, the function is only available as
4513 fastcall function, so it may only be used in presence of a prototype.
4515 <tag/Availability/ISO 9899
4517 <ref id="isalnum" name="isalnum">,
4518 <ref id="isalpha" name="isalpha">,
4519 <ref id="isascii" name="isascii">,
4520 <ref id="isblank" name="isblank">,
4521 <ref id="iscntrl" name="iscntrl">,
4522 <ref id="isdigit" name="isdigit">,
4523 <ref id="isgraph" name="isgraph">,
4524 <ref id="islower" name="islower">,
4525 <ref id="isprint" name="isprint">,
4526 <ref id="ispunct" name="ispunct">,
4527 <ref id="isupper" name="isupper">,
4528 <ref id="isxdigit" name="isxdigit">
4534 <sect1>isupper<label id="isupper"><p>
4538 <tag/Function/Check if a given character is an upper case letter.
4539 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4540 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
4541 <tag/Description/The function returns a non zero value if the given argument
4542 is an upper case letter. The return value is zero if the character is anything
4544 <tag/Notes/<itemize>
4545 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4546 inline sequence generated by the macro will not work correctly for values
4547 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4548 this range. The non inline function may be accessed by <tt/#undef/'ing the
4550 <item>When compiling without <tt/-Os/, the function is only available as
4551 fastcall function, so it may only be used in presence of a prototype.
4553 <tag/Availability/ISO 9899
4555 <ref id="isalnum" name="isalnum">,
4556 <ref id="isalpha" name="isalpha">,
4557 <ref id="isascii" name="isascii">,
4558 <ref id="isblank" name="isblank">,
4559 <ref id="iscntrl" name="iscntrl">,
4560 <ref id="isdigit" name="isdigit">,
4561 <ref id="isgraph" name="isgraph">,
4562 <ref id="islower" name="islower">,
4563 <ref id="isprint" name="isprint">,
4564 <ref id="ispunct" name="ispunct">,
4565 <ref id="isspace" name="isspace">,
4566 <ref id="isxdigit" name="isxdigit">
4572 <sect1>isxdigit<label id="isxdigit"><p>
4576 <tag/Function/Check if a given character is a hexadecimal digit.
4577 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4578 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
4579 <tag/Description/The function returns a non zero value if the given argument
4580 is a hexadecimal digit (0..9, a..f and A..F). The return value is zero if the
4581 character is anything else.
4582 <tag/Notes/<itemize>
4583 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4584 inline sequence generated by the macro will not work correctly for values
4585 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4586 this range. The non inline function may be accessed by <tt/#undef/'ing the
4588 <item>When compiling without <tt/-Os/, the function is only available as
4589 fastcall function, so it may only be used in presence of a prototype.
4591 <tag/Availability/ISO 9899
4593 <ref id="isalnum" name="isalnum">,
4594 <ref id="isalpha" name="isalpha">,
4595 <ref id="isascii" name="isascii">,
4596 <ref id="isblank" name="isblank">,
4597 <ref id="iscntrl" name="iscntrl">,
4598 <ref id="isdigit" name="isdigit">,
4599 <ref id="isgraph" name="isgraph">,
4600 <ref id="islower" name="islower">,
4601 <ref id="isprint" name="isprint">,
4602 <ref id="ispunct" name="ispunct">,
4603 <ref id="isspace" name="isspace">,
4604 <ref id="isupper" name="isupper">
4610 <sect1>itoa<label id="itoa"><p>
4614 <tag/Function/Convert an integer into a string.
4615 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4616 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
4617 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
4618 <tt/radix/ as the base.
4619 <tag/Notes/<itemize>
4620 <item>There are no provisions to prevent a buffer overflow.
4621 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
4622 <item>The function is non standard, so it is not available in strict ANSI mode.
4623 You should probably use <tt/sprintf/ instead.
4624 <item>The function is only available as fastcall function, so it may only be
4625 used in presence of a prototype.
4627 <tag/Availability/cc65
4629 <ref id="atoi" name="atoi">,
4630 <ref id="atol" name="atol">,
4631 <ref id="ltoa" name="ltoa">,
4632 <ref id="ultoa" name="ultoa">,
4633 <ref id="utoa" name="utoa">
4639 <sect1>joy_count<label id="joy_count"><p>
4643 <tag/Function/Return the number of joysticks supported by the current driver.
4644 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4645 <tag/Declaration/<tt/unsigned char joy_count (void);/
4646 <tag/Description/The function returns a the number of joysticks supported
4647 by the current joystick driver.
4648 <tag/Notes/<itemize>
4649 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4650 name="joy_load_driver"> before calling this function.
4651 <item>The function returns the number of joysticks supported by the driver.
4652 There's no way to check for the number of actually connected joysticks.
4654 <tag/Availability/cc65
4656 <ref id="joy_load_driver" name="joy_load_driver">,
4657 <ref id="joy_read" name="joy_read">
4663 <sect1>joy_install<label id="joy_install"><p>
4667 <tag/Function/Install an already loaded driver and return an error code.
4668 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4669 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
4670 <tag/Description/The function installs a driver that was already loaded into
4671 memory (or linked statically to the program). It returns an error code
4672 (<tt/JOY_ERR_OK/ in case of success).
4673 <tag/Notes/<itemize>
4674 <item>The function is only available as fastcall function, so it may only be
4675 used in presence of a prototype.
4677 <tag/Availability/cc65
4679 <ref id="joy_load_driver" name="joy_load_driver">,
4680 <ref id="joy_uninstall" name="joy_uninstall">,
4681 <ref id="joy_unload" name="joy_unload">
4687 <sect1>joy_load_driver<label id="joy_load_driver"><p>
4691 <tag/Function/Load a driver from disk and install it.
4692 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4693 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
4694 <tag/Description/The function loads a driver with the given name from disk
4695 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
4696 driver was successfully loaded and installed.
4697 <tag/Notes/<itemize>
4698 <item>The function is only available as fastcall function, so it may only be
4699 used in presence of a prototype.
4701 <tag/Availability/cc65
4703 <ref id="joy_install" name="joy_install">,
4704 <ref id="joy_uninstall" name="joy_uninstall">,
4705 <ref id="joy_unload" name="joy_unload">
4711 <sect1>joy_read<label id="joy_read"><p>
4715 <tag/Function/Read the status of a joystick.
4716 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4717 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
4718 <tag/Description/The function reads the status bits for a joystick. The number
4719 of the joystick is passed as parameter. The result may be examined by using one
4720 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
4721 <tag/Notes/<itemize>
4722 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4723 name="joy_load_driver"> before calling this function.
4724 <item>The function is only available as fastcall function, so it may only be
4725 used in presence of a prototype.
4727 <tag/Availability/cc65
4729 <ref id="joy_count" name="joy_count">,
4730 <ref id="joy_load_driver" name="joy_load_driver">,
4731 <ref id="joy_unload" name="joy_unload">
4737 <sect1>joy_uninstall<label id="joy_uninstall"><p>
4741 <tag/Function/Uninstall the current joystick driver.
4742 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4743 <tag/Declaration/<tt/unsigned char joy_uninstall (void);/
4744 <tag/Description/The function uninstalls the currently installed joystick
4745 driver. It does not remove the driver from memory. The function returns an
4746 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4747 <tag/Notes/<itemize>
4748 <item>A joystick driver must be installed using <ref id="joy_install"
4749 name="joy_install"> before calling this function.
4751 <tag/Availability/cc65
4753 <ref id="joy_install" name="joy_install">,
4754 <ref id="joy_load_driver" name="joy_load_driver">,
4755 <ref id="joy_unload" name="joy_unload">
4761 <sect1>joy_unload<label id="joy_unload"><p>
4765 <tag/Function/Uninstall, then unload the current joystick driver.
4766 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4767 <tag/Declaration/<tt/unsigned char joy_unload (void);/
4768 <tag/Description/The function uninstalls the currently installed joystick
4769 driver and removes it from memory. An error code is returned, which is
4770 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4771 <tag/Notes/<itemize>
4772 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4773 name="joy_load_driver"> before calling this function.
4775 <tag/Availability/cc65
4777 <ref id="joy_load_driver" name="joy_load_driver">
4783 <sect1>kbhit<label id="kbhit"><p>
4787 <tag/Function/Check if there's a key waiting in the keyboard buffer.
4788 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4789 <tag/Declaration/<tt/unsigned char kbhit (void);/
4790 <tag/Description/The function returns a value of zero if there is no character
4791 waiting to be read from the keyboard. It returns non zero otherwise.
4792 <tag/Notes/<itemize>
4793 <item>If the system does not support a keyboard buffer (most systems
4794 do), the function is rather useless.
4796 <tag/Availability/cc65
4798 <ref id="cgetc" name="cgetc">,
4799 <ref id="cursor" name="cursor">
4805 <sect1>kbrepeat<label id="kbrepeat"><p>
4809 <tag/Function/Set the keyboard repeat mode.
4810 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
4811 <tag/Declaration/<tt/unsigned char __fastcall__ kbrepeat (unsigned char mode);/
4812 <tag/Description/This function changes which keys have automatic repeat when
4813 being held down for a certain time. Possible values are <tt/KBREPEAT_CURSOR/
4814 (repeat only cursor-related keys), <tt/KBREPEAT_NONE/ (no repeat for any
4815 keys), and <tt/KBREPEAT_ALL/ (repeat all keys). The old mode is returned, so
4816 it can be restored later.
4817 <tag/Notes/<itemize>
4818 <item>The function is available only as a fastcall function; so, it may be used
4819 only in the presence of a prototype.
4821 <tag/Availability/cc65
4827 <sect1>labs<label id="labs"><p>
4831 <tag/Function/Returns the absolute value of a long integer.
4832 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4833 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
4834 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
4836 <tag/Notes/<itemize>
4837 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
4838 <item>The function is only available as fastcall function, so it may only be
4839 used in presence of a prototype.
4841 <tag/Availability/ISO 9899
4843 <ref id="abs" name="abs">
4849 <sect1>ltoa<label id="ltoa"><p>
4853 <tag/Function/Convert a long integer into a string.
4854 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4855 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
4856 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
4857 using <tt/radix/ as the base.
4858 <tag/Notes/<itemize>
4859 <item>There are no provisions to prevent a buffer overflow.
4860 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
4861 <item>The function is non standard, so it is not available in strict ANSI mode.
4862 You should probably use <tt/sprintf/ instead.
4863 <item>The function is only available as fastcall function, so it may only be
4864 used in presence of a prototype.
4866 <tag/Availability/cc65
4868 <ref id="atoi" name="atoi">,
4869 <ref id="atol" name="atol">,
4870 <ref id="itoa" name="itoa">,
4871 <ref id="ultoa" name="ultoa">,
4872 <ref id="utoa" name="utoa">
4878 <sect1>localeconv<label id="localeconv"><p>
4882 <tag/Function/Returns a pointer to the current locale structure.
4883 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4884 <tag/Declaration/<tt/struct lconv* localeconv (void);/
4885 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
4887 <tag/Notes/<itemize>
4888 <item>cc65 supports only the "C" locale, so even after setting a new locale
4889 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
4892 <tag/Availability/ISO 9899
4894 <ref id="setlocale" name="setlocale">
4900 <sect1>longjmp<label id="longjmp"><p>
4904 <tag/Function/Non local goto.
4905 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4906 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
4907 <tag/Description/The <tt/longjmp/ function restores a program context from the
4908 data in <tt/buf/, which must have been set by a preceeding call to
4909 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
4910 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
4912 <tag/Notes/<itemize>
4913 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
4914 was called with a value of one.
4915 <item>The function is only available as fastcall function, so it may only
4916 be used in presence of a prototype.
4918 <tag/Availability/ISO 9899
4920 <ref id="setjmp" name="setjmp">
4926 <sect1>malloc<label id="malloc"><p>
4930 <tag/Function/Allocate dynamic memory.
4931 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4932 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
4933 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
4934 pointer to the allocated memory block. On error (not enough memory available),
4935 <tt/malloc/ returns <tt/NULL/.
4936 <tag/Notes/<itemize>
4937 <item>The function is only available as fastcall function, so it may only
4938 be used in presence of a prototype.
4940 <tag/Availability/ISO 9899
4942 <ref id="_heapadd" name="_heapadd">,
4943 <ref id="_heapblocksize" name="_heapblocksize">,
4944 <ref id="_heapmaxavail" name="_heapmaxavail">,
4945 <ref id="_heapmemavail" name="_heapmemavail">,
4946 <ref id="calloc" name="calloc">,
4947 <ref id="free" name="free">,
4948 <ref id="realloc" name="realloc">,
4949 <ref id="strdup" name="strdup">
4955 <sect1>memchr<label id="memchr"><p>
4959 <tag/Function/Search for a character in a block of raw memory.
4960 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4961 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
4962 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
4963 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
4964 that is of size <tt/count/. Upon completion, the function returns a pointer to
4965 the character found, or a null pointer if the character was not found.
4966 <tag/Notes/<itemize>
4967 <item>The function is only available as fastcall function, so it may only
4968 be used in presence of a prototype.
4970 <tag/Availability/ISO 9899
4972 <ref id="strchr" name="strchr">
4978 <sect1>memcmp<label id="memcmp"><p>
4982 <tag/Function/Compare two memory areas.
4983 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4984 <tag/Declaration/<tt/int __fastcall__ memcmp (const void* p1, const void* p2, size_t count);/
4985 <tag/Description/<tt/memcmp/ compares <tt/count/ bytes from the memory area
4986 pointed to by <tt/p1/ into the memory area pointed to by <tt/p2/. It returns a value that is less than
4987 zero if <tt/p1/ is less than <tt/p2/, zero if <tt/p1/ is the same as <tt/p2/,
4988 and a value greater than zero if <tt/p1/ is greater than <tt/p2/.
4989 <tag/Notes/<itemize>
4990 <item>The function is only available as fastcall function, so it may only
4991 be used in presence of a prototype.
4993 <tag/Availability/ISO 9899
4995 <ref id="strcmp" name="strcmp">,
4996 <ref id="memmove" name="memmove">,
4997 <ref id="memset" name="memset">
5003 <sect1>memcpy<label id="memcpy"><p>
5007 <tag/Function/Copy a memory area.
5008 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5009 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
5010 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
5011 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
5013 <tag/Notes/<itemize>
5014 <item>The result is undefined if the memory areas do overlap. Use
5015 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
5016 <item>The function is only available as fastcall function, so it may only
5017 be used in presence of a prototype.
5019 <tag/Availability/ISO 9899
5021 <ref id="_swap" name="_swap">,
5022 <ref id="memmove" name="memmove">,
5023 <ref id="memset" name="memset">
5029 <sect1>memmove<label id="memmove"><p>
5033 <tag/Function/Copy a memory area.
5034 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5035 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
5036 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
5037 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
5039 <tag/Notes/<itemize>
5040 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
5041 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
5042 <item>The function is only available as fastcall function, so it may only
5043 be used in presence of a prototype.
5045 <tag/Availability/ISO 9899
5047 <ref id="_swap" name="_swap">,
5048 <ref id="memcpy" name="memcpy">,
5049 <ref id="memset" name="memset">
5055 <sect1>memset<label id="memset"><p>
5059 <tag/Function/Fill a memory area.
5060 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5061 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
5062 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
5063 the value <tt/val/. The function returns <tt/p/.
5064 <tag/Notes/<itemize>
5065 <item>The function is only available as fastcall function, so it may only
5066 be used in presence of a prototype.
5068 <tag/Availability/ISO 9899
5070 <ref id="_swap" name="_swap">,
5071 <ref id="bzero" name="bzero">,
5072 <ref id="memcpy" name="memcpy">,
5073 <ref id="memmove" name="memmove">
5079 <sect1>mod_free<label id="mod_free"><p>
5083 <tag/Function/Free a relocatable module.
5084 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
5085 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
5086 <tag/Description/The function will free a module loaded into memory by use of
5087 the <tt/<ref id="mod_load" name="mod_load">/ function.
5088 <tag/Notes/<itemize>
5089 <item>The pointer passed as parameter is the pointer to the module memory,
5090 not the pointer to the control structure.
5091 <item>The function is available only as a fastcall function; so, it may be used
5092 only in the presence of a prototype.
5094 <tag/Availability/cc65
5096 <ref id="mod_load" name="mod_load">
5102 <sect1>mod_load<label id="mod_load"><p>
5106 <tag/Function/Load a relocatable module.
5107 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
5108 <tag/Declaration/<tt/unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl);/
5109 <tag/Description/The function will load a code module into memory and relocate
5110 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
5111 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
5112 the module just loaded. Possible error codes are:
5114 <item><tt/MLOAD_OK/ - Module load successful
5115 <item><tt/MLOAD_ERR_READ/ - Read error
5116 <item><tt/MLOAD_ERR_HDR/ - Header error
5117 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
5118 <item><tt/MLOAD_ERR_FMT/ - Data format error
5119 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
5121 <tag/Notes/<itemize>
5122 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
5123 relocatable o65 modules for use with this function.
5124 <item>The function is available only as a fastcall function; so, it may be used
5125 only in the presence of a prototype.
5127 <tag/Availability/cc65
5129 <ref id="mod_free" name="mod_free">
5135 <sect1>mouse_setbox<label id="mouse_setbox"><p>
5139 <tag/Function/Specify a bounding box for the mouse cursor.
5140 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5141 <tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
5142 <tag/Description/The function allows to set a bounding box for mouse movement.
5143 <tag/Notes/<itemize>
5144 <item>The function does not check if the mouse cursor is currently within the
5145 given rectangle. Placing the mouse cursor within the bounding box is the
5146 responsibility of the programmer.
5147 <item>While the bounding box may be larger than the actual screen size, the
5148 standard mouse cursor draw routines may fail to set the cursor to coordinates
5149 outside of the screen area. Depending on the platform, you may have to supply
5150 your own mouse cursor routines.
5151 <item>The function is only available as fastcall function, so it may only be
5152 used in presence of a prototype.
5154 <tag/Availability/cc65
5156 <ref id="mouse_getbox" name="mouse_getbox">,
5157 <ref id="mouse_move" name="mouse_move">
5163 <sect1>mouse_getbox<label id="mouse_getbox"><p>
5167 <tag/Function/Return the current bounding box for the mouse cursor.
5168 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5169 <tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
5170 <tag/Description/The function queries the current bounding box for mouse
5172 <tag/Notes/<itemize>
5173 <item>The function is only available as fastcall function, so it may only be
5174 used in presence of a prototype.
5176 <tag/Availability/cc65
5178 <ref id="mouse_move" name="mouse_move">,
5179 <ref id="mouse_setbox" name="mouse_setbox">
5185 <sect1>mouse_buttons<label id="mouse_buttons"><p>
5189 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
5190 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5191 <tag/Declaration/<tt/unsigned char mouse_buttons (void);/
5192 <tag/Description/The function returns a bit mask that encodes the state of the
5193 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
5195 <tag/Availability/cc65
5197 <ref id="mouse_info" name="mouse_info">,
5198 <ref id="mouse_pos" name="mouse_pos">
5204 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
5208 <tag/Function/Return a readable error message for an error code.
5209 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5210 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
5212 <tag/Description/The function returns an error message (in english) for the
5213 error code passed parameter.
5214 <tag/Notes/<itemize>
5215 <item>The function will return "Unknown error" for invalid error codes.
5216 <item>The function is only available as fastcall function, so it may only be
5217 used in presence of a prototype.
5219 <tag/Availability/cc65
5221 <ref id="mouse_load_driver" name="mouse_load_driver">,
5222 <ref id="mouse_uninstall" name="mouse_uninstall">,
5223 <ref id="mouse_unload" name="mouse_unload">
5229 <sect1>mouse_hide<label id="mouse_hide"><p>
5233 <tag/Function/Hide the mouse pointer.
5234 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5235 <tag/Declaration/<tt/void mouse_hide (void);/
5236 <tag/Description/The function hides the mouse pointer. It manages a counter
5237 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
5238 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
5239 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
5241 <tag/Availability/cc65
5243 <ref id="mouse_show" name="mouse_show">
5249 <sect1>mouse_info<label id="mouse_info"><p>
5253 <tag/Function/Return the state of the mouse buttons and the position of the
5255 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5256 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
5257 <tag/Description/The function returns the state of the mouse buttons and the
5258 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
5259 <tag/Notes/<itemize>
5260 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
5261 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
5262 name="mouse_pos">/ instead.
5263 <item>The function is only available as fastcall function, so it may only be
5264 used in presence of a prototype.
5266 <tag/Availability/cc65
5268 <ref id="mouse_buttons" name="mouse_buttons">,
5269 <ref id="mouse_pos" name="mouse_pos">
5275 <sect1>mouse_install<label id="mouse_install"><p>
5279 <tag/Function/Install an already loaded mouse driver.
5280 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5281 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
5282 mouse_callbacks* c, void* driver);/
5283 <tag/Description/The function installs an already loaded mouse driver and
5284 returns an error code. The <tt/mouse_callbacks/ structure passed as first
5285 parameter contains pointers to routines needed to move or hide/show the mouse
5286 pointer. Defaults for these routines are supplied by the library, so if you
5287 can live with these defaults (which are platform specific), just pass a
5288 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
5289 driver linked statically to the program.
5290 <tag/Notes/<itemize>
5291 <item>Not all drivers are able to detect if the supported hardware is really
5293 <item>After installing a driver, the mouse cursor is hidden.
5294 <item>The function is only available as fastcall function, so it may only be
5295 used in presence of a prototype.
5297 <tag/Availability/cc65
5299 <ref id="mouse_load_driver" name="mouse_load_driver">,
5300 <ref id="mouse_uninstall" name="mouse_uninstall">,
5301 <ref id="mouse_unload" name="mouse_unload">
5307 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
5311 <tag/Function/Call the driver specific ioctl function.
5312 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5313 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
5314 <tag/Description/The function calls the IOCTL entry in the mouse driver,
5315 which is driver specific. The <tt/code/ parameter will choose between
5316 different IOCTL functions, and the <tt/data/ depends on code. The
5317 function returns an error code. The purpose of this function is to allow
5318 for driver specific extensions. See the documentation for a specific mouse
5319 driver for supported ioctl calls.
5320 <tag/Notes/<itemize>
5321 <item>Calling this function is non portable, because each driver may
5322 implement different ioctl calls (or none at all).
5323 <item>The function is only available as fastcall function, so it may only be
5324 used in presence of a prototype.
5326 <tag/Availability/cc65
5332 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
5336 <tag/Function/Load and initialize a mouse driver.
5337 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5338 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
5339 mouse_callbacks* c, const char* driver);/
5340 <tag/Description/Load a mouse driver into memory and initialize it. The
5341 function returns an error code that tells if the call has been successful. The
5342 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
5343 routines needed to move or hide/show the mouse pointer. Defaults for these
5344 routines are supplied by the library, so if you can live with these defaults
5345 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
5346 <tag/Notes/<itemize>
5347 <item>The driver is loaded by name, so currently you must know the type of
5348 mouse that should be supported. There is no autodetect capability.
5349 <item>Not all drivers are able to detect if the supported hardware is really
5351 <item>After installing a driver, the mouse cursor is hidden.
5352 <item>The function is only available as fastcall function, so it may only be
5353 used in presence of a prototype.
5355 <tag/Availability/cc65
5357 <ref id="mouse_install" name="mouse_install">,
5358 <ref id="mouse_uninstall" name="mouse_uninstall">,
5359 <ref id="mouse_unload" name="mouse_unload">
5365 <sect1>mouse_move<label id="mouse_move"><p>
5369 <tag/Function/Move the mouse cursor to a specific position.
5370 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5371 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
5372 <tag/Description/The function updates the mouse position. If the mouse cursor
5373 is visible, it is shown at the new position.
5374 <tag/Notes/<itemize>
5375 <item>The function does not check if the new position is within the bounding
5376 box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
5377 <item>The function is only available as fastcall function, so it may only be
5378 used in presence of a prototype.
5380 <tag/Availability/cc65
5382 <ref id="mouse_getbox" name="mouse_getbox">,
5383 <ref id="mouse_setbox" name="mouse_setbox">
5389 <sect1>mouse_pos<label id="mouse_pos"><p>
5393 <tag/Function/Return the position of the mouse.
5394 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5395 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
5396 <tag/Description/The function returns the position of the mouse in the
5397 <tt/mouse_pos/ structure passed as parameter.
5398 <tag/Notes/<itemize>
5399 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
5400 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
5401 name="mouse_info">/ instead.
5402 <item>The function is only available as fastcall function, so it may only be
5403 used in presence of a prototype.
5405 <tag/Availability/cc65
5407 <ref id="mouse_buttons" name="mouse_buttons">,
5408 <ref id="mouse_info" name="mouse_info">
5414 <sect1>mouse_show<label id="mouse_show"><p>
5418 <tag/Function/Show the mouse pointer.
5419 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5420 <tag/Declaration/<tt/void mouse_show (void);/
5421 <tag/Description/The function shows the mouse pointer. It manages a counter
5422 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
5423 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
5424 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
5425 <tag/Availability/cc65
5427 <ref id="mouse_hide" name="mouse_hide">
5433 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
5437 <tag/Function/Uninstall an already loaded mouse driver.
5438 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5439 <tag/Declaration/<tt/unsigned char mouse_uninstall (void);/
5440 <tag/Description/The function uninstalls an already loaded mouse driver but
5441 don't removes it from memory.
5442 <tag/Notes/<itemize>
5443 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
5444 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
5445 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
5448 <tag/Availability/cc65
5450 <ref id="mouse_install" name="mouse_install">,
5451 <ref id="mouse_load_driver" name="mouse_load_driver">,
5452 <ref id="mouse_unload" name="mouse_unload">
5458 <sect1>mouse_unload<label id="mouse_unload"><p>
5462 <tag/Function/Unload a mouse driver.
5463 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5464 <tag/Declaration/<tt/unsigned char mouse_unload (void);/
5465 <tag/Description/The function unloads a loaded mouse driver and frees all
5466 memory allocated for the driver.
5467 <tag/Notes/<itemize>
5468 <item>The function does nothing if no driver is loaded.
5470 <tag/Availability/cc65
5472 <ref id="mouse_install" name="mouse_install">,
5473 <ref id="mouse_load_driver" name="mouse_load_driver">,
5474 <ref id="mouse_uninstall" name="mouse_uninstall">
5480 <sect1>offsetof<label id="offsetof"><p>
5484 <tag/Function/Calculate the offset of a struct or union member.
5485 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
5486 <tag/Declaration/<tt/size_t offsetof (type, member);/
5487 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
5488 or <tt/union/ member.
5489 <tag/Notes/<itemize>
5490 <item>The function is actually a macro.
5492 <tag/Availability/ISO 9899
5498 <sect1>open<label id="open"><p>
5502 <tag/Function/Open and possibly create a file.
5503 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
5504 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
5505 <tag/Description/<tt/open/ opens a file and returns the file descriptor
5506 associated with it. On error, -1 is returned and an error code is stored in
5507 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
5508 <tag/Notes/<itemize>
5509 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
5510 open, which is used as the permission mask when a new file is created. While
5511 cc65 allows to pass this argument, it is ignored.
5513 <tag/Availability/POSIX 1003.1
5515 <ref id="close" name="close">,
5516 <ref id="creat" name="creat">
5522 <sect1>opendir<label id="opendir"><p>
5526 <tag/Function/Open a directory.
5527 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5528 <tag/Declaration/<tt/DIR* __fastcall__ opendir (const char* name);/
5529 <tag/Description/<tt/opendir/ opens a directory and returns the direcory
5530 descriptor associated with it. On error, NULL is returned and an error code is
5531 stored in <tt/errno/.
5532 <tag/Notes/<itemize>
5533 <item>The function is only available as fastcall function, so it may only
5534 be used in presence of a prototype.
5536 <tag/Availability/POSIX 1003.1
5538 <ref id="closedir" name="closedir">,
5539 <ref id="readdir" name="readdir">
5545 <sect1>peekbsys<label id="peekbsys"><p>
5549 <tag/Function/Read one byte from a location in the system bank.
5550 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5551 <tt/<ref id="cbm510.h" name="cbm510.h">/
5552 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
5553 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
5554 system bank (bank 15) of the CBM PET-II machines and returns it.
5555 <tag/Notes/<itemize>
5556 <item>The function is only available as fastcall function, so it may only
5557 be used in presence of a prototype.
5558 <item>This function may be a macro depending on the compiler options. The
5559 actual function is accessible by #undef'ing the macro.
5561 <tag/Availability/cc65
5563 <ref id="PEEK" name="PEEK">,
5564 <ref id="PEEKW" name="PEEKW">,
5565 <ref id="peekwsys" name="peekwsys">,
5566 <ref id="pokebsys" name="pokebsys">,
5567 <ref id="pokewsys" name="pokewsys">
5573 <sect1>peekwsys<label id="peekwsys"><p>
5577 <tag/Function/Read one word from a location in the system bank.
5578 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5579 <tt/<ref id="cbm510.h" name="cbm510.h">/
5580 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
5581 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
5582 system bank (bank 15) of the CBM PET-II machines and returns it. Following
5583 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
5584 high byte is read from <tt/addr+1/.
5585 <tag/Notes/<itemize>
5586 <item>The function is only available as fastcall function, so it may only
5587 be used in presence of a prototype.
5588 <item>The order in which the two bytes are read is undefined.
5590 <tag/Availability/cc65
5592 <ref id="PEEK" name="PEEK">,
5593 <ref id="PEEKW" name="PEEKW">,
5594 <ref id="peekbsys" name="peekbsys">,
5595 <ref id="pokebsys" name="pokebsys">,
5596 <ref id="pokewsys" name="pokewsys">
5602 <sect1>perror<label id="perror"><p>
5606 <tag/Function/Print an error message for the error in <tt/errno/.
5607 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5608 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
5609 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
5610 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
5611 a blank. Then the error message for the current contents of <tt/errno/ is
5612 printed followed by a newline. The message output is the same as returned by
5613 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
5614 <tag/Notes/<itemize>
5615 <item>The function is only available as fastcall function, so it may only
5616 be used in presence of a prototype.
5618 <tag/Availability/ISO 9899
5620 <ref id="_poserror" name="_poserror">,
5621 <ref id="strerror" name="strerror">
5627 <sect1>pokebsys<label id="pokebsys"><p>
5631 <tag/Function/Write one byte to a location in the system bank.
5632 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5633 <tt/<ref id="cbm510.h" name="cbm510.h">/
5634 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
5635 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
5636 system bank (bank 15) of the CBM PET-II machines.
5637 <tag/Notes/<itemize>
5638 <item>The function is only available as fastcall function, so it may only
5639 be used in presence of a prototype.
5641 <tag/Availability/cc65
5643 <ref id="POKE" name="POKE">,
5644 <ref id="POKEW" name="POKEW">,
5645 <ref id="peekbsys" name="peekbsys">,
5646 <ref id="peekwsys" name="peekwsys">,
5647 <ref id="pokewsys" name="pokewsys">
5653 <sect1>pokewsys<label id="pokewsys"><p>
5657 <tag/Function/Write one word to a location in the system bank.
5658 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5659 <tt/<ref id="cbm510.h" name="cbm510.h">/
5660 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
5661 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
5662 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
5663 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
5664 high byte is written to <tt/addr+1/.
5665 <tag/Notes/<itemize>
5666 <item>The function is only available as fastcall function, so it may only
5667 be used in presence of a prototype.
5668 <item>The order in which the two bytes are written is undefined.
5670 <tag/Availability/cc65
5672 <ref id="POKE" name="POKE">,
5673 <ref id="POKEW" name="POKEW">,
5674 <ref id="peekbsys" name="peekbsys">,
5675 <ref id="peekwsys" name="peekwsys">,
5676 <ref id="pokebsys" name="pokebsys">
5682 <sect1>qsort<label id="qsort"><p>
5686 <tag/Function/Sort an array.
5687 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5688 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
5689 size_t size, int __fastcall__ (* compare) (const void*, const void*));/
5690 <tag/Description/<tt/qsort/ sorts an array according to a given compare
5691 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
5692 is the number of elements, <tt/size/ the size of an element and <tt/compare/
5693 the function used to compare the members.
5694 <tag/Notes/<itemize>
5695 <item>If there are multiple members with the same key, the order after calling
5696 the function is undefined.
5697 <item>The function is only available as fastcall function, so it may only
5698 be used in presence of a prototype.
5699 <item>The function to which <tt/compare/ points must have the <tt/fastcall/
5702 <tag/Availability/ISO 9899
5704 <ref id="bsearch" name="bsearch">
5710 <sect1>raise<label id="raise"><p>
5714 <tag/Function/Send a signal to the executing program.
5715 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
5716 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
5717 <tag/Description/<tt/raise/ sends the given signal to the program. If the
5718 program has installed a signal handler for the signal, this signal handler
5719 will be executed. If no handler has been installed, the default action for
5720 the raised signal will be taken. The function returns zero on success,
5722 <tag/Notes/<itemize>
5723 <item>The function is only available as fastcall function, so it may only
5724 be used in presence of a prototype.
5726 <tag/Availability/ISO 9899
5728 <ref id="abort" name="abort">,
5729 <ref id="signal" name="signal">
5735 <sect1>rand<label id="rand"><p>
5739 <tag/Function/Return a pseudo random number.
5740 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5741 <tag/Declaration/<tt/int rand (void);/
5742 <tag/Description/The function returns a pseudo random number
5743 between 0 and <tt/RAND_MAX/ (exclusive).
5744 <tag/Notes/<itemize>
5745 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
5746 flow of numbers is generated.
5747 <item>On startup, the function behaves as if <ref id="srand" name="srand">
5748 had been used with an argument of 1.
5750 <tag/Availability/ISO 9899
5752 <ref id="_randomize" name="_randomize">,
5753 <ref id="srand" name="srand">
5759 <sect1>readdir<label id="readdir"><p>
5763 <tag/Function/Read a directory.
5764 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5765 <tag/Declaration/<tt/struct dirent* __fastcall__ readdir (DIR* dir);/
5766 <tag/Description/<tt/readdir/ reads the next directory entry from the directory
5767 stream pointed to by <tt/dir/. It stores the data in a <tt/dirent/ structure
5768 and returns a pointer to it. If the end of directory is reached, or an error
5769 occurs, NULL is returned. In case of errors, an error code is stored into
5771 <tag/Notes/<itemize>
5772 <item>The function is only available as fastcall function, so it may only
5773 be used in presence of a prototype.
5774 <item>The returned pointer may point to a statically allocated instance of
5775 <tt/struct dirent/, so it may get overwritten by subsequent calls to
5777 <item>On several platforms, namely the CBMs and the Atari, the disk drives get
5778 confused when opening/closing files between directory reads. So for example a
5779 program that reads the list of files on a disk, and after each call to
5780 <tt/readdir/, opens the file to process it, will fail.<newline>
5781 Possible solutions are reading the directory into memory before processing the
5782 file list, or to reset the directory by seeking to the correct position after
5783 opening/closing a file:
5785 seekdir (DIR, telldir (DIR));
5787 Platforms known to work without problems are: Apple.
5789 <tag/Availability/POSIX 1003.1
5791 <ref id="closedir" name="closedir">,
5792 <ref id="opendir" name="opendir">
5798 <sect1>realloc<label id="realloc"><p>
5802 <tag/Function/Change the size of an allocated memory block.
5803 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5804 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
5805 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
5806 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
5807 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
5808 behaves as if <tt/free/ had been called. On error (not enough memory
5809 available), <tt/realloc/ returns <tt/NULL/.
5810 <tag/Notes/<itemize>
5811 <item>The part of the memory block that is returned will have its contents
5813 <item>This function is somewhat dangerous to use. Be careful to save the
5814 pointer you're passing somewhere else, otherwise
5816 ptr = realloc (ptr, size);
5818 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
5819 <item>The function is only available as fastcall function, so it may only
5820 be used in presence of a prototype.
5822 <tag/Availability/ISO 9899
5824 <ref id="_heapadd" name="_heapadd">,
5825 <ref id="_heapblocksize" name="_heapblocksize">,
5826 <ref id="_heapmaxavail" name="_heapmaxavail">,
5827 <ref id="_heapmemavail" name="_heapmemavail">,
5828 <ref id="calloc" name="calloc">,
5829 <ref id="free" name="free">,
5830 <ref id="realloc" name="realloc">
5836 <sect1>remove<label id="remove"><p>
5840 <tag/Function/Delete a file.
5841 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5842 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
5843 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
5844 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5845 code describing the reason for the failure.
5846 <tag/Notes/<itemize>
5847 <item>This function is not available on all cc65 targets (depends on the
5848 availability of file I/O).
5849 <item>The function is only available as fastcall function, so it may only
5850 be used in presence of a prototype.
5852 <tag/Availability/ISO 9899
5854 <ref id="rename" name="rename">,
5855 <ref id="unlink" name="unlink">
5858 #include <stdio.h>
5860 #define FILENAME "helloworld"
5862 if (remove (FILENAME) == 0) {
5863 printf ("We deleted %s successfully\n", FILENAME);
5865 printf ("There was a problem deleting %s\n", FILENAME);
5872 <sect1>rename<label id="rename"><p>
5876 <tag/Function/Rename a file.
5877 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5878 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
5879 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
5880 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5881 code describing the reason for the failure.
5882 <tag/Notes/<itemize>
5883 <item>This function is not available on all cc65 targets (depends on the
5884 capabilities of the storage devices).
5885 <item>The function is only available as fastcall function, so it may only
5886 be used in presence of a prototype.
5888 <tag/Availability/ISO 9899
5890 <ref id="remove" name="remove">
5893 #include <stdio.h>
5895 #define OLDNAME "textfile.txt"
5896 #define NEWNAME "textfile.bak"
5898 if (rename (OLDNAME, NEWNAME) == 0) {
5899 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
5901 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
5908 <sect1>reset_brk<label id="reset_brk"><p>
5912 <tag/Function/Resets the break vector to its original value.
5913 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5914 <tag/Declaration/<tt/void reset_brk (void);/
5915 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
5916 before a call to <tt/set_brk/.
5917 <tag/Notes/<itemize>
5918 <item>The break vector is reset on program termination, so it's not strictly
5919 necessary to call this function as a part of your clean-up when exiting the program.
5921 <tag/Availability/cc65
5923 <ref id="reset_irq" name="reset_irq">,
5924 <ref id="set_brk" name="set_brk">,
5925 <ref id="set_irq" name="set_irq">
5931 <sect1>reset_irq<label id="reset_irq"><p>
5935 <tag/Function/Resets the C level interrupt request vector.
5936 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5937 <tag/Declaration/<tt/void reset_irq (void);/
5938 <tag/Description/<tt/reset_irq/ resets the C level interrupt request vector.
5939 <tag/Notes/<itemize>
5940 <item>The interrupt vector is reset on program termination, so it's not strictly
5941 necessary to call this function as a part of your clean-up when exiting the program.
5943 <tag/Availability/cc65
5945 <ref id="reset_brk" name="reset_brk">,
5946 <ref id="set_brk" name="set_brk">,
5947 <ref id="set_irq" name="set_irq">
5953 <sect1>revers<label id="revers"><p>
5957 <tag/Function/Control revers character display.
5958 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5959 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
5960 <tag/Description/If the argument is non zero, the function enables reverse
5961 character display. If the argument is zero, reverse character display is
5962 switched off. The old value of the setting is returned.
5963 <tag/Notes/<itemize>
5964 <item>The function may not be supported by the hardware, in which case
5965 the call is ignored.
5966 <item>The function is only available as fastcall function, so it may only
5967 be used in presence of a prototype.
5969 <tag/Availability/cc65
5971 <ref id="textcolor" name="textcolor">
5977 <sect1>rewinddir<label id="rewinddir"><p>
5981 <tag/Function/Reset a directory stream.
5982 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5983 <tag/Declaration/<tt/void __fastcall__ rewinddir (DIR* dir);/
5984 <tag/Description/<tt/rewinddir/ sets the position of the directory stream
5985 pointed to by <tt/dir/ to the start of the directory.
5986 <tag/Notes/<itemize>
5987 <item>The function is only available as fastcall function, so it may only
5988 be used in presence of a prototype.
5990 <tag/Availability/POSIX 1003.1
5992 <ref id="seekdir" name="seekdir">,
5993 <ref id="telldir" name="telldir">
5999 <sect1>screensize<label id="screensize"><p>
6003 <tag/Function/Return the dimensions of the text mode screen.
6004 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6005 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
6006 <tag/Description/The function returns the dimensions of the text mode screen.
6007 <tag/Notes/<itemize>
6008 <item>The function is only available as fastcall function, so it may only
6009 be used in presence of a prototype.
6011 <tag/Availability/cc65
6013 <ref id="gotox" name="gotox">,
6014 <ref id="gotoxy" name="gotoxy">,
6015 <ref id="gotoy" name="gotoy">,
6016 <ref id="wherex" name="wherex">,
6017 <ref id="wherey" name="wherey">
6023 <sect1>seekdir<label id="seekdir"><p>
6027 <tag/Function/Set the position of a directory stream.
6028 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
6029 <tag/Declaration/<tt/void __fastcall__ seekdir (DIR* dir, long offset);/
6030 <tag/Description/<tt/seekdir/ sets the position of the directory stream
6031 pointed to by <tt/dir/ to the value given in <tt/offset/, which should be a
6032 value returned by <tt/<ref id="telldir" name="telldir">/.
6033 <tag/Notes/<itemize>
6034 <item>The function is only available as fastcall function, so it may only
6035 be used in presence of a prototype.
6037 <tag/Availability/POSIX 1003.1
6039 <ref id="rewinddir" name="rewinddir">,
6040 <ref id="telldir" name="telldir">
6046 <sect1>ser_close<label id="ser_close"><p>
6050 <tag/Function/Close the port and disable interrupts
6051 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6052 <tag/Declaration/<tt/unsigned char ser_close (void);/
6053 <tag/Description/Close the port by clearing buffers and disable interrupts.
6054 <tag/Availability/cc65
6055 <tag/See also/Other serial functions.
6060 static void initialize(){
6061 struct ser_params params = {
6068 ser_install(lynx_comlynx); // This will activate the ComLynx
6070 ser_open(&params);
6077 <sect1>ser_get<label id="ser_get"><p>
6081 <tag/Function/Read a character from serial port.
6082 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6083 <tag/Declaration/<tt/unsigned char __fastcall__ ser_get (char* b);/
6084 <tag/Description/Get a character from the serial port. If no characters are
6085 available, the function will return SER_ERR_NO_DATA, so this is not a fatal
6087 <tag/Notes/<itemize>
6088 <item>The function is only available as fastcall function, so it may only
6089 be used in presence of a prototype.
6091 <tag/Availability/cc65
6092 <tag/See also/Other serial functions.
6094 Wait for a character to be available from a serial port.
6097 while (ser_get(&ch) == SER_ERR_NO_DATA)
6104 <sect1>ser_install<label id="ser_install"><p>
6108 <tag/Function/Install an already loaded driver and return an error code.
6109 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6110 <tag/Declaration/<tt/unsigned char __fastcall__ ser_install (void* driver);/
6111 <tag/Description/The function installs a driver that was already loaded into
6112 memory (or linked statically to the program). It returns an error code
6113 (<tt/SER_ERR_OK/ in case of success).
6114 <tag/Notes/<itemize>
6115 <item>The function is only available as fastcall function, so it may only be
6116 used in presence of a prototype.
6118 <tag/Availability/cc65
6120 <ref id="ser_load_driver" name="ser_load_driver">,
6121 <ref id="ser_uninstall" name="ser_uninstall">,
6122 <ref id="ser_unload" name="ser_unload">
6124 ser_install(lynx_comlynx); //Include the driver statically instead of loading it.
6130 <sect1>ser_ioctl<label id="ser_ioctl"><p>
6134 <tag/Function/Platform dependent code extensions.
6135 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6136 <tag/Declaration/<tt/unsigned __fastcall__ ser_ioctl (unsigned char code, void* data);/
6137 <tag/Description/Some platforms have extra serial functions that are not
6138 supported by standard serial driver functions. You can extend the driver to support
6139 this extra functionality bt using ser_ioctl functions.
6140 <tag/Notes/<itemize>
6141 <item>The function is only available as fastcall function, so it may only
6142 be used in presence of a prototype.
6143 <item>These functions are not easily portable to other cc65 platforms.
6145 <tag/Availability/cc65
6146 <tag/See also/Other serial functions.
6151 <sect1>ser_load_driver<label id="ser_load_driver"><p>
6155 <tag/Function/Load and install a serial driver.
6156 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6157 <tag/Declaration/<tt/unsigned char __fastcall__ ser_load_driver (const char *name);/
6158 <tag/Description/Load and install the driver by name.
6159 Will just load the driver and check if loading was successful.
6160 <tag/Notes/<itemize>
6161 <item>The function is only available as fastcall function, so it may only
6162 be used in presence of a prototype.
6164 <tag/Availability/cc65
6165 <tag/See also/Other serial functions.
6171 <sect1>ser_open<label id="ser_open"><p>
6175 <tag/Function/Open the port by setting the port parameters and enable interrupts
6176 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6177 <tag/Declaration/<tt/unsigned char __fastcall__ ser_open (const struct ser_params* params);/
6178 <tag/Description/Open the port by setting the port parameters and enable interrupts.
6179 <tag/Notes/<itemize>
6180 <item>The function is only available as fastcall function, so it may only
6181 be used in presence of a prototype.
6183 <tag/Availability/cc65
6184 <tag/See also/Other serial functions.
6189 static void initialize(){
6190 struct ser_params params = {
6197 ser_install(lynx_comlynx); // This will activate the ComLynx
6199 ser_open(&params);
6206 <sect1>ser_put<label id="ser_put"><p>
6210 <tag/Function/Write a character to a serial port.
6211 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6212 <tag/Declaration/<tt/unsigned char __fastcall__ ser_put (char b);/
6213 <tag/Description/Send a character via the serial port. There is a transmit
6214 buffer, but transmitting is not done via interrupt. The function returns
6215 SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
6216 <tag/Notes/<itemize>
6217 <item>The function is only available as fastcall function, so it may only
6218 be used in presence of a prototype.
6220 <tag/Availability/cc65
6221 <tag/See also/Other serial functions.
6230 <sect1>ser_status<label id="ser_status"><p>
6234 <tag/Function/Return the serial port status.
6235 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6236 <tag/Declaration/<tt/unsigned char __fastcall__ ser_status (unsigned char* status);/
6237 <tag/Description/Return the serial port status.
6238 <tag/Notes/<itemize>
6239 <item>The function is only available as fastcall function, so it may only
6240 be used in presence of a prototype.
6242 <tag/Availability/cc65
6243 <tag/See also/Other serial functions.
6249 <sect1>ser_uninstall<label id="ser_uninstall"><p>
6253 <tag/Function/Uninstall the currently loaded driver but do not unload it.
6254 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6255 <tag/Declaration/<tt/unsigned char ser_uninstall (void);/
6256 <tag/Description/Uninstall the currently loaded driver but do not unload it.
6257 <tag/Availability/cc65
6258 <tag/See also/Other serial functions.
6263 <sect1>ser_unload<label id="ser_unload"><p>
6267 <tag/Function/Uninstall, then unload the currently loaded driver.
6268 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6269 <tag/Declaration/<tt/unsigned char ser_unload (void);/
6270 <tag/Description/Uninstall, then unload the currently loaded driver.
6271 <tag/Availability/cc65
6272 <tag/See also/Other serial functions.
6278 <sect1>set_brk<label id="set_brk"><p>
6282 <tag/Function/Set the break vector to a user function.
6283 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
6284 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
6285 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
6286 program code by letting the vector point to a user written C function. The
6287 runtime library installs a small stub that saves the registers into global
6288 variables that may be accessed (and changed) by the break handler.
6289 <tag/Notes/<itemize>
6290 <item>The function is only available as fastcall function, so it may only
6291 be used in presence of a prototype.
6292 <item>The stub saves the zero page registers used by the C runtime and switches
6293 to a small break handler stack. This means that it is safe to execute C code,
6294 even if C code was interrupted. Be careful however not to use too many local
6295 variables, and do not enable stack checks for the handler function or any other
6296 function called from it.
6297 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
6298 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
6299 otherwise the <tt/BRK/ instruction will get executed over and over again.
6300 <item>The break vector is reset on program termination, so it's not strictly
6301 necessary to call <tt/<ref id="reset_brk" name="reset_brk">/ as a part of your
6302 clean-up when exiting the program.
6304 <tag/Availability/cc65
6306 <ref id="reset_brk" name="reset_brk">
6312 <sect1>set_irq<label id="set_irq"><p>
6316 <tag/Function/Set the C level interrupt request vector to the given address.
6317 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
6318 <tag/Declaration/<tt/void __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);/
6319 <tag/Description/<tt/set_irq/ allows a user program to handle interrupt requests
6320 (IRQs) within the program code by letting the vector point to a user written C
6321 function. The runtime library installs a small stub that saves the zero page
6322 registers used by the C runtime before calling the handler function and restores
6323 them after the handler function returns. Additionally the stub temporarily switches
6324 the C runtime stack to the stack area provided as parameter. If the handler function
6325 was set up to handle a "private", "exclusive" interrupt request source it must
6326 return the value <tt/IRQ_HANDLED/ if and only if it has verified that the current
6327 interrupt request actually stems from that source. In all other cases it must return
6328 the value <tt/IRQ_NOT_HANDLED/.
6329 <tag/Notes/<itemize>
6330 <item>The function is only available as fastcall function, so it may only
6331 be used in presence of a prototype.
6332 <item>The stub saves the registers and zero page locations used by the C runtime
6333 and switches to the provided stack area. As a consequence, there is some
6334 runtime overhead, but it it is safe to execute C code, even if other C code
6335 was interrupted. Be careful however not to call C library functions, and do not
6336 enable stack checks for the handler function or any other function called from
6338 <item>The interrupt vector is reset on program termination, so it's not strictly
6339 necessary to call <tt/<ref id="reset_irq" name="reset_irq">/ as a part of your
6340 clean-up when exiting the program.
6342 <tag/Availability/cc65
6344 <ref id="reset_brk" name="reset_brk">,
6345 <ref id="reset_irq" name="reset_irq">,
6346 <ref id="set_brk" name="set_brk">
6352 <sect1>set_c128_speed<label id="set_c128_speed"><p>
6356 <tag/Function/Set the current speed of a C128 CPU.
6357 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6358 <tag/Declaration/<tt/unsigned char __fastcall__ set_c128_speed (unsigned char speed);/
6359 <tag/Description/The function returns the speed after trying to set the speed of the C128 CPU.
6360 <tag/Notes/<itemize>
6361 <item>The function is specific to the C64 and C128.
6362 <item>The function does not check if the C128 CPU is the current CPU.
6363 <item>See the accelerator.h header for the speed definitions.
6365 <tag/Availability/cc65 (not all platforms)
6367 <ref id="detect_c128" name="detect_c128">,
6368 <ref id="get_c128_speed" name="get_c128_speed">,
6374 <sect1>set_c64dtv_speed<label id="set_c64dtv_speed"><p>
6378 <tag/Function/Set the current speed of the C64DTV.
6379 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6380 <tag/Declaration/<tt/unsigned char __fastcall__ set_c64dtv_speed (unsigned char speed);/
6381 <tag/Description/The function returns the speed after trying to set the speed of the C64DTV.
6382 <tag/Notes/<itemize>
6383 <item>The function is specific to the C64.
6384 <item>The function does not check for the presence of the C64DTV.
6385 <item>See the accelerator.h header for the speed definitions.
6387 <tag/Availability/cc65 (not all platforms)
6389 <ref id="detect_c64dtv" name="detect_c64dtv">,
6390 <ref id="get_c64dtv_speed" name="get_c64dtv_speed">,
6396 <sect1>set_c65_speed<label id="set_c65_speed"><p>
6400 <tag/Function/Set the current speed of the C65/C64DX in C64 mode.
6401 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6402 <tag/Declaration/<tt/unsigned char __fastcall__ set_c65_speed (unsigned char speed);/
6403 <tag/Description/The function returns the speed after trying to set the speed of the C65/C64DX in C64 mode.
6404 <tag/Notes/<itemize>
6405 <item>The function is specific to the C64.
6406 <item>The function does not check for the presence of a C65/C64DX in C64 mode.
6407 <item>See the accelerator.h header for the speed definitions.
6409 <tag/Availability/cc65 (not all platforms)
6411 <ref id="detect_c65" name="detect_c65">,
6412 <ref id="get_c65_speed" name="get_c65_speed">,
6418 <sect1>set_chameleon_speed<label id="set_chameleon_speed"><p>
6422 <tag/Function/Set the current speed of the C64 Chameleon cartridge.
6423 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6424 <tag/Declaration/<tt/unsigned char __fastcall__ set_chameleon_speed (unsigned char speed);/
6425 <tag/Description/The function returns the speed after trying to set the speed of the C64 Chameleon cartridge.
6426 <tag/Notes/<itemize>
6427 <item>The function is specific to the C64.
6428 <item>The function does not check for the presence of the C64 Chameleon cartridge.
6429 <item>See the accelerator.h header for the speed definitions.
6431 <tag/Availability/cc65 (not all platforms)
6433 <ref id="detect_chameleon" name="detect_chameleon">,
6434 <ref id="get_chameleon_speed" name="get_chameleon_speed">,
6440 <sect1>set_scpu_speed<label id="set_scpu_speed"><p>
6444 <tag/Function/Set the current speed of the C64/C128 SuperCPU cartridge.
6445 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6446 <tag/Declaration/<tt/unsigned char __fastcall__ set_scpu_speed (unsigned char speed);/
6447 <tag/Description/The function returns the speed after trying to set the speed of the SuperCPU cartridge.
6448 <tag/Notes/<itemize>
6449 <item>The function is specific to the C128 and C64.
6450 <item>The function does not check for the presence of the cartridge.
6451 <item>See the accelerator.h header for the speed definitions.
6453 <tag/Availability/cc65 (not all platforms)
6455 <ref id="detect_scpu" name="detect_scpu">,
6456 <ref id="get_scpu_speed" name="get_scpu_speed">,
6462 <sect1>set_turbomaster_speed<label id="set_turbomaster_speed"><p>
6466 <tag/Function/Set the current speed of the C64 Turbo Master cartridge.
6467 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6468 <tag/Declaration/<tt/unsigned char __fastcall__ set_turbomaster_speed (unsigned char speed);/
6469 <tag/Description/The function returns the speed after trying to set the speed of the C64 Turbo Master cartridge.
6470 <tag/Notes/<itemize>
6471 <item>The function is specific to the C64.
6472 <item>The function does not check for the presence of the C64 Turbo Master cartridge.
6473 <item>See the accelerator.h header for the speed definitions.
6475 <tag/Availability/cc65 (not all platforms)
6477 <ref id="detect_turbomaster" name="detect_turbomaster">,
6478 <ref id="get_turbomaster_speed" name="get_turbomaster_speed">,
6484 <sect1>setjmp<label id="setjmp"><p>
6488 <tag/Function/Save the context for use with <tt/longjmp/.
6489 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
6490 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
6491 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
6492 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
6494 <tag/Notes/<itemize>
6495 <item>The function is only available as fastcall function, so it may only
6496 be used in presence of a prototype.
6497 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
6498 <item><tt/setjmp/ will not save the signal context.
6500 <tag/Availability/ISO 9899
6502 <ref id="longjmp" name="longjmp">
6508 <sect1>setlocale<label id="setlocale"><p>
6512 <tag/Function/Selects a locale.
6513 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
6514 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
6515 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
6516 <tag/Notes/<itemize>
6517 <item>The function is only available as fastcall function, so it may only
6518 be used in presence of a prototype.
6519 <item>cc65 supports only the "C" locale, so calling this function to set a
6520 different locale has no effect.
6522 <tag/Availability/ISO 9899
6524 <ref id="localeconv" name="localeconv">,
6525 <ref id="strcoll" name="strcoll">
6526 <ref id="strxfrm" name="strxfrm">
6532 <sect1>signal<label id="signal"><p>
6536 <tag/Function/Install a signal handler.
6537 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
6538 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
6539 <tag/Description/<tt/signal/ installs a handler for the given signal. The
6540 handler may either be a user supplied function, or one of the predefined
6541 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
6542 previous value if the signal , or the special function vector SIG_ERR in
6544 <tag/Notes/<itemize>
6545 <item>The function is only available as fastcall function, so it may only
6546 be used in presence of a prototype.
6548 <tag/Availability/ISO 9899
6550 <ref id="abort" name="abort">,
6551 <ref id="raise" name="raise">
6557 <sect1>sleep<label id="sleep"><p>
6561 <tag/Function/Sleep for a specified amount of time.
6562 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
6563 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
6564 <tag/Description/The function will return after the specified number of
6565 seconds have elapsed.
6566 <tag/Notes/<itemize>
6567 <item>The function is only available as fastcall function, so it may only
6568 be used in presence of a prototype.
6570 <tag/Availability/POSIX 1003.1
6576 <sect1>slow<label id="slow"><p>
6580 <tag/Function/Switch the CPU into slow mode (C128: 1MHz mode, C16/Plus4: single clock mode).
6581 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
6582 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
6583 <tag/Declaration/<tt/void slow (void);/
6584 <tag/Description/The function will switch the clock of the CPU to slow mode. for the C128
6585 target it means switching the CPU into 1MHz mode. for the C16/Plus4 target it means
6586 switching the CPU into single clock mode.
6587 <tag/Notes/<itemize>
6588 <item>The function is specific to the C128, C16 and Plus4.
6590 <tag/Availability/cc65 (not all platforms)
6592 <ref id="fast" name="fast">,
6593 <ref id="isfast" name="isfast">,
6599 <sect1>srand<label id="srand"><p>
6603 <tag/Function/Initialize the pseudo random number generator.
6604 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
6605 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
6606 <tag/Description/The function initializes the random number generator using
6607 the given seed. On program startup, the generator behaves as if <tt/srand/ has
6608 been called with an argument of 1.
6609 <tag/Notes/<itemize>
6610 <item>The function is only available as fastcall function, so it may only
6611 be used in presence of a prototype.
6613 <tag/Availability/ISO 9899
6615 <ref id="_randomize" name="_randomize">,
6616 <ref id="rand" name="rand">
6622 <sect1>strcasecmp<label id="strcasecmp"><p>
6626 <tag/Function/Compare two strings case insensitive.
6627 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6628 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
6629 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
6630 as parameters without case sensitivity. It returns a value that is less than
6631 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
6632 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
6633 <tag/Notes/<itemize>
6634 <item>The function is only available as fastcall function, so it may only
6635 be used in presence of a prototype.
6636 <item>The function is not available in strict ANSI mode.
6638 <tag/Availability/cc65
6640 <ref id="strcmp" name="strcmp">,
6641 <ref id="strcoll" name="strcoll">,
6642 <ref id="stricmp" name="stricmp">,
6643 <ref id="strncmp" name="strncmp">,
6644 <ref id="strxfrm" name="strxfrm">
6650 <sect1>strcat<label id="strcat"><p>
6654 <tag/Function/Concatentate two strings.
6655 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6656 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
6657 <tag/Description/The <tt/strcat/ function appends a copy of the string
6658 pointed to by s2 (including the terminating null byte) to the end of the
6659 string pointed to by s1. The initial byte of s2 overwrites the null byte at
6661 <tag/Notes/<itemize>
6662 <item>The function is only available as fastcall function, so it may only
6663 be used in presence of a prototype.
6664 <item>If copying takes place between objects that overlap, the behaviour
6667 <tag/Availability/ISO 9899
6669 <ref id="strcpy" name="strcpy">,
6670 <ref id="strncat" name="strncat">,
6671 <ref id="strncpy" name="strncpy">
6677 <sect1>strchr<label id="strchr"><p>
6681 <tag/Function/Search for a character in a string.
6682 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6683 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
6684 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
6685 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6686 byte is considered to be part of the string. Upon completion, the function
6687 returns a pointer to the byte, or a null pointer if the byte was not found.
6688 <tag/Notes/<itemize>
6689 <item>The function is only available as fastcall function, so it may only
6690 be used in presence of a prototype.
6692 <tag/Availability/ISO 9899
6694 <ref id="memchr" name="memchr">,
6695 <ref id="strrchr" name="strrchr">
6701 <sect1>strcmp<label id="strcmp"><p>
6705 <tag/Function/Compare two strings.
6706 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6707 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
6708 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
6709 parameters. It returns a value that is less than zero if <tt/s1/ is less than
6710 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
6711 if <tt/s1/ is greater than <tt/s2/.
6712 <tag/Notes/<itemize>
6713 <item>The function is only available as fastcall function, so it may only
6714 be used in presence of a prototype.
6716 <tag/Availability/ISO 9899
6718 <ref id="strcasecmp" name="strcasecmp">,
6719 <ref id="strcoll" name="strcoll">,
6720 <ref id="stricmp" name="stricmp">,
6721 <ref id="strncmp" name="strncmp">
6722 <ref id="strxfrm" name="strxfrm">
6728 <sect1>strcoll<label id="strcoll"><p>
6732 <tag/Function/Compare two strings.
6733 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6734 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
6735 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
6736 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
6737 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
6738 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
6739 than zero if <tt/s1/ is greater than <tt/s2/.
6740 <tag/Notes/<itemize>
6741 <item>The function is only available as fastcall function, so it may only
6742 be used in presence of a prototype.
6744 <tag/Availability/ISO 9899
6746 <ref id="setlocale" name="setlocale">,
6747 <ref id="strcasecmp" name="strcasecmp">,
6748 <ref id="strcmp" name="strcmp">,
6749 <ref id="stricmp" name="stricmp">,
6750 <ref id="strncmp" name="strncmp">,
6751 <ref id="strxfrm" name="strxfrm">
6757 <sect1>strcpy<label id="strcpy"><p>
6761 <tag/Function/Copy a string.
6762 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6763 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
6764 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
6765 <tt/s2/ (including the terminating null byte) into the array pointed to by
6766 <tt/s1/. The function will always return <tt/s1/.
6767 <tag/Notes/<itemize>
6768 <item>The function is only available as fastcall function, so it may only
6769 be used in presence of a prototype.
6770 <item>If copying takes place between objects that overlap, the behaviour
6773 <tag/Availability/ISO 9899
6775 <ref id="strcat" name="strcat">,
6776 <ref id="strncat" name="strncat">,
6777 <ref id="strncpy" name="strncpy">
6780 #include <string.h>
6782 static char hello[14];
6784 strcpy (hello, "Hello world!\n");
6790 <sect1>strcspn<label id="strcspn"><p>
6794 <tag/Function/Compute the length of a substring.
6795 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6796 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
6797 <tag/Description/The <tt/strcspn/ function computes and returns the length of
6798 the substring pointed to by <tt/s/ which does <em>not</em> consist of
6799 characters contained in the string <tt/set/.
6800 <tag/Notes/<itemize>
6801 <item>The function is only available as fastcall function, so it may only
6802 be used in presence of a prototype.
6804 <tag/Availability/ISO 9899
6806 <ref id="strpbrk" name="strpbrk">,
6807 <ref id="strqtok" name="strqtok">,
6808 <ref id="strspn" name="strspn">,
6809 <ref id="strstr" name="strstr">,
6810 <ref id="strtok" name="strtok">
6816 <sect1>strdup<label id="strdup"><p>
6820 <tag/Function/Allocate a copy of a string on the heap.
6821 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6822 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
6823 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
6824 to hold a copy of <tt/s/ including the terminating zero. If the allocation
6825 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
6826 memory block, and a pointer to the block is returned.
6827 <tag/Notes/<itemize>
6828 <item>The function is only available as fastcall function, so it may only
6829 be used in presence of a prototype.
6830 <item>It is up to the caller to free the allocated memory block.
6832 <tag/Availability/ISO 9899
6834 <ref id="free" name="free">,
6835 <ref id="malloc" name="malloc">
6841 <sect1>strerror<label id="strerror"><p>
6845 <tag/Function/Return a string describing an error code.
6846 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6847 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
6848 <tag/Description/The <tt/strerror/ function returns a string describing the
6849 given error code. If an invalid error code is passed, the string "Unknown
6850 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
6851 <tt/errno/ is left untouched.
6852 <tag/Notes/<itemize>
6853 <item>The function is only available as fastcall function, so it may only
6854 be used in presence of a prototype.
6855 <item>While the return type of the function is a <tt/char*/, the returned
6856 string must not be modified by the caller!
6858 <tag/Availability/ISO 9899
6860 <ref id="_stroserror" name="_stroserror">
6866 <sect1>stricmp<label id="stricmp"><p>
6870 <tag/Function/Compare two strings case insensitive.
6871 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6872 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
6873 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
6874 parameters without case sensitivity. It returns a value that is less than zero
6875 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
6876 value greater than zero if <tt/s1/ is greater than <tt/s2/.
6877 <tag/Notes/<itemize>
6878 <item>The function is only available as fastcall function, so it may only
6879 be used in presence of a prototype.
6880 <item>The function is not available in strict ANSI mode.
6882 <tag/Availability/cc65
6884 <ref id="strcasecmp" name="strcasecmp">,
6885 <ref id="strcmp" name="strcmp">,
6886 <ref id="strcoll" name="strcoll">,
6887 <ref id="strncmp" name="strncmp">,
6888 <ref id="strxfrm" name="strxfrm">
6894 <sect1>strlen<label id="strlen"><p>
6898 <tag/Function/Return the length of a string.
6899 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6900 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
6901 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
6902 string to which s points, not including the terminating null byte.
6903 <tag/Notes/<itemize>
6904 <item>The function is only available as fastcall function, so it may only
6905 be used in presence of a prototype.
6906 <item>When compiling with <tt/-Os/ (inline known standard functions), the
6907 function does not work correctly for strings with more than 255 characters.
6909 <tag/Availability/ISO 9899
6911 <ref id="strcpy" name="strcpy">
6917 <sect1>strlower<label id="strlower"><p>
6921 <tag/Function/Make a string lower case.
6922 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6923 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
6924 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
6925 function to each character of a string. The function will always return <tt/s/.
6926 <tag/Notes/<itemize>
6927 <item>The function is only available as fastcall function, so it may only
6928 be used in presence of a prototype.
6929 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6930 <item>An alias name for this function is <tt/strlwr/.
6932 <tag/Availability/cc65
6934 <ref id="strupper" name="strupper">,
6935 <ref id="tolower" name="tolower">
6941 <sect1>strlwr<label id="strlwr"><p>
6948 <sect1>strncasecmp<label id="strncasecmp"><p>
6952 <tag/Function/Compare two strings case insensitive.
6953 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6954 <tag/Declaration/<tt/int __fastcall__ strncasecmp (const char* s1, const char* s2, size_t count);/
6955 <tag/Description/The <tt/strncasecmp/ function compares the two strings passed
6956 as parameters without case sensitivity. It returns a value that is less than
6957 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
6958 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
6959 <tag/Notes/<itemize>
6960 <item>The function is only available as fastcall function, so it may only
6961 be used in presence of a prototype.
6962 <item>The function is not available in strict ANSI mode.
6964 <tag/Availability/cc65
6966 <ref id="strcmp" name="strcmp">,
6967 <ref id="strcoll" name="strcoll">,
6968 <ref id="stricmp" name="stricmp">,
6969 <ref id="strncmp" name="strncmp">,
6970 <ref id="strxfrm" name="strxfrm">
6976 <sect1>strncat<label id="strncat"><p>
6980 <tag/Function/Concatentate two strings.
6981 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6982 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
6983 <tag/Description/The <tt/strncat/ function appends not more than n characters
6984 of the string pointed to by s2 to the end of the string pointed to by s1. The
6985 terminating null character at the end of s1 is overwritten. A terminating null
6986 character is appended to the result, even if not all of s2 is appended to s1.
6987 <tag/Notes/<itemize>
6988 <item>The function is only available as fastcall function, so it may only
6989 be used in presence of a prototype.
6990 <item>If copying takes place between objects that overlap, the behaviour
6993 <tag/Availability/ISO 9899
6995 <ref id="strcpy" name="strcpy">,
6996 <ref id="strncat" name="strncat">,
6997 <ref id="strncpy" name="strncpy">
7003 <sect1>strncmp<label id="strncmp"><p>
7007 <tag/Function/Compare two strings.
7008 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7009 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
7010 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
7011 characters of the two strings passed as parameters. It returns a value that is
7012 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
7013 <tt/s2/, zero if they are identical, and a value greater than zero they are
7015 <tag/Notes/<itemize>
7016 <item>The function is only available as fastcall function, so it may only
7017 be used in presence of a prototype.
7019 <tag/Availability/ISO 9899
7021 <ref id="strcasecmp" name="strcasecmp">,
7022 <ref id="strcmp" name="strcmp">,
7023 <ref id="strcoll" name="strcoll">,
7024 <ref id="stricmp" name="stricmp">,
7025 <ref id="strxfrm" name="strxfrm">
7031 <sect1>strncpy<label id="strncpy"><p>
7035 <tag/Function/Copy part of a string.
7036 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7037 <tag/Declaration/<tt/char* __fastcall__ strncpy (char* s1, const char* s2, size_t n);/
7038 <tag/Description/The <tt/strncpy/ function copies not more than <tt/n/ bytes from
7039 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
7040 pointed to by <tt/s2/ is a string that is shorter than <tt/n/ bytes, null bytes are
7041 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
7042 written. The function always will return <tt/s1/.
7043 <tag/Notes/<itemize>
7044 <item>The function is available only as a fastcall function; so, it may be used
7045 only in the presence of a prototype.
7046 <item>If there is no null byte in the first <tt/n/ bytes of the array pointed
7047 to by <tt/s2/, the result is <em/not/ null-terminated!
7048 <item>If copying takes place between objects that overlap, the behaviour is
7051 <tag/Availability/ISO 9899
7053 <ref id="memcpy" name="memcpy">,
7054 <ref id="strcat" name="strcat">,
7055 <ref id="strcpy" name="strcpy">,
7056 <ref id="strncat" name="strncat">
7061 static char hello[6];
7063 strncpy (hello, "Hello world!\n", sizeof hello - 1)[5] = '\0';
7069 <sect1>strnicmp<label id="strnicmp"><p>
7073 <tag/Function/Compare two strings case insensitive.
7074 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7075 <tag/Declaration/<tt/int __fastcall__ strnicmp (const char* s1, const char* s2, size_t count);/
7076 <tag/Description/The <tt/strnicmp/ function compares the two strings passed as
7077 parameters without case sensitivity. It returns a value that is less than zero
7078 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
7079 value greater than zero if <tt/s1/ is greater than <tt/s2/.
7080 <tag/Notes/<itemize>
7081 <item>The function is only available as fastcall function, so it may only
7082 be used in presence of a prototype.
7083 <item>The function is not available in strict ANSI mode.
7085 <tag/Availability/cc65
7087 <ref id="strcasecmp" name="strcasecmp">,
7088 <ref id="strcmp" name="strcmp">,
7089 <ref id="strcoll" name="strcoll">,
7090 <ref id="strncmp" name="strncmp">,
7091 <ref id="strxfrm" name="strxfrm">
7097 <sect1>strpbrk<label id="strpbrk"><p>
7101 <tag/Function/Find a character in a string, from a set of characters.
7102 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7103 <tag/Declaration/<tt/char* __fastcall__ strpbrk (const char* str, const char* set);/
7104 <tag/Description/<tt/strpbrk()/ searches within <tt/str/ for the first
7105 occurance of any character from <tt/set/. It returns a pointer to that
7106 character if found; otherwise, it returns <tt/NULL/.
7107 <tag/Notes/<itemize>
7108 <item>The function is available only as a fastcall function;
7109 so, it should be used only in the presence of a prototype.
7111 <tag/Availability/ISO 9899
7113 <ref id="strchr" name="strchr">,
7114 <ref id="strcspn" name="strcspn">,
7115 <ref id="strqtok" name="strqtok">,
7116 <ref id="strspn" name="strspn">,
7117 <ref id="strtok" name="strtok">
7123 <sect1>strqtok<label id="strqtok"><p>
7127 <tag/Function/Break a string into tokens.
7128 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7129 <tag/Declaration/<tt/char* __fastcall__ strqtok (char* s1, const char* s2);/
7130 <tag/Description/<tt/strqtok()/ will break the string <tt/s1/ into a sequence of
7131 tokens, which are delimited by either quotation marks or characters from the
7132 string <tt/s2/. Tokens inside quotation marks may contain characters from <tt/s2/
7133 (they aren't delimiters there). The first call to <tt/strqtok()/ will return a
7134 pointer to the first token in the string <tt/s1/. The following calls must pass
7135 a <tt/NULL/ pointer as <tt/s1/, in order to get the next token in the string.
7136 Different sets of delimiters may be used for the subsequent calls to <tt/strqtok()/.
7137 <tag/Notes/<itemize>
7138 <item>The function is available only as a fastcall function; so, it may be used
7139 only in the presence of a prototype.
7140 <item><tt/strqtok()/ will modify the string <tt/s1/.
7141 <item>The function will forget where it is in the <tt/s1/ string if it is given
7142 a second <tt/s1/ string before it finishes the first one.
7144 <tag/Availability/cc65
7146 <ref id="strcspn" name="strcspn">,
7147 <ref id="strpbrk" name="strpbrk">,
7148 <ref id="strspn" name="strspn">,
7149 <ref id="strtok" name="strtok">
7155 <sect1>strrchr<label id="strrchr"><p>
7159 <tag/Function/Search for a character in a string.
7160 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7161 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
7162 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
7163 (converted to a char) in the string pointed to by <tt/s/. The terminating null
7164 byte is considered to be part of the string. Upon completion, the function
7165 returns a pointer to the byte, or a null pointer if the byte was not found.
7166 <tag/Notes/<itemize>
7167 <item>The function is only available as fastcall function, so it may only
7168 be used in presence of a prototype.
7170 <tag/Availability/ISO 9899
7172 <ref id="strchr" name="strchr">
7178 <sect1>strspn<label id="strspn"><p>
7182 <tag/Function/Compute the length of a substring.
7183 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7184 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
7185 <tag/Description/The <tt/strspn/ function computes and returns the length of
7186 the substring pointed to by <tt/s/ which does consist only of characters
7187 contained in the string <tt/set/.
7188 <tag/Notes/<itemize>
7189 <item>The function is only available as fastcall function, so it may only
7190 be used in presence of a prototype.
7192 <tag/Availability/ISO 9899
7194 <ref id="strcspn" name="strcspn">,
7195 <ref id="strpbrk" name="strpbrk">,
7196 <ref id="strstr" name="strstr">
7202 <sect1>strstr<label id="strstr"><p>
7206 <tag/Function/Find a substring.
7207 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7208 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
7209 <tag/Description/<tt/strstr/ searches for the first occurance of the string
7210 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
7211 otherwise it returns <tt/NULL/.
7212 <tag/Notes/<itemize>
7213 <item>The function is only available as fastcall function, so it may only
7214 be used in presence of a prototype.
7216 <tag/Availability/ISO 9899
7218 <ref id="strcspn" name="strcspn">,
7219 <ref id="strspn" name="strspn">
7225 <sect1>strtok<label id="strtok"><p>
7229 <tag/Function/Break a string into tokens.
7230 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7231 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
7232 <tag/Description/<tt/strtok()/ will break the string <tt/s1/ into a sequence of
7233 tokens, which are delimited by characters from the string <tt/s2/. The first call
7234 to <tt/strtok()/ will return a pointer to the first token in the string <tt/s1/.
7235 The following calls must pass a <tt/NULL/ pointer as <tt/s1/, in order to get
7236 the next token in the string. Different sets of delimiters may be used for the
7237 subsequent calls to <tt/strtok()/.
7238 <tag/Notes/<itemize>
7239 <item>The function is only available as fastcall function, so it may only
7240 be used in presence of a prototype.
7241 <item><tt/strtok()/ will modify the string <tt/s1/.
7242 <item>The function will forget where it is in the <tt/s1/ string if it is given
7243 a second <tt/s1/ string before it finishes the first one.
7245 <tag/Availability/ISO 9899
7247 <ref id="strcspn" name="strcspn">,
7248 <ref id="strpbrk" name="strpbrk">,
7249 <ref id="strqtok" name="strqtok">,
7250 <ref id="strspn" name="strspn">
7256 <sect1>strxfrm<label id="strxfrm"><p>
7260 <tag/Function/Transform a string.
7261 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7262 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
7263 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
7264 s2 and places the resulting string into the string pointed to by s1. The
7265 transformation is such that if the <tt/strcmp/ function is applied to two
7266 transformed strings, it returns a value greater than, equal to, or less than
7267 zero, corresponding to the result of the <tt/strcoll/ function applied to the
7268 same two original strings. No more than n characters are placed into the
7269 resulting array pointed to by s1, including the terminating null character.
7270 <tag/Notes/<itemize>
7271 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
7272 the behaviour is undefined.
7273 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
7274 <item>The function is only available as fastcall function, so it may only
7275 be used in presence of a prototype.
7276 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
7277 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
7279 <tag/Availability/ISO 9899
7281 <ref id="strcmp" name="strcmp">,
7282 <ref id="strcoll" name="strcoll">,
7283 <ref id="strncpy" name="strncpy">
7289 <sect1>strupper<label id="strupper"><p>
7293 <tag/Function/Make a string upper case.
7294 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7295 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
7296 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
7297 function to each character of a string. The function will always return <tt/s/.
7298 <tag/Notes/<itemize>
7299 <item>The function is only available as fastcall function, so it may only
7300 be used in presence of a prototype.
7301 <item>The function prototype is unavailable when compiling in strict ANSI mode.
7302 <item>An alias name for this function is <tt/strupr/.
7304 <tag/Availability/cc65
7306 <ref id="strlower" name="strlower">
7307 <ref id="toupper" name="toupper">
7313 <sect1>strupr<label id="strupr"><p>
7320 <sect1>telldir<label id="telldir"><p>
7324 <tag/Function/Return the current position of a directory stream.
7325 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
7326 <tag/Declaration/<tt/long __fastcall__ telldir (DIR* dir);/
7327 <tag/Description/<tt/telldir/ returns the current position of a directory
7328 stream. The return value may be used in subsequent calls to
7329 <tt/<ref id="seekdir" name="seekdir">/.
7330 <tag/Notes/<itemize>
7331 <item>The function is only available as fastcall function, so it may only
7332 be used in presence of a prototype.
7334 <tag/Availability/POSIX 1003.1
7336 <ref id="seekdir" name="seekdir">,
7337 <ref id="telldir" name="telldir">
7343 <sect1>textcolor<label id="textcolor"><p>
7347 <tag/Function/Set the text color.
7348 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7349 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
7350 <tag/Description/The function will set a new text color. It returns the old
7351 (current) text color. Text output using any <tt/conio.h/ function will use
7352 the color set by this function.
7353 <tag/Notes/<itemize>
7354 <item>Text colors are system dependent. The function may have no effect
7355 on systems where the text color cannot be changed.
7356 <item>The function is only available as fastcall function, so it may only
7357 be used in presence of a prototype.
7359 <tag/Availability/cc65
7361 <ref id="bgcolor" name="bgcolor">,
7362 <ref id="bordercolor" name="bordercolor">
7368 <sect1>time<label id="time"><p>
7372 <tag/Function/Get the time.
7373 <tag/Header/<tt/<ref id="time.h" name="time.h">/
7374 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
7375 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
7376 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
7377 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
7378 returned and an error code is stored in <tt/errno/.
7379 <tag/Notes/<itemize>
7380 <item>The function is only available as fastcall function, so it may
7381 only be used in presence of a prototype.
7382 <item>Many platforms supported by cc65 do not have a realtime clock, so the
7383 returned value may not be valid.
7385 <tag/Availability/ISO 9899
7387 <ref id="clock" name="clock">
7393 <sect1>toggle_videomode<label id="toggle_videomode"><p>
7397 <tag/Function/Toggle between 40 and 80 column mode.
7398 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
7399 <tag/Declaration/<tt/void toggle_videomode (void);/
7400 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
7401 old mode (cursor position, color and so on) are saved and restored together
7403 <tag/Notes/<itemize>
7404 <item>The function is specific to the C128.
7405 <item>This function is deprecated. Please use <ref id="videomode"
7406 name="videomode"> instead!
7408 <tag/Availability/C128
7410 <ref id="fast" name="fast">,
7411 <ref id="isfast" name="isfast">,
7412 <ref id="slow" name="slow">,
7413 <ref id="videomode" name="videomode">
7419 <sect1>tolower<label id="tolower"><p>
7423 <tag/Function/Convert a character into its lower case representation.
7424 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7425 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
7426 <tag/Description/The function returns the given character converted to lower
7427 case. If the given character is not a letter, it is returned unchanged.
7428 <tag/Notes/<itemize>
7429 <item>The function is only available as fastcall function, so it may
7430 only be used in presence of a prototype.
7432 <tag/Availability/ISO 9899
7434 <ref id="islower" name="islower">,
7435 <ref id="isupper" name="isupper">,
7436 <ref id="toupper" name="toupper">
7442 <sect1>toupper<label id="toupper"><p>
7446 <tag/Function/Convert a character into its upper case representation.
7447 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7448 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
7449 <tag/Description/The function returns the given character converted to upper
7450 case. If the given character is not a letter, it is returned unchanged.
7451 <tag/Notes/<itemize>
7452 <item>The function is only available as fastcall function, so it may
7453 only be used in presence of a prototype.
7455 <tag/Availability/ISO 9899
7457 <ref id="islower" name="islower">,
7458 <ref id="isupper" name="isupper">,
7459 <ref id="tolower" name="tolower">
7465 <sect1>ultoa<label id="ultoa"><p>
7469 <tag/Function/Convert an unsigned long integer into a string.
7470 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7471 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
7472 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
7473 string using <tt/radix/ as the base.
7474 <tag/Notes/<itemize>
7475 <item>There are no provisions to prevent a buffer overflow.
7476 <item>The function is non standard, so it is not available in strict ANSI mode.
7477 You should probably use <tt/sprintf/ instead.
7478 <item>The function is only available as fastcall function, so it may only be
7479 used in presence of a prototype.
7481 <tag/Availability/cc65
7483 <ref id="atoi" name="atoi">,
7484 <ref id="atol" name="atol">,
7485 <ref id="itoa" name="itoa">,
7486 <ref id="ltoa" name="ltoa">,
7487 <ref id="utoa" name="utoa">
7493 <sect1>unlink<label id="unlink"><p>
7497 <tag/Function/Delete a file.
7498 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
7499 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
7500 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
7501 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
7502 code describing the reason for the failure.
7503 <tag/Notes/<itemize>
7504 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
7505 name="remove">/ instead, which is a native ANSI C function and does the same.
7506 <item>This function is not available on all cc65 targets (depends on the
7507 availability of file I/O).
7508 <item>The function is only available as fastcall function, so it may only
7509 be used in presence of a prototype.
7510 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
7511 used, which has the same semantics, but is more portable, because it conforms
7512 to the ISO C standard.
7514 <tag/Availability/POSIX 1003.1
7516 <ref id="remove" name="remove">
7519 #include <stdio.h>
7520 #include <unistd.h>
7522 #define FILENAME "helloworld"
7524 if (unlink (FILENAME) == 0) {
7525 printf ("We deleted %s successfully\n", FILENAME);
7527 printf ("There was a problem deleting %s\n", FILENAME);
7534 <sect1>utoa<label id="utoa"><p>
7538 <tag/Function/Convert an unsigned integer into a string.
7539 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7540 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
7541 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
7542 using <tt/radix/ as the base.
7543 <tag/Notes/<itemize>
7544 <item>There are no provisions to prevent a buffer overflow.
7545 <item>The function is non standard, so it is not available in strict ANSI mode.
7546 You should probably use <tt/sprintf/ instead.
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="atoi" name="atoi">,
7553 <ref id="atol" name="atol">,
7554 <ref id="itoa" name="itoa">,
7555 <ref id="ltoa" name="ltoa">,
7556 <ref id="ultoa" name="ultoa">
7562 <sect1>vcprintf<label id="vcprintf"><p>
7566 <tag/Function/Formatted output to the console.
7567 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7568 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
7569 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
7570 text where necessary and formatted according to the format string given. The
7571 resulting string is output to the console. <tt/vcprintf/ supports the same
7572 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
7573 <tag/Notes/<itemize>
7574 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
7575 between <tt/\r/ and <tt/\n/.
7576 <item>The function is only available as fastcall function, so it may only be
7577 used in presence of a prototype.
7579 <tag/Availability/cc65
7581 <ref id="cprintf" name="cprintf">,
7582 <ref id="cputc" name="cputc">,
7583 <ref id="cputcxy" name="cputcxy">,
7584 <ref id="cputs" name="cputs">,
7585 <ref id="cputsxy" name="cputsxy">
7591 <sect1>videomode<label id="videomode"><p>
7595 <tag/Function/Switch to either 40 or 80 column mode.
7596 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
7597 <ref id="c128.h" name="c128.h">/
7598 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
7599 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
7600 the requested mode is already active, nothing happens. The old mode is returned
7602 <tag/Notes/<itemize>
7603 <item>The function is specific to the C128 and enhanced Apple //e.
7604 <item>This function replaces <ref id="toggle_videomode"
7605 name="toggle_videomode">.
7606 <item>The function is only available as fastcall function, so it may only be
7607 used in presence of a prototype.
7609 <tag/Availability/C128 and enhanced Apple //e
7611 <ref id="fast" name="fast">,
7612 <ref id="isfast" name="isfast">,
7613 <ref id="slow" name="slow">,
7614 <ref id="toggle_videomode" name="toggle_videomode">
7620 <sect1>waitvsync<label id="waitvsync"><p>
7624 <tag/Function/Wait until the start of the next frame.
7626 <tt/<ref id="cbm.h" name="cbm.h">/,
7627 <tt/<ref id="gamate.h" name="gamate.h">/,
7628 <tt/<ref id="nes.h" name="nes.h">/,
7629 <tt/<ref id="pce.h" name="pce.h">/
7630 <tag/Declaration/<tt/void waitvsync (void);/
7631 <tag/Description/Wait for vertical sync to reduce flickering.
7632 <tag/Availability/Platforms above
7638 <sect1>wherex<label id="wherex"><p>
7642 <tag/Function/Return the current X position of the text mode cursor.
7643 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7644 <tag/Declaration/<tt/unsigned char wherex (void);/
7645 <tag/Description/The function returns the current X position of the text mode
7646 cursor. Zero is returned for the leftmost screen position.
7647 <tag/Availability/cc65
7649 <ref id="gotox" name="gotox">,
7650 <ref id="gotoy" name="gotoy">,
7651 <ref id="gotoxy" name="gotoxy">,
7652 <ref id="wherey" name="wherey">
7658 <sect1>wherey<label id="wherey"><p>
7662 <tag/Function/Return the current Y position of the text mode cursor.
7663 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7664 <tag/Declaration/<tt/unsigned char wherey (void);/
7665 <tag/Description/The function returns the current Y position of the text mode
7666 cursor. Zero is returned for the uppermost screen position.
7667 <tag/Availability/cc65
7669 <ref id="gotox" name="gotox">,
7670 <ref id="gotoy" name="gotoy">,
7671 <ref id="gotoxy" name="gotoxy">,
7672 <ref id="wherex" name="wherex">