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">
9 cc65 is a C compiler for 6502 based systems. This function reference describes
10 the C functions available in the standard library.
13 <!-- Table of contents -->
16 <!-- Begin the document -->
20 cc65 is a C compiler for 6502 based systems. It implements a subset of the ISO
21 C standard plus additional functions specially crafted for 6502 systems or
22 just some of the supported machines. This function refrence describes the
23 available functions together with any limitations.
25 For an overview about the available libraries, their purpose, and any
26 differences to the ISO standard, please have a look at the <url
27 url="library.html" name="cc65 Library Overview">.
29 <em/Note:/ Standard C functions are listed here, but not described in detail.
30 Since these functions behave identical on all standard compliant systems, they
31 are described in any book covering standard C.
33 Each entry for a function contains a detailed description
37 <tag/Function/Summary of what <bf/function/ does.
38 <tag/Header/The header file that contains the declaration.
39 <tag/Declaration/Describes the needed header files and declaration of the
41 <tag/Description/Description of the function.
42 <tag/Notes/Notes on the function.
43 <tag/Availability/The availability of the function.
44 <tag/See also/Other related functions.
45 <tag/Example/A piece of actual code using the function.
50 <sect>Functions by header file<p>
52 <sect1><tt/6502.h/<label id="6502.h"><p>
55 <item><ref id="BRK" name="BRK">
56 <item><ref id="CLI" name="CLI">
57 <item><ref id="SEI" name="SEI">
58 <item><ref id="_sys" name="_sys">
59 <item><ref id="getcpu" name="getcpu">
60 <item><ref id="reset_brk" name="reset_brk">
61 <item><ref id="reset_irq" name="reset_irq">
62 <item><ref id="set_brk" name="set_brk">
63 <item><ref id="set_irq" name="set_irq">
67 <sect1><tt/accelerator.h/<label id="accelerator.h"><p>
70 <item><ref id="detect_c128" name="detect_c128">
71 <item><ref id="detect_c64dtv" name="detect_c64dtv">
72 <item><ref id="detect_c65" name="detect_c65">
73 <item><ref id="detect_chameleon" name="detect_chameleon">
74 <item><ref id="detect_scpu" name="detect_scpu">
75 <item><ref id="detect_turbomaster" name="detect_turbomaster">
76 <item><ref id="get_c128_speed" name="get_c128_speed">
77 <item><ref id="get_c64dtv_speed" name="get_c64dtv_speed">
78 <item><ref id="get_c65_speed" name="get_c65_speed">
79 <item><ref id="get_chameleon_speed" name="get_chameleon_speed">
80 <item><ref id="get_scpu_speed" name="get_scpu_speed">
81 <item><ref id="get_turbomaster_speed" name="get_turbomaster_speed">
82 <item><ref id="set_c128_speed" name="set_c128_speed">
83 <item><ref id="set_c64dtv_speed" name="set_c64dtv_speed">
84 <item><ref id="set_c65_speed" name="set_c65_speed">
85 <item><ref id="set_chameleon_speed" name="set_chameleon_speed">
86 <item><ref id="set_scpu_speed" name="set_scpu_speed">
87 <item><ref id="set_turbomaster_speed" name="set_turbomaster_speed">
91 <sect1><tt/apple2.h/<label id="apple2.h"><p>
95 <item><ref id="get_ostype" name="get_ostype">
100 <sect1><tt/apple2enh.h/<label id="apple2enh.h"><p>
104 <item><ref id="get_ostype" name="get_ostype">
105 <item>rebootafterexit
106 <item><ref id="videomode" name="videomode">
110 <sect1><tt/assert.h/<label id="assert.h"><p>
113 <item><ref id="assert" name="assert">
117 <sect1><tt/atari.h/<label id="atari.h"><p>
120 <!-- <item><ref id="_getcolor" name="_getcolor"> -->
121 <!-- <item><ref id="_getdefdev" name="_getdefdev"> -->
122 <!-- <item><ref id="_graphics" name="_graphics"> -->
123 <item><ref id="_is_cmdline_dos" name="_is_cmdline_dos">
124 <!-- <item><ref id="_rest_vecs" name="_rest_vecs"> -->
125 <!-- <item><ref id="_save_vecs" name="_save_vecs"> -->
126 <!-- <item><ref id="_scroll" name="_scroll"> -->
127 <!-- <item><ref id="_setcolor" name="_setcolor"> -->
128 <!-- <item><ref id="_setcolor_low" name="_setcolor_low"> -->
129 <item><ref id="get_ostype" name="get_ostype">
130 <!-- <item><ref id="get_tv" name="get_tv"> -->
136 <sect1><tt/atmos.h/<label id="atmos.h"><p>
139 <item><ref id="atmos_explode" name="atmos_explode">
140 <item><ref id="atmos_load" name="atmos_load">
141 <item><ref id="atmos_ping" name="atmos_ping">
142 <item><ref id="atmos_save" name="atmos_save">
143 <item><ref id="atmos_shoot" name="atmos_shoot">
144 <item><ref id="atmos_tick" name="atmos_tick">
145 <item><ref id="atmos_tock" name="atmos_tock">
146 <item><ref id="atmos_zap" name="atmos_zap">
150 <sect1><tt/c128.h/<label id="c128.h"><p>
153 <item><ref id="c64mode" name="c64mode">
154 <item><ref id="fast" name="fast">
155 <item><ref id="isfast" name="isfast">
156 <item><ref id="slow" name="slow">
157 <item><ref id="toggle_videomode" name="toggle_videomode">
158 <item><ref id="videomode" name="videomode">
162 <sect1><tt/c16.h/<label id="c16.h"><p>
165 <item><ref id="fast" name="fast">
166 <item><ref id="isfast" name="isfast">
167 <item><ref id="slow" name="slow">
173 <sect1><tt/c64.h/<label id="c64.h"><p>
176 <item><ref id="get_ostype" name="get_ostype">
180 <sect1><tt/cbm.h/<label id="cbm.h"><p>
183 <item><ref id="cbm_k_acptr" name="cbm_k_acptr">
184 <item><ref id="cbm_k_basin" name="cbm_k_basin">
185 <item><ref id="cbm_k_bsout" name="cbm_k_bsout">
186 <item><ref id="cbm_k_chkin" name="cbm_k_chkin">
187 <item><ref id="cbm_k_ciout" name="cbm_k_ciout">
188 <item><ref id="cbm_k_ckout" name="cbm_k_ckout">
189 <item><ref id="cbm_k_clall" name="cbm_k_clall">
190 <item><ref id="cbm_k_close" name="cbm_k_close">
191 <item><ref id="cbm_k_clrch" name="cbm_k_clrch">
192 <item><ref id="cbm_k_getin" name="cbm_k_getin">
193 <item><ref id="cbm_k_iobase" name="cbm_k_iobase">
194 <item><ref id="cbm_k_listen" name="cbm_k_listen">
195 <item><ref id="cbm_k_load" name="cbm_k_load">
196 <item><ref id="cbm_k_open" name="cbm_k_open">
197 <item><ref id="cbm_k_readst" name="cbm_k_readst">
198 <item><ref id="cbm_k_save" name="cbm_k_save">
199 <item><ref id="cbm_k_scnkey" name="cbm_k_scnkey">
200 <item><ref id="cbm_k_second" name="cbm_k_second">
201 <item><ref id="cbm_k_setlfs" name="cbm_k_setlfs">
202 <item><ref id="cbm_k_setnam" name="cbm_k_setnam">
203 <item><ref id="cbm_k_talk" name="cbm_k_talk">
204 <item><ref id="cbm_k_tksa" name="cbm_k_tksa">
205 <item><ref id="cbm_k_udtim" name="cbm_k_udtim">
206 <item><ref id="cbm_k_unlsn" name="cbm_k_unlsn">
207 <item><ref id="cbm_k_untlk" name="cbm_k_untlk">
208 <!-- <item><ref id="cbm_load" name="cbm_load"> -->
209 <!-- <item><ref id="cbm_open" name="cbm_open"> -->
210 <!-- <item><ref id="cbm_opendir" name="cbm_opendir"> -->
211 <!-- <item><ref id="cbm_read" name="cbm_read"> -->
212 <!-- <item><ref id="cbm_readdir" name="cbm_readdir"> -->
213 <!-- <item><ref id="cbm_save" name="cbm_save"> -->
214 <!-- <item><ref id="cbm_write" name="cbm_write"> -->
215 <!-- <item><ref id="get_tv" name="get_tv"> -->
216 <item><ref id="waitvsync" name="waitvsync">
217 <item><ref id="kbrepeat" name="kbrepeat">
223 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
226 <item><ref id="peekbsys" name="peekbsys">
227 <item><ref id="peekwsys" name="peekwsys">
228 <item><ref id="pokebsys" name="pokebsys">
229 <item><ref id="pokewsys" name="pokewsys">
233 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
236 <item><ref id="peekbsys" name="peekbsys">
237 <item><ref id="peekwsys" name="peekwsys">
238 <item><ref id="pokebsys" name="pokebsys">
239 <item><ref id="pokewsys" name="pokewsys">
243 <sect1><tt/cc65.h/<label id="cc65.h"><p>
247 <!-- <item><ref id="cos" name="cos"> -->
248 <!-- <item><ref id="idiv32by16r16" name="idiv32by16r16"> -->
249 <!-- <item><ref id="imul16x16r32" name="imul16x16r32"> -->
250 <!-- <item><ref id="imul8x8r16" name="imul8x8r16"> -->
251 <!-- <item><ref id="sin" name="sin"> -->
252 <!-- <item><ref id="udiv32by16r16" name="udiv32by16r16"> -->
253 <!-- <item><ref id="umul16x16r32" name="umul16x16r32"> -->
254 <!-- <item><ref id="umul16x8r32" name="umul16x8r32"> -->
255 <!-- <item><ref id="umul8x8r16" name="umul8x8r16"> -->
256 <item><ref id="doesclrscrafterexit" name="doesclrscrafterexit">
257 <item><ref id="mul20" name="mul20">
258 <item><ref id="mul40" name="mul40">
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">
584 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
589 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
594 <sect1><tt/stddef.h/<label id="stddef.h"><p>
597 <item><ref id="offsetof" name="offsetof">
601 <sect1><tt/stdio.h/<label id="stdio.h"><p>
604 <item><ref id="_poserror" name="_poserror">
605 <item><ref id="clearerr" name="clearerr">
606 <!-- <item><ref id="fclose" name="fclose"> -->
607 <!-- <item><ref id="fdopen" name="fdopen"> -->
608 <item><ref id="feof" name="feof">
609 <item><ref id="ferror" name="ferror">
610 <!-- <item><ref id="fflush" name="fflush"> -->
611 <!-- <item><ref id="fgetc" name="fgetc"> -->
612 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
613 <!-- <item><ref id="fgets" name="fgets"> -->
614 <item><ref id="fileno" name="fileno">
615 <!-- <item><ref id="fopen" name="fopen"> -->
616 <!-- <item><ref id="fprintf" name="fprintf"> -->
617 <!-- <item><ref id="fputc" name="fputc"> -->
618 <!-- <item><ref id="fputs" name="fputs"> -->
619 <!-- <item><ref id="fread" name="fread"> -->
620 <!-- <item><ref id="freopen" name="freopen"> -->
621 <!-- <item><ref id="fscanf" name="fscanf"> -->
622 <!-- <item><ref id="fseek" name="fseek"> -->
623 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
624 <!-- <item><ref id="ftell" name="ftell"> -->
625 <!-- <item><ref id="fwrite" name="fwrite"> -->
626 <!-- <item><ref id="getc" name="getc"> -->
627 <!-- <item><ref id="getchar" name="getchar"> -->
628 <!-- <item><ref id="gets" name="gets"> -->
629 <!-- <item><ref id="printf" name="printf"> -->
630 <!-- <item><ref id="putc" name="putc"> -->
631 <!-- <item><ref id="putchar" name="putchar"> -->
632 <!-- <item><ref id="puts" name="puts"> -->
633 <item><ref id="rename" name="rename">
634 <item><ref id="remove" name="remove">
635 <!-- <item><ref id="rewind" name="rewind"> -->
636 <!-- <item><ref id="scanf" name="scanf"> -->
637 <!-- <item><ref id="snprintf" name="snprintf"> -->
638 <!-- <item><ref id="sprintf" name="sprintf"> -->
639 <!-- <item><ref id="sscanf" name="sscanf"> -->
640 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
641 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
642 <!-- <item><ref id="vprintf" name="vprintf"> -->
643 <!-- <item><ref id="vscanf" name="vscanf"> -->
644 <!-- <item><ref id="vsnprintf" name="vsnprintf"> -->
645 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
646 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
652 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
655 <item><ref id="_heapadd" name="_heapadd">
656 <item><ref id="_heapblocksize" name="_heapblocksize">
657 <item><ref id="_heapmaxavail" name="_heapmaxavail">
658 <item><ref id="_heapmemavail" name="_heapmemavail">
659 <item><ref id="_randomize" name="_randomize">
660 <item><ref id="_swap" name="_swap">
661 <item><ref id="abort" name="abort">
662 <item><ref id="abs" name="abs">
663 <item><ref id="atexit" name="atexit">
664 <item><ref id="atoi" name="atoi">
665 <item><ref id="atol" name="atol">
666 <item><ref id="bsearch" name="bsearch">
667 <item><ref id="calloc" name="calloc">
668 <item><ref id="div" name="div">
669 <item><ref id="exit" name="exit">
670 <item><ref id="free" name="free">
671 <item><ref id="getenv" name="getenv">
672 <item><ref id="itoa" name="itoa">
673 <item><ref id="labs" name="labs">
674 <item><ref id="ltoa" name="ltoa">
675 <item><ref id="malloc" name="malloc">
676 <item><ref id="perror" name="perror">
677 <!-- <item><ref id="posix_memalign" name="posix_memalign"> -->
678 <!-- <item><ref id="putenv" name="putenv"> -->
679 <item><ref id="qsort" name="qsort">
680 <item><ref id="rand" name="rand">
681 <item><ref id="realloc" name="realloc">
682 <item><ref id="srand" name="srand">
683 <!-- <item><ref id="system" name="system"> -->
684 <item><ref id="ultoa" name="ultoa">
685 <item><ref id="utoa" name="utoa">
691 <sect1><tt/string.h/<label id="string.h"><p>
694 <item><ref id="_stroserror" name="_stroserror">
695 <item><ref id="bzero" name="bzero">
696 <item><ref id="memchr" name="memchr">
697 <item><ref id="memcmp" name="memcmp">
698 <item><ref id="memcpy" name="memcpy">
699 <item><ref id="memmove" name="memmove">
700 <item><ref id="memset" name="memset">
701 <item><ref id="strcasecmp" name="strcasecmp">
702 <item><ref id="strcat" name="strcat">
703 <item><ref id="strchr" name="strchr">
704 <item><ref id="strcmp" name="strcmp">
705 <item><ref id="strcoll" name="strcoll">
706 <item><ref id="strcpy" name="strcpy">
707 <item><ref id="strcspn" name="strcspn">
708 <item><ref id="strdup" name="strdup">
709 <item><ref id="strerror" name="strerror">
710 <item><ref id="stricmp" name="stricmp">
711 <item><ref id="strlen" name="strlen">
712 <item><ref id="strlower" name="strlower">
713 <item><ref id="strlwr" name="strlwr">
714 <item><ref id="strncasecmp" name="strncasecmp">
715 <item><ref id="strncat" name="strncat">
716 <item><ref id="strncmp" name="strncmp">
717 <item><ref id="strncpy" name="strncpy">
718 <item><ref id="strnicmp" name="strnicmp">
719 <item><ref id="strpbrk" name="strpbrk">
720 <item><ref id="strqtok" name="strqtok">
721 <item><ref id="strrchr" name="strrchr">
722 <item><ref id="strspn" name="strspn">
723 <item><ref id="strstr" name="strstr">
724 <item><ref id="strtok" name="strtok">
725 <item><ref id="strxfrm" name="strxfrm">
726 <item><ref id="strupper" name="strupper">
727 <item><ref id="strupr" name="strupr">
731 <sect1><tt/telestrat.h/<label id="telestrat.h"><p>
734 <item><ref id="atmos_explode" name="explode">
735 <item><ref id="atmos_ping" name="ping">
736 <item><ref id="atmos_shoot" name="shoot">
737 <item><ref id="atmos_zap" name="zap">
738 <!-- <item><ref id="kbdclick1" name="kbdclick1"> -->
739 <!-- <item><ref id="oups" name="oups"> -->
745 <sect1><tt/tgi.h/<label id="tgi.h"><p>
747 <url url="tgi.html" name="Tiny Graphics Interface">.
750 <sect1><tt/time.h/<label id="time.h"><p>
753 <!-- <item><ref id="asctime" name="asctime"> -->
754 <item><ref id="clock" name="clock">
755 <item><ref id="clock_getres" name="clock_getres">
756 <item><ref id="clock_gettime" name="clock_gettime">
757 <item><ref id="clock_settime" name="clock_settime">
758 <!-- <item><ref id="ctime" name="ctime"> -->
759 <!-- <item><ref id="gmtime" name="gmtime"> -->
760 <!-- <item><ref id="localtime" name="localtime"> -->
761 <!-- <item><ref id="mktime" name="mktime"> -->
762 <!-- <item><ref id="strftime" name="strftime"> -->
763 <item><ref id="time" name="time">
769 <sect1><tt/unistd.h/<label id="unistd.h"><p>
772 <!-- <item><ref id="chdir" name="chdir"> -->
773 <item><ref id="exec" name="exec">
774 <item><ref id="getcwd" name="getcwd">
775 <item><ref id="getopt" name="getopt">
776 <!-- <item><ref id="lseek" name="lseek"> -->
777 <!-- <item><ref id="mkdir" name="mkdir"> -->
778 <!-- <item><ref id="read" name="read"> -->
779 <!-- <item><ref id="rmdir" name="rmdir"> -->
780 <item><ref id="sleep" name="sleep">
781 <item><ref id="unlink" name="unlink">
782 <!-- <item><ref id="write" name="write"> -->
788 <sect1><tt/vic20.h/<label id="vic20.h"><p>
793 <sect1><tt/zlib.h/<label id="zlib.h"><p>
796 <!-- <item><ref id="adler32" name="adler32"> -->
797 <!-- <item><ref id="crc32" name="crc32"> -->
798 <!-- <item><ref id="inflatemem" name="inflatemem"> -->
799 <!-- <item><ref id="uncompress" name="uncompress"> -->
805 <sect>Alphabetical function reference<p>
807 <sect1>_DE_ISDIR<label id="_DE_ISDIR"><p>
811 <tag/Function/Determine if a directory entry specifies a directory.
812 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
813 <tag/Declaration/<tt/int _DE_ISDIR(unsigned char type);/
814 <tag/Description/The function is called with the type of a directory entry
815 taken from a <tt/struct dirent/ and returns true if the entry designates
818 <item>The function is actually a macro.
820 <tag/Availability/cc65
822 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
823 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
824 <ref id="_DE_ISREG" name="_DE_ISREG">
830 <sect1>_DE_ISLBL<label id="_DE_ISLBL"><p>
834 <tag/Function/Determine if a directory entry specifies a disk label.
835 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
836 <tag/Declaration/<tt/int _DE_ISLBL(unsigned char type);/
837 <tag/Description/The function is called with the type of a directory entry
838 taken from a <tt/struct dirent/ and returns true if the entry designates
841 <item>The function is actually a macro.
843 <tag/Availability/cc65
845 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
846 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
847 <ref id="_DE_ISREG" name="_DE_ISREG">
853 <sect1>_DE_ISLNK<label id="_DE_ISLNK"><p>
857 <tag/Function/Determine if a directory entry specifies a link.
858 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
859 <tag/Declaration/<tt/int _DE_ISLNK(unsigned char type);/
860 <tag/Description/The function is called with the type of a directory entry
861 taken from a <tt/struct dirent/ and returns true if the entry designates
864 <item>The function is actually a macro.
866 <tag/Availability/cc65
868 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
869 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
870 <ref id="_DE_ISREG" name="_DE_ISREG">
876 <sect1>_DE_ISREG<label id="_DE_ISREG"><p>
880 <tag/Function/Determine if a directory entry specifies a regular file.
881 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
882 <tag/Declaration/<tt/int _DE_ISREG(unsigned char type);/
883 <tag/Description/The function is called with the type of a directory entry
884 taken from a <tt/struct dirent/ and returns true if the entry designates
887 <item>The function is actually a macro.
888 <item>A "regular file" means anything with data in it. This might still mean
889 that special processing is needed, when accessing the file. Relative files of
890 the CBM systems are classified as being "regular" files, for example.
892 <tag/Availability/cc65
894 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
895 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
896 <ref id="_DE_ISLNK" name="_DE_ISLNK">
902 <sect1>_heapadd<label id="_heapadd"><p>
906 <tag/Function/Add a block to the heap.
907 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
908 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
909 <tag/Description/The function adds a block of raw memory to the heap.
911 <item>The minimum blocksize that can be added is 6 bytes; the function will
912 ignore smaller blocks.
913 <item>The function is available only as a fastcall function; so, it may be used
914 only in the presence of a prototype.
916 <tag/Availability/cc65
918 <ref id="_heapblocksize" name="_heapblocksize">,
919 <ref id="_heapmaxavail" name="_heapmaxavail">,
920 <ref id="_heapmemavail" name="_heapmemavail">,
921 <ref id="calloc" name="calloc">,
922 <ref id="free" name="free">,
923 <ref id="malloc" name="malloc">,
924 <ref id="realloc" name="realloc">
930 <sect1>_heapblocksize<label id="_heapblocksize"><p>
934 <tag/Function/Return the size of an allocated block.
935 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
936 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
937 <tag/Description/The function returns the size of a block that must have
938 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
939 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
941 <item>Passing a pointer to a block that was is not the result of one of the
942 allocation functions, or that has been free'd will give unpredicable results.
943 <item>The function is available only as a fastcall function; so, it may be used
944 only in the presence of a prototype.
946 <tag/Availability/cc65
948 <ref id="_heapadd" name="_heapadd">,
949 <ref id="_heapmaxavail" name="_heapmaxavail">,
950 <ref id="_heapmemavail" name="_heapmemavail">,
951 <ref id="calloc" name="calloc">,
952 <ref id="free" name="free">,
953 <ref id="malloc" name="malloc">,
954 <ref id="realloc" name="realloc">
960 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
964 <tag/Function/Return the largest block that is available on the heap.
965 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
966 <tag/Declaration/<tt/size_t _heapmaxavail (void);/
967 <tag/Description/The function returns the size of the largest block that may
968 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
969 <tag/Availability/cc65
971 <ref id="_heapadd" name="_heapadd">,
972 <ref id="_heapblocksize" name="_heapblocksize">,
973 <ref id="_heapmemavail" name="_heapmemavail">,
974 <ref id="calloc" name="calloc">,
975 <ref id="free" name="free">,
976 <ref id="malloc" name="malloc">,
977 <ref id="realloc" name="realloc">
983 <sect1>_heapmemavail<label id="_heapmemavail"><p>
987 <tag/Function/Return the total available space on the heap.
988 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
989 <tag/Declaration/<tt/size_t _heapmemavail (void);/
990 <tag/Description/The function returns the total number of bytes available on
993 <item>This function is of less use than usually assumed, since the returned
994 heap space may be available but not in one block. So even if this function
995 says that several times more heap space is available than needed, <ref
996 id="malloc" name="malloc"> may still return <tt/NULL/.
998 <tag/Availability/cc65
1000 <ref id="_heapadd" name="_heapadd">,
1001 <ref id="_heapblocksize" name="_heapblocksize">,
1002 <ref id="_heapmaxavail" name="_heapmaxavail">,
1003 <ref id="calloc" name="calloc">,
1004 <ref id="free" name="free">,
1005 <ref id="malloc" name="malloc">,
1006 <ref id="realloc" name="realloc">
1012 <sect1>_is_cmdline_dos<label id="_is_cmdline_dos"><p>
1016 <tag/Function/Determines whether the underlying DOS supports command line arguments.
1017 <tag/Header/<tt/<ref id="atari.h" name="atari.h">/
1018 <tag/Declaration/<tt/unsigned char _is_cmdline_dos (void);/
1019 <tag/Description/The function returns 0 if the DOS doesn't support command line arguments.
1020 It returns 1 if it does.
1021 <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>clock_getres<label id="clock_getres"><p>
2584 <tag/Function/Determine the realtime clock resolution.
2585 <tag/Header/<tt/<ref id="time.h" name="time.h">/
2586 <tag/Declaration/<tt/int __fastcall__ clock_getres (clockid_t clock_id, struct timespec *res);/
2587 <tag/Description/The <tt/clock_getres/ function finds the resolution (precision)
2588 of the realtime clock. <tt/clock_id/ has to be <tt/CLOCK_REALTIME/. If <tt/res/
2589 is not <tt/NULL/, the resolution of the realtime clock is stored in the location
2590 pointed to by <tt/res/. If <tt/res/ is <tt/NULL/, the clock resolution is not returned.
2591 If the <tt/tp/ argument of <tt/<ref id="clock_settime" name="clock_settime">/ is not
2592 a multiple of <tt/res/, then the value is truncated to a multiple of <tt/res/. On
2593 success, zero is returned. On error, -1 is returned and <tt/errno/ is set to an
2594 error code describing the reason for the failure.
2595 <tag/Notes/<itemize>
2596 <item>The function is only available as fastcall function, so it may only
2597 be used in presence of a prototype.
2598 <item>Depending on the target either the <tt/tv_sec/ or the <tt/tv_nsec/
2599 field of the <tt/struct timespec/ returned is zero.
2601 <tag/Availability/POSIX 1003.1
2603 <ref id="clock_gettime" name="clock_gettime">,
2604 <ref id="clock_settime" name="clock_settime">
2610 <sect1>clock_gettime<label id="clock_gettime"><p>
2614 <tag/Function/Get the time from the realtime clock.
2615 <tag/Header/<tt/<ref id="time.h" name="time.h">/
2616 <tag/Declaration/<tt/int __fastcall__ clock_gettime (clockid_t clock_id, struct timespec *tp);/
2617 <tag/Description/The <tt/clock_gettime/ function retrieves the time since the 1970-01-01 00:00:00
2618 measured in nanoseconds. <tt/clock_id/ has to be <tt/CLOCK_REALTIME/. On success, zero is
2619 returned. On error, -1 is returned and <tt/errno/ is set to an error code describing the
2620 reason for the failure.
2621 <tag/Notes/<itemize>
2622 <item>The function is only available as fastcall function, so it may only
2623 be used in presence of a prototype.
2624 <item>Many platforms supported by cc65 do not have a realtime clock, so the
2625 retrieved value may not be valid. See also the platform-specific information.
2627 <tag/Availability/POSIX 1003.1
2629 <ref id="clock_getres" name="clock_getres">,
2630 <ref id="clock_settime" name="clock_settime">,
2631 <ref id="time" name="time">
2637 <sect1>clock_settime<label id="clock_settime"><p>
2641 <tag/Function/Set the time on the realtime clock.
2642 <tag/Header/<tt/<ref id="time.h" name="time.h">/
2643 <tag/Declaration/<tt/int __fastcall__ clock_settime (clockid_t clock_id, const struct timespec *tp);/
2644 <tag/Description/The <tt/clock_settime/ function sets the time since the 1970-01-01 00:00:00
2645 measured in nanoseconds. <tt/clock_id/ has to be <tt/CLOCK_REALTIME/. On success, zero is
2646 returned. On error, -1 is returned and <tt/errno/ is set to an error code describing the
2647 reason for the failure.
2648 <tag/Notes/<itemize>
2649 <item>The function is only available as fastcall function, so it may only
2650 be used in presence of a prototype.
2651 <item>Many platforms supported by cc65 do not have a realtime clock, so
2652 setting the time may not work. See also the platform-specific information.
2654 <tag/Availability/POSIX 1003.1
2656 <ref id="clock_getres" name="clock_getres">,
2657 <ref id="clock_gettime" name="clock_gettime">
2663 <sect1>clrscr<label id="clrscr"><p>
2667 <tag/Function/Clear the text screen.
2668 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2669 <tag/Declaration/<tt/void clrscr (void);/
2670 <tag/Description/The function clears the text screen and moves the cursor to
2671 the upper left corner.
2672 <tag/Availability/cc65
2674 <ref id="cclear" name="cclear">,
2675 <ref id="cclearxy" name="cclearxy">
2681 <sect1>close<label id="close"><p>
2685 <tag/Function/Close a file descriptor.
2686 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2687 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
2688 <tag/Description/The function closes the given file descriptor. It returns zero
2689 on success and -1 on error. If an error occurs, the cause can be determined by
2690 reading the <tt/errno/ variable.
2691 <tag/Notes/<itemize>
2692 <item>The function is only available as fastcall function, so it may only
2693 be used in presence of a prototype.
2695 <tag/Availability/POSIX 1003.1
2697 <ref id="creat" name="creat">,
2698 <ref id="open" name="open">
2704 <sect1>closedir<label id="closedir"><p>
2708 <tag/Function/Close a directory.
2709 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
2710 <tag/Declaration/<tt/int __fastcall__ closedir (DIR* dir);/
2711 <tag/Description/The function closes the given directory descriptor. It returns
2712 zero on success and -1 on error. If an error occurs, the cause can be determined
2713 by reading the <tt/errno/ variable.
2714 <tag/Notes/<itemize>
2715 <item>The function is only available as fastcall function, so it may only
2716 be used in presence of a prototype.
2718 <tag/Availability/POSIX 1003.1
2720 <ref id="opendir" name="opendir">,
2721 <ref id="readdir" name="readdir">
2727 <sect1>cpeekc<label id="cpeekc"><p>
2731 <tag/Function/Get a character from the display memory.
2732 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2733 <tag/Declaration/<tt/char cpeekc (void);/
2734 <tag/Description/The function gets the character that's at the current location
2735 of the cursor in the display screen RAM. That character is converted, if
2736 needed, into the encoding that can be passed to <tt/cputc()/.
2737 <tag/Notes/<itemize>
2738 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2739 done to make it obvious that peeking doesn't move the cursor in any way. Your
2740 program must place the cursor where it wants to peek before it calls any of
2743 <tag/Availability/cc65
2745 <ref id="cpeekcolor" name="cpeekcolor">,
2746 <ref id="cpeekrevers" name="cpeekrevers">,
2747 <ref id="cpeeks" name="cpeeks">,
2748 <ref id="cputc" name="cputc">
2754 <sect1>cpeekcolor<label id="cpeekcolor"><p>
2758 <tag/Function/Get a color from the display memory.
2759 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2760 <tag/Declaration/<tt/unsigned char cpeekcolor (void);/
2761 <tag/Description/The function gets the color number that's at the current
2762 location of the cursor in the display screen RAM. That number can be passed to
2764 <tag/Notes/<itemize>
2765 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2766 done to make it obvious that peeking doesn't move the cursor in any way. Your
2767 program must place the cursor where it wants to peek before it calls any of
2770 <tag/Availability/cc65
2772 <ref id="cpeekc" name="cpeekc">,
2773 <ref id="cpeekrevers" name="cpeekrevers">,
2774 <ref id="cpeeks" name="cpeeks">,
2775 <ref id="cputc" name="cputc">,
2776 <ref id="textcolor" name="textcolor">
2782 <sect1>cpeekrevers<label id="cpeekrevers"><p>
2786 <tag/Function/Get a reverse-character attribute from the display memory.
2787 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2788 <tag/Declaration/<tt/unsigned char cpeekrevers (void);/
2789 <tag/Description/The function gets the "reverse-mode" attribute of the
2790 character that's at the current location of the cursor in the display screen
2791 RAM. It returns a boolean value (0/1) that can be passed to <tt/revers()/.
2792 <tag/Notes/<itemize>
2793 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2794 done to make it obvious that peeking doesn't move the cursor in any way. Your
2795 program must place the cursor where it wants to peek before it calls any of
2798 <tag/Availability/cc65
2800 <ref id="cpeekc" name="cpeekc">,
2801 <ref id="cpeekcolor" name="cpeekcolor">,
2802 <ref id="cpeeks" name="cpeeks">,
2803 <ref id="cputc" name="cputc">,
2804 <ref id="revers" name="revers">
2810 <sect1>cpeeks<label id="cpeeks"><p>
2814 <tag/Function/Get a string from the display memory.
2815 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2816 <tag/Declaration/<tt/void __fastcall__ cpeeks (char* s, unsigned length);/
2817 <tag/Description/The function gets a fixed-length string ('\0'-terminated) of
2818 characters that start at the current location of the cursor in the display
2819 screen RAM. Those characters are converted, if needed, into the encoding that
2820 can be passed to <tt/cputs()/. The first argument must point to a RAM area
2821 that's large enough to hold "length + 1" bytes.
2822 <tag/Notes/<itemize>
2823 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2824 done to make it obvious that peeking doesn't move the cursor in any way. Your
2825 program must place the cursor where it wants to peek before it calls any of
2827 <item>The function is available as only a fastcall function;
2828 so, it may be used only in the presence of a prototype.
2830 <tag/Availability/cc65
2832 <ref id="cpeekc" name="cpeekc">,
2833 <ref id="cpeekcolor" name="cpeekcolor">,
2834 <ref id="cpeekrevers" name="cpeekrevers">,
2835 <ref id="cputc" name="cputc">,
2836 <ref id="cputs" name="cputs">
2842 <sect1>creat<label id="creat"><p>
2846 <tag/Function/Create a file.
2847 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2848 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
2849 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
2850 associated with it. On error, -1 is returned and an error code is stored in
2852 <tag/Notes/<itemize>
2853 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
2854 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
2855 <item>The function is only available as fastcall function, so it may only
2856 be used in presence of a prototype.
2858 <tag/Availability/POSIX 1003.1
2860 <ref id="close" name="close">,
2861 <ref id="open" name="open">
2867 <sect1>cprintf<label id="cprintf"><p>
2871 <tag/Function/Formatted output to the console.
2872 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2873 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
2874 <tag/Description/The arguments are converted to text where necessary and
2875 formatted according to the format string given. The resulting string is output
2876 to the console. <tt/cprintf/ supports the same format specifiers as
2877 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
2878 <tag/Notes/<itemize>
2879 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
2880 between <tt/\r/ and <tt/\n/.
2882 <tag/Availability/cc65
2884 <ref id="cputc" name="cputc">,
2885 <ref id="cputcxy" name="cputcxy">,
2886 <ref id="cputs" name="cputs">,
2887 <ref id="cputsxy" name="cputsxy">,
2888 <ref id="vcprintf" name="vcprintf">
2894 <sect1>cputc<label id="cputc"><p>
2898 <tag/Function/Output a character directly to the console.
2899 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2900 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
2901 <tag/Description/Output one character to the console at the current cursor
2903 <tag/Notes/<itemize>
2904 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
2905 between <tt/\r/ and <tt/\n/.
2906 <item>The function is only available as fastcall function, so it may only
2907 be used in presence of a prototype.
2909 <tag/Availability/cc65
2911 <ref id="cprintf" name="cprintf">,
2912 <ref id="cputcxy" name="cputcxy">,
2913 <ref id="cputs" name="cputs">,
2914 <ref id="cputsxy" name="cputsxy">,
2915 <ref id="vcprintf" name="vcprintf">
2921 <sect1>cputcxy<label id="cputcxy"><p>
2925 <tag/Function/Output a character at a specific screen position.
2926 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2927 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
2928 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
2929 the screen and outputs one character.
2930 <tag/Notes/<itemize>
2931 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
2932 between <tt/\r/ and <tt/\n/.
2933 <item>The function is only available as fastcall function, so it may only
2934 be used in presence of a prototype.
2936 <tag/Availability/cc65
2938 <ref id="cprintf" name="cprintf">,
2939 <ref id="cputc" name="cputc">,
2940 <ref id="cputs" name="cputs">,
2941 <ref id="cputsxy" name="cputsxy">,
2942 <ref id="vcprintf" name="vcprintf">
2948 <sect1>cputs<label id="cputs"><p>
2952 <tag/Function/Output a string directly to the console.
2953 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2954 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
2955 <tag/Description/The function outputs the given string on the console at the
2956 current cursor position.
2957 <tag/Notes/<itemize>
2958 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
2959 between <tt/\r/ and <tt/\n/.
2960 <item>The function is only available as fastcall function, so it may only
2961 be used in presence of a prototype.
2963 <tag/Availability/cc65
2965 <ref id="cprintf" name="cprintf">,
2966 <ref id="cputc" name="cputc">,
2967 <ref id="cputcxy" name="cputcxy">,
2968 <ref id="cputsxy" name="cputsxy">,
2969 <ref id="vcprintf" name="vcprintf">
2975 <sect1>cputsxy<label id="cputsxy"><p>
2979 <tag/Function/Output a string to the console at a given position.
2980 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2981 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
2982 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
2983 and outputs the string <tt/s/.
2984 <tag/Notes/<itemize>
2985 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
2986 between <tt/\r/ and <tt/\n/.
2987 <item>The function is only available as fastcall function, so it may only
2988 be used in presence of a prototype.
2990 <tag/Availability/cc65
2992 <ref id="cprintf" name="cprintf">,
2993 <ref id="cputc" name="cputc">,
2994 <ref id="cputcxy" name="cputcxy">,
2995 <ref id="cputs" name="cputs">,
2996 <ref id="vcprintf" name="vcprintf">
3002 <sect1>cursor<label id="cursor"><p>
3006 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
3007 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3008 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
3009 <tag/Description/If the argument to the function is non zero, a blinking cursor
3010 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
3011 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
3012 <tag/Notes/<itemize>
3013 <item>The function is only available as fastcall function, so it may only
3014 be used in presence of a prototype.
3016 <tag/Availability/cc65
3018 <ref id="cgetc" name="cgetc">,
3019 <ref id="kbhit" name="kbhit">
3025 <sect1>cvline<label id="cvline"><p>
3029 <tag/Function/Output a vertical line in text mode.
3030 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3031 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
3032 <tag/Description/The function outputs a vertical line with the given length
3033 starting at the current cursor position.
3034 <tag/Notes/<itemize>
3035 <item>The character used to draw the vertical line is system dependent.
3036 If available, a line drawing character is used. Drawing a line that is partially
3037 off screen leads to undefined behaviour.
3038 <item>The function is only available as fastcall function, so it may only be
3039 used in presence of a prototype.
3041 <tag/Availability/cc65
3043 <ref id="chline" name="chline">,
3044 <ref id="chlinexy" name="chlinexy">,
3045 <ref id="cvlinexy" name="cvlinexy">
3051 <sect1>cvlinexy<label id="cvlinexy"><p>
3055 <tag/Function/Output a vertical line at a given position in text mode.
3056 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
3057 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
3058 <tag/Description/The function outputs a vertical line with the given length
3059 starting at a given position.
3060 <tag/Notes/<itemize>
3061 <item>The character used to draw the vertical line is system dependent.
3062 If available, a line drawing character is used. Drawing a line that is partially
3063 off screen leads to undefined behaviour.
3064 <item>The function is only available as fastcall function, so it may only be
3065 used in presence of a prototype.
3067 <tag/Availability/cc65
3069 <ref id="chline" name="chline">,
3070 <ref id="chlinexy" name="chlinexy">,
3071 <ref id="cvline" name="cvline">
3077 <sect1>decompress_lz4<label id="decompress_lz4"><p>
3081 <tag/Function/Uncompress a LZ4-compressed buffer.
3082 <tag/Header/<tt/<ref id="lz4.h" name="lz4.h">/
3083 <tag/Declaration/<tt/void decompress_lz4 (const unsigned char* src, unsigned char* const dst, const unsigned short uncompressed_size);/
3084 <tag/Description/<tt/decompress_lz4/ uncompresses a LZ4-compressed buffer.
3085 <tag/Notes/<itemize>
3086 <item>Use LZ4_compress_HC with compression level 16 for best compression.
3088 <tag/Availability/cc65
3094 <sect1>detect_c128<label id="detect_c128"><p>
3098 <tag/Function/Check if a C128 CPU is the current CPU.
3099 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3100 <tag/Declaration/<tt/unsigned char detect_c128 (void);/
3101 <tag/Description/The function returns a 1 if a C128 CPU is the current CPU.
3102 <tag/Notes/<itemize>
3103 <item>The function is specific to the C64 and C128.
3105 <tag/Availability/cc65 (not all platforms)
3107 <ref id="get_c128_speed" name="get_c128_speed">,
3108 <ref id="set_c128_speed" name="set_c128_speed">,
3114 <sect1>detect_c64dtv<label id="detect_c64dtv"><p>
3118 <tag/Function/Check for the presence of the C64DTV.
3119 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3120 <tag/Declaration/<tt/unsigned char detect_c64dtv (void);/
3121 <tag/Description/The function returns a 1 if a C64DTV has been detected.
3122 <tag/Notes/<itemize>
3123 <item>The function is specific to the C64.
3125 <tag/Availability/cc65 (not all platforms)
3127 <ref id="get_c64dtv_speed" name="get_c64dtv_speed">,
3128 <ref id="set_c64dtv_speed" name="set_c64dtv_speed">,
3134 <sect1>detect_c65<label id="detect_c65"><p>
3138 <tag/Function/Check for the presence of a C65/C64DX in C64 mode.
3139 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3140 <tag/Declaration/<tt/unsigned char detect_c65 (void);/
3141 <tag/Description/The function returns a 1 if a C65/C64DX in C64 mode has been detected.
3142 <tag/Notes/<itemize>
3143 <item>The function is specific to the C64.
3145 <tag/Availability/cc65 (not all platforms)
3147 <ref id="get_c65_speed" name="get_c65_speed">,
3148 <ref id="set_c65_speed" name="set_c65_speed">,
3154 <sect1>detect_chameleon<label id="detect_chameleon"><p>
3158 <tag/Function/Check for the presence of the C64 Chameleon cartridge.
3159 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3160 <tag/Declaration/<tt/unsigned char detect_chameleon (void);/
3161 <tag/Description/The function returns a 1 if a C64 Chameleon cartridge has been detected.
3162 <tag/Notes/<itemize>
3163 <item>The function is specific to the C64.
3165 <tag/Availability/cc65 (not all platforms)
3167 <ref id="get_chameleon_speed" name="get_chameleon_speed">,
3168 <ref id="set_chameleon_speed" name="set_chameleon_speed">,
3174 <sect1>detect_scpu<label id="detect_scpu"><p>
3178 <tag/Function/Check for the presence of the C64/C128 SuperCPU cartridge.
3179 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3180 <tag/Declaration/<tt/unsigned char detect_scpu (void);/
3181 <tag/Description/The function returns a 1 if a SuperCPU cartridge has been detected.
3182 <tag/Notes/<itemize>
3183 <item>The function is specific to the C128 and C64.
3185 <tag/Availability/cc65 (not all platforms)
3187 <ref id="get_scpu_speed" name="get_scpu_speed">,
3188 <ref id="set_scpu_speed" name="set_scpu_speed">,
3194 <sect1>detect_turbomaster<label id="detect_turbomaster"><p>
3198 <tag/Function/Check for the presence of the C64 Turbo Master cartridge.
3199 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3200 <tag/Declaration/<tt/unsigned char detect_turbomaster (void);/
3201 <tag/Description/The function returns a 1 if a C64 Turbo Master cartridge has been detected.
3202 <tag/Notes/<itemize>
3203 <item>The function is specific to the C64.
3205 <tag/Availability/cc65 (not all platforms)
3207 <ref id="get_turbomaster_speed" name="get_turbomaster_speed">,
3208 <ref id="set_turbomaster_speed" name="set_turbomaster_speed">,
3214 <sect1>div<label id="div"><p>
3218 <tag/Function/Divide two ints and return quotient and remainder.
3219 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3220 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
3221 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
3222 quotient and remainder in a <tt/div_t/ structure.
3223 <tag/Notes/<itemize>
3224 <item>The function is only available as fastcall function, so it may only
3225 be used in presence of a prototype.
3227 <tag/Availability/ISO 9899
3235 <sect1>doesclrscrafterexit<label id="doesclrscrafterexit"><p>
3239 <tag/Function/Determines whether the screen is going to be cleared after program exit.
3240 <tag/Header/<tt/<ref id="cc65.h" name="cc65.h">/
3241 <tag/Declaration/<tt/unsigned char doesclrscrafterexit (void);/
3242 <tag/Description/The function returns zero if the screen won't be cleared immediately after
3243 program termination. It returns a non-zero value if it will.
3244 <tag/Notes/<itemize>
3245 <item>Some systems, maybe depending on configuration, immediately clear the screen
3246 after a program exits. Therefore it might be difficult to read
3247 the last messages printed by the program prior to its exit. This function can be used
3248 to decide if a delay or wait for a key press should be executed when then program
3251 <tag/Availability/cc65
3254 #include <stdio.h>
3255 #include <unistd.h>
3256 #include <cc65.h>
3259 printf("Hello World\n");
3260 if (doesclrscrafterexit())
3269 <sect1>em_commit<label id="em_commit"><p>
3273 <tag/Function/Commit changes into extended memory.
3274 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3275 <tag/Declaration/<tt/void em_commit (void);/
3276 <tag/Description/Commit changes in the memory window to extended storage. If
3277 the contents of the memory window have been changed, these changes may be lost
3278 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
3279 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
3280 name="em_copyto">/ are called without calling <tt/em_commit/ first.
3281 <tag/Notes/<itemize>
3282 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
3283 memory window are discarded, it does just mean that the drivers is allowed
3285 <item>The function is only available as fastcall function, so it may only be
3286 used in presence of a prototype.
3287 <item>The function produces undefined results if no extended memory driver is
3290 <tag/Availability/cc65
3292 <ref id="em_load_driver" name="em_load_driver">,
3293 <ref id="em_map" name="em_map">,
3294 <ref id="em_use" name="em_use">
3300 <sect1>em_copyfrom<label id="em_copyfrom"><p>
3304 <tag/Function/Copy from extended into normal memory.
3305 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3306 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
3307 <tag/Description/Copy data from extended memory into linear memory. Source and
3308 target addresses as well as the number of bytes to transfer are specified in
3309 the <tt/em_copy/ structure that is passed as a parameter.
3310 <tag/Notes/<itemize>
3311 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
3312 made any changes to the data in the window, call <tt/<ref id="em_commit"
3313 name="em_commit">/ first, or the changes are lost.
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 function produces undefined results if no extended memory driver is
3319 <tag/Availability/cc65
3321 <ref id="em_commit" name="em_commit">,
3322 <ref id="em_copyto" name="em_copyto">,
3323 <ref id="em_load_driver" name="em_load_driver">
3329 <sect1>em_copyto<label id="em_copyto"><p>
3333 <tag/Function/Copy from normal into extended memory.
3334 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3335 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
3336 <tag/Description/Copy data from linear into extended memory. Source and
3337 target addresses as well as the number of bytes to transfer are specified in
3338 the <tt/em_copy/ structure that is passed as a parameter.
3339 <tag/Notes/<itemize>
3340 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
3341 made any changes to the data in the window, call <tt/<ref id="em_commit"
3342 name="em_commit">/ first, or the changes are lost.
3343 <item>The function is only available as fastcall function, so it may only be
3344 used in presence of a prototype.
3345 <item>The function produces undefined results if no extended memory driver is
3348 <tag/Availability/cc65
3350 <ref id="em_commit" name="em_commit">,
3351 <ref id="em_copyfrom" name="em_copyfrom">,
3352 <ref id="em_load_driver" name="em_load_driver">
3358 <sect1>em_install<label id="em_install"><p>
3362 <tag/Function/Install an already loaded extended memory driver.
3363 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3364 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
3365 <tag/Description/The function installs an already loaded extended memory driver
3366 and returns an error code. The function may be used to install a driver linked
3367 statically to the program.
3368 <tag/Notes/<itemize>
3369 <item>Not all drivers are able to detect if the supported hardware is really
3371 <item>The function is only available as fastcall function, so it may only be
3372 used in presence of a prototype.
3374 <tag/Availability/cc65
3376 <ref id="em_load_driver" name="em_load_driver">,
3377 <ref id="em_uninstall" name="em_uninstall">,
3378 <ref id="em_unload" name="em_unload">
3384 <sect1>em_load_driver<label id="em_load_driver"><p>
3388 <tag/Function/Load and initialize an extended memory driver.
3389 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3390 <tag/Declaration/<tt/unsigned char __fastcall__ em_load_driver (const char* name);/
3391 <tag/Description/Load an extended memory driver into memory and initialize
3392 it. The function returns an error code that tells if all this has been
3394 <tag/Notes/<itemize>
3395 <item>Not all drivers are able to detect if the supported hardware is really
3397 <item>The function is only available as fastcall function, so it may only be
3398 used in presence of a prototype.
3399 <item>The driver is loaded by name, so currently you must know the type of
3400 extended memory that should be supported. There is no autodetect capability.
3402 <tag/Availability/cc65
3404 <ref id="em_unload" name="em_unload">
3410 <sect1>em_map<label id="em_map"><p>
3414 <tag/Function/Make a page of extended memory accessible.
3415 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3416 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
3417 <tag/Description/The function maps one page of extended memory into linear
3418 memory and returns a pointer to the page frame. Depending on the hardware
3419 and driver, the data is either mapped into the address space or transfered
3420 into a buffer. If you don't need the actual contents of the page (for example
3421 because you're going to overwrite it completely), it is better to call
3422 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
3423 data if it is possible to avoid that.
3424 <tag/Notes/<itemize>
3425 <item>Calling <tt/em_map/ will invalidate the memory window, so if you
3426 made any changes to the data in the window, call <tt/<ref id="em_commit"
3427 name="em_commit">/ first, or the changes are lost.
3428 <item>The function is only available as fastcall function, so it may only be
3429 used in presence of a prototype.
3430 <item>The function produces undefined results if no extended memory driver is
3433 <tag/Availability/cc65
3435 <ref id="em_commit" name="em_commit">,
3436 <ref id="em_load_driver" name="em_load_driver">,
3437 <ref id="em_use" name="em_use">
3443 <sect1>em_pagecount<label id="em_pagecount"><p>
3447 <tag/Function/Return the number of available extended memory pages.
3448 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3449 <tag/Declaration/<tt/unsigned em_pagecount (void);/
3450 <tag/Description/The function returns the size of the extended memory supported
3451 by the driver in 256 byte pages.
3452 <tag/Notes/<itemize>
3453 <item>The function returns zero if no extended memory driver is loaded.
3454 <item>The function may return zero if the supported hardware was not detected.
3456 <tag/Availability/cc65
3458 <ref id="em_load_driver" name="em_load_driver">
3464 <sect1>em_uninstall<label id="em_uninstall"><p>
3468 <tag/Function/Uninstall an already loaded extended memory driver.
3469 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3470 <tag/Declaration/<tt/unsigned char em_uninstall (void);/
3471 <tag/Description/The function uninstalls an already loaded extended memory
3472 driver but doesn't remove it from memory.
3473 <tag/Notes/<itemize>
3474 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
3475 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
3476 should be used instead of <tt/em_uninstall/ so the driver is also removed
3479 <tag/Availability/cc65
3481 <ref id="em_install" name="em_install">,
3482 <ref id="em_load_driver" name="em_load_driver">,
3483 <ref id="em_unload" name="em_unload">
3489 <sect1>em_unload<label id="em_unload"><p>
3493 <tag/Function/Unload an extended memory driver.
3494 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3495 <tag/Declaration/<tt/unsigned char em_unload (void);/
3496 <tag/Description/The function unloads a loaded extended memory driver and
3497 frees all memory allocated for the driver.
3498 <tag/Notes/<itemize>
3499 <item>The function does nothing if no driver is loaded.
3501 <tag/Availability/cc65
3503 <ref id="em_load_driver" name="em_load_driver">
3509 <sect1>em_use<label id="em_use"><p>
3513 <tag/Function/Prepare an extended memory page for use.
3514 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3515 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
3516 <tag/Description/The function maps one page of extended memory into linear
3517 memory and returns a pointer to the page frame. This function is similar to
3518 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
3519 actual memory window in the assumption that the existing data is wrong or
3520 will get overwritten.
3521 <tag/Notes/<itemize>
3522 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
3523 made any changes to the data in the window, call <tt/<ref id="em_commit"
3524 name="em_commit">/ first, or the changes are lost.
3525 <item>The function is only available as fastcall function, so it may only be
3526 used in presence of a prototype.
3527 <item>The function produces undefined results if no extended memory driver is
3530 <tag/Availability/cc65
3532 <ref id="em_commit" name="em_commit">,
3533 <ref id="em_load_driver" name="em_load_driver">,
3534 <ref id="em_map" name="em_map">
3540 <sect1>exit<label id="exit"><p>
3544 <tag/Function/Terminate the program.
3545 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3546 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
3547 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
3548 return code of the program. Before termination, all files are closed, buffered
3549 output is written and any functions registered with <tt/<ref id="atexit"
3550 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
3551 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
3553 <tag/Notes/<itemize>
3554 <item>The function is only available as fastcall function, so it may only
3555 be used in presence of a prototype.
3556 <item>It depends on the host machine if the program return code can be
3557 evaluated or is ignored.
3559 <tag/Availability/ISO 9899
3561 <ref id="abort" name="abort">,
3562 <ref id="exit" name="exit">
3568 <sect1>exec<label id="exec"><p>
3572 <tag/Function/Execute a program file.
3573 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3574 <tag/Declaration/<tt/int __fastcall__ exec (const char* progname, const char* cmdline);/
3575 <tag/Description/<tt/exec/ replaces the currently running program by a new one.
3576 Calling <tt/exec()/ is identical to calling <tt/<ref id="exit" name="exit()">/,
3577 then loading and starting the program named in the first argument, passing
3578 the command line specified as second argument. Instead of an empty string,
3579 a <tt/NULL/ pointer may be passed as second parameter.
3580 On success, the function does not return. On failure, -1 is returned and
3581 <tt/errno/ contains an error code.
3582 <tag/Notes/<itemize>
3583 <item>The function is only available as fastcall function, so it may only
3584 be used in presence of a prototype.
3585 <item>On most platforms, the function needs to copy a small stub loader to
3586 some memory area outside the program space. This may collide with other
3587 programs. See the platform specific docs on this.
3588 <item>Because it is necessary to terminate the running program before the
3589 memory can be reused to load the new one, there is a high chance that the
3590 function may not be able to return on errors.
3591 <item>The command line is passed to the new program in the same way as cc65
3592 programs expect the command line. If the new program is not a cc65 generated
3593 program, it may not be able to read it.
3595 <tag/Availability/cc65
3597 <ref id="exit" name="exit">
3603 <sect1>fast<label id="fast"><p>
3607 <tag/Function/Switch the CPU into fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
3608 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
3609 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
3610 <tag/Declaration/<tt/void fast (void);/
3611 <tag/Description/The function will switch the clock of the CPU to fast mode. For the C128
3612 target it means switching the CPU into 2MHz mode. For the C16/Plus4 target it means
3613 switching the CPU into double clock mode.
3614 <tag/Notes/<itemize>
3615 <item>The function is specific to the C128, C16 and Plus4.
3616 <item>On the C128 the 2MHz clock will not work in 40 column mode.
3618 <tag/Availability/cc65 (not all platforms)
3620 <ref id="isfast" name="isfast">,
3621 <ref id="slow" name="slow">,
3627 <sect1>feof<label id="feof"><p>
3631 <tag/Function/Return the end-of-file indicator of a stream.
3632 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3633 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
3634 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
3635 <tt/f/, and returns a non zero value if it is set.
3636 <tag/Notes/<itemize>
3637 <item>The indicator is set only after a read past the end of a file is
3639 <item>The function is only available as fastcall function, so it may only be
3640 used in presence of a prototype.
3642 <tag/Availability/ISO 9899
3644 <ref id="feof" name="clearerr">,
3645 <ref id="ferror" name="ferror">
3651 <sect1>ferror<label id="ferror"><p>
3655 <tag/Function/Return the error indicator of a stream.
3656 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3657 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
3658 <tag/Description/<tt/ferror/ tests the error indicator of the stream
3659 <tt/f/, and returns a non zero value if it is set.
3660 <tag/Notes/<itemize>
3661 <item>The function is only available as fastcall function, so it may only be
3662 used in presence of a prototype.
3664 <tag/Availability/ISO 9899
3666 <ref id="feof" name="clearerr">,
3667 <ref id="ferror" name="feof">
3673 <sect1>fileno<label id="fileno"><p>
3677 <tag/Function/Return the file handle used by a stream.
3678 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3679 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
3680 <tag/Description/The <tt/fileno/ function returns the file handle used
3681 internally by a C stream. This file handle (an integer) can be used as a
3682 handle for the POSIX input/output functions.
3683 <tag/Notes/<itemize>
3684 <item>The function is only available as fastcall function, so it may only be
3685 used in presence of a prototype.
3686 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
3687 file may have unpredictable results.
3689 <tag/Availability/POSIX 1003.1
3691 <ref id="creat" name="creat">,
3692 <ref id="open" name="open"> <!-- , -->
3693 <!-- <ref id="read" name="read">, -->
3694 <!-- <ref id="write" name="write"> -->
3700 <sect1>free<label id="free"><p>
3704 <tag/Function/Free a block of dynamic memory.
3705 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3706 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
3707 <tag/Description/Free a block of dynamic memory previously allocated with
3708 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
3709 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
3710 pointer is <tt/NULL/, no action is performed.
3711 <tag/Notes/<itemize>
3712 <item>Passing an already free'd block to <tt/free/ again will cause undefined
3713 behaviour and may crash your program.
3714 <item>The function is only available as fastcall function, so it may only
3715 be used in presence of a prototype.
3717 <tag/Availability/ISO 9899
3719 <ref id="_heapadd" name="_heapadd">,
3720 <ref id="_heapblocksize" name="_heapblocksize">,
3721 <ref id="_heapmaxavail" name="_heapmaxavail">,
3722 <ref id="_heapmemavail" name="_heapmemavail">,
3723 <ref id="calloc" name="calloc">,
3724 <ref id="malloc" name="malloc">,
3725 <ref id="realloc" name="realloc">
3731 <sect1>get_ostype<label id="get_ostype"><p>
3735 <tag/Function/The function returns the operating system, the program runs on.
3736 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
3737 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
3738 <tag/Declaration/<tt/unsigned char get_ostype (void);/
3739 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
3740 all supported targets. If it exists, it returns a number that identifies the
3741 operating system or machine type, the program runs on. The machine dependent
3742 header files define constants that can be used to check the return code.
3743 <tag/Notes/<itemize>
3744 <item>The function does not exist on all platforms.
3745 <item>The return codes are platform dependent.
3747 <tag/Availability/cc65 (not all platforms)
3753 <sect1>get_c128_speed<label id="get_c128_speed"><p>
3757 <tag/Function/Get the current speed of the C128 CPU.
3758 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3759 <tag/Declaration/<tt/unsigned char get_c128_speed (void);/
3760 <tag/Description/The function returns the current speed of the C128 CPU.
3761 <tag/Notes/<itemize>
3762 <item>The function is specific to the C64 and C128.
3763 <item>The function does not check if the C128 CPU is the current CPU.
3764 <item>See the accelerator.h header for the speed definitions.
3766 <tag/Availability/cc65 (not all platforms)
3768 <ref id="detect_c128" name="detect_c128">,
3769 <ref id="set_c128_speed" name="set_c128_speed">,
3775 <sect1>get_c64dtv_speed<label id="get_c64dtv_speed"><p>
3779 <tag/Function/Get the current speed of the C64DTV.
3780 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3781 <tag/Declaration/<tt/unsigned char get_c64dtv_speed (void);/
3782 <tag/Description/The function returns the current speed of the C64DTV.
3783 <tag/Notes/<itemize>
3784 <item>The function is specific to the C64.
3785 <item>The function does not check for the presence of the C64DTV.
3786 <item>See the accelerator.h header for the speed definitions.
3788 <tag/Availability/cc65 (not all platforms)
3790 <ref id="detect_c64dtv" name="detect_c64dtv">,
3791 <ref id="set_c64dtv_speed" name="set_c64dtv_speed">,
3797 <sect1>get_c65_speed<label id="get_c65_speed"><p>
3801 <tag/Function/Get the current speed of the C65/C64DX in C64 mode.
3802 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3803 <tag/Declaration/<tt/unsigned char get_c65_speed (void);/
3804 <tag/Description/The function returns the current speed of the C65/C64DX in C64 mode.
3805 <tag/Notes/<itemize>
3806 <item>The function is specific to the C64.
3807 <item>The function does not check for the presence of a C65/C64DX in C64 mode.
3808 <item>See the accelerator.h header for the speed definitions.
3810 <tag/Availability/cc65 (not all platforms)
3812 <ref id="detect_c65" name="detect_c65">,
3813 <ref id="set_c65_speed" name="set_c65_speed">,
3819 <sect1>get_chameleon_speed<label id="get_chameleon_speed"><p>
3823 <tag/Function/Get the current speed of the C64 Chameleon cartridge.
3824 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3825 <tag/Declaration/<tt/unsigned char get_chameleon_speed (void);/
3826 <tag/Description/The function returns the current speed of the C64 Chameleon cartridge.
3827 <tag/Notes/<itemize>
3828 <item>The function is specific to the C64.
3829 <item>The function does not check for the presence of the C64 Chameleon cartridge.
3830 <item>See the accelerator.h header for the speed definitions.
3832 <tag/Availability/cc65 (not all platforms)
3834 <ref id="detect_chameleon" name="detect_chameleon">,
3835 <ref id="set_chameleon_speed" name="set_chameleon_speed">,
3841 <sect1>get_scpu_speed<label id="get_scpu_speed"><p>
3845 <tag/Function/Get the current speed of the C64/C128 SuperCPU cartridge.
3846 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3847 <tag/Declaration/<tt/unsigned char get_scpu_speed (void);/
3848 <tag/Description/The function returns the current speed of the SuperCPU cartridge.
3849 <tag/Notes/<itemize>
3850 <item>The function is specific to the C128 and C64.
3851 <item>The function does not check for the presence of the cartridge.
3852 <item>See the accelerator.h header for the speed definitions.
3854 <tag/Availability/cc65 (not all platforms)
3856 <ref id="detect_scpu" name="detect_scpu">,
3857 <ref id="set_scpu_speed" name="set_scpu_speed">,
3863 <sect1>get_turbomaster_speed<label id="get_turbomaster_speed"><p>
3867 <tag/Function/Get the current speed of the C64 Turbo Master cartridge.
3868 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3869 <tag/Declaration/<tt/unsigned char get_turbomaster_speed (void);/
3870 <tag/Description/The function returns the current speed of the C64 Turbo Master cartridge.
3871 <tag/Notes/<itemize>
3872 <item>The function is specific to the C64.
3873 <item>The function does not check for the presence of the C64 Turbo Master cartridge.
3874 <item>See the accelerator.h header for the speed definitions.
3876 <tag/Availability/cc65 (not all platforms)
3878 <ref id="detect_turbomaster" name="detect_turbomaster">,
3879 <ref id="set_turbomaster_speed" name="set_turbomaster_speed">,
3884 <sect1>getcpu<label id="getcpu"><p>
3888 <tag/Function/Determine on which CPU the program is running.
3889 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3890 <tag/Declaration/<tt/unsigned char getcpu (void);/
3891 <tag/Description/The function checks on which CPU the code is running. It
3892 returns one of the constants<itemize>
3894 <item><tt/CPU_65C02/
3895 <item><tt/CPU_65816/
3897 <item><tt/CPU_65SC02/
3898 <item><tt/CPU_65CE02/
3899 <item><tt/CPU_HUC6280/
3902 <tag/Notes/<itemize>
3903 <item>Other, more exotic CPU types are not disinguished.
3905 <tag/Availability/cc65
3911 <sect1>getcurrentdevice<label id="getcurrentdevice"><p>
3915 <tag/Function/Get current device.
3916 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3917 <tag/Declaration/<tt/unsigned char getcurrentdevice (void);/
3918 <tag/Description/The function returns the current device.
3919 It allows to access the current device with the <ref id="dio.h"
3920 name="Low-level disk I/O API"> or <ref id="cbm.h" name="cbm_* I/O
3921 functions"> requiring a 'device' parameter.
3922 <tag/Availability/cc65
3924 <ref id="getdevicedir" name="getdevicedir">,
3925 <ref id="getfirstdevice" name="getfirstdevice">,
3926 <ref id="getnextdevice" name="getnextdevice">
3928 dio_open (getcurrentdevice ());
3934 <sect1>getcwd<label id="getcwd"><p>
3938 <tag/Function/Get current working directory.
3939 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3940 <tag/Declaration/<tt/char* __fastcall__ getcwd (char* buf, size_t size);/
3941 <tag/Description/The function will return the current working directory.
3942 <tag/Notes/<itemize>
3943 <item>The function is only available as fastcall function, so it may only
3944 be used in presence of a prototype.
3946 <tag/Availability/POSIX 1003.1
3952 <sect1>getdevicedir<label id="getdevicedir"><p>
3956 <tag/Function/Get device directory.
3957 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3958 <tag/Declaration/<tt/char* __fastcall__ getdevicedir (unsigned char device, char* buf, size_t size);/
3959 <tag/Description/The function returns the directory representing <tt/device/.
3960 It allows to access the device on filesystem level by calling chdir() with
3961 the directory returned.
3962 <tag/Notes/<itemize>
3963 <item>Calling getdevicedir() <em/does/ check for a (formatted) disk in a
3964 floppy-disk-type device and returns NULL if that check fails.
3965 <item>The function is only available as fastcall function, so it may only
3966 be used in presence of a prototype.
3968 <tag/Availability/cc65
3970 <ref id="getcwd" name="getcwd">,
3971 <ref id="getcurrentdevice" name="getcurrentdevice">,
3972 <ref id="getfirstdevice" name="getfirstdevice">,
3973 <ref id="getnextdevice" name="getnextdevice">
3975 chdir (getdevicedir (device, buf, sizeof buf));
3977 cf. <tt/samples/enumdevdir.c/
3982 <sect1>getenv<label id="getenv"><p>
3986 <tag/Function/Return a value from the environment.
3987 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3988 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
3989 <tag/Description/The function searches the environment for an entry that
3990 matches <tt/name/ and returns its value. The environment consists of a list
3991 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
3993 <tag/Notes/<itemize>
3994 <item>What exactly is stored in the environment depends on the machine the
3995 program is running on.
3996 <item>The function is only available as fastcall function, so it may only
3997 be used in presence of a prototype.
3999 <tag/Availability/ISO 9899
4005 <sect1>getfirstdevice<label id="getfirstdevice"><p>
4009 <tag/Function/Get first device.
4010 <tag/Header/<tt/<ref id="device.h" name="device.h">/
4011 <tag/Declaration/<tt/unsigned char getfirstdevice (void);/
4012 <tag/Description/The function returns the first device.
4013 The constant <tt/INVALID_DEVICE/ indicates no device.
4014 <tag/Notes/<itemize>
4015 <item>Calling getfirstdevice() does <em/not/ turn on the motor of a
4016 drive-type device and does <em/not/ check for a disk in the drive.
4018 <tag/Availability/cc65
4020 <ref id="getcurrentdevice" name="getcurrentdevice">,
4021 <ref id="getdevicedir" name="getdevicedir">,
4022 <ref id="getnextdevice" name="getnextdevice">
4024 unsigned char dev = getfirstdevice ();
4025 while (dev != INVALID_DEVICE) {
4026 printf ("%d\n", dev);
4027 dev = getnextdevice (dev);
4034 <sect1>getnextdevice<label id="getnextdevice"><p>
4038 <tag/Function/Get next device.
4039 <tag/Header/<tt/<ref id="device.h" name="device.h">/
4040 <tag/Declaration/<tt/unsigned char __fastcall__ getnextdevice (unsigned char device);/
4041 <tag/Description/The function returns the next device after <tt/device/.
4042 The constant <tt/INVALID_DEVICE/ indicates no further device.
4043 <tag/Notes/<itemize>
4044 <item>Calling getnextdevice() does <em/not/ turn on the motor of a
4045 drive-type device and does <em/not/ check for a disk in the drive.
4046 <item>The function is only available as fastcall function, so it may only
4047 be used in presence of a prototype.
4049 <tag/Availability/cc65
4051 <ref id="getcurrentdevice" name="getcurrentdevice">,
4052 <ref id="getdevicedir" name="getdevicedir">,
4053 <ref id="getfirstdevice" name="getfirstdevice">
4055 unsigned char dev = getfirstdevice ();
4056 while (dev != INVALID_DEVICE) {
4057 printf ("%d\n", dev);
4058 dev = getnextdevice (dev);
4065 <sect1>getopt<label id="getopt"><p>
4069 <tag/Function/Parse command line options.
4070 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
4071 <tag/Declaration/<tt/int __fastcall__ getopt (int argc, char* const* argv,
4072 const char* optstring);/
4073 <tag/Description/The function parses command line arguments, <tt/argc/ and
4074 <tt/argv/ are the argument count and array passed to <tt/main/. <tt/optstring/
4075 is a string that contains command line option characters. If a character in
4076 <tt/optstring/ is followed by a colon, the option requires an argument. An
4077 option on the command line is recognized if it is one of the option characters
4079 <tt/getopt/ must be called repeatedly. It will return each option character
4080 found on the command line and <tt/EOF/ (-1) if there is no other option. An
4081 option argument is placed in <tt/optarg/, the index of the next element on the
4082 command line to be processed is placed in <tt/optind/.
4083 <tag/Notes/<itemize>
4084 <item>The implementation will not reorder options. A non option on the command
4085 line will terminate option processing. All remaining arguments are not
4086 recognized as options, even if the start with a '-' character.
4087 <item>The function is only available as fastcall function, so it may only
4088 be used in presence of a prototype.
4090 <tag/Availability/POSIX.2
4096 <sect1>gotox<label id="gotox"><p>
4100 <tag/Function/Move the text mode cursor to a new X position.
4101 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4102 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
4103 <tag/Description/The function moves the text mode cursor to the specified X
4104 position while leaving the Y position untouched. The leftmost position on the
4105 screen has the coordinate 0.
4106 <tag/Notes/<itemize>
4107 <item>The function is only available as fastcall function, so it may
4108 only be used in presence of a prototype.
4109 <item>Invalid values for the X position (out of screen coordinates) may
4110 lead to undefined behaviour.
4112 <tag/Availability/cc65
4114 <ref id="gotoy" name="gotoy">,
4115 <ref id="gotoxy" name="gotoxy">,
4116 <ref id="wherex" name="wherex">,
4117 <ref id="wherey" name="wherey">
4123 <sect1>gotoxy<label id="gotoxy"><p>
4127 <tag/Function/Move the text mode cursor to a new position.
4128 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4129 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
4130 <tag/Description/The function moves the text mode cursor to the specified
4131 position. The leftmost position on the screen has the X coordinate 0, the
4132 topmost line has the Y coordinate 0.
4133 <tag/Notes/<itemize>
4134 <item>The function is only available as fastcall function, so it may only be
4135 used in presence of a prototype.
4136 <item>Invalid values for any of both coordinates (out of screen positions) may
4137 lead to undefined behaviour.
4139 <tag/Availability/cc65
4141 <ref id="gotox" name="gotox">,
4142 <ref id="gotoy" name="gotoy">,
4143 <ref id="wherex" name="wherex">,
4144 <ref id="wherey" name="wherey">
4150 <sect1>gotoy<label id="gotoy"><p>
4154 <tag/Function/Move the text mode cursor to a new Y position.
4155 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4156 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
4157 <tag/Description/The function moves the text mode cursor to the specified Y
4158 position while leaving the X position untouched. The uppermost position on the
4159 screen has the coordinate 0.
4160 <tag/Notes/<itemize>
4161 <item>The function is only available as fastcall function, so it may
4162 only be used in presence of a prototype.
4163 <item>Invalid values for the Y position (out of screen coordinates) may lead
4164 to undefined behaviour.
4166 <tag/Availability/cc65
4168 <ref id="gotox" name="gotox">,
4169 <ref id="gotoxy" name="gotoxy">,
4170 <ref id="wherex" name="wherex">,
4171 <ref id="wherey" name="wherey">
4177 <sect1>isalnum<label id="isalnum"><p>
4181 <tag/Function/Check if a given character is a letter or digit.
4182 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4183 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
4184 <tag/Description/The function returns a non zero value if the given argument
4185 is a letter or digit. The return value is zero if the character is anything
4187 <tag/Notes/<itemize>
4188 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4189 inline sequence generated by the macro will not work correctly for values
4190 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4191 this range. The non inline function may be accessed by <tt/#undef/'ing
4193 <item>When compiling without <tt/-Os/, the function is only available as
4194 fastcall function, so it may only be used in presence of a prototype.
4196 <tag/Availability/ISO 9899
4198 <ref id="isalpha" name="isalpha">,
4199 <ref id="isascii" name="isascii">,
4200 <ref id="isblank" name="isblank">,
4201 <ref id="iscntrl" name="iscntrl">,
4202 <ref id="isdigit" name="isdigit">,
4203 <ref id="isgraph" name="isgraph">,
4204 <ref id="islower" name="islower">,
4205 <ref id="isprint" name="isprint">,
4206 <ref id="ispunct" name="ispunct">,
4207 <ref id="isspace" name="isspace">,
4208 <ref id="isupper" name="isupper">,
4209 <ref id="isxdigit" name="isxdigit">
4215 <sect1>isalpha<label id="isalpha"><p>
4219 <tag/Function/Check if a given character is a letter.
4220 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4221 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
4222 <tag/Description/The function returns a non zero value if the given argument
4223 is a letter. The return value is zero if the character is anything else.
4224 <tag/Notes/<itemize>
4225 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4226 inline sequence generated by the macro will not work correctly for values
4227 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4228 this range. The non inline function may be accessed by <tt/#undef/'ing the
4230 <item>When compiling without <tt/-Os/, the function is only available as
4231 fastcall function, so it may only be used in presence of a prototype.
4233 <tag/Availability/ISO 9899
4235 <ref id="isalnum" name="isalnum">,
4236 <ref id="isascii" name="isascii">,
4237 <ref id="isblank" name="isblank">,
4238 <ref id="iscntrl" name="iscntrl">,
4239 <ref id="isdigit" name="isdigit">,
4240 <ref id="isgraph" name="isgraph">,
4241 <ref id="islower" name="islower">,
4242 <ref id="isprint" name="isprint">,
4243 <ref id="ispunct" name="ispunct">,
4244 <ref id="isspace" name="isspace">,
4245 <ref id="isupper" name="isupper">,
4246 <ref id="isxdigit" name="isxdigit">
4252 <sect1>isascii<label id="isascii"><p>
4256 <tag/Function/Check if a given character is in the ASCII (0..127) range.
4257 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4258 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
4259 <tag/Description/The function returns a non zero value if the given argument
4260 is in the range 0..127 (the range of valid ASCII characters) and zero if not.
4261 <tag/Notes/<itemize>
4262 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4263 inline sequence generated by the macro will not work correctly for values
4264 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4265 this range. The non inline function may be accessed by <tt/#undef/'ing the
4267 <item>When compiling without <tt/-Os/, the function is only available as
4268 fastcall function, so it may only be used in presence of a prototype.
4270 <tag/Availability/ISO 9899
4272 <ref id="isalnum" name="isalnum">,
4273 <ref id="isalpha" name="isalpha">,
4274 <ref id="isblank" name="isblank">,
4275 <ref id="iscntrl" name="iscntrl">,
4276 <ref id="isdigit" name="isdigit">,
4277 <ref id="isgraph" name="isgraph">,
4278 <ref id="islower" name="islower">,
4279 <ref id="isprint" name="isprint">,
4280 <ref id="ispunct" name="ispunct">,
4281 <ref id="isspace" name="isspace">,
4282 <ref id="isupper" name="isupper">,
4283 <ref id="isxdigit" name="isxdigit">
4289 <sect1>isblank<label id="isblank"><p>
4293 <tag/Function/Check if a given character is a space or tab.
4294 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4295 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
4296 <tag/Description/The function returns a non zero value if the given argument
4297 is a space or tab character. The return value is zero if the character is
4299 <tag/Notes/<itemize>
4300 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4301 inline sequence generated by the macro will not work correctly for values
4302 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4303 this range. The non inline function may be accessed by <tt/#undef/'ing the
4305 <item>When compiling without <tt/-Os/, the function is only available as
4306 fastcall function, so it may only be used in presence of a prototype.
4308 <tag/Availability/ISO 9899
4310 <ref id="isalnum" name="isalnum">,
4311 <ref id="isalpha" name="isalpha">,
4312 <ref id="isascii" name="isascii">,
4313 <ref id="iscntrl" name="iscntrl">,
4314 <ref id="isdigit" name="isdigit">,
4315 <ref id="isgraph" name="isgraph">,
4316 <ref id="islower" name="islower">,
4317 <ref id="isprint" name="isprint">,
4318 <ref id="ispunct" name="ispunct">,
4319 <ref id="isspace" name="isspace">,
4320 <ref id="isupper" name="isupper">,
4321 <ref id="isxdigit" name="isxdigit">
4327 <sect1>iscntrl<label id="iscntrl"><p>
4331 <tag/Function/Check if a given character is a control character.
4332 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4333 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
4334 <tag/Description/The function returns a non zero value if the given argument
4335 is a control character. The return value is zero if the character is anything
4337 <tag/Notes/<itemize>
4338 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4339 inline sequence generated by the macro will not work correctly for values
4340 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4341 this range. The non inline function may be accessed by <tt/#undef/'ing the
4343 <item>When compiling without <tt/-Os/, the function is only available as
4344 fastcall function, so it may only be used in presence of a prototype.
4346 <tag/Availability/ISO 9899
4348 <ref id="isalnum" name="isalnum">,
4349 <ref id="isalpha" name="isalpha">,
4350 <ref id="isascii" name="isascii">,
4351 <ref id="isblank" name="isblank">,
4352 <ref id="isdigit" name="isdigit">,
4353 <ref id="isgraph" name="isgraph">,
4354 <ref id="islower" name="islower">,
4355 <ref id="isprint" name="isprint">,
4356 <ref id="ispunct" name="ispunct">,
4357 <ref id="isspace" name="isspace">,
4358 <ref id="isupper" name="isupper">,
4359 <ref id="isxdigit" name="isxdigit">
4365 <sect1>isdigit<label id="isdigit"><p>
4369 <tag/Function/Check if a given character is a digit.
4370 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4371 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
4372 <tag/Description/The function returns a non zero value if the given argument
4373 is a digit. The return value is zero if the character is anything else.
4374 <tag/Notes/<itemize>
4375 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4376 inline sequence generated by the macro will not work correctly for values
4377 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4378 this range. The non inline function may be accessed by <tt/#undef/'ing the
4380 <item>When compiling without <tt/-Os/, the function is only available as
4381 fastcall function, so it may only be used in presence of a prototype.
4383 <tag/Availability/ISO 9899
4385 <ref id="isalnum" name="isalnum">,
4386 <ref id="isalpha" name="isalpha">,
4387 <ref id="isascii" name="isascii">,
4388 <ref id="isblank" name="isblank">,
4389 <ref id="iscntrl" name="iscntrl">,
4390 <ref id="isgraph" name="isgraph">,
4391 <ref id="islower" name="islower">,
4392 <ref id="isprint" name="isprint">,
4393 <ref id="ispunct" name="ispunct">,
4394 <ref id="isspace" name="isspace">,
4395 <ref id="isupper" name="isupper">,
4396 <ref id="isxdigit" name="isxdigit">
4402 <sect1>isfast<label id="isfast"><p>
4406 <tag/Function/Check if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
4407 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
4408 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
4409 <tag/Declaration/<tt/unsigned char isfast (void);/
4410 <tag/Description/The function returns a 1 if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
4411 <tag/Notes/<itemize>
4412 <item>The function is specific to the C128, C16 and Plus4.
4414 <tag/Availability/cc65 (not all platforms)
4416 <ref id="fast" name="fast">,
4417 <ref id="slow" name="slow">,
4423 <sect1>isgraph<label id="isgraph"><p>
4427 <tag/Function/Check if a given character is a printable character (except
4429 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4430 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
4431 <tag/Description/The function returns a non zero value if the given argument
4432 is a printable character with the exception of space. The return value is zero
4433 if the character is anything else.
4434 <tag/Notes/<itemize>
4435 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4436 inline sequence generated by the macro will not work correctly for values
4437 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4438 this range. The non inline function may be accessed by <tt/#undef/'ing the
4440 <item>When compiling without <tt/-Os/, the function is only available as
4441 fastcall function, so it may only be used in presence of a prototype.
4443 <tag/Availability/ISO 9899
4445 <ref id="isalnum" name="isalnum">,
4446 <ref id="isalpha" name="isalpha">,
4447 <ref id="isascii" name="isascii">,
4448 <ref id="isblank" name="isblank">,
4449 <ref id="iscntrl" name="iscntrl">,
4450 <ref id="isdigit" name="isdigit">,
4451 <ref id="islower" name="islower">,
4452 <ref id="isprint" name="isprint">,
4453 <ref id="ispunct" name="ispunct">,
4454 <ref id="isspace" name="isspace">,
4455 <ref id="isupper" name="isupper">,
4456 <ref id="isxdigit" name="isxdigit">
4462 <sect1>islower<label id="islower"><p>
4466 <tag/Function/Check if a given character is a lower case letter.
4467 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4468 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
4469 <tag/Description/The function returns a non zero value if the given argument
4470 is a lower case letter. The return value is zero if the character is anything
4472 <tag/Notes/<itemize>
4473 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4474 inline sequence generated by the macro will not work correctly for values
4475 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4476 this range. The non inline function may be accessed by <tt/#undef/'ing the
4478 <item>When compiling without <tt/-Os/, the function is only available as
4479 fastcall function, so it may only be used in presence of a prototype.
4481 <tag/Availability/ISO 9899
4483 <ref id="isalnum" name="isalnum">,
4484 <ref id="isalpha" name="isalpha">,
4485 <ref id="isascii" name="isascii">,
4486 <ref id="isblank" name="isblank">,
4487 <ref id="iscntrl" name="iscntrl">,
4488 <ref id="isdigit" name="isdigit">,
4489 <ref id="isgraph" name="isgraph">,
4490 <ref id="isprint" name="isprint">,
4491 <ref id="ispunct" name="ispunct">,
4492 <ref id="isspace" name="isspace">,
4493 <ref id="isupper" name="isupper">,
4494 <ref id="isxdigit" name="isxdigit">
4500 <sect1>isprint<label id="isprint"><p>
4504 <tag/Function/Check if a given character is a printable character.
4505 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4506 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
4507 <tag/Description/The function returns a non zero value if the given argument
4508 is a printable character (this includes the space character). The return value
4509 is zero if the character is anything else.
4510 <tag/Notes/<itemize>
4511 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4512 inline sequence generated by the macro will not work correctly for values
4513 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4514 this range. The non inline function may be accessed by <tt/#undef/'ing the
4516 <item>When compiling without <tt/-Os/, the function is only available as
4517 fastcall function, so it may only be used in presence of a prototype.
4519 <tag/Availability/ISO 9899
4521 <ref id="isalnum" name="isalnum">,
4522 <ref id="isalpha" name="isalpha">,
4523 <ref id="isascii" name="isascii">,
4524 <ref id="isblank" name="isblank">,
4525 <ref id="iscntrl" name="iscntrl">,
4526 <ref id="isdigit" name="isdigit">,
4527 <ref id="isgraph" name="isgraph">,
4528 <ref id="islower" name="islower">,
4529 <ref id="ispunct" name="ispunct">,
4530 <ref id="isspace" name="isspace">,
4531 <ref id="isupper" name="isupper">,
4532 <ref id="isxdigit" name="isxdigit">
4538 <sect1>ispunct<label id="ispunct"><p>
4542 <tag/Function/Check if a given character is a printable character but not a
4543 space or an alphanumeric character.
4544 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4545 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
4546 <tag/Description/The function returns a non zero value if the given argument
4547 is a printable character, but not a space or anything alphanumeric. The return
4548 value is zero if the character is anything else.
4549 <tag/Notes/<itemize>
4550 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4551 inline sequence generated by the macro will not work correctly for values
4552 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4553 this range. The non inline function may be accessed by <tt/#undef/'ing the
4555 <item>When compiling without <tt/-Os/, the function is only available as
4556 fastcall function, so it may only be used in presence of a prototype.
4558 <tag/Availability/ISO 9899
4560 <ref id="isalnum" name="isalnum">,
4561 <ref id="isalpha" name="isalpha">,
4562 <ref id="isascii" name="isascii">,
4563 <ref id="isblank" name="isblank">,
4564 <ref id="iscntrl" name="iscntrl">,
4565 <ref id="isdigit" name="isdigit">,
4566 <ref id="isgraph" name="isgraph">,
4567 <ref id="islower" name="islower">,
4568 <ref id="isprint" name="isprint">,
4569 <ref id="isspace" name="isspace">,
4570 <ref id="isupper" name="isupper">,
4571 <ref id="isxdigit" name="isxdigit">
4577 <sect1>isspace<label id="isspace"><p>
4581 <tag/Function/Check if a given character is a white-space character.
4582 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4583 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
4584 <tag/Description/The function returns a non zero value if the given argument
4585 is a white space character. The return value is zero if the character is
4586 anything else. The standard white space characters are: space, formfeed ('\f'),
4587 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
4589 <tag/Notes/<itemize>
4590 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4591 inline sequence generated by the macro will not work correctly for values
4592 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4593 this range. The non inline function may be accessed by <tt/#undef/'ing the
4595 <item>When compiling without <tt/-Os/, the function is only available as
4596 fastcall function, so it may only be used in presence of a prototype.
4598 <tag/Availability/ISO 9899
4600 <ref id="isalnum" name="isalnum">,
4601 <ref id="isalpha" name="isalpha">,
4602 <ref id="isascii" name="isascii">,
4603 <ref id="isblank" name="isblank">,
4604 <ref id="iscntrl" name="iscntrl">,
4605 <ref id="isdigit" name="isdigit">,
4606 <ref id="isgraph" name="isgraph">,
4607 <ref id="islower" name="islower">,
4608 <ref id="isprint" name="isprint">,
4609 <ref id="ispunct" name="ispunct">,
4610 <ref id="isupper" name="isupper">,
4611 <ref id="isxdigit" name="isxdigit">
4617 <sect1>isupper<label id="isupper"><p>
4621 <tag/Function/Check if a given character is an upper case letter.
4622 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4623 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
4624 <tag/Description/The function returns a non zero value if the given argument
4625 is an upper case letter. The return value is zero if the character is anything
4627 <tag/Notes/<itemize>
4628 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4629 inline sequence generated by the macro will not work correctly for values
4630 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4631 this range. The non inline function may be accessed by <tt/#undef/'ing the
4633 <item>When compiling without <tt/-Os/, the function is only available as
4634 fastcall function, so it may only be used in presence of a prototype.
4636 <tag/Availability/ISO 9899
4638 <ref id="isalnum" name="isalnum">,
4639 <ref id="isalpha" name="isalpha">,
4640 <ref id="isascii" name="isascii">,
4641 <ref id="isblank" name="isblank">,
4642 <ref id="iscntrl" name="iscntrl">,
4643 <ref id="isdigit" name="isdigit">,
4644 <ref id="isgraph" name="isgraph">,
4645 <ref id="islower" name="islower">,
4646 <ref id="isprint" name="isprint">,
4647 <ref id="ispunct" name="ispunct">,
4648 <ref id="isspace" name="isspace">,
4649 <ref id="isxdigit" name="isxdigit">
4655 <sect1>isxdigit<label id="isxdigit"><p>
4659 <tag/Function/Check if a given character is a hexadecimal digit.
4660 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4661 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
4662 <tag/Description/The function returns a non zero value if the given argument
4663 is a hexadecimal digit (0..9, a..f and A..F). The return value is zero if the
4664 character is anything else.
4665 <tag/Notes/<itemize>
4666 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4667 inline sequence generated by the macro will not work correctly for values
4668 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4669 this range. The non inline function may be accessed by <tt/#undef/'ing the
4671 <item>When compiling without <tt/-Os/, the function is only available as
4672 fastcall function, so it may only be used in presence of a prototype.
4674 <tag/Availability/ISO 9899
4676 <ref id="isalnum" name="isalnum">,
4677 <ref id="isalpha" name="isalpha">,
4678 <ref id="isascii" name="isascii">,
4679 <ref id="isblank" name="isblank">,
4680 <ref id="iscntrl" name="iscntrl">,
4681 <ref id="isdigit" name="isdigit">,
4682 <ref id="isgraph" name="isgraph">,
4683 <ref id="islower" name="islower">,
4684 <ref id="isprint" name="isprint">,
4685 <ref id="ispunct" name="ispunct">,
4686 <ref id="isspace" name="isspace">,
4687 <ref id="isupper" name="isupper">
4693 <sect1>itoa<label id="itoa"><p>
4697 <tag/Function/Convert an integer into a string.
4698 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4699 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
4700 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
4701 <tt/radix/ as the base.
4702 <tag/Notes/<itemize>
4703 <item>There are no provisions to prevent a buffer overflow.
4704 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
4705 <item>The function is non standard, so it is not available in strict ANSI mode.
4706 You should probably use <tt/sprintf/ instead.
4707 <item>The function is only available as fastcall function, so it may only be
4708 used in presence of a prototype.
4710 <tag/Availability/cc65
4712 <ref id="atoi" name="atoi">,
4713 <ref id="atol" name="atol">,
4714 <ref id="ltoa" name="ltoa">,
4715 <ref id="ultoa" name="ultoa">,
4716 <ref id="utoa" name="utoa">
4722 <sect1>joy_count<label id="joy_count"><p>
4726 <tag/Function/Return the number of joysticks supported by the current driver.
4727 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4728 <tag/Declaration/<tt/unsigned char joy_count (void);/
4729 <tag/Description/The function returns a the number of joysticks supported
4730 by the current joystick driver.
4731 <tag/Notes/<itemize>
4732 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4733 name="joy_load_driver"> before calling this function.
4734 <item>The function returns the number of joysticks supported by the driver.
4735 There's no way to check for the number of actually connected joysticks.
4737 <tag/Availability/cc65
4739 <ref id="joy_load_driver" name="joy_load_driver">,
4740 <ref id="joy_read" name="joy_read">
4746 <sect1>joy_install<label id="joy_install"><p>
4750 <tag/Function/Install an already loaded driver and return an error code.
4751 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4752 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
4753 <tag/Description/The function installs a driver that was already loaded into
4754 memory (or linked statically to the program). It returns an error code
4755 (<tt/JOY_ERR_OK/ in case of success).
4756 <tag/Notes/<itemize>
4757 <item>The function is only available as fastcall function, so it may only be
4758 used in presence of a prototype.
4760 <tag/Availability/cc65
4762 <ref id="joy_load_driver" name="joy_load_driver">,
4763 <ref id="joy_uninstall" name="joy_uninstall">,
4764 <ref id="joy_unload" name="joy_unload">
4770 <sect1>joy_load_driver<label id="joy_load_driver"><p>
4774 <tag/Function/Load a driver from disk and install it.
4775 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4776 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
4777 <tag/Description/The function loads a driver with the given name from disk
4778 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
4779 driver was successfully loaded and installed.
4780 <tag/Notes/<itemize>
4781 <item>The function is only available as fastcall function, so it may only be
4782 used in presence of a prototype.
4784 <tag/Availability/cc65
4786 <ref id="joy_install" name="joy_install">,
4787 <ref id="joy_uninstall" name="joy_uninstall">,
4788 <ref id="joy_unload" name="joy_unload">
4794 <sect1>joy_read<label id="joy_read"><p>
4798 <tag/Function/Read the status of a joystick.
4799 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4800 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
4801 <tag/Description/The function reads the status bits for a joystick. The number
4802 of the joystick is passed as parameter. The result may be examined by using one
4803 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
4804 <tag/Notes/<itemize>
4805 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4806 name="joy_load_driver"> before calling this function.
4807 <item>The function is only available as fastcall function, so it may only be
4808 used in presence of a prototype.
4810 <tag/Availability/cc65
4812 <ref id="joy_count" name="joy_count">,
4813 <ref id="joy_load_driver" name="joy_load_driver">,
4814 <ref id="joy_unload" name="joy_unload">
4820 <sect1>joy_uninstall<label id="joy_uninstall"><p>
4824 <tag/Function/Uninstall the current joystick driver.
4825 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4826 <tag/Declaration/<tt/unsigned char joy_uninstall (void);/
4827 <tag/Description/The function uninstalls the currently installed joystick
4828 driver. It does not remove the driver from memory. The function returns an
4829 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4830 <tag/Notes/<itemize>
4831 <item>A joystick driver must be installed using <ref id="joy_install"
4832 name="joy_install"> before calling this function.
4834 <tag/Availability/cc65
4836 <ref id="joy_install" name="joy_install">,
4837 <ref id="joy_load_driver" name="joy_load_driver">,
4838 <ref id="joy_unload" name="joy_unload">
4844 <sect1>joy_unload<label id="joy_unload"><p>
4848 <tag/Function/Uninstall, then unload the current joystick driver.
4849 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4850 <tag/Declaration/<tt/unsigned char joy_unload (void);/
4851 <tag/Description/The function uninstalls the currently installed joystick
4852 driver and removes it from memory. An error code is returned, which is
4853 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4854 <tag/Notes/<itemize>
4855 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4856 name="joy_load_driver"> before calling this function.
4858 <tag/Availability/cc65
4860 <ref id="joy_load_driver" name="joy_load_driver">
4866 <sect1>kbhit<label id="kbhit"><p>
4870 <tag/Function/Check if there's a key waiting in the keyboard buffer.
4871 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4872 <tag/Declaration/<tt/unsigned char kbhit (void);/
4873 <tag/Description/The function returns a value of zero if there is no character
4874 waiting to be read from the keyboard. It returns non zero otherwise.
4875 <tag/Notes/<itemize>
4876 <item>If the system does not support a keyboard buffer (most systems
4877 do), the function is rather useless.
4879 <tag/Availability/cc65
4881 <ref id="cgetc" name="cgetc">,
4882 <ref id="cursor" name="cursor">
4888 <sect1>kbrepeat<label id="kbrepeat"><p>
4892 <tag/Function/Set the keyboard repeat mode.
4893 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
4894 <tag/Declaration/<tt/unsigned char __fastcall__ kbrepeat (unsigned char mode);/
4895 <tag/Description/This function changes which keys have automatic repeat when
4896 being held down for a certain time. Possible values are <tt/KBREPEAT_CURSOR/
4897 (repeat only cursor-related keys), <tt/KBREPEAT_NONE/ (no repeat for any
4898 keys), and <tt/KBREPEAT_ALL/ (repeat all keys). The old mode is returned, so
4899 it can be restored later.
4900 <tag/Notes/<itemize>
4901 <item>The function is available only as a fastcall function; so, it may be used
4902 only in the presence of a prototype.
4904 <tag/Availability/cc65
4910 <sect1>labs<label id="labs"><p>
4914 <tag/Function/Returns the absolute value of a long integer.
4915 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4916 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
4917 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
4919 <tag/Notes/<itemize>
4920 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
4921 <item>The function is only available as fastcall function, so it may only be
4922 used in presence of a prototype.
4924 <tag/Availability/ISO 9899
4926 <ref id="abs" name="abs">
4932 <sect1>ltoa<label id="ltoa"><p>
4936 <tag/Function/Convert a long integer into a string.
4937 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4938 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
4939 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
4940 using <tt/radix/ as the base.
4941 <tag/Notes/<itemize>
4942 <item>There are no provisions to prevent a buffer overflow.
4943 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
4944 <item>The function is non standard, so it is not available in strict ANSI mode.
4945 You should probably use <tt/sprintf/ instead.
4946 <item>The function is only available as fastcall function, so it may only be
4947 used in presence of a prototype.
4949 <tag/Availability/cc65
4951 <ref id="atoi" name="atoi">,
4952 <ref id="atol" name="atol">,
4953 <ref id="itoa" name="itoa">,
4954 <ref id="ultoa" name="ultoa">,
4955 <ref id="utoa" name="utoa">
4961 <sect1>localeconv<label id="localeconv"><p>
4965 <tag/Function/Returns a pointer to the current locale structure.
4966 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4967 <tag/Declaration/<tt/struct lconv* localeconv (void);/
4968 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
4970 <tag/Notes/<itemize>
4971 <item>cc65 supports only the "C" locale, so even after setting a new locale
4972 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
4975 <tag/Availability/ISO 9899
4977 <ref id="setlocale" name="setlocale">
4983 <sect1>longjmp<label id="longjmp"><p>
4987 <tag/Function/Non local goto.
4988 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4989 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
4990 <tag/Description/The <tt/longjmp/ function restores a program context from the
4991 data in <tt/buf/, which must have been set by a preceeding call to
4992 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
4993 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
4995 <tag/Notes/<itemize>
4996 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
4997 was called with a value of one.
4998 <item>The function is only available as fastcall function, so it may only
4999 be used in presence of a prototype.
5001 <tag/Availability/ISO 9899
5003 <ref id="setjmp" name="setjmp">
5009 <sect1>malloc<label id="malloc"><p>
5013 <tag/Function/Allocate dynamic memory.
5014 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5015 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
5016 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
5017 pointer to the allocated memory block. On error (not enough memory available),
5018 <tt/malloc/ returns <tt/NULL/.
5019 <tag/Notes/<itemize>
5020 <item>The function is only available as fastcall function, so it may only
5021 be used in presence of a prototype.
5023 <tag/Availability/ISO 9899
5025 <ref id="_heapadd" name="_heapadd">,
5026 <ref id="_heapblocksize" name="_heapblocksize">,
5027 <ref id="_heapmaxavail" name="_heapmaxavail">,
5028 <ref id="_heapmemavail" name="_heapmemavail">,
5029 <ref id="calloc" name="calloc">,
5030 <ref id="free" name="free">,
5031 <ref id="realloc" name="realloc">,
5032 <ref id="strdup" name="strdup">
5038 <sect1>memchr<label id="memchr"><p>
5042 <tag/Function/Search for a character in a block of raw memory.
5043 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5044 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
5045 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
5046 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
5047 that is of size <tt/count/. Upon completion, the function returns a pointer to
5048 the character found, or a null pointer if the character was not found.
5049 <tag/Notes/<itemize>
5050 <item>The function is only available as fastcall function, so it may only
5051 be used in presence of a prototype.
5053 <tag/Availability/ISO 9899
5055 <ref id="strchr" name="strchr">
5061 <sect1>memcmp<label id="memcmp"><p>
5065 <tag/Function/Compare two memory areas.
5066 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5067 <tag/Declaration/<tt/int __fastcall__ memcmp (const void* p1, const void* p2, size_t count);/
5068 <tag/Description/<tt/memcmp/ compares <tt/count/ bytes from the memory area
5069 pointed to by <tt/p1/ into the memory area pointed to by <tt/p2/. It returns a value that is less than
5070 zero if <tt/p1/ is less than <tt/p2/, zero if <tt/p1/ is the same as <tt/p2/,
5071 and a value greater than zero if <tt/p1/ is greater than <tt/p2/.
5072 <tag/Notes/<itemize>
5073 <item>The function is only available as fastcall function, so it may only
5074 be used in presence of a prototype.
5076 <tag/Availability/ISO 9899
5078 <ref id="strcmp" name="strcmp">,
5079 <ref id="memmove" name="memmove">,
5080 <ref id="memset" name="memset">
5086 <sect1>memcpy<label id="memcpy"><p>
5090 <tag/Function/Copy a memory area.
5091 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5092 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
5093 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
5094 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
5096 <tag/Notes/<itemize>
5097 <item>The result is undefined if the memory areas do overlap. Use
5098 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
5099 <item>The function is only available as fastcall function, so it may only
5100 be used in presence of a prototype.
5102 <tag/Availability/ISO 9899
5104 <ref id="_swap" name="_swap">,
5105 <ref id="memmove" name="memmove">,
5106 <ref id="memset" name="memset">
5112 <sect1>memmove<label id="memmove"><p>
5116 <tag/Function/Copy a memory area.
5117 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5118 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
5119 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
5120 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
5122 <tag/Notes/<itemize>
5123 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
5124 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
5125 <item>The function is only available as fastcall function, so it may only
5126 be used in presence of a prototype.
5128 <tag/Availability/ISO 9899
5130 <ref id="_swap" name="_swap">,
5131 <ref id="memcpy" name="memcpy">,
5132 <ref id="memset" name="memset">
5138 <sect1>memset<label id="memset"><p>
5142 <tag/Function/Fill a memory area.
5143 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5144 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
5145 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
5146 the value <tt/val/. The function returns <tt/p/.
5147 <tag/Notes/<itemize>
5148 <item>The function is only available as fastcall function, so it may only
5149 be used in presence of a prototype.
5151 <tag/Availability/ISO 9899
5153 <ref id="_swap" name="_swap">,
5154 <ref id="bzero" name="bzero">,
5155 <ref id="memcpy" name="memcpy">,
5156 <ref id="memmove" name="memmove">
5162 <sect1>mod_free<label id="mod_free"><p>
5166 <tag/Function/Free a relocatable module.
5167 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
5168 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
5169 <tag/Description/The function will free a module loaded into memory by use of
5170 the <tt/<ref id="mod_load" name="mod_load">/ function.
5171 <tag/Notes/<itemize>
5172 <item>The pointer passed as parameter is the pointer to the module memory,
5173 not the pointer to the control structure.
5174 <item>The function is available only as a fastcall function; so, it may be used
5175 only in the presence of a prototype.
5177 <tag/Availability/cc65
5179 <ref id="mod_load" name="mod_load">
5185 <sect1>mod_load<label id="mod_load"><p>
5189 <tag/Function/Load a relocatable module.
5190 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
5191 <tag/Declaration/<tt/unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl);/
5192 <tag/Description/The function will load a code module into memory and relocate
5193 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
5194 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
5195 the module just loaded. Possible error codes are:
5197 <item><tt/MLOAD_OK/ - Module load successful
5198 <item><tt/MLOAD_ERR_READ/ - Read error
5199 <item><tt/MLOAD_ERR_HDR/ - Header error
5200 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
5201 <item><tt/MLOAD_ERR_FMT/ - Data format error
5202 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
5204 <tag/Notes/<itemize>
5205 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
5206 relocatable o65 modules for use with this function.
5207 <item>The function is available only as a fastcall function; so, it may be used
5208 only in the presence of a prototype.
5210 <tag/Availability/cc65
5212 <ref id="mod_free" name="mod_free">
5218 <sect1>mouse_setbox<label id="mouse_setbox"><p>
5222 <tag/Function/Specify a bounding box for the mouse cursor.
5223 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5224 <tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
5225 <tag/Description/The function allows to set a bounding box for mouse movement.
5226 <tag/Notes/<itemize>
5227 <item>The function does not check if the mouse cursor is currently within the
5228 given rectangle. Placing the mouse cursor within the bounding box is the
5229 responsibility of the programmer.
5230 <item>While the bounding box may be larger than the actual screen size, the
5231 standard mouse cursor draw routines may fail to set the cursor to coordinates
5232 outside of the screen area. Depending on the platform, you may have to supply
5233 your own mouse cursor routines.
5234 <item>The function is only available as fastcall function, so it may only be
5235 used in presence of a prototype.
5237 <tag/Availability/cc65
5239 <ref id="mouse_getbox" name="mouse_getbox">,
5240 <ref id="mouse_move" name="mouse_move">
5246 <sect1>mouse_getbox<label id="mouse_getbox"><p>
5250 <tag/Function/Return the current bounding box for the mouse cursor.
5251 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5252 <tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
5253 <tag/Description/The function queries the current bounding box for mouse
5255 <tag/Notes/<itemize>
5256 <item>The function is only available as fastcall function, so it may only be
5257 used in presence of a prototype.
5259 <tag/Availability/cc65
5261 <ref id="mouse_move" name="mouse_move">,
5262 <ref id="mouse_setbox" name="mouse_setbox">
5268 <sect1>mouse_buttons<label id="mouse_buttons"><p>
5272 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
5273 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5274 <tag/Declaration/<tt/unsigned char mouse_buttons (void);/
5275 <tag/Description/The function returns a bit mask that encodes the state of the
5276 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
5278 <tag/Availability/cc65
5280 <ref id="mouse_info" name="mouse_info">,
5281 <ref id="mouse_pos" name="mouse_pos">
5287 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
5291 <tag/Function/Return a readable error message for an error code.
5292 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5293 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
5295 <tag/Description/The function returns an error message (in english) for the
5296 error code passed parameter.
5297 <tag/Notes/<itemize>
5298 <item>The function will return "Unknown error" for invalid error codes.
5299 <item>The function is only available as fastcall function, so it may only be
5300 used in presence of a prototype.
5302 <tag/Availability/cc65
5304 <ref id="mouse_load_driver" name="mouse_load_driver">,
5305 <ref id="mouse_uninstall" name="mouse_uninstall">,
5306 <ref id="mouse_unload" name="mouse_unload">
5312 <sect1>mouse_hide<label id="mouse_hide"><p>
5316 <tag/Function/Hide the mouse pointer.
5317 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5318 <tag/Declaration/<tt/void mouse_hide (void);/
5319 <tag/Description/The function hides the mouse pointer. It manages a counter
5320 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
5321 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
5322 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
5324 <tag/Availability/cc65
5326 <ref id="mouse_show" name="mouse_show">
5332 <sect1>mouse_info<label id="mouse_info"><p>
5336 <tag/Function/Return the state of the mouse buttons and the position of the
5338 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5339 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
5340 <tag/Description/The function returns the state of the mouse buttons and the
5341 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
5342 <tag/Notes/<itemize>
5343 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
5344 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
5345 name="mouse_pos">/ instead.
5346 <item>The function is only available as fastcall function, so it may only be
5347 used in presence of a prototype.
5349 <tag/Availability/cc65
5351 <ref id="mouse_buttons" name="mouse_buttons">,
5352 <ref id="mouse_pos" name="mouse_pos">
5358 <sect1>mouse_install<label id="mouse_install"><p>
5362 <tag/Function/Install an already loaded mouse driver.
5363 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5364 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
5365 mouse_callbacks* c, void* driver);/
5366 <tag/Description/The function installs an already loaded mouse driver and
5367 returns an error code. The <tt/mouse_callbacks/ structure passed as first
5368 parameter contains pointers to routines needed to move or hide/show the mouse
5369 pointer. Defaults for these routines are supplied by the library, so if you
5370 can live with these defaults (which are platform specific), just pass a
5371 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
5372 driver linked statically to the program.
5373 <tag/Notes/<itemize>
5374 <item>Not all drivers are able to detect if the supported hardware is really
5376 <item>After installing a driver, the mouse cursor is hidden.
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_load_driver" name="mouse_load_driver">,
5383 <ref id="mouse_uninstall" name="mouse_uninstall">,
5384 <ref id="mouse_unload" name="mouse_unload">
5390 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
5394 <tag/Function/Call the driver specific ioctl function.
5395 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5396 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
5397 <tag/Description/The function calls the IOCTL entry in the mouse driver,
5398 which is driver specific. The <tt/code/ parameter will choose between
5399 different IOCTL functions, and the <tt/data/ depends on code. The
5400 function returns an error code. The purpose of this function is to allow
5401 for driver specific extensions. See the documentation for a specific mouse
5402 driver for supported ioctl calls.
5403 <tag/Notes/<itemize>
5404 <item>Calling this function is non portable, because each driver may
5405 implement different ioctl calls (or none at all).
5406 <item>The function is only available as fastcall function, so it may only be
5407 used in presence of a prototype.
5409 <tag/Availability/cc65
5415 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
5419 <tag/Function/Load and initialize a mouse driver.
5420 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5421 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
5422 mouse_callbacks* c, const char* driver);/
5423 <tag/Description/Load a mouse driver into memory and initialize it. The
5424 function returns an error code that tells if the call has been successful. The
5425 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
5426 routines needed to move or hide/show the mouse pointer. Defaults for these
5427 routines are supplied by the library, so if you can live with these defaults
5428 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
5429 <tag/Notes/<itemize>
5430 <item>The driver is loaded by name, so currently you must know the type of
5431 mouse that should be supported. There is no autodetect capability.
5432 <item>Not all drivers are able to detect if the supported hardware is really
5434 <item>After installing a driver, the mouse cursor is hidden.
5435 <item>The function is only available as fastcall function, so it may only be
5436 used in presence of a prototype.
5438 <tag/Availability/cc65
5440 <ref id="mouse_install" name="mouse_install">,
5441 <ref id="mouse_uninstall" name="mouse_uninstall">,
5442 <ref id="mouse_unload" name="mouse_unload">
5448 <sect1>mouse_move<label id="mouse_move"><p>
5452 <tag/Function/Move the mouse cursor to a specific position.
5453 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5454 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
5455 <tag/Description/The function updates the mouse position. If the mouse cursor
5456 is visible, it is shown at the new position.
5457 <tag/Notes/<itemize>
5458 <item>The function does not check if the new position is within the bounding
5459 box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
5460 <item>The function is only available as fastcall function, so it may only be
5461 used in presence of a prototype.
5463 <tag/Availability/cc65
5465 <ref id="mouse_getbox" name="mouse_getbox">,
5466 <ref id="mouse_setbox" name="mouse_setbox">
5472 <sect1>mouse_pos<label id="mouse_pos"><p>
5476 <tag/Function/Return the position of the mouse.
5477 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5478 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
5479 <tag/Description/The function returns the position of the mouse in the
5480 <tt/mouse_pos/ structure passed as parameter.
5481 <tag/Notes/<itemize>
5482 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
5483 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
5484 name="mouse_info">/ instead.
5485 <item>The function is only available as fastcall function, so it may only be
5486 used in presence of a prototype.
5488 <tag/Availability/cc65
5490 <ref id="mouse_buttons" name="mouse_buttons">,
5491 <ref id="mouse_info" name="mouse_info">
5497 <sect1>mouse_show<label id="mouse_show"><p>
5501 <tag/Function/Show the mouse pointer.
5502 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5503 <tag/Declaration/<tt/void mouse_show (void);/
5504 <tag/Description/The function shows the mouse pointer. It manages a counter
5505 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
5506 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
5507 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
5508 <tag/Availability/cc65
5510 <ref id="mouse_hide" name="mouse_hide">
5516 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
5520 <tag/Function/Uninstall an already loaded mouse driver.
5521 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5522 <tag/Declaration/<tt/unsigned char mouse_uninstall (void);/
5523 <tag/Description/The function uninstalls an already loaded mouse driver but
5524 don't removes it from memory.
5525 <tag/Notes/<itemize>
5526 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
5527 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
5528 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
5531 <tag/Availability/cc65
5533 <ref id="mouse_install" name="mouse_install">,
5534 <ref id="mouse_load_driver" name="mouse_load_driver">,
5535 <ref id="mouse_unload" name="mouse_unload">
5541 <sect1>mouse_unload<label id="mouse_unload"><p>
5545 <tag/Function/Unload a mouse driver.
5546 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5547 <tag/Declaration/<tt/unsigned char mouse_unload (void);/
5548 <tag/Description/The function unloads a loaded mouse driver and frees all
5549 memory allocated for the driver.
5550 <tag/Notes/<itemize>
5551 <item>The function does nothing if no driver is loaded.
5553 <tag/Availability/cc65
5555 <ref id="mouse_install" name="mouse_install">,
5556 <ref id="mouse_load_driver" name="mouse_load_driver">,
5557 <ref id="mouse_uninstall" name="mouse_uninstall">
5562 <sect1>mul20<label id="mul20"><p>
5566 <tag/Function/Multiplies argument by 20.
5567 <tag/Header/<tt/<ref id="cc65.h" name="cc65.h">/
5568 <tag/Declaration/<tt/unsigned int __fastcall__ mul20(unsigned char value);/
5569 <tag/Description/Speed optimized function to multiply an 8 bit unsigned value by 20 to get a 16 bit result.
5570 <tag/Availability/cc65
5574 <sect1>mul40<label id="mul40"><p>
5578 <tag/Function/Multiplies argument by 40.
5579 <tag/Header/<tt/<ref id="cc65.h" name="cc65.h">/
5580 <tag/Declaration/<tt/unsigned int __fastcall__ mul40(unsigned char value);/
5581 <tag/Description/Speed optimized function to multiply an 8 bit unsigned value by 40 to get a 16 bit result.
5582 <tag/Availability/cc65
5586 <sect1>offsetof<label id="offsetof"><p>
5590 <tag/Function/Calculate the offset of a struct or union member.
5591 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
5592 <tag/Declaration/<tt/size_t offsetof (type, member);/
5593 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
5594 or <tt/union/ member.
5595 <tag/Notes/<itemize>
5596 <item>The function is actually a macro.
5598 <tag/Availability/ISO 9899
5604 <sect1>open<label id="open"><p>
5608 <tag/Function/Open and possibly create a file.
5609 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
5610 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
5611 <tag/Description/<tt/open/ opens a file and returns the file descriptor
5612 associated with it. On error, -1 is returned and an error code is stored in
5613 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
5614 <tag/Notes/<itemize>
5615 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
5616 open, which is used as the permission mask when a new file is created. While
5617 cc65 allows to pass this argument, it is ignored.
5619 <tag/Availability/POSIX 1003.1
5621 <ref id="close" name="close">,
5622 <ref id="creat" name="creat">
5628 <sect1>opendir<label id="opendir"><p>
5632 <tag/Function/Open a directory.
5633 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5634 <tag/Declaration/<tt/DIR* __fastcall__ opendir (const char* name);/
5635 <tag/Description/<tt/opendir/ opens a directory and returns the direcory
5636 descriptor associated with it. On error, NULL is returned and an error code is
5637 stored in <tt/errno/.
5638 <tag/Notes/<itemize>
5639 <item>The function is only available as fastcall function, so it may only
5640 be used in presence of a prototype.
5642 <tag/Availability/POSIX 1003.1
5644 <ref id="closedir" name="closedir">,
5645 <ref id="readdir" name="readdir">
5651 <sect1>peekbsys<label id="peekbsys"><p>
5655 <tag/Function/Read one byte from a location in the system bank.
5656 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5657 <tt/<ref id="cbm510.h" name="cbm510.h">/
5658 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
5659 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
5660 system bank (bank 15) of the CBM PET-II machines and returns it.
5661 <tag/Notes/<itemize>
5662 <item>The function is only available as fastcall function, so it may only
5663 be used in presence of a prototype.
5664 <item>This function may be a macro depending on the compiler options. The
5665 actual function is accessible by #undef'ing the macro.
5667 <tag/Availability/cc65
5669 <ref id="PEEK" name="PEEK">,
5670 <ref id="PEEKW" name="PEEKW">,
5671 <ref id="peekwsys" name="peekwsys">,
5672 <ref id="pokebsys" name="pokebsys">,
5673 <ref id="pokewsys" name="pokewsys">
5679 <sect1>peekwsys<label id="peekwsys"><p>
5683 <tag/Function/Read one word from a location in the system bank.
5684 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5685 <tt/<ref id="cbm510.h" name="cbm510.h">/
5686 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
5687 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
5688 system bank (bank 15) of the CBM PET-II machines and returns it. Following
5689 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
5690 high byte is read from <tt/addr+1/.
5691 <tag/Notes/<itemize>
5692 <item>The function is only available as fastcall function, so it may only
5693 be used in presence of a prototype.
5694 <item>The order in which the two bytes are read is undefined.
5696 <tag/Availability/cc65
5698 <ref id="PEEK" name="PEEK">,
5699 <ref id="PEEKW" name="PEEKW">,
5700 <ref id="peekbsys" name="peekbsys">,
5701 <ref id="pokebsys" name="pokebsys">,
5702 <ref id="pokewsys" name="pokewsys">
5708 <sect1>perror<label id="perror"><p>
5712 <tag/Function/Print an error message for the error in <tt/errno/.
5713 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5714 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
5715 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
5716 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
5717 a blank. Then the error message for the current contents of <tt/errno/ is
5718 printed followed by a newline. The message output is the same as returned by
5719 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
5720 <tag/Notes/<itemize>
5721 <item>The function is only available as fastcall function, so it may only
5722 be used in presence of a prototype.
5724 <tag/Availability/ISO 9899
5726 <ref id="_poserror" name="_poserror">,
5727 <ref id="strerror" name="strerror">
5733 <sect1>pokebsys<label id="pokebsys"><p>
5737 <tag/Function/Write one byte to a location in the system bank.
5738 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5739 <tt/<ref id="cbm510.h" name="cbm510.h">/
5740 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
5741 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
5742 system bank (bank 15) of the CBM PET-II machines.
5743 <tag/Notes/<itemize>
5744 <item>The function is only available as fastcall function, so it may only
5745 be used in presence of a prototype.
5747 <tag/Availability/cc65
5749 <ref id="POKE" name="POKE">,
5750 <ref id="POKEW" name="POKEW">,
5751 <ref id="peekbsys" name="peekbsys">,
5752 <ref id="peekwsys" name="peekwsys">,
5753 <ref id="pokewsys" name="pokewsys">
5759 <sect1>pokewsys<label id="pokewsys"><p>
5763 <tag/Function/Write one word to a location in the system bank.
5764 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5765 <tt/<ref id="cbm510.h" name="cbm510.h">/
5766 <tag/Declaration/<tt/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
5767 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
5768 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
5769 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
5770 high byte is written to <tt/addr+1/.
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 order in which the two bytes are written is undefined.
5776 <tag/Availability/cc65
5778 <ref id="POKE" name="POKE">,
5779 <ref id="POKEW" name="POKEW">,
5780 <ref id="peekbsys" name="peekbsys">,
5781 <ref id="peekwsys" name="peekwsys">,
5782 <ref id="pokebsys" name="pokebsys">
5788 <sect1>qsort<label id="qsort"><p>
5792 <tag/Function/Sort an array.
5793 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5794 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
5795 size_t size, int __fastcall__ (* compare) (const void*, const void*));/
5796 <tag/Description/<tt/qsort/ sorts an array according to a given compare
5797 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
5798 is the number of elements, <tt/size/ the size of an element and <tt/compare/
5799 the function used to compare the members.
5800 <tag/Notes/<itemize>
5801 <item>If there are multiple members with the same key, the order after calling
5802 the function is undefined.
5803 <item>The function is only available as fastcall function, so it may only
5804 be used in presence of a prototype.
5805 <item>The function to which <tt/compare/ points must have the <tt/fastcall/
5808 <tag/Availability/ISO 9899
5810 <ref id="bsearch" name="bsearch">
5816 <sect1>raise<label id="raise"><p>
5820 <tag/Function/Send a signal to the executing program.
5821 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
5822 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
5823 <tag/Description/<tt/raise/ sends the given signal to the program. If the
5824 program has installed a signal handler for the signal, this signal handler
5825 will be executed. If no handler has been installed, the default action for
5826 the raised signal will be taken. The function returns zero on success,
5828 <tag/Notes/<itemize>
5829 <item>The function is only available as fastcall function, so it may only
5830 be used in presence of a prototype.
5832 <tag/Availability/ISO 9899
5834 <ref id="abort" name="abort">,
5835 <ref id="signal" name="signal">
5841 <sect1>rand<label id="rand"><p>
5845 <tag/Function/Return a pseudo random number.
5846 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5847 <tag/Declaration/<tt/int rand (void);/
5848 <tag/Description/The function returns a pseudo random number
5849 between 0 and <tt/RAND_MAX/ (exclusive).
5850 <tag/Notes/<itemize>
5851 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
5852 flow of numbers is generated.
5853 <item>On startup, the function behaves as if <ref id="srand" name="srand">
5854 had been used with an argument of 1.
5856 <tag/Availability/ISO 9899
5858 <ref id="_randomize" name="_randomize">,
5859 <ref id="srand" name="srand">
5865 <sect1>readdir<label id="readdir"><p>
5869 <tag/Function/Read a directory.
5870 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5871 <tag/Declaration/<tt/struct dirent* __fastcall__ readdir (DIR* dir);/
5872 <tag/Description/<tt/readdir/ reads the next directory entry from the directory
5873 stream pointed to by <tt/dir/. It stores the data in a <tt/dirent/ structure
5874 and returns a pointer to it. If the end of directory is reached, or an error
5875 occurs, NULL is returned. In case of errors, an error code is stored into
5877 <tag/Notes/<itemize>
5878 <item>The function is only available as fastcall function, so it may only
5879 be used in presence of a prototype.
5880 <item>The returned pointer may point to a statically allocated instance of
5881 <tt/struct dirent/, so it may get overwritten by subsequent calls to
5883 <item>On several platforms, namely the CBMs and the Atari, the disk drives get
5884 confused when opening/closing files between directory reads. So for example a
5885 program that reads the list of files on a disk, and after each call to
5886 <tt/readdir/, opens the file to process it, will fail.<newline>
5887 Possible solutions are reading the directory into memory before processing the
5888 file list, or to reset the directory by seeking to the correct position after
5889 opening/closing a file:
5891 seekdir (DIR, telldir (DIR));
5893 Platforms known to work without problems are: Apple.
5895 <tag/Availability/POSIX 1003.1
5897 <ref id="closedir" name="closedir">,
5898 <ref id="opendir" name="opendir">
5904 <sect1>realloc<label id="realloc"><p>
5908 <tag/Function/Change the size of an allocated memory block.
5909 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5910 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
5911 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
5912 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
5913 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
5914 behaves as if <tt/free/ had been called. On error (not enough memory
5915 available), <tt/realloc/ returns <tt/NULL/.
5916 <tag/Notes/<itemize>
5917 <item>The part of the memory block that is returned will have its contents
5919 <item>This function is somewhat dangerous to use. Be careful to save the
5920 pointer you're passing somewhere else, otherwise
5922 ptr = realloc (ptr, size);
5924 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
5925 <item>The function is only available as fastcall function, so it may only
5926 be used in presence of a prototype.
5928 <tag/Availability/ISO 9899
5930 <ref id="_heapadd" name="_heapadd">,
5931 <ref id="_heapblocksize" name="_heapblocksize">,
5932 <ref id="_heapmaxavail" name="_heapmaxavail">,
5933 <ref id="_heapmemavail" name="_heapmemavail">,
5934 <ref id="calloc" name="calloc">,
5935 <ref id="free" name="free">,
5936 <ref id="realloc" name="realloc">
5942 <sect1>remove<label id="remove"><p>
5946 <tag/Function/Delete a file.
5947 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5948 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
5949 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
5950 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5951 code describing the reason for the failure.
5952 <tag/Notes/<itemize>
5953 <item>This function is not available on all cc65 targets (depends on the
5954 availability of file I/O).
5955 <item>The function is only available as fastcall function, so it may only
5956 be used in presence of a prototype.
5958 <tag/Availability/ISO 9899
5960 <ref id="rename" name="rename">,
5961 <ref id="unlink" name="unlink">
5964 #include <stdio.h>
5966 #define FILENAME "helloworld"
5968 if (remove (FILENAME) == 0) {
5969 printf ("We deleted %s successfully\n", FILENAME);
5971 printf ("There was a problem deleting %s\n", FILENAME);
5978 <sect1>rename<label id="rename"><p>
5982 <tag/Function/Rename a file.
5983 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5984 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
5985 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
5986 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5987 code describing the reason for the failure.
5988 <tag/Notes/<itemize>
5989 <item>This function is not available on all cc65 targets (depends on the
5990 capabilities of the storage devices).
5991 <item>The function is only available as fastcall function, so it may only
5992 be used in presence of a prototype.
5994 <tag/Availability/ISO 9899
5996 <ref id="remove" name="remove">
5999 #include <stdio.h>
6001 #define OLDNAME "textfile.txt"
6002 #define NEWNAME "textfile.bak"
6004 if (rename (OLDNAME, NEWNAME) == 0) {
6005 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
6007 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
6014 <sect1>reset_brk<label id="reset_brk"><p>
6018 <tag/Function/Resets the break vector to its original value.
6019 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
6020 <tag/Declaration/<tt/void reset_brk (void);/
6021 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
6022 before a call to <tt/set_brk/.
6023 <tag/Notes/<itemize>
6024 <item>The break vector is reset on program termination, so it's not strictly
6025 necessary to call this function as a part of your clean-up when exiting the program.
6027 <tag/Availability/cc65
6029 <ref id="reset_irq" name="reset_irq">,
6030 <ref id="set_brk" name="set_brk">,
6031 <ref id="set_irq" name="set_irq">
6037 <sect1>reset_irq<label id="reset_irq"><p>
6041 <tag/Function/Resets the C level interrupt request vector.
6042 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
6043 <tag/Declaration/<tt/void reset_irq (void);/
6044 <tag/Description/<tt/reset_irq/ resets the C level interrupt request vector.
6045 <tag/Notes/<itemize>
6046 <item>The interrupt vector is reset on program termination, so it's not strictly
6047 necessary to call this function as a part of your clean-up when exiting the program.
6049 <tag/Availability/cc65
6051 <ref id="reset_brk" name="reset_brk">,
6052 <ref id="set_brk" name="set_brk">,
6053 <ref id="set_irq" name="set_irq">
6059 <sect1>revers<label id="revers"><p>
6063 <tag/Function/Control revers character display.
6064 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6065 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
6066 <tag/Description/If the argument is non zero, the function enables reverse
6067 character display. If the argument is zero, reverse character display is
6068 switched off. The old value of the setting is returned.
6069 <tag/Notes/<itemize>
6070 <item>The function may not be supported by the hardware, in which case
6071 the call is ignored.
6072 <item>The function is only available as fastcall function, so it may only
6073 be used in presence of a prototype.
6075 <tag/Availability/cc65
6077 <ref id="textcolor" name="textcolor">
6083 <sect1>rewinddir<label id="rewinddir"><p>
6087 <tag/Function/Reset a directory stream.
6088 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
6089 <tag/Declaration/<tt/void __fastcall__ rewinddir (DIR* dir);/
6090 <tag/Description/<tt/rewinddir/ sets the position of the directory stream
6091 pointed to by <tt/dir/ to the start of the directory.
6092 <tag/Notes/<itemize>
6093 <item>The function is only available as fastcall function, so it may only
6094 be used in presence of a prototype.
6096 <tag/Availability/POSIX 1003.1
6098 <ref id="seekdir" name="seekdir">,
6099 <ref id="telldir" name="telldir">
6105 <sect1>screensize<label id="screensize"><p>
6109 <tag/Function/Return the dimensions of the text mode screen.
6110 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6111 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
6112 <tag/Description/The function returns the dimensions of the text mode screen.
6113 <tag/Notes/<itemize>
6114 <item>The function is only available as fastcall function, so it may only
6115 be used in presence of a prototype.
6117 <tag/Availability/cc65
6119 <ref id="gotox" name="gotox">,
6120 <ref id="gotoxy" name="gotoxy">,
6121 <ref id="gotoy" name="gotoy">,
6122 <ref id="wherex" name="wherex">,
6123 <ref id="wherey" name="wherey">
6129 <sect1>seekdir<label id="seekdir"><p>
6133 <tag/Function/Set the position of a directory stream.
6134 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
6135 <tag/Declaration/<tt/void __fastcall__ seekdir (DIR* dir, long offset);/
6136 <tag/Description/<tt/seekdir/ sets the position of the directory stream
6137 pointed to by <tt/dir/ to the value given in <tt/offset/, which should be a
6138 value returned by <tt/<ref id="telldir" name="telldir">/.
6139 <tag/Notes/<itemize>
6140 <item>The function is only available as fastcall function, so it may only
6141 be used in presence of a prototype.
6143 <tag/Availability/POSIX 1003.1
6145 <ref id="rewinddir" name="rewinddir">,
6146 <ref id="telldir" name="telldir">
6152 <sect1>ser_close<label id="ser_close"><p>
6156 <tag/Function/Close the port and disable interrupts
6157 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6158 <tag/Declaration/<tt/unsigned char ser_close (void);/
6159 <tag/Description/Close the port by clearing buffers and disable interrupts.
6160 <tag/Availability/cc65
6161 <tag/See also/Other serial functions.
6166 static void initialize(){
6167 struct ser_params params = {
6174 ser_install(lynx_comlynx); // This will activate the ComLynx
6176 ser_open(&params);
6183 <sect1>ser_get<label id="ser_get"><p>
6187 <tag/Function/Read a character from serial port.
6188 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6189 <tag/Declaration/<tt/unsigned char __fastcall__ ser_get (char* b);/
6190 <tag/Description/Get a character from the serial port. If no characters are
6191 available, the function will return SER_ERR_NO_DATA, so this is not a fatal
6193 <tag/Notes/<itemize>
6194 <item>The function is only available as fastcall function, so it may only
6195 be used in presence of a prototype.
6197 <tag/Availability/cc65
6198 <tag/See also/Other serial functions.
6200 Wait for a character to be available from a serial port.
6203 while (ser_get(&ch) == SER_ERR_NO_DATA)
6210 <sect1>ser_install<label id="ser_install"><p>
6214 <tag/Function/Install an already loaded driver and return an error code.
6215 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6216 <tag/Declaration/<tt/unsigned char __fastcall__ ser_install (void* driver);/
6217 <tag/Description/The function installs a driver that was already loaded into
6218 memory (or linked statically to the program). It returns an error code
6219 (<tt/SER_ERR_OK/ in case of success).
6220 <tag/Notes/<itemize>
6221 <item>The function is only available as fastcall function, so it may only be
6222 used in presence of a prototype.
6224 <tag/Availability/cc65
6226 <ref id="ser_load_driver" name="ser_load_driver">,
6227 <ref id="ser_uninstall" name="ser_uninstall">,
6228 <ref id="ser_unload" name="ser_unload">
6230 ser_install(lynx_comlynx); //Include the driver statically instead of loading it.
6236 <sect1>ser_ioctl<label id="ser_ioctl"><p>
6240 <tag/Function/Platform dependent code extensions.
6241 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6242 <tag/Declaration/<tt/unsigned __fastcall__ ser_ioctl (unsigned char code, void* data);/
6243 <tag/Description/Some platforms have extra serial functions that are not
6244 supported by standard serial driver functions. You can extend the driver to support
6245 this extra functionality bt using ser_ioctl functions.
6246 <tag/Notes/<itemize>
6247 <item>The function is only available as fastcall function, so it may only
6248 be used in presence of a prototype.
6249 <item>These functions are not easily portable to other cc65 platforms.
6251 <tag/Availability/cc65
6252 <tag/See also/Other serial functions.
6257 <sect1>ser_load_driver<label id="ser_load_driver"><p>
6261 <tag/Function/Load and install a serial driver.
6262 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6263 <tag/Declaration/<tt/unsigned char __fastcall__ ser_load_driver (const char *name);/
6264 <tag/Description/Load and install the driver by name.
6265 Will just load the driver and check if loading was successful.
6266 <tag/Notes/<itemize>
6267 <item>The function is only available as fastcall function, so it may only
6268 be used in presence of a prototype.
6270 <tag/Availability/cc65
6271 <tag/See also/Other serial functions.
6277 <sect1>ser_open<label id="ser_open"><p>
6281 <tag/Function/Open the port by setting the port parameters and enable interrupts
6282 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6283 <tag/Declaration/<tt/unsigned char __fastcall__ ser_open (const struct ser_params* params);/
6284 <tag/Description/Open the port by setting the port parameters and enable interrupts.
6285 <tag/Notes/<itemize>
6286 <item>The function is only available as fastcall function, so it may only
6287 be used in presence of a prototype.
6289 <tag/Availability/cc65
6290 <tag/See also/Other serial functions.
6295 static void initialize(){
6296 struct ser_params params = {
6303 ser_install(lynx_comlynx); // This will activate the ComLynx
6305 ser_open(&params);
6312 <sect1>ser_put<label id="ser_put"><p>
6316 <tag/Function/Write a character to a serial port.
6317 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6318 <tag/Declaration/<tt/unsigned char __fastcall__ ser_put (char b);/
6319 <tag/Description/Send a character via the serial port. There is a transmit
6320 buffer, but transmitting is not done via interrupt. The function returns
6321 SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
6322 <tag/Notes/<itemize>
6323 <item>The function is only available as fastcall function, so it may only
6324 be used in presence of a prototype.
6326 <tag/Availability/cc65
6327 <tag/See also/Other serial functions.
6336 <sect1>ser_status<label id="ser_status"><p>
6340 <tag/Function/Return the serial port status.
6341 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6342 <tag/Declaration/<tt/unsigned char __fastcall__ ser_status (unsigned char* status);/
6343 <tag/Description/Return the serial port status.
6344 <tag/Notes/<itemize>
6345 <item>The function is only available as fastcall function, so it may only
6346 be used in presence of a prototype.
6348 <tag/Availability/cc65
6349 <tag/See also/Other serial functions.
6355 <sect1>ser_uninstall<label id="ser_uninstall"><p>
6359 <tag/Function/Uninstall the currently loaded driver but do not unload it.
6360 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6361 <tag/Declaration/<tt/unsigned char ser_uninstall (void);/
6362 <tag/Description/Uninstall the currently loaded driver but do not unload it.
6363 <tag/Availability/cc65
6364 <tag/See also/Other serial functions.
6369 <sect1>ser_unload<label id="ser_unload"><p>
6373 <tag/Function/Uninstall, then unload the currently loaded driver.
6374 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6375 <tag/Declaration/<tt/unsigned char ser_unload (void);/
6376 <tag/Description/Uninstall, then unload the currently loaded driver.
6377 <tag/Availability/cc65
6378 <tag/See also/Other serial functions.
6384 <sect1>set_brk<label id="set_brk"><p>
6388 <tag/Function/Set the break vector to a user function.
6389 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
6390 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
6391 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
6392 program code by letting the vector point to a user written C function. The
6393 runtime library installs a small stub that saves the registers into global
6394 variables that may be accessed (and changed) by the break handler.
6395 <tag/Notes/<itemize>
6396 <item>The function is only available as fastcall function, so it may only
6397 be used in presence of a prototype.
6398 <item>The stub saves the zero page registers used by the C runtime and switches
6399 to a small break handler stack. This means that it is safe to execute C code,
6400 even if C code was interrupted. Be careful however not to use too many local
6401 variables, and do not enable stack checks for the handler function or any other
6402 function called from it.
6403 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
6404 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
6405 otherwise the <tt/BRK/ instruction will get executed over and over again.
6406 <item>The break vector is reset on program termination, so it's not strictly
6407 necessary to call <tt/<ref id="reset_brk" name="reset_brk">/ as a part of your
6408 clean-up when exiting the program.
6410 <tag/Availability/cc65
6412 <ref id="reset_brk" name="reset_brk">
6418 <sect1>set_irq<label id="set_irq"><p>
6422 <tag/Function/Set the C level interrupt request vector to the given address.
6423 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
6424 <tag/Declaration/<tt/void __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);/
6425 <tag/Description/<tt/set_irq/ allows a user program to handle interrupt requests
6426 (IRQs) within the program code by letting the vector point to a user written C
6427 function. The runtime library installs a small stub that saves the zero page
6428 registers used by the C runtime before calling the handler function and restores
6429 them after the handler function returns. Additionally the stub temporarily switches
6430 the C runtime stack to the stack area provided as parameter. If the handler function
6431 was set up to handle a "private", "exclusive" interrupt request source it must
6432 return the value <tt/IRQ_HANDLED/ if and only if it has verified that the current
6433 interrupt request actually stems from that source. In all other cases it must return
6434 the value <tt/IRQ_NOT_HANDLED/.
6435 <tag/Notes/<itemize>
6436 <item>The function is only available as fastcall function, so it may only
6437 be used in presence of a prototype.
6438 <item>The stub saves the registers and zero page locations used by the C runtime
6439 and switches to the provided stack area. As a consequence, there is some
6440 runtime overhead, but it it is safe to execute C code, even if other C code
6441 was interrupted. Be careful however not to call C library functions, and do not
6442 enable stack checks for the handler function or any other function called from
6444 <item>The interrupt vector is reset on program termination, so it's not strictly
6445 necessary to call <tt/<ref id="reset_irq" name="reset_irq">/ as a part of your
6446 clean-up when exiting the program.
6448 <tag/Availability/cc65
6450 <ref id="reset_brk" name="reset_brk">,
6451 <ref id="reset_irq" name="reset_irq">,
6452 <ref id="set_brk" name="set_brk">
6458 <sect1>set_c128_speed<label id="set_c128_speed"><p>
6462 <tag/Function/Set the current speed of a C128 CPU.
6463 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6464 <tag/Declaration/<tt/unsigned char __fastcall__ set_c128_speed (unsigned char speed);/
6465 <tag/Description/The function returns the speed after trying to set the speed of the C128 CPU.
6466 <tag/Notes/<itemize>
6467 <item>The function is specific to the C64 and C128.
6468 <item>The function does not check if the C128 CPU is the current CPU.
6469 <item>See the accelerator.h header for the speed definitions.
6471 <tag/Availability/cc65 (not all platforms)
6473 <ref id="detect_c128" name="detect_c128">,
6474 <ref id="get_c128_speed" name="get_c128_speed">,
6480 <sect1>set_c64dtv_speed<label id="set_c64dtv_speed"><p>
6484 <tag/Function/Set the current speed of the C64DTV.
6485 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6486 <tag/Declaration/<tt/unsigned char __fastcall__ set_c64dtv_speed (unsigned char speed);/
6487 <tag/Description/The function returns the speed after trying to set the speed of the C64DTV.
6488 <tag/Notes/<itemize>
6489 <item>The function is specific to the C64.
6490 <item>The function does not check for the presence of the C64DTV.
6491 <item>See the accelerator.h header for the speed definitions.
6493 <tag/Availability/cc65 (not all platforms)
6495 <ref id="detect_c64dtv" name="detect_c64dtv">,
6496 <ref id="get_c64dtv_speed" name="get_c64dtv_speed">,
6502 <sect1>set_c65_speed<label id="set_c65_speed"><p>
6506 <tag/Function/Set the current speed of the C65/C64DX in C64 mode.
6507 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6508 <tag/Declaration/<tt/unsigned char __fastcall__ set_c65_speed (unsigned char speed);/
6509 <tag/Description/The function returns the speed after trying to set the speed of the C65/C64DX in C64 mode.
6510 <tag/Notes/<itemize>
6511 <item>The function is specific to the C64.
6512 <item>The function does not check for the presence of a C65/C64DX in C64 mode.
6513 <item>See the accelerator.h header for the speed definitions.
6515 <tag/Availability/cc65 (not all platforms)
6517 <ref id="detect_c65" name="detect_c65">,
6518 <ref id="get_c65_speed" name="get_c65_speed">,
6524 <sect1>set_chameleon_speed<label id="set_chameleon_speed"><p>
6528 <tag/Function/Set the current speed of the C64 Chameleon cartridge.
6529 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6530 <tag/Declaration/<tt/unsigned char __fastcall__ set_chameleon_speed (unsigned char speed);/
6531 <tag/Description/The function returns the speed after trying to set the speed of the C64 Chameleon cartridge.
6532 <tag/Notes/<itemize>
6533 <item>The function is specific to the C64.
6534 <item>The function does not check for the presence of the C64 Chameleon cartridge.
6535 <item>See the accelerator.h header for the speed definitions.
6537 <tag/Availability/cc65 (not all platforms)
6539 <ref id="detect_chameleon" name="detect_chameleon">,
6540 <ref id="get_chameleon_speed" name="get_chameleon_speed">,
6546 <sect1>set_scpu_speed<label id="set_scpu_speed"><p>
6550 <tag/Function/Set the current speed of the C64/C128 SuperCPU cartridge.
6551 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6552 <tag/Declaration/<tt/unsigned char __fastcall__ set_scpu_speed (unsigned char speed);/
6553 <tag/Description/The function returns the speed after trying to set the speed of the SuperCPU cartridge.
6554 <tag/Notes/<itemize>
6555 <item>The function is specific to the C128 and C64.
6556 <item>The function does not check for the presence of the cartridge.
6557 <item>See the accelerator.h header for the speed definitions.
6559 <tag/Availability/cc65 (not all platforms)
6561 <ref id="detect_scpu" name="detect_scpu">,
6562 <ref id="get_scpu_speed" name="get_scpu_speed">,
6568 <sect1>set_turbomaster_speed<label id="set_turbomaster_speed"><p>
6572 <tag/Function/Set the current speed of the C64 Turbo Master cartridge.
6573 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6574 <tag/Declaration/<tt/unsigned char __fastcall__ set_turbomaster_speed (unsigned char speed);/
6575 <tag/Description/The function returns the speed after trying to set the speed of the C64 Turbo Master cartridge.
6576 <tag/Notes/<itemize>
6577 <item>The function is specific to the C64.
6578 <item>The function does not check for the presence of the C64 Turbo Master cartridge.
6579 <item>See the accelerator.h header for the speed definitions.
6581 <tag/Availability/cc65 (not all platforms)
6583 <ref id="detect_turbomaster" name="detect_turbomaster">,
6584 <ref id="get_turbomaster_speed" name="get_turbomaster_speed">,
6590 <sect1>setjmp<label id="setjmp"><p>
6594 <tag/Function/Save the context for use with <tt/longjmp/.
6595 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
6596 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
6597 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
6598 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
6600 <tag/Notes/<itemize>
6601 <item>The function is only available as fastcall function, so it may only
6602 be used in presence of a prototype.
6603 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
6604 <item><tt/setjmp/ will not save the signal context.
6606 <tag/Availability/ISO 9899
6608 <ref id="longjmp" name="longjmp">
6614 <sect1>setlocale<label id="setlocale"><p>
6618 <tag/Function/Selects a locale.
6619 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
6620 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
6621 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
6622 <tag/Notes/<itemize>
6623 <item>The function is only available as fastcall function, so it may only
6624 be used in presence of a prototype.
6625 <item>cc65 supports only the "C" locale, so calling this function to set a
6626 different locale has no effect.
6628 <tag/Availability/ISO 9899
6630 <ref id="localeconv" name="localeconv">,
6631 <ref id="strcoll" name="strcoll">
6632 <ref id="strxfrm" name="strxfrm">
6638 <sect1>signal<label id="signal"><p>
6642 <tag/Function/Install a signal handler.
6643 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
6644 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
6645 <tag/Description/<tt/signal/ installs a handler for the given signal. The
6646 handler may either be a user supplied function, or one of the predefined
6647 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
6648 previous value if the signal , or the special function vector SIG_ERR in
6650 <tag/Notes/<itemize>
6651 <item>The function is only available as fastcall function, so it may only
6652 be used in presence of a prototype.
6654 <tag/Availability/ISO 9899
6656 <ref id="abort" name="abort">,
6657 <ref id="raise" name="raise">
6663 <sect1>sleep<label id="sleep"><p>
6667 <tag/Function/Sleep for a specified amount of time.
6668 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
6669 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
6670 <tag/Description/The function will return after the specified number of
6671 seconds have elapsed.
6672 <tag/Notes/<itemize>
6673 <item>The function is only available as fastcall function, so it may only
6674 be used in presence of a prototype.
6676 <tag/Availability/POSIX 1003.1
6682 <sect1>slow<label id="slow"><p>
6686 <tag/Function/Switch the CPU into slow mode (C128: 1MHz mode, C16/Plus4: single clock mode).
6687 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
6688 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
6689 <tag/Declaration/<tt/void slow (void);/
6690 <tag/Description/The function will switch the clock of the CPU to slow mode. for the C128
6691 target it means switching the CPU into 1MHz mode. for the C16/Plus4 target it means
6692 switching the CPU into single clock mode.
6693 <tag/Notes/<itemize>
6694 <item>The function is specific to the C128, C16 and Plus4.
6696 <tag/Availability/cc65 (not all platforms)
6698 <ref id="fast" name="fast">,
6699 <ref id="isfast" name="isfast">,
6705 <sect1>srand<label id="srand"><p>
6709 <tag/Function/Initialize the pseudo random number generator.
6710 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
6711 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
6712 <tag/Description/The function initializes the random number generator using
6713 the given seed. On program startup, the generator behaves as if <tt/srand/ has
6714 been called with an argument of 1.
6715 <tag/Notes/<itemize>
6716 <item>The function is only available as fastcall function, so it may only
6717 be used in presence of a prototype.
6719 <tag/Availability/ISO 9899
6721 <ref id="_randomize" name="_randomize">,
6722 <ref id="rand" name="rand">
6728 <sect1>strcasecmp<label id="strcasecmp"><p>
6732 <tag/Function/Compare two strings case insensitive.
6733 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6734 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
6735 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
6736 as parameters without case sensitivity. It returns a value that is less than
6737 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
6738 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
6739 <tag/Notes/<itemize>
6740 <item>The function is only available as fastcall function, so it may only
6741 be used in presence of a prototype.
6742 <item>The function is not available in strict ANSI mode.
6744 <tag/Availability/cc65
6746 <ref id="strcmp" name="strcmp">,
6747 <ref id="strcoll" name="strcoll">,
6748 <ref id="stricmp" name="stricmp">,
6749 <ref id="strncmp" name="strncmp">,
6750 <ref id="strxfrm" name="strxfrm">
6756 <sect1>strcat<label id="strcat"><p>
6760 <tag/Function/Concatentate two strings.
6761 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6762 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
6763 <tag/Description/The <tt/strcat/ function appends a copy of the string
6764 pointed to by s2 (including the terminating null byte) to the end of the
6765 string pointed to by s1. The initial byte of s2 overwrites the null byte at
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="strcpy" name="strcpy">,
6776 <ref id="strncat" name="strncat">,
6777 <ref id="strncpy" name="strncpy">
6783 <sect1>strchr<label id="strchr"><p>
6787 <tag/Function/Search for a character in a string.
6788 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6789 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
6790 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
6791 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6792 byte is considered to be part of the string. Upon completion, the function
6793 returns a pointer to the byte, or a null pointer if the byte was not found.
6794 <tag/Notes/<itemize>
6795 <item>The function is only available as fastcall function, so it may only
6796 be used in presence of a prototype.
6798 <tag/Availability/ISO 9899
6800 <ref id="memchr" name="memchr">,
6801 <ref id="strrchr" name="strrchr">
6807 <sect1>strcmp<label id="strcmp"><p>
6811 <tag/Function/Compare two strings.
6812 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6813 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
6814 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
6815 parameters. It returns a value that is less than zero if <tt/s1/ is less than
6816 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
6817 if <tt/s1/ is greater than <tt/s2/.
6818 <tag/Notes/<itemize>
6819 <item>The function is only available as fastcall function, so it may only
6820 be used in presence of a prototype.
6822 <tag/Availability/ISO 9899
6824 <ref id="strcasecmp" name="strcasecmp">,
6825 <ref id="strcoll" name="strcoll">,
6826 <ref id="stricmp" name="stricmp">,
6827 <ref id="strncmp" name="strncmp">
6828 <ref id="strxfrm" name="strxfrm">
6834 <sect1>strcoll<label id="strcoll"><p>
6838 <tag/Function/Compare two strings.
6839 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6840 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
6841 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
6842 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
6843 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
6844 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
6845 than zero if <tt/s1/ is greater than <tt/s2/.
6846 <tag/Notes/<itemize>
6847 <item>The function is only available as fastcall function, so it may only
6848 be used in presence of a prototype.
6850 <tag/Availability/ISO 9899
6852 <ref id="setlocale" name="setlocale">,
6853 <ref id="strcasecmp" name="strcasecmp">,
6854 <ref id="strcmp" name="strcmp">,
6855 <ref id="stricmp" name="stricmp">,
6856 <ref id="strncmp" name="strncmp">,
6857 <ref id="strxfrm" name="strxfrm">
6863 <sect1>strcpy<label id="strcpy"><p>
6867 <tag/Function/Copy a string.
6868 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6869 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
6870 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
6871 <tt/s2/ (including the terminating null byte) into the array pointed to by
6872 <tt/s1/. The function will always return <tt/s1/.
6873 <tag/Notes/<itemize>
6874 <item>The function is only available as fastcall function, so it may only
6875 be used in presence of a prototype.
6876 <item>If copying takes place between objects that overlap, the behaviour
6879 <tag/Availability/ISO 9899
6881 <ref id="strcat" name="strcat">,
6882 <ref id="strncat" name="strncat">,
6883 <ref id="strncpy" name="strncpy">
6886 #include <string.h>
6888 static char hello[14];
6890 strcpy (hello, "Hello world!\n");
6896 <sect1>strcspn<label id="strcspn"><p>
6900 <tag/Function/Compute the length of a substring.
6901 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6902 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
6903 <tag/Description/The <tt/strcspn/ function computes and returns the length of
6904 the substring pointed to by <tt/s/ which does <em>not</em> consist of
6905 characters contained in the string <tt/set/.
6906 <tag/Notes/<itemize>
6907 <item>The function is only available as fastcall function, so it may only
6908 be used in presence of a prototype.
6910 <tag/Availability/ISO 9899
6912 <ref id="strpbrk" name="strpbrk">,
6913 <ref id="strqtok" name="strqtok">,
6914 <ref id="strspn" name="strspn">,
6915 <ref id="strstr" name="strstr">,
6916 <ref id="strtok" name="strtok">
6922 <sect1>strdup<label id="strdup"><p>
6926 <tag/Function/Allocate a copy of a string on the heap.
6927 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6928 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
6929 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
6930 to hold a copy of <tt/s/ including the terminating zero. If the allocation
6931 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
6932 memory block, and a pointer to the block is returned.
6933 <tag/Notes/<itemize>
6934 <item>The function is only available as fastcall function, so it may only
6935 be used in presence of a prototype.
6936 <item>It is up to the caller to free the allocated memory block.
6938 <tag/Availability/ISO 9899
6940 <ref id="free" name="free">,
6941 <ref id="malloc" name="malloc">
6947 <sect1>strerror<label id="strerror"><p>
6951 <tag/Function/Return a string describing an error code.
6952 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6953 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
6954 <tag/Description/The <tt/strerror/ function returns a string describing the
6955 given error code. If an invalid error code is passed, the string "Unknown
6956 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
6957 <tt/errno/ is left untouched.
6958 <tag/Notes/<itemize>
6959 <item>The function is only available as fastcall function, so it may only
6960 be used in presence of a prototype.
6961 <item>While the return type of the function is a <tt/char*/, the returned
6962 string must not be modified by the caller!
6964 <tag/Availability/ISO 9899
6966 <ref id="_stroserror" name="_stroserror">
6972 <sect1>stricmp<label id="stricmp"><p>
6976 <tag/Function/Compare two strings case insensitive.
6977 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6978 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
6979 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
6980 parameters without case sensitivity. It returns a value that is less than zero
6981 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
6982 value greater than zero if <tt/s1/ is greater than <tt/s2/.
6983 <tag/Notes/<itemize>
6984 <item>The function is only available as fastcall function, so it may only
6985 be used in presence of a prototype.
6986 <item>The function is not available in strict ANSI mode.
6988 <tag/Availability/cc65
6990 <ref id="strcasecmp" name="strcasecmp">,
6991 <ref id="strcmp" name="strcmp">,
6992 <ref id="strcoll" name="strcoll">,
6993 <ref id="strncmp" name="strncmp">,
6994 <ref id="strxfrm" name="strxfrm">
7000 <sect1>strlen<label id="strlen"><p>
7004 <tag/Function/Return the length of a string.
7005 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7006 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
7007 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
7008 string to which s points, not including the terminating null byte.
7009 <tag/Notes/<itemize>
7010 <item>The function is only available as fastcall function, so it may only
7011 be used in presence of a prototype.
7012 <item>When compiling with <tt/-Os/ (inline known standard functions), the
7013 function does not work correctly for strings with more than 255 characters.
7015 <tag/Availability/ISO 9899
7017 <ref id="strcpy" name="strcpy">
7023 <sect1>strlower<label id="strlower"><p>
7027 <tag/Function/Make a string lower case.
7028 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7029 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
7030 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
7031 function to each character of a string. The function will always return <tt/s/.
7032 <tag/Notes/<itemize>
7033 <item>The function is only available as fastcall function, so it may only
7034 be used in presence of a prototype.
7035 <item>The function prototype is unavailable when compiling in strict ANSI mode.
7036 <item>An alias name for this function is <tt/strlwr/.
7038 <tag/Availability/cc65
7040 <ref id="strupper" name="strupper">,
7041 <ref id="tolower" name="tolower">
7047 <sect1>strlwr<label id="strlwr"><p>
7054 <sect1>strncasecmp<label id="strncasecmp"><p>
7058 <tag/Function/Compare two strings case insensitive.
7059 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7060 <tag/Declaration/<tt/int __fastcall__ strncasecmp (const char* s1, const char* s2, size_t count);/
7061 <tag/Description/The <tt/strncasecmp/ function compares the two strings passed
7062 as parameters without case sensitivity. It returns a value that is less than
7063 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
7064 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
7065 <tag/Notes/<itemize>
7066 <item>The function is only available as fastcall function, so it may only
7067 be used in presence of a prototype.
7068 <item>The function is not available in strict ANSI mode.
7070 <tag/Availability/cc65
7072 <ref id="strcmp" name="strcmp">,
7073 <ref id="strcoll" name="strcoll">,
7074 <ref id="stricmp" name="stricmp">,
7075 <ref id="strncmp" name="strncmp">,
7076 <ref id="strxfrm" name="strxfrm">
7082 <sect1>strncat<label id="strncat"><p>
7086 <tag/Function/Concatentate two strings.
7087 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7088 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
7089 <tag/Description/The <tt/strncat/ function appends not more than n characters
7090 of the string pointed to by s2 to the end of the string pointed to by s1. The
7091 terminating null character at the end of s1 is overwritten. A terminating null
7092 character is appended to the result, even if not all of s2 is appended to s1.
7093 <tag/Notes/<itemize>
7094 <item>The function is only available as fastcall function, so it may only
7095 be used in presence of a prototype.
7096 <item>If copying takes place between objects that overlap, the behaviour
7099 <tag/Availability/ISO 9899
7101 <ref id="strcpy" name="strcpy">,
7102 <ref id="strncat" name="strncat">,
7103 <ref id="strncpy" name="strncpy">
7109 <sect1>strncmp<label id="strncmp"><p>
7113 <tag/Function/Compare two strings.
7114 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7115 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
7116 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
7117 characters of the two strings passed as parameters. It returns a value that is
7118 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
7119 <tt/s2/, zero if they are identical, and a value greater than zero they are
7121 <tag/Notes/<itemize>
7122 <item>The function is only available as fastcall function, so it may only
7123 be used in presence of a prototype.
7125 <tag/Availability/ISO 9899
7127 <ref id="strcasecmp" name="strcasecmp">,
7128 <ref id="strcmp" name="strcmp">,
7129 <ref id="strcoll" name="strcoll">,
7130 <ref id="stricmp" name="stricmp">,
7131 <ref id="strxfrm" name="strxfrm">
7137 <sect1>strncpy<label id="strncpy"><p>
7141 <tag/Function/Copy part of a string.
7142 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7143 <tag/Declaration/<tt/char* __fastcall__ strncpy (char* s1, const char* s2, size_t n);/
7144 <tag/Description/The <tt/strncpy/ function copies not more than <tt/n/ bytes from
7145 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
7146 pointed to by <tt/s2/ is a string that is shorter than <tt/n/ bytes, null bytes are
7147 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
7148 written. The function always will return <tt/s1/.
7149 <tag/Notes/<itemize>
7150 <item>The function is available only as a fastcall function; so, it may be used
7151 only in the presence of a prototype.
7152 <item>If there is no null byte in the first <tt/n/ bytes of the array pointed
7153 to by <tt/s2/, the result is <em/not/ null-terminated!
7154 <item>If copying takes place between objects that overlap, the behaviour is
7157 <tag/Availability/ISO 9899
7159 <ref id="memcpy" name="memcpy">,
7160 <ref id="strcat" name="strcat">,
7161 <ref id="strcpy" name="strcpy">,
7162 <ref id="strncat" name="strncat">
7167 static char hello[6];
7169 strncpy (hello, "Hello world!\n", sizeof hello - 1)[5] = '\0';
7175 <sect1>strnicmp<label id="strnicmp"><p>
7179 <tag/Function/Compare two strings case insensitive.
7180 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7181 <tag/Declaration/<tt/int __fastcall__ strnicmp (const char* s1, const char* s2, size_t count);/
7182 <tag/Description/The <tt/strnicmp/ function compares the two strings passed as
7183 parameters without case sensitivity. It returns a value that is less than zero
7184 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
7185 value greater than zero if <tt/s1/ is greater than <tt/s2/.
7186 <tag/Notes/<itemize>
7187 <item>The function is only available as fastcall function, so it may only
7188 be used in presence of a prototype.
7189 <item>The function is not available in strict ANSI mode.
7191 <tag/Availability/cc65
7193 <ref id="strcasecmp" name="strcasecmp">,
7194 <ref id="strcmp" name="strcmp">,
7195 <ref id="strcoll" name="strcoll">,
7196 <ref id="strncmp" name="strncmp">,
7197 <ref id="strxfrm" name="strxfrm">
7203 <sect1>strpbrk<label id="strpbrk"><p>
7207 <tag/Function/Find a character in a string, from a set of characters.
7208 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7209 <tag/Declaration/<tt/char* __fastcall__ strpbrk (const char* str, const char* set);/
7210 <tag/Description/<tt/strpbrk()/ searches within <tt/str/ for the first
7211 occurance of any character from <tt/set/. It returns a pointer to that
7212 character if found; otherwise, it returns <tt/NULL/.
7213 <tag/Notes/<itemize>
7214 <item>The function is available only as a fastcall function;
7215 so, it should be used only in the presence of a prototype.
7217 <tag/Availability/ISO 9899
7219 <ref id="strchr" name="strchr">,
7220 <ref id="strcspn" name="strcspn">,
7221 <ref id="strqtok" name="strqtok">,
7222 <ref id="strspn" name="strspn">,
7223 <ref id="strtok" name="strtok">
7229 <sect1>strqtok<label id="strqtok"><p>
7233 <tag/Function/Break a string into tokens.
7234 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7235 <tag/Declaration/<tt/char* __fastcall__ strqtok (char* s1, const char* s2);/
7236 <tag/Description/<tt/strqtok()/ will break the string <tt/s1/ into a sequence of
7237 tokens, which are delimited by either quotation marks or characters from the
7238 string <tt/s2/. Tokens inside quotation marks may contain characters from <tt/s2/
7239 (they aren't delimiters there). The first call to <tt/strqtok()/ will return a
7240 pointer to the first token in the string <tt/s1/. The following calls must pass
7241 a <tt/NULL/ pointer as <tt/s1/, in order to get the next token in the string.
7242 Different sets of delimiters may be used for the subsequent calls to <tt/strqtok()/.
7243 <tag/Notes/<itemize>
7244 <item>The function is available only as a fastcall function; so, it may be used
7245 only in the presence of a prototype.
7246 <item><tt/strqtok()/ will modify the string <tt/s1/.
7247 <item>The function will forget where it is in the <tt/s1/ string if it is given
7248 a second <tt/s1/ string before it finishes the first one.
7250 <tag/Availability/cc65
7252 <ref id="strcspn" name="strcspn">,
7253 <ref id="strpbrk" name="strpbrk">,
7254 <ref id="strspn" name="strspn">,
7255 <ref id="strtok" name="strtok">
7261 <sect1>strrchr<label id="strrchr"><p>
7265 <tag/Function/Search for a character in a string.
7266 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7267 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
7268 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
7269 (converted to a char) in the string pointed to by <tt/s/. The terminating null
7270 byte is considered to be part of the string. Upon completion, the function
7271 returns a pointer to the byte, or a null pointer if the byte was not found.
7272 <tag/Notes/<itemize>
7273 <item>The function is only available as fastcall function, so it may only
7274 be used in presence of a prototype.
7276 <tag/Availability/ISO 9899
7278 <ref id="strchr" name="strchr">
7284 <sect1>strspn<label id="strspn"><p>
7288 <tag/Function/Compute the length of a substring.
7289 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7290 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
7291 <tag/Description/The <tt/strspn/ function computes and returns the length of
7292 the substring pointed to by <tt/s/ which does consist only of characters
7293 contained in the string <tt/set/.
7294 <tag/Notes/<itemize>
7295 <item>The function is only available as fastcall function, so it may only
7296 be used in presence of a prototype.
7298 <tag/Availability/ISO 9899
7300 <ref id="strcspn" name="strcspn">,
7301 <ref id="strpbrk" name="strpbrk">,
7302 <ref id="strstr" name="strstr">
7308 <sect1>strstr<label id="strstr"><p>
7312 <tag/Function/Find a substring.
7313 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7314 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
7315 <tag/Description/<tt/strstr/ searches for the first occurance of the string
7316 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
7317 otherwise it returns <tt/NULL/.
7318 <tag/Notes/<itemize>
7319 <item>The function is only available as fastcall function, so it may only
7320 be used in presence of a prototype.
7322 <tag/Availability/ISO 9899
7324 <ref id="strcspn" name="strcspn">,
7325 <ref id="strspn" name="strspn">
7331 <sect1>strtok<label id="strtok"><p>
7335 <tag/Function/Break a string into tokens.
7336 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7337 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
7338 <tag/Description/<tt/strtok()/ will break the string <tt/s1/ into a sequence of
7339 tokens, which are delimited by characters from the string <tt/s2/. The first call
7340 to <tt/strtok()/ will return a pointer to the first token in the string <tt/s1/.
7341 The following calls must pass a <tt/NULL/ pointer as <tt/s1/, in order to get
7342 the next token in the string. Different sets of delimiters may be used for the
7343 subsequent calls to <tt/strtok()/.
7344 <tag/Notes/<itemize>
7345 <item>The function is only available as fastcall function, so it may only
7346 be used in presence of a prototype.
7347 <item><tt/strtok()/ will modify the string <tt/s1/.
7348 <item>The function will forget where it is in the <tt/s1/ string if it is given
7349 a second <tt/s1/ string before it finishes the first one.
7351 <tag/Availability/ISO 9899
7353 <ref id="strcspn" name="strcspn">,
7354 <ref id="strpbrk" name="strpbrk">,
7355 <ref id="strqtok" name="strqtok">,
7356 <ref id="strspn" name="strspn">
7362 <sect1>strxfrm<label id="strxfrm"><p>
7366 <tag/Function/Transform a string.
7367 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7368 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
7369 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
7370 s2 and places the resulting string into the string pointed to by s1. The
7371 transformation is such that if the <tt/strcmp/ function is applied to two
7372 transformed strings, it returns a value greater than, equal to, or less than
7373 zero, corresponding to the result of the <tt/strcoll/ function applied to the
7374 same two original strings. No more than n characters are placed into the
7375 resulting array pointed to by s1, including the terminating null character.
7376 <tag/Notes/<itemize>
7377 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
7378 the behaviour is undefined.
7379 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
7380 <item>The function is only available as fastcall function, so it may only
7381 be used in presence of a prototype.
7382 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
7383 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
7385 <tag/Availability/ISO 9899
7387 <ref id="strcmp" name="strcmp">,
7388 <ref id="strcoll" name="strcoll">,
7389 <ref id="strncpy" name="strncpy">
7395 <sect1>strupper<label id="strupper"><p>
7399 <tag/Function/Make a string upper case.
7400 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7401 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
7402 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
7403 function to each character of a string. The function will always return <tt/s/.
7404 <tag/Notes/<itemize>
7405 <item>The function is only available as fastcall function, so it may only
7406 be used in presence of a prototype.
7407 <item>The function prototype is unavailable when compiling in strict ANSI mode.
7408 <item>An alias name for this function is <tt/strupr/.
7410 <tag/Availability/cc65
7412 <ref id="strlower" name="strlower">
7413 <ref id="toupper" name="toupper">
7419 <sect1>strupr<label id="strupr"><p>
7426 <sect1>telldir<label id="telldir"><p>
7430 <tag/Function/Return the current position of a directory stream.
7431 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
7432 <tag/Declaration/<tt/long __fastcall__ telldir (DIR* dir);/
7433 <tag/Description/<tt/telldir/ returns the current position of a directory
7434 stream. The return value may be used in subsequent calls to
7435 <tt/<ref id="seekdir" name="seekdir">/.
7436 <tag/Notes/<itemize>
7437 <item>The function is only available as fastcall function, so it may only
7438 be used in presence of a prototype.
7440 <tag/Availability/POSIX 1003.1
7442 <ref id="seekdir" name="seekdir">,
7443 <ref id="telldir" name="telldir">
7449 <sect1>textcolor<label id="textcolor"><p>
7453 <tag/Function/Set the text color.
7454 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7455 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
7456 <tag/Description/The function will set a new text color. It returns the old
7457 (current) text color. Text output using any <tt/conio.h/ function will use
7458 the color set by this function.
7459 <tag/Notes/<itemize>
7460 <item>Text colors are system dependent. The function may have no effect
7461 on systems where the text color cannot be changed.
7462 <item>The function is only available as fastcall function, so it may only
7463 be used in presence of a prototype.
7465 <tag/Availability/cc65
7467 <ref id="bgcolor" name="bgcolor">,
7468 <ref id="bordercolor" name="bordercolor">
7474 <sect1>time<label id="time"><p>
7478 <tag/Function/Get the time.
7479 <tag/Header/<tt/<ref id="time.h" name="time.h">/
7480 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
7481 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
7482 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
7483 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
7484 returned and an error code is stored in <tt/errno/.
7485 <tag/Notes/<itemize>
7486 <item>The function is only available as fastcall function, so it may
7487 only be used in presence of a prototype.
7488 <item>Many platforms supported by cc65 do not have a realtime clock, so the
7489 returned value may not be valid.
7491 <tag/Availability/ISO 9899
7493 <ref id="clock" name="clock">,
7494 <ref id="clock_gettime" name="clock_gettime">
7500 <sect1>toggle_videomode<label id="toggle_videomode"><p>
7504 <tag/Function/Toggle between 40 and 80 column mode.
7505 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
7506 <tag/Declaration/<tt/void toggle_videomode (void);/
7507 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
7508 old mode (cursor position, color and so on) are saved and restored together
7510 <tag/Notes/<itemize>
7511 <item>The function is specific to the C128.
7512 <item>This function is deprecated. Please use <ref id="videomode"
7513 name="videomode"> instead!
7515 <tag/Availability/C128
7517 <ref id="fast" name="fast">,
7518 <ref id="isfast" name="isfast">,
7519 <ref id="slow" name="slow">,
7520 <ref id="videomode" name="videomode">
7526 <sect1>tolower<label id="tolower"><p>
7530 <tag/Function/Convert a character into its lower case representation.
7531 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7532 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
7533 <tag/Description/The function returns the given character converted to lower
7534 case. If the given character is not a letter, it is returned unchanged.
7535 <tag/Notes/<itemize>
7536 <item>The function is only available as fastcall function, so it may
7537 only be used in presence of a prototype.
7539 <tag/Availability/ISO 9899
7541 <ref id="islower" name="islower">,
7542 <ref id="isupper" name="isupper">,
7543 <ref id="toupper" name="toupper">
7549 <sect1>toupper<label id="toupper"><p>
7553 <tag/Function/Convert a character into its upper case representation.
7554 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7555 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
7556 <tag/Description/The function returns the given character converted to upper
7557 case. If the given character is not a letter, it is returned unchanged.
7558 <tag/Notes/<itemize>
7559 <item>The function is only available as fastcall function, so it may
7560 only be used in presence of a prototype.
7562 <tag/Availability/ISO 9899
7564 <ref id="islower" name="islower">,
7565 <ref id="isupper" name="isupper">,
7566 <ref id="tolower" name="tolower">
7572 <sect1>ultoa<label id="ultoa"><p>
7576 <tag/Function/Convert an unsigned long integer into a string.
7577 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7578 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
7579 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
7580 string using <tt/radix/ as the base.
7581 <tag/Notes/<itemize>
7582 <item>There are no provisions to prevent a buffer overflow.
7583 <item>The function is non standard, so it is not available in strict ANSI mode.
7584 You should probably use <tt/sprintf/ instead.
7585 <item>The function is only available as fastcall function, so it may only be
7586 used in presence of a prototype.
7588 <tag/Availability/cc65
7590 <ref id="atoi" name="atoi">,
7591 <ref id="atol" name="atol">,
7592 <ref id="itoa" name="itoa">,
7593 <ref id="ltoa" name="ltoa">,
7594 <ref id="utoa" name="utoa">
7600 <sect1>unlink<label id="unlink"><p>
7604 <tag/Function/Delete a file.
7605 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
7606 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
7607 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
7608 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
7609 code describing the reason for the failure.
7610 <tag/Notes/<itemize>
7611 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
7612 name="remove">/ instead, which is a native ANSI C function and does the same.
7613 <item>This function is not available on all cc65 targets (depends on the
7614 availability of file I/O).
7615 <item>The function is only available as fastcall function, so it may only
7616 be used in presence of a prototype.
7617 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
7618 used, which has the same semantics, but is more portable, because it conforms
7619 to the ISO C standard.
7621 <tag/Availability/POSIX 1003.1
7623 <ref id="remove" name="remove">
7626 #include <stdio.h>
7627 #include <unistd.h>
7629 #define FILENAME "helloworld"
7631 if (unlink (FILENAME) == 0) {
7632 printf ("We deleted %s successfully\n", FILENAME);
7634 printf ("There was a problem deleting %s\n", FILENAME);
7641 <sect1>utoa<label id="utoa"><p>
7645 <tag/Function/Convert an unsigned integer into a string.
7646 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7647 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
7648 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
7649 using <tt/radix/ as the base.
7650 <tag/Notes/<itemize>
7651 <item>There are no provisions to prevent a buffer overflow.
7652 <item>The function is non standard, so it is not available in strict ANSI mode.
7653 You should probably use <tt/sprintf/ instead.
7654 <item>The function is only available as fastcall function, so it may only be
7655 used in presence of a prototype.
7657 <tag/Availability/cc65
7659 <ref id="atoi" name="atoi">,
7660 <ref id="atol" name="atol">,
7661 <ref id="itoa" name="itoa">,
7662 <ref id="ltoa" name="ltoa">,
7663 <ref id="ultoa" name="ultoa">
7669 <sect1>vcprintf<label id="vcprintf"><p>
7673 <tag/Function/Formatted output to the console.
7674 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7675 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
7676 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
7677 text where necessary and formatted according to the format string given. The
7678 resulting string is output to the console. <tt/vcprintf/ supports the same
7679 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
7680 <tag/Notes/<itemize>
7681 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
7682 between <tt/\r/ and <tt/\n/.
7683 <item>The function is only available as fastcall function, so it may only be
7684 used in presence of a prototype.
7686 <tag/Availability/cc65
7688 <ref id="cprintf" name="cprintf">,
7689 <ref id="cputc" name="cputc">,
7690 <ref id="cputcxy" name="cputcxy">,
7691 <ref id="cputs" name="cputs">,
7692 <ref id="cputsxy" name="cputsxy">
7698 <sect1>videomode<label id="videomode"><p>
7702 <tag/Function/Switch to either 40 or 80 column mode.
7703 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
7704 <ref id="c128.h" name="c128.h">/
7705 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
7706 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
7707 the requested mode is already active, nothing happens. The old mode is returned
7709 <tag/Notes/<itemize>
7710 <item>The function is specific to the C128 and enhanced Apple //e.
7711 <item>This function replaces <ref id="toggle_videomode"
7712 name="toggle_videomode">.
7713 <item>The function is only available as fastcall function, so it may only be
7714 used in presence of a prototype.
7716 <tag/Availability/C128 and enhanced Apple //e
7718 <ref id="fast" name="fast">,
7719 <ref id="isfast" name="isfast">,
7720 <ref id="slow" name="slow">,
7721 <ref id="toggle_videomode" name="toggle_videomode">
7727 <sect1>waitvsync<label id="waitvsync"><p>
7731 <tag/Function/Wait until the start of the next frame.
7733 <tt/<ref id="cbm.h" name="cbm.h">/,
7734 <tt/<ref id="gamate.h" name="gamate.h">/,
7735 <tt/<ref id="nes.h" name="nes.h">/,
7736 <tt/<ref id="pce.h" name="pce.h">/
7737 <tag/Declaration/<tt/void waitvsync (void);/
7738 <tag/Description/Wait for vertical sync to reduce flickering.
7739 <tag/Availability/Platforms above
7745 <sect1>wherex<label id="wherex"><p>
7749 <tag/Function/Return the current X position of the text mode cursor.
7750 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7751 <tag/Declaration/<tt/unsigned char wherex (void);/
7752 <tag/Description/The function returns the current X position of the text mode
7753 cursor. Zero is returned for the leftmost screen position.
7754 <tag/Availability/cc65
7756 <ref id="gotox" name="gotox">,
7757 <ref id="gotoy" name="gotoy">,
7758 <ref id="gotoxy" name="gotoxy">,
7759 <ref id="wherey" name="wherey">
7765 <sect1>wherey<label id="wherey"><p>
7769 <tag/Function/Return the current Y position of the text mode cursor.
7770 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7771 <tag/Declaration/<tt/unsigned char wherey (void);/
7772 <tag/Description/The function returns the current Y position of the text mode
7773 cursor. Zero is returned for the uppermost screen position.
7774 <tag/Availability/cc65
7776 <ref id="gotox" name="gotox">,
7777 <ref id="gotoy" name="gotoy">,
7778 <ref id="gotoxy" name="gotoxy">,
7779 <ref id="wherex" name="wherex">