1 <!doctype linuxdoc system> <!-- -*- text-mode -*- -->
4 <title>cc65 function reference
5 <author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
6 <url url="mailto:greg.king5@verizon.net" name="Greg King">
10 cc65 is a C compiler for 6502 based systems. This function reference describes
11 the C functions available in the standard library.
14 <!-- Table of contents -->
17 <!-- Begin the document -->
21 cc65 is a C compiler for 6502 based systems. It implements a subset of the ISO
22 C standard plus additional functions specially crafted for 6502 systems or
23 just some of the supported machines. This function refrence describes the
24 available functions together with any limitations.
26 For an overview about the available libraries, their purpose, and any
27 differences to the ISO standard, please have a look at the <url
28 url="library.html" name="cc65 Library Overview">.
30 <em/Note:/ Standard C functions are listed here, but not described in detail.
31 Since these functions behave identical on all standard compliant systems, they
32 are described in any book covering standard C.
34 Each entry for a function contains a detailed description
38 <tag/Function/Summary of what <bf/function/ does.
39 <tag/Header/The header file that contains the declaration.
40 <tag/Declaration/Describes the needed header files and declaration of the
42 <tag/Description/Description of the function.
43 <tag/Notes/Notes on the function.
44 <tag/Availability/The availability of the function.
45 <tag/See also/Other related functions.
46 <tag/Example/A piece of actual code using the function.
51 <sect>Functions by header file<p>
53 <sect1><tt/6502.h/<label id="6502.h"><p>
56 <item><ref id="BRK" name="BRK">
57 <item><ref id="CLI" name="CLI">
58 <item><ref id="SEI" name="SEI">
59 <item><ref id="_sys" name="_sys">
60 <item><ref id="getcpu" name="getcpu">
61 <item><ref id="reset_brk" name="reset_brk">
62 <item><ref id="reset_irq" name="reset_irq">
63 <item><ref id="set_brk" name="set_brk">
64 <item><ref id="set_irq" name="set_irq">
68 <sect1><tt/accelerator.h/<label id="accelerator.h"><p>
71 <item><ref id="detect_c128" name="detect_c128">
72 <item><ref id="detect_c64dtv" name="detect_c64dtv">
73 <item><ref id="detect_c65" name="detect_c65">
74 <item><ref id="detect_chameleon" name="detect_chameleon">
75 <item><ref id="detect_scpu" name="detect_scpu">
76 <item><ref id="detect_turbomaster" name="detect_turbomaster">
77 <item><ref id="get_c128_speed" name="get_c128_speed">
78 <item><ref id="get_c64dtv_speed" name="get_c64dtv_speed">
79 <item><ref id="get_c65_speed" name="get_c65_speed">
80 <item><ref id="get_chameleon_speed" name="get_chameleon_speed">
81 <item><ref id="get_scpu_speed" name="get_scpu_speed">
82 <item><ref id="get_turbomaster_speed" name="get_turbomaster_speed">
83 <item><ref id="set_c128_speed" name="set_c128_speed">
84 <item><ref id="set_c64dtv_speed" name="set_c64dtv_speed">
85 <item><ref id="set_c65_speed" name="set_c65_speed">
86 <item><ref id="set_chameleon_speed" name="set_chameleon_speed">
87 <item><ref id="set_scpu_speed" name="set_scpu_speed">
88 <item><ref id="set_turbomaster_speed" name="set_turbomaster_speed">
92 <sect1><tt/apple2.h/<label id="apple2.h"><p>
96 <item><ref id="get_ostype" name="get_ostype">
101 <sect1><tt/apple2enh.h/<label id="apple2enh.h"><p>
105 <item><ref id="get_ostype" name="get_ostype">
106 <item>rebootafterexit
107 <item><ref id="videomode" name="videomode">
111 <sect1><tt/assert.h/<label id="assert.h"><p>
114 <item><ref id="assert" name="assert">
118 <sect1><tt/atari.h/<label id="atari.h"><p>
121 <!-- <item><ref id="_getcolor" name="_getcolor"> -->
122 <!-- <item><ref id="_getdefdev" name="_getdefdev"> -->
123 <!-- <item><ref id="_graphics" name="_graphics"> -->
124 <item><ref id="_is_cmdline_dos" name="_is_cmdline_dos">
125 <!-- <item><ref id="_rest_vecs" name="_rest_vecs"> -->
126 <!-- <item><ref id="_save_vecs" name="_save_vecs"> -->
127 <!-- <item><ref id="_scroll" name="_scroll"> -->
128 <!-- <item><ref id="_setcolor" name="_setcolor"> -->
129 <!-- <item><ref id="_setcolor_low" name="_setcolor_low"> -->
130 <item><ref id="get_ostype" name="get_ostype">
131 <!-- <item><ref id="get_tv" name="get_tv"> -->
137 <sect1><tt/atmos.h/<label id="atmos.h"><p>
140 <item><ref id="atmos_explode" name="atmos_explode">
141 <item><ref id="atmos_load" name="atmos_load">
142 <item><ref id="atmos_ping" name="atmos_ping">
143 <item><ref id="atmos_save" name="atmos_save">
144 <item><ref id="atmos_shoot" name="atmos_shoot">
145 <item><ref id="atmos_tick" name="atmos_tick">
146 <item><ref id="atmos_tock" name="atmos_tock">
147 <item><ref id="atmos_zap" name="atmos_zap">
151 <sect1><tt/c128.h/<label id="c128.h"><p>
154 <item><ref id="c64mode" name="c64mode">
155 <item><ref id="fast" name="fast">
156 <item><ref id="isfast" name="isfast">
157 <item><ref id="slow" name="slow">
158 <item><ref id="toggle_videomode" name="toggle_videomode">
159 <item><ref id="videomode" name="videomode">
163 <sect1><tt/c16.h/<label id="c16.h"><p>
166 <item><ref id="fast" name="fast">
167 <item><ref id="isfast" name="isfast">
168 <item><ref id="slow" name="slow">
174 <sect1><tt/c64.h/<label id="c64.h"><p>
177 <item><ref id="get_ostype" name="get_ostype">
181 <sect1><tt/cbm.h/<label id="cbm.h"><p>
184 <item><ref id="cbm_k_acptr" name="cbm_k_acptr">
185 <item><ref id="cbm_k_basin" name="cbm_k_basin">
186 <item><ref id="cbm_k_bsout" name="cbm_k_bsout">
187 <item><ref id="cbm_k_chkin" name="cbm_k_chkin">
188 <item><ref id="cbm_k_ciout" name="cbm_k_ciout">
189 <item><ref id="cbm_k_ckout" name="cbm_k_ckout">
190 <item><ref id="cbm_k_clall" name="cbm_k_clall">
191 <item><ref id="cbm_k_close" name="cbm_k_close">
192 <item><ref id="cbm_k_clrch" name="cbm_k_clrch">
193 <item><ref id="cbm_k_getin" name="cbm_k_getin">
194 <item><ref id="cbm_k_iobase" name="cbm_k_iobase">
195 <item><ref id="cbm_k_listen" name="cbm_k_listen">
196 <item><ref id="cbm_k_load" name="cbm_k_load">
197 <item><ref id="cbm_k_open" name="cbm_k_open">
198 <item><ref id="cbm_k_readst" name="cbm_k_readst">
199 <item><ref id="cbm_k_save" name="cbm_k_save">
200 <item><ref id="cbm_k_scnkey" name="cbm_k_scnkey">
201 <item><ref id="cbm_k_second" name="cbm_k_second">
202 <item><ref id="cbm_k_setlfs" name="cbm_k_setlfs">
203 <item><ref id="cbm_k_setnam" name="cbm_k_setnam">
204 <item><ref id="cbm_k_talk" name="cbm_k_talk">
205 <item><ref id="cbm_k_tksa" name="cbm_k_tksa">
206 <item><ref id="cbm_k_udtim" name="cbm_k_udtim">
207 <item><ref id="cbm_k_unlsn" name="cbm_k_unlsn">
208 <item><ref id="cbm_k_untlk" name="cbm_k_untlk">
209 <!-- <item><ref id="cbm_load" name="cbm_load"> -->
210 <!-- <item><ref id="cbm_open" name="cbm_open"> -->
211 <!-- <item><ref id="cbm_opendir" name="cbm_opendir"> -->
212 <!-- <item><ref id="cbm_read" name="cbm_read"> -->
213 <!-- <item><ref id="cbm_readdir" name="cbm_readdir"> -->
214 <!-- <item><ref id="cbm_save" name="cbm_save"> -->
215 <!-- <item><ref id="cbm_write" name="cbm_write"> -->
216 <!-- <item><ref id="get_tv" name="get_tv"> -->
217 <item><ref id="waitvsync" name="waitvsync">
218 <item><ref id="kbrepeat" name="kbrepeat">
224 <sect1><tt/cbm510.h/<label id="cbm510.h"><p>
227 <item><ref id="peekbsys" name="peekbsys">
228 <item><ref id="peekwsys" name="peekwsys">
229 <item><ref id="pokebsys" name="pokebsys">
230 <item><ref id="pokewsys" name="pokewsys">
234 <sect1><tt/cbm610.h/<label id="cbm610.h"><p>
237 <item><ref id="peekbsys" name="peekbsys">
238 <item><ref id="peekwsys" name="peekwsys">
239 <item><ref id="pokebsys" name="pokebsys">
240 <item><ref id="pokewsys" name="pokewsys">
244 <sect1><tt/cc65.h/<label id="cc65.h"><p>
247 <!-- <item><ref id="cc65_cos" name="cc65_cos"> -->
248 <!-- <item><ref id="cc65_idiv32by16r16" name="cc65_idiv32by16r16"> -->
249 <!-- <item><ref id="cc65_imul16x16r32" name="cc65_imul16x16r32"> -->
250 <!-- <item><ref id="cc65_imul8x8r16" name="cc65_imul8x8r16"> -->
251 <!-- <item><ref id="cc65_sin" name="cc65_sin"> -->
252 <!-- <item><ref id="cc65_udiv32by16r16" name="cc65_udiv32by16r16"> -->
253 <!-- <item><ref id="cc65_umul16x16r32" name="cc65_umul16x16r32"> -->
254 <!-- <item><ref id="cc65_umul16x8r32" name="cc65_umul16x8r32"> -->
255 <!-- <item><ref id="cc65_umul8x8r16" name="cc65_umul8x8r16"> -->
256 <item><ref id="doesclrscrafterexit" name="doesclrscrafterexit">
262 <sect1><tt/conio.h/<label id="conio.h"><p>
265 <item><ref id="bgcolor" name="bgcolor">
266 <item><ref id="bordercolor" name="bordercolor">
267 <item><ref id="cclear" name="cclear">
268 <item><ref id="cclearxy" name="cclearxy">
269 <item><ref id="cgetc" name="cgetc">
270 <item><ref id="chline" name="chline">
271 <item><ref id="chlinexy" name="chlinexy">
272 <item><ref id="clrscr" name="clrscr">
273 <item><ref id="cpeekc" name="cpeekc">
274 <item><ref id="cpeekcolor" name="cpeekcolor">
275 <item><ref id="cpeekrevers" name="cpeekrevers">
276 <item><ref id="cpeeks" name="cpeeks">
277 <item><ref id="cprintf" name="cprintf">
278 <item><ref id="cputc" name="cputc">
279 <item><ref id="cputcxy" name="cputcxy">
280 <item><ref id="cputs" name="cputs">
281 <item><ref id="cputsxy" name="cputsxy">
282 <item><ref id="cursor" name="cursor">
283 <item><ref id="cvline" name="cvline">
284 <item><ref id="cvlinexy" name="cvlinexy">
285 <item><ref id="gotox" name="gotox">
286 <item><ref id="gotoxy" name="gotoxy">
287 <item><ref id="gotoy" name="gotoy">
288 <item><ref id="kbhit" name="kbhit">
289 <item><ref id="revers" name="revers">
290 <item><ref id="screensize" name="screensize">
291 <item><ref id="textcolor" name="textcolor">
292 <item><ref id="vcprintf" name="vcprintf">
293 <item><ref id="wherex" name="wherex">
294 <item><ref id="wherey" name="wherey">
298 <sect1><tt/ctype.h/<label id="ctype.h"><p>
301 <item><ref id="isalnum" name="isalnum">
302 <item><ref id="isalpha" name="isalpha">
303 <item><ref id="isascii" name="isascii">
304 <item><ref id="isblank" name="isblank">
305 <item><ref id="iscntrl" name="iscntrl">
306 <item><ref id="isdigit" name="isdigit">
307 <item><ref id="isgraph" name="isgraph">
308 <item><ref id="islower" name="islower">
309 <item><ref id="isprint" name="isprint">
310 <item><ref id="ispunct" name="ispunct">
311 <item><ref id="isspace" name="isspace">
312 <item><ref id="isupper" name="isupper">
313 <item><ref id="isxdigit" name="isxdigit">
314 <item><ref id="tolower" name="tolower">
315 <item><ref id="toupper" name="toupper">
319 <sect1><tt/dbg.h/<label id="dbg.h"><p>
322 <!-- <item><ref id="DbgInit" name="DbgInit"> -->
328 <sect1><tt/device.h/<label id="device.h"><p>
331 <item><ref id="getcurrentdevice" name="getcurrentdevice">
332 <item><ref id="getdevicedir" name="getdevicedir">
333 <item><ref id="getfirstdevice" name="getfirstdevice">
334 <item><ref id="getnextdevice" name="getnextdevice">
338 <sect1><tt/dio.h/<label id="dio.h"><p>
340 <url url="dio.html" name="Low-level disk I/O API">.
343 <sect1><tt/dirent.h/<label id="dirent.h"><p>
346 <item><ref id="_DE_ISDIR" name="_DE_ISDIR">
347 <item><ref id="_DE_ISLBL" name="_DE_ISLBL">
348 <item><ref id="_DE_ISLNK" name="_DE_ISLNK">
349 <item><ref id="_DE_ISREG" name="_DE_ISREG">
350 <item><ref id="closedir" name="closedir">
351 <item><ref id="opendir" name="opendir">
352 <item><ref id="readdir" name="readdir">
353 <item><ref id="rewinddir" name="rewinddir">
354 <item><ref id="seekdir" name="seekdir">
355 <item><ref id="telldir" name="telldir">
359 <sect1><tt/em.h/<label id="em.h"><p>
361 This header file contains definitions for extended memory access,
362 see also <tt>testcode/lib/em-test.c</tt> and <tt>samples/multidemo.c</tt>.
365 <item><ref id="em_commit" name="em_commit">
366 <item><ref id="em_copyfrom" name="em_copyfrom">
367 <item><ref id="em_copyto" name="em_copyto">
368 <item><ref id="em_install" name="em_install">
369 <item><ref id="em_load_driver" name="em_load_driver">
370 <item><ref id="em_map" name="em_map">
371 <item><ref id="em_pagecount" name="em_pagecount">
372 <item><ref id="em_uninstall" name="em_uninstall">
373 <item><ref id="em_unload" name="em_unload">
374 <item><ref id="em_use" name="em_use">
378 <sect1><tt/errno.h/<label id="errno.h"><p>
381 <!-- <item><ref id="_directerrno" name="_directerrno"> -->
382 <!-- <item><ref id="_mappederrno" name="_mappederrno"> -->
383 <!-- <item><ref id="_osmaperrno" name="_osmaperrno"> -->
384 <!-- <item><ref id="_seterrno" name="_seterrno"> -->
390 <sect1><tt/fcntl.h/<label id="fcntl.h"><p>
393 <item><ref id="close" name="close">
394 <item><ref id="creat" name="creat">
395 <item><ref id="open" name="open">
399 <sect1><tt/gamate.h/<label id="gamate.h"><p>
402 <!-- <item><ref id="get_tv" name="get_tv"> -->
403 <item><ref id="waitvsync" name="waitvsync">
409 <sect1><tt/geos.h/<label id="geos.h"><p>
411 <url url="geos.html" name="GEOS API">.
414 <sect1><tt/joystick.h/<label id="joystick.h"><p>
417 <item><ref id="joy_count" name="joy_count">
418 <item><ref id="joy_install" name="joy_install">
419 <item><ref id="joy_load_driver" name="joy_load_driver">
420 <item><ref id="joy_read" name="joy_read">
421 <item><ref id="joy_uninstall" name="joy_uninstall">
422 <item><ref id="joy_unload" name="joy_unload">
426 <sect1><tt/locale.h/<label id="locale.h"><p>
429 <item><ref id="localeconv" name="localeconv">
430 <item><ref id="setlocale" name="setlocale">
434 <sect1><tt/lynx.h/<label id="lynx.h"><p>
437 <!-- <item><ref id="lynx_eeprom_erase" name="lynx_eeprom_erase"> -->
438 <!-- <item><ref id="lynx_eeprom_read" name="lynx_eeprom_read"> -->
439 <!-- <item><ref id="lynx_eeprom_write" name="lynx_eeprom_write"> -->
440 <!-- <item><ref id="lynx_eeread" name="lynx_eeread"> -->
441 <!-- <item><ref id="lynx_eewrite" name="lynx_eewrite"> -->
442 <!-- <item><ref id="lynx_exec" name="lynx_exec"> -->
443 <!-- <item><ref id="lynx_load" name="lynx_load"> -->
449 <sect1><tt/lz4.h/<label id="lz4.h"><p>
452 <item><ref id="decompress_lz4" name="decompress_lz4">
456 <sect1><tt/modload.h/<label id="modload.h"><p>
459 <item><ref id="mod_load" name="mod_load">
460 <item><ref id="mod_free" name="mod_free">
464 <sect1><tt/mouse.h/<label id="mouse.h"><p>
467 <item><ref id="mouse_buttons" name="mouse_buttons">
468 <item><ref id="mouse_getbox" name="mouse_getbox">
469 <item><ref id="mouse_geterrormsg" name="mouse_geterrormsg">
470 <item><ref id="mouse_hide" name="mouse_hide">
471 <item><ref id="mouse_info" name="mouse_info">
472 <item><ref id="mouse_install" name="mouse_install">
473 <item><ref id="mouse_ioctl" name="mouse_ioctl">
474 <item><ref id="mouse_load_driver" name="mouse_load_driver">
475 <item><ref id="mouse_move" name="mouse_move">
476 <item><ref id="mouse_pos" name="mouse_pos">
477 <item><ref id="mouse_setbox" name="mouse_setbox">
478 <item><ref id="mouse_show" name="mouse_show">
479 <item><ref id="mouse_uninstall" name="mouse_uninstall">
480 <item><ref id="mouse_unload" name="mouse_unload">
484 <sect1><tt/nes.h/<label id="nes.h"><p>
487 <!-- <item><ref id="get_tv" name="get_tv"> -->
488 <item><ref id="waitvsync" name="waitvsync">
494 <sect1><tt/o65.h/<label id="o65.h"><p>
496 The <tt/o65.h/ header file contains structure and constant definitions that
497 may be used when dealing with files in <url
498 url="http://www.6502.org/users/andre/o65/fileformat.html" name="the o65 format">.
499 It does not declare any functions.
502 <sect1><tt/pce.h/<label id="pce.h"><p>
505 <!-- <item><ref id="get_tv" name="get_tv"> -->
506 <item><ref id="waitvsync" name="waitvsync">
512 <sect1><tt/peekpoke.h/<label id="peekpoke.h"><p>
515 <item><ref id="PEEK" name="PEEK">
516 <item><ref id="PEEKW" name="PEEKW">
517 <item><ref id="POKE" name="POKE">
518 <item><ref id="POKEW" name="POKEW">
522 <sect1><tt/pen.h/<label id="pen.h"><p>
525 <!-- <item><ref id="pen_adjust" name="pen_adjust"> -->
526 <!-- <item><ref id="pen_calibrate" name="pen_calibrate"> -->
532 <sect1><tt/pet.h/<label id="pet.h"><p>
537 <sect1><tt/plus4.h/<label id="plus4.h"><p>
540 <item><ref id="fast" name="fast">
541 <item><ref id="isfast" name="isfast">
542 <item><ref id="slow" name="slow">
548 <sect1><tt/serial.h/<label id="serial.h"><p>
550 This header file contains definitions for initializing serial
551 communication, see also <tt>testcode/lib/ser-test.c</tt>.
554 <item><ref id="ser_close" name="ser_close">
555 <item><ref id="ser_get" name="ser_get">
556 <item><ref id="ser_install" name="ser_install">
557 <item><ref id="ser_ioctl" name="ser_ioctl">
558 <item><ref id="ser_load_driver" name="ser_load_driver">
559 <item><ref id="ser_open" name="ser_open">
560 <item><ref id="ser_put" name="ser_put">
561 <item><ref id="ser_status" name="ser_status">
562 <item><ref id="ser_uninstall" name="ser_uninstall">
563 <item><ref id="ser_unload" name="ser_unload">
567 <sect1><tt/setjmp.h/<label id="setjmp.h"><p>
570 <item><ref id="setjmp" name="setjmp">
571 <item><ref id="longjmp" name="longjmp">
575 <sect1><tt/signal.h/<label id="signal.h"><p>
578 <item><ref id="raise" name="raise">
579 <item><ref id="signal" name="signal">
583 <sect1><tt/stdarg.h/<label id="stdarg.h"><p>
588 <sect1><tt/stdbool.h/<label id="stdbool.h"><p>
593 <sect1><tt/stddef.h/<label id="stddef.h"><p>
596 <item><ref id="offsetof" name="offsetof">
600 <sect1><tt/stdio.h/<label id="stdio.h"><p>
603 <item><ref id="_poserror" name="_poserror">
604 <item><ref id="clearerr" name="clearerr">
605 <!-- <item><ref id="fclose" name="fclose"> -->
606 <!-- <item><ref id="fdopen" name="fdopen"> -->
607 <item><ref id="feof" name="feof">
608 <item><ref id="ferror" name="ferror">
609 <!-- <item><ref id="fflush" name="fflush"> -->
610 <!-- <item><ref id="fgetc" name="fgetc"> -->
611 <!-- <item><ref id="fgetpos" name="fgetpos"> -->
612 <!-- <item><ref id="fgets" name="fgets"> -->
613 <item><ref id="fileno" name="fileno">
614 <!-- <item><ref id="fopen" name="fopen"> -->
615 <!-- <item><ref id="fprintf" name="fprintf"> -->
616 <!-- <item><ref id="fputc" name="fputc"> -->
617 <!-- <item><ref id="fputs" name="fputs"> -->
618 <!-- <item><ref id="fread" name="fread"> -->
619 <!-- <item><ref id="freopen" name="freopen"> -->
620 <!-- <item><ref id="fscanf" name="fscanf"> -->
621 <!-- <item><ref id="fseek" name="fseek"> -->
622 <!-- <item><ref id="fsetpos" name="fsetpos"> -->
623 <!-- <item><ref id="ftell" name="ftell"> -->
624 <!-- <item><ref id="fwrite" name="fwrite"> -->
625 <!-- <item><ref id="getc" name="getc"> -->
626 <!-- <item><ref id="getchar" name="getchar"> -->
627 <!-- <item><ref id="gets" name="gets"> -->
628 <!-- <item><ref id="printf" name="printf"> -->
629 <!-- <item><ref id="putc" name="putc"> -->
630 <!-- <item><ref id="putchar" name="putchar"> -->
631 <!-- <item><ref id="puts" name="puts"> -->
632 <item><ref id="rename" name="rename">
633 <item><ref id="remove" name="remove">
634 <!-- <item><ref id="rewind" name="rewind"> -->
635 <!-- <item><ref id="scanf" name="scanf"> -->
636 <!-- <item><ref id="snprintf" name="snprintf"> -->
637 <!-- <item><ref id="sprintf" name="sprintf"> -->
638 <!-- <item><ref id="sscanf" name="sscanf"> -->
639 <!-- <item><ref id="vfprintf" name="vfprintf"> -->
640 <!-- <item><ref id="vfscanf" name="vfscanf"> -->
641 <!-- <item><ref id="vprintf" name="vprintf"> -->
642 <!-- <item><ref id="vscanf" name="vscanf"> -->
643 <!-- <item><ref id="vsnprintf" name="vsnprintf"> -->
644 <!-- <item><ref id="vsprintf" name="vsprintf"> -->
645 <!-- <item><ref id="vsscanf" name="vsscanf"> -->
651 <sect1><tt/stdlib.h/<label id="stdlib.h"><p>
654 <item><ref id="_heapadd" name="_heapadd">
655 <item><ref id="_heapblocksize" name="_heapblocksize">
656 <item><ref id="_heapmaxavail" name="_heapmaxavail">
657 <item><ref id="_heapmemavail" name="_heapmemavail">
658 <item><ref id="_randomize" name="_randomize">
659 <item><ref id="_swap" name="_swap">
660 <item><ref id="abort" name="abort">
661 <item><ref id="abs" name="abs">
662 <item><ref id="atexit" name="atexit">
663 <item><ref id="atoi" name="atoi">
664 <item><ref id="atol" name="atol">
665 <item><ref id="bsearch" name="bsearch">
666 <item><ref id="calloc" name="calloc">
667 <item><ref id="div" name="div">
668 <item><ref id="exit" name="exit">
669 <item><ref id="free" name="free">
670 <item><ref id="getenv" name="getenv">
671 <item><ref id="itoa" name="itoa">
672 <item><ref id="labs" name="labs">
673 <item><ref id="ltoa" name="ltoa">
674 <item><ref id="malloc" name="malloc">
675 <item><ref id="perror" name="perror">
676 <!-- <item><ref id="posix_memalign" name="posix_memalign"> -->
677 <!-- <item><ref id="putenv" name="putenv"> -->
678 <item><ref id="qsort" name="qsort">
679 <item><ref id="rand" name="rand">
680 <item><ref id="realloc" name="realloc">
681 <item><ref id="srand" name="srand">
682 <!-- <item><ref id="system" name="system"> -->
683 <item><ref id="ultoa" name="ultoa">
684 <item><ref id="utoa" name="utoa">
690 <sect1><tt/string.h/<label id="string.h"><p>
693 <item><ref id="_stroserror" name="_stroserror">
694 <item><ref id="bzero" name="bzero">
695 <item><ref id="memchr" name="memchr">
696 <item><ref id="memcmp" name="memcmp">
697 <item><ref id="memcpy" name="memcpy">
698 <item><ref id="memmove" name="memmove">
699 <item><ref id="memset" name="memset">
700 <item><ref id="strcasecmp" name="strcasecmp">
701 <item><ref id="strcat" name="strcat">
702 <item><ref id="strchr" name="strchr">
703 <item><ref id="strcmp" name="strcmp">
704 <item><ref id="strcoll" name="strcoll">
705 <item><ref id="strcpy" name="strcpy">
706 <item><ref id="strcspn" name="strcspn">
707 <item><ref id="strdup" name="strdup">
708 <item><ref id="strerror" name="strerror">
709 <item><ref id="stricmp" name="stricmp">
710 <item><ref id="strlen" name="strlen">
711 <item><ref id="strlower" name="strlower">
712 <item><ref id="strlwr" name="strlwr">
713 <item><ref id="strncasecmp" name="strncasecmp">
714 <item><ref id="strncat" name="strncat">
715 <item><ref id="strncmp" name="strncmp">
716 <item><ref id="strncpy" name="strncpy">
717 <item><ref id="strnicmp" name="strnicmp">
718 <item><ref id="strpbrk" name="strpbrk">
719 <item><ref id="strqtok" name="strqtok">
720 <item><ref id="strrchr" name="strrchr">
721 <item><ref id="strspn" name="strspn">
722 <item><ref id="strstr" name="strstr">
723 <item><ref id="strtok" name="strtok">
724 <item><ref id="strxfrm" name="strxfrm">
725 <item><ref id="strupper" name="strupper">
726 <item><ref id="strupr" name="strupr">
730 <sect1><tt/telestrat.h/<label id="telestrat.h"><p>
733 <item><ref id="atmos_explode" name="explode">
734 <item><ref id="atmos_ping" name="ping">
735 <item><ref id="atmos_shoot" name="shoot">
736 <item><ref id="atmos_zap" name="zap">
737 <!-- <item><ref id="kbdclick1" name="kbdclick1"> -->
738 <!-- <item><ref id="oups" name="oups"> -->
744 <sect1><tt/tgi.h/<label id="tgi.h"><p>
746 <url url="tgi.html" name="Tiny Graphics Interface">.
749 <sect1><tt/time.h/<label id="time.h"><p>
752 <!-- <item><ref id="_systime" name="_systime"> -->
753 <!-- <item><ref id="asctime" name="asctime"> -->
754 <item><ref id="clock" name="clock">
755 <!-- <item><ref id="ctime" name="ctime"> -->
756 <!-- <item><ref id="gmtime" name="gmtime"> -->
757 <!-- <item><ref id="localtime" name="localtime"> -->
758 <!-- <item><ref id="mktime" name="mktime"> -->
759 <!-- <item><ref id="strftime" name="strftime"> -->
760 <item><ref id="time" name="time">
766 <sect1><tt/unistd.h/<label id="unistd.h"><p>
769 <!-- <item><ref id="chdir" name="chdir"> -->
770 <item><ref id="exec" name="exec">
771 <item><ref id="getcwd" name="getcwd">
772 <item><ref id="getopt" name="getopt">
773 <!-- <item><ref id="lseek" name="lseek"> -->
774 <!-- <item><ref id="mkdir" name="mkdir"> -->
775 <!-- <item><ref id="read" name="read"> -->
776 <!-- <item><ref id="rmdir" name="rmdir"> -->
777 <item><ref id="sleep" name="sleep">
778 <item><ref id="unlink" name="unlink">
779 <!-- <item><ref id="write" name="write"> -->
785 <sect1><tt/vic20.h/<label id="vic20.h"><p>
790 <sect1><tt/zlib.h/<label id="zlib.h"><p>
793 <!-- <item><ref id="adler32" name="adler32"> -->
794 <!-- <item><ref id="crc32" name="crc32"> -->
795 <!-- <item><ref id="inflatemem" name="inflatemem"> -->
796 <!-- <item><ref id="uncompress" name="uncompress"> -->
802 <sect>Alphabetical function reference<p>
804 <sect1>_DE_ISDIR<label id="_DE_ISDIR"><p>
808 <tag/Function/Determine if a directory entry specifies a directory.
809 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
810 <tag/Declaration/<tt/int _DE_ISDIR(unsigned char type);/
811 <tag/Description/The function is called with the type of a directory entry
812 taken from a <tt/struct dirent/ and returns true if the entry designates
815 <item>The function is actually a macro.
817 <tag/Availability/cc65
819 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
820 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
821 <ref id="_DE_ISREG" name="_DE_ISREG">
827 <sect1>_DE_ISLBL<label id="_DE_ISLBL"><p>
831 <tag/Function/Determine if a directory entry specifies a disk label.
832 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
833 <tag/Declaration/<tt/int _DE_ISLBL(unsigned char type);/
834 <tag/Description/The function is called with the type of a directory entry
835 taken from a <tt/struct dirent/ and returns true if the entry designates
838 <item>The function is actually a macro.
840 <tag/Availability/cc65
842 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
843 <ref id="_DE_ISLNK" name="_DE_ISLNK">,
844 <ref id="_DE_ISREG" name="_DE_ISREG">
850 <sect1>_DE_ISLNK<label id="_DE_ISLNK"><p>
854 <tag/Function/Determine if a directory entry specifies a link.
855 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
856 <tag/Declaration/<tt/int _DE_ISLNK(unsigned char type);/
857 <tag/Description/The function is called with the type of a directory entry
858 taken from a <tt/struct dirent/ and returns true if the entry designates
861 <item>The function is actually a macro.
863 <tag/Availability/cc65
865 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
866 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
867 <ref id="_DE_ISREG" name="_DE_ISREG">
873 <sect1>_DE_ISREG<label id="_DE_ISREG"><p>
877 <tag/Function/Determine if a directory entry specifies a regular file.
878 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
879 <tag/Declaration/<tt/int _DE_ISREG(unsigned char type);/
880 <tag/Description/The function is called with the type of a directory entry
881 taken from a <tt/struct dirent/ and returns true if the entry designates
884 <item>The function is actually a macro.
885 <item>A "regular file" means anything with data in it. This might still mean
886 that special processing is needed, when accessing the file. Relative files of
887 the CBM systems are classified as being "regular" files, for example.
889 <tag/Availability/cc65
891 <ref id="_DE_ISDIR" name="_DE_ISDIR">,
892 <ref id="_DE_ISLBL" name="_DE_ISLBL">,
893 <ref id="_DE_ISLNK" name="_DE_ISLNK">
899 <sect1>_heapadd<label id="_heapadd"><p>
903 <tag/Function/Add a block to the heap.
904 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
905 <tag/Declaration/<tt/void __fastcall__ _heapadd (void* mem, size_t size);/
906 <tag/Description/The function adds a block of raw memory to the heap.
908 <item>The minimum blocksize that can be added is 6 bytes; the function will
909 ignore smaller blocks.
910 <item>The function is available only as a fastcall function; so, it may be used
911 only in the presence of a prototype.
913 <tag/Availability/cc65
915 <ref id="_heapblocksize" name="_heapblocksize">,
916 <ref id="_heapmaxavail" name="_heapmaxavail">,
917 <ref id="_heapmemavail" name="_heapmemavail">,
918 <ref id="calloc" name="calloc">,
919 <ref id="free" name="free">,
920 <ref id="malloc" name="malloc">,
921 <ref id="realloc" name="realloc">
927 <sect1>_heapblocksize<label id="_heapblocksize"><p>
931 <tag/Function/Return the size of an allocated block.
932 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
933 <tag/Declaration/<tt/size_t __fastcall__ _heapblocksize (const void* block);/
934 <tag/Description/The function returns the size of a block that must have
935 previously been allocated by <tt/<ref id="malloc" name="malloc">/, <tt/<ref
936 id="calloc" name="calloc">/ or <tt/<ref id="realloc" name="realloc">/.
938 <item>Passing a pointer to a block that was is not the result of one of the
939 allocation functions, or that has been free'd will give unpredicable results.
940 <item>The function is available only as a fastcall function; so, it may be used
941 only in the presence of a prototype.
943 <tag/Availability/cc65
945 <ref id="_heapadd" name="_heapadd">,
946 <ref id="_heapmaxavail" name="_heapmaxavail">,
947 <ref id="_heapmemavail" name="_heapmemavail">,
948 <ref id="calloc" name="calloc">,
949 <ref id="free" name="free">,
950 <ref id="malloc" name="malloc">,
951 <ref id="realloc" name="realloc">
957 <sect1>_heapmaxavail<label id="_heapmaxavail"><p>
961 <tag/Function/Return the largest block that is available on the heap.
962 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
963 <tag/Declaration/<tt/size_t _heapmaxavail (void);/
964 <tag/Description/The function returns the size of the largest block that may
965 be allocated from the heap using <tt/<ref id="malloc" name="malloc">/.
966 <tag/Availability/cc65
968 <ref id="_heapadd" name="_heapadd">,
969 <ref id="_heapblocksize" name="_heapblocksize">,
970 <ref id="_heapmemavail" name="_heapmemavail">,
971 <ref id="calloc" name="calloc">,
972 <ref id="free" name="free">,
973 <ref id="malloc" name="malloc">,
974 <ref id="realloc" name="realloc">
980 <sect1>_heapmemavail<label id="_heapmemavail"><p>
984 <tag/Function/Return the total available space on the heap.
985 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
986 <tag/Declaration/<tt/size_t _heapmemavail (void);/
987 <tag/Description/The function returns the total number of bytes available on
990 <item>This function is of less use than usually assumed, since the returned
991 heap space may be available but not in one block. So even if this function
992 says that several times more heap space is available than needed, <ref
993 id="malloc" name="malloc"> may still return <tt/NULL/.
995 <tag/Availability/cc65
997 <ref id="_heapadd" name="_heapadd">,
998 <ref id="_heapblocksize" name="_heapblocksize">,
999 <ref id="_heapmaxavail" name="_heapmaxavail">,
1000 <ref id="calloc" name="calloc">,
1001 <ref id="free" name="free">,
1002 <ref id="malloc" name="malloc">,
1003 <ref id="realloc" name="realloc">
1009 <sect1>_is_cmdline_dos<label id="_is_cmdline_dos"><p>
1013 <tag/Function/Determines whether the underlying DOS supports command line arguments.
1014 <tag/Header/<tt/<ref id="atari.h" name="atari.h">/
1015 <tag/Declaration/<tt/unsigned char _is_cmdline_dos (void);/
1016 <tag/Description/The function returns 0 if the DOS doesn't support command line arguments.
1017 It returns 1 if it does.
1018 <tag/Availability/cc65 (<tt/atari/ and <tt/atarixl/ platforms)
1023 <sect1>_poserror<label id="_poserror"><p>
1027 <tag/Function/Print an error message for the error in <tt/_oserror/.
1028 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
1029 <tag/Declaration/<tt/void __fastcall__ _poserror (const char* msg);/
1030 <tag/Description/<tt/_poserror/ prints an error message to <tt/stderr/. If
1031 <tt/msg/ is not <tt/NULL/ and not an empty string, it is printed followed by
1032 a colon and a blank. Then the error message for the current contents of
1033 <tt/_oserror/ are printed followed by a newline. The message output is the
1034 same as returned by <tt/<ref id="_stroserror" name="_stroserror">/ with an
1035 argument of <tt/_oserror/.
1036 <tag/Notes/<itemize>
1037 <item>Since operating system specific error code are - you guessed it -
1038 operating system specific, the value in <tt/_oserror/ and the message that is
1039 printed depends on the cc65 target.
1040 <item>The function is only available as fastcall function, so it may only
1041 be used in presence of a prototype.
1043 <tag/Availability/cc65
1045 <ref id="_stroserror" name="_stroserror">,
1046 <ref id="perror" name="perror">
1052 <sect1>_randomize<label id="_randomize"><p>
1056 <tag/Function/Initialize the pseudo random number generator.
1057 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1058 <tag/Declaration/<tt/void _randomize (void);/
1059 <tag/Description/The function initializes the random number generator with
1060 a seed derived from fast changing hardware events, so the seed itself can be
1061 considered random to a certain degree.
1062 <tag/Notes/<itemize>
1063 <item>The randomness of the seed depends on the machine hardware.
1065 <tag/Availability/cc65
1067 <ref id="rand" name="rand">,
1068 <ref id="srand" name="srand">
1074 <sect1>_stroserror<label id="_stroserror"><p>
1078 <tag/Function/Return a string describing an OS specific error code.
1079 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1080 <tag/Declaration/<tt/const char* __fastcall__ _stroserror (unsigned char errcode);/
1081 <tag/Description/<tt/_stroserror/ will return a string describing the given
1082 operating system specific error code.
1083 <tag/Notes/<itemize>
1084 <item>Since operating system specific error code are - you guessed it -
1085 operating system specific, the parameter and the string returned depend on the
1087 <item>The function is only available as fastcall function, so it may only be
1088 used in presence of a prototype.
1090 <tag/Availability/cc65
1092 <ref id="strerror" name="strerror">
1098 <sect1>_swap<label id="_swap"><p>
1102 <tag/Function/Swap the contents of memory areas.
1103 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1104 <tag/Declaration/<tt/void __fastcall__ _swap (void* p, void* q, size_t size);/
1105 <tag/Description/<tt/_swap/ will swap (exchange) the contents of the two memory
1106 areas pointed to by <tt/p/ and <tt/q/. Both memory areas are assumed to be
1107 <tt/size/ bytes in size.
1108 <tag/Notes/<itemize>
1109 <item>The memory areas may not overlap, otherwise the results are undefined.
1110 <item>The function is only available as fastcall function, so it may only be
1111 used in presence of a prototype.
1113 <tag/Availability/cc65
1115 <ref id="memcpy" name="memcpy">,
1116 <ref id="memmove" name="memmove">
1122 <sect1>_sys<label id="_sys"><p>
1126 <tag/Function/Call a subroutine passing register values.
1127 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1128 <tag/Declaration/<tt/void __fastcall__ _sys (struct regs* r);/
1129 <tag/Description/The function will call the subroutine at the address
1130 specified in the <tt/pc/ member of the passed <tt/regs/ structure. All
1131 registers and the CPU flags are set to the values given in the <tt/regs/
1132 structure. On return from the subroutine, the new values of the registers and
1133 flags are stored back overwriting the old values.
1134 <tag/Notes/<itemize>
1135 <item>Bits 4 and 5 of the flags value in the <tt/regs/ structure are ignored
1136 when calling the subroutine (they are unchanged from their current values).
1137 <item>The function is only available as fastcall function, so it may only be
1138 used in presence of a prototype.
1140 <tag/Availability/cc65
1146 <sect1>BRK<label id="BRK"><p>
1150 <tag/Function/Insert a 6502 BRK instrunction into the code.
1151 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1152 <tag/Declaration/<tt/void BRK (void);/
1153 <tag/Description/The function will insert a 6502 BRK instruction into the code
1154 which may be used to trigger a debugger.
1155 <tag/Notes/<itemize>
1156 <item>The function is actually a macro.
1157 <item>The inserted instruction may lead to unexpected results if no debugger
1160 <tag/Availability/cc65
1162 <ref id="CLI" name="CLI">,
1163 <ref id="SEI" name="SEI">
1169 <sect1>CLI<label id="CLI"><p>
1173 <tag/Function/Insert a 6502 CLI instrunction into the code.
1174 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1175 <tag/Declaration/<tt/void CLI (void);/
1176 <tag/Description/The function will insert a 6502 CLI instruction into the code,
1177 so interrupts are enabled. Enabling interrupts has no effects if they are
1178 already enabled (the default).
1179 <tag/Notes/<itemize>
1180 <item>The function is actually a macro.
1181 <item>Disabling interrupts may lead to unexpected results.
1183 <tag/Availability/cc65
1185 <ref id="BRK" name="BRK">,
1186 <ref id="SEI" name="SEI">
1192 <sect1>PEEK<label id="PEEK"><p>
1196 <tag/Function/Read a byte from memory.
1197 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1198 <tag/Declaration/<tt/unsigned char PEEK (unsigned addr);/
1199 <tag/Description/The function will read the absolute memory given by <tt/addr/
1200 and return the value read.
1201 <tag/Notes/<itemize>
1202 <item>The function is actually a macro.
1203 <item>This function depends highly on the platform and environment.
1205 <tag/Availability/cc65
1207 <ref id="PEEKW" name="PEEKW">,
1208 <ref id="POKE" name="POKE">
1214 <sect1>PEEKW<label id="PEEKW"><p>
1218 <tag/Function/Read a word (two bytes) from memory.
1219 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1220 <tag/Declaration/<tt/unsigned PEEKW (unsigned addr);/
1221 <tag/Description/The function will read the absolute memory given by <tt/addr/
1222 and return the value read. The byte read from the higher address is the high
1223 byte of the return value.
1224 <tag/Notes/<itemize>
1225 <item>The function is actually a macro.
1226 <item>This function depends highly on the platform and environment.
1227 <item>The order in which the two bytes are read is unspecified and may
1228 depend of the address expression used.
1230 <tag/Availability/cc65
1232 <ref id="PEEK" name="PEEK">,
1233 <ref id="POKE" name="POKE">
1239 <sect1>POKE<label id="POKE"><p>
1243 <tag/Function/Write a byte to memory.
1244 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1245 <tag/Declaration/<tt/void POKE (unsigned addr, unsigned char val);/
1246 <tag/Description/The function writes the value <tt/val/ to the absolute
1247 memory address given by <tt/addr/.
1248 <tag/Notes/<itemize>
1249 <item>The function is actually a macro.
1250 <item>This function depends highly on the platform and environment.
1251 <item>Careless use will cause the program to act strange or may crash the
1254 <tag/Availability/cc65
1256 <ref id="PEEK" name="PEEK">,
1257 <ref id="POKEW" name="POKEW">
1263 <sect1>POKEW<label id="POKEW"><p>
1267 <tag/Function/Write a word (two bytes) to memory.
1268 <tag/Header/<tt/<ref id="peekpoke.h" name="peekpoke.h">/
1269 <tag/Declaration/<tt/void POKEW (unsigned addr, unsigned val);/
1270 <tag/Description/The function writes the value <tt/val/ to the absolute
1271 memory address given by <tt/addr/. The low byte of <tt/val/ is written to
1272 the <tt/addr/, the high byte is written to <tt/addr+1/.
1273 <tag/Notes/<itemize>
1274 <item>The function is actually a macro.
1275 <item>This function depends highly on the platform and environment.
1276 <item>Careless use will cause the program to act strange or may crash the
1278 <item>The order in which the two bytes are written is unspecified and may
1279 depend of the address expression used.
1281 <tag/Availability/cc65
1283 <ref id="PEEK" name="PEEK">,
1284 <ref id="POKE" name="POKE">
1290 <sect1>SEI<label id="SEI"><p>
1294 <tag/Function/Insert a 6502 SEI instrunction into the code.
1295 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
1296 <tag/Declaration/<tt/void SEI (void);/
1297 <tag/Description/The function will insert a 6502 SEI instruction into the code,
1298 so interrupts are disabled. Note that non maskable interrupts cannot be
1300 <tag/Notes/<itemize>
1301 <item>The function is actually a macro.
1302 <item>Disabling interrupts may lead to unexpected results.
1304 <tag/Availability/cc65
1306 <ref id="BRK" name="BRK">,
1307 <ref id="CLI" name="CLI">
1313 <sect1>abort<label id="abort"><p>
1317 <tag/Function/Terminates a program abnormally.
1318 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1319 <tag/Declaration/<tt/void abort (void);/
1320 <tag/Description/<tt/abort/ raises <tt/SIGABRT/, writes a termination message
1321 on stderr, then terminates the program with an exit code of 3.
1322 <tag/Availability/ISO 9899
1324 <ref id="assert" name="assert">,
1325 <ref id="exit" name="exit">,
1326 <ref id="raise" name="raise">
1332 <sect1>abs<label id="abs"><p>
1336 <tag/Function/Returns the absolute value of an integer.
1337 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1338 <tag/Declaration/<tt/int __fastcall__ abs (int v);/
1339 <tag/Description/<tt/abs/ returns the absolute value of the argument passed to
1341 <tag/Notes/<itemize>
1342 <item>The return value is undefined if <tt/INT_MIN/ is passed to the function.
1343 <item>The function is only available as fastcall function, so it may only be
1344 used in presence of a prototype.
1346 <tag/Availability/ISO 9899
1348 <ref id="labs" name="labs">
1354 <sect1>assert<label id="assert"><p>
1358 <tag/Function/Test a condition and possibly abort.
1359 <tag/Header/<tt/<ref id="assert.h" name="assert.h">/
1360 <tag/Declaration/<tt/void assert (int cond);/
1361 <tag/Description/<tt/assert/ is a macro that expands to a <tt/id/
1362 statement. If the condition evaluates t zero (false), assert prints a message
1363 on stderr and aborts the program.
1364 <tag/Notes/<itemize>
1365 <item>The function is actually a macro.
1367 <tag/Availability/ISO 9899
1369 <ref id="abort" name="abort">,
1370 <ref id="exit" name="exit">
1376 <sect1>atexit<label id="atexit"><p>
1380 <tag/Function/Register an exit function.
1381 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1382 <tag/Declaration/<tt/int __fastcall__ atexit (void (*exitfunc) (void));/
1383 <tag/Description/<tt/atexit/ registers the function pointed to by
1384 <tt/exitfunc/ as an exit function. Exit functions are called when the program
1385 terminates, they are called in LIFO order (the last function registered is
1386 called first). <tt/atexit/ returns zero on success and a nonzero value on
1388 <tag/Notes/<itemize>
1389 <item>A maximum of 5 exit functions can be registered.
1390 <item>There is no way to unregister an exit function.
1391 <item>The function is only available as fastcall function, so it may only be
1392 used in presence of a prototype.
1394 <tag/Availability/ISO 9899
1396 <ref id="abort" name="abort">,
1397 <ref id="exit" name="exit">
1403 <sect1>atmos_explode<label id="atmos_explode"><p>
1407 <tag/Function/Bomb sound effect.
1408 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1409 <tag/Declaration/<tt/void __fastcall__ atmos_explode(void);/
1410 <tag/Description/<tt/atmos_explode/ plays the BASIC sound.
1411 <tag/Notes/<itemize>
1412 <item>The function is available only as a fastcall function; so, it may be used
1413 only in the presence of a prototype.
1415 <tag/Availability/cc65
1417 <ref id="atmos_ping" name="atmos_ping">,
1418 <ref id="atmos_shoot" name="atmos_shoot">,
1419 <ref id="atmos_tick" name="atmos_tick">,
1420 <ref id="atmos_tock" name="atmos_tock">,
1421 <ref id="atmos_zap" name="atmos_zap">
1427 <sect1>atmos_load<label id="atmos_load"><p>
1431 <tag/Function/Load Atmos tape.
1432 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1433 <tag/Declaration/<tt/void __fastcall__ atmos_load(const char* name);/
1434 <tag/Description/<tt/atmos_load/ reads a memory block from tape.
1435 <tag/Notes/<itemize>
1436 <item>The function is available only as a fastcall function; so, it may be used
1437 only in the presence of a prototype.
1439 <tag/Availability/cc65
1441 <ref id="atmos_save" name="atmos_save">
1447 <sect1>atmos_ping<label id="atmos_ping"><p>
1451 <tag/Function/Bell or ricochet sound effect.
1452 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1453 <tag/Declaration/<tt/void __fastcall__ atmos_ping(void);/
1454 <tag/Description/<tt/atmos_ping/ plays the BASIC sound.
1455 <tag/Notes/<itemize>
1456 <item>The function is available only as a fastcall function; so, it may be used
1457 only in the presence of a prototype.
1459 <tag/Availability/cc65
1461 <ref id="atmos_explode" name="atmos_explode">,
1462 <ref id="atmos_shoot" name="atmos_shoot">,
1463 <ref id="atmos_tick" name="atmos_tick">,
1464 <ref id="atmos_tock" name="atmos_tock">,
1465 <ref id="atmos_zap" name="atmos_zap">
1471 <sect1>atmos_save<label id="atmos_save"><p>
1475 <tag/Function/Save Atmos tape.
1476 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1477 <tag/Declaration/<tt/void __fastcall__ atmos_save(const char* name, const void* start, const void* end);/
1478 <tag/Description/<tt/atmos_save/ writes a memory block to tape.
1479 <tag/Notes/<itemize>
1480 <item>The function is available only as a fastcall function; so, it may be used
1481 only in the presence of a prototype.
1483 <tag/Availability/cc65
1485 <ref id="atmos_load" name="atmos_load">
1487 atmos_save("hires", 0xa000, 0xc000);
1493 <sect1>atmos_shoot<label id="atmos_shoot"><p>
1497 <tag/Function/Pistol sound effect.
1498 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1499 <tag/Declaration/<tt/void __fastcall__ atmos_shoot(void);/
1500 <tag/Description/<tt/atmos_shoot/ plays the BASIC sound.
1501 <tag/Notes/<itemize>
1502 <item>The function is available only as a fastcall function; so, it may be used
1503 only in the presence of a prototype.
1505 <tag/Availability/cc65
1507 <ref id="atmos_explode" name="atmos_explode">,
1508 <ref id="atmos_ping" name="atmos_ping">,
1509 <ref id="atmos_tick" name="atmos_tick">,
1510 <ref id="atmos_tock" name="atmos_tock">,
1511 <ref id="atmos_zap" name="atmos_zap">
1517 <sect1>atmos_tick<label id="atmos_tick"><p>
1521 <tag/Function/High-pitch click.
1522 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1523 <tag/Declaration/<tt/void __fastcall__ atmos_tick(void);/
1524 <tag/Description/<tt/atmos_tick/ plays the system sound.
1525 <tag/Notes/<itemize>
1526 <item>The function is available only as a fastcall function; so, it may be used
1527 only in the presence of a prototype.
1529 <tag/Availability/cc65
1531 <ref id="atmos_explode" name="atmos_explode">,
1532 <ref id="atmos_ping" name="atmos_ping">,
1533 <ref id="atmos_shoot" name="atmos_shoot">,
1534 <ref id="atmos_tock" name="atmos_tock">,
1535 <ref id="atmos_zap" name="atmos_zap">
1541 <sect1>atmos_tock<label id="atmos_tock"><p>
1545 <tag/Function/Low-pitch click.
1546 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1547 <tag/Declaration/<tt/void __fastcall__ atmos_tock(void);/
1548 <tag/Description/<tt/atmos_tock/ plays the system sound.
1549 <tag/Notes/<itemize>
1550 <item>The function is available only as a fastcall function; so, it may be used
1551 only in the presence of a prototype.
1553 <tag/Availability/cc65
1555 <ref id="atmos_explode" name="atmos_explode">,
1556 <ref id="atmos_ping" name="atmos_ping">,
1557 <ref id="atmos_shoot" name="atmos_shoot">,
1558 <ref id="atmos_tick" name="atmos_tick">,
1559 <ref id="atmos_zap" name="atmos_zap">
1565 <sect1>atmos_zap<label id="atmos_zap"><p>
1569 <tag/Function/Raygun sound effect.
1570 <tag/Header/<tt/<ref id="atmos.h" name="atmos.h">/
1571 <tag/Declaration/<tt/void __fastcall__ atmos_zap(void);/
1572 <tag/Description/<tt/atmos_zap/ plays the BASIC sound.
1573 <tag/Notes/<itemize>
1574 <item>The function is available only as a fastcall function; so, it may be used
1575 only in the presence of a prototype.
1577 <tag/Availability/cc65
1579 <ref id="atmos_explode" name="atmos_explode">,
1580 <ref id="atmos_ping" name="atmos_ping">,
1581 <ref id="atmos_shoot" name="atmos_shoot">,
1582 <ref id="atmos_tick" name="atmos_tick">,
1583 <ref id="atmos_tock" name="atmos_tock">
1589 <sect1>atoi<label id="atoi"><p>
1593 <tag/Function/Convert a string to an integer.
1594 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1595 <tag/Declaration/<tt/int __fastcall__ atoi (const char* s);/
1596 <tag/Description/<tt/atoi/ converts the given string into an integer.
1597 Conversion stops as soon as any invalid character is encountered.
1598 <tag/Notes/<itemize>
1599 <item>There is no way to detect any conversion errors.
1600 <item>The function does not check for an numerical overflow when converting.
1601 <item>The function is only available as fastcall function, so it may only be
1602 used in presence of a prototype.
1604 <tag/Availability/ISO 9899
1606 <ref id="atol" name="atol">,
1607 <ref id="itoa" name="itoa">,
1608 <ref id="ltoa" name="ltoa">,
1609 <ref id="ultoa" name="ultoa">,
1610 <ref id="utoa" name="utoa">
1616 <sect1>atol<label id="atol"><p>
1620 <tag/Function/Convert a string to a long integer.
1621 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1622 <tag/Declaration/<tt/long __fastcall__ atol (const char* s);/
1623 <tag/Description/<tt/atol/ converts the given string into a long integer.
1624 Conversion stops as soon as any invalid character is encountered.
1625 <tag/Notes/<itemize>
1626 <item>There is no way to detect any conversion errors.
1627 <item>The function does not check for an numerical overflow when converting.
1628 <item>The function is only available as fastcall function, so it may only be
1629 used in presence of a prototype.
1631 <tag/Availability/ISO 9899
1633 <ref id="atoi" name="atoi">,
1634 <ref id="itoa" name="itoa">,
1635 <ref id="ltoa" name="ltoa">,
1636 <ref id="ultoa" name="ultoa">,
1637 <ref id="utoa" name="utoa">
1643 <sect1>bgcolor<label id="bgcolor"><p>
1647 <tag/Function/Set the background text color.
1648 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1649 <tag/Declaration/<tt/unsigned char __fastcall__ bgcolor (unsigned char color);/
1650 <tag/Description/The function will set a new background color and return the
1651 old (current) one. The background color is valid for the whole text output
1652 area of the screen, not just for new text.
1653 <tag/Notes/<itemize>
1654 <item>Background colors are system dependent. The function may have no effect
1655 on systems where the background color cannot be changed.
1656 <item>The function is only available as fastcall function, so it may only be
1657 used in presence of a prototype.
1659 <tag/Availability/cc65
1661 <ref id="bordercolor" name="bordercolor">,
1662 <ref id="textcolor" name="textcolor">
1668 <sect1>bordercolor<label id="bordercolor"><p>
1672 <tag/Function/Set the border (frame) color.
1673 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
1674 <tag/Declaration/<tt/unsigned char __fastcall__ bordercolor (unsigned char color);/
1675 <tag/Description/The function will set a new border color. It returns the old
1676 (current) border color.
1677 <tag/Notes/<itemize>
1678 <item>Border colors are system dependent. The function may have no effect
1679 on systems where the border color cannot be changed.
1680 <item>The function is only available as fastcall function, so it may only
1681 be used in presence of a prototype.
1683 <tag/Availability/cc65
1685 <ref id="bgcolor" name="bgcolor">,
1686 <ref id="textcolor" name="textcolor">
1692 <sect1>bsearch<label id="bsearch"><p>
1696 <tag/Function/Do a binary search in a sorted array.
1697 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1698 <tag/Declaration/<tt/void* __fastcall__ bsearch (const void* key,
1699 const void* base, size_t n, size_t size,
1700 int __fastcall__ (* cmp) (const void*, const void*));/
1701 <tag/Description/<tt/bsearch/ searches a sorted array for a member that
1702 matches the one pointed to by <tt/key/. <tt/base/ is the address of the array,
1703 <tt/n/ is the number of elements, <tt/size/ the size of an element and <tt/cmp/
1704 the function used to compare the members against the key. The function returns
1705 a pointer to the member found, or <tt/NULL/ if there was no match.
1706 <tag/Notes/<itemize>
1707 <item>The contents of the array must be sorted in ascending order according to
1708 the compare function given.
1709 <item>If there are multiple members that match the key, the function will
1710 return one of the members.
1711 <item>The function is only available as fastcall function, so it may only
1712 be used in presence of a prototype.
1713 <item>The function to which <tt/cmp/ points must have the <tt/fastcall/ calling
1716 <tag/Availability/ISO 9899
1718 <ref id="qsort" name="qsort">
1724 <sect1>bzero<label id="bzero"><p>
1728 <tag/Function/Fill a memory area with zeroes.
1729 <tag/Header/<tt/<ref id="string.h" name="string.h">/
1730 <tag/Declaration/<tt/void __fastcall__ bzero (void* p, size_t count);/
1731 <tag/Description/<tt/bzero/ fills the memory area pointed to by <tt/p/ with
1733 <tag/Notes/<itemize>
1734 <item>The function is non standard and therefore only available in non ANSI
1735 mode. You should use <tt/<ref id="memset" name="memset">/ instead.
1736 <item>The function is only available as fastcall function, so it may only
1737 be used in presence of a prototype.
1739 <tag/Availability/cc65
1741 <ref id="_swap" name="_swap">,
1742 <ref id="memcpy" name="memcpy">,
1743 <ref id="memmove" name="memmove">,
1744 <ref id="memset" name="memset">,
1750 <sect1>c64mode<label id="c64mode"><p>
1754 <tag/Function/Switch the C128 into C64 compatible mode.
1755 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
1756 <tag/Declaration/<tt/void c64mode (void);/
1757 <tag/Description/The function will cause the machine to reboot into C64 mode.
1758 <tag/Notes/<itemize>
1759 <item>The function is specific to the C128.
1760 <item>The function will not return to the caller.
1762 <tag/Availability/C128
1768 <sect1>calloc<label id="calloc"><p>
1772 <tag/Function/Allocate and clear memory.
1773 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
1774 <tag/Declaration/<tt/void* __fastcall__ calloc (size_t n, size_t size);/
1775 <tag/Description/<tt/calloc/ allocates memory for an array of <tt/n/ elements
1776 of size <tt/size/, clears the whole block with binary zeroes and returns a
1777 pointer to it. On error (not enough memory available), <tt/calloc/ returns
1779 <tag/Notes/<itemize>
1780 <item>Clearing the memory may not have the expected effect on all platforms:
1781 pointers in the block may not be <tt/NULL/ and floating point variables may
1782 not be zero (0.0). In other words: The "clearing" effect of this function
1783 should be used with care for portable programs.
1784 <item>The function is only available as fastcall function, so it may only
1785 be used in presence of a prototype.
1787 <tag/Availability/ISO 9899
1789 <ref id="_heapadd" name="_heapadd">,
1790 <ref id="_heapblocksize" name="_heapblocksize">,
1791 <ref id="_heapmaxavail" name="_heapmaxavail">,
1792 <ref id="_heapmemavail" name="_heapmemavail">,
1793 <ref id="free" name="free">,
1794 <ref id="malloc" name="malloc">,
1795 <ref id="realloc" name="realloc">
1801 <sect1>cbm_k_acptr<label id="cbm_k_acptr"><p>
1805 <tag/Function/Input byte from serial bus
1806 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1807 <tag/Declaration/<tt/unsigned char cbm_k_acptr (void);/
1808 <tag/Description/The function returns a byte of data, which it
1809 gets from the current TALKer on the serial bus.
1810 In order to receive the data, the device must have previously been
1811 sent a command to TALK and a secondary address if it needs one.
1812 <tag/Notes/<itemize>
1815 <tag/Availability/cc65
1817 <ref id="cbm_k_talk" name="cbm_k_talk">,
1823 <sect1>cbm_k_basin<label id="cbm_k_basin"><p>
1827 <tag/Function/Input a Character from the Current Device
1828 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1829 <tag/Declaration/<tt/unsigned char cbm_k_basin (void);/
1830 <tag/Description/The function returns a character from the current input device.
1831 Device must first have been OPENed and then designated as the input channel by the CHKIN routine.
1832 When this function is called, the next byte of data available from the device is returned.
1833 Exception is the routine for the keyboard device (which is the default input device).
1834 <tag/Notes/<itemize>
1837 <tag/Availability/cc65
1839 <ref id="cbm_k_open" name="cbm_k_open">,
1840 <ref id="cbm_k_chkin" name="cbm_k_chkin">
1846 <sect1>cbm_k_bsout<label id="cbm_k_bsout"><p>
1850 <tag/Function/Output a byte
1851 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1852 <tag/Declaration/<tt/void __fastcall__ cbm_k_bsout (unsigned char C);/
1853 <tag/Description/Function sends the character to the current output device.
1854 Unless a device has been OPENed and designated as the
1855 current output channel using the CHKOUT routine, the character is
1856 printed to the screen, which is the default output device. If the
1857 cassette is the current device, outputting a byte will only add it to
1858 the buffer. No actual transmission of data will occur until the
1859 192-byte buffer is full.
1860 <tag/Notes/<itemize>
1861 <item>The function is only available as fastcall function, so it may
1862 only be used in presence of a prototype.
1864 <tag/Availability/cc65
1866 <ref id="cbm_k_open" name="cbm_k_open">,
1867 <ref id="cbm_k_chkin" name="cbm_k_chkout">
1873 <sect1>cbm_k_chkin<label id="cbm_k_chkin"><p>
1877 <tag/Function/Designate a Logical File As the Current Input Channel
1878 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1879 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_chkin (unsigned char FN);/
1880 <tag/Description/If you wish to
1881 get data from any device other than the keyboard, this function must be
1882 called after OPENing the device, before you can get a data byte with
1883 the cbm_k_basin or cbm_k_getin routine. When called, the routine will designate
1884 the logical file whose file number was supplied as the
1885 current file, its device as the current device, and its secondary
1886 address as the current secondary address. If the device on the
1887 channel is a serial device, which requires a TALK command and
1888 sometimes a secondary address, function will send them over the
1890 <tag/Notes/<itemize>
1891 <item>The function is only available as fastcall function, so it may
1892 only be used in presence of a prototype.
1894 <tag/Availability/cc65
1896 <ref id="cbm_k_open" name="cbm_k_open">,
1897 <ref id="cbm_k_basin" name="cbm_k_basin">,
1898 <ref id="cbm_k_getin" name="cbm_k_getin">
1904 <sect1>cbm_k_ciout<label id="cbm_k_ciout"><p>
1908 <tag/Function/Transmit a byte over the serial bus
1909 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1910 <tag/Declaration/<tt/void __fastcall__ cbm_k_ciout (unsigned char C);/
1911 <tag/Description/Purpose of this function is to send a byte of data over
1912 the serial bus. In order for the data to be received, the serial
1913 device must have first been commanded to LISTEN and been given a
1914 secondary address if necessary. This routine always buffers the
1915 current character, and defers sending it until the next byte is
1916 buffered. When the UNLISTEN command is sent, the last byte will be
1917 sent with an End or Identify (EOI).
1918 <tag/Notes/<itemize>
1919 <item>The function is only available as fastcall function, so it may
1920 only be used in presence of a prototype.
1922 <tag/Availability/cc65
1924 <ref id="cbm_k_listen" name="cbm_k_listen">,
1925 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">
1931 <sect1>cbm_k_ckout<label id="cbm_k_ckout"><p>
1935 <tag/Function/Designate a Logical File As the Current Output Channel
1936 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1937 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_ckout (unsigned char FN);/
1938 <tag/Description/If you wish to
1939 output data to any device other than the screen, this routine must be
1940 called after OPENing the device, and before you output a data byte
1941 with the cbm_k_bsout() function. When called, the function will designate the
1942 logical file whose file number was supplied as the current
1943 file, its device as the current device, and its secondary address as
1944 the current secondary address. If the device on the channel uses the
1945 serial bus, and therefore requires a LISTEN command and possibly a
1946 secondary address, this information will be sent on the bus.
1947 <tag/Notes/<itemize>
1948 <item>The function is only available as fastcall function, so it may
1949 only be used in presence of a prototype.
1951 <tag/Availability/cc65
1953 <ref id="cbm_k_bsout" name="cbm_k_bsout">,
1954 <ref id="cbm_k_listen" name="cbm_k_listen">
1960 <sect1>cbm_k_clall<label id="cbm_k_clall"><p>
1964 <tag/Function/Close All Logical I/O Files
1965 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1966 <tag/Declaration/<tt/void cbm_k_clall (void);/
1967 <tag/Description/It closes all
1968 open files, by resetting the index into open files to
1969 zero and restores the default I/O devices.
1970 <tag/Notes/<itemize>
1973 <tag/Availability/cc65
1975 <ref id="cbm_k_open" name="cbm_k_open">,
1976 <ref id="cbm_k_close" name="cbm_k_close">
1982 <sect1>cbm_k_close<label id="cbm_k_close"><p>
1986 <tag/Function/Close a Logical I/O File
1987 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
1988 <tag/Declaration/<tt/void __fastcall__ cbm_k_close (unsigned char FN);/
1989 <tag/Description/It is used to
1990 close a logical file after all I/O operations involving that file have
1992 <tag/Notes/<itemize>
1993 <item>The function is only available as fastcall function, so it may
1994 only be used in presence of a prototype.
1996 <tag/Availability/cc65
1998 <ref id="cbm_k_open" name="cbm_k_open">,
1999 <ref id="cbm_k_clall" name="cbm_k_clall">
2005 <sect1>cbm_k_clrch<label id="cbm_k_clrch"><p>
2009 <tag/Function/Restore Current Input and Output Devices to the Default Devices
2010 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2011 <tag/Declaration/<tt/void cbm_k_clrch (void);/
2012 <tag/Description/It sets the
2013 current input device to the keyboard, and the current output device to
2014 the screen. Also, if the current input device was formerly a serial
2015 device, the routine sends it an UNTALK command on the serial bus, and
2016 if a serial device was formerly the current output device, the routine
2017 sends it an UNLISTEN command.
2018 <tag/Notes/<itemize>
2021 <tag/Availability/cc65
2023 <ref id="cbm_k_chkin" name="cbm_k_chkin">,
2024 <ref id="cbm_k_ckout" name="cbm_k_ckout">
2030 <sect1>cbm_k_getin<label id="cbm_k_getin"><p>
2034 <tag/Function/Get One Byte from the Input Device
2035 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2036 <tag/Declaration/<tt/unsigned char cbm_k_getin (void);/
2037 <tag/Description/Function gets a character from the current input device.
2038 <tag/Notes/<itemize>
2041 <tag/Availability/cc65
2043 <ref id="cbm_k_basin" name="cbm_k_basin">
2049 <sect1>cbm_k_iobase<label id="cbm_k_iobase"><p>
2053 <tag/Function/Return Base Address of Memory-Mapped I/O Devices
2054 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2055 <tag/Declaration/<tt/unsigned cbm_k_iobase (void);/
2056 <tag/Description/This function returns the address of
2057 the memory section where the memory mapped I/O devices are located. This
2058 address can then be used with an offset to access the memory mapped I/O
2059 devices in the Commodore 64. The offset is the number of locations from
2060 the beginning of the page on which the I/O register you want is located.
2061 This function exists to provide compatibility between the Commodore 64,
2062 VIC-20, and future models of the Commodore 64. If the I/O locations for
2063 a program are set by a call to this function, they should
2064 still remain compatible with future versions of the Commodore 64, the
2066 <tag/Notes/<itemize>
2069 <tag/Availability/cc65
2077 <sect1>cbm_k_listen<label id="cbm_k_listen"><p>
2081 <tag/Function/Command a device on the serial bus to LISTEN
2082 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2083 <tag/Declaration/<tt/void __fastcall__ cbm_k_listen (unsigned char dev);/
2084 <tag/Description/This function will command a device on the serial bus to
2085 receive data. The KERNAL routine will OR the supplied device number bit by bit
2086 to convert it to a listen address, then transmits this data as a command on
2087 the serial bus. The specified device will then go into listen mode, and
2088 be ready to accept information.
2089 <tag/Notes/<itemize>
2090 <item>The function is only available as fastcall function, so it may
2091 only be used in presence of a prototype.
2093 <tag/Availability/cc65
2095 <ref id="cbm_k_unlsn" name="cbm_k_unlsn">
2101 <sect1>cbm_k_load<label id="cbm_k_load"><p>
2105 <tag/Function/Load RAM from a Device
2106 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2107 <tag/Declaration/<tt/unsigned int __fastcall__ cbm_k_load(unsigned char flag, unsigned addr);/
2108 <tag/Description/This function LOADs data bytes from any input device directly into the memory.
2109 It can also be used for a verify operation, comparing data from a device with the data already in
2110 memory, while leaving the data stored in RAM unchanged.
2111 The flag must be set to 0 for a LOAD operation, or 1 for a
2112 verify, If the input device is OPENed with a secondary address (SA) of 0
2113 the header information from the device is ignored. In this case, the starting address for the load must be supplied.
2114 If the device is addressed with a secondary address of 1, then the data is
2115 loaded into memory starting at the location specified by the header.
2116 Function returns the address of the highest RAM location loaded.
2117 Before this function can be called, the KERNAL SETLFS, and SETNAM
2118 routines must be called.
2119 <tag/Notes/<itemize>
2120 <item>The function is only available as fastcall function, so it may
2121 only be used in presence of a prototype.
2123 <tag/Availability/cc65
2125 <ref id="cbm_k_save" name="cbm_k_save">,
2126 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2127 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2133 <sect1>cbm_k_open<label id="cbm_k_open"><p>
2137 <tag/Function/Open a Logical I/O File
2138 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2139 <tag/Declaration/<tt/unsigned char cbm_k_open (void);/
2140 <tag/Description/This function assigns a logical file to a device, so that it can be used for
2141 Input/Output operations. In order to specify the logical file number,
2142 the device number, and the secondary address if any, the cbm_k_setlfs() function must first be called.
2143 Likewise, in order to designate the filename, the cbm_k_setnam() function must be used first. After these two
2144 functions are called, cbm_k_open() is then called.
2145 <tag/Notes/<itemize>
2148 <tag/Availability/cc65
2150 <ref id="cbm_k_close" name="cbm_k_close">,
2151 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2152 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2158 <sect1>cbm_k_readst<label id="cbm_k_readst"><p>
2162 <tag/Function/Read status word
2163 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2164 <tag/Declaration/<tt/unsigned char cbm_k_readst (void);/
2165 <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.
2166 <tag/Notes/<itemize>
2169 <tag/Availability/cc65
2177 <sect1>cbm_k_save<label id="cbm_k_save"><p>
2181 <tag/Function/Save RAM to a Device
2182 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2183 <tag/Declaration/<tt/unsigned char __fastcall__ cbm_k_save(unsigned int start, unsigned int end)/
2184 <tag/Description/This function saves a section of memory. The cbm_k_setlfs() and cbm_k_setnam() functions must be
2185 used before calling this function. However, a file name is not required to
2186 SAVE to device 1 (the Datassette(TM) recorder). Any attempt to save to
2187 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.
2188 <tag/Notes/<itemize>
2189 <item>The function is only available as fastcall function, so it may
2190 only be used in presence of a prototype.
2192 <tag/Availability/cc65
2194 <ref id="cbm_k_load" name="cbm_k_load">,
2195 <ref id="cbm_k_setlfs" name="cbm_k_setlfs">,
2196 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2202 <sect1>cbm_k_scnkey<label id="cbm_k_scnkey"><p>
2206 <tag/Function/Scan the keyboard matrix.
2207 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2208 <tag/Declaration/<tt/void cbm_k_scnkey (void);/
2209 <tag/Description/This function looks at the switches in the keyboard, to see
2210 if any of them are being pressed. If they are, then code numbers for them are
2211 stored in RAM. Other functions use those numbers to input text. Normally,
2212 the keyboard is scanned by the Kernal's Interrupt Service Routine. But, if
2213 you divert the "Jiffy interrupt" to a C-code ISR, then that ISR must call this
2214 function, in order to provide input from the keyboard.
2215 <tag/Availability/cc65
2217 <ref id="cbm_k_getin" name="cbm_k_getin">,
2218 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2219 <ref id="cgetc" name="cgetc">,
2220 <!-- <ref id="getc" name="getc"> -->
2221 <!-- <ref id="getchar" name="getchar"> -->
2227 <sect1>cmb_k_second<label id="cbm_k_second"><p>
2231 <tag/Function/Send secondary address for LISTEN.
2232 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2233 <tag/Declaration/<tt/void __fastcall__ cbm_k_second (unsigned char addr);/
2234 <tag/Description/This function is used to send a secondary address to an I/O
2235 device after a call to LISTEN is made, and the device is commanded to LISTEN.
2236 <tag/Notes/<itemize>
2237 <item>The function is only available as fastcall function, so it may
2238 only be used in presence of a prototype.
2239 <item>The function can only be called after a call to LISTEN.
2240 <item>The function will not work after a TALK.
2241 <item>When a secondary address is to be sent to a device on the serial bus,
2242 the address must first be ORed with $60.
2244 <tag/Availability/cc65
2246 <ref id="cbm_k_listen" name="cbm_k_listen">
2252 <sect1>cbm_k_setlfs<label id="cbm_k_setlfs"><p>
2256 <tag/Function/Set up a logical file
2257 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2258 <tag/Declaration/<tt/void __fastcall__ cbm_k_setlfs (unsigned char LFN, unsigned char DEV, unsigned char SA);/
2259 <tag/Description/This functions sets up the logical file by setting its number, device address,
2260 and secondary address.
2261 <tag/Notes/<itemize>
2262 <item>The function is only available as fastcall function, so it may
2263 only be used in presence of a prototype.
2265 <tag/Availability/cc65
2267 <ref id="cbm_k_setnam" name="cbm_k_setnam">
2273 <sect1>cbm_k_setnam<label id="cbm_k_setnam"><p>
2277 <tag/Function/Set Filename Parameters
2278 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2279 <tag/Declaration/<tt/void __fastcall__ cbm_k_setnam (const char* Name);/
2280 <tag/Description/This function is used to set up the file name for the OPEN,
2281 SAVE, or LOAD operations.
2282 <tag/Notes/<itemize>
2283 <item>The function is only available as fastcall function, so it may
2284 only be used in presence of a prototype.
2286 <tag/Availability/cc65
2288 <ref id="cbm_k_open" name="cbm_k_open">,
2289 <ref id="cbm_k_load" name="cbm_k_load">,
2290 <ref id="cbm_k_save" name="cbm_k_save">
2296 <sect1>cbm_k_talk<label id="cbm_k_talk"><p>
2300 <tag/Function/Commands device to TALK
2301 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2302 <tag/Declaration/<tt/void __fastcall__ cbm_k_talk (unsigned char dev);/
2303 <tag/Description/When called, it ORs the device number with the TALK code (64, $40) and sends it on the serial
2304 bus. This commands the device to TALK.
2305 <tag/Notes/<itemize>
2306 <item>The function is only available as fastcall function, so it may
2307 only be used in presence of a prototype.
2309 <tag/Availability/cc65
2311 <ref id="cbm_k_acptr" name="cbm_k_acptr">
2317 <sect1>cbm_k_tksa<label id="cbm_k_tksa"><p>
2321 <tag/Function/Send TALK secondary address to serial bus
2322 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2323 <tag/Declaration/<tt/void __fastcall__ cbm_k_tksa (unsigned char addr);/
2324 <tag/Description/This function transmits a secondary address on the serial bus for a TALK device.
2325 <tag/Notes/<itemize>
2326 <item>The function is only available as fastcall function, so it may
2327 only be used in presence of a prototype.
2328 <item>The function can only be called after a call to TALK.
2329 <item>The function will not work after a LISTEN.
2331 <tag/Availability/cc65
2333 <ref id="cbm_k_talk" name="cbm_k_talk">
2339 <sect1>cbm_k_udtim<label id="cbm_k_udtim"><p>
2343 <tag/Function/Update the Jiffy clock.
2344 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2345 <tag/Declaration/<tt/void cbm_k_udtim (void);/
2346 <tag/Description/This function adds one count to the Jiffy clock. That clock
2347 counts sixtieths of a second. It is used by the library's <tt/clock()/
2348 function. Normally, the Jiffy clock is updated by the Kernal's Interrupt
2349 Service Routine. But, if you divert the "Jiffy interrupt" to a C-code ISR,
2350 then that ISR must call this function, in order to keep the clock valid.
2351 <tag/Availability/cc65
2353 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2354 <ref id="clock" name="clock">
2360 <sect1>cbm_k_unlsn<label id="cbm_k_unlsn"><p>
2364 <tag/Function/Send an UNLISTEN command
2365 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2366 <tag/Declaration/<tt/void cbm_k_unlsn (void);/
2367 <tag/Description/This function commands all devices on the serial bus to
2368 stop receiving data from the host computer (i.e., UNLISTEN). Calling this
2369 function results in an UNLISTEN command being transmitted on the serial
2370 bus. Only devices previously commanded to LISTEN are affected. This
2371 function is normally used after the host computer is finished sending data
2372 to external devices. Sending the UNLISTEN commands the listening devices
2373 to get off the serial bus so it can be used for other purposes.
2374 <tag/Availability/cc65
2376 <ref id="cbm_k_listen" name="cbm_k_listen">
2382 <sect1>cbm_k_untlk<label id="cbm_k_untlk"><p>
2386 <tag/Function/Send an UNTALK command
2387 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
2388 <tag/Declaration/<tt/void cbm_k_untlk (void);/
2389 <tag/Description/This function commands all devices on the serial bus to
2390 stop sending data to the host computer (i.e., UNTALK). Calling this
2391 function results in an UNTALK command being transmitted on the serial
2392 bus. Only devices previously commanded to TALK are affected. This
2393 function is normally used after the host computer is finished listening to data
2394 from an external device. Sending the UNTALK commands the sending devices
2395 to get off the serial bus so it can be used for other purposes.
2396 <tag/Availability/cc65
2398 <ref id="cbm_k_talk" name="cbm_k_talk">
2404 <sect1>cclear<label id="cclear"><p>
2408 <tag/Function/Clear part of a line (write a given number of spaces).
2409 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2410 <tag/Declaration/<tt/void __fastcall__ cclear (unsigned char length);/
2411 <tag/Description/The function clears part of a line by writing <tt/length/
2412 spaces in the current text color.
2413 <tag/Notes/<itemize>
2414 <item>The function is only available as fastcall function, so it may
2415 only be used in presence of a prototype.
2417 <tag/Availability/cc65
2419 <ref id="cclearxy" name="cclearxy">,
2420 <ref id="clrscr" name="clrscr">
2426 <sect1>cclearxy<label id="cclearxy"><p>
2430 <tag/Function/Clear part of a line (write a given number of spaces) starting
2431 at a specific screen position.
2432 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2433 <tag/Declaration/<tt/void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length);/
2434 <tag/Description/The function moves the cursor to a specific position, and
2435 will then clear part of the line by writing <tt/length/ spaces in the current
2437 <tag/Notes/<itemize>
2438 <item>The function is only available as fastcall function, so it may
2439 only be used in presence of a prototype.
2441 <tag/Availability/cc65
2443 <ref id="cclear" name="cclear">,
2444 <ref id="clrscr" name="clrscr">
2450 <sect1>cgetc<label id="cgetc"><p>
2454 <tag/Function/Read a character from the keyboard.
2455 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2456 <tag/Declaration/<tt/char cgetc (void);/
2457 <tag/Description/The function reads a character from the keyboard. If there is
2458 no character available, <tt/cgetc()/ waits until the user presses a key. If the
2459 cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
2460 displayed while waiting.
2461 <tag/Notes/<itemize>
2462 <item>If the system supports a keyboard buffer, <tt/cgetc()/ will fetch a key
2463 from that buffer; and, wait only if the buffer is empty.
2464 <item>The keyboard must be scanned periodically, in order for this function to
2465 see anything that you type. (See the description of <tt/cbm_k_scnkey()/.)
2467 <tag/Availability/cc65
2469 <ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
2470 <ref id="cursor" name="cursor">,
2471 <ref id="kbhit" name="kbhit">
2477 <sect1>chline<label id="chline"><p>
2481 <tag/Function/Output a horizontal line in text mode.
2482 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2483 <tag/Declaration/<tt/void __fastcall__ chline (unsigned char length);/
2484 <tag/Description/The function outputs a horizontal line with the given length
2485 starting at the current cursor position.
2486 <tag/Notes/<itemize>
2487 <item>The character used to draw the horizontal line is system dependent.
2488 If available, a line drawing character is used. Drawing a line that is partially
2489 off screen leads to undefined behaviour.
2490 <item>The function is only available as fastcall function, so it may only be
2491 used in presence of a prototype.
2493 <tag/Availability/cc65
2495 <ref id="chlinexy" name="chlinexy">,
2496 <ref id="cvline" name="cvline">,
2497 <ref id="cvlinexy" name="cvlinexy">
2503 <sect1>chlinexy<label id="chlinexy"><p>
2507 <tag/Function/Output a horizontal line at a given position in text mode.
2508 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2509 <tag/Declaration/<tt/void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);/
2510 <tag/Description/The function outputs a horizontal line with the given length
2511 starting at a given position.
2512 <tag/Notes/<itemize>
2513 <item>The character used to draw the horizontal line is system dependent.
2514 If available, a line drawing character is used. Drawing a line that is partially
2515 off screen leads to undefined behaviour.
2516 <item>The function is only available as fastcall function, so it may only be
2517 used in presence of a prototype.
2519 <tag/Availability/cc65
2521 <ref id="chline" name="chline">,
2522 <ref id="cvline" name="cvline">,
2523 <ref id="cvlinexy" name="cvlinexy">
2529 <sect1>clearerr<label id="clearerr"><p>
2533 <tag/Function/Clear error and end-of-file status of a stream.
2534 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
2535 <tag/Declaration/<tt/void __fastcall__ clearerr (FILE* f);/
2536 <tag/Description/<tt/clearerr/ clears the error and end-of-file status
2537 indicators for the stream <tt/f/.
2538 <tag/Notes/<itemize>
2539 <item>The function is only available as fastcall function, so it may only be
2540 used in presence of a prototype.
2542 <tag/Availability/ISO 9899
2544 <ref id="feof" name="feof">,
2545 <ref id="ferror" name="ferror">
2551 <sect1>clock<label id="clock"><p>
2555 <tag/Function/Determine the processor time used.
2556 <tag/Header/<tt/<ref id="time.h" name="time.h">/
2557 <tag/Declaration/<tt/clock_t clock (void);/
2558 <tag/Description/The <tt/clock/ function returns an approximaton of processor
2559 time used by the program. The time is returned in implementation-defined
2560 units. It can be converted to seconds by dividing by the value of the macro
2561 <tt/CLOCKS_PER_SEC/.
2562 <tag/Notes/<itemize>
2563 <item>Since the machines that cc65-generated programs run on cannot run multiple
2564 processes, the function actually will return the time since some
2565 implementation-defined point in the past.
2566 <item>The Jiffy clock must be "running", in order for this function to return
2567 changing values. (See the description of <tt/cbm_k_udtim()/.)
2569 <tag/Availability/ISO 9899
2571 <ref id="cbm_k_udtim" name="cbm_k_udtim">,
2572 <ref id="time" name="time">
2578 <sect1>clrscr<label id="clrscr"><p>
2582 <tag/Function/Clear the text screen.
2583 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2584 <tag/Declaration/<tt/void clrscr (void);/
2585 <tag/Description/The function clears the text screen and moves the cursor to
2586 the upper left corner.
2587 <tag/Availability/cc65
2589 <ref id="cclear" name="cclear">,
2590 <ref id="cclearxy" name="cclearxy">
2596 <sect1>close<label id="close"><p>
2600 <tag/Function/Close a file descriptor.
2601 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2602 <tag/Declaration/<tt/int __fastcall__ close (int fd);/
2603 <tag/Description/The function closes the given file descriptor. It returns zero
2604 on success and -1 on error. If an error occurs, the cause can be determined by
2605 reading the <tt/errno/ variable.
2606 <tag/Notes/<itemize>
2607 <item>The function is only available as fastcall function, so it may only
2608 be used in presence of a prototype.
2610 <tag/Availability/POSIX 1003.1
2612 <ref id="creat" name="creat">,
2613 <ref id="open" name="open">
2619 <sect1>closedir<label id="closedir"><p>
2623 <tag/Function/Close a directory.
2624 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
2625 <tag/Declaration/<tt/int __fastcall__ closedir (DIR* dir);/
2626 <tag/Description/The function closes the given directory descriptor. It returns
2627 zero on success and -1 on error. If an error occurs, the cause can be determined
2628 by reading the <tt/errno/ variable.
2629 <tag/Notes/<itemize>
2630 <item>The function is only available as fastcall function, so it may only
2631 be used in presence of a prototype.
2633 <tag/Availability/POSIX 1003.1
2635 <ref id="opendir" name="opendir">,
2636 <ref id="readdir" name="readdir">
2642 <sect1>cpeekc<label id="cpeekc"><p>
2646 <tag/Function/Get a character from the display memory.
2647 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2648 <tag/Declaration/<tt/char cpeekc (void);/
2649 <tag/Description/The function gets the character that's at the current location
2650 of the cursor in the display screen RAM. That character is converted, if
2651 needed, into the encoding that can be passed to <tt/cputc()/.
2652 <tag/Notes/<itemize>
2653 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2654 done to make it obvious that peeking doesn't move the cursor in any way. Your
2655 program must place the cursor where it wants to peek before it calls any of
2658 <tag/Availability/cc65
2660 <ref id="cpeekcolor" name="cpeekcolor">,
2661 <ref id="cpeekrevers" name="cpeekrevers">,
2662 <ref id="cpeeks" name="cpeeks">,
2663 <ref id="cputc" name="cputc">
2669 <sect1>cpeekcolor<label id="cpeekcolor"><p>
2673 <tag/Function/Get a color from the display memory.
2674 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2675 <tag/Declaration/<tt/unsigned char cpeekcolor (void);/
2676 <tag/Description/The function gets the color number that's at the current
2677 location of the cursor in the display screen RAM. That number can be passed to
2679 <tag/Notes/<itemize>
2680 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2681 done to make it obvious that peeking doesn't move the cursor in any way. Your
2682 program must place the cursor where it wants to peek before it calls any of
2685 <tag/Availability/cc65
2687 <ref id="cpeekc" name="cpeekc">,
2688 <ref id="cpeekrevers" name="cpeekrevers">,
2689 <ref id="cpeeks" name="cpeeks">,
2690 <ref id="cputc" name="cputc">,
2691 <ref id="textcolor" name="textcolor">
2697 <sect1>cpeekrevers<label id="cpeekrevers"><p>
2701 <tag/Function/Get a reverse-character attribute from the display memory.
2702 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2703 <tag/Declaration/<tt/unsigned char cpeekrevers (void);/
2704 <tag/Description/The function gets the "reverse-mode" attribute of the
2705 character that's at the current location of the cursor in the display screen
2706 RAM. It returns a boolean value (0/1) that can be passed to <tt/revers()/.
2707 <tag/Notes/<itemize>
2708 <item>Conio peek functions don't have <tt/cpeek...xy()/ versions. That was
2709 done to make it obvious that peeking doesn't move the cursor in any way. Your
2710 program must place the cursor where it wants to peek before it calls any of
2713 <tag/Availability/cc65
2715 <ref id="cpeekc" name="cpeekc">,
2716 <ref id="cpeekcolor" name="cpeekcolor">,
2717 <ref id="cpeeks" name="cpeeks">,
2718 <ref id="cputc" name="cputc">,
2719 <ref id="revers" name="revers">
2725 <sect1>cpeeks<label id="cpeeks"><p>
2729 <tag/Function/Get a string from the display memory.
2730 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2731 <tag/Declaration/<tt/void __fastcall__ cpeeks (char* s, unsigned length);/
2732 <tag/Description/The function gets a fixed-length string ('\0'-terminated) of
2733 characters that start at the current location of the cursor in the display
2734 screen RAM. Those characters are converted, if needed, into the encoding that
2735 can be passed to <tt/cputs()/. The first argument must point to a RAM area
2736 that's large enough to hold "length + 1" bytes.
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
2742 <item>The function is available as only a fastcall function;
2743 so, it may be used only in the presence of a prototype.
2745 <tag/Availability/cc65
2747 <ref id="cpeekc" name="cpeekc">,
2748 <ref id="cpeekcolor" name="cpeekcolor">,
2749 <ref id="cpeekrevers" name="cpeekrevers">,
2750 <ref id="cputc" name="cputc">,
2751 <ref id="cputs" name="cputs">
2757 <sect1>creat<label id="creat"><p>
2761 <tag/Function/Create a file.
2762 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
2763 <tag/Declaration/<tt/int __fastcall__ creat (const char* name, unsigned mode);/
2764 <tag/Description/<tt/creat/ creates a new file and returns the file descriptor
2765 associated with it. On error, -1 is returned and an error code is stored in
2767 <tag/Notes/<itemize>
2768 <item><tt/creat/ is identical to calling <tt/<ref id="open" name="open">/ with
2769 <tt/flags/ equal to <tt/O_WRONLY | O_CREAT | O_TRUNC/.
2770 <item>The function is only available as fastcall function, so it may only
2771 be used in presence of a prototype.
2773 <tag/Availability/POSIX 1003.1
2775 <ref id="close" name="close">,
2776 <ref id="open" name="open">
2782 <sect1>cprintf<label id="cprintf"><p>
2786 <tag/Function/Formatted output to the console.
2787 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2788 <tag/Declaration/<tt/int cprintf (const char* format, ...);/
2789 <tag/Description/The arguments are converted to text where necessary and
2790 formatted according to the format string given. The resulting string is output
2791 to the console. <tt/cprintf/ supports the same format specifiers as
2792 <tt/printf/. <!-- <tt/<ref id="printf" name="printf">/. -->
2793 <tag/Notes/<itemize>
2794 <item>Like all other <tt/conio/ output functions, <tt/cprintf/ distinguishes
2795 between <tt/\r/ and <tt/\n/.
2797 <tag/Availability/cc65
2799 <ref id="cputc" name="cputc">,
2800 <ref id="cputcxy" name="cputcxy">,
2801 <ref id="cputs" name="cputs">,
2802 <ref id="cputsxy" name="cputsxy">,
2803 <ref id="vcprintf" name="vcprintf">
2809 <sect1>cputc<label id="cputc"><p>
2813 <tag/Function/Output a character directly to the console.
2814 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2815 <tag/Declaration/<tt/void __fastcall__ cputc (char c);/
2816 <tag/Description/Output one character to the console at the current cursor
2818 <tag/Notes/<itemize>
2819 <item>Like all other <tt/conio/ output functions, <tt/cputc/ distinguishes
2820 between <tt/\r/ and <tt/\n/.
2821 <item>The function is only available as fastcall function, so it may only
2822 be used in presence of a prototype.
2824 <tag/Availability/cc65
2826 <ref id="cprintf" name="cprintf">,
2827 <ref id="cputcxy" name="cputcxy">,
2828 <ref id="cputs" name="cputs">,
2829 <ref id="cputsxy" name="cputsxy">,
2830 <ref id="vcprintf" name="vcprintf">
2836 <sect1>cputcxy<label id="cputcxy"><p>
2840 <tag/Function/Output a character at a specific screen position.
2841 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2842 <tag/Declaration/<tt/void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);/
2843 <tag/Description/<tt/cputcxy/ moves the cursor to the given x/y position on
2844 the screen and outputs one character.
2845 <tag/Notes/<itemize>
2846 <item>Like all other <tt/conio/ output functions, <tt/cputcxy/ distinguishes
2847 between <tt/\r/ and <tt/\n/.
2848 <item>The function is only available as fastcall function, so it may only
2849 be used in presence of a prototype.
2851 <tag/Availability/cc65
2853 <ref id="cprintf" name="cprintf">,
2854 <ref id="cputc" name="cputc">,
2855 <ref id="cputs" name="cputs">,
2856 <ref id="cputsxy" name="cputsxy">,
2857 <ref id="vcprintf" name="vcprintf">
2863 <sect1>cputs<label id="cputs"><p>
2867 <tag/Function/Output a string directly to the console.
2868 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2869 <tag/Declaration/<tt/void __fastcall__ cputs (const char* s);/
2870 <tag/Description/The function outputs the given string on the console at the
2871 current cursor position.
2872 <tag/Notes/<itemize>
2873 <item>Like all other <tt/conio/ output functions, <tt/cputs/ distinguishes
2874 between <tt/\r/ and <tt/\n/.
2875 <item>The function is only available as fastcall function, so it may only
2876 be used in presence of a prototype.
2878 <tag/Availability/cc65
2880 <ref id="cprintf" name="cprintf">,
2881 <ref id="cputc" name="cputc">,
2882 <ref id="cputcxy" name="cputcxy">,
2883 <ref id="cputsxy" name="cputsxy">,
2884 <ref id="vcprintf" name="vcprintf">
2890 <sect1>cputsxy<label id="cputsxy"><p>
2894 <tag/Function/Output a string to the console at a given position.
2895 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2896 <tag/Declaration/<tt/void __fastcall__ cputsxy (unsigned char x, unsigned char y, const char* s);/
2897 <tag/Description/<tt/cputsxy/ moves the cursor to the given x/y position,
2898 and outputs the string <tt/s/.
2899 <tag/Notes/<itemize>
2900 <item>Like all other <tt/conio/ output functions, <tt/cputsxy/ distinguishes
2901 between <tt/\r/ and <tt/\n/.
2902 <item>The function is only available as fastcall function, so it may only
2903 be used in presence of a prototype.
2905 <tag/Availability/cc65
2907 <ref id="cprintf" name="cprintf">,
2908 <ref id="cputc" name="cputc">,
2909 <ref id="cputcxy" name="cputcxy">,
2910 <ref id="cputs" name="cputs">,
2911 <ref id="vcprintf" name="vcprintf">
2917 <sect1>cursor<label id="cursor"><p>
2921 <tag/Function/Enable/disable a blinking cursor when waiting for keyboard input.
2922 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2923 <tag/Declaration/<tt/unsigned char __fastcall__ cursor (unsigned char onoff);/
2924 <tag/Description/If the argument to the function is non zero, a blinking cursor
2925 will be enabled when the <tt/cgetc/ function waits for input from the keyboard.
2926 If the argument is zero, <tt/cgetc/ will wait without a blinking cursor.
2927 <tag/Notes/<itemize>
2928 <item>The function is only available as fastcall function, so it may only
2929 be used in presence of a prototype.
2931 <tag/Availability/cc65
2933 <ref id="cgetc" name="cgetc">,
2934 <ref id="kbhit" name="kbhit">
2940 <sect1>cvline<label id="cvline"><p>
2944 <tag/Function/Output a vertical line in text mode.
2945 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2946 <tag/Declaration/<tt/void __fastcall__ cvline (unsigned char length);/
2947 <tag/Description/The function outputs a vertical line with the given length
2948 starting at the current cursor position.
2949 <tag/Notes/<itemize>
2950 <item>The character used to draw the vertical line is system dependent.
2951 If available, a line drawing character is used. Drawing a line that is partially
2952 off screen leads to undefined behaviour.
2953 <item>The function is only available as fastcall function, so it may only be
2954 used in presence of a prototype.
2956 <tag/Availability/cc65
2958 <ref id="chline" name="chline">,
2959 <ref id="chlinexy" name="chlinexy">,
2960 <ref id="cvlinexy" name="cvlinexy">
2966 <sect1>cvlinexy<label id="cvlinexy"><p>
2970 <tag/Function/Output a vertical line at a given position in text mode.
2971 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
2972 <tag/Declaration/<tt/void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);/
2973 <tag/Description/The function outputs a vertical line with the given length
2974 starting at a given position.
2975 <tag/Notes/<itemize>
2976 <item>The character used to draw the vertical line is system dependent.
2977 If available, a line drawing character is used. Drawing a line that is partially
2978 off screen leads to undefined behaviour.
2979 <item>The function is only available as fastcall function, so it may only be
2980 used in presence of a prototype.
2982 <tag/Availability/cc65
2984 <ref id="chline" name="chline">,
2985 <ref id="chlinexy" name="chlinexy">,
2986 <ref id="cvline" name="cvline">
2992 <sect1>decompress_lz4<label id="decompress_lz4"><p>
2996 <tag/Function/Uncompress a LZ4-compressed buffer.
2997 <tag/Header/<tt/<ref id="lz4.h" name="lz4.h">/
2998 <tag/Declaration/<tt/void decompress_lz4 (const unsigned char* src, unsigned char* const dst, const unsigned short uncompressed_size);/
2999 <tag/Description/<tt/decompress_lz4/ uncompresses a LZ4-compressed buffer.
3000 <tag/Notes/<itemize>
3001 <item>Use LZ4_compress_HC with compression level 16 for best compression.
3003 <tag/Availability/cc65
3009 <sect1>detect_c128<label id="detect_c128"><p>
3013 <tag/Function/Check if a C128 CPU is the current CPU.
3014 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3015 <tag/Declaration/<tt/unsigned char detect_c128 (void);/
3016 <tag/Description/The function returns a 1 if a C128 CPU is the current CPU.
3017 <tag/Notes/<itemize>
3018 <item>The function is specific to the C64 and C128.
3020 <tag/Availability/cc65 (not all platforms)
3022 <ref id="get_c128_speed" name="get_c128_speed">,
3023 <ref id="set_c128_speed" name="set_c128_speed">,
3029 <sect1>detect_c64dtv<label id="detect_c64dtv"><p>
3033 <tag/Function/Check for the presence of the C64DTV.
3034 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3035 <tag/Declaration/<tt/unsigned char detect_c64dtv (void);/
3036 <tag/Description/The function returns a 1 if a C64DTV has been detected.
3037 <tag/Notes/<itemize>
3038 <item>The function is specific to the C64.
3040 <tag/Availability/cc65 (not all platforms)
3042 <ref id="get_c64dtv_speed" name="get_c64dtv_speed">,
3043 <ref id="set_c64dtv_speed" name="set_c64dtv_speed">,
3049 <sect1>detect_c65<label id="detect_c65"><p>
3053 <tag/Function/Check for the presence of a C65/C64DX in C64 mode.
3054 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3055 <tag/Declaration/<tt/unsigned char detect_c65 (void);/
3056 <tag/Description/The function returns a 1 if a C65/C64DX in C64 mode has been detected.
3057 <tag/Notes/<itemize>
3058 <item>The function is specific to the C64.
3060 <tag/Availability/cc65 (not all platforms)
3062 <ref id="get_c65_speed" name="get_c65_speed">,
3063 <ref id="set_c65_speed" name="set_c65_speed">,
3069 <sect1>detect_chameleon<label id="detect_chameleon"><p>
3073 <tag/Function/Check for the presence of the C64 Chameleon cartridge.
3074 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3075 <tag/Declaration/<tt/unsigned char detect_chameleon (void);/
3076 <tag/Description/The function returns a 1 if a C64 Chameleon cartridge has been detected.
3077 <tag/Notes/<itemize>
3078 <item>The function is specific to the C64.
3080 <tag/Availability/cc65 (not all platforms)
3082 <ref id="get_chameleon_speed" name="get_chameleon_speed">,
3083 <ref id="set_chameleon_speed" name="set_chameleon_speed">,
3089 <sect1>detect_scpu<label id="detect_scpu"><p>
3093 <tag/Function/Check for the presence of the C64/C128 SuperCPU cartridge.
3094 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3095 <tag/Declaration/<tt/unsigned char detect_scpu (void);/
3096 <tag/Description/The function returns a 1 if a SuperCPU cartridge has been detected.
3097 <tag/Notes/<itemize>
3098 <item>The function is specific to the C128 and C64.
3100 <tag/Availability/cc65 (not all platforms)
3102 <ref id="get_scpu_speed" name="get_scpu_speed">,
3103 <ref id="set_scpu_speed" name="set_scpu_speed">,
3109 <sect1>detect_turbomaster<label id="detect_turbomaster"><p>
3113 <tag/Function/Check for the presence of the C64 Turbo Master cartridge.
3114 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3115 <tag/Declaration/<tt/unsigned char detect_turbomaster (void);/
3116 <tag/Description/The function returns a 1 if a C64 Turbo Master cartridge has been detected.
3117 <tag/Notes/<itemize>
3118 <item>The function is specific to the C64.
3120 <tag/Availability/cc65 (not all platforms)
3122 <ref id="get_turbomaster_speed" name="get_turbomaster_speed">,
3123 <ref id="set_turbomaster_speed" name="set_turbomaster_speed">,
3129 <sect1>div<label id="div"><p>
3133 <tag/Function/Divide two ints and return quotient and remainder.
3134 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3135 <tag/Declaration/<tt/div_t __fastcall__ div (int numer, int denom);/
3136 <tag/Description/<tt/div/ divides <tt/numer/ by <tt/denom/ and returns the
3137 quotient and remainder in a <tt/div_t/ structure.
3138 <tag/Notes/<itemize>
3139 <item>The function is only available as fastcall function, so it may only
3140 be used in presence of a prototype.
3142 <tag/Availability/ISO 9899
3150 <sect1>doesclrscrafterexit<label id="doesclrscrafterexit"><p>
3154 <tag/Function/Determines whether the screen is going to be cleared after program exit.
3155 <tag/Header/<tt/<ref id="cc65.h" name="cc65.h">/
3156 <tag/Declaration/<tt/unsigned char doesclrscrafterexit (void);/
3157 <tag/Description/The function returns zero if the screen won't be cleared immediately after
3158 program termination. It returns a non-zero value if it will.
3159 <tag/Notes/<itemize>
3160 <item>Some systems, maybe depending on configuration, immediately clear the screen
3161 after a program exits. Therefore it might be difficult to read
3162 the last messages printed by the program prior to its exit. This function can be used
3163 to decide if a delay or wait for a key press should be executed when then program
3166 <tag/Availability/cc65
3169 #include <stdio.h>
3170 #include <unistd.h>
3171 #include <cc65.h>
3174 printf("Hello World\n");
3175 if (doesclrscrafterexit())
3184 <sect1>em_commit<label id="em_commit"><p>
3188 <tag/Function/Commit changes into extended memory.
3189 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3190 <tag/Declaration/<tt/void em_commit (void);/
3191 <tag/Description/Commit changes in the memory window to extended storage. If
3192 the contents of the memory window have been changed, these changes may be lost
3193 if <tt/<ref id="em_map" name="em_map">/, <tt/<ref id="em_use" name="em_use">/,
3194 <tt/<ref id="em_copyfrom" name="em_copyfrom">/ or <tt/<ref id="em_copyto"
3195 name="em_copyto">/ are called without calling <tt/em_commit/ first.
3196 <tag/Notes/<itemize>
3197 <item>Calling <tt/em_commit/ does not necessarily mean that changes to the
3198 memory window are discarded, it does just mean that the drivers is allowed
3200 <item>The function is only available as fastcall function, so it may only be
3201 used in presence of a prototype.
3202 <item>The function produces undefined results if no extended memory driver is
3205 <tag/Availability/cc65
3207 <ref id="em_load_driver" name="em_load_driver">,
3208 <ref id="em_map" name="em_map">,
3209 <ref id="em_use" name="em_use">
3215 <sect1>em_copyfrom<label id="em_copyfrom"><p>
3219 <tag/Function/Copy from extended into normal memory.
3220 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3221 <tag/Declaration/<tt/void __fastcall__ em_copyfrom (const struct em_copy* copy_data);/
3222 <tag/Description/Copy data from extended memory into linear memory. Source and
3223 target addresses as well as the number of bytes to transfer are specified in
3224 the <tt/em_copy/ structure that is passed as a parameter.
3225 <tag/Notes/<itemize>
3226 <item>Calling <tt/em_copyfrom/ will invalidate the memory window, so if you
3227 made any changes to the data in the window, call <tt/<ref id="em_commit"
3228 name="em_commit">/ first, or the changes are lost.
3229 <item>The function is only available as fastcall function, so it may only be
3230 used in presence of a prototype.
3231 <item>The function produces undefined results if no extended memory driver is
3234 <tag/Availability/cc65
3236 <ref id="em_commit" name="em_commit">,
3237 <ref id="em_copyto" name="em_copyto">,
3238 <ref id="em_load_driver" name="em_load_driver">
3244 <sect1>em_copyto<label id="em_copyto"><p>
3248 <tag/Function/Copy from normal into extended memory.
3249 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3250 <tag/Declaration/<tt/void __fastcall__ em_copyto (const struct em_copy* copy_data);/
3251 <tag/Description/Copy data from linear into extended memory. Source and
3252 target addresses as well as the number of bytes to transfer are specified in
3253 the <tt/em_copy/ structure that is passed as a parameter.
3254 <tag/Notes/<itemize>
3255 <item>Calling <tt/em_copyto/ will invalidate the memory window, so if you
3256 made any changes to the data in the window, call <tt/<ref id="em_commit"
3257 name="em_commit">/ first, or the changes are lost.
3258 <item>The function is only available as fastcall function, so it may only be
3259 used in presence of a prototype.
3260 <item>The function produces undefined results if no extended memory driver is
3263 <tag/Availability/cc65
3265 <ref id="em_commit" name="em_commit">,
3266 <ref id="em_copyfrom" name="em_copyfrom">,
3267 <ref id="em_load_driver" name="em_load_driver">
3273 <sect1>em_install<label id="em_install"><p>
3277 <tag/Function/Install an already loaded extended memory driver.
3278 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3279 <tag/Declaration/<tt/unsigned char _fastcall__ em_install (void* driver);/
3280 <tag/Description/The function installs an already loaded extended memory driver
3281 and returns an error code. The function may be used to install a driver linked
3282 statically to the program.
3283 <tag/Notes/<itemize>
3284 <item>Not all drivers are able to detect if the supported hardware is really
3286 <item>The function is only available as fastcall function, so it may only be
3287 used in presence of a prototype.
3289 <tag/Availability/cc65
3291 <ref id="em_load_driver" name="em_load_driver">,
3292 <ref id="em_uninstall" name="em_uninstall">,
3293 <ref id="em_unload" name="em_unload">
3299 <sect1>em_load_driver<label id="em_load_driver"><p>
3303 <tag/Function/Load and initialize an extended memory driver.
3304 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3305 <tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/
3306 <tag/Description/Load an extended memory driver into memory and initialize
3307 it. The function returns an error code that tells if all this has been
3309 <tag/Notes/<itemize>
3310 <item>Not all drivers are able to detect if the supported hardware is really
3312 <item>The function is only available as fastcall function, so it may only be
3313 used in presence of a prototype.
3314 <item>The driver is loaded by name, so currently you must know the type of
3315 extended memory that should be supported. There is no autodetect capability.
3317 <tag/Availability/cc65
3319 <ref id="em_unload" name="em_unload">
3325 <sect1>em_map<label id="em_map"><p>
3329 <tag/Function/Make a page of extended memory accessible.
3330 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3331 <tag/Declaration/<tt/void* __fastcall__ em_map (unsigned page);/
3332 <tag/Description/The function maps one page of extended memory into linear
3333 memory and returns a pointer to the page frame. Depending on the hardware
3334 and driver, the data is either mapped into the address space or transfered
3335 into a buffer. If you don't need the actual contents of the page (for example
3336 because you're going to overwrite it completely), it is better to call
3337 <tt/<ref id="em_use" name="em_use">/ instead. <tt/em_use/ will not transfer the
3338 data if it is possible to avoid that.
3339 <tag/Notes/<itemize>
3340 <item>Calling <tt/em_map/ 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_load_driver" name="em_load_driver">,
3352 <ref id="em_use" name="em_use">
3358 <sect1>em_pagecount<label id="em_pagecount"><p>
3362 <tag/Function/Return the number of available extended memory pages.
3363 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3364 <tag/Declaration/<tt/unsigned em_pagecount (void);/
3365 <tag/Description/The function returns the size of the extended memory supported
3366 by the driver in 256 byte pages.
3367 <tag/Notes/<itemize>
3368 <item>The function returns zero if no extended memory driver is loaded.
3369 <item>The function may return zero if the supported hardware was not detected.
3371 <tag/Availability/cc65
3373 <ref id="em_load_driver" name="em_load_driver">
3379 <sect1>em_uninstall<label id="em_uninstall"><p>
3383 <tag/Function/Uninstall an already loaded extended memory driver.
3384 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3385 <tag/Declaration/<tt/unsigned char em_uninstall (void);/
3386 <tag/Description/The function uninstalls an already loaded extended memory
3387 driver but doesn't remove it from memory.
3388 <tag/Notes/<itemize>
3389 <item>If the driver has been loaded using <tt/<ref id="em_load_driver"
3390 name="em_load_driver">/, <tt/<ref id="em_unload" name="em_unload">/
3391 should be used instead of <tt/em_uninstall/ so the driver is also removed
3394 <tag/Availability/cc65
3396 <ref id="em_install" name="em_install">,
3397 <ref id="em_load_driver" name="em_load_driver">,
3398 <ref id="em_unload" name="em_unload">
3404 <sect1>em_unload<label id="em_unload"><p>
3408 <tag/Function/Unload an extended memory driver.
3409 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3410 <tag/Declaration/<tt/unsigned char em_unload (void);/
3411 <tag/Description/The function unloads a loaded extended memory driver and
3412 frees all memory allocated for the driver.
3413 <tag/Notes/<itemize>
3414 <item>The function does nothing if no driver is loaded.
3416 <tag/Availability/cc65
3418 <ref id="em_load_driver" name="em_load_driver">
3424 <sect1>em_use<label id="em_use"><p>
3428 <tag/Function/Prepare an extended memory page for use.
3429 <tag/Header/<tt/<ref id="em.h" name="em.h">/
3430 <tag/Declaration/<tt/void* __fastcall__ em_use (unsigned page);/
3431 <tag/Description/The function maps one page of extended memory into linear
3432 memory and returns a pointer to the page frame. This function is similar to
3433 <tt/<ref id="em_map" name="em_map">/, but will not transfer data into the
3434 actual memory window in the assumption that the existing data is wrong or
3435 will get overwritten.
3436 <tag/Notes/<itemize>
3437 <item>Calling <tt/em_use/ will invalidate the memory window, so if you
3438 made any changes to the data in the window, call <tt/<ref id="em_commit"
3439 name="em_commit">/ first, or the changes are lost.
3440 <item>The function is only available as fastcall function, so it may only be
3441 used in presence of a prototype.
3442 <item>The function produces undefined results if no extended memory driver is
3445 <tag/Availability/cc65
3447 <ref id="em_commit" name="em_commit">,
3448 <ref id="em_load_driver" name="em_load_driver">,
3449 <ref id="em_map" name="em_map">
3455 <sect1>exit<label id="exit"><p>
3459 <tag/Function/Terminate the program.
3460 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3461 <tag/Declaration/<tt/void __fastcall__ exit (int status);/
3462 <tag/Description/<tt/exit/ terminates the program. The argument specifies the
3463 return code of the program. Before termination, all files are closed, buffered
3464 output is written and any functions registered with <tt/<ref id="atexit"
3465 name="atexit">/ are called. Common values for status are <tt/EXIT_SUCCESS/ and
3466 <tt/EXIT_FAILURE/ which are also defined in <tt/<ref id="stdlib.h"
3468 <tag/Notes/<itemize>
3469 <item>The function is only available as fastcall function, so it may only
3470 be used in presence of a prototype.
3471 <item>It depends on the host machine if the program return code can be
3472 evaluated or is ignored.
3474 <tag/Availability/ISO 9899
3476 <ref id="abort" name="abort">,
3477 <ref id="exit" name="exit">
3483 <sect1>exec<label id="exec"><p>
3487 <tag/Function/Execute a program file.
3488 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3489 <tag/Declaration/<tt/int __fastcall__ exec (const char* progname, const char* cmdline);/
3490 <tag/Description/<tt/exec/ replaces the currently running program by a new one.
3491 Calling <tt/exec()/ is identical to calling <tt/<ref id="exit" name="exit()">/,
3492 then loading and starting the program named in the first argument, passing
3493 the command line specified as second argument. Instead of an empty string,
3494 a <tt/NULL/ pointer may be passed as second parameter.
3495 On success, the function does not return. On failure, -1 is returned and
3496 <tt/errno/ contains an error code.
3497 <tag/Notes/<itemize>
3498 <item>The function is only available as fastcall function, so it may only
3499 be used in presence of a prototype.
3500 <item>On most platforms, the function needs to copy a small stub loader to
3501 some memory area outside the program space. This may collide with other
3502 programs. See the platform specific docs on this.
3503 <item>Because it is necessary to terminate the running program before the
3504 memory can be reused to load the new one, there is a high chance that the
3505 function may not be able to return on errors.
3506 <item>The command line is passed to the new program in the same way as cc65
3507 programs expect the command line. If the new program is not a cc65 generated
3508 program, it may not be able to read it.
3510 <tag/Availability/cc65
3512 <ref id="exit" name="exit">
3518 <sect1>fast<label id="fast"><p>
3522 <tag/Function/Switch the CPU into fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
3523 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
3524 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
3525 <tag/Declaration/<tt/void fast (void);/
3526 <tag/Description/The function will switch the clock of the CPU to fast mode. For the C128
3527 target it means switching the CPU into 2MHz mode. For the C16/Plus4 target it means
3528 switching the CPU into double clock mode.
3529 <tag/Notes/<itemize>
3530 <item>The function is specific to the C128, C16 and Plus4.
3531 <item>On the C128 the 2MHz clock will not work in 40 column mode.
3533 <tag/Availability/cc65 (not all platforms)
3535 <ref id="isfast" name="isfast">,
3536 <ref id="slow" name="slow">,
3542 <sect1>feof<label id="feof"><p>
3546 <tag/Function/Return the end-of-file indicator of a stream.
3547 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3548 <tag/Declaration/<tt/int __fastcall__ feof (FILE* f);/
3549 <tag/Description/<tt/feof/ tests the end-of-file indicator ofthe stream
3550 <tt/f/, and returns a non zero value if it is set.
3551 <tag/Notes/<itemize>
3552 <item>The indicator is set only after a read past the end of a file is
3554 <item>The function is only available as fastcall function, so it may only be
3555 used in presence of a prototype.
3557 <tag/Availability/ISO 9899
3559 <ref id="feof" name="clearerr">,
3560 <ref id="ferror" name="ferror">
3566 <sect1>ferror<label id="ferror"><p>
3570 <tag/Function/Return the error indicator of a stream.
3571 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3572 <tag/Declaration/<tt/int __fastcall__ ferror (FILE* f);/
3573 <tag/Description/<tt/ferror/ tests the error indicator of the stream
3574 <tt/f/, and returns a non zero value if it is set.
3575 <tag/Notes/<itemize>
3576 <item>The function is only available as fastcall function, so it may only be
3577 used in presence of a prototype.
3579 <tag/Availability/ISO 9899
3581 <ref id="feof" name="clearerr">,
3582 <ref id="ferror" name="feof">
3588 <sect1>fileno<label id="fileno"><p>
3592 <tag/Function/Return the file handle used by a stream.
3593 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
3594 <tag/Declaration/<tt/int __fastcall__ fileno (FILE* f);/
3595 <tag/Description/The <tt/fileno/ function returns the file handle used
3596 internally by a C stream. This file handle (an integer) can be used as a
3597 handle for the POSIX input/output functions.
3598 <tag/Notes/<itemize>
3599 <item>The function is only available as fastcall function, so it may only be
3600 used in presence of a prototype.
3601 <item>Mixing C file I/O functions and POSIX file I/O functions for the same
3602 file may have unpredictable results.
3604 <tag/Availability/POSIX 1003.1
3606 <ref id="creat" name="creat">,
3607 <ref id="open" name="open"> <!-- , -->
3608 <!-- <ref id="read" name="read">, -->
3609 <!-- <ref id="write" name="write"> -->
3615 <sect1>free<label id="free"><p>
3619 <tag/Function/Free a block of dynamic memory.
3620 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3621 <tag/Declaration/<tt/void __fastcall__ free (void* block);/
3622 <tag/Description/Free a block of dynamic memory previously allocated with
3623 <tt/<ref id="malloc" name="malloc">/, <tt/<ref id="calloc" name="calloc">/
3624 or <tt/<ref id="realloc" name="realloc">/. As an exception, if the passed
3625 pointer is <tt/NULL/, no action is performed.
3626 <tag/Notes/<itemize>
3627 <item>Passing an already free'd block to <tt/free/ again will cause undefined
3628 behaviour and may crash your program.
3629 <item>The function is only available as fastcall function, so it may only
3630 be used in presence of a prototype.
3632 <tag/Availability/ISO 9899
3634 <ref id="_heapadd" name="_heapadd">,
3635 <ref id="_heapblocksize" name="_heapblocksize">,
3636 <ref id="_heapmaxavail" name="_heapmaxavail">,
3637 <ref id="_heapmemavail" name="_heapmemavail">,
3638 <ref id="calloc" name="calloc">,
3639 <ref id="malloc" name="malloc">,
3640 <ref id="realloc" name="realloc">
3646 <sect1>get_ostype<label id="get_ostype"><p>
3650 <tag/Function/The function returns the operating system, the program runs on.
3651 <tag/Header/<tt/<ref id="apple2.h" name="apple2.h">,
3652 <ref id="atari.h" name="atari.h">, <ref id="c64.h" name="c64.h">/
3653 <tag/Declaration/<tt/unsigned char get_ostype (void);/
3654 <tag/Description/<tt/get_ostype/ is machine dependent and does not exist for
3655 all supported targets. If it exists, it returns a number that identifies the
3656 operating system or machine type, the program runs on. The machine dependent
3657 header files define constants that can be used to check the return code.
3658 <tag/Notes/<itemize>
3659 <item>The function does not exist on all platforms.
3660 <item>The return codes are platform dependent.
3662 <tag/Availability/cc65 (not all platforms)
3668 <sect1>get_c128_speed<label id="get_c128_speed"><p>
3672 <tag/Function/Get the current speed of the C128 CPU.
3673 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3674 <tag/Declaration/<tt/unsigned char get_c128_speed (void);/
3675 <tag/Description/The function returns the current speed of the C128 CPU.
3676 <tag/Notes/<itemize>
3677 <item>The function is specific to the C64 and C128.
3678 <item>The function does not check if the C128 CPU is the current CPU.
3679 <item>See the accelerator.h header for the speed definitions.
3681 <tag/Availability/cc65 (not all platforms)
3683 <ref id="detect_c128" name="detect_c128">,
3684 <ref id="set_c128_speed" name="set_c128_speed">,
3690 <sect1>get_c64dtv_speed<label id="get_c64dtv_speed"><p>
3694 <tag/Function/Get the current speed of the C64DTV.
3695 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3696 <tag/Declaration/<tt/unsigned char get_c64dtv_speed (void);/
3697 <tag/Description/The function returns the current speed of the C64DTV.
3698 <tag/Notes/<itemize>
3699 <item>The function is specific to the C64.
3700 <item>The function does not check for the presence of the C64DTV.
3701 <item>See the accelerator.h header for the speed definitions.
3703 <tag/Availability/cc65 (not all platforms)
3705 <ref id="detect_c64dtv" name="detect_c64dtv">,
3706 <ref id="set_c64dtv_speed" name="set_c64dtv_speed">,
3712 <sect1>get_c65_speed<label id="get_c65_speed"><p>
3716 <tag/Function/Get the current speed of the C65/C64DX in C64 mode.
3717 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3718 <tag/Declaration/<tt/unsigned char get_c65_speed (void);/
3719 <tag/Description/The function returns the current speed of the C65/C64DX in C64 mode.
3720 <tag/Notes/<itemize>
3721 <item>The function is specific to the C64.
3722 <item>The function does not check for the presence of a C65/C64DX in C64 mode.
3723 <item>See the accelerator.h header for the speed definitions.
3725 <tag/Availability/cc65 (not all platforms)
3727 <ref id="detect_c65" name="detect_c65">,
3728 <ref id="set_c65_speed" name="set_c65_speed">,
3734 <sect1>get_chameleon_speed<label id="get_chameleon_speed"><p>
3738 <tag/Function/Get the current speed of the C64 Chameleon cartridge.
3739 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3740 <tag/Declaration/<tt/unsigned char get_chameleon_speed (void);/
3741 <tag/Description/The function returns the current speed of the C64 Chameleon cartridge.
3742 <tag/Notes/<itemize>
3743 <item>The function is specific to the C64.
3744 <item>The function does not check for the presence of the C64 Chameleon cartridge.
3745 <item>See the accelerator.h header for the speed definitions.
3747 <tag/Availability/cc65 (not all platforms)
3749 <ref id="detect_chameleon" name="detect_chameleon">,
3750 <ref id="set_chameleon_speed" name="set_chameleon_speed">,
3756 <sect1>get_scpu_speed<label id="get_scpu_speed"><p>
3760 <tag/Function/Get the current speed of the C64/C128 SuperCPU cartridge.
3761 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3762 <tag/Declaration/<tt/unsigned char get_scpu_speed (void);/
3763 <tag/Description/The function returns the current speed of the SuperCPU cartridge.
3764 <tag/Notes/<itemize>
3765 <item>The function is specific to the C128 and C64.
3766 <item>The function does not check for the presence of the cartridge.
3767 <item>See the accelerator.h header for the speed definitions.
3769 <tag/Availability/cc65 (not all platforms)
3771 <ref id="detect_scpu" name="detect_scpu">,
3772 <ref id="set_scpu_speed" name="set_scpu_speed">,
3778 <sect1>get_turbomaster_speed<label id="get_turbomaster_speed"><p>
3782 <tag/Function/Get the current speed of the C64 Turbo Master cartridge.
3783 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
3784 <tag/Declaration/<tt/unsigned char get_turbomaster_speed (void);/
3785 <tag/Description/The function returns the current speed of the C64 Turbo Master cartridge.
3786 <tag/Notes/<itemize>
3787 <item>The function is specific to the C64.
3788 <item>The function does not check for the presence of the C64 Turbo Master cartridge.
3789 <item>See the accelerator.h header for the speed definitions.
3791 <tag/Availability/cc65 (not all platforms)
3793 <ref id="detect_turbomaster" name="detect_turbomaster">,
3794 <ref id="set_turbomaster_speed" name="set_turbomaster_speed">,
3799 <sect1>getcpu<label id="getcpu"><p>
3803 <tag/Function/Determine on which CPU the program is running.
3804 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
3805 <tag/Declaration/<tt/unsigned char getcpu (void);/
3806 <tag/Description/The function checks on which CPU the code is running. It
3807 returns one of the constants<itemize>
3809 <item><tt/CPU_65C02/
3810 <item><tt/CPU_65816/
3812 <item><tt/CPU_65SC02/
3813 <item><tt/CPU_65CE02/
3814 <item><tt/CPU_HUC6280/
3817 <tag/Notes/<itemize>
3818 <item>Other, more exotic CPU types are not disinguished.
3820 <tag/Availability/cc65
3826 <sect1>getcurrentdevice<label id="getcurrentdevice"><p>
3830 <tag/Function/Get current device.
3831 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3832 <tag/Declaration/<tt/unsigned char getcurrentdevice (void);/
3833 <tag/Description/The function returns the current device.
3834 It allows to access the current device with the <ref id="dio.h"
3835 name="Low-level disk I/O API"> or <ref id="cbm.h" name="cbm_* I/O
3836 functions"> requiring a 'device' parameter.
3837 <tag/Availability/cc65
3839 <ref id="getdevicedir" name="getdevicedir">,
3840 <ref id="getfirstdevice" name="getfirstdevice">,
3841 <ref id="getnextdevice" name="getnextdevice">
3843 dio_open (getcurrentdevice ());
3849 <sect1>getcwd<label id="getcwd"><p>
3853 <tag/Function/Get current working directory.
3854 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3855 <tag/Declaration/<tt/char* __fastcall__ getcwd (char* buf, size_t size);/
3856 <tag/Description/The function will return the current working directory.
3857 <tag/Notes/<itemize>
3858 <item>The function is only available as fastcall function, so it may only
3859 be used in presence of a prototype.
3861 <tag/Availability/POSIX 1003.1
3867 <sect1>getdevicedir<label id="getdevicedir"><p>
3871 <tag/Function/Get device directory.
3872 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3873 <tag/Declaration/<tt/char* __fastcall__ getdevicedir (unsigned char device, char* buf, size_t size);/
3874 <tag/Description/The function returns the directory representing <tt/device/.
3875 It allows to access the device on filesystem level by calling chdir() with
3876 the directory returned.
3877 <tag/Notes/<itemize>
3878 <item>Calling getdevicedir() <em/does/ check for a (formatted) disk in a
3879 floppy-disk-type device and returns NULL if that check fails.
3880 <item>The function is only available as fastcall function, so it may only
3881 be used in presence of a prototype.
3883 <tag/Availability/cc65
3885 <ref id="getcwd" name="getcwd">,
3886 <ref id="getcurrentdevice" name="getcurrentdevice">,
3887 <ref id="getfirstdevice" name="getfirstdevice">,
3888 <ref id="getnextdevice" name="getnextdevice">
3890 chdir (getdevicedir (device, buf, sizeof buf));
3892 cf. <tt/samples/enumdevdir.c/
3897 <sect1>getenv<label id="getenv"><p>
3901 <tag/Function/Return a value from the environment.
3902 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
3903 <tag/Declaration/<tt/char* __fastcall__ getenv (const char* name);/
3904 <tag/Description/The function searches the environment for an entry that
3905 matches <tt/name/ and returns its value. The environment consists of a list
3906 of strings in the form <tt/name=value/. If there is no match, <tt/getenv/
3908 <tag/Notes/<itemize>
3909 <item>What exactly is stored in the environment depends on the machine the
3910 program is running on.
3911 <item>The function is only available as fastcall function, so it may only
3912 be used in presence of a prototype.
3914 <tag/Availability/ISO 9899
3920 <sect1>getfirstdevice<label id="getfirstdevice"><p>
3924 <tag/Function/Get first device.
3925 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3926 <tag/Declaration/<tt/unsigned char getfirstdevice (void);/
3927 <tag/Description/The function returns the first device.
3928 The constant <tt/INVALID_DEVICE/ indicates no device.
3929 <tag/Notes/<itemize>
3930 <item>Calling getfirstdevice() does <em/not/ turn on the motor of a
3931 drive-type device and does <em/not/ check for a disk in the drive.
3933 <tag/Availability/cc65
3935 <ref id="getcurrentdevice" name="getcurrentdevice">,
3936 <ref id="getdevicedir" name="getdevicedir">,
3937 <ref id="getnextdevice" name="getnextdevice">
3939 unsigned char dev = getfirstdevice ();
3940 while (dev != INVALID_DEVICE) {
3941 printf ("%d\n", dev);
3942 dev = getnextdevice (dev);
3949 <sect1>getnextdevice<label id="getnextdevice"><p>
3953 <tag/Function/Get next device.
3954 <tag/Header/<tt/<ref id="device.h" name="device.h">/
3955 <tag/Declaration/<tt/unsigned char __fastcall__ getnextdevice (unsigned char device);/
3956 <tag/Description/The function returns the next device after <tt/device/.
3957 The constant <tt/INVALID_DEVICE/ indicates no further device.
3958 <tag/Notes/<itemize>
3959 <item>Calling getnextdevice() does <em/not/ turn on the motor of a
3960 drive-type device and does <em/not/ check for a disk in the drive.
3961 <item>The function is only available as fastcall function, so it may only
3962 be used in presence of a prototype.
3964 <tag/Availability/cc65
3966 <ref id="getcurrentdevice" name="getcurrentdevice">,
3967 <ref id="getdevicedir" name="getdevicedir">,
3968 <ref id="getfirstdevice" name="getfirstdevice">
3970 unsigned char dev = getfirstdevice ();
3971 while (dev != INVALID_DEVICE) {
3972 printf ("%d\n", dev);
3973 dev = getnextdevice (dev);
3980 <sect1>getopt<label id="getopt"><p>
3984 <tag/Function/Parse command line options.
3985 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
3986 <tag/Declaration/<tt/int __fastcall__ getopt (int argc, char* const* argv,
3987 const char* optstring);/
3988 <tag/Description/The function parses command line arguments, <tt/argc/ and
3989 <tt/argv/ are the argument count and array passed to <tt/main/. <tt/optstring/
3990 is a string that contains command line option characters. If a character in
3991 <tt/optstring/ is followed by a colon, the option requires an argument. An
3992 option on the command line is recognized if it is one of the option characters
3994 <tt/getopt/ must be called repeatedly. It will return each option character
3995 found on the command line and <tt/EOF/ (-1) if there is no other option. An
3996 option argument is placed in <tt/optarg/, the index of the next element on the
3997 command line to be processed is placed in <tt/optind/.
3998 <tag/Notes/<itemize>
3999 <item>The implementation will not reorder options. A non option on the command
4000 line will terminate option processing. All remaining arguments are not
4001 recognized as options, even if the start with a '-' character.
4002 <item>The function is only available as fastcall function, so it may only
4003 be used in presence of a prototype.
4005 <tag/Availability/POSIX.2
4011 <sect1>gotox<label id="gotox"><p>
4015 <tag/Function/Move the text mode cursor to a new X position.
4016 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4017 <tag/Declaration/<tt/void __fastcall__ gotox (unsigned char x);/
4018 <tag/Description/The function moves the text mode cursor to the specified X
4019 position while leaving the Y position untouched. The leftmost position on the
4020 screen has the coordinate 0.
4021 <tag/Notes/<itemize>
4022 <item>The function is only available as fastcall function, so it may
4023 only be used in presence of a prototype.
4024 <item>Invalid values for the X position (out of screen coordinates) may
4025 lead to undefined behaviour.
4027 <tag/Availability/cc65
4029 <ref id="gotoy" name="gotoy">,
4030 <ref id="gotoxy" name="gotoxy">,
4031 <ref id="wherex" name="wherex">,
4032 <ref id="wherey" name="wherey">
4038 <sect1>gotoxy<label id="gotoxy"><p>
4042 <tag/Function/Move the text mode cursor to a new position.
4043 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4044 <tag/Declaration/<tt/void __fastcall__ gotoxy (unsigned char x, unsigned char y);/
4045 <tag/Description/The function moves the text mode cursor to the specified
4046 position. The leftmost position on the screen has the X coordinate 0, the
4047 topmost line has the Y coordinate 0.
4048 <tag/Notes/<itemize>
4049 <item>The function is only available as fastcall function, so it may only be
4050 used in presence of a prototype.
4051 <item>Invalid values for any of both coordinates (out of screen positions) may
4052 lead to undefined behaviour.
4054 <tag/Availability/cc65
4056 <ref id="gotox" name="gotox">,
4057 <ref id="gotoy" name="gotoy">,
4058 <ref id="wherex" name="wherex">,
4059 <ref id="wherey" name="wherey">
4065 <sect1>gotoy<label id="gotoy"><p>
4069 <tag/Function/Move the text mode cursor to a new Y position.
4070 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4071 <tag/Declaration/<tt/void __fastcall__ gotoy (unsigned char x);/
4072 <tag/Description/The function moves the text mode cursor to the specified Y
4073 position while leaving the X position untouched. The uppermost position on the
4074 screen has the coordinate 0.
4075 <tag/Notes/<itemize>
4076 <item>The function is only available as fastcall function, so it may
4077 only be used in presence of a prototype.
4078 <item>Invalid values for the Y position (out of screen coordinates) may lead
4079 to undefined behaviour.
4081 <tag/Availability/cc65
4083 <ref id="gotox" name="gotox">,
4084 <ref id="gotoxy" name="gotoxy">,
4085 <ref id="wherex" name="wherex">,
4086 <ref id="wherey" name="wherey">
4092 <sect1>isalnum<label id="isalnum"><p>
4096 <tag/Function/Check if a given character is a letter or digit.
4097 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4098 <tag/Declaration/<tt/int __fastcall__ isalnum (int c);/
4099 <tag/Description/The function returns a non zero value if the given argument
4100 is a letter or digit. The return value is zero if the character is anything
4102 <tag/Notes/<itemize>
4103 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4104 inline sequence generated by the macro will not work correctly for values
4105 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4106 this range. The non inline function may be accessed by <tt/#undef/'ing
4108 <item>When compiling without <tt/-Os/, the function is only available as
4109 fastcall function, so it may only be used in presence of a prototype.
4111 <tag/Availability/ISO 9899
4113 <ref id="isalpha" name="isalpha">,
4114 <ref id="isascii" name="isascii">,
4115 <ref id="isblank" name="isblank">,
4116 <ref id="iscntrl" name="iscntrl">,
4117 <ref id="isdigit" name="isdigit">,
4118 <ref id="isgraph" name="isgraph">,
4119 <ref id="islower" name="islower">,
4120 <ref id="isprint" name="isprint">,
4121 <ref id="ispunct" name="ispunct">,
4122 <ref id="isspace" name="isspace">,
4123 <ref id="isupper" name="isupper">,
4124 <ref id="isxdigit" name="isxdigit">
4130 <sect1>isalpha<label id="isalpha"><p>
4134 <tag/Function/Check if a given character is a letter.
4135 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4136 <tag/Declaration/<tt/int __fastcall__ isalpha (int c);/
4137 <tag/Description/The function returns a non zero value if the given argument
4138 is a letter. The return value is zero if the character is anything else.
4139 <tag/Notes/<itemize>
4140 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4141 inline sequence generated by the macro will not work correctly for values
4142 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4143 this range. The non inline function may be accessed by <tt/#undef/'ing the
4145 <item>When compiling without <tt/-Os/, the function is only available as
4146 fastcall function, so it may only be used in presence of a prototype.
4148 <tag/Availability/ISO 9899
4150 <ref id="isalnum" name="isalnum">,
4151 <ref id="isascii" name="isascii">,
4152 <ref id="isblank" name="isblank">,
4153 <ref id="iscntrl" name="iscntrl">,
4154 <ref id="isdigit" name="isdigit">,
4155 <ref id="isgraph" name="isgraph">,
4156 <ref id="islower" name="islower">,
4157 <ref id="isprint" name="isprint">,
4158 <ref id="ispunct" name="ispunct">,
4159 <ref id="isspace" name="isspace">,
4160 <ref id="isupper" name="isupper">,
4161 <ref id="isxdigit" name="isxdigit">
4167 <sect1>isascii<label id="isascii"><p>
4171 <tag/Function/Check if a given character is in the ASCII (0..127) range.
4172 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4173 <tag/Declaration/<tt/int __fastcall__ isascii (int c);/
4174 <tag/Description/The function returns a non zero value if the given argument
4175 is in the range 0..127 (the range of valid ASCII characters) and zero if not.
4176 <tag/Notes/<itemize>
4177 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4178 inline sequence generated by the macro will not work correctly for values
4179 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4180 this range. The non inline function may be accessed by <tt/#undef/'ing the
4182 <item>When compiling without <tt/-Os/, the function is only available as
4183 fastcall function, so it may only be used in presence of a prototype.
4185 <tag/Availability/ISO 9899
4187 <ref id="isalnum" name="isalnum">,
4188 <ref id="isalpha" name="isalpha">,
4189 <ref id="isblank" name="isblank">,
4190 <ref id="iscntrl" name="iscntrl">,
4191 <ref id="isdigit" name="isdigit">,
4192 <ref id="isgraph" name="isgraph">,
4193 <ref id="islower" name="islower">,
4194 <ref id="isprint" name="isprint">,
4195 <ref id="ispunct" name="ispunct">,
4196 <ref id="isspace" name="isspace">,
4197 <ref id="isupper" name="isupper">,
4198 <ref id="isxdigit" name="isxdigit">
4204 <sect1>isblank<label id="isblank"><p>
4208 <tag/Function/Check if a given character is a space or tab.
4209 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4210 <tag/Declaration/<tt/int __fastcall__ isblank (int c);/
4211 <tag/Description/The function returns a non zero value if the given argument
4212 is a space or tab character. The return value is zero if the character is
4214 <tag/Notes/<itemize>
4215 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4216 inline sequence generated by the macro will not work correctly for values
4217 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4218 this range. The non inline function may be accessed by <tt/#undef/'ing the
4220 <item>When compiling without <tt/-Os/, the function is only available as
4221 fastcall function, so it may only be used in presence of a prototype.
4223 <tag/Availability/ISO 9899
4225 <ref id="isalnum" name="isalnum">,
4226 <ref id="isalpha" name="isalpha">,
4227 <ref id="isascii" name="isascii">,
4228 <ref id="iscntrl" name="iscntrl">,
4229 <ref id="isdigit" name="isdigit">,
4230 <ref id="isgraph" name="isgraph">,
4231 <ref id="islower" name="islower">,
4232 <ref id="isprint" name="isprint">,
4233 <ref id="ispunct" name="ispunct">,
4234 <ref id="isspace" name="isspace">,
4235 <ref id="isupper" name="isupper">,
4236 <ref id="isxdigit" name="isxdigit">
4242 <sect1>iscntrl<label id="iscntrl"><p>
4246 <tag/Function/Check if a given character is a control character.
4247 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4248 <tag/Declaration/<tt/int __fastcall__ iscntrl (int c);/
4249 <tag/Description/The function returns a non zero value if the given argument
4250 is a control character. The return value is zero if the character is anything
4252 <tag/Notes/<itemize>
4253 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4254 inline sequence generated by the macro will not work correctly for values
4255 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4256 this range. The non inline function may be accessed by <tt/#undef/'ing the
4258 <item>When compiling without <tt/-Os/, the function is only available as
4259 fastcall function, so it may only be used in presence of a prototype.
4261 <tag/Availability/ISO 9899
4263 <ref id="isalnum" name="isalnum">,
4264 <ref id="isalpha" name="isalpha">,
4265 <ref id="isascii" name="isascii">,
4266 <ref id="isblank" name="isblank">,
4267 <ref id="isdigit" name="isdigit">,
4268 <ref id="isgraph" name="isgraph">,
4269 <ref id="islower" name="islower">,
4270 <ref id="isprint" name="isprint">,
4271 <ref id="ispunct" name="ispunct">,
4272 <ref id="isspace" name="isspace">,
4273 <ref id="isupper" name="isupper">,
4274 <ref id="isxdigit" name="isxdigit">
4280 <sect1>isdigit<label id="isdigit"><p>
4284 <tag/Function/Check if a given character is a digit.
4285 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4286 <tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
4287 <tag/Description/The function returns a non zero value if the given argument
4288 is a digit. The return value is zero if the character is anything else.
4289 <tag/Notes/<itemize>
4290 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4291 inline sequence generated by the macro will not work correctly for values
4292 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4293 this range. The non inline function may be accessed by <tt/#undef/'ing the
4295 <item>When compiling without <tt/-Os/, the function is only available as
4296 fastcall function, so it may only be used in presence of a prototype.
4298 <tag/Availability/ISO 9899
4300 <ref id="isalnum" name="isalnum">,
4301 <ref id="isalpha" name="isalpha">,
4302 <ref id="isascii" name="isascii">,
4303 <ref id="isblank" name="isblank">,
4304 <ref id="iscntrl" name="iscntrl">,
4305 <ref id="isgraph" name="isgraph">,
4306 <ref id="islower" name="islower">,
4307 <ref id="isprint" name="isprint">,
4308 <ref id="ispunct" name="ispunct">,
4309 <ref id="isspace" name="isspace">,
4310 <ref id="isupper" name="isupper">,
4311 <ref id="isxdigit" name="isxdigit">
4317 <sect1>isfast<label id="isfast"><p>
4321 <tag/Function/Check if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
4322 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
4323 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
4324 <tag/Declaration/<tt/unsigned char isfast (void);/
4325 <tag/Description/The function returns a 1 if the CPU is in fast mode (C128: 2MHz mode, C16/Plus4: double clock mode).
4326 <tag/Notes/<itemize>
4327 <item>The function is specific to the C128, C16 and Plus4.
4329 <tag/Availability/cc65 (not all platforms)
4331 <ref id="fast" name="fast">,
4332 <ref id="slow" name="slow">,
4338 <sect1>isgraph<label id="isgraph"><p>
4342 <tag/Function/Check if a given character is a printable character (except
4344 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4345 <tag/Declaration/<tt/int __fastcall__ isgraph (int c);/
4346 <tag/Description/The function returns a non zero value if the given argument
4347 is a printable character with the exception of space. The return value is zero
4348 if the character is anything else.
4349 <tag/Notes/<itemize>
4350 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4351 inline sequence generated by the macro will not work correctly for values
4352 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4353 this range. The non inline function may be accessed by <tt/#undef/'ing the
4355 <item>When compiling without <tt/-Os/, the function is only available as
4356 fastcall function, so it may only be used in presence of a prototype.
4358 <tag/Availability/ISO 9899
4360 <ref id="isalnum" name="isalnum">,
4361 <ref id="isalpha" name="isalpha">,
4362 <ref id="isascii" name="isascii">,
4363 <ref id="isblank" name="isblank">,
4364 <ref id="iscntrl" name="iscntrl">,
4365 <ref id="isdigit" name="isdigit">,
4366 <ref id="islower" name="islower">,
4367 <ref id="isprint" name="isprint">,
4368 <ref id="ispunct" name="ispunct">,
4369 <ref id="isspace" name="isspace">,
4370 <ref id="isupper" name="isupper">,
4371 <ref id="isxdigit" name="isxdigit">
4377 <sect1>islower<label id="islower"><p>
4381 <tag/Function/Check if a given character is a lower case letter.
4382 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4383 <tag/Declaration/<tt/int __fastcall__ islower (int c);/
4384 <tag/Description/The function returns a non zero value if the given argument
4385 is a lower case letter. The return value is zero if the character is anything
4387 <tag/Notes/<itemize>
4388 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4389 inline sequence generated by the macro will not work correctly for values
4390 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4391 this range. The non inline function may be accessed by <tt/#undef/'ing the
4393 <item>When compiling without <tt/-Os/, the function is only available as
4394 fastcall function, so it may only be used in presence of a prototype.
4396 <tag/Availability/ISO 9899
4398 <ref id="isalnum" name="isalnum">,
4399 <ref id="isalpha" name="isalpha">,
4400 <ref id="isascii" name="isascii">,
4401 <ref id="isblank" name="isblank">,
4402 <ref id="iscntrl" name="iscntrl">,
4403 <ref id="isdigit" name="isdigit">,
4404 <ref id="isgraph" name="isgraph">,
4405 <ref id="isprint" name="isprint">,
4406 <ref id="ispunct" name="ispunct">,
4407 <ref id="isspace" name="isspace">,
4408 <ref id="isupper" name="isupper">,
4409 <ref id="isxdigit" name="isxdigit">
4415 <sect1>isprint<label id="isprint"><p>
4419 <tag/Function/Check if a given character is a printable character.
4420 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4421 <tag/Declaration/<tt/int __fastcall__ isprint (int c);/
4422 <tag/Description/The function returns a non zero value if the given argument
4423 is a printable character (this includes the space character). The return value
4424 is zero if the character is anything else.
4425 <tag/Notes/<itemize>
4426 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4427 inline sequence generated by the macro will not work correctly for values
4428 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4429 this range. The non inline function may be accessed by <tt/#undef/'ing the
4431 <item>When compiling without <tt/-Os/, the function is only available as
4432 fastcall function, so it may only be used in presence of a prototype.
4434 <tag/Availability/ISO 9899
4436 <ref id="isalnum" name="isalnum">,
4437 <ref id="isalpha" name="isalpha">,
4438 <ref id="isascii" name="isascii">,
4439 <ref id="isblank" name="isblank">,
4440 <ref id="iscntrl" name="iscntrl">,
4441 <ref id="isdigit" name="isdigit">,
4442 <ref id="isgraph" name="isgraph">,
4443 <ref id="islower" name="islower">,
4444 <ref id="ispunct" name="ispunct">,
4445 <ref id="isspace" name="isspace">,
4446 <ref id="isupper" name="isupper">,
4447 <ref id="isxdigit" name="isxdigit">
4453 <sect1>ispunct<label id="ispunct"><p>
4457 <tag/Function/Check if a given character is a printable character but not a
4458 space or an alphanumeric character.
4459 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4460 <tag/Declaration/<tt/int __fastcall__ ispunct (int c);/
4461 <tag/Description/The function returns a non zero value if the given argument
4462 is a printable character, but not a space or anything alphanumeric. The return
4463 value is zero if the character is anything else.
4464 <tag/Notes/<itemize>
4465 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4466 inline sequence generated by the macro will not work correctly for values
4467 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4468 this range. The non inline function may be accessed by <tt/#undef/'ing the
4470 <item>When compiling without <tt/-Os/, the function is only available as
4471 fastcall function, so it may only be used in presence of a prototype.
4473 <tag/Availability/ISO 9899
4475 <ref id="isalnum" name="isalnum">,
4476 <ref id="isalpha" name="isalpha">,
4477 <ref id="isascii" name="isascii">,
4478 <ref id="isblank" name="isblank">,
4479 <ref id="iscntrl" name="iscntrl">,
4480 <ref id="isdigit" name="isdigit">,
4481 <ref id="isgraph" name="isgraph">,
4482 <ref id="islower" name="islower">,
4483 <ref id="isprint" name="isprint">,
4484 <ref id="isspace" name="isspace">,
4485 <ref id="isupper" name="isupper">,
4486 <ref id="isxdigit" name="isxdigit">
4492 <sect1>isspace<label id="isspace"><p>
4496 <tag/Function/Check if a given character is a white-space character.
4497 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4498 <tag/Declaration/<tt/int __fastcall__ isspace (int c);/
4499 <tag/Description/The function returns a non zero value if the given argument
4500 is a white space character. The return value is zero if the character is
4501 anything else. The standard white space characters are: space, formfeed ('\f'),
4502 newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
4504 <tag/Notes/<itemize>
4505 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4506 inline sequence generated by the macro will not work correctly for values
4507 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4508 this range. The non inline function may be accessed by <tt/#undef/'ing the
4510 <item>When compiling without <tt/-Os/, the function is only available as
4511 fastcall function, so it may only be used in presence of a prototype.
4513 <tag/Availability/ISO 9899
4515 <ref id="isalnum" name="isalnum">,
4516 <ref id="isalpha" name="isalpha">,
4517 <ref id="isascii" name="isascii">,
4518 <ref id="isblank" name="isblank">,
4519 <ref id="iscntrl" name="iscntrl">,
4520 <ref id="isdigit" name="isdigit">,
4521 <ref id="isgraph" name="isgraph">,
4522 <ref id="islower" name="islower">,
4523 <ref id="isprint" name="isprint">,
4524 <ref id="ispunct" name="ispunct">,
4525 <ref id="isupper" name="isupper">,
4526 <ref id="isxdigit" name="isxdigit">
4532 <sect1>isupper<label id="isupper"><p>
4536 <tag/Function/Check if a given character is an upper case letter.
4537 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4538 <tag/Declaration/<tt/int __fastcall__ isupper (int c);/
4539 <tag/Description/The function returns a non zero value if the given argument
4540 is an upper case letter. The return value is zero if the character is anything
4542 <tag/Notes/<itemize>
4543 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4544 inline sequence generated by the macro will not work correctly for values
4545 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4546 this range. The non inline function may be accessed by <tt/#undef/'ing the
4548 <item>When compiling without <tt/-Os/, the function is only available as
4549 fastcall function, so it may only be used in presence of a prototype.
4551 <tag/Availability/ISO 9899
4553 <ref id="isalnum" name="isalnum">,
4554 <ref id="isalpha" name="isalpha">,
4555 <ref id="isascii" name="isascii">,
4556 <ref id="isblank" name="isblank">,
4557 <ref id="iscntrl" name="iscntrl">,
4558 <ref id="isdigit" name="isdigit">,
4559 <ref id="isgraph" name="isgraph">,
4560 <ref id="islower" name="islower">,
4561 <ref id="isprint" name="isprint">,
4562 <ref id="ispunct" name="ispunct">,
4563 <ref id="isspace" name="isspace">,
4564 <ref id="isxdigit" name="isxdigit">
4570 <sect1>isxdigit<label id="isxdigit"><p>
4574 <tag/Function/Check if a given character is a hexadecimal digit.
4575 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
4576 <tag/Declaration/<tt/int __fastcall__ isxdigit (int c);/
4577 <tag/Description/The function returns a non zero value if the given argument
4578 is a hexadecimal digit (0..9, a..f and A..F). The return value is zero if the
4579 character is anything else.
4580 <tag/Notes/<itemize>
4581 <item>When compiling with <tt/-Os/ the function is actually a macro. The
4582 inline sequence generated by the macro will not work correctly for values
4583 outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
4584 this range. The non inline function may be accessed by <tt/#undef/'ing the
4586 <item>When compiling without <tt/-Os/, the function is only available as
4587 fastcall function, so it may only be used in presence of a prototype.
4589 <tag/Availability/ISO 9899
4591 <ref id="isalnum" name="isalnum">,
4592 <ref id="isalpha" name="isalpha">,
4593 <ref id="isascii" name="isascii">,
4594 <ref id="isblank" name="isblank">,
4595 <ref id="iscntrl" name="iscntrl">,
4596 <ref id="isdigit" name="isdigit">,
4597 <ref id="isgraph" name="isgraph">,
4598 <ref id="islower" name="islower">,
4599 <ref id="isprint" name="isprint">,
4600 <ref id="ispunct" name="ispunct">,
4601 <ref id="isspace" name="isspace">,
4602 <ref id="isupper" name="isupper">
4608 <sect1>itoa<label id="itoa"><p>
4612 <tag/Function/Convert an integer into a string.
4613 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4614 <tag/Declaration/<tt/char* __fastcall__ itoa (int val, char* buf, int radix);/
4615 <tag/Description/<tt/itoa/ converts the integer <tt/val/ into a string using
4616 <tt/radix/ as the base.
4617 <tag/Notes/<itemize>
4618 <item>There are no provisions to prevent a buffer overflow.
4619 <item>If <tt/val/ contains <tt/INT_MIN/, the behaviour is undefined.
4620 <item>The function is non standard, so it is not available in strict ANSI mode.
4621 You should probably use <tt/sprintf/ instead.
4622 <item>The function is only available as fastcall function, so it may only be
4623 used in presence of a prototype.
4625 <tag/Availability/cc65
4627 <ref id="atoi" name="atoi">,
4628 <ref id="atol" name="atol">,
4629 <ref id="ltoa" name="ltoa">,
4630 <ref id="ultoa" name="ultoa">,
4631 <ref id="utoa" name="utoa">
4637 <sect1>joy_count<label id="joy_count"><p>
4641 <tag/Function/Return the number of joysticks supported by the current driver.
4642 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4643 <tag/Declaration/<tt/unsigned char joy_count (void);/
4644 <tag/Description/The function returns a the number of joysticks supported
4645 by the current joystick driver.
4646 <tag/Notes/<itemize>
4647 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4648 name="joy_load_driver"> before calling this function.
4649 <item>The function returns the number of joysticks supported by the driver.
4650 There's no way to check for the number of actually connected joysticks.
4652 <tag/Availability/cc65
4654 <ref id="joy_load_driver" name="joy_load_driver">,
4655 <ref id="joy_read" name="joy_read">
4661 <sect1>joy_install<label id="joy_install"><p>
4665 <tag/Function/Install an already loaded driver and return an error code.
4666 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4667 <tag/Declaration/<tt/unsigned char __fastcall__ joy_install (void* driver);/
4668 <tag/Description/The function installs a driver that was already loaded into
4669 memory (or linked statically to the program). It returns an error code
4670 (<tt/JOY_ERR_OK/ in case of success).
4671 <tag/Notes/<itemize>
4672 <item>The function is only available as fastcall function, so it may only be
4673 used in presence of a prototype.
4675 <tag/Availability/cc65
4677 <ref id="joy_load_driver" name="joy_load_driver">,
4678 <ref id="joy_uninstall" name="joy_uninstall">,
4679 <ref id="joy_unload" name="joy_unload">
4685 <sect1>joy_load_driver<label id="joy_load_driver"><p>
4689 <tag/Function/Load a driver from disk and install it.
4690 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4691 <tag/Declaration/<tt/unsigned char __fastcall__ joy_load_driver (const char* driver);/
4692 <tag/Description/The function loads a driver with the given name from disk
4693 and installs it. An error code is returned, which is <tt/JOY_ERR_OK/ if the
4694 driver was successfully loaded and installed.
4695 <tag/Notes/<itemize>
4696 <item>The function is only available as fastcall function, so it may only be
4697 used in presence of a prototype.
4699 <tag/Availability/cc65
4701 <ref id="joy_install" name="joy_install">,
4702 <ref id="joy_uninstall" name="joy_uninstall">,
4703 <ref id="joy_unload" name="joy_unload">
4709 <sect1>joy_read<label id="joy_read"><p>
4713 <tag/Function/Read the status of a joystick.
4714 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4715 <tag/Declaration/<tt/unsigned char __fastcall__ joy_read (unsigned char joystick);/
4716 <tag/Description/The function reads the status bits for a joystick. The number
4717 of the joystick is passed as parameter. The result may be examined by using one
4718 of the <tt/JOY_xxx/ macros from <ref id="joystick.h" name="joystick.h">.
4719 <tag/Notes/<itemize>
4720 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4721 name="joy_load_driver"> before calling this function.
4722 <item>The function is only available as fastcall function, so it may only be
4723 used in presence of a prototype.
4725 <tag/Availability/cc65
4727 <ref id="joy_count" name="joy_count">,
4728 <ref id="joy_load_driver" name="joy_load_driver">,
4729 <ref id="joy_unload" name="joy_unload">
4735 <sect1>joy_uninstall<label id="joy_uninstall"><p>
4739 <tag/Function/Uninstall the current joystick driver.
4740 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4741 <tag/Declaration/<tt/unsigned char joy_uninstall (void);/
4742 <tag/Description/The function uninstalls the currently installed joystick
4743 driver. It does not remove the driver from memory. The function returns an
4744 error code, which is <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4745 <tag/Notes/<itemize>
4746 <item>A joystick driver must be installed using <ref id="joy_install"
4747 name="joy_install"> before calling this function.
4749 <tag/Availability/cc65
4751 <ref id="joy_install" name="joy_install">,
4752 <ref id="joy_load_driver" name="joy_load_driver">,
4753 <ref id="joy_unload" name="joy_unload">
4759 <sect1>joy_unload<label id="joy_unload"><p>
4763 <tag/Function/Uninstall, then unload the current joystick driver.
4764 <tag/Header/<tt/<ref id="joystick.h" name="joystick.h">/
4765 <tag/Declaration/<tt/unsigned char joy_unload (void);/
4766 <tag/Description/The function uninstalls the currently installed joystick
4767 driver and removes it from memory. An error code is returned, which is
4768 <tt/JOY_ERR_OK/ if the driver was successfully uninstalled.
4769 <tag/Notes/<itemize>
4770 <item>A joystick driver must be loaded using <ref id="joy_load_driver"
4771 name="joy_load_driver"> before calling this function.
4773 <tag/Availability/cc65
4775 <ref id="joy_load_driver" name="joy_load_driver">
4781 <sect1>kbhit<label id="kbhit"><p>
4785 <tag/Function/Check if there's a key waiting in the keyboard buffer.
4786 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
4787 <tag/Declaration/<tt/unsigned char kbhit (void);/
4788 <tag/Description/The function returns a value of zero if there is no character
4789 waiting to be read from the keyboard. It returns non zero otherwise.
4790 <tag/Notes/<itemize>
4791 <item>If the system does not support a keyboard buffer (most systems
4792 do), the function is rather useless.
4794 <tag/Availability/cc65
4796 <ref id="cgetc" name="cgetc">,
4797 <ref id="cursor" name="cursor">
4803 <sect1>kbrepeat<label id="kbrepeat"><p>
4807 <tag/Function/Set the keyboard repeat mode.
4808 <tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
4809 <tag/Declaration/<tt/unsigned char __fastcall__ kbrepeat (unsigned char mode);/
4810 <tag/Description/This function changes which keys have automatic repeat when
4811 being held down for a certain time. Possible values are <tt/KBREPEAT_CURSOR/
4812 (repeat only cursor-related keys), <tt/KBREPEAT_NONE/ (no repeat for any
4813 keys), and <tt/KBREPEAT_ALL/ (repeat all keys). The old mode is returned, so
4814 it can be restored later.
4815 <tag/Notes/<itemize>
4816 <item>The function is available only as a fastcall function; so, it may be used
4817 only in the presence of a prototype.
4819 <tag/Availability/cc65
4825 <sect1>labs<label id="labs"><p>
4829 <tag/Function/Returns the absolute value of a long integer.
4830 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4831 <tag/Declaration/<tt/long __fastcall__ labs (long v);/
4832 <tag/Description/<tt/labs/ returns the absolute value of the argument passed to
4834 <tag/Notes/<itemize>
4835 <item>The return value is undefined if <tt/LONG_MIN/ is passed to the function.
4836 <item>The function is only available as fastcall function, so it may only be
4837 used in presence of a prototype.
4839 <tag/Availability/ISO 9899
4841 <ref id="abs" name="abs">
4847 <sect1>ltoa<label id="ltoa"><p>
4851 <tag/Function/Convert a long integer into a string.
4852 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4853 <tag/Declaration/<tt/char* __fastcall__ ltoa (long val, char* buf, int radix);/
4854 <tag/Description/<tt/itoa/ converts the long integer <tt/val/ into a string
4855 using <tt/radix/ as the base.
4856 <tag/Notes/<itemize>
4857 <item>There are no provisions to prevent a buffer overflow.
4858 <item>If <tt/val/ contains <tt/LONG_MIN/, the behaviour is undefined.
4859 <item>The function is non standard, so it is not available in strict ANSI mode.
4860 You should probably use <tt/sprintf/ instead.
4861 <item>The function is only available as fastcall function, so it may only be
4862 used in presence of a prototype.
4864 <tag/Availability/cc65
4866 <ref id="atoi" name="atoi">,
4867 <ref id="atol" name="atol">,
4868 <ref id="itoa" name="itoa">,
4869 <ref id="ultoa" name="ultoa">,
4870 <ref id="utoa" name="utoa">
4876 <sect1>localeconv<label id="localeconv"><p>
4880 <tag/Function/Returns a pointer to the current locale structure.
4881 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
4882 <tag/Declaration/<tt/struct lconv* localeconv (void);/
4883 <tag/Description/<tt/localeconv/ returns a pointer to the current locale
4885 <tag/Notes/<itemize>
4886 <item>cc65 supports only the "C" locale, so even after setting a new locale
4887 using <tt/<ref id="setlocale" name="setlocale">/, the structure returned will
4890 <tag/Availability/ISO 9899
4892 <ref id="setlocale" name="setlocale">
4898 <sect1>longjmp<label id="longjmp"><p>
4902 <tag/Function/Non local goto.
4903 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
4904 <tag/Declaration/<tt/void __fastcall__ longjmp (jmp_buf buf, int retval);/
4905 <tag/Description/The <tt/longjmp/ function restores a program context from the
4906 data in <tt/buf/, which must have been set by a preceeding call to
4907 <tt/<ref id="setjmp" name="setjmp">/. Program execution continues as if the
4908 call to <tt/<ref id="setjmp" name="setjmp">/ has just returned the value
4910 <tag/Notes/<itemize>
4911 <item>If the parameter <tt/retval/ is zero, the function will behave as if it
4912 was called with a value of one.
4913 <item>The function is only available as fastcall function, so it may only
4914 be used in presence of a prototype.
4916 <tag/Availability/ISO 9899
4918 <ref id="setjmp" name="setjmp">
4924 <sect1>malloc<label id="malloc"><p>
4928 <tag/Function/Allocate dynamic memory.
4929 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
4930 <tag/Declaration/<tt/void* __fastcall__ malloc (size_t size);/
4931 <tag/Description/<tt/malloc/ allocates size bytes on the heap and returns a
4932 pointer to the allocated memory block. On error (not enough memory available),
4933 <tt/malloc/ returns <tt/NULL/.
4934 <tag/Notes/<itemize>
4935 <item>The function is only available as fastcall function, so it may only
4936 be used in presence of a prototype.
4938 <tag/Availability/ISO 9899
4940 <ref id="_heapadd" name="_heapadd">,
4941 <ref id="_heapblocksize" name="_heapblocksize">,
4942 <ref id="_heapmaxavail" name="_heapmaxavail">,
4943 <ref id="_heapmemavail" name="_heapmemavail">,
4944 <ref id="calloc" name="calloc">,
4945 <ref id="free" name="free">,
4946 <ref id="realloc" name="realloc">,
4947 <ref id="strdup" name="strdup">
4953 <sect1>memchr<label id="memchr"><p>
4957 <tag/Function/Search for a character in a block of raw memory.
4958 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4959 <tag/Declaration/<tt/void* __fastcall__ strchr (const void* mem, int c, size_t count);/
4960 <tag/Description/The <tt/memchr/ function locates the first occurrence of <tt/c/
4961 (converted to a char) in the block of raw memory string pointed to by <tt/mem/
4962 that is of size <tt/count/. Upon completion, the function returns a pointer to
4963 the character found, or a null pointer if the character was not found.
4964 <tag/Notes/<itemize>
4965 <item>The function is only available as fastcall function, so it may only
4966 be used in presence of a prototype.
4968 <tag/Availability/ISO 9899
4970 <ref id="strchr" name="strchr">
4976 <sect1>memcmp<label id="memcmp"><p>
4980 <tag/Function/Compare two memory areas.
4981 <tag/Header/<tt/<ref id="string.h" name="string.h">/
4982 <tag/Declaration/<tt/int __fastcall__ memcmp (const void* p1, const void* p2, size_t count);/
4983 <tag/Description/<tt/memcmp/ compares <tt/count/ bytes from the memory area
4984 pointed to by <tt/p1/ into the memory area pointed to by <tt/p2/. It returns a value that is less than
4985 zero if <tt/p1/ is less than <tt/p2/, zero if <tt/p1/ is the same as <tt/p2/,
4986 and a value greater than zero if <tt/p1/ is greater than <tt/p2/.
4987 <tag/Notes/<itemize>
4988 <item>The function is only available as fastcall function, so it may only
4989 be used in presence of a prototype.
4991 <tag/Availability/ISO 9899
4993 <ref id="strcmp" name="strcmp">,
4994 <ref id="memmove" name="memmove">,
4995 <ref id="memset" name="memset">
5001 <sect1>memcpy<label id="memcpy"><p>
5005 <tag/Function/Copy a memory area.
5006 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5007 <tag/Declaration/<tt/void* __fastcall__ memcpy (void* dest, const void* src, size_t count);/
5008 <tag/Description/<tt/memcpy/ copies <tt/count/ bytes from the memory area
5009 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
5011 <tag/Notes/<itemize>
5012 <item>The result is undefined if the memory areas do overlap. Use
5013 <tt/<ref id="memmove" name="memmove">/ to copy overlapping memory areas.
5014 <item>The function is only available as fastcall function, so it may only
5015 be used in presence of a prototype.
5017 <tag/Availability/ISO 9899
5019 <ref id="_swap" name="_swap">,
5020 <ref id="memmove" name="memmove">,
5021 <ref id="memset" name="memset">
5027 <sect1>memmove<label id="memmove"><p>
5031 <tag/Function/Copy a memory area.
5032 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5033 <tag/Declaration/<tt/void* __fastcall__ memmove (void* dest, const void* src, size_t count);/
5034 <tag/Description/<tt/memmove/ copies <tt/count/ bytes from the memory area
5035 pointed to by <tt/src/ into the memory area pointed to by <tt/dest/. It returns
5037 <tag/Notes/<itemize>
5038 <item>While <tt/memmove/ allows the memory areas to overlap, it has some
5039 additional overhead compared to <tt/<ref id="memcpy" name="memcpy">/.
5040 <item>The function is only available as fastcall function, so it may only
5041 be used in presence of a prototype.
5043 <tag/Availability/ISO 9899
5045 <ref id="_swap" name="_swap">,
5046 <ref id="memcpy" name="memcpy">,
5047 <ref id="memset" name="memset">
5053 <sect1>memset<label id="memset"><p>
5057 <tag/Function/Fill a memory area.
5058 <tag/Header/<tt/<ref id="string.h" name="string.h">/
5059 <tag/Declaration/<tt/void* __fastcall__ memset (void* p, int val, size_t count);/
5060 <tag/Description/<tt/memset/ fills the memory area pointed to by <tt/p/ with
5061 the value <tt/val/. The function returns <tt/p/.
5062 <tag/Notes/<itemize>
5063 <item>The function is only available as fastcall function, so it may only
5064 be used in presence of a prototype.
5066 <tag/Availability/ISO 9899
5068 <ref id="_swap" name="_swap">,
5069 <ref id="bzero" name="bzero">,
5070 <ref id="memcpy" name="memcpy">,
5071 <ref id="memmove" name="memmove">
5077 <sect1>mod_free<label id="mod_free"><p>
5081 <tag/Function/Free a relocatable module.
5082 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
5083 <tag/Declaration/<tt/void __fastcall__ mod_free (void* module);/
5084 <tag/Description/The function will free a module loaded into memory by use of
5085 the <tt/<ref id="mod_load" name="mod_load">/ function.
5086 <tag/Notes/<itemize>
5087 <item>The pointer passed as parameter is the pointer to the module memory,
5088 not the pointer to the control structure.
5089 <item>The function is available only as a fastcall function; so, it may be used
5090 only in the presence of a prototype.
5092 <tag/Availability/cc65
5094 <ref id="mod_load" name="mod_load">
5100 <sect1>mod_load<label id="mod_load"><p>
5104 <tag/Function/Load a relocatable module.
5105 <tag/Header/<tt/<ref id="modload.h" name="modload.h">/
5106 <tag/Declaration/<tt/unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl);/
5107 <tag/Description/The function will load a code module into memory and relocate
5108 it. The function will return an error code. If <tt/MLOAD_OK/ is returned, the
5109 outgoing fields in the passed <tt/mod_ctrl/ struct contain information about
5110 the module just loaded. Possible error codes are:
5112 <item><tt/MLOAD_OK/ - Module load successful
5113 <item><tt/MLOAD_ERR_READ/ - Read error
5114 <item><tt/MLOAD_ERR_HDR/ - Header error
5115 <item><tt/MLOAD_ERR_OS/ - Wrong operating system
5116 <item><tt/MLOAD_ERR_FMT/ - Data format error
5117 <item><tt/MLOAD_ERR_MEM/ - Not enough memory
5119 <tag/Notes/<itemize>
5120 <item>The <htmlurl url="ld65.html" name="ld65"> linker is needed to create
5121 relocatable o65 modules for use with this function.
5122 <item>The function is available only as a fastcall function; so, it may be used
5123 only in the presence of a prototype.
5125 <tag/Availability/cc65
5127 <ref id="mod_free" name="mod_free">
5133 <sect1>mouse_setbox<label id="mouse_setbox"><p>
5137 <tag/Function/Specify a bounding box for the mouse cursor.
5138 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5139 <tag/Declaration/<tt/void __fastcall__ mouse_setbox (const struct mouse_box* box);/
5140 <tag/Description/The function allows to set a bounding box for mouse movement.
5141 <tag/Notes/<itemize>
5142 <item>The function does not check if the mouse cursor is currently within the
5143 given rectangle. Placing the mouse cursor within the bounding box is the
5144 responsibility of the programmer.
5145 <item>While the bounding box may be larger than the actual screen size, the
5146 standard mouse cursor draw routines may fail to set the cursor to coordinates
5147 outside of the screen area. Depending on the platform, you may have to supply
5148 your own mouse cursor routines.
5149 <item>The function is only available as fastcall function, so it may only be
5150 used in presence of a prototype.
5152 <tag/Availability/cc65
5154 <ref id="mouse_getbox" name="mouse_getbox">,
5155 <ref id="mouse_move" name="mouse_move">
5161 <sect1>mouse_getbox<label id="mouse_getbox"><p>
5165 <tag/Function/Return the current bounding box for the mouse cursor.
5166 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5167 <tag/Declaration/<tt/void __fastcall__ mouse_getbox (struct mouse_box* box);/
5168 <tag/Description/The function queries the current bounding box for mouse
5170 <tag/Notes/<itemize>
5171 <item>The function is only available as fastcall function, so it may only be
5172 used in presence of a prototype.
5174 <tag/Availability/cc65
5176 <ref id="mouse_move" name="mouse_move">,
5177 <ref id="mouse_setbox" name="mouse_setbox">
5183 <sect1>mouse_buttons<label id="mouse_buttons"><p>
5187 <tag/Function/Return a bit mask encoding the state of the mouse buttons.
5188 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5189 <tag/Declaration/<tt/unsigned char mouse_buttons (void);/
5190 <tag/Description/The function returns a bit mask that encodes the state of the
5191 mouse buttons. You may use the <tt/MOUSE_BTN_XXX/ flags to decode the function
5193 <tag/Availability/cc65
5195 <ref id="mouse_info" name="mouse_info">,
5196 <ref id="mouse_pos" name="mouse_pos">
5202 <sect1>mouse_geterrormsg<label id="mouse_geterrormsg"><p>
5206 <tag/Function/Return a readable error message for an error code.
5207 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5208 <tag/Declaration/<tt/const char* __fastcall__ mouse_geterrormsg (unsigned char
5210 <tag/Description/The function returns an error message (in english) for the
5211 error code passed parameter.
5212 <tag/Notes/<itemize>
5213 <item>The function will return "Unknown error" for invalid error codes.
5214 <item>The function is only available as fastcall function, so it may only be
5215 used in presence of a prototype.
5217 <tag/Availability/cc65
5219 <ref id="mouse_load_driver" name="mouse_load_driver">,
5220 <ref id="mouse_uninstall" name="mouse_uninstall">,
5221 <ref id="mouse_unload" name="mouse_unload">
5227 <sect1>mouse_hide<label id="mouse_hide"><p>
5231 <tag/Function/Hide the mouse pointer.
5232 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5233 <tag/Declaration/<tt/void mouse_hide (void);/
5234 <tag/Description/The function hides the mouse pointer. It manages a counter
5235 that is shared between <tt/<ref id="mouse_show" name="mouse_show">/ and
5236 <tt/mouse_hide/ so that every call call to <tt/mouse_hide/ must be followed by
5237 a call to <tt/<ref id="mouse_show" name="mouse_show">/ to make the mouse cursor
5239 <tag/Availability/cc65
5241 <ref id="mouse_show" name="mouse_show">
5247 <sect1>mouse_info<label id="mouse_info"><p>
5251 <tag/Function/Return the state of the mouse buttons and the position of the
5253 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5254 <tag/Declaration/<tt/void __fastcall__ mouse_info (struct mouse_info* info);/
5255 <tag/Description/The function returns the state of the mouse buttons and the
5256 position of the mouse in the <tt/mouse_info/ structure passed as parameter.
5257 <tag/Notes/<itemize>
5258 <item>The <tt/mouse_info/ struct is a superset of the <tt/mouse_pos/ struct,
5259 so if you just need the mouse position, call <tt/<ref id="mouse_pos"
5260 name="mouse_pos">/ instead.
5261 <item>The function is only available as fastcall function, so it may only be
5262 used in presence of a prototype.
5264 <tag/Availability/cc65
5266 <ref id="mouse_buttons" name="mouse_buttons">,
5267 <ref id="mouse_pos" name="mouse_pos">
5273 <sect1>mouse_install<label id="mouse_install"><p>
5277 <tag/Function/Install an already loaded mouse driver.
5278 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5279 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_install (const struct
5280 mouse_callbacks* c, void* driver);/
5281 <tag/Description/The function installs an already loaded mouse driver and
5282 returns an error code. The <tt/mouse_callbacks/ structure passed as first
5283 parameter contains pointers to routines needed to move or hide/show the mouse
5284 pointer. Defaults for these routines are supplied by the library, so if you
5285 can live with these defaults (which are platform specific), just pass a
5286 pointer to <tt/mouse_def_callbacks/. The function may be used to install a
5287 driver linked statically to the program.
5288 <tag/Notes/<itemize>
5289 <item>Not all drivers are able to detect if the supported hardware is really
5291 <item>After installing a driver, the mouse cursor is hidden.
5292 <item>The function is only available as fastcall function, so it may only be
5293 used in presence of a prototype.
5295 <tag/Availability/cc65
5297 <ref id="mouse_load_driver" name="mouse_load_driver">,
5298 <ref id="mouse_uninstall" name="mouse_uninstall">,
5299 <ref id="mouse_unload" name="mouse_unload">
5305 <sect1>mouse_ioctl<label id="mouse_ioctl"><p>
5309 <tag/Function/Call the driver specific ioctl function.
5310 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5311 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);/
5312 <tag/Description/The function calls the IOCTL entry in the mouse driver,
5313 which is driver specific. The <tt/code/ parameter will choose between
5314 different IOCTL functions, and the <tt/data/ depends on code. The
5315 function returns an error code. The purpose of this function is to allow
5316 for driver specific extensions. See the documentation for a specific mouse
5317 driver for supported ioctl calls.
5318 <tag/Notes/<itemize>
5319 <item>Calling this function is non portable, because each driver may
5320 implement different ioctl calls (or none at all).
5321 <item>The function is only available as fastcall function, so it may only be
5322 used in presence of a prototype.
5324 <tag/Availability/cc65
5330 <sect1>mouse_load_driver<label id="mouse_load_driver"><p>
5334 <tag/Function/Load and initialize a mouse driver.
5335 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5336 <tag/Declaration/<tt/unsigned char __fastcall__ mouse_load_driver (const struct
5337 mouse_callbacks* c, const char* driver);/
5338 <tag/Description/Load a mouse driver into memory and initialize it. The
5339 function returns an error code that tells if the call has been successful. The
5340 <tt/mouse_callbacks/ structure passed as first parameter contains pointers to
5341 routines needed to move or hide/show the mouse pointer. Defaults for these
5342 routines are supplied by the library, so if you can live with these defaults
5343 (which are platform specific), just pass a pointer to <tt/mouse_def_callbacks/.
5344 <tag/Notes/<itemize>
5345 <item>The driver is loaded by name, so currently you must know the type of
5346 mouse that should be supported. There is no autodetect capability.
5347 <item>Not all drivers are able to detect if the supported hardware is really
5349 <item>After installing a driver, the mouse cursor is hidden.
5350 <item>The function is only available as fastcall function, so it may only be
5351 used in presence of a prototype.
5353 <tag/Availability/cc65
5355 <ref id="mouse_install" name="mouse_install">,
5356 <ref id="mouse_uninstall" name="mouse_uninstall">,
5357 <ref id="mouse_unload" name="mouse_unload">
5363 <sect1>mouse_move<label id="mouse_move"><p>
5367 <tag/Function/Move the mouse cursor to a specific position.
5368 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5369 <tag/Declaration/<tt/void __fastcall__ mouse_move (int x, int y);/
5370 <tag/Description/The function updates the mouse position. If the mouse cursor
5371 is visible, it is shown at the new position.
5372 <tag/Notes/<itemize>
5373 <item>The function does not check if the new position is within the bounding
5374 box specified with <tt/<ref id="mouse_setbox" name="mouse_setbox">/.
5375 <item>The function is only available as fastcall function, so it may only be
5376 used in presence of a prototype.
5378 <tag/Availability/cc65
5380 <ref id="mouse_getbox" name="mouse_getbox">,
5381 <ref id="mouse_setbox" name="mouse_setbox">
5387 <sect1>mouse_pos<label id="mouse_pos"><p>
5391 <tag/Function/Return the position of the mouse.
5392 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5393 <tag/Declaration/<tt/void __fastcall__ mouse_pos (struct mouse_pos* pos);/
5394 <tag/Description/The function returns the position of the mouse in the
5395 <tt/mouse_pos/ structure passed as parameter.
5396 <tag/Notes/<itemize>
5397 <item>The <tt/mouse_pos/ struct is a subset of the <tt/mouse_info/ struct,
5398 so if you do also need the mouse buttons, call <tt/<ref id="mouse_info"
5399 name="mouse_info">/ instead.
5400 <item>The function is only available as fastcall function, so it may only be
5401 used in presence of a prototype.
5403 <tag/Availability/cc65
5405 <ref id="mouse_buttons" name="mouse_buttons">,
5406 <ref id="mouse_info" name="mouse_info">
5412 <sect1>mouse_show<label id="mouse_show"><p>
5416 <tag/Function/Show the mouse pointer.
5417 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5418 <tag/Declaration/<tt/void mouse_show (void);/
5419 <tag/Description/The function shows the mouse pointer. It manages a counter
5420 that is shared between <tt/<ref id="mouse_hide" name="mouse_hide">/ and
5421 <tt/mouse_show/. The mouse cursor is visible if there was one more call to
5422 <tt/mouse_show/ than to <tt/<ref id="mouse_hide" name="mouse_hide">/.
5423 <tag/Availability/cc65
5425 <ref id="mouse_hide" name="mouse_hide">
5431 <sect1>mouse_uninstall<label id="mouse_uninstall"><p>
5435 <tag/Function/Uninstall an already loaded mouse driver.
5436 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5437 <tag/Declaration/<tt/unsigned char mouse_uninstall (void);/
5438 <tag/Description/The function uninstalls an already loaded mouse driver but
5439 don't removes it from memory.
5440 <tag/Notes/<itemize>
5441 <item>If the driver has been loaded using <tt/<ref id="mouse_load_driver"
5442 name="mouse_load_driver">/, <tt/<ref id="mouse_unload" name="mouse_unload">/
5443 should be used instead of <tt/mouse_uninstall/ so the driver is also removed
5446 <tag/Availability/cc65
5448 <ref id="mouse_install" name="mouse_install">,
5449 <ref id="mouse_load_driver" name="mouse_load_driver">,
5450 <ref id="mouse_unload" name="mouse_unload">
5456 <sect1>mouse_unload<label id="mouse_unload"><p>
5460 <tag/Function/Unload a mouse driver.
5461 <tag/Header/<tt/<ref id="mouse.h" name="mouse.h">/
5462 <tag/Declaration/<tt/unsigned char mouse_unload (void);/
5463 <tag/Description/The function unloads a loaded mouse driver and frees all
5464 memory allocated for the driver.
5465 <tag/Notes/<itemize>
5466 <item>The function does nothing if no driver is loaded.
5468 <tag/Availability/cc65
5470 <ref id="mouse_install" name="mouse_install">,
5471 <ref id="mouse_load_driver" name="mouse_load_driver">,
5472 <ref id="mouse_uninstall" name="mouse_uninstall">
5478 <sect1>offsetof<label id="offsetof"><p>
5482 <tag/Function/Calculate the offset of a struct or union member.
5483 <tag/Header/<tt/<ref id="stddef.h" name="stddef.h">/
5484 <tag/Declaration/<tt/size_t offsetof (type, member);/
5485 <tag/Description/<tt/offsetof/ calculates the address offset of a <tt/struct/
5486 or <tt/union/ member.
5487 <tag/Notes/<itemize>
5488 <item>The function is actually a macro.
5490 <tag/Availability/ISO 9899
5496 <sect1>open<label id="open"><p>
5500 <tag/Function/Open and possibly create a file.
5501 <tag/Header/<tt/<ref id="fcntl.h" name="fcntl.h">/
5502 <tag/Declaration/<tt/int open (const char* name, int flags, ...);/
5503 <tag/Description/<tt/open/ opens a file and returns the file descriptor
5504 associated with it. On error, -1 is returned and an error code is stored in
5505 <tt/errno/. Several flags may be passed to <tt/open/ that change the behaviour.
5506 <tag/Notes/<itemize>
5507 <item>POSIX specifies an additional <tt/mode/ argument that may be passed to
5508 open, which is used as the permission mask when a new file is created. While
5509 cc65 allows to pass this argument, it is ignored.
5511 <tag/Availability/POSIX 1003.1
5513 <ref id="close" name="close">,
5514 <ref id="creat" name="creat">
5520 <sect1>opendir<label id="opendir"><p>
5524 <tag/Function/Open a directory.
5525 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5526 <tag/Declaration/<tt/DIR* __fastcall__ opendir (const char* name);/
5527 <tag/Description/<tt/opendir/ opens a directory and returns the direcory
5528 descriptor associated with it. On error, NULL is returned and an error code is
5529 stored in <tt/errno/.
5530 <tag/Notes/<itemize>
5531 <item>The function is only available as fastcall function, so it may only
5532 be used in presence of a prototype.
5534 <tag/Availability/POSIX 1003.1
5536 <ref id="closedir" name="closedir">,
5537 <ref id="readdir" name="readdir">
5543 <sect1>peekbsys<label id="peekbsys"><p>
5547 <tag/Function/Read one byte from a location in the system bank.
5548 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5549 <tt/<ref id="cbm510.h" name="cbm510.h">/
5550 <tag/Declaration/<tt/unsigned char __fastcall__ peekbsys (unsigned addr);/
5551 <tag/Description/<tt/peekbsys/ reads one byte from the given address in the
5552 system bank (bank 15) of the CBM PET-II machines and returns it.
5553 <tag/Notes/<itemize>
5554 <item>The function is only available as fastcall function, so it may only
5555 be used in presence of a prototype.
5556 <item>This function may be a macro depending on the compiler options. The
5557 actual function is accessible by #undef'ing the macro.
5559 <tag/Availability/cc65
5561 <ref id="PEEK" name="PEEK">,
5562 <ref id="PEEKW" name="PEEKW">,
5563 <ref id="peekwsys" name="peekwsys">,
5564 <ref id="pokebsys" name="pokebsys">,
5565 <ref id="pokewsys" name="pokewsys">
5571 <sect1>peekwsys<label id="peekwsys"><p>
5575 <tag/Function/Read one word from a location in the system bank.
5576 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5577 <tt/<ref id="cbm510.h" name="cbm510.h">/
5578 <tag/Declaration/<tt/unsigned __fastcall__ peekwsys (unsigned addr);/
5579 <tag/Description/<tt/peekwsys/ reads one word from the given address in the
5580 system bank (bank 15) of the CBM PET-II machines and returns it. Following
5581 the usual 6502 conventions, the low byte is read from <tt/addr/, and the
5582 high byte is read from <tt/addr+1/.
5583 <tag/Notes/<itemize>
5584 <item>The function is only available as fastcall function, so it may only
5585 be used in presence of a prototype.
5586 <item>The order in which the two bytes are read is undefined.
5588 <tag/Availability/cc65
5590 <ref id="PEEK" name="PEEK">,
5591 <ref id="PEEKW" name="PEEKW">,
5592 <ref id="peekbsys" name="peekbsys">,
5593 <ref id="pokebsys" name="pokebsys">,
5594 <ref id="pokewsys" name="pokewsys">
5600 <sect1>perror<label id="perror"><p>
5604 <tag/Function/Print an error message for the error in <tt/errno/.
5605 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5606 <tag/Declaration/<tt/void __fastcall__ perror (const char* s);/
5607 <tag/Description/<tt/perror/ prints an error message to <tt/stderr/. If <tt/s/
5608 is not <tt/NULL/ and not an empty string, it is printed followed by a colon and
5609 a blank. Then the error message for the current contents of <tt/errno/ is
5610 printed followed by a newline. The message output is the same as returned by
5611 <tt/<ref id="strerror" name="strerror">/ with an argument of <tt/errno/.
5612 <tag/Notes/<itemize>
5613 <item>The function is only available as fastcall function, so it may only
5614 be used in presence of a prototype.
5616 <tag/Availability/ISO 9899
5618 <ref id="_poserror" name="_poserror">,
5619 <ref id="strerror" name="strerror">
5625 <sect1>pokebsys<label id="pokebsys"><p>
5629 <tag/Function/Write one byte to a location in the system bank.
5630 <tag/Header/<tt/<ref id="cbm610.h" name="cbm610.h">/,
5631 <tt/<ref id="cbm510.h" name="cbm510.h">/
5632 <tag/Declaration/<tt/void __fastcall__ pokebsys (unsigned addr, unsigned char val);/
5633 <tag/Description/<tt/pokebsys/ writes one byte to the given address in the
5634 system bank (bank 15) of the CBM PET-II machines.
5635 <tag/Notes/<itemize>
5636 <item>The function is only available as fastcall function, so it may only
5637 be used in presence of a prototype.
5639 <tag/Availability/cc65
5641 <ref id="POKE" name="POKE">,
5642 <ref id="POKEW" name="POKEW">,
5643 <ref id="peekbsys" name="peekbsys">,
5644 <ref id="peekwsys" name="peekwsys">,
5645 <ref id="pokewsys" name="pokewsys">
5651 <sect1>pokewsys<label id="pokewsys"><p>
5655 <tag/Function/Write one word to 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/void __fastcall__ pokewsys (unsigned addr, unsigned val);/
5659 <tag/Description/<tt/pokewsys/ writes one word to the given address in the
5660 system bank (bank 15) of the CBM PET-II machines. Following the usual 6502
5661 conventions, the low byte of <tt/val/ is written to <tt/addr/, and the
5662 high byte is written to <tt/addr+1/.
5663 <tag/Notes/<itemize>
5664 <item>The function is only available as fastcall function, so it may only
5665 be used in presence of a prototype.
5666 <item>The order in which the two bytes are written is undefined.
5668 <tag/Availability/cc65
5670 <ref id="POKE" name="POKE">,
5671 <ref id="POKEW" name="POKEW">,
5672 <ref id="peekbsys" name="peekbsys">,
5673 <ref id="peekwsys" name="peekwsys">,
5674 <ref id="pokebsys" name="pokebsys">
5680 <sect1>qsort<label id="qsort"><p>
5684 <tag/Function/Sort an array.
5685 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5686 <tag/Declaration/<tt/void __fastcall__ qsort (void* base, size_t count,
5687 size_t size, int __fastcall__ (* compare) (const void*, const void*));/
5688 <tag/Description/<tt/qsort/ sorts an array according to a given compare
5689 function <tt/compare/. <tt/base/ is the address of the array, <tt/count/
5690 is the number of elements, <tt/size/ the size of an element and <tt/compare/
5691 the function used to compare the members.
5692 <tag/Notes/<itemize>
5693 <item>If there are multiple members with the same key, the order after calling
5694 the function is undefined.
5695 <item>The function is only available as fastcall function, so it may only
5696 be used in presence of a prototype.
5697 <item>The function to which <tt/compare/ points must have the <tt/fastcall/
5700 <tag/Availability/ISO 9899
5702 <ref id="bsearch" name="bsearch">
5708 <sect1>raise<label id="raise"><p>
5712 <tag/Function/Send a signal to the executing program.
5713 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
5714 <tag/Declaration/<tt/int __fastcall__ raise (int sig);/
5715 <tag/Description/<tt/raise/ sends the given signal to the program. If the
5716 program has installed a signal handler for the signal, this signal handler
5717 will be executed. If no handler has been installed, the default action for
5718 the raised signal will be taken. The function returns zero on success,
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="abort" name="abort">,
5727 <ref id="signal" name="signal">
5733 <sect1>rand<label id="rand"><p>
5737 <tag/Function/Return a pseudo random number.
5738 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5739 <tag/Declaration/<tt/int rand (void);/
5740 <tag/Description/The function returns a pseudo random number
5741 between 0 and <tt/RAND_MAX/ (exclusive).
5742 <tag/Notes/<itemize>
5743 <item>Without using <tt><ref id="srand" name="srand"></tt>, always the same
5744 flow of numbers is generated.
5745 <item>On startup, the function behaves as if <ref id="srand" name="srand">
5746 had been used with an argument of 1.
5748 <tag/Availability/ISO 9899
5750 <ref id="_randomize" name="_randomize">,
5751 <ref id="srand" name="srand">
5757 <sect1>readdir<label id="readdir"><p>
5761 <tag/Function/Read a directory.
5762 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5763 <tag/Declaration/<tt/struct dirent* __fastcall__ readdir (DIR* dir);/
5764 <tag/Description/<tt/readdir/ reads the next directory entry from the directory
5765 stream pointed to by <tt/dir/. It stores the data in a <tt/dirent/ structure
5766 and returns a pointer to it. If the end of directory is reached, or an error
5767 occurs, NULL is returned. In case of errors, an error code is stored into
5769 <tag/Notes/<itemize>
5770 <item>The function is only available as fastcall function, so it may only
5771 be used in presence of a prototype.
5772 <item>The returned pointer may point to a statically allocated instance of
5773 <tt/struct dirent/, so it may get overwritten by subsequent calls to
5775 <item>On several platforms, namely the CBMs and the Atari, the disk drives get
5776 confused when opening/closing files between directory reads. So for example a
5777 program that reads the list of files on a disk, and after each call to
5778 <tt/readdir/, opens the file to process it, will fail.<newline>
5779 Possible solutions are reading the directory into memory before processing the
5780 file list, or to reset the directory by seeking to the correct position after
5781 opening/closing a file:
5783 seekdir (DIR, telldir (DIR));
5785 Platforms known to work without problems are: Apple.
5787 <tag/Availability/POSIX 1003.1
5789 <ref id="closedir" name="closedir">,
5790 <ref id="opendir" name="opendir">
5796 <sect1>realloc<label id="realloc"><p>
5800 <tag/Function/Change the size of an allocated memory block.
5801 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
5802 <tag/Declaration/<tt/void* __fastcall__ realloc (void* block, size_t size);/
5803 <tag/Description/<tt/realloc/ changes the size of the memory block pointed to
5804 by <tt/block/ to <tt/size/ bytes. If <tt/block/ is <tt/NULL/, <tt/realloc/
5805 behaves as if <tt/malloc/ had been called. If <tt/size/ is zero, <tt/realloc/
5806 behaves as if <tt/free/ had been called. On error (not enough memory
5807 available), <tt/realloc/ returns <tt/NULL/.
5808 <tag/Notes/<itemize>
5809 <item>The part of the memory block that is returned will have its contents
5811 <item>This function is somewhat dangerous to use. Be careful to save the
5812 pointer you're passing somewhere else, otherwise
5814 ptr = realloc (ptr, size);
5816 will loose your only copy of <tt/ptr/ if <tt/realloc/ returns <tt/NULL/.
5817 <item>The function is only available as fastcall function, so it may only
5818 be used in presence of a prototype.
5820 <tag/Availability/ISO 9899
5822 <ref id="_heapadd" name="_heapadd">,
5823 <ref id="_heapblocksize" name="_heapblocksize">,
5824 <ref id="_heapmaxavail" name="_heapmaxavail">,
5825 <ref id="_heapmemavail" name="_heapmemavail">,
5826 <ref id="calloc" name="calloc">,
5827 <ref id="free" name="free">,
5828 <ref id="realloc" name="realloc">
5834 <sect1>remove<label id="remove"><p>
5838 <tag/Function/Delete a file.
5839 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5840 <tag/Declaration/<tt/int __fastcall__ remove (const char* name);/
5841 <tag/Description/<tt/remove/ deletes the file with the given name. On success,
5842 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5843 code describing the reason for the failure.
5844 <tag/Notes/<itemize>
5845 <item>This function is not available on all cc65 targets (depends on the
5846 availability of file I/O).
5847 <item>The function is only available as fastcall function, so it may only
5848 be used in presence of a prototype.
5850 <tag/Availability/ISO 9899
5852 <ref id="rename" name="rename">,
5853 <ref id="unlink" name="unlink">
5856 #include <stdio.h>
5858 #define FILENAME "helloworld"
5860 if (remove (FILENAME) == 0) {
5861 printf ("We deleted %s successfully\n", FILENAME);
5863 printf ("There was a problem deleting %s\n", FILENAME);
5870 <sect1>rename<label id="rename"><p>
5874 <tag/Function/Rename a file.
5875 <tag/Header/<tt/<ref id="stdio.h" name="stdio.h">/
5876 <tag/Declaration/<tt/int __fastcall__ rename (const char* oldname, const char* newname);/
5877 <tag/Description/<tt/rename/ renames a file (gives it a new name). On success,
5878 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
5879 code describing the reason for the failure.
5880 <tag/Notes/<itemize>
5881 <item>This function is not available on all cc65 targets (depends on the
5882 capabilities of the storage devices).
5883 <item>The function is only available as fastcall function, so it may only
5884 be used in presence of a prototype.
5886 <tag/Availability/ISO 9899
5888 <ref id="remove" name="remove">
5891 #include <stdio.h>
5893 #define OLDNAME "textfile.txt"
5894 #define NEWNAME "textfile.bak"
5896 if (rename (OLDNAME, NEWNAME) == 0) {
5897 printf ("Renamed %s to %s\n", OLDNAME, NEWNAME);
5899 printf ("Error renaming %s to %s\n", OLDNAME, NEWNAME);
5906 <sect1>reset_brk<label id="reset_brk"><p>
5910 <tag/Function/Resets the break vector to its original value.
5911 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5912 <tag/Declaration/<tt/void reset_brk (void);/
5913 <tag/Description/<tt/reset_brk/ resets the break vector to the value it had
5914 before a call to <tt/set_brk/.
5915 <tag/Notes/<itemize>
5916 <item>The break vector is reset on program termination, so it's not strictly
5917 necessary to call this function as a part of your clean-up when exiting the program.
5919 <tag/Availability/cc65
5921 <ref id="reset_irq" name="reset_irq">,
5922 <ref id="set_brk" name="set_brk">,
5923 <ref id="set_irq" name="set_irq">
5929 <sect1>reset_irq<label id="reset_irq"><p>
5933 <tag/Function/Resets the C level interrupt request vector.
5934 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
5935 <tag/Declaration/<tt/void reset_irq (void);/
5936 <tag/Description/<tt/reset_irq/ resets the C level interrupt request vector.
5937 <tag/Notes/<itemize>
5938 <item>The interrupt vector is reset on program termination, so it's not strictly
5939 necessary to call this function as a part of your clean-up when exiting the program.
5941 <tag/Availability/cc65
5943 <ref id="reset_brk" name="reset_brk">,
5944 <ref id="set_brk" name="set_brk">,
5945 <ref id="set_irq" name="set_irq">
5951 <sect1>revers<label id="revers"><p>
5955 <tag/Function/Control revers character display.
5956 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
5957 <tag/Declaration/<tt/unsigned char __fastcall__ revers (unsigned char onoff);/
5958 <tag/Description/If the argument is non zero, the function enables reverse
5959 character display. If the argument is zero, reverse character display is
5960 switched off. The old value of the setting is returned.
5961 <tag/Notes/<itemize>
5962 <item>The function may not be supported by the hardware, in which case
5963 the call is ignored.
5964 <item>The function is only available as fastcall function, so it may only
5965 be used in presence of a prototype.
5967 <tag/Availability/cc65
5969 <ref id="textcolor" name="textcolor">
5975 <sect1>rewinddir<label id="rewinddir"><p>
5979 <tag/Function/Reset a directory stream.
5980 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
5981 <tag/Declaration/<tt/void __fastcall__ rewinddir (DIR* dir);/
5982 <tag/Description/<tt/rewinddir/ sets the position of the directory stream
5983 pointed to by <tt/dir/ to the start of the directory.
5984 <tag/Notes/<itemize>
5985 <item>The function is only available as fastcall function, so it may only
5986 be used in presence of a prototype.
5988 <tag/Availability/POSIX 1003.1
5990 <ref id="seekdir" name="seekdir">,
5991 <ref id="telldir" name="telldir">
5997 <sect1>screensize<label id="screensize"><p>
6001 <tag/Function/Return the dimensions of the text mode screen.
6002 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
6003 <tag/Declaration/<tt/void __fastcall__ screensize (unsigned char* x, unsigned char* y);/
6004 <tag/Description/The function returns the dimensions of the text mode screen.
6005 <tag/Notes/<itemize>
6006 <item>The function is only available as fastcall function, so it may only
6007 be used in presence of a prototype.
6009 <tag/Availability/cc65
6011 <ref id="gotox" name="gotox">,
6012 <ref id="gotoxy" name="gotoxy">,
6013 <ref id="gotoy" name="gotoy">,
6014 <ref id="wherex" name="wherex">,
6015 <ref id="wherey" name="wherey">
6021 <sect1>seekdir<label id="seekdir"><p>
6025 <tag/Function/Set the position of a directory stream.
6026 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
6027 <tag/Declaration/<tt/void __fastcall__ seekdir (DIR* dir, long offset);/
6028 <tag/Description/<tt/seekdir/ sets the position of the directory stream
6029 pointed to by <tt/dir/ to the value given in <tt/offset/, which should be a
6030 value returned by <tt/<ref id="telldir" name="telldir">/.
6031 <tag/Notes/<itemize>
6032 <item>The function is only available as fastcall function, so it may only
6033 be used in presence of a prototype.
6035 <tag/Availability/POSIX 1003.1
6037 <ref id="rewinddir" name="rewinddir">,
6038 <ref id="telldir" name="telldir">
6044 <sect1>ser_close<label id="ser_close"><p>
6048 <tag/Function/Close the port and disable interrupts
6049 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6050 <tag/Declaration/<tt/unsigned char ser_close (void);/
6051 <tag/Description/Close the port by clearing buffers and disable interrupts.
6052 <tag/Availability/cc65
6053 <tag/See also/Other serial functions.
6058 static void initialize(){
6059 struct ser_params params = {
6066 ser_install(lynx_comlynx); // This will activate the ComLynx
6068 ser_open(&params);
6075 <sect1>ser_get<label id="ser_get"><p>
6079 <tag/Function/Read a character from serial port.
6080 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6081 <tag/Declaration/<tt/unsigned char __fastcall__ ser_get (char* b);/
6082 <tag/Description/Get a character from the serial port. If no characters are
6083 available, the function will return SER_ERR_NO_DATA, so this is not a fatal
6085 <tag/Notes/<itemize>
6086 <item>The function is only available as fastcall function, so it may only
6087 be used in presence of a prototype.
6089 <tag/Availability/cc65
6090 <tag/See also/Other serial functions.
6092 Wait for a character to be available from a serial port.
6095 while (ser_get(&ch) == SER_ERR_NO_DATA)
6102 <sect1>ser_install<label id="ser_install"><p>
6106 <tag/Function/Install an already loaded driver and return an error code.
6107 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6108 <tag/Declaration/<tt/unsigned char __fastcall__ ser_install (void* driver);/
6109 <tag/Description/The function installs a driver that was already loaded into
6110 memory (or linked statically to the program). It returns an error code
6111 (<tt/SER_ERR_OK/ in case of success).
6112 <tag/Notes/<itemize>
6113 <item>The function is only available as fastcall function, so it may only be
6114 used in presence of a prototype.
6116 <tag/Availability/cc65
6118 <ref id="ser_load_driver" name="ser_load_driver">,
6119 <ref id="ser_uninstall" name="ser_uninstall">,
6120 <ref id="ser_unload" name="ser_unload">
6122 ser_install(lynx_comlynx); //Include the driver statically instead of loading it.
6128 <sect1>ser_ioctl<label id="ser_ioctl"><p>
6132 <tag/Function/Platform dependent code extensions.
6133 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6134 <tag/Declaration/<tt/unsigned __fastcall__ ser_ioctl (unsigned char code, void* data);/
6135 <tag/Description/Some platforms have extra serial functions that are not
6136 supported by standard serial driver functions. You can extend the driver to support
6137 this extra functionality bt using ser_ioctl functions.
6138 <tag/Notes/<itemize>
6139 <item>The function is only available as fastcall function, so it may only
6140 be used in presence of a prototype.
6141 <item>These functions are not easily portable to other cc65 platforms.
6143 <tag/Availability/cc65
6144 <tag/See also/Other serial functions.
6149 <sect1>ser_load_driver<label id="ser_load_driver"><p>
6153 <tag/Function/Load and install a serial driver.
6154 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6155 <tag/Declaration/<tt/unsigned char __fastcall__ ser_load_driver (const char *name);/
6156 <tag/Description/Load and install the driver by name.
6157 Will just load the driver and check if loading was successful.
6158 <tag/Notes/<itemize>
6159 <item>The function is only available as fastcall function, so it may only
6160 be used in presence of a prototype.
6162 <tag/Availability/cc65
6163 <tag/See also/Other serial functions.
6169 <sect1>ser_open<label id="ser_open"><p>
6173 <tag/Function/Open the port by setting the port parameters and enable interrupts
6174 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6175 <tag/Declaration/<tt/unsigned char __fastcall__ ser_open (const struct ser_params* params);/
6176 <tag/Description/Open the port by setting the port parameters and enable interrupts.
6177 <tag/Notes/<itemize>
6178 <item>The function is only available as fastcall function, so it may only
6179 be used in presence of a prototype.
6181 <tag/Availability/cc65
6182 <tag/See also/Other serial functions.
6187 static void initialize(){
6188 struct ser_params params = {
6195 ser_install(lynx_comlynx); // This will activate the ComLynx
6197 ser_open(&params);
6204 <sect1>ser_put<label id="ser_put"><p>
6208 <tag/Function/Write a character to a serial port.
6209 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6210 <tag/Declaration/<tt/unsigned char __fastcall__ ser_put (char b);/
6211 <tag/Description/Send a character via the serial port. There is a transmit
6212 buffer, but transmitting is not done via interrupt. The function returns
6213 SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
6214 <tag/Notes/<itemize>
6215 <item>The function is only available as fastcall function, so it may only
6216 be used in presence of a prototype.
6218 <tag/Availability/cc65
6219 <tag/See also/Other serial functions.
6228 <sect1>ser_status<label id="ser_status"><p>
6232 <tag/Function/Return the serial port status.
6233 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6234 <tag/Declaration/<tt/unsigned char __fastcall__ ser_status (unsigned char* status);/
6235 <tag/Description/Return the serial port status.
6236 <tag/Notes/<itemize>
6237 <item>The function is only available as fastcall function, so it may only
6238 be used in presence of a prototype.
6240 <tag/Availability/cc65
6241 <tag/See also/Other serial functions.
6247 <sect1>ser_uninstall<label id="ser_uninstall"><p>
6251 <tag/Function/Uninstall the currently loaded driver but do not unload it.
6252 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6253 <tag/Declaration/<tt/unsigned char ser_uninstall (void);/
6254 <tag/Description/Uninstall the currently loaded driver but do not unload it.
6255 <tag/Availability/cc65
6256 <tag/See also/Other serial functions.
6261 <sect1>ser_unload<label id="ser_unload"><p>
6265 <tag/Function/Uninstall, then unload the currently loaded driver.
6266 <tag/Header/<tt/<ref id="serial.h" name="serial.h">/
6267 <tag/Declaration/<tt/unsigned char ser_unload (void);/
6268 <tag/Description/Uninstall, then unload the currently loaded driver.
6269 <tag/Availability/cc65
6270 <tag/See also/Other serial functions.
6276 <sect1>set_brk<label id="set_brk"><p>
6280 <tag/Function/Set the break vector to a user function.
6281 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
6282 <tag/Declaration/<tt/void __fastcall__ set_brk (brk_handler func);/
6283 <tag/Description/<tt/set_brk/ allows a user program to handle breaks within the
6284 program code by letting the vector point to a user written C function. The
6285 runtime library installs a small stub that saves the registers into global
6286 variables that may be accessed (and changed) by the break handler.
6287 <tag/Notes/<itemize>
6288 <item>The function is only available as fastcall function, so it may only
6289 be used in presence of a prototype.
6290 <item>The stub saves the zero page registers used by the C runtime and switches
6291 to a small break handler stack. This means that it is safe to execute C code,
6292 even if C code was interrupted. Be careful however not to use too many local
6293 variables, and do not enable stack checks for the handler function or any other
6294 function called from it.
6295 <item>The <tt/brk_pc/ variable points to the <tt/BRK/ instruction. If you want
6296 the continue with the interrupted code, you have to adjust <tt/brk_pc/,
6297 otherwise the <tt/BRK/ instruction will get executed over and over again.
6298 <item>The break vector is reset on program termination, so it's not strictly
6299 necessary to call <tt/<ref id="reset_brk" name="reset_brk">/ as a part of your
6300 clean-up when exiting the program.
6302 <tag/Availability/cc65
6304 <ref id="reset_brk" name="reset_brk">
6310 <sect1>set_irq<label id="set_irq"><p>
6314 <tag/Function/Set the C level interrupt request vector to the given address.
6315 <tag/Header/<tt/<ref id="6502.h" name="6502.h">/
6316 <tag/Declaration/<tt/void __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);/
6317 <tag/Description/<tt/set_irq/ allows a user program to handle interrupt requests
6318 (IRQs) within the program code by letting the vector point to a user written C
6319 function. The runtime library installs a small stub that saves the zero page
6320 registers used by the C runtime before calling the handler function and restores
6321 them after the handler function returns. Additionally the stub temporarily switches
6322 the C runtime stack to the stack area provided as parameter. If the handler function
6323 was set up to handle a "private", "exclusive" interrupt request source it must
6324 return the value <tt/IRQ_HANDLED/ if and only if it has verified that the current
6325 interrupt request actually stems from that source. In all other cases it must return
6326 the value <tt/IRQ_NOT_HANDLED/.
6327 <tag/Notes/<itemize>
6328 <item>The function is only available as fastcall function, so it may only
6329 be used in presence of a prototype.
6330 <item>The stub saves the registers and zero page locations used by the C runtime
6331 and switches to the provided stack area. As a consequence, there is some
6332 runtime overhead, but it it is safe to execute C code, even if other C code
6333 was interrupted. Be careful however not to call C library functions, and do not
6334 enable stack checks for the handler function or any other function called from
6336 <item>The interrupt vector is reset on program termination, so it's not strictly
6337 necessary to call <tt/<ref id="reset_irq" name="reset_irq">/ as a part of your
6338 clean-up when exiting the program.
6340 <tag/Availability/cc65
6342 <ref id="reset_brk" name="reset_brk">,
6343 <ref id="reset_irq" name="reset_irq">,
6344 <ref id="set_brk" name="set_brk">
6350 <sect1>set_c128_speed<label id="set_c128_speed"><p>
6354 <tag/Function/Set the current speed of a C128 CPU.
6355 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6356 <tag/Declaration/<tt/unsigned char __fastcall__ set_c128_speed (unsigned char speed);/
6357 <tag/Description/The function returns the speed after trying to set the speed of the C128 CPU.
6358 <tag/Notes/<itemize>
6359 <item>The function is specific to the C64 and C128.
6360 <item>The function does not check if the C128 CPU is the current CPU.
6361 <item>See the accelerator.h header for the speed definitions.
6363 <tag/Availability/cc65 (not all platforms)
6365 <ref id="detect_c128" name="detect_c128">,
6366 <ref id="get_c128_speed" name="get_c128_speed">,
6372 <sect1>set_c64dtv_speed<label id="set_c64dtv_speed"><p>
6376 <tag/Function/Set the current speed of the C64DTV.
6377 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6378 <tag/Declaration/<tt/unsigned char __fastcall__ set_c64dtv_speed (unsigned char speed);/
6379 <tag/Description/The function returns the speed after trying to set the speed of the C64DTV.
6380 <tag/Notes/<itemize>
6381 <item>The function is specific to the C64.
6382 <item>The function does not check for the presence of the C64DTV.
6383 <item>See the accelerator.h header for the speed definitions.
6385 <tag/Availability/cc65 (not all platforms)
6387 <ref id="detect_c64dtv" name="detect_c64dtv">,
6388 <ref id="get_c64dtv_speed" name="get_c64dtv_speed">,
6394 <sect1>set_c65_speed<label id="set_c65_speed"><p>
6398 <tag/Function/Set the current speed of the C65/C64DX in C64 mode.
6399 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6400 <tag/Declaration/<tt/unsigned char __fastcall__ set_c65_speed (unsigned char speed);/
6401 <tag/Description/The function returns the speed after trying to set the speed of the C65/C64DX in C64 mode.
6402 <tag/Notes/<itemize>
6403 <item>The function is specific to the C64.
6404 <item>The function does not check for the presence of a C65/C64DX in C64 mode.
6405 <item>See the accelerator.h header for the speed definitions.
6407 <tag/Availability/cc65 (not all platforms)
6409 <ref id="detect_c65" name="detect_c65">,
6410 <ref id="get_c65_speed" name="get_c65_speed">,
6416 <sect1>set_chameleon_speed<label id="set_chameleon_speed"><p>
6420 <tag/Function/Set the current speed of the C64 Chameleon cartridge.
6421 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6422 <tag/Declaration/<tt/unsigned char __fastcall__ set_chameleon_speed (unsigned char speed);/
6423 <tag/Description/The function returns the speed after trying to set the speed of the C64 Chameleon cartridge.
6424 <tag/Notes/<itemize>
6425 <item>The function is specific to the C64.
6426 <item>The function does not check for the presence of the C64 Chameleon cartridge.
6427 <item>See the accelerator.h header for the speed definitions.
6429 <tag/Availability/cc65 (not all platforms)
6431 <ref id="detect_chameleon" name="detect_chameleon">,
6432 <ref id="get_chameleon_speed" name="get_chameleon_speed">,
6438 <sect1>set_scpu_speed<label id="set_scpu_speed"><p>
6442 <tag/Function/Set the current speed of the C64/C128 SuperCPU cartridge.
6443 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6444 <tag/Declaration/<tt/unsigned char __fastcall__ set_scpu_speed (unsigned char speed);/
6445 <tag/Description/The function returns the speed after trying to set the speed of the SuperCPU cartridge.
6446 <tag/Notes/<itemize>
6447 <item>The function is specific to the C128 and C64.
6448 <item>The function does not check for the presence of the cartridge.
6449 <item>See the accelerator.h header for the speed definitions.
6451 <tag/Availability/cc65 (not all platforms)
6453 <ref id="detect_scpu" name="detect_scpu">,
6454 <ref id="get_scpu_speed" name="get_scpu_speed">,
6460 <sect1>set_turbomaster_speed<label id="set_turbomaster_speed"><p>
6464 <tag/Function/Set the current speed of the C64 Turbo Master cartridge.
6465 <tag/Header/<tt/<ref id="accelerator.h" name="accelerator.h">/
6466 <tag/Declaration/<tt/unsigned char __fastcall__ set_turbomaster_speed (unsigned char speed);/
6467 <tag/Description/The function returns the speed after trying to set the speed of the C64 Turbo Master cartridge.
6468 <tag/Notes/<itemize>
6469 <item>The function is specific to the C64.
6470 <item>The function does not check for the presence of the C64 Turbo Master cartridge.
6471 <item>See the accelerator.h header for the speed definitions.
6473 <tag/Availability/cc65 (not all platforms)
6475 <ref id="detect_turbomaster" name="detect_turbomaster">,
6476 <ref id="get_turbomaster_speed" name="get_turbomaster_speed">,
6482 <sect1>setjmp<label id="setjmp"><p>
6486 <tag/Function/Save the context for use with <tt/longjmp/.
6487 <tag/Header/<tt/<ref id="setjmp.h" name="setjmp.h">/
6488 <tag/Declaration/<tt/int __fastcall__ setjmp (jmp_buf buf);/
6489 <tag/Description/The <tt/setjmp/ function saves the current context in <tt/buf/
6490 for subsequent use by the <tt/<ref id="longjmp" name="longjmp">/ function and
6492 <tag/Notes/<itemize>
6493 <item>The function is only available as fastcall function, so it may only
6494 be used in presence of a prototype.
6495 <item><tt/setjmp/ is actually a macro as required by the ISO standard.
6496 <item><tt/setjmp/ will not save the signal context.
6498 <tag/Availability/ISO 9899
6500 <ref id="longjmp" name="longjmp">
6506 <sect1>setlocale<label id="setlocale"><p>
6510 <tag/Function/Selects a locale.
6511 <tag/Header/<tt/<ref id="locale.h" name="locale.h">/
6512 <tag/Declaration/<tt/char* __fastcall__ setlocale (int category, const char* locale);/
6513 <tag/Description/<tt/setlocale/ sets or queries the program's locale.
6514 <tag/Notes/<itemize>
6515 <item>The function is only available as fastcall function, so it may only
6516 be used in presence of a prototype.
6517 <item>cc65 supports only the "C" locale, so calling this function to set a
6518 different locale has no effect.
6520 <tag/Availability/ISO 9899
6522 <ref id="localeconv" name="localeconv">,
6523 <ref id="strcoll" name="strcoll">
6524 <ref id="strxfrm" name="strxfrm">
6530 <sect1>signal<label id="signal"><p>
6534 <tag/Function/Install a signal handler.
6535 <tag/Header/<tt/<ref id="signal.h" name="signal.h">/
6536 <tag/Declaration/<tt/__sigfunc __fastcall__ signal (int sig, __sigfunc func);/
6537 <tag/Description/<tt/signal/ installs a handler for the given signal. The
6538 handler may either be a user supplied function, or one of the predefined
6539 signal handlers <tt/SIG_IGN/ or <tt/SIG_DFL/. The function returns the
6540 previous value if the signal , or the special function vector SIG_ERR in
6542 <tag/Notes/<itemize>
6543 <item>The function is only available as fastcall function, so it may only
6544 be used in presence of a prototype.
6546 <tag/Availability/ISO 9899
6548 <ref id="abort" name="abort">,
6549 <ref id="raise" name="raise">
6555 <sect1>sleep<label id="sleep"><p>
6559 <tag/Function/Sleep for a specified amount of time.
6560 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
6561 <tag/Declaration/<tt/void __fastcall__ sleep (unsigned seconds);/
6562 <tag/Description/The function will return after the specified number of
6563 seconds have elapsed.
6564 <tag/Notes/<itemize>
6565 <item>The function is only available as fastcall function, so it may only
6566 be used in presence of a prototype.
6568 <tag/Availability/POSIX 1003.1
6574 <sect1>slow<label id="slow"><p>
6578 <tag/Function/Switch the CPU into slow mode (C128: 1MHz mode, C16/Plus4: single clock mode).
6579 <tag/Header/<tt/<ref id="c128.h" name="c128.h">,
6580 <ref id="c16.h" name="c16.h">, <ref id="plus4.h" name="plus4.h">/
6581 <tag/Declaration/<tt/void slow (void);/
6582 <tag/Description/The function will switch the clock of the CPU to slow mode. for the C128
6583 target it means switching the CPU into 1MHz mode. for the C16/Plus4 target it means
6584 switching the CPU into single clock mode.
6585 <tag/Notes/<itemize>
6586 <item>The function is specific to the C128, C16 and Plus4.
6588 <tag/Availability/cc65 (not all platforms)
6590 <ref id="fast" name="fast">,
6591 <ref id="isfast" name="isfast">,
6597 <sect1>srand<label id="srand"><p>
6601 <tag/Function/Initialize the pseudo random number generator.
6602 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
6603 <tag/Declaration/<tt/void __fastcall__ srand (unsigned seed);/
6604 <tag/Description/The function initializes the random number generator using
6605 the given seed. On program startup, the generator behaves as if <tt/srand/ has
6606 been called with an argument of 1.
6607 <tag/Notes/<itemize>
6608 <item>The function is only available as fastcall function, so it may only
6609 be used in presence of a prototype.
6611 <tag/Availability/ISO 9899
6613 <ref id="_randomize" name="_randomize">,
6614 <ref id="rand" name="rand">
6620 <sect1>strcasecmp<label id="strcasecmp"><p>
6624 <tag/Function/Compare two strings case insensitive.
6625 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6626 <tag/Declaration/<tt/int __fastcall__ strcasecmp (const char* s1, const char* s2);/
6627 <tag/Description/The <tt/strcasecmp/ function compares the two strings passed
6628 as parameters without case sensitivity. It returns a value that is less than
6629 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
6630 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
6631 <tag/Notes/<itemize>
6632 <item>The function is only available as fastcall function, so it may only
6633 be used in presence of a prototype.
6634 <item>The function is not available in strict ANSI mode.
6636 <tag/Availability/cc65
6638 <ref id="strcmp" name="strcmp">,
6639 <ref id="strcoll" name="strcoll">,
6640 <ref id="stricmp" name="stricmp">,
6641 <ref id="strncmp" name="strncmp">,
6642 <ref id="strxfrm" name="strxfrm">
6648 <sect1>strcat<label id="strcat"><p>
6652 <tag/Function/Concatentate two strings.
6653 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6654 <tag/Declaration/<tt/char* __fastcall__ strcat (char* s1, const char* s2);/
6655 <tag/Description/The <tt/strcat/ function appends a copy of the string
6656 pointed to by s2 (including the terminating null byte) to the end of the
6657 string pointed to by s1. The initial byte of s2 overwrites the null byte at
6659 <tag/Notes/<itemize>
6660 <item>The function is only available as fastcall function, so it may only
6661 be used in presence of a prototype.
6662 <item>If copying takes place between objects that overlap, the behaviour
6665 <tag/Availability/ISO 9899
6667 <ref id="strcpy" name="strcpy">,
6668 <ref id="strncat" name="strncat">,
6669 <ref id="strncpy" name="strncpy">
6675 <sect1>strchr<label id="strchr"><p>
6679 <tag/Function/Search for a character in a string.
6680 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6681 <tag/Declaration/<tt/char* __fastcall__ strchr (const char* s, int c);/
6682 <tag/Description/The <tt/strchr/ function locates the first occurrence of <tt/c/
6683 (converted to a char) in the string pointed to by <tt/s/. The terminating null
6684 byte is considered to be part of the string. Upon completion, the function
6685 returns a pointer to the byte, or a null pointer if the byte was not found.
6686 <tag/Notes/<itemize>
6687 <item>The function is only available as fastcall function, so it may only
6688 be used in presence of a prototype.
6690 <tag/Availability/ISO 9899
6692 <ref id="memchr" name="memchr">,
6693 <ref id="strrchr" name="strrchr">
6699 <sect1>strcmp<label id="strcmp"><p>
6703 <tag/Function/Compare two strings.
6704 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6705 <tag/Declaration/<tt/int __fastcall__ strcmp (const char* s1, const char* s2);/
6706 <tag/Description/The <tt/strcmp/ function compares the two strings passed as
6707 parameters. It returns a value that is less than zero if <tt/s1/ is less than
6708 <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater than zero
6709 if <tt/s1/ is greater than <tt/s2/.
6710 <tag/Notes/<itemize>
6711 <item>The function is only available as fastcall function, so it may only
6712 be used in presence of a prototype.
6714 <tag/Availability/ISO 9899
6716 <ref id="strcasecmp" name="strcasecmp">,
6717 <ref id="strcoll" name="strcoll">,
6718 <ref id="stricmp" name="stricmp">,
6719 <ref id="strncmp" name="strncmp">
6720 <ref id="strxfrm" name="strxfrm">
6726 <sect1>strcoll<label id="strcoll"><p>
6730 <tag/Function/Compare two strings.
6731 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6732 <tag/Declaration/<tt/int __fastcall__ strcoll (const char* s1, const char* s2);/
6733 <tag/Description/The <tt/strcoll/ function compares the two strings passed as
6734 parameters, according to the collating sequence set by <tt/<ref id="setlocale"
6735 name="setlocale">/. It returns a value that is less than zero if <tt/s1/ is
6736 less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a value greater
6737 than zero if <tt/s1/ is greater than <tt/s2/.
6738 <tag/Notes/<itemize>
6739 <item>The function is only available as fastcall function, so it may only
6740 be used in presence of a prototype.
6742 <tag/Availability/ISO 9899
6744 <ref id="setlocale" name="setlocale">,
6745 <ref id="strcasecmp" name="strcasecmp">,
6746 <ref id="strcmp" name="strcmp">,
6747 <ref id="stricmp" name="stricmp">,
6748 <ref id="strncmp" name="strncmp">,
6749 <ref id="strxfrm" name="strxfrm">
6755 <sect1>strcpy<label id="strcpy"><p>
6759 <tag/Function/Copy a string.
6760 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6761 <tag/Declaration/<tt/char* __fastcall__ strcpy (char* s1, const char* s2);/
6762 <tag/Description/The <tt/strcpy/ function copies the string pointed to by
6763 <tt/s2/ (including the terminating null byte) into the array pointed to by
6764 <tt/s1/. The function will always return <tt/s1/.
6765 <tag/Notes/<itemize>
6766 <item>The function is only available as fastcall function, so it may only
6767 be used in presence of a prototype.
6768 <item>If copying takes place between objects that overlap, the behaviour
6771 <tag/Availability/ISO 9899
6773 <ref id="strcat" name="strcat">,
6774 <ref id="strncat" name="strncat">,
6775 <ref id="strncpy" name="strncpy">
6778 #include <string.h>
6780 static char hello[14];
6782 strcpy (hello, "Hello world!\n");
6788 <sect1>strcspn<label id="strcspn"><p>
6792 <tag/Function/Compute the length of a substring.
6793 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6794 <tag/Declaration/<tt/size_t __fastcall__ strcspn (const char* s, const char* set);/
6795 <tag/Description/The <tt/strcspn/ function computes and returns the length of
6796 the substring pointed to by <tt/s/ which does <em>not</em> consist of
6797 characters contained in the string <tt/set/.
6798 <tag/Notes/<itemize>
6799 <item>The function is only available as fastcall function, so it may only
6800 be used in presence of a prototype.
6802 <tag/Availability/ISO 9899
6804 <ref id="strpbrk" name="strpbrk">,
6805 <ref id="strqtok" name="strqtok">,
6806 <ref id="strspn" name="strspn">,
6807 <ref id="strstr" name="strstr">,
6808 <ref id="strtok" name="strtok">
6814 <sect1>strdup<label id="strdup"><p>
6818 <tag/Function/Allocate a copy of a string on the heap.
6819 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6820 <tag/Declaration/<tt/char* __fastcall__ strdup (const char* s);/
6821 <tag/Description/<tt/strdup/ allocates a memory block on the heap, big enough
6822 to hold a copy of <tt/s/ including the terminating zero. If the allocation
6823 fails, <tt/NULL/ is returned, otherwise <tt/s/ is copied into the allocated
6824 memory block, and a pointer to the block is returned.
6825 <tag/Notes/<itemize>
6826 <item>The function is only available as fastcall function, so it may only
6827 be used in presence of a prototype.
6828 <item>It is up to the caller to free the allocated memory block.
6830 <tag/Availability/ISO 9899
6832 <ref id="free" name="free">,
6833 <ref id="malloc" name="malloc">
6839 <sect1>strerror<label id="strerror"><p>
6843 <tag/Function/Return a string describing an error code.
6844 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6845 <tag/Declaration/<tt/char* __fastcall__ strerror (int errcode);/
6846 <tag/Description/The <tt/strerror/ function returns a string describing the
6847 given error code. If an invalid error code is passed, the string "Unknown
6848 error" is returned, and <tt/errno/ is set to <tt/EINVAL/. In all other cases,
6849 <tt/errno/ is left untouched.
6850 <tag/Notes/<itemize>
6851 <item>The function is only available as fastcall function, so it may only
6852 be used in presence of a prototype.
6853 <item>While the return type of the function is a <tt/char*/, the returned
6854 string must not be modified by the caller!
6856 <tag/Availability/ISO 9899
6858 <ref id="_stroserror" name="_stroserror">
6864 <sect1>stricmp<label id="stricmp"><p>
6868 <tag/Function/Compare two strings case insensitive.
6869 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6870 <tag/Declaration/<tt/int __fastcall__ stricmp (const char* s1, const char* s2);/
6871 <tag/Description/The <tt/stricmp/ function compares the two strings passed as
6872 parameters without case sensitivity. It returns a value that is less than zero
6873 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
6874 value greater than zero if <tt/s1/ is greater than <tt/s2/.
6875 <tag/Notes/<itemize>
6876 <item>The function is only available as fastcall function, so it may only
6877 be used in presence of a prototype.
6878 <item>The function is not available in strict ANSI mode.
6880 <tag/Availability/cc65
6882 <ref id="strcasecmp" name="strcasecmp">,
6883 <ref id="strcmp" name="strcmp">,
6884 <ref id="strcoll" name="strcoll">,
6885 <ref id="strncmp" name="strncmp">,
6886 <ref id="strxfrm" name="strxfrm">
6892 <sect1>strlen<label id="strlen"><p>
6896 <tag/Function/Return the length of a string.
6897 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6898 <tag/Declaration/<tt/size_t __fastcall__ strlen (const char* s);/
6899 <tag/Description/The <tt/strlen/ function computes the number of bytes in the
6900 string to which s points, not including the terminating null byte.
6901 <tag/Notes/<itemize>
6902 <item>The function is only available as fastcall function, so it may only
6903 be used in presence of a prototype.
6904 <item>When compiling with <tt/-Os/ (inline known standard functions), the
6905 function does not work correctly for strings with more than 255 characters.
6907 <tag/Availability/ISO 9899
6909 <ref id="strcpy" name="strcpy">
6915 <sect1>strlower<label id="strlower"><p>
6919 <tag/Function/Make a string lower case.
6920 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6921 <tag/Declaration/<tt/char* __fastcall__ strlower (char* s);/
6922 <tag/Description/The <tt/strlower/ function will apply the <tt/tolower/
6923 function to each character of a string. The function will always return <tt/s/.
6924 <tag/Notes/<itemize>
6925 <item>The function is only available as fastcall function, so it may only
6926 be used in presence of a prototype.
6927 <item>The function prototype is unavailable when compiling in strict ANSI mode.
6928 <item>An alias name for this function is <tt/strlwr/.
6930 <tag/Availability/cc65
6932 <ref id="strupper" name="strupper">,
6933 <ref id="tolower" name="tolower">
6939 <sect1>strlwr<label id="strlwr"><p>
6946 <sect1>strncasecmp<label id="strncasecmp"><p>
6950 <tag/Function/Compare two strings case insensitive.
6951 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6952 <tag/Declaration/<tt/int __fastcall__ strncasecmp (const char* s1, const char* s2, size_t count);/
6953 <tag/Description/The <tt/strncasecmp/ function compares the two strings passed
6954 as parameters without case sensitivity. It returns a value that is less than
6955 zero if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/,
6956 and a value greater than zero if <tt/s1/ is greater than <tt/s2/.
6957 <tag/Notes/<itemize>
6958 <item>The function is only available as fastcall function, so it may only
6959 be used in presence of a prototype.
6960 <item>The function is not available in strict ANSI mode.
6962 <tag/Availability/cc65
6964 <ref id="strcmp" name="strcmp">,
6965 <ref id="strcoll" name="strcoll">,
6966 <ref id="stricmp" name="stricmp">,
6967 <ref id="strncmp" name="strncmp">,
6968 <ref id="strxfrm" name="strxfrm">
6974 <sect1>strncat<label id="strncat"><p>
6978 <tag/Function/Concatentate two strings.
6979 <tag/Header/<tt/<ref id="string.h" name="string.h">/
6980 <tag/Declaration/<tt/char* __fastcall__ strncat (char* s1, const char* s2, size_t n);/
6981 <tag/Description/The <tt/strncat/ function appends not more than n characters
6982 of the string pointed to by s2 to the end of the string pointed to by s1. The
6983 terminating null character at the end of s1 is overwritten. A terminating null
6984 character is appended to the result, even if not all of s2 is appended to s1.
6985 <tag/Notes/<itemize>
6986 <item>The function is only available as fastcall function, so it may only
6987 be used in presence of a prototype.
6988 <item>If copying takes place between objects that overlap, the behaviour
6991 <tag/Availability/ISO 9899
6993 <ref id="strcpy" name="strcpy">,
6994 <ref id="strncat" name="strncat">,
6995 <ref id="strncpy" name="strncpy">
7001 <sect1>strncmp<label id="strncmp"><p>
7005 <tag/Function/Compare two strings.
7006 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7007 <tag/Declaration/<tt/int __fastcall__ strncmp (const char* s1, const char* s2, size_t count);/
7008 <tag/Description/The <tt/strncmp/ function compares not more than <tt/count/
7009 characters of the two strings passed as parameters. It returns a value that is
7010 less than zero if the first <tt/count/ characters of <tt/s1/ are less than
7011 <tt/s2/, zero if they are identical, and a value greater than zero they are
7013 <tag/Notes/<itemize>
7014 <item>The function is only available as fastcall function, so it may only
7015 be used in presence of a prototype.
7017 <tag/Availability/ISO 9899
7019 <ref id="strcasecmp" name="strcasecmp">,
7020 <ref id="strcmp" name="strcmp">,
7021 <ref id="strcoll" name="strcoll">,
7022 <ref id="stricmp" name="stricmp">,
7023 <ref id="strxfrm" name="strxfrm">
7029 <sect1>strncpy<label id="strncpy"><p>
7033 <tag/Function/Copy part of a string.
7034 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7035 <tag/Declaration/<tt/char* __fastcall__ strncpy (char* s1, const char* s2, size_t n);/
7036 <tag/Description/The <tt/strncpy/ function copies not more than <tt/n/ bytes from
7037 the array pointed to by <tt/s2/ to the array pointed to by <tt/s1/. If the array
7038 pointed to by <tt/s2/ is a string that is shorter than <tt/n/ bytes, null bytes are
7039 appended to the copy in the array pointed to by <tt/s1/, until <tt/n/ bytes are
7040 written. The function always will return <tt/s1/.
7041 <tag/Notes/<itemize>
7042 <item>The function is available only as a fastcall function; so, it may be used
7043 only in the presence of a prototype.
7044 <item>If there is no null byte in the first <tt/n/ bytes of the array pointed
7045 to by <tt/s2/, the result is <em/not/ null-terminated!
7046 <item>If copying takes place between objects that overlap, the behaviour is
7049 <tag/Availability/ISO 9899
7051 <ref id="memcpy" name="memcpy">,
7052 <ref id="strcat" name="strcat">,
7053 <ref id="strcpy" name="strcpy">,
7054 <ref id="strncat" name="strncat">
7059 static char hello[6];
7061 strncpy (hello, "Hello world!\n", sizeof hello - 1)[5] = '\0';
7067 <sect1>strnicmp<label id="strnicmp"><p>
7071 <tag/Function/Compare two strings case insensitive.
7072 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7073 <tag/Declaration/<tt/int __fastcall__ strnicmp (const char* s1, const char* s2, size_t count);/
7074 <tag/Description/The <tt/strnicmp/ function compares the two strings passed as
7075 parameters without case sensitivity. It returns a value that is less than zero
7076 if <tt/s1/ is less than <tt/s2/, zero if <tt/s1/ is the same as <tt/s2/, and a
7077 value greater than zero if <tt/s1/ is greater than <tt/s2/.
7078 <tag/Notes/<itemize>
7079 <item>The function is only available as fastcall function, so it may only
7080 be used in presence of a prototype.
7081 <item>The function is not available in strict ANSI mode.
7083 <tag/Availability/cc65
7085 <ref id="strcasecmp" name="strcasecmp">,
7086 <ref id="strcmp" name="strcmp">,
7087 <ref id="strcoll" name="strcoll">,
7088 <ref id="strncmp" name="strncmp">,
7089 <ref id="strxfrm" name="strxfrm">
7095 <sect1>strpbrk<label id="strpbrk"><p>
7099 <tag/Function/Find a character in a string, from a set of characters.
7100 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7101 <tag/Declaration/<tt/char* __fastcall__ strpbrk (const char* str, const char* set);/
7102 <tag/Description/<tt/strpbrk()/ searches within <tt/str/ for the first
7103 occurance of any character from <tt/set/. It returns a pointer to that
7104 character if found; otherwise, it returns <tt/NULL/.
7105 <tag/Notes/<itemize>
7106 <item>The function is available only as a fastcall function;
7107 so, it should be used only in the presence of a prototype.
7109 <tag/Availability/ISO 9899
7111 <ref id="strchr" name="strchr">,
7112 <ref id="strcspn" name="strcspn">,
7113 <ref id="strqtok" name="strqtok">,
7114 <ref id="strspn" name="strspn">,
7115 <ref id="strtok" name="strtok">
7121 <sect1>strqtok<label id="strqtok"><p>
7125 <tag/Function/Break a string into tokens.
7126 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7127 <tag/Declaration/<tt/char* __fastcall__ strqtok (char* s1, const char* s2);/
7128 <tag/Description/<tt/strqtok()/ will break the string <tt/s1/ into a sequence of
7129 tokens, which are delimited by either quotation marks or characters from the
7130 string <tt/s2/. Tokens inside quotation marks may contain characters from <tt/s2/
7131 (they aren't delimiters there). The first call to <tt/strqtok()/ will return a
7132 pointer to the first token in the string <tt/s1/. The following calls must pass
7133 a <tt/NULL/ pointer as <tt/s1/, in order to get the next token in the string.
7134 Different sets of delimiters may be used for the subsequent calls to <tt/strqtok()/.
7135 <tag/Notes/<itemize>
7136 <item>The function is available only as a fastcall function; so, it may be used
7137 only in the presence of a prototype.
7138 <item><tt/strqtok()/ will modify the string <tt/s1/.
7139 <item>The function will forget where it is in the <tt/s1/ string if it is given
7140 a second <tt/s1/ string before it finishes the first one.
7142 <tag/Availability/cc65
7144 <ref id="strcspn" name="strcspn">,
7145 <ref id="strpbrk" name="strpbrk">,
7146 <ref id="strspn" name="strspn">,
7147 <ref id="strtok" name="strtok">
7153 <sect1>strrchr<label id="strrchr"><p>
7157 <tag/Function/Search for a character in a string.
7158 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7159 <tag/Declaration/<tt/char* __fastcall__ strrchr (const char* s, int c);/
7160 <tag/Description/The <tt/strrchr/ function locates the last occurrence of <tt/c/
7161 (converted to a char) in the string pointed to by <tt/s/. The terminating null
7162 byte is considered to be part of the string. Upon completion, the function
7163 returns a pointer to the byte, or a null pointer if the byte was not found.
7164 <tag/Notes/<itemize>
7165 <item>The function is only available as fastcall function, so it may only
7166 be used in presence of a prototype.
7168 <tag/Availability/ISO 9899
7170 <ref id="strchr" name="strchr">
7176 <sect1>strspn<label id="strspn"><p>
7180 <tag/Function/Compute the length of a substring.
7181 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7182 <tag/Declaration/<tt/size_t __fastcall__ strspn (const char* s, const char* set);/
7183 <tag/Description/The <tt/strspn/ function computes and returns the length of
7184 the substring pointed to by <tt/s/ which does consist only of characters
7185 contained in the string <tt/set/.
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.
7190 <tag/Availability/ISO 9899
7192 <ref id="strcspn" name="strcspn">,
7193 <ref id="strpbrk" name="strpbrk">,
7194 <ref id="strstr" name="strstr">
7200 <sect1>strstr<label id="strstr"><p>
7204 <tag/Function/Find a substring.
7205 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7206 <tag/Declaration/<tt/char* __fastcall__ strstr (const char* str, const char* substr);/
7207 <tag/Description/<tt/strstr/ searches for the first occurance of the string
7208 <tt/substr/ within <tt/str/. If found, it returns a pointer to the copy,
7209 otherwise it returns <tt/NULL/.
7210 <tag/Notes/<itemize>
7211 <item>The function is only available as fastcall function, so it may only
7212 be used in presence of a prototype.
7214 <tag/Availability/ISO 9899
7216 <ref id="strcspn" name="strcspn">,
7217 <ref id="strspn" name="strspn">
7223 <sect1>strtok<label id="strtok"><p>
7227 <tag/Function/Break a string into tokens.
7228 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7229 <tag/Declaration/<tt/char* __fastcall__ strtok (char* s1, const char* s2);/
7230 <tag/Description/<tt/strtok()/ will break the string <tt/s1/ into a sequence of
7231 tokens, which are delimited by characters from the string <tt/s2/. The first call
7232 to <tt/strtok()/ will return a pointer to the first token in the string <tt/s1/.
7233 The following calls must pass a <tt/NULL/ pointer as <tt/s1/, in order to get
7234 the next token in the string. Different sets of delimiters may be used for the
7235 subsequent calls to <tt/strtok()/.
7236 <tag/Notes/<itemize>
7237 <item>The function is only available as fastcall function, so it may only
7238 be used in presence of a prototype.
7239 <item><tt/strtok()/ will modify the string <tt/s1/.
7240 <item>The function will forget where it is in the <tt/s1/ string if it is given
7241 a second <tt/s1/ string before it finishes the first one.
7243 <tag/Availability/ISO 9899
7245 <ref id="strcspn" name="strcspn">,
7246 <ref id="strpbrk" name="strpbrk">,
7247 <ref id="strqtok" name="strqtok">,
7248 <ref id="strspn" name="strspn">
7254 <sect1>strxfrm<label id="strxfrm"><p>
7258 <tag/Function/Transform a string.
7259 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7260 <tag/Declaration/<tt/size_t __fastcall__ strxfrm (char* s1, const char* s2, size_t n);/
7261 <tag/Description/The <tt/strxfrm/ function transforms the string pointed to by
7262 s2 and places the resulting string into the string pointed to by s1. The
7263 transformation is such that if the <tt/strcmp/ function is applied to two
7264 transformed strings, it returns a value greater than, equal to, or less than
7265 zero, corresponding to the result of the <tt/strcoll/ function applied to the
7266 same two original strings. No more than n characters are placed into the
7267 resulting array pointed to by s1, including the terminating null character.
7268 <tag/Notes/<itemize>
7269 <item><tt/s1/ and <tt/s2/ must not point to the same memory area, otherwise
7270 the behaviour is undefined.
7271 <item>If <tt/n/ is zero, <tt/s1/ may be a NULL pointer.
7272 <item>The function is only available as fastcall function, so it may only
7273 be used in presence of a prototype.
7274 <item>Since cc65 doesn't support different charcter sets, <tt/strxfrm/ will
7275 just copy s2 to s1 using <tt><ref id="strncpy" name="strncpy"></tt>.
7277 <tag/Availability/ISO 9899
7279 <ref id="strcmp" name="strcmp">,
7280 <ref id="strcoll" name="strcoll">,
7281 <ref id="strncpy" name="strncpy">
7287 <sect1>strupper<label id="strupper"><p>
7291 <tag/Function/Make a string upper case.
7292 <tag/Header/<tt/<ref id="string.h" name="string.h">/
7293 <tag/Declaration/<tt/char* __fastcall__ strupper (char* s);/
7294 <tag/Description/The <tt/strupper/ function will apply the <tt/toupper/
7295 function to each character of a string. The function will always return <tt/s/.
7296 <tag/Notes/<itemize>
7297 <item>The function is only available as fastcall function, so it may only
7298 be used in presence of a prototype.
7299 <item>The function prototype is unavailable when compiling in strict ANSI mode.
7300 <item>An alias name for this function is <tt/strupr/.
7302 <tag/Availability/cc65
7304 <ref id="strlower" name="strlower">
7305 <ref id="toupper" name="toupper">
7311 <sect1>strupr<label id="strupr"><p>
7318 <sect1>telldir<label id="telldir"><p>
7322 <tag/Function/Return the current position of a directory stream.
7323 <tag/Header/<tt/<ref id="dirent.h" name="dirent.h">/
7324 <tag/Declaration/<tt/long __fastcall__ telldir (DIR* dir);/
7325 <tag/Description/<tt/telldir/ returns the current position of a directory
7326 stream. The return value may be used in subsequent calls to
7327 <tt/<ref id="seekdir" name="seekdir">/.
7328 <tag/Notes/<itemize>
7329 <item>The function is only available as fastcall function, so it may only
7330 be used in presence of a prototype.
7332 <tag/Availability/POSIX 1003.1
7334 <ref id="seekdir" name="seekdir">,
7335 <ref id="telldir" name="telldir">
7341 <sect1>textcolor<label id="textcolor"><p>
7345 <tag/Function/Set the text color.
7346 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7347 <tag/Declaration/<tt/unsigned char __fastcall__ textcolor (unsigned char color);/
7348 <tag/Description/The function will set a new text color. It returns the old
7349 (current) text color. Text output using any <tt/conio.h/ function will use
7350 the color set by this function.
7351 <tag/Notes/<itemize>
7352 <item>Text colors are system dependent. The function may have no effect
7353 on systems where the text color cannot be changed.
7354 <item>The function is only available as fastcall function, so it may only
7355 be used in presence of a prototype.
7357 <tag/Availability/cc65
7359 <ref id="bgcolor" name="bgcolor">,
7360 <ref id="bordercolor" name="bordercolor">
7366 <sect1>time<label id="time"><p>
7370 <tag/Function/Get the time.
7371 <tag/Header/<tt/<ref id="time.h" name="time.h">/
7372 <tag/Declaration/<tt/time_t __fastcall__ time (time_t* t);/
7373 <tag/Description/The function returns the time since the 1970-01-01 00:00:00
7374 measured in seconds. If the pointer <tt/t/ is not <tt/NULL/, the function
7375 result will also be stored there. If no time is available, <tt/(time_t)-1/ is
7376 returned and an error code is stored in <tt/errno/.
7377 <tag/Notes/<itemize>
7378 <item>The function is only available as fastcall function, so it may
7379 only be used in presence of a prototype.
7380 <item>Many platforms supported by cc65 do not have a realtime clock, so the
7381 returned value may not be valid.
7383 <tag/Availability/ISO 9899
7385 <ref id="clock" name="clock">
7391 <sect1>toggle_videomode<label id="toggle_videomode"><p>
7395 <tag/Function/Toggle between 40 and 80 column mode.
7396 <tag/Header/<tt/<ref id="c128.h" name="c128.h">/
7397 <tag/Declaration/<tt/void toggle_videomode (void);/
7398 <tag/Description/Toggle between 40 and 80 column mode. The settings for the
7399 old mode (cursor position, color and so on) are saved and restored together
7401 <tag/Notes/<itemize>
7402 <item>The function is specific to the C128.
7403 <item>This function is deprecated. Please use <ref id="videomode"
7404 name="videomode"> instead!
7406 <tag/Availability/C128
7408 <ref id="fast" name="fast">,
7409 <ref id="isfast" name="isfast">,
7410 <ref id="slow" name="slow">,
7411 <ref id="videomode" name="videomode">
7417 <sect1>tolower<label id="tolower"><p>
7421 <tag/Function/Convert a character into its lower case representation.
7422 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7423 <tag/Declaration/<tt/int __fastcall__ tolower (int c);/
7424 <tag/Description/The function returns the given character converted to lower
7425 case. If the given character is not a letter, it is returned unchanged.
7426 <tag/Notes/<itemize>
7427 <item>The function is only available as fastcall function, so it may
7428 only be used in presence of a prototype.
7430 <tag/Availability/ISO 9899
7432 <ref id="islower" name="islower">,
7433 <ref id="isupper" name="isupper">,
7434 <ref id="toupper" name="toupper">
7440 <sect1>toupper<label id="toupper"><p>
7444 <tag/Function/Convert a character into its upper case representation.
7445 <tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
7446 <tag/Declaration/<tt/int __fastcall__ toupper (int c);/
7447 <tag/Description/The function returns the given character converted to upper
7448 case. If the given character is not a letter, it is returned unchanged.
7449 <tag/Notes/<itemize>
7450 <item>The function is only available as fastcall function, so it may
7451 only be used in presence of a prototype.
7453 <tag/Availability/ISO 9899
7455 <ref id="islower" name="islower">,
7456 <ref id="isupper" name="isupper">,
7457 <ref id="tolower" name="tolower">
7463 <sect1>ultoa<label id="ultoa"><p>
7467 <tag/Function/Convert an unsigned long integer into a string.
7468 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7469 <tag/Declaration/<tt/char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);/
7470 <tag/Description/<tt/itoa/ converts the unsigned long integer <tt/val/ into a
7471 string using <tt/radix/ as the base.
7472 <tag/Notes/<itemize>
7473 <item>There are no provisions to prevent a buffer overflow.
7474 <item>The function is non standard, so it is not available in strict ANSI mode.
7475 You should probably use <tt/sprintf/ instead.
7476 <item>The function is only available as fastcall function, so it may only be
7477 used in presence of a prototype.
7479 <tag/Availability/cc65
7481 <ref id="atoi" name="atoi">,
7482 <ref id="atol" name="atol">,
7483 <ref id="itoa" name="itoa">,
7484 <ref id="ltoa" name="ltoa">,
7485 <ref id="utoa" name="utoa">
7491 <sect1>unlink<label id="unlink"><p>
7495 <tag/Function/Delete a file.
7496 <tag/Header/<tt/<ref id="unistd.h" name="unistd.h">/
7497 <tag/Declaration/<tt/int __fastcall__ unlink (const char* name);/
7498 <tag/Description/<tt/unlink/ deletes the file with the given name. On success,
7499 zero is returned. On error, -1 is returned and <tt/errno/ is set to an error
7500 code describing the reason for the failure.
7501 <tag/Notes/<itemize>
7502 <item>The use of this function is discouraged. Please use <tt/<ref id="remove"
7503 name="remove">/ instead, which is a native ANSI C function and does the same.
7504 <item>This function is not available on all cc65 targets (depends on the
7505 availability of file I/O).
7506 <item>The function is only available as fastcall function, so it may only
7507 be used in presence of a prototype.
7508 <item>Instead of <tt/unlink/, <tt/<ref id="remove" name="remove">/ should be
7509 used, which has the same semantics, but is more portable, because it conforms
7510 to the ISO C standard.
7512 <tag/Availability/POSIX 1003.1
7514 <ref id="remove" name="remove">
7517 #include <stdio.h>
7518 #include <unistd.h>
7520 #define FILENAME "helloworld"
7522 if (unlink (FILENAME) == 0) {
7523 printf ("We deleted %s successfully\n", FILENAME);
7525 printf ("There was a problem deleting %s\n", FILENAME);
7532 <sect1>utoa<label id="utoa"><p>
7536 <tag/Function/Convert an unsigned integer into a string.
7537 <tag/Header/<tt/<ref id="stdlib.h" name="stdlib.h">/
7538 <tag/Declaration/<tt/char* __fastcall__ utoa (unsigned val, char* buf, int radix);/
7539 <tag/Description/<tt/itoa/ converts the unsigned integer <tt/val/ into a string
7540 using <tt/radix/ as the base.
7541 <tag/Notes/<itemize>
7542 <item>There are no provisions to prevent a buffer overflow.
7543 <item>The function is non standard, so it is not available in strict ANSI mode.
7544 You should probably use <tt/sprintf/ instead.
7545 <item>The function is only available as fastcall function, so it may only be
7546 used in presence of a prototype.
7548 <tag/Availability/cc65
7550 <ref id="atoi" name="atoi">,
7551 <ref id="atol" name="atol">,
7552 <ref id="itoa" name="itoa">,
7553 <ref id="ltoa" name="ltoa">,
7554 <ref id="ultoa" name="ultoa">
7560 <sect1>vcprintf<label id="vcprintf"><p>
7564 <tag/Function/Formatted output to the console.
7565 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7566 <tag/Declaration/<tt/int __fastcall__ vcprintf (const char* format, va_list ap);/
7567 <tag/Description/The arguments specified as a <tt/va_list/ are converted to
7568 text where necessary and formatted according to the format string given. The
7569 resulting string is output to the console. <tt/vcprintf/ supports the same
7570 format specifiers as <tt/vprintf/. <!-- <tt/<ref id="vprintf" name="vprintf">/. -->
7571 <tag/Notes/<itemize>
7572 <item>Like all other <tt/conio/ output functions, <tt/vcprintf/ distinguishes
7573 between <tt/\r/ and <tt/\n/.
7574 <item>The function is only available as fastcall function, so it may only be
7575 used in presence of a prototype.
7577 <tag/Availability/cc65
7579 <ref id="cprintf" name="cprintf">,
7580 <ref id="cputc" name="cputc">,
7581 <ref id="cputcxy" name="cputcxy">,
7582 <ref id="cputs" name="cputs">,
7583 <ref id="cputsxy" name="cputsxy">
7589 <sect1>videomode<label id="videomode"><p>
7593 <tag/Function/Switch to either 40 or 80 column mode.
7594 <tag/Header/<tt/<ref id="apple2enh.h" name="apple2enh.h">,
7595 <ref id="c128.h" name="c128.h">/
7596 <tag/Declaration/<tt/unsigned __fastcall__ videomode (unsigned Mode);/
7597 <tag/Description/Switch to 40 or 80 column mode depending on the argument. If
7598 the requested mode is already active, nothing happens. The old mode is returned
7600 <tag/Notes/<itemize>
7601 <item>The function is specific to the C128 and enhanced Apple //e.
7602 <item>This function replaces <ref id="toggle_videomode"
7603 name="toggle_videomode">.
7604 <item>The function is only available as fastcall function, so it may only be
7605 used in presence of a prototype.
7607 <tag/Availability/C128 and enhanced Apple //e
7609 <ref id="fast" name="fast">,
7610 <ref id="isfast" name="isfast">,
7611 <ref id="slow" name="slow">,
7612 <ref id="toggle_videomode" name="toggle_videomode">
7618 <sect1>waitvsync<label id="waitvsync"><p>
7622 <tag/Function/Wait until the start of the next frame.
7624 <tt/<ref id="cbm.h" name="cbm.h">/,
7625 <tt/<ref id="gamate.h" name="gamate.h">/,
7626 <tt/<ref id="nes.h" name="nes.h">/,
7627 <tt/<ref id="pce.h" name="pce.h">/
7628 <tag/Declaration/<tt/void waitvsync (void);/
7629 <tag/Description/Wait for vertical sync to reduce flickering.
7630 <tag/Availability/Platforms above
7636 <sect1>wherex<label id="wherex"><p>
7640 <tag/Function/Return the current X position of the text mode cursor.
7641 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7642 <tag/Declaration/<tt/unsigned char wherex (void);/
7643 <tag/Description/The function returns the current X position of the text mode
7644 cursor. Zero is returned for the leftmost screen position.
7645 <tag/Availability/cc65
7647 <ref id="gotox" name="gotox">,
7648 <ref id="gotoy" name="gotoy">,
7649 <ref id="gotoxy" name="gotoxy">,
7650 <ref id="wherey" name="wherey">
7656 <sect1>wherey<label id="wherey"><p>
7660 <tag/Function/Return the current Y position of the text mode cursor.
7661 <tag/Header/<tt/<ref id="conio.h" name="conio.h">/
7662 <tag/Declaration/<tt/unsigned char wherey (void);/
7663 <tag/Description/The function returns the current Y position of the text mode
7664 cursor. Zero is returned for the uppermost screen position.
7665 <tag/Availability/cc65
7667 <ref id="gotox" name="gotox">,
7668 <ref id="gotoy" name="gotoy">,
7669 <ref id="gotoxy" name="gotoxy">,
7670 <ref id="wherex" name="wherex">